diff --git a/assets/brainchop-webworker-DDjdSg4F.js b/assets/brainchop-webworker-CY-cU9Jz.js similarity index 86% rename from assets/brainchop-webworker-DDjdSg4F.js rename to assets/brainchop-webworker-CY-cU9Jz.js index 1982ef2..6d0a4f0 100644 --- a/assets/brainchop-webworker-DDjdSg4F.js +++ b/assets/brainchop-webworker-CY-cU9Jz.js @@ -1,4 +1,4 @@ -(function(){"use strict";function yw(n,e){return e.forEach(function(t){t&&typeof t!="string"&&!Array.isArray(t)&&Object.keys(t).forEach(function(s){if(s!=="default"&&!(s in n)){var o=Object.getOwnPropertyDescriptor(t,s);Object.defineProperty(n,s,o.get?o:{enumerable:!0,get:function(){return t[s]}})}})}),Object.freeze(n)}/** +(function(){"use strict";function bw(n,e){return e.forEach(function(t){t&&typeof t!="string"&&!Array.isArray(t)&&Object.keys(t).forEach(function(s){if(s!=="default"&&!(s in n)){var o=Object.getOwnPropertyDescriptor(t,s);Object.defineProperty(n,s,o.get?o:{enumerable:!0,get:function(){return t[s]}})}})}),Object.freeze(n)}/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const ww=1e-7,Cw=1e-4;class Lp{constructor(e,t){this.backend=e,this.dataMover=t,this.data=new WeakMap,this.dataIdsCount=0}get(e){return this.data.has(e)||this.dataMover.moveData(this.backend,e),this.data.get(e)}set(e,t){this.dataIdsCount++,this.data.set(e,t)}has(e){return this.data.has(e)}delete(e){return this.dataIdsCount--,this.data.delete(e)}numDataIds(){return this.dataIdsCount}}class Oc{refCount(e){return jt("refCount")}incRef(e){return jt("incRef")}timerAvailable(){return!0}time(e){return jt("time")}read(e){return jt("read")}readSync(e){return jt("readSync")}readToGPU(e,t){return jt("readToGPU")}numDataIds(){return jt("numDataIds")}disposeData(e,t){return jt("disposeData")}write(e,t,s){return jt("write")}move(e,t,s,o,r){return jt("move")}createTensorFromGPUData(e,t,s){return jt("createTensorFromGPUData")}memory(){return jt("memory")}floatPrecision(){return jt("floatPrecision")}epsilon(){return this.floatPrecision()===32?ww:Cw}dispose(){return jt("dispose")}}function jt(n){throw new Error(`'${n}' not yet implemented or not found in the registry. This kernel may not be supported by the tfjs backend you have chosen`)}/** + */const yw=1e-7,ww=1e-4;class Lp{constructor(e,t){this.backend=e,this.dataMover=t,this.data=new WeakMap,this.dataIdsCount=0}get(e){return this.data.has(e)||this.dataMover.moveData(this.backend,e),this.data.get(e)}set(e,t){this.dataIdsCount++,this.data.set(e,t)}has(e){return this.data.has(e)}delete(e){return this.dataIdsCount--,this.data.delete(e)}numDataIds(){return this.dataIdsCount}}class Fc{refCount(e){return jt("refCount")}incRef(e){return jt("incRef")}timerAvailable(){return!0}time(e){return jt("time")}read(e){return jt("read")}readSync(e){return jt("readSync")}readToGPU(e,t){return jt("readToGPU")}numDataIds(){return jt("numDataIds")}disposeData(e,t){return jt("disposeData")}write(e,t,s){return jt("write")}move(e,t,s,o,r){return jt("move")}createTensorFromGPUData(e,t,s){return jt("createTensorFromGPUData")}memory(){return jt("memory")}floatPrecision(){return jt("floatPrecision")}epsilon(){return this.floatPrecision()===32?yw:ww}dispose(){return jt("dispose")}}function jt(n){throw new Error(`'${n}' not yet implemented or not found in the registry. This kernel may not be supported by the tfjs backend you have chosen`)}/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -28,7 +28,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function Iw(n){let e=n.length,t=0;for(;e>0;)t=Math.random()*e|0,e--,Ao(n,e,t)}function Us(n,e,t){return Math.max(n,Math.min(e,t))}function Lc(n){return n%2===0?n:n+1}function Ao(n,e,t){const s=n[e];n[e]=n[t],n[t]=s}function $w(n){let e=0;for(let t=0;tt+` Shapes ${n} and ${e} must match`)}function Mp(n){v(n!=null,()=>"The input to the tensor constructor must be a non-null value.")}function G(n){if(n.length===0)return 1;let e=n[0];for(let t=1;t0,t,s){return new Promise((o,r)=>{let i=0;const a=()=>{if(n()){o();return}i++;const l=e(i);if(t!=null&&i>=t){r();return}s!=null?s(a,l):setTimeout(a,l)};a()})}function Bp(n,e){let t=1,s=-1;for(let r=0;r=0)t*=n[r];else if(n[r]===-1){if(s!==-1)throw Error(`Shapes can only have 1 implicit size. Found -1 at dim ${s} and dim ${r}`);s=r}else if(n[r]<0)throw Error(`Shapes can not be < 0. Found ${n[r]} at dim ${r}`);if(s===-1){if(e>0&&e!==t)throw Error(`Size(${e}) must match the product of shape ${n}`);return n}if(t===0)throw Error(`Cannot infer the missing size in [${n}] when there are 0 elements`);if(e%t!==0)throw Error(`The implicit shape can't be a fractional number. Got ${e} / ${t}`);const o=n.slice();return o[s]=e/t,o}function $e(n,e){const t=e.length;return n=n==null?e.map((s,o)=>o):[].concat(n),v(n.every(s=>s>=-t&&s`All values in axis param must be in range [-${t}, ${t}) but got axis ${n}`),v(n.every(s=>Do(s)),()=>`All values in axis param must be integers but got axis ${n}`),n.map(s=>s<0?t+s:s)}function ms(n,e){const t=[],s=[],o=e!=null&&Array.isArray(e)&&e.length===0,r=e==null||o?null:$e(e,n).sort();let i=0;for(let a=0;aa)&&n[a]===1&&(t.push(n[a]),s.push(a)),r[i]<=a&&i++}n[a]!==1&&(t.push(n[a]),s.push(a))}return{newShape:t,keptDims:s}}function Tt(n,e){return et(n,e)}function et(n,e){let t=null;if(n==null||n==="float32")t=new Float32Array(e);else if(n==="int32")t=new Int32Array(e);else if(n==="bool")t=new Uint8Array(e);else if(n==="string")t=new Array(e);else throw new Error(`Unknown data type ${n}`);return t}function kw(n,e){for(let t=0;te+=t.length),e}function br(n){return typeof n=="string"||n instanceof String}function Tw(n){return typeof n=="boolean"}function Bc(n){return typeof n=="number"}function _o(n){return Array.isArray(n)?_o(n[0]):n instanceof Float32Array?"float32":n instanceof Int32Array||n instanceof Uint8Array||n instanceof Uint8ClampedArray?"int32":Bc(n)?"float32":br(n)?"string":Tw(n)?"bool":"float32"}function zc(n){return!!(n&&n.constructor&&n.call&&n.apply)}function Vc(n,e){for(let t=e;t=0;--s)t[s]=t[s+1]*n[s+1];return t}function Vp(n,e,t,s=!1){const o=new Array;if(e.length===1){const r=e[0]*(s?2:1);for(let i=0;il*c)*(s?2:1);for(let l=0;lo*r)*(t?2:1);if(s===0)return[];if(s!==e.length)throw new Error(`[${n}] does not match the input size ${e.length}${t?" for a complex tensor":""}.`);return Vp(0,n,e,t)}function Nw(n,e){if(Array.isArray(n))return n;if(e==="float32")return n instanceof Float32Array?n:new Float32Array(n);if(e==="int32")return n instanceof Int32Array?n:new Int32Array(n);if(e==="bool"||e==="string")return Uint8Array.from(new Int32Array(n));throw new Error(`Unknown dtype ${e}`)}function Wc(n,e){const t=Nt(n,e);for(let s=0;ss*o,1);if(e==null||e==="float32")return $n(n,new Float32Array(t));if(e==="int32")return $n(n,new Int32Array(t));if(e==="bool")return $n(n,new Uint8Array(t));throw new Error(`Unknown data type ${e}`)}function ns(n){n.forEach(e=>{v(Number.isInteger(e)&&e>=0,()=>`Tensor must have a shape comprised of positive integers but got shape [${n}].`)})}function Pn(n,e,t){if(e===0)return 0;if(e===1)return n[0];let s=n[n.length-1];for(let o=0;o0;)t=Math.random()*e|0,e--,Ao(n,e,t)}function Us(n,e,t){return Math.max(n,Math.min(e,t))}function _c(n){return n%2===0?n:n+1}function Ao(n,e,t){const s=n[e];n[e]=n[t],n[t]=s}function Iw(n){let e=0;for(let t=0;tt+` Shapes ${n} and ${e} must match`)}function Mp(n){k(n!=null,()=>"The input to the tensor constructor must be a non-null value.")}function G(n){if(n.length===0)return 1;let e=n[0];for(let t=1;t0,t,s){return new Promise((o,r)=>{let i=0;const a=()=>{if(n()){o();return}i++;const l=e(i);if(t!=null&&i>=t){r();return}s!=null?s(a,l):setTimeout(a,l)};a()})}function Bp(n,e){let t=1,s=-1;for(let r=0;r=0)t*=n[r];else if(n[r]===-1){if(s!==-1)throw Error(`Shapes can only have 1 implicit size. Found -1 at dim ${s} and dim ${r}`);s=r}else if(n[r]<0)throw Error(`Shapes can not be < 0. Found ${n[r]} at dim ${r}`);if(s===-1){if(e>0&&e!==t)throw Error(`Size(${e}) must match the product of shape ${n}`);return n}if(t===0)throw Error(`Cannot infer the missing size in [${n}] when there are 0 elements`);if(e%t!==0)throw Error(`The implicit shape can't be a fractional number. Got ${e} / ${t}`);const o=n.slice();return o[s]=e/t,o}function $e(n,e){const t=e.length;return n=n==null?e.map((s,o)=>o):[].concat(n),k(n.every(s=>s>=-t&&s`All values in axis param must be in range [-${t}, ${t}) but got axis ${n}`),k(n.every(s=>Do(s)),()=>`All values in axis param must be integers but got axis ${n}`),n.map(s=>s<0?t+s:s)}function ms(n,e){const t=[],s=[],o=e!=null&&Array.isArray(e)&&e.length===0,r=e==null||o?null:$e(e,n).sort();let i=0;for(let a=0;aa)&&n[a]===1&&(t.push(n[a]),s.push(a)),r[i]<=a&&i++}n[a]!==1&&(t.push(n[a]),s.push(a))}return{newShape:t,keptDims:s}}function Tt(n,e){return et(n,e)}function et(n,e){let t=null;if(n==null||n==="float32")t=new Float32Array(e);else if(n==="int32")t=new Int32Array(e);else if(n==="bool")t=new Uint8Array(e);else if(n==="string")t=new Array(e);else throw new Error(`Unknown data type ${n}`);return t}function $w(n,e){for(let t=0;te+=t.length),e}function br(n){return typeof n=="string"||n instanceof String}function Sw(n){return typeof n=="boolean"}function Mc(n){return typeof n=="number"}function _o(n){return Array.isArray(n)?_o(n[0]):n instanceof Float32Array?"float32":n instanceof Int32Array||n instanceof Uint8Array||n instanceof Uint8ClampedArray?"int32":Mc(n)?"float32":br(n)?"string":Sw(n)?"bool":"float32"}function Pc(n){return!!(n&&n.constructor&&n.call&&n.apply)}function Bc(n,e){for(let t=e;t=0;--s)t[s]=t[s+1]*n[s+1];return t}function Vp(n,e,t,s=!1){const o=new Array;if(e.length===1){const r=e[0]*(s?2:1);for(let i=0;il*c)*(s?2:1);for(let l=0;lo*r)*(t?2:1);if(s===0)return[];if(s!==e.length)throw new Error(`[${n}] does not match the input size ${e.length}${t?" for a complex tensor":""}.`);return Vp(0,n,e,t)}function Tw(n,e){if(Array.isArray(n))return n;if(e==="float32")return n instanceof Float32Array?n:new Float32Array(n);if(e==="int32")return n instanceof Int32Array?n:new Int32Array(n);if(e==="bool"||e==="string")return Uint8Array.from(new Int32Array(n));throw new Error(`Unknown dtype ${e}`)}function zc(n,e){const t=Nt(n,e);for(let s=0;ss*o,1);if(e==null||e==="float32")return $n(n,new Float32Array(t));if(e==="int32")return $n(n,new Int32Array(t));if(e==="bool")return $n(n,new Uint8Array(t));throw new Error(`Unknown data type ${e}`)}function ns(n){n.forEach(e=>{k(Number.isInteger(e)&&e>=0,()=>`Tensor must have a shape comprised of positive integers but got shape [${n}].`)})}function Pn(n,e,t){if(e===0)return 0;if(e===1)return n[0];let s=n[n.length-1];for(let o=0;o"u"||typeof this.global.location>"u"||typeof this.global.location.search>"u")return;const e=this.getQueryParams(this.global.location.search);Up in e&&e[Up].split(",").forEach(s=>{const[o,r]=s.split(":");this.urlFlags[o]=Dw(o,r)})}}function Rw(n){const e={};return n.replace(/[?&]([^=?&]+)(?:=([^&]*))?/g,(t,...s)=>(Aw(e,s[0],s[1]),s.join("="))),e}function Aw(n,e,t){n[decodeURIComponent(e)]=decodeURIComponent(t||"")}function Dw(n,e){const t=e.toLowerCase();return t==="true"||t==="false"?t==="true":`${+t}`===t?+t:e}function V(){return yr}let yr=null;function Fw(n){yr=n}/** + */const Up="tfjsflags";class Nw{constructor(e){this.global=e,this.flags={},this.flagRegistry={},this.urlFlags={},this.getQueryParams=Ew,this.populateURLFlags()}setPlatform(e,t){this.platform!=null&&(V().getBool("IS_TEST")||V().getBool("PROD")||console.warn(`Platform ${this.platformName} has already been set. Overwriting the platform with ${e}.`)),this.platformName=e,this.platform=t}registerFlag(e,t,s){if(this.flagRegistry[e]={evaluationFn:t,setHook:s},this.urlFlags[e]!=null){const o=this.urlFlags[e];V().getBool("IS_TEST")||V().getBool("PROD")||console.warn(`Setting feature override from URL ${e}: ${o}.`),this.set(e,o)}}async getAsync(e){return e in this.flags?this.flags[e]:(this.flags[e]=await this.evaluateFlag(e),this.flags[e])}get(e){if(e in this.flags)return this.flags[e];const t=this.evaluateFlag(e);if(Vc(t))throw new Error(`Flag ${e} cannot be synchronously evaluated. Please use getAsync() instead.`);return this.flags[e]=t,this.flags[e]}getNumber(e){return this.get(e)}getBool(e){return this.get(e)}getString(e){return this.get(e)}getFlags(){return this.flags}get features(){return this.flags}set(e,t){if(this.flagRegistry[e]==null)throw new Error(`Cannot set flag ${e} as it has not been registered.`);this.flags[e]=t,this.flagRegistry[e].setHook!=null&&this.flagRegistry[e].setHook(t)}evaluateFlag(e){if(this.flagRegistry[e]==null)throw new Error(`Cannot evaluate flag '${e}': no evaluation function found.`);return this.flagRegistry[e].evaluationFn()}setFlags(e){this.flags=Object.assign({},e)}reset(){this.flags={},this.urlFlags={},this.populateURLFlags()}populateURLFlags(){if(typeof this.global>"u"||typeof this.global.location>"u"||typeof this.global.location.search>"u")return;const e=this.getQueryParams(this.global.location.search);Up in e&&e[Up].split(",").forEach(s=>{const[o,r]=s.split(":");this.urlFlags[o]=Aw(o,r)})}}function Ew(n){const e={};return n.replace(/[?&]([^=?&]+)(?:=([^&]*))?/g,(t,...s)=>(Rw(e,s[0],s[1]),s.join("="))),e}function Rw(n,e,t){n[decodeURIComponent(e)]=decodeURIComponent(t||"")}function Aw(n,e){const t=e.toLowerCase();return t==="true"||t==="false"?t==="true":`${+t}`===t?+t:e}function V(){return yr}let yr=null;function Dw(n){yr=n}/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -58,7 +58,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */let Gc;function Gp(){if(Gc==null){let n;if(typeof window<"u")n=window;else if(typeof global<"u")n=global;else if(typeof process<"u")n=process;else if(typeof self<"u")n=self;else throw new Error("Could not find a global object");Gc=n}return Gc}function _w(){const n=Gp();return n._tfGlobals==null&&(n._tfGlobals=new Map),n._tfGlobals}function Hc(n,e){const t=_w();if(t.has(n))return t.get(n);{const s=e();return t.set(n,s),t.get(n)}}const ca="Abs",wr="Acos",Cr="Acosh",Lo="Add",qc="AddN",jc="All",Kc="Any",ua="ArgMax",ha="ArgMin",Ir="Asin",$r="Asinh",kr="Atan",vr="Atanh",Sr="Atan2",da="AvgPool",Xc="AvgPoolGrad",pa="AvgPool3D",Yc="AvgPool3DGrad",fa="BatchMatMul",ma="BatchToSpaceND",Zc="Bincount",Qc="BitwiseAnd",Ow="BroadcastTo",Hp="BroadcastArgs",Tr="Cast",Nr="Ceil",Er="ClipByValue",Jc="Complex",ga="ComplexAbs",xa="Concat",ba="Conv2D",eu="Conv2DBackpropFilter",ya="Conv2DBackpropInput",wa="Conv3D",tu="Conv3DBackpropFilterV2",nu="Conv3DBackpropInputV2",Rr="Cos",Ar="Cosh",su="Cumprod",Ca="Cumsum",ou="CropAndResize",ru="DenseBincount",iu="DepthToSpace",Ia="DepthwiseConv2dNative",au="DepthwiseConv2dNativeBackpropFilter",lu="DepthwiseConv2dNativeBackpropInput",qp="Diag",$a="Dilation2D",cu="Dilation2DBackpropInput",uu="Dilation2DBackpropFilter",Lw="Draw",Dr="RealDiv",hu="Einsum",Fr="Elu",du="EluGrad",_r="Erf",ka="Equal",Or="Exp",va="ExpandDims",Lr="Expm1",pu="FFT",fu="Fill",mu="FlipLeftRight",Mr="Floor",Pr="FloorDiv",Sa="FusedBatchNorm",Ta="GatherV2",jp="GatherNd",Na="Greater",Br="GreaterEqual",zr="Identity",gu="IFFT",xu="Imag",Vr="IsFinite",Wr="IsInf",Ur="IsNan",Ea="LeakyRelu",Ra="Less",Aa="LessEqual",Kp="LinSpace",Gr="Log",Hr="Log1p",Da="LogicalAnd",Fa="LogicalNot",_a="LogicalOr",Mw="LogSoftmax",Oa="LRN",bu="LRNGrad",La="Max",qr="Maximum",Ma="MaxPool",yu="MaxPoolGrad",Pa="MaxPool3D",wu="MaxPool3DGrad",Xp="MaxPoolWithArgmax",Ba="Mean",za="Min",jr="Minimum",Va="MirrorPad",Kr="Mod",Yp="Multinomial",Xr="Multiply",Wa="Neg",Ua="NotEqual",Cu="NonMaxSuppressionV3",Iu="NonMaxSuppressionV4",$u="NonMaxSuppressionV5",Ga="OnesLike",Ha="OneHot",qa="Pack",ja="PadV2",Yr="Pow",Ka="Prelu",Xa="Prod",Zp="RaggedGather",Qp="RaggedRange",Jp="RaggedTensorToTensor",ku="Range",vu="Real",Zr="Reciprocal",Qr="Relu",Ya="Reshape",Za="ResizeNearestNeighbor",Su="ResizeNearestNeighborGrad",Qa="ResizeBilinear",Tu="ResizeBilinearGrad",Jr="Relu6",Ja="Reverse",ei="Round",ti="Rsqrt",ef="ScatterNd",tf="TensorScatterUpdate",nf="SearchSorted",el="Select",ni="Selu",tl="Slice",si="Sin",oi="Sinh",ri="Sign",ii="Sigmoid",ai="Softplus",li="Sqrt",nl="Sum",sl="SpaceToBatchND",ol="SplitV",rl="Softmax",sf="SparseFillEmptyRows",of="SparseReshape",rf="SparseSegmentMean",af="SparseSegmentSum",lf="SparseToDense",ci="SquaredDifference",Nu="Square",Eu="StaticRegexReplace",Ru="StridedSlice",cf="StringNGrams",uf="StringSplit",hf="StringToHashBucketFast",ui="Sub",hi="Tan",di="Tanh",pi="Tile",Au="TopK",Du="Transform",Mo="Transpose",Fu="Unique",il="Unpack",al="UnsortedSegmentSum",ll="ZerosLike",fi="Step",Pw="FromPixels",_u="RotateWithOffset",cl="_FusedMatMul",ul="FusedConv2D",df="FusedDepthwiseConv2D";/** + */let Wc;function Gp(){if(Wc==null){let n;if(typeof window<"u")n=window;else if(typeof global<"u")n=global;else if(typeof process<"u")n=process;else if(typeof self<"u")n=self;else throw new Error("Could not find a global object");Wc=n}return Wc}function Fw(){const n=Gp();return n._tfGlobals==null&&(n._tfGlobals=new Map),n._tfGlobals}function Uc(n,e){const t=Fw();if(t.has(n))return t.get(n);{const s=e();return t.set(n,s),t.get(n)}}const ca="Abs",wr="Acos",Cr="Acosh",Lo="Add",Gc="AddN",Hc="All",qc="Any",ua="ArgMax",ha="ArgMin",Ir="Asin",$r="Asinh",kr="Atan",vr="Atanh",Sr="Atan2",da="AvgPool",jc="AvgPoolGrad",pa="AvgPool3D",Kc="AvgPool3DGrad",fa="BatchMatMul",ma="BatchToSpaceND",Xc="Bincount",Yc="BitwiseAnd",_w="BroadcastTo",Hp="BroadcastArgs",Tr="Cast",Nr="Ceil",Er="ClipByValue",Zc="Complex",ga="ComplexAbs",xa="Concat",ba="Conv2D",Qc="Conv2DBackpropFilter",ya="Conv2DBackpropInput",wa="Conv3D",Jc="Conv3DBackpropFilterV2",eu="Conv3DBackpropInputV2",Rr="Cos",Ar="Cosh",tu="Cumprod",Ca="Cumsum",nu="CropAndResize",su="DenseBincount",ou="DepthToSpace",Ia="DepthwiseConv2dNative",ru="DepthwiseConv2dNativeBackpropFilter",iu="DepthwiseConv2dNativeBackpropInput",qp="Diag",$a="Dilation2D",au="Dilation2DBackpropInput",lu="Dilation2DBackpropFilter",Ow="Draw",Dr="RealDiv",cu="Einsum",Fr="Elu",uu="EluGrad",_r="Erf",ka="Equal",Or="Exp",va="ExpandDims",Lr="Expm1",hu="FFT",du="Fill",pu="FlipLeftRight",Mr="Floor",Pr="FloorDiv",Sa="FusedBatchNorm",Ta="GatherV2",jp="GatherNd",Na="Greater",Br="GreaterEqual",zr="Identity",fu="IFFT",mu="Imag",Vr="IsFinite",Wr="IsInf",Ur="IsNan",Ea="LeakyRelu",Ra="Less",Aa="LessEqual",Kp="LinSpace",Gr="Log",Hr="Log1p",Da="LogicalAnd",Fa="LogicalNot",_a="LogicalOr",Lw="LogSoftmax",Oa="LRN",gu="LRNGrad",La="Max",qr="Maximum",Ma="MaxPool",xu="MaxPoolGrad",Pa="MaxPool3D",bu="MaxPool3DGrad",Xp="MaxPoolWithArgmax",Ba="Mean",za="Min",jr="Minimum",Va="MirrorPad",Kr="Mod",Yp="Multinomial",Xr="Multiply",Wa="Neg",Ua="NotEqual",yu="NonMaxSuppressionV3",wu="NonMaxSuppressionV4",Cu="NonMaxSuppressionV5",Ga="OnesLike",Ha="OneHot",qa="Pack",ja="PadV2",Yr="Pow",Ka="Prelu",Xa="Prod",Zp="RaggedGather",Qp="RaggedRange",Jp="RaggedTensorToTensor",Iu="Range",$u="Real",Zr="Reciprocal",Qr="Relu",Ya="Reshape",Za="ResizeNearestNeighbor",ku="ResizeNearestNeighborGrad",Qa="ResizeBilinear",vu="ResizeBilinearGrad",Jr="Relu6",Ja="Reverse",ei="Round",ti="Rsqrt",ef="ScatterNd",tf="TensorScatterUpdate",nf="SearchSorted",el="Select",ni="Selu",tl="Slice",si="Sin",oi="Sinh",ri="Sign",ii="Sigmoid",ai="Softplus",li="Sqrt",nl="Sum",sl="SpaceToBatchND",ol="SplitV",rl="Softmax",sf="SparseFillEmptyRows",of="SparseReshape",rf="SparseSegmentMean",af="SparseSegmentSum",lf="SparseToDense",ci="SquaredDifference",Su="Square",Tu="StaticRegexReplace",Nu="StridedSlice",cf="StringNGrams",uf="StringSplit",hf="StringToHashBucketFast",ui="Sub",hi="Tan",di="Tanh",pi="Tile",Eu="TopK",Ru="Transform",Mo="Transpose",Au="Unique",il="Unpack",al="UnsortedSegmentSum",ll="ZerosLike",fi="Step",Mw="FromPixels",Du="RotateWithOffset",cl="_FusedMatMul",ul="FusedConv2D",df="FusedDepthwiseConv2D";/** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -73,7 +73,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function tn(...n){V().getBool("IS_TEST")||V().getBool("PROD")||console.warn(...n)}function Bw(...n){V().getBool("IS_TEST")||V().getBool("PROD")||console.log(...n)}/** + */function tn(...n){V().getBool("IS_TEST")||V().getBool("PROD")||console.warn(...n)}function Pw(...n){V().getBool("IS_TEST")||V().getBool("PROD")||console.log(...n)}/** * @license * Copyright 2019 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -88,7 +88,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const hl=Hc("kernelRegistry",()=>new Map),Ou=Hc("gradRegistry",()=>new Map);function pf(n,e){const t=xf(n,e);return hl.get(t)}function ff(n){return Ou.get(n)}function mf(n){const e=hl.entries(),t=[];for(;;){const{done:s,value:o}=e.next();if(s)break;const[r,i]=o,[a]=r.split("_");a===n&&t.push(i)}return t}function gf(n){const{kernelName:e,backendName:t}=n,s=xf(e,t);hl.has(s)&&tn(`The kernel '${e}' for backend '${t}' is already registered`),hl.set(s,n)}function zw(n){const{kernelName:e}=n;Ou.has(e)&&V().getBool("DEBUG")&&tn(`Overriding the gradient for '${e}'`),Ou.set(e,n)}function xf(n,e){return`${e}_${n}`}/** + */const hl=Uc("kernelRegistry",()=>new Map),Fu=Uc("gradRegistry",()=>new Map);function pf(n,e){const t=xf(n,e);return hl.get(t)}function ff(n){return Fu.get(n)}function mf(n){const e=hl.entries(),t=[];for(;;){const{done:s,value:o}=e.next();if(s)break;const[r,i]=o,[a]=r.split("_");a===n&&t.push(i)}return t}function gf(n){const{kernelName:e,backendName:t}=n,s=xf(e,t);hl.has(s)&&tn(`The kernel '${e}' for backend '${t}' is already registered`),hl.set(s,n)}function Bw(n){const{kernelName:e}=n;Fu.has(e)&&V().getBool("DEBUG")&&tn(`Overriding the gradient for '${e}'`),Fu.set(e,n)}function xf(n,e){return`${e}_${n}`}/** * @license * Copyright 2023 Google LLC. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -103,7 +103,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function bf(n){return n instanceof Float32Array||n instanceof Int32Array||n instanceof Uint8Array||n instanceof Uint8ClampedArray}var Gs=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Vw(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}function Ww(n){if(n.__esModule)return n;var e=n.default;if(typeof e=="function"){var t=function s(){return this instanceof s?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(n).forEach(function(s){var o=Object.getOwnPropertyDescriptor(n,s);Object.defineProperty(t,s,o.get?o:{enumerable:!0,get:function(){return n[s]}})}),t}var yf=Ge,ln=null;try{ln=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch{}function Ge(n,e,t){this.low=n|0,this.high=e|0,this.unsigned=!!t}Ge.prototype.__isLong__,Object.defineProperty(Ge.prototype,"__isLong__",{value:!0});function Kt(n){return(n&&n.__isLong__)===!0}Ge.isLong=Kt;var wf={},Cf={};function Hs(n,e){var t,s,o;return e?(n>>>=0,(o=0<=n&&n<256)&&(s=Cf[n],s)?s:(t=He(n,(n|0)<0?-1:0,!0),o&&(Cf[n]=t),t)):(n|=0,(o=-128<=n&&n<128)&&(s=wf[n],s)?s:(t=He(n,n<0?-1:0,!1),o&&(wf[n]=t),t))}Ge.fromInt=Hs;function cn(n,e){if(isNaN(n))return e?qs:un;if(e){if(n<0)return qs;if(n>=$f)return Nf}else{if(n<=-kf)return Xt;if(n+1>=kf)return Tf}return n<0?cn(-n,e).neg():He(n%Po|0,n/Po|0,e)}Ge.fromNumber=cn;function He(n,e,t){return new Ge(n,e,t)}Ge.fromBits=He;var dl=Math.pow;function Lu(n,e,t){if(n.length===0)throw Error("empty string");if(n==="NaN"||n==="Infinity"||n==="+Infinity"||n==="-Infinity")return un;if(typeof e=="number"?(t=e,e=!1):e=!!e,t=t||10,t<2||360)throw Error("interior hyphen");if(s===0)return Lu(n.substring(1),e,t).neg();for(var o=cn(dl(t,8)),r=un,i=0;i>>0:this.low},oe.toNumber=function(){return this.unsigned?(this.high>>>0)*Po+(this.low>>>0):this.high*Po+(this.low>>>0)},oe.toString=function(e){if(e=e||10,e<2||36>>0,u=c.toString(e);if(i=l,i.isZero())return u+a;for(;u.length<6;)u="0"+u;a=""+u+a}},oe.getHighBits=function(){return this.high},oe.getHighBitsUnsigned=function(){return this.high>>>0},oe.getLowBits=function(){return this.low},oe.getLowBitsUnsigned=function(){return this.low>>>0},oe.getNumBitsAbs=function(){if(this.isNegative())return this.eq(Xt)?64:this.neg().getNumBitsAbs();for(var e=this.high!=0?this.high:this.low,t=31;t>0&&!(e&1<=0},oe.isOdd=function(){return(this.low&1)===1},oe.isEven=function(){return(this.low&1)===0},oe.equals=function(e){return Kt(e)||(e=kn(e)),this.unsigned!==e.unsigned&&this.high>>>31===1&&e.high>>>31===1?!1:this.high===e.high&&this.low===e.low},oe.eq=oe.equals,oe.notEquals=function(e){return!this.eq(e)},oe.neq=oe.notEquals,oe.ne=oe.notEquals,oe.lessThan=function(e){return this.comp(e)<0},oe.lt=oe.lessThan,oe.lessThanOrEqual=function(e){return this.comp(e)<=0},oe.lte=oe.lessThanOrEqual,oe.le=oe.lessThanOrEqual,oe.greaterThan=function(e){return this.comp(e)>0},oe.gt=oe.greaterThan,oe.greaterThanOrEqual=function(e){return this.comp(e)>=0},oe.gte=oe.greaterThanOrEqual,oe.ge=oe.greaterThanOrEqual,oe.compare=function(e){if(Kt(e)||(e=kn(e)),this.eq(e))return 0;var t=this.isNegative(),s=e.isNegative();return t&&!s?-1:!t&&s?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1},oe.comp=oe.compare,oe.negate=function(){return!this.unsigned&&this.eq(Xt)?Xt:this.not().add(Bo)},oe.neg=oe.negate,oe.add=function(e){Kt(e)||(e=kn(e));var t=this.high>>>16,s=this.high&65535,o=this.low>>>16,r=this.low&65535,i=e.high>>>16,a=e.high&65535,l=e.low>>>16,c=e.low&65535,u=0,h=0,d=0,p=0;return p+=r+c,d+=p>>>16,p&=65535,d+=o+l,h+=d>>>16,d&=65535,h+=s+a,u+=h>>>16,h&=65535,u+=t+i,u&=65535,He(d<<16|p,u<<16|h,this.unsigned)},oe.subtract=function(e){return Kt(e)||(e=kn(e)),this.add(e.neg())},oe.sub=oe.subtract,oe.multiply=function(e){if(this.isZero())return un;if(Kt(e)||(e=kn(e)),ln){var t=ln.mul(this.low,this.high,e.low,e.high);return He(t,ln.get_high(),this.unsigned)}if(e.isZero())return un;if(this.eq(Xt))return e.isOdd()?Xt:un;if(e.eq(Xt))return this.isOdd()?Xt:un;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(vf)&&e.lt(vf))return cn(this.toNumber()*e.toNumber(),this.unsigned);var s=this.high>>>16,o=this.high&65535,r=this.low>>>16,i=this.low&65535,a=e.high>>>16,l=e.high&65535,c=e.low>>>16,u=e.low&65535,h=0,d=0,p=0,f=0;return f+=i*u,p+=f>>>16,f&=65535,p+=r*u,d+=p>>>16,p&=65535,p+=i*c,d+=p>>>16,p&=65535,d+=o*u,h+=d>>>16,d&=65535,d+=r*c,h+=d>>>16,d&=65535,d+=i*l,h+=d>>>16,d&=65535,h+=s*u+o*c+r*l+i*a,h&=65535,He(p<<16|f,h<<16|d,this.unsigned)},oe.mul=oe.multiply,oe.divide=function(e){if(Kt(e)||(e=kn(e)),e.isZero())throw Error("division by zero");if(ln){if(!this.unsigned&&this.high===-2147483648&&e.low===-1&&e.high===-1)return this;var t=(this.unsigned?ln.div_u:ln.div_s)(this.low,this.high,e.low,e.high);return He(t,ln.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?qs:un;var s,o,r;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return qs;if(e.gt(this.shru(1)))return Sf;r=qs}else{if(this.eq(Xt)){if(e.eq(Bo)||e.eq(Mu))return Xt;if(e.eq(Xt))return Bo;var i=this.shr(1);return s=i.div(e).shl(1),s.eq(un)?e.isNegative()?Bo:Mu:(o=this.sub(e.mul(s)),r=s.add(o.div(e)),r)}else if(e.eq(Xt))return this.unsigned?qs:un;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();r=un}for(o=this;o.gte(e);){s=Math.max(1,Math.floor(o.toNumber()/e.toNumber()));for(var a=Math.ceil(Math.log(s)/Math.LN2),l=a<=48?1:dl(2,a-48),c=cn(s),u=c.mul(e);u.isNegative()||u.gt(o);)s-=l,c=cn(s,this.unsigned),u=c.mul(e);c.isZero()&&(c=Bo),r=r.add(c),o=o.sub(u)}return r},oe.div=oe.divide,oe.modulo=function(e){if(Kt(e)||(e=kn(e)),ln){var t=(this.unsigned?ln.rem_u:ln.rem_s)(this.low,this.high,e.low,e.high);return He(t,ln.get_high(),this.unsigned)}return this.sub(this.div(e).mul(e))},oe.mod=oe.modulo,oe.rem=oe.modulo,oe.not=function(){return He(~this.low,~this.high,this.unsigned)},oe.and=function(e){return Kt(e)||(e=kn(e)),He(this.low&e.low,this.high&e.high,this.unsigned)},oe.or=function(e){return Kt(e)||(e=kn(e)),He(this.low|e.low,this.high|e.high,this.unsigned)},oe.xor=function(e){return Kt(e)||(e=kn(e)),He(this.low^e.low,this.high^e.high,this.unsigned)},oe.shiftLeft=function(e){return Kt(e)&&(e=e.toInt()),(e&=63)===0?this:e<32?He(this.low<>>32-e,this.unsigned):He(0,this.low<>>e|this.high<<32-e,this.high>>e,this.unsigned):He(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},oe.shr=oe.shiftRight,oe.shiftRightUnsigned=function(e){if(Kt(e)&&(e=e.toInt()),e&=63,e===0)return this;var t=this.high;if(e<32){var s=this.low;return He(s>>>e|t<<32-e,t>>>e,this.unsigned)}else return e===32?He(t,0,this.unsigned):He(t>>>e-32,0,this.unsigned)},oe.shru=oe.shiftRightUnsigned,oe.shr_u=oe.shiftRightUnsigned,oe.toSigned=function(){return this.unsigned?He(this.low,this.high,!1):this},oe.toUnsigned=function(){return this.unsigned?this:He(this.low,this.high,!0)},oe.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},oe.toBytesLE=function(){var e=this.high,t=this.low;return[t&255,t>>>8&255,t>>>16&255,t>>>24,e&255,e>>>8&255,e>>>16&255,e>>>24]},oe.toBytesBE=function(){var e=this.high,t=this.low;return[e>>>24,e>>>16&255,e>>>8&255,e&255,t>>>24,t>>>16&255,t>>>8&255,t&255]},Ge.fromBytes=function(e,t,s){return s?Ge.fromBytesLE(e,t):Ge.fromBytesBE(e,t)},Ge.fromBytesLE=function(e,t){return new Ge(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24,t)},Ge.fromBytesBE=function(e,t){return new Ge(e[4]<<24|e[5]<<16|e[6]<<8|e[7],e[0]<<24|e[1]<<16|e[2]<<8|e[3],t)};var Ef=Vw(yf),Gw=yw({__proto__:null,default:Ef},[yf]);/** + */function bf(n){return n instanceof Float32Array||n instanceof Int32Array||n instanceof Uint8Array||n instanceof Uint8ClampedArray}var Gs=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function zw(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}function Vw(n){if(n.__esModule)return n;var e=n.default;if(typeof e=="function"){var t=function s(){return this instanceof s?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(n).forEach(function(s){var o=Object.getOwnPropertyDescriptor(n,s);Object.defineProperty(t,s,o.get?o:{enumerable:!0,get:function(){return n[s]}})}),t}var yf=Ge,ln=null;try{ln=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch{}function Ge(n,e,t){this.low=n|0,this.high=e|0,this.unsigned=!!t}Ge.prototype.__isLong__,Object.defineProperty(Ge.prototype,"__isLong__",{value:!0});function Kt(n){return(n&&n.__isLong__)===!0}Ge.isLong=Kt;var wf={},Cf={};function Hs(n,e){var t,s,o;return e?(n>>>=0,(o=0<=n&&n<256)&&(s=Cf[n],s)?s:(t=He(n,(n|0)<0?-1:0,!0),o&&(Cf[n]=t),t)):(n|=0,(o=-128<=n&&n<128)&&(s=wf[n],s)?s:(t=He(n,n<0?-1:0,!1),o&&(wf[n]=t),t))}Ge.fromInt=Hs;function cn(n,e){if(isNaN(n))return e?qs:un;if(e){if(n<0)return qs;if(n>=$f)return Nf}else{if(n<=-kf)return Xt;if(n+1>=kf)return Tf}return n<0?cn(-n,e).neg():He(n%Po|0,n/Po|0,e)}Ge.fromNumber=cn;function He(n,e,t){return new Ge(n,e,t)}Ge.fromBits=He;var dl=Math.pow;function _u(n,e,t){if(n.length===0)throw Error("empty string");if(n==="NaN"||n==="Infinity"||n==="+Infinity"||n==="-Infinity")return un;if(typeof e=="number"?(t=e,e=!1):e=!!e,t=t||10,t<2||360)throw Error("interior hyphen");if(s===0)return _u(n.substring(1),e,t).neg();for(var o=cn(dl(t,8)),r=un,i=0;i>>0:this.low},oe.toNumber=function(){return this.unsigned?(this.high>>>0)*Po+(this.low>>>0):this.high*Po+(this.low>>>0)},oe.toString=function(e){if(e=e||10,e<2||36>>0,u=c.toString(e);if(i=l,i.isZero())return u+a;for(;u.length<6;)u="0"+u;a=""+u+a}},oe.getHighBits=function(){return this.high},oe.getHighBitsUnsigned=function(){return this.high>>>0},oe.getLowBits=function(){return this.low},oe.getLowBitsUnsigned=function(){return this.low>>>0},oe.getNumBitsAbs=function(){if(this.isNegative())return this.eq(Xt)?64:this.neg().getNumBitsAbs();for(var e=this.high!=0?this.high:this.low,t=31;t>0&&!(e&1<=0},oe.isOdd=function(){return(this.low&1)===1},oe.isEven=function(){return(this.low&1)===0},oe.equals=function(e){return Kt(e)||(e=kn(e)),this.unsigned!==e.unsigned&&this.high>>>31===1&&e.high>>>31===1?!1:this.high===e.high&&this.low===e.low},oe.eq=oe.equals,oe.notEquals=function(e){return!this.eq(e)},oe.neq=oe.notEquals,oe.ne=oe.notEquals,oe.lessThan=function(e){return this.comp(e)<0},oe.lt=oe.lessThan,oe.lessThanOrEqual=function(e){return this.comp(e)<=0},oe.lte=oe.lessThanOrEqual,oe.le=oe.lessThanOrEqual,oe.greaterThan=function(e){return this.comp(e)>0},oe.gt=oe.greaterThan,oe.greaterThanOrEqual=function(e){return this.comp(e)>=0},oe.gte=oe.greaterThanOrEqual,oe.ge=oe.greaterThanOrEqual,oe.compare=function(e){if(Kt(e)||(e=kn(e)),this.eq(e))return 0;var t=this.isNegative(),s=e.isNegative();return t&&!s?-1:!t&&s?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1},oe.comp=oe.compare,oe.negate=function(){return!this.unsigned&&this.eq(Xt)?Xt:this.not().add(Bo)},oe.neg=oe.negate,oe.add=function(e){Kt(e)||(e=kn(e));var t=this.high>>>16,s=this.high&65535,o=this.low>>>16,r=this.low&65535,i=e.high>>>16,a=e.high&65535,l=e.low>>>16,c=e.low&65535,u=0,h=0,d=0,p=0;return p+=r+c,d+=p>>>16,p&=65535,d+=o+l,h+=d>>>16,d&=65535,h+=s+a,u+=h>>>16,h&=65535,u+=t+i,u&=65535,He(d<<16|p,u<<16|h,this.unsigned)},oe.subtract=function(e){return Kt(e)||(e=kn(e)),this.add(e.neg())},oe.sub=oe.subtract,oe.multiply=function(e){if(this.isZero())return un;if(Kt(e)||(e=kn(e)),ln){var t=ln.mul(this.low,this.high,e.low,e.high);return He(t,ln.get_high(),this.unsigned)}if(e.isZero())return un;if(this.eq(Xt))return e.isOdd()?Xt:un;if(e.eq(Xt))return this.isOdd()?Xt:un;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(vf)&&e.lt(vf))return cn(this.toNumber()*e.toNumber(),this.unsigned);var s=this.high>>>16,o=this.high&65535,r=this.low>>>16,i=this.low&65535,a=e.high>>>16,l=e.high&65535,c=e.low>>>16,u=e.low&65535,h=0,d=0,p=0,f=0;return f+=i*u,p+=f>>>16,f&=65535,p+=r*u,d+=p>>>16,p&=65535,p+=i*c,d+=p>>>16,p&=65535,d+=o*u,h+=d>>>16,d&=65535,d+=r*c,h+=d>>>16,d&=65535,d+=i*l,h+=d>>>16,d&=65535,h+=s*u+o*c+r*l+i*a,h&=65535,He(p<<16|f,h<<16|d,this.unsigned)},oe.mul=oe.multiply,oe.divide=function(e){if(Kt(e)||(e=kn(e)),e.isZero())throw Error("division by zero");if(ln){if(!this.unsigned&&this.high===-2147483648&&e.low===-1&&e.high===-1)return this;var t=(this.unsigned?ln.div_u:ln.div_s)(this.low,this.high,e.low,e.high);return He(t,ln.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?qs:un;var s,o,r;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return qs;if(e.gt(this.shru(1)))return Sf;r=qs}else{if(this.eq(Xt)){if(e.eq(Bo)||e.eq(Ou))return Xt;if(e.eq(Xt))return Bo;var i=this.shr(1);return s=i.div(e).shl(1),s.eq(un)?e.isNegative()?Bo:Ou:(o=this.sub(e.mul(s)),r=s.add(o.div(e)),r)}else if(e.eq(Xt))return this.unsigned?qs:un;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();r=un}for(o=this;o.gte(e);){s=Math.max(1,Math.floor(o.toNumber()/e.toNumber()));for(var a=Math.ceil(Math.log(s)/Math.LN2),l=a<=48?1:dl(2,a-48),c=cn(s),u=c.mul(e);u.isNegative()||u.gt(o);)s-=l,c=cn(s,this.unsigned),u=c.mul(e);c.isZero()&&(c=Bo),r=r.add(c),o=o.sub(u)}return r},oe.div=oe.divide,oe.modulo=function(e){if(Kt(e)||(e=kn(e)),ln){var t=(this.unsigned?ln.rem_u:ln.rem_s)(this.low,this.high,e.low,e.high);return He(t,ln.get_high(),this.unsigned)}return this.sub(this.div(e).mul(e))},oe.mod=oe.modulo,oe.rem=oe.modulo,oe.not=function(){return He(~this.low,~this.high,this.unsigned)},oe.and=function(e){return Kt(e)||(e=kn(e)),He(this.low&e.low,this.high&e.high,this.unsigned)},oe.or=function(e){return Kt(e)||(e=kn(e)),He(this.low|e.low,this.high|e.high,this.unsigned)},oe.xor=function(e){return Kt(e)||(e=kn(e)),He(this.low^e.low,this.high^e.high,this.unsigned)},oe.shiftLeft=function(e){return Kt(e)&&(e=e.toInt()),(e&=63)===0?this:e<32?He(this.low<>>32-e,this.unsigned):He(0,this.low<>>e|this.high<<32-e,this.high>>e,this.unsigned):He(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},oe.shr=oe.shiftRight,oe.shiftRightUnsigned=function(e){if(Kt(e)&&(e=e.toInt()),e&=63,e===0)return this;var t=this.high;if(e<32){var s=this.low;return He(s>>>e|t<<32-e,t>>>e,this.unsigned)}else return e===32?He(t,0,this.unsigned):He(t>>>e-32,0,this.unsigned)},oe.shru=oe.shiftRightUnsigned,oe.shr_u=oe.shiftRightUnsigned,oe.toSigned=function(){return this.unsigned?He(this.low,this.high,!1):this},oe.toUnsigned=function(){return this.unsigned?this:He(this.low,this.high,!0)},oe.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},oe.toBytesLE=function(){var e=this.high,t=this.low;return[t&255,t>>>8&255,t>>>16&255,t>>>24,e&255,e>>>8&255,e>>>16&255,e>>>24]},oe.toBytesBE=function(){var e=this.high,t=this.low;return[e>>>24,e>>>16&255,e>>>8&255,e&255,t>>>24,t>>>16&255,t>>>8&255,t&255]},Ge.fromBytes=function(e,t,s){return s?Ge.fromBytesLE(e,t):Ge.fromBytesBE(e,t)},Ge.fromBytesLE=function(e,t){return new Ge(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24,t)},Ge.fromBytesBE=function(e,t){return new Ge(e[4]<<24|e[5]<<16|e[6]<<8|e[7],e[0]<<24|e[1]<<16|e[2]<<8|e[3],t)};var Ef=zw(yf),Uw=bw({__proto__:null,default:Ef},[yf]);/** * @license * Copyright 2021 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -118,7 +118,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const js=Ef||Gw;function pl(n){return js.fromString(n,!0,16)}const Rf=pl("c3a5c85c97cb3127"),Ks=pl("b492b66fbe98f273"),_t=pl("9ae16a3b2f90404f");function Pu(n){return n.xor(n.shru(47))}function Af(n,e,t){const s=n.slice(e,e+t);return js.fromBytes(Array.from(s),!0,!0)}function ze(n,e){return Af(n,e,8)}function Df(n,e){return Af(n,e,4)}function gt(n,e){return e===0?n:n.shru(e).or(n.shl(64-e))}function gs(n,e,t=pl("9ddfea08eb382d69")){let s=n.xor(e).mul(t);s=s.xor(s.shru(47));let o=e.xor(s).mul(t);return o=o.xor(o.shru(47)),o=o.mul(t),o}function Hw(n,e,t,s,o,r){o=o.add(n),r=gt(r.add(o).add(s),21);const i=o;return o=o.add(e),o=o.add(t),r=r.add(gt(o,44)),[o.add(s),r.add(i)]}function fl(n,e,t,s){return Hw(ze(n,e),ze(n,e+8),ze(n,e+16),ze(n,e+24),t,s)}function qw(n,e=n.length){if(e>=8){const t=_t.add(e*2),s=ze(n,0).add(_t),o=ze(n,e-8),r=gt(o,37).mul(t).add(s),i=gt(s,25).add(o).mul(t);return gs(r,i,t)}if(e>=4){const t=_t.add(e*2),s=Df(n,0);return gs(s.shl(3).add(e),Df(n,e-4),t)}if(e>0){const t=n[0],s=n[e>>1],o=n[e-1],r=t+(s<<8),i=e+(o<<2);return Pu(_t.mul(r).xor(Rf.mul(i))).mul(_t)}return _t}function jw(n,e=n.length){const t=_t.add(e*2),s=ze(n,0).mul(Ks),o=ze(n,8),r=ze(n,e-8).mul(t),i=ze(n,e-16).mul(_t);return gs(gt(s.add(o),43).add(gt(r,30)).add(i),s.add(gt(o.add(_t),18)).add(r),t)}function Kw(n,e=n.length){const t=_t.add(e*2),s=ze(n,0).mul(_t),o=ze(n,8),r=ze(n,e-8).mul(t),i=ze(n,e-16).mul(_t),a=gt(s.add(o),43).add(gt(r,30)).add(i),l=gs(a,s.add(gt(o.add(_t),18)).add(r),t),c=ze(n,16).mul(t),u=ze(n,24),h=a.add(ze(n,e-32)).mul(t),d=l.add(ze(n,e-24)).mul(t);return gs(gt(c.add(u),43).add(gt(h,30)).add(d),c.add(gt(u.add(s),18)).add(h),t)}function Xw(n,e=n.length){const t=js.fromNumber(81,!0);if(e<=32)return e<=16?qw(n,e):jw(n,e);if(e<=64)return Kw(n,e);let s=t,o=t.mul(Ks).add(113),r=Pu(o.mul(_t).add(113)).mul(_t),i=[js.UZERO,js.UZERO],a=[js.UZERO,js.UZERO];s=s.mul(_t).add(ze(n,0));let l=0;const c=(e-1>>6)*64,u=c+(e-1&63)-63;do s=gt(s.add(o).add(i[0]).add(ze(n,l+8)),37).mul(Ks),o=gt(o.add(i[1]).add(ze(n,l+48)),42).mul(Ks),s=s.xor(a[1]),o=o.add(i[0]).add(ze(n,l+40)),r=gt(r.add(a[0]),33).mul(Ks),i=fl(n,l,i[1].mul(Ks),s.add(a[0])),a=fl(n,l+32,r.add(a[1]),o.add(ze(n,l+16))),[r,s]=[s,r],l+=64;while(l!==c);const h=Ks.add(r.and(255).shl(1));return l=u,a[0]=a[0].add(e-1&63),i[0]=i[0].add(a[0]),a[0]=a[0].add(i[0]),s=gt(s.add(o).add(i[0]).add(ze(n,l+8)),37).mul(h),o=gt(o.add(i[1]).add(ze(n,l+48)),42).mul(h),s=s.xor(a[1].mul(9)),o=o.add(i[0].mul(9).add(ze(n,l+40))),r=gt(r.add(a[0]),33).mul(h),i=fl(n,l,i[1].mul(h),s.add(a[0])),a=fl(n,l+32,r.add(a[1]),o.add(ze(n,l+16))),[r,s]=[s,r],gs(gs(i[0],a[0],h).add(Pu(o).mul(Rf)).add(r),gs(i[1],a[1],h).add(s),h)}/** + */const js=Ef||Uw;function pl(n){return js.fromString(n,!0,16)}const Rf=pl("c3a5c85c97cb3127"),Ks=pl("b492b66fbe98f273"),Ft=pl("9ae16a3b2f90404f");function Lu(n){return n.xor(n.shru(47))}function Af(n,e,t){const s=n.slice(e,e+t);return js.fromBytes(Array.from(s),!0,!0)}function ze(n,e){return Af(n,e,8)}function Df(n,e){return Af(n,e,4)}function gt(n,e){return e===0?n:n.shru(e).or(n.shl(64-e))}function gs(n,e,t=pl("9ddfea08eb382d69")){let s=n.xor(e).mul(t);s=s.xor(s.shru(47));let o=e.xor(s).mul(t);return o=o.xor(o.shru(47)),o=o.mul(t),o}function Gw(n,e,t,s,o,r){o=o.add(n),r=gt(r.add(o).add(s),21);const i=o;return o=o.add(e),o=o.add(t),r=r.add(gt(o,44)),[o.add(s),r.add(i)]}function fl(n,e,t,s){return Gw(ze(n,e),ze(n,e+8),ze(n,e+16),ze(n,e+24),t,s)}function Hw(n,e=n.length){if(e>=8){const t=Ft.add(e*2),s=ze(n,0).add(Ft),o=ze(n,e-8),r=gt(o,37).mul(t).add(s),i=gt(s,25).add(o).mul(t);return gs(r,i,t)}if(e>=4){const t=Ft.add(e*2),s=Df(n,0);return gs(s.shl(3).add(e),Df(n,e-4),t)}if(e>0){const t=n[0],s=n[e>>1],o=n[e-1],r=t+(s<<8),i=e+(o<<2);return Lu(Ft.mul(r).xor(Rf.mul(i))).mul(Ft)}return Ft}function qw(n,e=n.length){const t=Ft.add(e*2),s=ze(n,0).mul(Ks),o=ze(n,8),r=ze(n,e-8).mul(t),i=ze(n,e-16).mul(Ft);return gs(gt(s.add(o),43).add(gt(r,30)).add(i),s.add(gt(o.add(Ft),18)).add(r),t)}function jw(n,e=n.length){const t=Ft.add(e*2),s=ze(n,0).mul(Ft),o=ze(n,8),r=ze(n,e-8).mul(t),i=ze(n,e-16).mul(Ft),a=gt(s.add(o),43).add(gt(r,30)).add(i),l=gs(a,s.add(gt(o.add(Ft),18)).add(r),t),c=ze(n,16).mul(t),u=ze(n,24),h=a.add(ze(n,e-32)).mul(t),d=l.add(ze(n,e-24)).mul(t);return gs(gt(c.add(u),43).add(gt(h,30)).add(d),c.add(gt(u.add(s),18)).add(h),t)}function Kw(n,e=n.length){const t=js.fromNumber(81,!0);if(e<=32)return e<=16?Hw(n,e):qw(n,e);if(e<=64)return jw(n,e);let s=t,o=t.mul(Ks).add(113),r=Lu(o.mul(Ft).add(113)).mul(Ft),i=[js.UZERO,js.UZERO],a=[js.UZERO,js.UZERO];s=s.mul(Ft).add(ze(n,0));let l=0;const c=(e-1>>6)*64,u=c+(e-1&63)-63;do s=gt(s.add(o).add(i[0]).add(ze(n,l+8)),37).mul(Ks),o=gt(o.add(i[1]).add(ze(n,l+48)),42).mul(Ks),s=s.xor(a[1]),o=o.add(i[0]).add(ze(n,l+40)),r=gt(r.add(a[0]),33).mul(Ks),i=fl(n,l,i[1].mul(Ks),s.add(a[0])),a=fl(n,l+32,r.add(a[1]),o.add(ze(n,l+16))),[r,s]=[s,r],l+=64;while(l!==c);const h=Ks.add(r.and(255).shl(1));return l=u,a[0]=a[0].add(e-1&63),i[0]=i[0].add(a[0]),a[0]=a[0].add(i[0]),s=gt(s.add(o).add(i[0]).add(ze(n,l+8)),37).mul(h),o=gt(o.add(i[1]).add(ze(n,l+48)),42).mul(h),s=s.xor(a[1].mul(9)),o=o.add(i[0].mul(9).add(ze(n,l+40))),r=gt(r.add(a[0]),33).mul(h),i=fl(n,l,i[1].mul(h),s.add(a[0])),a=fl(n,l+32,r.add(a[1]),o.add(ze(n,l+16))),[r,s]=[s,r],gs(gs(i[0],a[0],h).add(Lu(o).mul(Rf)).add(r),gs(i[1],a[1],h).add(s),h)}/** * @license * Copyright 2017 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -133,7 +133,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function xs(n,e){return e==="string"?bs(n):Xs([n],e)}function Yw(n,e){return n instanceof Float32Array&&e==="float32"||n instanceof Int32Array&&e==="int32"||n instanceof Uint8Array&&e==="bool"}function Xs(n,e){if(e==="string")throw new Error("Cannot convert a string[] to a TypedArray");if(Array.isArray(n)&&(n=Ys(n)),V().getBool("DEBUG")&&kw(n,e),Yw(n,e))return n;if(e==null||e==="float32"||e==="complex64")return new Float32Array(n);if(e==="int32")return new Int32Array(n);if(e==="bool"){const t=new Uint8Array(n.length);for(let s=0;s{o=s()};let i;const a=Vt();if(this.backendTimer.timerAvailable())i=this.backendTimer.time(r);else{r();for(const c of o)c.dataSync();i=Promise.resolve({kernelMs:Vt()-a})}if(V().getBool("CHECK_COMPUTATION_FOR_ERRORS"))for(let c=0;c{Qw(h,u.dtype,e)})}return{kernelName:e,outputs:o,inputs:t,timeMs:i.then(c=>c.kernelMs),extraInfo:i.then(c=>c.getExtraProfileInfo!=null?c.getExtraProfileInfo():"")}}logKernelProfile(e){const{kernelName:t,outputs:s,timeMs:o,inputs:r,extraInfo:i}=e;s.forEach(a=>{Promise.all([a.data(),o,i]).then(l=>{this.logger.logKernelProfile(t,a,l[0],l[1],r,l[2])})})}}function Qw(n,e,t){if(e!=="float32")return!1;for(let s=0;s0?m:""} `}}console.log(`%c${l} %c${a} %c${c}D ${h} %c${u} %c${d} %c${i}`,"font-weight:bold","color:red","color:blue","color: orange","color: green","color: steelblue")}}/** + */class Yw{constructor(e,t){this.backendTimer=e,this.logger=t,t==null&&(this.logger=new Qw)}profileKernel(e,t,s){let o;const r=()=>{o=s()};let i;const a=zt();if(this.backendTimer.timerAvailable())i=this.backendTimer.time(r);else{r();for(const c of o)c.dataSync();i=Promise.resolve({kernelMs:zt()-a})}if(V().getBool("CHECK_COMPUTATION_FOR_ERRORS"))for(let c=0;c{Zw(h,u.dtype,e)})}return{kernelName:e,outputs:o,inputs:t,timeMs:i.then(c=>c.kernelMs),extraInfo:i.then(c=>c.getExtraProfileInfo!=null?c.getExtraProfileInfo():"")}}logKernelProfile(e){const{kernelName:t,outputs:s,timeMs:o,inputs:r,extraInfo:i}=e;s.forEach(a=>{Promise.all([a.data(),o,i]).then(l=>{this.logger.logKernelProfile(t,a,l[0],l[1],r,l[2])})})}}function Zw(n,e,t){if(e!=="float32")return!1;for(let s=0;s0?m:""} `}}console.log(`%c${l} %c${a} %c${c}D ${h} %c${u} %c${d} %c${i}`,"font-weight:bold","color:red","color:blue","color: orange","color: green","color: steelblue")}}/** * @license * Copyright 2017 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -163,7 +163,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function eC(n,e,t){const s={},o={};for(let l=0;ls[m.id]=!0),p=!0,o[c.id]=!0;break}if(p)break}}const r={};r[t.id]=!0;const i={};for(let l=n.length-1;l>=0;l--){const c=n[l],u=c.inputs;for(let h=0;h=0;o--){const r=e[o],i=[];if(r.outputs.forEach(l=>{const c=n[l.id];c!=null?i.push(c):i.push(null)}),r.gradient==null)throw new Error(`Cannot compute gradient: gradient function not found for ${r.kernelName}.`);const a=r.gradient(i);for(const l in r.inputs){if(!(l in a))throw new Error(`Cannot backprop through input ${l}. Available gradients found: ${Object.keys(a)}.`);const c=t(()=>a[l]());if(c.dtype!=="float32")throw new Error(`Error in gradient for op ${r.kernelName}. The gradient of input ${l} must have 'float32' dtype, but has '${c.dtype}'`);const u=r.inputs[l];if(!_e(c.shape,u.shape))throw new Error(`Error in gradient for op ${r.kernelName}. The gradient of input '${l}' has shape '${c.shape}', which does not match the shape of the input '${u.shape}'`);if(n[u.id]==null)n[u.id]=c;else{const h=n[u.id];n[u.id]=s(h,c),h.dispose()}}}}/** + */function Jw(n,e,t){const s={},o={};for(let l=0;ls[m.id]=!0),p=!0,o[c.id]=!0;break}if(p)break}}const r={};r[t.id]=!0;const i={};for(let l=n.length-1;l>=0;l--){const c=n[l],u=c.inputs;for(let h=0;h=0;o--){const r=e[o],i=[];if(r.outputs.forEach(l=>{const c=n[l.id];c!=null?i.push(c):i.push(null)}),r.gradient==null)throw new Error(`Cannot compute gradient: gradient function not found for ${r.kernelName}.`);const a=r.gradient(i);for(const l in r.inputs){if(!(l in a))throw new Error(`Cannot backprop through input ${l}. Available gradients found: ${Object.keys(a)}.`);const c=t(()=>a[l]());if(c.dtype!=="float32")throw new Error(`Error in gradient for op ${r.kernelName}. The gradient of input ${l} must have 'float32' dtype, but has '${c.dtype}'`);const u=r.inputs[l];if(!_e(c.shape,u.shape))throw new Error(`Error in gradient for op ${r.kernelName}. The gradient of input '${l}' has shape '${c.shape}', which does not match the shape of the input '${u.shape}'`);if(n[u.id]==null)n[u.id]=c;else{const h=n[u.id];n[u.id]=s(h,c),h.dispose()}}}}/** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -178,9 +178,9 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const Ff=20,mi=3,Bu=7;function nC(n,e,t,s){const o=ue(e),r=sC(n,e,t,o),i=e.length,a=ml(n,e,t,o,r),l=["Tensor"];return s&&(l.push(` dtype: ${t}`),l.push(` rank: ${i}`),l.push(` shape: [${e}]`),l.push(" values:")),l.push(a.map(c=>" "+c).join(` + */const Ff=20,mi=3,Mu=7;function tC(n,e,t,s){const o=ue(e),r=nC(n,e,t,o),i=e.length,a=ml(n,e,t,o,r),l=["Tensor"];return s&&(l.push(` dtype: ${t}`),l.push(` rank: ${i}`),l.push(` shape: [${e}]`),l.push(" values:")),l.push(a.map(c=>" "+c).join(` `)),l.join(` -`)}function sC(n,e,t,s){const o=G(e),r=s[s.length-1],i=new Array(r).fill(0),a=e.length,l=t==="complex64"?xi(n):n;if(a>1)for(let c=0;cFf){const g=mi*i;let x=Array.from(n.slice(0,g)),b=Array.from(n.slice((a-mi)*i,a*i));return t==="complex64"&&(x=xi(x),b=xi(b)),["["+x.map((w,y)=>gi(w,o[y],t)).join(", ")+", ..., "+b.map((w,y)=>gi(w,o[a-mi+y],t)).join(", ")+"]"]}return["["+(t==="complex64"?xi(n):Array.from(n)).map((g,x)=>gi(g,o[x],t)).join(", ")+"]"]}const c=e.slice(1),u=s.slice(1),h=s[0]*i,d=[];if(a>Ff){for(let m=0;m0?d[0]+p:"");for(let m=1;m1)for(let c=0;cFf){const g=mi*i;let x=Array.from(n.slice(0,g)),b=Array.from(n.slice((a-mi)*i,a*i));return t==="complex64"&&(x=xi(x),b=xi(b)),["["+x.map((w,y)=>gi(w,o[y],t)).join(", ")+", ..., "+b.map((w,y)=>gi(w,o[a-mi+y],t)).join(", ")+"]"]}return["["+(t==="complex64"?xi(n):Array.from(n)).map((g,x)=>gi(g,o[x],t)).join(", ")+"]"]}const c=e.slice(1),u=s.slice(1),h=s[0]*i,d=[];if(a>Ff){for(let m=0;m0?d[0]+p:"");for(let m=1;m`Length of values '${o}' does not match the size inferred by the shape '${this.size}'.`)}if(t==="complex64")throw new Error("complex64 dtype TensorBuffers are not supported. Please create a TensorBuffer for the real and imaginary parts separately and call tf.complex(real, imag).");this.values=s||et(t,this.size),this.strides=ue(e)}set(e,...t){t.length===0&&(t=[0]),v(t.length===this.rank,()=>`The number of provided coordinates (${t.length}) must match the rank (${this.rank})`);const s=this.locToIndex(t);this.values[s]=e}get(...e){e.length===0&&(e=[0]);let t=0;for(const o of e){if(o<0||o>=this.shape[t]){const r=`Requested out of range element at ${e}. Buffer shape=${this.shape}`;throw new Error(r)}t++}let s=e[e.length-1];for(let o=0;oys(s))}catch{throw new Error("Failed to decode the string bytes into utf-8. To get the original bytes, call tensor.bytes().")}}return e}dataToGPU(e){return this.throwIfDisposed(),vn().readToGPU(this.dataId,e)}dataSync(){this.throwIfDisposed();const e=vn().readSync(this.dataId);if(this.dtype==="string")try{return e.map(t=>ys(t))}catch{throw new Error("Failed to decode the string bytes into utf-8. To get the original bytes, call tensor.bytes().")}return e}async bytes(){this.throwIfDisposed();const e=await vn().read(this.dataId);return this.dtype==="string"?e:new Uint8Array(e.buffer)}dispose(){this.isDisposed||(this.kerasMask&&this.kerasMask.dispose(),vn().disposeTensor(this),this.isDisposedInternal=!0)}get isDisposed(){return this.isDisposedInternal}throwIfDisposed(){if(this.isDisposed)throw new Error("Tensor is disposed.")}print(e=!1){return zo.print(this,e)}clone(){return this.throwIfDisposed(),zo.clone(this)}toString(e=!1){const t=this.dataSync();return nC(t,this.shape,this.dtype,e)}cast(e){return this.throwIfDisposed(),zo.cast(this,e)}variable(e=!0,t,s){return this.throwIfDisposed(),vn().makeVariable(this,e,t,s)}}Object.defineProperty(ct,Symbol.hasInstance,{value:n=>!!n&&n.data!=null&&n.dataSync!=null&&n.throwIfDisposed!=null});function U(){return Hc("Tensor",()=>ct)}U();class gl extends ct{constructor(e,t,s,o){super(e.shape,e.dtype,e.dataId,o),this.trainable=t,this.name=s}assign(e){if(e.dtype!==this.dtype)throw new Error(`dtype of the new value (${e.dtype}) and previous value (${this.dtype}) must match`);if(!_e(e.shape,this.shape))throw new Error(`shape of the new value (${e.shape}) and previous value (${this.shape}) must match`);vn().disposeTensor(this),this.dataId=e.dataId,vn().incRef(this,null)}dispose(){vn().disposeVariable(this),this.isDisposedInternal=!0}}Object.defineProperty(gl,Symbol.hasInstance,{value:n=>n instanceof ct&&n.assign!=null&&n.assign instanceof Function});/** + */class wt{constructor(e,t,s){if(this.dtype=t,this.shape=e.slice(),this.size=G(e),s!=null){const o=s.length;k(o===this.size,()=>`Length of values '${o}' does not match the size inferred by the shape '${this.size}'.`)}if(t==="complex64")throw new Error("complex64 dtype TensorBuffers are not supported. Please create a TensorBuffer for the real and imaginary parts separately and call tf.complex(real, imag).");this.values=s||et(t,this.size),this.strides=ue(e)}set(e,...t){t.length===0&&(t=[0]),k(t.length===this.rank,()=>`The number of provided coordinates (${t.length}) must match the rank (${this.rank})`);const s=this.locToIndex(t);this.values[s]=e}get(...e){e.length===0&&(e=[0]);let t=0;for(const o of e){if(o<0||o>=this.shape[t]){const r=`Requested out of range element at ${e}. Buffer shape=${this.shape}`;throw new Error(r)}t++}let s=e[e.length-1];for(let o=0;oys(s))}catch{throw new Error("Failed to decode the string bytes into utf-8. To get the original bytes, call tensor.bytes().")}}return e}dataToGPU(e){return this.throwIfDisposed(),vn().readToGPU(this.dataId,e)}dataSync(){this.throwIfDisposed();const e=vn().readSync(this.dataId);if(this.dtype==="string")try{return e.map(t=>ys(t))}catch{throw new Error("Failed to decode the string bytes into utf-8. To get the original bytes, call tensor.bytes().")}return e}async bytes(){this.throwIfDisposed();const e=await vn().read(this.dataId);return this.dtype==="string"?e:new Uint8Array(e.buffer)}dispose(){this.isDisposed||(this.kerasMask&&this.kerasMask.dispose(),vn().disposeTensor(this),this.isDisposedInternal=!0)}get isDisposed(){return this.isDisposedInternal}throwIfDisposed(){if(this.isDisposed)throw new Error("Tensor is disposed.")}print(e=!1){return zo.print(this,e)}clone(){return this.throwIfDisposed(),zo.clone(this)}toString(e=!1){const t=this.dataSync();return tC(t,this.shape,this.dtype,e)}cast(e){return this.throwIfDisposed(),zo.cast(this,e)}variable(e=!0,t,s){return this.throwIfDisposed(),vn().makeVariable(this,e,t,s)}}Object.defineProperty(ct,Symbol.hasInstance,{value:n=>!!n&&n.data!=null&&n.dataSync!=null&&n.throwIfDisposed!=null});function U(){return Uc("Tensor",()=>ct)}U();class gl extends ct{constructor(e,t,s,o){super(e.shape,e.dtype,e.dataId,o),this.trainable=t,this.name=s}assign(e){if(e.dtype!==this.dtype)throw new Error(`dtype of the new value (${e.dtype}) and previous value (${this.dtype}) must match`);if(!_e(e.shape,this.shape))throw new Error(`shape of the new value (${e.shape}) and previous value (${this.shape}) must match`);vn().disposeTensor(this),this.dataId=e.dataId,vn().incRef(this,null)}dispose(){vn().disposeVariable(this),this.isDisposedInternal=!0}}Object.defineProperty(gl,Symbol.hasInstance,{value:n=>n instanceof ct&&n.assign!=null&&n.assign instanceof Function});/** * @license * Copyright 2017 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -212,7 +212,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */var Of;(function(n){n.R0="R0",n.R1="R1",n.R2="R2",n.R3="R3",n.R4="R4",n.R5="R5",n.R6="R6"})(Of||(Of={}));var zu;(function(n){n.float32="float32",n.int32="int32",n.bool="int32",n.complex64="complex64"})(zu||(zu={}));var Vu;(function(n){n.float32="float32",n.int32="int32",n.bool="bool",n.complex64="complex64"})(Vu||(Vu={}));var Wu;(function(n){n.float32="float32",n.int32="float32",n.bool="float32",n.complex64="complex64"})(Wu||(Wu={}));var Uu;(function(n){n.float32="complex64",n.int32="complex64",n.bool="complex64",n.complex64="complex64"})(Uu||(Uu={}));const iC={float32:Wu,int32:zu,bool:Vu,complex64:Uu};function Yt(n,e){if(n==="string"||e==="string"){if(n==="string"&&e==="string")return"string";throw new Error(`Can not upcast ${n} with ${e}`)}return iC[n][e]}function Gu(n){return Yt(n,"int32")}function Lf(n){return n!=null&&typeof n=="object"&&"texture"in n&&n.texture instanceof WebGLTexture}function Mf(n){return typeof GPUBuffer<"u"&&n!=null&&typeof n=="object"&&"buffer"in n&&n.buffer instanceof GPUBuffer}/** + */var Of;(function(n){n.R0="R0",n.R1="R1",n.R2="R2",n.R3="R3",n.R4="R4",n.R5="R5",n.R6="R6"})(Of||(Of={}));var Pu;(function(n){n.float32="float32",n.int32="int32",n.bool="int32",n.complex64="complex64"})(Pu||(Pu={}));var Bu;(function(n){n.float32="float32",n.int32="int32",n.bool="bool",n.complex64="complex64"})(Bu||(Bu={}));var zu;(function(n){n.float32="float32",n.int32="float32",n.bool="float32",n.complex64="complex64"})(zu||(zu={}));var Vu;(function(n){n.float32="complex64",n.int32="complex64",n.bool="complex64",n.complex64="complex64"})(Vu||(Vu={}));const rC={float32:zu,int32:Pu,bool:Bu,complex64:Vu};function Yt(n,e){if(n==="string"||e==="string"){if(n==="string"&&e==="string")return"string";throw new Error(`Can not upcast ${n} with ${e}`)}return rC[n][e]}function Wu(n){return Yt(n,"int32")}function Lf(n){return n!=null&&typeof n=="object"&&"texture"in n&&n.texture instanceof WebGLTexture}function Mf(n){return typeof GPUBuffer<"u"&&n!=null&&typeof n=="object"&&"buffer"in n&&n.buffer instanceof GPUBuffer}/** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -227,7 +227,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function tt(n,e){if(n.dtype===e.dtype)return[n,e];const t=Yt(n.dtype,e.dtype);return[n.cast(t),e.cast(t)]}function Pf(n){const e=[];return Bf(n,e,new Set),e}function Bf(n,e,t){if(n==null)return;if(n instanceof ct){e.push(n);return}if(!aC(n))return;const s=n;for(const o in s){const r=s[o];t.has(r)||(t.add(r),Bf(r,e,t))}}function aC(n){return Array.isArray(n)||typeof n=="object"}/** + */function tt(n,e){if(n.dtype===e.dtype)return[n,e];const t=Yt(n.dtype,e.dtype);return[n.cast(t),e.cast(t)]}function Pf(n){const e=[];return Bf(n,e,new Set),e}function Bf(n,e,t){if(n==null)return;if(n instanceof ct){e.push(n);return}if(!iC(n))return;const s=n;for(const o in s){const r=s[o];t.has(r)||(t.add(r),Bf(r,e,t))}}function iC(n){return Array.isArray(n)||typeof n=="object"}/** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -242,7 +242,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function Hu(n){return n.kernelName!=null}class zf{constructor(){this.registeredVariables={},this.nextTapeNodeId=0,this.numBytes=0,this.numTensors=0,this.numStringTensors=0,this.numDataBuffers=0,this.gradientDepth=0,this.kernelDepth=0,this.scopeStack=[],this.numDataMovesStack=[],this.nextScopeId=0,this.tensorInfo=new WeakMap,this.profiling=!1,this.activeProfile={newBytes:0,newTensors:0,peakBytes:0,kernels:[],result:null,get kernelNames(){return Array.from(new Set(this.kernels.map(e=>e.name)))}}}dispose(){for(const e in this.registeredVariables)this.registeredVariables[e].dispose()}}class Vo{constructor(e){this.ENV=e,this.registry={},this.registryFactory={},this.pendingBackendInitId=0,this.state=new zf}async ready(){if(this.pendingBackendInit!=null)return this.pendingBackendInit.then(()=>{});if(this.backendInstance!=null)return;const e=this.getSortedBackends();for(let t=0;t{t.setupFunc!=null&&t.setupFunc(this.backendInstance)})}disposeRegisteredKernels(e){mf(e).forEach(s=>{s.disposeFunc!=null&&s.disposeFunc(this.registry[e])})}initializeBackend(e){const t=this.registryFactory[e];if(t==null)throw new Error(`Cannot initialize backend ${e}, no registration found.`);try{const s=t.factory();if(s&&!(s instanceof Oc)&&typeof s.then=="function"){const o=++this.pendingBackendInitId,r=s.then(i=>o(othis.registryFactory[t].priority-this.registryFactory[e].priority)}initializeBackendsAndReturnBest(){const e=this.getSortedBackends();for(let t=0;tthis.startScope(s),()=>this.endScope(o),()=>(o=t(),o instanceof Promise&&console.error("Cannot return a Promise inside of tidy."),o))}scopedRun(e,t,s){e();try{const o=s();return t(),o}catch(o){throw t(),o}}nextTensorId(){return Vo.nextTensorId++}nextVariableId(){return Vo.nextVariableId++}clone(e){const t=F.runKernel(zr,{x:e}),s={x:e},o=i=>({x:()=>{const a="float32",l={x:i},c={dtype:a};return F.runKernel(Tr,l,c)}}),r=[];return this.addTapeNode(this.state.activeScope.name,s,[t],o,r,{}),t}runKernel(e,t,s){if(this.backendName==null&&this.backend,!(pf(e,this.backendName)!=null))throw new Error(`Kernel '${e}' not registered for backend '${this.backendName}'`);return this.runKernelFunc({kernelName:e,inputs:t,attrs:s})}shouldCheckForMemLeaks(){return this.ENV.getBool("IS_TEST")}checkKernelForMemLeak(e,t,s){const o=this.backend.numDataIds();let r=0;s.forEach(l=>{r+=l.dtype==="complex64"?3:1});const i=this.state.numDataMovesStack[this.state.numDataMovesStack.length-1],a=o-t-r-i;if(a>0)throw new Error(`Backend '${this.backendName}' has an internal memory leak (${a} data ids) after running '${e}'`)}runKernelFunc(e){let t,s=[];const o=this.isTapeOn(),r=this.state.numBytes,i=this.state.numTensors;this.shouldCheckForMemLeaks()&&this.state.numDataMovesStack.push(0);let a;this.backendName==null&&this.backend;let l;const c=Hu(e)?e.kernelName:this.state.activeScope!=null?this.state.activeScope.name:"";if(Hu(e)){const{kernelName:f,inputs:m,attrs:g}=e;this.backendName==null&&this.backend;const x=pf(f,this.backendName);v(x!=null,()=>`Cannot find registered kernel '${f}' for backend '${this.backendName}'`),a=()=>{const b=this.backend.numDataIds();l=x.kernelFunc({inputs:m,attrs:g,backend:this.backend});const w=Array.isArray(l)?l:[l];this.shouldCheckForMemLeaks()&&this.checkKernelForMemLeak(f,b,w);const y=w.map(C=>C.rank!=null?C:this.makeTensorFromTensorInfo(C));if(o){const C=this.getTensorsForGradient(f,m,y);s=this.saveTensorsForBackwardMode(C)}return y}}else{const{forwardFunc:f}=e,m=g=>{o&&(s=g.map(x=>this.keep(this.clone(x))))};a=()=>{const g=this.backend.numDataIds();l=this.tidy(()=>f(this.backend,m));const x=Array.isArray(l)?l:[l];return this.shouldCheckForMemLeaks()&&this.checkKernelForMemLeak(c,g,x),x}}const{inputs:u,attrs:h}=e,d=Hu(e)?null:e.backwardsFunc;let p;return this.scopedRun(()=>this.state.kernelDepth++,()=>this.state.kernelDepth--,()=>{!this.ENV.getBool("DEBUG")&&!this.state.profiling?t=a():(p=this.profiler.profileKernel(c,u,()=>a()),this.ENV.getBool("DEBUG")&&this.profiler.logKernelProfile(p),t=p.outputs)}),o&&this.addTapeNode(c,u,t,d,s,h),this.state.profiling&&this.state.activeProfile.kernels.push({name:c,bytesAdded:this.state.numBytes-r,totalBytesSnapshot:this.state.numBytes,tensorsAdded:this.state.numTensors-i,totalTensorsSnapshot:this.state.numTensors,inputShapes:Object.keys(u).map(f=>u[f]!=null?u[f].shape:null),outputShapes:t.map(f=>f.shape),kernelTimeMs:p.timeMs,extraInfo:p.extraInfo}),Array.isArray(l)?t:t[0]}saveTensorsForBackwardMode(e){return e.map(s=>this.keep(this.clone(s)))}getTensorsForGradient(e,t,s){const o=ff(e);if(o!=null){const r=o.inputsToSave||[],i=o.outputsToSave||[];let a;o.saveAllInputs?(v(Array.isArray(t),()=>"saveAllInputs is true, expected inputs to be an array."),a=Object.keys(t).map(c=>t[c])):a=r.map(c=>t[c]);const l=s.filter((c,u)=>i[u]);return a.concat(l)}return[]}makeTensor(e,t,s,o){if(e==null)throw new Error("Values passed to engine.makeTensor() are null");s=s||"float32",o=o||this.backend;let r=e;s==="string"&&br(e[0])&&(r=e.map(l=>bs(l)));const i=o.write(r,t,s),a=new ct(t,s,i,this.nextTensorId());if(this.trackTensor(a,o),s==="string"){const l=this.state.tensorInfo.get(i),c=Sw(r);this.state.numBytes+=c-l.bytes,l.bytes=c}return a}makeTensorFromDataId(e,t,s,o){s=s||"float32";const r={dataId:e,shape:t,dtype:s};return this.makeTensorFromTensorInfo(r,o)}makeTensorFromTensorInfo(e,t){const{dataId:s,shape:o,dtype:r}=e,i=new ct(o,r,s,this.nextTensorId());return this.trackTensor(i,t),i}makeVariable(e,t=!0,s,o){s=s||this.nextVariableId().toString(),o!=null&&o!==e.dtype&&(e=e.cast(o));const r=new gl(e,t,s,this.nextTensorId());if(this.state.registeredVariables[r.name]!=null)throw new Error(`Variable with name ${r.name} was already registered`);return this.state.registeredVariables[r.name]=r,this.incRef(r,this.backend),r}trackTensor(e,t){this.state.numTensors++,e.dtype==="string"&&this.state.numStringTensors++;let s=0;e.dtype!=="complex64"&&e.dtype!=="string"&&(s=e.size*la(e.dtype)),this.state.numBytes+=s,this.state.tensorInfo.has(e.dataId)||(this.state.numDataBuffers++,this.state.tensorInfo.set(e.dataId,{backend:t||this.backend,dtype:e.dtype,shape:e.shape,bytes:s})),e instanceof gl||this.track(e)}incRef(e,t){this.trackTensor(e,t),this.backend.incRef(e.dataId)}removeDataId(e,t){this.state.tensorInfo.has(e)&&this.state.tensorInfo.get(e).backend===t&&(this.state.tensorInfo.delete(e),this.state.numDataBuffers--)}disposeTensor(e){if(!this.state.tensorInfo.has(e.dataId))return;const t=this.state.tensorInfo.get(e.dataId);if(this.state.numTensors--,e.dtype==="string"&&(this.state.numStringTensors--,this.state.numBytes-=t.bytes),e.dtype!=="complex64"&&e.dtype!=="string"){const s=e.size*la(e.dtype);this.state.numBytes-=s}t.backend.disposeData(e.dataId)&&this.removeDataId(e.dataId,t.backend)}disposeVariables(){for(const e in this.state.registeredVariables){const t=this.state.registeredVariables[e];this.disposeVariable(t)}}disposeVariable(e){this.disposeTensor(e),this.state.registeredVariables[e.name]!=null&&delete this.state.registeredVariables[e.name]}memory(){const e=this.backend.memory();return e.numTensors=this.state.numTensors,e.numDataBuffers=this.state.numDataBuffers,e.numBytes=this.state.numBytes,this.state.numStringTensors>0&&(e.unreliable=!0,e.reasons==null&&(e.reasons=[]),e.reasons.push("Memory usage by string tensors is approximate (2 bytes per character)")),e}async profile(e){this.state.profiling=!0;const t=this.state.numBytes,s=this.state.numTensors;this.state.activeProfile.kernels=[],this.state.activeProfile.result=await e(),this.state.profiling=!1,this.state.activeProfile.peakBytes=Math.max(...this.state.activeProfile.kernels.map(o=>o.totalBytesSnapshot)),this.state.activeProfile.newBytes=this.state.numBytes-t,this.state.activeProfile.newTensors=this.state.numTensors-s;for(const o of this.state.activeProfile.kernels)o.kernelTimeMs=await o.kernelTimeMs,o.extraInfo=await o.extraInfo;return this.state.activeProfile}isTapeOn(){return this.state.gradientDepth>0&&this.state.kernelDepth===0}addTapeNode(e,t,s,o,r,i){const a={id:this.state.nextTapeNodeId++,kernelName:e,inputs:t,outputs:s,saved:r},l=ff(e);l!=null&&(o=l.gradFunc),o!=null&&(a.gradient=c=>(c=c.map((u,h)=>{if(u==null){const d=s[h],p=Nt(d.size,d.dtype);return this.makeTensor(p,d.shape,d.dtype)}return u}),o(c.length>1?c:c[0],r,i))),this.state.activeTape.push(a)}keep(e){return e.kept=!0,e}startTape(){this.state.gradientDepth===0&&(this.state.activeTape=[]),this.state.gradientDepth++}endTape(){this.state.gradientDepth--}startScope(e){const t={track:[],name:"unnamed scope",id:this.state.nextScopeId++};e&&(t.name=e),this.state.scopeStack.push(t),this.state.activeScope=t}endScope(e){const t=Pf(e),s=new Set(t.map(r=>r.id));for(let r=0;r{!r.kept&&r.scopeId===o.id&&this.track(r)})}gradients(e,t,s,o=!1){if(v(t.length>0,()=>"gradients() received an empty list of xs."),s!=null&&s.dtype!=="float32")throw new Error(`dy must have 'float32' dtype, but has '${s.dtype}'`);const r=this.scopedRun(()=>this.startTape(),()=>this.endTape(),()=>this.tidy("forward",e));v(r instanceof ct,()=>"The result y returned by f() must be a tensor.");const i=eC(this.state.activeTape,t,r);if(!o&&i.length===0&&t.length>0)throw new Error("Cannot compute gradient of y=f(x) with respect to x. Make sure that the f you passed encloses all operations that lead from x to y.");return this.tidy("backward",()=>{const a={};a[r.id]=s??lC(r.shape),tC(a,i,c=>this.tidy(c),cC);const l=t.map(c=>a[c.id]);return this.state.gradientDepth===0&&(this.state.activeTape.forEach(c=>{for(const u of c.saved)u.dispose()}),this.state.activeTape=null),{value:r,grads:l}})}customGrad(e){return v(zc(e),()=>"The f passed in customGrad(f) must be a function."),(...t)=>{v(t.every(a=>a instanceof ct),()=>"The args passed in customGrad(f)(x1, x2,...) must all be tensors");let s;const o={};t.forEach((a,l)=>{o[l]=a});const r=(a,l)=>(s=e(...t,l),v(s.value instanceof ct,()=>"The function f passed in customGrad(f) must return an object where `obj.value` is a tensor"),v(zc(s.gradFunc),()=>"The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function."),s.value),i=(a,l)=>{const c=s.gradFunc(a,l),u=Array.isArray(c)?c:[c];v(u.length===t.length,()=>"The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function that returns the same number of tensors as inputs passed to f(...)."),v(u.every(d=>d instanceof ct),()=>"The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function that returns a list of only tensors.");const h={};return u.forEach((d,p)=>{h[p]=()=>d}),h};return this.runKernelFunc({forwardFunc:r,backwardsFunc:i,inputs:o})}}readSync(e){return this.state.tensorInfo.get(e).backend.readSync(e)}read(e){return this.state.tensorInfo.get(e).backend.read(e)}readToGPU(e,t){return this.state.tensorInfo.get(e).backend.readToGPU(e,t)}async time(e){const t=Vt(),s=await this.backend.time(e);return s.wallMs=Vt()-t,s}track(e){return this.state.activeScope!=null&&(e.scopeId=this.state.activeScope.id,this.state.activeScope.track.push(e)),e}get registeredVariables(){return this.state.registeredVariables}reset(){this.pendingBackendInitId++,this.state.dispose(),this.ENV.reset(),this.state=new zf;for(const e in this.registry)this.disposeRegisteredKernels(e),this.registry[e].dispose(),delete this.registry[e];this.backendName=null,this.backendInstance=null,this.pendingBackendInit=null}}Vo.nextTensorId=0,Vo.nextVariableId=0;function lC(n){const e=Wc(G(n),"float32");return F.makeTensor(e,n,"float32")}function Vf(){const n=Gp();if(n._tfengine==null){const e=new Ew(n);n._tfengine=new Vo(e)}return Fw(n._tfengine.ENV),oC(()=>n._tfengine),n._tfengine}const F=Vf();function cC(n,e){const t={a:n,b:e};return F.runKernel(Lo,t)}/** + */function Uu(n){return n.kernelName!=null}class zf{constructor(){this.registeredVariables={},this.nextTapeNodeId=0,this.numBytes=0,this.numTensors=0,this.numStringTensors=0,this.numDataBuffers=0,this.gradientDepth=0,this.kernelDepth=0,this.scopeStack=[],this.numDataMovesStack=[],this.nextScopeId=0,this.tensorInfo=new WeakMap,this.profiling=!1,this.activeProfile={newBytes:0,newTensors:0,peakBytes:0,kernels:[],result:null,get kernelNames(){return Array.from(new Set(this.kernels.map(e=>e.name)))}}}dispose(){for(const e in this.registeredVariables)this.registeredVariables[e].dispose()}}class Vo{constructor(e){this.ENV=e,this.registry={},this.registryFactory={},this.pendingBackendInitId=0,this.state=new zf}async ready(){if(this.pendingBackendInit!=null)return this.pendingBackendInit.then(()=>{});if(this.backendInstance!=null)return;const e=this.getSortedBackends();for(let t=0;t{t.setupFunc!=null&&t.setupFunc(this.backendInstance)})}disposeRegisteredKernels(e){mf(e).forEach(s=>{s.disposeFunc!=null&&s.disposeFunc(this.registry[e])})}initializeBackend(e){const t=this.registryFactory[e];if(t==null)throw new Error(`Cannot initialize backend ${e}, no registration found.`);try{const s=t.factory();if(s&&!(s instanceof Fc)&&typeof s.then=="function"){const o=++this.pendingBackendInitId,r=s.then(i=>o(othis.registryFactory[t].priority-this.registryFactory[e].priority)}initializeBackendsAndReturnBest(){const e=this.getSortedBackends();for(let t=0;tthis.startScope(s),()=>this.endScope(o),()=>(o=t(),o instanceof Promise&&console.error("Cannot return a Promise inside of tidy."),o))}scopedRun(e,t,s){e();try{const o=s();return t(),o}catch(o){throw t(),o}}nextTensorId(){return Vo.nextTensorId++}nextVariableId(){return Vo.nextVariableId++}clone(e){const t=F.runKernel(zr,{x:e}),s={x:e},o=i=>({x:()=>{const a="float32",l={x:i},c={dtype:a};return F.runKernel(Tr,l,c)}}),r=[];return this.addTapeNode(this.state.activeScope.name,s,[t],o,r,{}),t}runKernel(e,t,s){if(this.backendName==null&&this.backend,!(pf(e,this.backendName)!=null))throw new Error(`Kernel '${e}' not registered for backend '${this.backendName}'`);return this.runKernelFunc({kernelName:e,inputs:t,attrs:s})}shouldCheckForMemLeaks(){return this.ENV.getBool("IS_TEST")}checkKernelForMemLeak(e,t,s){const o=this.backend.numDataIds();let r=0;s.forEach(l=>{r+=l.dtype==="complex64"?3:1});const i=this.state.numDataMovesStack[this.state.numDataMovesStack.length-1],a=o-t-r-i;if(a>0)throw new Error(`Backend '${this.backendName}' has an internal memory leak (${a} data ids) after running '${e}'`)}runKernelFunc(e){let t,s=[];const o=this.isTapeOn(),r=this.state.numBytes,i=this.state.numTensors;this.shouldCheckForMemLeaks()&&this.state.numDataMovesStack.push(0);let a;this.backendName==null&&this.backend;let l;const c=Uu(e)?e.kernelName:this.state.activeScope!=null?this.state.activeScope.name:"";if(Uu(e)){const{kernelName:f,inputs:m,attrs:g}=e;this.backendName==null&&this.backend;const x=pf(f,this.backendName);k(x!=null,()=>`Cannot find registered kernel '${f}' for backend '${this.backendName}'`),a=()=>{const b=this.backend.numDataIds();l=x.kernelFunc({inputs:m,attrs:g,backend:this.backend});const w=Array.isArray(l)?l:[l];this.shouldCheckForMemLeaks()&&this.checkKernelForMemLeak(f,b,w);const y=w.map(C=>C.rank!=null?C:this.makeTensorFromTensorInfo(C));if(o){const C=this.getTensorsForGradient(f,m,y);s=this.saveTensorsForBackwardMode(C)}return y}}else{const{forwardFunc:f}=e,m=g=>{o&&(s=g.map(x=>this.keep(this.clone(x))))};a=()=>{const g=this.backend.numDataIds();l=this.tidy(()=>f(this.backend,m));const x=Array.isArray(l)?l:[l];return this.shouldCheckForMemLeaks()&&this.checkKernelForMemLeak(c,g,x),x}}const{inputs:u,attrs:h}=e,d=Uu(e)?null:e.backwardsFunc;let p;return this.scopedRun(()=>this.state.kernelDepth++,()=>this.state.kernelDepth--,()=>{!this.ENV.getBool("DEBUG")&&!this.state.profiling?t=a():(p=this.profiler.profileKernel(c,u,()=>a()),this.ENV.getBool("DEBUG")&&this.profiler.logKernelProfile(p),t=p.outputs)}),o&&this.addTapeNode(c,u,t,d,s,h),this.state.profiling&&this.state.activeProfile.kernels.push({name:c,bytesAdded:this.state.numBytes-r,totalBytesSnapshot:this.state.numBytes,tensorsAdded:this.state.numTensors-i,totalTensorsSnapshot:this.state.numTensors,inputShapes:Object.keys(u).map(f=>u[f]!=null?u[f].shape:null),outputShapes:t.map(f=>f.shape),kernelTimeMs:p.timeMs,extraInfo:p.extraInfo}),Array.isArray(l)?t:t[0]}saveTensorsForBackwardMode(e){return e.map(s=>this.keep(this.clone(s)))}getTensorsForGradient(e,t,s){const o=ff(e);if(o!=null){const r=o.inputsToSave||[],i=o.outputsToSave||[];let a;o.saveAllInputs?(k(Array.isArray(t),()=>"saveAllInputs is true, expected inputs to be an array."),a=Object.keys(t).map(c=>t[c])):a=r.map(c=>t[c]);const l=s.filter((c,u)=>i[u]);return a.concat(l)}return[]}makeTensor(e,t,s,o){if(e==null)throw new Error("Values passed to engine.makeTensor() are null");s=s||"float32",o=o||this.backend;let r=e;s==="string"&&br(e[0])&&(r=e.map(l=>bs(l)));const i=o.write(r,t,s),a=new ct(t,s,i,this.nextTensorId());if(this.trackTensor(a,o),s==="string"){const l=this.state.tensorInfo.get(i),c=vw(r);this.state.numBytes+=c-l.bytes,l.bytes=c}return a}makeTensorFromDataId(e,t,s,o){s=s||"float32";const r={dataId:e,shape:t,dtype:s};return this.makeTensorFromTensorInfo(r,o)}makeTensorFromTensorInfo(e,t){const{dataId:s,shape:o,dtype:r}=e,i=new ct(o,r,s,this.nextTensorId());return this.trackTensor(i,t),i}makeVariable(e,t=!0,s,o){s=s||this.nextVariableId().toString(),o!=null&&o!==e.dtype&&(e=e.cast(o));const r=new gl(e,t,s,this.nextTensorId());if(this.state.registeredVariables[r.name]!=null)throw new Error(`Variable with name ${r.name} was already registered`);return this.state.registeredVariables[r.name]=r,this.incRef(r,this.backend),r}trackTensor(e,t){this.state.numTensors++,e.dtype==="string"&&this.state.numStringTensors++;let s=0;e.dtype!=="complex64"&&e.dtype!=="string"&&(s=e.size*la(e.dtype)),this.state.numBytes+=s,this.state.tensorInfo.has(e.dataId)||(this.state.numDataBuffers++,this.state.tensorInfo.set(e.dataId,{backend:t||this.backend,dtype:e.dtype,shape:e.shape,bytes:s})),e instanceof gl||this.track(e)}incRef(e,t){this.trackTensor(e,t),this.backend.incRef(e.dataId)}removeDataId(e,t){this.state.tensorInfo.has(e)&&this.state.tensorInfo.get(e).backend===t&&(this.state.tensorInfo.delete(e),this.state.numDataBuffers--)}disposeTensor(e){if(!this.state.tensorInfo.has(e.dataId))return;const t=this.state.tensorInfo.get(e.dataId);if(this.state.numTensors--,e.dtype==="string"&&(this.state.numStringTensors--,this.state.numBytes-=t.bytes),e.dtype!=="complex64"&&e.dtype!=="string"){const s=e.size*la(e.dtype);this.state.numBytes-=s}t.backend.disposeData(e.dataId)&&this.removeDataId(e.dataId,t.backend)}disposeVariables(){for(const e in this.state.registeredVariables){const t=this.state.registeredVariables[e];this.disposeVariable(t)}}disposeVariable(e){this.disposeTensor(e),this.state.registeredVariables[e.name]!=null&&delete this.state.registeredVariables[e.name]}memory(){const e=this.backend.memory();return e.numTensors=this.state.numTensors,e.numDataBuffers=this.state.numDataBuffers,e.numBytes=this.state.numBytes,this.state.numStringTensors>0&&(e.unreliable=!0,e.reasons==null&&(e.reasons=[]),e.reasons.push("Memory usage by string tensors is approximate (2 bytes per character)")),e}async profile(e){this.state.profiling=!0;const t=this.state.numBytes,s=this.state.numTensors;this.state.activeProfile.kernels=[],this.state.activeProfile.result=await e(),this.state.profiling=!1,this.state.activeProfile.peakBytes=Math.max(...this.state.activeProfile.kernels.map(o=>o.totalBytesSnapshot)),this.state.activeProfile.newBytes=this.state.numBytes-t,this.state.activeProfile.newTensors=this.state.numTensors-s;for(const o of this.state.activeProfile.kernels)o.kernelTimeMs=await o.kernelTimeMs,o.extraInfo=await o.extraInfo;return this.state.activeProfile}isTapeOn(){return this.state.gradientDepth>0&&this.state.kernelDepth===0}addTapeNode(e,t,s,o,r,i){const a={id:this.state.nextTapeNodeId++,kernelName:e,inputs:t,outputs:s,saved:r},l=ff(e);l!=null&&(o=l.gradFunc),o!=null&&(a.gradient=c=>(c=c.map((u,h)=>{if(u==null){const d=s[h],p=Nt(d.size,d.dtype);return this.makeTensor(p,d.shape,d.dtype)}return u}),o(c.length>1?c:c[0],r,i))),this.state.activeTape.push(a)}keep(e){return e.kept=!0,e}startTape(){this.state.gradientDepth===0&&(this.state.activeTape=[]),this.state.gradientDepth++}endTape(){this.state.gradientDepth--}startScope(e){const t={track:[],name:"unnamed scope",id:this.state.nextScopeId++};e&&(t.name=e),this.state.scopeStack.push(t),this.state.activeScope=t}endScope(e){const t=Pf(e),s=new Set(t.map(r=>r.id));for(let r=0;r{!r.kept&&r.scopeId===o.id&&this.track(r)})}gradients(e,t,s,o=!1){if(k(t.length>0,()=>"gradients() received an empty list of xs."),s!=null&&s.dtype!=="float32")throw new Error(`dy must have 'float32' dtype, but has '${s.dtype}'`);const r=this.scopedRun(()=>this.startTape(),()=>this.endTape(),()=>this.tidy("forward",e));k(r instanceof ct,()=>"The result y returned by f() must be a tensor.");const i=Jw(this.state.activeTape,t,r);if(!o&&i.length===0&&t.length>0)throw new Error("Cannot compute gradient of y=f(x) with respect to x. Make sure that the f you passed encloses all operations that lead from x to y.");return this.tidy("backward",()=>{const a={};a[r.id]=s??aC(r.shape),eC(a,i,c=>this.tidy(c),lC);const l=t.map(c=>a[c.id]);return this.state.gradientDepth===0&&(this.state.activeTape.forEach(c=>{for(const u of c.saved)u.dispose()}),this.state.activeTape=null),{value:r,grads:l}})}customGrad(e){return k(Pc(e),()=>"The f passed in customGrad(f) must be a function."),(...t)=>{k(t.every(a=>a instanceof ct),()=>"The args passed in customGrad(f)(x1, x2,...) must all be tensors");let s;const o={};t.forEach((a,l)=>{o[l]=a});const r=(a,l)=>(s=e(...t,l),k(s.value instanceof ct,()=>"The function f passed in customGrad(f) must return an object where `obj.value` is a tensor"),k(Pc(s.gradFunc),()=>"The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function."),s.value),i=(a,l)=>{const c=s.gradFunc(a,l),u=Array.isArray(c)?c:[c];k(u.length===t.length,()=>"The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function that returns the same number of tensors as inputs passed to f(...)."),k(u.every(d=>d instanceof ct),()=>"The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function that returns a list of only tensors.");const h={};return u.forEach((d,p)=>{h[p]=()=>d}),h};return this.runKernelFunc({forwardFunc:r,backwardsFunc:i,inputs:o})}}readSync(e){return this.state.tensorInfo.get(e).backend.readSync(e)}read(e){return this.state.tensorInfo.get(e).backend.read(e)}readToGPU(e,t){return this.state.tensorInfo.get(e).backend.readToGPU(e,t)}async time(e){const t=zt(),s=await this.backend.time(e);return s.wallMs=zt()-t,s}track(e){return this.state.activeScope!=null&&(e.scopeId=this.state.activeScope.id,this.state.activeScope.track.push(e)),e}get registeredVariables(){return this.state.registeredVariables}reset(){this.pendingBackendInitId++,this.state.dispose(),this.ENV.reset(),this.state=new zf;for(const e in this.registry)this.disposeRegisteredKernels(e),this.registry[e].dispose(),delete this.registry[e];this.backendName=null,this.backendInstance=null,this.pendingBackendInit=null}}Vo.nextTensorId=0,Vo.nextVariableId=0;function aC(n){const e=zc(G(n),"float32");return F.makeTensor(e,n,"float32")}function Vf(){const n=Gp();if(n._tfengine==null){const e=new Nw(n);n._tfengine=new Vo(e)}return Dw(n._tfengine.ENV),sC(()=>n._tfengine),n._tfengine}const F=Vf();function lC(n,e){const t={a:n,b:e};return F.runKernel(Lo,t)}/** * @license * Copyright 2017 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -257,7 +257,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function uC(){return typeof navigator<"u"&&navigator!=null}function Wf(n){if(n||uC()){if(n||(n=navigator),n.product==="ReactNative")return!0;const e=n.userAgent||n.vendor||(typeof window<"u"?window.opera:"");if(!e){const t=n;return t.userAgentData&&t.userAgentData.mobile}return/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(e)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(e.substr(0,4))}return!1}function Uf(){return typeof window<"u"&&window.document!=null||typeof WorkerGlobalScope<"u"}/** + */function cC(){return typeof navigator<"u"&&navigator!=null}function Wf(n){if(n||cC()){if(n||(n=navigator),n.product==="ReactNative")return!0;const e=n.userAgent||n.vendor||(typeof window<"u"?window.opera:"");if(!e){const t=n;return t.userAgentData&&t.userAgentData.mobile}return/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(e)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(e.substr(0,4))}return!1}function Uf(){return typeof window<"u"&&window.document!=null||typeof WorkerGlobalScope<"u"}/** * @license * Copyright 2019 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -272,7 +272,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const Wt=V();Wt.registerFlag("DEBUG",()=>!1,n=>{n&&console.warn("Debugging mode is ON. The output of every math call will be downloaded to CPU and checked for NaNs. This significantly impacts performance.")}),Wt.registerFlag("IS_BROWSER",()=>Uf()),Wt.registerFlag("IS_NODE",()=>typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"),Wt.registerFlag("IS_CHROME",()=>typeof navigator<"u"&&navigator!=null&&navigator.userAgent!=null&&/Chrome/.test(navigator.userAgent)&&/Google Inc/.test(navigator.vendor)),Wt.registerFlag("IS_SAFARI",()=>typeof navigator<"u"&&navigator!=null&&navigator.userAgent!=null&&/Safari/.test(navigator.userAgent)&&/Apple/.test(navigator.vendor)),Wt.registerFlag("PROD",()=>!1),Wt.registerFlag("TENSORLIKE_CHECK_SHAPE_CONSISTENCY",()=>Wt.getBool("DEBUG")),Wt.registerFlag("DEPRECATION_WARNINGS_ENABLED",()=>!0),Wt.registerFlag("IS_TEST",()=>!1),Wt.registerFlag("CHECK_COMPUTATION_FOR_ERRORS",()=>Wt.getBool("DEBUG")),Wt.registerFlag("WRAP_TO_IMAGEBITMAP",()=>!1),Wt.registerFlag("CANVAS2D_WILL_READ_FREQUENTLY_FOR_GPU",()=>!1),Wt.registerFlag("USE_SETTIMEOUTCUSTOM",()=>!1);/** + */const Vt=V();Vt.registerFlag("DEBUG",()=>!1,n=>{n&&console.warn("Debugging mode is ON. The output of every math call will be downloaded to CPU and checked for NaNs. This significantly impacts performance.")}),Vt.registerFlag("IS_BROWSER",()=>Uf()),Vt.registerFlag("IS_NODE",()=>typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"),Vt.registerFlag("IS_CHROME",()=>typeof navigator<"u"&&navigator!=null&&navigator.userAgent!=null&&/Chrome/.test(navigator.userAgent)&&/Google Inc/.test(navigator.vendor)),Vt.registerFlag("IS_SAFARI",()=>typeof navigator<"u"&&navigator!=null&&navigator.userAgent!=null&&/Safari/.test(navigator.userAgent)&&/Apple/.test(navigator.vendor)),Vt.registerFlag("PROD",()=>!1),Vt.registerFlag("TENSORLIKE_CHECK_SHAPE_CONSISTENCY",()=>Vt.getBool("DEBUG")),Vt.registerFlag("DEPRECATION_WARNINGS_ENABLED",()=>!0),Vt.registerFlag("IS_TEST",()=>!1),Vt.registerFlag("CHECK_COMPUTATION_FOR_ERRORS",()=>Vt.getBool("DEBUG")),Vt.registerFlag("WRAP_TO_IMAGEBITMAP",()=>!1),Vt.registerFlag("CANVAS2D_WILL_READ_FREQUENTLY_FOR_GPU",()=>!1),Vt.registerFlag("USE_SETTIMEOUTCUSTOM",()=>!1);/** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -287,7 +287,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function xl(n,e){let t=n;if(hn(n))return e==="string"?[]:[n.length];if(Lf(n)){const o=n.channels||"RGBA";return[n.height,n.width*o.length]}else if(Mf(n))return[n.buffer.size/(e==null?4:la(e))];if(!Array.isArray(n))return[];const s=[];for(;Array.isArray(t)||hn(t)&&e!=="string";)s.push(t.length),t=t[0];return Array.isArray(n)&&V().getBool("TENSORLIKE_CHECK_SHAPE_CONSISTENCY")&&Gf(n,s,[]),s}function Gf(n,e,t){if(t=t||[],!Array.isArray(n)&&!hn(n)){v(e.length===0,()=>`Element arr[${t.join("][")}] is a primitive, but should be an array/TypedArray of ${e[0]} elements`);return}v(e.length>0,()=>`Element arr[${t.join("][")}] should be a primitive, but is an array of ${n.length} elements`),v(n.length===e[0],()=>`Element arr[${t.join("][")}] should have ${e[0]} elements, but has ${n.length} elements`);const s=e.slice(1);for(let o=0;o=0&&(o=s),Hf(s,o,e,t),n==null||!hn(n)&&!Array.isArray(n)&&typeof n!="number"&&typeof n!="boolean"&&typeof n!="string"){const l=n==null?"null":n.constructor.name;throw new Error(`Argument '${e}' passed to '${t}' must be a Tensor or TensorLike, but got '${l}'`)}const r=xl(n,o);!hn(n)&&!Array.isArray(n)&&(n=[n]);const a=o!=="string"?Xs(n,o):Ys(n,[],!0);return F.makeTensor(a,r,o)}function qf(n,e,t,s="numeric"){if(!Array.isArray(n))throw new Error(`Argument ${e} passed to ${t} must be a \`Tensor[]\` or \`TensorLike[]\``);return n.map((r,i)=>T(r,`${e}[${i}]`,t,s))}/** + */function xl(n,e){let t=n;if(hn(n))return e==="string"?[]:[n.length];if(Lf(n)){const o=n.channels||"RGBA";return[n.height,n.width*o.length]}else if(Mf(n))return[n.buffer.size/(e==null?4:la(e))];if(!Array.isArray(n))return[];const s=[];for(;Array.isArray(t)||hn(t)&&e!=="string";)s.push(t.length),t=t[0];return Array.isArray(n)&&V().getBool("TENSORLIKE_CHECK_SHAPE_CONSISTENCY")&&Gf(n,s,[]),s}function Gf(n,e,t){if(t=t||[],!Array.isArray(n)&&!hn(n)){k(e.length===0,()=>`Element arr[${t.join("][")}] is a primitive, but should be an array/TypedArray of ${e[0]} elements`);return}k(e.length>0,()=>`Element arr[${t.join("][")}] should be a primitive, but is an array of ${n.length} elements`),k(n.length===e[0],()=>`Element arr[${t.join("][")}] should have ${e[0]} elements, but has ${n.length} elements`);const s=e.slice(1);for(let o=0;o=0&&(o=s),Hf(s,o,e,t),n==null||!hn(n)&&!Array.isArray(n)&&typeof n!="number"&&typeof n!="boolean"&&typeof n!="string"){const l=n==null?"null":n.constructor.name;throw new Error(`Argument '${e}' passed to '${t}' must be a Tensor or TensorLike, but got '${l}'`)}const r=xl(n,o);!hn(n)&&!Array.isArray(n)&&(n=[n]);const a=o!=="string"?Xs(n,o):Ys(n,[],!0);return F.makeTensor(a,r,o)}function qf(n,e,t,s="numeric"){if(!Array.isArray(n))throw new Error(`Argument ${e} passed to ${t} must be a \`Tensor[]\` or \`TensorLike[]\``);return n.map((r,i)=>T(r,`${e}[${i}]`,t,s))}/** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -302,7 +302,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const hC="__op";function L(n){const e=Object.keys(n);if(e.length!==1)throw new Error(`Please provide an object with a single key (operation name) mapping to a function. Got an object with ${e.length} keys.`);let t=e[0];const s=n[t];t.endsWith("_")&&(t=t.substring(0,t.length-1)),t=t+hC;const o=(...r)=>{F.startScope(t);try{const i=s(...r);return Uc(i)&&console.error("Cannot return a Promise inside of tidy."),F.endScope(i),i}catch(i){throw F.endScope(null),i}};return Object.defineProperty(o,"name",{value:t,configurable:!0}),o}/** + */const uC="__op";function L(n){const e=Object.keys(n);if(e.length!==1)throw new Error(`Please provide an object with a single key (operation name) mapping to a function. Got an object with ${e.length} keys.`);let t=e[0];const s=n[t];t.endsWith("_")&&(t=t.substring(0,t.length-1)),t=t+uC;const o=(...r)=>{F.startScope(t);try{const i=s(...r);return Vc(i)&&console.error("Cannot return a Promise inside of tidy."),F.endScope(i),i}catch(i){throw F.endScope(null),i}};return Object.defineProperty(o,"name",{value:t,configurable:!0}),o}/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -317,7 +317,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function dC(n,e){const t=T(n,"real","complex"),s=T(e,"imag","complex");Mc(t.shape,s.shape,`real and imag shapes, ${t.shape} and ${s.shape}, must match in call to tf.complex().`);const o={real:t,imag:s};return F.runKernel(Jc,o)}const Zs=L({complex_:dC});/** + */function hC(n,e){const t=T(n,"real","complex"),s=T(e,"imag","complex");Oc(t.shape,s.shape,`real and imag shapes, ${t.shape} and ${s.shape}, must match in call to tf.complex().`);const o={real:t,imag:s};return F.runKernel(Zc,o)}const Zs=L({complex_:hC});/** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -332,7 +332,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function bl(n,e,t,s){if(s==null)s=_o(n);else if(s==="complex64")throw new Error("Cannot construct a complex64 tensor directly. Please use tf.complex(real, imag).");if(Mf(n)||Lf(n)){if(s!=="float32"&&s!=="int32")throw new Error(`Creating tensor from GPU data only supports 'float32'|'int32' dtype, while the dtype is ${s}.`);return F.backend.createTensorFromGPUData(n,e||t,s)}if(!hn(n)&&!Array.isArray(n)&&typeof n!="number"&&typeof n!="boolean"&&typeof n!="string")throw new Error("values passed to tensor(values) must be a number/boolean/string or an array of numbers/booleans/strings, or a TypedArray");if(e!=null){ns(e);const o=G(e),r=G(t);v(o===r,()=>`Based on the provided shape, [${e}], the tensor should have ${o} values but has ${r}`);for(let i=0;i`Error creating a new Tensor. Inferred shape (${t}) does not match the provided shape (${e}). `)}}return!hn(n)&&!Array.isArray(n)&&(n=[n]),e=e||t,n=s!=="string"?Xs(n,s):Ys(n,[],!0),F.makeTensor(n,e,s)}/** + */function bl(n,e,t,s){if(s==null)s=_o(n);else if(s==="complex64")throw new Error("Cannot construct a complex64 tensor directly. Please use tf.complex(real, imag).");if(Mf(n)||Lf(n)){if(s!=="float32"&&s!=="int32")throw new Error(`Creating tensor from GPU data only supports 'float32'|'int32' dtype, while the dtype is ${s}.`);return F.backend.createTensorFromGPUData(n,e||t,s)}if(!hn(n)&&!Array.isArray(n)&&typeof n!="number"&&typeof n!="boolean"&&typeof n!="string")throw new Error("values passed to tensor(values) must be a number/boolean/string or an array of numbers/booleans/strings, or a TypedArray");if(e!=null){ns(e);const o=G(e),r=G(t);k(o===r,()=>`Based on the provided shape, [${e}], the tensor should have ${o} values but has ${r}`);for(let i=0;i`Error creating a new Tensor. Inferred shape (${t}) does not match the provided shape (${e}). `)}}return!hn(n)&&!Array.isArray(n)&&(n=[n]),e=e||t,n=s!=="string"?Xs(n,s):Ys(n,[],!0),F.makeTensor(n,e,s)}/** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -362,7 +362,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const yl={float32:4,float16:2,int32:4,uint16:2,uint8:1,bool:1,complex64:8};class ws{static join(e){return new ws(e).slice()}constructor(e){if(this.shards=[],this.previousShardIndex=0,e==null||(e instanceof Array||(e=[e]),e=e.map(s=>hn(s)?s.buffer:s),e.length===0))return;this.bufferUniformSize=e[0].byteLength;let t=0;for(let s=0;s=this.byteLength)return-1;if(this.bufferUniformSize!=null)return this.previousShardIndex=Math.floor(e/this.bufferUniformSize),this.previousShardIndex;function t(o){return e=o.end?1:0}if(t(this.shards[this.previousShardIndex])===0)return this.previousShardIndex;const s=pC(this.shards,t);return s===-1?-1:(this.previousShardIndex=s,this.previousShardIndex)}}function pC(n,e){let t=0,s=n.length;for(;t<=s;){const o=Math.floor((s-t)/2)+t,r=e(n[o]);if(r===0)return o;r<0?s=o:t=o+1}return-1}/** + */const yl={float32:4,float16:2,int32:4,uint16:2,uint8:1,bool:1,complex64:8};class ws{static join(e){return new ws(e).slice()}constructor(e){if(this.shards=[],this.previousShardIndex=0,e==null||(e instanceof Array||(e=[e]),e=e.map(s=>hn(s)?s.buffer:s),e.length===0))return;this.bufferUniformSize=e[0].byteLength;let t=0;for(let s=0;s=this.byteLength)return-1;if(this.bufferUniformSize!=null)return this.previousShardIndex=Math.floor(e/this.bufferUniformSize),this.previousShardIndex;function t(o){return e=o.end?1:0}if(t(this.shards[this.previousShardIndex])===0)return this.previousShardIndex;const s=dC(this.shards,t);return s===-1?-1:(this.previousShardIndex=s,this.previousShardIndex)}}function dC(n,e){let t=0,s=n.length;for(;t<=s;){const o=Math.floor((s-t)/2)+t,r=e(n[o]);if(r===0)return o;r<0?s=o:t=o+1}return-1}/** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -377,7 +377,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function fC(){V().set("PROD",!0)}function Te(){return F}function Ot(){return F.memory()}function mC(n){return F.profile(n)}function B(n,e){return F.tidy(n,e)}function fe(n){Pf(n).forEach(t=>t.dispose())}function dn(n){return F.keep(n)}function gC(n){return F.setBackend(n)}function xC(){return F.ready()}function jf(){return F.backendName}function Kf(n,e,t=1){return F.registerBackend(n,e,t)}function bC(){return F.backend}/** + */function pC(){V().set("PROD",!0)}function Te(){return F}function Wt(){return F.memory()}function fC(n){return F.profile(n)}function B(n,e){return F.tidy(n,e)}function fe(n){Pf(n).forEach(t=>t.dispose())}function dn(n){return F.keep(n)}function mC(n){return F.setBackend(n)}function gC(){return F.ready()}function jf(){return F.backendName}function Kf(n,e,t=1){return F.registerBackend(n,e,t)}function xC(){return F.backend}/** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -392,7 +392,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const Wo=4;async function Xf(n,e){const t=[],s=[],o=Array.isArray(n)?n.map(i=>i.name):Object.keys(n);for(let i=0;i{const d=await l.bytes(),p=d.reduce((g,x)=>g+x.length,0)+Wo*d.length,f=new Uint8Array(p);let m=0;for(let g=0;gt.slice(o+a,o+l));s[r.name]=CC(r,t.slice(o,o+i)),o+=i}return s}function wC(n,e){const t=G(n.shape);let s;if("quantization"in n){const o=n.quantization;s=yl[o.dtype]}else if(n.dtype==="string"){let o=0;for(let r=0;r{if(e+=r.byteLength,t.push(r.byteLength===r.buffer.byteLength?r:new r.constructor(r)),!(r instanceof Float32Array||r instanceof Int32Array||r instanceof Uint8Array))throw new Error(`Unsupported TypedArray subtype: ${r.constructor.name}`)});const s=new Uint8Array(e);let o=0;return t.forEach(r=>{s.set(new Uint8Array(r.buffer),o),o+=r.byteLength}),s.buffer}const qu=typeof Buffer<"u"&&(typeof Blob>"u"||typeof atob>"u"||typeof btoa>"u");function Yf(n){return qu?Buffer.byteLength(n,"utf8"):new Blob([n]).size}function $C(n){if(qu)return Buffer.from(n).toString("base64");const e=new Uint8Array(n);let t="";for(let s=0,o=e.length;s{let s=t<<13,o=0;for(;!(s&8388608);)o-=8388608,s<<=1;return s&=-8388609,o+=947912704,s|o},e=new Uint32Array(2048);e[0]=0;for(let t=1;t<1024;t++)e[t]=n(t);for(let t=1024;t<2048;t++)e[t]=939524096+(t-1024<<13);return e}function RC(){const n=new Uint32Array(64);n[0]=0,n[31]=1199570944,n[32]=2147483648,n[63]=3347054592;for(let e=1;e<31;e++)n[e]=e<<23;for(let e=33;e<63;e++)n[e]=2147483648+(e-32<<23);return n}function AC(){const n=new Uint32Array(64);for(let e=0;e<64;e++)n[e]=1024;return n[0]=n[32]=0,n}function DC(){const n=EC(),e=RC(),t=AC();return s=>{const o=new ArrayBuffer(4*s.length),r=new Uint32Array(o);for(let i=0;i>10]+(a&1023)]+e[a>>10];r[i]=l}return new Float32Array(o)}}/** + */const Wo=4;async function Xf(n,e){const t=[],s=[],o=Array.isArray(n)?n.map(i=>i.name):Object.keys(n);for(let i=0;i{const d=await l.bytes(),p=d.reduce((g,x)=>g+x.length,0)+Wo*d.length,f=new Uint8Array(p);let m=0;for(let g=0;gt.slice(o+a,o+l));s[r.name]=wC(r,t.slice(o,o+i)),o+=i}return s}function yC(n,e){const t=G(n.shape);let s;if("quantization"in n){const o=n.quantization;s=yl[o.dtype]}else if(n.dtype==="string"){let o=0;for(let r=0;r{if(e+=r.byteLength,t.push(r.byteLength===r.buffer.byteLength?r:new r.constructor(r)),!(r instanceof Float32Array||r instanceof Int32Array||r instanceof Uint8Array))throw new Error(`Unsupported TypedArray subtype: ${r.constructor.name}`)});const s=new Uint8Array(e);let o=0;return t.forEach(r=>{s.set(new Uint8Array(r.buffer),o),o+=r.byteLength}),s.buffer}const Gu=typeof Buffer<"u"&&(typeof Blob>"u"||typeof atob>"u"||typeof btoa>"u");function Yf(n){return Gu?Buffer.byteLength(n,"utf8"):new Blob([n]).size}function IC(n){if(Gu)return Buffer.from(n).toString("base64");const e=new Uint8Array(n);let t="";for(let s=0,o=e.length;s{let s=t<<13,o=0;for(;!(s&8388608);)o-=8388608,s<<=1;return s&=-8388609,o+=947912704,s|o},e=new Uint32Array(2048);e[0]=0;for(let t=1;t<1024;t++)e[t]=n(t);for(let t=1024;t<2048;t++)e[t]=939524096+(t-1024<<13);return e}function EC(){const n=new Uint32Array(64);n[0]=0,n[31]=1199570944,n[32]=2147483648,n[63]=3347054592;for(let e=1;e<31;e++)n[e]=e<<23;for(let e=33;e<63;e++)n[e]=2147483648+(e-32<<23);return n}function RC(){const n=new Uint32Array(64);for(let e=0;e<64;e++)n[e]=1024;return n[0]=n[32]=0,n}function AC(){const n=NC(),e=EC(),t=RC();return s=>{const o=new ArrayBuffer(4*s.length),r=new Uint32Array(o);for(let i=0;i>10]+(a&1023)]+e[a>>10];r[i]=l}return new Float32Array(o)}}/** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -407,7 +407,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */class xt{constructor(){this.saveRouters=[],this.loadRouters=[]}static getInstance(){return xt.instance==null&&(xt.instance=new xt),xt.instance}static registerSaveRouter(e){xt.getInstance().saveRouters.push(e)}static registerLoadRouter(e){xt.getInstance().loadRouters.push(e)}static getSaveHandlers(e){return xt.getHandlers(e,"save")}static getLoadHandlers(e,t){return xt.getHandlers(e,"load",t)}static getHandlers(e,t,s){const o=[];return(t==="load"?xt.getInstance().loadRouters:xt.getInstance().saveRouters).forEach(i=>{const a=i(e,s);a!==null&&o.push(a)}),o}}const FC=n=>xt.getSaveHandlers(n),_C=(n,e)=>xt.getLoadHandlers(n,e);/** + */class xt{constructor(){this.saveRouters=[],this.loadRouters=[]}static getInstance(){return xt.instance==null&&(xt.instance=new xt),xt.instance}static registerSaveRouter(e){xt.getInstance().saveRouters.push(e)}static registerLoadRouter(e){xt.getInstance().loadRouters.push(e)}static getSaveHandlers(e){return xt.getHandlers(e,"save")}static getLoadHandlers(e,t){return xt.getHandlers(e,"load",t)}static getHandlers(e,t,s){const o=[];return(t==="load"?xt.getInstance().loadRouters:xt.getInstance().saveRouters).forEach(i=>{const a=i(e,s);a!==null&&o.push(a)}),o}}const DC=n=>xt.getSaveHandlers(n),FC=(n,e)=>xt.getLoadHandlers(n,e);/** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -422,7 +422,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const Ku="tensorflowjs",Xu=1,Qs="models_store",Cs="model_info_store";function Qf(){if(!V().getBool("IS_BROWSER"))throw new Error("Failed to obtain IndexedDB factory because the current environmentis not a web browser.");const n=typeof window>"u"?self:window,e=n.indexedDB||n.mozIndexedDB||n.webkitIndexedDB||n.msIndexedDB||n.shimIndexedDB;if(e==null)throw new Error("The current browser does not appear to support IndexedDB.");return e}function Yu(n){const e=n.result;e.createObjectStore(Qs,{keyPath:"modelPath"}),e.createObjectStore(Cs,{keyPath:"modelPath"})}class Js{constructor(e){if(this.indexedDB=Qf(),e==null||!e)throw new Error("For IndexedDB, modelPath must not be null, undefined or empty.");this.modelPath=e}async save(e){if(e.modelTopology instanceof ArrayBuffer)throw new Error("BrowserLocalStorage.save() does not support saving model topology in binary formats yet.");return this.databaseAction(this.modelPath,e)}async load(){return this.databaseAction(this.modelPath)}databaseAction(e,t){return new Promise((s,o)=>{const r=this.indexedDB.open(Ku,Xu);r.onupgradeneeded=()=>Yu(r),r.onsuccess=()=>{const i=r.result;if(t==null){const a=i.transaction(Qs,"readonly"),c=a.objectStore(Qs).get(this.modelPath);c.onsuccess=()=>{if(c.result==null)return i.close(),o(new Error(`Cannot find model with path '${this.modelPath}' in IndexedDB.`));s(c.result.modelArtifacts)},c.onerror=u=>(i.close(),o(c.error)),a.oncomplete=()=>i.close()}else{t.weightData=ws.join(t.weightData);const a=ju(t),l=i.transaction(Cs,"readwrite");let c=l.objectStore(Cs),u;try{u=c.put({modelPath:this.modelPath,modelArtifactsInfo:a})}catch(d){return o(d)}let h;u.onsuccess=()=>{h=i.transaction(Qs,"readwrite");const d=h.objectStore(Qs);let p;try{p=d.put({modelPath:this.modelPath,modelArtifacts:t,modelArtifactsInfo:a})}catch(f){return o(f)}p.onsuccess=()=>s({modelArtifactsInfo:a}),p.onerror=f=>{c=l.objectStore(Cs);const m=c.delete(this.modelPath);m.onsuccess=()=>(i.close(),o(p.error)),m.onerror=g=>(i.close(),o(p.error))}},u.onerror=d=>(i.close(),o(u.error)),l.oncomplete=()=>{h==null?i.close():h.oncomplete=()=>i.close()}}},r.onerror=i=>o(r.error)})}}Js.URL_SCHEME="indexeddb://";const Jf=n=>V().getBool("IS_BROWSER")&&!Array.isArray(n)&&n.startsWith(Js.URL_SCHEME)?OC(n.slice(Js.URL_SCHEME.length)):null;xt.registerSaveRouter(Jf),xt.registerLoadRouter(Jf);function OC(n){return new Js(n)}function LC(n){return n.startsWith(Js.URL_SCHEME)?n.slice(Js.URL_SCHEME.length):n}class MC{constructor(){this.indexedDB=Qf()}async listModels(){return new Promise((e,t)=>{const s=this.indexedDB.open(Ku,Xu);s.onupgradeneeded=()=>Yu(s),s.onsuccess=()=>{const o=s.result,r=o.transaction(Cs,"readonly"),a=r.objectStore(Cs).getAll();a.onsuccess=()=>{const l={};for(const c of a.result)l[c.modelPath]=c.modelArtifactsInfo;e(l)},a.onerror=l=>(o.close(),t(a.error)),r.oncomplete=()=>o.close()},s.onerror=o=>t(s.error)})}async removeModel(e){return e=LC(e),new Promise((t,s)=>{const o=this.indexedDB.open(Ku,Xu);o.onupgradeneeded=()=>Yu(o),o.onsuccess=()=>{const r=o.result,i=r.transaction(Cs,"readwrite"),a=i.objectStore(Cs),l=a.get(e);let c;l.onsuccess=()=>{if(l.result==null)return r.close(),s(new Error(`Cannot find model with path '${e}' in IndexedDB.`));{const u=a.delete(e),h=()=>{c=r.transaction(Qs,"readwrite");const p=c.objectStore(Qs).delete(e);p.onsuccess=()=>t(l.result.modelArtifactsInfo),p.onerror=f=>s(l.error)};u.onsuccess=h,u.onerror=d=>(h(),r.close(),s(l.error))}},l.onerror=u=>(r.close(),s(l.error)),i.oncomplete=()=>{c==null?r.close():c.oncomplete=()=>r.close()}},o.onerror=r=>s(o.error)})}}/** + */const qu="tensorflowjs",ju=1,Qs="models_store",Cs="model_info_store";function Qf(){if(!V().getBool("IS_BROWSER"))throw new Error("Failed to obtain IndexedDB factory because the current environmentis not a web browser.");const n=typeof window>"u"?self:window,e=n.indexedDB||n.mozIndexedDB||n.webkitIndexedDB||n.msIndexedDB||n.shimIndexedDB;if(e==null)throw new Error("The current browser does not appear to support IndexedDB.");return e}function Ku(n){const e=n.result;e.createObjectStore(Qs,{keyPath:"modelPath"}),e.createObjectStore(Cs,{keyPath:"modelPath"})}class Js{constructor(e){if(this.indexedDB=Qf(),e==null||!e)throw new Error("For IndexedDB, modelPath must not be null, undefined or empty.");this.modelPath=e}async save(e){if(e.modelTopology instanceof ArrayBuffer)throw new Error("BrowserLocalStorage.save() does not support saving model topology in binary formats yet.");return this.databaseAction(this.modelPath,e)}async load(){return this.databaseAction(this.modelPath)}databaseAction(e,t){return new Promise((s,o)=>{const r=this.indexedDB.open(qu,ju);r.onupgradeneeded=()=>Ku(r),r.onsuccess=()=>{const i=r.result;if(t==null){const a=i.transaction(Qs,"readonly"),c=a.objectStore(Qs).get(this.modelPath);c.onsuccess=()=>{if(c.result==null)return i.close(),o(new Error(`Cannot find model with path '${this.modelPath}' in IndexedDB.`));s(c.result.modelArtifacts)},c.onerror=u=>(i.close(),o(c.error)),a.oncomplete=()=>i.close()}else{t.weightData=ws.join(t.weightData);const a=Hu(t),l=i.transaction(Cs,"readwrite");let c=l.objectStore(Cs),u;try{u=c.put({modelPath:this.modelPath,modelArtifactsInfo:a})}catch(d){return o(d)}let h;u.onsuccess=()=>{h=i.transaction(Qs,"readwrite");const d=h.objectStore(Qs);let p;try{p=d.put({modelPath:this.modelPath,modelArtifacts:t,modelArtifactsInfo:a})}catch(f){return o(f)}p.onsuccess=()=>s({modelArtifactsInfo:a}),p.onerror=f=>{c=l.objectStore(Cs);const m=c.delete(this.modelPath);m.onsuccess=()=>(i.close(),o(p.error)),m.onerror=g=>(i.close(),o(p.error))}},u.onerror=d=>(i.close(),o(u.error)),l.oncomplete=()=>{h==null?i.close():h.oncomplete=()=>i.close()}}},r.onerror=i=>o(r.error)})}}Js.URL_SCHEME="indexeddb://";const Jf=n=>V().getBool("IS_BROWSER")&&!Array.isArray(n)&&n.startsWith(Js.URL_SCHEME)?_C(n.slice(Js.URL_SCHEME.length)):null;xt.registerSaveRouter(Jf),xt.registerLoadRouter(Jf);function _C(n){return new Js(n)}function OC(n){return n.startsWith(Js.URL_SCHEME)?n.slice(Js.URL_SCHEME.length):n}class LC{constructor(){this.indexedDB=Qf()}async listModels(){return new Promise((e,t)=>{const s=this.indexedDB.open(qu,ju);s.onupgradeneeded=()=>Ku(s),s.onsuccess=()=>{const o=s.result,r=o.transaction(Cs,"readonly"),a=r.objectStore(Cs).getAll();a.onsuccess=()=>{const l={};for(const c of a.result)l[c.modelPath]=c.modelArtifactsInfo;e(l)},a.onerror=l=>(o.close(),t(a.error)),r.oncomplete=()=>o.close()},s.onerror=o=>t(s.error)})}async removeModel(e){return e=OC(e),new Promise((t,s)=>{const o=this.indexedDB.open(qu,ju);o.onupgradeneeded=()=>Ku(o),o.onsuccess=()=>{const r=o.result,i=r.transaction(Cs,"readwrite"),a=i.objectStore(Cs),l=a.get(e);let c;l.onsuccess=()=>{if(l.result==null)return r.close(),s(new Error(`Cannot find model with path '${e}' in IndexedDB.`));{const u=a.delete(e),h=()=>{c=r.transaction(Qs,"readwrite");const p=c.objectStore(Qs).delete(e);p.onsuccess=()=>t(l.result.modelArtifactsInfo),p.onerror=f=>s(l.error)};u.onsuccess=h,u.onerror=d=>(h(),r.close(),s(l.error))}},l.onerror=u=>(r.close(),s(l.error)),i.oncomplete=()=>{c==null?r.close():c.oncomplete=()=>r.close()}},o.onerror=r=>s(o.error)})}}/** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -437,7 +437,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const os="/",Uo="tensorflowjs_models",em="info",PC="model_topology",BC="weight_specs",zC="weight_data",VC="model_metadata";function tm(n){return{info:[Uo,n,em].join(os),topology:[Uo,n,PC].join(os),weightSpecs:[Uo,n,BC].join(os),weightData:[Uo,n,zC].join(os),modelMetadata:[Uo,n,VC].join(os)}}function nm(n){for(const e of Object.values(n))window.localStorage.removeItem(e)}function WC(n){const e=n.split(os);if(e.length<3)throw new Error(`Invalid key format: ${n}`);return e.slice(1,e.length-1).join(os)}function UC(n){return n.startsWith(eo.URL_SCHEME)?n.slice(eo.URL_SCHEME.length):n}class eo{constructor(e){if(!V().getBool("IS_BROWSER")||typeof window>"u"||typeof window.localStorage>"u")throw new Error("The current environment does not support local storage.");if(this.LS=window.localStorage,e==null||!e)throw new Error("For local storage, modelPath must not be null, undefined or empty.");this.modelPath=e,this.keys=tm(this.modelPath)}async save(e){if(e.modelTopology instanceof ArrayBuffer)throw new Error("BrowserLocalStorage.save() does not support saving model topology in binary formats yet.");{const t=JSON.stringify(e.modelTopology),s=JSON.stringify(e.weightSpecs),o=ju(e),r=ws.join(e.weightData);try{this.LS.setItem(this.keys.info,JSON.stringify(o)),this.LS.setItem(this.keys.topology,t),this.LS.setItem(this.keys.weightSpecs,s),this.LS.setItem(this.keys.weightData,$C(r));const i={format:e.format,generatedBy:e.generatedBy,convertedBy:e.convertedBy,signature:e.signature!=null?e.signature:void 0,userDefinedMetadata:e.userDefinedMetadata!=null?e.userDefinedMetadata:void 0,modelInitializer:e.modelInitializer!=null?e.modelInitializer:void 0,initializerSignature:e.initializerSignature!=null?e.initializerSignature:void 0,trainingConfig:e.trainingConfig!=null?e.trainingConfig:void 0};return this.LS.setItem(this.keys.modelMetadata,JSON.stringify(i)),{modelArtifactsInfo:o}}catch{throw nm(this.keys),new Error(`Failed to save model '${this.modelPath}' to local storage: size quota being exceeded is a possible cause of this failure: modelTopologyBytes=${o.modelTopologyBytes}, weightSpecsBytes=${o.weightSpecsBytes}, weightDataBytes=${o.weightDataBytes}.`)}}}async load(){const e=JSON.parse(this.LS.getItem(this.keys.info));if(e==null)throw new Error(`In local storage, there is no model with name '${this.modelPath}'`);if(e.modelTopologyType!=="JSON")throw new Error("BrowserLocalStorage does not support loading non-JSON model topology yet.");const t={},s=JSON.parse(this.LS.getItem(this.keys.topology));if(s==null)throw new Error(`In local storage, the topology of model '${this.modelPath}' is missing.`);t.modelTopology=s;const o=JSON.parse(this.LS.getItem(this.keys.weightSpecs));if(o==null)throw new Error(`In local storage, the weight specs of model '${this.modelPath}' are missing.`);t.weightSpecs=o;const r=this.LS.getItem(this.keys.modelMetadata);if(r!=null){const a=JSON.parse(r);t.format=a.format,t.generatedBy=a.generatedBy,t.convertedBy=a.convertedBy,a.signature!=null&&(t.signature=a.signature),a.userDefinedMetadata!=null&&(t.userDefinedMetadata=a.userDefinedMetadata),a.modelInitializer!=null&&(t.modelInitializer=a.modelInitializer),a.initializerSignature!=null&&(t.initializerSignature=a.initializerSignature),a.trainingConfig!=null&&(t.trainingConfig=a.trainingConfig)}const i=this.LS.getItem(this.keys.weightData);if(i==null)throw new Error(`In local storage, the binary weight values of model '${this.modelPath}' are missing.`);return t.weightData=kC(i),t}}eo.URL_SCHEME="localstorage://";const sm=n=>V().getBool("IS_BROWSER")&&!Array.isArray(n)&&n.startsWith(eo.URL_SCHEME)?GC(n.slice(eo.URL_SCHEME.length)):null;xt.registerSaveRouter(sm),xt.registerLoadRouter(sm);function GC(n){return new eo(n)}class HC{constructor(){v(V().getBool("IS_BROWSER"),()=>"Current environment is not a web browser"),v(typeof window>"u"||typeof window.localStorage<"u",()=>"Current browser does not appear to support localStorage"),this.LS=window.localStorage}async listModels(){const e={},t=Uo+os,s=os+em;for(let o=0;o"u"||typeof window.localStorage>"u")throw new Error("The current environment does not support local storage.");if(this.LS=window.localStorage,e==null||!e)throw new Error("For local storage, modelPath must not be null, undefined or empty.");this.modelPath=e,this.keys=tm(this.modelPath)}async save(e){if(e.modelTopology instanceof ArrayBuffer)throw new Error("BrowserLocalStorage.save() does not support saving model topology in binary formats yet.");{const t=JSON.stringify(e.modelTopology),s=JSON.stringify(e.weightSpecs),o=Hu(e),r=ws.join(e.weightData);try{this.LS.setItem(this.keys.info,JSON.stringify(o)),this.LS.setItem(this.keys.topology,t),this.LS.setItem(this.keys.weightSpecs,s),this.LS.setItem(this.keys.weightData,IC(r));const i={format:e.format,generatedBy:e.generatedBy,convertedBy:e.convertedBy,signature:e.signature!=null?e.signature:void 0,userDefinedMetadata:e.userDefinedMetadata!=null?e.userDefinedMetadata:void 0,modelInitializer:e.modelInitializer!=null?e.modelInitializer:void 0,initializerSignature:e.initializerSignature!=null?e.initializerSignature:void 0,trainingConfig:e.trainingConfig!=null?e.trainingConfig:void 0};return this.LS.setItem(this.keys.modelMetadata,JSON.stringify(i)),{modelArtifactsInfo:o}}catch{throw nm(this.keys),new Error(`Failed to save model '${this.modelPath}' to local storage: size quota being exceeded is a possible cause of this failure: modelTopologyBytes=${o.modelTopologyBytes}, weightSpecsBytes=${o.weightSpecsBytes}, weightDataBytes=${o.weightDataBytes}.`)}}}async load(){const e=JSON.parse(this.LS.getItem(this.keys.info));if(e==null)throw new Error(`In local storage, there is no model with name '${this.modelPath}'`);if(e.modelTopologyType!=="JSON")throw new Error("BrowserLocalStorage does not support loading non-JSON model topology yet.");const t={},s=JSON.parse(this.LS.getItem(this.keys.topology));if(s==null)throw new Error(`In local storage, the topology of model '${this.modelPath}' is missing.`);t.modelTopology=s;const o=JSON.parse(this.LS.getItem(this.keys.weightSpecs));if(o==null)throw new Error(`In local storage, the weight specs of model '${this.modelPath}' are missing.`);t.weightSpecs=o;const r=this.LS.getItem(this.keys.modelMetadata);if(r!=null){const a=JSON.parse(r);t.format=a.format,t.generatedBy=a.generatedBy,t.convertedBy=a.convertedBy,a.signature!=null&&(t.signature=a.signature),a.userDefinedMetadata!=null&&(t.userDefinedMetadata=a.userDefinedMetadata),a.modelInitializer!=null&&(t.modelInitializer=a.modelInitializer),a.initializerSignature!=null&&(t.initializerSignature=a.initializerSignature),a.trainingConfig!=null&&(t.trainingConfig=a.trainingConfig)}const i=this.LS.getItem(this.keys.weightData);if(i==null)throw new Error(`In local storage, the binary weight values of model '${this.modelPath}' are missing.`);return t.weightData=$C(i),t}}eo.URL_SCHEME="localstorage://";const sm=n=>V().getBool("IS_BROWSER")&&!Array.isArray(n)&&n.startsWith(eo.URL_SCHEME)?UC(n.slice(eo.URL_SCHEME.length)):null;xt.registerSaveRouter(sm),xt.registerLoadRouter(sm);function UC(n){return new eo(n)}class GC{constructor(){k(V().getBool("IS_BROWSER"),()=>"Current environment is not a web browser"),k(typeof window>"u"||typeof window.localStorage<"u",()=>"Current browser does not appear to support localStorage"),this.LS=window.localStorage}async listModels(){const e={},t=Uo+os,s=os+em;for(let o=0;o"scheme must not be undefined or null."),e.endsWith(om)&&(e=e.slice(0,e.indexOf(om))),v(e.length>0,()=>"scheme must not be an empty string.");const s=Bn.getInstance();v(s.managers[e]==null,()=>`A model store manager is already registered for scheme '${e}'.`),s.managers[e]=t}static getManager(e){const t=Bn.getInstance().managers[e];if(t==null)throw new Error(`Cannot find model manager for scheme '${e}'`);return t}static getSchemes(){return Object.keys(Bn.getInstance().managers)}}/** + */const om="://";class Bn{constructor(){this.managers={}}static getInstance(){return Bn.instance==null&&(Bn.instance=new Bn),Bn.instance}static registerManager(e,t){k(e!=null,()=>"scheme must not be undefined or null."),e.endsWith(om)&&(e=e.slice(0,e.indexOf(om))),k(e.length>0,()=>"scheme must not be an empty string.");const s=Bn.getInstance();k(s.managers[e]==null,()=>`A model store manager is already registered for scheme '${e}'.`),s.managers[e]=t}static getManager(e){const t=Bn.getInstance().managers[e];if(t==null)throw new Error(`Cannot find model manager for scheme '${e}'`);return t}static getSchemes(){return Object.keys(Bn.getInstance().managers)}}/** * @license * Copyright 2019 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -467,7 +467,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */class qC{constructor(){this.messageName="setTimeoutCustom",this.functionRefs=[],this.handledMessageCount=0,this.hasEventListener=!1}fetch(e,t){return fetch(e,t)}now(){return performance.now()}encode(e,t){if(t!=="utf-8"&&t!=="utf8")throw new Error(`Browser's encoder only supports utf-8, but got ${t}`);return this.textEncoder==null&&(this.textEncoder=new TextEncoder),this.textEncoder.encode(e)}decode(e,t){return new TextDecoder(t).decode(e)}setTimeoutCustom(e,t){if(typeof window>"u"||!V().getBool("USE_SETTIMEOUTCUSTOM")){setTimeout(e,t);return}this.functionRefs.push(e),setTimeout(()=>{window.postMessage({name:this.messageName,index:this.functionRefs.length-1},"*")},t),this.hasEventListener||(this.hasEventListener=!0,window.addEventListener("message",s=>{if(s.source===window&&s.data.name===this.messageName){s.stopPropagation();const o=this.functionRefs[s.data.index];o(),this.handledMessageCount++,this.handledMessageCount===this.functionRefs.length&&(this.functionRefs=[],this.handledMessageCount=0)}},!0))}isTypedArray(e){return bf(e)}}if(V().get("IS_BROWSER")){V().setPlatform("browser",new qC);try{Bn.registerManager(eo.URL_SCHEME,new HC)}catch{}try{Bn.registerManager(Js.URL_SCHEME,new MC)}catch{}}/** + */class HC{constructor(){this.messageName="setTimeoutCustom",this.functionRefs=[],this.handledMessageCount=0,this.hasEventListener=!1}fetch(e,t){return fetch(e,t)}now(){return performance.now()}encode(e,t){if(t!=="utf-8"&&t!=="utf8")throw new Error(`Browser's encoder only supports utf-8, but got ${t}`);return this.textEncoder==null&&(this.textEncoder=new TextEncoder),this.textEncoder.encode(e)}decode(e,t){return new TextDecoder(t).decode(e)}setTimeoutCustom(e,t){if(typeof window>"u"||!V().getBool("USE_SETTIMEOUTCUSTOM")){setTimeout(e,t);return}this.functionRefs.push(e),setTimeout(()=>{window.postMessage({name:this.messageName,index:this.functionRefs.length-1},"*")},t),this.hasEventListener||(this.hasEventListener=!0,window.addEventListener("message",s=>{if(s.source===window&&s.data.name===this.messageName){s.stopPropagation();const o=this.functionRefs[s.data.index];o(),this.handledMessageCount++,this.handledMessageCount===this.functionRefs.length&&(this.functionRefs=[],this.handledMessageCount=0)}},!0))}isTypedArray(e){return bf(e)}}if(V().get("IS_BROWSER")){V().setPlatform("browser",new HC);try{Bn.registerManager(eo.URL_SCHEME,new GC)}catch{}try{Bn.registerManager(Js.URL_SCHEME,new LC)}catch{}}/** * @license * Copyright 2019 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -482,7 +482,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const jC={importFetch:()=>require("node-fetch")};let Zu;class KC{constructor(){this.util=require("util"),this.textEncoder=new this.util.TextEncoder}fetch(e,t){return V().global.fetch!=null?V().global.fetch(e,t):(Zu==null&&(Zu=jC.importFetch()),Zu(e,t))}now(){const e=process.hrtime();return e[0]*1e3+e[1]/1e6}encode(e,t){if(t!=="utf-8"&&t!=="utf8")throw new Error(`Node built-in encoder only supports utf-8, but got ${t}`);return this.textEncoder.encode(e)}decode(e,t){return e.length===0?"":new this.util.TextDecoder(t).decode(e)}isTypedArray(e){return this.util.types.isFloat32Array(e)||this.util.types.isInt32Array(e)||this.util.types.isUint8Array(e)||this.util.types.isUint8ClampedArray(e)}}V().get("IS_NODE")&&!V().get("IS_BROWSER")&&V().setPlatform("node",new KC);/** + */const qC={importFetch:()=>require("node-fetch")};let Xu;class jC{constructor(){this.util=require("util"),this.textEncoder=new this.util.TextEncoder}fetch(e,t){return V().global.fetch!=null?V().global.fetch(e,t):(Xu==null&&(Xu=qC.importFetch()),Xu(e,t))}now(){const e=process.hrtime();return e[0]*1e3+e[1]/1e6}encode(e,t){if(t!=="utf-8"&&t!=="utf8")throw new Error(`Node built-in encoder only supports utf-8, but got ${t}`);return this.textEncoder.encode(e)}decode(e,t){return e.length===0?"":new this.util.TextDecoder(t).decode(e)}isTypedArray(e){return this.util.types.isFloat32Array(e)||this.util.types.isInt32Array(e)||this.util.types.isUint8Array(e)||this.util.types.isUint8ClampedArray(e)}}V().get("IS_NODE")&&!V().get("IS_BROWSER")&&V().setPlatform("node",new jC);/** * @license * Copyright 2020 Google Inc. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -512,7 +512,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function XC(n,e){const t=T(n,"x","cast");if(!vw(e))throw new Error(`Failed to cast to unknown dtype ${e}`);if(e==="string"&&t.dtype!=="string"||e!=="string"&&t.dtype==="string")throw new Error("Only strings can be casted to strings");const s={x:t},o={dtype:e};return F.runKernel(Tr,s,o)}const re=L({cast_:XC});/** + */function KC(n,e){const t=T(n,"x","cast");if(!kw(e))throw new Error(`Failed to cast to unknown dtype ${e}`);if(e==="string"&&t.dtype!=="string"||e!=="string"&&t.dtype==="string")throw new Error("Only strings can be casted to strings");const s={x:t},o={dtype:e};return F.runKernel(Tr,s,o)}const re=L({cast_:KC});/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -527,7 +527,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function YC(n){const t={x:T(n,"x","clone","string_or_numeric")};return F.runKernel(zr,t)}const to=L({clone_:YC});/** + */function XC(n){const t={x:T(n,"x","clone","string_or_numeric")};return F.runKernel(zr,t)}const to=L({clone_:XC});/** * @license * Copyright 2020 Google Inc. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -542,7 +542,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function ZC(n,e=!1){console.log(n.toString(e))}/** + */function YC(n,e=!1){console.log(n.toString(e))}/** * @license * Copyright 2020 Google Inc. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -557,7 +557,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */Vf(),rC({buffer:ke,cast:re,clone:to,print:ZC});/** + */Vf(),oC({buffer:ke,cast:re,clone:to,print:YC});/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -572,7 +572,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function QC(n,e){let t=T(n,"a","add"),s=T(e,"b","add");[t,s]=tt(t,s);const o={a:t,b:s};return F.runKernel(Lo,o)}const J=L({add_:QC});/** + */function ZC(n,e){let t=T(n,"a","add"),s=T(e,"b","add");[t,s]=tt(t,s);const o={a:t,b:s};return F.runKernel(Lo,o)}const J=L({add_:ZC});/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -587,7 +587,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function JC(n,e){let t=T(n,"a","floorDiv"),s=T(e,"b","floorDiv");[t,s]=tt(t,s);const o={a:t,b:s};return F.runKernel(Pr,o)}const rm=L({floorDiv_:JC});/** + */function QC(n,e){let t=T(n,"a","floorDiv"),s=T(e,"b","floorDiv");[t,s]=tt(t,s);const o={a:t,b:s};return F.runKernel(Pr,o)}const rm=L({floorDiv_:QC});/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -602,7 +602,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function eI(n,e){let t=T(n,"a","div"),s=T(e,"b","div");if([t,s]=tt(t,s),t.dtype==="int32"&&s.dtype==="int32")return rm(t,s);const o={a:t,b:s},r={};return F.runKernel(Dr,o,r)}const me=L({div_:eI});/** + */function JC(n,e){let t=T(n,"a","div"),s=T(e,"b","div");if([t,s]=tt(t,s),t.dtype==="int32"&&s.dtype==="int32")return rm(t,s);const o={a:t,b:s},r={};return F.runKernel(Dr,o,r)}const me=L({div_:JC});/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -617,7 +617,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function tI(n,e){let t=T(n,"a","mul"),s=T(e,"b","mul");[t,s]=tt(t,s);const o={a:t,b:s};return F.runKernel(Xr,o)}const D=L({mul_:tI});/** + */function eI(n,e){let t=T(n,"a","mul"),s=T(e,"b","mul");[t,s]=tt(t,s);const o={a:t,b:s};return F.runKernel(Xr,o)}const D=L({mul_:eI});/** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -632,7 +632,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function nI(n){const e=T(n,"x","abs");if(e.dtype==="complex64"){const t={x:e};return F.runKernel(ga,t)}else{const t={x:e};return F.runKernel(ca,t)}}const Lt=L({abs_:nI});/** + */function tI(n){const e=T(n,"x","abs");if(e.dtype==="complex64"){const t={x:e};return F.runKernel(ga,t)}else{const t={x:e};return F.runKernel(ca,t)}}const _t=L({abs_:tI});/** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -647,7 +647,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function sI(n){const t={x:T(n,"x","acos")};return F.runKernel(wr,t)}const oI=L({acos_:sI});/** + */function nI(n){const t={x:T(n,"x","acos")};return F.runKernel(wr,t)}const sI=L({acos_:nI});/** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -662,7 +662,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function rI(n){const t={x:T(n,"x","acosh")};return F.runKernel(Cr,t)}const iI=L({acosh_:rI});/** + */function oI(n){const t={x:T(n,"x","acosh")};return F.runKernel(Cr,t)}const rI=L({acosh_:oI});/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -677,7 +677,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function aI(n,e=null,t=!1){const o={x:T(n,"x","all","bool")},r={axis:e,keepDims:t};return F.runKernel(jc,o,r)}const im=L({all_:aI});/** + */function iI(n,e=null,t=!1){const o={x:T(n,"x","all","bool")},r={axis:e,keepDims:t};return F.runKernel(Hc,o,r)}const im=L({all_:iI});/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -692,7 +692,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function lI(n,e=null,t=!1){const o={x:T(n,"x","any","bool")},r={axis:e,keepDims:t};return F.runKernel(Kc,o,r)}const Qu=L({any_:lI});/** + */function aI(n,e=null,t=!1){const o={x:T(n,"x","any","bool")},r={axis:e,keepDims:t};return F.runKernel(qc,o,r)}const Yu=L({any_:aI});/** * @license * Copyright 2020 Google Inc. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -707,7 +707,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function cI(n,e=0){const s={x:T(n,"x","argMax")},o={axis:e};return F.runKernel(ua,s,o)}const no=L({argMax_:cI});/** + */function lI(n,e=0){const s={x:T(n,"x","argMax")},o={axis:e};return F.runKernel(ua,s,o)}const no=L({argMax_:lI});/** * @license * Copyright 2020 Google Inc. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -722,7 +722,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function uI(n,e=0){const s={x:T(n,"x","argMin")},o={axis:e};return F.runKernel(ha,s,o)}const hI=L({argMin_:uI});/** + */function cI(n,e=0){const s={x:T(n,"x","argMin")},o={axis:e};return F.runKernel(ha,s,o)}const uI=L({argMin_:cI});/** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -737,7 +737,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function dI(n){const t={x:T(n,"x","asin")};return F.runKernel(Ir,t)}const pI=L({asin_:dI});/** + */function hI(n){const t={x:T(n,"x","asin")};return F.runKernel(Ir,t)}const dI=L({asin_:hI});/** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -752,7 +752,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function fI(n){const t={x:T(n,"x","asinh")};return F.runKernel($r,t)}const mI=L({asinh_:fI});/** + */function pI(n){const t={x:T(n,"x","asinh")};return F.runKernel($r,t)}const fI=L({asinh_:pI});/** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -767,7 +767,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function gI(n){const t={x:T(n,"x","atan")};return F.runKernel(kr,t)}const xI=L({atan_:gI});/** + */function mI(n){const t={x:T(n,"x","atan")};return F.runKernel(kr,t)}const gI=L({atan_:mI});/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -782,7 +782,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function bI(n,e){let t=T(n,"a","atan2"),s=T(e,"b","atan2");[t,s]=tt(t,s);const o={a:t,b:s};return F.runKernel(Sr,o)}const yI=L({atan2_:bI});/** + */function xI(n,e){let t=T(n,"a","atan2"),s=T(e,"b","atan2");[t,s]=tt(t,s);const o={a:t,b:s};return F.runKernel(Sr,o)}const bI=L({atan2_:xI});/** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -797,7 +797,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function wI(n){const t={x:T(n,"x","atanh")};return F.runKernel(vr,t)}const CI=L({atanh_:wI});/** + */function yI(n){const t={x:T(n,"x","atanh")};return F.runKernel(vr,t)}const wI=L({atanh_:yI});/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -812,7 +812,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function bi(n,e,t,s,o="NHWC",r){const i=n[3],a=[...e,i],l=is(o);return Ct(n,a,t,r,s,null,null,l)}function pn(n,e,t,s,o,r,i="channelsLast"){const[a,l]=yi(e);let c;if(i==="channelsLast")c=[a,l,n[3],n[3]];else if(i==="channelsFirst")c=[a,l,n[1],n[1]];else throw new Error(`Unknown dataFormat ${i}`);return Ct(n,c,t,s,o,r,!1,i)}function rs(n,e,t,s,o,r,i="NDHWC"){const[a,l,c]=eh(e);let u,h;if(i==="NDHWC")h="channelsLast",u=[a,l,c,n[4],n[4]];else if(i==="NCDHW")h="channelsFirst",u=[a,l,c,n[1],n[1]];else throw new Error(`Unknown dataFormat ${i}`);return Is(n,u,t,s,o,!1,h,r)}function Ct(n,e,t,s,o,r,i=!1,a="channelsLast"){let[l,c,u,h]=[-1,-1,-1,-1];if(a==="channelsLast")[l,c,u,h]=n;else if(a==="channelsFirst")[l,h,c,u]=n;else throw new Error(`Unknown dataFormat ${a}`);const[d,p,,f]=e,[m,g]=yi(t),[x,b]=yi(s),w=Go(d,x),y=Go(p,b),{padInfo:C,outHeight:I,outWidth:$}=kI(o,c,u,m,g,w,y,r,a),k=i?f*h:f;let S;return a==="channelsFirst"?S=[l,k,I,$]:a==="channelsLast"&&(S=[l,I,$,k]),{batchSize:l,dataFormat:a,inHeight:c,inWidth:u,inChannels:h,outHeight:I,outWidth:$,outChannels:k,padInfo:C,strideHeight:m,strideWidth:g,filterHeight:d,filterWidth:p,effectiveFilterHeight:w,effectiveFilterWidth:y,dilationHeight:x,dilationWidth:b,inShape:n,outShape:S,filterShape:e}}function Is(n,e,t,s,o,r=!1,i="channelsLast",a){let[l,c,u,h,d]=[-1,-1,-1,-1,-1];if(i==="channelsLast")[l,c,u,h,d]=n;else if(i==="channelsFirst")[l,d,c,u,h]=n;else throw new Error(`Unknown dataFormat ${i}`);const[p,f,m,,g]=e,[x,b,w]=eh(t),[y,C,I]=eh(s),$=Go(p,y),k=Go(f,C),S=Go(m,I),{padInfo:N,outDepth:A,outHeight:_,outWidth:E}=vI(o,c,u,h,x,b,w,$,k,S,a),M=r?g*d:g;let z;return i==="channelsFirst"?z=[l,M,A,_,E]:i==="channelsLast"&&(z=[l,A,_,E,M]),{batchSize:l,dataFormat:i,inDepth:c,inHeight:u,inWidth:h,inChannels:d,outDepth:A,outHeight:_,outWidth:E,outChannels:M,padInfo:N,strideDepth:x,strideHeight:b,strideWidth:w,filterDepth:p,filterHeight:f,filterWidth:m,effectiveFilterDepth:$,effectiveFilterHeight:k,effectiveFilterWidth:S,dilationDepth:y,dilationHeight:C,dilationWidth:I,inShape:n,outShape:z,filterShape:e}}function II(n,e,t,s,o){s==null&&(s=Ju(n,e,t));const r=n[0],i=n[1],a=wi((r-e+2*s)/t+1,o),l=wi((i-e+2*s)/t+1,o);return[a,l]}function $I(n,e,t,s,o,r){o==null&&(o=Ju(n,e[0],s[0]));const i=[0,0,0,t];for(let a=0;a<3;a++)n[a]+2*o>=e[a]&&(i[a]=wi((n[a]-e[a]+2*o)/s[a]+1,r));return i}function Ju(n,e,t,s=1){const o=Go(e,s);return Math.floor((n[0]*(t-1)-t+o)/2)}function yi(n){return typeof n=="number"?[n,n,n]:n.length===2?[n[0],n[1],1]:n}function eh(n){return typeof n=="number"?[n,n,n]:n}function Go(n,e){return e<=1?n:n+(n-1)*(e-1)}function kI(n,e,t,s,o,r,i,a,l){let c,u,h;if(typeof n=="number"){c={top:n,bottom:n,left:n,right:n,type:n===0?"VALID":"NUMBER"};const p=II([e,t],r,s,n,a);u=p[0],h=p[1]}else if(n==="same"){u=Math.ceil(e/s),h=Math.ceil(t/o);const d=Math.max(0,(u-1)*s+r-e),p=Math.max(0,(h-1)*o+i-t),f=Math.floor(d/2),m=d-f,g=Math.floor(p/2),x=p-g;c={top:f,bottom:m,left:g,right:x,type:"SAME"}}else if(n==="valid")c={top:0,bottom:0,left:0,right:0,type:"VALID"},u=Math.ceil((e-r+1)/s),h=Math.ceil((t-i+1)/o);else if(typeof n=="object"){const d=l==="channelsLast"?n[1][0]:n[2][0],p=l==="channelsLast"?n[1][1]:n[2][1],f=l==="channelsLast"?n[2][0]:n[3][0],m=l==="channelsLast"?n[2][1]:n[3][1];c={top:d,bottom:p,left:f,right:m,type:d===0&&p===0&&f===0&&m===0?"VALID":"EXPLICIT"},u=wi((e-r+d+p)/s+1,a),h=wi((t-i+f+m)/o+1,a)}else throw Error(`Unknown padding parameter: ${n}`);return{padInfo:c,outHeight:u,outWidth:h}}function vI(n,e,t,s,o,r,i,a,l,c,u){let h,d,p,f;if(n==="valid"&&(n=0),typeof n=="number"){h={top:n,bottom:n,left:n,right:n,front:n,back:n,type:n===0?"VALID":"NUMBER"};const g=$I([e,t,s,1],[a,l,c],1,[o,r,i],n,u);d=g[0],p=g[1],f=g[2]}else if(n==="same"){d=Math.ceil(e/o),p=Math.ceil(t/r),f=Math.ceil(s/i);const m=(d-1)*o+a-e,g=(p-1)*r+l-t,x=(f-1)*i+c-s,b=Math.floor(m/2),w=m-b,y=Math.floor(g/2),C=g-y,I=Math.floor(x/2),$=x-I;h={top:y,bottom:C,left:I,right:$,front:b,back:w,type:"SAME"}}else throw Error(`Unknown padding parameter: ${n}`);return{padInfo:h,outDepth:d,outHeight:p,outWidth:f}}function wi(n,e){if(!e)return Math.trunc(n);switch(e){case"round":return Math.round(n);case"ceil":return Math.ceil(n);case"floor":return Math.floor(n);default:throw new Error(`Unknown roundingMode ${e}`)}}function so(n){const[e,t,s]=yi(n);return e===1&&t===1&&s===1}function Et(n,e){return so(n)||so(e)}function oo(n){return yi(n).every(e=>e>0)}function is(n){if(n==="NHWC")return"channelsLast";if(n==="NCHW")return"channelsFirst";throw new Error(`Unknown dataFormat ${n}`)}function Ut(n,e,t){if(t!=null){if(typeof e=="string")throw Error(`Error in ${n}: pad must be an integer when using dimRoundingMode ${t} but got pad ${e}.`);if(typeof e=="number")v(Do(e),()=>`Error in ${n}: pad must be an integer when using dimRoundingMode ${t} but got pad ${e}.`);else if(typeof e=="object")e.forEach(s=>{s.forEach(o=>{v(Do(o),()=>`Error in ${n}: pad must be an integer when using dimRoundingMode ${t} but got pad ${o}.`)})});else throw Error(`Error in ${n}: Unknown padding parameter: ${e}`)}}/** + */function bi(n,e,t,s,o="NHWC",r){const i=n[3],a=[...e,i],l=is(o);return Ct(n,a,t,r,s,null,null,l)}function pn(n,e,t,s,o,r,i="channelsLast"){const[a,l]=yi(e);let c;if(i==="channelsLast")c=[a,l,n[3],n[3]];else if(i==="channelsFirst")c=[a,l,n[1],n[1]];else throw new Error(`Unknown dataFormat ${i}`);return Ct(n,c,t,s,o,r,!1,i)}function rs(n,e,t,s,o,r,i="NDHWC"){const[a,l,c]=Qu(e);let u,h;if(i==="NDHWC")h="channelsLast",u=[a,l,c,n[4],n[4]];else if(i==="NCDHW")h="channelsFirst",u=[a,l,c,n[1],n[1]];else throw new Error(`Unknown dataFormat ${i}`);return Is(n,u,t,s,o,!1,h,r)}function Ct(n,e,t,s,o,r,i=!1,a="channelsLast"){let[l,c,u,h]=[-1,-1,-1,-1];if(a==="channelsLast")[l,c,u,h]=n;else if(a==="channelsFirst")[l,h,c,u]=n;else throw new Error(`Unknown dataFormat ${a}`);const[d,p,,f]=e,[m,g]=yi(t),[x,b]=yi(s),w=Go(d,x),y=Go(p,b),{padInfo:C,outHeight:I,outWidth:v}=$I(o,c,u,m,g,w,y,r,a),$=i?f*h:f;let S;return a==="channelsFirst"?S=[l,$,I,v]:a==="channelsLast"&&(S=[l,I,v,$]),{batchSize:l,dataFormat:a,inHeight:c,inWidth:u,inChannels:h,outHeight:I,outWidth:v,outChannels:$,padInfo:C,strideHeight:m,strideWidth:g,filterHeight:d,filterWidth:p,effectiveFilterHeight:w,effectiveFilterWidth:y,dilationHeight:x,dilationWidth:b,inShape:n,outShape:S,filterShape:e}}function Is(n,e,t,s,o,r=!1,i="channelsLast",a){let[l,c,u,h,d]=[-1,-1,-1,-1,-1];if(i==="channelsLast")[l,c,u,h,d]=n;else if(i==="channelsFirst")[l,d,c,u,h]=n;else throw new Error(`Unknown dataFormat ${i}`);const[p,f,m,,g]=e,[x,b,w]=Qu(t),[y,C,I]=Qu(s),v=Go(p,y),$=Go(f,C),S=Go(m,I),{padInfo:N,outDepth:A,outHeight:_,outWidth:E}=kI(o,c,u,h,x,b,w,v,$,S,a),M=r?g*d:g;let z;return i==="channelsFirst"?z=[l,M,A,_,E]:i==="channelsLast"&&(z=[l,A,_,E,M]),{batchSize:l,dataFormat:i,inDepth:c,inHeight:u,inWidth:h,inChannels:d,outDepth:A,outHeight:_,outWidth:E,outChannels:M,padInfo:N,strideDepth:x,strideHeight:b,strideWidth:w,filterDepth:p,filterHeight:f,filterWidth:m,effectiveFilterDepth:v,effectiveFilterHeight:$,effectiveFilterWidth:S,dilationDepth:y,dilationHeight:C,dilationWidth:I,inShape:n,outShape:z,filterShape:e}}function CI(n,e,t,s,o){s==null&&(s=Zu(n,e,t));const r=n[0],i=n[1],a=wi((r-e+2*s)/t+1,o),l=wi((i-e+2*s)/t+1,o);return[a,l]}function II(n,e,t,s,o,r){o==null&&(o=Zu(n,e[0],s[0]));const i=[0,0,0,t];for(let a=0;a<3;a++)n[a]+2*o>=e[a]&&(i[a]=wi((n[a]-e[a]+2*o)/s[a]+1,r));return i}function Zu(n,e,t,s=1){const o=Go(e,s);return Math.floor((n[0]*(t-1)-t+o)/2)}function yi(n){return typeof n=="number"?[n,n,n]:n.length===2?[n[0],n[1],1]:n}function Qu(n){return typeof n=="number"?[n,n,n]:n}function Go(n,e){return e<=1?n:n+(n-1)*(e-1)}function $I(n,e,t,s,o,r,i,a,l){let c,u,h;if(typeof n=="number"){c={top:n,bottom:n,left:n,right:n,type:n===0?"VALID":"NUMBER"};const p=CI([e,t],r,s,n,a);u=p[0],h=p[1]}else if(n==="same"){u=Math.ceil(e/s),h=Math.ceil(t/o);const d=Math.max(0,(u-1)*s+r-e),p=Math.max(0,(h-1)*o+i-t),f=Math.floor(d/2),m=d-f,g=Math.floor(p/2),x=p-g;c={top:f,bottom:m,left:g,right:x,type:"SAME"}}else if(n==="valid")c={top:0,bottom:0,left:0,right:0,type:"VALID"},u=Math.ceil((e-r+1)/s),h=Math.ceil((t-i+1)/o);else if(typeof n=="object"){const d=l==="channelsLast"?n[1][0]:n[2][0],p=l==="channelsLast"?n[1][1]:n[2][1],f=l==="channelsLast"?n[2][0]:n[3][0],m=l==="channelsLast"?n[2][1]:n[3][1];c={top:d,bottom:p,left:f,right:m,type:d===0&&p===0&&f===0&&m===0?"VALID":"EXPLICIT"},u=wi((e-r+d+p)/s+1,a),h=wi((t-i+f+m)/o+1,a)}else throw Error(`Unknown padding parameter: ${n}`);return{padInfo:c,outHeight:u,outWidth:h}}function kI(n,e,t,s,o,r,i,a,l,c,u){let h,d,p,f;if(n==="valid"&&(n=0),typeof n=="number"){h={top:n,bottom:n,left:n,right:n,front:n,back:n,type:n===0?"VALID":"NUMBER"};const g=II([e,t,s,1],[a,l,c],1,[o,r,i],n,u);d=g[0],p=g[1],f=g[2]}else if(n==="same"){d=Math.ceil(e/o),p=Math.ceil(t/r),f=Math.ceil(s/i);const m=(d-1)*o+a-e,g=(p-1)*r+l-t,x=(f-1)*i+c-s,b=Math.floor(m/2),w=m-b,y=Math.floor(g/2),C=g-y,I=Math.floor(x/2),v=x-I;h={top:y,bottom:C,left:I,right:v,front:b,back:w,type:"SAME"}}else throw Error(`Unknown padding parameter: ${n}`);return{padInfo:h,outDepth:d,outHeight:p,outWidth:f}}function wi(n,e){if(!e)return Math.trunc(n);switch(e){case"round":return Math.round(n);case"ceil":return Math.ceil(n);case"floor":return Math.floor(n);default:throw new Error(`Unknown roundingMode ${e}`)}}function so(n){const[e,t,s]=yi(n);return e===1&&t===1&&s===1}function Et(n,e){return so(n)||so(e)}function oo(n){return yi(n).every(e=>e>0)}function is(n){if(n==="NHWC")return"channelsLast";if(n==="NCHW")return"channelsFirst";throw new Error(`Unknown dataFormat ${n}`)}function Ut(n,e,t){if(t!=null){if(typeof e=="string")throw Error(`Error in ${n}: pad must be an integer when using dimRoundingMode ${t} but got pad ${e}.`);if(typeof e=="number")k(Do(e),()=>`Error in ${n}: pad must be an integer when using dimRoundingMode ${t} but got pad ${e}.`);else if(typeof e=="object")e.forEach(s=>{s.forEach(o=>{k(Do(o),()=>`Error in ${n}: pad must be an integer when using dimRoundingMode ${t} but got pad ${o}.`)})});else throw Error(`Error in ${n}: Unknown padding parameter: ${e}`)}}/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -827,7 +827,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function SI(n,e){const s={x:T(n,"x","reshape","string_or_numeric")},o={shape:e};return F.runKernel(Ya,s,o)}const O=L({reshape_:SI});/** + */function vI(n,e){const s={x:T(n,"x","reshape","string_or_numeric")},o={shape:e};return F.runKernel(Ya,s,o)}const O=L({reshape_:vI});/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -842,7 +842,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function TI(n,e,t,s,o){const r=T(n,"x","avgPool","float32"),i=1;v(Et(t,i),()=>`Error in avgPool: Either strides or dilations must be 1. Got strides ${t} and dilations '${i}'`);let a=r,l=!1;r.rank===3&&(l=!0,a=O(r,[1,r.shape[0],r.shape[1],r.shape[2]])),v(a.rank===4,()=>`Error in avgPool: x must be rank 4 but got rank ${a.rank}.`),Ut("avgPool",s,o);const c={x:a},u={filterSize:e,strides:t,pad:s,dimRoundingMode:o};let h=F.runKernel(da,c,u);return h=re(h,r.dtype),l?O(h,[h.shape[1],h.shape[2],h.shape[3]]):h}const th=L({avgPool_:TI});/** + */function SI(n,e,t,s,o){const r=T(n,"x","avgPool","float32"),i=1;k(Et(t,i),()=>`Error in avgPool: Either strides or dilations must be 1. Got strides ${t} and dilations '${i}'`);let a=r,l=!1;r.rank===3&&(l=!0,a=O(r,[1,r.shape[0],r.shape[1],r.shape[2]])),k(a.rank===4,()=>`Error in avgPool: x must be rank 4 but got rank ${a.rank}.`),Ut("avgPool",s,o);const c={x:a},u={filterSize:e,strides:t,pad:s,dimRoundingMode:o};let h=F.runKernel(da,c,u);return h=re(h,r.dtype),l?O(h,[h.shape[1],h.shape[2],h.shape[3]]):h}const Ju=L({avgPool_:SI});/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -857,7 +857,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function NI(n,e,t,s,o,r="NDHWC"){const i=T(n,"x","avgPool3d","float32");let a=i,l=!1;i.rank===4&&(l=!0,a=O(i,[1,i.shape[0],i.shape[1],i.shape[2],i.shape[3]])),v(a.rank===5,()=>`Error in avgPool3d: x must be rank 5 but got rank ${a.rank}.`),v(r==="NDHWC",()=>`Error in avgPool3d: Only NDHWC is currently supported, but got dataFormat of ${r}`),v(typeof t=="number"&&t>0||Array.isArray(t)&&t[0]>0&&t[1]>0&&t[2]>0,()=>`Error in avgPool3d: Stride must be > 0, but got '${t}'`),Ut("avgPool3d",s,o);const c={x:a},u={filterSize:e,strides:t,pad:s,dimRoundingMode:o,dataFormat:r};let h=F.runKernel(pa,c,u);return h=re(h,a.dtype),l?O(h,[h.shape[1],h.shape[2],h.shape[3],h.shape[4]]):h}const EI=L({avgPool3d_:NI});/** + */function TI(n,e,t,s,o,r="NDHWC"){const i=T(n,"x","avgPool3d","float32");let a=i,l=!1;i.rank===4&&(l=!0,a=O(i,[1,i.shape[0],i.shape[1],i.shape[2],i.shape[3]])),k(a.rank===5,()=>`Error in avgPool3d: x must be rank 5 but got rank ${a.rank}.`),k(r==="NDHWC",()=>`Error in avgPool3d: Only NDHWC is currently supported, but got dataFormat of ${r}`),k(typeof t=="number"&&t>0||Array.isArray(t)&&t[0]>0&&t[1]>0&&t[2]>0,()=>`Error in avgPool3d: Stride must be > 0, but got '${t}'`),Ut("avgPool3d",s,o);const c={x:a},u={filterSize:e,strides:t,pad:s,dimRoundingMode:o,dataFormat:r};let h=F.runKernel(pa,c,u);return h=re(h,a.dtype),l?O(h,[h.shape[1],h.shape[2],h.shape[3],h.shape[4]]):h}const NI=L({avgPool3d_:TI});/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -872,8 +872,8 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function RI(n,e=0){v(n.length>=1,()=>"Pass at least one tensor to concat");const t=qf(n,"tensors","concat","string_or_numeric");if(t[0].dtype==="complex64"&&t.forEach(r=>{if(r.dtype!=="complex64")throw new Error(`Cannot concatenate complex64 tensors with a tensor - with dtype ${r.dtype}. `)}),t.length===1)return to(t[0]);const s=t,o={axis:e};return F.runKernel(xa,s,o)}const Mt=L({concat_:RI});/** + */function EI(n,e=0){k(n.length>=1,()=>"Pass at least one tensor to concat");const t=qf(n,"tensors","concat","string_or_numeric");if(t[0].dtype==="complex64"&&t.forEach(r=>{if(r.dtype!=="complex64")throw new Error(`Cannot concatenate complex64 tensors with a tensor + with dtype ${r.dtype}. `)}),t.length===1)return to(t[0]);const s=t,o={axis:e};return F.runKernel(xa,s,o)}const Ot=L({concat_:EI});/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -888,7 +888,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function AI(n,e,t=!1,s=!1){let o=T(n,"a","matMul"),r=T(e,"b","matMul");[o,r]=tt(o,r);const i={a:o,b:r},a={transposeA:t,transposeB:s};return F.runKernel(fa,i,a)}const Ae=L({matMul_:AI});/** + */function RI(n,e,t=!1,s=!1){let o=T(n,"a","matMul"),r=T(e,"b","matMul");[o,r]=tt(o,r);const i={a:o,b:r},a={transposeA:t,transposeB:s};return F.runKernel(fa,i,a)}const Ae=L({matMul_:RI});/** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -903,7 +903,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function DI(n){const t={x:T(n,"x","sigmoid","float32")};return F.runKernel(ii,t)}const Ho=L({sigmoid_:DI});/** + */function AI(n){const t={x:T(n,"x","sigmoid","float32")};return F.runKernel(ii,t)}const Ho=L({sigmoid_:AI});/** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -918,7 +918,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function FI(n,e,t){const s=T(n,"x","slice","string_or_numeric");if(s.rank===0)throw new Error("Slicing scalar is not possible");const o={x:s},r={begin:e,size:t};return F.runKernel(tl,o,r)}const Ve=L({slice_:FI});/** + */function DI(n,e,t){const s=T(n,"x","slice","string_or_numeric");if(s.rank===0)throw new Error("Slicing scalar is not possible");const o={x:s},r={begin:e,size:t};return F.runKernel(tl,o,r)}const Ve=L({slice_:DI});/** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -933,7 +933,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function _I(n){const t={x:T(n,"x","tanh","float32")};return F.runKernel(di,t)}const wl=L({tanh_:_I});/** + */function FI(n){const t={x:T(n,"x","tanh","float32")};return F.runKernel(di,t)}const wl=L({tanh_:FI});/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -948,7 +948,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function OI(n,e,t){const s=T(n,"x","batchToSpaceND"),o=e.reduce((a,l)=>a*l);v(s.rank>=1+e.length,()=>`input rank is ${s.rank} but should be > than blockShape.length ${e.length}`),v(t.length===e.length,()=>`crops.length is ${t.length} but should be equal to blockShape.length ${e.length}`),v(s.shape[0]%o===0,()=>`input tensor batch is ${s.shape[0]} but is not divisible by the product of the elements of blockShape ${e.join(" * ")} === ${o}`);const r={x:s},i={blockShape:e,crops:t};return F.runKernel(ma,r,i)}const nh=L({batchToSpaceND_:OI});function LI(n){let e;return n.rank===0||n.rank===1?e=O(n,[1,1,1,n.size]):n.rank===2?e=O(n,[1,1,n.shape[0],n.shape[1]]):n.rank===3?e=O(n,[1,n.shape[0],n.shape[1],n.shape[2]]):e=n,e}/** + */function _I(n,e,t){const s=T(n,"x","batchToSpaceND"),o=e.reduce((a,l)=>a*l);k(s.rank>=1+e.length,()=>`input rank is ${s.rank} but should be > than blockShape.length ${e.length}`),k(t.length===e.length,()=>`crops.length is ${t.length} but should be equal to blockShape.length ${e.length}`),k(s.shape[0]%o===0,()=>`input tensor batch is ${s.shape[0]} but is not divisible by the product of the elements of blockShape ${e.join(" * ")} === ${o}`);const r={x:s},i={blockShape:e,crops:t};return F.runKernel(ma,r,i)}const eh=L({batchToSpaceND_:_I});function OI(n){let e;return n.rank===0||n.rank===1?e=O(n,[1,1,1,n.size]):n.rank===2?e=O(n,[1,1,n.shape[0],n.shape[1]]):n.rank===3?e=O(n,[1,n.shape[0],n.shape[1],n.shape[2]]):e=n,e}/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -963,7 +963,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function MI(n,e,t,s,o,r){r==null&&(r=.001);const i=T(n,"x","batchNorm"),a=T(e,"mean","batchNorm"),l=T(t,"variance","batchNorm");let c;o!=null&&(c=T(o,"scale","batchNorm"));let u;s!=null&&(u=T(s,"offset","batchNorm")),v(a.rank===l.rank,()=>"Batch normalization gradient requires mean and variance to have equal ranks."),v(u==null||a.rank===u.rank,()=>"Batch normalization gradient requires mean and offset to have equal ranks."),v(c==null||a.rank===c.rank,()=>"Batch normalization gradient requires mean and scale to have equal ranks.");const d={x:LI(i),scale:c,offset:u,mean:a,variance:l},p={varianceEpsilon:r},f=F.runKernel(Sa,d,p);return O(f,i.shape)}const Cl=L({batchNorm_:MI});function PI(n,e,t,s,o,r){const i=T(n,"x","batchNorm"),a=T(e,"mean","batchNorm"),l=T(t,"variance","batchNorm");let c;o!=null&&(c=T(o,"scale","batchNorm"));let u;return s!=null&&(u=T(s,"offset","batchNorm")),v(i.rank===2,()=>`Error in batchNorm2D: x must be rank 2 but got rank ${i.rank}.`),v(a.rank===2||a.rank===1,()=>`Error in batchNorm2D: mean must be rank 2 or rank 1 but got rank ${a.rank}.`),v(l.rank===2||l.rank===1,()=>`Error in batchNorm2D: variance must be rank 2 or rank 1 but got rank ${l.rank}.`),c!=null&&v(c.rank===2||c.rank===1,()=>`Error in batchNorm2D: scale must be rank 2 or rank 1 but got rank ${c.rank}.`),u!=null&&v(u.rank===2||u.rank===1,()=>`Error in batchNorm2D: offset must be rank 2 or rank 1 but got rank ${u.rank}.`),Cl(i,a,l,u,c,r)}const BI=L({batchNorm2d_:PI});function zI(n,e,t,s,o,r){const i=T(n,"x","batchNorm"),a=T(e,"mean","batchNorm"),l=T(t,"variance","batchNorm");let c;o!=null&&(c=T(o,"scale","batchNorm"));let u;return s!=null&&(u=T(s,"offset","batchNorm")),v(i.rank===3,()=>`Error in batchNorm3D: x must be rank 3 but got rank ${i.rank}.`),v(a.rank===3||a.rank===1,()=>`Error in batchNorm3D: mean must be rank 3 or rank 1 but got rank ${a.rank}.`),v(l.rank===3||l.rank===1,()=>`Error in batchNorm3D: variance must be rank 3 or rank 1 but got rank ${l.rank}.`),c!=null&&v(c.rank===3||c.rank===1,()=>`Error in batchNorm3D: scale must be rank 3 or rank 1 but got rank ${c.rank}.`),u!=null&&v(u.rank===3||u.rank===1,()=>`Error in batchNorm3D: offset must be rank 3 or rank 1 but got rank ${u.rank}.`),Cl(i,a,l,u,c,r)}const VI=L({batchNorm3d_:zI});function WI(n,e,t,s,o,r){const i=T(n,"x","batchNorm"),a=T(e,"mean","batchNorm"),l=T(t,"variance","batchNorm");let c;o!=null&&(c=T(o,"scale","batchNorm"));let u;return s!=null&&(u=T(s,"offset","batchNorm")),v(i.rank===4,()=>`Error in batchNorm4D: x must be rank 4 but got rank ${i.rank}.`),v(a.rank===4||a.rank===1,()=>`Error in batchNorm4D: mean must be rank 4 or rank 1 but got rank ${a.rank}.`),v(l.rank===4||l.rank===1,()=>`Error in batchNorm4D: variance must be rank 4 or rank 1 but got rank ${l.rank}.`),c!=null&&v(c.rank===4||c.rank===1,()=>`Error in batchNorm4D: scale must be rank 4 or rank 1 but got rank ${c.rank}.`),u!=null&&v(u.rank===4||u.rank===1,()=>`Error in batchNorm4D: offset must be rank 4 or rank 1 but got rank ${u.rank}.`),Cl(i,a,l,u,c,r)}const UI=L({batchNorm4d_:WI});/** + */function LI(n,e,t,s,o,r){r==null&&(r=.001);const i=T(n,"x","batchNorm"),a=T(e,"mean","batchNorm"),l=T(t,"variance","batchNorm");let c;o!=null&&(c=T(o,"scale","batchNorm"));let u;s!=null&&(u=T(s,"offset","batchNorm")),k(a.rank===l.rank,()=>"Batch normalization gradient requires mean and variance to have equal ranks."),k(u==null||a.rank===u.rank,()=>"Batch normalization gradient requires mean and offset to have equal ranks."),k(c==null||a.rank===c.rank,()=>"Batch normalization gradient requires mean and scale to have equal ranks.");const d={x:OI(i),scale:c,offset:u,mean:a,variance:l},p={varianceEpsilon:r},f=F.runKernel(Sa,d,p);return O(f,i.shape)}const Cl=L({batchNorm_:LI});function MI(n,e,t,s,o,r){const i=T(n,"x","batchNorm"),a=T(e,"mean","batchNorm"),l=T(t,"variance","batchNorm");let c;o!=null&&(c=T(o,"scale","batchNorm"));let u;return s!=null&&(u=T(s,"offset","batchNorm")),k(i.rank===2,()=>`Error in batchNorm2D: x must be rank 2 but got rank ${i.rank}.`),k(a.rank===2||a.rank===1,()=>`Error in batchNorm2D: mean must be rank 2 or rank 1 but got rank ${a.rank}.`),k(l.rank===2||l.rank===1,()=>`Error in batchNorm2D: variance must be rank 2 or rank 1 but got rank ${l.rank}.`),c!=null&&k(c.rank===2||c.rank===1,()=>`Error in batchNorm2D: scale must be rank 2 or rank 1 but got rank ${c.rank}.`),u!=null&&k(u.rank===2||u.rank===1,()=>`Error in batchNorm2D: offset must be rank 2 or rank 1 but got rank ${u.rank}.`),Cl(i,a,l,u,c,r)}const PI=L({batchNorm2d_:MI});function BI(n,e,t,s,o,r){const i=T(n,"x","batchNorm"),a=T(e,"mean","batchNorm"),l=T(t,"variance","batchNorm");let c;o!=null&&(c=T(o,"scale","batchNorm"));let u;return s!=null&&(u=T(s,"offset","batchNorm")),k(i.rank===3,()=>`Error in batchNorm3D: x must be rank 3 but got rank ${i.rank}.`),k(a.rank===3||a.rank===1,()=>`Error in batchNorm3D: mean must be rank 3 or rank 1 but got rank ${a.rank}.`),k(l.rank===3||l.rank===1,()=>`Error in batchNorm3D: variance must be rank 3 or rank 1 but got rank ${l.rank}.`),c!=null&&k(c.rank===3||c.rank===1,()=>`Error in batchNorm3D: scale must be rank 3 or rank 1 but got rank ${c.rank}.`),u!=null&&k(u.rank===3||u.rank===1,()=>`Error in batchNorm3D: offset must be rank 3 or rank 1 but got rank ${u.rank}.`),Cl(i,a,l,u,c,r)}const zI=L({batchNorm3d_:BI});function VI(n,e,t,s,o,r){const i=T(n,"x","batchNorm"),a=T(e,"mean","batchNorm"),l=T(t,"variance","batchNorm");let c;o!=null&&(c=T(o,"scale","batchNorm"));let u;return s!=null&&(u=T(s,"offset","batchNorm")),k(i.rank===4,()=>`Error in batchNorm4D: x must be rank 4 but got rank ${i.rank}.`),k(a.rank===4||a.rank===1,()=>`Error in batchNorm4D: mean must be rank 4 or rank 1 but got rank ${a.rank}.`),k(l.rank===4||l.rank===1,()=>`Error in batchNorm4D: variance must be rank 4 or rank 1 but got rank ${l.rank}.`),c!=null&&k(c.rank===4||c.rank===1,()=>`Error in batchNorm4D: scale must be rank 4 or rank 1 but got rank ${c.rank}.`),u!=null&&k(u.rank===4||u.rank===1,()=>`Error in batchNorm4D: offset must be rank 4 or rank 1 but got rank ${u.rank}.`),Cl(i,a,l,u,c,r)}const WI=L({batchNorm4d_:VI});/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -978,7 +978,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function GI(n,e,t){const s=T(n,"x","bincount"),o=T(e,"weights","bincount");v(s.dtype==="int32",()=>`Error in bincount: input dtype must be int32, but got ${s.dtype}`),v(t>=0,()=>`size must be non-negative, but got ${t}.`),v(o.size===s.size||o.size===0,()=>`Error in bincount: weights must have the same size as input or0-length, but got input shape: ${s.shape}, weights shape: ${o.shape}.`);const r={x:s,weights:o},i={size:t};return F.runKernel(Zc,r,i)}const HI=L({bincount_:GI});/** + */function UI(n,e,t){const s=T(n,"x","bincount"),o=T(e,"weights","bincount");k(s.dtype==="int32",()=>`Error in bincount: input dtype must be int32, but got ${s.dtype}`),k(t>=0,()=>`size must be non-negative, but got ${t}.`),k(o.size===s.size||o.size===0,()=>`Error in bincount: weights must have the same size as input or0-length, but got input shape: ${s.shape}, weights shape: ${o.shape}.`);const r={x:s,weights:o},i={size:t};return F.runKernel(Xc,r,i)}const GI=L({bincount_:UI});/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -993,7 +993,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function qI(n,e){let t=T(n,"broadcastTo","x");const s=t.shape;if(ns(e),e.lengtht.rank){const c=t.shape.slice();for(;c.length=0;c--)if(o[c]===e[c])r[c]=1;else if(t.shape[c]!==1)throw new Error(`broadcastTo(): [${s}] cannot be broadcast to [${e}].`);if(r.map((c,u)=>c>1?u:-1).filter(c=>c>=0).length===0)return to(t);const a={x:t},l={reps:r};return F.runKernel(pi,a,l)}const Ci=L({broadcastTo_:qI});/** + */function HI(n,e){let t=T(n,"broadcastTo","x");const s=t.shape;if(ns(e),e.lengtht.rank){const c=t.shape.slice();for(;c.length=0;c--)if(o[c]===e[c])r[c]=1;else if(t.shape[c]!==1)throw new Error(`broadcastTo(): [${s}] cannot be broadcast to [${e}].`);if(r.map((c,u)=>c>1?u:-1).filter(c=>c>=0).length===0)return to(t);const a={x:t},l={reps:r};return F.runKernel(pi,a,l)}const Ci=L({broadcastTo_:HI});/** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -1008,7 +1008,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function jI(n){const t={x:T(n,"x","ceil","float32")};return F.runKernel(Nr,t)}const KI=L({ceil_:jI});/** + */function qI(n){const t={x:T(n,"x","ceil","float32")};return F.runKernel(Nr,t)}const jI=L({ceil_:qI});/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -1023,7 +1023,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function Ii(n,e,t){ns(n),t=t||_o(e);const s={shape:n,value:e,dtype:t};return F.runKernel(fu,{},s)}/** + */function Ii(n,e,t){ns(n),t=t||_o(e);const s={shape:n,value:e,dtype:t};return F.runKernel(du,{},s)}/** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -1038,7 +1038,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function XI(n,e,t){const s=T(n,"x","clipByValue");if(v(e<=t,()=>`Error in clip: min (${e}) must be less than or equal to max (${t}).`),e===t)return Ii(s.shape,e,s.dtype);const o={x:s},r={clipValueMin:e,clipValueMax:t};return F.runKernel(Er,o,r)}const nn=L({clipByValue_:XI});function YI(n){return Mt(n,0)}const ZI=L({concat1d_:YI});function QI(n,e){return Mt(n,e)}const JI=L({concat2d_:QI});function e$(n,e){return Mt(n,e)}const t$=L({concat3d_:e$});function n$(n,e){return Mt(n,e)}const s$=L({concat4d_:n$});/** + */function KI(n,e,t){const s=T(n,"x","clipByValue");if(k(e<=t,()=>`Error in clip: min (${e}) must be less than or equal to max (${t}).`),e===t)return Ii(s.shape,e,s.dtype);const o={x:s},r={clipValueMin:e,clipValueMax:t};return F.runKernel(Er,o,r)}const nn=L({clipByValue_:KI});function XI(n){return Ot(n,0)}const YI=L({concat1d_:XI});function ZI(n,e){return Ot(n,e)}const QI=L({concat2d_:ZI});function JI(n,e){return Ot(n,e)}const e$=L({concat3d_:JI});function t$(n,e){return Ot(n,e)}const n$=L({concat4d_:t$});/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -1053,7 +1053,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function o$(n,e,t,s,o="NHWC",r=[1,1],i){const a=T(n,"x","conv2d","float32"),l=T(e,"filter","conv2d","float32");let c=a,u=!1;a.rank===3&&(u=!0,c=O(a,[1,a.shape[0],a.shape[1],a.shape[2]])),v(c.rank===4,()=>`Error in conv2d: input must be rank 4, but got rank ${c.rank}.`),v(l.rank===4,()=>`Error in conv2d: filter must be rank 4, but got rank ${l.rank}.`),Ut("conv2d",s,i);const h=o==="NHWC"?c.shape[3]:c.shape[1];v(h===l.shape[2],()=>`Error in conv2d: depth of input (${h}) must match input depth for filter ${l.shape[2]}.`),v(Et(t,r),()=>`Error in conv2D: Either strides or dilations must be 1. Got strides ${t} and dilations '${r}'`),v(oo(r),()=>"Error in conv2D: Dilated rates should be larger than 0."),v(oo(t),()=>"Error in conv2D: Strides should be larger than 0.");const d={x:c,filter:l},p={strides:t,pad:s,dataFormat:o,dilations:r,dimRoundingMode:i},f=F.runKernel(ba,d,p);return u?O(f,[f.shape[1],f.shape[2],f.shape[3]]):f}const ro=L({conv2d_:o$});function r$(n,e,t,s,o="NWC",r=1,i){const a=T(n,"x","conv1d"),l=T(e,"filter","conv1d");let c=a,u=!1;a.rank===2&&(u=!0,c=O(a,[1,a.shape[0],a.shape[1]])),v(c.rank===3,()=>`Error in conv1d: input must be rank 3, but got rank ${c.rank}.`),v(l.rank===3,()=>`Error in conv1d: filter must be rank 3, but got rank ${l.rank}.`),Ut("conv1d",s,i),v(c.shape[2]===l.shape[1],()=>`Error in conv1d: depth of input (${c.shape[2]}) must match input depth for filter ${l.shape[1]}.`),v(Et(t,r),()=>`Error in conv1D: Either stride or dilation must be 1. Got stride ${t} and dilation '${r}'`),v(oo(r),()=>"Error in conv1D: Dilated rates should be larger than 0."),v(oo(t),()=>"Error in conv1D: Stride should be larger than 0."),v(o==="NWC",()=>`Error in conv1d: got dataFormat of ${o} but only NWC is currently supported.`);const h=O(l,[1,l.shape[0],l.shape[1],l.shape[2]]),d=O(c,[c.shape[0],1,c.shape[1],c.shape[2]]),g=ro(d,h,[1,t],s,"NHWC",[1,r],i);return u?O(g,[g.shape[2],g.shape[3]]):O(g,[g.shape[0],g.shape[2],g.shape[3]])}const am=L({conv1d_:r$});/** + */function s$(n,e,t,s,o="NHWC",r=[1,1],i){const a=T(n,"x","conv2d","float32"),l=T(e,"filter","conv2d","float32");let c=a,u=!1;a.rank===3&&(u=!0,c=O(a,[1,a.shape[0],a.shape[1],a.shape[2]])),k(c.rank===4,()=>`Error in conv2d: input must be rank 4, but got rank ${c.rank}.`),k(l.rank===4,()=>`Error in conv2d: filter must be rank 4, but got rank ${l.rank}.`),Ut("conv2d",s,i);const h=o==="NHWC"?c.shape[3]:c.shape[1];k(h===l.shape[2],()=>`Error in conv2d: depth of input (${h}) must match input depth for filter ${l.shape[2]}.`),k(Et(t,r),()=>`Error in conv2D: Either strides or dilations must be 1. Got strides ${t} and dilations '${r}'`),k(oo(r),()=>"Error in conv2D: Dilated rates should be larger than 0."),k(oo(t),()=>"Error in conv2D: Strides should be larger than 0.");const d={x:c,filter:l},p={strides:t,pad:s,dataFormat:o,dilations:r,dimRoundingMode:i},f=F.runKernel(ba,d,p);return u?O(f,[f.shape[1],f.shape[2],f.shape[3]]):f}const ro=L({conv2d_:s$});function o$(n,e,t,s,o="NWC",r=1,i){const a=T(n,"x","conv1d"),l=T(e,"filter","conv1d");let c=a,u=!1;a.rank===2&&(u=!0,c=O(a,[1,a.shape[0],a.shape[1]])),k(c.rank===3,()=>`Error in conv1d: input must be rank 3, but got rank ${c.rank}.`),k(l.rank===3,()=>`Error in conv1d: filter must be rank 3, but got rank ${l.rank}.`),Ut("conv1d",s,i),k(c.shape[2]===l.shape[1],()=>`Error in conv1d: depth of input (${c.shape[2]}) must match input depth for filter ${l.shape[1]}.`),k(Et(t,r),()=>`Error in conv1D: Either stride or dilation must be 1. Got stride ${t} and dilation '${r}'`),k(oo(r),()=>"Error in conv1D: Dilated rates should be larger than 0."),k(oo(t),()=>"Error in conv1D: Stride should be larger than 0."),k(o==="NWC",()=>`Error in conv1d: got dataFormat of ${o} but only NWC is currently supported.`);const h=O(l,[1,l.shape[0],l.shape[1],l.shape[2]]),d=O(c,[c.shape[0],1,c.shape[1],c.shape[2]]),g=ro(d,h,[1,t],s,"NHWC",[1,r],i);return u?O(g,[g.shape[2],g.shape[3]]):O(g,[g.shape[0],g.shape[2],g.shape[3]])}const am=L({conv1d_:o$});/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -1068,7 +1068,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function i$(n,e,t,s,o,r="NHWC",i){v(n.length===e.rank,()=>`Length of inShape (${n.length}) and rank of dy (${e.rank}) must match`);let a=n,l=e,c=!1;e.rank===3&&(c=!0,l=O(e,[1,e.shape[0],e.shape[1],e.shape[2]]),a=[1,n[0],n[1],n[2]]),v(a.length===4,()=>`Error in conv2dDerInput: inShape must be length 4, but got length ${a.length}.`),v(l.rank===4,()=>`Error in conv2dDerInput: dy must be rank 4, but got rank ${l.rank}`),v(t.rank===4,()=>`Error in conv2dDerInput: filter must be rank 4, but got rank ${t.rank}`);const u=r==="NHWC"?a[3]:a[1],h=r==="NHWC"?l.shape[3]:l.shape[1];v(u===t.shape[2],()=>`Error in conv2dDerInput: depth of input (${u}) must match input depth for filter ${t.shape[2]}.`),v(h===t.shape[3],()=>`Error in conv2dDerInput: depth of output (${h}) must match output depth for filter ${t.shape[3]}.`),Ut("conv2dDerInput",o,i);const d={dy:l,filter:t},p={strides:s,pad:o,dataFormat:r,dimRoundingMode:i,inputShape:a},f=F.runKernel(ya,d,p);return c?O(f,[f.shape[1],f.shape[2],f.shape[3]]):f}const sh=L({conv2DBackpropInput_:i$});function a$(n,e,t,s,o,r){const i=T(n,"x","conv2dTranspose"),a=T(e,"filter","conv2dTranspose");return sh(t,i,a,s,o,"NHWC",r)}const lm=L({conv2dTranspose_:a$});/** + */function r$(n,e,t,s,o,r="NHWC",i){k(n.length===e.rank,()=>`Length of inShape (${n.length}) and rank of dy (${e.rank}) must match`);let a=n,l=e,c=!1;e.rank===3&&(c=!0,l=O(e,[1,e.shape[0],e.shape[1],e.shape[2]]),a=[1,n[0],n[1],n[2]]),k(a.length===4,()=>`Error in conv2dDerInput: inShape must be length 4, but got length ${a.length}.`),k(l.rank===4,()=>`Error in conv2dDerInput: dy must be rank 4, but got rank ${l.rank}`),k(t.rank===4,()=>`Error in conv2dDerInput: filter must be rank 4, but got rank ${t.rank}`);const u=r==="NHWC"?a[3]:a[1],h=r==="NHWC"?l.shape[3]:l.shape[1];k(u===t.shape[2],()=>`Error in conv2dDerInput: depth of input (${u}) must match input depth for filter ${t.shape[2]}.`),k(h===t.shape[3],()=>`Error in conv2dDerInput: depth of output (${h}) must match output depth for filter ${t.shape[3]}.`),Ut("conv2dDerInput",o,i);const d={dy:l,filter:t},p={strides:s,pad:o,dataFormat:r,dimRoundingMode:i,inputShape:a},f=F.runKernel(ya,d,p);return c?O(f,[f.shape[1],f.shape[2],f.shape[3]]):f}const th=L({conv2DBackpropInput_:r$});function i$(n,e,t,s,o,r){const i=T(n,"x","conv2dTranspose"),a=T(e,"filter","conv2dTranspose");return th(t,i,a,s,o,"NHWC",r)}const lm=L({conv2dTranspose_:i$});/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -1083,7 +1083,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function l$(n,e,t,s,o="NDHWC",r=[1,1,1]){const i=T(n,"x","conv3d"),a=T(e,"filter","conv3d");let l=i,c=!1;i.rank===4&&(c=!0,l=O(i,[1,i.shape[0],i.shape[1],i.shape[2],i.shape[3]])),v(l.rank===5,()=>`Error in conv3d: input must be rank 5, but got rank ${l.rank}.`),v(a.rank===5,()=>`Error in conv3d: filter must be rank 5, but got rank ${a.rank}.`),v(l.shape[4]===a.shape[3],()=>`Error in conv3d: depth of input (${l.shape[4]}) must match input depth for filter ${a.shape[3]}.`),v(Et(t,r),()=>`Error in conv3D: Either strides or dilations must be 1. Got strides ${t} and dilations '${r}'`),v(o==="NDHWC",()=>`Error in conv3d: got dataFormat of ${o} but only NDHWC is currently supported.`),v(oo(r),()=>"Error in conv3D: Dilated rates should be larger than 0."),v(oo(t),()=>"Error in conv3D: Strides should be larger than 0.");const u={x:l,filter:a},h={strides:t,pad:s,dataFormat:o,dilations:r},d=F.runKernel(wa,u,h);return c?O(d,[d.shape[1],d.shape[2],d.shape[3],d.shape[4]]):d}const oh=L({conv3d_:l$});/** + */function a$(n,e,t,s,o="NDHWC",r=[1,1,1]){const i=T(n,"x","conv3d"),a=T(e,"filter","conv3d");let l=i,c=!1;i.rank===4&&(c=!0,l=O(i,[1,i.shape[0],i.shape[1],i.shape[2],i.shape[3]])),k(l.rank===5,()=>`Error in conv3d: input must be rank 5, but got rank ${l.rank}.`),k(a.rank===5,()=>`Error in conv3d: filter must be rank 5, but got rank ${a.rank}.`),k(l.shape[4]===a.shape[3],()=>`Error in conv3d: depth of input (${l.shape[4]}) must match input depth for filter ${a.shape[3]}.`),k(Et(t,r),()=>`Error in conv3D: Either strides or dilations must be 1. Got strides ${t} and dilations '${r}'`),k(o==="NDHWC",()=>`Error in conv3d: got dataFormat of ${o} but only NDHWC is currently supported.`),k(oo(r),()=>"Error in conv3D: Dilated rates should be larger than 0."),k(oo(t),()=>"Error in conv3D: Strides should be larger than 0.");const u={x:l,filter:a},h={strides:t,pad:s,dataFormat:o,dilations:r},d=F.runKernel(wa,u,h);return c?O(d,[d.shape[1],d.shape[2],d.shape[3],d.shape[4]]):d}const nh=L({conv3d_:a$});/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -1098,7 +1098,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function c$(n,e,t,s,o){v(n.length===e.rank,()=>`Length of inShape (${n.length}) and rank of dy (${e.rank}) must match`);let r=n,i=e,a=!1;e.rank===4&&(a=!0,i=O(e,[1,e.shape[0],e.shape[1],e.shape[2],e.shape[3]]),r=[1,n[0],n[1],n[2],n[3]]);const l=r[4],c=i.shape[4];v(r.length===5,()=>`Error in conv3dDerInput: inShape must be length 5, but got length ${r.length}.`),v(i.rank===5,()=>`Error in conv3dDerInput: dy must be rank 5, but got rank ${i.rank}`),v(t.rank===5,()=>`Error in conv3dDerInput: filter must be rank 5, but got rank ${t.rank}`),v(l===t.shape[3],()=>`Error in conv3dDerInput: depth of input (${l}) must match input depth for filter ${t.shape[3]}.`),v(c===t.shape[4],()=>`Error in conv3dDerInput: depth of output (${c}) must match output depth for filter ${t.shape[4]}.`);const u={dy:i,filter:t},h={pad:o,strides:s,inputShape:r},d=F.runKernel(nu,u,h);return a?O(d,[d.shape[1],d.shape[2],d.shape[3],d.shape[4]]):d}const cm=L({conv3DBackpropInput_:c$});function u$(n,e,t,s,o){const r=T(n,"x","conv3dTranspose"),i=T(e,"filter","conv3dTranspose");return cm(t,r,i,s,o)}const h$=L({conv3dTranspose_:u$});/** + */function l$(n,e,t,s,o){k(n.length===e.rank,()=>`Length of inShape (${n.length}) and rank of dy (${e.rank}) must match`);let r=n,i=e,a=!1;e.rank===4&&(a=!0,i=O(e,[1,e.shape[0],e.shape[1],e.shape[2],e.shape[3]]),r=[1,n[0],n[1],n[2],n[3]]);const l=r[4],c=i.shape[4];k(r.length===5,()=>`Error in conv3dDerInput: inShape must be length 5, but got length ${r.length}.`),k(i.rank===5,()=>`Error in conv3dDerInput: dy must be rank 5, but got rank ${i.rank}`),k(t.rank===5,()=>`Error in conv3dDerInput: filter must be rank 5, but got rank ${t.rank}`),k(l===t.shape[3],()=>`Error in conv3dDerInput: depth of input (${l}) must match input depth for filter ${t.shape[3]}.`),k(c===t.shape[4],()=>`Error in conv3dDerInput: depth of output (${c}) must match output depth for filter ${t.shape[4]}.`);const u={dy:i,filter:t},h={pad:o,strides:s,inputShape:r},d=F.runKernel(eu,u,h);return a?O(d,[d.shape[1],d.shape[2],d.shape[3],d.shape[4]]):d}const cm=L({conv3DBackpropInput_:l$});function c$(n,e,t,s,o){const r=T(n,"x","conv3dTranspose"),i=T(e,"filter","conv3dTranspose");return cm(t,r,i,s,o)}const u$=L({conv3dTranspose_:c$});/** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -1113,7 +1113,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function d$(n){const t={x:T(n,"x","cos","float32")};return F.runKernel(Rr,t)}const rh=L({cos_:d$});/** + */function h$(n){const t={x:T(n,"x","cos","float32")};return F.runKernel(Rr,t)}const sh=L({cos_:h$});/** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -1128,7 +1128,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function p$(n){const t={x:T(n,"x","cosh","float32")};return F.runKernel(Ar,t)}const um=L({cosh_:p$});/** + */function d$(n){const t={x:T(n,"x","cosh","float32")};return F.runKernel(Ar,t)}const um=L({cosh_:d$});/** * @license * Copyright 2022 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the 'License'); @@ -1143,7 +1143,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function f$(n,e=0,t=!1,s=!1){const r={x:T(n,"x","cumprod")},i={axis:e,exclusive:t,reverse:s};return F.runKernel(su,r,i)}const ih=L({cumprod_:f$});/** + */function p$(n,e=0,t=!1,s=!1){const r={x:T(n,"x","cumprod")},i={axis:e,exclusive:t,reverse:s};return F.runKernel(tu,r,i)}const oh=L({cumprod_:p$});/** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -1158,7 +1158,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function m$(n,e=0,t=!1,s=!1){const r={x:T(n,"x","cumsum")},i={axis:e,exclusive:t,reverse:s};return F.runKernel(Ca,r,i)}const hm=L({cumsum_:m$});/** + */function f$(n,e=0,t=!1,s=!1){const r={x:T(n,"x","cumsum")},i={axis:e,exclusive:t,reverse:s};return F.runKernel(Ca,r,i)}const hm=L({cumsum_:f$});/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -1173,7 +1173,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function g$(n,e,t,s=!1){const o=T(n,"x","denseBincount"),r=T(e,"weights","denseBincount");v(o.dtype==="int32",()=>`Error in denseBincount: input dtype must be int32, but got ${o.dtype}`),v(o.rank<=2,()=>`Error in denseBincount: input must be at most rank 2, but got rank ${o.rank}.`),v(t>=0,()=>`size must be non-negative, but got ${t}.`),v(r.size===o.size||r.size===0,()=>`Error in denseBincount: weights must have the same shape as x or 0-length, but got x shape: ${o.shape}, weights shape: ${r.shape}.`);const i={x:o,weights:r},a={size:t,binaryOutput:s};return F.runKernel(ru,i,a)}const dm=L({denseBincount_:g$});/** + */function m$(n,e,t,s=!1){const o=T(n,"x","denseBincount"),r=T(e,"weights","denseBincount");k(o.dtype==="int32",()=>`Error in denseBincount: input dtype must be int32, but got ${o.dtype}`),k(o.rank<=2,()=>`Error in denseBincount: input must be at most rank 2, but got rank ${o.rank}.`),k(t>=0,()=>`size must be non-negative, but got ${t}.`),k(r.size===o.size||r.size===0,()=>`Error in denseBincount: weights must have the same shape as x or 0-length, but got x shape: ${o.shape}, weights shape: ${r.shape}.`);const i={x:o,weights:r},a={size:t,binaryOutput:s};return F.runKernel(su,i,a)}const dm=L({denseBincount_:m$});/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -1188,11 +1188,11 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function x$(n,e,t="NHWC"){const s=T(n,"x","depthToSpace","float32"),o=t==="NHWC"?s.shape[1]:s.shape[2],r=t==="NHWC"?s.shape[2]:s.shape[3],i=t==="NHWC"?s.shape[3]:s.shape[1];v(e>1,()=>`blockSize should be > 1 for depthToSpace, but was: ${e}`),v(o*e>=0,()=>`Negative dimension size caused by overflow when multiplying + */function g$(n,e,t="NHWC"){const s=T(n,"x","depthToSpace","float32"),o=t==="NHWC"?s.shape[1]:s.shape[2],r=t==="NHWC"?s.shape[2]:s.shape[3],i=t==="NHWC"?s.shape[3]:s.shape[1];k(e>1,()=>`blockSize should be > 1 for depthToSpace, but was: ${e}`),k(o*e>=0,()=>`Negative dimension size caused by overflow when multiplying ${o} and ${e} for depthToSpace with input shape - ${s.shape}`),v(r*e>=0,()=>`Negative dimension size caused by overflow when multiplying + ${s.shape}`),k(r*e>=0,()=>`Negative dimension size caused by overflow when multiplying ${r} and ${e} for depthToSpace with input shape - ${s.shape}`),v(i%(e*e)===0,()=>`Dimension size must be evenly divisible by ${e*e} but is ${i} for depthToSpace with input shape ${s.shape}`);const a={x:s},l={blockSize:e,dataFormat:t};return F.runKernel(iu,a,l)}const b$=L({depthToSpace_:x$});/** + ${s.shape}`),k(i%(e*e)===0,()=>`Dimension size must be evenly divisible by ${e*e} but is ${i} for depthToSpace with input shape ${s.shape}`);const a={x:s},l={blockSize:e,dataFormat:t};return F.runKernel(ou,a,l)}const x$=L({depthToSpace_:g$});/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -1207,7 +1207,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function y$(n,e,t,s,o="NHWC",r=[1,1],i){const a=T(n,"x","depthwiseConv2d","float32"),l=T(e,"filter","depthwiseConv2d","float32");let c=a,u=!1;a.rank===3&&(u=!0,c=O(a,[1,a.shape[0],a.shape[1],a.shape[2]])),v(c.rank===4,()=>`Error in depthwiseConv2d: input must be rank 4, but got rank ${c.rank}.`),v(l.rank===4,()=>`Error in depthwiseConv2d: filter must be rank 4, but got rank ${l.rank}.`);const h=o==="NHWC"?c.shape[3]:c.shape[1];v(h===l.shape[2],()=>`Error in depthwiseConv2d: number of input channels (${h}) must match the inChannels dimension in filter ${l.shape[2]}.`),Ut("depthwiseConv2d",s,i);const d={x:c,filter:l},p={strides:t,pad:s,dataFormat:o,dilations:r,dimRoundingMode:i},f=F.runKernel(Ia,d,p);return u?O(f,[f.shape[1],f.shape[2],f.shape[3]]):f}const ah=L({depthwiseConv2d_:y$});/** + */function b$(n,e,t,s,o="NHWC",r=[1,1],i){const a=T(n,"x","depthwiseConv2d","float32"),l=T(e,"filter","depthwiseConv2d","float32");let c=a,u=!1;a.rank===3&&(u=!0,c=O(a,[1,a.shape[0],a.shape[1],a.shape[2]])),k(c.rank===4,()=>`Error in depthwiseConv2d: input must be rank 4, but got rank ${c.rank}.`),k(l.rank===4,()=>`Error in depthwiseConv2d: filter must be rank 4, but got rank ${l.rank}.`);const h=o==="NHWC"?c.shape[3]:c.shape[1];k(h===l.shape[2],()=>`Error in depthwiseConv2d: number of input channels (${h}) must match the inChannels dimension in filter ${l.shape[2]}.`),Ut("depthwiseConv2d",s,i);const d={x:c,filter:l},p={strides:t,pad:s,dataFormat:o,dilations:r,dimRoundingMode:i},f=F.runKernel(Ia,d,p);return u?O(f,[f.shape[1],f.shape[2],f.shape[3]]):f}const rh=L({depthwiseConv2d_:b$});/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -1222,7 +1222,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function w$(n,e,t,s,o=[1,1],r="NHWC"){const i=T(n,"x","dilation2d"),a=T(e,"filter","dilation2d");v(i.rank===3||i.rank===4,()=>`Error in dilation2d: input must be rank 3 or 4, but got rank ${i.rank}.`),v(a.rank===3,()=>`Error in dilation2d: filter must be rank 3, but got rank ${a.rank}.`),v(r==="NHWC",()=>`Error in dilation2d: Only NHWC is currently supported, but got dataFormat of ${r}`);let l=i,c=!1;i.rank===3&&(l=O(i,[1,i.shape[0],i.shape[1],i.shape[2]]),c=!0),v(l.shape[3]===a.shape[2],()=>`Error in dilation2d: input and filter must have the same depth: ${l.shape[3]} vs ${a.shape[2]}`);const u={x:l,filter:a},h={strides:t,pad:s,dilations:o},d=F.runKernel($a,u,h);return c?O(d,[d.shape[1],d.shape[2],d.shape[3]]):d}const C$=L({dilation2d_:w$});/** + */function y$(n,e,t,s,o=[1,1],r="NHWC"){const i=T(n,"x","dilation2d"),a=T(e,"filter","dilation2d");k(i.rank===3||i.rank===4,()=>`Error in dilation2d: input must be rank 3 or 4, but got rank ${i.rank}.`),k(a.rank===3,()=>`Error in dilation2d: filter must be rank 3, but got rank ${a.rank}.`),k(r==="NHWC",()=>`Error in dilation2d: Only NHWC is currently supported, but got dataFormat of ${r}`);let l=i,c=!1;i.rank===3&&(l=O(i,[1,i.shape[0],i.shape[1],i.shape[2]]),c=!0),k(l.shape[3]===a.shape[2],()=>`Error in dilation2d: input and filter must have the same depth: ${l.shape[3]} vs ${a.shape[2]}`);const u={x:l,filter:a},h={strides:t,pad:s,dilations:o},d=F.runKernel($a,u,h);return c?O(d,[d.shape[1],d.shape[2],d.shape[3]]):d}const w$=L({dilation2d_:y$});/** * @license * Copyright 2017 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -1252,7 +1252,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function I$(n,e){let t=T(n,"a","equal","string_or_numeric"),s=T(e,"b","equal","string_or_numeric");[t,s]=tt(t,s),Ce(t.shape,s.shape);const o={a:t,b:s};return F.runKernel(ka,o)}const zn=L({equal_:I$});/** + */function C$(n,e){let t=T(n,"a","equal","string_or_numeric"),s=T(e,"b","equal","string_or_numeric");[t,s]=tt(t,s),Ce(t.shape,s.shape);const o={a:t,b:s};return F.runKernel(ka,o)}const zn=L({equal_:C$});/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -1267,7 +1267,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function $$(n,e,t){const s=T(e,"a","where"),o=T(t,"b","where"),r=T(n,"condition","where","bool"),i=Ce(Ce(r.shape,s.shape),o.shape),a=Ci(r,i),l=Ci(s,i),c=Ci(o,i),u={condition:a,t:l,e:c};return F.runKernel(el,u)}const It=L({where_:$$});/** + */function I$(n,e,t){const s=T(e,"a","where"),o=T(t,"b","where"),r=T(n,"condition","where","bool"),i=Ce(Ce(r.shape,s.shape),o.shape),a=Ci(r,i),l=Ci(s,i),c=Ci(o,i),u={condition:a,t:l,e:c};return F.runKernel(el,u)}const It=L({where_:I$});/** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -1282,7 +1282,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function k$(n){const t={x:T(n,"x","zerosLike")};return F.runKernel(ll,t)}const Ne=L({zerosLike_:k$});/** + */function $$(n){const t={x:T(n,"x","zerosLike")};return F.runKernel(ll,t)}const Ne=L({zerosLike_:$$});/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -1297,7 +1297,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function v$(n,e){let t=T(n,"a","div"),s=T(e,"b","div");[t,s]=tt(t,s);const o=me(t,s),r=Ne(o),i=zn(s,r);return It(i,r,o)}const S$=L({divNoNan_:v$});/** + */function k$(n,e){let t=T(n,"a","div"),s=T(e,"b","div");[t,s]=tt(t,s);const o=me(t,s),r=Ne(o),i=zn(s,r);return It(i,r,o)}const v$=L({divNoNan_:k$});/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -1312,7 +1312,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function T$(n,e){const t=T(n,"t1","dot"),s=T(e,"t2","dot");v((t.rank===1||t.rank===2)&&(s.rank===1||s.rank===2),()=>`Error in dot: inputs must all be rank 1 or 2, but got ranks ${t.rank} and ${s.rank}.`);const o=t.rank===1?t.size:t.shape[1],r=s.rank===1?s.size:s.shape[0];if(v(o===r,()=>`Error in dot: inner dimensions of inputs must match, but got ${o} and ${r}.`),t.rank===1&&s.rank===1){const i=O(t,[1,-1]),a=O(s,[-1,1]),l=Ae(i,a);return O(l,[])}else if(t.rank===1&&s.rank===2){const i=O(t,[1,-1]),a=O(s,[s.shape[0],s.shape[1]]),l=Ae(i,a);return O(l,[l.size])}else if(t.rank===2&&s.rank===1){const i=O(s,[-1,1]),a=Ae(t,i);return O(a,[a.size])}else{const i=O(s,[s.shape[0],s.shape[1]]);return Ae(t,i)}}const N$=L({dot_:T$});/** + */function S$(n,e){const t=T(n,"t1","dot"),s=T(e,"t2","dot");k((t.rank===1||t.rank===2)&&(s.rank===1||s.rank===2),()=>`Error in dot: inputs must all be rank 1 or 2, but got ranks ${t.rank} and ${s.rank}.`);const o=t.rank===1?t.size:t.shape[1],r=s.rank===1?s.size:s.shape[0];if(k(o===r,()=>`Error in dot: inner dimensions of inputs must match, but got ${o} and ${r}.`),t.rank===1&&s.rank===1){const i=O(t,[1,-1]),a=O(s,[-1,1]),l=Ae(i,a);return O(l,[])}else if(t.rank===1&&s.rank===2){const i=O(t,[1,-1]),a=O(s,[s.shape[0],s.shape[1]]),l=Ae(i,a);return O(l,[l.size])}else if(t.rank===2&&s.rank===1){const i=O(s,[-1,1]),a=Ae(t,i);return O(a,[a.size])}else{const i=O(s,[s.shape[0],s.shape[1]]);return Ae(t,i)}}const T$=L({dot_:S$});/** * @license * Copyright 2021 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -1327,7 +1327,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function E$(n,...e){const t=e.map((o,r)=>T(o,`tensors${r}`,"einsum")),s={equation:n};return F.runKernel(hu,t,s)}const $i=L({einsum_:E$});/** + */function N$(n,...e){const t=e.map((o,r)=>T(o,`tensors${r}`,"einsum")),s={equation:n};return F.runKernel(cu,t,s)}const $i=L({einsum_:N$});/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -1342,7 +1342,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function R$(n){const t={x:T(n,"x","elu","float32")};return F.runKernel(Fr,t)}const Il=L({elu_:R$});/** + */function E$(n){const t={x:T(n,"x","elu","float32")};return F.runKernel(Fr,t)}const Il=L({elu_:E$});/** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -1357,7 +1357,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function A$(n){let e=T(n,"x","erf");v(e.dtype==="int32"||e.dtype==="float32",()=>"Input dtype must be `int32` or `float32`."),e.dtype==="int32"&&(e=re(e,"float32"));const t={x:e};return F.runKernel(_r,t)}const pm=L({erf_:A$});/** + */function R$(n){let e=T(n,"x","erf");k(e.dtype==="int32"||e.dtype==="float32",()=>"Input dtype must be `int32` or `float32`."),e.dtype==="int32"&&(e=re(e,"float32"));const t={x:e};return F.runKernel(_r,t)}const pm=L({erf_:R$});/** * @license * Copyright 2017 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -1372,7 +1372,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function lh(n,e){for(let t=0;tn[r]);return[t,o]}function at(n,e){const t=e.map(s=>1);return fm(n,t,e)}function $t(n,e,t){v(lh(e,t),()=>`${n} supports only inner-most axes for now. Got axes ${e} and rank-${t} input.`)}function Ze(n,e){if(lh(n,e))return null;const t=[];for(let s=0;st.push(s)),t}function $s(n){return n.map((e,t)=>[t,e]).sort((e,t)=>e[1]-t[1]).map(e=>e[0])}function nt(n,e){const t=[];for(let s=e-n;sn[r]);return[t,o]}function at(n,e){const t=e.map(s=>1);return fm(n,t,e)}function $t(n,e,t){k(ih(e,t),()=>`${n} supports only inner-most axes for now. Got axes ${e} and rank-${t} input.`)}function Ze(n,e){if(ih(n,e))return null;const t=[];for(let s=0;st.push(s)),t}function $s(n){return n.map((e,t)=>[t,e]).sort((e,t)=>e[1]-t[1]).map(e=>e[0])}function nt(n,e){const t=[];for(let s=e-n;s"Axis must be <= rank of the tensor");const s={input:t},o={dim:e};return F.runKernel(va,s,o)}const Gt=L({expandDims_:W$});/** + */function V$(n,e=0){const t=T(n,"x","expandDims","string_or_numeric");k(e<=t.rank,()=>"Axis must be <= rank of the tensor");const s={input:t},o={dim:e};return F.runKernel(va,s,o)}const Gt=L({expandDims_:V$});/** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -1552,7 +1552,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function U$(n){const t={x:T(n,"x","expm1")};return F.runKernel(Lr,t)}const G$=L({expm1_:U$});/** + */function W$(n){const t={x:T(n,"x","expm1")};return F.runKernel(Lr,t)}const U$=L({expm1_:W$});/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -1567,7 +1567,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function H$(n,e){const t=T(n,"x","tile","string_or_numeric");v(t.rank===e.length,()=>`Error in transpose: rank of input ${t.rank} must match length of reps ${e}.`);const s={x:t},o={reps:e};return F.runKernel(pi,s,o)}const Tn=L({tile_:H$});/** + */function G$(n,e){const t=T(n,"x","tile","string_or_numeric");k(t.rank===e.length,()=>`Error in transpose: rank of input ${t.rank} must match length of reps ${e}.`);const s={x:t},o={reps:e};return F.runKernel(pi,s,o)}const Tn=L({tile_:G$});/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -1582,7 +1582,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function q$(n,e,t,s="float32"){e==null&&(e=n);const o=ke([n,e],s),r=n<=e?n:e;for(let a=0;a`Error in localResponseNormalization: x must be rank 3 or 4 but got - rank ${r.rank}.`),v(Do(e),()=>`Error in localResponseNormalization: depthRadius must be an integer but got depthRadius ${e}.`);let i=r,a=!1;r.rank===3&&(a=!0,i=O(r,[1,r.shape[0],r.shape[1],r.shape[2]]));const l={x:i},c={depthRadius:e,bias:t,alpha:s,beta:o},u=F.runKernel(Oa,l,c);return a?O(u,[u.shape[1],u.shape[2],u.shape[3]]):u}const lk=L({localResponseNormalization_:ak});/** + */function ik(n,e=5,t=1,s=1,o=.5){const r=T(n,"x","localResponseNormalization");k(r.rank===4||r.rank===3,()=>`Error in localResponseNormalization: x must be rank 3 or 4 but got + rank ${r.rank}.`),k(Do(e),()=>`Error in localResponseNormalization: depthRadius must be an integer but got depthRadius ${e}.`);let i=r,a=!1;r.rank===3&&(a=!0,i=O(r,[1,r.shape[0],r.shape[1],r.shape[2]]));const l={x:i},c={depthRadius:e,bias:t,alpha:s,beta:o},u=F.runKernel(Oa,l,c);return a?O(u,[u.shape[1],u.shape[2],u.shape[3]]):u}const ak=L({localResponseNormalization_:ik});/** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -1778,7 +1778,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function ck(n){const t={x:T(n,"x","log","float32")};return F.runKernel(Gr,t)}const Wn=L({log_:ck});/** + */function lk(n){const t={x:T(n,"x","log","float32")};return F.runKernel(Gr,t)}const Wn=L({log_:lk});/** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -1793,7 +1793,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function uk(n){const t={x:T(n,"x","log1p")};return F.runKernel(Hr,t)}const xm=L({log1p_:uk});/** + */function ck(n){const t={x:T(n,"x","log1p")};return F.runKernel(Hr,t)}const xm=L({log1p_:ck});/** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -1808,7 +1808,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function hk(n,e){v(zc(n),()=>"The f passed in variableGrads(f) must be a function"),v(e==null||Array.isArray(e)&&e.every(c=>c instanceof gl),()=>"The varList passed in variableGrads(f, varList) must be an array of variables");const t=e!=null;if(!t){e=[];for(const c in F.registeredVariables)e.push(F.registeredVariables[c])}const s=t?e.filter(c=>!c.trainable):null,o=e.length;e=e.filter(c=>c.trainable),v(e.length>0,()=>`variableGrads() expects at least one of the input variables to be trainable, but none of the ${o} variables is trainable.`);const r=!0,{value:i,grads:a}=F.gradients(n,e,null,r);v(a.some(c=>c!=null),()=>"Cannot find a connection between any variable and the result of the loss function y=f(x). Please make sure the operations that use variables are inside the function f passed to minimize()."),v(i.rank===0,()=>`The f passed in variableGrads(f) must return a scalar, but it returned a rank-${i.rank} tensor`);const l={};return e.forEach((c,u)=>{a[u]!=null&&(l[c.name]=a[u])}),s!=null&&s.forEach(c=>l[c.name]=null),{value:i,grads:l}}function Ko(n){return F.customGrad(n)}/** + */function uk(n,e){k(Pc(n),()=>"The f passed in variableGrads(f) must be a function"),k(e==null||Array.isArray(e)&&e.every(c=>c instanceof gl),()=>"The varList passed in variableGrads(f, varList) must be an array of variables");const t=e!=null;if(!t){e=[];for(const c in F.registeredVariables)e.push(F.registeredVariables[c])}const s=t?e.filter(c=>!c.trainable):null,o=e.length;e=e.filter(c=>c.trainable),k(e.length>0,()=>`variableGrads() expects at least one of the input variables to be trainable, but none of the ${o} variables is trainable.`);const r=!0,{value:i,grads:a}=F.gradients(n,e,null,r);k(a.some(c=>c!=null),()=>"Cannot find a connection between any variable and the result of the loss function y=f(x). Please make sure the operations that use variables are inside the function f passed to minimize()."),k(i.rank===0,()=>`The f passed in variableGrads(f) must return a scalar, but it returned a rank-${i.rank} tensor`);const l={};return e.forEach((c,u)=>{a[u]!=null&&(l[c.name]=a[u])}),s!=null&&s.forEach(c=>l[c.name]=null),{value:i,grads:l}}function Ko(n){return F.customGrad(n)}/** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -1823,7 +1823,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function dk(n){const t={x:T(n,"x","neg")};return F.runKernel(Wa,t)}const st=L({neg_:dk});/** + */function hk(n){const t={x:T(n,"x","neg")};return F.runKernel(Wa,t)}const st=L({neg_:hk});/** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -1838,7 +1838,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function pk(n){const t={x:T(n,"x","softplus")};return F.runKernel(ai,t)}const ki=L({softplus_:pk});/** + */function dk(n){const t={x:T(n,"x","softplus")};return F.runKernel(ai,t)}const ki=L({softplus_:dk});/** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -1853,7 +1853,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function fk(n){const e=T(n,"x","logSigmoid");return Ko(s=>({value:st(ki(st(s))),gradFunc:i=>D(i,Ho(st(s)))}))(e)}const mk=L({logSigmoid_:fk});/** + */function pk(n){const e=T(n,"x","logSigmoid");return Ko(s=>({value:st(ki(st(s))),gradFunc:i=>D(i,Ho(st(s)))}))(e)}const fk=L({logSigmoid_:pk});/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -1868,7 +1868,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function gk(n,e){let t=T(n,"a","sub"),s=T(e,"b","sub");[t,s]=tt(t,s);const o={a:t,b:s};return F.runKernel(ui,o)}const be=L({sub_:gk});/** + */function mk(n,e){let t=T(n,"a","sub"),s=T(e,"b","sub");[t,s]=tt(t,s);const o={a:t,b:s};return F.runKernel(ui,o)}const be=L({sub_:mk});/** * @license * Copyright 2020 Google Inc. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -1883,7 +1883,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function xk(n,e=-1){const t=T(n,"logits","logSoftmax");if(e===-1&&(e=t.rank-1),e!==t.rank-1)throw Error(`Log Softmax along a non-last dimension is not yet supported. Logits was rank ${t.rank} and axis was ${e}`);return Ko((o,r)=>{const a=Sn(o,e,!0),l=be(o,a),c=be(re(l,"float32"),Wn(de(Vn(l),e,!0)));return r([c]),{value:c,gradFunc:(h,d)=>{const[p]=d,f=!0,m=Vn(p);return be(h,D(de(h,e,f),m))}}})(t)}const bm=L({logSoftmax_:xk});/** + */function gk(n,e=-1){const t=T(n,"logits","logSoftmax");if(e===-1&&(e=t.rank-1),e!==t.rank-1)throw Error(`Log Softmax along a non-last dimension is not yet supported. Logits was rank ${t.rank} and axis was ${e}`);return Ko((o,r)=>{const a=Sn(o,e,!0),l=be(o,a),c=be(re(l,"float32"),Wn(de(Vn(l),e,!0)));return r([c]),{value:c,gradFunc:(h,d)=>{const[p]=d,f=!0,m=Vn(p);return be(h,D(de(h,e,f),m))}}})(t)}const bm=L({logSoftmax_:gk});/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -1898,7 +1898,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function bk(n,e=null,t=!1){const s=T(n,"x","logSumExp"),o=$e(e,s.shape),r=Sn(s,o,!0),i=be(s,r),a=Vn(i),l=de(a,o),c=Wn(l),u=J(O(r,c.shape),c);if(t){const h=at(u.shape,o);return O(u,h)}return u}const ym=L({logSumExp_:bk});/** + */function xk(n,e=null,t=!1){const s=T(n,"x","logSumExp"),o=$e(e,s.shape),r=Sn(s,o,!0),i=be(s,r),a=Vn(i),l=de(a,o),c=Wn(l),u=J(O(r,c.shape),c);if(t){const h=at(u.shape,o);return O(u,h)}return u}const ym=L({logSumExp_:xk});/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -1913,7 +1913,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function yk(n,e){const t=T(n,"a","logicalAnd","bool"),s=T(e,"b","logicalAnd","bool");Ce(t.shape,s.shape);const o={a:t,b:s};return F.runKernel(Da,o)}const as=L({logicalAnd_:yk});/** + */function bk(n,e){const t=T(n,"a","logicalAnd","bool"),s=T(e,"b","logicalAnd","bool");Ce(t.shape,s.shape);const o={a:t,b:s};return F.runKernel(Da,o)}const as=L({logicalAnd_:bk});/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -1928,7 +1928,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function wk(n){const t={x:T(n,"x","logicalNot","bool")};return F.runKernel(Fa,t)}const dh=L({logicalNot_:wk});/** + */function yk(n){const t={x:T(n,"x","logicalNot","bool")};return F.runKernel(Fa,t)}const uh=L({logicalNot_:yk});/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -1943,7 +1943,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function Ck(n,e){const t=T(n,"a","logicalOr","bool"),s=T(e,"b","logicalOr","bool");Ce(t.shape,s.shape);const o={a:t,b:s};return F.runKernel(_a,o)}const wm=L({logicalOr_:Ck});/** + */function wk(n,e){const t=T(n,"a","logicalOr","bool"),s=T(e,"b","logicalOr","bool");Ce(t.shape,s.shape);const o={a:t,b:s};return F.runKernel(_a,o)}const wm=L({logicalOr_:wk});/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -1958,7 +1958,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function Ik(n,e){const t=T(n,"a","logicalXor","bool"),s=T(e,"b","logicalXor","bool");return Ce(t.shape,s.shape),as(wm(n,e),dh(as(n,e)))}const $k=L({logicalXor_:Ik});/** + */function Ck(n,e){const t=T(n,"a","logicalXor","bool"),s=T(e,"b","logicalXor","bool");return Ce(t.shape,s.shape),as(wm(n,e),uh(as(n,e)))}const Ik=L({logicalXor_:Ck});/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -1973,7 +1973,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function kk(n,e,t,s,o){const r=T(n,"x","maxPool"),i=1;let a=r,l=!1;r.rank===3&&(l=!0,a=O(r,[1,r.shape[0],r.shape[1],r.shape[2]])),v(a.rank===4,()=>`Error in maxPool: input must be rank 4 but got rank ${a.rank}.`),v(Et(t,i),()=>`Error in maxPool: Either strides or dilations must be 1. Got strides ${t} and dilations '${i}'`),Ut("maxPool",s,o);const c={x:a},u={filterSize:e,strides:t,pad:s,dimRoundingMode:o},h=F.runKernel(Ma,c,u);return l?O(h,[h.shape[1],h.shape[2],h.shape[3]]):h}const ph=L({maxPool_:kk});/** + */function $k(n,e,t,s,o){const r=T(n,"x","maxPool"),i=1;let a=r,l=!1;r.rank===3&&(l=!0,a=O(r,[1,r.shape[0],r.shape[1],r.shape[2]])),k(a.rank===4,()=>`Error in maxPool: input must be rank 4 but got rank ${a.rank}.`),k(Et(t,i),()=>`Error in maxPool: Either strides or dilations must be 1. Got strides ${t} and dilations '${i}'`),Ut("maxPool",s,o);const c={x:a},u={filterSize:e,strides:t,pad:s,dimRoundingMode:o},h=F.runKernel(Ma,c,u);return l?O(h,[h.shape[1],h.shape[2],h.shape[3]]):h}const hh=L({maxPool_:$k});/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -1988,7 +1988,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function vk(n,e=[1,1,1],t,s,o,r="NDHWC"){const i=T(n,"x","maxPool3d");let a=i,l=!1;i.rank===4&&(l=!0,a=O(i,[1,i.shape[0],i.shape[1],i.shape[2],i.shape[3]])),v(a.rank===5,()=>`Error in maxPool3d: x must be rank 5 but got rank ${a.rank}.`),v(r==="NDHWC",()=>`Error in maxPool3d: Only NDHWC is currently supported, but got dataFormat of ${r}`),Ut("maxPool3d",s,o);const c={x:a},u={filterSize:e,strides:t,pad:s,dimRoundingMode:o,dataFormat:r},h=F.runKernel(Pa,c,u);return l?O(h,[h.shape[1],h.shape[2],h.shape[3],h.shape[4]]):h}const Sk=L({maxPool3d_:vk});/** + */function kk(n,e=[1,1,1],t,s,o,r="NDHWC"){const i=T(n,"x","maxPool3d");let a=i,l=!1;i.rank===4&&(l=!0,a=O(i,[1,i.shape[0],i.shape[1],i.shape[2],i.shape[3]])),k(a.rank===5,()=>`Error in maxPool3d: x must be rank 5 but got rank ${a.rank}.`),k(r==="NDHWC",()=>`Error in maxPool3d: Only NDHWC is currently supported, but got dataFormat of ${r}`),Ut("maxPool3d",s,o);const c={x:a},u={filterSize:e,strides:t,pad:s,dimRoundingMode:o,dataFormat:r},h=F.runKernel(Pa,c,u);return l?O(h,[h.shape[1],h.shape[2],h.shape[3],h.shape[4]]):h}const vk=L({maxPool3d_:kk});/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -2003,7 +2003,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function Tk(n,e){let t=T(n,"a","maximum"),s=T(e,"b","maximum");[t,s]=tt(t,s),t.dtype==="bool"&&(t=re(t,"int32"),s=re(s,"int32")),Ce(t.shape,s.shape);const o={a:t,b:s};return F.runKernel(qr,o)}const ks=L({maximum_:Tk});/** + */function Sk(n,e){let t=T(n,"a","maximum"),s=T(e,"b","maximum");[t,s]=tt(t,s),t.dtype==="bool"&&(t=re(t,"int32"),s=re(s,"int32")),Ce(t.shape,s.shape);const o={a:t,b:s};return F.runKernel(qr,o)}const ks=L({maximum_:Sk});/** * @license * Copyright 2020 Google Inc. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -2018,7 +2018,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function Nk(n,e=null,t=!1){const o={x:T(n,"x","mean")},r={axis:e,keepDims:t};return F.runKernel(Ba,o,r)}const lt=L({mean_:Nk});/** + */function Tk(n,e=null,t=!1){const o={x:T(n,"x","mean")},r={axis:e,keepDims:t};return F.runKernel(Ba,o,r)}const lt=L({mean_:Tk});/** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -2048,7 +2048,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function Nn(n,e="float32"){if(ns(n),e==="complex64"){const s=Nn(n,"float32"),o=ot(n,"float32");return Zs(s,o)}const t=Wc(G(n),e);return F.makeTensor(t,n,e)}/** + */function Nn(n,e="float32"){if(ns(n),e==="complex64"){const s=Nn(n,"float32"),o=ot(n,"float32");return Zs(s,o)}const t=zc(G(n),e);return F.makeTensor(t,n,e)}/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -2063,7 +2063,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function Ek(n,e){let t=T(n,"a","minimum"),s=T(e,"b","minimum");[t,s]=tt(t,s),t.dtype==="bool"&&(t=re(t,"int32"),s=re(s,"int32")),Ce(t.shape,s.shape);const o={a:t,b:s};return F.runKernel(jr,o)}const vi=L({minimum_:Ek});/** + */function Nk(n,e){let t=T(n,"a","minimum"),s=T(e,"b","minimum");[t,s]=tt(t,s),t.dtype==="bool"&&(t=re(t,"int32"),s=re(s,"int32")),Ce(t.shape,s.shape);const o={a:t,b:s};return F.runKernel(jr,o)}const vi=L({minimum_:Nk});/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -2078,7 +2078,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function Rk(n,e,t){v(t==="reflect"||t==="symmetric",()=>`Invalid mode. Mode must be either reflect or symmetric. Got ${t}.`);const s=T(n,"x","mirrorPad");if(s.rank===0)throw new Error("mirrorPad(scalar) is not defined. Pass non-scalar to mirrorPad");v(e.length===s.rank,()=>`Padding doesn't match input. Must be ${s.rank}. Got ${e.length}.`);const o=t==="reflect"?1:0;for(let a=0;a"Invalid number of paddings. Must be length of 2 each."),v(e[a][0]>=0&&e[a][0]<=s.shape[a]-o&&e[a][1]>=0&&e[a][1]<=s.shape[a]-o,()=>`Padding in dimension ${a} cannot be greater than or equal to ${s.shape[a]-o} or less than 0 for input of shape ${s.shape}`);const r={paddings:e,mode:t},i={x:s};return F.runKernel(Va,i,r)}const Ak=L({mirrorPad_:Rk});/** + */function Ek(n,e,t){k(t==="reflect"||t==="symmetric",()=>`Invalid mode. Mode must be either reflect or symmetric. Got ${t}.`);const s=T(n,"x","mirrorPad");if(s.rank===0)throw new Error("mirrorPad(scalar) is not defined. Pass non-scalar to mirrorPad");k(e.length===s.rank,()=>`Padding doesn't match input. Must be ${s.rank}. Got ${e.length}.`);const o=t==="reflect"?1:0;for(let a=0;a"Invalid number of paddings. Must be length of 2 each."),k(e[a][0]>=0&&e[a][0]<=s.shape[a]-o&&e[a][1]>=0&&e[a][1]<=s.shape[a]-o,()=>`Padding in dimension ${a} cannot be greater than or equal to ${s.shape[a]-o} or less than 0 for input of shape ${s.shape}`);const r={paddings:e,mode:t},i={x:s};return F.runKernel(Va,i,r)}const Rk=L({mirrorPad_:Ek});/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -2093,7 +2093,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function Dk(n,e){let t=T(n,"a","mod"),s=T(e,"b","mod");[t,s]=tt(t,s);const o={a:t,b:s};return F.runKernel(Kr,o)}const Fk=L({mod_:Dk});/** + */function Ak(n,e){let t=T(n,"a","mod"),s=T(e,"b","mod");[t,s]=tt(t,s);const o={a:t,b:s};return F.runKernel(Kr,o)}const Dk=L({mod_:Ak});/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -2108,7 +2108,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function _k(n,e=null,t=!1){n=T(n,"x","moments");const s=$e(e,n.shape),o=lt(n,s,t);let r=o.shape;t||(r=at(o.shape,s));const i=qe(be(re(n,"float32"),O(o,r))),a=lt(i,s,t);return{mean:o,variance:a}}const fh=L({moments_:_k});/** + */function Fk(n,e=null,t=!1){n=T(n,"x","moments");const s=$e(e,n.shape),o=lt(n,s,t);let r=o.shape;t||(r=at(o.shape,s));const i=qe(be(re(n,"float32"),O(o,r))),a=lt(i,s,t);return{mean:o,variance:a}}const dh=L({moments_:Fk});/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -2123,7 +2123,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function Ok(n,e){let t=T(n,"a","notEqual","string_or_numeric"),s=T(e,"b","notEqual","string_or_numeric");[t,s]=tt(t,s),Ce(t.shape,s.shape);const o={a:t,b:s};return F.runKernel(Ua,o)}const Tl=L({notEqual_:Ok});/** + */function _k(n,e){let t=T(n,"a","notEqual","string_or_numeric"),s=T(e,"b","notEqual","string_or_numeric");[t,s]=tt(t,s),Ce(t.shape,s.shape);const o={a:t,b:s};return F.runKernel(Ua,o)}const Tl=L({notEqual_:_k});/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -2138,7 +2138,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function Lk(n,e,t=1,s=0,o="int32"){if(e<2)throw new Error(`Error in oneHot: depth must be >=2, but it is ${e}`);const i={indices:T(n,"indices","oneHot","int32")},a={dtype:o,depth:e,onValue:t,offValue:s};return F.runKernel(Ha,i,a)}const Cm=L({oneHot_:Lk});/** + */function Ok(n,e,t=1,s=0,o="int32"){if(e<2)throw new Error(`Error in oneHot: depth must be >=2, but it is ${e}`);const i={indices:T(n,"indices","oneHot","int32")},a={dtype:o,depth:e,onValue:t,offValue:s};return F.runKernel(Ha,i,a)}const Cm=L({oneHot_:Ok});/** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -2153,7 +2153,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function Mk(n){const t={x:T(n,"x","onesLike")};return F.runKernel(Ga,t)}const fn=L({onesLike_:Mk});/** + */function Lk(n){const t={x:T(n,"x","onesLike")};return F.runKernel(Ga,t)}const fn=L({onesLike_:Lk});/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -2168,7 +2168,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function Pk(n,e,t=0){const s=T(n,"x","pad");if(s.rank===0)throw new Error("pad(scalar) is not defined. Pass non-scalar to pad");const o={paddings:e,constantValue:t},r={x:s};return F.runKernel(ja,r,o)}const mh=L({pad_:Pk});/** + */function Mk(n,e,t=0){const s=T(n,"x","pad");if(s.rank===0)throw new Error("pad(scalar) is not defined. Pass non-scalar to pad");const o={paddings:e,constantValue:t},r={x:s};return F.runKernel(ja,r,o)}const ph=L({pad_:Mk});/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -2183,7 +2183,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function Bk(n,e,t){const s=T(n,"x","spaceToBatchND");v(s.rank>=1+e.length,()=>`input rank ${s.rank} should be > than [blockShape] ${e.length}`),v(t.length===e.length,()=>`paddings.shape[0] ${t.length} must be equal to [blockShape] ${e.length}`),v(s.shape.reduce((i,a,l)=>l>0&&l<=e.length?i&&(a+t[l-1][0]+t[l-1][1])%e[l-1]===0:i,!0),()=>`input spatial dimensions ${s.shape.slice(1)} with paddings ${t.toString()} must be divisible by blockShapes ${e.toString()}`);const o={x:s},r={blockShape:e,paddings:t};return F.runKernel(sl,o,r)}const gh=L({spaceToBatchND_:Bk});/** + */function Pk(n,e,t){const s=T(n,"x","spaceToBatchND");k(s.rank>=1+e.length,()=>`input rank ${s.rank} should be > than [blockShape] ${e.length}`),k(t.length===e.length,()=>`paddings.shape[0] ${t.length} must be equal to [blockShape] ${e.length}`),k(s.shape.reduce((i,a,l)=>l>0&&l<=e.length?i&&(a+t[l-1][0]+t[l-1][1])%e[l-1]===0:i,!0),()=>`input spatial dimensions ${s.shape.slice(1)} with paddings ${t.toString()} must be divisible by blockShapes ${e.toString()}`);const o={x:s},r={blockShape:e,paddings:t};return F.runKernel(sl,o,r)}const fh=L({spaceToBatchND_:Pk});/** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -2198,7 +2198,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function zk(n,e,t,s,o,r,i){o==null&&(o=[1,1]),r==null&&(r=1),s===0&&(s="valid");const a=T(n,"x","maxPool");let l=a,c=!1;a.rank===3&&(c=!0,l=O(a,[1,a.shape[0],a.shape[1],a.shape[2]])),v(Et(r,o),()=>`Error in pool: Either strides or dilations must be 1. Got strides ${r} and dilations '${o}'`);const u=pn(l.shape,e,r,o,s),h=[u.dilationHeight,u.dilationWidth];let d;s==="same"?d=Wk([u.filterHeight,u.filterWidth],h):d=[[0,0],[0,0]];const p=h[0]===1&&h[1]===1,[f,m]=Vk([u.inHeight,u.inWidth],h,d),g=p?s:"valid",x=p?l:gh(l,h,f),w=(t==="avg"?()=>th(x,e,r,g,i):()=>ph(x,e,r,g,i))(),y=p?w:nh(w,h,m);return c?O(y,[y.shape[1],y.shape[2],y.shape[3]]):y}function Vk(n,e,t){const s=t.map(u=>u[0]),o=t.map(u=>u[1]),r=n.concat(s,o),i=e.map((u,h)=>(u-r[h]%u)%u),a=o.map((u,h)=>u+i[h]),l=e.map((u,h)=>[s[h],a[h]]),c=e.map((u,h)=>[0,i[h]]);return[l,c]}function Wk(n,e){const s=n.map((i,a)=>i+(i-1)*(e[a]-1)).map(i=>i-1),o=s.map(i=>Math.floor(i/2)),r=s.map((i,a)=>i-o[a]);return s.map((i,a)=>[o[a],r[a]])}const Uk=L({pool_:zk});/** + */function Bk(n,e,t,s,o,r,i){o==null&&(o=[1,1]),r==null&&(r=1),s===0&&(s="valid");const a=T(n,"x","maxPool");let l=a,c=!1;a.rank===3&&(c=!0,l=O(a,[1,a.shape[0],a.shape[1],a.shape[2]])),k(Et(r,o),()=>`Error in pool: Either strides or dilations must be 1. Got strides ${r} and dilations '${o}'`);const u=pn(l.shape,e,r,o,s),h=[u.dilationHeight,u.dilationWidth];let d;s==="same"?d=Vk([u.filterHeight,u.filterWidth],h):d=[[0,0],[0,0]];const p=h[0]===1&&h[1]===1,[f,m]=zk([u.inHeight,u.inWidth],h,d),g=p?s:"valid",x=p?l:fh(l,h,f),w=(t==="avg"?()=>Ju(x,e,r,g,i):()=>hh(x,e,r,g,i))(),y=p?w:eh(w,h,m);return c?O(y,[y.shape[1],y.shape[2],y.shape[3]]):y}function zk(n,e,t){const s=t.map(u=>u[0]),o=t.map(u=>u[1]),r=n.concat(s,o),i=e.map((u,h)=>(u-r[h]%u)%u),a=o.map((u,h)=>u+i[h]),l=e.map((u,h)=>[s[h],a[h]]),c=e.map((u,h)=>[0,i[h]]);return[l,c]}function Vk(n,e){const s=n.map((i,a)=>i+(i-1)*(e[a]-1)).map(i=>i-1),o=s.map(i=>Math.floor(i/2)),r=s.map((i,a)=>i-o[a]);return s.map((i,a)=>[o[a],r[a]])}const Wk=L({pool_:Bk});/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -2213,7 +2213,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function Gk(n,e){const t=T(n,"x","prelu"),s=T(e,"alpha","prelu"),o={x:t,alpha:s};return F.runKernel(Ka,o)}const xh=L({prelu_:Gk});/** + */function Uk(n,e){const t=T(n,"x","prelu"),s=T(e,"alpha","prelu"),o={x:t,alpha:s};return F.runKernel(Ka,o)}const mh=L({prelu_:Uk});/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -2228,7 +2228,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function Hk(n,e=null,t=!1){let s=T(n,"x","prod");s.dtype==="bool"&&(s=re(s,"int32"));const o={x:s},r={axis:e,keepDims:t};return F.runKernel(Xa,o,r)}const qk=L({prod_:Hk});var bh={exports:{}};bh.exports,function(n){(function(e,t,s){function o(l){var c=this,u=a();c.next=function(){var h=2091639*c.s0+c.c*23283064365386963e-26;return c.s0=c.s1,c.s1=c.s2,c.s2=h-(c.c=h|0)},c.c=1,c.s0=u(" "),c.s1=u(" "),c.s2=u(" "),c.s0-=u(l),c.s0<0&&(c.s0+=1),c.s1-=u(l),c.s1<0&&(c.s1+=1),c.s2-=u(l),c.s2<0&&(c.s2+=1),u=null}function r(l,c){return c.c=l.c,c.s0=l.s0,c.s1=l.s1,c.s2=l.s2,c}function i(l,c){var u=new o(l),h=c&&c.state,d=u.next;return d.int32=function(){return u.next()*4294967296|0},d.double=function(){return d()+(d()*2097152|0)*11102230246251565e-32},d.quick=d,h&&(typeof h=="object"&&r(h,u),d.state=function(){return r(u,{})}),d}function a(){var l=4022871197,c=function(u){u=String(u);for(var h=0;h>>0,d-=l,d*=l,l=d>>>0,d-=l,l+=d*4294967296}return(l>>>0)*23283064365386963e-26};return c}t&&t.exports?t.exports=i:s&&s.amd?s(function(){return i}):this.alea=i})(Gs,n,!1)}(bh);var jk=bh.exports,yh={exports:{}};yh.exports,function(n){(function(e,t,s){function o(a){var l=this,c="";l.x=0,l.y=0,l.z=0,l.w=0,l.next=function(){var h=l.x^l.x<<11;return l.x=l.y,l.y=l.z,l.z=l.w,l.w^=l.w>>>19^h^h>>>8},a===(a|0)?l.x=a:c+=a;for(var u=0;u>>0)/4294967296};return h.double=function(){do var d=c.next()>>>11,p=(c.next()>>>0)/4294967296,f=(d+p)/(1<<21);while(f===0);return f},h.int32=c.next,h.quick=h,u&&(typeof u=="object"&&r(u,c),h.state=function(){return r(c,{})}),h}t&&t.exports?t.exports=i:s&&s.amd?s(function(){return i}):this.xor128=i})(Gs,n,!1)}(yh);var Kk=yh.exports,wh={exports:{}};wh.exports,function(n){(function(e,t,s){function o(a){var l=this,c="";l.next=function(){var h=l.x^l.x>>>2;return l.x=l.y,l.y=l.z,l.z=l.w,l.w=l.v,(l.d=l.d+362437|0)+(l.v=l.v^l.v<<4^(h^h<<1))|0},l.x=0,l.y=0,l.z=0,l.w=0,l.v=0,a===(a|0)?l.x=a:c+=a;for(var u=0;u>>4),l.next()}function r(a,l){return l.x=a.x,l.y=a.y,l.z=a.z,l.w=a.w,l.v=a.v,l.d=a.d,l}function i(a,l){var c=new o(a),u=l&&l.state,h=function(){return(c.next()>>>0)/4294967296};return h.double=function(){do var d=c.next()>>>11,p=(c.next()>>>0)/4294967296,f=(d+p)/(1<<21);while(f===0);return f},h.int32=c.next,h.quick=h,u&&(typeof u=="object"&&r(u,c),h.state=function(){return r(c,{})}),h}t&&t.exports?t.exports=i:s&&s.amd?s(function(){return i}):this.xorwow=i})(Gs,n,!1)}(wh);var Xk=wh.exports,Ch={exports:{}};Ch.exports,function(n){(function(e,t,s){function o(a){var l=this;l.next=function(){var u=l.x,h=l.i,d,p;return d=u[h],d^=d>>>7,p=d^d<<24,d=u[h+1&7],p^=d^d>>>10,d=u[h+3&7],p^=d^d>>>3,d=u[h+4&7],p^=d^d<<7,d=u[h+7&7],d=d^d<<13,p^=d^d<<9,u[h]=p,l.i=h+1&7,p};function c(u,h){var d,p=[];if(h===(h|0))p[0]=h;else for(h=""+h,d=0;d0;--d)u.next()}c(l,a)}function r(a,l){return l.x=a.x.slice(),l.i=a.i,l}function i(a,l){a==null&&(a=+new Date);var c=new o(a),u=l&&l.state,h=function(){return(c.next()>>>0)/4294967296};return h.double=function(){do var d=c.next()>>>11,p=(c.next()>>>0)/4294967296,f=(d+p)/(1<<21);while(f===0);return f},h.int32=c.next,h.quick=h,u&&(u.x&&r(u,c),h.state=function(){return r(c,{})}),h}t&&t.exports?t.exports=i:s&&s.amd?s(function(){return i}):this.xorshift7=i})(Gs,n,!1)}(Ch);var Yk=Ch.exports,Ih={exports:{}};Ih.exports,function(n){(function(e,t,s){function o(a){var l=this;l.next=function(){var u=l.w,h=l.X,d=l.i,p,f;return l.w=u=u+1640531527|0,f=h[d+34&127],p=h[d=d+1&127],f^=f<<13,p^=p<<17,f^=f>>>15,p^=p>>>12,f=h[d]=f^p,l.i=d,f+(u^u>>>16)|0};function c(u,h){var d,p,f,m,g,x=[],b=128;for(h===(h|0)?(p=h,h=null):(h=h+"\0",p=0,b=Math.max(b,h.length)),f=0,m=-32;m>>15,p^=p<<4,p^=p>>>13,m>=0&&(g=g+1640531527|0,d=x[m&127]^=p+g,f=d==0?f+1:0);for(f>=128&&(x[(h&&h.length||0)&127]=-1),f=127,m=4*128;m>0;--m)p=x[f+34&127],d=x[f=f+1&127],p^=p<<13,d^=d<<17,p^=p>>>15,d^=d>>>12,x[f]=p^d;u.w=g,u.X=x,u.i=f}c(l,a)}function r(a,l){return l.i=a.i,l.w=a.w,l.X=a.X.slice(),l}function i(a,l){a==null&&(a=+new Date);var c=new o(a),u=l&&l.state,h=function(){return(c.next()>>>0)/4294967296};return h.double=function(){do var d=c.next()>>>11,p=(c.next()>>>0)/4294967296,f=(d+p)/(1<<21);while(f===0);return f},h.int32=c.next,h.quick=h,u&&(u.X&&r(u,c),h.state=function(){return r(c,{})}),h}t&&t.exports?t.exports=i:s&&s.amd?s(function(){return i}):this.xor4096=i})(Gs,n,!1)}(Ih);var Zk=Ih.exports,$h={exports:{}};$h.exports,function(n){(function(e,t,s){function o(a){var l=this,c="";l.next=function(){var h=l.b,d=l.c,p=l.d,f=l.a;return h=h<<25^h>>>7^d,d=d-p|0,p=p<<24^p>>>8^f,f=f-h|0,l.b=h=h<<20^h>>>12^d,l.c=d=d-p|0,l.d=p<<16^d>>>16^f,l.a=f-h|0},l.a=0,l.b=0,l.c=-1640531527,l.d=1367130551,a===Math.floor(a)?(l.a=a/4294967296|0,l.b=a|0):c+=a;for(var u=0;u>>0)/4294967296};return h.double=function(){do var d=c.next()>>>11,p=(c.next()>>>0)/4294967296,f=(d+p)/(1<<21);while(f===0);return f},h.int32=c.next,h.quick=h,u&&(typeof u=="object"&&r(u,c),h.state=function(){return r(c,{})}),h}t&&t.exports?t.exports=i:s&&s.amd?s(function(){return i}):this.tychei=i})(Gs,n,!1)}($h);var Qk=$h.exports,Im={exports:{}},Jk={},ev=Object.freeze({__proto__:null,default:Jk}),tv=Ww(ev);(function(n){(function(e,t,s){var o=256,r=6,i=52,a="random",l=s.pow(o,r),c=s.pow(2,i),u=c*2,h=o-1,d;function p(y,C,I){var $=[];C=C==!0?{entropy:!0}:C||{};var k=x(g(C.entropy?[y,w(t)]:y??b(),3),$),S=new f($),N=function(){for(var A=S.g(r),_=l,E=0;A=u;)A/=2,_/=2,E>>>=1;return(A+E)/_};return N.int32=function(){return S.g(4)|0},N.quick=function(){return S.g(4)/4294967296},N.double=N,x(w(S.S),t),(C.pass||I||function(A,_,E,M){return M&&(M.S&&m(M,S),A.state=function(){return m(S,{})}),E?(s[a]=A,_):A})(N,k,"global"in C?C.global:this==s,C.state)}function f(y){var C,I=y.length,$=this,k=0,S=$.i=$.j=0,N=$.S=[];for(I||(y=[I++]);k>>0,d-=l,d*=l,l=d>>>0,d-=l,l+=d*4294967296}return(l>>>0)*23283064365386963e-26};return c}t&&t.exports?t.exports=i:s&&s.amd?s(function(){return i}):this.alea=i})(Gs,n,!1)}(gh);var qk=gh.exports,xh={exports:{}};xh.exports,function(n){(function(e,t,s){function o(a){var l=this,c="";l.x=0,l.y=0,l.z=0,l.w=0,l.next=function(){var h=l.x^l.x<<11;return l.x=l.y,l.y=l.z,l.z=l.w,l.w^=l.w>>>19^h^h>>>8},a===(a|0)?l.x=a:c+=a;for(var u=0;u>>0)/4294967296};return h.double=function(){do var d=c.next()>>>11,p=(c.next()>>>0)/4294967296,f=(d+p)/(1<<21);while(f===0);return f},h.int32=c.next,h.quick=h,u&&(typeof u=="object"&&r(u,c),h.state=function(){return r(c,{})}),h}t&&t.exports?t.exports=i:s&&s.amd?s(function(){return i}):this.xor128=i})(Gs,n,!1)}(xh);var jk=xh.exports,bh={exports:{}};bh.exports,function(n){(function(e,t,s){function o(a){var l=this,c="";l.next=function(){var h=l.x^l.x>>>2;return l.x=l.y,l.y=l.z,l.z=l.w,l.w=l.v,(l.d=l.d+362437|0)+(l.v=l.v^l.v<<4^(h^h<<1))|0},l.x=0,l.y=0,l.z=0,l.w=0,l.v=0,a===(a|0)?l.x=a:c+=a;for(var u=0;u>>4),l.next()}function r(a,l){return l.x=a.x,l.y=a.y,l.z=a.z,l.w=a.w,l.v=a.v,l.d=a.d,l}function i(a,l){var c=new o(a),u=l&&l.state,h=function(){return(c.next()>>>0)/4294967296};return h.double=function(){do var d=c.next()>>>11,p=(c.next()>>>0)/4294967296,f=(d+p)/(1<<21);while(f===0);return f},h.int32=c.next,h.quick=h,u&&(typeof u=="object"&&r(u,c),h.state=function(){return r(c,{})}),h}t&&t.exports?t.exports=i:s&&s.amd?s(function(){return i}):this.xorwow=i})(Gs,n,!1)}(bh);var Kk=bh.exports,yh={exports:{}};yh.exports,function(n){(function(e,t,s){function o(a){var l=this;l.next=function(){var u=l.x,h=l.i,d,p;return d=u[h],d^=d>>>7,p=d^d<<24,d=u[h+1&7],p^=d^d>>>10,d=u[h+3&7],p^=d^d>>>3,d=u[h+4&7],p^=d^d<<7,d=u[h+7&7],d=d^d<<13,p^=d^d<<9,u[h]=p,l.i=h+1&7,p};function c(u,h){var d,p=[];if(h===(h|0))p[0]=h;else for(h=""+h,d=0;d0;--d)u.next()}c(l,a)}function r(a,l){return l.x=a.x.slice(),l.i=a.i,l}function i(a,l){a==null&&(a=+new Date);var c=new o(a),u=l&&l.state,h=function(){return(c.next()>>>0)/4294967296};return h.double=function(){do var d=c.next()>>>11,p=(c.next()>>>0)/4294967296,f=(d+p)/(1<<21);while(f===0);return f},h.int32=c.next,h.quick=h,u&&(u.x&&r(u,c),h.state=function(){return r(c,{})}),h}t&&t.exports?t.exports=i:s&&s.amd?s(function(){return i}):this.xorshift7=i})(Gs,n,!1)}(yh);var Xk=yh.exports,wh={exports:{}};wh.exports,function(n){(function(e,t,s){function o(a){var l=this;l.next=function(){var u=l.w,h=l.X,d=l.i,p,f;return l.w=u=u+1640531527|0,f=h[d+34&127],p=h[d=d+1&127],f^=f<<13,p^=p<<17,f^=f>>>15,p^=p>>>12,f=h[d]=f^p,l.i=d,f+(u^u>>>16)|0};function c(u,h){var d,p,f,m,g,x=[],b=128;for(h===(h|0)?(p=h,h=null):(h=h+"\0",p=0,b=Math.max(b,h.length)),f=0,m=-32;m>>15,p^=p<<4,p^=p>>>13,m>=0&&(g=g+1640531527|0,d=x[m&127]^=p+g,f=d==0?f+1:0);for(f>=128&&(x[(h&&h.length||0)&127]=-1),f=127,m=4*128;m>0;--m)p=x[f+34&127],d=x[f=f+1&127],p^=p<<13,d^=d<<17,p^=p>>>15,d^=d>>>12,x[f]=p^d;u.w=g,u.X=x,u.i=f}c(l,a)}function r(a,l){return l.i=a.i,l.w=a.w,l.X=a.X.slice(),l}function i(a,l){a==null&&(a=+new Date);var c=new o(a),u=l&&l.state,h=function(){return(c.next()>>>0)/4294967296};return h.double=function(){do var d=c.next()>>>11,p=(c.next()>>>0)/4294967296,f=(d+p)/(1<<21);while(f===0);return f},h.int32=c.next,h.quick=h,u&&(u.X&&r(u,c),h.state=function(){return r(c,{})}),h}t&&t.exports?t.exports=i:s&&s.amd?s(function(){return i}):this.xor4096=i})(Gs,n,!1)}(wh);var Yk=wh.exports,Ch={exports:{}};Ch.exports,function(n){(function(e,t,s){function o(a){var l=this,c="";l.next=function(){var h=l.b,d=l.c,p=l.d,f=l.a;return h=h<<25^h>>>7^d,d=d-p|0,p=p<<24^p>>>8^f,f=f-h|0,l.b=h=h<<20^h>>>12^d,l.c=d=d-p|0,l.d=p<<16^d>>>16^f,l.a=f-h|0},l.a=0,l.b=0,l.c=-1640531527,l.d=1367130551,a===Math.floor(a)?(l.a=a/4294967296|0,l.b=a|0):c+=a;for(var u=0;u>>0)/4294967296};return h.double=function(){do var d=c.next()>>>11,p=(c.next()>>>0)/4294967296,f=(d+p)/(1<<21);while(f===0);return f},h.int32=c.next,h.quick=h,u&&(typeof u=="object"&&r(u,c),h.state=function(){return r(c,{})}),h}t&&t.exports?t.exports=i:s&&s.amd?s(function(){return i}):this.tychei=i})(Gs,n,!1)}(Ch);var Zk=Ch.exports,Im={exports:{}},Qk={},Jk=Object.freeze({__proto__:null,default:Qk}),ev=Vw(Jk);(function(n){(function(e,t,s){var o=256,r=6,i=52,a="random",l=s.pow(o,r),c=s.pow(2,i),u=c*2,h=o-1,d;function p(y,C,I){var v=[];C=C==!0?{entropy:!0}:C||{};var $=x(g(C.entropy?[y,w(t)]:y??b(),3),v),S=new f(v),N=function(){for(var A=S.g(r),_=l,E=0;A=u;)A/=2,_/=2,E>>>=1;return(A+E)/_};return N.int32=function(){return S.g(4)|0},N.quick=function(){return S.g(4)/4294967296},N.double=N,x(w(S.S),t),(C.pass||I||function(A,_,E,M){return M&&(M.S&&m(M,S),A.state=function(){return m(S,{})}),E?(s[a]=A,_):A})(N,$,"global"in C?C.global:this==s,C.state)}function f(y){var C,I=y.length,v=this,$=0,S=v.i=v.j=0,N=v.S=[];for(I||(y=[I++]);$=1||i===0);const a=Math.sqrt(-2*Math.log(i)/i);e=this.mean+this.stdDev*o*a,t=this.mean+this.stdDev*r*a,(!this.truncated||this.isValidTruncated(e))&&(s=!0)}return(!this.truncated||this.isValidTruncated(t))&&(this.nextVal=this.convertValue(t)),this.convertValue(e)}convertValue(e){return this.dtype==null||this.dtype==="float32"?e:Math.round(e)}isValidTruncated(e){return e<=this.upper&&e>=this.lower}}class cv{constructor(e=0,t=1,s,o){if(this.canReturnFloat=()=>this.dtype==null||this.dtype==="float32",this.min=e,this.range=t-e,this.dtype=s,o==null&&(o=Math.random()),typeof o=="number"&&(o=o.toString()),!this.canReturnFloat()&&this.range<=1)throw new Error(`The difference between ${e} - ${t} <= 1 and dtype is not float`);this.random=kh.alea(o)}convertValue(e){return this.canReturnFloat()?e:Math.round(e)}nextValue(){return this.convertValue(this.min+this.range*this.random())}}/** + */class $m{constructor(e,t,s,o,r){this.mean=e,this.stdDev=t,this.dtype=s,this.nextVal=NaN,this.truncated=o,this.truncated&&(this.upper=this.mean+this.stdDev*2,this.lower=this.mean-this.stdDev*2);const i=r||Math.random();this.random=Ih.alea(i.toString())}nextValue(){if(!isNaN(this.nextVal)){const o=this.nextVal;return this.nextVal=NaN,o}let e,t,s=!1;for(;!s;){let o,r,i;do o=2*this.random()-1,r=2*this.random()-1,i=o*o+r*r;while(i>=1||i===0);const a=Math.sqrt(-2*Math.log(i)/i);e=this.mean+this.stdDev*o*a,t=this.mean+this.stdDev*r*a,(!this.truncated||this.isValidTruncated(e))&&(s=!0)}return(!this.truncated||this.isValidTruncated(t))&&(this.nextVal=this.convertValue(t)),this.convertValue(e)}convertValue(e){return this.dtype==null||this.dtype==="float32"?e:Math.round(e)}isValidTruncated(e){return e<=this.upper&&e>=this.lower}}class lv{constructor(e=0,t=1,s,o){if(this.canReturnFloat=()=>this.dtype==null||this.dtype==="float32",this.min=e,this.range=t-e,this.dtype=s,o==null&&(o=Math.random()),typeof o=="number"&&(o=o.toString()),!this.canReturnFloat()&&this.range<=1)throw new Error(`The difference between ${e} - ${t} <= 1 and dtype is not float`);this.random=Ih.alea(o)}convertValue(e){return this.canReturnFloat()?e:Math.round(e)}nextValue(){return this.convertValue(this.min+this.range*this.random())}}/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -2258,7 +2258,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function uv(n,e=0,t=1,s,o){if(ns(n),s!=null&&s==="bool")throw new Error(`Unsupported data type ${s}`);const r=new $m(e,t,s,!1,o),i=ke(n,s);for(let a=0;a`Error in separableConv2d: input must be rank 4, but got rank ${u.rank}.`),v(l.rank===4,()=>`Error in separableConv2d: depthwise filter must be rank 4, but got rank ${l.rank}.`),v(c.rank===4,()=>`Error in separableConv2d: pointwise filter must be rank 4, but got rank ${l.rank}.`),v(c.shape[0]===1,()=>`Error in separableConv2d: the first dimension of pointwise filter must be 1, but got ${c.shape[0]}.`),v(c.shape[1]===1,()=>`Error in separableConv2d: the second dimension of pointwise filter must be 1, but got ${c.shape[1]}.`);const d=l.shape[2],p=l.shape[3];v(c.shape[2]===d*p,()=>`Error in separableConv2d: the third dimension of pointwise filter must be ${d*p}, but got ${c.shape[2]}.`);const f=ah(u,l,s,o,i,r),g=ro(f,c,1,"valid",i);return h?O(g,[g.shape[1],g.shape[2],g.shape[3]]):g}const Nm=L({separableConv2d_:Iv});/** + */function wv(n){const t={x:T(n,"x","selu")};return F.runKernel(ni,t)}const Tm=L({selu_:wv});function Cv(n,e,t,s,o,r=[1,1],i="NHWC"){const a=T(n,"x","separableConv2d"),l=T(e,"depthwiseFilter","separableConv2d"),c=T(t,"pointwiseFilter","separableConv2d");let u=a,h=!1;if(a.rank===3&&(h=!0,u=O(a,[1,a.shape[0],a.shape[1],a.shape[2]])),i==="NCHW")throw new Error("separableConv2d currently does not support dataFormat NCHW; only NHWC is supported");k(u.rank===4,()=>`Error in separableConv2d: input must be rank 4, but got rank ${u.rank}.`),k(l.rank===4,()=>`Error in separableConv2d: depthwise filter must be rank 4, but got rank ${l.rank}.`),k(c.rank===4,()=>`Error in separableConv2d: pointwise filter must be rank 4, but got rank ${l.rank}.`),k(c.shape[0]===1,()=>`Error in separableConv2d: the first dimension of pointwise filter must be 1, but got ${c.shape[0]}.`),k(c.shape[1]===1,()=>`Error in separableConv2d: the second dimension of pointwise filter must be 1, but got ${c.shape[1]}.`);const d=l.shape[2],p=l.shape[3];k(c.shape[2]===d*p,()=>`Error in separableConv2d: the third dimension of pointwise filter must be ${d*p}, but got ${c.shape[2]}.`);const f=rh(u,l,s,o,i,r),g=ro(f,c,1,"valid",i);return h?O(g,[g.shape[1],g.shape[2],g.shape[3]]):g}const Nm=L({separableConv2d_:Cv});/** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -2423,7 +2423,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function $v(n){const t={x:T(n,"x","sign")};return F.runKernel(ri,t)}const kv=L({sign_:$v});/** + */function Iv(n){const t={x:T(n,"x","sign")};return F.runKernel(ri,t)}const $v=L({sign_:Iv});/** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -2438,7 +2438,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function vv(n){const t={x:T(n,"x","sin","float32")};return F.runKernel(si,t)}const Em=L({sin_:vv});/** + */function kv(n){const t={x:T(n,"x","sin","float32")};return F.runKernel(si,t)}const Em=L({sin_:kv});/** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -2453,7 +2453,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function Sv(n){const t={x:T(n,"x","sinh")};return F.runKernel(oi,t)}const Rm=L({sinh_:Sv});/** + */function vv(n){const t={x:T(n,"x","sinh")};return F.runKernel(oi,t)}const Rm=L({sinh_:vv});/** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -2468,7 +2468,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function Tv(n,e,t){const s=T(n,"x","slice1d");return v(s.rank===1,()=>`slice1d expects a rank-1 tensor, but got a rank-${s.rank} tensor`),Ve(s,[e],[t])}const vh=L({slice1d_:Tv});/** + */function Sv(n,e,t){const s=T(n,"x","slice1d");return k(s.rank===1,()=>`slice1d expects a rank-1 tensor, but got a rank-${s.rank} tensor`),Ve(s,[e],[t])}const $h=L({slice1d_:Sv});/** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -2483,7 +2483,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function Nv(n,e,t){const s=T(n,"x","slice2d");return v(s.rank===2,()=>`slice2d expects a rank-2 tensor, but got a rank-${s.rank} tensor`),Ve(s,e,t)}const Am=L({slice2d_:Nv});/** + */function Tv(n,e,t){const s=T(n,"x","slice2d");return k(s.rank===2,()=>`slice2d expects a rank-2 tensor, but got a rank-${s.rank} tensor`),Ve(s,e,t)}const Am=L({slice2d_:Tv});/** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -2498,7 +2498,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function Ev(n,e,t){const s=T(n,"x","slice3d");return v(s.rank===3,()=>`slice3d expects a rank-3 tensor, but got a rank-${s.rank} tensor`),Ve(s,e,t)}const Sh=L({slice3d_:Ev});/** + */function Nv(n,e,t){const s=T(n,"x","slice3d");return k(s.rank===3,()=>`slice3d expects a rank-3 tensor, but got a rank-${s.rank} tensor`),Ve(s,e,t)}const kh=L({slice3d_:Nv});/** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -2513,7 +2513,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function Rv(n,e,t){const s=T(n,"x","slice4d");return v(s.rank===4,()=>`slice4d expects a rank-4 tensor, but got a rank-${s.rank} tensor`),Ve(s,e,t)}const El=L({slice4d_:Rv});/** + */function Ev(n,e,t){const s=T(n,"x","slice4d");return k(s.rank===4,()=>`slice4d expects a rank-4 tensor, but got a rank-${s.rank} tensor`),Ve(s,e,t)}const El=L({slice4d_:Ev});/** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -2528,7 +2528,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function Av(n,e=-1){const t=T(n,"logits","softmax","float32");if(e===-1&&(e=t.rank-1),e!==t.rank-1)throw Error(`Softmax along a non-last dimension is not yet supported. Logits was rank ${t.rank} and dim was ${e}`);const s={logits:t},o={dim:e};return F.runKernel(rl,s,o)}const Th=L({softmax_:Av});/** + */function Rv(n,e=-1){const t=T(n,"logits","softmax","float32");if(e===-1&&(e=t.rank-1),e!==t.rank-1)throw Error(`Softmax along a non-last dimension is not yet supported. Logits was rank ${t.rank} and dim was ${e}`);const s={logits:t},o={dim:e};return F.runKernel(rl,s,o)}const vh=L({softmax_:Rv});/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -2543,7 +2543,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function Dv(n){v(n.dtype==="complex64",()=>`The dtype for tf.spectral.fft() must be complex64 but got ${n.dtype}.`);const e={input:n};return F.runKernel(pu,e)}const Dm=L({fft_:Dv});/** + */function Av(n){k(n.dtype==="complex64",()=>`The dtype for tf.spectral.fft() must be complex64 but got ${n.dtype}.`);const e={input:n};return F.runKernel(hu,e)}const Dm=L({fft_:Av});/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -2558,7 +2558,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function Fv(n){v(n.dtype==="complex64",()=>`The dtype for tf.spectral.ifft() must be complex64 but got ${n.dtype}.`);const e={input:n};return F.runKernel(gu,e)}const Nh=L({ifft_:Fv});/** + */function Dv(n){k(n.dtype==="complex64",()=>`The dtype for tf.spectral.ifft() must be complex64 but got ${n.dtype}.`);const e={input:n};return F.runKernel(fu,e)}const Sh=L({ifft_:Dv});/** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -2573,7 +2573,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function _v(n){const e=n.shape[n.shape.length-1],t=n.size/e;let s;if(e<=2){const o=O(n,[t,e]);s=Nh(o)}else{const o=[t,2*(e-1)],r=O(Nl(n),[t,e]),i=O(uh(n),[t,e]),a=uo(Ve(r,[0,1],[t,e-2]),1),l=D(uo(Ve(i,[0,1],[t,e-2]),1),De(-1)),c=Mt([r,a],1),u=Mt([i,l],1),h=O(Zs(c,u),[o[0],o[1]]);s=Nh(h)}if(s=Nl(s),n.rank===3&&n.shape[0]!==0){const o=s,r=n.shape[0];s=O(s,[r,s.shape[0]/r,s.shape[1]]),o.dispose()}return s}const Ov=L({irfft_:_v});/** + */function Fv(n){const e=n.shape[n.shape.length-1],t=n.size/e;let s;if(e<=2){const o=O(n,[t,e]);s=Sh(o)}else{const o=[t,2*(e-1)],r=O(Nl(n),[t,e]),i=O(lh(n),[t,e]),a=uo(Ve(r,[0,1],[t,e-2]),1),l=D(uo(Ve(i,[0,1],[t,e-2]),1),De(-1)),c=Ot([r,a],1),u=Ot([i,l],1),h=O(Zs(c,u),[o[0],o[1]]);s=Sh(h)}if(s=Nl(s),n.rank===3&&n.shape[0]!==0){const o=s,r=n.shape[0];s=O(s,[r,s.shape[0]/r,s.shape[1]]),o.dispose()}return s}const _v=L({irfft_:Fv});/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -2588,7 +2588,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function Lv(n,e,t=0){const o={x:T(n,"x","split")},r={numOrSizeSplits:e,axis:t};return F.runKernel(ol,o,r)}const sn=L({split_:Lv});/** + */function Ov(n,e,t=0){const o={x:T(n,"x","split")},r={numOrSizeSplits:e,axis:t};return F.runKernel(ol,o,r)}const sn=L({split_:Ov});/** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -2603,7 +2603,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function Mv(n,e){v(n.dtype==="float32",()=>`The dtype for rfft() must be real value but got ${n.dtype}`);let t=n.shape[n.shape.length-1];const s=n.size/t;let o;if(e!=null&&e0),m=n.shape.map(g=>g);m[n.shape.length-1]=e,o=Ve(n,f,m),t=e}else if(e!=null&&e>t){const f=n.shape.map(m=>m);f[n.shape.length-1]=e-t,o=Mt([n,ot(f)],n.shape.length-1),t=e}else o=n;const r=Ne(o),i=O(Zs(o,r),[s,t]),a=Dm(i),l=Math.floor(t/2)+1,c=Nl(a),u=uh(a),h=sn(c,[l,t-l],c.shape.length-1),d=sn(u,[l,t-l],u.shape.length-1),p=o.shape.slice();return p[o.shape.length-1]=l,O(Zs(h[0],d[0]),p)}const Pv=L({rfft_:Mv});/** + */function Lv(n,e){k(n.dtype==="float32",()=>`The dtype for rfft() must be real value but got ${n.dtype}`);let t=n.shape[n.shape.length-1];const s=n.size/t;let o;if(e!=null&&e0),m=n.shape.map(g=>g);m[n.shape.length-1]=e,o=Ve(n,f,m),t=e}else if(e!=null&&e>t){const f=n.shape.map(m=>m);f[n.shape.length-1]=e-t,o=Ot([n,ot(f)],n.shape.length-1),t=e}else o=n;const r=Ne(o),i=O(Zs(o,r),[s,t]),a=Dm(i),l=Math.floor(t/2)+1,c=Nl(a),u=lh(a),h=sn(c,[l,t-l],c.shape.length-1),d=sn(u,[l,t-l],u.shape.length-1),p=o.shape.slice();return p[o.shape.length-1]=l,O(Zs(h[0],d[0]),p)}const Mv=L({rfft_:Lv});/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -2618,7 +2618,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function Bv(n,e){let t=T(n,"a","squaredDifference"),s=T(e,"b","squaredDifference");[t,s]=tt(t,s),Ce(t.shape,s.shape);const o={a:t,b:s},r={};return F.runKernel(ci,o,r)}const zv=L({squaredDifference_:Bv});/** + */function Pv(n,e){let t=T(n,"a","squaredDifference"),s=T(e,"b","squaredDifference");[t,s]=tt(t,s),Ce(t.shape,s.shape);const o={a:t,b:s},r={};return F.runKernel(ci,o,r)}const Bv=L({squaredDifference_:Pv});/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -2633,7 +2633,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function Vv(n,e){const t=T(n,"x","squeeze","string_or_numeric");return O(t,ms(t.shape,e).newShape)}const Xo=L({squeeze_:Vv});/** + */function zv(n,e){const t=T(n,"x","squeeze","string_or_numeric");return O(t,ms(t.shape,e).newShape)}const Xo=L({squeeze_:zv});/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -2648,7 +2648,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function Wv(n,e=0){const t=qf(n,"tensors","stack","string_or_numeric");v(t.length>=1,()=>"Pass at least one tensor to tf.stack"),t.length>0&&v(e<=t[0].rank,()=>"Axis must be <= rank of the tensor");const s=t,o={axis:e};return F.runKernel(qa,s,o)}const Un=L({stack_:Wv});/** + */function Vv(n,e=0){const t=qf(n,"tensors","stack","string_or_numeric");k(t.length>=1,()=>"Pass at least one tensor to tf.stack"),t.length>0&&k(e<=t[0].rank,()=>"Axis must be <= rank of the tensor");const s=t,o={axis:e};return F.runKernel(qa,s,o)}const Un=L({stack_:Vv});/** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -2663,7 +2663,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function Uv(n,e=0){const s={x:T(n,"x","step")},o={alpha:e};return F.runKernel(fi,s,o)}const Ni=L({step_:Uv});/** + */function Wv(n,e=0){const s={x:T(n,"x","step")},o={alpha:e};return F.runKernel(fi,s,o)}const Ni=L({step_:Wv});/** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -2678,7 +2678,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function Gv(n,e,t,s,o=0,r=0,i=0,a=0,l=0){const u={x:T(n,"x","stridedSlice","string_or_numeric")},h={begin:e,end:t,strides:s,beginMask:o,endMask:r,ellipsisMask:i,newAxisMask:a,shrinkAxisMask:l};return F.runKernel(Ru,u,h)}const Hv=L({stridedSlice_:Gv});/** + */function Uv(n,e,t,s,o=0,r=0,i=0,a=0,l=0){const u={x:T(n,"x","stridedSlice","string_or_numeric")},h={begin:e,end:t,strides:s,beginMask:o,endMask:r,ellipsisMask:i,newAxisMask:a,shrinkAxisMask:l};return F.runKernel(Nu,u,h)}const Gv=L({stridedSlice_:Uv});/** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -2693,7 +2693,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function qv(n){const t={x:T(n,"x","tan","float32")};return F.runKernel(hi,t)}const jv=L({tan_:qv});/** + */function Hv(n){const t={x:T(n,"x","tan","float32")};return F.runKernel(hi,t)}const qv=L({tan_:Hv});/** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -2708,7 +2708,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function At(n,e){Mp(n);const t=xl(n,e);if(t.length!==1)throw new Error("tensor1d() requires values to be a flat/TypedArray");return bl(n,null,t,e)}/** + */function Lt(n,e){Mp(n);const t=xl(n,e);if(t.length!==1)throw new Error("tensor1d() requires values to be a flat/TypedArray");return bl(n,null,t,e)}/** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -2723,7 +2723,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function Eh(n,e,t){if(Mp(n),e!=null&&e.length!==2)throw new Error("tensor2d() requires shape to have two numbers");const s=xl(n,t);if(s.length!==2&&s.length!==1)throw new Error("tensor2d() requires values to be number[][] or flat/TypedArray");if(s.length===1&&e==null)throw new Error("tensor2d() requires shape to be provided when `values` are a flat/TypedArray");return bl(n,e,s,t)}function Fm(n,e,t){const s=e.rank>1?e.shape[e.rank-1]:1,o=e.rank>1?e.rank-1:1,r=`Must have updates.shape = indices.shape[:batchDim] + shape[sliceDim:], got updates.shape: ${t.shape}, indices.shape: ${e.shape}, shape: ${n}, sliceDim: ${s}, and batchDim: ${o}.`;if(t.rank1?e.shape[s-1]:1,r=t.length;let i=1;for(let h=o;h1?e.shape[e.rank-1]:1,o=e.rank>1?e.rank-1:1,r=`Must have updates.shape = indices.shape[:batchDim] + shape[sliceDim:], got updates.shape: ${t.shape}, indices.shape: ${e.shape}, shape: ${n}, sliceDim: ${s}, and batchDim: ${o}.`;if(t.rank1?e.shape[s-1]:1,r=t.length;let i=1;for(let h=o;h= 0 but got ${e}`);if(e>o)throw new Error(`'k' passed to topk() must be <= the last dimension (${o}) but got ${e}`);const r={x:s},i={k:e,sorted:t},[a,l]=F.runKernel(Au,r,i);return{values:a,indices:l}}const Yv=L({topk_:Xv});/** + */function Kv(n,e=1,t=!0){const s=T(n,"x","topk");if(s.rank===0)throw new Error("topk() expects the input to be of rank 1 or higher");const o=s.shape[s.shape.length-1];if(e<0)throw new Error(`'k' passed to topk() must be >= 0 but got ${e}`);if(e>o)throw new Error(`'k' passed to topk() must be <= the last dimension (${o}) but got ${e}`);const r={x:s},i={k:e,sorted:t},[a,l]=F.runKernel(Eu,r,i);return{values:a,indices:l}}const Xv=L({topk_:Kv});/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -2753,7 +2753,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function Zv(n,e=0,t=1,s,o){if(ns(n),s!=null&&s==="bool")throw new Error("Unsupported data type $ { dtype }");const r=new $m(e,t,s,!0,o),i=ke(n,s);for(let a=0;a0,()=>"The input tensor must be at least 1D");const s={x:t},o={axis:e},[r,i]=F.runKernel(Fu,s,o);return{values:r,indices:i}}const Jv=L({unique_:Qv});/** + */function Zv(n,e=0){const t=T(n,"x","unique","string_or_numeric");k(t.rank>0,()=>"The input tensor must be at least 1D");const s={x:t},o={axis:e},[r,i]=F.runKernel(Au,s,o);return{values:r,indices:i}}const Qv=L({unique_:Zv});/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -2783,7 +2783,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function eS(n,e,t){const s=T(n,"x","unsortedSegmentSum"),o=T(e,"segmentIds","unsortedSegmentSum","int32");v(Do(t),()=>"numSegments must be of dtype int");const r={x:s,segmentIds:o},i={numSegments:t};return F.runKernel(al,r,i)}const Om=L({unsortedSegmentSum_:eS});/** + */function Jv(n,e,t){const s=T(n,"x","unsortedSegmentSum"),o=T(e,"segmentIds","unsortedSegmentSum","int32");k(Do(t),()=>"numSegments must be of dtype int");const r={x:s,segmentIds:o},i={numSegments:t};return F.runKernel(al,r,i)}const Om=L({unsortedSegmentSum_:Jv});/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -2798,7 +2798,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function tS(n,e=0){const t=T(n,"x","unstack","string_or_numeric");v(e>=-t.shape.length&&e`Axis = ${e} is not in [-${t.shape.length}, ${t.shape.length})`);const s={value:t},o={axis:e};return F.runKernel(il,s,o)}const Gn=L({unstack_:tS});/** + */function eS(n,e=0){const t=T(n,"x","unstack","string_or_numeric");k(e>=-t.shape.length&&e`Axis = ${e} is not in [-${t.shape.length}, ${t.shape.length})`);const s={value:t},o={axis:e};return F.runKernel(il,s,o)}const Gn=L({unstack_:eS});/** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -2813,7 +2813,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function nS(n,e=!0,t,s){return F.makeVariable(n,e,t,s)}/** + */function tS(n,e=!0,t,s){return F.makeVariable(n,e,t,s)}/** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -2828,7 +2828,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function Rh(n,e){const t=[];for(let r=0;ra).reverse()),v(s.rank===e.length,()=>`Error in transpose: rank of input ${s.rank} must match length of perm ${e}.`),e.forEach(i=>{v(i>=0&&i`All entries in 'perm' must be between 0 and ${s.rank-1} but got ${e}`)}),s.rank<=1)return s.clone();const o={x:s},r={perm:e};return s.dtype==="complex64"?B(()=>{let i=Nl(s),a=uh(s);return i=F.runKernel(Mo,{x:i},r),a=F.runKernel(Mo,{x:a},r),t&&(a=st(a)),Zs(i,a)}):F.runKernel(Mo,o,r)}const Ee=L({transpose_:oS});/** + */function sS(n,e,t){const s=T(n,"x","transpose");if(e==null&&(e=s.shape.map((i,a)=>a).reverse()),k(s.rank===e.length,()=>`Error in transpose: rank of input ${s.rank} must match length of perm ${e}.`),e.forEach(i=>{k(i>=0&&i`All entries in 'perm' must be between 0 and ${s.rank-1} but got ${e}`)}),s.rank<=1)return s.clone();const o={x:s},r={perm:e};return s.dtype==="complex64"?B(()=>{let i=Nl(s),a=lh(s);return i=F.runKernel(Mo,{x:i},r),a=F.runKernel(Mo,{x:a},r),t&&(a=st(a)),Zs(i,a)}):F.runKernel(Mo,o,r)}const Ee=L({transpose_:sS});/** * @license * Copyright 2019 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -2873,7 +2873,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function rS(n,e){if(e==null)return n.shape.slice();if(_e(n.shape,e))return e;if(n.shape.length===e.length){const t=[];for(let s=0;s`x has to be a floating point tensor since it's going to be scaled, but got a ${o.dtype} tensor instead.`),v(e>=0&&e<1,()=>`rate must be a float in the range [0, 1), but got ${e}.`),e===0)return n instanceof ct?o.clone():o;const r=rS(o,t),i=1-e,a=me(vl(J(Si(r,0,1,"float32",s),i)),i);return D(o,a)}const aS=L({dropout_:iS});/** + */function rS(n,e,t,s){const o=T(n,"x","dropout");if(k(o.dtype==="float32",()=>`x has to be a floating point tensor since it's going to be scaled, but got a ${o.dtype} tensor instead.`),k(e>=0&&e<1,()=>`rate must be a float in the range [0, 1), but got ${e}.`),e===0)return n instanceof ct?o.clone():o;const r=oS(o,t),i=1-e,a=me(vl(J(Si(r,0,1,"float32",s),i)),i);return D(o,a)}const iS=L({dropout_:rS});/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -2903,7 +2903,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function lS(n,e,t,s,o,r="NHWC",i){let a=n;n.rank===3&&(a=O(n,[1,n.shape[0],n.shape[1],n.shape[2]]));let l=e;l.rank===3&&(l=O(e,[1,e.shape[0],e.shape[1],e.shape[2]])),v(a.rank===4,()=>`Error in conv2dDerFilter: input must be rank 4, but got shape ${a.shape}.`),v(l.rank===4,()=>`Error in conv2dDerFilter: dy must be rank 4, but got shape ${l.shape}.`),v(t.length===4,()=>`Error in conv2dDerFilter: filterShape must be length 4, but got ${t}.`);const c=r==="NHWC"?a.shape[3]:a.shape[1],u=r==="NHWC"?l.shape[3]:l.shape[1];v(c===t[2],()=>`Error in conv2dDerFilter: depth of input ${c}) must match input depth in filter (${t[2]}.`),v(u===t[3],()=>`Error in conv2dDerFilter: depth of dy (${u}) must match output depth for filter (${t[3]}).`),Ut("conv2dDerFilter",o,i);const h={x:a,dy:l},d={strides:s,pad:o,dataFormat:r,dimRoundingMode:i,filterShape:t};return F.runKernel(eu,h,d)}const Ah=L({conv2DBackpropFilter_:lS});/** + */function aS(n,e,t,s,o,r="NHWC",i){let a=n;n.rank===3&&(a=O(n,[1,n.shape[0],n.shape[1],n.shape[2]]));let l=e;l.rank===3&&(l=O(e,[1,e.shape[0],e.shape[1],e.shape[2]])),k(a.rank===4,()=>`Error in conv2dDerFilter: input must be rank 4, but got shape ${a.shape}.`),k(l.rank===4,()=>`Error in conv2dDerFilter: dy must be rank 4, but got shape ${l.shape}.`),k(t.length===4,()=>`Error in conv2dDerFilter: filterShape must be length 4, but got ${t}.`);const c=r==="NHWC"?a.shape[3]:a.shape[1],u=r==="NHWC"?l.shape[3]:l.shape[1];k(c===t[2],()=>`Error in conv2dDerFilter: depth of input ${c}) must match input depth in filter (${t[2]}.`),k(u===t[3],()=>`Error in conv2dDerFilter: depth of dy (${u}) must match output depth for filter (${t[3]}).`),Ut("conv2dDerFilter",o,i);const h={x:a,dy:l},d={strides:s,pad:o,dataFormat:r,dimRoundingMode:i,filterShape:t};return F.runKernel(Qc,h,d)}const Eh=L({conv2DBackpropFilter_:aS});/** * @license * Copyright 2019 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -2918,7 +2918,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function Dh(n,e,t){if(t==null||t==="linear")return n;if(t==="relu")return D(n,Ni(e));throw new Error(`Cannot compute gradient for fused activation ${t}.`)}function Fh(n,e){let t=e;const s=ut(n.shape,e.shape);return s.length>0&&(t=de(t,s)),O(t,n.shape)}function _h(n,e,t,s){if(e==="linear")return n;if(e==="relu")return co(n);if(e==="elu")return Il(n);if(e==="relu6")return km(n);if(e==="prelu")return xh(n,t);if(e==="leakyrelu")return hh(n,s);if(e==="sigmoid")return Ho(n);throw new Error(`Unknown fused activation ${e}.`)}const Oh=(n,e)=>!(n>0)||e==="linear";/** + */function Rh(n,e,t){if(t==null||t==="linear")return n;if(t==="relu")return D(n,Ni(e));throw new Error(`Cannot compute gradient for fused activation ${t}.`)}function Ah(n,e){let t=e;const s=ut(n.shape,e.shape);return s.length>0&&(t=de(t,s)),O(t,n.shape)}function Dh(n,e,t,s){if(e==="linear")return n;if(e==="relu")return co(n);if(e==="elu")return Il(n);if(e==="relu6")return km(n);if(e==="prelu")return mh(n,t);if(e==="leakyrelu")return ch(n,s);if(e==="sigmoid")return Ho(n);throw new Error(`Unknown fused activation ${e}.`)}const Fh=(n,e)=>!(n>0)||e==="linear";/** * @license * Copyright 2019 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -2933,7 +2933,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function cS({x:n,filter:e,strides:t,pad:s,dataFormat:o="NHWC",dilations:r=[1,1],dimRoundingMode:i,bias:a,activation:l="linear",preluActivationWeights:c,leakyreluAlpha:u}){if(l=l||"linear",Oh(F.state.gradientDepth,l)===!1){v(o==="NHWC",()=>`Error in fused conv2d: got dataFormat of ${o} but only NHWC is currently supported for the case of gradient depth is 0 and the activation is not linear.`);let I=ro(n,e,t,s,o,r,i);return a!=null&&(I=J(I,a)),_h(I,l,c,u)}const h=T(n,"x","conv2d","float32"),d=T(e,"filter","conv2d","float32");let p=h,f=!1;h.rank===3&&(f=!0,p=O(h,[1,h.shape[0],h.shape[1],h.shape[2]])),v(p.rank===4,()=>`Error in fused conv2d: input must be rank 4, but got rank ${p.rank}.`),v(d.rank===4,()=>`Error in fused conv2d: filter must be rank 4, but got rank ${d.rank}.`),Ut("fused conv2d",s,i);const m=o==="NHWC"?p.shape[3]:p.shape[1];v(d.shape[2]===m,()=>`Error in conv2d: depth of input (${m}) must match input depth for filter ${d.shape[2]}.`),v(Et(t,r),()=>`Error in conv2D: Either strides or dilations must be 1. Got strides ${t} and dilations '${r}'`);const g=Ct(p.shape,d.shape,t,r,s,i);let x;a!=null&&(x=T(a,"bias","fused conv2d"),[x]=tt(x,h),o==="NHWC"?Ce(g.outShape,x.shape):(v(x.shape.length<=1,()=>`Error in fused conv2d: only supports scalar or 1-D Tensor bias for NCHW format but got the bias of rank-${x.shape.length}.`),v(x.shape.length===0||x.shape[0]===g.outChannels||x.shape[0]===1,()=>`Error in fused conv2d: bias shape (${x.shape}) is not compatible with the number of output channels (${g.outChannels})`)));let b;if(c!=null){const I=c.shape;if(v(I.length<=1||I.length===3,()=>`Error in fused conv2d: only supports scalar, 1-D Tensor or 3-D Tensor PReLU activation weights but got a tensor of rank-${I.length}.`),I.length===1)v(I[0]===1||I[0]===g.outChannels,()=>`Error in fused conv2d: PReLU activation weights (${I}) is not compatible with the number of output channels (${g.outChannels}).`);else if(I.length===3)try{Ce(I,g.outShape)}catch{const k=`Error in fused conv2d: PReLU activation weights (${I}) is not compatible with the output shape of the conv2d (${g.outShape}).`;throw Error(k)}b=T(c,"prelu weights","fused conv2d")}const w=(I,$)=>{v(o==="NHWC",()=>`Error in gradient of fused conv2D: got dataFormat of ${o} but only NHWC is currently supported.`);const[k,S,N,A]=$,_=Dh(I,N,l);v(so(r),()=>`Error in gradient of fused conv2D: dilation rates greater than 1 are not yet supported in gradients. Got dilations '${r}'`);const E=sh(S.shape,_,k,t,s),M=Ah(S,_,k.shape,t,s),z=[E,M];if(A!=null){const P=Fh(A,_);z.push(P)}return z},y={x:p,filter:d,bias:x,preluActivationWeights:b},C={strides:t,pad:s,dataFormat:o,dilations:r,dimRoundingMode:i,activation:l,leakyreluAlpha:u};return a==null?Ko(($,k,S)=>{let N=F.runKernel(ul,y,C);return S([k,$,N]),f&&(N=O(N,[N.shape[1],N.shape[2],N.shape[3]])),{value:N,gradFunc:w}})(p,d):Ko(($,k,S,N)=>{let A=F.runKernel(ul,y,C);return N([k,$,A,S]),f&&(A=O(A,[A.shape[1],A.shape[2],A.shape[3]])),{value:A,gradFunc:w}})(p,d,x)}const uS=L({fusedConv2d_:cS});/** + */function lS({x:n,filter:e,strides:t,pad:s,dataFormat:o="NHWC",dilations:r=[1,1],dimRoundingMode:i,bias:a,activation:l="linear",preluActivationWeights:c,leakyreluAlpha:u}){if(l=l||"linear",Fh(F.state.gradientDepth,l)===!1){k(o==="NHWC",()=>`Error in fused conv2d: got dataFormat of ${o} but only NHWC is currently supported for the case of gradient depth is 0 and the activation is not linear.`);let I=ro(n,e,t,s,o,r,i);return a!=null&&(I=J(I,a)),Dh(I,l,c,u)}const h=T(n,"x","conv2d","float32"),d=T(e,"filter","conv2d","float32");let p=h,f=!1;h.rank===3&&(f=!0,p=O(h,[1,h.shape[0],h.shape[1],h.shape[2]])),k(p.rank===4,()=>`Error in fused conv2d: input must be rank 4, but got rank ${p.rank}.`),k(d.rank===4,()=>`Error in fused conv2d: filter must be rank 4, but got rank ${d.rank}.`),Ut("fused conv2d",s,i);const m=o==="NHWC"?p.shape[3]:p.shape[1];k(d.shape[2]===m,()=>`Error in conv2d: depth of input (${m}) must match input depth for filter ${d.shape[2]}.`),k(Et(t,r),()=>`Error in conv2D: Either strides or dilations must be 1. Got strides ${t} and dilations '${r}'`);const g=Ct(p.shape,d.shape,t,r,s,i);let x;a!=null&&(x=T(a,"bias","fused conv2d"),[x]=tt(x,h),o==="NHWC"?Ce(g.outShape,x.shape):(k(x.shape.length<=1,()=>`Error in fused conv2d: only supports scalar or 1-D Tensor bias for NCHW format but got the bias of rank-${x.shape.length}.`),k(x.shape.length===0||x.shape[0]===g.outChannels||x.shape[0]===1,()=>`Error in fused conv2d: bias shape (${x.shape}) is not compatible with the number of output channels (${g.outChannels})`)));let b;if(c!=null){const I=c.shape;if(k(I.length<=1||I.length===3,()=>`Error in fused conv2d: only supports scalar, 1-D Tensor or 3-D Tensor PReLU activation weights but got a tensor of rank-${I.length}.`),I.length===1)k(I[0]===1||I[0]===g.outChannels,()=>`Error in fused conv2d: PReLU activation weights (${I}) is not compatible with the number of output channels (${g.outChannels}).`);else if(I.length===3)try{Ce(I,g.outShape)}catch{const $=`Error in fused conv2d: PReLU activation weights (${I}) is not compatible with the output shape of the conv2d (${g.outShape}).`;throw Error($)}b=T(c,"prelu weights","fused conv2d")}const w=(I,v)=>{k(o==="NHWC",()=>`Error in gradient of fused conv2D: got dataFormat of ${o} but only NHWC is currently supported.`);const[$,S,N,A]=v,_=Rh(I,N,l);k(so(r),()=>`Error in gradient of fused conv2D: dilation rates greater than 1 are not yet supported in gradients. Got dilations '${r}'`);const E=th(S.shape,_,$,t,s),M=Eh(S,_,$.shape,t,s),z=[E,M];if(A!=null){const P=Ah(A,_);z.push(P)}return z},y={x:p,filter:d,bias:x,preluActivationWeights:b},C={strides:t,pad:s,dataFormat:o,dilations:r,dimRoundingMode:i,activation:l,leakyreluAlpha:u};return a==null?Ko((v,$,S)=>{let N=F.runKernel(ul,y,C);return S([$,v,N]),f&&(N=O(N,[N.shape[1],N.shape[2],N.shape[3]])),{value:N,gradFunc:w}})(p,d):Ko((v,$,S,N)=>{let A=F.runKernel(ul,y,C);return N([$,v,A,S]),f&&(A=O(A,[A.shape[1],A.shape[2],A.shape[3]])),{value:A,gradFunc:w}})(p,d,x)}const cS=L({fusedConv2d_:lS});/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -2948,7 +2948,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function hS(n,e,t,s,o,r=[1,1],i){let a=n;n.rank===3&&(a=O(n,[1,n.shape[0],n.shape[1],n.shape[2]]));let l=e;l.rank===3&&(l=O(e,[1,e.shape[0],e.shape[1],e.shape[2]]));const c={x:a,dy:l},u={strides:s,pad:o,dimRoundingMode:i,dilations:r,filterShape:t};return F.runKernel(au,c,u)}const dS=L({depthwiseConv2dNativeBackpropFilter_:hS});/** + */function uS(n,e,t,s,o,r=[1,1],i){let a=n;n.rank===3&&(a=O(n,[1,n.shape[0],n.shape[1],n.shape[2]]));let l=e;l.rank===3&&(l=O(e,[1,e.shape[0],e.shape[1],e.shape[2]]));const c={x:a,dy:l},u={strides:s,pad:o,dimRoundingMode:i,dilations:r,filterShape:t};return F.runKernel(ru,c,u)}const hS=L({depthwiseConv2dNativeBackpropFilter_:uS});/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -2963,7 +2963,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function pS(n,e,t,s,o,r=[1,1],i){let a=e,l=!1;e.rank===3&&(l=!0,a=O(e,[1,e.shape[0],e.shape[1],e.shape[2]]));const c={dy:a,filter:t},u={strides:s,pad:o,dimRoundingMode:i,dilations:r,inputShape:n},h=F.runKernel(lu,c,u);return l?O(h,[h.shape[1],h.shape[2],h.shape[3]]):h}const fS=L({depthwiseConv2dNativeBackpropInput_:pS});/** + */function dS(n,e,t,s,o,r=[1,1],i){let a=e,l=!1;e.rank===3&&(l=!0,a=O(e,[1,e.shape[0],e.shape[1],e.shape[2]]));const c={dy:a,filter:t},u={strides:s,pad:o,dimRoundingMode:i,dilations:r,inputShape:n},h=F.runKernel(iu,c,u);return l?O(h,[h.shape[1],h.shape[2],h.shape[3]]):h}const pS=L({depthwiseConv2dNativeBackpropInput_:dS});/** * @license * Copyright 2019 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -2978,7 +2978,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function mS({a:n,b:e,transposeA:t=!1,transposeB:s=!1,bias:o,activation:r="linear",preluActivationWeights:i,leakyreluAlpha:a=.2}){if(Oh(F.state.gradientDepth,r)===!1){let A=Ae(n,e,t,s);return o!=null&&(A=J(A,o)),_h(A,r,i,a)}let l=T(n,"a","fused matMul"),c=T(e,"b","fused matMul");[l,c]=tt(l,c);const u=t?l.shape[l.rank-2]:l.shape[l.rank-1],h=s?c.shape[c.rank-1]:c.shape[c.rank-2],d=t?l.shape[l.rank-1]:l.shape[l.rank-2],p=s?c.shape[c.rank-2]:c.shape[c.rank-1],f=l.shape.slice(0,-2),m=c.shape.slice(0,-2),g=G(f),x=G(m);v(u===h,()=>`Error in fused matMul: inner shapes (${u}) and (${h}) of Tensors with shapes ${l.shape} and ${c.shape} and transposeA=${t} and transposeB=${s} must match.`);const w=Ce(l.shape.slice(0,-2),c.shape.slice(0,-2)).concat([d,p]),y=t?O(l,[g,u,d]):O(l,[g,d,u]),C=s?O(c,[x,p,h]):O(c,[x,h,p]);let I;o!=null&&(I=T(o,"bias","fused matMul"),[I]=tt(I,l),Ce(w,I.shape));let $;i!=null&&($=T(i,"prelu weights","fused matMul"));const k=(A,_)=>{const[E,M,z,P]=_,H=Dh(O(A,z.shape),z,r);let W,q;if(!t&&!s?(W=Ae(H,M,!1,!0),q=Ae(E,H,!0,!1)):!t&&s?(W=Ae(H,M,!1,!1),q=Ae(H,E,!0,!1)):t&&!s?(W=Ae(M,H,!1,!0),q=Ae(E,H,!1,!1)):(W=Ae(M,H,!0,!0),q=Ae(H,E,!0,!0)),o!=null){const K=Fh(P,H);return[W,q,K]}else return[W,q]},S={a:y,b:C,bias:I,preluActivationWeights:$},N={transposeA:t,transposeB:s,activation:r,leakyreluAlpha:a};return o==null?Ko((_,E,M)=>{const z=F.runKernel(cl,S,N);return M([_,E,z]),{value:O(z,w),gradFunc:k}})(y,C):Ko((_,E,M,z)=>{const P=F.runKernel(cl,S,N);return z([_,E,P,M]),{value:O(P,w),gradFunc:k}})(y,C,I)}const Mm=L({fusedMatMul_:mS});/** + */function fS({a:n,b:e,transposeA:t=!1,transposeB:s=!1,bias:o,activation:r="linear",preluActivationWeights:i,leakyreluAlpha:a=.2}){if(Fh(F.state.gradientDepth,r)===!1){let A=Ae(n,e,t,s);return o!=null&&(A=J(A,o)),Dh(A,r,i,a)}let l=T(n,"a","fused matMul"),c=T(e,"b","fused matMul");[l,c]=tt(l,c);const u=t?l.shape[l.rank-2]:l.shape[l.rank-1],h=s?c.shape[c.rank-1]:c.shape[c.rank-2],d=t?l.shape[l.rank-1]:l.shape[l.rank-2],p=s?c.shape[c.rank-2]:c.shape[c.rank-1],f=l.shape.slice(0,-2),m=c.shape.slice(0,-2),g=G(f),x=G(m);k(u===h,()=>`Error in fused matMul: inner shapes (${u}) and (${h}) of Tensors with shapes ${l.shape} and ${c.shape} and transposeA=${t} and transposeB=${s} must match.`);const w=Ce(l.shape.slice(0,-2),c.shape.slice(0,-2)).concat([d,p]),y=t?O(l,[g,u,d]):O(l,[g,d,u]),C=s?O(c,[x,p,h]):O(c,[x,h,p]);let I;o!=null&&(I=T(o,"bias","fused matMul"),[I]=tt(I,l),Ce(w,I.shape));let v;i!=null&&(v=T(i,"prelu weights","fused matMul"));const $=(A,_)=>{const[E,M,z,P]=_,H=Rh(O(A,z.shape),z,r);let W,q;if(!t&&!s?(W=Ae(H,M,!1,!0),q=Ae(E,H,!0,!1)):!t&&s?(W=Ae(H,M,!1,!1),q=Ae(H,E,!0,!1)):t&&!s?(W=Ae(M,H,!1,!0),q=Ae(E,H,!1,!1)):(W=Ae(M,H,!0,!0),q=Ae(H,E,!0,!0)),o!=null){const K=Ah(P,H);return[W,q,K]}else return[W,q]},S={a:y,b:C,bias:I,preluActivationWeights:v},N={transposeA:t,transposeB:s,activation:r,leakyreluAlpha:a};return o==null?Ko((_,E,M)=>{const z=F.runKernel(cl,S,N);return M([_,E,z]),{value:O(z,w),gradFunc:$}})(y,C):Ko((_,E,M,z)=>{const P=F.runKernel(cl,S,N);return z([_,E,P,M]),{value:O(P,w),gradFunc:$}})(y,C,I)}const Mm=L({fusedMatMul_:fS});/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -2993,7 +2993,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function gS(n,e,t,s,o="bilinear",r=0){const i=T(n,"image","cropAndResize"),a=T(e,"boxes","cropAndResize","float32"),l=T(t,"boxInd","cropAndResize","int32"),c=a.shape[0];v(i.rank===4,()=>`Error in cropAndResize: image must be rank 4,but got rank ${i.rank}.`),v(a.rank===2&&a.shape[1]===4,()=>`Error in cropAndResize: boxes must be have size [${c},4] but had shape ${a.shape}.`),v(l.rank===1&&l.shape[0]===c,()=>`Error in cropAndResize: boxInd must be have size [${c}] but had shape ${a.shape}.`),v(s.length===2,()=>`Error in cropAndResize: cropSize must be of length 2, but got length ${s.length}.`),v(s[0]>=1&&s[1]>=1,()=>`cropSize must be atleast [1,1], but was ${s}`),v(o==="bilinear"||o==="nearest",()=>`method must be bilinear or nearest, but was ${o}`);const u={image:i,boxes:a,boxInd:l},h={method:o,extrapolationValue:r,cropSize:s};return F.runKernel(ou,u,h)}const xS=L({cropAndResize_:gS});/** + */function mS(n,e,t,s,o="bilinear",r=0){const i=T(n,"image","cropAndResize"),a=T(e,"boxes","cropAndResize","float32"),l=T(t,"boxInd","cropAndResize","int32"),c=a.shape[0];k(i.rank===4,()=>`Error in cropAndResize: image must be rank 4,but got rank ${i.rank}.`),k(a.rank===2&&a.shape[1]===4,()=>`Error in cropAndResize: boxes must be have size [${c},4] but had shape ${a.shape}.`),k(l.rank===1&&l.shape[0]===c,()=>`Error in cropAndResize: boxInd must be have size [${c}] but had shape ${a.shape}.`),k(s.length===2,()=>`Error in cropAndResize: cropSize must be of length 2, but got length ${s.length}.`),k(s[0]>=1&&s[1]>=1,()=>`cropSize must be atleast [1,1], but was ${s}`),k(o==="bilinear"||o==="nearest",()=>`method must be bilinear or nearest, but was ${o}`);const u={image:i,boxes:a,boxInd:l},h={method:o,extrapolationValue:r,cropSize:s};return F.runKernel(nu,u,h)}const gS=L({cropAndResize_:mS});/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -3008,7 +3008,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function bS(n){const e=T(n,"image","flipLeftRight","float32");v(e.rank===4,()=>`Error in flipLeftRight: image must be rank 4,but got rank ${e.rank}.`);const t={image:e};return F.runKernel(mu,t,{})}const yS=L({flipLeftRight_:bS});/** + */function xS(n){const e=T(n,"image","flipLeftRight","float32");k(e.rank===4,()=>`Error in flipLeftRight: image must be rank 4,but got rank ${e.rank}.`);const t={image:e};return F.runKernel(pu,t,{})}const bS=L({flipLeftRight_:xS});/** * @license * Copyright 2021 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -3023,7 +3023,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function wS(n){const e=T(n,"image","grayscaleToRGB"),t=e.rank-1,s=e.shape[t];v(e.rank>=2,()=>`Error in grayscaleToRGB: images must be at least rank 2, but got rank ${e.rank}.`),v(s===1,()=>`Error in grayscaleToRGB: last dimension of a grayscale image should be size 1, but got size ${s}.`);const o=new Array(e.rank);return o.fill(1,0,t),o[t]=3,Tn(e,o)}const CS=L({grayscaleToRGB_:wS});/** + */function yS(n){const e=T(n,"image","grayscaleToRGB"),t=e.rank-1,s=e.shape[t];k(e.rank>=2,()=>`Error in grayscaleToRGB: images must be at least rank 2, but got rank ${e.rank}.`),k(s===1,()=>`Error in grayscaleToRGB: last dimension of a grayscale image should be size 1, but got size ${s}.`);const o=new Array(e.rank);return o.fill(1,0,t),o[t]=3,Tn(e,o)}const wS=L({grayscaleToRGB_:yS});/** * @license * Copyright 2023 Google LLC. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -3038,7 +3038,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function IS(n){const e=T(n,"image","RGBToGrayscale"),t=e.rank-1,s=e.shape[t];v(e.rank>=2,()=>`Error in RGBToGrayscale: images must be at least rank 2, but got rank ${e.rank}.`),v(s===3,()=>`Error in RGBToGrayscale: last dimension of an RGB image should be size 3, but got size ${s}.`);const o=e.dtype,r=re(e,"float32"),i=At([.2989,.587,.114]);let a;switch(e.rank){case 2:a=$i("ij,j->i",r,i);break;case 3:a=$i("ijk,k->ij",r,i);break;case 4:a=$i("ijkl,l->ijk",r,i);break;case 5:a=$i("ijklm,m->ijkl",r,i);break;case 6:a=$i("ijklmn,n->ijklm",r,i);break;default:throw new Error("Not a valid tensor rank.")}return a=Gt(a,-1),re(a,o)}const $S=L({rgbToGrayscale_:IS});/** + */function CS(n){const e=T(n,"image","RGBToGrayscale"),t=e.rank-1,s=e.shape[t];k(e.rank>=2,()=>`Error in RGBToGrayscale: images must be at least rank 2, but got rank ${e.rank}.`),k(s===3,()=>`Error in RGBToGrayscale: last dimension of an RGB image should be size 3, but got size ${s}.`);const o=e.dtype,r=re(e,"float32"),i=Lt([.2989,.587,.114]);let a;switch(e.rank){case 2:a=$i("ij,j->i",r,i);break;case 3:a=$i("ijk,k->ij",r,i);break;case 4:a=$i("ijkl,l->ijk",r,i);break;case 5:a=$i("ijklm,m->ijkl",r,i);break;case 6:a=$i("ijklmn,n->ijklm",r,i);break;default:throw new Error("Not a valid tensor rank.")}return a=Gt(a,-1),re(a,o)}const IS=L({rgbToGrayscale_:CS});/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -3053,7 +3053,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function kS(n,e,t=0,s=.5){const o=T(n,"image","rotateWithOffset","float32");v(o.rank===4,()=>`Error in rotateWithOffset: image must be rank 4,but got rank ${o.rank}.`);const r={image:o},i={radians:e,fillValue:t,center:s};return F.runKernel(_u,r,i)}const vS=L({rotateWithOffset_:kS});/** + */function $S(n,e,t=0,s=.5){const o=T(n,"image","rotateWithOffset","float32");k(o.rank===4,()=>`Error in rotateWithOffset: image must be rank 4,but got rank ${o.rank}.`);const r={image:o},i={radians:e,fillValue:t,center:s};return F.runKernel(Du,r,i)}const kS=L({rotateWithOffset_:$S});/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -3068,7 +3068,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function Yo(n,e,t,s,o,r){s==null&&(s=.5),o==null&&(o=Number.NEGATIVE_INFINITY),r==null&&(r=0);const i=n.shape[0];return t=Math.min(t,i),v(0<=s&&s<=1,()=>`iouThreshold must be in [0, 1], but was '${s}'`),v(n.rank===2,()=>`boxes must be a 2D tensor, but was of rank '${n.rank}'`),v(n.shape[1]===4,()=>`boxes must have 4 columns, but 2nd dimension was ${n.shape[1]}`),v(e.rank===1,()=>"scores must be a 1D tensor"),v(e.shape[0]===i,()=>`scores has incompatible shape with boxes. Expected ${i}, but was ${e.shape[0]}`),v(0<=r&&r<=1,()=>`softNmsSigma must be in [0, 1], but was '${r}'`),{maxOutputSize:t,iouThreshold:s,scoreThreshold:o,softNmsSigma:r}}/** + */function Yo(n,e,t,s,o,r){s==null&&(s=.5),o==null&&(o=Number.NEGATIVE_INFINITY),r==null&&(r=0);const i=n.shape[0];return t=Math.min(t,i),k(0<=s&&s<=1,()=>`iouThreshold must be in [0, 1], but was '${s}'`),k(n.rank===2,()=>`boxes must be a 2D tensor, but was of rank '${n.rank}'`),k(n.shape[1]===4,()=>`boxes must have 4 columns, but 2nd dimension was ${n.shape[1]}`),k(e.rank===1,()=>"scores must be a 1D tensor"),k(e.shape[0]===i,()=>`scores has incompatible shape with boxes. Expected ${i}, but was ${e.shape[0]}`),k(0<=r&&r<=1,()=>`softNmsSigma must be in [0, 1], but was '${r}'`),{maxOutputSize:t,iouThreshold:s,scoreThreshold:o,softNmsSigma:r}}/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -3083,7 +3083,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function SS(n,e,t,s=.5,o=Number.NEGATIVE_INFINITY){const r=T(n,"boxes","nonMaxSuppression","float32"),i=T(e,"scores","nonMaxSuppression","float32"),a=Yo(r,i,t,s,o);t=a.maxOutputSize,s=a.iouThreshold,o=a.scoreThreshold;const l={maxOutputSize:t,iouThreshold:s,scoreThreshold:o};return F.runKernel(Cu,{boxes:r,scores:i},l)}const TS=L({nonMaxSuppression_:SS});/** + */function vS(n,e,t,s=.5,o=Number.NEGATIVE_INFINITY){const r=T(n,"boxes","nonMaxSuppression","float32"),i=T(e,"scores","nonMaxSuppression","float32"),a=Yo(r,i,t,s,o);t=a.maxOutputSize,s=a.iouThreshold,o=a.scoreThreshold;const l={maxOutputSize:t,iouThreshold:s,scoreThreshold:o};return F.runKernel(yu,{boxes:r,scores:i},l)}const SS=L({nonMaxSuppression_:vS});/** * @license * Copyright 2019 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -3098,7 +3098,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function NS(n,e,t){const s=ES(n,e,t),o=s<0?-(s+1):s;n.splice(o,0,e)}function ES(n,e,t){return AS(n,e,t||RS)}function RS(n,e){return n>e?1:n>>1);const a=t(e,n[r]);a>0?s=r+1:(o=r,i=!a)}return i?s:-s-1}/** + */function TS(n,e,t){const s=NS(n,e,t),o=s<0?-(s+1):s;n.splice(o,0,e)}function NS(n,e,t){return RS(n,e,t||ES)}function ES(n,e){return n>e?1:n>>1);const a=t(e,n[r]);a>0?s=r+1:(o=r,i=!a)}return i?s:-s-1}/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -3113,7 +3113,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function Lh(n,e,t,s,o){return Bh(n,e,t,s,o,0)}function Mh(n,e,t,s,o,r){return Bh(n,e,t,s,o,0,!1,r,!0)}function Ph(n,e,t,s,o,r){return Bh(n,e,t,s,o,r,!0)}function Bh(n,e,t,s,o,r,i=!1,a=!1,l=!1){const c=[];for(let g=0;go&&c.push({score:e[g],boxIndex:g,suppressBeginIndex:0});c.sort(Pm);const u=r>0?-.5/r:0,h=[],d=[];for(;h.length0;){const g=c.pop(),{score:x,boxIndex:b,suppressBeginIndex:w}=g;if(x=w;--C){const I=DS(n,b,h[C]);if(I>=s){y=!0;break}if(g.score=g.score*FS(s,u,I),g.score<=o)break}g.suppressBeginIndex=h.length,y||(g.score===x?(h.push(b),d.push(g.score)):g.score>o&&NS(c,g,Pm))}const p=h.length,f=t-p;a&&f>0&&(h.push(...new Array(f).fill(0)),d.push(...new Array(f).fill(0)));const m={selectedIndices:h};return i&&(m.selectedScores=d),l&&(m.validOutputs=p),m}function DS(n,e,t){const s=n.subarray(e*4,e*4+4),o=n.subarray(t*4,t*4+4),r=Math.min(s[0],s[2]),i=Math.min(s[1],s[3]),a=Math.max(s[0],s[2]),l=Math.max(s[1],s[3]),c=Math.min(o[0],o[2]),u=Math.min(o[1],o[3]),h=Math.max(o[0],o[2]),d=Math.max(o[1],o[3]),p=(a-r)*(l-i),f=(h-c)*(d-u);if(p<=0||f<=0)return 0;const m=Math.max(r,c),g=Math.max(i,u),x=Math.min(a,h),b=Math.min(l,d),w=Math.max(x-m,0)*Math.max(b-g,0);return w/(p+f-w)}function FS(n,e,t){const s=Math.exp(e*t*t);return t<=n?s:0}function Pm(n,e){return n.score-e.score||n.score===e.score&&e.boxIndex-n.boxIndex}/** + */function _h(n,e,t,s,o){return Mh(n,e,t,s,o,0)}function Oh(n,e,t,s,o,r){return Mh(n,e,t,s,o,0,!1,r,!0)}function Lh(n,e,t,s,o,r){return Mh(n,e,t,s,o,r,!0)}function Mh(n,e,t,s,o,r,i=!1,a=!1,l=!1){const c=[];for(let g=0;go&&c.push({score:e[g],boxIndex:g,suppressBeginIndex:0});c.sort(Pm);const u=r>0?-.5/r:0,h=[],d=[];for(;h.length0;){const g=c.pop(),{score:x,boxIndex:b,suppressBeginIndex:w}=g;if(x=w;--C){const I=AS(n,b,h[C]);if(I>=s){y=!0;break}if(g.score=g.score*DS(s,u,I),g.score<=o)break}g.suppressBeginIndex=h.length,y||(g.score===x?(h.push(b),d.push(g.score)):g.score>o&&TS(c,g,Pm))}const p=h.length,f=t-p;a&&f>0&&(h.push(...new Array(f).fill(0)),d.push(...new Array(f).fill(0)));const m={selectedIndices:h};return i&&(m.selectedScores=d),l&&(m.validOutputs=p),m}function AS(n,e,t){const s=n.subarray(e*4,e*4+4),o=n.subarray(t*4,t*4+4),r=Math.min(s[0],s[2]),i=Math.min(s[1],s[3]),a=Math.max(s[0],s[2]),l=Math.max(s[1],s[3]),c=Math.min(o[0],o[2]),u=Math.min(o[1],o[3]),h=Math.max(o[0],o[2]),d=Math.max(o[1],o[3]),p=(a-r)*(l-i),f=(h-c)*(d-u);if(p<=0||f<=0)return 0;const m=Math.max(r,c),g=Math.max(i,u),x=Math.min(a,h),b=Math.min(l,d),w=Math.max(x-m,0)*Math.max(b-g,0);return w/(p+f-w)}function DS(n,e,t){const s=Math.exp(e*t*t);return t<=n?s:0}function Pm(n,e){return n.score-e.score||n.score===e.score&&e.boxIndex-n.boxIndex}/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -3128,7 +3128,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */async function _S(n,e,t,s=.5,o=Number.NEGATIVE_INFINITY){const r=T(n,"boxes","nonMaxSuppressionAsync"),i=T(e,"scores","nonMaxSuppressionAsync"),a=Yo(r,i,t,s,o);t=a.maxOutputSize,s=a.iouThreshold,o=a.scoreThreshold;const l=await Promise.all([r.data(),i.data()]),c=l[0],u=l[1],{selectedIndices:h}=Lh(c,u,t,s,o);return r!==n&&r.dispose(),i!==e&&i.dispose(),At(h,"int32")}const OS=_S;/** + */async function FS(n,e,t,s=.5,o=Number.NEGATIVE_INFINITY){const r=T(n,"boxes","nonMaxSuppressionAsync"),i=T(e,"scores","nonMaxSuppressionAsync"),a=Yo(r,i,t,s,o);t=a.maxOutputSize,s=a.iouThreshold,o=a.scoreThreshold;const l=await Promise.all([r.data(),i.data()]),c=l[0],u=l[1],{selectedIndices:h}=_h(c,u,t,s,o);return r!==n&&r.dispose(),i!==e&&i.dispose(),Lt(h,"int32")}const _S=FS;/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -3143,7 +3143,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function LS(n,e,t,s=.5,o=Number.NEGATIVE_INFINITY,r=0){const i=T(n,"boxes","nonMaxSuppression"),a=T(e,"scores","nonMaxSuppression"),l=Yo(i,a,t,s,o,r);t=l.maxOutputSize,s=l.iouThreshold,o=l.scoreThreshold,r=l.softNmsSigma;const c={boxes:i,scores:a},u={maxOutputSize:t,iouThreshold:s,scoreThreshold:o,softNmsSigma:r},h=F.runKernel($u,c,u);return{selectedIndices:h[0],selectedScores:h[1]}}const MS=L({nonMaxSuppressionWithScore_:LS});/** + */function OS(n,e,t,s=.5,o=Number.NEGATIVE_INFINITY,r=0){const i=T(n,"boxes","nonMaxSuppression"),a=T(e,"scores","nonMaxSuppression"),l=Yo(i,a,t,s,o,r);t=l.maxOutputSize,s=l.iouThreshold,o=l.scoreThreshold,r=l.softNmsSigma;const c={boxes:i,scores:a},u={maxOutputSize:t,iouThreshold:s,scoreThreshold:o,softNmsSigma:r},h=F.runKernel(Cu,c,u);return{selectedIndices:h[0],selectedScores:h[1]}}const LS=L({nonMaxSuppressionWithScore_:OS});/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -3158,7 +3158,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */async function PS(n,e,t,s=.5,o=Number.NEGATIVE_INFINITY,r=0){const i=T(n,"boxes","nonMaxSuppressionAsync"),a=T(e,"scores","nonMaxSuppressionAsync"),l=Yo(i,a,t,s,o,r);t=l.maxOutputSize,s=l.iouThreshold,o=l.scoreThreshold,r=l.softNmsSigma;const c=await Promise.all([i.data(),a.data()]),u=c[0],h=c[1],{selectedIndices:d,selectedScores:p}=Ph(u,h,t,s,o,r);return i!==n&&i.dispose(),a!==e&&a.dispose(),{selectedIndices:At(d,"int32"),selectedScores:At(p)}}const BS=PS;/** + */async function MS(n,e,t,s=.5,o=Number.NEGATIVE_INFINITY,r=0){const i=T(n,"boxes","nonMaxSuppressionAsync"),a=T(e,"scores","nonMaxSuppressionAsync"),l=Yo(i,a,t,s,o,r);t=l.maxOutputSize,s=l.iouThreshold,o=l.scoreThreshold,r=l.softNmsSigma;const c=await Promise.all([i.data(),a.data()]),u=c[0],h=c[1],{selectedIndices:d,selectedScores:p}=Lh(u,h,t,s,o,r);return i!==n&&i.dispose(),a!==e&&a.dispose(),{selectedIndices:Lt(d,"int32"),selectedScores:Lt(p)}}const PS=MS;/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -3173,7 +3173,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function zS(n,e,t,s=.5,o=Number.NEGATIVE_INFINITY,r=!1){const i=T(n,"boxes","nonMaxSuppression"),a=T(e,"scores","nonMaxSuppression"),l=Yo(i,a,t,s,o,null),c=l.maxOutputSize,u=l.iouThreshold,h=l.scoreThreshold,d={boxes:i,scores:a},p={maxOutputSize:c,iouThreshold:u,scoreThreshold:h,padToMaxOutputSize:r},f=F.runKernel(Iu,d,p);return{selectedIndices:f[0],validOutputs:f[1]}}const VS=L({nonMaxSuppressionPadded_:zS});/** + */function BS(n,e,t,s=.5,o=Number.NEGATIVE_INFINITY,r=!1){const i=T(n,"boxes","nonMaxSuppression"),a=T(e,"scores","nonMaxSuppression"),l=Yo(i,a,t,s,o,null),c=l.maxOutputSize,u=l.iouThreshold,h=l.scoreThreshold,d={boxes:i,scores:a},p={maxOutputSize:c,iouThreshold:u,scoreThreshold:h,padToMaxOutputSize:r},f=F.runKernel(wu,d,p);return{selectedIndices:f[0],validOutputs:f[1]}}const zS=L({nonMaxSuppressionPadded_:BS});/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -3188,7 +3188,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */async function WS(n,e,t,s=.5,o=Number.NEGATIVE_INFINITY,r=!1){const i=T(n,"boxes","nonMaxSuppressionAsync"),a=T(e,"scores","nonMaxSuppressionAsync"),l=Yo(i,a,t,s,o,null),c=l.maxOutputSize,u=l.iouThreshold,h=l.scoreThreshold,[d,p]=await Promise.all([i.data(),a.data()]),{selectedIndices:f,validOutputs:m}=Mh(d,p,c,u,h,r);return i!==n&&i.dispose(),a!==e&&a.dispose(),{selectedIndices:At(f,"int32"),validOutputs:De(m,"int32")}}const US=WS;/** + */async function VS(n,e,t,s=.5,o=Number.NEGATIVE_INFINITY,r=!1){const i=T(n,"boxes","nonMaxSuppressionAsync"),a=T(e,"scores","nonMaxSuppressionAsync"),l=Yo(i,a,t,s,o,null),c=l.maxOutputSize,u=l.iouThreshold,h=l.scoreThreshold,[d,p]=await Promise.all([i.data(),a.data()]),{selectedIndices:f,validOutputs:m}=Oh(d,p,c,u,h,r);return i!==n&&i.dispose(),a!==e&&a.dispose(),{selectedIndices:Lt(f,"int32"),validOutputs:De(m,"int32")}}const WS=VS;/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -3203,7 +3203,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function GS(n,e,t=!1,s=!1){const o=T(n,"images","resizeBilinear");v(o.rank===3||o.rank===4,()=>`Error in resizeBilinear: x must be rank 3 or 4, but got rank ${o.rank}.`),v(e.length===2,()=>`Error in resizeBilinear: new shape must 2D, but got shape ${e}.`),v(s===!1||t===!1,()=>"Error in resizeBilinear: If halfPixelCenters is true, alignCorners must be false.");let r=o,i=!1;o.rank===3&&(i=!0,r=O(o,[1,o.shape[0],o.shape[1],o.shape[2]]));const a={images:r},l={alignCorners:t,halfPixelCenters:s,size:e},c=F.runKernel(Qa,a,l);return i?O(c,[c.shape[1],c.shape[2],c.shape[3]]):c}const Bm=L({resizeBilinear_:GS});/** + */function US(n,e,t=!1,s=!1){const o=T(n,"images","resizeBilinear");k(o.rank===3||o.rank===4,()=>`Error in resizeBilinear: x must be rank 3 or 4, but got rank ${o.rank}.`),k(e.length===2,()=>`Error in resizeBilinear: new shape must 2D, but got shape ${e}.`),k(s===!1||t===!1,()=>"Error in resizeBilinear: If halfPixelCenters is true, alignCorners must be false.");let r=o,i=!1;o.rank===3&&(i=!0,r=O(o,[1,o.shape[0],o.shape[1],o.shape[2]]));const a={images:r},l={alignCorners:t,halfPixelCenters:s,size:e},c=F.runKernel(Qa,a,l);return i?O(c,[c.shape[1],c.shape[2],c.shape[3]]):c}const Bm=L({resizeBilinear_:US});/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -3218,7 +3218,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function HS(n,e,t=!1,s=!1){const o=T(n,"images","resizeNearestNeighbor");v(o.rank===3||o.rank===4,()=>`Error in resizeNearestNeighbor: x must be rank 3 or 4, but got rank ${o.rank}.`),v(e.length===2,()=>`Error in resizeNearestNeighbor: new shape must 2D, but got shape ${e}.`),v(o.dtype==="float32"||o.dtype==="int32",()=>"`images` must have `int32` or `float32` as dtype"),v(s===!1||t===!1,()=>"Error in resizeNearestNeighbor: If halfPixelCenters is true, alignCorners must be false.");let r=o,i=!1;o.rank===3&&(i=!0,r=O(o,[1,o.shape[0],o.shape[1],o.shape[2]]));const a={images:r},l={alignCorners:t,halfPixelCenters:s,size:e},c=F.runKernel(Za,a,l);return i?O(c,[c.shape[1],c.shape[2],c.shape[3]]):c}const zm=L({resizeNearestNeighbor_:HS});/** + */function GS(n,e,t=!1,s=!1){const o=T(n,"images","resizeNearestNeighbor");k(o.rank===3||o.rank===4,()=>`Error in resizeNearestNeighbor: x must be rank 3 or 4, but got rank ${o.rank}.`),k(e.length===2,()=>`Error in resizeNearestNeighbor: new shape must 2D, but got shape ${e}.`),k(o.dtype==="float32"||o.dtype==="int32",()=>"`images` must have `int32` or `float32` as dtype"),k(s===!1||t===!1,()=>"Error in resizeNearestNeighbor: If halfPixelCenters is true, alignCorners must be false.");let r=o,i=!1;o.rank===3&&(i=!0,r=O(o,[1,o.shape[0],o.shape[1],o.shape[2]]));const a={images:r},l={alignCorners:t,halfPixelCenters:s,size:e},c=F.runKernel(Za,a,l);return i?O(c,[c.shape[1],c.shape[2],c.shape[3]]):c}const zm=L({resizeNearestNeighbor_:GS});/** * @license * Copyright 2021 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -3233,7 +3233,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function qS(n,e="binary",t=!1,s=.5){const o=T(n,"image","threshold"),r=.2989,i=.587,a=.114,l=o.shape[0]*o.shape[1];let c=D(At([s]),255),u,h,d,p;if(v(o.rank===3,()=>`Error in threshold: image must be rank 3,but got rank ${o.rank}.`),v(o.shape[2]===3||o.shape[2]===1,()=>`Error in threshold: image color channel must be equal to 3 or 1but got ${o.shape[2]}.`),v(o.dtype==="int32"||o.dtype==="float32",()=>`Error in dtype: image dtype must be int32 or float32,but got dtype ${o.dtype}.`),v(e==="otsu"||e==="binary",()=>`Method must be binary or otsu, but was ${e}`),o.shape[2]===3){[u,h,d]=sn(o,[1,1,1],-1);const g=D(u,r),x=D(h,i),b=D(d,a);p=J(J(g,x),b)}else p=n;if(e==="otsu"){const g=HI(re(vm(p),"int32"),ss([]),256);c=jS(g,l)}const f=t?jo(p,c):Zt(p,c);return re(D(f,255),"int32")}function jS(n,e){let t=At([-1]),s=At([0]),o=At([0]),r,i,a,l,c,u;for(let h=0;h`Error in threshold: image must be rank 3,but got rank ${o.rank}.`),k(o.shape[2]===3||o.shape[2]===1,()=>`Error in threshold: image color channel must be equal to 3 or 1but got ${o.shape[2]}.`),k(o.dtype==="int32"||o.dtype==="float32",()=>`Error in dtype: image dtype must be int32 or float32,but got dtype ${o.dtype}.`),k(e==="otsu"||e==="binary",()=>`Method must be binary or otsu, but was ${e}`),o.shape[2]===3){[u,h,d]=sn(o,[1,1,1],-1);const g=D(u,r),x=D(h,i),b=D(d,a);p=J(J(g,x),b)}else p=n;if(e==="otsu"){const g=GI(re(vm(p),"int32"),ss([]),256);c=qS(g,l)}const f=t?jo(p,c):Zt(p,c);return re(D(f,255),"int32")}function qS(n,e){let t=Lt([-1]),s=Lt([0]),o=Lt([0]),r,i,a,l,c,u;for(let h=0;h`Error in transform: image must be rank 4,but got rank ${i.rank}.`),v(a.rank===2&&(a.shape[0]===i.shape[0]||a.shape[0]===1)&&a.shape[1]===8,()=>"Error in transform: Input transform should be batch x 8 or 1 x 8"),v(r==null||r.length===2,()=>`Error in transform: outputShape must be [height, width] or null, but got ${r}.`);const l={image:i,transforms:a},c={interpolation:t,fillMode:s,fillValue:o,outputShape:r};return F.runKernel(Du,l,c)}const YS=L({transform_:XS});/** + */function KS(n,e,t="nearest",s="constant",o=0,r){const i=T(n,"image","transform","float32"),a=T(e,"transforms","transform","float32");k(i.rank===4,()=>`Error in transform: image must be rank 4,but got rank ${i.rank}.`),k(a.rank===2&&(a.shape[0]===i.shape[0]||a.shape[0]===1)&&a.shape[1]===8,()=>"Error in transform: Input transform should be batch x 8 or 1 x 8"),k(r==null||r.length===2,()=>`Error in transform: outputShape must be [height, width] or null, but got ${r}.`);const l={image:i,transforms:a},c={interpolation:t,fillMode:s,fillValue:o,outputShape:r};return F.runKernel(Ru,l,c)}const XS=L({transform_:KS});/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -3263,7 +3263,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function ZS(n,e,t){const s=T(n,"a","bandPart");v(s.rank>=2,()=>`bandPart(): Rank must be at least 2, got ${s.rank}.`);const o=s.shape,[r,i]=s.shape.slice(-2);let a,l;typeof e=="number"?(v(e%1===0,()=>`bandPart(): numLower must be an integer, got ${e}.`),v(e<=r,()=>`bandPart(): numLower (${e}) must not be greater than the number of rows (${r}).`),a=T(e<0?r:e,"numLower","bandPart")):(v(e.dtype==="int32",()=>"bandPart(): numLower's dtype must be an int32."),a=It(Sl(e,0),r,vi(e,r))),typeof t=="number"?(v(t%1===0,()=>`bandPart(): numUpper must be an integer, got ${t}.`),v(t<=i,()=>`bandPart(): numUpper (${t}) must not be greater than the number of columns (${i}).`),l=T(t<0?i:t,"numUpper","bandPart")):(v(t.dtype==="int32",()=>"bandPart(): numUpper's dtype must be an int32."),l=It(Sl(t,0),i,vi(t,i)));const c=O(Ti(0,r,1,"int32"),[-1,1]),u=Ti(0,i,1,"int32"),h=be(c,u),d=as(jo(h,a),ao(h,st(l))),p=ot([r,i],s.dtype);return O(Un(Gn(O(s,[-1,r,i])).map(f=>It(d,f,p))),o)}const QS=L({bandPart_:ZS});/** + */function YS(n,e,t){const s=T(n,"a","bandPart");k(s.rank>=2,()=>`bandPart(): Rank must be at least 2, got ${s.rank}.`);const o=s.shape,[r,i]=s.shape.slice(-2);let a,l;typeof e=="number"?(k(e%1===0,()=>`bandPart(): numLower must be an integer, got ${e}.`),k(e<=r,()=>`bandPart(): numLower (${e}) must not be greater than the number of rows (${r}).`),a=T(e<0?r:e,"numLower","bandPart")):(k(e.dtype==="int32",()=>"bandPart(): numLower's dtype must be an int32."),a=It(Sl(e,0),r,vi(e,r))),typeof t=="number"?(k(t%1===0,()=>`bandPart(): numUpper must be an integer, got ${t}.`),k(t<=i,()=>`bandPart(): numUpper (${t}) must not be greater than the number of columns (${i}).`),l=T(t<0?i:t,"numUpper","bandPart")):(k(t.dtype==="int32",()=>"bandPart(): numUpper's dtype must be an int32."),l=It(Sl(t,0),i,vi(t,i)));const c=O(Ti(0,r,1,"int32"),[-1,1]),u=Ti(0,i,1,"int32"),h=be(c,u),d=as(jo(h,a),ao(h,st(l))),p=ot([r,i],s.dtype);return O(Un(Gn(O(s,[-1,r,i])).map(f=>It(d,f,p))),o)}const ZS=L({bandPart_:YS});/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -3278,7 +3278,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function JS(n){let e;if(Array.isArray(n)){e=!1,v(n!=null&&n.length>0,()=>"Gram-Schmidt process: input must not be null, undefined, or empty");const o=n[0].shape[0];for(let r=1;r`Gram-Schmidt: Non-unique lengths found in the input vectors: (${n[r].shape[0]} vs. ${o})`)}else e=!0,n=sn(n,n.shape[0],0).map(o=>Xo(o,[0]));v(n.length<=n[0].shape[0],()=>`Gram-Schmidt: Number of vectors (${n.length}) exceeds number of dimensions (${n[0].shape[0]}).`);const t=[],s=n;for(let o=0;o{let r=s[o];if(o>0)for(let i=0;i0,()=>"Gram-Schmidt process: input must not be null, undefined, or empty");const o=n[0].shape[0];for(let r=1;r`Gram-Schmidt: Non-unique lengths found in the input vectors: (${n[r].shape[0]} vs. ${o})`)}else e=!0,n=sn(n,n.shape[0],0).map(o=>Xo(o,[0]));k(n.length<=n[0].shape[0],()=>`Gram-Schmidt: Number of vectors (${n.length}) exceeds number of dimensions (${n[0].shape[0]}).`);const t=[],s=n;for(let o=0;o{let r=s[o];if(o>0)for(let i=0;i=2,()=>`qr() requires input tensor to have a rank >= 2, but got rank ${n.rank}`),n.rank===2)return Vm(n,e);{const t=n.shape.slice(0,n.shape.length-2).reduce((l,c)=>l*c),s=Gn(O(n,[t,n.shape[n.shape.length-2],n.shape[n.shape.length-1]]),0),o=[],r=[];s.forEach(l=>{const[c,u]=Vm(l,e);o.push(c),r.push(u)});const i=O(Un(o,0),n.shape),a=O(Un(r,0),n.shape);return[i,a]}}function Vm(n,e=!1){return F.tidy(()=>{v(n.shape.length===2,()=>`qr2d() requires a 2D Tensor, but got a ${n.shape.length}D Tensor.`);const t=n.shape[0],s=n.shape[1];let o=gm(t),r=to(n);const i=Eh([[1]],[1,1]);let a=to(i);const l=t>=s?s:t;for(let c=0;c{const p=Ve(r,[c,c],[t-c,1]),f=kl(p),m=Ve(r,[c,c],[1,1]),g=It(Zt(m,0),Eh([[-1]]),Eh([[1]])),x=be(m,D(g,f)),b=me(p,x);b.shape[0]===1?a=to(i):a=Mt([i,Ve(b,[1,0],[b.shape[0]-1,b.shape[1]])],0);const w=st(me(Ae(g,x),f)),y=Ve(r,[c,0],[t-c,s]),C=D(w,a),I=Ee(a);if(c===0)r=be(y,Ae(C,Ae(I,y)));else{const S=be(y,Ae(C,Ae(I,y)));r=Mt([Ve(r,[0,0],[c,s]),S],0)}const $=Ee(C),k=Ve(o,[0,c],[t,o.shape[1]-c]);if(c===0)o=be(k,Ae(Ae(k,a),$));else{const S=be(k,Ae(Ae(k,a),$));o=Mt([Ve(o,[0,0],[t,c]),S],1)}return[a,r,o]}),fe([u,h,d])}return!e&&t>s&&(o=Ve(o,[0,0],[t,s]),r=Ve(r,[0,0],[s,s])),[o,r]})}const n2=L({qr_:t2});/** + */function e2(n,e=!1){if(k(n.rank>=2,()=>`qr() requires input tensor to have a rank >= 2, but got rank ${n.rank}`),n.rank===2)return Vm(n,e);{const t=n.shape.slice(0,n.shape.length-2).reduce((l,c)=>l*c),s=Gn(O(n,[t,n.shape[n.shape.length-2],n.shape[n.shape.length-1]]),0),o=[],r=[];s.forEach(l=>{const[c,u]=Vm(l,e);o.push(c),r.push(u)});const i=O(Un(o,0),n.shape),a=O(Un(r,0),n.shape);return[i,a]}}function Vm(n,e=!1){return F.tidy(()=>{k(n.shape.length===2,()=>`qr2d() requires a 2D Tensor, but got a ${n.shape.length}D Tensor.`);const t=n.shape[0],s=n.shape[1];let o=gm(t),r=to(n);const i=Th([[1]],[1,1]);let a=to(i);const l=t>=s?s:t;for(let c=0;c{const p=Ve(r,[c,c],[t-c,1]),f=kl(p),m=Ve(r,[c,c],[1,1]),g=It(Zt(m,0),Th([[-1]]),Th([[1]])),x=be(m,D(g,f)),b=me(p,x);b.shape[0]===1?a=to(i):a=Ot([i,Ve(b,[1,0],[b.shape[0]-1,b.shape[1]])],0);const w=st(me(Ae(g,x),f)),y=Ve(r,[c,0],[t-c,s]),C=D(w,a),I=Ee(a);if(c===0)r=be(y,Ae(C,Ae(I,y)));else{const S=be(y,Ae(C,Ae(I,y)));r=Ot([Ve(r,[0,0],[c,s]),S],0)}const v=Ee(C),$=Ve(o,[0,c],[t,o.shape[1]-c]);if(c===0)o=be($,Ae(Ae($,a),v));else{const S=be($,Ae(Ae($,a),v));o=Ot([Ve(o,[0,0],[t,c]),S],1)}return[a,r,o]}),fe([u,h,d])}return!e&&t>s&&(o=Ve(o,[0,0],[t,s]),r=Ve(r,[0,0],[s,s])),[o,r]})}const t2=L({qr_:e2});/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -3308,7 +3308,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const ls={flipLeftRight:yS,grayscaleToRGB:CS,resizeNearestNeighbor:zm,resizeBilinear:Bm,rgbToGrayscale:$S,rotateWithOffset:vS,cropAndResize:xS,nonMaxSuppression:TS,nonMaxSuppressionAsync:OS,nonMaxSuppressionWithScore:MS,nonMaxSuppressionWithScoreAsync:BS,nonMaxSuppressionPadded:VS,nonMaxSuppressionPaddedAsync:US,threshold:KS,transform:YS},s2={bandPart:QS,gramSchmidt:e2,qr:n2};/** + */const ls={flipLeftRight:bS,grayscaleToRGB:wS,resizeNearestNeighbor:zm,resizeBilinear:Bm,rgbToGrayscale:IS,rotateWithOffset:kS,cropAndResize:gS,nonMaxSuppression:SS,nonMaxSuppressionAsync:_S,nonMaxSuppressionWithScore:LS,nonMaxSuppressionWithScoreAsync:PS,nonMaxSuppressionPadded:zS,nonMaxSuppressionPaddedAsync:WS,threshold:jS,transform:XS},n2={bandPart:ZS,gramSchmidt:JS,qr:t2};/** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -3323,7 +3323,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const o2=new Map,r2=new Map;class Zo{getClassName(){return this.constructor.className}static fromConfig(e,t){return new e(t)}}class mn{constructor(){this.classNameMap={}}static getMap(){return mn.instance==null&&(mn.instance=new mn),mn.instance}static register(e){mn.getMap().classNameMap[e.className]=[e,e.fromConfig]}}function Z(n,e,t){v(n.className!=null,()=>"Class being registered does not have the static className property defined."),v(typeof n.className=="string",()=>"className is required to be a string, but got type "+typeof n.className),v(n.className.length>0,()=>"Class being registered has an empty-string as its className, which is disallowed."),typeof e>"u"&&(e="Custom"),typeof t>"u"&&(t=n.className);const s=t,o=e+">"+s;return mn.register(n),o2.set(o,n),r2.set(n,o),n}/** + */const s2=new Map,o2=new Map;class Zo{getClassName(){return this.constructor.className}static fromConfig(e,t){return new e(t)}}class mn{constructor(){this.classNameMap={}}static getMap(){return mn.instance==null&&(mn.instance=new mn),mn.instance}static register(e){mn.getMap().classNameMap[e.className]=[e,e.fromConfig]}}function Z(n,e,t){k(n.className!=null,()=>"Class being registered does not have the static className property defined."),k(typeof n.className=="string",()=>"className is required to be a string, but got type "+typeof n.className),k(n.className.length>0,()=>"Class being registered has an empty-string as its className, which is disallowed."),typeof e>"u"&&(e="Custom"),typeof t>"u"&&(t=n.className);const s=t,o=e+">"+s;return mn.register(n),s2.set(o,n),o2.set(n,o),n}/** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -3338,7 +3338,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */class vs extends Zo{minimize(e,t=!1,s){const{value:o,grads:r}=this.computeGradients(e,s);if(s!=null){const i=s.map(a=>({name:a.name,tensor:r[a.name]}));this.applyGradients(i)}else this.applyGradients(r);return fe(r),t?o:(o.dispose(),null)}get iterations(){return this.iterations_==null&&(this.iterations_=0),this.iterations_}incrementIterations(){this.iterations_=this.iterations+1}computeGradients(e,t){return hk(e,t)}dispose(){this.iterations_!=null&&fe(this.iterations_)}async saveIterations(){return this.iterations_==null&&(this.iterations_=0),{name:"iter",tensor:De(this.iterations_,"int32")}}async getWeights(){throw new Error("getWeights() is not implemented for this optimizer yet.")}async setWeights(e){throw new Error(`setWeights() is not implemented for this optimizer class ${this.getClassName()}`)}async extractIterations(e){return this.iterations_=(await e[0].tensor.data())[0],e.slice(1)}}Object.defineProperty(vs,Symbol.hasInstance,{value:n=>n.minimize!=null&&n.computeGradients!=null&&n.applyGradients!=null});/** + */class vs extends Zo{minimize(e,t=!1,s){const{value:o,grads:r}=this.computeGradients(e,s);if(s!=null){const i=s.map(a=>({name:a.name,tensor:r[a.name]}));this.applyGradients(i)}else this.applyGradients(r);return fe(r),t?o:(o.dispose(),null)}get iterations(){return this.iterations_==null&&(this.iterations_=0),this.iterations_}incrementIterations(){this.iterations_=this.iterations+1}computeGradients(e,t){return uk(e,t)}dispose(){this.iterations_!=null&&fe(this.iterations_)}async saveIterations(){return this.iterations_==null&&(this.iterations_=0),{name:"iter",tensor:De(this.iterations_,"int32")}}async getWeights(){throw new Error("getWeights() is not implemented for this optimizer yet.")}async setWeights(e){throw new Error(`setWeights() is not implemented for this optimizer class ${this.getClassName()}`)}async extractIterations(e){return this.iterations_=(await e[0].tensor.data())[0],e.slice(1)}}Object.defineProperty(vs,Symbol.hasInstance,{value:n=>n.minimize!=null&&n.computeGradients!=null&&n.applyGradients!=null});/** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -3398,7 +3398,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */class Hm extends vs{static get className(){return"Adamax"}constructor(e,t,s,o=null,r=0){super(),this.learningRate=e,this.beta1=t,this.beta2=s,this.epsilon=o,this.decay=r,this.accumulatedFirstMoment=[],this.accumulatedWeightedInfNorm=[],B(()=>{this.iteration=De(0).variable(),this.accBeta1=De(t).variable()}),o==null&&(this.epsilon=F.backend.epsilon())}applyGradients(e){const t=Array.isArray(e)?e.map(s=>s.name):Object.keys(e);B(()=>{const s=be(1,this.accBeta1),o=me(-this.learningRate,J(D(this.iteration,this.decay),1));t.forEach((r,i)=>{const a=F.registeredVariables[r],l=!1;this.accumulatedFirstMoment[i]==null&&(this.accumulatedFirstMoment[i]={originalName:`${r}/m`,variable:Ne(a).variable(l)}),this.accumulatedWeightedInfNorm[i]==null&&(this.accumulatedWeightedInfNorm[i]={originalName:`${r}/v`,variable:Ne(a).variable(l)});const c=Array.isArray(e)?e[i].tensor:e[r];if(c==null)return;const u=this.accumulatedFirstMoment[i].variable,h=this.accumulatedWeightedInfNorm[i].variable,d=J(D(u,this.beta1),D(c,1-this.beta1)),p=D(h,this.beta2),f=Lt(c),m=ks(p,f);u.assign(d),h.assign(m);const g=J(D(me(o,s),me(d,J(m,this.epsilon))),a);a.assign(g)}),this.iteration.assign(J(this.iteration,1)),this.accBeta1.assign(D(this.accBeta1,this.beta1))}),this.incrementIterations()}dispose(){this.accBeta1.dispose(),this.iteration.dispose(),this.accumulatedFirstMoment!=null&&fe(this.accumulatedFirstMoment.map(e=>e.variable)),this.accumulatedWeightedInfNorm!=null&&fe(this.accumulatedWeightedInfNorm.map(e=>e.variable))}async getWeights(){throw new Error("getWeights() is not implemented for Adamax yet.")}async setWeights(e){throw new Error("setWeights() is not implemented for Adamax yet.")}getConfig(){return{learningRate:this.learningRate,beta1:this.beta1,beta2:this.beta2,epsilon:this.epsilon,decay:this.decay}}static fromConfig(e,t){return new e(t.learningRate,t.beta1,t.beta2,t.epsilon,t.decay)}}/** + */class Hm extends vs{static get className(){return"Adamax"}constructor(e,t,s,o=null,r=0){super(),this.learningRate=e,this.beta1=t,this.beta2=s,this.epsilon=o,this.decay=r,this.accumulatedFirstMoment=[],this.accumulatedWeightedInfNorm=[],B(()=>{this.iteration=De(0).variable(),this.accBeta1=De(t).variable()}),o==null&&(this.epsilon=F.backend.epsilon())}applyGradients(e){const t=Array.isArray(e)?e.map(s=>s.name):Object.keys(e);B(()=>{const s=be(1,this.accBeta1),o=me(-this.learningRate,J(D(this.iteration,this.decay),1));t.forEach((r,i)=>{const a=F.registeredVariables[r],l=!1;this.accumulatedFirstMoment[i]==null&&(this.accumulatedFirstMoment[i]={originalName:`${r}/m`,variable:Ne(a).variable(l)}),this.accumulatedWeightedInfNorm[i]==null&&(this.accumulatedWeightedInfNorm[i]={originalName:`${r}/v`,variable:Ne(a).variable(l)});const c=Array.isArray(e)?e[i].tensor:e[r];if(c==null)return;const u=this.accumulatedFirstMoment[i].variable,h=this.accumulatedWeightedInfNorm[i].variable,d=J(D(u,this.beta1),D(c,1-this.beta1)),p=D(h,this.beta2),f=_t(c),m=ks(p,f);u.assign(d),h.assign(m);const g=J(D(me(o,s),me(d,J(m,this.epsilon))),a);a.assign(g)}),this.iteration.assign(J(this.iteration,1)),this.accBeta1.assign(D(this.accBeta1,this.beta1))}),this.incrementIterations()}dispose(){this.accBeta1.dispose(),this.iteration.dispose(),this.accumulatedFirstMoment!=null&&fe(this.accumulatedFirstMoment.map(e=>e.variable)),this.accumulatedWeightedInfNorm!=null&&fe(this.accumulatedWeightedInfNorm.map(e=>e.variable))}async getWeights(){throw new Error("getWeights() is not implemented for Adamax yet.")}async setWeights(e){throw new Error("setWeights() is not implemented for Adamax yet.")}getConfig(){return{learningRate:this.learningRate,beta1:this.beta1,beta2:this.beta2,epsilon:this.epsilon,decay:this.decay}}static fromConfig(e,t){return new e(t.learningRate,t.beta1,t.beta2,t.epsilon,t.decay)}}/** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -3413,7 +3413,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */class zh extends vs{static get className(){return"SGD"}constructor(e){super(),this.learningRate=e,this.setLearningRate(e)}applyGradients(e){(Array.isArray(e)?e.map(s=>s.name):Object.keys(e)).forEach((s,o)=>{const r=Array.isArray(e)?e[o].tensor:e[s];if(r==null)return;const i=F.registeredVariables[s];B(()=>{const a=J(D(this.c,r),i);i.assign(a)})}),this.incrementIterations()}setLearningRate(e){this.learningRate=e,this.c!=null&&this.c.dispose(),this.c=dn(De(-e))}dispose(){this.c.dispose()}async getWeights(){return[await this.saveIterations()]}async setWeights(e){if(e=await this.extractIterations(e),e.length!==0)throw new Error("SGD optimizer does not have settable weights.")}getConfig(){return{learningRate:this.learningRate}}static fromConfig(e,t){return new e(t.learningRate)}}/** + */class Ph extends vs{static get className(){return"SGD"}constructor(e){super(),this.learningRate=e,this.setLearningRate(e)}applyGradients(e){(Array.isArray(e)?e.map(s=>s.name):Object.keys(e)).forEach((s,o)=>{const r=Array.isArray(e)?e[o].tensor:e[s];if(r==null)return;const i=F.registeredVariables[s];B(()=>{const a=J(D(this.c,r),i);i.assign(a)})}),this.incrementIterations()}setLearningRate(e){this.learningRate=e,this.c!=null&&this.c.dispose(),this.c=dn(De(-e))}dispose(){this.c.dispose()}async getWeights(){return[await this.saveIterations()]}async setWeights(e){if(e=await this.extractIterations(e),e.length!==0)throw new Error("SGD optimizer does not have settable weights.")}getConfig(){return{learningRate:this.learningRate}}static fromConfig(e,t){return new e(t.learningRate)}}/** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -3428,7 +3428,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */class qm extends zh{static get className(){return"Momentum"}constructor(e,t,s=!1){super(e),this.learningRate=e,this.momentum=t,this.useNesterov=s,this.accumulations=[],this.m=De(this.momentum)}applyGradients(e){(Array.isArray(e)?e.map(s=>s.name):Object.keys(e)).forEach((s,o)=>{const r=F.registeredVariables[s];this.accumulations[o]==null&&(this.accumulations[o]={originalName:`${s}/momentum`,variable:B(()=>Ne(r).variable(!1))});const i=this.accumulations[o].variable,a=Array.isArray(e)?e[o].tensor:e[s];a!=null&&B(()=>{let l;const c=J(D(this.m,i),a);this.useNesterov?l=J(D(this.c,J(a,D(c,this.m))),r):l=J(D(this.c,c),r),i.assign(c),r.assign(l)})}),this.incrementIterations()}dispose(){this.m.dispose(),this.accumulations!=null&&fe(this.accumulations.map(e=>e.variable))}setMomentum(e){this.momentum=e}async getWeights(){return[await this.saveIterations()].concat(this.accumulations.map(e=>({name:e.originalName,tensor:e.variable})))}async setWeights(e){e=await this.extractIterations(e);const t=!1;this.accumulations=e.map(s=>({originalName:s.name,variable:s.tensor.variable(t)}))}getConfig(){return{learningRate:this.learningRate,momentum:this.momentum,useNesterov:this.useNesterov}}static fromConfig(e,t){return new e(t.learningRate,t.momentum,t.useNesterov)}}/** + */class qm extends Ph{static get className(){return"Momentum"}constructor(e,t,s=!1){super(e),this.learningRate=e,this.momentum=t,this.useNesterov=s,this.accumulations=[],this.m=De(this.momentum)}applyGradients(e){(Array.isArray(e)?e.map(s=>s.name):Object.keys(e)).forEach((s,o)=>{const r=F.registeredVariables[s];this.accumulations[o]==null&&(this.accumulations[o]={originalName:`${s}/momentum`,variable:B(()=>Ne(r).variable(!1))});const i=this.accumulations[o].variable,a=Array.isArray(e)?e[o].tensor:e[s];a!=null&&B(()=>{let l;const c=J(D(this.m,i),a);this.useNesterov?l=J(D(this.c,J(a,D(c,this.m))),r):l=J(D(this.c,c),r),i.assign(c),r.assign(l)})}),this.incrementIterations()}dispose(){this.m.dispose(),this.accumulations!=null&&fe(this.accumulations.map(e=>e.variable))}setMomentum(e){this.momentum=e}async getWeights(){return[await this.saveIterations()].concat(this.accumulations.map(e=>({name:e.originalName,tensor:e.variable})))}async setWeights(e){e=await this.extractIterations(e);const t=!1;this.accumulations=e.map(s=>({originalName:s.name,variable:s.tensor.variable(t)}))}getConfig(){return{learningRate:this.learningRate,momentum:this.momentum,useNesterov:this.useNesterov}}static fromConfig(e,t){return new e(t.learningRate,t.momentum,t.useNesterov)}}/** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -3458,7 +3458,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const i2=[Wm,Um,Gm,Hm,qm,jm,zh];function a2(){for(const n of i2)Z(n)}/** + */const r2=[Wm,Um,Gm,Hm,qm,jm,Ph];function i2(){for(const n of r2)Z(n)}/** * @license * Copyright 2019 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -3473,7 +3473,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function Km(n,e,t,s){i(n),t=t??0,s=s??1,a(t,s);let o=0;const r=l=>(l.then(c=>{const u=t+ ++o/n.length*(s-t);return e(u),c}),l);function i(l){v(l!=null&&Array.isArray(l)&&l.length>0,()=>"promises must be a none empty array")}function a(l,c){v(l>=0&&l<=1,()=>`Progress fraction must be in range [0, 1], but got startFraction ${l}`),v(c>=0&&c<=1,()=>`Progress fraction must be in range [0, 1], but got endFraction ${c}`),v(c>=l,()=>`startFraction must be no more than endFraction, but got startFraction ${l} and endFraction ${c}`)}return Promise.all(n.map(r))}/** + */function Km(n,e,t,s){i(n),t=t??0,s=s??1,a(t,s);let o=0;const r=l=>(l.then(c=>{const u=t+ ++o/n.length*(s-t);return e(u),c}),l);function i(l){k(l!=null&&Array.isArray(l)&&l.length>0,()=>"promises must be a none empty array")}function a(l,c){k(l>=0&&l<=1,()=>`Progress fraction must be in range [0, 1], but got startFraction ${l}`),k(c>=0&&c<=1,()=>`Progress fraction must be in range [0, 1], but got endFraction ${c}`),k(c>=l,()=>`startFraction must be no more than endFraction, but got startFraction ${l} and endFraction ${c}`)}return Promise.all(n.map(r))}/** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -3488,7 +3488,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */async function l2(n,e){e==null&&(e={});const t=e.fetchFunc==null?V().platform.fetch:e.fetchFunc,s=n.map(h=>t(h,e.requestInit,{isBinary:!0})),a=(e.onProgress==null?await Promise.all(s):await Km(s,e.onProgress,0,.5)).map(h=>h.arrayBuffer());return e.onProgress==null?await Promise.all(a):await Km(a,e.onProgress,.5,1)}function c2(n,e){var t;const s=e.fetchFunc==null?V().platform.fetch:e.fetchFunc;let o=0,r;return(t=e.onProgress)===null||t===void 0||t.call(e,0),new ReadableStream({pull:async i=>{for(var a;ot(h,e.requestInit,{isBinary:!0})),a=(e.onProgress==null?await Promise.all(s):await Km(s,e.onProgress,0,.5)).map(h=>h.arrayBuffer());return e.onProgress==null?await Promise.all(a):await Km(a,e.onProgress,.5,1)}function l2(n,e){var t;const s=e.fetchFunc==null?V().platform.fetch:e.fetchFunc;let o=0,r;return(t=e.onProgress)===null||t===void 0||t.call(e,0),new ReadableStream({pull:async i=>{for(var a;o"Must pass a function that matches the signature of `fetch` (see https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API)"),this.fetch=t.fetchFunc):this.fetch=V().platform.fetch,v(e!=null&&e.length>0,()=>"URL path for http must not be null, undefined or empty."),Array.isArray(e)&&v(e.length===2,()=>`URL paths for http must have a length of 2, (actual length is ${e.length}).`),this.path=e,t.requestInit!=null&&t.requestInit.body!=null)throw new Error("requestInit is expected to have no pre-existing body, but has one.");this.requestInit=t.requestInit||{},this.loadOptions=t}async save(e){if(e.modelTopology instanceof ArrayBuffer)throw new Error("BrowserHTTPRequest.save() does not support saving model topology in binary formats yet.");const t=Object.assign({method:this.DEFAULT_METHOD},this.requestInit);t.body=new FormData;const s=[{paths:["./model.weights.bin"],weights:e.weightSpecs}],o=SC(e,s);if(t.body.append("model.json",new Blob([JSON.stringify(o)],{type:h2}),"model.json"),e.weightData!=null){const i=ws.join(e.weightData);t.body.append("model.weights.bin",new Blob([i],{type:u2}),"model.weights.bin")}const r=await this.fetch(this.path,t);if(r.ok)return{modelArtifactsInfo:ju(e),responses:[r]};throw new Error(`BrowserHTTPRequest.save() failed due to HTTP response status ${r.status}.`)}async loadModelJSON(){const e=await this.fetch(this.path,this.requestInit);if(!e.ok)throw new Error(`Request to ${this.path} failed with status code ${e.status}. Please verify this URL points to the model JSON of the model to load.`);let t;try{t=await e.json()}catch{let i=`Failed to parse model JSON of response from ${this.path}.`;throw this.path.endsWith(".pb")?i+=" Your path contains a .pb file extension. Support for .pb models have been removed in TensorFlow.js 1.0 in favor of .json models. You can re-convert your Python TensorFlow model using the TensorFlow.js 1.0 conversion scripts or you can convert your.pb models with the 'pb2json'NPM script in the tensorflow/tfjs-converter repository.":i+=" Please make sure the server is serving valid JSON for this request.",new Error(i)}const s=t.modelTopology,o=t.weightsManifest;if(s==null&&o==null)throw new Error(`The JSON from HTTP path ${this.path} contains neither model topology or manifest for weights.`);return t}async load(){if(this.loadOptions.streamWeights)return this.loadStream();const e=await this.loadModelJSON();return NC(e,t=>this.loadWeights(t))}async loadStream(){const e=await this.loadModelJSON(),t=await this.getWeightUrls(e.weightsManifest),s=Zf(e.weightsManifest),o=()=>c2(t,this.loadOptions);return Object.assign(Object.assign({},e),{weightSpecs:s,getWeightStream:o})}async getWeightUrls(e){const t=Array.isArray(this.path)?this.path[1]:this.path,[s,o]=d2(t),r=this.weightPathPrefix||s,i=[],a=[];for(const l of e)for(const c of l.paths)this.weightUrlConverter!=null?a.push(this.weightUrlConverter(c)):i.push(r+c+o);return this.weightUrlConverter&&i.push(...await Promise.all(a)),i}async loadWeights(e){const t=await this.getWeightUrls(e),s=Zf(e),o=await l2(t,this.loadOptions);return[s,o]}}Vh.URL_SCHEME_REGEX=/^https?:\/\//;function d2(n){const e=n.lastIndexOf("/"),t=n.lastIndexOf("?"),s=n.substring(0,e),o=t>e?n.substring(t):"";return[s+"/",o]}function Xm(n){return n.match(Vh.URL_SCHEME_REGEX)!=null}const Ym=(n,e)=>{if(typeof fetch>"u"&&(e==null||e.fetchFunc==null))return null;{let t=!0;if(Array.isArray(n)?t=n.every(s=>Xm(s)):t=Xm(n),t)return Zm(n,e)}return null};xt.registerSaveRouter(Ym),xt.registerLoadRouter(Ym);function Zm(n,e){return new Vh(n,e)}function p2(n,e){return Zm(n,e)}function Wh(n,e){const t=n.shape.length,s=e.shape.length;if(t<1)throw new Error(`tf.gatherND() expects the input to be rank 1 or higher, but the rank was ${t}.`);if(s<1)throw new Error(`tf.gatherND() expects the indices to be rank 1 or higher, but the rank was ${s}.`);if(e.dtype!=="int32")throw new Error(`tf.gatherND() expects the indices to be int32 type, but the dtype was ${e.dtype}.`);if(e.shape[s-1]>t)throw new Error(`index innermost dimension length must be <= tensor rank; saw: ${e.shape[s-1]} vs. ${t}`);if(G(n.shape)===0)throw new Error(`Requested more than 0 entries, but input is empty. Input shape: ${n.shape}.`);const o=e.shape,r=o[o.length-1];let i=1;for(let h=0;hh/c),1].slice(0,r);return[l,i,c,u]}/** + */const c2="application/octet-stream",u2="application/json";class Bh{constructor(e,t){if(this.DEFAULT_METHOD="POST",t==null&&(t={}),this.weightPathPrefix=t.weightPathPrefix,this.weightUrlConverter=t.weightUrlConverter,t.fetchFunc!=null?(k(typeof t.fetchFunc=="function",()=>"Must pass a function that matches the signature of `fetch` (see https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API)"),this.fetch=t.fetchFunc):this.fetch=V().platform.fetch,k(e!=null&&e.length>0,()=>"URL path for http must not be null, undefined or empty."),Array.isArray(e)&&k(e.length===2,()=>`URL paths for http must have a length of 2, (actual length is ${e.length}).`),this.path=e,t.requestInit!=null&&t.requestInit.body!=null)throw new Error("requestInit is expected to have no pre-existing body, but has one.");this.requestInit=t.requestInit||{},this.loadOptions=t}async save(e){if(e.modelTopology instanceof ArrayBuffer)throw new Error("BrowserHTTPRequest.save() does not support saving model topology in binary formats yet.");const t=Object.assign({method:this.DEFAULT_METHOD},this.requestInit);t.body=new FormData;const s=[{paths:["./model.weights.bin"],weights:e.weightSpecs}],o=vC(e,s);if(t.body.append("model.json",new Blob([JSON.stringify(o)],{type:u2}),"model.json"),e.weightData!=null){const i=ws.join(e.weightData);t.body.append("model.weights.bin",new Blob([i],{type:c2}),"model.weights.bin")}const r=await this.fetch(this.path,t);if(r.ok)return{modelArtifactsInfo:Hu(e),responses:[r]};throw new Error(`BrowserHTTPRequest.save() failed due to HTTP response status ${r.status}.`)}async loadModelJSON(){const e=await this.fetch(this.path,this.requestInit);if(!e.ok)throw new Error(`Request to ${this.path} failed with status code ${e.status}. Please verify this URL points to the model JSON of the model to load.`);let t;try{t=await e.json()}catch{let i=`Failed to parse model JSON of response from ${this.path}.`;throw this.path.endsWith(".pb")?i+=" Your path contains a .pb file extension. Support for .pb models have been removed in TensorFlow.js 1.0 in favor of .json models. You can re-convert your Python TensorFlow model using the TensorFlow.js 1.0 conversion scripts or you can convert your.pb models with the 'pb2json'NPM script in the tensorflow/tfjs-converter repository.":i+=" Please make sure the server is serving valid JSON for this request.",new Error(i)}const s=t.modelTopology,o=t.weightsManifest;if(s==null&&o==null)throw new Error(`The JSON from HTTP path ${this.path} contains neither model topology or manifest for weights.`);return t}async load(){if(this.loadOptions.streamWeights)return this.loadStream();const e=await this.loadModelJSON();return TC(e,t=>this.loadWeights(t))}async loadStream(){const e=await this.loadModelJSON(),t=await this.getWeightUrls(e.weightsManifest),s=Zf(e.weightsManifest),o=()=>l2(t,this.loadOptions);return Object.assign(Object.assign({},e),{weightSpecs:s,getWeightStream:o})}async getWeightUrls(e){const t=Array.isArray(this.path)?this.path[1]:this.path,[s,o]=h2(t),r=this.weightPathPrefix||s,i=[],a=[];for(const l of e)for(const c of l.paths)this.weightUrlConverter!=null?a.push(this.weightUrlConverter(c)):i.push(r+c+o);return this.weightUrlConverter&&i.push(...await Promise.all(a)),i}async loadWeights(e){const t=await this.getWeightUrls(e),s=Zf(e),o=await a2(t,this.loadOptions);return[s,o]}}Bh.URL_SCHEME_REGEX=/^https?:\/\//;function h2(n){const e=n.lastIndexOf("/"),t=n.lastIndexOf("?"),s=n.substring(0,e),o=t>e?n.substring(t):"";return[s+"/",o]}function Xm(n){return n.match(Bh.URL_SCHEME_REGEX)!=null}const Ym=(n,e)=>{if(typeof fetch>"u"&&(e==null||e.fetchFunc==null))return null;{let t=!0;if(Array.isArray(n)?t=n.every(s=>Xm(s)):t=Xm(n),t)return Zm(n,e)}return null};xt.registerSaveRouter(Ym),xt.registerLoadRouter(Ym);function Zm(n,e){return new Bh(n,e)}function d2(n,e){return Zm(n,e)}function zh(n,e){const t=n.shape.length,s=e.shape.length;if(t<1)throw new Error(`tf.gatherND() expects the input to be rank 1 or higher, but the rank was ${t}.`);if(s<1)throw new Error(`tf.gatherND() expects the indices to be rank 1 or higher, but the rank was ${s}.`);if(e.dtype!=="int32")throw new Error(`tf.gatherND() expects the indices to be int32 type, but the dtype was ${e.dtype}.`);if(e.shape[s-1]>t)throw new Error(`index innermost dimension length must be <= tensor rank; saw: ${e.shape[s-1]} vs. ${t}`);if(G(n.shape)===0)throw new Error(`Requested more than 0 entries, but input is empty. Input shape: ${n.shape}.`);const o=e.shape,r=o[o.length-1];let i=1;for(let h=0;hh/c),1].slice(0,r);return[l,i,c,u]}/** * @license * Copyright 2021 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -3518,7 +3518,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const Uh=-2,f2=-1;function Gh(n,e,t){const s=n.shape.length;v(s===e.length,()=>`Error in slice${s}D: Length of begin ${e} must match the rank of the array (${s}).`),v(s===t.length,()=>`Error in slice${s}D: Length of size ${t} must match the rank of the array (${s}).`);for(let o=0;o`Error in slice${s}D: begin[${o}] + size[${o}] (${e[o]+t[o]}) would overflow input.shape[${o}] (${n.shape[o]})`)}function m2(n){const e=[];let t=0;for(;n>0;)n&1&&e.push(t),n/=2,t++;return e}function Hh(n,e,t){const s=[];for(let o=0;o0){const p=e[0],f=t+1;u=tg(i,p,f,s,n),h=ng(a,p,f,o,n),d=Qm(r,p,f,n)}else for(let p=0;p-1)r[a]=0;else{const l=Jm(e,t,a);let c=s[l];n&1<-1)r[a]=Number.MAX_SAFE_INTEGER;else{const l=Jm(e,t,a);let c=s[l];n&1<0?i=Number.MIN_SAFE_INTEGER:i=Number.MAX_SAFE_INTEGER);const l=s[o];return i<0&&(i+=l),i=Us(0,i,l-1),i}function rg(n,e,t,s,o,r){let i=e[o];const a=t[o]||1;(n&1<0?i=Number.MAX_SAFE_INTEGER:i=Number.MIN_SAFE_INTEGER);const l=s[o];return i<0&&(i+=l),a>0?i=Us(0,i,l):i=Us(-1,i,l-1),i}function qh(n,e,t){let s=t.length;for(let o=0;o1){s=o;break}for(let o=s+1;o0||t[o]!==n[o])return!1;return!0}function jh(n,e){let t=n.length>0?n[n.length-1]:1;for(let s=0;s{v(i!==-1,()=>"slice() does not support negative begin indexing.")});let r;return t==null?r=new Array(o).fill(-1):typeof t=="number"?r=[t,...new Array(o-1).fill(-1)]:t.lengthi>=0?i:(v(i===-1,()=>`Negative size values should be exactly -1 but got ${i} for the slice() size at index ${a}.`),n.shape[a]-s[a])),[s,r]}function Kh(n,e,t,s,o,r,i,a,l){let c;if(s==null?(c=new Array(e.length),c.fill(1)):c=s,i!=null&&i&i-1)throw new Error("Multiple ellipses in slice is not allowed.");let u=!1;const h={dims:c.length,numAddAxisAfterEllipsis:0,begin:e.slice(),end:t.slice(),strides:c.slice(),beginMask:o,endMask:r,ellipsisMask:i,newAxisMask:a,shrinkAxisMask:l};for(let w=0;w0?0:-1,d.strides[w]>0?C:C-1];if(y&&d.strides[w]<=0)throw Error("only stride 1 allowed on non-range indexing.");m=m&&d.strides[w]===1;const k=!!(d.beginMask&1<=C)throw Error(`slice index ${d.begin[w]} of dimension ${w} out of bounds.`)}else d.begin[w]=ig(d.begin[w],0,d.strides[w],C,I,$),d.end[w]=ig(d.end[w],1,d.strides[w],C,I,$);const A=d.strides[w]===1&&d.begin[w]===0&&d.end[w]===C;p=p&&A,f=f&&(w===0&&d.strides[w]===1||A)}else p=p&&d.strides[w]===1&&k,f=f&&(w===0&&d.strides[w]===1||k);let S,N=!1;if(d.beginValid&&d.endValid?(S=d.end[w]-d.begin[w],N=!0):y?(S=1,N=!0):k&&C>=0&&(d.strides[w]<0?S=-C:S=C,N=!0),N){let A;S===0||S<0!=d.strides[w]<0?A=0:A=Math.trunc(S/d.strides[w])+(S%d.strides[w]!==0?1:0),g.push(A)}else g.push(-1)}for(let w=0;w=0?x.push(g[y]):y===Uh&&x.push(1)}return{finalShapeSparse:x.filter((w,y)=>d.finalShapeGatherIndices[y]!==Uh),finalShape:x,isIdentity:p,sliceDim0:f,isSimpleSlice:m,begin:d.begin,end:d.end,strides:d.strides}}function x2(n,e){e.beginMask=0,e.endMask=0,e.shrinkAxisMask=0;let t=0;e.beginValid=n.begin!=null,e.endValid=n.end!=null,e.begin=new Array(e.dims),e.end=new Array(e.dims),e.strides=new Array(e.dims),e.finalShapeGatherIndices=[],e.finalShapeGatherIndicesSparse=[],e.inputShapeGatherIndicesSparse=new Array(e.dims);for(let s=0;s0?r[e]:r[e+1&1];{const i=n<0?s+n:n;return ir[1]?r[1]:i}}var b2=Object.freeze({__proto__:null,assertParamsValid:Gh,computeFlatOffset:jh,computeOutShape:Hh,getNormalizedAxes:g2,isSliceContinous:qh,maskToAxes:m2,parseSliceParams:Rl,sliceInfo:Kh,startForAxis:og,startIndicesWithElidedDims:tg,stopForAxis:rg,stopIndicesWithElidedDims:ng,stridesForAxis:sg,stridesWithElidedDims:Qm});/** + */const Vh=-2,p2=-1;function Wh(n,e,t){const s=n.shape.length;k(s===e.length,()=>`Error in slice${s}D: Length of begin ${e} must match the rank of the array (${s}).`),k(s===t.length,()=>`Error in slice${s}D: Length of size ${t} must match the rank of the array (${s}).`);for(let o=0;o`Error in slice${s}D: begin[${o}] + size[${o}] (${e[o]+t[o]}) would overflow input.shape[${o}] (${n.shape[o]})`)}function f2(n){const e=[];let t=0;for(;n>0;)n&1&&e.push(t),n/=2,t++;return e}function Uh(n,e,t){const s=[];for(let o=0;o0){const p=e[0],f=t+1;u=tg(i,p,f,s,n),h=ng(a,p,f,o,n),d=Qm(r,p,f,n)}else for(let p=0;p-1)r[a]=0;else{const l=Jm(e,t,a);let c=s[l];n&1<-1)r[a]=Number.MAX_SAFE_INTEGER;else{const l=Jm(e,t,a);let c=s[l];n&1<0?i=Number.MIN_SAFE_INTEGER:i=Number.MAX_SAFE_INTEGER);const l=s[o];return i<0&&(i+=l),i=Us(0,i,l-1),i}function rg(n,e,t,s,o,r){let i=e[o];const a=t[o]||1;(n&1<0?i=Number.MAX_SAFE_INTEGER:i=Number.MIN_SAFE_INTEGER);const l=s[o];return i<0&&(i+=l),a>0?i=Us(0,i,l):i=Us(-1,i,l-1),i}function Gh(n,e,t){let s=t.length;for(let o=0;o1){s=o;break}for(let o=s+1;o0||t[o]!==n[o])return!1;return!0}function Hh(n,e){let t=n.length>0?n[n.length-1]:1;for(let s=0;s{k(i!==-1,()=>"slice() does not support negative begin indexing.")});let r;return t==null?r=new Array(o).fill(-1):typeof t=="number"?r=[t,...new Array(o-1).fill(-1)]:t.lengthi>=0?i:(k(i===-1,()=>`Negative size values should be exactly -1 but got ${i} for the slice() size at index ${a}.`),n.shape[a]-s[a])),[s,r]}function qh(n,e,t,s,o,r,i,a,l){let c;if(s==null?(c=new Array(e.length),c.fill(1)):c=s,i!=null&&i&i-1)throw new Error("Multiple ellipses in slice is not allowed.");let u=!1;const h={dims:c.length,numAddAxisAfterEllipsis:0,begin:e.slice(),end:t.slice(),strides:c.slice(),beginMask:o,endMask:r,ellipsisMask:i,newAxisMask:a,shrinkAxisMask:l};for(let w=0;w0?0:-1,d.strides[w]>0?C:C-1];if(y&&d.strides[w]<=0)throw Error("only stride 1 allowed on non-range indexing.");m=m&&d.strides[w]===1;const $=!!(d.beginMask&1<=C)throw Error(`slice index ${d.begin[w]} of dimension ${w} out of bounds.`)}else d.begin[w]=ig(d.begin[w],0,d.strides[w],C,I,v),d.end[w]=ig(d.end[w],1,d.strides[w],C,I,v);const A=d.strides[w]===1&&d.begin[w]===0&&d.end[w]===C;p=p&&A,f=f&&(w===0&&d.strides[w]===1||A)}else p=p&&d.strides[w]===1&&$,f=f&&(w===0&&d.strides[w]===1||$);let S,N=!1;if(d.beginValid&&d.endValid?(S=d.end[w]-d.begin[w],N=!0):y?(S=1,N=!0):$&&C>=0&&(d.strides[w]<0?S=-C:S=C,N=!0),N){let A;S===0||S<0!=d.strides[w]<0?A=0:A=Math.trunc(S/d.strides[w])+(S%d.strides[w]!==0?1:0),g.push(A)}else g.push(-1)}for(let w=0;w=0?x.push(g[y]):y===Vh&&x.push(1)}return{finalShapeSparse:x.filter((w,y)=>d.finalShapeGatherIndices[y]!==Vh),finalShape:x,isIdentity:p,sliceDim0:f,isSimpleSlice:m,begin:d.begin,end:d.end,strides:d.strides}}function g2(n,e){e.beginMask=0,e.endMask=0,e.shrinkAxisMask=0;let t=0;e.beginValid=n.begin!=null,e.endValid=n.end!=null,e.begin=new Array(e.dims),e.end=new Array(e.dims),e.strides=new Array(e.dims),e.finalShapeGatherIndices=[],e.finalShapeGatherIndicesSparse=[],e.inputShapeGatherIndicesSparse=new Array(e.dims);for(let s=0;s0?r[e]:r[e+1&1];{const i=n<0?s+n:n;return ir[1]?r[1]:i}}var x2=Object.freeze({__proto__:null,assertParamsValid:Wh,computeFlatOffset:Hh,computeOutShape:Uh,getNormalizedAxes:m2,isSliceContinous:Gh,maskToAxes:f2,parseSliceParams:Rl,sliceInfo:qh,startForAxis:og,startIndicesWithElidedDims:tg,stopForAxis:rg,stopIndicesWithElidedDims:ng,stridesForAxis:sg,stridesWithElidedDims:Qm});/** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -3533,7 +3533,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */class y2{static sgd(e){return new zh(e)}static momentum(e,t,s=!1){return new qm(e,t,s)}static rmsprop(e,t=.9,s=0,o=null,r=!1){return new jm(e,t,s,o,r)}static adam(e=.001,t=.9,s=.999,o=null){return new Gm(e,t,s,o)}static adadelta(e=.001,t=.95,s=null){return new Wm(e,t,s)}static adamax(e=.002,t=.9,s=.999,o=null,r=0){return new Hm(e,t,s,o,r)}static adagrad(e,t=.1){return new Um(e,t)}}/** + */class b2{static sgd(e){return new Ph(e)}static momentum(e,t,s=!1){return new qm(e,t,s)}static rmsprop(e,t=.9,s=0,o=null,r=!1){return new jm(e,t,s,o,r)}static adam(e=.001,t=.9,s=.999,o=null){return new Gm(e,t,s,o)}static adadelta(e=.001,t=.95,s=null){return new Wm(e,t,s)}static adamax(e=.002,t=.9,s=.999,o=null,r=0){return new Hm(e,t,s,o,r)}static adagrad(e,t=.1){return new Um(e,t)}}/** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -3548,7 +3548,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const Qo=y2;/** + */const Qo=b2;/** * @license * Copyright 2017 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -3563,7 +3563,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const w2=typeof requestAnimationFrame<"u"?requestAnimationFrame:typeof setImmediate<"u"?setImmediate:n=>n();function ag(){return new Promise(n=>w2(()=>n()))}/** + */const y2=typeof requestAnimationFrame<"u"?requestAnimationFrame:typeof setImmediate<"u"?setImmediate:n=>n();function ag(){return new Promise(n=>y2(()=>n()))}/** * @license * Copyright 2017 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -3578,7 +3578,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function Xh(n,e){const t=n[0].length;n.forEach((o,r)=>{v(o.length===t,()=>`Error in concat${t}D: rank of tensors[${r}] must be the same as the rank of the rest (${t})`)}),v(e>=0&&e`Error in concat${t}D: axis must be between 0 and ${t-1}.`);const s=n[0];n.forEach((o,r)=>{for(let i=0;i`Error in concat${t}D: Shape of tensors[${r}] (${o}) does not match the shape of the rest (${s}) along the non-concatenated axis ${r}.`)})}function Hn(n,e){const t=n[0].slice();for(let s=1;s{k(o.length===t,()=>`Error in concat${t}D: rank of tensors[${r}] must be the same as the rank of the rest (${t})`)}),k(e>=0&&e`Error in concat${t}D: axis must be between 0 and ${t-1}.`);const s=n[0];n.forEach((o,r)=>{for(let i=0;i`Error in concat${t}D: Shape of tensors[${r}] (${o}) does not match the shape of the rest (${s}) along the non-concatenated axis ${r}.`)})}function Hn(n,e){const t=n[0].slice();for(let s=1;s=e*2+1||i%2===1?r.push(i):o.push(i);s.push(...o),s.push(0),s.push(...r)}return s}function Ai(n,e,t,s=!0){const o=[];s?o.push(n[0]/t):o.push(n[0]*t);for(let r=1;r=e*2+1||i%2===1?r.push(i):o.push(i);s.push(...o),s.push(0),s.push(...r)}return s}function Ai(n,e,t,s=!0){const o=[];s?o.push(n[0]/t):o.push(n[0]*t);for(let r=1;r/g,bg=",",yg="...";function ld(n,e){n=n.replace(/\s/g,"");const t=(n.length-n.replace(C2,"").length)/ad.length;if(t<1)throw new Error("Equations without an arrow are not supported.");if(t>1)throw new Error(`Equation must contain exactly one arrow ("${ad}").`);const[s,o]=n.split(ad);v(s.indexOf(yg)===-1,()=>`The ellipsis notation ("${yg}") is not supported yet.`);const r=s.split(bg),i=r.length;if(e!==i)throw new Error(`Expected ${i} input tensors, received ${e}`);if(i>2)throw new Error("Support for more than 2 input tensors is not implemented yet.");const a=[];for(let d=0;df.indexOf(p)!==-1))throw new Error(`Output subscripts contain the label ${p} not present in the input subscripts.`);a.indexOf(p)===-1&&a.push(p)}for(let d=0;do!==-1),{permutationIndices:t,expandDims:s}}function ud(n,e,t){const s=new Array(n);for(let o=0;o`Expected dimension ${s[e[o][i]]} at axis ${i} of input shaped ${JSON.stringify(r)}, but got dimension ${r[i]}`)}}function hd(n,e){const t=n,s=[];let o=0;n.length===0&&t.push(-1),o=n.length+1;for(let i=0;ie===t)}function I2(n,e){const t=[];for(let s=0;s"Number of splits must evenly divide the axis."),s=new Array(e).fill(n.shape[t]/e);else{const o=e.reduce((i,a)=>(a===-1&&(i+=1),i),0);v(o<=1,()=>"There should be only one negative value in split array.");const r=e.indexOf(-1);if(r!==-1){const i=e.reduce((a,l)=>l>0?a+l:a);e[r]=n.shape[t]-i}v(n.shape[t]===e.reduce((i,a)=>i+a),()=>"The sum of sizes must match the size of the axis dimension."),s=e}return s}/** + */const rd="->",w2=/->/g,bg=",",yg="...";function id(n,e){n=n.replace(/\s/g,"");const t=(n.length-n.replace(w2,"").length)/rd.length;if(t<1)throw new Error("Equations without an arrow are not supported.");if(t>1)throw new Error(`Equation must contain exactly one arrow ("${rd}").`);const[s,o]=n.split(rd);k(s.indexOf(yg)===-1,()=>`The ellipsis notation ("${yg}") is not supported yet.`);const r=s.split(bg),i=r.length;if(e!==i)throw new Error(`Expected ${i} input tensors, received ${e}`);if(i>2)throw new Error("Support for more than 2 input tensors is not implemented yet.");const a=[];for(let d=0;df.indexOf(p)!==-1))throw new Error(`Output subscripts contain the label ${p} not present in the input subscripts.`);a.indexOf(p)===-1&&a.push(p)}for(let d=0;do!==-1),{permutationIndices:t,expandDims:s}}function ld(n,e,t){const s=new Array(n);for(let o=0;o`Expected dimension ${s[e[o][i]]} at axis ${i} of input shaped ${JSON.stringify(r)}, but got dimension ${r[i]}`)}}function cd(n,e){const t=n,s=[];let o=0;n.length===0&&t.push(-1),o=n.length+1;for(let i=0;ie===t)}function C2(n,e){const t=[];for(let s=0;s"Number of splits must evenly divide the axis."),s=new Array(e).fill(n.shape[t]/e);else{const o=e.reduce((i,a)=>(a===-1&&(i+=1),i),0);k(o<=1,()=>"There should be only one negative value in split array.");const r=e.indexOf(-1);if(r!==-1){const i=e.reduce((a,l)=>l>0?a+l:a);e[r]=n.shape[t]-i}k(n.shape[t]===e.reduce((i,a)=>i+a),()=>"The sum of sizes must match the size of the axis dimension."),s=e}return s}/** * @license * Copyright 2021 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -3745,7 +3745,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function fd(){return"segment ids must be >= 0"}function Ng(){return"segment ids are not increasing"}function Eg(n,e){return`Segment id ${n} out of range [0, ${e}), possibly because segmentIds input is not sorted.`}function Rg(n,e,t){return`Bad: indices[${n}] == ${e} out of range [0, ${t})`}/** + */function dd(){return"segment ids must be >= 0"}function Ng(){return"segment ids are not increasing"}function Eg(n,e){return`Segment id ${n} out of range [0, ${e}), possibly because segmentIds input is not sorted.`}function Rg(n,e,t){return`Bad: indices[${n}] == ${e} out of range [0, ${t})`}/** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -3760,8 +3760,8 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function Ag(n,e){let t=!1,s;for(n<=Yh?(s=n,t=!0):s=Vc(n,Math.floor(Math.sqrt(n)));!t;)s>e||s===n?t=!0:s=Vc(n,s+1);return s}function Dg(n,e,t){const s=[],o=n.length;for(let r=0;ro))throw new Error(`Expect batchDims in the range of [-${o}, ${o}], but got ${s}`);if(s<0&&(s+=o),s>r)throw new Error(`batchDims (${s}) must be less than rank(x) ( - ${r}).`);if(te||s===n?t=!0:s=Bc(n,s+1);return s}function Dg(n,e,t){const s=[],o=n.length;for(let r=0;ro))throw new Error(`Expect batchDims in the range of [-${o}, ${o}], but got ${s}`);if(s<0&&(s+=o),s>r)throw new Error(`batchDims (${s}) must be less than rank(x) ( + ${r}).`);if(tys(e))}catch(e){throw new Error(`Failed to decode encoded string bytes into utf-8, error: ${e}`)}}function Fg(n){return n.map(e=>bs(e))}var k2=Object.freeze({__proto__:null,ERF_A1:td,ERF_A2:nd,ERF_A3:sd,ERF_A4:od,ERF_A5:rd,ERF_P:ed,PARALLELIZE_THRESHOLD:Yh,get RowPartitionType(){return En},SELU_SCALE:Fl,SELU_SCALEALPHA:Dl,applyActivation:_h,assertAndGetBroadcastShape:Ce,assertAxesAreInnerMostDims:$t,assertParamsConsistent:Xh,assignToTypedArray:mg,axesAreInnerMostDims:lh,calculateShapes:ho,checkEinsumDimSizes:ud,checkPadOnDimRoundingMode:Ut,combineLocations:fm,combineRaggedTensorToTensorShapes:lg,complexWithEvenIndex:pg,complexWithOddIndex:fg,computeConv2DInfo:Ct,computeConv3DInfo:Is,computeDefaultPad:Ju,computeDilation2DInfo:bi,computeOptimalWindowSize:Al,computeOutAndReduceShapes:bt,computeOutShape:Hn,computePool2DInfo:pn,computePool3DInfo:rs,convertConv2DDataFormat:is,decodeEinsumEquation:ld,eitherStridesOrDilationsAreOne:Et,expandShapeToKeepDim:at,exponent:xg,exponents:gg,fromStringArrayToUint8:Fg,fromUint8ToStringArray:us,getAxesPermutation:Ze,getBroadcastDims:qo,getComplexWithIndex:id,getEinsumComputePath:hd,getEinsumPermutation:cd,getFusedBiasGradient:Fh,getFusedDyActivation:Dh,getImageCenter:Zh,getInnerMostAxes:nt,getPermuted:Ri,getRaggedRank:ug,getReductionAxes:ut,getReshaped:Ei,getReshapedPermuted:Ai,getRowPartitionTypesHelper:cg,getSliceBeginCoords:Qh,getSliceSize:Jh,getSparseFillEmptyRowsIndicesDenseShapeMismatch:wg,getSparseFillEmptyRowsNegativeIndexErrorMessage:Cg,getSparseFillEmptyRowsOutOfRangeIndexErrorMessage:Ig,getSparseReshapeEmptyTensorZeroOutputDimErrorMessage:vg,getSparseReshapeInputOutputMismatchErrorMessage:Tg,getSparseReshapeInputOutputMultipleErrorMessage:Sg,getSparseReshapeMultipleNegativeOneOutputDimErrorMessage:$g,getSparseReshapeNegativeOutputDimErrorMessage:kg,getSparseSegmentReductionIndicesOutOfRangeErrorMessage:Rg,getSparseSegmentReductionNegativeSegmentIdsErrorMessage:fd,getSparseSegmentReductionNonIncreasingSegmentIdsErrorMessage:Ng,getSparseSegmentReductionSegmentIdOutOfRangeErrorMessage:Eg,getUndoAxesPermutation:$s,isIdentityPermutation:dd,log:Bw,mergeRealAndImagArrays:cs,prepareAndValidate:Wh,prepareSplitSize:pd,segment_util:$2,shouldFuse:Oh,slice_util:b2,splitRealAndImagArrays:dg,stridesOrDilationsArePositive:oo,tupleValuesAreOne:so,upcastType:Yt,validateDefaultValueShape:hg,validateInput:Kv,validateUpdateShape:Fm,warn:tn});/** + */function us(n){try{return n.map(e=>ys(e))}catch(e){throw new Error(`Failed to decode encoded string bytes into utf-8, error: ${e}`)}}function Fg(n){return n.map(e=>bs(e))}var $2=Object.freeze({__proto__:null,ERF_A1:Jh,ERF_A2:ed,ERF_A3:td,ERF_A4:nd,ERF_A5:sd,ERF_P:Qh,PARALLELIZE_THRESHOLD:Kh,get RowPartitionType(){return En},SELU_SCALE:Fl,SELU_SCALEALPHA:Dl,applyActivation:Dh,assertAndGetBroadcastShape:Ce,assertAxesAreInnerMostDims:$t,assertParamsConsistent:jh,assignToTypedArray:mg,axesAreInnerMostDims:ih,calculateShapes:ho,checkEinsumDimSizes:ld,checkPadOnDimRoundingMode:Ut,combineLocations:fm,combineRaggedTensorToTensorShapes:lg,complexWithEvenIndex:pg,complexWithOddIndex:fg,computeConv2DInfo:Ct,computeConv3DInfo:Is,computeDefaultPad:Zu,computeDilation2DInfo:bi,computeOptimalWindowSize:Al,computeOutAndReduceShapes:bt,computeOutShape:Hn,computePool2DInfo:pn,computePool3DInfo:rs,convertConv2DDataFormat:is,decodeEinsumEquation:id,eitherStridesOrDilationsAreOne:Et,expandShapeToKeepDim:at,exponent:xg,exponents:gg,fromStringArrayToUint8:Fg,fromUint8ToStringArray:us,getAxesPermutation:Ze,getBroadcastDims:qo,getComplexWithIndex:od,getEinsumComputePath:cd,getEinsumPermutation:ad,getFusedBiasGradient:Ah,getFusedDyActivation:Rh,getImageCenter:Xh,getInnerMostAxes:nt,getPermuted:Ri,getRaggedRank:ug,getReductionAxes:ut,getReshaped:Ei,getReshapedPermuted:Ai,getRowPartitionTypesHelper:cg,getSliceBeginCoords:Yh,getSliceSize:Zh,getSparseFillEmptyRowsIndicesDenseShapeMismatch:wg,getSparseFillEmptyRowsNegativeIndexErrorMessage:Cg,getSparseFillEmptyRowsOutOfRangeIndexErrorMessage:Ig,getSparseReshapeEmptyTensorZeroOutputDimErrorMessage:vg,getSparseReshapeInputOutputMismatchErrorMessage:Tg,getSparseReshapeInputOutputMultipleErrorMessage:Sg,getSparseReshapeMultipleNegativeOneOutputDimErrorMessage:$g,getSparseReshapeNegativeOutputDimErrorMessage:kg,getSparseSegmentReductionIndicesOutOfRangeErrorMessage:Rg,getSparseSegmentReductionNegativeSegmentIdsErrorMessage:dd,getSparseSegmentReductionNonIncreasingSegmentIdsErrorMessage:Ng,getSparseSegmentReductionSegmentIdOutOfRangeErrorMessage:Eg,getUndoAxesPermutation:$s,isIdentityPermutation:ud,log:Pw,mergeRealAndImagArrays:cs,prepareAndValidate:zh,prepareSplitSize:hd,segment_util:I2,shouldFuse:Fh,slice_util:x2,splitRealAndImagArrays:dg,stridesOrDilationsArePositive:oo,tupleValuesAreOne:so,upcastType:Yt,validateDefaultValueShape:hg,validateInput:jv,validateUpdateShape:Fm,warn:tn});/** * @license * Copyright 2017 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -3791,7 +3791,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */a2();/** + */i2();/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -3821,7 +3821,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const v2={kernelName:wr,inputsToSave:["x"],gradFunc:(n,e)=>{const[t]=e;return{x:()=>{const s=qe(re(t,"float32")),o=Rt(be(De(1),s));return st(me(n,o))}}}};/** + */const k2={kernelName:wr,inputsToSave:["x"],gradFunc:(n,e)=>{const[t]=e;return{x:()=>{const s=qe(re(t,"float32")),o=Rt(be(De(1),s));return st(me(n,o))}}}};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -3836,7 +3836,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const S2={kernelName:Cr,inputsToSave:["x"],gradFunc:(n,e)=>{const[t]=e;return{x:()=>{const s=Rt(be(qe(re(t,"float32")),1));return me(n,s)}}}};/** + */const v2={kernelName:Cr,inputsToSave:["x"],gradFunc:(n,e)=>{const[t]=e;return{x:()=>{const s=Rt(be(qe(re(t,"float32")),1));return me(n,s)}}}};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -3851,7 +3851,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const T2={kernelName:Lo,inputsToSave:["a","b"],gradFunc:(n,e)=>{const[t,s]=e,o=Ce(t.shape,s.shape);return{a:()=>{let a=n;const l=ut(t.shape,o);return l.length>0&&(a=de(a,l)),O(a,t.shape)},b:()=>{let a=n;const l=ut(s.shape,o);return l.length>0&&(a=de(a,l)),O(a,s.shape)}}}};/** + */const S2={kernelName:Lo,inputsToSave:["a","b"],gradFunc:(n,e)=>{const[t,s]=e,o=Ce(t.shape,s.shape);return{a:()=>{let a=n;const l=ut(t.shape,o);return l.length>0&&(a=de(a,l)),O(a,t.shape)},b:()=>{let a=n;const l=ut(s.shape,o);return l.length>0&&(a=de(a,l)),O(a,s.shape)}}}};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -3866,7 +3866,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const N2={kernelName:qc,saveAllInputs:!0,gradFunc:(n,e)=>{const t={};return e.forEach((s,o)=>{t[o]=()=>n.clone()}),t}};/** + */const T2={kernelName:Gc,saveAllInputs:!0,gradFunc:(n,e)=>{const t={};return e.forEach((s,o)=>{t[o]=()=>n.clone()}),t}};/** * @license * Copyright 2020 Google Inc. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -3881,7 +3881,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const E2={kernelName:ua,inputsToSave:["x"],gradFunc:(n,e)=>{const[t]=e;return{x:()=>Ne(t)}}};/** + */const N2={kernelName:ua,inputsToSave:["x"],gradFunc:(n,e)=>{const[t]=e;return{x:()=>Ne(t)}}};/** * @license * Copyright 2020 Google Inc. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -3896,7 +3896,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const R2={kernelName:ha,inputsToSave:["x"],gradFunc:(n,e)=>{const[t]=e;return{x:()=>Ne(t)}}};/** + */const E2={kernelName:ha,inputsToSave:["x"],gradFunc:(n,e)=>{const[t]=e;return{x:()=>Ne(t)}}};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -3911,7 +3911,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const A2={kernelName:Ir,inputsToSave:["x"],gradFunc:(n,e)=>{const[t]=e;return{x:()=>me(n,Rt(be(De(1),qe(re(t,"float32")))))}}};/** + */const R2={kernelName:Ir,inputsToSave:["x"],gradFunc:(n,e)=>{const[t]=e;return{x:()=>me(n,Rt(be(De(1),qe(re(t,"float32")))))}}};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -3926,7 +3926,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const D2={kernelName:$r,inputsToSave:["x"],gradFunc:(n,e)=>{const[t]=e;return{x:()=>{const s=Rt(J(De(1),qe(re(t,"float32"))));return me(n,s)}}}};/** + */const A2={kernelName:$r,inputsToSave:["x"],gradFunc:(n,e)=>{const[t]=e;return{x:()=>{const s=Rt(J(De(1),qe(re(t,"float32"))));return me(n,s)}}}};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -3941,7 +3941,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const F2={kernelName:Sr,inputsToSave:["a","b"],gradFunc:(n,e)=>{const[t,s]=e,o=Ce(t.shape,s.shape);return{a:()=>{const a=J(qe(t),qe(s));let l=D(n,me(s,a));const c=ut(t.shape,o);return c.length>0&&(l=de(l,c)),O(l,t.shape)},b:()=>{const a=J(qe(t),qe(s));let l=st(D(n,me(t,a)));const c=ut(s.shape,o);return c.length>0&&(l=de(l,c)),O(l,s.shape)}}}};/** + */const D2={kernelName:Sr,inputsToSave:["a","b"],gradFunc:(n,e)=>{const[t,s]=e,o=Ce(t.shape,s.shape);return{a:()=>{const a=J(qe(t),qe(s));let l=D(n,me(s,a));const c=ut(t.shape,o);return c.length>0&&(l=de(l,c)),O(l,t.shape)},b:()=>{const a=J(qe(t),qe(s));let l=st(D(n,me(t,a)));const c=ut(s.shape,o);return c.length>0&&(l=de(l,c)),O(l,s.shape)}}}};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -3956,7 +3956,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const _2={kernelName:kr,inputsToSave:["x"],gradFunc:(n,e)=>{const[t]=e;return{x:()=>me(n,J(qe(re(t,"float32")),1))}}};/** + */const F2={kernelName:kr,inputsToSave:["x"],gradFunc:(n,e)=>{const[t]=e;return{x:()=>me(n,J(qe(re(t,"float32")),1))}}};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -3971,7 +3971,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const O2={kernelName:vr,inputsToSave:["x"],gradFunc:(n,e)=>{const[t]=e;return{x:()=>me(n,be(De(1),qe(re(t,"float32"))))}}};/** + */const _2={kernelName:vr,inputsToSave:["x"],gradFunc:(n,e)=>{const[t]=e;return{x:()=>me(n,be(De(1),qe(re(t,"float32"))))}}};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -3986,7 +3986,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function L2(n,e,t,s,o,r){const i=T(n,"dy","avgPool3dGrad"),a=T(e,"input","avgPool3dGrad");let l=i,c=a,u=!1;a.rank===4&&(u=!0,l=O(i,[1,i.shape[0],i.shape[1],i.shape[2],i.shape[3]]),c=O(a,[1,a.shape[0],a.shape[1],a.shape[2],a.shape[3]])),v(l.rank===5,()=>`Error in avgPool3dGrad: dy must be rank 5 but got rank ${l.rank}.`),v(c.rank===5,()=>`Error in avgPool3dGrad: input must be rank 5 but got rank ${c.rank}.`),Ut("avgPool3dGrad",o,r);const h={dy:l,input:c},d={filterSize:t,strides:s,pad:o,dimRoundingMode:r},p=F.runKernel(Yc,h,d);return u?O(p,[p.shape[1],p.shape[2],p.shape[3],p.shape[4]]):p}const M2=L({avgPool3dGrad_:L2});/** + */function O2(n,e,t,s,o,r){const i=T(n,"dy","avgPool3dGrad"),a=T(e,"input","avgPool3dGrad");let l=i,c=a,u=!1;a.rank===4&&(u=!0,l=O(i,[1,i.shape[0],i.shape[1],i.shape[2],i.shape[3]]),c=O(a,[1,a.shape[0],a.shape[1],a.shape[2],a.shape[3]])),k(l.rank===5,()=>`Error in avgPool3dGrad: dy must be rank 5 but got rank ${l.rank}.`),k(c.rank===5,()=>`Error in avgPool3dGrad: input must be rank 5 but got rank ${c.rank}.`),Ut("avgPool3dGrad",o,r);const h={dy:l,input:c},d={filterSize:t,strides:s,pad:o,dimRoundingMode:r},p=F.runKernel(Kc,h,d);return u?O(p,[p.shape[1],p.shape[2],p.shape[3],p.shape[4]]):p}const L2=L({avgPool3dGrad_:O2});/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -4001,7 +4001,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const P2={kernelName:pa,inputsToSave:["x"],gradFunc:(n,e,t)=>{const[s]=e,{filterSize:o,strides:r,pad:i,dimRoundingMode:a}=t;return{x:()=>M2(n,s,o,r,i,a)}}};/** + */const M2={kernelName:pa,inputsToSave:["x"],gradFunc:(n,e,t)=>{const[s]=e,{filterSize:o,strides:r,pad:i,dimRoundingMode:a}=t;return{x:()=>L2(n,s,o,r,i,a)}}};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -4016,7 +4016,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function B2(n,e,t,s,o){const r=T(n,"dy","avgPoolGrad"),i=T(e,"input","avgPoolGrad");v(i.rank===r.rank,()=>`Rank of input (${i.rank}) does not match rank of dy (${r.rank})`);let a=i,l=r,c=!1;i.rank===3&&(c=!0,a=O(i,[1,i.shape[0],i.shape[1],i.shape[2]]),l=O(r,[1,r.shape[0],r.shape[1],r.shape[2]])),v(l.rank===4,()=>`Error in avgPoolGrad: dy must be rank 4 but got rank ${l.rank}.`),v(a.rank===4,()=>`Error in avgPoolGrad: input must be rank 4 but got rank ${a.rank}.`);const u={dy:l,input:a},h={filterSize:t,strides:s,pad:o},d=F.runKernel(Xc,u,h);return c?O(d,[d.shape[1],d.shape[2],d.shape[3]]):d}const z2=L({avgPoolGrad_:B2});/** + */function P2(n,e,t,s,o){const r=T(n,"dy","avgPoolGrad"),i=T(e,"input","avgPoolGrad");k(i.rank===r.rank,()=>`Rank of input (${i.rank}) does not match rank of dy (${r.rank})`);let a=i,l=r,c=!1;i.rank===3&&(c=!0,a=O(i,[1,i.shape[0],i.shape[1],i.shape[2]]),l=O(r,[1,r.shape[0],r.shape[1],r.shape[2]])),k(l.rank===4,()=>`Error in avgPoolGrad: dy must be rank 4 but got rank ${l.rank}.`),k(a.rank===4,()=>`Error in avgPoolGrad: input must be rank 4 but got rank ${a.rank}.`);const u={dy:l,input:a},h={filterSize:t,strides:s,pad:o},d=F.runKernel(jc,u,h);return c?O(d,[d.shape[1],d.shape[2],d.shape[3]]):d}const B2=L({avgPoolGrad_:P2});/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -4031,7 +4031,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const V2={kernelName:da,inputsToSave:["x"],gradFunc:(n,e,t)=>{const[s]=e,{filterSize:o,strides:r,pad:i}=t;return{x:()=>z2(n,s,o,r,i)}}};/** + */const z2={kernelName:da,inputsToSave:["x"],gradFunc:(n,e,t)=>{const[s]=e,{filterSize:o,strides:r,pad:i}=t;return{x:()=>B2(n,s,o,r,i)}}};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -4046,7 +4046,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const W2={kernelName:fa,inputsToSave:["a","b"],gradFunc:(n,e,t)=>{const[s,o]=e,{transposeA:r,transposeB:i}=t;return!r&&!i?{a:()=>Ae(n,o,!1,!0),b:()=>Ae(s,n,!0,!1)}:!r&&i?{a:()=>Ae(n,o,!1,!1),b:()=>Ae(n,s,!0,!1)}:r&&!i?{a:()=>Ae(o,n,!1,!0),b:()=>Ae(s,n,!1,!1)}:{a:()=>Ae(o,n,!0,!0),b:()=>Ae(n,s,!0,!0)}}};/** + */const V2={kernelName:fa,inputsToSave:["a","b"],gradFunc:(n,e,t)=>{const[s,o]=e,{transposeA:r,transposeB:i}=t;return!r&&!i?{a:()=>Ae(n,o,!1,!0),b:()=>Ae(s,n,!0,!1)}:!r&&i?{a:()=>Ae(n,o,!1,!1),b:()=>Ae(n,s,!0,!1)}:r&&!i?{a:()=>Ae(o,n,!1,!0),b:()=>Ae(s,n,!1,!1)}:{a:()=>Ae(o,n,!0,!0),b:()=>Ae(n,s,!0,!0)}}};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -4061,7 +4061,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const U2={kernelName:ma,gradFunc:(n,e,t)=>{const{blockShape:s,crops:o}=t;return{x:()=>gh(n,s,o)}}};/** + */const W2={kernelName:ma,gradFunc:(n,e,t)=>{const{blockShape:s,crops:o}=t;return{x:()=>fh(n,s,o)}}};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -4076,7 +4076,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const G2={kernelName:Ow,gradFunc:(n,e,t)=>{const s=t,o=s.inputShape,r=s.shape,i=Array.from(r);for(let l=o.length-1;l>=0;l--)if(o[l]===r[l])i[l]=1;else if(o[l]!==1)throw new Error(`broadcastTo(): [${o}] cannot be broadcast to [${r}].`);const a=[];for(let l=0;l1&&a.push(l);return{x:()=>de(n,a,!0)}}};/** + */const U2={kernelName:_w,gradFunc:(n,e,t)=>{const s=t,o=s.inputShape,r=s.shape,i=Array.from(r);for(let l=o.length-1;l>=0;l--)if(o[l]===r[l])i[l]=1;else if(o[l]!==1)throw new Error(`broadcastTo(): [${o}] cannot be broadcast to [${r}].`);const a=[];for(let l=0;l1&&a.push(l);return{x:()=>de(n,a,!0)}}};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -4091,7 +4091,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const H2={kernelName:Tr,gradFunc:n=>({x:()=>n.clone()})};/** + */const G2={kernelName:Tr,gradFunc:n=>({x:()=>n.clone()})};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -4106,7 +4106,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const q2={kernelName:Nr,gradFunc:n=>({x:()=>Ne(n)})};/** + */const H2={kernelName:Nr,gradFunc:n=>({x:()=>Ne(n)})};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -4121,7 +4121,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const j2={kernelName:Er,inputsToSave:["x"],gradFunc:(n,e,t)=>{const[s]=e,{clipValueMin:o,clipValueMax:r}=t;return{x:()=>It(as(ao(s,o),jo(s,r)),n,Ne(n))}}};/** + */const q2={kernelName:Er,inputsToSave:["x"],gradFunc:(n,e,t)=>{const[s]=e,{clipValueMin:o,clipValueMax:r}=t;return{x:()=>It(as(ao(s,o),jo(s,r)),n,Ne(n))}}};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -4136,7 +4136,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const K2={kernelName:ga,inputsToSave:["x"],gradFunc:_g.gradFunc};/** + */const j2={kernelName:ga,inputsToSave:["x"],gradFunc:_g.gradFunc};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -4151,7 +4151,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const X2={kernelName:xa,saveAllInputs:!0,gradFunc:(n,e,t)=>{const s=e.map(l=>l.shape),{axis:o}=t,r=$e(o,e[0].shape)[0],i=s.map(l=>l[r]);return sn(n,i,r).map(l=>()=>l)}};/** + */const K2={kernelName:xa,saveAllInputs:!0,gradFunc:(n,e,t)=>{const s=e.map(l=>l.shape),{axis:o}=t,r=$e(o,e[0].shape)[0],i=s.map(l=>l[r]);return sn(n,i,r).map(l=>()=>l)}};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -4166,7 +4166,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const Y2={kernelName:ba,inputsToSave:["x","filter"],gradFunc:(n,e,t)=>{const[s,o]=e,{dilations:r,strides:i,pad:a,dataFormat:l}=t;return v(so(r),()=>`Error in gradient of conv2D: dilation rates greater than 1 are not yet supported in gradients. Got dilations '${r}'`),{x:()=>sh(s.shape,n,o,i,a,l),filter:()=>Ah(s,n,o.shape,i,a,l)}}};/** + */const X2={kernelName:ba,inputsToSave:["x","filter"],gradFunc:(n,e,t)=>{const[s,o]=e,{dilations:r,strides:i,pad:a,dataFormat:l}=t;return k(so(r),()=>`Error in gradient of conv2D: dilation rates greater than 1 are not yet supported in gradients. Got dilations '${r}'`),{x:()=>th(s.shape,n,o,i,a,l),filter:()=>Eh(s,n,o.shape,i,a,l)}}};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -4181,7 +4181,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const Z2={kernelName:ya,inputsToSave:["dy","filter"],gradFunc:(n,e,t)=>{const[s,o]=e,{strides:r,pad:i,dataFormat:a,dimRoundingMode:l}=t;return{dy:()=>ro(n,o,r,i,a,1,l),filter:()=>Ah(n,s,o.shape,r,i,a,l)}}};/** + */const Y2={kernelName:ya,inputsToSave:["dy","filter"],gradFunc:(n,e,t)=>{const[s,o]=e,{strides:r,pad:i,dataFormat:a,dimRoundingMode:l}=t;return{dy:()=>ro(n,o,r,i,a,1,l),filter:()=>Eh(n,s,o.shape,r,i,a,l)}}};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -4196,7 +4196,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function Q2(n,e,t,s,o){let r=n;n.rank===4&&(r=O(n,[1,n.shape[0],n.shape[1],n.shape[2],n.shape[3]]));let i=e;i.rank===4&&(i=O(e,[1,e.shape[0],e.shape[1],e.shape[2],e.shape[3]])),v(r.rank===5,()=>`Error in conv3dDerFilter: input must be rank 5, but got shape ${r.shape}.`),v(i.rank===5,()=>`Error in conv3dDerFilter: dy must be rank 5, but got shape ${i.shape}.`),v(t.length===5,()=>`Error in conv3dDerFilter: filterShape must be length 5, but got ${t}.`),v(r.shape[4]===t[3],()=>`Error in conv3dDerFilter: depth of input ${r.shape[4]}) must match input depth in filter (${t[3]}.`),v(i.shape[4]===t[4],()=>`Error in conv3dDerFilter: depth of dy (${i.shape[4]}) must match output depth for filter (${t[4]}).`);const a={x:r,dy:i},l={strides:s,pad:o,filterShape:t};return F.runKernel(tu,a,l)}const J2=L({conv3DBackpropFilter_:Q2});/** + */function Z2(n,e,t,s,o){let r=n;n.rank===4&&(r=O(n,[1,n.shape[0],n.shape[1],n.shape[2],n.shape[3]]));let i=e;i.rank===4&&(i=O(e,[1,e.shape[0],e.shape[1],e.shape[2],e.shape[3]])),k(r.rank===5,()=>`Error in conv3dDerFilter: input must be rank 5, but got shape ${r.shape}.`),k(i.rank===5,()=>`Error in conv3dDerFilter: dy must be rank 5, but got shape ${i.shape}.`),k(t.length===5,()=>`Error in conv3dDerFilter: filterShape must be length 5, but got ${t}.`),k(r.shape[4]===t[3],()=>`Error in conv3dDerFilter: depth of input ${r.shape[4]}) must match input depth in filter (${t[3]}.`),k(i.shape[4]===t[4],()=>`Error in conv3dDerFilter: depth of dy (${i.shape[4]}) must match output depth for filter (${t[4]}).`);const a={x:r,dy:i},l={strides:s,pad:o,filterShape:t};return F.runKernel(Jc,a,l)}const Q2=L({conv3DBackpropFilter_:Z2});/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -4211,7 +4211,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const eT={kernelName:wa,inputsToSave:["x","filter"],gradFunc:(n,e,t)=>{const{dilations:s,strides:o,pad:r}=t;v(so(s),()=>`Error in gradient of conv3D: dilation rates greater than 1 are not yet supported in gradients. Got dilations '${s}'`);const[i,a]=e;return{x:()=>cm(i.shape,n,a,o,r),filter:()=>J2(i,n,a.shape,o,r)}}};/** + */const J2={kernelName:wa,inputsToSave:["x","filter"],gradFunc:(n,e,t)=>{const{dilations:s,strides:o,pad:r}=t;k(so(s),()=>`Error in gradient of conv3D: dilation rates greater than 1 are not yet supported in gradients. Got dilations '${s}'`);const[i,a]=e;return{x:()=>cm(i.shape,n,a,o,r),filter:()=>Q2(i,n,a.shape,o,r)}}};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -4226,7 +4226,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const tT={kernelName:Rr,inputsToSave:["x"],gradFunc:(n,e)=>{const[t]=e;return{x:()=>D(st(Em(re(t,"float32"))),n)}}};/** + */const eT={kernelName:Rr,inputsToSave:["x"],gradFunc:(n,e)=>{const[t]=e;return{x:()=>D(st(Em(re(t,"float32"))),n)}}};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -4241,7 +4241,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const nT={kernelName:Ar,inputsToSave:["x"],gradFunc:(n,e)=>{const[t]=e;return{x:()=>D(Rm(re(t,"float32")),n)}}};/** + */const tT={kernelName:Ar,inputsToSave:["x"],gradFunc:(n,e)=>{const[t]=e;return{x:()=>D(Rm(re(t,"float32")),n)}}};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -4256,7 +4256,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const sT={kernelName:Ca,inputsToSave:["x"],gradFunc:(n,e,t)=>{const[s]=e,{axis:o,exclusive:r,reverse:i}=t;return{x:()=>{const a=Ze([o],s.rank);let l=hm(n,o,r,!i);return a!=null&&(l=Ee(l,a)),l}}}};/** + */const nT={kernelName:Ca,inputsToSave:["x"],gradFunc:(n,e,t)=>{const[s]=e,{axis:o,exclusive:r,reverse:i}=t;return{x:()=>{const a=Ze([o],s.rank);let l=hm(n,o,r,!i);return a!=null&&(l=Ee(l,a)),l}}}};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -4271,7 +4271,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const oT={kernelName:Ia,inputsToSave:["x","filter"],gradFunc:(n,e,t)=>{const{dilations:s,strides:o,pad:r,dimRoundingMode:i}=t,a=s??[1,1];v(so(a),()=>`Error in gradient of depthwiseConv2dNative: dilation rates greater than 1 are not yet supported. Got dilations '${a}'`);const[l,c]=e;return v(l.rank===4,()=>`Error in gradient of depthwiseConv2dNative: input must be rank 4, but got rank ${l.rank}.`),v(c.rank===4,()=>`Error in gradient of depthwiseConv2dNative: filter must be rank 4, but got rank ${c.rank}.`),v(l.shape[3]===c.shape[2],()=>`Error in gradient of depthwiseConv2d: number of input channels (${l.shape[3]}) must match the inChannels dimension in filter ${c.shape[2]}.`),v(Et(o,a),()=>`Error in gradient of depthwiseConv2d: Either strides or dilations must be 1. Got strides ${o} and dilations '${a}'.`),Ut("depthwiseConv2d",r,i),{x:()=>fS(l.shape,n,c,o,r,a,i),filter:()=>dS(l,n,c.shape,o,r,a,i)}}};/** + */const sT={kernelName:Ia,inputsToSave:["x","filter"],gradFunc:(n,e,t)=>{const{dilations:s,strides:o,pad:r,dimRoundingMode:i}=t,a=s??[1,1];k(so(a),()=>`Error in gradient of depthwiseConv2dNative: dilation rates greater than 1 are not yet supported. Got dilations '${a}'`);const[l,c]=e;return k(l.rank===4,()=>`Error in gradient of depthwiseConv2dNative: input must be rank 4, but got rank ${l.rank}.`),k(c.rank===4,()=>`Error in gradient of depthwiseConv2dNative: filter must be rank 4, but got rank ${c.rank}.`),k(l.shape[3]===c.shape[2],()=>`Error in gradient of depthwiseConv2d: number of input channels (${l.shape[3]}) must match the inChannels dimension in filter ${c.shape[2]}.`),k(Et(o,a),()=>`Error in gradient of depthwiseConv2d: Either strides or dilations must be 1. Got strides ${o} and dilations '${a}'.`),Ut("depthwiseConv2d",r,i),{x:()=>pS(l.shape,n,c,o,r,a,i),filter:()=>hS(l,n,c.shape,o,r,a,i)}}};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -4286,7 +4286,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const rT={kernelName:$a,inputsToSave:["x","filter"],gradFunc:(n,e,t)=>{const[s,o]=e,r={x:s,filter:o,dy:n},i={x:s,filter:o,dy:n};return{x:()=>F.runKernel(cu,r,t),filter:()=>F.runKernel(uu,i,t)}}};/** + */const oT={kernelName:$a,inputsToSave:["x","filter"],gradFunc:(n,e,t)=>{const[s,o]=e,r={x:s,filter:o,dy:n},i={x:s,filter:o,dy:n};return{x:()=>F.runKernel(au,r,t),filter:()=>F.runKernel(lu,i,t)}}};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -4301,7 +4301,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const iT={kernelName:Fr,outputsToSave:[!0],gradFunc:(n,e)=>{const[t]=e,s={dy:n,y:t};return{x:()=>F.runKernel(du,s)}}};/** + */const rT={kernelName:Fr,outputsToSave:[!0],gradFunc:(n,e)=>{const[t]=e,s={dy:n,y:t};return{x:()=>F.runKernel(uu,s)}}};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -4316,7 +4316,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const aT={kernelName:_r,inputsToSave:["x"],gradFunc:(n,e)=>{const[t]=e,s=D(Vn(st(qe(t))),2/Math.sqrt(Math.PI));return{x:()=>D(n,s)}}};/** + */const iT={kernelName:_r,inputsToSave:["x"],gradFunc:(n,e)=>{const[t]=e,s=D(Vn(st(qe(t))),2/Math.sqrt(Math.PI));return{x:()=>D(n,s)}}};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -4331,7 +4331,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const lT={kernelName:Or,outputsToSave:[!0],gradFunc:(n,e)=>{const[t]=e;return{x:()=>D(n,t)}}};/** + */const aT={kernelName:Or,outputsToSave:[!0],gradFunc:(n,e)=>{const[t]=e;return{x:()=>D(n,t)}}};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -4346,7 +4346,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const cT={kernelName:va,inputsToSave:["input"],gradFunc:(n,e)=>{const[t]=e;return{input:()=>O(n,t.shape)}}};/** + */const lT={kernelName:va,inputsToSave:["input"],gradFunc:(n,e)=>{const[t]=e;return{input:()=>O(n,t.shape)}}};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -4361,7 +4361,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const uT={kernelName:Lr,inputsToSave:["x"],gradFunc:(n,e)=>{const[t]=e;return{x:()=>D(n,Vn(t))}}};/** + */const cT={kernelName:Lr,inputsToSave:["x"],gradFunc:(n,e)=>{const[t]=e;return{x:()=>D(n,Vn(t))}}};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -4376,7 +4376,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const hT={kernelName:Mr,gradFunc:n=>({x:()=>Ne(n)})};/** + */const uT={kernelName:Mr,gradFunc:n=>({x:()=>Ne(n)})};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -4391,7 +4391,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const dT={kernelName:Pr,inputsToSave:["a","b"],gradFunc:(n,e)=>{const[t,s]=e,o=Ce(t.shape,s.shape);return{a:()=>{const a=me(n,re(s,"float32")),l=ut(t.shape,o);return l.length>0?O(de(a,l),t.shape):a},b:()=>{let a=D(n,re(t,"float32"));const l=ut(s.shape,o);l.length>0&&(a=O(de(a,l),s.shape));const c=qe(s);return st(me(a,re(c,"float32")))}}}};/** + */const hT={kernelName:Pr,inputsToSave:["a","b"],gradFunc:(n,e)=>{const[t,s]=e,o=Ce(t.shape,s.shape);return{a:()=>{const a=me(n,re(s,"float32")),l=ut(t.shape,o);return l.length>0?O(de(a,l),t.shape):a},b:()=>{let a=D(n,re(t,"float32"));const l=ut(s.shape,o);l.length>0&&(a=O(de(a,l),s.shape));const c=qe(s);return st(me(a,re(c,"float32")))}}}};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -4406,7 +4406,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const pT={kernelName:Sa,inputsToSave:["x","mean","variance","scale"],gradFunc:(n,e,t)=>{const{varianceEpsilon:s}=t,[o,r,i,a]=e,l=a??De(1),c=ut(r.shape,o.shape),u=[];if(r.rank===1){for(let y=0;yr.rank===1?O(D(D(n,Tn(O(p,[1,1,1,r.shape[0]]),u)),l),o.shape):O(D(D(n,p),l),o.shape),mean:()=>{let y=D(D(p,De(-1)),d);return r.rank===1&&(y=de(y,c)),O(y,r.shape)},variance:()=>{let y=D(D(f,h),d);return r.rank===1&&(y=de(y,c)),O(y,r.shape)},scale:()=>{const y=D(h,p);let C=D(n,y);return r.rank===1&&(C=de(C,c)),O(C,r.shape)},offset:()=>{let y=n;return r.rank===1&&(y=de(y,c)),O(y,r.shape)}}}};/** + */const dT={kernelName:Sa,inputsToSave:["x","mean","variance","scale"],gradFunc:(n,e,t)=>{const{varianceEpsilon:s}=t,[o,r,i,a]=e,l=a??De(1),c=ut(r.shape,o.shape),u=[];if(r.rank===1){for(let y=0;yr.rank===1?O(D(D(n,Tn(O(p,[1,1,1,r.shape[0]]),u)),l),o.shape):O(D(D(n,p),l),o.shape),mean:()=>{let y=D(D(p,De(-1)),d);return r.rank===1&&(y=de(y,c)),O(y,r.shape)},variance:()=>{let y=D(D(f,h),d);return r.rank===1&&(y=de(y,c)),O(y,r.shape)},scale:()=>{const y=D(h,p);let C=D(n,y);return r.rank===1&&(C=de(C,c)),O(C,r.shape)},offset:()=>{let y=n;return r.rank===1&&(y=de(y,c)),O(y,r.shape)}}}};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -4421,7 +4421,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const fT={kernelName:Ta,inputsToSave:["x","indices"],gradFunc:(n,e,t)=>{const[s,o]=e,{axis:r,batchDims:i}=t,a=$e(r,s.shape)[0],l=(c,u,h)=>()=>{const d=c.shape,p=u.size,f=d.slice(0,a),m=f.length,g=d.slice(r,d.length).slice(1),x=g.length,b=Og(0,m),w=Og(m+1,m+1+x),y=Lg([f,[p],g]),C=O(h,y),I=O(u,[p]),$=Lg([[m],b,w]),k=Ee(C,$);let S=Om(k,I,c.shape[a]);const N=$s($);return S=Ee(S,N),S};if(i===1){const c=s.shape[0],u=s.split(c,0);return{x:()=>Un(u.map((p,f)=>l(p,o.slice(f,1),n.slice(f,1))())).reshape(s.shape),indices:()=>o}}else return{x:l(s,o,n),indices:()=>o}}};function Og(n,e){const t=[];for(let s=n;s{const[s,o]=e,{axis:r,batchDims:i}=t,a=$e(r,s.shape)[0],l=(c,u,h)=>()=>{const d=c.shape,p=u.size,f=d.slice(0,a),m=f.length,g=d.slice(r,d.length).slice(1),x=g.length,b=Og(0,m),w=Og(m+1,m+1+x),y=Lg([f,[p],g]),C=O(h,y),I=O(u,[p]),v=Lg([[m],b,w]),$=Ee(C,v);let S=Om($,I,c.shape[a]);const N=$s(v);return S=Ee(S,N),S};if(i===1){const c=s.shape[0],u=s.split(c,0);return{x:()=>Un(u.map((p,f)=>l(p,o.slice(f,1),n.slice(f,1))())).reshape(s.shape),indices:()=>o}}else return{x:l(s,o,n),indices:()=>o}}};function Og(n,e){const t=[];for(let s=n;s{const[t,s]=e;return{a:()=>Ne(t),b:()=>Ne(s)}}};/** + */const fT={kernelName:Br,inputsToSave:["a","b"],gradFunc:(n,e)=>{const[t,s]=e;return{a:()=>Ne(t),b:()=>Ne(s)}}};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -4451,7 +4451,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const gT={kernelName:zr,gradFunc:n=>({x:()=>re(n,"float32")})};/** + */const mT={kernelName:zr,gradFunc:n=>({x:()=>re(n,"float32")})};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -4466,7 +4466,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const xT={kernelName:Vr,gradFunc:n=>({x:()=>Ne(n)})};/** + */const gT={kernelName:Vr,gradFunc:n=>({x:()=>Ne(n)})};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -4481,7 +4481,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const bT={kernelName:Wr,gradFunc:n=>({x:()=>Ne(n)})};/** + */const xT={kernelName:Wr,gradFunc:n=>({x:()=>Ne(n)})};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -4496,7 +4496,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const yT={kernelName:Ur,gradFunc:n=>({x:()=>Ne(n)})};/** + */const bT={kernelName:Ur,gradFunc:n=>({x:()=>Ne(n)})};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -4511,7 +4511,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const wT={kernelName:Ea,inputsToSave:["x"],gradFunc:(n,e,t)=>{const[s]=e,{alpha:o}=t,r=Zt(s,0);return{x:()=>It(r,n,D(n,o))}}};/** + */const yT={kernelName:Ea,inputsToSave:["x"],gradFunc:(n,e,t)=>{const[s]=e,{alpha:o}=t,r=Zt(s,0);return{x:()=>It(r,n,D(n,o))}}};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -4526,7 +4526,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const CT={kernelName:Hr,inputsToSave:["x"],gradFunc:(n,e)=>{const[t]=e;return{x:()=>me(n,J(t,1))}}};/** + */const wT={kernelName:Hr,inputsToSave:["x"],gradFunc:(n,e)=>{const[t]=e;return{x:()=>me(n,J(t,1))}}};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -4541,7 +4541,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const IT={kernelName:Gr,inputsToSave:["x"],gradFunc:(n,e)=>{const[t]=e;return{x:()=>me(n,re(t,"float32"))}}};/** + */const CT={kernelName:Gr,inputsToSave:["x"],gradFunc:(n,e)=>{const[t]=e;return{x:()=>me(n,re(t,"float32"))}}};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -4556,7 +4556,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const $T={kernelName:Mw,inputsToSave:[],outputsToSave:[!0],gradFunc:(n,e,t)=>{const[s]=e,{axis:o}=t;return{logits:()=>{const i=Vn(s);return be(n,D(de(n,o,!0),i))}}}};/** + */const IT={kernelName:Lw,inputsToSave:[],outputsToSave:[!0],gradFunc:(n,e,t)=>{const[s]=e,{axis:o}=t;return{logits:()=>{const i=Vn(s);return be(n,D(de(n,o,!0),i))}}}};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -4571,7 +4571,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function kT(n,e,t,s=5,o=1,r=1,i=.5){const a={x:n,y:e,dy:t},l={depthRadius:s,bias:o,alpha:r,beta:i};return F.runKernel(bu,a,l)}const vT=L({localResponseNormalizationBackprop_:kT});/** + */function $T(n,e,t,s=5,o=1,r=1,i=.5){const a={x:n,y:e,dy:t},l={depthRadius:s,bias:o,alpha:r,beta:i};return F.runKernel(gu,a,l)}const kT=L({localResponseNormalizationBackprop_:$T});/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -4586,7 +4586,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const ST={kernelName:Oa,inputsToSave:["x"],outputsToSave:[!0],gradFunc:(n,e,t)=>{const[s,o]=e,{depthRadius:r,bias:i,alpha:a,beta:l}=t;return{x:()=>vT(s,o,n,r,i,a,l)}}};/** + */const vT={kernelName:Oa,inputsToSave:["x"],outputsToSave:[!0],gradFunc:(n,e,t)=>{const[s,o]=e,{depthRadius:r,bias:i,alpha:a,beta:l}=t;return{x:()=>kT(s,o,n,r,i,a,l)}}};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -4631,7 +4631,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const TT={kernelName:qr,inputsToSave:["a","b"],gradFunc:(n,e)=>{const[t,s]=e;return{a:()=>D(n,re(ao(t,s),"float32")),b:()=>D(n,re(Sl(t,s),"float32"))}}};/** + */const ST={kernelName:qr,inputsToSave:["a","b"],gradFunc:(n,e)=>{const[t,s]=e;return{a:()=>D(n,re(ao(t,s),"float32")),b:()=>D(n,re(Sl(t,s),"float32"))}}};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -4646,7 +4646,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function NT(n,e,t,s,o,r,i){const a=T(n,"dy","maxPool3dGrad"),l=T(e,"input","maxPool3dGrad"),c=T(t,"output","maxPool3dGrad");let u=a,h=l,d=c,p=!1;l.rank===4&&(p=!0,u=O(a,[1,a.shape[0],a.shape[1],a.shape[2],a.shape[3]]),h=O(l,[1,l.shape[0],l.shape[1],l.shape[2],l.shape[3]]),d=O(c,[1,c.shape[0],c.shape[1],c.shape[2],c.shape[3]])),v(u.rank===5,()=>`Error in maxPool3dGrad: dy must be rank 5 but got rank ${u.rank}.`),v(h.rank===5,()=>`Error in maxPool3dGrad: input must be rank 5 but got rank ${h.rank}.`),v(d.rank===5,()=>`Error in maxPool3dGrad: output must be rank 5 but got rank ${d.rank}.`),Ut("maxPool3dGrad",r,i);const f={dy:u,input:h,output:d},m={filterSize:s,strides:o,pad:r,dimRoundingMode:i},g=F.runKernel(wu,f,m);return p?O(g,[g.shape[1],g.shape[2],g.shape[3],g.shape[4]]):g}const ET=L({maxPool3dGrad_:NT});/** + */function TT(n,e,t,s,o,r,i){const a=T(n,"dy","maxPool3dGrad"),l=T(e,"input","maxPool3dGrad"),c=T(t,"output","maxPool3dGrad");let u=a,h=l,d=c,p=!1;l.rank===4&&(p=!0,u=O(a,[1,a.shape[0],a.shape[1],a.shape[2],a.shape[3]]),h=O(l,[1,l.shape[0],l.shape[1],l.shape[2],l.shape[3]]),d=O(c,[1,c.shape[0],c.shape[1],c.shape[2],c.shape[3]])),k(u.rank===5,()=>`Error in maxPool3dGrad: dy must be rank 5 but got rank ${u.rank}.`),k(h.rank===5,()=>`Error in maxPool3dGrad: input must be rank 5 but got rank ${h.rank}.`),k(d.rank===5,()=>`Error in maxPool3dGrad: output must be rank 5 but got rank ${d.rank}.`),Ut("maxPool3dGrad",r,i);const f={dy:u,input:h,output:d},m={filterSize:s,strides:o,pad:r,dimRoundingMode:i},g=F.runKernel(bu,f,m);return p?O(g,[g.shape[1],g.shape[2],g.shape[3],g.shape[4]]):g}const NT=L({maxPool3dGrad_:TT});/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -4661,7 +4661,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const RT={kernelName:Pa,inputsToSave:["x"],outputsToSave:[!0],gradFunc:(n,e,t)=>{const[s,o]=e,{filterSize:r,strides:i,pad:a,dimRoundingMode:l}=t;return{x:()=>ET(n,s,o,r,i,a,l)}}};/** + */const ET={kernelName:Pa,inputsToSave:["x"],outputsToSave:[!0],gradFunc:(n,e,t)=>{const[s,o]=e,{filterSize:r,strides:i,pad:a,dimRoundingMode:l}=t;return{x:()=>NT(n,s,o,r,i,a,l)}}};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -4676,7 +4676,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function AT(n,e,t,s,o,r,i){const a=T(n,"dy","maxPoolGrad"),l=T(e,"input","maxPoolGrad"),c=T(t,"output","maxPoolGrad");v(l.rank===a.rank,()=>`Rank of input (${l.rank}) does not match rank of dy (${a.rank})`),v(a.rank===4,()=>`Error in maxPoolGrad: dy must be rank 4 but got rank ${a.rank}.`),v(l.rank===4,()=>`Error in maxPoolGrad: input must be rank 4 but got rank ${l.rank}.`),Ut("maxPoolGrad",r,i);const u={dy:a,input:l,output:c},h={filterSize:s,strides:o,pad:r,dimRoundingMode:i};return F.runKernel(yu,u,h)}const DT=L({maxPoolGrad_:AT});/** + */function RT(n,e,t,s,o,r,i){const a=T(n,"dy","maxPoolGrad"),l=T(e,"input","maxPoolGrad"),c=T(t,"output","maxPoolGrad");k(l.rank===a.rank,()=>`Rank of input (${l.rank}) does not match rank of dy (${a.rank})`),k(a.rank===4,()=>`Error in maxPoolGrad: dy must be rank 4 but got rank ${a.rank}.`),k(l.rank===4,()=>`Error in maxPoolGrad: input must be rank 4 but got rank ${l.rank}.`),Ut("maxPoolGrad",r,i);const u={dy:a,input:l,output:c},h={filterSize:s,strides:o,pad:r,dimRoundingMode:i};return F.runKernel(xu,u,h)}const AT=L({maxPoolGrad_:RT});/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -4691,7 +4691,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const FT={kernelName:Ma,inputsToSave:["x"],outputsToSave:[!0],gradFunc:(n,e,t)=>{const[s,o]=e,{filterSize:r,strides:i,pad:a}=t;return{x:()=>DT(n,s,o,r,i,a)}}};/** + */const DT={kernelName:Ma,inputsToSave:["x"],outputsToSave:[!0],gradFunc:(n,e,t)=>{const[s,o]=e,{filterSize:r,strides:i,pad:a}=t;return{x:()=>AT(n,s,o,r,i,a)}}};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -4706,7 +4706,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const _T={kernelName:Ba,inputsToSave:["x"],gradFunc:(n,e,t)=>{const[s]=e,{axis:o}=t,r=$e(o,s.shape),a=bt(s.shape,r)[1],l=G(a);return{x:()=>{const u=s.shape.slice();r.forEach(p=>{u[p]=1});const h=O(n,u);return me(D(h,Nn(s.shape,"float32")),l)}}}};/** + */const FT={kernelName:Ba,inputsToSave:["x"],gradFunc:(n,e,t)=>{const[s]=e,{axis:o}=t,r=$e(o,s.shape),a=bt(s.shape,r)[1],l=G(a);return{x:()=>{const u=s.shape.slice();r.forEach(p=>{u[p]=1});const h=O(n,u);return me(D(h,Nn(s.shape,"float32")),l)}}}};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -4721,7 +4721,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const OT={kernelName:za,inputsToSave:["x"],outputsToSave:[!0],gradFunc:(n,e,t)=>{const s=t,{axis:o}=s,[r,i]=e,a=$e(o,r.shape),l=Mg(n,i,r,a);return{x:()=>l.x()}}};/** + */const _T={kernelName:za,inputsToSave:["x"],outputsToSave:[!0],gradFunc:(n,e,t)=>{const s=t,{axis:o}=s,[r,i]=e,a=$e(o,r.shape),l=Mg(n,i,r,a);return{x:()=>l.x()}}};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -4736,7 +4736,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const LT={kernelName:jr,inputsToSave:["a","b"],gradFunc:(n,e)=>{const[t,s]=e;return{a:()=>D(n,re(jo(t,s),"float32")),b:()=>D(n,re(Zt(t,s),"float32"))}}};/** + */const OT={kernelName:jr,inputsToSave:["a","b"],gradFunc:(n,e)=>{const[t,s]=e;return{a:()=>D(n,re(jo(t,s),"float32")),b:()=>D(n,re(Zt(t,s),"float32"))}}};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -4751,7 +4751,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const MT={kernelName:Va,inputsToSave:["x"],gradFunc:(n,e,t)=>{const s=e[0],{paddings:o}=t,r=o.map(i=>i[0]);return{x:()=>Ve(n,r,s.shape)}}};/** + */const LT={kernelName:Va,inputsToSave:["x"],gradFunc:(n,e,t)=>{const s=e[0],{paddings:o}=t,r=o.map(i=>i[0]);return{x:()=>Ve(n,r,s.shape)}}};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -4766,7 +4766,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const PT={kernelName:Kr,inputsToSave:["a","b"],gradFunc:(n,e)=>{const[t,s]=e,o=Ce(t.shape,s.shape);return{a:()=>{const a=ut(t.shape,o);return a.length>0?O(de(n,a),t.shape):n},b:()=>{const a=D(n,st(vl(me(t,s)))),l=ut(s.shape,o);return l.length>0?O(de(a,l),s.shape):a}}}};/** + */const MT={kernelName:Kr,inputsToSave:["a","b"],gradFunc:(n,e)=>{const[t,s]=e,o=Ce(t.shape,s.shape);return{a:()=>{const a=ut(t.shape,o);return a.length>0?O(de(n,a),t.shape):n},b:()=>{const a=D(n,st(vl(me(t,s)))),l=ut(s.shape,o);return l.length>0?O(de(a,l),s.shape):a}}}};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -4781,7 +4781,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const BT={kernelName:Xr,inputsToSave:["a","b"],gradFunc:(n,e)=>{const[t,s]=e,o=Ce(t.shape,s.shape);return{a:()=>{const a=D(n,re(s,"float32")),l=ut(t.shape,o);return l.length>0?O(de(a,l),t.shape):a},b:()=>{const a=D(n,re(t,"float32")),l=ut(s.shape,o);return l.length>0?O(de(a,l),s.shape):a}}}};/** + */const PT={kernelName:Xr,inputsToSave:["a","b"],gradFunc:(n,e)=>{const[t,s]=e,o=Ce(t.shape,s.shape);return{a:()=>{const a=D(n,re(s,"float32")),l=ut(t.shape,o);return l.length>0?O(de(a,l),t.shape):a},b:()=>{const a=D(n,re(t,"float32")),l=ut(s.shape,o);return l.length>0?O(de(a,l),s.shape):a}}}};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -4796,7 +4796,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const zT={kernelName:Wa,gradFunc:n=>({x:()=>st(n)})};/** + */const BT={kernelName:Wa,gradFunc:n=>({x:()=>st(n)})};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -4811,7 +4811,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const VT={kernelName:Ha,inputsToSave:["indices"],gradFunc:(n,e)=>{const t=e[0];return{indices:()=>ot(t.shape,"float32")}}};/** + */const zT={kernelName:Ha,inputsToSave:["indices"],gradFunc:(n,e)=>{const t=e[0];return{indices:()=>ot(t.shape,"float32")}}};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -4826,7 +4826,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const WT={kernelName:Ga,gradFunc:n=>({x:()=>Ne(n)})};/** + */const VT={kernelName:Ga,gradFunc:n=>({x:()=>Ne(n)})};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -4841,7 +4841,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const UT={kernelName:qa,saveAllInputs:!0,gradFunc:(n,e,t)=>{const{axis:s}=t;return Gn(n,s).map(r=>()=>r)}};/** + */const WT={kernelName:qa,saveAllInputs:!0,gradFunc:(n,e,t)=>{const{axis:s}=t;return Gn(n,s).map(r=>()=>r)}};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -4871,7 +4871,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const GT={kernelName:Yr,inputsToSave:["a","b"],outputsToSave:[!0],gradFunc:(n,e)=>{const[t,s,o]=e,r=t,i=s,a=Ce(r.shape,i.shape);return{a:()=>{const u=re(i,"float32");let h=D(n,D(u,io(r,be(u,De(1)))));const d=ut(r.shape,a);return d.length>0&&(h=de(h,d)),O(h,r.shape)},b:()=>{const u=Zt(r,0),h=It(u,Wn(r),Ne(r));let d=D(n,D(o,h));const p=ut(i.shape,a);return p.length>0&&(d=de(d,p)),O(d,i.shape)}}}};/** + */const UT={kernelName:Yr,inputsToSave:["a","b"],outputsToSave:[!0],gradFunc:(n,e)=>{const[t,s,o]=e,r=t,i=s,a=Ce(r.shape,i.shape);return{a:()=>{const u=re(i,"float32");let h=D(n,D(u,io(r,be(u,De(1)))));const d=ut(r.shape,a);return d.length>0&&(h=de(h,d)),O(h,r.shape)},b:()=>{const u=Zt(r,0),h=It(u,Wn(r),Ne(r));let d=D(n,D(o,h));const p=ut(i.shape,a);return p.length>0&&(d=de(d,p)),O(d,i.shape)}}}};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -4886,7 +4886,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const HT={kernelName:Ka,inputsToSave:["x","alpha"],gradFunc:(n,e)=>{const[t,s]=e,o=Zt(t,0);return{x:()=>It(o,n,D(n,s)),alpha:()=>{let r=It(o,Ne(n),D(n,t));const i=ut(s.shape,n.shape);return i.length>0&&(r=de(r,i)),O(r,s.shape)}}}};/** + */const GT={kernelName:Ka,inputsToSave:["x","alpha"],gradFunc:(n,e)=>{const[t,s]=e,o=Zt(t,0);return{x:()=>It(o,n,D(n,s)),alpha:()=>{let r=It(o,Ne(n),D(n,t));const i=ut(s.shape,n.shape);return i.length>0&&(r=de(r,i)),O(r,s.shape)}}}};/** * @license * Copyright 2022 Google Inc. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -4901,7 +4901,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function qT(n,e,t){const s=n.shape.slice();s[t]=1;const o=O(e,s),r=ih(n,t,!0,!1),i=ih(n,t,!0,!0),a=D(r,i);return D(o,a)}function jT(n,e,t){const s=n.shape.length,o=s-t.length,r=Ze(t,s);let i=n;r!=null&&(i=Ee(n,r));const a=i.shape.slice(),c=a.splice(s-t.length,t.length).reduce((d,p)=>d*p,1);a.push(c);const u=i.reshape(a);let h=qT(u,e,o);if(h=h.reshape(i.shape),r!=null){const d=$s(r);h=Ee(h,d)}return h}const KT={kernelName:Xa,inputsToSave:["x"],gradFunc:(n,e,t)=>{const[s]=e,{axis:o}=t;let r=[];return o==null?r=s.shape.map((i,a)=>a):typeof o=="number"?r=[o]:r=o,{x:()=>jT(s,n,r)}}};/** + */function HT(n,e,t){const s=n.shape.slice();s[t]=1;const o=O(e,s),r=oh(n,t,!0,!1),i=oh(n,t,!0,!0),a=D(r,i);return D(o,a)}function qT(n,e,t){const s=n.shape.length,o=s-t.length,r=Ze(t,s);let i=n;r!=null&&(i=Ee(n,r));const a=i.shape.slice(),c=a.splice(s-t.length,t.length).reduce((d,p)=>d*p,1);a.push(c);const u=i.reshape(a);let h=HT(u,e,o);if(h=h.reshape(i.shape),r!=null){const d=$s(r);h=Ee(h,d)}return h}const jT={kernelName:Xa,inputsToSave:["x"],gradFunc:(n,e,t)=>{const[s]=e,{axis:o}=t;let r=[];return o==null?r=s.shape.map((i,a)=>a):typeof o=="number"?r=[o]:r=o,{x:()=>qT(s,n,r)}}};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -4916,7 +4916,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const XT={kernelName:Dr,inputsToSave:["a","b"],gradFunc:(n,e)=>{const[t,s]=e,o=Ce(t.shape,s.shape);return{a:()=>{const a=me(n,re(s,"float32")),l=ut(t.shape,o);return l.length>0?O(de(a,l),t.shape):a},b:()=>{let a=D(n,re(t,"float32"));const l=ut(s.shape,o);l.length>0&&(a=O(de(a,l),s.shape));const c=qe(s);return st(me(a,re(c,"float32")))}}}};/** + */const KT={kernelName:Dr,inputsToSave:["a","b"],gradFunc:(n,e)=>{const[t,s]=e,o=Ce(t.shape,s.shape);return{a:()=>{const a=me(n,re(s,"float32")),l=ut(t.shape,o);return l.length>0?O(de(a,l),t.shape):a},b:()=>{let a=D(n,re(t,"float32"));const l=ut(s.shape,o);l.length>0&&(a=O(de(a,l),s.shape));const c=qe(s);return st(me(a,re(c,"float32")))}}}};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -4931,7 +4931,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const YT={kernelName:Zr,inputsToSave:["x"],gradFunc:(n,e)=>{const[t]=e;return{x:()=>me(n,st(qe(t)))}}};/** + */const XT={kernelName:Zr,inputsToSave:["x"],gradFunc:(n,e)=>{const[t]=e;return{x:()=>me(n,st(qe(t)))}}};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -4946,7 +4946,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const ZT={kernelName:Jr,inputsToSave:["x"],gradFunc:(n,e)=>{const[t]=e,s=D(jo(t,6),Ni(t));return{x:()=>D(n,re(s,"float32"))}}};/** + */const YT={kernelName:Jr,inputsToSave:["x"],gradFunc:(n,e)=>{const[t]=e,s=D(jo(t,6),Ni(t));return{x:()=>D(n,re(s,"float32"))}}};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -4961,7 +4961,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const QT={kernelName:Qr,inputsToSave:["x"],gradFunc:(n,e)=>{const[t]=e;return{x:()=>D(n,re(Ni(t),"float32"))}}};/** + */const ZT={kernelName:Qr,inputsToSave:["x"],gradFunc:(n,e)=>{const[t]=e;return{x:()=>D(n,re(Ni(t),"float32"))}}};/** * @license * Copyright 2020 Google Inc. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -4976,7 +4976,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const JT={kernelName:Ya,inputsToSave:["x"],gradFunc:(n,e)=>{const[t]=e;return{x:()=>O(n,t.shape)}}};/** + */const QT={kernelName:Ya,inputsToSave:["x"],gradFunc:(n,e)=>{const[t]=e;return{x:()=>O(n,t.shape)}}};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -4991,7 +4991,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const eN={kernelName:Qa,inputsToSave:["images"],gradFunc:(n,e,t)=>{const[s]=e,o={dy:n,images:s};return{images:()=>F.runKernel(Tu,o,t)}}};/** + */const JT={kernelName:Qa,inputsToSave:["images"],gradFunc:(n,e,t)=>{const[s]=e,o={dy:n,images:s};return{images:()=>F.runKernel(vu,o,t)}}};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -5006,7 +5006,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const tN={kernelName:Za,inputsToSave:["images"],gradFunc:(n,e,t)=>{const[s]=e,o={dy:n,images:s};return{images:()=>F.runKernel(Su,o,t)}}};/** + */const eN={kernelName:Za,inputsToSave:["images"],gradFunc:(n,e,t)=>{const[s]=e,o={dy:n,images:s};return{images:()=>F.runKernel(ku,o,t)}}};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -5021,7 +5021,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const nN={kernelName:Ja,gradFunc:(n,e,t)=>{const{dims:s}=t,o=$e(s,n.shape);return{x:()=>uo(n,o)}}};/** + */const tN={kernelName:Ja,gradFunc:(n,e,t)=>{const{dims:s}=t,o=$e(s,n.shape);return{x:()=>uo(n,o)}}};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -5036,7 +5036,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const sN={kernelName:ei,gradFunc:n=>({x:()=>Ne(n)})};/** + */const nN={kernelName:ei,gradFunc:n=>({x:()=>Ne(n)})};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -5051,7 +5051,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const oN={kernelName:ti,inputsToSave:["x"],gradFunc:(n,e)=>{const[t]=e;return{x:()=>st(me(n,D(io(t,1.5),2)))}}};/** + */const sN={kernelName:ti,inputsToSave:["x"],gradFunc:(n,e)=>{const[t]=e;return{x:()=>st(me(n,D(io(t,1.5),2)))}}};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -5066,7 +5066,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const rN={kernelName:el,inputsToSave:["condition"],gradFunc:(n,e)=>{const[t]=e;return{condition:()=>re(Ne(t),"float32"),t:()=>D(n,re(t,n.dtype)),e:()=>D(n,re(dh(t),n.dtype))}}};/** + */const oN={kernelName:el,inputsToSave:["condition"],gradFunc:(n,e)=>{const[t]=e;return{condition:()=>re(Ne(t),"float32"),t:()=>D(n,re(t,n.dtype)),e:()=>D(n,re(uh(t),n.dtype))}}};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -5081,7 +5081,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const iN={kernelName:ni,inputsToSave:["x"],gradFunc:(n,e)=>{const[t]=e;return{x:()=>{const s=Zt(t,De(0)),o=De(Dl),r=De(Fl),i=D(n,r),a=D(D(n,o),Vn(re(t,"float32")));return It(s,i,a)}}}};/** + */const rN={kernelName:ni,inputsToSave:["x"],gradFunc:(n,e)=>{const[t]=e;return{x:()=>{const s=Zt(t,De(0)),o=De(Dl),r=De(Fl),i=D(n,r),a=D(D(n,o),Vn(re(t,"float32")));return It(s,i,a)}}}};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -5096,7 +5096,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const aN={kernelName:ii,outputsToSave:[!0],gradFunc:(n,e)=>{const[t]=e;return{x:()=>D(n,D(t,be(De(1),t)))}}};/** + */const iN={kernelName:ii,outputsToSave:[!0],gradFunc:(n,e)=>{const[t]=e;return{x:()=>D(n,D(t,be(De(1),t)))}}};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -5111,7 +5111,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const lN={kernelName:ri,gradFunc:n=>({x:()=>Ne(n)})};/** + */const aN={kernelName:ri,gradFunc:n=>({x:()=>Ne(n)})};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -5126,7 +5126,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const cN={kernelName:si,inputsToSave:["x"],gradFunc:(n,e)=>{const[t]=e;return{x:()=>D(rh(re(t,"float32")),n)}}};/** + */const lN={kernelName:si,inputsToSave:["x"],gradFunc:(n,e)=>{const[t]=e;return{x:()=>D(sh(re(t,"float32")),n)}}};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -5141,7 +5141,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const uN={kernelName:oi,inputsToSave:["x"],gradFunc:(n,e)=>{const[t]=e;return{x:()=>D(um(re(t,"float32")),n)}}};/** + */const cN={kernelName:oi,inputsToSave:["x"],gradFunc:(n,e)=>{const[t]=e;return{x:()=>D(um(re(t,"float32")),n)}}};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -5156,7 +5156,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const hN={kernelName:tl,inputsToSave:["x"],gradFunc:(n,e,t)=>{const[s]=e,{begin:o,size:r}=t,i=s.shape,[a,l]=Rl(s,o,r),c=[];for(let u=0;umh(n,c)}}};/** + */const uN={kernelName:tl,inputsToSave:["x"],gradFunc:(n,e,t)=>{const[s]=e,{begin:o,size:r}=t,i=s.shape,[a,l]=Rl(s,o,r),c=[];for(let u=0;uph(n,c)}}};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -5171,7 +5171,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const dN={kernelName:rl,outputsToSave:[!0],gradFunc:(n,e,t)=>{const[s]=e,{dim:o}=t,r=!0,i=D(n,s);return{logits:()=>be(i,D(de(i,[o],r),s))}}};/** + */const hN={kernelName:rl,outputsToSave:[!0],gradFunc:(n,e,t)=>{const[s]=e,{dim:o}=t,r=!0,i=D(n,s);return{logits:()=>be(i,D(de(i,[o],r),s))}}};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -5186,7 +5186,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const pN={kernelName:ai,inputsToSave:["x"],gradFunc:(n,e)=>{const[t]=e;return{x:()=>D(n,Ho(t))}}};/** + */const dN={kernelName:ai,inputsToSave:["x"],gradFunc:(n,e)=>{const[t]=e;return{x:()=>D(n,Ho(t))}}};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -5201,7 +5201,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const zg={kernelName:sl,gradFunc:(n,e,t)=>{const{blockShape:s,paddings:o}=t;return{x:()=>nh(n,s,o)}}};/** + */const zg={kernelName:sl,gradFunc:(n,e,t)=>{const{blockShape:s,paddings:o}=t;return{x:()=>eh(n,s,o)}}};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -5216,7 +5216,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const Vg={kernelName:ol,gradFunc:(n,e,t)=>{const{axis:s}=t;return{x:()=>Mt(n,s)}}};/** + */const Vg={kernelName:ol,gradFunc:(n,e,t)=>{const{axis:s}=t;return{x:()=>Ot(n,s)}}};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -5231,7 +5231,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const fN={kernelName:li,inputsToSave:["x"],gradFunc:(n,e)=>{const[t]=e;return{x:()=>me(n,D(Rt(re(t,"float32")),2))}}};/** + */const pN={kernelName:li,inputsToSave:["x"],gradFunc:(n,e)=>{const[t]=e;return{x:()=>me(n,D(Rt(re(t,"float32")),2))}}};/** * @license * Copyright 2019 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -5246,7 +5246,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const mN={kernelName:Nu,inputsToSave:["x"],gradFunc:(n,e)=>{const[t]=e;return{x:()=>D(n,D(re(t,"float32"),2))}}};/** + */const fN={kernelName:Su,inputsToSave:["x"],gradFunc:(n,e)=>{const[t]=e;return{x:()=>D(n,D(re(t,"float32"),2))}}};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -5261,7 +5261,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const gN={kernelName:ci,inputsToSave:["a","b"],gradFunc:(n,e)=>{const[t,s]=e,o=De(2);return{a:()=>D(n,D(o,be(t,s))),b:()=>D(n,D(o,be(s,t)))}}};/** + */const mN={kernelName:ci,inputsToSave:["a","b"],gradFunc:(n,e)=>{const[t,s]=e,o=De(2);return{a:()=>D(n,D(o,be(t,s))),b:()=>D(n,D(o,be(s,t)))}}};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -5276,7 +5276,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const xN={kernelName:fi,gradFunc:n=>({x:()=>Ne(n)})};/** + */const gN={kernelName:fi,gradFunc:n=>({x:()=>Ne(n)})};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -5291,7 +5291,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const bN={kernelName:ui,inputsToSave:["a","b"],gradFunc:(n,e)=>{const[t,s]=e,o=Ce(t.shape,s.shape);return{a:()=>{let a=n;const l=ut(t.shape,o);return l.length>0&&(a=de(a,l)),O(a,t.shape)},b:()=>{let a=n;const l=ut(s.shape,o);return l.length>0&&(a=de(a,l)),O(st(a),s.shape)}}}};/** + */const xN={kernelName:ui,inputsToSave:["a","b"],gradFunc:(n,e)=>{const[t,s]=e,o=Ce(t.shape,s.shape);return{a:()=>{let a=n;const l=ut(t.shape,o);return l.length>0&&(a=de(a,l)),O(a,t.shape)},b:()=>{let a=n;const l=ut(s.shape,o);return l.length>0&&(a=de(a,l)),O(st(a),s.shape)}}}};/** * @license * Copyright 2020 Google Inc. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -5306,7 +5306,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const yN={kernelName:nl,inputsToSave:["x"],gradFunc:(n,e,t)=>{const[s]=e,o=s.shape.slice(),{axis:r}=t;$e(r,s.shape).forEach(c=>{o[c]=1});const a=O(n,o),l=D(a,Nn(s.shape,"float32"));return{x:()=>l}}};/** + */const bN={kernelName:nl,inputsToSave:["x"],gradFunc:(n,e,t)=>{const[s]=e,o=s.shape.slice(),{axis:r}=t;$e(r,s.shape).forEach(c=>{o[c]=1});const a=O(n,o),l=D(a,Nn(s.shape,"float32"));return{x:()=>l}}};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -5321,7 +5321,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const wN={kernelName:hi,inputsToSave:["x"],gradFunc:(n,e)=>{const[t]=e;return{x:()=>me(n,qe(rh(t)))}}};/** + */const yN={kernelName:hi,inputsToSave:["x"],gradFunc:(n,e)=>{const[t]=e;return{x:()=>me(n,qe(sh(t)))}}};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -5336,7 +5336,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const CN={kernelName:di,outputsToSave:[!0],gradFunc:(n,e)=>{const[t]=e;return{x:()=>D(be(De(1),qe(t)),n)}}};/** + */const wN={kernelName:di,outputsToSave:[!0],gradFunc:(n,e)=>{const[t]=e;return{x:()=>D(be(De(1),qe(t)),n)}}};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -5351,7 +5351,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const IN={kernelName:pi,inputsToSave:["x"],gradFunc:(n,e,t)=>{const[s]=e,{reps:o}=t;return{x:()=>{let i=Ne(s);if(s.rank===1)for(let a=0;a{const[s]=e,{reps:o}=t;return{x:()=>{let i=Ne(s);if(s.rank===1)for(let a=0;a{const s=t,{perm:o}=s,r=$s(o);return{x:()=>Ee(n,r)}}};/** + */const IN={kernelName:Mo,gradFunc:(n,e,t)=>{const s=t,{perm:o}=s,r=$s(o);return{x:()=>Ee(n,r)}}};/** * @license * Copyright 2020 Google Inc. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -5381,7 +5381,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const kN={kernelName:il,gradFunc:(n,e,t)=>{const s=t,{axis:o}=s;return{value:()=>Un(n,o)}}};/** + */const $N={kernelName:il,gradFunc:(n,e,t)=>{const s=t,{axis:o}=s;return{value:()=>Un(n,o)}}};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -5396,7 +5396,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const vN={kernelName:al,inputsToSave:["segmentIds"],gradFunc:(n,e)=>{const[t]=e;return{x:()=>SN(n,t)}}};function SN(n,e){const t=ks(e,Ne(e)),s=ch(n,t);let o=ao(e,De(0,"int32"));const r=s.rank-o.rank;for(let a=0;a{const[t]=e;return{x:()=>vN(n,t)}}};function vN(n,e){const t=ks(e,Ne(e)),s=ah(n,t);let o=ao(e,De(0,"int32"));const r=s.rank-o.rank;for(let a=0;a({x:()=>Ne(n)})};/** + */const SN={kernelName:ll,gradFunc:n=>({x:()=>Ne(n)})};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -5426,7 +5426,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const NN=[_g,v2,S2,T2,N2,E2,R2,A2,D2,F2,_2,O2,P2,V2,W2,U2,G2,H2,q2,j2,K2,X2,Z2,Y2,eT,tT,nT,sT,oT,rT,XT,iT,aT,lT,cT,uT,dT,hT,pT,fT,mT,gT,xT,bT,yT,wT,CT,IT,$T,ST,Pg,Pg,TT,RT,FT,_T,OT,LT,MT,PT,BT,zT,VT,WT,UT,Bg,Bg,GT,HT,KT,YT,ZT,QT,JT,eN,tN,nN,sN,oN,rN,iN,aN,lN,cN,uN,hN,dN,pN,zg,zg,Vg,Vg,fN,gN,mN,xN,bN,yN,wN,CN,IN,$N,kN,vN,TN];for(const n of NN)zw(n);/** + */const TN=[_g,k2,v2,S2,T2,N2,E2,R2,A2,D2,F2,_2,M2,z2,V2,W2,U2,G2,H2,q2,j2,K2,Y2,X2,J2,eT,tT,nT,sT,oT,KT,rT,iT,aT,lT,cT,hT,uT,dT,pT,fT,mT,gT,xT,bT,yT,wT,CT,IT,vT,Pg,Pg,ST,ET,DT,FT,_T,OT,LT,MT,PT,BT,zT,VT,WT,Bg,Bg,UT,GT,jT,XT,YT,ZT,QT,JT,eN,tN,nN,sN,oN,rN,iN,aN,lN,cN,uN,hN,dN,zg,zg,Vg,Vg,pN,mN,fN,gN,xN,bN,yN,wN,CN,IN,$N,kN,SN];for(const n of TN)Bw(n);/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -5441,7 +5441,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */U().prototype.abs=function(){return this.throwIfDisposed(),Lt(this)};/** + */U().prototype.abs=function(){return this.throwIfDisposed(),_t(this)};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -5456,7 +5456,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */U().prototype.acos=function(){return this.throwIfDisposed(),oI(this)};/** + */U().prototype.acos=function(){return this.throwIfDisposed(),sI(this)};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -5471,7 +5471,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */U().prototype.acosh=function(){return this.throwIfDisposed(),iI(this)};/** + */U().prototype.acosh=function(){return this.throwIfDisposed(),rI(this)};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -5516,7 +5516,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */U().prototype.any=function(n,e){return this.throwIfDisposed(),Qu(this,n,e)};/** + */U().prototype.any=function(n,e){return this.throwIfDisposed(),Yu(this,n,e)};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -5546,7 +5546,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */U().prototype.argMin=function(n){return this.throwIfDisposed(),hI(this,n)};/** + */U().prototype.argMin=function(n){return this.throwIfDisposed(),uI(this,n)};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -5561,7 +5561,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */U().prototype.asScalar=function(){return this.throwIfDisposed(),v(this.size===1,()=>"The array must have only 1 element."),O(this,[])};/** + */U().prototype.asScalar=function(){return this.throwIfDisposed(),k(this.size===1,()=>"The array must have only 1 element."),O(this,[])};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -5666,7 +5666,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */U().prototype.asin=function(){return this.throwIfDisposed(),pI(this)};/** + */U().prototype.asin=function(){return this.throwIfDisposed(),dI(this)};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -5681,7 +5681,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */U().prototype.asinh=function(){return this.throwIfDisposed(),mI(this)};/** + */U().prototype.asinh=function(){return this.throwIfDisposed(),fI(this)};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -5696,7 +5696,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */U().prototype.atan=function(){return this.throwIfDisposed(),xI(this)};/** + */U().prototype.atan=function(){return this.throwIfDisposed(),gI(this)};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -5711,7 +5711,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */U().prototype.atan2=function(n){return this.throwIfDisposed(),yI(this,n)};/** + */U().prototype.atan2=function(n){return this.throwIfDisposed(),bI(this,n)};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -5726,7 +5726,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */U().prototype.atanh=function(){return this.throwIfDisposed(),CI(this)},U().prototype.avgPool=function(n,e,t,s){return this.throwIfDisposed(),th(this,n,e,t,s)};/** + */U().prototype.atanh=function(){return this.throwIfDisposed(),wI(this)},U().prototype.avgPool=function(n,e,t,s){return this.throwIfDisposed(),Ju(this,n,e,t,s)};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -5741,7 +5741,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */U().prototype.batchToSpaceND=function(n,e){return this.throwIfDisposed(),nh(this,n,e)};/** + */U().prototype.batchToSpaceND=function(n,e){return this.throwIfDisposed(),eh(this,n,e)};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -5801,7 +5801,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */U().prototype.ceil=function(){return this.throwIfDisposed(),KI(this)};/** + */U().prototype.ceil=function(){return this.throwIfDisposed(),jI(this)};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -5831,7 +5831,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */U().prototype.concat=function(n,e){return this.throwIfDisposed(),n instanceof ct&&(n=[n]),Mt([this,...n],e)};/** + */U().prototype.concat=function(n,e){return this.throwIfDisposed(),n instanceof ct&&(n=[n]),Ot([this,...n],e)};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -5891,7 +5891,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */U().prototype.cos=function(){return this.throwIfDisposed(),rh(this)};/** + */U().prototype.cos=function(){return this.throwIfDisposed(),sh(this)};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -5921,7 +5921,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */U().prototype.cumprod=function(n,e,t){return this.throwIfDisposed(),ih(this,n,e,t)};/** + */U().prototype.cumprod=function(n,e,t){return this.throwIfDisposed(),oh(this,n,e,t)};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -5951,7 +5951,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */U().prototype.depthToSpace=function(n,e){return this.throwIfDisposed(),b$(this,n,e)};/** + */U().prototype.depthToSpace=function(n,e){return this.throwIfDisposed(),x$(this,n,e)};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -5966,7 +5966,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */U().prototype.depthwiseConv2d=function(n,e,t,s,o,r){return this.throwIfDisposed(),ah(this,n,e,t,s,o,r)};/** + */U().prototype.depthwiseConv2d=function(n,e,t,s,o,r){return this.throwIfDisposed(),rh(this,n,e,t,s,o,r)};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -5981,7 +5981,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */U().prototype.dilation2d=function(n,e,t,s,o){return this.throwIfDisposed(),C$(this,n,e,t,s,o)};/** + */U().prototype.dilation2d=function(n,e,t,s,o){return this.throwIfDisposed(),w$(this,n,e,t,s,o)};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -5996,7 +5996,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */U().prototype.divNoNan=function(n){return this.throwIfDisposed(),S$(this,n)};/** + */U().prototype.divNoNan=function(n){return this.throwIfDisposed(),v$(this,n)};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -6026,7 +6026,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */U().prototype.dot=function(n){return this.throwIfDisposed(),N$(this,n)};/** + */U().prototype.dot=function(n){return this.throwIfDisposed(),T$(this,n)};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -6086,7 +6086,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */U().prototype.euclideanNorm=function(n,e){return this.throwIfDisposed(),z$(this,n,e)};/** + */U().prototype.euclideanNorm=function(n,e){return this.throwIfDisposed(),B$(this,n,e)};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -6131,7 +6131,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */U().prototype.expm1=function(){return this.throwIfDisposed(),G$(this)};/** + */U().prototype.expm1=function(){return this.throwIfDisposed(),U$(this)};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -6206,7 +6206,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */U().prototype.gather=function(n,e,t){return this.throwIfDisposed(),ch(this,n,e,t)};/** + */U().prototype.gather=function(n,e,t){return this.throwIfDisposed(),ah(this,n,e,t)};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -6251,7 +6251,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */U().prototype.ifft=function(){return this.throwIfDisposed(),Nh(this)};/** + */U().prototype.ifft=function(){return this.throwIfDisposed(),Sh(this)};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -6266,7 +6266,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */U().prototype.irfft=function(){return this.throwIfDisposed(),Ov(this)};/** + */U().prototype.irfft=function(){return this.throwIfDisposed(),_v(this)};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -6281,7 +6281,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */U().prototype.isFinite=function(){return this.throwIfDisposed(),J$(this)};/** + */U().prototype.isFinite=function(){return this.throwIfDisposed(),Q$(this)};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -6296,7 +6296,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */U().prototype.isInf=function(){return this.throwIfDisposed(),tk(this)};/** + */U().prototype.isInf=function(){return this.throwIfDisposed(),ek(this)};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -6311,7 +6311,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */U().prototype.isNaN=function(){return this.throwIfDisposed(),sk(this)};/** + */U().prototype.isNaN=function(){return this.throwIfDisposed(),nk(this)};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -6326,7 +6326,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */U().prototype.leakyRelu=function(n){return this.throwIfDisposed(),hh(this,n)};/** + */U().prototype.leakyRelu=function(n){return this.throwIfDisposed(),ch(this,n)};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -6371,7 +6371,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */U().prototype.localResponseNormalization=function(n,e,t,s){return this.throwIfDisposed(),lk(this,n,e,t,s)};/** + */U().prototype.localResponseNormalization=function(n,e,t,s){return this.throwIfDisposed(),ak(this,n,e,t,s)};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -6386,7 +6386,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */U().prototype.logSigmoid=function(){return this.throwIfDisposed(),mk(this)};/** + */U().prototype.logSigmoid=function(){return this.throwIfDisposed(),fk(this)};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -6476,7 +6476,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */U().prototype.logicalNot=function(){return this.throwIfDisposed(),dh(this)};/** + */U().prototype.logicalNot=function(){return this.throwIfDisposed(),uh(this)};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -6506,7 +6506,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */U().prototype.logicalXor=function(n){return this.throwIfDisposed(),$k(this,n)};/** + */U().prototype.logicalXor=function(n){return this.throwIfDisposed(),Ik(this,n)};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -6521,7 +6521,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */U().prototype.matMul=function(n,e,t){return this.throwIfDisposed(),Ae(this,n,e,t)},U().prototype.maxPool=function(n,e,t,s){return this.throwIfDisposed(),ph(this,n,e,t,s)};/** + */U().prototype.matMul=function(n,e,t){return this.throwIfDisposed(),Ae(this,n,e,t)},U().prototype.maxPool=function(n,e,t,s){return this.throwIfDisposed(),hh(this,n,e,t,s)};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -6611,7 +6611,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */U().prototype.mirrorPad=function(n,e){return this.throwIfDisposed(),Ak(this,n,e)};/** + */U().prototype.mirrorPad=function(n,e){return this.throwIfDisposed(),Rk(this,n,e)};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -6626,7 +6626,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */U().prototype.mod=function(n){return this.throwIfDisposed(),Fk(this,n)};/** + */U().prototype.mod=function(n){return this.throwIfDisposed(),Dk(this,n)};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -6731,7 +6731,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */U().prototype.pad=function(n,e){return this.throwIfDisposed(),mh(this,n,e)},U().prototype.pool=function(n,e,t,s,o,r){return this.throwIfDisposed(),Uk(this,n,e,t,s,o,r)};/** + */U().prototype.pad=function(n,e){return this.throwIfDisposed(),ph(this,n,e)},U().prototype.pool=function(n,e,t,s,o,r){return this.throwIfDisposed(),Wk(this,n,e,t,s,o,r)};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -6761,7 +6761,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */U().prototype.prelu=function(n){return this.throwIfDisposed(),xh(this,n)};/** + */U().prototype.prelu=function(n){return this.throwIfDisposed(),mh(this,n)};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -6776,7 +6776,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */U().prototype.prod=function(n,e){return this.throwIfDisposed(),qk(this,n,e)};/** + */U().prototype.prod=function(n,e){return this.throwIfDisposed(),Hk(this,n,e)};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -6791,7 +6791,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */U().prototype.reciprocal=function(){return this.throwIfDisposed(),mv(this)};/** + */U().prototype.reciprocal=function(){return this.throwIfDisposed(),fv(this)};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -6911,7 +6911,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */U().prototype.rfft=function(){return this.throwIfDisposed(),Pv(this)};/** + */U().prototype.rfft=function(){return this.throwIfDisposed(),Mv(this)};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -7001,7 +7001,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */U().prototype.sign=function(){return this.throwIfDisposed(),kv(this)};/** + */U().prototype.sign=function(){return this.throwIfDisposed(),$v(this)};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -7061,7 +7061,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */U().prototype.softmax=function(n){return this.throwIfDisposed(),Th(this,n)};/** + */U().prototype.softmax=function(n){return this.throwIfDisposed(),vh(this,n)};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -7091,7 +7091,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */U().prototype.spaceToBatchND=function(n,e){return this.throwIfDisposed(),gh(this,n,e)};/** + */U().prototype.spaceToBatchND=function(n,e){return this.throwIfDisposed(),fh(this,n,e)};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -7151,7 +7151,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */U().prototype.squaredDifference=function(n){return this.throwIfDisposed(),zv(this,n)};/** + */U().prototype.squaredDifference=function(n){return this.throwIfDisposed(),Bv(this,n)};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -7211,7 +7211,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */U().prototype.stridedSlice=function(n,e,t,s,o,r,i,a){return this.throwIfDisposed(),Hv(this,n,e,t,s,o,r,i,a)};/** + */U().prototype.stridedSlice=function(n,e,t,s,o,r,i,a){return this.throwIfDisposed(),Gv(this,n,e,t,s,o,r,i,a)};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -7256,7 +7256,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */U().prototype.tan=function(){return this.throwIfDisposed(),jv(this)};/** + */U().prototype.tan=function(){return this.throwIfDisposed(),qv(this)};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -7346,7 +7346,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */U().prototype.topk=function(n,e){return this.throwIfDisposed(),Yv(this,n,e)};/** + */U().prototype.topk=function(n,e){return this.throwIfDisposed(),Xv(this,n,e)};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -7376,7 +7376,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */U().prototype.unique=function(n){return this.throwIfDisposed(),Jv(this,n)};/** + */U().prototype.unique=function(n){return this.throwIfDisposed(),Qv(this,n)};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -7444,7 +7444,7 @@ * license that can be found in the LICENSE file or at * https://opensource.org/licenses/MIT. * ============================================================================= - */class qn extends Error{constructor(e){super(e),Object.setPrototypeOf(this,qn.prototype)}}class gn extends Error{constructor(e){super(e),Object.setPrototypeOf(this,gn.prototype)}}class R extends Error{constructor(e){super(e),Object.setPrototypeOf(this,R.prototype)}}class Ie extends Error{constructor(e){super(e),Object.setPrototypeOf(this,Ie.prototype)}}class gd extends Error{constructor(e){super(e),Object.setPrototypeOf(this,gd.prototype)}}/** + */class qn extends Error{constructor(e){super(e),Object.setPrototypeOf(this,qn.prototype)}}class gn extends Error{constructor(e){super(e),Object.setPrototypeOf(this,gn.prototype)}}class R extends Error{constructor(e){super(e),Object.setPrototypeOf(this,R.prototype)}}class Ie extends Error{constructor(e){super(e),Object.setPrototypeOf(this,Ie.prototype)}}class fd extends Error{constructor(e){super(e),Object.setPrototypeOf(this,fd.prototype)}}/** * @license * Copyright 2022 Google LLC * @@ -7460,12 +7460,12 @@ * license that can be found in the LICENSE file or at * https://opensource.org/licenses/MIT. * ============================================================================= - */function po(n,e){if(Array.isArray(n)){let t=[];for(let s=0;st.toUpperCase())}let xn={};function xd(n){if(n==null)return null;const e={};return e.className=n.getClassName(),e.config=n.getConfig(),e}function bd(n){if(!(n==null||typeof n!="object"))if(Array.isArray(n))n.forEach(e=>bd(e));else{const e=Object.keys(n);for(const t of e){const s=n[t];s!=null&&typeof s=="object"&&(!Array.isArray(s)&&s.type==="ndarray"&&typeof s.value=="number"?n[t]=s.value:bd(s))}}}function Di(n,e={},t={},s="object",o=!1){if(typeof n=="string"){const r=n;let i;if(r in t)i=t[r];else if(r in xn)i=xn[r];else if(i=e[r],i==null)throw new R(`Unknown ${s}: ${n}. This may be due to one of the following reasons: + */function po(n,e){if(Array.isArray(n)){let t=[];for(let s=0;st.toUpperCase())}let xn={};function md(n){if(n==null)return null;const e={};return e.className=n.getClassName(),e.config=n.getConfig(),e}function gd(n){if(!(n==null||typeof n!="object"))if(Array.isArray(n))n.forEach(e=>gd(e));else{const e=Object.keys(n);for(const t of e){const s=n[t];s!=null&&typeof s=="object"&&(!Array.isArray(s)&&s.type==="ndarray"&&typeof s.value=="number"?n[t]=s.value:gd(s))}}}function Di(n,e={},t={},s="object",o=!1){if(typeof n=="string"){const r=n;let i;if(r in t)i=t[r];else if(r in xn)i=xn[r];else if(i=e[r],i==null)throw new R(`Unknown ${s}: ${n}. This may be due to one of the following reasons: 1. The ${s} is defined in Python, in which case it needs to be ported to TensorFlow.js or your JavaScript code. 2. The custom ${s} is defined in JavaScript, but is not registered properly with tf.serialization.registerClass().`);return i}else{const r=n;if(r.className==null||r.config==null)throw new R(`${s}: Improper config format: ${JSON.stringify(r)}. 'className' and 'config' must set.`);const i=r.className;let a,l;if(i in t?[a,l]=t[i]:i in xn?[a,l]=xn.className:i in e&&([a,l]=e[i]),a==null)throw new R(`Unknown ${s}: ${i}. This may be due to one of the following reasons: 1. The ${s} is defined in Python, in which case it needs to be ported to TensorFlow.js or your JavaScript code. -2. The custom ${s} is defined in JavaScript, but is not registered properly with tf.serialization.registerClass().`);if(l!=null){const c={};for(const p of Object.keys(xn))c[p]=xn[p];for(const p of Object.keys(t))c[p]=t[p];const u=r.config;u.customObjects=c;const h=Object.assign({},xn);for(const p of Object.keys(t))xn[p]=t[p];bd(r.config);const d=l(a,r.config,t,o);return xn=Object.assign({},h),d}else{const c=Object.assign({},xn);for(const h of Object.keys(t))xn[h]=t[h];const u=new a(r.config);return xn=Object.assign({},c),u}}}function EN(n,e){return ne?1:0}function _l(n,e){return-1*EN(n,e)}function Ss(n){if(n==null)return n;const e=[];for(const t of n)e.indexOf(t)===-1&&e.push(t);return e}function RN(n){if(n==null)throw new R(`Invalid value in obj: ${JSON.stringify(n)}`);for(const e in n)if(n.hasOwnProperty(e))return!1;return!0}function mo(n,e,t){if(t!=null&&n.indexOf(t)<0)throw new R(`${t} is not a valid ${e}. Valid values are ${n} or null/undefined.`)}function yd(n,e,t=0,s=1/0){return jn(t>=0),jn(s>=t),Array.isArray(n)&&n.length>=t&&n.length<=s&&n.every(o=>typeof o===e)}function yt(n,e){Array.isArray(n)?(v(n.length>0,()=>`${e} is unexpectedly an empty array.`),n.forEach((t,s)=>yt(t,`element ${s+1} of ${e}`))):v(Number.isInteger(n)&&n>0,()=>`Expected ${e} to be a positive integer, but got ${Gg(n)}.`)}function Gg(n){return n===null?"null":Array.isArray(n)?"["+n.map(e=>Gg(e)).join(",")+"]":typeof n=="string"?`"${n}"`:`${n}`}function AN(n,e,t){let s=t!=null?t():Vt(),o;return(...i)=>{const a=t!=null?t():Vt();return a-se?1:0}function _l(n,e){return-1*NN(n,e)}function Ss(n){if(n==null)return n;const e=[];for(const t of n)e.indexOf(t)===-1&&e.push(t);return e}function EN(n){if(n==null)throw new R(`Invalid value in obj: ${JSON.stringify(n)}`);for(const e in n)if(n.hasOwnProperty(e))return!1;return!0}function mo(n,e,t){if(t!=null&&n.indexOf(t)<0)throw new R(`${t} is not a valid ${e}. Valid values are ${n} or null/undefined.`)}function xd(n,e,t=0,s=1/0){return jn(t>=0),jn(s>=t),Array.isArray(n)&&n.length>=t&&n.length<=s&&n.every(o=>typeof o===e)}function yt(n,e){Array.isArray(n)?(k(n.length>0,()=>`${e} is unexpectedly an empty array.`),n.forEach((t,s)=>yt(t,`element ${s+1} of ${e}`))):k(Number.isInteger(n)&&n>0,()=>`Expected ${e} to be a positive integer, but got ${Gg(n)}.`)}function Gg(n){return n===null?"null":Array.isArray(n)?"["+n.map(e=>Gg(e)).join(",")+"]":typeof n=="string"?`"${n}"`:`${n}`}function RN(n,e,t){let s=t!=null?t():zt(),o;return(...i)=>{const a=t!=null?t():zt();return a-s0){const t=`${n}_${e}`;return Jo.set(t,1),t}else return n}const zN=new RegExp(/^[A-Za-z0-9][-A-Za-z0-9\._\/]*$/);function Zg(n){return!!n.match(zN)}/** + */const Jo=new Map;function rt(n){mo(DN,"DataFormat",n)}function MN(n){mo(FN,"InterpolationFormat",n)}function on(n){mo(_N,"PaddingMode",n)}function jg(n){mo(ON,"PoolMode",n)}const Fi=[],Kg="/";function go(n,e){Fi.push(n);try{const t=e();return Fi.pop(),t}catch(t){throw Fi.pop(),t}}function PN(){return Fi.length===0?"":Fi.join(Kg)+Kg}function Xg(n){if(!Zg(n))throw new Error("Not a valid tensor name: '"+n+"'");return PN()+n}function Yg(n){if(!Zg(n))throw new Error("Not a valid tensor name: '"+n+"'");Jo.has(n)||Jo.set(n,0);const e=Jo.get(n);if(Jo.set(n,Jo.get(n)+1),e>0){const t=`${n}_${e}`;return Jo.set(t,1),t}else return n}const BN=new RegExp(/^[A-Za-z0-9][-A-Za-z0-9\._\/]*$/);function Zg(n){return!!n.match(BN)}/** * @license * Copyright 2018 Google LLC * @@ -7497,7 +7497,7 @@ * license that can be found in the LICENSE file or at * https://opensource.org/licenses/MIT. * ============================================================================= - */function VN(n){return n===parseInt(n.toString(),10)}function Ts(n,e,t){e==null&&(e=0),t==null&&(t=n.length);let s=1;for(let o=e;oe&&(e=s)}return e}function Rn(n,e){if(ee&&(e=s)}return e}function Rn(n,e){if(e{if(n.shape.length!==2)throw new R(`repeat() expects a rank-2 tensor, but received a rank-${n.shape.length} tensor.`);const t=_i(n,1);return $d(t,[1,e,1])})}function UN(n){const e=[Ts(n.shape)];return O(n,e)}function GN(n){if(n.rank<=1)throw new R(`batchFlatten requires a minimum rank of 2. Got rank: ${n.rank}.`);const e=[n.shape[0],Ts(n.shape,1)];return O(n,e)}function xo(n,e,t){return B(()=>{switch(n.rank){case 1:return vh(n,e,t);case 2:return Am(n,[e,0],[t,n.shape[1]]);case 3:return Sh(n,[e,0,0],[t,n.shape[1],n.shape[2]]);case 4:return El(n,[e,0,0,0],[t,n.shape[1],n.shape[2],n.shape[3]]);case 5:return Ve(n,[e,0,0,0,0],[t,n.shape[1],n.shape[2],n.shape[3],n.shape[4]]);case 6:return Ve(n,[e,0,0,0,0,0],[t,n.shape[1],n.shape[2],n.shape[3],n.shape[4],n.shape[5]]);default:throw new R(`sliceAlongFirstAxis() received an unsupported tensor rank: ${n.rank}`)}})}function Cd(n,e,t){return B(()=>{switch(n.rank){case 1:return vh(n,e,t);case 2:return Am(n,[0,e],[n.shape[0],t]);case 3:return Sh(n,[0,0,e],[n.shape[0],n.shape[1],t]);case 4:return El(n,[0,0,0,e],[n.shape[0],n.shape[1],n.shape[2],t]);default:throw new R(`sliceAlongLastAxis() received an unsupported tensor rank: ${n.rank}`)}})}function Ml(n,e,t,s){return B(()=>{switch(n.rank){case 1:return vh(n,e,t);case 2:switch(s){case 1:return xo(n,e,t);case 2:return Cd(n,e,t);default:throw new R(`The axis is not within the rank of the tensor ${s}`)}case 3:switch(s){case 1:return xo(n,e,t);case 2:return Sh(n,[0,e,0],[n.shape[0],t,n.shape[2]]);case 3:return Cd(n,e,t);default:throw new R(`The axis is not within the rank of the tensor ${s}`)}case 4:switch(s){case 1:return xo(n,e,t);case 2:return El(n,[0,e,0,0],[n.shape[0],t,n.shape[2],n.shape[3]]);case 3:return El(n,[0,0,e,0],[n.shape[0],n.shape[1],t,n.shape[3]]);case 4:return Cd(n,e,t);default:throw new R(`The axis is not within the rank of the tensor ${s}`)}default:throw new R(`sliceAlongLastAxis() received an unsupported tensor rank: ${n.rank}`)}})}function Id(n,e=-1){let t;return e<0&&(t=n[0].rank,t!==0?e=t:e=0),e===n[0].rank&&(e=-1),Mt(n,e)}function Qg(n,e){switch(n.rank){case 1:return ZI([n,e]);case 2:return JI([n,e],0);case 3:return t$([n,e],0);case 4:return s$([n,e],0);default:throw new R(`concatAlongFirstAxis() received an unsupported tensor rank: ${n.rank}`)}}function $d(n,e){if(Array.isArray(e)||(e=[e]),n.rank!==e.length)throw new R(`The length of input n (${e.length}) does not match the number of dimensions in input x (${n.rank})`);return Tn(n,e)}function Pl(n,e=0,t=1,s,o){return hv(n,e,t,s,o)}function Xn(n,e,t,s){if(n.rank<2||e.rank<2)throw new Ie(`dot requires both inputs to be rank >= 2 but got x shape = ${n.shape} and y shape = ${e.shape}`);if(e.rank>=3){const o=n.shape.slice(-1)[0],r=e.shape.slice(-2)[0];if(o!==r)throw new Ie(`If rank y >= 3, then the second last dim of y must equal the last dim of x but got x shape = ${n.shape} and y shape = ${e.shape}`)}if(n.rank===2&&e.rank===2)return Mm({a:n,b:e,transposeA:!1,transposeB:!1,bias:s?kd(n.rank,s,An()):null,activation:t});{const o=n.shape.slice(),r=o.pop();n=O(n,[-1,r]);const i=e.shape.slice(),a=i.pop(),l=i.pop(),c=[...i,a],u=Array.from({length:e.rank},(f,m)=>m===0?e.rank-2:m<=e.rank-2?m-1:m);e=O(Ee(e,u),[l,-1]);const h=[...o,...c];return O(Mm({a:n,b:e,transposeA:!1,transposeB:!1,bias:s?kd(n.rank,s,An()):null,activation:t}),h)}}function Jg(n,e,t){return B(()=>(Array.isArray(e)?e=At(e,"int32"):e=re(e,"int32"),ch(n,e,t)))}function Oi(n){return D(n,n)}function kd(n,e,t){const s=e.shape;if(e.rank!==1&&e.rank!==n)throw new R(`Unexpected bias dimensions: ${e.rank}; expected it to be 1 or ${n}`);if(n===5){if(t==="channelsFirst")return s.length===1?O(e,[1,s[0],1,1,1]):O(e,[1,s[3],s[0],s[1],s[2]]);if(t==="channelsLast")return s.length===1?O(e,[1,1,1,1,s[0]]):O(e,[1].concat(s))}else if(n===4){if(t==="channelsFirst")return s.length===1?O(e,[1,s[0],1,1]):O(e,[1,s[2],s[0],s[1]]);if(t==="channelsLast")return s.length===1?O(e,[1,1,1,s[0]]):O(e,[1].concat(s))}else if(n===3){if(t==="channelsFirst")return s.length===1?O(e,[1,s[0],1]):O(e,[1,s[1],s[0]]);if(t==="channelsLast")return s.length===1?O(e,[1,1,s[0]]):O(e,[1].concat(s))}else if(n<3)return e;throw new R(`Unsupported input rank by biasAdd: ${e.rank}`)}function Dn(n,e,t){return B(()=>(t==null&&(t=An()),rt(t),J(n,kd(n.rank,e,t))))}function HN(n,e=1){if(e!==1)throw new Ie(`Support for alpha values other than 1 (${e}) is not implemented yet.`);return Il(n)}function qN(n){return B(()=>me(n,J(Lt(n),1)))}function ex(n,e,t,s){return B(()=>aS(n,e,t,s))}function jN(n){return B(()=>{const e=J(.5,D(.2,n));return nn(e,0,1)})}function Li(n,e,t=!1){return t?n():e()}/** + */function Kn(n,e){return re(n,e)}function _i(n,e=-1){const t=n.shape.slice();return e<0&&(e=t.length+e+1),t.splice(e,0,1),O(n,t)}function VN(n,e){return B(()=>{if(n.shape.length!==2)throw new R(`repeat() expects a rank-2 tensor, but received a rank-${n.shape.length} tensor.`);const t=_i(n,1);return Cd(t,[1,e,1])})}function WN(n){const e=[Ts(n.shape)];return O(n,e)}function UN(n){if(n.rank<=1)throw new R(`batchFlatten requires a minimum rank of 2. Got rank: ${n.rank}.`);const e=[n.shape[0],Ts(n.shape,1)];return O(n,e)}function xo(n,e,t){return B(()=>{switch(n.rank){case 1:return $h(n,e,t);case 2:return Am(n,[e,0],[t,n.shape[1]]);case 3:return kh(n,[e,0,0],[t,n.shape[1],n.shape[2]]);case 4:return El(n,[e,0,0,0],[t,n.shape[1],n.shape[2],n.shape[3]]);case 5:return Ve(n,[e,0,0,0,0],[t,n.shape[1],n.shape[2],n.shape[3],n.shape[4]]);case 6:return Ve(n,[e,0,0,0,0,0],[t,n.shape[1],n.shape[2],n.shape[3],n.shape[4],n.shape[5]]);default:throw new R(`sliceAlongFirstAxis() received an unsupported tensor rank: ${n.rank}`)}})}function yd(n,e,t){return B(()=>{switch(n.rank){case 1:return $h(n,e,t);case 2:return Am(n,[0,e],[n.shape[0],t]);case 3:return kh(n,[0,0,e],[n.shape[0],n.shape[1],t]);case 4:return El(n,[0,0,0,e],[n.shape[0],n.shape[1],n.shape[2],t]);default:throw new R(`sliceAlongLastAxis() received an unsupported tensor rank: ${n.rank}`)}})}function Ml(n,e,t,s){return B(()=>{switch(n.rank){case 1:return $h(n,e,t);case 2:switch(s){case 1:return xo(n,e,t);case 2:return yd(n,e,t);default:throw new R(`The axis is not within the rank of the tensor ${s}`)}case 3:switch(s){case 1:return xo(n,e,t);case 2:return kh(n,[0,e,0],[n.shape[0],t,n.shape[2]]);case 3:return yd(n,e,t);default:throw new R(`The axis is not within the rank of the tensor ${s}`)}case 4:switch(s){case 1:return xo(n,e,t);case 2:return El(n,[0,e,0,0],[n.shape[0],t,n.shape[2],n.shape[3]]);case 3:return El(n,[0,0,e,0],[n.shape[0],n.shape[1],t,n.shape[3]]);case 4:return yd(n,e,t);default:throw new R(`The axis is not within the rank of the tensor ${s}`)}default:throw new R(`sliceAlongLastAxis() received an unsupported tensor rank: ${n.rank}`)}})}function wd(n,e=-1){let t;return e<0&&(t=n[0].rank,t!==0?e=t:e=0),e===n[0].rank&&(e=-1),Ot(n,e)}function Qg(n,e){switch(n.rank){case 1:return YI([n,e]);case 2:return QI([n,e],0);case 3:return e$([n,e],0);case 4:return n$([n,e],0);default:throw new R(`concatAlongFirstAxis() received an unsupported tensor rank: ${n.rank}`)}}function Cd(n,e){if(Array.isArray(e)||(e=[e]),n.rank!==e.length)throw new R(`The length of input n (${e.length}) does not match the number of dimensions in input x (${n.rank})`);return Tn(n,e)}function Pl(n,e=0,t=1,s,o){return uv(n,e,t,s,o)}function Xn(n,e,t,s){if(n.rank<2||e.rank<2)throw new Ie(`dot requires both inputs to be rank >= 2 but got x shape = ${n.shape} and y shape = ${e.shape}`);if(e.rank>=3){const o=n.shape.slice(-1)[0],r=e.shape.slice(-2)[0];if(o!==r)throw new Ie(`If rank y >= 3, then the second last dim of y must equal the last dim of x but got x shape = ${n.shape} and y shape = ${e.shape}`)}if(n.rank===2&&e.rank===2)return Mm({a:n,b:e,transposeA:!1,transposeB:!1,bias:s?Id(n.rank,s,An()):null,activation:t});{const o=n.shape.slice(),r=o.pop();n=O(n,[-1,r]);const i=e.shape.slice(),a=i.pop(),l=i.pop(),c=[...i,a],u=Array.from({length:e.rank},(f,m)=>m===0?e.rank-2:m<=e.rank-2?m-1:m);e=O(Ee(e,u),[l,-1]);const h=[...o,...c];return O(Mm({a:n,b:e,transposeA:!1,transposeB:!1,bias:s?Id(n.rank,s,An()):null,activation:t}),h)}}function Jg(n,e,t){return B(()=>(Array.isArray(e)?e=Lt(e,"int32"):e=re(e,"int32"),ah(n,e,t)))}function Oi(n){return D(n,n)}function Id(n,e,t){const s=e.shape;if(e.rank!==1&&e.rank!==n)throw new R(`Unexpected bias dimensions: ${e.rank}; expected it to be 1 or ${n}`);if(n===5){if(t==="channelsFirst")return s.length===1?O(e,[1,s[0],1,1,1]):O(e,[1,s[3],s[0],s[1],s[2]]);if(t==="channelsLast")return s.length===1?O(e,[1,1,1,1,s[0]]):O(e,[1].concat(s))}else if(n===4){if(t==="channelsFirst")return s.length===1?O(e,[1,s[0],1,1]):O(e,[1,s[2],s[0],s[1]]);if(t==="channelsLast")return s.length===1?O(e,[1,1,1,s[0]]):O(e,[1].concat(s))}else if(n===3){if(t==="channelsFirst")return s.length===1?O(e,[1,s[0],1]):O(e,[1,s[1],s[0]]);if(t==="channelsLast")return s.length===1?O(e,[1,1,s[0]]):O(e,[1].concat(s))}else if(n<3)return e;throw new R(`Unsupported input rank by biasAdd: ${e.rank}`)}function Dn(n,e,t){return B(()=>(t==null&&(t=An()),rt(t),J(n,Id(n.rank,e,t))))}function GN(n,e=1){if(e!==1)throw new Ie(`Support for alpha values other than 1 (${e}) is not implemented yet.`);return Il(n)}function HN(n){return B(()=>me(n,J(_t(n),1)))}function ex(n,e,t,s){return B(()=>iS(n,e,t,s))}function qN(n){return B(()=>{const e=J(.5,D(.2,n));return nn(e,0,1)})}function Li(n,e,t=!1){return t?n():e()}/** * @license * Copyright 2018 Google LLC * @@ -7521,7 +7521,7 @@ * license that can be found in the LICENSE file or at * https://opensource.org/licenses/MIT. * ============================================================================= - */const KN=["fanIn","fanOut","fanAvg"],XN=["normal","uniform","truncatedNormal"];/** + */const jN=["fanIn","fanOut","fanAvg"],KN=["normal","uniform","truncatedNormal"];/** * @license * Copyright 2018 Google LLC * @@ -7529,7 +7529,7 @@ * license that can be found in the LICENSE file or at * https://opensource.org/licenses/MIT. * ============================================================================= - */function YN(n){mo(KN,"FanMode",n)}function ZN(n){mo(XN,"Distribution",n)}class bn extends Zo{fromConfigUsesCustomObjects(){return!1}getConfig(){return{}}}class tx extends bn{apply(e,t){return ot(e,t)}}tx.className="Zeros",Z(tx);class vd extends bn{apply(e,t){return Nn(e,t)}}vd.className="Ones",Z(vd);class nx extends bn{constructor(e){if(super(),typeof e!="object")throw new R(`Expected argument of type ConstantConfig but got ${e}`);if(e.value===void 0)throw new R(`config must have value set but got ${e}`);this.value=e.value}apply(e,t){return B(()=>D(De(this.value),Nn(e,t)))}getConfig(){return{value:this.value}}}nx.className="Constant",Z(nx);class sx extends bn{constructor(e){super(),this.DEFAULT_MINVAL=-.05,this.DEFAULT_MAXVAL=.05,this.minval=e.minval||this.DEFAULT_MINVAL,this.maxval=e.maxval||this.DEFAULT_MAXVAL,this.seed=e.seed}apply(e,t){return Si(e,this.minval,this.maxval,t,this.seed)}getConfig(){return{minval:this.minval,maxval:this.maxval,seed:this.seed}}}sx.className="RandomUniform",Z(sx);class ox extends bn{constructor(e){super(),this.DEFAULT_MEAN=0,this.DEFAULT_STDDEV=.05,this.mean=e.mean||this.DEFAULT_MEAN,this.stddev=e.stddev||this.DEFAULT_STDDEV,this.seed=e.seed}apply(e,t){if(t=t||"float32",t!=="float32"&&t!=="int32")throw new Ie(`randomNormal does not support dType ${t}.`);return Pl(e,this.mean,this.stddev,t,this.seed)}getConfig(){return{mean:this.mean,stddev:this.stddev,seed:this.seed}}}ox.className="RandomNormal",Z(ox);class rx extends bn{constructor(e){super(),this.DEFAULT_MEAN=0,this.DEFAULT_STDDEV=.05,this.mean=e.mean||this.DEFAULT_MEAN,this.stddev=e.stddev||this.DEFAULT_STDDEV,this.seed=e.seed}apply(e,t){if(t=t||"float32",t!=="float32"&&t!=="int32")throw new Ie(`truncatedNormal does not support dType ${t}.`);return _m(e,this.mean,this.stddev,t,this.seed)}getConfig(){return{mean:this.mean,stddev:this.stddev,seed:this.seed}}}rx.className="TruncatedNormal",Z(rx);class ix extends bn{constructor(e){super(),this.gain=e.gain!=null?e.gain:1}apply(e,t){return B(()=>{if(e.length!==2||e[0]!==e[1])throw new R("Identity matrix initializer can only be used for 2D square matrices.");return D(this.gain,gm(e[0]))})}getConfig(){return{gain:this.gain}}}ix.className="Identity",Z(ix);function QN(n,e="channelsLast"){let t,s;if(rt(e),n.length===2)t=n[0],s=n[1];else if([3,4,5].indexOf(n.length)!==-1){if(e==="channelsFirst"){const o=Ts(n,2);t=n[1]*o,s=n[0]*o}else if(e==="channelsLast"){const o=Ts(n,0,n.length-2);t=n[n.length-2]*o,s=n[n.length-1]*o}}else{const o=Ts(n);t=Math.sqrt(o),s=Math.sqrt(o)}return[t,s]}class Qt extends bn{constructor(e){if(super(),e.scale<0)throw new R(`scale must be a positive float. Got: ${e.scale}`);this.scale=e.scale==null?1:e.scale,this.mode=e.mode==null?"fanIn":e.mode,YN(this.mode),this.distribution=e.distribution==null?"normal":e.distribution,ZN(this.distribution),this.seed=e.seed}apply(e,t){const s=QN(e),o=s[0],r=s[1];let i=this.scale;if(this.mode==="fanIn"?i/=Math.max(1,o):this.mode==="fanOut"?i/=Math.max(1,r):i/=Math.max(1,(o+r)/2),this.distribution==="normal"){const a=Math.sqrt(i);if(t=t||"float32",t!=="float32"&&t!=="int32")throw new Ie(`${this.getClassName()} does not support dType ${t}.`);return _m(e,0,a,t,this.seed)}else{const a=Math.sqrt(3*i);return Si(e,-a,a,t,this.seed)}}getConfig(){return{scale:this.scale,mode:this.mode,distribution:this.distribution,seed:this.seed}}}Qt.className="VarianceScaling",Z(Qt);class Sd extends Qt{constructor(e){super({scale:1,mode:"fanAvg",distribution:"uniform",seed:e==null?null:e.seed})}getClassName(){return Qt.className}}Sd.className="GlorotUniform",Z(Sd);class Td extends Qt{constructor(e){super({scale:1,mode:"fanAvg",distribution:"normal",seed:e==null?null:e.seed})}getClassName(){return Qt.className}}Td.className="GlorotNormal",Z(Td);class Nd extends Qt{constructor(e){super({scale:2,mode:"fanIn",distribution:"normal",seed:e==null?null:e.seed})}getClassName(){return Qt.className}}Nd.className="HeNormal",Z(Nd);class Ed extends Qt{constructor(e){super({scale:2,mode:"fanIn",distribution:"uniform",seed:e==null?null:e.seed})}getClassName(){return Qt.className}}Ed.className="HeUniform",Z(Ed);class Rd extends Qt{constructor(e){super({scale:1,mode:"fanIn",distribution:"normal",seed:e==null?null:e.seed})}getClassName(){return Qt.className}}Rd.className="LeCunNormal",Z(Rd);class Ad extends Qt{constructor(e){super({scale:1,mode:"fanIn",distribution:"uniform",seed:e==null?null:e.seed})}getClassName(){return Qt.className}}Ad.className="LeCunUniform",Z(Ad);class ax extends bn{constructor(e){super(),this.DEFAULT_GAIN=1,this.ELEMENTS_WARN_SLOW=2e3,this.gain=e.gain==null?this.DEFAULT_GAIN:e.gain,this.seed=e.seed}apply(e,t){return B(()=>{if(e.length<2)throw new Ie("Shape must be at least 2D.");if(t!=="int32"&&t!=="float32"&&t!==void 0)throw new TypeError(`Unsupported data type ${t}.`);t=t;const s=G(e.slice(0,-1)),o=e[e.length-1],r=s*o;r>this.ELEMENTS_WARN_SLOW&&console.warn(`Orthogonal initializer is being called on a matrix with more than ${this.ELEMENTS_WARN_SLOW} (${r}) elements: Slowness may result.`);const i=[Math.max(o,s),Math.min(o,s)],a=Pl(i,0,1,t,this.seed),l=s2.qr(a,!1);let c=l[0];const h=l[1].flatten().stridedSlice([0],[Math.min(o,s)*Math.min(o,s)],[Math.min(o,s)+1]);return c=D(c,h.sign()),sD(De(this.value),Nn(e,t)))}getConfig(){return{value:this.value}}}nx.className="Constant",Z(nx);class sx extends bn{constructor(e){super(),this.DEFAULT_MINVAL=-.05,this.DEFAULT_MAXVAL=.05,this.minval=e.minval||this.DEFAULT_MINVAL,this.maxval=e.maxval||this.DEFAULT_MAXVAL,this.seed=e.seed}apply(e,t){return Si(e,this.minval,this.maxval,t,this.seed)}getConfig(){return{minval:this.minval,maxval:this.maxval,seed:this.seed}}}sx.className="RandomUniform",Z(sx);class ox extends bn{constructor(e){super(),this.DEFAULT_MEAN=0,this.DEFAULT_STDDEV=.05,this.mean=e.mean||this.DEFAULT_MEAN,this.stddev=e.stddev||this.DEFAULT_STDDEV,this.seed=e.seed}apply(e,t){if(t=t||"float32",t!=="float32"&&t!=="int32")throw new Ie(`randomNormal does not support dType ${t}.`);return Pl(e,this.mean,this.stddev,t,this.seed)}getConfig(){return{mean:this.mean,stddev:this.stddev,seed:this.seed}}}ox.className="RandomNormal",Z(ox);class rx extends bn{constructor(e){super(),this.DEFAULT_MEAN=0,this.DEFAULT_STDDEV=.05,this.mean=e.mean||this.DEFAULT_MEAN,this.stddev=e.stddev||this.DEFAULT_STDDEV,this.seed=e.seed}apply(e,t){if(t=t||"float32",t!=="float32"&&t!=="int32")throw new Ie(`truncatedNormal does not support dType ${t}.`);return _m(e,this.mean,this.stddev,t,this.seed)}getConfig(){return{mean:this.mean,stddev:this.stddev,seed:this.seed}}}rx.className="TruncatedNormal",Z(rx);class ix extends bn{constructor(e){super(),this.gain=e.gain!=null?e.gain:1}apply(e,t){return B(()=>{if(e.length!==2||e[0]!==e[1])throw new R("Identity matrix initializer can only be used for 2D square matrices.");return D(this.gain,gm(e[0]))})}getConfig(){return{gain:this.gain}}}ix.className="Identity",Z(ix);function ZN(n,e="channelsLast"){let t,s;if(rt(e),n.length===2)t=n[0],s=n[1];else if([3,4,5].indexOf(n.length)!==-1){if(e==="channelsFirst"){const o=Ts(n,2);t=n[1]*o,s=n[0]*o}else if(e==="channelsLast"){const o=Ts(n,0,n.length-2);t=n[n.length-2]*o,s=n[n.length-1]*o}}else{const o=Ts(n);t=Math.sqrt(o),s=Math.sqrt(o)}return[t,s]}class Qt extends bn{constructor(e){if(super(),e.scale<0)throw new R(`scale must be a positive float. Got: ${e.scale}`);this.scale=e.scale==null?1:e.scale,this.mode=e.mode==null?"fanIn":e.mode,XN(this.mode),this.distribution=e.distribution==null?"normal":e.distribution,YN(this.distribution),this.seed=e.seed}apply(e,t){const s=ZN(e),o=s[0],r=s[1];let i=this.scale;if(this.mode==="fanIn"?i/=Math.max(1,o):this.mode==="fanOut"?i/=Math.max(1,r):i/=Math.max(1,(o+r)/2),this.distribution==="normal"){const a=Math.sqrt(i);if(t=t||"float32",t!=="float32"&&t!=="int32")throw new Ie(`${this.getClassName()} does not support dType ${t}.`);return _m(e,0,a,t,this.seed)}else{const a=Math.sqrt(3*i);return Si(e,-a,a,t,this.seed)}}getConfig(){return{scale:this.scale,mode:this.mode,distribution:this.distribution,seed:this.seed}}}Qt.className="VarianceScaling",Z(Qt);class kd extends Qt{constructor(e){super({scale:1,mode:"fanAvg",distribution:"uniform",seed:e==null?null:e.seed})}getClassName(){return Qt.className}}kd.className="GlorotUniform",Z(kd);class vd extends Qt{constructor(e){super({scale:1,mode:"fanAvg",distribution:"normal",seed:e==null?null:e.seed})}getClassName(){return Qt.className}}vd.className="GlorotNormal",Z(vd);class Sd extends Qt{constructor(e){super({scale:2,mode:"fanIn",distribution:"normal",seed:e==null?null:e.seed})}getClassName(){return Qt.className}}Sd.className="HeNormal",Z(Sd);class Td extends Qt{constructor(e){super({scale:2,mode:"fanIn",distribution:"uniform",seed:e==null?null:e.seed})}getClassName(){return Qt.className}}Td.className="HeUniform",Z(Td);class Nd extends Qt{constructor(e){super({scale:1,mode:"fanIn",distribution:"normal",seed:e==null?null:e.seed})}getClassName(){return Qt.className}}Nd.className="LeCunNormal",Z(Nd);class Ed extends Qt{constructor(e){super({scale:1,mode:"fanIn",distribution:"uniform",seed:e==null?null:e.seed})}getClassName(){return Qt.className}}Ed.className="LeCunUniform",Z(Ed);class ax extends bn{constructor(e){super(),this.DEFAULT_GAIN=1,this.ELEMENTS_WARN_SLOW=2e3,this.gain=e.gain==null?this.DEFAULT_GAIN:e.gain,this.seed=e.seed}apply(e,t){return B(()=>{if(e.length<2)throw new Ie("Shape must be at least 2D.");if(t!=="int32"&&t!=="float32"&&t!==void 0)throw new TypeError(`Unsupported data type ${t}.`);t=t;const s=G(e.slice(0,-1)),o=e[e.length-1],r=s*o;r>this.ELEMENTS_WARN_SLOW&&console.warn(`Orthogonal initializer is being called on a matrix with more than ${this.ELEMENTS_WARN_SLOW} (${r}) elements: Slowness may result.`);const i=[Math.max(o,s),Math.min(o,s)],a=Pl(i,0,1,t,this.seed),l=n2.qr(a,!1);let c=l[0];const h=l[1].flatten().stridedSlice([0],[Math.min(o,s)*Math.min(o,s)],[Math.min(o,s)+1]);return c=D(c,h.sign()),se.read())}function _d(n){n.forEach(e=>{e[0].write(e[1])})}/** + */const ux="Variable";class QN{constructor(e,t="float32",s=ux,o=!0,r=null){this.dtype=t??"float32",this.shape=e.shape,this.id=qg(),s=s??ux,this.originalName=Xg(s),this.name=Yg(this.originalName),this.trainable_=o,this.constraint=r,this.val=tS(e,this.trainable_,this.name,this.dtype)}read(){return this.assertNotDisposed(),this.val}write(e){return this.assertNotDisposed(),JN(this.val,e),this.val.id!==e.id&&(this.val.assign(e),this.constraint!=null&&this.val.assign(this.constraint.apply(this.val))),this}dispose(){this.assertNotDisposed(),this.val.dispose()}assertNotDisposed(){if(this.val.isDisposed)throw new Error(`LayersVariable ${this.name} is already disposed.`)}get trainable(){return this.trainable_}set trainable(e){this.trainable_=e,this.val.trainable=e}}function JN(n,e){if(n.shape.toString()!==e.shape.toString())throw new Error("Shape mismatch: "+JSON.stringify(n.shape)+" vs. "+JSON.stringify(e.shape))}function Ad(n){return n.map(e=>e.read())}function Dd(n){n.forEach(e=>{e[0].write(e[1])})}/** * @license * Copyright 2018 Google LLC * @@ -7561,7 +7561,7 @@ * license that can be found in the LICENSE file or at * https://opensource.org/licenses/MIT. * ============================================================================= - */class dt{constructor(e){this.dtype=e.dtype,this.shape=e.shape,e.shape!=null?this.ndim=e.shape.length:this.ndim=e.ndim,this.maxNDim=e.maxNDim,this.minNDim=e.minNDim,this.axes=e.axes||{}}}class Yn{constructor(e,t,s,o,r,i,a){this.dtype=e,this.shape=t,this.sourceLayer=s,this.inputs=o,this.callArgs=r,this.outputTensorIndex=a,this.id=qg(),i!=null&&(this.originalName=Xg(i),this.name=Yg(this.originalName)),this.rank=t.length}}let tE=0;class Vl{constructor(e,t){this.callArgs=t,this.id=tE++,this.outboundLayer=e.outboundLayer,this.inboundLayers=e.inboundLayers,this.nodeIndices=e.nodeIndices,this.tensorIndices=e.tensorIndices,this.inputTensors=e.inputTensors,this.outputTensors=e.outputTensors,this.inputMasks=e.inputMasks,this.outputMasks=e.outputMasks,this.inputShapes=e.inputShapes,this.outputShapes=e.outputShapes;for(const s of e.inboundLayers)s!=null&&s.outboundNodes.push(this);e.outboundLayer.inboundNodes.push(this)}getConfig(){const e=[];for(const t of this.inboundLayers)t!=null?e.push(t.name):e.push(null);return{outboundLayer:this.outboundLayer?this.outboundLayer.name:null,inboundLayers:e,nodeIndices:this.nodeIndices,tensorIndices:this.tensorIndices}}}let nE=0;class ve extends Zo{constructor(e={}){super(),this._callHook=null,this._addedWeightNames=[],this._stateful=!1,this.id=nE++,this.activityRegularizer=null,this.inputSpec=null,this.supportsMasking=!1,this._trainableWeights=[],this._nonTrainableWeights=[],this._losses=[],this._updates=[],this._built=!1,this.inboundNodes=[],this.outboundNodes=[];let t=e.name;if(!t){const s=this.getClassName();t=hs(s)+"_"+Ll(s)}if(this.name=t,this.trainable_=e.trainable==null?!0:e.trainable,e.inputShape!=null||e.batchInputShape!=null){let s;if(e.batchInputShape!=null)s=e.batchInputShape;else if(e.inputShape!=null){let r=null;e.batchSize!=null&&(r=e.batchSize),s=[r].concat(e.inputShape)}this.batchInputShape=s;let o=e.dtype;o==null&&(o=e.inputDType),o==null&&(o="float32"),this.dtype=o}e.weights!=null?this.initialWeights=e.weights:this.initialWeights=null,this._refCount=null,this.fastWeightInitDuringBuild=!1}static nodeKey(e,t){return e.name+"_ib-"+t.toString()}getNodeAtIndex(e,t){if(this.inboundNodes.length===0)throw new gn(`The layer has never been called and thus has no defined ${t}.`);if(this.inboundNodes.length<=e)throw new R(`Asked to get ${t} at node ${e}, but the layer has only ${this.inboundNodes.length} inbound nodes.`);return this.inboundNodes[e]}getInputAt(e){return Ht(this.getNodeAtIndex(e,"input").inputTensors)}getOutputAt(e){return Ht(this.getNodeAtIndex(e,"output").outputTensors)}get input(){if(this.inboundNodes.length>1)throw new qn(`Layer ${this.name} has multiple inbound nodes, hence the notion of "layer input" is ill-defined. Use \`getInputAt(nodeIndex)\` instead.`);if(this.inboundNodes.length===0)throw new qn(`Layer ${this.name} is not connected, no input to return.`);return Ht(this.getNodeAtIndex(0,"input").inputTensors)}get output(){if(this.inboundNodes.length===0)throw new qn(`Layer ${this.name} has no inbound nodes.`);if(this.inboundNodes.length>1)throw new qn(`Layer ${this.name} has multiple inbound nodes, hence the notion of "layer output" is ill-defined. Use \`getOutputAt(nodeIndex)\` instead.`);return Ht(this.getNodeAtIndex(0,"output").outputTensors)}get losses(){return this._losses}calculateLosses(){return this.losses.map(e=>e())}get updates(){return this._updates}get built(){return this._built}set built(e){this._built=e}get trainable(){return this.trainable_}set trainable(e){this._trainableWeights.forEach(t=>t.trainable=e),this.trainable_=e}get trainableWeights(){return this.trainable_?this._trainableWeights.filter(e=>e.trainable):[]}set trainableWeights(e){this._trainableWeights=e}get nonTrainableWeights(){return this.trainable?this._trainableWeights.filter(e=>!e.trainable).concat(this._nonTrainableWeights):this._trainableWeights.concat(this._nonTrainableWeights)}set nonTrainableWeights(e){this._nonTrainableWeights=e}get weights(){return this.trainableWeights.concat(this.nonTrainableWeights)}get stateful(){return this._stateful}resetStates(){if(!this.stateful)throw new Error("Cannot call the resetStates() method of a non-stateful Layer object.")}assertInputCompatibility(e){const t=Oe(e);if(this.inputSpec==null||this.inputSpec.length===0)return;const s=Oe(this.inputSpec);if(t.length!==s.length)throw new R(`Layer ${this.name} expects ${s.length} inputs, but it received ${t.length} input tensors. Input received: ${e}`);for(let o=0;oi.maxNDim)throw new R(`Input ${o} is incompatible with layer ${this.name}: expected max_ndim=${i.maxNDim}, found ndim=${a}`);if(i.minNDim!=null&&a=0?l[u]:l[l.length+u];if(h!=null&&[h,null].indexOf(d)===-1)throw new R(`Input ${o} is incompatible with layer ${this.name}: expected axis ${u} of input shape to have value ${h} but got shape ${l}.`)}}if(i.shape!=null)for(let l=0;l{if(!this.built){this.assertInputCompatibility(e);const i=[];for(const a of Oe(e))i.push(a.shape);this.build(Ht(i)),this.built=!0,this.initialWeights&&this.setWeights(this.initialWeights),this._refCount===null&&r&&(this._refCount=1)}if(this.assertInputCompatibility(e),r){let i=this.call(e,t);this.supportsMasking&&this.setMaskMetadata(e,i);const a=Oe(i),l=[];for(let c of a)s.indexOf(c)!==-1&&(c=c.clone()),l.push(c);if(i=Ht(l),this.activityRegularizer!=null)throw new Ie("Layer invocation in the presence of activity regularizer(s) is not supported yet.");return i}else{const i=sE(e),a=this.computeOutputShape(i);let l;const c=oE(e);if(this.warnOnIncompatibleInputShape(Array.isArray(e)?i[0]:i),a!=null&&a.length>0&&Array.isArray(a[0])?l=a.map((u,h)=>new Yn(c,u,this,Oe(e),t,this.name,h)):l=new Yn(c,a,this,Oe(e),t,this.name),this.addInboundNode(e,l,null,null,i,a,t),this._refCount++,this.activityRegularizer!=null)throw new Ie("Layer invocation in the presence of activity regularizer(s) is not supported yet.");return l}})}warnOnIncompatibleInputShape(e){if(this.batchInputShape!=null)if(e.length!==this.batchInputShape.length)console.warn(`The rank of the input tensor provided (shape: ${JSON.stringify(e)}) does not match that of the batchInputShape (${JSON.stringify(this.batchInputShape)}) of the layer ${this.name}`);else{let t=!1;this.batchInputShape.forEach((s,o)=>{s!=null&&e[o]!=null&&e[o]!==s&&(t=!0)}),t&&console.warn(`The shape of the input tensor (${JSON.stringify(e)}) does not match the expectation of layer ${this.name}: ${JSON.stringify(this.batchInputShape)}`)}}get outputShape(){if(this.inboundNodes==null||this.inboundNodes.length===0)throw new qn(`The layer ${this.name} has never been called and thus has no defined output shape.`);const e=[];for(const t of this.inboundNodes){const s=JSON.stringify(t.outputShapes);e.indexOf(s)===-1&&e.push(s)}if(e.length===1){const t=this.inboundNodes[0].outputShapes;return Array.isArray(t)&&Array.isArray(t[0])&&t.length===1?t[0]:t}else throw new qn(`The layer ${this.name} has multiple inbound nodes with different output shapes. Hence the notion of "output shape" is ill-defined for the layer.`)}countParams(){if(!this.built)throw new gn(`You tried to call countParams() on ${this.name}, but the layer is not built yet. Build it first by calling build(batchInputShape).`);return zl(this.weights)}build(e){this.built=!0}getWeights(e=!1){return Fd(e?this.trainableWeights:this.weights)}setWeights(e){B(()=>{const t=this.weights;if(t.length!==e.length)throw new R(`You called setWeights(weights) on layer "${this.name}" with a weight list of length ${e.length}, but the layer was expecting ${t.length} weights. Provided weights: ${e}...`);if(t.length===0)return;const s=[],o=Fd(t);for(let r=0;rr.apply(u.read())),i==null&&(i=!0),i?this._trainableWeights.push(u):this._nonTrainableWeights.push(u),u}setFastWeightInitDuringBuild(e){this.fastWeightInitDuringBuild=e}addLoss(e){e==null||Array.isArray(e)&&e.length===0||(e=Oe(e),this._losses!==void 0&&this._losses!==null&&this.losses.push(...e))}computeOutputShape(e){return e}computeMask(e,t){if(!this.supportsMasking){if(t!=null)if(Array.isArray(t))t.forEach(s=>{if(s!=null)throw new TypeError(`Layer ${this.name} does not support masking, but was passed an inputMask.`)});else throw new TypeError(`Layer ${this.name} does not support masking, but was passed an inputMask.`);return null}return t}setMaskMetadata(e,t,s){if(!this.supportsMasking)return;const o=this.computeMask(e,s),r=Oe(t),i=Oe(o);if(r.length!==i.length)throw new Error(`${this.name} outputs ${r.length} tensors but ${r.length} masks for those tensors`);for(let a=0;ae.dispose()),this.weights.length}assertNotDisposed(){if(this._refCount===0)throw new Error(`Layer '${this.name}' is already disposed.`)}dispose(){if(!this.built)throw new Error(`Cannot dispose Layer ${this.name} because it has not been built yet.`);if(this._refCount===null)throw new Error(`Cannot dispose Layer ${this.name} because it has not been used yet.`);this.assertNotDisposed();let e=0;return--this._refCount===0&&(e=this.disposeWeights()),{refCountAfterDispose:this._refCount,numDisposedVariables:e}}}function sE(n){n=Oe(n);const e=[];for(const t of n)e.push(t.shape);return Ht(e)}function oE(n){return"float32"}function hx(n,e,t){if((e==null||t!=null&&t>0)&&(e=n.sourceLayer,t=n.nodeIndex),e.inboundNodes.length===0)return[n];{const s=e.inboundNodes[t];if(s.inboundLayers.length===0)return s.inputTensors;{const o=[];for(let r=0;r1)throw new qn(`Layer ${this.name} has multiple inbound nodes, hence the notion of "layer input" is ill-defined. Use \`getInputAt(nodeIndex)\` instead.`);if(this.inboundNodes.length===0)throw new qn(`Layer ${this.name} is not connected, no input to return.`);return Ht(this.getNodeAtIndex(0,"input").inputTensors)}get output(){if(this.inboundNodes.length===0)throw new qn(`Layer ${this.name} has no inbound nodes.`);if(this.inboundNodes.length>1)throw new qn(`Layer ${this.name} has multiple inbound nodes, hence the notion of "layer output" is ill-defined. Use \`getOutputAt(nodeIndex)\` instead.`);return Ht(this.getNodeAtIndex(0,"output").outputTensors)}get losses(){return this._losses}calculateLosses(){return this.losses.map(e=>e())}get updates(){return this._updates}get built(){return this._built}set built(e){this._built=e}get trainable(){return this.trainable_}set trainable(e){this._trainableWeights.forEach(t=>t.trainable=e),this.trainable_=e}get trainableWeights(){return this.trainable_?this._trainableWeights.filter(e=>e.trainable):[]}set trainableWeights(e){this._trainableWeights=e}get nonTrainableWeights(){return this.trainable?this._trainableWeights.filter(e=>!e.trainable).concat(this._nonTrainableWeights):this._trainableWeights.concat(this._nonTrainableWeights)}set nonTrainableWeights(e){this._nonTrainableWeights=e}get weights(){return this.trainableWeights.concat(this.nonTrainableWeights)}get stateful(){return this._stateful}resetStates(){if(!this.stateful)throw new Error("Cannot call the resetStates() method of a non-stateful Layer object.")}assertInputCompatibility(e){const t=Oe(e);if(this.inputSpec==null||this.inputSpec.length===0)return;const s=Oe(this.inputSpec);if(t.length!==s.length)throw new R(`Layer ${this.name} expects ${s.length} inputs, but it received ${t.length} input tensors. Input received: ${e}`);for(let o=0;oi.maxNDim)throw new R(`Input ${o} is incompatible with layer ${this.name}: expected max_ndim=${i.maxNDim}, found ndim=${a}`);if(i.minNDim!=null&&a=0?l[u]:l[l.length+u];if(h!=null&&[h,null].indexOf(d)===-1)throw new R(`Input ${o} is incompatible with layer ${this.name}: expected axis ${u} of input shape to have value ${h} but got shape ${l}.`)}}if(i.shape!=null)for(let l=0;l{if(!this.built){this.assertInputCompatibility(e);const i=[];for(const a of Oe(e))i.push(a.shape);this.build(Ht(i)),this.built=!0,this.initialWeights&&this.setWeights(this.initialWeights),this._refCount===null&&r&&(this._refCount=1)}if(this.assertInputCompatibility(e),r){let i=this.call(e,t);this.supportsMasking&&this.setMaskMetadata(e,i);const a=Oe(i),l=[];for(let c of a)s.indexOf(c)!==-1&&(c=c.clone()),l.push(c);if(i=Ht(l),this.activityRegularizer!=null)throw new Ie("Layer invocation in the presence of activity regularizer(s) is not supported yet.");return i}else{const i=nE(e),a=this.computeOutputShape(i);let l;const c=sE(e);if(this.warnOnIncompatibleInputShape(Array.isArray(e)?i[0]:i),a!=null&&a.length>0&&Array.isArray(a[0])?l=a.map((u,h)=>new Yn(c,u,this,Oe(e),t,this.name,h)):l=new Yn(c,a,this,Oe(e),t,this.name),this.addInboundNode(e,l,null,null,i,a,t),this._refCount++,this.activityRegularizer!=null)throw new Ie("Layer invocation in the presence of activity regularizer(s) is not supported yet.");return l}})}warnOnIncompatibleInputShape(e){if(this.batchInputShape!=null)if(e.length!==this.batchInputShape.length)console.warn(`The rank of the input tensor provided (shape: ${JSON.stringify(e)}) does not match that of the batchInputShape (${JSON.stringify(this.batchInputShape)}) of the layer ${this.name}`);else{let t=!1;this.batchInputShape.forEach((s,o)=>{s!=null&&e[o]!=null&&e[o]!==s&&(t=!0)}),t&&console.warn(`The shape of the input tensor (${JSON.stringify(e)}) does not match the expectation of layer ${this.name}: ${JSON.stringify(this.batchInputShape)}`)}}get outputShape(){if(this.inboundNodes==null||this.inboundNodes.length===0)throw new qn(`The layer ${this.name} has never been called and thus has no defined output shape.`);const e=[];for(const t of this.inboundNodes){const s=JSON.stringify(t.outputShapes);e.indexOf(s)===-1&&e.push(s)}if(e.length===1){const t=this.inboundNodes[0].outputShapes;return Array.isArray(t)&&Array.isArray(t[0])&&t.length===1?t[0]:t}else throw new qn(`The layer ${this.name} has multiple inbound nodes with different output shapes. Hence the notion of "output shape" is ill-defined for the layer.`)}countParams(){if(!this.built)throw new gn(`You tried to call countParams() on ${this.name}, but the layer is not built yet. Build it first by calling build(batchInputShape).`);return zl(this.weights)}build(e){this.built=!0}getWeights(e=!1){return Ad(e?this.trainableWeights:this.weights)}setWeights(e){B(()=>{const t=this.weights;if(t.length!==e.length)throw new R(`You called setWeights(weights) on layer "${this.name}" with a weight list of length ${e.length}, but the layer was expecting ${t.length} weights. Provided weights: ${e}...`);if(t.length===0)return;const s=[],o=Ad(t);for(let r=0;rr.apply(u.read())),i==null&&(i=!0),i?this._trainableWeights.push(u):this._nonTrainableWeights.push(u),u}setFastWeightInitDuringBuild(e){this.fastWeightInitDuringBuild=e}addLoss(e){e==null||Array.isArray(e)&&e.length===0||(e=Oe(e),this._losses!==void 0&&this._losses!==null&&this.losses.push(...e))}computeOutputShape(e){return e}computeMask(e,t){if(!this.supportsMasking){if(t!=null)if(Array.isArray(t))t.forEach(s=>{if(s!=null)throw new TypeError(`Layer ${this.name} does not support masking, but was passed an inputMask.`)});else throw new TypeError(`Layer ${this.name} does not support masking, but was passed an inputMask.`);return null}return t}setMaskMetadata(e,t,s){if(!this.supportsMasking)return;const o=this.computeMask(e,s),r=Oe(t),i=Oe(o);if(r.length!==i.length)throw new Error(`${this.name} outputs ${r.length} tensors but ${r.length} masks for those tensors`);for(let a=0;ae.dispose()),this.weights.length}assertNotDisposed(){if(this._refCount===0)throw new Error(`Layer '${this.name}' is already disposed.`)}dispose(){if(!this.built)throw new Error(`Cannot dispose Layer ${this.name} because it has not been built yet.`);if(this._refCount===null)throw new Error(`Cannot dispose Layer ${this.name} because it has not been used yet.`);this.assertNotDisposed();let e=0;return--this._refCount===0&&(e=this.disposeWeights()),{refCountAfterDispose:this._refCount,numDisposedVariables:e}}}function nE(n){n=Oe(n);const e=[];for(const t of n)e.push(t.shape);return Ht(e)}function sE(n){return"float32"}function hx(n,e,t){if((e==null||t!=null&&t>0)&&(e=n.sourceLayer,t=n.nodeIndex),e.inboundNodes.length===0)return[n];{const s=e.inboundNodes[t];if(s.inboundLayers.length===0)return s.inputTensors;{const o=[];for(let r=0;rf.name),l=[],c=e.names();for(const f of a)c.indexOf(f)!==-1?l.push(e.getValue(f)):l.push(null);s!=null&&(s.maxNumTensors=-1/0,s.minNumTensors=1/0);const u=a.join(",")+"|"+e.names().sort().join(",");let h=Wl.get(u),d;if(h==null){const f=uE(i,e);h=f.sorted,d=f.recipientCounts,Wl.put(u,h),Ul.put(u,d)}d={},o||Object.assign(d,Ul.get(u));const p=new Es(e);for(let f=0;fs.maxNumTensors&&(s.maxNumTensors=S),S0,()=>"Expected at least one fetch, got none");let t=[],s={};if(n.length===1){const o=dx(n[0],e);t=o.sorted,s=o.recipientMap}else{const o=new Set;for(const r of n){const{sorted:i,recipientMap:a}=dx(r,e);for(const l of i)o.has(l.name)||(t.push(l),o.add(l.name));for(const l in a)s[l]==null&&(s[l]=new Set),a[l].forEach(c=>s[l].add(c))}}return{sorted:t,recipientCounts:hE(s)}}function hE(n){const e={};for(const t in n)e[t]=n[t].size;return e}function dx(n,e){const t=new Set,s=[],o={};for(const a of e.names())t.add(a);const r=[],i=[];for(r.push(n);r.length>0;){const a=r[r.length-1];if(t.has(a.name)){r.pop();continue}const l=i[i.length-1]===r.length-1;if(a.inputs.length===0||l)r.pop(),s.push(a),t.add(a.name),l&&i.pop();else{i.push(r.length-1);for(const c of a.inputs)o[c.name]==null&&(o[c.name]=new Set),o[c.name].add(a.name),!t.has(c.name)&&r.push(c)}}return{sorted:s,recipientMap:o}}function dE(n){let e;if(n.sourceLayer.inboundNodes.length===1)e=n.sourceLayer.output;else{let t=null;for(let s=0;sf.name),l=[],c=e.names();for(const f of a)c.indexOf(f)!==-1?l.push(e.getValue(f)):l.push(null);s!=null&&(s.maxNumTensors=-1/0,s.minNumTensors=1/0);const u=a.join(",")+"|"+e.names().sort().join(",");let h=Wl.get(u),d;if(h==null){const f=cE(i,e);h=f.sorted,d=f.recipientCounts,Wl.put(u,h),Ul.put(u,d)}d={},o||Object.assign(d,Ul.get(u));const p=new Es(e);for(let f=0;fs.maxNumTensors&&(s.maxNumTensors=S),S0,()=>"Expected at least one fetch, got none");let t=[],s={};if(n.length===1){const o=dx(n[0],e);t=o.sorted,s=o.recipientMap}else{const o=new Set;for(const r of n){const{sorted:i,recipientMap:a}=dx(r,e);for(const l of i)o.has(l.name)||(t.push(l),o.add(l.name));for(const l in a)s[l]==null&&(s[l]=new Set),a[l].forEach(c=>s[l].add(c))}}return{sorted:t,recipientCounts:uE(s)}}function uE(n){const e={};for(const t in n)e[t]=n[t].size;return e}function dx(n,e){const t=new Set,s=[],o={};for(const a of e.names())t.add(a);const r=[],i=[];for(r.push(n);r.length>0;){const a=r[r.length-1];if(t.has(a.name)){r.pop();continue}const l=i[i.length-1]===r.length-1;if(a.inputs.length===0||l)r.pop(),s.push(a),t.add(a.name),l&&i.pop();else{i.push(r.length-1);for(const c of a.inputs)o[c.name]==null&&(o[c.name]=new Set),o[c.name].add(a.name),!t.has(c.name)&&r.push(c)}}return{sorted:s,recipientMap:o}}function hE(n){let e;if(n.sourceLayer.inboundNodes.length===1)e=n.sourceLayer.output;else{let t=null;for(let s=0;s100,cE);/** + */V().registerFlag("TOPOLOGICAL_SORT_CACHE_MAX_ENTRIES",()=>100,lE);/** * @license * Copyright 2018 Google LLC * @@ -7600,7 +7600,7 @@ * license that can be found in the LICENSE file or at * https://opensource.org/licenses/MIT. * ============================================================================= - */function Od(n,e){return B(()=>Rt(de(D(n,n),e,!0)))}class Bi extends Zo{getConfig(){return{}}}class px extends Bi{constructor(e){super(),this.defaultMaxValue=2,this.defaultAxis=0,this.maxValue=e.maxValue!=null?e.maxValue:this.defaultMaxValue,this.axis=e.axis!=null?e.axis:this.defaultAxis}apply(e){return B(()=>{const t=Od(e,this.axis),s=nn(t,0,this.maxValue);return D(e,me(s,J(ht(),t)))})}getConfig(){return{maxValue:this.maxValue,axis:this.axis}}}px.className="MaxNorm",Z(px);class fx extends Bi{constructor(e){super(),this.defaultAxis=0,this.axis=e.axis!=null?e.axis:this.defaultAxis}apply(e){return B(()=>me(e,J(ht(),Od(e,this.axis))))}getConfig(){return{axis:this.axis}}}fx.className="UnitNorm",Z(fx);class mx extends Bi{apply(e){return co(e)}}mx.className="NonNeg",Z(mx);class gx extends Bi{constructor(e){super(),this.defaultMinValue=0,this.defaultMaxValue=1,this.defaultRate=1,this.defaultAxis=0,this.minValue=e.minValue!=null?e.minValue:this.defaultMinValue,this.maxValue=e.maxValue!=null?e.maxValue:this.defaultMaxValue,this.rate=e.rate!=null?e.rate:this.defaultRate,this.axis=e.axis!=null?e.axis:this.defaultAxis}apply(e){return B(()=>{const t=Od(e,this.axis),s=J(D(this.rate,nn(t,this.minValue,this.maxValue)),D(1-this.rate,t));return D(e,me(s,J(ht(),t)))})}getConfig(){return{minValue:this.minValue,maxValue:this.maxValue,rate:this.rate,axis:this.axis}}}gx.className="MinMaxNorm",Z(gx);const xx={maxNorm:"MaxNorm",minMaxNorm:"MinMaxNorm",nonNeg:"NonNeg",unitNorm:"UnitNorm"};function pt(n){return xd(n)}function bx(n,e={}){return Di(n,mn.getMap().classNameMap,e,"constraint")}function ft(n){if(n==null)return null;if(typeof n=="string"){const t={className:n in xx?xx[n]:n,config:{}};return bx(t)}else return n instanceof Bi?n:bx(n)}/** + */function Fd(n,e){return B(()=>Rt(de(D(n,n),e,!0)))}class Bi extends Zo{getConfig(){return{}}}class px extends Bi{constructor(e){super(),this.defaultMaxValue=2,this.defaultAxis=0,this.maxValue=e.maxValue!=null?e.maxValue:this.defaultMaxValue,this.axis=e.axis!=null?e.axis:this.defaultAxis}apply(e){return B(()=>{const t=Fd(e,this.axis),s=nn(t,0,this.maxValue);return D(e,me(s,J(ht(),t)))})}getConfig(){return{maxValue:this.maxValue,axis:this.axis}}}px.className="MaxNorm",Z(px);class fx extends Bi{constructor(e){super(),this.defaultAxis=0,this.axis=e.axis!=null?e.axis:this.defaultAxis}apply(e){return B(()=>me(e,J(ht(),Fd(e,this.axis))))}getConfig(){return{axis:this.axis}}}fx.className="UnitNorm",Z(fx);class mx extends Bi{apply(e){return co(e)}}mx.className="NonNeg",Z(mx);class gx extends Bi{constructor(e){super(),this.defaultMinValue=0,this.defaultMaxValue=1,this.defaultRate=1,this.defaultAxis=0,this.minValue=e.minValue!=null?e.minValue:this.defaultMinValue,this.maxValue=e.maxValue!=null?e.maxValue:this.defaultMaxValue,this.rate=e.rate!=null?e.rate:this.defaultRate,this.axis=e.axis!=null?e.axis:this.defaultAxis}apply(e){return B(()=>{const t=Fd(e,this.axis),s=J(D(this.rate,nn(t,this.minValue,this.maxValue)),D(1-this.rate,t));return D(e,me(s,J(ht(),t)))})}getConfig(){return{minValue:this.minValue,maxValue:this.maxValue,rate:this.rate,axis:this.axis}}}gx.className="MinMaxNorm",Z(gx);const xx={maxNorm:"MaxNorm",minMaxNorm:"MinMaxNorm",nonNeg:"NonNeg",unitNorm:"UnitNorm"};function pt(n){return md(n)}function bx(n,e={}){return Di(n,mn.getMap().classNameMap,e,"constraint")}function ft(n){if(n==null)return null;if(typeof n=="string"){const t={className:n in xx?xx[n]:n,config:{}};return bx(t)}else return n instanceof Bi?n:bx(n)}/** * @license * Copyright 2018 Google LLC * @@ -7616,7 +7616,7 @@ * license that can be found in the LICENSE file or at * https://opensource.org/licenses/MIT. * ============================================================================= - */var wx;(function(n){n[n.SILENT=0]="SILENT",n[n.VERBOSE=1]="VERBOSE"})(wx||(wx={}));const pE=125;class zi{constructor(){this.validationData=null}setParams(e){this.params=e}async onEpochBegin(e,t){}async onEpochEnd(e,t){}async onBatchBegin(e,t){}async onBatchEnd(e,t){}async onTrainBegin(e){}async onTrainEnd(e){}setModel(e){}}class fE{constructor(e,t=10){e==null&&(e=[]),this.callbacks=e,this.queueLength=t}append(e){this.callbacks.push(e)}setParams(e){for(const t of this.callbacks)t.setParams(e)}setModel(e){for(const t of this.callbacks)t.setModel(e)}async onEpochBegin(e,t){t==null&&(t={});for(const s of this.callbacks)await s.onEpochBegin(e,t)}async onEpochEnd(e,t){t==null&&(t={});for(const s of this.callbacks)await s.onEpochEnd(e,t)}async onBatchBegin(e,t){t==null&&(t={});for(const s of this.callbacks)await s.onBatchBegin(e,t)}async onBatchEnd(e,t){t==null&&(t={});for(const s of this.callbacks)await s.onBatchEnd(e,t)}async onTrainBegin(e){e==null&&(e={});for(const t of this.callbacks)await t.onTrainBegin(e)}async onTrainEnd(e){e==null&&(e={});for(const t of this.callbacks)await t.onTrainEnd(e)}}class mE extends zi{constructor(){super()}async onEpochBegin(e){this.seen=0,this.totals={}}async onBatchEnd(e,t){t==null&&(t={});const s=t.size==null?0:t.size;this.seen+=s;for(const o in t){const r=t[o];if(typeof r=="number")this.totals.hasOwnProperty(o)||(this.totals[o]=0),this.totals[o]=this.totals[o]+r*s;else{let i;o in this.totals?i=this.totals[o]:this.totals[o]=0;const a=B(()=>J(this.totals[o],D(r,s)));this.totals[o]=a,i!=null&&i.dispose()}}}async onEpochEnd(e,t){if(t!=null)for(const s of this.params.metrics)this.totals[s]!=null&&(typeof this.totals[s]=="number"?t[s]=this.totals[s]/this.seen:B(()=>{const o=D(me(1,this.seen),this.totals[s]);t[s]=o,this.totals[s].dispose(),dn(t[s])}))}}class gE extends zi{async onTrainBegin(e){this.epoch=[],this.history={}}async onEpochEnd(e,t){t==null&&(t={}),this.epoch.push(e);for(const s in t)this.history[s]==null&&(this.history[s]=[]),this.history[s].push(t[s])}async syncData(){const e=[],t=[],s=[];for(const r in this.history){const i=this.history[r];for(let a=0;anew xE(s,e))}class yn{constructor(){}static registerCallbackConstructor(e,t){v(e>=0&&Number.isInteger(e),()=>`Verbosity level is expected to be an integer >= 0, but got ${e}`),yn.checkForDuplicate(t),yn.constructors[e]==null&&(yn.constructors[e]=[]),yn.constructors[e].push(t)}static checkForDuplicate(e){for(const t in yn.constructors)yn.constructors[+t].forEach(o=>{if(o===e)throw new R("Duplicate callback constructor.")})}static clear(){yn.constructors={}}static createCallbacks(e){const t=[];for(const s in yn.constructors){const o=+s;e>=o&&t.push(...yn.constructors[o])}return t.map(s=>new s)}}yn.constructors={};function Ix(n,e,t,s,o,r,i,a,l){const c=new gE,u=[new mE,...yn.createCallbacks(e)];n!=null&&u.push(...n),u.push(c);const h=new fE(u);return h.setParams({epochs:t,initialEpoch:s,samples:o,steps:r,batchSize:i,verbose:e,doValidation:a,metrics:l}),{callbackList:h,history:c}}/** + */var wx;(function(n){n[n.SILENT=0]="SILENT",n[n.VERBOSE=1]="VERBOSE"})(wx||(wx={}));const dE=125;class zi{constructor(){this.validationData=null}setParams(e){this.params=e}async onEpochBegin(e,t){}async onEpochEnd(e,t){}async onBatchBegin(e,t){}async onBatchEnd(e,t){}async onTrainBegin(e){}async onTrainEnd(e){}setModel(e){}}class pE{constructor(e,t=10){e==null&&(e=[]),this.callbacks=e,this.queueLength=t}append(e){this.callbacks.push(e)}setParams(e){for(const t of this.callbacks)t.setParams(e)}setModel(e){for(const t of this.callbacks)t.setModel(e)}async onEpochBegin(e,t){t==null&&(t={});for(const s of this.callbacks)await s.onEpochBegin(e,t)}async onEpochEnd(e,t){t==null&&(t={});for(const s of this.callbacks)await s.onEpochEnd(e,t)}async onBatchBegin(e,t){t==null&&(t={});for(const s of this.callbacks)await s.onBatchBegin(e,t)}async onBatchEnd(e,t){t==null&&(t={});for(const s of this.callbacks)await s.onBatchEnd(e,t)}async onTrainBegin(e){e==null&&(e={});for(const t of this.callbacks)await t.onTrainBegin(e)}async onTrainEnd(e){e==null&&(e={});for(const t of this.callbacks)await t.onTrainEnd(e)}}class fE extends zi{constructor(){super()}async onEpochBegin(e){this.seen=0,this.totals={}}async onBatchEnd(e,t){t==null&&(t={});const s=t.size==null?0:t.size;this.seen+=s;for(const o in t){const r=t[o];if(typeof r=="number")this.totals.hasOwnProperty(o)||(this.totals[o]=0),this.totals[o]=this.totals[o]+r*s;else{let i;o in this.totals?i=this.totals[o]:this.totals[o]=0;const a=B(()=>J(this.totals[o],D(r,s)));this.totals[o]=a,i!=null&&i.dispose()}}}async onEpochEnd(e,t){if(t!=null)for(const s of this.params.metrics)this.totals[s]!=null&&(typeof this.totals[s]=="number"?t[s]=this.totals[s]/this.seen:B(()=>{const o=D(me(1,this.seen),this.totals[s]);t[s]=o,this.totals[s].dispose(),dn(t[s])}))}}class mE extends zi{async onTrainBegin(e){this.epoch=[],this.history={}}async onEpochEnd(e,t){t==null&&(t={}),this.epoch.push(e);for(const s in t)this.history[s]==null&&(this.history[s]=[]),this.history[s].push(t[s])}async syncData(){const e=[],t=[],s=[];for(const r in this.history){const i=this.history[r];for(let a=0;anew gE(s,e))}class yn{constructor(){}static registerCallbackConstructor(e,t){k(e>=0&&Number.isInteger(e),()=>`Verbosity level is expected to be an integer >= 0, but got ${e}`),yn.checkForDuplicate(t),yn.constructors[e]==null&&(yn.constructors[e]=[]),yn.constructors[e].push(t)}static checkForDuplicate(e){for(const t in yn.constructors)yn.constructors[+t].forEach(o=>{if(o===e)throw new R("Duplicate callback constructor.")})}static clear(){yn.constructors={}}static createCallbacks(e){const t=[];for(const s in yn.constructors){const o=+s;e>=o&&t.push(...yn.constructors[o])}return t.map(s=>new s)}}yn.constructors={};function Ix(n,e,t,s,o,r,i,a,l){const c=new mE,u=[new fE,...yn.createCallbacks(e)];n!=null&&u.push(...n),u.push(c);const h=new pE(u);return h.setParams({epochs:t,initialEpoch:s,samples:o,steps:r,batchSize:i,verbose:e,doValidation:a,metrics:l}),{callbackList:h,history:c}}/** * @license * Copyright 2018 Google LLC * @@ -7632,7 +7632,7 @@ * license that can be found in the LICENSE file or at * https://opensource.org/licenses/MIT. * ============================================================================= - */function Gl(n,e){return B(()=>{n.dtype!=="float32"&&(n=re(n,"float32"));const t=de(Oi(n),e,!0),s=Ii(t.shape,ht()),o=Rt(ks(t,s));return me(n,o)})}function Hl(n,e){return B(()=>lt(Oi(be(e,n)),-1))}function Ld(n,e){return B(()=>lt(Lt(be(e,n)),-1))}function Md(n,e){return B(()=>{const t=be(n,e),s=nn(Lt(n),ht(),Number.MAX_VALUE),o=Lt(me(t,s));return D(100,lt(o,-1))})}function bE(n,e){return B(()=>{const t=nn(e,ht(),Number.MAX_VALUE),s=Wn(J(1,t)),o=nn(n,ht(),Number.MAX_VALUE),r=Wn(J(1,o));return lt(Oi(be(s,r)),-1)})}function yE(n,e){return B(()=>{const t=ks(0,be(1,D(n,e)));return lt(Oi(t),-1)})}function wE(n,e){return B(()=>{const t=ks(0,be(1,D(n,e)));return lt(t,-1)})}function CE(n,e){return B(()=>{const t=de(D(n,e),-1),s=Sn(D(be(1,n),e),-1);return ks(0,J(1,be(s,t)))})}function IE(n,e){return B(()=>{const t=Math.log(2),s=be(e,n),o=be(J(s,ki(D(-2,s))),t);return lt(o,-1)})}function Vi(n,e,t=!1){return B(()=>{if(t)e=Th(e);else{const s=de(e,e.shape.length-1,!0);e=me(e,s)}return e=nn(e,ht(),1-ht()),st(de(D(re(n,"float32"),Wn(e)),e.shape.length-1))})}function ql(n,e,t=!1){return B(()=>{const s=re(vl(UN(n)),"int32");e=nn(e,ht(),1-ht());const o=e.shape,r=O(Cm(s,o[o.length-1]),o);return Vi(r,e,t)})}function $E(n,e){if(!_e(n.shape,e.shape))throw new R(`logits and labels must have the same shape, but got shapes ${JSON.stringify(n.shape)} and ${JSON.stringify(e.shape)}`);return B(()=>{const t=co(e),s=st(Lt(e));return J(be(t,D(e,n)),xm(Vn(s)))})}function jl(n,e){return B(()=>{let t;return t=nn(e,ht(),1-ht()),t=Wn(me(t,be(1,t))),lt($E(n,t),-1)})}function kE(n,e){return B(()=>{const t=nn(n,ht(),1),s=nn(e,ht(),1);return de(D(n,Wn(me(t,s))),-1)})}function vE(n,e){return B(()=>{const t=Wn(J(ht(),e));return lt(be(e,D(n,t)),-1)})}function $x(n,e){return B(()=>{const t=Gl(n,-1),s=Gl(e,-1),o=D(t,s);return st(de(o,-1))})}const Kl={meanSquaredError:Hl,meanAbsoluteError:Ld,meanAbsolutePercentageError:Md,meanSquaredLogarithmicError:bE,squaredHinge:yE,hinge:wE,categoricalHinge:CE,logcosh:IE,categoricalCrossentropy:Vi,sparseCategoricalCrossentropy:ql,binaryCrossentropy:jl,kullbackLeiblerDivergence:kE,poisson:vE,cosineProximity:$x};function Pd(n){if(typeof n=="string"){if(n in Kl)return Kl[n];let e=`Unknown loss ${n}`;throw n.toLowerCase().includes("softmaxcrossentropy")&&(e=`Unknown loss ${n}. Use "categoricalCrossentropy" as the string name for tf.losses.softmaxCrossEntropy`),new R(e)}else return n}/** + */function Gl(n,e){return B(()=>{n.dtype!=="float32"&&(n=re(n,"float32"));const t=de(Oi(n),e,!0),s=Ii(t.shape,ht()),o=Rt(ks(t,s));return me(n,o)})}function Hl(n,e){return B(()=>lt(Oi(be(e,n)),-1))}function _d(n,e){return B(()=>lt(_t(be(e,n)),-1))}function Od(n,e){return B(()=>{const t=be(n,e),s=nn(_t(n),ht(),Number.MAX_VALUE),o=_t(me(t,s));return D(100,lt(o,-1))})}function xE(n,e){return B(()=>{const t=nn(e,ht(),Number.MAX_VALUE),s=Wn(J(1,t)),o=nn(n,ht(),Number.MAX_VALUE),r=Wn(J(1,o));return lt(Oi(be(s,r)),-1)})}function bE(n,e){return B(()=>{const t=ks(0,be(1,D(n,e)));return lt(Oi(t),-1)})}function yE(n,e){return B(()=>{const t=ks(0,be(1,D(n,e)));return lt(t,-1)})}function wE(n,e){return B(()=>{const t=de(D(n,e),-1),s=Sn(D(be(1,n),e),-1);return ks(0,J(1,be(s,t)))})}function CE(n,e){return B(()=>{const t=Math.log(2),s=be(e,n),o=be(J(s,ki(D(-2,s))),t);return lt(o,-1)})}function Vi(n,e,t=!1){return B(()=>{if(t)e=vh(e);else{const s=de(e,e.shape.length-1,!0);e=me(e,s)}return e=nn(e,ht(),1-ht()),st(de(D(re(n,"float32"),Wn(e)),e.shape.length-1))})}function ql(n,e,t=!1){return B(()=>{const s=re(vl(WN(n)),"int32");e=nn(e,ht(),1-ht());const o=e.shape,r=O(Cm(s,o[o.length-1]),o);return Vi(r,e,t)})}function IE(n,e){if(!_e(n.shape,e.shape))throw new R(`logits and labels must have the same shape, but got shapes ${JSON.stringify(n.shape)} and ${JSON.stringify(e.shape)}`);return B(()=>{const t=co(e),s=st(_t(e));return J(be(t,D(e,n)),xm(Vn(s)))})}function jl(n,e){return B(()=>{let t;return t=nn(e,ht(),1-ht()),t=Wn(me(t,be(1,t))),lt(IE(n,t),-1)})}function $E(n,e){return B(()=>{const t=nn(n,ht(),1),s=nn(e,ht(),1);return de(D(n,Wn(me(t,s))),-1)})}function kE(n,e){return B(()=>{const t=Wn(J(ht(),e));return lt(be(e,D(n,t)),-1)})}function $x(n,e){return B(()=>{const t=Gl(n,-1),s=Gl(e,-1),o=D(t,s);return st(de(o,-1))})}const Kl={meanSquaredError:Hl,meanAbsoluteError:_d,meanAbsolutePercentageError:Od,meanSquaredLogarithmicError:xE,squaredHinge:bE,hinge:yE,categoricalHinge:wE,logcosh:CE,categoricalCrossentropy:Vi,sparseCategoricalCrossentropy:ql,binaryCrossentropy:jl,kullbackLeiblerDivergence:$E,poisson:kE,cosineProximity:$x};function Ld(n){if(typeof n=="string"){if(n in Kl)return Kl[n];let e=`Unknown loss ${n}`;throw n.toLowerCase().includes("softmaxcrossentropy")&&(e=`Unknown loss ${n}. Use "categoricalCrossentropy" as the string name for tf.losses.softmaxCrossEntropy`),new R(e)}else return n}/** * @license * Copyright 2018 Google LLC * @@ -7640,7 +7640,7 @@ * license that can be found in the LICENSE file or at * https://opensource.org/licenses/MIT. * ============================================================================= - */function kx(n,e){return B(()=>{const t=D(.5,fn(e)),s=Kn(Zt(e,t),n.dtype);return lt(zn(n,s),-1)})}function vx(n,e){return B(()=>Kn(zn(no(n,-1),no(e,-1)),"float32"))}function SE(n,e){return B(()=>re(de(as(zn(n,1),zn(e,1))),"float32"))}function TE(n,e){return B(()=>re(de(as(zn(n,0),zn(e,1))),"float32"))}function NE(n,e){return B(()=>{const t=SE(n,e),s=TE(n,e),o=J(t,s);return re(It(Zt(o,0),me(t,o),0),"float32")})}function EE(n,e){return jl(n,e)}function RE(n,e){return n.rank===e.rank&&(n=Xo(n,[n.rank-1])),e=no(e,-1),e.dtype!==n.dtype&&(e=re(e,n.dtype)),re(zn(n,e),"float32")}const AE=Hl,DE=Hl,FE=Ld,_E=Ld,OE=Md,LE=Md,Sx=Vi,ME=$x,Tx=ql,Xl={binaryAccuracy:kx,categoricalAccuracy:vx,precision:NE,categoricalCrossentropy:Sx,sparseCategoricalCrossentropy:Tx,mse:AE,MSE:DE,mae:FE,MAE:_E,mape:OE,MAPE:LE,cosine:ME};function PE(n){if(typeof n=="string"&&n in Xl)return Xl[n];if(typeof n!="string"&&n!=null)return n;throw new R(`Unknown metric ${n}`)}function Yl(n){if(jn(n!==null,`Unknown LossOrMetricFn ${n}`),typeof n=="string")return n;{let e;for(const t of Object.keys(Kl))if(Kl[t]===n){e=t;break}if(e!==void 0)return e;for(const t of Object.keys(Xl))if(Xl[t]===n){e=t;break}return e!==void 0?e:n.name}}/** + */function kx(n,e){return B(()=>{const t=D(.5,fn(e)),s=Kn(Zt(e,t),n.dtype);return lt(zn(n,s),-1)})}function vx(n,e){return B(()=>Kn(zn(no(n,-1),no(e,-1)),"float32"))}function vE(n,e){return B(()=>re(de(as(zn(n,1),zn(e,1))),"float32"))}function SE(n,e){return B(()=>re(de(as(zn(n,0),zn(e,1))),"float32"))}function TE(n,e){return B(()=>{const t=vE(n,e),s=SE(n,e),o=J(t,s);return re(It(Zt(o,0),me(t,o),0),"float32")})}function NE(n,e){return jl(n,e)}function EE(n,e){return n.rank===e.rank&&(n=Xo(n,[n.rank-1])),e=no(e,-1),e.dtype!==n.dtype&&(e=re(e,n.dtype)),re(zn(n,e),"float32")}const RE=Hl,AE=Hl,DE=_d,FE=_d,_E=Od,OE=Od,Sx=Vi,LE=$x,Tx=ql,Xl={binaryAccuracy:kx,categoricalAccuracy:vx,precision:TE,categoricalCrossentropy:Sx,sparseCategoricalCrossentropy:Tx,mse:RE,MSE:AE,mae:DE,MAE:FE,mape:_E,MAPE:OE,cosine:LE};function ME(n){if(typeof n=="string"&&n in Xl)return Xl[n];if(typeof n!="string"&&n!=null)return n;throw new R(`Unknown metric ${n}`)}function Yl(n){if(jn(n!==null,`Unknown LossOrMetricFn ${n}`),typeof n=="string")return n;{let e;for(const t of Object.keys(Kl))if(Kl[t]===n){e=t;break}if(e!==void 0)return e;for(const t of Object.keys(Xl))if(Xl[t]===n){e=t;break}return e!==void 0?e:n.name}}/** * @license * Copyright 2018 Google LLC * @@ -7648,7 +7648,7 @@ * license that can be found in the LICENSE file or at * https://opensource.org/licenses/MIT. * ============================================================================= - */function BE(n){const e={Adagrad:()=>Qo.adagrad(.01),Adadelta:()=>Qo.adadelta(1,.95,ht()),Adam:()=>Qo.adam(.001,.9,.999,ht()),Adamax:()=>Qo.adamax(.002,.9,.999,ht(),0),RMSProp:()=>Qo.rmsprop(.001,.9,0,ht()),SGD:()=>Qo.sgd(.01)};if(e.adagrad=e.Adagrad,e.adadelta=e.Adadelta,e.adam=e.Adam,e.adamax=e.Adamax,e.rmsprop=e.RMSProp,e.sgd=e.SGD,n in e)return e[n]();throw new R(`Unknown Optimizer ${n}`)}/** + */function PE(n){const e={Adagrad:()=>Qo.adagrad(.01),Adadelta:()=>Qo.adadelta(1,.95,ht()),Adam:()=>Qo.adam(.001,.9,.999,ht()),Adamax:()=>Qo.adamax(.002,.9,.999,ht(),0),RMSProp:()=>Qo.rmsprop(.001,.9,0,ht()),SGD:()=>Qo.sgd(.01)};if(e.adagrad=e.Adagrad,e.adadelta=e.Adadelta,e.adam=e.Adam,e.adamax=e.Adamax,e.rmsprop=e.RMSProp,e.sgd=e.SGD,n in e)return e[n]();throw new R(`Unknown Optimizer ${n}`)}/** * @license * Copyright 2019 Google LLC * @@ -7656,7 +7656,7 @@ * license that can be found in the LICENSE file or at * https://opensource.org/licenses/MIT. * ============================================================================= - */const Nx=1*1024*1024;function Ex(n,e,t=!1){if(n==null||typeof n!="object"||Object.getPrototypeOf(n)!==Object.prototype||!Bd(n))throw new Error("User-defined metadata is expected to be a JSON object, but is not.");if(t){const s=JSON.stringify(n);s.length>Nx&&console.warn(`User-defined metadata of model "${e}" is too large in size (length=${s.length} when serialized). It is not recommended to store such large objects in user-defined metadata. Please make sure its serialized length is <= ${Nx}.`)}}function Bd(n){if(n===null)return!0;if(typeof n=="object")if(Object.getPrototypeOf(n)===Object.prototype){const e=Object.keys(n);for(const t of e)if(typeof t!="string"||!Bd(n[t]))return!1;return!0}else if(Array.isArray(n)){for(const e of n)if(!Bd(e))return!1;return!0}else return!1;else{const e=typeof n;return e==="string"||e==="number"||e==="boolean"}}/** + */const Nx=1*1024*1024;function Ex(n,e,t=!1){if(n==null||typeof n!="object"||Object.getPrototypeOf(n)!==Object.prototype||!Md(n))throw new Error("User-defined metadata is expected to be a JSON object, but is not.");if(t){const s=JSON.stringify(n);s.length>Nx&&console.warn(`User-defined metadata of model "${e}" is too large in size (length=${s.length} when serialized). It is not recommended to store such large objects in user-defined metadata. Please make sure its serialized length is <= ${Nx}.`)}}function Md(n){if(n===null)return!0;if(typeof n=="object")if(Object.getPrototypeOf(n)===Object.prototype){const e=Object.keys(n);for(const t of e)if(typeof t!="string"||!Md(n[t]))return!1;return!0}else if(Array.isArray(n)){for(const e of n)if(!Md(e))return!1;return!0}else return!1;else{const e=typeof n;return e==="string"||e==="number"||e==="boolean"}}/** * @license * Copyright 2018 Google LLC * @@ -7664,7 +7664,7 @@ * license that can be found in the LICENSE file or at * https://opensource.org/licenses/MIT. * ============================================================================= - */function zE(n,e,t,s=console.log){const o=WE(n),r=["Layer (type)","Input Shape","Output shape","Param #"];o?(e=e||90,t=t||[.32,.61,.89,1]):(e=e||115,t=t||[.24,.48,.7,.8,1]),t[t.length-1]<=1&&(t=t.map(u=>Math.floor(e*u)));let i;if(!o){r.push("Receives inputs"),i=[];for(const u in n.nodesByDepth)i.push(...n.nodesByDepth[u])}s("_".repeat(e)),Zl(r,t,s),s("=".repeat(e));const a=n.layers;for(let u=0;u1||o.length===1&&o[0].inboundLayers.length>1){e=!1;break}s.push(...o)}if(e)for(const o of n.layers){let r=!1;for(const i of o.inboundNodes)if(s.indexOf(i)!==-1)if(r){e=!1;break}else r=!0;if(!e)break}return e}function Zl(n,e,t=console.log){let s="";for(let o=0;o0&&(s=s.slice(0,s.length-1)+" "),s+=n[o],s=s.slice(0,e[o]),s+=" ".repeat(e[o]-s.length);t(s)}function UE(n,e,t){let s,o;try{o=n.inboundNodes.map(l=>JSON.stringify(l.inputShapes)).join(",")}catch{o="multiple"}try{s=JSON.stringify(n.outputShape)}catch{s="multiple"}const r=n.name,i=n.getClassName(),a=[`${r} (${i})`,o,s,n.countParams().toString()];Zl(a,e,t)}function GE(n,e,t,s){let o,r;try{r=n.inboundNodes.map(h=>JSON.stringify(h.inputShapes)).join(",")}catch{r="multiple"}try{o=JSON.stringify(n.outputShape)}catch{o="multiple"}const i=[];for(const h of n.inboundNodes)if(!(t!=null&&t.length>0&&t.indexOf(h)===-1))for(let d=0;dMath.floor(e*u)));let i;if(!o){r.push("Receives inputs"),i=[];for(const u in n.nodesByDepth)i.push(...n.nodesByDepth[u])}s("_".repeat(e)),Zl(r,t,s),s("=".repeat(e));const a=n.layers;for(let u=0;u1||o.length===1&&o[0].inboundLayers.length>1){e=!1;break}s.push(...o)}if(e)for(const o of n.layers){let r=!1;for(const i of o.inboundNodes)if(s.indexOf(i)!==-1)if(r){e=!1;break}else r=!0;if(!e)break}return e}function Zl(n,e,t=console.log){let s="";for(let o=0;o0&&(s=s.slice(0,s.length-1)+" "),s+=n[o],s=s.slice(0,e[o]),s+=" ".repeat(e[o]-s.length);t(s)}function WE(n,e,t){let s,o;try{o=n.inboundNodes.map(l=>JSON.stringify(l.inputShapes)).join(",")}catch{o="multiple"}try{s=JSON.stringify(n.outputShape)}catch{s="multiple"}const r=n.name,i=n.getClassName(),a=[`${r} (${i})`,o,s,n.countParams().toString()];Zl(a,e,t)}function UE(n,e,t,s){let o,r;try{r=n.inboundNodes.map(h=>JSON.stringify(h.inputShapes)).join(",")}catch{r="multiple"}try{o=JSON.stringify(n.outputShape)}catch{o="multiple"}const i=[];for(const h of n.inboundNodes)if(!(t!=null&&t.length>0&&t.indexOf(h)===-1))for(let d=0;d{const e=Object.keys(n);if(e.length===0)return!1;const t=e[0].split("/");return!isNaN(parseInt(t[t.length-1],10))};class Fn extends ve{constructor(e){if(super({}),this.containerNodes=new Set,this.name=e.name,this.name==null){const b=this.getClassName().toLowerCase();this.name=Ll(b)}if(this.supportsMasking=!1,this.trainable_=!0,Array.isArray(e.inputs)?this.inputs=e.inputs.slice():this.inputs=[e.inputs],Array.isArray(e.outputs)?this.outputs=e.outputs.slice():this.outputs=[e.outputs],Ss(this.inputs).length!==this.inputs.length)throw new R(`The list of inputs passed to the model is redundant. All inputs should only appear once. Found: ${this.inputs.map(b=>b.name)}`);Ss(this.outputs).length!==this.outputs.length&&console.warn(`The list of outputs passed to the model is redundant. All outputs should only appear once. Found: ${this.outputs.map(b=>b.name)}`),this.inputLayers=[],this.inputLayersNodeIndices=[],this.inputLayersTensorIndices=[],this.outputLayers=[],this.outputLayersNodeIndices=[],this.outputLayersTensorIndices=[],this.layers=[],this.internalContainerRefs=[];for(const b of this.outputs){const w=b.sourceLayer,y=b.nodeIndex,C=b.tensorIndex;this.outputLayers.push(w),this.outputLayersNodeIndices.push(y),this.outputLayersTensorIndices.push(C)}for(const b of this.inputs){const w=b.sourceLayer,y=b.nodeIndex,C=b.tensorIndex;jn(y===0,"input layer has >1 nodes"),jn(C===0,"input layer has >1 tensors"),this.inputLayers.push(w),this.inputLayersNodeIndices.push(y),this.inputLayersTensorIndices.push(C)}this.inputNames=[],this.outputNames=[],this.feedInputShapes=[],this.feedInputNames=[],this.feedOutputNames=[];for(let b=0;bb.shape),this.internalOutputShapes=this.outputs.map(b=>b.shape);const t={},s={},o={},r={},i={},a=[],l=(b,w,y,C,I,$)=>{(C==null||I==null||$==null)&&(C=b.sourceLayer,I=b.nodeIndex,$=b.tensorIndex);const k=C.inboundNodes[I];if(y.indexOf(k)!==-1)throw new gn(`The tensor ${b.name} at layer "${C.name}" is part of a cycle.`);if(w.indexOf(k)!==-1)return;this.containerNodes.add(Fn.nodeKey(C,I)),C.id in i||(i[C.id]=Object.keys(i).length),y.indexOf(k)===-1&&y.push(k);const S=k.inboundLayers.length;for(let N=0;N=0;)y.splice(y.indexOf(k),1);a.push(k)},c=[],u=[];for(const b of this.outputs)l(b,c,u);const h=a.slice().reverse();for(const b of h){s[b.id]=b,b.id in t||(t[b.id]=0);let w=t[b.id];const y=o[b.outboundLayer.id]==null?0:o[b.outboundLayer.id];w=Math.max(w,y),o[b.outboundLayer.id]=w,r[b.outboundLayer.id]=b.outboundLayer,t[b.id]=w;for(let C=0;CparseInt(b,10)).sort(_l);this.layers=[];for(const b of f){const w=p[b];w.sort((y,C)=>{const I=i[y.id],$=i[C.id];return I<$?-1:I>$?1:0});for(const y of w)y instanceof Fn&&this.internalContainerRefs.push(y),this.layers.push(y)}this.layersByDepth=p,f=Object.keys(d).map(b=>parseInt(b,10)).sort(_l);const m=this.inputs.slice(),g=[];for(const b of f)for(const w of d[b]){const y=w.outboundLayer;if(y!=null){for(const C of w.inputTensors)if(m.indexOf(C)===-1)throw new gn(`Graph disconnected: cannot obtain value for tensor ${C} at layer "${y.name}". The following previous layers were accessed without issue: ${g}`);for(const C of w.outputTensors)m.push(C);g.push(y.name)}}this.nodesByDepth=d;const x=this.layers.map(b=>b.name);for(const b of x){const w=x.filter(y=>y===b).length;if(w!==1)throw new gn(`The name "${b}" is used ${w} times in the model. All layer names should be unique. Layer names: `+JSON.stringify(x))}this.outboundNodes=[],this.inboundNodes=[],new Vl({outboundLayer:this,inboundLayers:[],nodeIndices:[],tensorIndices:[],inputTensors:this.inputs,outputTensors:this.outputs,inputMasks:this.inputs.map(b=>null),outputMasks:this.outputs.map(b=>null),inputShapes:this.inputs.map(b=>b.shape),outputShapes:this.outputs.map(b=>b.shape)}),this.built=!0,this._refCount=1}assertNotDisposed(){if(this._refCount===0)throw new Error(`Container '${this.name}' is already disposed.`)}dispose(){this.assertNotDisposed();const e={refCountAfterDispose:null,numDisposedVariables:0};if(--this._refCount===0){for(const t of this.layers)e.numDisposedVariables+=t.dispose().numDisposedVariables;for(const t of this.internalContainerRefs)e.numDisposedVariables+=t.dispose().numDisposedVariables}return e.refCountAfterDispose=this._refCount,e}get trainable(){return this.trainable_}set trainable(e){this.layers.forEach(t=>{t._trainableWeights.forEach(s=>s.trainable=e)}),this.trainable_=e}get trainableWeights(){if(this._trainableWeights.length>0)throw new R("Container instance unexpectedly contains _trainableWeights.The trainable weights of a Container are a union of the trainable weights of its consituent Layers. Its own _trainableWeights must remain an empty Array.");if(!this.trainable)return[];let e=[];for(const t of this.layers)e=e.concat(t.trainableWeights);return e}get nonTrainableWeights(){const e=[];for(const t of this.layers)e.push(...t.nonTrainableWeights);if(!this.trainable){const t=[];for(const s of this.layers)t.push(...s.trainableWeights);return t.concat(e)}return e}get weights(){return this.trainableWeights.concat(this.nonTrainableWeights)}loadWeights(e,t=!0){const s={};let o=0;const r=HE(e);r&&this.parseWeights(e);for(const a of this.layers)for(const[l,c]of a.weights.entries()){const u=r?`${c.name.split("/").slice(0,-1).join("/")+"/"}${l}`:c.originalName;if(s[u]!=null)throw new R(`Duplicate weight name: ${u}`);s[u]=c,o++}const i=[];for(const a in e){let l=a;if(s[a]==null){const c=a.split("/");l=c.slice(0,-2).concat([c[c.length-1]]).join("/")}if(s[l]!=null)i.push([s[l],e[a]]);else if(t)throw new R(`Provided weight data has no target variable: ${a}`);delete s[l]}if(t){const a=[];for(const l in s)a.push(l);if(a.length>0)throw new R(`${a.length} of ${o} weights are not set: ${a}`)}_d(i)}parseWeights(e){for(const t in Object.keys(e)){const s=t.split("/"),o=["vars","layer_checkpoint_dependencies"],r=s.map(i=>i.startsWith("_")?i.slice(1):i).filter(i=>!o.includes(i)).join("/");r!==t&&(e[r]=e[t],delete e[t])}}updatedConfig(){const e=this.getConfig(),t={};return t.className=this.getClassName(),t.config=e,t.kerasVersion=`tfjs-layers ${Ax}`,t.backend="TensorFlow.js",t}toJSON(e,t=!0){const s=zd(this.updatedConfig());return t?JSON.stringify(s):s}call(e,t){return B(()=>{e=Oe(e);const s=new Es;for(let o=0;o{e=Oe(e);let s;return t==null?s=po(null,e.length):s=Oe(t),this.runInternalGraph(e,s)[1]})}computeOutputShape(e){const t=Bl(e);if(t.length!==this.inputLayers.length)throw new R(`Invalid inputShape argument ${e}: model has ${this.inputLayers.length} tensor inputs.`);const s={};for(let a=0;aparseInt(a,10)).sort(_l);if(o.length>1)for(const a of o){const l=this.nodesByDepth[a];for(const c of l){const u=c.outboundLayer;if(this.inputLayers.map(m=>m.id).indexOf(u.id)!==-1)continue;const h=[];for(let m=0;mparseInt(l,10)).sort(_l);for(const l of o){const c=this.nodesByDepth[l];for(const u of c){const h=u.outboundLayer,d=u.inputTensors,p=u.outputTensors,f=new Array;for(const m of d)m.id in s&&f.push(s[m.id]);if(f.length===d.length){let m={},g,x,b,w;if(u.callArgs!=null&&(m=u.callArgs),f.length===1){const[y,C]=f[0];m.mask==null&&(m.mask=C),b=Oe(h.call(y,m)),w=Oe(h.computeMask(y,C)),g=[y],x=[C]}else g=f.map(y=>y[0]),x=f.map(y=>y[1]),m.mask==null&&(m.mask=x),b=Oe(h.call(g,m)),w=Oe(h.computeMask(g,x));if(h.activityRegularizer)throw new Ie("LayersModel invocation with concrete Tensor value(s) in the presence of activity regularizer(s) is not supported yet.");for(let y=0;y{const e=[];for(const t of this.layers)for(let s=0;s0){const m=[];for(let g=0;g0&&g.apply(Ht(b),w)}function c(g){const x=g.name,b=Zn(g,t.customObjects!=null?t.customObjects:{});b.setFastWeightInitDuringBuild(o),r[x]=b,g.inboundNodes.forEach(y=>{if(!(y instanceof Array))throw new R(`Corrupted configuration, expected array for nodeData: ${y}`);a(b,y)})}const u=t.name,h=t.layers;for(const g of h)c(g);for(;!RN(i);)for(const g of h){const x=r[g.name];if(x.name in i){const b=i[x.name];delete i[x.name];for(const w of b)l(x,w)}}const d=[],p=[],f=t.inputLayers;for(const g of f){const x=g[0],b=g[1],w=g[2];jn(x in r);const C=r[x].inboundNodes[b].outputTensors;d.push(C[w])}const m=t.outputLayers;for(const g of m){const x=g[0],b=g[1],w=g[2];jn(x in r);const C=r[x].inboundNodes[b].outputTensors;p.push(C[w])}return new e({inputs:d,outputs:p,name:u})}get stateful(){if(this._stateful)throw new R("Container instance unexpectedly has _stateful = true. The statefulness of a Container is determined by the Layers it contains. Its _stateful property must remain the default false.");for(const e of this.layers)if(e.stateful)return!0;return!1}resetStates(){B(()=>{this.layers.forEach(e=>{e.stateful&&e.resetStates()})})}}/** + */const GE=n=>{const e=Object.keys(n);if(e.length===0)return!1;const t=e[0].split("/");return!isNaN(parseInt(t[t.length-1],10))};class Fn extends ve{constructor(e){if(super({}),this.containerNodes=new Set,this.name=e.name,this.name==null){const b=this.getClassName().toLowerCase();this.name=Ll(b)}if(this.supportsMasking=!1,this.trainable_=!0,Array.isArray(e.inputs)?this.inputs=e.inputs.slice():this.inputs=[e.inputs],Array.isArray(e.outputs)?this.outputs=e.outputs.slice():this.outputs=[e.outputs],Ss(this.inputs).length!==this.inputs.length)throw new R(`The list of inputs passed to the model is redundant. All inputs should only appear once. Found: ${this.inputs.map(b=>b.name)}`);Ss(this.outputs).length!==this.outputs.length&&console.warn(`The list of outputs passed to the model is redundant. All outputs should only appear once. Found: ${this.outputs.map(b=>b.name)}`),this.inputLayers=[],this.inputLayersNodeIndices=[],this.inputLayersTensorIndices=[],this.outputLayers=[],this.outputLayersNodeIndices=[],this.outputLayersTensorIndices=[],this.layers=[],this.internalContainerRefs=[];for(const b of this.outputs){const w=b.sourceLayer,y=b.nodeIndex,C=b.tensorIndex;this.outputLayers.push(w),this.outputLayersNodeIndices.push(y),this.outputLayersTensorIndices.push(C)}for(const b of this.inputs){const w=b.sourceLayer,y=b.nodeIndex,C=b.tensorIndex;jn(y===0,"input layer has >1 nodes"),jn(C===0,"input layer has >1 tensors"),this.inputLayers.push(w),this.inputLayersNodeIndices.push(y),this.inputLayersTensorIndices.push(C)}this.inputNames=[],this.outputNames=[],this.feedInputShapes=[],this.feedInputNames=[],this.feedOutputNames=[];for(let b=0;bb.shape),this.internalOutputShapes=this.outputs.map(b=>b.shape);const t={},s={},o={},r={},i={},a=[],l=(b,w,y,C,I,v)=>{(C==null||I==null||v==null)&&(C=b.sourceLayer,I=b.nodeIndex,v=b.tensorIndex);const $=C.inboundNodes[I];if(y.indexOf($)!==-1)throw new gn(`The tensor ${b.name} at layer "${C.name}" is part of a cycle.`);if(w.indexOf($)!==-1)return;this.containerNodes.add(Fn.nodeKey(C,I)),C.id in i||(i[C.id]=Object.keys(i).length),y.indexOf($)===-1&&y.push($);const S=$.inboundLayers.length;for(let N=0;N=0;)y.splice(y.indexOf($),1);a.push($)},c=[],u=[];for(const b of this.outputs)l(b,c,u);const h=a.slice().reverse();for(const b of h){s[b.id]=b,b.id in t||(t[b.id]=0);let w=t[b.id];const y=o[b.outboundLayer.id]==null?0:o[b.outboundLayer.id];w=Math.max(w,y),o[b.outboundLayer.id]=w,r[b.outboundLayer.id]=b.outboundLayer,t[b.id]=w;for(let C=0;CparseInt(b,10)).sort(_l);this.layers=[];for(const b of f){const w=p[b];w.sort((y,C)=>{const I=i[y.id],v=i[C.id];return Iv?1:0});for(const y of w)y instanceof Fn&&this.internalContainerRefs.push(y),this.layers.push(y)}this.layersByDepth=p,f=Object.keys(d).map(b=>parseInt(b,10)).sort(_l);const m=this.inputs.slice(),g=[];for(const b of f)for(const w of d[b]){const y=w.outboundLayer;if(y!=null){for(const C of w.inputTensors)if(m.indexOf(C)===-1)throw new gn(`Graph disconnected: cannot obtain value for tensor ${C} at layer "${y.name}". The following previous layers were accessed without issue: ${g}`);for(const C of w.outputTensors)m.push(C);g.push(y.name)}}this.nodesByDepth=d;const x=this.layers.map(b=>b.name);for(const b of x){const w=x.filter(y=>y===b).length;if(w!==1)throw new gn(`The name "${b}" is used ${w} times in the model. All layer names should be unique. Layer names: `+JSON.stringify(x))}this.outboundNodes=[],this.inboundNodes=[],new Vl({outboundLayer:this,inboundLayers:[],nodeIndices:[],tensorIndices:[],inputTensors:this.inputs,outputTensors:this.outputs,inputMasks:this.inputs.map(b=>null),outputMasks:this.outputs.map(b=>null),inputShapes:this.inputs.map(b=>b.shape),outputShapes:this.outputs.map(b=>b.shape)}),this.built=!0,this._refCount=1}assertNotDisposed(){if(this._refCount===0)throw new Error(`Container '${this.name}' is already disposed.`)}dispose(){this.assertNotDisposed();const e={refCountAfterDispose:null,numDisposedVariables:0};if(--this._refCount===0){for(const t of this.layers)e.numDisposedVariables+=t.dispose().numDisposedVariables;for(const t of this.internalContainerRefs)e.numDisposedVariables+=t.dispose().numDisposedVariables}return e.refCountAfterDispose=this._refCount,e}get trainable(){return this.trainable_}set trainable(e){this.layers.forEach(t=>{t._trainableWeights.forEach(s=>s.trainable=e)}),this.trainable_=e}get trainableWeights(){if(this._trainableWeights.length>0)throw new R("Container instance unexpectedly contains _trainableWeights.The trainable weights of a Container are a union of the trainable weights of its consituent Layers. Its own _trainableWeights must remain an empty Array.");if(!this.trainable)return[];let e=[];for(const t of this.layers)e=e.concat(t.trainableWeights);return e}get nonTrainableWeights(){const e=[];for(const t of this.layers)e.push(...t.nonTrainableWeights);if(!this.trainable){const t=[];for(const s of this.layers)t.push(...s.trainableWeights);return t.concat(e)}return e}get weights(){return this.trainableWeights.concat(this.nonTrainableWeights)}loadWeights(e,t=!0){const s={};let o=0;const r=GE(e);r&&this.parseWeights(e);for(const a of this.layers)for(const[l,c]of a.weights.entries()){const u=r?`${c.name.split("/").slice(0,-1).join("/")+"/"}${l}`:c.originalName;if(s[u]!=null)throw new R(`Duplicate weight name: ${u}`);s[u]=c,o++}const i=[];for(const a in e){let l=a;if(s[a]==null){const c=a.split("/");l=c.slice(0,-2).concat([c[c.length-1]]).join("/")}if(s[l]!=null)i.push([s[l],e[a]]);else if(t)throw new R(`Provided weight data has no target variable: ${a}`);delete s[l]}if(t){const a=[];for(const l in s)a.push(l);if(a.length>0)throw new R(`${a.length} of ${o} weights are not set: ${a}`)}Dd(i)}parseWeights(e){for(const t in Object.keys(e)){const s=t.split("/"),o=["vars","layer_checkpoint_dependencies"],r=s.map(i=>i.startsWith("_")?i.slice(1):i).filter(i=>!o.includes(i)).join("/");r!==t&&(e[r]=e[t],delete e[t])}}updatedConfig(){const e=this.getConfig(),t={};return t.className=this.getClassName(),t.config=e,t.kerasVersion=`tfjs-layers ${Ax}`,t.backend="TensorFlow.js",t}toJSON(e,t=!0){const s=Pd(this.updatedConfig());return t?JSON.stringify(s):s}call(e,t){return B(()=>{e=Oe(e);const s=new Es;for(let o=0;o{e=Oe(e);let s;return t==null?s=po(null,e.length):s=Oe(t),this.runInternalGraph(e,s)[1]})}computeOutputShape(e){const t=Bl(e);if(t.length!==this.inputLayers.length)throw new R(`Invalid inputShape argument ${e}: model has ${this.inputLayers.length} tensor inputs.`);const s={};for(let a=0;aparseInt(a,10)).sort(_l);if(o.length>1)for(const a of o){const l=this.nodesByDepth[a];for(const c of l){const u=c.outboundLayer;if(this.inputLayers.map(m=>m.id).indexOf(u.id)!==-1)continue;const h=[];for(let m=0;mparseInt(l,10)).sort(_l);for(const l of o){const c=this.nodesByDepth[l];for(const u of c){const h=u.outboundLayer,d=u.inputTensors,p=u.outputTensors,f=new Array;for(const m of d)m.id in s&&f.push(s[m.id]);if(f.length===d.length){let m={},g,x,b,w;if(u.callArgs!=null&&(m=u.callArgs),f.length===1){const[y,C]=f[0];m.mask==null&&(m.mask=C),b=Oe(h.call(y,m)),w=Oe(h.computeMask(y,C)),g=[y],x=[C]}else g=f.map(y=>y[0]),x=f.map(y=>y[1]),m.mask==null&&(m.mask=x),b=Oe(h.call(g,m)),w=Oe(h.computeMask(g,x));if(h.activityRegularizer)throw new Ie("LayersModel invocation with concrete Tensor value(s) in the presence of activity regularizer(s) is not supported yet.");for(let y=0;y{const e=[];for(const t of this.layers)for(let s=0;s0){const m=[];for(let g=0;g0&&g.apply(Ht(b),w)}function c(g){const x=g.name,b=Zn(g,t.customObjects!=null?t.customObjects:{});b.setFastWeightInitDuringBuild(o),r[x]=b,g.inboundNodes.forEach(y=>{if(!(y instanceof Array))throw new R(`Corrupted configuration, expected array for nodeData: ${y}`);a(b,y)})}const u=t.name,h=t.layers;for(const g of h)c(g);for(;!EN(i);)for(const g of h){const x=r[g.name];if(x.name in i){const b=i[x.name];delete i[x.name];for(const w of b)l(x,w)}}const d=[],p=[],f=t.inputLayers;for(const g of f){const x=g[0],b=g[1],w=g[2];jn(x in r);const C=r[x].inboundNodes[b].outputTensors;d.push(C[w])}const m=t.outputLayers;for(const g of m){const x=g[0],b=g[1],w=g[2];jn(x in r);const C=r[x].inboundNodes[b].outputTensors;p.push(C[w])}return new e({inputs:d,outputs:p,name:u})}get stateful(){if(this._stateful)throw new R("Container instance unexpectedly has _stateful = true. The statefulness of a Container is determined by the Layers it contains. Its _stateful property must remain the default false.");for(const e of this.layers)if(e.stateful)return!0;return!1}resetStates(){B(()=>{this.layers.forEach(e=>{e.stateful&&e.resetStates()})})}}/** * @license * Copyright 2018 Google LLC * @@ -7688,7 +7688,7 @@ * license that can be found in the LICENSE file or at * https://opensource.org/licenses/MIT. * ============================================================================= - */function qE(n,e,t){const s=e.length;if(n==null||Array.isArray(n)&&n.length===0)return e.map(o=>null);if(s===1)return Array.isArray(n)&&n.length===1?n:typeof n=="object"&&e[0]in n?[n[e[0]]]:[n];if(Array.isArray(n)){if(n.length!==s)throw new Error(`Provided ${t} is an array of ${n.length} element(s), but the model has ${s} outputs. Make sure a set of weights is provided for each model output.`);return n}else if(typeof n=="object"&&Object.keys(n).length>0&&typeof n[Object.keys(n)[0]]=="object"){const o=[];return e.forEach(r=>{r in n?o.push(n[r]):o.push(null)}),o}else throw new Error(`The model has multiple (${s}) outputs, so ${t} must be either an array with ${s} elements or an object with ${e} keys. Provided ${t} not understood: ${JSON.stringify(n)}`)}function Dx(n,e){return qE(n,e,"classWeight")}async function Fx(n,e,t,s){if(e!=null||s!=null)throw new Error("Support sampleWeight is not implemented yet");if(t!=null){const o=B(()=>{if(n.shape.length===1)return to(n);if(n.shape.length===2){if(n.shape[1]>1)return no(n,1);if(n.shape[1]===1)return O(n,[n.shape[0]]);throw new Error(`Encountered unexpected last-dimension size (${n.shape[1]}) during handling of class weights. The size is expected to be >= 1.`)}else throw new Error(`Unexpected rank of target (y) tensor (${n.rank}) during handling of class weights. The rank is expected to be 1 or 2.`)}),r=Array.from(await o.data());fe(o);const i=[];return r.forEach(a=>{if(t[a]==null)throw new Error(`classWeight must contain all classes in the training data. The class ${a} exists in the data but not in classWeight`);i.push(t[a])}),At(i,"float32")}else return null}function jE(n,e){return D(n,e)}/** + */function HE(n,e,t){const s=e.length;if(n==null||Array.isArray(n)&&n.length===0)return e.map(o=>null);if(s===1)return Array.isArray(n)&&n.length===1?n:typeof n=="object"&&e[0]in n?[n[e[0]]]:[n];if(Array.isArray(n)){if(n.length!==s)throw new Error(`Provided ${t} is an array of ${n.length} element(s), but the model has ${s} outputs. Make sure a set of weights is provided for each model output.`);return n}else if(typeof n=="object"&&Object.keys(n).length>0&&typeof n[Object.keys(n)[0]]=="object"){const o=[];return e.forEach(r=>{r in n?o.push(n[r]):o.push(null)}),o}else throw new Error(`The model has multiple (${s}) outputs, so ${t} must be either an array with ${s} elements or an object with ${e} keys. Provided ${t} not understood: ${JSON.stringify(n)}`)}function Dx(n,e){return HE(n,e,"classWeight")}async function Fx(n,e,t,s){if(e!=null||s!=null)throw new Error("Support sampleWeight is not implemented yet");if(t!=null){const o=B(()=>{if(n.shape.length===1)return to(n);if(n.shape.length===2){if(n.shape[1]>1)return no(n,1);if(n.shape[1]===1)return O(n,[n.shape[0]]);throw new Error(`Encountered unexpected last-dimension size (${n.shape[1]}) during handling of class weights. The size is expected to be >= 1.`)}else throw new Error(`Unexpected rank of target (y) tensor (${n.rank}) during handling of class weights. The rank is expected to be 1 or 2.`)}),r=Array.from(await o.data());fe(o);const i=[];return r.forEach(a=>{if(t[a]==null)throw new Error(`classWeight must contain all classes in the training data. The class ${a} exists in the data but not in classWeight`);i.push(t[a])}),Lt(i,"float32")}else return null}function qE(n,e){return D(n,e)}/** * @license * Copyright 2018 Google LLC * @@ -7696,7 +7696,7 @@ * license that can be found in the LICENSE file or at * https://opensource.org/licenses/MIT. * ============================================================================= - */const KE=32;function _x(n,e){let t,s;const o=e;t=o.xs,s=o.ys,v(t!=null&&s!=null,()=>`A Dataset iterator for fitDataset() is expected to generate objects of the form \`{xs: xVal, ys: yVal}\`, where the two values may be \`tf.Tensor\`, an array of Tensors, or a map of string to Tensor. The provided Dataset instead generates ${e}`);const r=Ox("input",n.inputNames,t),i=Ox("output",n.outputNames,s),a=r[0].shape[0];v(r.length===n.inputs.length,()=>`LayersModel has ${n.inputs.length} inputs, but the dataset provides ${r.length} inputs. (Expected input keys: ${JSON.stringify(n.inputNames)})`),v(i.length===n.outputs.length,()=>`LayersModel has ${n.outputs.length} outputs, but the dataset provides ${i.length} outputs. (Expected output keys: ${JSON.stringify(n.outputNames)})`);for(let l=0;l`Batch size mismatch: input ${n.inputNames[l]} has ${r[l].shape[0]}; expected ${a} based on input ${n.inputNames[0]}.`);for(let l=0;l`Batch size mismatch: output ${n.outputNames[l]} has ${i[l].shape[0]}; expected ${a} based on input ${n.inputNames[0]}.`);return{xs:r,ys:i}}function Ox(n,e,t){if(t instanceof ct)return[t];if(Array.isArray(t))return v(t.length===e.length,()=>`Received an array of ${t.length} Tensors, but expected ${e.length} to match the ${n} keys ${e}.`),t;{const s=[];for(const o of e){if(t[o]==null)throw new R(`The feature data generated by the dataset lacks the required ${n} key '${o}'.`);s.push(t[o])}return s}}function XE(n){if(n.length===3)throw new Ie("Validation with sample weights is not implemented yet.");return{xs:n[0],ys:n[1]}}async function YE(n,e,t){const s=t.batchesPerEpoch!=null;if(v(n.optimizer!=null,()=>"You must compile a model before training/testing. Use LayersModel.compile(modelCompileConfig)."),v(t!=null,()=>"For fitDataset(), the 2nd argument (config) is required, but it is not provided in this call."),v(t.epochs!=null&&t.epochs>0&&Number.isInteger(t.epochs),()=>`For fitDataset(), config.epochs is expected to be a positive integer, but got ${t.epochs}`),v(!s||t.batchesPerEpoch>0&&Number.isInteger(t.batchesPerEpoch),()=>`For fitDataset(), config.batchesPerEpoch is expected to be a positive integer if specified, but got ${t.batchesPerEpoch}`),v(t.validationSplit==null,()=>"`validationSplit` is not supported by `fitDataset()`. Use validationData instead."),n.isTraining)throw new Error("Cannot start training because another fit() call is ongoing.");n.isTraining=!0;try{const o=t.validationData!=null;let r,i;if(o)if(Lx(t.validationData))v(t.validationBatches==null||t.validationBatches>0&&Number.isInteger(t.validationBatches),()=>`For fitDataset() with dataset-based validation, config.validationBatches is expected not to be provided, or to be a positive integer, but got ${t.validationBatches}`);else{const g=XE(t.validationData);r=g.xs,i=g.ys}const a=n.makeTrainFunction(),l=n.getDedupedMetricsNames();let c;o?c=l.slice().concat(l.map(g=>"val_"+g)):c=l.slice();const u=Cx(t.callbacks,t.yieldEvery),h=t.verbose==null?1:t.verbose,{callbackList:d,history:p}=Ix(u,h,t.epochs,null,null,ZE(e,t),null,o,c);d.setModel(n),n.history=p,await d.onTrainBegin(),n.stopTraining_=!1;let f=t.initialEpoch==null?0:t.initialEpoch,m=await e.iterator();for(;f=t.batchesPerEpoch:w.done){if(o){let y;Lx(t.validationData)?y=Oe(await n.evaluateDataset(t.validationData,{batches:t.validationBatches})):y=Oe(n.evaluate(r,i,{batchSize:t.validationBatchSize==null?KE:t.validationBatchSize,verbose:0}));for(let C=0;C0)throw new Ie("Verbose mode is not implemented yet.");v(!s||t.batches>0&&Number.isInteger(t.batches),()=>`Test loop expects \`batches\` to be a positive integer, but received ${JSON.stringify(t.batches)}`);const i=QE(e)?e:await e.iterator();let a=0,l=0;for(;!s||l{if(c.value){const{xs:u,ys:h}=_x(n,c.value),d=u.concat(h),p=B(()=>o(d));if(fe(d),l===0)for(let m=0;mJ(r[m],D(f,g))),l>0&&fe(x)}fe(p),a+=f,++l}return r}),c.done){s&&console.warn(`Your dataset iterator ran out of data during evaluateDataset(). Interrupting evalution. Make sure that your dataset can generate at least \`batches\` batches (in this case, ${t.batches} batches). You may need to use the repeat() function when building your dataset.`);break}}for(let c=0;c`A Dataset iterator for fitDataset() is expected to generate objects of the form \`{xs: xVal, ys: yVal}\`, where the two values may be \`tf.Tensor\`, an array of Tensors, or a map of string to Tensor. The provided Dataset instead generates ${e}`);const r=Ox("input",n.inputNames,t),i=Ox("output",n.outputNames,s),a=r[0].shape[0];k(r.length===n.inputs.length,()=>`LayersModel has ${n.inputs.length} inputs, but the dataset provides ${r.length} inputs. (Expected input keys: ${JSON.stringify(n.inputNames)})`),k(i.length===n.outputs.length,()=>`LayersModel has ${n.outputs.length} outputs, but the dataset provides ${i.length} outputs. (Expected output keys: ${JSON.stringify(n.outputNames)})`);for(let l=0;l`Batch size mismatch: input ${n.inputNames[l]} has ${r[l].shape[0]}; expected ${a} based on input ${n.inputNames[0]}.`);for(let l=0;l`Batch size mismatch: output ${n.outputNames[l]} has ${i[l].shape[0]}; expected ${a} based on input ${n.inputNames[0]}.`);return{xs:r,ys:i}}function Ox(n,e,t){if(t instanceof ct)return[t];if(Array.isArray(t))return k(t.length===e.length,()=>`Received an array of ${t.length} Tensors, but expected ${e.length} to match the ${n} keys ${e}.`),t;{const s=[];for(const o of e){if(t[o]==null)throw new R(`The feature data generated by the dataset lacks the required ${n} key '${o}'.`);s.push(t[o])}return s}}function KE(n){if(n.length===3)throw new Ie("Validation with sample weights is not implemented yet.");return{xs:n[0],ys:n[1]}}async function XE(n,e,t){const s=t.batchesPerEpoch!=null;if(k(n.optimizer!=null,()=>"You must compile a model before training/testing. Use LayersModel.compile(modelCompileConfig)."),k(t!=null,()=>"For fitDataset(), the 2nd argument (config) is required, but it is not provided in this call."),k(t.epochs!=null&&t.epochs>0&&Number.isInteger(t.epochs),()=>`For fitDataset(), config.epochs is expected to be a positive integer, but got ${t.epochs}`),k(!s||t.batchesPerEpoch>0&&Number.isInteger(t.batchesPerEpoch),()=>`For fitDataset(), config.batchesPerEpoch is expected to be a positive integer if specified, but got ${t.batchesPerEpoch}`),k(t.validationSplit==null,()=>"`validationSplit` is not supported by `fitDataset()`. Use validationData instead."),n.isTraining)throw new Error("Cannot start training because another fit() call is ongoing.");n.isTraining=!0;try{const o=t.validationData!=null;let r,i;if(o)if(Lx(t.validationData))k(t.validationBatches==null||t.validationBatches>0&&Number.isInteger(t.validationBatches),()=>`For fitDataset() with dataset-based validation, config.validationBatches is expected not to be provided, or to be a positive integer, but got ${t.validationBatches}`);else{const g=KE(t.validationData);r=g.xs,i=g.ys}const a=n.makeTrainFunction(),l=n.getDedupedMetricsNames();let c;o?c=l.slice().concat(l.map(g=>"val_"+g)):c=l.slice();const u=Cx(t.callbacks,t.yieldEvery),h=t.verbose==null?1:t.verbose,{callbackList:d,history:p}=Ix(u,h,t.epochs,null,null,YE(e,t),null,o,c);d.setModel(n),n.history=p,await d.onTrainBegin(),n.stopTraining_=!1;let f=t.initialEpoch==null?0:t.initialEpoch,m=await e.iterator();for(;f=t.batchesPerEpoch:w.done){if(o){let y;Lx(t.validationData)?y=Oe(await n.evaluateDataset(t.validationData,{batches:t.validationBatches})):y=Oe(n.evaluate(r,i,{batchSize:t.validationBatchSize==null?jE:t.validationBatchSize,verbose:0}));for(let C=0;C0)throw new Ie("Verbose mode is not implemented yet.");k(!s||t.batches>0&&Number.isInteger(t.batches),()=>`Test loop expects \`batches\` to be a positive integer, but received ${JSON.stringify(t.batches)}`);const i=ZE(e)?e:await e.iterator();let a=0,l=0;for(;!s||l{if(c.value){const{xs:u,ys:h}=_x(n,c.value),d=u.concat(h),p=B(()=>o(d));if(fe(d),l===0)for(let m=0;mJ(r[m],D(f,g))),l>0&&fe(x)}fe(p),a+=f,++l}return r}),c.done){s&&console.warn(`Your dataset iterator ran out of data during evaluateDataset(). Interrupting evalution. Make sure that your dataset can generate at least \`batches\` batches (in this case, ${t.batches} batches). You may need to use the repeat() function when building your dataset.`);break}}for(let c=0;c0&&Number.isInteger(n),()=>`batchSize is required to be a positive integer, but got ${n}`)}function Wi(n,e,t){return n==null?[null]:Array.isArray(n)?n.map(s=>xo(s,e,t-e)):xo(n,e,t-e)}function Wd(n,e){return B(()=>n==null?null:Array.isArray(n)?n.map(t=>Wd(t,e)):Jg(n,e.dtype==="int32"?e:re(e,"int32")))}function Ud(n,e){const t=[];let s=0,o=null;for(;s=n&&(o=n),t.push([s,o]),s=o;return t}function Mx(n){const e=[];n instanceof ct&&(n=[n]);for(let t=0;tt.push(o.id));else if(e!=null)for(const o in e){const r=e[o];t.push(r.id)}const s=[];if(n instanceof ct)t.indexOf(n.id)===-1&&s.push(n);else if(Array.isArray(n))n.forEach(o=>{t.indexOf(o.id)===-1&&s.push(o)});else if(n!=null)for(const o in n){const r=n[o];t.indexOf(r.id)===-1&&s.push(r)}s.forEach(o=>{o.isDisposed||o.dispose()})}/** + */function Bd(n){k(n>0&&Number.isInteger(n),()=>`batchSize is required to be a positive integer, but got ${n}`)}function Wi(n,e,t){return n==null?[null]:Array.isArray(n)?n.map(s=>xo(s,e,t-e)):xo(n,e,t-e)}function zd(n,e){return B(()=>n==null?null:Array.isArray(n)?n.map(t=>zd(t,e)):Jg(n,e.dtype==="int32"?e:re(e,"int32")))}function Vd(n,e){const t=[];let s=0,o=null;for(;s=n&&(o=n),t.push([s,o]),s=o;return t}function Mx(n){const e=[];n instanceof ct&&(n=[n]);for(let t=0;tt.push(o.id));else if(e!=null)for(const o in e){const r=e[o];t.push(r.id)}const s=[];if(n instanceof ct)t.indexOf(n.id)===-1&&s.push(n);else if(Array.isArray(n))n.forEach(o=>{t.indexOf(o.id)===-1&&s.push(o)});else if(n!=null)for(const o in n){const r=n[o];t.indexOf(r.id)===-1&&s.push(r)}s.forEach(o=>{o.isDisposed||o.dispose()})}/** * @license * Copyright 2018 Google LLC * @@ -7712,7 +7712,7 @@ * license that can be found in the LICENSE file or at * https://opensource.org/licenses/MIT. * ============================================================================= - */function eR(n){return n instanceof ct}function Gd(n){return Array.isArray(n)}function Px(n){return!eR(n)&&!Gd(n)}function Bx(n,e,t,s=!0,o=""){if(e==null||e.length===0){if(n!=null){let i=!1;if(Gd(n)&&n.length>0)i=!0;else if(Px(n)){for(const a in n)if(n.hasOwnProperty(a)){i=!0;break}}else i=!0;if(i)throw new R(`Error when checking model ${o} expected no data, but got ${n}`)}return[]}if(n==null)return e.map(i=>null);let r;if(Px(n)){n=n,r=[];for(const i of e){if(n[i]==null)throw new R(`No data provided for "${i}". Need data for each key in: ${e}`);r.push(n[i])}}else if(Gd(n)){if(n=n,n.length!==e.length)throw new R(`Error when checking model ${o}: the Array of Tensors that you are passing to your model is not the size the model expected. Expected to see ${e.length} Tensor(s), but instead got the following list of Tensor(s): ${n}`);r=n}else{if(n=n,e.length>1)throw new R(`The model ${o} expects ${e.length} Tensor(s), but only received one Tensor. Found: Tensor with shape ${n.shape}`);r=[n]}if(r=Mx(r),t!=null)for(let i=0;i=0&&c!==u)throw new R(`${o} expected a batch of elements where each example has shape [${t[i].slice(1,t[i].length)}] (i.e.,tensor shape [*,${t[i].slice(1,t[i].length)}]) but the ${o} received an input with ${a.shape[0]} examples, each with shape [${a.shape.slice(1,a.shape.length)}] (tensor shape [${a.shape}])`)}}return r}function tR(n,e,t){const s=Ss(n.map(r=>r.shape[0]));s.sort();const o=Ss(e.map(r=>r.shape[0]));if(o.sort(),s.length>1)throw new R(`All input Tensors (x) should have the same number of samples. Got array shapes: ${JSON.stringify(n.map(r=>r.shape))}`);if(o.length>1)throw new R(`All target Tensors (y) should have the same number of samples. Got array shapes: ${JSON.stringify(e.map(r=>r.shape))}`);if(s.length>0&&o.length>0&&!_e(s,o))throw new R(`Input Tensors should have the same number of samples as target Tensors. Found ${s[0]} input sample(s) and ${o[0]} target sample(s).`)}function nR(n,e,t){const s=[Hl,jl,Vi];for(let o=0;o1)throw new R(`The model expects ${e.length} ${o} Tensors, but only received one Tensor. Found: array with shape ${JSON.stringify(n.shape)}.`);r=[n]}if(t!=null)for(let i=0;i[]);let t;if(typeof n=="string"||typeof n=="function")t=[n];else if(Array.isArray(n)||typeof n=="object")t=n;else throw new TypeError(`Type of metrics argument not understood. Expected an string,function, Array, or Object, found: ${n}`);if(Array.isArray(t))return e.map(s=>t);{const s=[];for(const o of e){let r=t.hasOwnProperty(o)?t[o]:[];Array.isArray(r)||(r=[r]),s.push(r)}return s}}const oR="layers-model";class tr extends Fn{constructor(e){super(e),this.isTraining=!1}summary(e,t,s=console.log){if(!this.built)throw new R("This model has never been called, thus its weights have not been created yet. So no summary can be displayed. Build the model first (e.g., by calling it on some test data).");zE(this,e,t,s)}compile(e){if(e.loss==null&&(e.loss=[]),this.loss=e.loss,typeof e.optimizer=="string")this.optimizer_=BE(e.optimizer),this.isOptimizerOwned=!0;else{if(!(e.optimizer instanceof vs))throw new R("User-defined optimizer must be an instance of tf.Optimizer.");this.optimizer_=e.optimizer,this.isOptimizerOwned=!1}let t=[];if(!Array.isArray(e.loss)&&typeof e.loss!="string"&&typeof e.loss!="function"){e.loss=e.loss;for(const i in e.loss)if(this.outputNames.indexOf(i)===-1)throw new R(`Unknown entry in loss dictionary: "${i}". Only expected the following keys: ${this.outputNames}`);for(const i of this.outputNames)e.loss[i]==null&&console.warn(`Output "${i}" is missing from loss dictionary. We assume this was done on purpose, and we will not be expecting data to be passed to ${i} during training`),t.push(Pd(e.loss[i]))}else if(Array.isArray(e.loss)){if(e.loss.length!==this.outputs.length)throw new R(`When passing an Array as loss, it should have one entry per model output. The model has ${this.outputs.length} output(s), but you passed loss=${e.loss}.`);t=e.loss.map(a=>Pd(a))}else{const i=Pd(e.loss);this.outputs.forEach(a=>{t.push(i)})}this.lossFunctions=t,this.feedOutputNames=[],this.feedOutputShapes=[],this.feedLossFns=[];for(let i=0;i{for(let i=0;i1&&(this.metricsTensors.push([a,i]),this.metricsNames.push(this.outputNames[i]+"_loss"))}});const o=sR(e.metrics,this.outputNames),r=(i,a,l)=>{this.outputNames.length>1&&(a=this.outputNames[i]+"_"+a),this.metricsNames.push(a),this.metricsTensors.push([l,i])};go("metric",()=>{for(let i=0;i{const u="";let h,d,p;for(const f of c){if(typeof f=="string"&&["accuracy","acc","crossentropy","ce"].indexOf(f)!==-1){const g=this.internalOutputShapes[i];g[g.length-1]===1||this.lossFunctions[i]===jl?["accuracy","acc"].indexOf(f)!==-1?d=kx:["crossentropy","ce"].indexOf(f)!==-1&&(d=EE):this.lossFunctions[i]===ql?["accuracy","acc"].indexOf(f)!==-1?d=RE:["crossentropy","ce"].indexOf(f)!==-1&&(d=Tx):["accuracy","acc"].indexOf(f)!==-1?d=vx:["crossentropy","ce"].indexOf(f)!==-1&&(d=Sx);let x;["accuracy","acc"].indexOf(f)!==-1?x="acc":["crossentropy","ce"].indexOf(f)!==-1&&(x="ce"),p=d,h=u+x}else p=PE(f),h=u+Yl(f);let m;go(h,()=>{m=p}),r(i,h,m)}})(a)}}),this.collectedTrainableWeights=this.trainableWeights}checkTrainableWeightsConsistency(){this.collectedTrainableWeights!=null&&this.trainableWeights.length!==this.collectedTrainableWeights.length&&console.warn("Discrepancy between trainableweights and collected trainable weights. Did you set `model.trainable` without calling `model.compile()` afterwards?")}evaluate(e,t,s={}){const o=s.batchSize==null?32:s.batchSize;Vd(o);const i=this.standardizeUserDataXY(e,t,!0,o);try{const a=i[0].concat(i[1]);this.makeTestFunction();const l=this.testFunction,c=this.testLoop(l,a,o,s.verbose,s.steps);return Ht(c)}finally{_n(i[0],e),_n(i[1],t)}}async evaluateDataset(e,t){return this.makeTestFunction(),JE(this,e,t)}checkNumSamples(e,t,s,o="steps"){let r;if(s!=null){if(r=null,t!=null)throw new R(`If ${o} is set, batchSize must be null or undefined.Got batchSize = ${t}`)}else if(e!=null)Array.isArray(e)?r=e[0].shape[0]:r=e.shape[0];else throw new R(`Either the input data should have a defined shape, or ${o} shoud be specified.`);return r}execute(e,t){if(Array.isArray(t)&&t.length===0)throw new R("`outputs` is an empty Array, which is not allowed.");const s=Array.isArray(t),o=s?t:[t],r=this.retrieveSymbolicTensors(o),i=new Es;if(e instanceof ct&&(e=[e]),Array.isArray(e)){if(e.length!==this.inputs.length)throw new R(`The number of inputs provided (${e.length}) does not match the number of inputs of this model (${this.inputs.length}).`);for(let l=0;la.name);for(let a=0;a0){const o=[];throw t.forEach((r,i)=>{r==null&&o.push(e[i])}),new R(`Cannot find SymbolicTensors for output name(s): ${JSON.stringify(o)}`)}return t}predictLoop(e,t=32,s=!1){return B(()=>{const o=this.checkNumSamples(e);if(s)throw new Ie("Verbose predictLoop() is not implemented yet.");const r=Ud(o,t),i=this.outputs.map(a=>[]);for(let a=0;a{const c=r[a][0],u=r[a][1],h=Wi(e,c,u),d=[];if(Array.isArray(h))for(let f=0;fi[u].push(c));return Ht(i.map(a=>Mt(a,0)))})}predict(e,t={}){const s=Mx(e);zx(s,this.inputNames,this.feedInputShapes,!1);try{const o=t.batchSize==null?32:t.batchSize;return Vd(o),this.predictLoop(s,o)}finally{_n(s,e)}}predictOnBatch(e){zx(e,this.inputNames,this.feedInputShapes,!0);const t=(Array.isArray(e)?e[0]:e).shape[0];return this.predictLoop(e,t)}standardizeUserDataXY(e,t,s=!0,o){if(this.optimizer_==null)throw new gn("You must compile a model before training/testing. Use LayersModel.compile(modelCompileArgs).");const r=[];for(let i=0;i0&&e[0].shape[0]%o!==0)throw new R(`In a stateful network, you should only pass inputs with a number of samples that is divisible by the batch size ${o}. Found: ${e[0].shape[0]} sample(s).`);return[e,t]}async standardizeUserData(e,t,s,o,r=!0,i){const[a,l]=this.standardizeUserDataXY(e,t,r,i);if(s!=null)throw new Error("sample weight is not supported yet.");let c=null;if(o!=null){const u=Dx(o,this.outputNames);c=[];for(let h=0;h{const i=this.checkNumSamples(t,s,r,"steps"),a=[];if(o>0)throw new Ie("Verbose mode is not implemented yet.");if(r!=null)throw new Ie("steps mode in testLoop() is not implemented yet");{const l=Ud(i,s),c=At(Rn(0,i));for(let u=0;u1){const i=Ug(e.slice(0,s),o);r+=`_${i}`}t.push(r)}return t}makeTrainFunction(){return e=>{const t=[],s=e.slice(0,this.inputs.length),o=e.slice(this.inputs.length,this.inputs.length+this.outputs.length),r=e.slice(this.inputs.length+this.outputs.length,this.inputs.length+this.outputs.length*2),i=[],a=()=>{const h=[];for(let m=0;m1&&m{f=J(f,m)}),f},l=this.collectedTrainableWeights.map(h=>h.read());return[this.optimizer_.minimize(a,!0,l)].concat(i)}}makeTestFunction(){this.testFunction=e=>B(()=>{const t=[];let s;const o=e.slice(0,this.inputs.length),r=e.slice(this.inputs.length,this.inputs.length+this.outputs.length),i=[];for(let c=0;c0){if(g=!0,s.validationData.length===2)l=s.validationData[0],c=s.validationData[1];else throw s.validationData.length===3?new Ie("validationData including sample weights is not supported yet."):new R(`When passing validation data, it must contain 2 (valX, valY) or 3 (valX, valY, valSampleWeight) items; ${s.validationData} is invalid.`);const N=await this.standardizeUserData(l,c,null,null,!0,p);u=N[0],h=N[1],x=u.concat(h)}else if(s.validationSplit!=null&&s.validationSplit>0&&s.validationSplit<1){g=!0;const S=Math.floor(o[0].shape[0]*(1-s.validationSplit)),N=o[0].shape[0];u=Wi(o,S,N),i=o,o=Wi(o,0,S),h=Wi(r,S,N),a=r,r=Wi(r,0,S),x=u.concat(h)}else s.validationSteps!=null&&(g=!0);const b=o.concat(r).concat(d);this.checkTrainableWeightsConsistency();const w=this.makeTrainFunction(),y=this.getDedupedMetricsNames();let C,I;g?(this.makeTestFunction(),C=this.testFunction,I=y.slice().concat(y.map(S=>"val_"+S))):(C=null,x=[],I=y.slice());const $=Cx(s.callbacks,s.yieldEvery);return await this.fitLoop(w,b,y,p,s.epochs,s.verbose,$,C,x,s.shuffle,I,s.initialEpoch,null,null)}finally{this.isTraining=!1,_n(o,e),_n(r,t),_n(i,e),_n(a,t),_n(u,l),_n(h,c),d!=null&&fe(d)}}async fitLoop(e,t,s,o,r,i,a,l,c,u,h,d,p,f){o==null&&(o=32),r==null&&(r=1),u==null&&(u=!0),d==null&&(d=0);let m=!1;if(l!=null&&c!=null&&(m=!0),f!=null&&(m=!0,p==null))throw new R("Can only use `validationSteps` when doing step-wise training, i.e., `stepsPerEpoch` must be set.");const g=this.checkNumSamples(t,o,p,"steps_per_epoch");let x;g!=null&&(x=Rn(0,g)),i==null&&(i=1);const{callbackList:b,history:w}=Ix(a,i,r,d,g,p,o,m,h);b.setModel(this),this.history=w,await b.onTrainBegin(),this.stopTraining_=!1;for(let y=d;y{const N=$[k][0],A=$[k][1],_=xo(I,N,A-N);S.batch=k,S.size=A-N;const E=Wd(t,_),M=e(E);for(let z=0;zhs(t))}else{const t=Object.keys(this.loss);e={};const s=this.loss;for(const o of t)if(typeof s[o]=="string")e[o]=hs(s[o]);else throw new Error("Serialization of non-string loss is not supported.")}return e}getMetricIdentifiers(){if(typeof this.metrics=="string"||typeof this.metrics=="function")return[hs(Yl(this.metrics))];if(Array.isArray(this.metrics))return this.metrics.map(e=>hs(Yl(e)));{const e={};for(const t in this.metrics)e[t]=hs(Yl(this.metrics[t]));return e}}getTrainingConfig(){return{loss:this.getLossIdentifiers(),metrics:this.getMetricIdentifiers(),optimizer_config:{class_name:this.optimizer.getClassName(),config:this.optimizer.getConfig()}}}loadTrainingConfig(e){if(e.weighted_metrics!=null)throw new Error("Loading weight_metrics is not supported yet.");if(e.loss_weights!=null)throw new Error("Loading loss_weights is not supported yet.");if(e.sample_weight_mode!=null)throw new Error("Loading sample_weight_mode is not supported yet.");const t=Ql(e.optimizer_config),s=Zn(t);let o;if(typeof e.loss=="string")o=fo(e.loss);else if(Array.isArray(e.loss))o=e.loss.map(i=>fo(i));else if(e.loss!=null){o={};for(const i in e.loss)o[i]=fo(e.loss[i])}let r;if(Array.isArray(e.metrics))r=e.metrics.map(i=>fo(i));else if(e.metrics!=null){r={};for(const i in e.metrics)r[i]=fo(e.metrics[i])}this.compile({loss:o,metrics:r,optimizer:s})}async save(e,t){if(typeof e=="string"){const c=FC(e);if(c.length===0)throw new R(`Cannot find any save handlers for URL '${e}'`);if(c.length>1)throw new R(`Found more than one (${c.length}) save handlers for URL '${e}'`);e=c[0]}if(e.save==null)throw new R("LayersModel.save() cannot proceed because the IOHandler provided does not have the `save` attribute defined.");const s=await Xf(this.getNamedWeights(t)),a={modelTopology:this.toJSON(null,!1),format:oR,generatedBy:`TensorFlow.js tfjs-layers v${Ax}`,convertedBy:null};if((t==null?!1:t.includeOptimizer)&&this.optimizer!=null){a.trainingConfig=this.getTrainingConfig();const c="optimizer",{data:u,specs:h}=await Xf(await this.optimizer.getWeights(),c);s.specs.push(...h),s.data=vC([s.data,u])}return this.userDefinedMetadata!=null&&(Ex(this.userDefinedMetadata,this.name,!0),a.userDefinedMetadata=this.userDefinedMetadata),a.weightData=s.data,a.weightSpecs=s.specs,e.save(a)}setUserDefinedMetadata(e){Ex(e,this.name),this.userDefinedMetadata=e}getUserDefinedMetadata(){return this.userDefinedMetadata}}tr.className="Model",Z(tr);class Vx extends tr{}Vx.className="Functional",Z(Vx);/** + */function JE(n){return n instanceof ct}function Wd(n){return Array.isArray(n)}function Px(n){return!JE(n)&&!Wd(n)}function Bx(n,e,t,s=!0,o=""){if(e==null||e.length===0){if(n!=null){let i=!1;if(Wd(n)&&n.length>0)i=!0;else if(Px(n)){for(const a in n)if(n.hasOwnProperty(a)){i=!0;break}}else i=!0;if(i)throw new R(`Error when checking model ${o} expected no data, but got ${n}`)}return[]}if(n==null)return e.map(i=>null);let r;if(Px(n)){n=n,r=[];for(const i of e){if(n[i]==null)throw new R(`No data provided for "${i}". Need data for each key in: ${e}`);r.push(n[i])}}else if(Wd(n)){if(n=n,n.length!==e.length)throw new R(`Error when checking model ${o}: the Array of Tensors that you are passing to your model is not the size the model expected. Expected to see ${e.length} Tensor(s), but instead got the following list of Tensor(s): ${n}`);r=n}else{if(n=n,e.length>1)throw new R(`The model ${o} expects ${e.length} Tensor(s), but only received one Tensor. Found: Tensor with shape ${n.shape}`);r=[n]}if(r=Mx(r),t!=null)for(let i=0;i=0&&c!==u)throw new R(`${o} expected a batch of elements where each example has shape [${t[i].slice(1,t[i].length)}] (i.e.,tensor shape [*,${t[i].slice(1,t[i].length)}]) but the ${o} received an input with ${a.shape[0]} examples, each with shape [${a.shape.slice(1,a.shape.length)}] (tensor shape [${a.shape}])`)}}return r}function eR(n,e,t){const s=Ss(n.map(r=>r.shape[0]));s.sort();const o=Ss(e.map(r=>r.shape[0]));if(o.sort(),s.length>1)throw new R(`All input Tensors (x) should have the same number of samples. Got array shapes: ${JSON.stringify(n.map(r=>r.shape))}`);if(o.length>1)throw new R(`All target Tensors (y) should have the same number of samples. Got array shapes: ${JSON.stringify(e.map(r=>r.shape))}`);if(s.length>0&&o.length>0&&!_e(s,o))throw new R(`Input Tensors should have the same number of samples as target Tensors. Found ${s[0]} input sample(s) and ${o[0]} target sample(s).`)}function tR(n,e,t){const s=[Hl,jl,Vi];for(let o=0;o1)throw new R(`The model expects ${e.length} ${o} Tensors, but only received one Tensor. Found: array with shape ${JSON.stringify(n.shape)}.`);r=[n]}if(t!=null)for(let i=0;i[]);let t;if(typeof n=="string"||typeof n=="function")t=[n];else if(Array.isArray(n)||typeof n=="object")t=n;else throw new TypeError(`Type of metrics argument not understood. Expected an string,function, Array, or Object, found: ${n}`);if(Array.isArray(t))return e.map(s=>t);{const s=[];for(const o of e){let r=t.hasOwnProperty(o)?t[o]:[];Array.isArray(r)||(r=[r]),s.push(r)}return s}}const sR="layers-model";class tr extends Fn{constructor(e){super(e),this.isTraining=!1}summary(e,t,s=console.log){if(!this.built)throw new R("This model has never been called, thus its weights have not been created yet. So no summary can be displayed. Build the model first (e.g., by calling it on some test data).");BE(this,e,t,s)}compile(e){if(e.loss==null&&(e.loss=[]),this.loss=e.loss,typeof e.optimizer=="string")this.optimizer_=PE(e.optimizer),this.isOptimizerOwned=!0;else{if(!(e.optimizer instanceof vs))throw new R("User-defined optimizer must be an instance of tf.Optimizer.");this.optimizer_=e.optimizer,this.isOptimizerOwned=!1}let t=[];if(!Array.isArray(e.loss)&&typeof e.loss!="string"&&typeof e.loss!="function"){e.loss=e.loss;for(const i in e.loss)if(this.outputNames.indexOf(i)===-1)throw new R(`Unknown entry in loss dictionary: "${i}". Only expected the following keys: ${this.outputNames}`);for(const i of this.outputNames)e.loss[i]==null&&console.warn(`Output "${i}" is missing from loss dictionary. We assume this was done on purpose, and we will not be expecting data to be passed to ${i} during training`),t.push(Ld(e.loss[i]))}else if(Array.isArray(e.loss)){if(e.loss.length!==this.outputs.length)throw new R(`When passing an Array as loss, it should have one entry per model output. The model has ${this.outputs.length} output(s), but you passed loss=${e.loss}.`);t=e.loss.map(a=>Ld(a))}else{const i=Ld(e.loss);this.outputs.forEach(a=>{t.push(i)})}this.lossFunctions=t,this.feedOutputNames=[],this.feedOutputShapes=[],this.feedLossFns=[];for(let i=0;i{for(let i=0;i1&&(this.metricsTensors.push([a,i]),this.metricsNames.push(this.outputNames[i]+"_loss"))}});const o=nR(e.metrics,this.outputNames),r=(i,a,l)=>{this.outputNames.length>1&&(a=this.outputNames[i]+"_"+a),this.metricsNames.push(a),this.metricsTensors.push([l,i])};go("metric",()=>{for(let i=0;i{const u="";let h,d,p;for(const f of c){if(typeof f=="string"&&["accuracy","acc","crossentropy","ce"].indexOf(f)!==-1){const g=this.internalOutputShapes[i];g[g.length-1]===1||this.lossFunctions[i]===jl?["accuracy","acc"].indexOf(f)!==-1?d=kx:["crossentropy","ce"].indexOf(f)!==-1&&(d=NE):this.lossFunctions[i]===ql?["accuracy","acc"].indexOf(f)!==-1?d=EE:["crossentropy","ce"].indexOf(f)!==-1&&(d=Tx):["accuracy","acc"].indexOf(f)!==-1?d=vx:["crossentropy","ce"].indexOf(f)!==-1&&(d=Sx);let x;["accuracy","acc"].indexOf(f)!==-1?x="acc":["crossentropy","ce"].indexOf(f)!==-1&&(x="ce"),p=d,h=u+x}else p=ME(f),h=u+Yl(f);let m;go(h,()=>{m=p}),r(i,h,m)}})(a)}}),this.collectedTrainableWeights=this.trainableWeights}checkTrainableWeightsConsistency(){this.collectedTrainableWeights!=null&&this.trainableWeights.length!==this.collectedTrainableWeights.length&&console.warn("Discrepancy between trainableweights and collected trainable weights. Did you set `model.trainable` without calling `model.compile()` afterwards?")}evaluate(e,t,s={}){const o=s.batchSize==null?32:s.batchSize;Bd(o);const i=this.standardizeUserDataXY(e,t,!0,o);try{const a=i[0].concat(i[1]);this.makeTestFunction();const l=this.testFunction,c=this.testLoop(l,a,o,s.verbose,s.steps);return Ht(c)}finally{_n(i[0],e),_n(i[1],t)}}async evaluateDataset(e,t){return this.makeTestFunction(),QE(this,e,t)}checkNumSamples(e,t,s,o="steps"){let r;if(s!=null){if(r=null,t!=null)throw new R(`If ${o} is set, batchSize must be null or undefined.Got batchSize = ${t}`)}else if(e!=null)Array.isArray(e)?r=e[0].shape[0]:r=e.shape[0];else throw new R(`Either the input data should have a defined shape, or ${o} shoud be specified.`);return r}execute(e,t){if(Array.isArray(t)&&t.length===0)throw new R("`outputs` is an empty Array, which is not allowed.");const s=Array.isArray(t),o=s?t:[t],r=this.retrieveSymbolicTensors(o),i=new Es;if(e instanceof ct&&(e=[e]),Array.isArray(e)){if(e.length!==this.inputs.length)throw new R(`The number of inputs provided (${e.length}) does not match the number of inputs of this model (${this.inputs.length}).`);for(let l=0;la.name);for(let a=0;a0){const o=[];throw t.forEach((r,i)=>{r==null&&o.push(e[i])}),new R(`Cannot find SymbolicTensors for output name(s): ${JSON.stringify(o)}`)}return t}predictLoop(e,t=32,s=!1){return B(()=>{const o=this.checkNumSamples(e);if(s)throw new Ie("Verbose predictLoop() is not implemented yet.");const r=Vd(o,t),i=this.outputs.map(a=>[]);for(let a=0;a{const c=r[a][0],u=r[a][1],h=Wi(e,c,u),d=[];if(Array.isArray(h))for(let f=0;fi[u].push(c));return Ht(i.map(a=>Ot(a,0)))})}predict(e,t={}){const s=Mx(e);zx(s,this.inputNames,this.feedInputShapes,!1);try{const o=t.batchSize==null?32:t.batchSize;return Bd(o),this.predictLoop(s,o)}finally{_n(s,e)}}predictOnBatch(e){zx(e,this.inputNames,this.feedInputShapes,!0);const t=(Array.isArray(e)?e[0]:e).shape[0];return this.predictLoop(e,t)}standardizeUserDataXY(e,t,s=!0,o){if(this.optimizer_==null)throw new gn("You must compile a model before training/testing. Use LayersModel.compile(modelCompileArgs).");const r=[];for(let i=0;i0&&e[0].shape[0]%o!==0)throw new R(`In a stateful network, you should only pass inputs with a number of samples that is divisible by the batch size ${o}. Found: ${e[0].shape[0]} sample(s).`);return[e,t]}async standardizeUserData(e,t,s,o,r=!0,i){const[a,l]=this.standardizeUserDataXY(e,t,r,i);if(s!=null)throw new Error("sample weight is not supported yet.");let c=null;if(o!=null){const u=Dx(o,this.outputNames);c=[];for(let h=0;h{const i=this.checkNumSamples(t,s,r,"steps"),a=[];if(o>0)throw new Ie("Verbose mode is not implemented yet.");if(r!=null)throw new Ie("steps mode in testLoop() is not implemented yet");{const l=Vd(i,s),c=Lt(Rn(0,i));for(let u=0;u1){const i=Ug(e.slice(0,s),o);r+=`_${i}`}t.push(r)}return t}makeTrainFunction(){return e=>{const t=[],s=e.slice(0,this.inputs.length),o=e.slice(this.inputs.length,this.inputs.length+this.outputs.length),r=e.slice(this.inputs.length+this.outputs.length,this.inputs.length+this.outputs.length*2),i=[],a=()=>{const h=[];for(let m=0;m1&&m{f=J(f,m)}),f},l=this.collectedTrainableWeights.map(h=>h.read());return[this.optimizer_.minimize(a,!0,l)].concat(i)}}makeTestFunction(){this.testFunction=e=>B(()=>{const t=[];let s;const o=e.slice(0,this.inputs.length),r=e.slice(this.inputs.length,this.inputs.length+this.outputs.length),i=[];for(let c=0;c0){if(g=!0,s.validationData.length===2)l=s.validationData[0],c=s.validationData[1];else throw s.validationData.length===3?new Ie("validationData including sample weights is not supported yet."):new R(`When passing validation data, it must contain 2 (valX, valY) or 3 (valX, valY, valSampleWeight) items; ${s.validationData} is invalid.`);const N=await this.standardizeUserData(l,c,null,null,!0,p);u=N[0],h=N[1],x=u.concat(h)}else if(s.validationSplit!=null&&s.validationSplit>0&&s.validationSplit<1){g=!0;const S=Math.floor(o[0].shape[0]*(1-s.validationSplit)),N=o[0].shape[0];u=Wi(o,S,N),i=o,o=Wi(o,0,S),h=Wi(r,S,N),a=r,r=Wi(r,0,S),x=u.concat(h)}else s.validationSteps!=null&&(g=!0);const b=o.concat(r).concat(d);this.checkTrainableWeightsConsistency();const w=this.makeTrainFunction(),y=this.getDedupedMetricsNames();let C,I;g?(this.makeTestFunction(),C=this.testFunction,I=y.slice().concat(y.map(S=>"val_"+S))):(C=null,x=[],I=y.slice());const v=Cx(s.callbacks,s.yieldEvery);return await this.fitLoop(w,b,y,p,s.epochs,s.verbose,v,C,x,s.shuffle,I,s.initialEpoch,null,null)}finally{this.isTraining=!1,_n(o,e),_n(r,t),_n(i,e),_n(a,t),_n(u,l),_n(h,c),d!=null&&fe(d)}}async fitLoop(e,t,s,o,r,i,a,l,c,u,h,d,p,f){o==null&&(o=32),r==null&&(r=1),u==null&&(u=!0),d==null&&(d=0);let m=!1;if(l!=null&&c!=null&&(m=!0),f!=null&&(m=!0,p==null))throw new R("Can only use `validationSteps` when doing step-wise training, i.e., `stepsPerEpoch` must be set.");const g=this.checkNumSamples(t,o,p,"steps_per_epoch");let x;g!=null&&(x=Rn(0,g)),i==null&&(i=1);const{callbackList:b,history:w}=Ix(a,i,r,d,g,p,o,m,h);b.setModel(this),this.history=w,await b.onTrainBegin(),this.stopTraining_=!1;for(let y=d;y{const N=v[$][0],A=v[$][1],_=xo(I,N,A-N);S.batch=$,S.size=A-N;const E=zd(t,_),M=e(E);for(let z=0;zhs(t))}else{const t=Object.keys(this.loss);e={};const s=this.loss;for(const o of t)if(typeof s[o]=="string")e[o]=hs(s[o]);else throw new Error("Serialization of non-string loss is not supported.")}return e}getMetricIdentifiers(){if(typeof this.metrics=="string"||typeof this.metrics=="function")return[hs(Yl(this.metrics))];if(Array.isArray(this.metrics))return this.metrics.map(e=>hs(Yl(e)));{const e={};for(const t in this.metrics)e[t]=hs(Yl(this.metrics[t]));return e}}getTrainingConfig(){return{loss:this.getLossIdentifiers(),metrics:this.getMetricIdentifiers(),optimizer_config:{class_name:this.optimizer.getClassName(),config:this.optimizer.getConfig()}}}loadTrainingConfig(e){if(e.weighted_metrics!=null)throw new Error("Loading weight_metrics is not supported yet.");if(e.loss_weights!=null)throw new Error("Loading loss_weights is not supported yet.");if(e.sample_weight_mode!=null)throw new Error("Loading sample_weight_mode is not supported yet.");const t=Ql(e.optimizer_config),s=Zn(t);let o;if(typeof e.loss=="string")o=fo(e.loss);else if(Array.isArray(e.loss))o=e.loss.map(i=>fo(i));else if(e.loss!=null){o={};for(const i in e.loss)o[i]=fo(e.loss[i])}let r;if(Array.isArray(e.metrics))r=e.metrics.map(i=>fo(i));else if(e.metrics!=null){r={};for(const i in e.metrics)r[i]=fo(e.metrics[i])}this.compile({loss:o,metrics:r,optimizer:s})}async save(e,t){if(typeof e=="string"){const c=DC(e);if(c.length===0)throw new R(`Cannot find any save handlers for URL '${e}'`);if(c.length>1)throw new R(`Found more than one (${c.length}) save handlers for URL '${e}'`);e=c[0]}if(e.save==null)throw new R("LayersModel.save() cannot proceed because the IOHandler provided does not have the `save` attribute defined.");const s=await Xf(this.getNamedWeights(t)),a={modelTopology:this.toJSON(null,!1),format:sR,generatedBy:`TensorFlow.js tfjs-layers v${Ax}`,convertedBy:null};if((t==null?!1:t.includeOptimizer)&&this.optimizer!=null){a.trainingConfig=this.getTrainingConfig();const c="optimizer",{data:u,specs:h}=await Xf(await this.optimizer.getWeights(),c);s.specs.push(...h),s.data=kC([s.data,u])}return this.userDefinedMetadata!=null&&(Ex(this.userDefinedMetadata,this.name,!0),a.userDefinedMetadata=this.userDefinedMetadata),a.weightData=s.data,a.weightSpecs=s.specs,e.save(a)}setUserDefinedMetadata(e){Ex(e,this.name),this.userDefinedMetadata=e}getUserDefinedMetadata(){return this.userDefinedMetadata}}tr.className="Model",Z(tr);class Vx extends tr{}Vx.className="Functional",Z(Vx);/** * @license * Copyright 2018 Google LLC * @@ -7720,7 +7720,7 @@ * license that can be found in the LICENSE file or at * https://opensource.org/licenses/MIT. * ============================================================================= - */async function rR(n,e){if(e==null&&(e={}),typeof n=="string"){const t=_C(n,e);if(t.length===0)t.push(p2(n,e));else if(t.length>1)throw new R(`Found more than one (${t.length}) load handlers for URL '${n}'`);n=t[0]}return iR(n,void 0,e)}async function iR(n,e,t){if(t==null&&(t={}),n.load==null)throw new R("Cannot proceed with model loading because the IOHandler provided does not have the `load` method implemented.");const s=await n.load();let o=s.modelTopology;o.model_config!=null&&(o=o.model_config);const r=t.strict==null?!0:t.strict,i=s.weightData!=null&&s.weightSpecs!=null&&r,a=Zn(Ql(o),e,i),l=s.trainingConfig;if(l!=null&&a.loadTrainingConfig(l),s.userDefinedMetadata!=null&&a.setUserDefinedMetadata(s.userDefinedMetadata),s.weightData!=null){if(s.weightSpecs==null)throw new R("LayersModel artifacts contains weight data, but not weight specs. Therefore loading of weights cannot proceed.");const{modelWeights:c,optimizerWeights:u}=aR(s.weightData,s.weightSpecs);a.loadWeights(c,r),a.optimizer!=null&&u.length>0&&await a.optimizer.setWeights(u),fe(c),fe(u.map(h=>h.tensor))}return a}function aR(n,e){const t=yC(n,e),s={},o=[];return e.forEach(r=>{r.group==="optimizer"?o.push({name:r.name,tensor:t[r.name]}):s[r.name]=t[r.name]}),{modelWeights:s,optimizerWeights:o}}class Ui extends tr{constructor(e){if(super({inputs:[],outputs:[]}),e=e||{},this.trainable=!0,this.built=!1,this.name=e.name!=null?e.name:Ll("sequential_"),e.layers!=null)for(const t of e.layers)this.add(t)}checkShape(e){if(e.inboundNodes[0].outputTensors[0].shape.some(s=>s<0))throw new R(`Negative dimension size caused by adding layer ${e.name} with input shape [${e.inboundNodes[0].inputTensors[0].shape}]`)}add(e){const t=e instanceof Ui||e instanceof tr;let s;if(t){if(s=e,s.outputs.length!==1)throw new R("All layers in a Sequential model should have a single output tensor. For multi-output layers, use the functional API.");if(s.inputs.length!==1)throw new R("All layers in a Sequential model should have a single input tensor. For multi-input layers, use the functional API.")}if(this.outputs.length===0){if(e.inboundNodes.length===0){if(e.batchInputShape==null)throw new R("The first layer in a Sequential model must get an `inputShape` or `batchInputShape` argument.");const o=aE({batchShape:e.batchInputShape,dtype:e.dtype,name:e.name+"_input"});e.apply(o)}if(t)this.outputs=s.outputs,this.inputs=s.inputs;else{if(e.inboundNodes.length!==1)throw new R(`A layer added to a Sequential model must not already be connected somewhere else. LayersModel received layer ${e.name} which has ${e.inboundNodes.length} pre-existing inbound connections.`);if(e.inboundNodes[0].outputTensors.length!==1)throw new R("All layers in a Sequential model should have a single output tensor. For multi-output layers, use the functional API.");this.checkShape(e),this.outputs=[e.inboundNodes[0].outputTensors[0]],this.inputs=hx(this.outputs[0])}this.inboundNodes=[],new Vl({outboundLayer:this,inboundLayers:[],nodeIndices:[],tensorIndices:[],inputTensors:this.inputs,outputTensors:this.outputs,inputMasks:po(null,this.inputs.length),outputMasks:[null],inputShapes:this.inputs.map(o=>o.shape),outputShapes:this.outputs[0].shape})}else{const o=e.apply(this.outputs[0]);if(Array.isArray(o))throw new TypeError("All layers in a Sequential model should have a single output tensor. For multi-output layers, use the functional API.");this.checkShape(e),this.outputs=[o],this.inboundNodes[0].outputTensors=this.outputs,this.inboundNodes[0].outputShapes=[this.outputs[0].shape]}this.layers.push(e),this.built=!1}pop(){if(this.layers.length===0)throw new TypeError("There are no layers in the model.");if(this.layers.pop(),this.layers.length===0)this.outputs=[],this.inboundNodes=[],this.outboundNodes=[];else{const e=this.layers.length-1;this.layers[e].outboundNodes=[],this.outputs=[this.layers[e].output],this.inboundNodes[0].outputTensors=this.outputs,this.inboundNodes[0].outputShapes=[this.outputs[0].shape]}}call(e,t){return this.model==null&&this.build(),this.model.call(e,t)}build(e){if(Fe(e),this.inputs.length===0||this.outputs.length===0)throw new TypeError("Sequential model cannot be built: model is empty. Add some layers first.");this.model=new tr({inputs:this.inputs,outputs:this.outputs[0],name:this.name+"_model"}),this.model.trainable=this.trainable,this.supportsMasking=this.model.supportsMasking,this.inputLayers=this.model.inputLayers,this.inputLayersNodeIndices=this.model.inputLayersNodeIndices,this.inputLayersTensorIndices=this.model.inputLayersTensorIndices,this.outputLayers=this.model.outputLayers,this.outputLayersNodeIndices=this.model.outputLayersNodeIndices,this.outputLayersTensorIndices=this.model.outputLayersTensorIndices,this.nodesByDepth=this.model.nodesByDepth,this.containerNodes=this.model.containerNodes,this.outputNames=this.model.outputNames,this.inputNames=this.model.inputNames,this.built=!0}countParams(){return this.built||this.build(),super.countParams()}summary(e,t,s=console.log){this.built||this.build(),super.summary(e,t,s)}setWeights(e){this.model==null&&this.build(),this.model.setWeights(e)}evaluate(e,t,s={}){if(!this.built)throw new gn("The model needs to be compiled before being used.");return this.model.evaluate(e,t,s)}async evaluateDataset(e,t){if(!this.built)throw new gn("The model needs to be compiled before being used.");return this.model.evaluateDataset(e,t)}predict(e,t={}){return this.model==null&&this.build(),this.model.predict(e,t)}predictOnBatch(e){return this.model==null&&this.build(),this.model.predictOnBatch(e)}compile(e){this.build(),this.model.compile(e),this.optimizer_=this.model.optimizer,this.isOptimizerOwned=this.model.isOptimizerOwned,this.loss=this.model.loss,this.metrics=this.model.metrics,this.metricsTensors=this.model.metricsTensors,this.metricsNames=this.model.metricsNames}get optimizer(){return this.model==null?void 0:this.model.optimizer}set optimizer(e){this.model.optimizer=e}async fit(e,t,s={}){if(!this.built)throw new gn("The model needs to be compiled before being used.");return this.model.fit(e,t,s)}async fitDataset(e,t){if(!this.built)throw new gn("The model needs to be compiled before being used.");return this.model.fitDataset(e,t)}async trainOnBatch(e,t){return this.model.trainOnBatch(e,t)}static fromConfig(e,t,s={},o=!1){let r,i={};if(t instanceof Array){if(t[0].className==null||t[0].className==="Merge")throw new R("Legacy serialization format not supported yet.");r=t}else v(t.layers!=null,()=>"When the config data for a Sequential model is not an Array, it must be an Object that contains the 'layers' field."),r=t.layers,delete t.layers,i=t;const a=new e(i);if(!(a instanceof Ui))throw new Ie(`Sequential.fromConfig called on non-Sequential input: ${a}`);for(const l of r){const u=Zn(l,void 0,o);o&&u.setFastWeightInitDuringBuild(!0),a.add(u)}return a}set stopTraining(e){if(this.model==null)throw new R("Cannot set the stopTraining property of a sequential model before it is compiled.");this.model.stopTraining=e}get stopTraining(){if(this.model==null)throw new R("Cannot get the stopTraining property of a sequential model before it is compiled.");return this.model.stopTraining}getConfig(){const e=[];for(const t of this.layers){const s={};s.className=t.getClassName(),s.config=t.getConfig(),e.push(s)}return{name:this.name,layers:e}}}Ui.className="Sequential",Z(Ui);/** + */async function oR(n,e){if(e==null&&(e={}),typeof n=="string"){const t=FC(n,e);if(t.length===0)t.push(d2(n,e));else if(t.length>1)throw new R(`Found more than one (${t.length}) load handlers for URL '${n}'`);n=t[0]}return rR(n,void 0,e)}async function rR(n,e,t){if(t==null&&(t={}),n.load==null)throw new R("Cannot proceed with model loading because the IOHandler provided does not have the `load` method implemented.");const s=await n.load();let o=s.modelTopology;o.model_config!=null&&(o=o.model_config);const r=t.strict==null?!0:t.strict,i=s.weightData!=null&&s.weightSpecs!=null&&r,a=Zn(Ql(o),e,i),l=s.trainingConfig;if(l!=null&&a.loadTrainingConfig(l),s.userDefinedMetadata!=null&&a.setUserDefinedMetadata(s.userDefinedMetadata),s.weightData!=null){if(s.weightSpecs==null)throw new R("LayersModel artifacts contains weight data, but not weight specs. Therefore loading of weights cannot proceed.");const{modelWeights:c,optimizerWeights:u}=iR(s.weightData,s.weightSpecs);a.loadWeights(c,r),a.optimizer!=null&&u.length>0&&await a.optimizer.setWeights(u),fe(c),fe(u.map(h=>h.tensor))}return a}function iR(n,e){const t=bC(n,e),s={},o=[];return e.forEach(r=>{r.group==="optimizer"?o.push({name:r.name,tensor:t[r.name]}):s[r.name]=t[r.name]}),{modelWeights:s,optimizerWeights:o}}class Ui extends tr{constructor(e){if(super({inputs:[],outputs:[]}),e=e||{},this.trainable=!0,this.built=!1,this.name=e.name!=null?e.name:Ll("sequential_"),e.layers!=null)for(const t of e.layers)this.add(t)}checkShape(e){if(e.inboundNodes[0].outputTensors[0].shape.some(s=>s<0))throw new R(`Negative dimension size caused by adding layer ${e.name} with input shape [${e.inboundNodes[0].inputTensors[0].shape}]`)}add(e){const t=e instanceof Ui||e instanceof tr;let s;if(t){if(s=e,s.outputs.length!==1)throw new R("All layers in a Sequential model should have a single output tensor. For multi-output layers, use the functional API.");if(s.inputs.length!==1)throw new R("All layers in a Sequential model should have a single input tensor. For multi-input layers, use the functional API.")}if(this.outputs.length===0){if(e.inboundNodes.length===0){if(e.batchInputShape==null)throw new R("The first layer in a Sequential model must get an `inputShape` or `batchInputShape` argument.");const o=iE({batchShape:e.batchInputShape,dtype:e.dtype,name:e.name+"_input"});e.apply(o)}if(t)this.outputs=s.outputs,this.inputs=s.inputs;else{if(e.inboundNodes.length!==1)throw new R(`A layer added to a Sequential model must not already be connected somewhere else. LayersModel received layer ${e.name} which has ${e.inboundNodes.length} pre-existing inbound connections.`);if(e.inboundNodes[0].outputTensors.length!==1)throw new R("All layers in a Sequential model should have a single output tensor. For multi-output layers, use the functional API.");this.checkShape(e),this.outputs=[e.inboundNodes[0].outputTensors[0]],this.inputs=hx(this.outputs[0])}this.inboundNodes=[],new Vl({outboundLayer:this,inboundLayers:[],nodeIndices:[],tensorIndices:[],inputTensors:this.inputs,outputTensors:this.outputs,inputMasks:po(null,this.inputs.length),outputMasks:[null],inputShapes:this.inputs.map(o=>o.shape),outputShapes:this.outputs[0].shape})}else{const o=e.apply(this.outputs[0]);if(Array.isArray(o))throw new TypeError("All layers in a Sequential model should have a single output tensor. For multi-output layers, use the functional API.");this.checkShape(e),this.outputs=[o],this.inboundNodes[0].outputTensors=this.outputs,this.inboundNodes[0].outputShapes=[this.outputs[0].shape]}this.layers.push(e),this.built=!1}pop(){if(this.layers.length===0)throw new TypeError("There are no layers in the model.");if(this.layers.pop(),this.layers.length===0)this.outputs=[],this.inboundNodes=[],this.outboundNodes=[];else{const e=this.layers.length-1;this.layers[e].outboundNodes=[],this.outputs=[this.layers[e].output],this.inboundNodes[0].outputTensors=this.outputs,this.inboundNodes[0].outputShapes=[this.outputs[0].shape]}}call(e,t){return this.model==null&&this.build(),this.model.call(e,t)}build(e){if(Fe(e),this.inputs.length===0||this.outputs.length===0)throw new TypeError("Sequential model cannot be built: model is empty. Add some layers first.");this.model=new tr({inputs:this.inputs,outputs:this.outputs[0],name:this.name+"_model"}),this.model.trainable=this.trainable,this.supportsMasking=this.model.supportsMasking,this.inputLayers=this.model.inputLayers,this.inputLayersNodeIndices=this.model.inputLayersNodeIndices,this.inputLayersTensorIndices=this.model.inputLayersTensorIndices,this.outputLayers=this.model.outputLayers,this.outputLayersNodeIndices=this.model.outputLayersNodeIndices,this.outputLayersTensorIndices=this.model.outputLayersTensorIndices,this.nodesByDepth=this.model.nodesByDepth,this.containerNodes=this.model.containerNodes,this.outputNames=this.model.outputNames,this.inputNames=this.model.inputNames,this.built=!0}countParams(){return this.built||this.build(),super.countParams()}summary(e,t,s=console.log){this.built||this.build(),super.summary(e,t,s)}setWeights(e){this.model==null&&this.build(),this.model.setWeights(e)}evaluate(e,t,s={}){if(!this.built)throw new gn("The model needs to be compiled before being used.");return this.model.evaluate(e,t,s)}async evaluateDataset(e,t){if(!this.built)throw new gn("The model needs to be compiled before being used.");return this.model.evaluateDataset(e,t)}predict(e,t={}){return this.model==null&&this.build(),this.model.predict(e,t)}predictOnBatch(e){return this.model==null&&this.build(),this.model.predictOnBatch(e)}compile(e){this.build(),this.model.compile(e),this.optimizer_=this.model.optimizer,this.isOptimizerOwned=this.model.isOptimizerOwned,this.loss=this.model.loss,this.metrics=this.model.metrics,this.metricsTensors=this.model.metricsTensors,this.metricsNames=this.model.metricsNames}get optimizer(){return this.model==null?void 0:this.model.optimizer}set optimizer(e){this.model.optimizer=e}async fit(e,t,s={}){if(!this.built)throw new gn("The model needs to be compiled before being used.");return this.model.fit(e,t,s)}async fitDataset(e,t){if(!this.built)throw new gn("The model needs to be compiled before being used.");return this.model.fitDataset(e,t)}async trainOnBatch(e,t){return this.model.trainOnBatch(e,t)}static fromConfig(e,t,s={},o=!1){let r,i={};if(t instanceof Array){if(t[0].className==null||t[0].className==="Merge")throw new R("Legacy serialization format not supported yet.");r=t}else k(t.layers!=null,()=>"When the config data for a Sequential model is not an Array, it must be an Object that contains the 'layers' field."),r=t.layers,delete t.layers,i=t;const a=new e(i);if(!(a instanceof Ui))throw new Ie(`Sequential.fromConfig called on non-Sequential input: ${a}`);for(const l of r){const u=Zn(l,void 0,o);o&&u.setFastWeightInitDuringBuild(!0),a.add(u)}return a}set stopTraining(e){if(this.model==null)throw new R("Cannot set the stopTraining property of a sequential model before it is compiled.");this.model.stopTraining=e}get stopTraining(){if(this.model==null)throw new R("Cannot get the stopTraining property of a sequential model before it is compiled.");return this.model.stopTraining}getConfig(){const e=[];for(const t of this.layers){const s={};s.className=t.getClassName(),s.config=t.getConfig(),e.push(s)}return{name:this.name,layers:e}}}Ui.className="Sequential",Z(Ui);/** * @license * Copyright 2018 Google LLC * @@ -7728,7 +7728,7 @@ * license that can be found in the LICENSE file or at * https://opensource.org/licenses/MIT. * ============================================================================= - */let Dt=class extends Zo{getConfig(){return{}}};class Wx extends Dt{apply(e,t=1){return HN(e,t)}}Wx.className="elu",Z(Wx);class Ux extends Dt{apply(e){return Tm(e)}}Ux.className="selu",Z(Ux);class Gx extends Dt{apply(e){return co(e)}}Gx.className="relu",Z(Gx);class Hx extends Dt{apply(e){return B(()=>vi(6,co(e)))}}Hx.className="relu6",Z(Hx);class qx extends Dt{apply(e){return e}}qx.className="linear",Z(qx);class jx extends Dt{apply(e){return Ho(e)}}jx.className="sigmoid",Z(jx);class Kx extends Dt{apply(e){return jN(e)}}Kx.className="hardSigmoid",Z(Kx);class Xx extends Dt{apply(e){return ki(e)}}Xx.className="softplus",Z(Xx);class Yx extends Dt{apply(e){return qN(e)}}Yx.className="softsign",Z(Yx);class Zx extends Dt{apply(e){return wl(e)}}Zx.className="tanh",Z(Zx);let Hd=class extends Dt{apply(e,t=-1){return Th(e,t)}};Hd.className="softmax",Z(Hd);class Qx extends Dt{apply(e,t=-1){return bm(e,t)}}Qx.className="logSoftmax",Z(Qx);class Jx extends Dt{apply(e){return B(()=>B(()=>{const t=Math.sqrt(2),s=D(.5,J(1,pm(me(e,t))));return D(e,s)}))}}Jx.className="gelu",Z(Jx);class eb extends Dt{apply(e){return B(()=>D(.5,D(e,J(1,wl(D(Rt(me(2,Math.PI)),J(e,D(.044715,io(e,3)))))))))}}eb.className="gelu_new",Z(eb);class tb extends Dt{apply(e){return B(()=>D(e,wl(ki(e))))}}tb.className="mish",Z(tb);class nb extends Dt{apply(e,t=1){return B(()=>D(Ho(D(e,t)),e))}}nb.className="swish",Z(nb);function Rs(n){return n.getClassName()}function qd(n,e={}){return Di(n,mn.getMap().classNameMap,e,"activation")}function As(n){if(n==null){const e={};return e.className="linear",e.config={},qd(e)}if(typeof n=="string"){const e={};return e.className=n,e.config={},qd(e)}else return n instanceof Dt?n:qd(n)}/** + */let At=class extends Zo{getConfig(){return{}}};class Wx extends At{apply(e,t=1){return GN(e,t)}}Wx.className="elu",Z(Wx);class Ux extends At{apply(e){return Tm(e)}}Ux.className="selu",Z(Ux);class Gx extends At{apply(e){return co(e)}}Gx.className="relu",Z(Gx);class Hx extends At{apply(e){return B(()=>vi(6,co(e)))}}Hx.className="relu6",Z(Hx);class qx extends At{apply(e){return e}}qx.className="linear",Z(qx);class jx extends At{apply(e){return Ho(e)}}jx.className="sigmoid",Z(jx);class Kx extends At{apply(e){return qN(e)}}Kx.className="hardSigmoid",Z(Kx);class Xx extends At{apply(e){return ki(e)}}Xx.className="softplus",Z(Xx);class Yx extends At{apply(e){return HN(e)}}Yx.className="softsign",Z(Yx);class Zx extends At{apply(e){return wl(e)}}Zx.className="tanh",Z(Zx);let Ud=class extends At{apply(e,t=-1){return vh(e,t)}};Ud.className="softmax",Z(Ud);class Qx extends At{apply(e,t=-1){return bm(e,t)}}Qx.className="logSoftmax",Z(Qx);class Jx extends At{apply(e){return B(()=>B(()=>{const t=Math.sqrt(2),s=D(.5,J(1,pm(me(e,t))));return D(e,s)}))}}Jx.className="gelu",Z(Jx);class eb extends At{apply(e){return B(()=>D(.5,D(e,J(1,wl(D(Rt(me(2,Math.PI)),J(e,D(.044715,io(e,3)))))))))}}eb.className="gelu_new",Z(eb);class tb extends At{apply(e){return B(()=>D(e,wl(ki(e))))}}tb.className="mish",Z(tb);class nb extends At{apply(e,t=1){return B(()=>D(Ho(D(e,t)),e))}}nb.className="swish",Z(nb);function Rs(n){return n.getClassName()}function Gd(n,e={}){return Di(n,mn.getMap().classNameMap,e,"activation")}function As(n){if(n==null){const e={};return e.className="linear",e.config={},Gd(e)}if(typeof n=="string"){const e={};return e.className=n,e.config={},Gd(e)}else return n instanceof At?n:Gd(n)}/** * @license * Copyright 2018 Google LLC * @@ -7736,7 +7736,7 @@ * license that can be found in the LICENSE file or at * https://opensource.org/licenses/MIT. * ============================================================================= - */function lR(n){if(n!=null&&typeof n!="object")throw new Error(`Argument to L1L2 regularizer's constructor is expected to be an object, but received: ${n}`)}class sb extends Zo{}class ob extends sb{constructor(e){super(),lR(e),this.l1=e==null||e.l1==null?.01:e.l1,this.l2=e==null||e.l2==null?.01:e.l2,this.hasL1=this.l1!==0,this.hasL2=this.l2!==0}apply(e){return B(()=>{let t=ot([1]);return this.hasL1&&(t=J(t,de(D(this.l1,Lt(e))))),this.hasL2&&(t=J(t,de(D(this.l2,Oi(e))))),O(t,[])})}getConfig(){return{l1:this.l1,l2:this.l2}}static fromConfig(e,t){return new e({l1:t.l1,l2:t.l2})}}ob.className="L1L2",Z(ob);const rb={l1l2:"L1L2"};function Be(n){return xd(n)}function ib(n,e={}){return Di(n,mn.getMap().classNameMap,e,"regularizer")}function Ke(n){if(n==null)return null;if(typeof n=="string"){const t={className:n in rb?rb[n]:n,config:{}};return ib(t)}else return n instanceof sb?n:ib(n)}/** + */function aR(n){if(n!=null&&typeof n!="object")throw new Error(`Argument to L1L2 regularizer's constructor is expected to be an object, but received: ${n}`)}class sb extends Zo{}class ob extends sb{constructor(e){super(),aR(e),this.l1=e==null||e.l1==null?.01:e.l1,this.l2=e==null||e.l2==null?.01:e.l2,this.hasL1=this.l1!==0,this.hasL2=this.l2!==0}apply(e){return B(()=>{let t=ot([1]);return this.hasL1&&(t=J(t,de(D(this.l1,_t(e))))),this.hasL2&&(t=J(t,de(D(this.l2,Oi(e))))),O(t,[])})}getConfig(){return{l1:this.l1,l2:this.l2}}static fromConfig(e,t){return new e({l1:t.l1,l2:t.l2})}}ob.className="L1L2",Z(ob);const rb={l1l2:"L1L2"};function Be(n){return md(n)}function ib(n,e={}){return Di(n,mn.getMap().classNameMap,e,"regularizer")}function Ke(n){if(n==null)return null;if(typeof n=="string"){const t={className:n in rb?rb[n]:n,config:{}};return ib(t)}else return n instanceof sb?n:ib(n)}/** * @license * Copyright 2018 Google LLC * @@ -7744,7 +7744,7 @@ * license that can be found in the LICENSE file or at * https://opensource.org/licenses/MIT. * ============================================================================= - */class ab extends ve{constructor(e){super(e??{}),this.supportsMasking=!0,e!=null&&(this.maxValue=e.maxValue)}call(e,t){e=ye(e);let s=co(e);return this.maxValue!=null&&(s=nn(s,0,this.maxValue)),s}computeOutputShape(e){return e}getConfig(){const e={maxValue:this.maxValue},t=super.getConfig();return Object.assign(e,t),e}}ab.className="ReLU",Z(ab);class lb extends ve{constructor(e){super(e??{}),this.DEFAULT_ALPHA=.3,e==null&&(e={}),this.alpha=e.alpha==null?this.DEFAULT_ALPHA:e.alpha}call(e,t){const s=ye(e);return hh(s,this.alpha)}computeOutputShape(e){return e}getConfig(){const e={alpha:this.alpha},t=super.getConfig();return Object.assign(e,t),e}}lb.className="LeakyReLU",Z(lb);class cb extends ve{constructor(e){if(super(e??{}),this.DEFAULT_ALPHA_INITIALIZER="zeros",e==null&&(e={}),this.supportsMasking=!0,this.alphaInitializer=je(e.alphaInitializer||this.DEFAULT_ALPHA_INITIALIZER),this.alphaRegularizer=Ke(e.alphaRegularizer),this.alphaConstraint=ft(e.alphaConstraint),e.sharedAxes==null)this.sharedAxes=null;else if(Array.isArray(e.sharedAxes))this.sharedAxes=e.sharedAxes;else if(typeof e.sharedAxes=="number")this.sharedAxes=[e.sharedAxes];else throw new R(`Expected sharedAxes to be a number or an array of numbers, but got ${e.sharedAxes}`)}build(e){e=Fe(e);const t=e.slice(1);if(this.sharedAxes!=null)for(const o of this.sharedAxes)t[o-1]=1;this.alpha=this.addWeight("alpha",t,"float32",this.alphaInitializer,this.alphaRegularizer,!0,this.alphaConstraint);const s={};if(this.sharedAxes!=null)for(let o=1;o{let s=ye(e);const o=t.mask;if(o!=null){const r=D(be(Nn(s.shape),re(o,s.dtype)),De(-1e9));s=J(s,r)}return this.axis instanceof Array?this.axis.length>1?Vn(be(s,ym(s,this.axis,!0))):this.softmax(s,this.axis[0]):this.softmax(s,this.axis)})}computeOutputShape(e){return e}getConfig(){const e={axis:this.axis},t=super.getConfig();return Object.assign(e,t),e}}db.className="Softmax",Z(db);/** + */class ab extends ve{constructor(e){super(e??{}),this.supportsMasking=!0,e!=null&&(this.maxValue=e.maxValue)}call(e,t){e=ye(e);let s=co(e);return this.maxValue!=null&&(s=nn(s,0,this.maxValue)),s}computeOutputShape(e){return e}getConfig(){const e={maxValue:this.maxValue},t=super.getConfig();return Object.assign(e,t),e}}ab.className="ReLU",Z(ab);class lb extends ve{constructor(e){super(e??{}),this.DEFAULT_ALPHA=.3,e==null&&(e={}),this.alpha=e.alpha==null?this.DEFAULT_ALPHA:e.alpha}call(e,t){const s=ye(e);return ch(s,this.alpha)}computeOutputShape(e){return e}getConfig(){const e={alpha:this.alpha},t=super.getConfig();return Object.assign(e,t),e}}lb.className="LeakyReLU",Z(lb);class cb extends ve{constructor(e){if(super(e??{}),this.DEFAULT_ALPHA_INITIALIZER="zeros",e==null&&(e={}),this.supportsMasking=!0,this.alphaInitializer=je(e.alphaInitializer||this.DEFAULT_ALPHA_INITIALIZER),this.alphaRegularizer=Ke(e.alphaRegularizer),this.alphaConstraint=ft(e.alphaConstraint),e.sharedAxes==null)this.sharedAxes=null;else if(Array.isArray(e.sharedAxes))this.sharedAxes=e.sharedAxes;else if(typeof e.sharedAxes=="number")this.sharedAxes=[e.sharedAxes];else throw new R(`Expected sharedAxes to be a number or an array of numbers, but got ${e.sharedAxes}`)}build(e){e=Fe(e);const t=e.slice(1);if(this.sharedAxes!=null)for(const o of this.sharedAxes)t[o-1]=1;this.alpha=this.addWeight("alpha",t,"float32",this.alphaInitializer,this.alphaRegularizer,!0,this.alphaConstraint);const s={};if(this.sharedAxes!=null)for(let o=1;o{let s=ye(e);const o=t.mask;if(o!=null){const r=D(be(Nn(s.shape),re(o,s.dtype)),De(-1e9));s=J(s,r)}return this.axis instanceof Array?this.axis.length>1?Vn(be(s,ym(s,this.axis,!0))):this.softmax(s,this.axis[0]):this.softmax(s,this.axis)})}computeOutputShape(e){return e}getConfig(){const e={axis:this.axis},t=super.getConfig();return Object.assign(e,t),e}}db.className="Softmax",Z(db);/** * @license * Copyright 2018 Google LLC * @@ -7752,7 +7752,7 @@ * license that can be found in the LICENSE file or at * https://opensource.org/licenses/MIT. * ============================================================================= - */function nr(n,e,t){if(typeof n=="number")return po(n,e);if(n.length!==e)throw new R(`The ${t} argument must be an integer or tuple of ${e} integers. Received: ${n.length} elements.`);for(let s=0;s(rt(e),e==="channelsFirst"?Ee(n,[0,2,3,1]):n))}function pb(n,e){return B(()=>(rt(e),e==="channelsFirst"?Ee(n,[0,2,3,4,1]):n))}function cR(n,e,t,s=1,o="valid",r,i=1){return B(()=>{if(r==null&&(r=An()),rt(r),n.shape.length!==3)throw new R(`The input of a conv1dWithBias operation should be 3, but is ${n.shape.length} instead.`);if(e.shape.length!==3)throw new R(`The kernel for a conv1dWithBias operation should be 3, but is ${e.shape.length} instead`);if(t!=null&&t.shape.length!==1)throw new R(`The bias for a conv1dWithBias operation should be 1, but is ${t.shape.length} instead`);if(r==="channelsFirst"&&(n=Ee(n,[0,2,1])),o==="causal")throw new Ie("The support for CAUSAL padding mode in conv1dWithBias is not implemented yet.");let a=am(n,e,s,o==="same"?"same":"valid","NWC",i);return t!=null&&(a=Dn(a,t)),a})}function fb(n,e,t,s=[1,1],o="valid",r,i,a=null){return B(()=>{if(r==null&&(r=An()),rt(r),n.rank!==3&&n.rank!==4)throw new R(`conv2dWithBiasActivation expects input to be of rank 3 or 4, but received ${n.rank}.`);if(e.rank!==3&&e.rank!==4)throw new R(`conv2dWithBiasActivation expects kernel to be of rank 3 or 4, but received ${n.rank}.`);let l=jd(n,r);if(o==="causal")throw new Ie("The support for CAUSAL padding mode in conv1dWithBias is not implemented yet.");return l=uS({x:l,filter:e,strides:s,pad:o==="same"?"same":"valid",dilations:i,dataFormat:"NHWC",bias:t,activation:a}),r==="channelsFirst"&&(l=Ee(l,[0,3,1,2])),l})}function uR(n,e,t,s=[1,1,1],o="valid",r,i){return B(()=>{if(r==null&&(r=An()),rt(r),n.rank!==4&&n.rank!==5)throw new R(`conv3dWithBias expects input to be of rank 4 or 5, but received ${n.rank}.`);if(e.rank!==4&&e.rank!==5)throw new R(`conv3dWithBias expects kernel to be of rank 4 or 5, but received ${n.rank}.`);let a=pb(n,r);if(o==="causal")throw new Ie("The support for CAUSAL padding mode in conv3dWithBias is not implemented yet.");return a=oh(a,e,s,o==="same"?"same":"valid","NDHWC",i),t!=null&&(a=Dn(a,t)),r==="channelsFirst"&&(a=Ee(a,[0,4,1,2,3])),a})}class Jl extends ve{constructor(e,t){if(super(t),this.bias=null,this.DEFAULT_KERNEL_INITIALIZER="glorotNormal",this.DEFAULT_BIAS_INITIALIZER="zeros",Jl.verifyArgs(t),this.rank=e,yt(this.rank,"rank"),this.rank!==1&&this.rank!==2&&this.rank!==3)throw new Ie(`Convolution layer for rank other than 1, 2, or 3 (${this.rank}) is not implemented yet.`);if(this.kernelSize=nr(t.kernelSize,e,"kernelSize"),this.strides=nr(t.strides==null?1:t.strides,e,"strides"),this.padding=t.padding==null?"valid":t.padding,on(this.padding),this.dataFormat=t.dataFormat==null?"channelsLast":t.dataFormat,rt(this.dataFormat),this.activation=As(t.activation),this.useBias=t.useBias==null?!0:t.useBias,this.biasInitializer=je(t.biasInitializer||this.DEFAULT_BIAS_INITIALIZER),this.biasConstraint=ft(t.biasConstraint),this.biasRegularizer=Ke(t.biasRegularizer),this.activityRegularizer=Ke(t.activityRegularizer),this.dilationRate=nr(t.dilationRate==null?1:t.dilationRate,e,"dilationRate"),this.rank===1&&Array.isArray(this.dilationRate)&&this.dilationRate.length!==1)throw new R(`dilationRate must be a number or an array of a single number for 1D convolution, but received ${JSON.stringify(this.dilationRate)}`);if(this.rank===2){if(typeof this.dilationRate=="number")this.dilationRate=[this.dilationRate,this.dilationRate];else if(this.dilationRate.length!==2)throw new R(`dilationRate must be a number or array of two numbers for 2D convolution, but received ${JSON.stringify(this.dilationRate)}`)}else if(this.rank===3){if(typeof this.dilationRate=="number")this.dilationRate=[this.dilationRate,this.dilationRate,this.dilationRate];else if(this.dilationRate.length!==3)throw new R(`dilationRate must be a number or array of three numbers for 3D convolution, but received ${JSON.stringify(this.dilationRate)}`)}}static verifyArgs(e){if(jn("kernelSize"in e,"required key 'kernelSize' not in config"),typeof e.kernelSize!="number"&&!yd(e.kernelSize,"number",1,3))throw new R(`BaseConv expects config.kernelSize to be number or number[] with length 1, 2, or 3, but received ${JSON.stringify(e.kernelSize)}.`)}getConfig(){const e={kernelSize:this.kernelSize,strides:this.strides,padding:this.padding,dataFormat:this.dataFormat,dilationRate:this.dilationRate,activation:Rs(this.activation),useBias:this.useBias,biasInitializer:Qe(this.biasInitializer),biasRegularizer:Be(this.biasRegularizer),activityRegularizer:Be(this.activityRegularizer),biasConstraint:pt(this.biasConstraint)},t=super.getConfig();return Object.assign(e,t),e}}class sr extends Jl{constructor(e,t){super(e,t),this.kernel=null,sr.verifyArgs(t),this.filters=t.filters,yt(this.filters,"filters"),this.kernelInitializer=je(t.kernelInitializer||this.DEFAULT_KERNEL_INITIALIZER),this.kernelConstraint=ft(t.kernelConstraint),this.kernelRegularizer=Ke(t.kernelRegularizer)}build(e){e=Fe(e);const t=this.dataFormat==="channelsFirst"?1:e.length-1;if(e[t]==null)throw new R(`The channel dimension of the input should be defined. Found ${e[t]}`);const s=e[t],o=this.kernelSize.concat([s,this.filters]);this.kernel=this.addWeight("kernel",o,null,this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint),this.useBias&&(this.bias=this.addWeight("bias",[this.filters],null,this.biasInitializer,this.biasRegularizer,!0,this.biasConstraint)),this.inputSpec=[{ndim:this.rank+2,axes:{[t]:s}}],this.built=!0}call(e,t){return B(()=>{e=ye(e);let s;const o=this.bias==null?null:this.bias.read(),r=Hg(this.activation.getClassName());if(r!=null&&this.rank===2)s=fb(e,this.kernel.read(),o,this.strides,this.padding,this.dataFormat,this.dilationRate,r);else{if(this.rank===1)s=cR(e,this.kernel.read(),o,this.strides[0],this.padding,this.dataFormat,this.dilationRate[0]);else if(this.rank===2)s=fb(e,this.kernel.read(),o,this.strides,this.padding,this.dataFormat,this.dilationRate);else if(this.rank===3)s=uR(e,this.kernel.read(),o,this.strides,this.padding,this.dataFormat,this.dilationRate);else throw new Ie("convolutions greater than 3D are not implemented yet.");this.activation!=null&&(s=this.activation.apply(s))}return s})}computeOutputShape(e){e=Fe(e);const t=[],s=this.dataFormat==="channelsLast"?e.slice(1,e.length-1):e.slice(2);for(let r=0;r 0 but got ${JSON.stringify(e.filters)}`)}}class Gi extends sr{constructor(e){super(2,e),Gi.verifyArgs(e)}getConfig(){const e=super.getConfig();return delete e.rank,e}static verifyArgs(e){if(typeof e.kernelSize!="number"&&!yd(e.kernelSize,"number",1,2))throw new R(`Conv2D expects config.kernelSize to be number or number[] with length 1 or 2, but received ${JSON.stringify(e.kernelSize)}.`)}}Gi.className="Conv2D",Z(Gi);class Hi extends sr{constructor(e){super(3,e),Hi.verifyArgs(e)}getConfig(){const e=super.getConfig();return delete e.rank,e}static verifyArgs(e){if(typeof e.kernelSize!="number"&&!(Array.isArray(e.kernelSize)&&(e.kernelSize.length===1||e.kernelSize.length===3)))throw new R(`Conv3D expects config.kernelSize to be number or [number, number, number], but received ${JSON.stringify(e.kernelSize)}.`)}}Hi.className="Conv3D",Z(Hi);class mb extends Gi{constructor(e){if(super(e),this.inputSpec=[new dt({ndim:4})],this.padding!=="same"&&this.padding!=="valid")throw new R(`Conv2DTranspose currently supports only padding modes 'same' and 'valid', but received padding mode ${this.padding}`)}build(e){if(e=Fe(e),e.length!==4)throw new R("Input should have rank 4; Received input shape: "+JSON.stringify(e));const t=this.dataFormat==="channelsFirst"?1:e.length-1;if(e[t]==null)throw new R("The channel dimension of the inputs should be defined. Found `None`.");const s=e[t],o=this.kernelSize.concat([this.filters,s]);this.kernel=this.addWeight("kernel",o,"float32",this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint),this.useBias&&(this.bias=this.addWeight("bias",[this.filters],"float32",this.biasInitializer,this.biasRegularizer,!0,this.biasConstraint)),this.inputSpec=[new dt({ndim:4,axes:{[t]:s}})],this.built=!0}call(e,t){return B(()=>{let s=ye(e);if(s.shape.length!==4)throw new R(`Conv2DTranspose.call() expects input tensor to be rank-4, but received a tensor of rank-${s.shape.length}`);const o=s.shape,r=o[0];let i,a;this.dataFormat==="channelsFirst"?(i=2,a=3):(i=1,a=2);const l=o[i],c=o[a],u=this.kernelSize[0],h=this.kernelSize[1],d=this.strides[0],p=this.strides[1],f=Qn(l,d,u,this.padding),m=Qn(c,p,h,this.padding),g=[r,f,m,this.filters];this.dataFormat!=="channelsLast"&&(s=Ee(s,[0,2,3,1]));let x=lm(s,this.kernel.read(),g,this.strides,this.padding);return this.dataFormat!=="channelsLast"&&(x=Ee(x,[0,3,1,2])),this.bias!=null&&(x=Dn(x,this.bias.read(),this.dataFormat)),this.activation!=null&&(x=this.activation.apply(x)),x})}computeOutputShape(e){e=Fe(e);const t=e.slice();let s,o,r;this.dataFormat==="channelsFirst"?(s=1,o=2,r=3):(s=3,o=1,r=2);const i=this.kernelSize[0],a=this.kernelSize[1],l=this.strides[0],c=this.strides[1];return t[s]=this.filters,t[o]=Qn(t[o],l,i,this.padding),t[r]=Qn(t[r],c,a,this.padding),t}getConfig(){const e=super.getConfig();return delete e.dilationRate,e}}mb.className="Conv2DTranspose",Z(mb);class gb extends Hi{constructor(e){if(super(e),this.inputSpec=[new dt({ndim:5})],this.padding!=="same"&&this.padding!=="valid")throw new R(`Conv3DTranspose currently supports only padding modes 'same' and 'valid', but received padding mode ${this.padding}`)}build(e){if(e=Fe(e),e.length!==5)throw new R("Input should have rank 5; Received input shape: "+JSON.stringify(e));const t=this.dataFormat==="channelsFirst"?1:e.length-1;if(e[t]==null)throw new R("The channel dimension of the inputs should be defined. Found `None`.");const s=e[t],o=this.kernelSize.concat([this.filters,s]);this.kernel=this.addWeight("kernel",o,"float32",this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint),this.useBias&&(this.bias=this.addWeight("bias",[this.filters],"float32",this.biasInitializer,this.biasRegularizer,!0,this.biasConstraint)),this.inputSpec=[new dt({ndim:5,axes:{[t]:s}})],this.built=!0}call(e,t){return B(()=>{let s=ye(e);if(s.shape.length!==5)throw new R(`Conv3DTranspose.call() expects input tensor to be rank-4, but received a tensor of rank-${s.shape.length}`);const o=s.shape,r=o[0];let i,a,l;this.dataFormat==="channelsFirst"?(l=2,i=3,a=4):(l=1,i=2,a=3);const c=o[l],u=o[i],h=o[a],d=this.kernelSize[0],p=this.kernelSize[1],f=this.kernelSize[2],m=this.strides[0],g=this.strides[1],x=this.strides[2],b=Qn(c,m,d,this.padding),w=Qn(u,g,p,this.padding),y=Qn(h,x,f,this.padding),C=[r,b,w,y,this.filters];this.dataFormat!=="channelsLast"&&(s=Ee(s,[0,2,3,4,1]));let I=h$(s,this.kernel.read(),C,this.strides,this.padding);return this.dataFormat!=="channelsLast"&&(I=Ee(I,[0,4,1,2,3])),this.bias!==null&&(I=Dn(I,this.bias.read(),this.dataFormat)),this.activation!==null&&(I=this.activation.apply(I)),I})}computeOutputShape(e){e=Fe(e);const t=e.slice();let s,o,r,i;this.dataFormat==="channelsFirst"?(s=1,o=2,r=3,i=4):(s=4,o=1,r=2,i=3);const a=this.kernelSize[0],l=this.kernelSize[1],c=this.kernelSize[2],u=this.strides[0],h=this.strides[1],d=this.strides[2];return t[s]=this.filters,t[o]=Qn(t[o],u,a,this.padding),t[r]=Qn(t[r],h,l,this.padding),t[i]=Qn(t[i],d,c,this.padding),t}getConfig(){const e=super.getConfig();return delete e.dilationRate,e}}gb.className="Conv3DTranspose",Z(gb);class xb extends sr{constructor(e,t){if(super(e,t),this.DEFAULT_DEPTHWISE_INITIALIZER="glorotUniform",this.DEFAULT_POINTWISE_INITIALIZER="glorotUniform",this.depthwiseKernel=null,this.pointwiseKernel=null,t.filters==null)throw new R("The `filters` configuration field is required by SeparableConv, but is unspecified.");if(t.kernelInitializer!=null||t.kernelRegularizer!=null||t.kernelConstraint!=null)throw new R("Fields kernelInitializer, kernelRegularizer and kernelConstraint are invalid for SeparableConv2D. Use depthwiseInitializer, depthwiseRegularizer, depthwiseConstraint, pointwiseInitializer, pointwiseRegularizer and pointwiseConstraint instead.");if(t.padding!=null&&t.padding!=="same"&&t.padding!=="valid")throw new R(`SeparableConv${this.rank}D supports only padding modes: 'same' and 'valid', but received ${JSON.stringify(t.padding)}`);this.depthMultiplier=t.depthMultiplier==null?1:t.depthMultiplier,this.depthwiseInitializer=je(t.depthwiseInitializer||this.DEFAULT_DEPTHWISE_INITIALIZER),this.depthwiseRegularizer=Ke(t.depthwiseRegularizer),this.depthwiseConstraint=ft(t.depthwiseConstraint),this.pointwiseInitializer=je(t.depthwiseInitializer||this.DEFAULT_POINTWISE_INITIALIZER),this.pointwiseRegularizer=Ke(t.pointwiseRegularizer),this.pointwiseConstraint=ft(t.pointwiseConstraint)}build(e){if(e=Fe(e),e.length{e=ye(e);let s;if(this.rank===1)throw new Ie("1D separable convolution is not implemented yet.");return this.rank===2&&(this.dataFormat==="channelsFirst"&&(e=Ee(e,[0,2,3,1])),s=Nm(e,this.depthwiseKernel.read(),this.pointwiseKernel.read(),this.strides,this.padding,this.dilationRate,"NHWC")),this.useBias&&(s=Dn(s,this.bias.read(),this.dataFormat)),this.activation!=null&&(s=this.activation.apply(s)),this.dataFormat==="channelsFirst"&&(s=Ee(s,[0,3,1,2])),s})}getConfig(){const e=super.getConfig();return delete e.rank,delete e.kernelInitializer,delete e.kernelRegularizer,delete e.kernelConstraint,e.depthwiseInitializer=Qe(this.depthwiseInitializer),e.pointwiseInitializer=Qe(this.pointwiseInitializer),e.depthwiseRegularizer=Be(this.depthwiseRegularizer),e.pointwiseRegularizer=Be(this.pointwiseRegularizer),e.depthwiseConstraint=pt(this.depthwiseConstraint),e.pointwiseConstraint=pt(this.pointwiseConstraint),e}}xb.className="SeparableConv";class bb extends xb{constructor(e){super(2,e)}}bb.className="SeparableConv2D",Z(bb);class ec extends sr{constructor(e){super(1,e),ec.verifyArgs(e),this.inputSpec=[{ndim:3}]}getConfig(){const e=super.getConfig();return delete e.rank,delete e.dataFormat,e}static verifyArgs(e){if(typeof e.kernelSize!="number"&&!yd(e.kernelSize,"number",1,1))throw new R(`Conv1D expects config.kernelSize to be number or number[] with length 1, but received ${JSON.stringify(e.kernelSize)}.`)}}ec.className="Conv1D",Z(ec);class yb extends ve{constructor(e){super(e),typeof e.cropping=="number"?this.cropping=[[e.cropping,e.cropping],[e.cropping,e.cropping]]:typeof e.cropping[0]=="number"?this.cropping=[[e.cropping[0],e.cropping[0]],[e.cropping[1],e.cropping[1]]]:this.cropping=e.cropping,this.dataFormat=e.dataFormat===void 0?"channelsLast":e.dataFormat,this.inputSpec=[{ndim:4}]}computeOutputShape(e){return this.dataFormat==="channelsFirst"?[e[0],e[1],e[2]-this.cropping[0][0]-this.cropping[0][1],e[3]-this.cropping[1][0]-this.cropping[1][1]]:[e[0],e[1]-this.cropping[0][0]-this.cropping[0][1],e[2]-this.cropping[1][0]-this.cropping[1][1],e[3]]}call(e,t){return B(()=>{if(e=ye(e),this.dataFormat==="channelsLast"){const s=Ml(e,this.cropping[0][0],e.shape[1]-this.cropping[0][0]-this.cropping[0][1],2);return Ml(s,this.cropping[1][0],e.shape[2]-this.cropping[1][1]-this.cropping[1][0],3)}else{const s=Ml(e,this.cropping[0][0],e.shape[2]-this.cropping[0][0]-this.cropping[0][1],3);return Ml(s,this.cropping[1][0],e.shape[3]-this.cropping[1][1]-this.cropping[1][0],4)}})}getConfig(){const e={cropping:this.cropping,dataFormat:this.dataFormat},t=super.getConfig();return Object.assign(e,t),e}}yb.className="Cropping2D",Z(yb);class wb extends ve{constructor(e){super(e),this.DEFAULT_SIZE=[2,2],this.inputSpec=[{ndim:4}],this.size=e.size==null?this.DEFAULT_SIZE:e.size,this.dataFormat=e.dataFormat==null?"channelsLast":e.dataFormat,rt(this.dataFormat),this.interpolation=e.interpolation==null?"nearest":e.interpolation,PN(this.interpolation)}computeOutputShape(e){if(this.dataFormat==="channelsFirst"){const t=e[2]==null?null:this.size[0]*e[2],s=e[3]==null?null:this.size[1]*e[3];return[e[0],e[1],t,s]}else{const t=e[1]==null?null:this.size[0]*e[1],s=e[2]==null?null:this.size[1]*e[2];return[e[0],t,s,e[3]]}}call(e,t){return B(()=>{let s=ye(e);const o=s.shape;if(this.dataFormat==="channelsFirst"){s=Ee(s,[0,2,3,1]);const r=this.size[0]*o[2],i=this.size[1]*o[3],a=this.interpolation==="nearest"?ls.resizeNearestNeighbor(s,[r,i]):ls.resizeBilinear(s,[r,i]);return Ee(a,[0,3,1,2])}else{const r=this.size[0]*o[1],i=this.size[1]*o[2];return this.interpolation==="nearest"?ls.resizeNearestNeighbor(s,[r,i]):ls.resizeBilinear(s,[r,i])}})}getConfig(){const e={size:this.size,dataFormat:this.dataFormat,interpolation:this.interpolation},t=super.getConfig();return Object.assign(e,t),e}}wb.className="UpSampling2D",Z(wb);/** + */function Hd(n,e){return B(()=>(rt(e),e==="channelsFirst"?Ee(n,[0,2,3,1]):n))}function pb(n,e){return B(()=>(rt(e),e==="channelsFirst"?Ee(n,[0,2,3,4,1]):n))}function lR(n,e,t,s=1,o="valid",r,i=1){return B(()=>{if(r==null&&(r=An()),rt(r),n.shape.length!==3)throw new R(`The input of a conv1dWithBias operation should be 3, but is ${n.shape.length} instead.`);if(e.shape.length!==3)throw new R(`The kernel for a conv1dWithBias operation should be 3, but is ${e.shape.length} instead`);if(t!=null&&t.shape.length!==1)throw new R(`The bias for a conv1dWithBias operation should be 1, but is ${t.shape.length} instead`);if(r==="channelsFirst"&&(n=Ee(n,[0,2,1])),o==="causal")throw new Ie("The support for CAUSAL padding mode in conv1dWithBias is not implemented yet.");let a=am(n,e,s,o==="same"?"same":"valid","NWC",i);return t!=null&&(a=Dn(a,t)),a})}function fb(n,e,t,s=[1,1],o="valid",r,i,a=null){return B(()=>{if(r==null&&(r=An()),rt(r),n.rank!==3&&n.rank!==4)throw new R(`conv2dWithBiasActivation expects input to be of rank 3 or 4, but received ${n.rank}.`);if(e.rank!==3&&e.rank!==4)throw new R(`conv2dWithBiasActivation expects kernel to be of rank 3 or 4, but received ${n.rank}.`);let l=Hd(n,r);if(o==="causal")throw new Ie("The support for CAUSAL padding mode in conv1dWithBias is not implemented yet.");return l=cS({x:l,filter:e,strides:s,pad:o==="same"?"same":"valid",dilations:i,dataFormat:"NHWC",bias:t,activation:a}),r==="channelsFirst"&&(l=Ee(l,[0,3,1,2])),l})}function cR(n,e,t,s=[1,1,1],o="valid",r,i){return B(()=>{if(r==null&&(r=An()),rt(r),n.rank!==4&&n.rank!==5)throw new R(`conv3dWithBias expects input to be of rank 4 or 5, but received ${n.rank}.`);if(e.rank!==4&&e.rank!==5)throw new R(`conv3dWithBias expects kernel to be of rank 4 or 5, but received ${n.rank}.`);let a=pb(n,r);if(o==="causal")throw new Ie("The support for CAUSAL padding mode in conv3dWithBias is not implemented yet.");return a=nh(a,e,s,o==="same"?"same":"valid","NDHWC",i),t!=null&&(a=Dn(a,t)),r==="channelsFirst"&&(a=Ee(a,[0,4,1,2,3])),a})}class Jl extends ve{constructor(e,t){if(super(t),this.bias=null,this.DEFAULT_KERNEL_INITIALIZER="glorotNormal",this.DEFAULT_BIAS_INITIALIZER="zeros",Jl.verifyArgs(t),this.rank=e,yt(this.rank,"rank"),this.rank!==1&&this.rank!==2&&this.rank!==3)throw new Ie(`Convolution layer for rank other than 1, 2, or 3 (${this.rank}) is not implemented yet.`);if(this.kernelSize=nr(t.kernelSize,e,"kernelSize"),this.strides=nr(t.strides==null?1:t.strides,e,"strides"),this.padding=t.padding==null?"valid":t.padding,on(this.padding),this.dataFormat=t.dataFormat==null?"channelsLast":t.dataFormat,rt(this.dataFormat),this.activation=As(t.activation),this.useBias=t.useBias==null?!0:t.useBias,this.biasInitializer=je(t.biasInitializer||this.DEFAULT_BIAS_INITIALIZER),this.biasConstraint=ft(t.biasConstraint),this.biasRegularizer=Ke(t.biasRegularizer),this.activityRegularizer=Ke(t.activityRegularizer),this.dilationRate=nr(t.dilationRate==null?1:t.dilationRate,e,"dilationRate"),this.rank===1&&Array.isArray(this.dilationRate)&&this.dilationRate.length!==1)throw new R(`dilationRate must be a number or an array of a single number for 1D convolution, but received ${JSON.stringify(this.dilationRate)}`);if(this.rank===2){if(typeof this.dilationRate=="number")this.dilationRate=[this.dilationRate,this.dilationRate];else if(this.dilationRate.length!==2)throw new R(`dilationRate must be a number or array of two numbers for 2D convolution, but received ${JSON.stringify(this.dilationRate)}`)}else if(this.rank===3){if(typeof this.dilationRate=="number")this.dilationRate=[this.dilationRate,this.dilationRate,this.dilationRate];else if(this.dilationRate.length!==3)throw new R(`dilationRate must be a number or array of three numbers for 3D convolution, but received ${JSON.stringify(this.dilationRate)}`)}}static verifyArgs(e){if(jn("kernelSize"in e,"required key 'kernelSize' not in config"),typeof e.kernelSize!="number"&&!xd(e.kernelSize,"number",1,3))throw new R(`BaseConv expects config.kernelSize to be number or number[] with length 1, 2, or 3, but received ${JSON.stringify(e.kernelSize)}.`)}getConfig(){const e={kernelSize:this.kernelSize,strides:this.strides,padding:this.padding,dataFormat:this.dataFormat,dilationRate:this.dilationRate,activation:Rs(this.activation),useBias:this.useBias,biasInitializer:Qe(this.biasInitializer),biasRegularizer:Be(this.biasRegularizer),activityRegularizer:Be(this.activityRegularizer),biasConstraint:pt(this.biasConstraint)},t=super.getConfig();return Object.assign(e,t),e}}class sr extends Jl{constructor(e,t){super(e,t),this.kernel=null,sr.verifyArgs(t),this.filters=t.filters,yt(this.filters,"filters"),this.kernelInitializer=je(t.kernelInitializer||this.DEFAULT_KERNEL_INITIALIZER),this.kernelConstraint=ft(t.kernelConstraint),this.kernelRegularizer=Ke(t.kernelRegularizer)}build(e){e=Fe(e);const t=this.dataFormat==="channelsFirst"?1:e.length-1;if(e[t]==null)throw new R(`The channel dimension of the input should be defined. Found ${e[t]}`);const s=e[t],o=this.kernelSize.concat([s,this.filters]);this.kernel=this.addWeight("kernel",o,null,this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint),this.useBias&&(this.bias=this.addWeight("bias",[this.filters],null,this.biasInitializer,this.biasRegularizer,!0,this.biasConstraint)),this.inputSpec=[{ndim:this.rank+2,axes:{[t]:s}}],this.built=!0}call(e,t){return B(()=>{e=ye(e);let s;const o=this.bias==null?null:this.bias.read(),r=Hg(this.activation.getClassName());if(r!=null&&this.rank===2)s=fb(e,this.kernel.read(),o,this.strides,this.padding,this.dataFormat,this.dilationRate,r);else{if(this.rank===1)s=lR(e,this.kernel.read(),o,this.strides[0],this.padding,this.dataFormat,this.dilationRate[0]);else if(this.rank===2)s=fb(e,this.kernel.read(),o,this.strides,this.padding,this.dataFormat,this.dilationRate);else if(this.rank===3)s=cR(e,this.kernel.read(),o,this.strides,this.padding,this.dataFormat,this.dilationRate);else throw new Ie("convolutions greater than 3D are not implemented yet.");this.activation!=null&&(s=this.activation.apply(s))}return s})}computeOutputShape(e){e=Fe(e);const t=[],s=this.dataFormat==="channelsLast"?e.slice(1,e.length-1):e.slice(2);for(let r=0;r 0 but got ${JSON.stringify(e.filters)}`)}}class Gi extends sr{constructor(e){super(2,e),Gi.verifyArgs(e)}getConfig(){const e=super.getConfig();return delete e.rank,e}static verifyArgs(e){if(typeof e.kernelSize!="number"&&!xd(e.kernelSize,"number",1,2))throw new R(`Conv2D expects config.kernelSize to be number or number[] with length 1 or 2, but received ${JSON.stringify(e.kernelSize)}.`)}}Gi.className="Conv2D",Z(Gi);class Hi extends sr{constructor(e){super(3,e),Hi.verifyArgs(e)}getConfig(){const e=super.getConfig();return delete e.rank,e}static verifyArgs(e){if(typeof e.kernelSize!="number"&&!(Array.isArray(e.kernelSize)&&(e.kernelSize.length===1||e.kernelSize.length===3)))throw new R(`Conv3D expects config.kernelSize to be number or [number, number, number], but received ${JSON.stringify(e.kernelSize)}.`)}}Hi.className="Conv3D",Z(Hi);class mb extends Gi{constructor(e){if(super(e),this.inputSpec=[new dt({ndim:4})],this.padding!=="same"&&this.padding!=="valid")throw new R(`Conv2DTranspose currently supports only padding modes 'same' and 'valid', but received padding mode ${this.padding}`)}build(e){if(e=Fe(e),e.length!==4)throw new R("Input should have rank 4; Received input shape: "+JSON.stringify(e));const t=this.dataFormat==="channelsFirst"?1:e.length-1;if(e[t]==null)throw new R("The channel dimension of the inputs should be defined. Found `None`.");const s=e[t],o=this.kernelSize.concat([this.filters,s]);this.kernel=this.addWeight("kernel",o,"float32",this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint),this.useBias&&(this.bias=this.addWeight("bias",[this.filters],"float32",this.biasInitializer,this.biasRegularizer,!0,this.biasConstraint)),this.inputSpec=[new dt({ndim:4,axes:{[t]:s}})],this.built=!0}call(e,t){return B(()=>{let s=ye(e);if(s.shape.length!==4)throw new R(`Conv2DTranspose.call() expects input tensor to be rank-4, but received a tensor of rank-${s.shape.length}`);const o=s.shape,r=o[0];let i,a;this.dataFormat==="channelsFirst"?(i=2,a=3):(i=1,a=2);const l=o[i],c=o[a],u=this.kernelSize[0],h=this.kernelSize[1],d=this.strides[0],p=this.strides[1],f=Qn(l,d,u,this.padding),m=Qn(c,p,h,this.padding),g=[r,f,m,this.filters];this.dataFormat!=="channelsLast"&&(s=Ee(s,[0,2,3,1]));let x=lm(s,this.kernel.read(),g,this.strides,this.padding);return this.dataFormat!=="channelsLast"&&(x=Ee(x,[0,3,1,2])),this.bias!=null&&(x=Dn(x,this.bias.read(),this.dataFormat)),this.activation!=null&&(x=this.activation.apply(x)),x})}computeOutputShape(e){e=Fe(e);const t=e.slice();let s,o,r;this.dataFormat==="channelsFirst"?(s=1,o=2,r=3):(s=3,o=1,r=2);const i=this.kernelSize[0],a=this.kernelSize[1],l=this.strides[0],c=this.strides[1];return t[s]=this.filters,t[o]=Qn(t[o],l,i,this.padding),t[r]=Qn(t[r],c,a,this.padding),t}getConfig(){const e=super.getConfig();return delete e.dilationRate,e}}mb.className="Conv2DTranspose",Z(mb);class gb extends Hi{constructor(e){if(super(e),this.inputSpec=[new dt({ndim:5})],this.padding!=="same"&&this.padding!=="valid")throw new R(`Conv3DTranspose currently supports only padding modes 'same' and 'valid', but received padding mode ${this.padding}`)}build(e){if(e=Fe(e),e.length!==5)throw new R("Input should have rank 5; Received input shape: "+JSON.stringify(e));const t=this.dataFormat==="channelsFirst"?1:e.length-1;if(e[t]==null)throw new R("The channel dimension of the inputs should be defined. Found `None`.");const s=e[t],o=this.kernelSize.concat([this.filters,s]);this.kernel=this.addWeight("kernel",o,"float32",this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint),this.useBias&&(this.bias=this.addWeight("bias",[this.filters],"float32",this.biasInitializer,this.biasRegularizer,!0,this.biasConstraint)),this.inputSpec=[new dt({ndim:5,axes:{[t]:s}})],this.built=!0}call(e,t){return B(()=>{let s=ye(e);if(s.shape.length!==5)throw new R(`Conv3DTranspose.call() expects input tensor to be rank-4, but received a tensor of rank-${s.shape.length}`);const o=s.shape,r=o[0];let i,a,l;this.dataFormat==="channelsFirst"?(l=2,i=3,a=4):(l=1,i=2,a=3);const c=o[l],u=o[i],h=o[a],d=this.kernelSize[0],p=this.kernelSize[1],f=this.kernelSize[2],m=this.strides[0],g=this.strides[1],x=this.strides[2],b=Qn(c,m,d,this.padding),w=Qn(u,g,p,this.padding),y=Qn(h,x,f,this.padding),C=[r,b,w,y,this.filters];this.dataFormat!=="channelsLast"&&(s=Ee(s,[0,2,3,4,1]));let I=u$(s,this.kernel.read(),C,this.strides,this.padding);return this.dataFormat!=="channelsLast"&&(I=Ee(I,[0,4,1,2,3])),this.bias!==null&&(I=Dn(I,this.bias.read(),this.dataFormat)),this.activation!==null&&(I=this.activation.apply(I)),I})}computeOutputShape(e){e=Fe(e);const t=e.slice();let s,o,r,i;this.dataFormat==="channelsFirst"?(s=1,o=2,r=3,i=4):(s=4,o=1,r=2,i=3);const a=this.kernelSize[0],l=this.kernelSize[1],c=this.kernelSize[2],u=this.strides[0],h=this.strides[1],d=this.strides[2];return t[s]=this.filters,t[o]=Qn(t[o],u,a,this.padding),t[r]=Qn(t[r],h,l,this.padding),t[i]=Qn(t[i],d,c,this.padding),t}getConfig(){const e=super.getConfig();return delete e.dilationRate,e}}gb.className="Conv3DTranspose",Z(gb);class xb extends sr{constructor(e,t){if(super(e,t),this.DEFAULT_DEPTHWISE_INITIALIZER="glorotUniform",this.DEFAULT_POINTWISE_INITIALIZER="glorotUniform",this.depthwiseKernel=null,this.pointwiseKernel=null,t.filters==null)throw new R("The `filters` configuration field is required by SeparableConv, but is unspecified.");if(t.kernelInitializer!=null||t.kernelRegularizer!=null||t.kernelConstraint!=null)throw new R("Fields kernelInitializer, kernelRegularizer and kernelConstraint are invalid for SeparableConv2D. Use depthwiseInitializer, depthwiseRegularizer, depthwiseConstraint, pointwiseInitializer, pointwiseRegularizer and pointwiseConstraint instead.");if(t.padding!=null&&t.padding!=="same"&&t.padding!=="valid")throw new R(`SeparableConv${this.rank}D supports only padding modes: 'same' and 'valid', but received ${JSON.stringify(t.padding)}`);this.depthMultiplier=t.depthMultiplier==null?1:t.depthMultiplier,this.depthwiseInitializer=je(t.depthwiseInitializer||this.DEFAULT_DEPTHWISE_INITIALIZER),this.depthwiseRegularizer=Ke(t.depthwiseRegularizer),this.depthwiseConstraint=ft(t.depthwiseConstraint),this.pointwiseInitializer=je(t.depthwiseInitializer||this.DEFAULT_POINTWISE_INITIALIZER),this.pointwiseRegularizer=Ke(t.pointwiseRegularizer),this.pointwiseConstraint=ft(t.pointwiseConstraint)}build(e){if(e=Fe(e),e.length{e=ye(e);let s;if(this.rank===1)throw new Ie("1D separable convolution is not implemented yet.");return this.rank===2&&(this.dataFormat==="channelsFirst"&&(e=Ee(e,[0,2,3,1])),s=Nm(e,this.depthwiseKernel.read(),this.pointwiseKernel.read(),this.strides,this.padding,this.dilationRate,"NHWC")),this.useBias&&(s=Dn(s,this.bias.read(),this.dataFormat)),this.activation!=null&&(s=this.activation.apply(s)),this.dataFormat==="channelsFirst"&&(s=Ee(s,[0,3,1,2])),s})}getConfig(){const e=super.getConfig();return delete e.rank,delete e.kernelInitializer,delete e.kernelRegularizer,delete e.kernelConstraint,e.depthwiseInitializer=Qe(this.depthwiseInitializer),e.pointwiseInitializer=Qe(this.pointwiseInitializer),e.depthwiseRegularizer=Be(this.depthwiseRegularizer),e.pointwiseRegularizer=Be(this.pointwiseRegularizer),e.depthwiseConstraint=pt(this.depthwiseConstraint),e.pointwiseConstraint=pt(this.pointwiseConstraint),e}}xb.className="SeparableConv";class bb extends xb{constructor(e){super(2,e)}}bb.className="SeparableConv2D",Z(bb);class ec extends sr{constructor(e){super(1,e),ec.verifyArgs(e),this.inputSpec=[{ndim:3}]}getConfig(){const e=super.getConfig();return delete e.rank,delete e.dataFormat,e}static verifyArgs(e){if(typeof e.kernelSize!="number"&&!xd(e.kernelSize,"number",1,1))throw new R(`Conv1D expects config.kernelSize to be number or number[] with length 1, but received ${JSON.stringify(e.kernelSize)}.`)}}ec.className="Conv1D",Z(ec);class yb extends ve{constructor(e){super(e),typeof e.cropping=="number"?this.cropping=[[e.cropping,e.cropping],[e.cropping,e.cropping]]:typeof e.cropping[0]=="number"?this.cropping=[[e.cropping[0],e.cropping[0]],[e.cropping[1],e.cropping[1]]]:this.cropping=e.cropping,this.dataFormat=e.dataFormat===void 0?"channelsLast":e.dataFormat,this.inputSpec=[{ndim:4}]}computeOutputShape(e){return this.dataFormat==="channelsFirst"?[e[0],e[1],e[2]-this.cropping[0][0]-this.cropping[0][1],e[3]-this.cropping[1][0]-this.cropping[1][1]]:[e[0],e[1]-this.cropping[0][0]-this.cropping[0][1],e[2]-this.cropping[1][0]-this.cropping[1][1],e[3]]}call(e,t){return B(()=>{if(e=ye(e),this.dataFormat==="channelsLast"){const s=Ml(e,this.cropping[0][0],e.shape[1]-this.cropping[0][0]-this.cropping[0][1],2);return Ml(s,this.cropping[1][0],e.shape[2]-this.cropping[1][1]-this.cropping[1][0],3)}else{const s=Ml(e,this.cropping[0][0],e.shape[2]-this.cropping[0][0]-this.cropping[0][1],3);return Ml(s,this.cropping[1][0],e.shape[3]-this.cropping[1][1]-this.cropping[1][0],4)}})}getConfig(){const e={cropping:this.cropping,dataFormat:this.dataFormat},t=super.getConfig();return Object.assign(e,t),e}}yb.className="Cropping2D",Z(yb);class wb extends ve{constructor(e){super(e),this.DEFAULT_SIZE=[2,2],this.inputSpec=[{ndim:4}],this.size=e.size==null?this.DEFAULT_SIZE:e.size,this.dataFormat=e.dataFormat==null?"channelsLast":e.dataFormat,rt(this.dataFormat),this.interpolation=e.interpolation==null?"nearest":e.interpolation,MN(this.interpolation)}computeOutputShape(e){if(this.dataFormat==="channelsFirst"){const t=e[2]==null?null:this.size[0]*e[2],s=e[3]==null?null:this.size[1]*e[3];return[e[0],e[1],t,s]}else{const t=e[1]==null?null:this.size[0]*e[1],s=e[2]==null?null:this.size[1]*e[2];return[e[0],t,s,e[3]]}}call(e,t){return B(()=>{let s=ye(e);const o=s.shape;if(this.dataFormat==="channelsFirst"){s=Ee(s,[0,2,3,1]);const r=this.size[0]*o[2],i=this.size[1]*o[3],a=this.interpolation==="nearest"?ls.resizeNearestNeighbor(s,[r,i]):ls.resizeBilinear(s,[r,i]);return Ee(a,[0,3,1,2])}else{const r=this.size[0]*o[1],i=this.size[1]*o[2];return this.interpolation==="nearest"?ls.resizeNearestNeighbor(s,[r,i]):ls.resizeBilinear(s,[r,i])}})}getConfig(){const e={size:this.size,dataFormat:this.dataFormat,interpolation:this.interpolation},t=super.getConfig();return Object.assign(e,t),e}}wb.className="UpSampling2D",Z(wb);/** * @license * Copyright 2018 Google LLC * @@ -7768,7 +7768,7 @@ * license that can be found in the LICENSE file or at * https://opensource.org/licenses/MIT. * ============================================================================= - */function hR(n,e,t=[1,1],s="valid",o,r){return B(()=>{o==null&&(o=An()),rt(o);let i=jd(n,o);if(n.rank!==4)throw new R(`Input for depthwiseConv2d is required to be 4-D, but is instead ${n.rank}-D`);if(e.rank!==4)throw new R(`depthwiseKernel is required to be 4-D, but is instead ${e.rank}-D`);return i=ah(i,e,t,s==="same"?"same":"valid","NHWC",r),o==="channelsFirst"&&(i=Ee(i,[0,3,1,2])),i})}class Cb extends Jl{constructor(e){super(2,e),this.depthwiseKernel=null,this.depthMultiplier=e.depthMultiplier==null?1:e.depthMultiplier,this.depthwiseInitializer=je(e.depthwiseInitializer||this.DEFAULT_KERNEL_INITIALIZER),this.depthwiseConstraint=ft(e.depthwiseConstraint),this.depthwiseRegularizer=Ke(e.depthwiseRegularizer)}build(e){if(e=Fe(e),e.length<4)throw new R(`Inputs to DepthwiseConv2D should have rank 4. Received input shape: ${JSON.stringify(e)}.`);const t=this.dataFormat==="channelsFirst"?1:3;if(e[t]==null||e[t]<0)throw new R(`The channel dimension of the inputs to DepthwiseConv2D should be defined, but is not (${e[t]}).`);const s=e[t],o=[this.kernelSize[0],this.kernelSize[1],s,this.depthMultiplier];this.depthwiseKernel=this.addWeight("depthwise_kernel",o,null,this.depthwiseInitializer,this.depthwiseRegularizer,!0,this.depthwiseConstraint),this.useBias?this.bias=this.addWeight("bias",[s*this.depthMultiplier],null,this.biasInitializer,this.biasRegularizer,!0,this.biasConstraint):this.bias=null,this.built=!0}call(e,t){return B(()=>{e=ye(e);let s=hR(e,this.depthwiseKernel.read(),this.strides,this.padding,this.dataFormat,null);return this.useBias&&(s=Dn(s,this.bias.read(),this.dataFormat)),this.activation!=null&&(s=this.activation.apply(s)),s})}computeOutputShape(e){e=Fe(e);const t=this.dataFormat==="channelsFirst"?e[2]:e[1],s=this.dataFormat==="channelsFirst"?e[3]:e[2],o=this.dataFormat==="channelsFirst"?e[1]*this.depthMultiplier:e[3]*this.depthMultiplier,r=On(t,this.kernelSize[0],this.padding,this.strides[0]),i=On(s,this.kernelSize[1],this.padding,this.strides[1]);return this.dataFormat==="channelsFirst"?[e[0],o,r,i]:[e[0],r,i,o]}getConfig(){const e=super.getConfig();return e.depthMultiplier=this.depthMultiplier,e.depthwiseInitializer=Qe(this.depthwiseInitializer),e.depthwiseRegularizer=Be(this.depthwiseRegularizer),e.depthwiseConstraint=pt(this.depthwiseRegularizer),e}}Cb.className="DepthwiseConv2D",Z(Cb);/** + */function uR(n,e,t=[1,1],s="valid",o,r){return B(()=>{o==null&&(o=An()),rt(o);let i=Hd(n,o);if(n.rank!==4)throw new R(`Input for depthwiseConv2d is required to be 4-D, but is instead ${n.rank}-D`);if(e.rank!==4)throw new R(`depthwiseKernel is required to be 4-D, but is instead ${e.rank}-D`);return i=rh(i,e,t,s==="same"?"same":"valid","NHWC",r),o==="channelsFirst"&&(i=Ee(i,[0,3,1,2])),i})}class Cb extends Jl{constructor(e){super(2,e),this.depthwiseKernel=null,this.depthMultiplier=e.depthMultiplier==null?1:e.depthMultiplier,this.depthwiseInitializer=je(e.depthwiseInitializer||this.DEFAULT_KERNEL_INITIALIZER),this.depthwiseConstraint=ft(e.depthwiseConstraint),this.depthwiseRegularizer=Ke(e.depthwiseRegularizer)}build(e){if(e=Fe(e),e.length<4)throw new R(`Inputs to DepthwiseConv2D should have rank 4. Received input shape: ${JSON.stringify(e)}.`);const t=this.dataFormat==="channelsFirst"?1:3;if(e[t]==null||e[t]<0)throw new R(`The channel dimension of the inputs to DepthwiseConv2D should be defined, but is not (${e[t]}).`);const s=e[t],o=[this.kernelSize[0],this.kernelSize[1],s,this.depthMultiplier];this.depthwiseKernel=this.addWeight("depthwise_kernel",o,null,this.depthwiseInitializer,this.depthwiseRegularizer,!0,this.depthwiseConstraint),this.useBias?this.bias=this.addWeight("bias",[s*this.depthMultiplier],null,this.biasInitializer,this.biasRegularizer,!0,this.biasConstraint):this.bias=null,this.built=!0}call(e,t){return B(()=>{e=ye(e);let s=uR(e,this.depthwiseKernel.read(),this.strides,this.padding,this.dataFormat,null);return this.useBias&&(s=Dn(s,this.bias.read(),this.dataFormat)),this.activation!=null&&(s=this.activation.apply(s)),s})}computeOutputShape(e){e=Fe(e);const t=this.dataFormat==="channelsFirst"?e[2]:e[1],s=this.dataFormat==="channelsFirst"?e[3]:e[2],o=this.dataFormat==="channelsFirst"?e[1]*this.depthMultiplier:e[3]*this.depthMultiplier,r=On(t,this.kernelSize[0],this.padding,this.strides[0]),i=On(s,this.kernelSize[1],this.padding,this.strides[1]);return this.dataFormat==="channelsFirst"?[e[0],o,r,i]:[e[0],r,i,o]}getConfig(){const e=super.getConfig();return e.depthMultiplier=this.depthMultiplier,e.depthwiseInitializer=Qe(this.depthwiseInitializer),e.depthwiseRegularizer=Be(this.depthwiseRegularizer),e.depthwiseConstraint=pt(this.depthwiseRegularizer),e}}Cb.className="DepthwiseConv2D",Z(Cb);/** * @license * Copyright 2018 Google LLC * @@ -7776,7 +7776,7 @@ * license that can be found in the LICENSE file or at * https://opensource.org/licenses/MIT. * ============================================================================= - */function Ib(n,e,t,s){if(Array.isArray(n)){if(e!=null||t!=null)throw new R("When inputs is an array, neither initialState or constants should be provided");s!=null&&(t=n.slice(n.length-s,n.length),n=n.slice(0,n.length-s)),n.length>1&&(e=n.slice(1,n.length)),n=n[0]}function o(r){return r==null||Array.isArray(r)?r:[r]}return e=o(e),t=o(t),{inputs:n,initialState:e,constants:t}}function $b(n,e,t,s=!1,o,r,i=!1,a=!1){return B(()=>{const l=e.shape.length;if(l<3)throw new R(`Input should be at least 3D, but is ${l}D.`);const c=[1,0].concat(Rn(2,l));if(e=Ee(e,c),r!=null)throw new Ie("The rnn() functoin of the deeplearn.js backend does not support constants yet.");i&&console.warn("Backend rnn(): the unroll = true option is not applicable to the imperative deeplearn.js backend."),o!=null&&(o=re(re(o,"bool"),"float32"),o.rank===l-1&&(o=Gt(o,-1)),o=Ee(o,c)),s&&(e=uo(e,0),o!=null&&(o=uo(o,0)));const u=[];let h,d=t;const p=e.shape[0],f=Gn(e);let m;o!=null&&(m=Gn(o));for(let x=0;xn(b,d));if(o==null)h=w[0],d=w[1];else{const y=B(()=>{const C=m[x],I=be(fn(C),C),$=J(D(w[0],C),D(d[0],I)),k=d.map((S,N)=>J(D(w[1][N],C),D(S,I)));return{output:$,newStates:k}});h=y.output,d=y.newStates}a&&u.push(h)}let g;return a&&(g=Un(u,1)),[h,g,d]})}class Ds extends ve{constructor(e){super(e);let t;if(e.cell==null)throw new R("cell property is missing for the constructor of RNN.");if(Array.isArray(e.cell)?t=new Yd({cells:e.cell}):t=e.cell,t.stateSize==null)throw new R("The RNN cell should have an attribute `stateSize` (tuple of integers, one integer per RNN state).");this.cell=t,this.returnSequences=e.returnSequences==null?!1:e.returnSequences,this.returnState=e.returnState==null?!1:e.returnState,this.goBackwards=e.goBackwards==null?!1:e.goBackwards,this._stateful=e.stateful==null?!1:e.stateful,this.unroll=e.unroll==null?!1:e.unroll,this.supportsMasking=!0,this.inputSpec=[new dt({ndim:3})],this.stateSpec=null,this.states_=null,this.numConstants=null,this.keptStates=[]}getStates(){if(this.states_==null){const e=Array.isArray(this.cell.stateSize)?this.cell.stateSize.length:1;return Rn(0,e).map(t=>null)}else return this.states_}setStates(e){this.states_=e}computeOutputShape(e){Dd(e)&&(e=e[0]),e=e;let t=this.cell.stateSize;Array.isArray(t)||(t=[t]);const s=t[0];let o;if(this.returnSequences?o=[e[0],e[1],s]:o=[e[0],s],this.returnState){const r=[];for(const i of t)r.push([e[0],i]);return[o].concat(r)}else return o}computeMask(e,t){return B(()=>{Array.isArray(t)&&(t=t[0]);const s=this.returnSequences?t:null;if(this.returnState){const o=this.states.map(r=>null);return[s].concat(o)}else return s})}get states(){if(this.states_==null){const e=Array.isArray(this.cell.stateSize)?this.cell.stateSize.length:1,t=[];for(let s=0;si.shape[i.shape.length-1]),r))throw new R(`An initialState was passed that is not compatible with cell.stateSize. Received stateSpec=${this.stateSpec}; However cell.stateSize is ${this.cell.stateSize}`)}else this.stateSpec=r.map(i=>new dt({shape:[null,i]}));this.stateful&&this.resetStates()}resetStates(e,t=!1){B(()=>{if(!this.stateful)throw new qn("Cannot call resetStates() on an RNN Layer that is not stateful.");const s=this.inputSpec[0].shape[0];if(s==null)throw new R("If an RNN is stateful, it needs to know its batch size. Specify the batch size of your input tensors: \n- If using a Sequential model, specify the batch size by passing a `batchInputShape` option to your first layer.\n- If using the functional API, specify the batch size by passing a `batchShape` option to your Input layer.");if(this.states_==null)Array.isArray(this.cell.stateSize)?this.states_=this.cell.stateSize.map(o=>ot([s,o])):this.states_=[ot([s,this.cell.stateSize])];else if(e==null)fe(this.states_),this.keptStates!=null&&(fe(this.keptStates),this.keptStates=[]),Array.isArray(this.cell.stateSize)?this.states_=this.cell.stateSize.map(o=>ot([s,o])):this.states_[0]=ot([s,this.cell.stateSize]);else{if(Array.isArray(e)||(e=[e]),e.length!==this.states_.length)throw new R(`Layer ${this.name} expects ${this.states_.length} state(s), but it received ${e.length} state value(s). Input received: ${e}`);t===!0?this.keptStates.push(this.states_.slice()):fe(this.states_);for(let o=0;odn(o.clone()))})}apply(e,t){let s=t==null?null:t.initialState,o=t==null?null:t.constants;t==null&&(t={});const r=Ib(e,s,o,this.numConstants);e=r.inputs,s=r.initialState,o=r.constants;let i=[],a=[];if(s!=null){t.initialState=s,i=i.concat(s),this.stateSpec=[];for(const c of s)this.stateSpec.push(new dt({shape:c.shape}));a=a.concat(this.stateSpec)}if(o!=null&&(t.constants=o,i=i.concat(o),this.numConstants=o.length),i[0]instanceof Yn){const c=[e].concat(i),u=this.inputSpec.concat(a),h=this.inputSpec;this.inputSpec=u;const d=super.apply(c,t);return this.inputSpec=h,d}else return super.apply(e,t)}call(e,t){return B(()=>{const s=t==null?null:t.mask,o=t==null?null:t.training;let r=t==null?null:t.initialState;e=ye(e),r==null&&(this.stateful?r=this.states_:r=this.getInitialState(e));const i=Array.isArray(this.cell.stateSize)?this.cell.stateSize.length:1;if(r.length!==i)throw new R(`RNN Layer has ${i} state(s) but was passed ${r.length} initial state(s).`);this.unroll&&console.warn("Ignoring unroll = true for RNN layer, due to imperative backend.");const a={training:o},c=$b((f,m)=>{const g=this.cell.call([f].concat(m),a);return[g[0],g.slice(1)]},e,r,this.goBackwards,s,null,this.unroll,this.returnSequences),u=c[0],h=c[1],d=c[2];this.stateful&&this.resetStates(d,o);const p=this.returnSequences?h:u;return this.returnState?[p].concat(d):p})}getInitialState(e){return B(()=>{let t=ot(e.shape);return t=de(t,[1,2]),t=_i(t),Array.isArray(this.cell.stateSize)?this.cell.stateSize.map(s=>s>1?$d(t,[1,s]):t):this.cell.stateSize>1?[$d(t,[1,this.cell.stateSize])]:[t]})}get trainableWeights(){return this.trainable?this.cell.trainableWeights:[]}get nonTrainableWeights(){return this.trainable?this.cell.nonTrainableWeights:this.cell.weights}setFastWeightInitDuringBuild(e){super.setFastWeightInitDuringBuild(e),this.cell!=null&&this.cell.setFastWeightInitDuringBuild(e)}getConfig(){const e=super.getConfig(),t={returnSequences:this.returnSequences,returnState:this.returnState,goBackwards:this.goBackwards,stateful:this.stateful,unroll:this.unroll};this.numConstants!=null&&(t.numConstants=this.numConstants);const s=this.cell.getConfig();return this.getClassName()===Ds.className&&(t.cell={className:this.cell.getClassName(),config:s}),Object.assign(Object.assign(Object.assign({},s),e),t)}static fromConfig(e,t,s={}){const o=t.cell,r=Zn(o,s);return new e(Object.assign(t,{cell:r}))}}Ds.className="RNN",Z(Ds);class tc extends ve{}class Kd extends tc{constructor(e){super(e),this.DEFAULT_ACTIVATION="tanh",this.DEFAULT_KERNEL_INITIALIZER="glorotNormal",this.DEFAULT_RECURRENT_INITIALIZER="orthogonal",this.DEFAULT_BIAS_INITIALIZER="zeros",this.units=e.units,yt(this.units,"units"),this.activation=As(e.activation==null?this.DEFAULT_ACTIVATION:e.activation),this.useBias=e.useBias==null?!0:e.useBias,this.kernelInitializer=je(e.kernelInitializer||this.DEFAULT_KERNEL_INITIALIZER),this.recurrentInitializer=je(e.recurrentInitializer||this.DEFAULT_RECURRENT_INITIALIZER),this.biasInitializer=je(e.biasInitializer||this.DEFAULT_BIAS_INITIALIZER),this.kernelRegularizer=Ke(e.kernelRegularizer),this.recurrentRegularizer=Ke(e.recurrentRegularizer),this.biasRegularizer=Ke(e.biasRegularizer),this.kernelConstraint=ft(e.kernelConstraint),this.recurrentConstraint=ft(e.recurrentConstraint),this.biasConstraint=ft(e.biasConstraint),this.dropout=er([1,Ns([0,e.dropout==null?0:e.dropout])]),this.recurrentDropout=er([1,Ns([0,e.recurrentDropout==null?0:e.recurrentDropout])]),this.dropoutFunc=e.dropoutFunc,this.stateSize=this.units,this.dropoutMask=null,this.recurrentDropoutMask=null}build(e){e=Fe(e),this.kernel=this.addWeight("kernel",[e[e.length-1],this.units],null,this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint),this.recurrentKernel=this.addWeight("recurrent_kernel",[this.units,this.units],null,this.recurrentInitializer,this.recurrentRegularizer,!0,this.recurrentConstraint),this.useBias?this.bias=this.addWeight("bias",[this.units],null,this.biasInitializer,this.biasRegularizer,!0,this.biasConstraint):this.bias=null,this.built=!0}call(e,t){return B(()=>{if(e=e,e.length!==2)throw new R(`SimpleRNNCell expects 2 input Tensors, got ${e.length}.`);let s=e[1];e=e[0];const o=t.training==null?!1:t.training;0fn(e),rate:this.dropout,training:o,dropoutFunc:this.dropoutFunc})),0fn(s),rate:this.recurrentDropout,training:o,dropoutFunc:this.dropoutFunc}));let r;const i=this.dropoutMask,a=this.recurrentDropoutMask;i!=null?r=Xn(D(e,i),this.kernel.read()):r=Xn(e,this.kernel.read()),this.bias!=null&&(r=Dn(r,this.bias.read())),a!=null&&(s=D(s,a));let l=J(r,Xn(s,this.recurrentKernel.read()));return this.activation!=null&&(l=this.activation.apply(l)),[l,l]})}getConfig(){const e=super.getConfig(),t={units:this.units,activation:Rs(this.activation),useBias:this.useBias,kernelInitializer:Qe(this.kernelInitializer),recurrentInitializer:Qe(this.recurrentInitializer),biasInitializer:Qe(this.biasInitializer),kernelRegularizer:Be(this.kernelRegularizer),recurrentRegularizer:Be(this.recurrentRegularizer),biasRegularizer:Be(this.biasRegularizer),activityRegularizer:Be(this.activityRegularizer),kernelConstraint:pt(this.kernelConstraint),recurrentConstraint:pt(this.recurrentConstraint),biasConstraint:pt(this.biasConstraint),dropout:this.dropout,recurrentDropout:this.recurrentDropout};return Object.assign(Object.assign({},e),t)}}Kd.className="SimpleRNNCell",Z(Kd);class kb extends Ds{constructor(e){e.cell=new Kd(e),super(e)}call(e,t){return B(()=>{this.cell.dropoutMask!=null&&(fe(this.cell.dropoutMask),this.cell.dropoutMask=null),this.cell.recurrentDropoutMask!=null&&(fe(this.cell.recurrentDropoutMask),this.cell.recurrentDropoutMask=null);const s=t==null?null:t.mask,o=t==null?null:t.training,r=t==null?null:t.initialState;return super.call(e,{mask:s,training:o,initialState:r})})}static fromConfig(e,t){return new e(t)}}kb.className="SimpleRNN",Z(kb);class Xd extends tc{constructor(e){if(super(e),this.DEFAULT_ACTIVATION="tanh",this.DEFAULT_RECURRENT_ACTIVATION="hardSigmoid",this.DEFAULT_KERNEL_INITIALIZER="glorotNormal",this.DEFAULT_RECURRENT_INITIALIZER="orthogonal",this.DEFAULT_BIAS_INITIALIZER="zeros",e.resetAfter)throw new R("GRUCell does not support reset_after parameter set to true.");this.units=e.units,yt(this.units,"units"),this.activation=As(e.activation===void 0?this.DEFAULT_ACTIVATION:e.activation),this.recurrentActivation=As(e.recurrentActivation===void 0?this.DEFAULT_RECURRENT_ACTIVATION:e.recurrentActivation),this.useBias=e.useBias==null?!0:e.useBias,this.kernelInitializer=je(e.kernelInitializer||this.DEFAULT_KERNEL_INITIALIZER),this.recurrentInitializer=je(e.recurrentInitializer||this.DEFAULT_RECURRENT_INITIALIZER),this.biasInitializer=je(e.biasInitializer||this.DEFAULT_BIAS_INITIALIZER),this.kernelRegularizer=Ke(e.kernelRegularizer),this.recurrentRegularizer=Ke(e.recurrentRegularizer),this.biasRegularizer=Ke(e.biasRegularizer),this.kernelConstraint=ft(e.kernelConstraint),this.recurrentConstraint=ft(e.recurrentConstraint),this.biasConstraint=ft(e.biasConstraint),this.dropout=er([1,Ns([0,e.dropout==null?0:e.dropout])]),this.recurrentDropout=er([1,Ns([0,e.recurrentDropout==null?0:e.recurrentDropout])]),this.dropoutFunc=e.dropoutFunc,this.implementation=e.implementation,this.stateSize=this.units,this.dropoutMask=null,this.recurrentDropoutMask=null}build(e){e=Fe(e);const t=e[e.length-1];this.kernel=this.addWeight("kernel",[t,this.units*3],null,this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint),this.recurrentKernel=this.addWeight("recurrent_kernel",[this.units,this.units*3],null,this.recurrentInitializer,this.recurrentRegularizer,!0,this.recurrentConstraint),this.useBias?this.bias=this.addWeight("bias",[this.units*3],null,this.biasInitializer,this.biasRegularizer,!0,this.biasConstraint):this.bias=null,this.built=!0}call(e,t){return B(()=>{if(e=e,e.length!==2)throw new R(`GRUCell expects 2 input Tensors (inputs, h, c), got ${e.length}.`);const s=t.training==null?!1:t.training;let o=e[1];e=e[0],0fn(e),rate:this.dropout,training:s,count:3,dropoutFunc:this.dropoutFunc})),0fn(o),rate:this.recurrentDropout,training:s,count:3,dropoutFunc:this.dropoutFunc}));const r=this.dropoutMask,i=this.recurrentDropoutMask;let a,l,c;0{this.cell.dropoutMask!=null&&(fe(this.cell.dropoutMask),this.cell.dropoutMask=null),this.cell.recurrentDropoutMask!=null&&(fe(this.cell.recurrentDropoutMask),this.cell.recurrentDropoutMask=null);const s=t==null?null:t.mask,o=t==null?null:t.training,r=t==null?null:t.initialState;return super.call(e,{mask:s,training:o,initialState:r})})}static fromConfig(e,t){return t.implmentation===0&&(t.implementation=1),new e(t)}}vb.className="GRU",Z(vb);class nc extends tc{constructor(e){super(e),this.DEFAULT_ACTIVATION="tanh",this.DEFAULT_RECURRENT_ACTIVATION="hardSigmoid",this.DEFAULT_KERNEL_INITIALIZER="glorotNormal",this.DEFAULT_RECURRENT_INITIALIZER="orthogonal",this.DEFAULT_BIAS_INITIALIZER="zeros",this.units=e.units,yt(this.units,"units"),this.activation=As(e.activation===void 0?this.DEFAULT_ACTIVATION:e.activation),this.recurrentActivation=As(e.recurrentActivation===void 0?this.DEFAULT_RECURRENT_ACTIVATION:e.recurrentActivation),this.useBias=e.useBias==null?!0:e.useBias,this.kernelInitializer=je(e.kernelInitializer||this.DEFAULT_KERNEL_INITIALIZER),this.recurrentInitializer=je(e.recurrentInitializer||this.DEFAULT_RECURRENT_INITIALIZER),this.biasInitializer=je(e.biasInitializer||this.DEFAULT_BIAS_INITIALIZER),this.unitForgetBias=e.unitForgetBias,this.kernelRegularizer=Ke(e.kernelRegularizer),this.recurrentRegularizer=Ke(e.recurrentRegularizer),this.biasRegularizer=Ke(e.biasRegularizer),this.kernelConstraint=ft(e.kernelConstraint),this.recurrentConstraint=ft(e.recurrentConstraint),this.biasConstraint=ft(e.biasConstraint),this.dropout=er([1,Ns([0,e.dropout==null?0:e.dropout])]),this.recurrentDropout=er([1,Ns([0,e.recurrentDropout==null?0:e.recurrentDropout])]),this.dropoutFunc=e.dropoutFunc,this.implementation=e.implementation,this.stateSize=[this.units,this.units],this.dropoutMask=null,this.recurrentDropoutMask=null}build(e){var t;e=Fe(e);const s=e[e.length-1];this.kernel=this.addWeight("kernel",[s,this.units*4],null,this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint),this.recurrentKernel=this.addWeight("recurrent_kernel",[this.units,this.units*4],null,this.recurrentInitializer,this.recurrentRegularizer,!0,this.recurrentConstraint);let o;if(this.useBias){if(this.unitForgetBias){const r=this.biasInitializer,i=this.units;o=new(t=class extends bn{apply(l,c){const u=r.apply([i]),h=new vd().apply([i]),d=r.apply([i*2]);return Qg(Qg(u,h),d)}},t.className="CustomInit",t)}else o=this.biasInitializer;this.bias=this.addWeight("bias",[this.units*4],null,o,this.biasRegularizer,!0,this.biasConstraint)}else this.bias=null;this.built=!0}call(e,t){return B(()=>{const s=t.training==null?!1:t.training;if(e=e,e.length!==3)throw new R(`LSTMCell expects 3 input Tensors (inputs, h, c), got ${e.length}.`);let o=e[1];const r=e[2];e=e[0],0fn(e),rate:this.dropout,training:s,count:4,dropoutFunc:this.dropoutFunc})),0fn(o),rate:this.recurrentDropout,training:s,count:4,dropoutFunc:this.dropoutFunc}));const i=this.dropoutMask,a=this.recurrentDropoutMask;let l,c,u,h;0{this.cell.dropoutMask!=null&&(fe(this.cell.dropoutMask),this.cell.dropoutMask=null),this.cell.recurrentDropoutMask!=null&&(fe(this.cell.recurrentDropoutMask),this.cell.recurrentDropoutMask=null);const s=t==null?null:t.mask,o=t==null?null:t.training,r=t==null?null:t.initialState;return super.call(e,{mask:s,training:o,initialState:r})})}static fromConfig(e,t){return t.implmentation===0&&(t.implementation=1),new e(t)}}Sb.className="LSTM",Z(Sb);class Yd extends tc{constructor(e){super(e),this.cells=e.cells}get stateSize(){const e=[];for(const t of this.cells.slice().reverse())Array.isArray(t.stateSize)?e.push(...t.stateSize):e.push(t.stateSize);return e}call(e,t){return B(()=>{e=e;let s=e.slice(1);const o=[];for(const a of this.cells.slice().reverse())Array.isArray(a.stateSize)?o.push(s.splice(0,a.stateSize.length)):o.push(s.splice(0,1));o.reverse();const r=[];let i;for(let a=0;a{go(`RNNCell_${o}`,()=>{s.build(e),Array.isArray(s.stateSize)?t=s.stateSize[0]:t=s.stateSize,e=[e[0],t]})}),this.built=!0}getConfig(){const e=super.getConfig(),t=r=>({className:r.getClassName(),config:r.getConfig()}),o={cells:this.cells.map(t)};return Object.assign(Object.assign({},e),o)}static fromConfig(e,t,s={}){const o=[];for(const r of t.cells)o.push(Zn(r,s));return new e({cells:o})}get trainableWeights(){if(!this.trainable)return[];const e=[];for(const t of this.cells)e.push(...t.trainableWeights);return e}get nonTrainableWeights(){const e=[];for(const t of this.cells)e.push(...t.nonTrainableWeights);if(!this.trainable){const t=[];for(const s of this.cells)t.push(...s.trainableWeights);return t.concat(e)}return e}getWeights(){const e=[];for(const t of this.cells)e.push(...t.weights);return Fd(e)}setWeights(e){const t=[];for(const s of this.cells){const o=s.weights.length,r=e.splice(o);for(let i=0;ir!=null?r(e(),t):ex(e(),t),a=()=>Li(i,e,s);return!o||o<=1?dn(a().clone()):Array(o).fill(void 0).map(a).map(c=>dn(c.clone()))}/** + */function Ib(n,e,t,s){if(Array.isArray(n)){if(e!=null||t!=null)throw new R("When inputs is an array, neither initialState or constants should be provided");s!=null&&(t=n.slice(n.length-s,n.length),n=n.slice(0,n.length-s)),n.length>1&&(e=n.slice(1,n.length)),n=n[0]}function o(r){return r==null||Array.isArray(r)?r:[r]}return e=o(e),t=o(t),{inputs:n,initialState:e,constants:t}}function $b(n,e,t,s=!1,o,r,i=!1,a=!1){return B(()=>{const l=e.shape.length;if(l<3)throw new R(`Input should be at least 3D, but is ${l}D.`);const c=[1,0].concat(Rn(2,l));if(e=Ee(e,c),r!=null)throw new Ie("The rnn() functoin of the deeplearn.js backend does not support constants yet.");i&&console.warn("Backend rnn(): the unroll = true option is not applicable to the imperative deeplearn.js backend."),o!=null&&(o=re(re(o,"bool"),"float32"),o.rank===l-1&&(o=Gt(o,-1)),o=Ee(o,c)),s&&(e=uo(e,0),o!=null&&(o=uo(o,0)));const u=[];let h,d=t;const p=e.shape[0],f=Gn(e);let m;o!=null&&(m=Gn(o));for(let x=0;xn(b,d));if(o==null)h=w[0],d=w[1];else{const y=B(()=>{const C=m[x],I=be(fn(C),C),v=J(D(w[0],C),D(d[0],I)),$=d.map((S,N)=>J(D(w[1][N],C),D(S,I)));return{output:v,newStates:$}});h=y.output,d=y.newStates}a&&u.push(h)}let g;return a&&(g=Un(u,1)),[h,g,d]})}class Ds extends ve{constructor(e){super(e);let t;if(e.cell==null)throw new R("cell property is missing for the constructor of RNN.");if(Array.isArray(e.cell)?t=new Kd({cells:e.cell}):t=e.cell,t.stateSize==null)throw new R("The RNN cell should have an attribute `stateSize` (tuple of integers, one integer per RNN state).");this.cell=t,this.returnSequences=e.returnSequences==null?!1:e.returnSequences,this.returnState=e.returnState==null?!1:e.returnState,this.goBackwards=e.goBackwards==null?!1:e.goBackwards,this._stateful=e.stateful==null?!1:e.stateful,this.unroll=e.unroll==null?!1:e.unroll,this.supportsMasking=!0,this.inputSpec=[new dt({ndim:3})],this.stateSpec=null,this.states_=null,this.numConstants=null,this.keptStates=[]}getStates(){if(this.states_==null){const e=Array.isArray(this.cell.stateSize)?this.cell.stateSize.length:1;return Rn(0,e).map(t=>null)}else return this.states_}setStates(e){this.states_=e}computeOutputShape(e){Rd(e)&&(e=e[0]),e=e;let t=this.cell.stateSize;Array.isArray(t)||(t=[t]);const s=t[0];let o;if(this.returnSequences?o=[e[0],e[1],s]:o=[e[0],s],this.returnState){const r=[];for(const i of t)r.push([e[0],i]);return[o].concat(r)}else return o}computeMask(e,t){return B(()=>{Array.isArray(t)&&(t=t[0]);const s=this.returnSequences?t:null;if(this.returnState){const o=this.states.map(r=>null);return[s].concat(o)}else return s})}get states(){if(this.states_==null){const e=Array.isArray(this.cell.stateSize)?this.cell.stateSize.length:1,t=[];for(let s=0;si.shape[i.shape.length-1]),r))throw new R(`An initialState was passed that is not compatible with cell.stateSize. Received stateSpec=${this.stateSpec}; However cell.stateSize is ${this.cell.stateSize}`)}else this.stateSpec=r.map(i=>new dt({shape:[null,i]}));this.stateful&&this.resetStates()}resetStates(e,t=!1){B(()=>{if(!this.stateful)throw new qn("Cannot call resetStates() on an RNN Layer that is not stateful.");const s=this.inputSpec[0].shape[0];if(s==null)throw new R("If an RNN is stateful, it needs to know its batch size. Specify the batch size of your input tensors: \n- If using a Sequential model, specify the batch size by passing a `batchInputShape` option to your first layer.\n- If using the functional API, specify the batch size by passing a `batchShape` option to your Input layer.");if(this.states_==null)Array.isArray(this.cell.stateSize)?this.states_=this.cell.stateSize.map(o=>ot([s,o])):this.states_=[ot([s,this.cell.stateSize])];else if(e==null)fe(this.states_),this.keptStates!=null&&(fe(this.keptStates),this.keptStates=[]),Array.isArray(this.cell.stateSize)?this.states_=this.cell.stateSize.map(o=>ot([s,o])):this.states_[0]=ot([s,this.cell.stateSize]);else{if(Array.isArray(e)||(e=[e]),e.length!==this.states_.length)throw new R(`Layer ${this.name} expects ${this.states_.length} state(s), but it received ${e.length} state value(s). Input received: ${e}`);t===!0?this.keptStates.push(this.states_.slice()):fe(this.states_);for(let o=0;odn(o.clone()))})}apply(e,t){let s=t==null?null:t.initialState,o=t==null?null:t.constants;t==null&&(t={});const r=Ib(e,s,o,this.numConstants);e=r.inputs,s=r.initialState,o=r.constants;let i=[],a=[];if(s!=null){t.initialState=s,i=i.concat(s),this.stateSpec=[];for(const c of s)this.stateSpec.push(new dt({shape:c.shape}));a=a.concat(this.stateSpec)}if(o!=null&&(t.constants=o,i=i.concat(o),this.numConstants=o.length),i[0]instanceof Yn){const c=[e].concat(i),u=this.inputSpec.concat(a),h=this.inputSpec;this.inputSpec=u;const d=super.apply(c,t);return this.inputSpec=h,d}else return super.apply(e,t)}call(e,t){return B(()=>{const s=t==null?null:t.mask,o=t==null?null:t.training;let r=t==null?null:t.initialState;e=ye(e),r==null&&(this.stateful?r=this.states_:r=this.getInitialState(e));const i=Array.isArray(this.cell.stateSize)?this.cell.stateSize.length:1;if(r.length!==i)throw new R(`RNN Layer has ${i} state(s) but was passed ${r.length} initial state(s).`);this.unroll&&console.warn("Ignoring unroll = true for RNN layer, due to imperative backend.");const a={training:o},c=$b((f,m)=>{const g=this.cell.call([f].concat(m),a);return[g[0],g.slice(1)]},e,r,this.goBackwards,s,null,this.unroll,this.returnSequences),u=c[0],h=c[1],d=c[2];this.stateful&&this.resetStates(d,o);const p=this.returnSequences?h:u;return this.returnState?[p].concat(d):p})}getInitialState(e){return B(()=>{let t=ot(e.shape);return t=de(t,[1,2]),t=_i(t),Array.isArray(this.cell.stateSize)?this.cell.stateSize.map(s=>s>1?Cd(t,[1,s]):t):this.cell.stateSize>1?[Cd(t,[1,this.cell.stateSize])]:[t]})}get trainableWeights(){return this.trainable?this.cell.trainableWeights:[]}get nonTrainableWeights(){return this.trainable?this.cell.nonTrainableWeights:this.cell.weights}setFastWeightInitDuringBuild(e){super.setFastWeightInitDuringBuild(e),this.cell!=null&&this.cell.setFastWeightInitDuringBuild(e)}getConfig(){const e=super.getConfig(),t={returnSequences:this.returnSequences,returnState:this.returnState,goBackwards:this.goBackwards,stateful:this.stateful,unroll:this.unroll};this.numConstants!=null&&(t.numConstants=this.numConstants);const s=this.cell.getConfig();return this.getClassName()===Ds.className&&(t.cell={className:this.cell.getClassName(),config:s}),Object.assign(Object.assign(Object.assign({},s),e),t)}static fromConfig(e,t,s={}){const o=t.cell,r=Zn(o,s);return new e(Object.assign(t,{cell:r}))}}Ds.className="RNN",Z(Ds);class tc extends ve{}class qd extends tc{constructor(e){super(e),this.DEFAULT_ACTIVATION="tanh",this.DEFAULT_KERNEL_INITIALIZER="glorotNormal",this.DEFAULT_RECURRENT_INITIALIZER="orthogonal",this.DEFAULT_BIAS_INITIALIZER="zeros",this.units=e.units,yt(this.units,"units"),this.activation=As(e.activation==null?this.DEFAULT_ACTIVATION:e.activation),this.useBias=e.useBias==null?!0:e.useBias,this.kernelInitializer=je(e.kernelInitializer||this.DEFAULT_KERNEL_INITIALIZER),this.recurrentInitializer=je(e.recurrentInitializer||this.DEFAULT_RECURRENT_INITIALIZER),this.biasInitializer=je(e.biasInitializer||this.DEFAULT_BIAS_INITIALIZER),this.kernelRegularizer=Ke(e.kernelRegularizer),this.recurrentRegularizer=Ke(e.recurrentRegularizer),this.biasRegularizer=Ke(e.biasRegularizer),this.kernelConstraint=ft(e.kernelConstraint),this.recurrentConstraint=ft(e.recurrentConstraint),this.biasConstraint=ft(e.biasConstraint),this.dropout=er([1,Ns([0,e.dropout==null?0:e.dropout])]),this.recurrentDropout=er([1,Ns([0,e.recurrentDropout==null?0:e.recurrentDropout])]),this.dropoutFunc=e.dropoutFunc,this.stateSize=this.units,this.dropoutMask=null,this.recurrentDropoutMask=null}build(e){e=Fe(e),this.kernel=this.addWeight("kernel",[e[e.length-1],this.units],null,this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint),this.recurrentKernel=this.addWeight("recurrent_kernel",[this.units,this.units],null,this.recurrentInitializer,this.recurrentRegularizer,!0,this.recurrentConstraint),this.useBias?this.bias=this.addWeight("bias",[this.units],null,this.biasInitializer,this.biasRegularizer,!0,this.biasConstraint):this.bias=null,this.built=!0}call(e,t){return B(()=>{if(e=e,e.length!==2)throw new R(`SimpleRNNCell expects 2 input Tensors, got ${e.length}.`);let s=e[1];e=e[0];const o=t.training==null?!1:t.training;0fn(e),rate:this.dropout,training:o,dropoutFunc:this.dropoutFunc})),0fn(s),rate:this.recurrentDropout,training:o,dropoutFunc:this.dropoutFunc}));let r;const i=this.dropoutMask,a=this.recurrentDropoutMask;i!=null?r=Xn(D(e,i),this.kernel.read()):r=Xn(e,this.kernel.read()),this.bias!=null&&(r=Dn(r,this.bias.read())),a!=null&&(s=D(s,a));let l=J(r,Xn(s,this.recurrentKernel.read()));return this.activation!=null&&(l=this.activation.apply(l)),[l,l]})}getConfig(){const e=super.getConfig(),t={units:this.units,activation:Rs(this.activation),useBias:this.useBias,kernelInitializer:Qe(this.kernelInitializer),recurrentInitializer:Qe(this.recurrentInitializer),biasInitializer:Qe(this.biasInitializer),kernelRegularizer:Be(this.kernelRegularizer),recurrentRegularizer:Be(this.recurrentRegularizer),biasRegularizer:Be(this.biasRegularizer),activityRegularizer:Be(this.activityRegularizer),kernelConstraint:pt(this.kernelConstraint),recurrentConstraint:pt(this.recurrentConstraint),biasConstraint:pt(this.biasConstraint),dropout:this.dropout,recurrentDropout:this.recurrentDropout};return Object.assign(Object.assign({},e),t)}}qd.className="SimpleRNNCell",Z(qd);class kb extends Ds{constructor(e){e.cell=new qd(e),super(e)}call(e,t){return B(()=>{this.cell.dropoutMask!=null&&(fe(this.cell.dropoutMask),this.cell.dropoutMask=null),this.cell.recurrentDropoutMask!=null&&(fe(this.cell.recurrentDropoutMask),this.cell.recurrentDropoutMask=null);const s=t==null?null:t.mask,o=t==null?null:t.training,r=t==null?null:t.initialState;return super.call(e,{mask:s,training:o,initialState:r})})}static fromConfig(e,t){return new e(t)}}kb.className="SimpleRNN",Z(kb);class jd extends tc{constructor(e){if(super(e),this.DEFAULT_ACTIVATION="tanh",this.DEFAULT_RECURRENT_ACTIVATION="hardSigmoid",this.DEFAULT_KERNEL_INITIALIZER="glorotNormal",this.DEFAULT_RECURRENT_INITIALIZER="orthogonal",this.DEFAULT_BIAS_INITIALIZER="zeros",e.resetAfter)throw new R("GRUCell does not support reset_after parameter set to true.");this.units=e.units,yt(this.units,"units"),this.activation=As(e.activation===void 0?this.DEFAULT_ACTIVATION:e.activation),this.recurrentActivation=As(e.recurrentActivation===void 0?this.DEFAULT_RECURRENT_ACTIVATION:e.recurrentActivation),this.useBias=e.useBias==null?!0:e.useBias,this.kernelInitializer=je(e.kernelInitializer||this.DEFAULT_KERNEL_INITIALIZER),this.recurrentInitializer=je(e.recurrentInitializer||this.DEFAULT_RECURRENT_INITIALIZER),this.biasInitializer=je(e.biasInitializer||this.DEFAULT_BIAS_INITIALIZER),this.kernelRegularizer=Ke(e.kernelRegularizer),this.recurrentRegularizer=Ke(e.recurrentRegularizer),this.biasRegularizer=Ke(e.biasRegularizer),this.kernelConstraint=ft(e.kernelConstraint),this.recurrentConstraint=ft(e.recurrentConstraint),this.biasConstraint=ft(e.biasConstraint),this.dropout=er([1,Ns([0,e.dropout==null?0:e.dropout])]),this.recurrentDropout=er([1,Ns([0,e.recurrentDropout==null?0:e.recurrentDropout])]),this.dropoutFunc=e.dropoutFunc,this.implementation=e.implementation,this.stateSize=this.units,this.dropoutMask=null,this.recurrentDropoutMask=null}build(e){e=Fe(e);const t=e[e.length-1];this.kernel=this.addWeight("kernel",[t,this.units*3],null,this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint),this.recurrentKernel=this.addWeight("recurrent_kernel",[this.units,this.units*3],null,this.recurrentInitializer,this.recurrentRegularizer,!0,this.recurrentConstraint),this.useBias?this.bias=this.addWeight("bias",[this.units*3],null,this.biasInitializer,this.biasRegularizer,!0,this.biasConstraint):this.bias=null,this.built=!0}call(e,t){return B(()=>{if(e=e,e.length!==2)throw new R(`GRUCell expects 2 input Tensors (inputs, h, c), got ${e.length}.`);const s=t.training==null?!1:t.training;let o=e[1];e=e[0],0fn(e),rate:this.dropout,training:s,count:3,dropoutFunc:this.dropoutFunc})),0fn(o),rate:this.recurrentDropout,training:s,count:3,dropoutFunc:this.dropoutFunc}));const r=this.dropoutMask,i=this.recurrentDropoutMask;let a,l,c;0{this.cell.dropoutMask!=null&&(fe(this.cell.dropoutMask),this.cell.dropoutMask=null),this.cell.recurrentDropoutMask!=null&&(fe(this.cell.recurrentDropoutMask),this.cell.recurrentDropoutMask=null);const s=t==null?null:t.mask,o=t==null?null:t.training,r=t==null?null:t.initialState;return super.call(e,{mask:s,training:o,initialState:r})})}static fromConfig(e,t){return t.implmentation===0&&(t.implementation=1),new e(t)}}vb.className="GRU",Z(vb);class nc extends tc{constructor(e){super(e),this.DEFAULT_ACTIVATION="tanh",this.DEFAULT_RECURRENT_ACTIVATION="hardSigmoid",this.DEFAULT_KERNEL_INITIALIZER="glorotNormal",this.DEFAULT_RECURRENT_INITIALIZER="orthogonal",this.DEFAULT_BIAS_INITIALIZER="zeros",this.units=e.units,yt(this.units,"units"),this.activation=As(e.activation===void 0?this.DEFAULT_ACTIVATION:e.activation),this.recurrentActivation=As(e.recurrentActivation===void 0?this.DEFAULT_RECURRENT_ACTIVATION:e.recurrentActivation),this.useBias=e.useBias==null?!0:e.useBias,this.kernelInitializer=je(e.kernelInitializer||this.DEFAULT_KERNEL_INITIALIZER),this.recurrentInitializer=je(e.recurrentInitializer||this.DEFAULT_RECURRENT_INITIALIZER),this.biasInitializer=je(e.biasInitializer||this.DEFAULT_BIAS_INITIALIZER),this.unitForgetBias=e.unitForgetBias,this.kernelRegularizer=Ke(e.kernelRegularizer),this.recurrentRegularizer=Ke(e.recurrentRegularizer),this.biasRegularizer=Ke(e.biasRegularizer),this.kernelConstraint=ft(e.kernelConstraint),this.recurrentConstraint=ft(e.recurrentConstraint),this.biasConstraint=ft(e.biasConstraint),this.dropout=er([1,Ns([0,e.dropout==null?0:e.dropout])]),this.recurrentDropout=er([1,Ns([0,e.recurrentDropout==null?0:e.recurrentDropout])]),this.dropoutFunc=e.dropoutFunc,this.implementation=e.implementation,this.stateSize=[this.units,this.units],this.dropoutMask=null,this.recurrentDropoutMask=null}build(e){var t;e=Fe(e);const s=e[e.length-1];this.kernel=this.addWeight("kernel",[s,this.units*4],null,this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint),this.recurrentKernel=this.addWeight("recurrent_kernel",[this.units,this.units*4],null,this.recurrentInitializer,this.recurrentRegularizer,!0,this.recurrentConstraint);let o;if(this.useBias){if(this.unitForgetBias){const r=this.biasInitializer,i=this.units;o=new(t=class extends bn{apply(l,c){const u=r.apply([i]),h=new $d().apply([i]),d=r.apply([i*2]);return Qg(Qg(u,h),d)}},t.className="CustomInit",t)}else o=this.biasInitializer;this.bias=this.addWeight("bias",[this.units*4],null,o,this.biasRegularizer,!0,this.biasConstraint)}else this.bias=null;this.built=!0}call(e,t){return B(()=>{const s=t.training==null?!1:t.training;if(e=e,e.length!==3)throw new R(`LSTMCell expects 3 input Tensors (inputs, h, c), got ${e.length}.`);let o=e[1];const r=e[2];e=e[0],0fn(e),rate:this.dropout,training:s,count:4,dropoutFunc:this.dropoutFunc})),0fn(o),rate:this.recurrentDropout,training:s,count:4,dropoutFunc:this.dropoutFunc}));const i=this.dropoutMask,a=this.recurrentDropoutMask;let l,c,u,h;0{this.cell.dropoutMask!=null&&(fe(this.cell.dropoutMask),this.cell.dropoutMask=null),this.cell.recurrentDropoutMask!=null&&(fe(this.cell.recurrentDropoutMask),this.cell.recurrentDropoutMask=null);const s=t==null?null:t.mask,o=t==null?null:t.training,r=t==null?null:t.initialState;return super.call(e,{mask:s,training:o,initialState:r})})}static fromConfig(e,t){return t.implmentation===0&&(t.implementation=1),new e(t)}}Sb.className="LSTM",Z(Sb);class Kd extends tc{constructor(e){super(e),this.cells=e.cells}get stateSize(){const e=[];for(const t of this.cells.slice().reverse())Array.isArray(t.stateSize)?e.push(...t.stateSize):e.push(t.stateSize);return e}call(e,t){return B(()=>{e=e;let s=e.slice(1);const o=[];for(const a of this.cells.slice().reverse())Array.isArray(a.stateSize)?o.push(s.splice(0,a.stateSize.length)):o.push(s.splice(0,1));o.reverse();const r=[];let i;for(let a=0;a{go(`RNNCell_${o}`,()=>{s.build(e),Array.isArray(s.stateSize)?t=s.stateSize[0]:t=s.stateSize,e=[e[0],t]})}),this.built=!0}getConfig(){const e=super.getConfig(),t=r=>({className:r.getClassName(),config:r.getConfig()}),o={cells:this.cells.map(t)};return Object.assign(Object.assign({},e),o)}static fromConfig(e,t,s={}){const o=[];for(const r of t.cells)o.push(Zn(r,s));return new e({cells:o})}get trainableWeights(){if(!this.trainable)return[];const e=[];for(const t of this.cells)e.push(...t.trainableWeights);return e}get nonTrainableWeights(){const e=[];for(const t of this.cells)e.push(...t.nonTrainableWeights);if(!this.trainable){const t=[];for(const s of this.cells)t.push(...s.trainableWeights);return t.concat(e)}return e}getWeights(){const e=[];for(const t of this.cells)e.push(...t.weights);return Ad(e)}setWeights(e){const t=[];for(const s of this.cells){const o=s.weights.length,r=e.splice(o);for(let i=0;ir!=null?r(e(),t):ex(e(),t),a=()=>Li(i,e,s);return!o||o<=1?dn(a().clone()):Array(o).fill(void 0).map(a).map(c=>dn(c.clone()))}/** * @license * Copyright 2020 Google LLC * @@ -7784,7 +7784,7 @@ * license that can be found in the LICENSE file or at * https://opensource.org/licenses/MIT. * ============================================================================= - */var dR=function(n,e){var t={};for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&e.indexOf(s)<0&&(t[s]=n[s]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,s=Object.getOwnPropertySymbols(n);o{if(this.cell.dropoutMask!=null&&(fe(this.cell.dropoutMask),this.cell.dropoutMask=null),this.cell.recurrentDropoutMask!=null&&(fe(this.cell.recurrentDropoutMask),this.cell.recurrentDropoutMask=null),t&&t.constants)throw new R("ConvRNN2D cell does not support constants");const s=t==null?null:t.mask,o=t==null?null:t.training,r=t==null?null:t.initialState;return super.call(e,{mask:s,training:o,initialState:r})})}computeOutputShape(e){let t=this.computeSingleOutputShape(e);return this.returnSequences||(t=[t[0],...t.slice(2)]),this.returnState&&(t=[t,...Array(2).fill([e[0],...t.slice(-3)])]),t}getInitialState(e){return B(()=>{const{stateSize:t}=this.cell,s=e.shape,o=this.computeSingleOutputShape(s),r=[o[0],...o.slice(2)],i=ot(r);return Array.isArray(t)?Array(t.length).fill(i):[i]})}resetStates(e,t=!1){B(()=>{if(!this.stateful)throw new qn("Cannot call resetStates() on an RNN Layer that is not stateful.");const s=this.inputSpec[0].shape,o=this.computeSingleOutputShape(s),r=[o[0],...o.slice(2)];if(s[0]==null)throw new R("If an RNN is stateful, it needs to know its batch size. Specify the batch size of your input tensors: \n- If using a Sequential model, specify the batch size by passing a `batchInputShape` option to your first layer.\n- If using the functional API, specify the batch size by passing a `batchShape` option to your Input layer.");if(this.getStates()==null)Array.isArray(this.cell.stateSize)?this.states_=this.cell.stateSize.map(()=>ot(r)):this.states_=[ot(r)];else if(e==null)fe(this.states_),this.keptStates!=null&&(fe(this.keptStates),this.keptStates=[]),Array.isArray(this.cell.stateSize)?this.states_=this.cell.stateSize.map(()=>ot(r)):this.states_[0]=ot(r);else{if(Array.isArray(e)||(e=[e]),e.length!==this.states_.length)throw new R(`Layer ${this.name} expects ${this.states_.length} state(s), but it received ${e.length} state value(s). Input received: ${e}`);t?this.keptStates.push(this.states_.slice()):fe(this.states_);for(let a=0;adn(a.clone()))})}computeSingleOutputShape(e){const{dataFormat:t,filters:s,kernelSize:o,padding:r,strides:i,dilationRate:a}=this.cell,l=t==="channelsFirst",c=e[l?3:2],u=e[l?4:3],h=On(c,o[0],r,i[0],a[0]),d=On(u,o[1],r,i[1],a[1]);return[...e.slice(0,2),...l?[s,h,d]:[h,d,s]]}}Tb.className="ConvRNN2D";class Zd extends nc{constructor(e){const{filters:t,kernelSize:s,strides:o,padding:r,dataFormat:i,dilationRate:a}=e;super(Object.assign(Object.assign({},e),{units:t})),this.filters=t,yt(this.filters,"filters"),this.kernelSize=nr(s,2,"kernelSize"),this.kernelSize.forEach(l=>yt(l,"kernelSize")),this.strides=nr(o||1,2,"strides"),this.strides.forEach(l=>yt(l,"strides")),this.padding=r||"valid",on(this.padding),this.dataFormat=i||"channelsLast",rt(this.dataFormat),this.dilationRate=nr(a||1,2,"dilationRate"),this.dilationRate.forEach(l=>yt(l,"dilationRate"))}build(e){var t;e=Fe(e);const s=this.dataFormat==="channelsFirst"?1:e.length-1;if(e[s]==null)throw new R(`The channel dimension of the input should be defined. Found ${e[s]}`);const o=e[s],r=4,i=this.kernelSize.concat([o,this.filters*r]);this.kernel=this.addWeight("kernel",i,null,this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint);const a=this.kernelSize.concat([this.filters,this.filters*r]);if(this.recurrentKernel=this.addWeight("recurrent_kernel",a,null,this.recurrentInitializer,this.recurrentRegularizer,!0,this.recurrentConstraint),this.useBias){let l;if(this.unitForgetBias){const c=this.biasInitializer,u=this.filters;l=new(t=class extends bn{apply(d,p){const f=c.apply([u]),m=Nn([u]),g=c.apply([u*2]);return Id([f,m,g])}},t.className="CustomInit",t)}else l=this.biasInitializer;this.bias=this.addWeight("bias",[this.filters*r],null,l,this.biasRegularizer,!0,this.biasConstraint)}this.built=!0}call(e,t){return B(()=>{if(e.length!==3)throw new R(`ConvLSTM2DCell expects 3 input Tensors (inputs, h, c), got ${e.length}.`);const s=t.training||!1,o=e[0],r=e[1],i=e[2],a=4;0fn(o),rate:this.dropout,training:s,count:a,dropoutFunc:this.dropoutFunc}));const l=this.dropoutMask,c=(K,j,Y)=>!j||!j[Y]?K:D(j[Y],K);let u=c(o,l,0),h=c(o,l,1),d=c(o,l,2),p=c(o,l,3);0fn(r),rate:this.recurrentDropout,training:s,count:a,dropoutFunc:this.dropoutFunc}));const f=this.recurrentDropoutMask;let m=c(r,f,0),g=c(r,f,1),x=c(r,f,2),b=c(r,f,3);const w=3,[y,C,I,$]=sn(this.kernel.read(),a,w),[k,S,N,A]=this.useBias?sn(this.bias.read(),a):[null,null,null,null];u=this.inputConv(u,y,k,this.padding),h=this.inputConv(h,C,S,this.padding),d=this.inputConv(d,I,N,this.padding),p=this.inputConv(p,$,A,this.padding);const[_,E,M,z]=sn(this.recurrentKernel.read(),a,w);m=this.recurrentConv(m,_),g=this.recurrentConv(g,E),x=this.recurrentConv(x,M),b=this.recurrentConv(b,z);const P=this.recurrentActivation.apply(J(u,m)),H=this.recurrentActivation.apply(J(h,g)),W=J(D(H,i),D(P,this.activation.apply(J(d,x)))),q=D(this.recurrentActivation.apply(J(p,b)),this.activation.apply(W));return[q,q,W]})}getConfig(){const e=super.getConfig(),t=dR(e,["units"]),s={filters:this.filters,kernelSize:this.kernelSize,padding:this.padding,dataFormat:this.dataFormat,dilationRate:this.dilationRate,strides:this.strides};return Object.assign(Object.assign({},t),s)}inputConv(e,t,s,o){const r=ro(e,t,this.strides,o||"valid",this.dataFormat==="channelsFirst"?"NCHW":"NHWC",this.dilationRate);return s?Dn(r,s,this.dataFormat):r}recurrentConv(e,t){return ro(e,t,1,"same",this.dataFormat==="channelsFirst"?"NCHW":"NHWC")}}Zd.className="ConvLSTM2DCell",Z(Zd);class Nb extends Tb{constructor(e){const t=new Zd(e);super(Object.assign(Object.assign({},e),{cell:t}))}static fromConfig(e,t){return new e(t)}}Nb.className="ConvLSTM2D",Z(Nb);/** + */var hR=function(n,e){var t={};for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&e.indexOf(s)<0&&(t[s]=n[s]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,s=Object.getOwnPropertySymbols(n);o{if(this.cell.dropoutMask!=null&&(fe(this.cell.dropoutMask),this.cell.dropoutMask=null),this.cell.recurrentDropoutMask!=null&&(fe(this.cell.recurrentDropoutMask),this.cell.recurrentDropoutMask=null),t&&t.constants)throw new R("ConvRNN2D cell does not support constants");const s=t==null?null:t.mask,o=t==null?null:t.training,r=t==null?null:t.initialState;return super.call(e,{mask:s,training:o,initialState:r})})}computeOutputShape(e){let t=this.computeSingleOutputShape(e);return this.returnSequences||(t=[t[0],...t.slice(2)]),this.returnState&&(t=[t,...Array(2).fill([e[0],...t.slice(-3)])]),t}getInitialState(e){return B(()=>{const{stateSize:t}=this.cell,s=e.shape,o=this.computeSingleOutputShape(s),r=[o[0],...o.slice(2)],i=ot(r);return Array.isArray(t)?Array(t.length).fill(i):[i]})}resetStates(e,t=!1){B(()=>{if(!this.stateful)throw new qn("Cannot call resetStates() on an RNN Layer that is not stateful.");const s=this.inputSpec[0].shape,o=this.computeSingleOutputShape(s),r=[o[0],...o.slice(2)];if(s[0]==null)throw new R("If an RNN is stateful, it needs to know its batch size. Specify the batch size of your input tensors: \n- If using a Sequential model, specify the batch size by passing a `batchInputShape` option to your first layer.\n- If using the functional API, specify the batch size by passing a `batchShape` option to your Input layer.");if(this.getStates()==null)Array.isArray(this.cell.stateSize)?this.states_=this.cell.stateSize.map(()=>ot(r)):this.states_=[ot(r)];else if(e==null)fe(this.states_),this.keptStates!=null&&(fe(this.keptStates),this.keptStates=[]),Array.isArray(this.cell.stateSize)?this.states_=this.cell.stateSize.map(()=>ot(r)):this.states_[0]=ot(r);else{if(Array.isArray(e)||(e=[e]),e.length!==this.states_.length)throw new R(`Layer ${this.name} expects ${this.states_.length} state(s), but it received ${e.length} state value(s). Input received: ${e}`);t?this.keptStates.push(this.states_.slice()):fe(this.states_);for(let a=0;adn(a.clone()))})}computeSingleOutputShape(e){const{dataFormat:t,filters:s,kernelSize:o,padding:r,strides:i,dilationRate:a}=this.cell,l=t==="channelsFirst",c=e[l?3:2],u=e[l?4:3],h=On(c,o[0],r,i[0],a[0]),d=On(u,o[1],r,i[1],a[1]);return[...e.slice(0,2),...l?[s,h,d]:[h,d,s]]}}Tb.className="ConvRNN2D";class Xd extends nc{constructor(e){const{filters:t,kernelSize:s,strides:o,padding:r,dataFormat:i,dilationRate:a}=e;super(Object.assign(Object.assign({},e),{units:t})),this.filters=t,yt(this.filters,"filters"),this.kernelSize=nr(s,2,"kernelSize"),this.kernelSize.forEach(l=>yt(l,"kernelSize")),this.strides=nr(o||1,2,"strides"),this.strides.forEach(l=>yt(l,"strides")),this.padding=r||"valid",on(this.padding),this.dataFormat=i||"channelsLast",rt(this.dataFormat),this.dilationRate=nr(a||1,2,"dilationRate"),this.dilationRate.forEach(l=>yt(l,"dilationRate"))}build(e){var t;e=Fe(e);const s=this.dataFormat==="channelsFirst"?1:e.length-1;if(e[s]==null)throw new R(`The channel dimension of the input should be defined. Found ${e[s]}`);const o=e[s],r=4,i=this.kernelSize.concat([o,this.filters*r]);this.kernel=this.addWeight("kernel",i,null,this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint);const a=this.kernelSize.concat([this.filters,this.filters*r]);if(this.recurrentKernel=this.addWeight("recurrent_kernel",a,null,this.recurrentInitializer,this.recurrentRegularizer,!0,this.recurrentConstraint),this.useBias){let l;if(this.unitForgetBias){const c=this.biasInitializer,u=this.filters;l=new(t=class extends bn{apply(d,p){const f=c.apply([u]),m=Nn([u]),g=c.apply([u*2]);return wd([f,m,g])}},t.className="CustomInit",t)}else l=this.biasInitializer;this.bias=this.addWeight("bias",[this.filters*r],null,l,this.biasRegularizer,!0,this.biasConstraint)}this.built=!0}call(e,t){return B(()=>{if(e.length!==3)throw new R(`ConvLSTM2DCell expects 3 input Tensors (inputs, h, c), got ${e.length}.`);const s=t.training||!1,o=e[0],r=e[1],i=e[2],a=4;0fn(o),rate:this.dropout,training:s,count:a,dropoutFunc:this.dropoutFunc}));const l=this.dropoutMask,c=(K,j,Y)=>!j||!j[Y]?K:D(j[Y],K);let u=c(o,l,0),h=c(o,l,1),d=c(o,l,2),p=c(o,l,3);0fn(r),rate:this.recurrentDropout,training:s,count:a,dropoutFunc:this.dropoutFunc}));const f=this.recurrentDropoutMask;let m=c(r,f,0),g=c(r,f,1),x=c(r,f,2),b=c(r,f,3);const w=3,[y,C,I,v]=sn(this.kernel.read(),a,w),[$,S,N,A]=this.useBias?sn(this.bias.read(),a):[null,null,null,null];u=this.inputConv(u,y,$,this.padding),h=this.inputConv(h,C,S,this.padding),d=this.inputConv(d,I,N,this.padding),p=this.inputConv(p,v,A,this.padding);const[_,E,M,z]=sn(this.recurrentKernel.read(),a,w);m=this.recurrentConv(m,_),g=this.recurrentConv(g,E),x=this.recurrentConv(x,M),b=this.recurrentConv(b,z);const P=this.recurrentActivation.apply(J(u,m)),H=this.recurrentActivation.apply(J(h,g)),W=J(D(H,i),D(P,this.activation.apply(J(d,x)))),q=D(this.recurrentActivation.apply(J(p,b)),this.activation.apply(W));return[q,q,W]})}getConfig(){const e=super.getConfig(),t=hR(e,["units"]),s={filters:this.filters,kernelSize:this.kernelSize,padding:this.padding,dataFormat:this.dataFormat,dilationRate:this.dilationRate,strides:this.strides};return Object.assign(Object.assign({},t),s)}inputConv(e,t,s,o){const r=ro(e,t,this.strides,o||"valid",this.dataFormat==="channelsFirst"?"NCHW":"NHWC",this.dilationRate);return s?Dn(r,s,this.dataFormat):r}recurrentConv(e,t){return ro(e,t,1,"same",this.dataFormat==="channelsFirst"?"NCHW":"NHWC")}}Xd.className="ConvLSTM2DCell",Z(Xd);class Nb extends Tb{constructor(e){const t=new Xd(e);super(Object.assign(Object.assign({},e),{cell:t}))}static fromConfig(e,t){return new e(t)}}Nb.className="ConvLSTM2D",Z(Nb);/** * @license * Copyright 2018 Google LLC * @@ -7792,7 +7792,7 @@ * license that can be found in the LICENSE file or at * https://opensource.org/licenses/MIT. * ============================================================================= - */class Qd extends ve{constructor(e){super(e),this.rate=Math.max(Math.min(e.rate,1),0),this.noiseShape=e.noiseShape,this.seed=e.seed,this.supportsMasking=!0}getNoiseShape(e){if(this.noiseShape==null)return this.noiseShape;const t=e.shape,s=[];for(let o=0;o{this.invokeCallHook(e,t);const s=ye(e);if(0ex(s,this.rate,r,this.seed),()=>s,o)}return e})}getConfig(){const e={rate:this.rate,noiseShape:this.noiseShape,seed:this.seed},t=super.getConfig();return Object.assign(e,t),e}dispose(){return super.dispose()}}Qd.className="Dropout",Z(Qd);class Eb extends Qd{constructor(e){super(e),this.inputSpec=[{ndim:3}]}getNoiseShape(e){const t=e.shape;return[t[0],1,t[2]]}}Eb.className="SpatialDropout1D",Z(Eb);class Rb extends ve{constructor(e){if(super(e),this.activation=null,this.useBias=!0,this.kernel=null,this.bias=null,this.DEFAULT_KERNEL_INITIALIZER="glorotNormal",this.DEFAULT_BIAS_INITIALIZER="zeros",e.batchInputShape==null&&e.inputShape==null&&e.inputDim!=null){let t=null;e.batchSize!=null&&(t=e.batchSize),this.batchInputShape=[t,e.inputDim]}this.units=e.units,yt(this.units,"units"),this.activation=As(e.activation),e.useBias!=null&&(this.useBias=e.useBias),this.kernelInitializer=je(e.kernelInitializer||this.DEFAULT_KERNEL_INITIALIZER),this.biasInitializer=je(e.biasInitializer||this.DEFAULT_BIAS_INITIALIZER),this.kernelConstraint=ft(e.kernelConstraint),this.biasConstraint=ft(e.biasConstraint),this.kernelRegularizer=Ke(e.kernelRegularizer),this.biasRegularizer=Ke(e.biasRegularizer),this.activityRegularizer=Ke(e.activityRegularizer),this.supportsMasking=!0,this.inputSpec=[{minNDim:2}]}build(e){e=Fe(e);const t=e[e.length-1];this.kernel==null&&(this.kernel=this.addWeight("kernel",[t,this.units],null,this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint),this.useBias&&(this.bias=this.addWeight("bias",[this.units],null,this.biasInitializer,this.biasRegularizer,!0,this.biasConstraint))),this.inputSpec=[{minNDim:2,axes:{[-1]:t}}],this.built=!0}computeOutputShape(e){e=Fe(e);const t=e.slice();return t[t.length-1]=this.units,t}call(e,t){return B(()=>{this.invokeCallHook(e,t);const s=ye(e),o=Hg(this.activation.getClassName());let r;return o!=null?r=Xn(s,this.kernel.read(),o,this.bias?this.bias.read():null):(r=Xn(s,this.kernel.read()),this.bias!=null&&(r=Dn(r,this.bias.read())),this.activation!=null&&(r=this.activation.apply(r))),r})}getConfig(){const e={units:this.units,activation:Rs(this.activation),useBias:this.useBias,kernelInitializer:Qe(this.kernelInitializer),biasInitializer:Qe(this.biasInitializer),kernelRegularizer:Be(this.kernelRegularizer),biasRegularizer:Be(this.biasRegularizer),activityRegularizer:Be(this.activityRegularizer),kernelConstraint:pt(this.kernelConstraint),biasConstraint:pt(this.biasConstraint)},t=super.getConfig();return Object.assign(e,t),e}}Rb.className="Dense",Z(Rb);class Ab extends ve{constructor(e){e=e||{},super(e),this.inputSpec=[{minNDim:3}],this.dataFormat=e.dataFormat}computeOutputShape(e){e=Fe(e);for(const t of e.slice(1))if(t==null)throw new R(`The shape of the input to "Flatten" is not fully defined (got ${e.slice(1)}). Make sure to pass a complete "input_shape" or "batch_input_shape" argument to the first layer in your model.`);return[e[0],Ts(e,1)]}call(e,t){return B(()=>{this.invokeCallHook(e,t);let s=ye(e);if(this.dataFormat==="channelsFirst"&&s.rank>1){const o=[0];for(let r=2;r{this.invokeCallHook(e,t);const s=ye(e);return this.activation.apply(s)})}getConfig(){const e={activation:Rs(this.activation)},t=super.getConfig();return Object.assign(e,t),e}}Db.className="Activation",Z(Db);class Fb extends ve{constructor(e){super(e),this.n=e.n,this.inputSpec=[{ndim:2}]}computeOutputShape(e){return[e[0],this.n,e[1]]}call(e,t){return B(()=>(e=ye(e),WN(e,this.n)))}getConfig(){const e={n:this.n},t=super.getConfig();return Object.assign(e,t),e}}Fb.className="RepeatVector",Z(Fb);class _b extends ve{constructor(e){super(e),this.targetShape=e.targetShape;for(let t=0;t{this.invokeCallHook(e,t);const s=ye(e),o=s.shape,r=o.slice(0,1).concat(this.fixUnknownDimension(o.slice(1),this.targetShape));return O(s,r)})}getConfig(){const e={targetShape:this.targetShape},t=super.getConfig();return Object.assign(e,t),e}}_b.className="Reshape",Z(_b);class Ob extends ve{constructor(e){if(super(e),e.dims==null)throw new Error("Required configuration field `dims` is missing during Permute constructor call.");if(!Array.isArray(e.dims))throw new Error(`Permute constructor requires \`dims\` to be an Array, but received ${e.dims} instead.`);const t=Rn(1,e.dims.length+1);if(!_e(e.dims.slice().sort(),t))throw new Error("Invalid permutation `dims`: "+JSON.stringify(e.dims)+" `dims` must contain consecutive integers starting from 1.");this.dims=e.dims,this.dimsIncludingBatch=[0].concat(this.dims),this.inputSpec=[new dt({ndim:this.dims.length+1})]}computeOutputShape(e){e=Fe(e);const t=e.slice();return this.dims.forEach((s,o)=>{t[o+1]=e[s]}),t}call(e,t){return Ee(ye(e),this.dimsIncludingBatch)}getConfig(){const e={dims:this.dims},t=super.getConfig();return Object.assign(e,t),e}}Ob.className="Permute",Z(Ob);class Lb extends ve{constructor(e){super(e??{}),this.supportsMasking=!0,e!=null?this.maskValue=e.maskValue==null?0:e.maskValue:this.maskValue=0}computeOutputShape(e){return e}getConfig(){const e=super.getConfig(),t={maskValue:this.maskValue};return Object.assign(t,e),t}computeMask(e,t){const s=ye(e);return Qu(Tl(s,this.maskValue),-1)}call(e,t){return B(()=>{this.invokeCallHook(e,t);const s=ye(e),i=Qu(Tl(s,this.maskValue),-1,!0);return D(s,re(i,s.dtype))})}}Lb.className="Masking",Z(Lb);/** + */class Yd extends ve{constructor(e){super(e),this.rate=Math.max(Math.min(e.rate,1),0),this.noiseShape=e.noiseShape,this.seed=e.seed,this.supportsMasking=!0}getNoiseShape(e){if(this.noiseShape==null)return this.noiseShape;const t=e.shape,s=[];for(let o=0;o{this.invokeCallHook(e,t);const s=ye(e);if(0ex(s,this.rate,r,this.seed),()=>s,o)}return e})}getConfig(){const e={rate:this.rate,noiseShape:this.noiseShape,seed:this.seed},t=super.getConfig();return Object.assign(e,t),e}dispose(){return super.dispose()}}Yd.className="Dropout",Z(Yd);class Eb extends Yd{constructor(e){super(e),this.inputSpec=[{ndim:3}]}getNoiseShape(e){const t=e.shape;return[t[0],1,t[2]]}}Eb.className="SpatialDropout1D",Z(Eb);class Rb extends ve{constructor(e){if(super(e),this.activation=null,this.useBias=!0,this.kernel=null,this.bias=null,this.DEFAULT_KERNEL_INITIALIZER="glorotNormal",this.DEFAULT_BIAS_INITIALIZER="zeros",e.batchInputShape==null&&e.inputShape==null&&e.inputDim!=null){let t=null;e.batchSize!=null&&(t=e.batchSize),this.batchInputShape=[t,e.inputDim]}this.units=e.units,yt(this.units,"units"),this.activation=As(e.activation),e.useBias!=null&&(this.useBias=e.useBias),this.kernelInitializer=je(e.kernelInitializer||this.DEFAULT_KERNEL_INITIALIZER),this.biasInitializer=je(e.biasInitializer||this.DEFAULT_BIAS_INITIALIZER),this.kernelConstraint=ft(e.kernelConstraint),this.biasConstraint=ft(e.biasConstraint),this.kernelRegularizer=Ke(e.kernelRegularizer),this.biasRegularizer=Ke(e.biasRegularizer),this.activityRegularizer=Ke(e.activityRegularizer),this.supportsMasking=!0,this.inputSpec=[{minNDim:2}]}build(e){e=Fe(e);const t=e[e.length-1];this.kernel==null&&(this.kernel=this.addWeight("kernel",[t,this.units],null,this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint),this.useBias&&(this.bias=this.addWeight("bias",[this.units],null,this.biasInitializer,this.biasRegularizer,!0,this.biasConstraint))),this.inputSpec=[{minNDim:2,axes:{[-1]:t}}],this.built=!0}computeOutputShape(e){e=Fe(e);const t=e.slice();return t[t.length-1]=this.units,t}call(e,t){return B(()=>{this.invokeCallHook(e,t);const s=ye(e),o=Hg(this.activation.getClassName());let r;return o!=null?r=Xn(s,this.kernel.read(),o,this.bias?this.bias.read():null):(r=Xn(s,this.kernel.read()),this.bias!=null&&(r=Dn(r,this.bias.read())),this.activation!=null&&(r=this.activation.apply(r))),r})}getConfig(){const e={units:this.units,activation:Rs(this.activation),useBias:this.useBias,kernelInitializer:Qe(this.kernelInitializer),biasInitializer:Qe(this.biasInitializer),kernelRegularizer:Be(this.kernelRegularizer),biasRegularizer:Be(this.biasRegularizer),activityRegularizer:Be(this.activityRegularizer),kernelConstraint:pt(this.kernelConstraint),biasConstraint:pt(this.biasConstraint)},t=super.getConfig();return Object.assign(e,t),e}}Rb.className="Dense",Z(Rb);class Ab extends ve{constructor(e){e=e||{},super(e),this.inputSpec=[{minNDim:3}],this.dataFormat=e.dataFormat}computeOutputShape(e){e=Fe(e);for(const t of e.slice(1))if(t==null)throw new R(`The shape of the input to "Flatten" is not fully defined (got ${e.slice(1)}). Make sure to pass a complete "input_shape" or "batch_input_shape" argument to the first layer in your model.`);return[e[0],Ts(e,1)]}call(e,t){return B(()=>{this.invokeCallHook(e,t);let s=ye(e);if(this.dataFormat==="channelsFirst"&&s.rank>1){const o=[0];for(let r=2;r{this.invokeCallHook(e,t);const s=ye(e);return this.activation.apply(s)})}getConfig(){const e={activation:Rs(this.activation)},t=super.getConfig();return Object.assign(e,t),e}}Db.className="Activation",Z(Db);class Fb extends ve{constructor(e){super(e),this.n=e.n,this.inputSpec=[{ndim:2}]}computeOutputShape(e){return[e[0],this.n,e[1]]}call(e,t){return B(()=>(e=ye(e),VN(e,this.n)))}getConfig(){const e={n:this.n},t=super.getConfig();return Object.assign(e,t),e}}Fb.className="RepeatVector",Z(Fb);class _b extends ve{constructor(e){super(e),this.targetShape=e.targetShape;for(let t=0;t{this.invokeCallHook(e,t);const s=ye(e),o=s.shape,r=o.slice(0,1).concat(this.fixUnknownDimension(o.slice(1),this.targetShape));return O(s,r)})}getConfig(){const e={targetShape:this.targetShape},t=super.getConfig();return Object.assign(e,t),e}}_b.className="Reshape",Z(_b);class Ob extends ve{constructor(e){if(super(e),e.dims==null)throw new Error("Required configuration field `dims` is missing during Permute constructor call.");if(!Array.isArray(e.dims))throw new Error(`Permute constructor requires \`dims\` to be an Array, but received ${e.dims} instead.`);const t=Rn(1,e.dims.length+1);if(!_e(e.dims.slice().sort(),t))throw new Error("Invalid permutation `dims`: "+JSON.stringify(e.dims)+" `dims` must contain consecutive integers starting from 1.");this.dims=e.dims,this.dimsIncludingBatch=[0].concat(this.dims),this.inputSpec=[new dt({ndim:this.dims.length+1})]}computeOutputShape(e){e=Fe(e);const t=e.slice();return this.dims.forEach((s,o)=>{t[o+1]=e[s]}),t}call(e,t){return Ee(ye(e),this.dimsIncludingBatch)}getConfig(){const e={dims:this.dims},t=super.getConfig();return Object.assign(e,t),e}}Ob.className="Permute",Z(Ob);class Lb extends ve{constructor(e){super(e??{}),this.supportsMasking=!0,e!=null?this.maskValue=e.maskValue==null?0:e.maskValue:this.maskValue=0}computeOutputShape(e){return e}getConfig(){const e=super.getConfig(),t={maskValue:this.maskValue};return Object.assign(t,e),t}computeMask(e,t){const s=ye(e);return Yu(Tl(s,this.maskValue),-1)}call(e,t){return B(()=>{this.invokeCallHook(e,t);const s=ye(e),i=Yu(Tl(s,this.maskValue),-1,!0);return D(s,re(i,s.dtype))})}}Lb.className="Masking",Z(Lb);/** * @license * Copyright 2018 Google LLC * @@ -7808,7 +7808,7 @@ * license that can be found in the LICENSE file or at * https://opensource.org/licenses/MIT. * ============================================================================= - */class yo extends ve{constructor(e){super(e||{}),this.supportsMasking=!0}mergeFunction(e){throw new Ie}computeElementwiseOpOutputShape(e,t){if(e==null||t==null)return null;if(e.length1)throw new R(`Can not merge tensors with different batch sizes. Got tensors with shapes: ${JSON.stringify(e)}.`);let s=e[0]==null?null:e[0].slice(1);for(let r=1;rr.length);e.indexOf(null)===-1&&Ss(o).length===1?this.reshapeRequired=!1:this.reshapeRequired=!0}call(e,t){return B(()=>{if(e=e,this.reshapeRequired){const s=[],o=e.map(r=>r.rank);if(o.indexOf(null)===-1){const r=Ns(o);for(let i of e){const a=i.rank;for(let l=0;l1){const u=Rn(1,c).concat([0]);s.push(Ee(l,u)),r=!0}else s.push(l)}let i=this.mergeFunction(s);const a=i.rank;if(r){if(a==null){const l=i.shape,c=l.length,u=l[c-1],h=[u].concat(l.slice(0,l.length-1));i=O(Ee(O(i,[-1,u]),[1,0]),h)}else if(a>1){const l=[a-1].concat(Rn(0,a-1));i=Ee(i,l)}}return i}}else return this.mergeFunction(e)})}computeOutputShape(e){e=e;let t;e[0]==null?t=null:t=e[0].slice(1);for(let o=1;o{if(t==null)return null;if(!Array.isArray(t))throw new R("`mask` should be an Array");if(!Array.isArray(e))throw new R("`inputs` should be an Array");if(t.length!==e.length)throw new R(`The Array 'inputs' and 'mask' are expected to have the same length, but have different lengths (${e.length} vs ${t.length})`);if(t.every(o=>o==null))return null;t=t.map(o=>o==null?o:Gt(o,0));let s=t[0];for(let o=1;o{let t=e[0].clone();for(let s=1;s{let t=e[0].clone();for(let s=1;s{let t=e[0].clone();for(let s=1;s{let t=e[0];for(let s=1;s{let t=e[0];for(let s=1;s1)throw new R("A `Concatenate` layer requires inputs with matching shapes except for the concat axis. Got input shapes: "+JSON.stringify(e))}mergeFunction(e){return B(()=>Id(e,this.axis))}computeOutputShape(e){if(!(Array.isArray(e)&&Array.isArray(e[0])))throw new R("A `Concatenate` layer should be called on a list of inputs.");const t=e,s=t[0].slice(),o=this.axis<0?s.length+this.axis:this.axis;for(const r of t.slice(1)){if(s[o]==null||r[o]==null){s[o]=null;break}s[o]+=r[o]}return s}computeMask(e,t){if(t==null)return null;if(!Array.isArray(t))throw new R("`mask` should be an array for Concatenate");if(!Array.isArray(e))throw new R("`inputs` should be an array for Concatenate");if(t.length!==e.length)throw new R(`Mismatch in the length of mask (${t.length}) and the legnth of inputs (${e.length})`);return B(()=>{let s=!0;if(t.forEach(i=>{if(i!=null){s=!1;return}}),s)return null;const o=[];for(let i=0;i3||e.shape.length>3)throw new Ie("batchDot is not implemented for tensors of 4D or higher rank yet");if(v(n.shape.length>=2,()=>`batchDot requires the rank of x to be >= 2, but got ${n.shape.length}`),v(n.shape.length>=2,()=>`batchDot requires the rank of y to be >= 2, but got ${e.shape.length}`),typeof t=="number"&&(t=[t,t]),n.dtype==="complex64"||e.dtype==="complex64")throw new Ie("batchDot is not implemented for complex64-type Tensors yet.");const s=n.shape.length,o=e.shape.length;t==null&&(t=[s-1,o-2]);const r=t;return B(()=>{let i;if(s>o){i=s-o;const l=[];for(let c=0;cs){i=o-s;const l=[];for(let c=0;c0){let l;s>o?l=s+o-3:l=s-1;const c=[];for(let u=l;u"A `Dot` layer should be called on a list of exactly 2 inputs.");const t=e[0],s=e[1];if(t.length>3||s.length>3)throw new Ie("Dot layer does not support tensors of 4D or higher rank yet.");const o=this.interpretAxes(t,s);if(t[o[0]]!==s[o[1]])throw new R(`Dimension incompatibility: ${t[o[0]]} !== ${s[o[1]]}`)}mergeFunction(e){if(e.length!==2)throw new R(`A \`Dot\` layer must be called on exactly 2 inputs, but received ${e.length} input(s).`);let t=e[0],s=e[1],o;return Array.isArray(this.axes)?o=this.axes.map((r,i)=>qi(r,e[i].shape.length)):o=[qi(this.axes,t.shape.length),qi(this.axes,s.shape.length)],this.normalize&&(t=Gl(t,o[0]),s=Gl(s,o[1])),pR(t,s,o)}interpretAxes(e,t){let s;return Array.isArray(this.axes)?s=this.axes:s=[qi(this.axes,e.length),qi(this.axes,t.length)],s}computeOutputShape(e){v(Array.isArray(e)&&e.length===2&&Array.isArray(e[0])&&Array.isArray(e[1]),()=>"A `Dot` layer should be called on a list of exactly 2 inputs.");const t=e[0].slice(),s=e[1].slice();if(t.length>3||s.length>3)throw new Ie("Dot layer does not support tensors of 4D or higher rank yet.");const o=this.interpretAxes(t,s);t.splice(o[0],1),s.splice(o[1],1),s.splice(0,1);const r=t.concat(s);return r.length===1&&r.push(1),r}computeMask(e,t){return null}getConfig(){const e={axes:this.axes,normalize:this.normalize},t=super.getConfig();return Object.assign(e,t),e}}Gb.className="Dot",Z(Gb);/** + */class yo extends ve{constructor(e){super(e||{}),this.supportsMasking=!0}mergeFunction(e){throw new Ie}computeElementwiseOpOutputShape(e,t){if(e==null||t==null)return null;if(e.length1)throw new R(`Can not merge tensors with different batch sizes. Got tensors with shapes: ${JSON.stringify(e)}.`);let s=e[0]==null?null:e[0].slice(1);for(let r=1;rr.length);e.indexOf(null)===-1&&Ss(o).length===1?this.reshapeRequired=!1:this.reshapeRequired=!0}call(e,t){return B(()=>{if(e=e,this.reshapeRequired){const s=[],o=e.map(r=>r.rank);if(o.indexOf(null)===-1){const r=Ns(o);for(let i of e){const a=i.rank;for(let l=0;l1){const u=Rn(1,c).concat([0]);s.push(Ee(l,u)),r=!0}else s.push(l)}let i=this.mergeFunction(s);const a=i.rank;if(r){if(a==null){const l=i.shape,c=l.length,u=l[c-1],h=[u].concat(l.slice(0,l.length-1));i=O(Ee(O(i,[-1,u]),[1,0]),h)}else if(a>1){const l=[a-1].concat(Rn(0,a-1));i=Ee(i,l)}}return i}}else return this.mergeFunction(e)})}computeOutputShape(e){e=e;let t;e[0]==null?t=null:t=e[0].slice(1);for(let o=1;o{if(t==null)return null;if(!Array.isArray(t))throw new R("`mask` should be an Array");if(!Array.isArray(e))throw new R("`inputs` should be an Array");if(t.length!==e.length)throw new R(`The Array 'inputs' and 'mask' are expected to have the same length, but have different lengths (${e.length} vs ${t.length})`);if(t.every(o=>o==null))return null;t=t.map(o=>o==null?o:Gt(o,0));let s=t[0];for(let o=1;o{let t=e[0].clone();for(let s=1;s{let t=e[0].clone();for(let s=1;s{let t=e[0].clone();for(let s=1;s{let t=e[0];for(let s=1;s{let t=e[0];for(let s=1;s1)throw new R("A `Concatenate` layer requires inputs with matching shapes except for the concat axis. Got input shapes: "+JSON.stringify(e))}mergeFunction(e){return B(()=>wd(e,this.axis))}computeOutputShape(e){if(!(Array.isArray(e)&&Array.isArray(e[0])))throw new R("A `Concatenate` layer should be called on a list of inputs.");const t=e,s=t[0].slice(),o=this.axis<0?s.length+this.axis:this.axis;for(const r of t.slice(1)){if(s[o]==null||r[o]==null){s[o]=null;break}s[o]+=r[o]}return s}computeMask(e,t){if(t==null)return null;if(!Array.isArray(t))throw new R("`mask` should be an array for Concatenate");if(!Array.isArray(e))throw new R("`inputs` should be an array for Concatenate");if(t.length!==e.length)throw new R(`Mismatch in the length of mask (${t.length}) and the legnth of inputs (${e.length})`);return B(()=>{let s=!0;if(t.forEach(i=>{if(i!=null){s=!1;return}}),s)return null;const o=[];for(let i=0;i3||e.shape.length>3)throw new Ie("batchDot is not implemented for tensors of 4D or higher rank yet");if(k(n.shape.length>=2,()=>`batchDot requires the rank of x to be >= 2, but got ${n.shape.length}`),k(n.shape.length>=2,()=>`batchDot requires the rank of y to be >= 2, but got ${e.shape.length}`),typeof t=="number"&&(t=[t,t]),n.dtype==="complex64"||e.dtype==="complex64")throw new Ie("batchDot is not implemented for complex64-type Tensors yet.");const s=n.shape.length,o=e.shape.length;t==null&&(t=[s-1,o-2]);const r=t;return B(()=>{let i;if(s>o){i=s-o;const l=[];for(let c=0;cs){i=o-s;const l=[];for(let c=0;c0){let l;s>o?l=s+o-3:l=s-1;const c=[];for(let u=l;u"A `Dot` layer should be called on a list of exactly 2 inputs.");const t=e[0],s=e[1];if(t.length>3||s.length>3)throw new Ie("Dot layer does not support tensors of 4D or higher rank yet.");const o=this.interpretAxes(t,s);if(t[o[0]]!==s[o[1]])throw new R(`Dimension incompatibility: ${t[o[0]]} !== ${s[o[1]]}`)}mergeFunction(e){if(e.length!==2)throw new R(`A \`Dot\` layer must be called on exactly 2 inputs, but received ${e.length} input(s).`);let t=e[0],s=e[1],o;return Array.isArray(this.axes)?o=this.axes.map((r,i)=>qi(r,e[i].shape.length)):o=[qi(this.axes,t.shape.length),qi(this.axes,s.shape.length)],this.normalize&&(t=Gl(t,o[0]),s=Gl(s,o[1])),dR(t,s,o)}interpretAxes(e,t){let s;return Array.isArray(this.axes)?s=this.axes:s=[qi(this.axes,e.length),qi(this.axes,t.length)],s}computeOutputShape(e){k(Array.isArray(e)&&e.length===2&&Array.isArray(e[0])&&Array.isArray(e[1]),()=>"A `Dot` layer should be called on a list of exactly 2 inputs.");const t=e[0].slice(),s=e[1].slice();if(t.length>3||s.length>3)throw new Ie("Dot layer does not support tensors of 4D or higher rank yet.");const o=this.interpretAxes(t,s);t.splice(o[0],1),s.splice(o[1],1),s.splice(0,1);const r=t.concat(s);return r.length===1&&r.push(1),r}computeMask(e,t){return null}getConfig(){const e={axes:this.axes,normalize:this.normalize},t=super.getConfig();return Object.assign(e,t),e}}Gb.className="Dot",Z(Gb);/** * @license * Copyright 2018 Google LLC * @@ -7824,7 +7824,7 @@ * license that can be found in the LICENSE file or at * https://opensource.org/licenses/MIT. * ============================================================================= - */function ji(n,e,t,s,o,r=.001){let i;if(n.rank===2)i=BI(n,e,t,s,o,r);else if(n.rank===3)i=VI(n,e,t,s,o,r);else if(n.rank===4)i=UI(n,e,t,s,o,r);else throw new Ie(`batchNormalization is not implemented for array of rank ${n.rank} yet`);return i}function fR(n,e,t,s,o=.001){return B(()=>{const r=fh(n,s),i=r.mean,a=r.variance;return[ji(n,i,a,t,e,o),i,a]})}function mR(n,e,t,s,o=.001){return B(()=>{const r=fh(n,s),i=r.mean,a=r.variance,l=[];for(const f of Rn(0,n.rank))s.indexOf(f)!==-1?l.push(1):l.push(n.shape[f]);const c=O(i,l),u=O(a,l),h=e==null?null:O(e,l),d=t==null?null:O(t,l);return[ji(n,c,u,d,h,o),i,a]})}function gR(n,e,t,s,o=.001){return _e(s.slice().sort(),Rn(0,n.rank-1))?fR(n,e,t,s,o):mR(n,e,t,s,o)}class Kb extends ve{constructor(e){e==null&&(e={}),super(e),this.supportsMasking=!0,this.axis=e.axis==null?-1:e.axis,this.momentum=e.momentum==null?.99:e.momentum,this.epsilon=e.epsilon==null?.001:e.epsilon,this.center=e.center==null?!0:e.center,this.scale=e.scale==null?!0:e.scale,this.betaInitializer=je(e.betaInitializer||"zeros"),this.gammaInitializer=je(e.gammaInitializer||"ones"),this.movingMeanInitializer=je(e.movingMeanInitializer||"zeros"),this.movingVarianceInitializer=je(e.movingVarianceInitializer||"ones"),this.betaConstraint=ft(e.betaConstraint),this.gammaConstraint=ft(e.gammaConstraint),this.betaRegularizer=Ke(e.betaRegularizer),this.gammaRegularizer=Ke(e.gammaRegularizer)}build(e){e=Fe(e);const t=this.axis>=0?this.axis:this.axis+e.length,s=e[t];if(s==null)throw new R(`Axis ${t} of input tensor should have a defined dimension but the layer received an input with shape ${JSON.stringify(e)}.`);this.inputSpec=[new dt({ndim:e.length,axes:{[t]:s}})];const o=[s];this.scale&&(this.gamma=this.addWeight("gamma",o,null,this.gammaInitializer,this.gammaRegularizer,!0,this.gammaConstraint)),this.center&&(this.beta=this.addWeight("beta",o,null,this.betaInitializer,this.betaRegularizer,!0,this.betaConstraint)),this.movingMean=this.addWeight("moving_mean",o,null,this.movingMeanInitializer,null,!1),this.movingVariance=this.addWeight("moving_variance",o,null,this.movingVarianceInitializer,null,!1),this.built=!0}call(e,t){return B(()=>{const s=t.training==null?!1:t.training,o=ye(e),r=o.shape,i=r.length,a=Rn(0,i),l=this.axis>=0?this.axis:this.axis+i;a.splice(l,1);const c=po(1,i);c[l]=r[l];const u=a.slice();u.sort();const h=!_e(u,Rn(0,i).slice(0,i-1)),d=()=>{if(h){const b=O(this.movingMean.read(),c),w=O(this.movingVariance.read(),c),y=this.center?O(this.beta.read(),c):null,C=this.scale?O(this.gamma.read(),c):null;return ji(o,b,w,y,C,this.epsilon)}else return ji(o,this.movingMean.read(),this.movingVariance.read(),this.beta==null?null:this.beta.read(),this.gamma==null?null:this.gamma.read(),this.epsilon)};if(!s)return d();const[p,f,m]=gR(o,this.gamma.read(),this.beta.read(),a,this.epsilon),g=(b,w,y)=>{B(()=>{const C=1-y,I=b.read(),$=D(be(I,w),C);b.write(be(I,$))})};return(()=>{g(this.movingMean,f,this.momentum),g(this.movingVariance,m,this.momentum)})(),p})}getConfig(){const e={axis:this.axis,momentum:this.momentum,epsilon:this.epsilon,center:this.center,scale:this.scale,betaInitializer:Qe(this.betaInitializer),gammaInitializer:Qe(this.gammaInitializer),movingMeanInitializer:Qe(this.movingMeanInitializer),movingVarianceInitializer:Qe(this.movingVarianceInitializer),betaRegularizer:Be(this.betaRegularizer),gammaRegularizer:Be(this.gammaRegularizer),betaConstraint:pt(this.betaConstraint),gammaConstraint:pt(this.gammaConstraint)},t=super.getConfig();return Object.assign(e,t),e}}Kb.className="BatchNormalization",Z(Kb);class Xb extends ve{constructor(e){if(e==null&&(e={}),super(e),this.axis=e.axis==null?-1:e.axis,typeof this.axis=="number"){if(!Number.isInteger(this.axis))throw new Error(`Expected axis to be an integer, but received ${this.axis}`)}else if(Array.isArray(this.axis)){for(const t of this.axis)if(!Number.isInteger(t))throw new Error(`Expected axis to be an array of integers, but received ${JSON.stringify(this.axis)}`)}else throw new Error(`Expected axis to be an integer or an array of integers, but received ${JSON.stringify(this.axis)}`);this.epsilon=e.epsilon==null?.001:e.epsilon,this.center=e.center==null?!0:e.center,this.scale=e.scale==null?!0:e.scale,this.betaInitializer=je(e.betaInitializer||"zeros"),this.gammaInitializer=je(e.gammaInitializer||"ones"),this.betaRegularizer=Ke(e.betaRegularizer),this.gammaRegularizer=Ke(e.gammaRegularizer),this.supportsMasking=!0}build(e){e=Fe(e);const t=e.length;typeof this.axis=="number"&&(this.axis=[this.axis]);for(let r=0;r=t)throw new Error(`Invalid axis: ${r}`);if(this.axis.length!==Ss(this.axis).length)throw new Error(`Found duplicate axes in: ${this.axis}`);const s=this.axis.map(r=>e[r]),o=!0;this.scale?this.gamma=this.addWeight("gamma",s,"float32",this.gammaInitializer,this.gammaRegularizer,o):this.gamma=null,this.center?this.beta=this.addWeight("beta",s,"float32",this.betaInitializer,this.betaRegularizer,o):this.beta=null,this.built=!0}call(e,t){const s=ye(e),o=s.shape,r=o.length;return B(()=>{let{mean:a,variance:l}=fh(s,this.axis,!0);const c=po(1,r);for(const m of this.axis)c[m]=o[m];const u=m=>m!=null&&m.shape.length!==r?O(m,c):m;let h=this.scale?u(this.gamma.read()):null,d=this.center?u(this.beta.read()):null;const p=[],f=[];for(let m=0;m{const r=dh(n,s),i=r.mean,a=r.variance;return[ji(n,i,a,t,e,o),i,a]})}function fR(n,e,t,s,o=.001){return B(()=>{const r=dh(n,s),i=r.mean,a=r.variance,l=[];for(const f of Rn(0,n.rank))s.indexOf(f)!==-1?l.push(1):l.push(n.shape[f]);const c=O(i,l),u=O(a,l),h=e==null?null:O(e,l),d=t==null?null:O(t,l);return[ji(n,c,u,d,h,o),i,a]})}function mR(n,e,t,s,o=.001){return _e(s.slice().sort(),Rn(0,n.rank-1))?pR(n,e,t,s,o):fR(n,e,t,s,o)}class Kb extends ve{constructor(e){e==null&&(e={}),super(e),this.supportsMasking=!0,this.axis=e.axis==null?-1:e.axis,this.momentum=e.momentum==null?.99:e.momentum,this.epsilon=e.epsilon==null?.001:e.epsilon,this.center=e.center==null?!0:e.center,this.scale=e.scale==null?!0:e.scale,this.betaInitializer=je(e.betaInitializer||"zeros"),this.gammaInitializer=je(e.gammaInitializer||"ones"),this.movingMeanInitializer=je(e.movingMeanInitializer||"zeros"),this.movingVarianceInitializer=je(e.movingVarianceInitializer||"ones"),this.betaConstraint=ft(e.betaConstraint),this.gammaConstraint=ft(e.gammaConstraint),this.betaRegularizer=Ke(e.betaRegularizer),this.gammaRegularizer=Ke(e.gammaRegularizer)}build(e){e=Fe(e);const t=this.axis>=0?this.axis:this.axis+e.length,s=e[t];if(s==null)throw new R(`Axis ${t} of input tensor should have a defined dimension but the layer received an input with shape ${JSON.stringify(e)}.`);this.inputSpec=[new dt({ndim:e.length,axes:{[t]:s}})];const o=[s];this.scale&&(this.gamma=this.addWeight("gamma",o,null,this.gammaInitializer,this.gammaRegularizer,!0,this.gammaConstraint)),this.center&&(this.beta=this.addWeight("beta",o,null,this.betaInitializer,this.betaRegularizer,!0,this.betaConstraint)),this.movingMean=this.addWeight("moving_mean",o,null,this.movingMeanInitializer,null,!1),this.movingVariance=this.addWeight("moving_variance",o,null,this.movingVarianceInitializer,null,!1),this.built=!0}call(e,t){return B(()=>{const s=t.training==null?!1:t.training,o=ye(e),r=o.shape,i=r.length,a=Rn(0,i),l=this.axis>=0?this.axis:this.axis+i;a.splice(l,1);const c=po(1,i);c[l]=r[l];const u=a.slice();u.sort();const h=!_e(u,Rn(0,i).slice(0,i-1)),d=()=>{if(h){const b=O(this.movingMean.read(),c),w=O(this.movingVariance.read(),c),y=this.center?O(this.beta.read(),c):null,C=this.scale?O(this.gamma.read(),c):null;return ji(o,b,w,y,C,this.epsilon)}else return ji(o,this.movingMean.read(),this.movingVariance.read(),this.beta==null?null:this.beta.read(),this.gamma==null?null:this.gamma.read(),this.epsilon)};if(!s)return d();const[p,f,m]=mR(o,this.gamma.read(),this.beta.read(),a,this.epsilon),g=(b,w,y)=>{B(()=>{const C=1-y,I=b.read(),v=D(be(I,w),C);b.write(be(I,v))})};return(()=>{g(this.movingMean,f,this.momentum),g(this.movingVariance,m,this.momentum)})(),p})}getConfig(){const e={axis:this.axis,momentum:this.momentum,epsilon:this.epsilon,center:this.center,scale:this.scale,betaInitializer:Qe(this.betaInitializer),gammaInitializer:Qe(this.gammaInitializer),movingMeanInitializer:Qe(this.movingMeanInitializer),movingVarianceInitializer:Qe(this.movingVarianceInitializer),betaRegularizer:Be(this.betaRegularizer),gammaRegularizer:Be(this.gammaRegularizer),betaConstraint:pt(this.betaConstraint),gammaConstraint:pt(this.gammaConstraint)},t=super.getConfig();return Object.assign(e,t),e}}Kb.className="BatchNormalization",Z(Kb);class Xb extends ve{constructor(e){if(e==null&&(e={}),super(e),this.axis=e.axis==null?-1:e.axis,typeof this.axis=="number"){if(!Number.isInteger(this.axis))throw new Error(`Expected axis to be an integer, but received ${this.axis}`)}else if(Array.isArray(this.axis)){for(const t of this.axis)if(!Number.isInteger(t))throw new Error(`Expected axis to be an array of integers, but received ${JSON.stringify(this.axis)}`)}else throw new Error(`Expected axis to be an integer or an array of integers, but received ${JSON.stringify(this.axis)}`);this.epsilon=e.epsilon==null?.001:e.epsilon,this.center=e.center==null?!0:e.center,this.scale=e.scale==null?!0:e.scale,this.betaInitializer=je(e.betaInitializer||"zeros"),this.gammaInitializer=je(e.gammaInitializer||"ones"),this.betaRegularizer=Ke(e.betaRegularizer),this.gammaRegularizer=Ke(e.gammaRegularizer),this.supportsMasking=!0}build(e){e=Fe(e);const t=e.length;typeof this.axis=="number"&&(this.axis=[this.axis]);for(let r=0;r=t)throw new Error(`Invalid axis: ${r}`);if(this.axis.length!==Ss(this.axis).length)throw new Error(`Found duplicate axes in: ${this.axis}`);const s=this.axis.map(r=>e[r]),o=!0;this.scale?this.gamma=this.addWeight("gamma",s,"float32",this.gammaInitializer,this.gammaRegularizer,o):this.gamma=null,this.center?this.beta=this.addWeight("beta",s,"float32",this.betaInitializer,this.betaRegularizer,o):this.beta=null,this.built=!0}call(e,t){const s=ye(e),o=s.shape,r=o.length;return B(()=>{let{mean:a,variance:l}=dh(s,this.axis,!0);const c=po(1,r);for(const m of this.axis)c[m]=o[m];const u=m=>m!=null&&m.shape.length!==r?O(m,c):m;let h=this.scale?u(this.gamma.read()):null,d=this.center?u(this.beta.read()):null;const p=[],f=[];for(let m=0;m{if(n.rank!==4)throw new R(`temporalPadding expects input tensor to be 4-D, but received a ${n.rank}-D tensor.`);if(e==null&&(e=[[1,1],[1,1]]),e.length!==2||e[0].length!==2||e[1].length!==2)throw new R("spatial2dPadding expects `padding` to be an Array of two Arrays, each of which is an Array of two integers.");if(t==null&&(t=An()),t!=="channelsLast"&&t!=="channelsFirst")throw new R(`Unknown data format: ${t}. Supported data formats are 'channelsLast' and 'channelsFirst.`);let s;return t==="channelsFirst"?s=[[0,0],[0,0],e[0],e[1]]:s=[[0,0],e[0],e[1],[0,0]],mh(n,s)})}class Yb extends ve{constructor(e){if(e==null&&(e={}),super(e),this.dataFormat=e.dataFormat==null?An():e.dataFormat,e.padding==null)this.padding=[[1,1],[1,1]];else if(typeof e.padding=="number")this.padding=[[e.padding,e.padding],[e.padding,e.padding]];else{if(e.padding=e.padding,e.padding.length!==2)throw new R(`ZeroPadding2D expects padding to be a length-2 array, but received a length-${e.padding.length} array.`);let t,s;if(typeof e.padding[0]=="number")t=[e.padding[0],e.padding[0]],s=[e.padding[1],e.padding[1]];else{if(e.padding=e.padding,e.padding[0].length!==2)throw new R(`ZeroPadding2D expects height padding to be a length-2 array, but received a length-${e.padding[0].length} array.`);if(t=e.padding[0],e.padding[1].length!==2)throw new R(`ZeroPadding2D expects width padding to be a length-2 array, but received a length-${e.padding[1].length} array.`);s=e.padding[1]}this.padding=[t,s]}this.inputSpec=[new dt({ndim:4})]}computeOutputShape(e){e=Fe(e);let t,s;return this.dataFormat==="channelsFirst"?(e[2]!=null&&e[2]>=0?t=e[2]+this.padding[0][0]+this.padding[0][1]:t=null,e[3]!=null&&e[3]>=0?s=e[3]+this.padding[1][0]+this.padding[1][1]:s=null,[e[0],e[1],t,s]):(e[1]!=null&&e[1]>=0?t=e[1]+this.padding[0][0]+this.padding[0][1]:t=null,e[2]!=null&&e[2]>=0?s=e[2]+this.padding[1][0]+this.padding[1][1]:s=null,[e[0],t,s,e[3]])}call(e,t){return B(()=>xR(ye(e),this.padding,this.dataFormat))}getConfig(){const e={padding:this.padding,dataFormat:this.dataFormat},t=super.getConfig();return Object.assign(e,t),e}}Yb.className="ZeroPadding2D",Z(Yb);/** + */function gR(n,e,t){return B(()=>{if(n.rank!==4)throw new R(`temporalPadding expects input tensor to be 4-D, but received a ${n.rank}-D tensor.`);if(e==null&&(e=[[1,1],[1,1]]),e.length!==2||e[0].length!==2||e[1].length!==2)throw new R("spatial2dPadding expects `padding` to be an Array of two Arrays, each of which is an Array of two integers.");if(t==null&&(t=An()),t!=="channelsLast"&&t!=="channelsFirst")throw new R(`Unknown data format: ${t}. Supported data formats are 'channelsLast' and 'channelsFirst.`);let s;return t==="channelsFirst"?s=[[0,0],[0,0],e[0],e[1]]:s=[[0,0],e[0],e[1],[0,0]],ph(n,s)})}class Yb extends ve{constructor(e){if(e==null&&(e={}),super(e),this.dataFormat=e.dataFormat==null?An():e.dataFormat,e.padding==null)this.padding=[[1,1],[1,1]];else if(typeof e.padding=="number")this.padding=[[e.padding,e.padding],[e.padding,e.padding]];else{if(e.padding=e.padding,e.padding.length!==2)throw new R(`ZeroPadding2D expects padding to be a length-2 array, but received a length-${e.padding.length} array.`);let t,s;if(typeof e.padding[0]=="number")t=[e.padding[0],e.padding[0]],s=[e.padding[1],e.padding[1]];else{if(e.padding=e.padding,e.padding[0].length!==2)throw new R(`ZeroPadding2D expects height padding to be a length-2 array, but received a length-${e.padding[0].length} array.`);if(t=e.padding[0],e.padding[1].length!==2)throw new R(`ZeroPadding2D expects width padding to be a length-2 array, but received a length-${e.padding[1].length} array.`);s=e.padding[1]}this.padding=[t,s]}this.inputSpec=[new dt({ndim:4})]}computeOutputShape(e){e=Fe(e);let t,s;return this.dataFormat==="channelsFirst"?(e[2]!=null&&e[2]>=0?t=e[2]+this.padding[0][0]+this.padding[0][1]:t=null,e[3]!=null&&e[3]>=0?s=e[3]+this.padding[1][0]+this.padding[1][1]:s=null,[e[0],e[1],t,s]):(e[1]!=null&&e[1]>=0?t=e[1]+this.padding[0][0]+this.padding[0][1]:t=null,e[2]!=null&&e[2]>=0?s=e[2]+this.padding[1][0]+this.padding[1][1]:s=null,[e[0],t,s,e[3]])}call(e,t){return B(()=>gR(ye(e),this.padding,this.dataFormat))}getConfig(){const e={padding:this.padding,dataFormat:this.dataFormat},t=super.getConfig();return Object.assign(e,t),e}}Yb.className="ZeroPadding2D",Z(Yb);/** * @license * Copyright 2018 Google LLC * @@ -7840,7 +7840,7 @@ * license that can be found in the LICENSE file or at * https://opensource.org/licenses/MIT. * ============================================================================= - */function sc(n,e,t,s,o,r){return B(()=>{rt(o),jg(r),on(s),t==null&&(t=[1,1]),s==null&&(s="valid"),o==null&&(o=An()),r==null&&(r="max"),n=jd(n,o);let i;const a=s==="same"?"same":"valid";return r==="max"?i=ph(n,e,t,a):i=th(n,e,t,a),o==="channelsFirst"&&(i=Ee(i,[0,3,1,2])),i})}function Zb(n,e,t,s,o,r){return B(()=>{rt(o),jg(r),on(s),t==null&&(t=[1,1,1]),s==null&&(s="valid"),o==null&&(o=An()),r==null&&(r="max"),n=pb(n,o);let i;const a=s==="same"?"same":"valid";return r==="max"?i=Sk(n,e,t,a):i=EI(n,e,t,a),o==="channelsFirst"&&(i=Ee(i,[0,4,1,2,3])),i})}class Qb extends ve{constructor(e){if(e.poolSize==null&&(e.poolSize=2),super(e),typeof e.poolSize=="number")this.poolSize=[e.poolSize];else if(Array.isArray(e.poolSize)&&e.poolSize.length===1&&typeof e.poolSize[0]=="number")this.poolSize=e.poolSize;else throw new R(`poolSize for 1D convolutional layer must be a number or an Array of a single number, but received ${JSON.stringify(e.poolSize)}`);if(yt(this.poolSize,"poolSize"),e.strides==null)this.strides=this.poolSize;else if(typeof e.strides=="number")this.strides=[e.strides];else if(Array.isArray(e.strides)&&e.strides.length===1&&typeof e.strides[0]=="number")this.strides=e.strides;else throw new R(`strides for 1D convolutional layer must be a number or an Array of a single number, but received ${JSON.stringify(e.strides)}`);yt(this.strides,"strides"),this.padding=e.padding==null?"valid":e.padding,on(this.padding),this.inputSpec=[new dt({ndim:3})]}computeOutputShape(e){e=Fe(e);const t=On(e[1],this.poolSize[0],this.padding,this.strides[0]);return[e[0],t,e[2]]}call(e,t){return B(()=>{this.invokeCallHook(e,t),e=_i(ye(e),2);const s=this.poolingFunction(ye(e),[this.poolSize[0],1],[this.strides[0],1],this.padding,"channelsLast");return Xo(s,[2])})}getConfig(){const e={poolSize:this.poolSize,padding:this.padding,strides:this.strides},t=super.getConfig();return Object.assign(e,t),e}}class Jb extends Qb{constructor(e){super(e)}poolingFunction(e,t,s,o,r){return rt(r),on(o),sc(e,t,s,o,r,"max")}}Jb.className="MaxPooling1D",Z(Jb);class e0 extends Qb{constructor(e){super(e)}poolingFunction(e,t,s,o,r){return rt(r),on(o),sc(e,t,s,o,r,"avg")}}e0.className="AveragePooling1D",Z(e0);class t0 extends ve{constructor(e){if(e.poolSize==null&&(e.poolSize=[2,2]),super(e),this.poolSize=Array.isArray(e.poolSize)?e.poolSize:[e.poolSize,e.poolSize],e.strides==null)this.strides=this.poolSize;else if(Array.isArray(e.strides)){if(e.strides.length!==2)throw new R(`If the strides property of a 2D pooling layer is an Array, it is expected to have a length of 2, but received length ${e.strides.length}.`);this.strides=e.strides}else this.strides=[e.strides,e.strides];yt(this.poolSize,"poolSize"),yt(this.strides,"strides"),this.padding=e.padding==null?"valid":e.padding,this.dataFormat=e.dataFormat==null?"channelsLast":e.dataFormat,rt(this.dataFormat),on(this.padding),this.inputSpec=[new dt({ndim:4})]}computeOutputShape(e){e=Fe(e);let t=this.dataFormat==="channelsFirst"?e[2]:e[1],s=this.dataFormat==="channelsFirst"?e[3]:e[2];return t=On(t,this.poolSize[0],this.padding,this.strides[0]),s=On(s,this.poolSize[1],this.padding,this.strides[1]),this.dataFormat==="channelsFirst"?[e[0],e[1],t,s]:[e[0],t,s,e[3]]}call(e,t){return B(()=>(this.invokeCallHook(e,t),this.poolingFunction(ye(e),this.poolSize,this.strides,this.padding,this.dataFormat)))}getConfig(){const e={poolSize:this.poolSize,padding:this.padding,strides:this.strides,dataFormat:this.dataFormat},t=super.getConfig();return Object.assign(e,t),e}}class n0 extends t0{constructor(e){super(e)}poolingFunction(e,t,s,o,r){return rt(r),on(o),sc(e,t,s,o,r,"max")}}n0.className="MaxPooling2D",Z(n0);class s0 extends t0{constructor(e){super(e)}poolingFunction(e,t,s,o,r){return rt(r),on(o),sc(e,t,s,o,r,"avg")}}s0.className="AveragePooling2D",Z(s0);class o0 extends ve{constructor(e){if(e.poolSize==null&&(e.poolSize=[2,2,2]),super(e),this.poolSize=Array.isArray(e.poolSize)?e.poolSize:[e.poolSize,e.poolSize,e.poolSize],e.strides==null)this.strides=this.poolSize;else if(Array.isArray(e.strides)){if(e.strides.length!==3)throw new R(`If the strides property of a 3D pooling layer is an Array, it is expected to have a length of 3, but received length ${e.strides.length}.`);this.strides=e.strides}else this.strides=[e.strides,e.strides,e.strides];yt(this.poolSize,"poolSize"),yt(this.strides,"strides"),this.padding=e.padding==null?"valid":e.padding,this.dataFormat=e.dataFormat==null?"channelsLast":e.dataFormat,rt(this.dataFormat),on(this.padding),this.inputSpec=[new dt({ndim:5})]}computeOutputShape(e){e=Fe(e);let t=this.dataFormat==="channelsFirst"?e[2]:e[1],s=this.dataFormat==="channelsFirst"?e[3]:e[2],o=this.dataFormat==="channelsFirst"?e[4]:e[3];return t=On(t,this.poolSize[0],this.padding,this.strides[0]),s=On(s,this.poolSize[1],this.padding,this.strides[1]),o=On(o,this.poolSize[2],this.padding,this.strides[2]),this.dataFormat==="channelsFirst"?[e[0],e[1],t,s,o]:[e[0],t,s,o,e[4]]}call(e,t){return B(()=>(this.invokeCallHook(e,t),this.poolingFunction(ye(e),this.poolSize,this.strides,this.padding,this.dataFormat)))}getConfig(){const e={poolSize:this.poolSize,padding:this.padding,strides:this.strides,dataFormat:this.dataFormat},t=super.getConfig();return Object.assign(e,t),e}}class r0 extends o0{constructor(e){super(e)}poolingFunction(e,t,s,o,r){return rt(r),on(o),Zb(e,t,s,o,r,"max")}}r0.className="MaxPooling3D",Z(r0);class i0 extends o0{constructor(e){super(e)}poolingFunction(e,t,s,o,r){return rt(r),on(o),Zb(e,t,s,o,r,"avg")}}i0.className="AveragePooling3D",Z(i0);class a0 extends ve{constructor(e){super(e),this.inputSpec=[new dt({ndim:3})]}computeOutputShape(e){return[e[0],e[2]]}call(e,t){throw new Ie}}class l0 extends a0{constructor(e){super(e||{})}call(e,t){return B(()=>{const s=ye(e);return lt(s,1)})}}l0.className="GlobalAveragePooling1D",Z(l0);class c0 extends a0{constructor(e){super(e||{})}call(e,t){return B(()=>{const s=ye(e);return Sn(s,1)})}}c0.className="GlobalMaxPooling1D",Z(c0);class u0 extends ve{constructor(e){super(e),this.dataFormat=e.dataFormat==null?"channelsLast":e.dataFormat,rt(this.dataFormat),this.inputSpec=[new dt({ndim:4})]}computeOutputShape(e){return e=e,this.dataFormat==="channelsLast"?[e[0],e[3]]:[e[0],e[1]]}call(e,t){throw new Ie}getConfig(){const e={dataFormat:this.dataFormat},t=super.getConfig();return Object.assign(e,t),e}}class h0 extends u0{call(e,t){return B(()=>{const s=ye(e);return this.dataFormat==="channelsLast"?lt(s,[1,2]):lt(s,[2,3])})}}h0.className="GlobalAveragePooling2D",Z(h0);class d0 extends u0{call(e,t){return B(()=>{const s=ye(e);return this.dataFormat==="channelsLast"?Sn(s,[1,2]):Sn(s,[2,3])})}}d0.className="GlobalMaxPooling2D",Z(d0);/** + */function sc(n,e,t,s,o,r){return B(()=>{rt(o),jg(r),on(s),t==null&&(t=[1,1]),s==null&&(s="valid"),o==null&&(o=An()),r==null&&(r="max"),n=Hd(n,o);let i;const a=s==="same"?"same":"valid";return r==="max"?i=hh(n,e,t,a):i=Ju(n,e,t,a),o==="channelsFirst"&&(i=Ee(i,[0,3,1,2])),i})}function Zb(n,e,t,s,o,r){return B(()=>{rt(o),jg(r),on(s),t==null&&(t=[1,1,1]),s==null&&(s="valid"),o==null&&(o=An()),r==null&&(r="max"),n=pb(n,o);let i;const a=s==="same"?"same":"valid";return r==="max"?i=vk(n,e,t,a):i=NI(n,e,t,a),o==="channelsFirst"&&(i=Ee(i,[0,4,1,2,3])),i})}class Qb extends ve{constructor(e){if(e.poolSize==null&&(e.poolSize=2),super(e),typeof e.poolSize=="number")this.poolSize=[e.poolSize];else if(Array.isArray(e.poolSize)&&e.poolSize.length===1&&typeof e.poolSize[0]=="number")this.poolSize=e.poolSize;else throw new R(`poolSize for 1D convolutional layer must be a number or an Array of a single number, but received ${JSON.stringify(e.poolSize)}`);if(yt(this.poolSize,"poolSize"),e.strides==null)this.strides=this.poolSize;else if(typeof e.strides=="number")this.strides=[e.strides];else if(Array.isArray(e.strides)&&e.strides.length===1&&typeof e.strides[0]=="number")this.strides=e.strides;else throw new R(`strides for 1D convolutional layer must be a number or an Array of a single number, but received ${JSON.stringify(e.strides)}`);yt(this.strides,"strides"),this.padding=e.padding==null?"valid":e.padding,on(this.padding),this.inputSpec=[new dt({ndim:3})]}computeOutputShape(e){e=Fe(e);const t=On(e[1],this.poolSize[0],this.padding,this.strides[0]);return[e[0],t,e[2]]}call(e,t){return B(()=>{this.invokeCallHook(e,t),e=_i(ye(e),2);const s=this.poolingFunction(ye(e),[this.poolSize[0],1],[this.strides[0],1],this.padding,"channelsLast");return Xo(s,[2])})}getConfig(){const e={poolSize:this.poolSize,padding:this.padding,strides:this.strides},t=super.getConfig();return Object.assign(e,t),e}}class Jb extends Qb{constructor(e){super(e)}poolingFunction(e,t,s,o,r){return rt(r),on(o),sc(e,t,s,o,r,"max")}}Jb.className="MaxPooling1D",Z(Jb);class e0 extends Qb{constructor(e){super(e)}poolingFunction(e,t,s,o,r){return rt(r),on(o),sc(e,t,s,o,r,"avg")}}e0.className="AveragePooling1D",Z(e0);class t0 extends ve{constructor(e){if(e.poolSize==null&&(e.poolSize=[2,2]),super(e),this.poolSize=Array.isArray(e.poolSize)?e.poolSize:[e.poolSize,e.poolSize],e.strides==null)this.strides=this.poolSize;else if(Array.isArray(e.strides)){if(e.strides.length!==2)throw new R(`If the strides property of a 2D pooling layer is an Array, it is expected to have a length of 2, but received length ${e.strides.length}.`);this.strides=e.strides}else this.strides=[e.strides,e.strides];yt(this.poolSize,"poolSize"),yt(this.strides,"strides"),this.padding=e.padding==null?"valid":e.padding,this.dataFormat=e.dataFormat==null?"channelsLast":e.dataFormat,rt(this.dataFormat),on(this.padding),this.inputSpec=[new dt({ndim:4})]}computeOutputShape(e){e=Fe(e);let t=this.dataFormat==="channelsFirst"?e[2]:e[1],s=this.dataFormat==="channelsFirst"?e[3]:e[2];return t=On(t,this.poolSize[0],this.padding,this.strides[0]),s=On(s,this.poolSize[1],this.padding,this.strides[1]),this.dataFormat==="channelsFirst"?[e[0],e[1],t,s]:[e[0],t,s,e[3]]}call(e,t){return B(()=>(this.invokeCallHook(e,t),this.poolingFunction(ye(e),this.poolSize,this.strides,this.padding,this.dataFormat)))}getConfig(){const e={poolSize:this.poolSize,padding:this.padding,strides:this.strides,dataFormat:this.dataFormat},t=super.getConfig();return Object.assign(e,t),e}}class n0 extends t0{constructor(e){super(e)}poolingFunction(e,t,s,o,r){return rt(r),on(o),sc(e,t,s,o,r,"max")}}n0.className="MaxPooling2D",Z(n0);class s0 extends t0{constructor(e){super(e)}poolingFunction(e,t,s,o,r){return rt(r),on(o),sc(e,t,s,o,r,"avg")}}s0.className="AveragePooling2D",Z(s0);class o0 extends ve{constructor(e){if(e.poolSize==null&&(e.poolSize=[2,2,2]),super(e),this.poolSize=Array.isArray(e.poolSize)?e.poolSize:[e.poolSize,e.poolSize,e.poolSize],e.strides==null)this.strides=this.poolSize;else if(Array.isArray(e.strides)){if(e.strides.length!==3)throw new R(`If the strides property of a 3D pooling layer is an Array, it is expected to have a length of 3, but received length ${e.strides.length}.`);this.strides=e.strides}else this.strides=[e.strides,e.strides,e.strides];yt(this.poolSize,"poolSize"),yt(this.strides,"strides"),this.padding=e.padding==null?"valid":e.padding,this.dataFormat=e.dataFormat==null?"channelsLast":e.dataFormat,rt(this.dataFormat),on(this.padding),this.inputSpec=[new dt({ndim:5})]}computeOutputShape(e){e=Fe(e);let t=this.dataFormat==="channelsFirst"?e[2]:e[1],s=this.dataFormat==="channelsFirst"?e[3]:e[2],o=this.dataFormat==="channelsFirst"?e[4]:e[3];return t=On(t,this.poolSize[0],this.padding,this.strides[0]),s=On(s,this.poolSize[1],this.padding,this.strides[1]),o=On(o,this.poolSize[2],this.padding,this.strides[2]),this.dataFormat==="channelsFirst"?[e[0],e[1],t,s,o]:[e[0],t,s,o,e[4]]}call(e,t){return B(()=>(this.invokeCallHook(e,t),this.poolingFunction(ye(e),this.poolSize,this.strides,this.padding,this.dataFormat)))}getConfig(){const e={poolSize:this.poolSize,padding:this.padding,strides:this.strides,dataFormat:this.dataFormat},t=super.getConfig();return Object.assign(e,t),e}}class r0 extends o0{constructor(e){super(e)}poolingFunction(e,t,s,o,r){return rt(r),on(o),Zb(e,t,s,o,r,"max")}}r0.className="MaxPooling3D",Z(r0);class i0 extends o0{constructor(e){super(e)}poolingFunction(e,t,s,o,r){return rt(r),on(o),Zb(e,t,s,o,r,"avg")}}i0.className="AveragePooling3D",Z(i0);class a0 extends ve{constructor(e){super(e),this.inputSpec=[new dt({ndim:3})]}computeOutputShape(e){return[e[0],e[2]]}call(e,t){throw new Ie}}class l0 extends a0{constructor(e){super(e||{})}call(e,t){return B(()=>{const s=ye(e);return lt(s,1)})}}l0.className="GlobalAveragePooling1D",Z(l0);class c0 extends a0{constructor(e){super(e||{})}call(e,t){return B(()=>{const s=ye(e);return Sn(s,1)})}}c0.className="GlobalMaxPooling1D",Z(c0);class u0 extends ve{constructor(e){super(e),this.dataFormat=e.dataFormat==null?"channelsLast":e.dataFormat,rt(this.dataFormat),this.inputSpec=[new dt({ndim:4})]}computeOutputShape(e){return e=e,this.dataFormat==="channelsLast"?[e[0],e[3]]:[e[0],e[1]]}call(e,t){throw new Ie}getConfig(){const e={dataFormat:this.dataFormat},t=super.getConfig();return Object.assign(e,t),e}}class h0 extends u0{call(e,t){return B(()=>{const s=ye(e);return this.dataFormat==="channelsLast"?lt(s,[1,2]):lt(s,[2,3])})}}h0.className="GlobalAveragePooling2D",Z(h0);class d0 extends u0{call(e,t){return B(()=>{const s=ye(e);return this.dataFormat==="channelsLast"?Sn(s,[1,2]):Sn(s,[2,3])})}}d0.className="GlobalMaxPooling2D",Z(d0);/** * @license * Copyright 2018 Google LLC * @@ -7848,7 +7848,7 @@ * license that can be found in the LICENSE file or at * https://opensource.org/licenses/MIT. * ============================================================================= - */class p0 extends ve{constructor(e){super(e),this.layer=e.layer}build(e){this.built=!0}get trainable(){return this.layer!=null?this.layer.trainable:!1}set trainable(e){this.layer!=null&&(this.layer.trainable=e)}get trainableWeights(){return this.layer.trainableWeights}get nonTrainableWeights(){return this.layer.nonTrainableWeights}get updates(){return this.layer._updates}get losses(){return this.layer.losses}getWeights(){return this.layer.getWeights()}setWeights(e){this.layer.setWeights(e)}getConfig(){const e={layer:{className:this.layer.getClassName(),config:this.layer.getConfig()}},t=super.getConfig();return Object.assign(e,t),e}setFastWeightInitDuringBuild(e){super.setFastWeightInitDuringBuild(e),this.layer!=null&&this.layer.setFastWeightInitDuringBuild(e)}static fromConfig(e,t,s={}){const o=t.layer,r=Zn(o,s);delete t.layer;const i={layer:r};return Object.assign(i,t),new e(i)}}class f0 extends p0{constructor(e){super(e),this.supportsMasking=!0}build(e){if(e=Fe(e),e.length<3)throw new R(`TimeDistributed layer expects an input shape >= 3D, but received input shape ${JSON.stringify(e)}`);this.inputSpec=[{shape:e}];const t=[e[0]].concat(e.slice(2));this.layer.built||(this.layer.build(t),this.layer.built=!0),super.build(e)}computeOutputShape(e){e=Fe(e);const t=[e[0]].concat(e.slice(2)),s=this.layer.computeOutputShape(t),o=e[1];return[s[0],o].concat(s.slice(1))}call(e,t){return B(()=>(e=ye(e),$b((i,a)=>[ye(this.layer.call(i,t)),[]],e,[],!1,null,null,!1,!0)[1]))}}f0.className="TimeDistributed",Z(f0);function bR(n){mo(MN,"BidirectionalMergeMode",n)}const yR="concat";class m0 extends p0{constructor(e){super(e);const t=e.layer.getConfig(),s={};s.className=e.layer.getClassName(),s.config=t,this.forwardLayer=Zn(s),t.goBackwards=t.goBackwards!==!0;const o={};if(o.className=e.layer.getClassName(),o.config=t,this.backwardLayer=Zn(o),this.forwardLayer.name="forward_"+this.forwardLayer.name,this.backwardLayer.name="backward_"+this.backwardLayer.name,this.mergeMode=e.mergeMode===void 0?yR:e.mergeMode,bR(this.mergeMode),e.weights)throw new Ie("weights support is not implemented for Bidirectional layer yet.");this._stateful=e.layer.stateful,this.returnSequences=e.layer.returnSequences,this.returnState=e.layer.returnState,this.supportsMasking=!0,this._trainable=!0,this.inputSpec=e.layer.inputSpec,this.numConstants=null}get trainable(){return this._trainable}set trainable(e){this._trainable=e,this.forwardLayer!=null&&(this.forwardLayer.trainable=e),this.backwardLayer!=null&&(this.backwardLayer.trainable=e)}getWeights(){return this.forwardLayer.getWeights().concat(this.backwardLayer.getWeights())}setWeights(e){const t=e.length,s=Math.floor(t/2);this.forwardLayer.setWeights(e.slice(0,s)),this.backwardLayer.setWeights(e.slice(s))}computeOutputShape(e){let t=this.forwardLayer.computeOutputShape(e);Array.isArray(t)&&Array.isArray(t[0])||(t=[t]),t=t;let s,o,r;return this.returnState&&(r=t.slice(1)),s=t[0],s=s,this.mergeMode==="concat"?(s[s.length-1]*=2,o=[s]):this.mergeMode==null?o=[s,s.slice()]:o=[s],this.returnState?this.mergeMode==null?o.concat(r).concat(r.slice()):[s].concat(r).concat(r.slice()):Ht(o)}apply(e,t){let s=t==null?null:t.initialState,o=t==null?null:t.constants;t==null&&(t={});const r=Ib(e,s,o,this.numConstants);if(e=r.inputs,s=r.initialState,o=r.constants,Array.isArray(e)&&(s=e.slice(1),e=e[0]),(s==null||s.length===0)&&o==null)return super.apply(e,t);const i=[],a=[];if(s!=null){const c=s.length;if(c%2>0)throw new R("When passing `initialState` to a Bidrectional RNN, the state should be an Array containing the states of the underlying RNNs.");t.initialState=s,i.push(...s);const u=s.map(h=>new dt({shape:h.shape}));this.forwardLayer.stateSpec=u.slice(0,c/2),this.backwardLayer.stateSpec=u.slice(c/2),a.push(...u)}if(o!=null)throw new Ie("Support for constants in Bidirectional layers is not implemented yet.");const l=i[0]instanceof Yn;for(const c of i)if(c instanceof Yn!==l)throw new R("The initial state of a Bidirectional layer cannot be specified as a mix of symbolic and non-symbolic tensors");if(l){const c=[e].concat(i),u=this.inputSpec.concat(a),h=this.inputSpec;this.inputSpec=u;const d=super.apply(c,t);return this.inputSpec=h,d}else return super.apply(e,t)}call(e,t){return B(()=>{const s=t.initialState;let o,r;if(s==null)o=this.forwardLayer.call(e,t),r=this.backwardLayer.call(e,t);else{const l=s.slice(0,s.length/2),c=s.slice(s.length/2);o=this.forwardLayer.call(e,Object.assign(t,{initialState:l})),r=this.backwardLayer.call(e,Object.assign(t,{initialState:c}))}let i;this.returnState&&(Array.isArray(o)&&(i=o.slice(1).concat(r.slice(1))),o=o[0],r=r[0]),this.returnSequences&&(r=uo(r,1));let a;return this.mergeMode==="concat"?a=Id([o,r]):this.mergeMode==="sum"?a=J(o,r):this.mergeMode==="ave"?a=D(.5,J(o,r)):this.mergeMode==="mul"?a=D(o,r):this.mergeMode==null&&(a=[o,r]),this.returnState?this.mergeMode==null?a.concat(i):[a].concat(i):a})}resetStates(e){this.forwardLayer.resetStates(),this.backwardLayer.resetStates()}build(e){go(this.forwardLayer.name,()=>{this.forwardLayer.build(e)}),go(this.backwardLayer.name,()=>{this.backwardLayer.build(e)}),this.built=!0}computeMask(e,t){Array.isArray(t)&&(t=t[0]);let s;if(this.returnSequences?this.mergeMode==null?s=[t,t]:s=t:this.mergeMode==null?s=[null,null]:s=null,this.returnState){const r=this.forwardLayer.states.map(i=>null);return Array.isArray(s)?s.concat(r).concat(r):[s].concat(r).concat(r)}else return s}get trainableWeights(){return this.forwardLayer.trainableWeights.concat(this.backwardLayer.trainableWeights)}get nonTrainableWeights(){return this.forwardLayer.nonTrainableWeights.concat(this.backwardLayer.nonTrainableWeights)}setFastWeightInitDuringBuild(e){super.setFastWeightInitDuringBuild(e),this.forwardLayer!=null&&this.forwardLayer.setFastWeightInitDuringBuild(e),this.backwardLayer!=null&&this.backwardLayer.setFastWeightInitDuringBuild(e)}getConfig(){const e={mergeMode:this.mergeMode},t=super.getConfig();return Object.assign(e,t),e}static fromConfig(e,t){const s=Zn(t.layer);if(delete t.layer,t.numConstants!=null)throw new Ie("Deserialization of a Bidirectional layer with numConstants present is not supported yet.");const o=t;return o.layer=s,new e(o)}}m0.className="Bidirectional",Z(m0);/** + */class p0 extends ve{constructor(e){super(e),this.layer=e.layer}build(e){this.built=!0}get trainable(){return this.layer!=null?this.layer.trainable:!1}set trainable(e){this.layer!=null&&(this.layer.trainable=e)}get trainableWeights(){return this.layer.trainableWeights}get nonTrainableWeights(){return this.layer.nonTrainableWeights}get updates(){return this.layer._updates}get losses(){return this.layer.losses}getWeights(){return this.layer.getWeights()}setWeights(e){this.layer.setWeights(e)}getConfig(){const e={layer:{className:this.layer.getClassName(),config:this.layer.getConfig()}},t=super.getConfig();return Object.assign(e,t),e}setFastWeightInitDuringBuild(e){super.setFastWeightInitDuringBuild(e),this.layer!=null&&this.layer.setFastWeightInitDuringBuild(e)}static fromConfig(e,t,s={}){const o=t.layer,r=Zn(o,s);delete t.layer;const i={layer:r};return Object.assign(i,t),new e(i)}}class f0 extends p0{constructor(e){super(e),this.supportsMasking=!0}build(e){if(e=Fe(e),e.length<3)throw new R(`TimeDistributed layer expects an input shape >= 3D, but received input shape ${JSON.stringify(e)}`);this.inputSpec=[{shape:e}];const t=[e[0]].concat(e.slice(2));this.layer.built||(this.layer.build(t),this.layer.built=!0),super.build(e)}computeOutputShape(e){e=Fe(e);const t=[e[0]].concat(e.slice(2)),s=this.layer.computeOutputShape(t),o=e[1];return[s[0],o].concat(s.slice(1))}call(e,t){return B(()=>(e=ye(e),$b((i,a)=>[ye(this.layer.call(i,t)),[]],e,[],!1,null,null,!1,!0)[1]))}}f0.className="TimeDistributed",Z(f0);function xR(n){mo(LN,"BidirectionalMergeMode",n)}const bR="concat";class m0 extends p0{constructor(e){super(e);const t=e.layer.getConfig(),s={};s.className=e.layer.getClassName(),s.config=t,this.forwardLayer=Zn(s),t.goBackwards=t.goBackwards!==!0;const o={};if(o.className=e.layer.getClassName(),o.config=t,this.backwardLayer=Zn(o),this.forwardLayer.name="forward_"+this.forwardLayer.name,this.backwardLayer.name="backward_"+this.backwardLayer.name,this.mergeMode=e.mergeMode===void 0?bR:e.mergeMode,xR(this.mergeMode),e.weights)throw new Ie("weights support is not implemented for Bidirectional layer yet.");this._stateful=e.layer.stateful,this.returnSequences=e.layer.returnSequences,this.returnState=e.layer.returnState,this.supportsMasking=!0,this._trainable=!0,this.inputSpec=e.layer.inputSpec,this.numConstants=null}get trainable(){return this._trainable}set trainable(e){this._trainable=e,this.forwardLayer!=null&&(this.forwardLayer.trainable=e),this.backwardLayer!=null&&(this.backwardLayer.trainable=e)}getWeights(){return this.forwardLayer.getWeights().concat(this.backwardLayer.getWeights())}setWeights(e){const t=e.length,s=Math.floor(t/2);this.forwardLayer.setWeights(e.slice(0,s)),this.backwardLayer.setWeights(e.slice(s))}computeOutputShape(e){let t=this.forwardLayer.computeOutputShape(e);Array.isArray(t)&&Array.isArray(t[0])||(t=[t]),t=t;let s,o,r;return this.returnState&&(r=t.slice(1)),s=t[0],s=s,this.mergeMode==="concat"?(s[s.length-1]*=2,o=[s]):this.mergeMode==null?o=[s,s.slice()]:o=[s],this.returnState?this.mergeMode==null?o.concat(r).concat(r.slice()):[s].concat(r).concat(r.slice()):Ht(o)}apply(e,t){let s=t==null?null:t.initialState,o=t==null?null:t.constants;t==null&&(t={});const r=Ib(e,s,o,this.numConstants);if(e=r.inputs,s=r.initialState,o=r.constants,Array.isArray(e)&&(s=e.slice(1),e=e[0]),(s==null||s.length===0)&&o==null)return super.apply(e,t);const i=[],a=[];if(s!=null){const c=s.length;if(c%2>0)throw new R("When passing `initialState` to a Bidrectional RNN, the state should be an Array containing the states of the underlying RNNs.");t.initialState=s,i.push(...s);const u=s.map(h=>new dt({shape:h.shape}));this.forwardLayer.stateSpec=u.slice(0,c/2),this.backwardLayer.stateSpec=u.slice(c/2),a.push(...u)}if(o!=null)throw new Ie("Support for constants in Bidirectional layers is not implemented yet.");const l=i[0]instanceof Yn;for(const c of i)if(c instanceof Yn!==l)throw new R("The initial state of a Bidirectional layer cannot be specified as a mix of symbolic and non-symbolic tensors");if(l){const c=[e].concat(i),u=this.inputSpec.concat(a),h=this.inputSpec;this.inputSpec=u;const d=super.apply(c,t);return this.inputSpec=h,d}else return super.apply(e,t)}call(e,t){return B(()=>{const s=t.initialState;let o,r;if(s==null)o=this.forwardLayer.call(e,t),r=this.backwardLayer.call(e,t);else{const l=s.slice(0,s.length/2),c=s.slice(s.length/2);o=this.forwardLayer.call(e,Object.assign(t,{initialState:l})),r=this.backwardLayer.call(e,Object.assign(t,{initialState:c}))}let i;this.returnState&&(Array.isArray(o)&&(i=o.slice(1).concat(r.slice(1))),o=o[0],r=r[0]),this.returnSequences&&(r=uo(r,1));let a;return this.mergeMode==="concat"?a=wd([o,r]):this.mergeMode==="sum"?a=J(o,r):this.mergeMode==="ave"?a=D(.5,J(o,r)):this.mergeMode==="mul"?a=D(o,r):this.mergeMode==null&&(a=[o,r]),this.returnState?this.mergeMode==null?a.concat(i):[a].concat(i):a})}resetStates(e){this.forwardLayer.resetStates(),this.backwardLayer.resetStates()}build(e){go(this.forwardLayer.name,()=>{this.forwardLayer.build(e)}),go(this.backwardLayer.name,()=>{this.backwardLayer.build(e)}),this.built=!0}computeMask(e,t){Array.isArray(t)&&(t=t[0]);let s;if(this.returnSequences?this.mergeMode==null?s=[t,t]:s=t:this.mergeMode==null?s=[null,null]:s=null,this.returnState){const r=this.forwardLayer.states.map(i=>null);return Array.isArray(s)?s.concat(r).concat(r):[s].concat(r).concat(r)}else return s}get trainableWeights(){return this.forwardLayer.trainableWeights.concat(this.backwardLayer.trainableWeights)}get nonTrainableWeights(){return this.forwardLayer.nonTrainableWeights.concat(this.backwardLayer.nonTrainableWeights)}setFastWeightInitDuringBuild(e){super.setFastWeightInitDuringBuild(e),this.forwardLayer!=null&&this.forwardLayer.setFastWeightInitDuringBuild(e),this.backwardLayer!=null&&this.backwardLayer.setFastWeightInitDuringBuild(e)}getConfig(){const e={mergeMode:this.mergeMode},t=super.getConfig();return Object.assign(e,t),e}static fromConfig(e,t){const s=Zn(t.layer);if(delete t.layer,t.numConstants!=null)throw new Ie("Deserialization of a Bidirectional layer with numConstants present is not supported yet.");const o=t;return o.layer=s,new e(o)}}m0.className="Bidirectional",Z(m0);/** * @license * Copyright 2022 CodeSmith LLC * @@ -7864,7 +7864,7 @@ * license that can be found in the LICENSE file or at * https://opensource.org/licenses/MIT. * ============================================================================= - */const{resizeBilinear:wR,cropAndResize:CR}=ls;class x0 extends ve{constructor(e){super(e),this.height=e.height,this.width=e.width}centerCrop(e,t,s,o,r,i,a,l){return B(()=>{let c,u=!1;const h=t/i,d=s/a,p=(o+t)/i,f=(r+s)/a,m=[h,d,p,f],g=[];e.rank===3?(u=!0,c=Un([e])):c=e;for(let C=0;C{const r=wR(e,[t,s]);return Kn(r,o)})}call(e,t){return B(()=>{const s=ye(e),o=s.dtype,r=s.shape,i=r[r.length-3],a=r[r.length-2];let l=0;i!==this.height&&(l=Math.floor((i-this.height)/2));let c=0;return a!==this.width&&(c=Math.floor((a-this.width)/2),c===0&&(c=1)),l>=0&&c>=0?this.centerCrop(s,l,c,this.height,this.width,i,a,o):this.upsize(e,this.height,this.width,o)})}getConfig(){const e={height:this.height,width:this.width},t=super.getConfig();return Object.assign(e,t),e}computeOutputShape(e){e=Fe(e);const t=e.length-3,s=e.length-2;return e[t]=this.height,e[s]=this.width,e}}x0.className="CenterCrop",Z(x0);/** + */const{resizeBilinear:yR,cropAndResize:wR}=ls;class x0 extends ve{constructor(e){super(e),this.height=e.height,this.width=e.width}centerCrop(e,t,s,o,r,i,a,l){return B(()=>{let c,u=!1;const h=t/i,d=s/a,p=(o+t)/i,f=(r+s)/a,m=[h,d,p,f],g=[];e.rank===3?(u=!0,c=Un([e])):c=e;for(let C=0;C{const r=yR(e,[t,s]);return Kn(r,o)})}call(e,t){return B(()=>{const s=ye(e),o=s.dtype,r=s.shape,i=r[r.length-3],a=r[r.length-2];let l=0;i!==this.height&&(l=Math.floor((i-this.height)/2));let c=0;return a!==this.width&&(c=Math.floor((a-this.width)/2),c===0&&(c=1)),l>=0&&c>=0?this.centerCrop(s,l,c,this.height,this.width,i,a,o):this.upsize(e,this.height,this.width,o)})}getConfig(){const e={height:this.height,width:this.width},t=super.getConfig();return Object.assign(e,t),e}computeOutputShape(e){e=Fe(e);const t=e.length-3,s=e.length-2;return e[t]=this.height,e[s]=this.width,e}}x0.className="CenterCrop",Z(x0);/** * @license * Copyright 2022 CodeSmith LLC * @@ -7872,7 +7872,7 @@ * license that can be found in the LICENSE file or at * https://opensource.org/licenses/MIT. * ============================================================================= - */function IR(n,e,t,s){let o=ye(n);if(o.dtype!=="int32"&&(o=Kn(o,"int32")),e==="int")return o;const r=o.shape;if(o.rank===0&&(o=Gt(o,-1)),e==="oneHot"&&o.shape[o.shape.length-1]!==1&&(o=Gt(o,-1)),o.rank>2)throw new R(`When outputMode is not int, maximum output rank is 2 Received outputMode ${e} and input shape ${r} which would result in output rank ${o.rank}.`);const i=["multiHot","oneHot"].includes(e),a=o;let l;if(typeof s<"u"&&e==="count"?l=dm(a,s,t,i):l=dm(a,[],t,i),e!=="tfIdf")return l;if(s)return D(l,s);throw new R("When outputMode is 'tfIdf', weights must be provided.")}/** + */function CR(n,e,t,s){let o=ye(n);if(o.dtype!=="int32"&&(o=Kn(o,"int32")),e==="int")return o;const r=o.shape;if(o.rank===0&&(o=Gt(o,-1)),e==="oneHot"&&o.shape[o.shape.length-1]!==1&&(o=Gt(o,-1)),o.rank>2)throw new R(`When outputMode is not int, maximum output rank is 2 Received outputMode ${e} and input shape ${r} which would result in output rank ${o.rank}.`);const i=["multiHot","oneHot"].includes(e),a=o;let l;if(typeof s<"u"&&e==="count"?l=dm(a,s,t,i):l=dm(a,[],t,i),e!=="tfIdf")return l;if(s)return D(l,s);throw new R("When outputMode is 'tfIdf', weights must be provided.")}/** * @license * Copyright 2022 CodeSmith LLC * @@ -7881,7 +7881,7 @@ * https://opensource.org/licenses/MIT. * ============================================================================= */class b0 extends ve{constructor(e){super(e),this.numTokens=e.numTokens,e.outputMode?this.outputMode=e.outputMode:this.outputMode="multiHot"}getConfig(){const e={numTokens:this.numTokens,outputMode:this.outputMode},t=super.getConfig();return Object.assign(e,t),e}computeOutputShape(e){return e=Fe(e),e==null?[this.numTokens]:this.outputMode==="oneHot"&&e[e.length-1]!==1?(e.push(this.numTokens),e):(e[e.length-1]=this.numTokens,e)}call(e,t){return B(()=>{e=ye(e),e.dtype!=="int32"&&(e=Kn(e,"int32"));let s;if(typeof t.countWeights<"u"){if(this.outputMode!=="count")throw new R(`countWeights is not used when outputMode !== count. - Received countWeights=${t.countWeights}`);s=ye(t.countWeights)}const o=Sn(e),r=$l(e),i=Zt(this.numTokens,o).bufferSync().get(0),a=ao(r,0).bufferSync().get(0);if(!(i&&a))throw new R(`Input values must be between 0 < values <= numTokens with numTokens=${this.numTokens}`);return IR(e,this.outputMode,this.numTokens,s)})}}b0.className="CategoryEncoding",Z(b0);/** + Received countWeights=${t.countWeights}`);s=ye(t.countWeights)}const o=Sn(e),r=$l(e),i=Zt(this.numTokens,o).bufferSync().get(0),a=ao(r,0).bufferSync().get(0);if(!(i&&a))throw new R(`Input values must be between 0 < values <= numTokens with numTokens=${this.numTokens}`);return CR(e,this.outputMode,this.numTokens,s)})}}b0.className="CategoryEncoding",Z(b0);/** * @license * Copyright 2022 CodeSmith LLC * @@ -7889,7 +7889,7 @@ * license that can be found in the LICENSE file or at * https://opensource.org/licenses/MIT. * ============================================================================= - */const $R=["bilinear","nearest"],y0=new Set($R);class w0 extends ve{constructor(e){if(super(e),this.height=e.height,this.width=e.width,e.interpolation)if(y0.has(e.interpolation))this.interpolation=e.interpolation;else throw new R(`Invalid interpolation parameter: ${e.interpolation} is not implemented`);else this.interpolation="bilinear";this.cropToAspectRatio=!!e.cropToAspectRatio}computeOutputShape(e){e=Fe(e);const t=e[2];return[this.height,this.width,t]}getConfig(){const e={height:this.height,width:this.width,interpolation:this.interpolation,cropToAspectRatio:this.cropToAspectRatio},t=super.getConfig();return Object.assign(e,t),e}call(e,t){return B(()=>{const s=[this.height,this.width];if(this.interpolation==="bilinear")return ls.resizeBilinear(e,s,!this.cropToAspectRatio);if(this.interpolation==="nearest")return ls.resizeNearestNeighbor(e,s,!this.cropToAspectRatio);throw new Error(`Interpolation is ${this.interpolation} but only ${[...y0]} are supported`)})}}w0.className="Resizing",Z(w0);/** + */const IR=["bilinear","nearest"],y0=new Set(IR);class w0 extends ve{constructor(e){if(super(e),this.height=e.height,this.width=e.width,e.interpolation)if(y0.has(e.interpolation))this.interpolation=e.interpolation;else throw new R(`Invalid interpolation parameter: ${e.interpolation} is not implemented`);else this.interpolation="bilinear";this.cropToAspectRatio=!!e.cropToAspectRatio}computeOutputShape(e){e=Fe(e);const t=e[2];return[this.height,this.width,t]}getConfig(){const e={height:this.height,width:this.width,interpolation:this.interpolation,cropToAspectRatio:this.cropToAspectRatio},t=super.getConfig();return Object.assign(e,t),e}call(e,t){return B(()=>{const s=[this.height,this.width];if(this.interpolation==="bilinear")return ls.resizeBilinear(e,s,!this.cropToAspectRatio);if(this.interpolation==="nearest")return ls.resizeNearestNeighbor(e,s,!this.cropToAspectRatio);throw new Error(`Interpolation is ${this.interpolation} but only ${[...y0]} are supported`)})}}w0.className="Resizing",Z(w0);/** * @license * Copyright 2023 CodeSmith LLC * @@ -7913,7 +7913,7 @@ * license that can be found in the LICENSE file or at * https://opensource.org/licenses/MIT. * ============================================================================= - */const kR=["bilinear","nearest"],$0=new Set(kR);class k0 extends I0{constructor(e){super(e);const{factor:t,interpolation:s="bilinear"}=e;if(this.factor=t,Array.isArray(this.factor)&&this.factor.length===2)this.widthLower=this.factor[0],this.widthUpper=this.factor[1];else if(!Array.isArray(this.factor)&&this.factor>0)this.widthLower=-this.factor,this.widthUpper=this.factor;else throw new R(`Invalid factor: ${this.factor}. Must be positive number or tuple of 2 numbers`);if(this.widthLower<-1||this.widthUpper<-1)throw new R(`factor must have values larger than -1. Got: ${this.factor}`);if(this.widthUpper0)this.widthLower=-this.factor,this.widthUpper=this.factor;else throw new R(`Invalid factor: ${this.factor}. Must be positive number or tuple of 2 numbers`);if(this.widthLower<-1||this.widthUpper<-1)throw new R(`factor must have values larger than -1. Got: ${this.factor}`);if(this.widthUpper{const s=ye(e);this.imgHeight=s.shape[s.shape.length-3];const o=s.shape[s.shape.length-2];this.widthFactor=Si([1],1+this.widthLower,1+this.widthUpper,"float32",this.randomGenerator.next());let r=this.widthFactor.dataSync()[0]*o;r=Math.round(r);const i=[this.imgHeight,r];switch(this.interpolation){case"bilinear":return ls.resizeBilinear(e,i);case"nearest":return ls.resizeNearestNeighbor(e,i);default:throw new Error(`Interpolation is ${this.interpolation} @@ -7979,7 +7979,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function le(n,e){Array.isArray(n)||(n=[n]),n.forEach(t=>{t!=null&&v(t.dtype!=="complex64",()=>`${e} does not support complex64 tensors in the CPU backend.`)})}/** + */function le(n,e){Array.isArray(n)||(n=[n]),n.forEach(t=>{t!=null&&k(t.dtype!=="complex64",()=>`${e} does not support complex64 tensors in the CPU backend.`)})}/** * @license * Copyright 2021 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -7994,10 +7994,10 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const vR=Rh;class oc extends Oc{nextDataId(){return oc.nextDataId++}constructor(){super(),this.blockSize=48,this.firstUse=!0,this.data=new Lp(this,Te())}write(e,t,s){this.firstUse&&(this.firstUse=!1,V().get("IS_NODE")&&tn(` + */const kR=Nh;class oc extends Fc{nextDataId(){return oc.nextDataId++}constructor(){super(),this.blockSize=48,this.firstUse=!0,this.data=new Lp(this,Te())}write(e,t,s){this.firstUse&&(this.firstUse=!1,V().get("IS_NODE")&&tn(` ============================ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dramatically, install our node backend, visit https://github.com/tensorflow/tfjs-node for more details. -============================`));const o={id:this.nextDataId()};return this.data.set(o,{values:e,dtype:s,refCount:1}),o}makeTensorInfo(e,t,s){let o;if(t==="string"&&s!=null&&s.length>0&&br(s[0])){const r=s.map(i=>bs(i));o=this.write(r,e,t)}else o=this.write(s,e,t);return{dataId:o,shape:e,dtype:t}}refCount(e){return this.data.has(e)?this.data.get(e).refCount:0}incRef(e){const t=this.data.get(e);t.refCount++}decRef(e){if(this.data.has(e)){const t=this.data.get(e);t.refCount--}}move(e,t,s,o,r){this.data.set(e,{values:t,dtype:o,refCount:r})}numDataIds(){return this.data.numDataIds()}async read(e){return this.readSync(e)}readSync(e){const{dtype:t,complexTensorInfos:s}=this.data.get(e);if(t==="complex64"){const o=this.readSync(s.real.dataId),r=this.readSync(s.imag.dataId);return cs(o,r)}return Nw(this.data.get(e).values,t)}bufferSync(e){const t=this.readSync(e.dataId);if(e.dtype==="string")try{const s=t.map(o=>ys(o));return ke(e.shape,e.dtype,s)}catch{throw new Error("Failed to decode encoded string bytes into utf-8")}return ke(e.shape,e.dtype,t)}makeOutput(e,t,s){return Te().makeTensorFromTensorInfo(this.makeTensorInfo(t,s,e),this)}disposeData(e,t=!1){if(this.data.has(e)){if(this.data.get(e).refCount--,!t&&this.data.get(e).refCount>0)return!1;const{complexTensorInfos:s}=this.data.get(e);s!=null&&(this.disposeData(s.real.dataId,!0),this.disposeData(s.imag.dataId,!0)),this.data.delete(e)}return!0}disposeIntermediateTensorInfo(e){this.disposeData(e.dataId)}async time(e){const t=Vt();return e(),{kernelMs:Vt()-t}}memory(){return{unreliable:!0,reasons:["The reported memory is an upper bound. Due to automatic garbage collection, the true allocated memory may be less."]}}where(e){le([e],"where");const t=this.readSync(e.dataId);return vR(e.shape,t)}dispose(){}floatPrecision(){return 32}epsilon(){return super.epsilon()}}oc.nextDataId=0;/** +============================`));const o={id:this.nextDataId()};return this.data.set(o,{values:e,dtype:s,refCount:1}),o}makeTensorInfo(e,t,s){let o;if(t==="string"&&s!=null&&s.length>0&&br(s[0])){const r=s.map(i=>bs(i));o=this.write(r,e,t)}else o=this.write(s,e,t);return{dataId:o,shape:e,dtype:t}}refCount(e){return this.data.has(e)?this.data.get(e).refCount:0}incRef(e){const t=this.data.get(e);t.refCount++}decRef(e){if(this.data.has(e)){const t=this.data.get(e);t.refCount--}}move(e,t,s,o,r){this.data.set(e,{values:t,dtype:o,refCount:r})}numDataIds(){return this.data.numDataIds()}async read(e){return this.readSync(e)}readSync(e){const{dtype:t,complexTensorInfos:s}=this.data.get(e);if(t==="complex64"){const o=this.readSync(s.real.dataId),r=this.readSync(s.imag.dataId);return cs(o,r)}return Tw(this.data.get(e).values,t)}bufferSync(e){const t=this.readSync(e.dataId);if(e.dtype==="string")try{const s=t.map(o=>ys(o));return ke(e.shape,e.dtype,s)}catch{throw new Error("Failed to decode encoded string bytes into utf-8")}return ke(e.shape,e.dtype,t)}makeOutput(e,t,s){return Te().makeTensorFromTensorInfo(this.makeTensorInfo(t,s,e),this)}disposeData(e,t=!1){if(this.data.has(e)){if(this.data.get(e).refCount--,!t&&this.data.get(e).refCount>0)return!1;const{complexTensorInfos:s}=this.data.get(e);s!=null&&(this.disposeData(s.real.dataId,!0),this.disposeData(s.imag.dataId,!0)),this.data.delete(e)}return!0}disposeIntermediateTensorInfo(e){this.disposeData(e.dataId)}async time(e){const t=zt();return e(),{kernelMs:zt()-t}}memory(){return{unreliable:!0,reasons:["The reported memory is an upper bound. Due to automatic garbage collection, the true allocated memory may be less."]}}where(e){le([e],"where");const t=this.readSync(e.dataId);return kR(e.shape,t)}dispose(){}floatPrecision(){return 32}epsilon(){return super.epsilon()}}oc.nextDataId=0;/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the License); @@ -8012,7 +8012,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function N0(n){const e=new Float32Array(n.length);for(let t=0;t{const{x:e}=n.inputs,t=n.backend;le(e,"abs");let s=new Float32Array(G(e.shape));const o=t.data.get(e.dataId).values;return s=N0(o),t.makeOutput(s,e.shape,e.dtype)}};/** + */function N0(n){const e=new Float32Array(n.length);for(let t=0;t{const{x:e}=n.inputs,t=n.backend;le(e,"abs");let s=new Float32Array(G(e.shape));const o=t.data.get(e.dataId).values;return s=N0(o),t.makeOutput(s,e.shape,e.dtype)}};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -8027,7 +8027,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function it(n){return(e,t,s,o,r)=>{const i=Ce(e,t),a=i.length,l=ue(i),c=G(i),u=Tt(r,c),h=e.length,d=t.length,p=ue(e),f=ue(t),m=qo(e,i),g=qo(t,i);if(m.length+g.length===0)for(let x=0;xw[$]=0);const y=Pn(w,h,p),C=b.slice(-d);g.forEach($=>C[$]=0);const I=Pn(C,d,f);u[x]=n(s[y],o[I])}return[u,i]}}/** + */function it(n){return(e,t,s,o,r)=>{const i=Ce(e,t),a=i.length,l=ue(i),c=G(i),u=Tt(r,c),h=e.length,d=t.length,p=ue(e),f=ue(t),m=qo(e,i),g=qo(t,i);if(m.length+g.length===0)for(let x=0;xw[v]=0);const y=Pn(w,h,p),C=b.slice(-d);g.forEach(v=>C[v]=0);const I=Pn(C,d,f);u[x]=n(s[y],o[I])}return[u,i]}}/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -8042,7 +8042,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function Jt(n){const{inputs:e,backend:t}=n,{real:s,imag:o}=e,r=t.data.get(s.dataId).values,i=t.data.get(o.dataId).values,a=t.makeTensorInfo(s.shape,"complex64"),l=t.data.get(a.dataId);return l.complexTensorInfos={real:t.makeTensorInfo(s.shape,"float32",r),imag:t.makeTensorInfo(o.shape,"float32",i)},a}const TR={kernelName:Jc,backendName:"cpu",kernelFunc:Jt};/** + */function Jt(n){const{inputs:e,backend:t}=n,{real:s,imag:o}=e,r=t.data.get(s.dataId).values,i=t.data.get(o.dataId).values,a=t.makeTensorInfo(s.shape,"complex64"),l=t.data.get(a.dataId);return l.complexTensorInfos={real:t.makeTensorInfo(s.shape,"float32",r),imag:t.makeTensorInfo(o.shape,"float32",i)},a}const SR={kernelName:Zc,backendName:"cpu",kernelFunc:Jt};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -8072,7 +8072,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function Jn(n){const{inputs:e,backend:t}=n,{x:s}=e;return t.incRef(s.dataId),{dataId:s.dataId,shape:s.shape,dtype:s.dtype}}const NR={kernelName:zr,backendName:"cpu",kernelFunc:Jn};/** + */function Jn(n){const{inputs:e,backend:t}=n,{x:s}=e;return t.incRef(s.dataId),{dataId:s.dataId,shape:s.shape,dtype:s.dtype}}const TR={kernelName:zr,backendName:"cpu",kernelFunc:Jn};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -8087,7 +8087,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function wo(n){const{inputs:e,backend:t}=n,{input:s}=e,o=t.data.get(s.dataId).complexTensorInfos.real,r=t.data.get(o.dataId).values;return t.makeTensorInfo(o.shape,o.dtype,r)}const ER={kernelName:vu,backendName:"cpu",kernelFunc:wo};/** + */function wo(n){const{inputs:e,backend:t}=n,{input:s}=e,o=t.data.get(s.dataId).complexTensorInfos.real,r=t.data.get(o.dataId).values;return t.makeTensorInfo(o.shape,o.dtype,r)}const NR={kernelName:$u,backendName:"cpu",kernelFunc:wo};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -8102,7 +8102,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function E0(n,e,t,s){if(s==="int32"){const o=Int32Array.from(n);return[e,"int32",o]}if(s==="bool"){const o=Xs([0],t),[r,i]=it((a,l)=>a!==l?1:0)(e,[],n,o,"bool");return[i,"bool",r]}throw new Error(`Error in Cast: failed to cast ${t} to ${s}`)}function _s(n){const{inputs:e,backend:t,attrs:s}=n,{x:o}=e,{dtype:r}=s;if(r==="complex64"){if(o.dtype==="complex64")return Jn({inputs:{x:o},backend:t});const u=rc(t,o.shape,o.dtype),h=_s({inputs:{x:o},backend:t,attrs:{dtype:"float32"}}),d=Jt({inputs:{real:h,imag:u},backend:t});return t.disposeIntermediateTensorInfo(u),t.disposeIntermediateTensorInfo(h),d}if(o.dtype==="complex64"){const u=wo({inputs:{input:o},backend:t}),h=_s({inputs:{x:u},backend:t,attrs:{dtype:r}});return t.disposeIntermediateTensorInfo(u),h}if(!zp(o.dtype,r)){const u=Jn({inputs:{x:o},backend:t});return{dataId:u.dataId,shape:u.shape,dtype:r}}const i=t.data.get(o.dataId).values,[a,l,c]=E0(i,o.shape,o.dtype,r);return t.makeTensorInfo(a,l,c)}const RR={kernelName:Tr,backendName:"cpu",kernelFunc:_s};/** + */function E0(n,e,t,s){if(s==="int32"){const o=Int32Array.from(n);return[e,"int32",o]}if(s==="bool"){const o=Xs([0],t),[r,i]=it((a,l)=>a!==l?1:0)(e,[],n,o,"bool");return[i,"bool",r]}throw new Error(`Error in Cast: failed to cast ${t} to ${s}`)}function _s(n){const{inputs:e,backend:t,attrs:s}=n,{x:o}=e,{dtype:r}=s;if(r==="complex64"){if(o.dtype==="complex64")return Jn({inputs:{x:o},backend:t});const u=rc(t,o.shape,o.dtype),h=_s({inputs:{x:o},backend:t,attrs:{dtype:"float32"}}),d=Jt({inputs:{real:h,imag:u},backend:t});return t.disposeIntermediateTensorInfo(u),t.disposeIntermediateTensorInfo(h),d}if(o.dtype==="complex64"){const u=wo({inputs:{input:o},backend:t}),h=_s({inputs:{x:u},backend:t,attrs:{dtype:r}});return t.disposeIntermediateTensorInfo(u),h}if(!zp(o.dtype,r)){const u=Jn({inputs:{x:o},backend:t});return{dataId:u.dataId,shape:u.shape,dtype:r}}const i=t.data.get(o.dataId).values,[a,l,c]=E0(i,o.shape,o.dtype,r);return t.makeTensorInfo(a,l,c)}const ER={kernelName:Tr,backendName:"cpu",kernelFunc:_s};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -8117,7 +8117,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function mt(n,e,t,s){return t==null?({inputs:o,backend:r})=>{const{a:i,b:a}=o,l=r;le([i,a],n);const c=l.data.get(i.dataId).values,u=l.data.get(a.dataId).values,h=i.dtype==="string"?us(c):c,d=i.dtype==="string"?us(u):u,p=s||i.dtype,[f,m]=e(i.shape,a.shape,h,d,p);return l.makeTensorInfo(m,p,f)}:({inputs:o,backend:r})=>{const{a:i,b:a}=o,l=r;if(i.dtype==="complex64"||a.dtype==="complex64"){const c=_s({inputs:{x:i},backend:l,attrs:{dtype:"complex64"}}),u=l.data.get(c.dataId),h=u.complexTensorInfos.real,d=u.complexTensorInfos.imag,p=l.data.get(h.dataId).values,f=l.data.get(d.dataId).values,m=_s({inputs:{x:a},backend:l,attrs:{dtype:"complex64"}}),g=l.data.get(m.dataId),x=g.complexTensorInfos.real,b=g.complexTensorInfos.imag,w=l.data.get(x.dataId).values,y=l.data.get(b.dataId).values,[C,I,$]=t(i.shape,a.shape,p,f,w,y),k=l.makeTensorInfo($,"float32",C),S=l.makeTensorInfo($,"float32",I),N=Jt({inputs:{real:k,imag:S},backend:l});return l.disposeIntermediateTensorInfo(c),l.disposeIntermediateTensorInfo(m),l.disposeIntermediateTensorInfo(k),l.disposeIntermediateTensorInfo(S),N}else{const c=l.data.get(i.dataId).values,u=l.data.get(a.dataId).values,h=s||i.dtype,[d,p]=e(i.shape,a.shape,c,u,h);return l.makeTensorInfo(p,h,d)}}}function Jd(n){return(e,t,s,o,r,i)=>{const a=Ce(e,t),l=G(a),c=a.length,u=ue(a),h=Tt("float32",l),d=Tt("float32",l),p=qo(e,a),f=qo(t,a),m=cs(s,o),g=cs(r,i),x=e.length,b=ue(e),w=t.length,y=ue(t);if(p.length+f.length===0)for(let C=0;C$[_]=0);const k=Pn($,x,b),S=I.slice(-w);f.forEach(_=>S[_]=0);const N=Pn(S,w,y),A=n(m[k*2],m[k*2+1],g[N*2],g[N*2+1]);h[C]=A.real,d[C]=A.imag}return[h,d,a]}}/** + */function mt(n,e,t,s){return t==null?({inputs:o,backend:r})=>{const{a:i,b:a}=o,l=r;le([i,a],n);const c=l.data.get(i.dataId).values,u=l.data.get(a.dataId).values,h=i.dtype==="string"?us(c):c,d=i.dtype==="string"?us(u):u,p=s||i.dtype,[f,m]=e(i.shape,a.shape,h,d,p);return l.makeTensorInfo(m,p,f)}:({inputs:o,backend:r})=>{const{a:i,b:a}=o,l=r;if(i.dtype==="complex64"||a.dtype==="complex64"){const c=_s({inputs:{x:i},backend:l,attrs:{dtype:"complex64"}}),u=l.data.get(c.dataId),h=u.complexTensorInfos.real,d=u.complexTensorInfos.imag,p=l.data.get(h.dataId).values,f=l.data.get(d.dataId).values,m=_s({inputs:{x:a},backend:l,attrs:{dtype:"complex64"}}),g=l.data.get(m.dataId),x=g.complexTensorInfos.real,b=g.complexTensorInfos.imag,w=l.data.get(x.dataId).values,y=l.data.get(b.dataId).values,[C,I,v]=t(i.shape,a.shape,p,f,w,y),$=l.makeTensorInfo(v,"float32",C),S=l.makeTensorInfo(v,"float32",I),N=Jt({inputs:{real:$,imag:S},backend:l});return l.disposeIntermediateTensorInfo(c),l.disposeIntermediateTensorInfo(m),l.disposeIntermediateTensorInfo($),l.disposeIntermediateTensorInfo(S),N}else{const c=l.data.get(i.dataId).values,u=l.data.get(a.dataId).values,h=s||i.dtype,[d,p]=e(i.shape,a.shape,c,u,h);return l.makeTensorInfo(p,h,d)}}}function Zd(n){return(e,t,s,o,r,i)=>{const a=Ce(e,t),l=G(a),c=a.length,u=ue(a),h=Tt("float32",l),d=Tt("float32",l),p=qo(e,a),f=qo(t,a),m=cs(s,o),g=cs(r,i),x=e.length,b=ue(e),w=t.length,y=ue(t);if(p.length+f.length===0)for(let C=0;Cv[_]=0);const $=Pn(v,x,b),S=I.slice(-w);f.forEach(_=>S[_]=0);const N=Pn(S,w,y),A=n(m[$*2],m[$*2+1],g[N*2],g[N*2+1]);h[C]=A.real,d[C]=A.imag}return[h,d,a]}}/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -8132,7 +8132,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const R0=it((n,e)=>n+e),AR=Jd((n,e,t,s)=>({real:n+t,imag:e+s})),or=mt(Lo,R0,AR),DR={kernelName:Lo,backendName:"cpu",kernelFunc:or};/** + */const R0=it((n,e)=>n+e),RR=Zd((n,e,t,s)=>({real:n+t,imag:e+s})),or=mt(Lo,R0,RR),AR={kernelName:Lo,backendName:"cpu",kernelFunc:or};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -8147,7 +8147,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function ep(n,e,t,s,o){const r=G(s),i=Nt(o,t);for(let a=0;a=o||(r>0?i[l]+=e[a]:i[l]+=1)}return i}function A0(n,e,t,s=!1){const o=n.shape[0],r=n.shape[1],i=ke([o,t],e.dtype);for(let a=0;a=t||(s?i.set(1,a,c):e.size>0?i.set(i.get(a,c)+e.get(a,l),a,c):i.set(i.get(a,c)+1,a,c))}return i}/** + */function Qd(n,e,t,s,o){const r=G(s),i=Nt(o,t);for(let a=0;a=o||(r>0?i[l]+=e[a]:i[l]+=1)}return i}function A0(n,e,t,s=!1){const o=n.shape[0],r=n.shape[1],i=ke([o,t],e.dtype);for(let a=0;a=t||(s?i.set(1,a,c):e.size>0?i.set(i.get(a,c)+e.get(a,l),a,c):i.set(i.get(a,c)+1,a,c))}return i}/** * @license * Copyright 2023 Google LLC. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -8162,7 +8162,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const D0=it((n,e)=>n&e),FR=mt(Qc,D0),_R={kernelName:Qc,backendName:"cpu",kernelFunc:FR};/** + */const D0=it((n,e)=>n&e),DR=mt(Yc,D0),FR={kernelName:Yc,backendName:"cpu",kernelFunc:DR};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -8207,7 +8207,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const F0=es(n=>Math.ceil(n)),OR=Os(Nr,F0),LR={kernelName:Nr,backendName:"cpu",kernelFunc:OR};/** + */const F0=es(n=>Math.ceil(n)),_R=Os(Nr,F0),OR={kernelName:Nr,backendName:"cpu",kernelFunc:_R};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -8237,7 +8237,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const O0=it((n,e)=>n===e?1:0),L0=mt(ka,O0,null,"bool"),MR={kernelName:ka,backendName:"cpu",kernelFunc:L0};/** + */const O0=it((n,e)=>n===e?1:0),L0=mt(ka,O0,null,"bool"),LR={kernelName:ka,backendName:"cpu",kernelFunc:L0};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the License); @@ -8252,7 +8252,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const M0=es(n=>Math.exp(n)),P0=Os(Or,M0,"float32"),PR={kernelName:Or,backendName:"cpu",kernelFunc:P0};/** + */const M0=es(n=>Math.exp(n)),P0=Os(Or,M0,"float32"),MR={kernelName:Or,backendName:"cpu",kernelFunc:P0};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the License); @@ -8267,7 +8267,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const B0=es(n=>Math.expm1(n)),BR=Os(Lr,B0),zR={kernelName:Lr,backendName:"cpu",kernelFunc:BR};/** + */const B0=es(n=>Math.expm1(n)),PR=Os(Lr,B0),BR={kernelName:Lr,backendName:"cpu",kernelFunc:PR};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the License); @@ -8282,7 +8282,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const z0=es(n=>Math.floor(n)),VR=Os(Mr,z0),WR={kernelName:Mr,backendName:"cpu",kernelFunc:VR};/** + */const z0=es(n=>Math.floor(n)),zR=Os(Mr,z0),VR={kernelName:Mr,backendName:"cpu",kernelFunc:zR};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -8297,7 +8297,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const V0=it((n,e)=>Math.floor(n/e)),UR=mt(Pr,V0,null,"int32"),GR={kernelName:Pr,backendName:"cpu",kernelFunc:UR};/** + */const V0=it((n,e)=>Math.floor(n/e)),WR=mt(Pr,V0,null,"int32"),UR={kernelName:Pr,backendName:"cpu",kernelFunc:WR};/** * @license * Copyright 2021 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -8342,7 +8342,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const G0=it((n,e)=>n>e?1:0),HR=mt(Na,G0,null,"bool"),qR={kernelName:Na,backendName:"cpu",kernelFunc:HR};/** + */const G0=it((n,e)=>n>e?1:0),GR=mt(Na,G0,null,"bool"),HR={kernelName:Na,backendName:"cpu",kernelFunc:GR};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -8357,7 +8357,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const H0=it((n,e)=>n>=e?1:0),jR=mt(Br,H0,null,"bool"),KR={kernelName:Br,backendName:"cpu",kernelFunc:jR};/** + */const H0=it((n,e)=>n>=e?1:0),qR=mt(Br,H0,null,"bool"),jR={kernelName:Br,backendName:"cpu",kernelFunc:qR};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -8372,7 +8372,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const q0=it((n,e)=>nnn<=e?1:0),ZR=mt(Aa,j0,null,"bool"),QR={kernelName:Aa,backendName:"cpu",kernelFunc:ZR};/** + */const j0=it((n,e)=>n<=e?1:0),YR=mt(Aa,j0,null,"bool"),ZR={kernelName:Aa,backendName:"cpu",kernelFunc:YR};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -8417,7 +8417,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const X0=es(n=>Math.log(n)),JR=Os(Gr,X0),eA={kernelName:Gr,backendName:"cpu",kernelFunc:JR};/** + */const X0=es(n=>Math.log(n)),QR=Os(Gr,X0),JR={kernelName:Gr,backendName:"cpu",kernelFunc:QR};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -8447,7 +8447,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const Z0=it((n,e)=>Math.max(n,e)),tA=mt(qr,Z0),nA={kernelName:qr,backendName:"cpu",kernelFunc:tA};/** + */const Z0=it((n,e)=>Math.max(n,e)),eA=mt(qr,Z0),tA={kernelName:qr,backendName:"cpu",kernelFunc:eA};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -8462,7 +8462,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const Q0=it((n,e)=>Math.min(n,e)),sA=mt(jr,Q0),oA={kernelName:jr,backendName:"cpu",kernelFunc:sA};/** + */const Q0=it((n,e)=>Math.min(n,e)),nA=mt(jr,Q0),sA={kernelName:jr,backendName:"cpu",kernelFunc:nA};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -8477,7 +8477,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const tp=it((n,e)=>n*e),rA=Jd((n,e,t,s)=>({real:n*t-e*s,imag:n*s+e*t})),ic=mt(Xr,tp,rA),iA={kernelName:Xr,backendName:"cpu",kernelFunc:ic};/** + */const Jd=it((n,e)=>n*e),oA=Zd((n,e,t,s)=>({real:n*t-e*s,imag:n*s+e*t})),ic=mt(Xr,Jd,oA),rA={kernelName:Xr,backendName:"cpu",kernelFunc:ic};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -8492,7 +8492,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function J0(n,e,t){const s=xs(-1,t);return tp([],e,s,n,t)}function aA(n){const{inputs:e,backend:t}=n,{x:s}=e;le(s,"neg");const o=t.data.get(s.dataId).values,[r,i]=J0(o,s.shape,s.dtype);return t.makeTensorInfo(i,s.dtype,r)}const lA={kernelName:Wa,backendName:"cpu",kernelFunc:aA};/** + */function J0(n,e,t){const s=xs(-1,t);return Jd([],e,s,n,t)}function iA(n){const{inputs:e,backend:t}=n,{x:s}=e;le(s,"neg");const o=t.data.get(s.dataId).values,[r,i]=J0(o,s.shape,s.dtype);return t.makeTensorInfo(i,s.dtype,r)}const aA={kernelName:Wa,backendName:"cpu",kernelFunc:iA};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -8507,7 +8507,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const e1=it((n,e)=>n!==e?1:0),cA=mt(Ua,e1,null,"bool"),uA={kernelName:Ua,backendName:"cpu",kernelFunc:cA};/** + */const e1=it((n,e)=>n!==e?1:0),lA=mt(Ua,e1,null,"bool"),cA={kernelName:Ua,backendName:"cpu",kernelFunc:lA};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -8522,7 +8522,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function np(n,e,t,s,o){const r=e.length,i=G(e),a=ue(e),l=ue(o),c=Tt(t,G(o));for(let u=0;ut.disposeIntermediateTensorInfo(b)),t.makeTensorInfo(x,g,f)}const pA={kernelName:Xa,backendName:"cpu",kernelFunc:dA};/** + */function t1(n,e,t,s){const[o,r]=bt(n,s),i=Yt(e,"int32"),a=Nt(G(o),i),l=G(r);for(let c=0;ct.disposeIntermediateTensorInfo(b)),t.makeTensorInfo(x,g,f)}const dA={kernelName:Xa,backendName:"cpu",kernelFunc:hA};/** * @license * Copyright 2022 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -8567,7 +8567,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function fA(n,e,t){n.forEach((s,o)=>{if(s<0||s>=t){const r=Oo(o,e.length,ue(e)).join(",");throw new Error(`indices[${r}] = ${s} is not in [0, ${t})`)}})}function mA(n,e){for(let t=0;to)throw new Error("Ragged splits must not point past values");for(let r=1;rs[r])throw new Error("Ragged splits must be sorted in ascending order")}}function gA(n,e,t,s){const o=[];let r=0;const i=e.length-1+t.length,a=new Array(i).fill(null).map(()=>[0]);mA(t,s);let l=1;for(let c=0;c=0){const m=a[f],g=m[m.length-1]-p[u];for(let x=u;xo[i]=r)}return e}function n1(n,e){const t=n.slice(0,e);for(;t.length{if(s<0||s>=t){const r=Oo(o,e.length,ue(e)).join(",");throw new Error(`indices[${r}] = ${s} is not in [0, ${t})`)}})}function fA(n,e){for(let t=0;to)throw new Error("Ragged splits must not point past values");for(let r=1;rs[r])throw new Error("Ragged splits must be sorted in ascending order")}}function mA(n,e,t,s){const o=[];let r=0;const i=e.length-1+t.length,a=new Array(i).fill(null).map(()=>[0]);fA(t,s);let l=1;for(let c=0;c=0){const m=a[f],g=m[m.length-1]-p[u];for(let x=u;xo[i]=r)}return e}function n1(n,e){const t=n.slice(0,e);for(;t.lengths&&(s=r)}return s}static getMaxWidthValueRowID(e){const t=e.length;if(t===0)return 0;let s=0,o=e[0],r=0;for(let i=1;i"Final length of result must be equal to firstDimension."),r}calculateOutputIndexRowSplit(e,t,s,o){const r=e.length,i=[];for(let a=0;a0&&i.length!==e[r-1])throw new Error("Invalid row split size.");return i}calculateOutputIndexValueRowID(e,t,s,o){const r=e.length,i=[];if(r===0)return[];let a=0,l=e[0];if(l>=t.length)throw new Error(`Got currentValueRowId=${l}, which is not less than ${t.length}`);let c=t[l];i.push(c);for(let u=1;u=0&&(++a,a=t.length)throw new Error(`Got nextValueRowId=${h} which is not less than ${t.length}`);c=t[h]}i.push(c)}if(i.length!==e.length)throw new Error("Invalid row ids.");return i}calculateOutputIndex(e,t,s,o){const r=this.getRowPartitionTensor(e),i=this.getRowPartitionTypeByDimension(e);switch(i){case wn.VALUE_ROWIDS:return this.calculateOutputIndexValueRowID(r,t,s,o);case wn.ROW_SPLITS:if(r.length-1>t.length)throw new Error(`Row partition size is greater than output size: ${r.length-1} > ${t.length}`);return this.calculateOutputIndexRowSplit(r,t,s,o);default:throw new Error(`Unsupported partition type: ${wn[i]}`)}}getFirstDimensionSize(){const e=this.rowPartitionValues[0];if(this.rowPartitionTypes.length===0)throw new Error("No row_partition_types given.");const t=this.rowPartitionTypes[0];switch(t){case wn.FIRST_DIM_SIZE:return e[0];case wn.VALUE_ROWIDS:throw new Error("Cannot handle VALUE_ROWIDS in first dimension.");case wn.ROW_SPLITS:return this.rowPartitionValuesShapes[0][0]-1;default:throw new Error(`Cannot handle type ${wn[t]}`)}}compute(){if(this.rowPartitionValues[0].length<=0)throw new Error("Invalid first partition input. Tensor requires at least one element.");const t=this.getFirstDimensionSize(),s=this.calculateOutputSize(t),o=new Array(this.raggedRank+1);o[o.length-1]=1;for(let l=o.length-2;l>=0;--l)o[l]=o[l+1]*s[l+1];const r=a1(s,!1),i=et(this.valuesDType,G(r));if(o[0]*s[0]>0){let l=this.calculateFirstParentOutputIndex(t,o[0],s[0]);for(let c=1;c<=this.raggedRank;++c)l=this.calculateOutputIndex(c-1,l,o[c],s[c]);this.setOutput(this.raggedRank,l,i,r)}return[r,i]}setOutput(e,t,s,o){if(s.length===0)return;const r=this.values,i=s;let a=o.slice();a=a.slice(e+1);const l=G(a),c=t.length;let u=this.defaultValue;if(u.length!==l&&u.length!==1){const f=this.defaultValueShape;B(()=>{const m=O(u,f);u=Ci(m,a).dataSync()})}let h=0,d=0,p=0;for(let f=0;f<=c;++f){let m=f=c){const g=s.length;m=Math.floor(g/l)}if(m>p)if(this.defaultValue.length===1)i.subarray(p*l,m*l).fill(this.defaultValue[0]),p=m;else for(;m>p;){const g=i.slice(p*l);i1(g,u,l),++p}m<0?(h=f+1,d=p):(h=f,d=p,p=d+1)}}}function i1(n,e,t){for(let s=0;s= 0`);if(s<-1)throw new Error(`Dimension ${s} must be >= -1`);s=-1}t.push(s)}return t}function l1(n,e,t,s,o,r,i,a,l,c){return new ac(n,e,t,s,o,r,i,a,l,c).compute()}/** + */var wn=En;class ac{constructor(e,t,s,o,r,i,a,l,c,u){this.shape=e,this.shapeShape=t,this.values=s,this.valuesShape=o,this.valuesDType=r,this.defaultValue=i,this.defaultValueShape=a,this.rowPartitionValues=l,this.rowPartitionValuesShapes=c,this.rowPartitionTypes=cg(u),this.raggedRank=ug(this.rowPartitionTypes)}getRowPartitionTypeByDimension(e){return this.rowPartitionTypes[0]===wn.FIRST_DIM_SIZE?this.rowPartitionTypes[e+1]:this.rowPartitionTypes[e]}getRowPartitionTensor(e){return this.rowPartitionTypes[0]===wn.FIRST_DIM_SIZE?this.rowPartitionValues[e+1]:this.rowPartitionValues[e]}getMaxWidth(e){const t=this.getRowPartitionTensor(e-1);switch(this.getRowPartitionTypeByDimension(e-1)){case wn.VALUE_ROWIDS:return ac.getMaxWidthValueRowID(t);case wn.ROW_SPLITS:return ac.getMaxWidthRowSplit(t);default:throw new Error(`Cannot handle partition type ${wn[this.getRowPartitionTypeByDimension(e-1)]}`)}}static getMaxWidthRowSplit(e){const t=e.length;if(t===0||t===1)return 0;let s=0;for(let o=0;os&&(s=r)}return s}static getMaxWidthValueRowID(e){const t=e.length;if(t===0)return 0;let s=0,o=e[0],r=0;for(let i=1;i"Final length of result must be equal to firstDimension."),r}calculateOutputIndexRowSplit(e,t,s,o){const r=e.length,i=[];for(let a=0;a0&&i.length!==e[r-1])throw new Error("Invalid row split size.");return i}calculateOutputIndexValueRowID(e,t,s,o){const r=e.length,i=[];if(r===0)return[];let a=0,l=e[0];if(l>=t.length)throw new Error(`Got currentValueRowId=${l}, which is not less than ${t.length}`);let c=t[l];i.push(c);for(let u=1;u=0&&(++a,a=t.length)throw new Error(`Got nextValueRowId=${h} which is not less than ${t.length}`);c=t[h]}i.push(c)}if(i.length!==e.length)throw new Error("Invalid row ids.");return i}calculateOutputIndex(e,t,s,o){const r=this.getRowPartitionTensor(e),i=this.getRowPartitionTypeByDimension(e);switch(i){case wn.VALUE_ROWIDS:return this.calculateOutputIndexValueRowID(r,t,s,o);case wn.ROW_SPLITS:if(r.length-1>t.length)throw new Error(`Row partition size is greater than output size: ${r.length-1} > ${t.length}`);return this.calculateOutputIndexRowSplit(r,t,s,o);default:throw new Error(`Unsupported partition type: ${wn[i]}`)}}getFirstDimensionSize(){const e=this.rowPartitionValues[0];if(this.rowPartitionTypes.length===0)throw new Error("No row_partition_types given.");const t=this.rowPartitionTypes[0];switch(t){case wn.FIRST_DIM_SIZE:return e[0];case wn.VALUE_ROWIDS:throw new Error("Cannot handle VALUE_ROWIDS in first dimension.");case wn.ROW_SPLITS:return this.rowPartitionValuesShapes[0][0]-1;default:throw new Error(`Cannot handle type ${wn[t]}`)}}compute(){if(this.rowPartitionValues[0].length<=0)throw new Error("Invalid first partition input. Tensor requires at least one element.");const t=this.getFirstDimensionSize(),s=this.calculateOutputSize(t),o=new Array(this.raggedRank+1);o[o.length-1]=1;for(let l=o.length-2;l>=0;--l)o[l]=o[l+1]*s[l+1];const r=a1(s,!1),i=et(this.valuesDType,G(r));if(o[0]*s[0]>0){let l=this.calculateFirstParentOutputIndex(t,o[0],s[0]);for(let c=1;c<=this.raggedRank;++c)l=this.calculateOutputIndex(c-1,l,o[c],s[c]);this.setOutput(this.raggedRank,l,i,r)}return[r,i]}setOutput(e,t,s,o){if(s.length===0)return;const r=this.values,i=s;let a=o.slice();a=a.slice(e+1);const l=G(a),c=t.length;let u=this.defaultValue;if(u.length!==l&&u.length!==1){const f=this.defaultValueShape;B(()=>{const m=O(u,f);u=Ci(m,a).dataSync()})}let h=0,d=0,p=0;for(let f=0;f<=c;++f){let m=f=c){const g=s.length;m=Math.floor(g/l)}if(m>p)if(this.defaultValue.length===1)i.subarray(p*l,m*l).fill(this.defaultValue[0]),p=m;else for(;m>p;){const g=i.slice(p*l);i1(g,u,l),++p}m<0?(h=f+1,d=p):(h=f,d=p,p=d+1)}}}function i1(n,e,t){for(let s=0;s= 0`);if(s<-1)throw new Error(`Dimension ${s} must be >= -1`);s=-1}t.push(s)}return t}function l1(n,e,t,s,o,r,i,a,l,c){return new ac(n,e,t,s,o,r,i,a,l,c).compute()}/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -8627,7 +8627,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const u1=es(n=>1/Math.sqrt(n)),wA=Os(ti,u1),CA={kernelName:ti,backendName:"cpu",kernelFunc:wA};/** + */const u1=es(n=>1/Math.sqrt(n)),yA=Os(ti,u1),wA={kernelName:ti,backendName:"cpu",kernelFunc:yA};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -8657,7 +8657,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const IA=es(n=>1/(1+Math.exp(-n))),h1=Le(ii,n=>1/(1+Math.exp(-n))),$A={kernelName:ii,backendName:"cpu",kernelFunc:h1};/** + */const CA=es(n=>1/(1+Math.exp(-n))),h1=Le(ii,n=>1/(1+Math.exp(-n))),IA={kernelName:ii,backendName:"cpu",kernelFunc:h1};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -8672,7 +8672,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function d1(n,e,t,s,o){const r=qh(s,e,t),i=G(t),a=ue(s);if(r){const h=jh(e,a);return o==="string"?n.slice(h,h+i):n.subarray(h,h+i)}const l=o==="string"?us(n):n,c=ke(s,o,l),u=ke(t,o);for(let h=0;hf+e[m]);u.set(c.get(...p),...d)}return o==="string"?Fg(u.values):u.values}function Io(n){const{inputs:e,backend:t,attrs:s}=n,{x:o}=e,{begin:r,size:i}=s;le(o,"slice");const[a,l]=Rl(o,r,i);Gh(o,a,l);const c=t.data.get(o.dataId).values,u=d1(c,a,l,o.shape,o.dtype);return t.makeTensorInfo(l,o.dtype,u)}const kA={kernelName:tl,backendName:"cpu",kernelFunc:Io};/** + */function d1(n,e,t,s,o){const r=Gh(s,e,t),i=G(t),a=ue(s);if(r){const h=Hh(e,a);return o==="string"?n.slice(h,h+i):n.subarray(h,h+i)}const l=o==="string"?us(n):n,c=ke(s,o,l),u=ke(t,o);for(let h=0;hf+e[m]);u.set(c.get(...p),...d)}return o==="string"?Fg(u.values):u.values}function Io(n){const{inputs:e,backend:t,attrs:s}=n,{x:o}=e,{begin:r,size:i}=s;le(o,"slice");const[a,l]=Rl(o,r,i);Wh(o,a,l);const c=t.data.get(o.dataId).values,u=d1(c,a,l,o.shape,o.dtype);return t.makeTensorInfo(l,o.dtype,u)}const $A={kernelName:tl,backendName:"cpu",kernelFunc:Io};/** * @license * Copyright 2021 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -8687,7 +8687,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function p1(n,e,t,s,o,r,i){const a=e[0],l=r[0],c=new Array(l),u=new Array(a),h=e[1];if(l===0){if(a!==0)throw new Error(wg(a));const g=et(t,0),x=et(o,0);return[g,[0,h],x,c,u]}let d=!0,p=0;const f=new Array(l).fill(0);for(let g=0;g=l)throw new Error(Ig(g,x,l));++f[x],d=d&&x>=p,p=x}let m=!0;for(let g=0;g0&&(f[g]+=f[g-1])}if(m&&d){const g=n,x=s;for(let b=0;b=l)throw new Error(Ig(g,x,l));++f[x],d=d&&x>=p,p=x}let m=!0;for(let g=0;g0&&(f[g]+=f[g-1])}if(m&&d){const g=n,x=s;for(let b=0;b0?o[a-1]+1:0;if(h<0)throw new Error(fd());const d=e.slice();d[0]=h;const p=d.reduce((w,y)=>w*y,1),f=et(t,p);if(a===0)return h>0&&f.fill(i),[f,d];if(h<=0)throw new Error(fd());let m=0,g=1,x=0,b=o[m];for(;;){let w=0;if(g=w)throw new Error(Ng())}if(b<0||b>=h)throw new Error(Eg(b,h));b>x&&f.fill(i,x*c,b*c);for(let y=m;y=l[0])throw new Error(Rg(y,s[y],l[0]));for(let I=0;Ia)break}return x0?o[a-1]+1:0;if(h<0)throw new Error(dd());const d=e.slice();d[0]=h;const p=d.reduce((w,y)=>w*y,1),f=et(t,p);if(a===0)return h>0&&f.fill(i),[f,d];if(h<=0)throw new Error(dd());let m=0,g=1,x=0,b=o[m];for(;;){let w=0;if(g=w)throw new Error(Ng())}if(b<0||b>=h)throw new Error(Eg(b,h));b>x&&f.fill(i,x*c,b*c);for(let y=m;y=l[0])throw new Error(Rg(y,s[y],l[0]));for(let I=0;Ia)break}return xMath.sqrt(n)),SA=Le(li,n=>Math.sqrt(n)),TA={kernelName:li,backendName:"cpu",kernelFunc:SA};/** + */const kA=es(n=>Math.sqrt(n)),vA=Le(li,n=>Math.sqrt(n)),SA={kernelName:li,backendName:"cpu",kernelFunc:vA};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -8747,7 +8747,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const m1=it((n,e)=>{const t=n-e;return t*t}),NA=mt(ci,m1),EA={kernelName:ci,backendName:"cpu",kernelFunc:NA};/** + */const m1=it((n,e)=>{const t=n-e;return t*t}),TA=mt(ci,m1),NA={kernelName:ci,backendName:"cpu",kernelFunc:TA};/** * @license * Copyright 2023 Google LLC. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -8762,7 +8762,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const g1=es((n,e)=>{const{pattern:t,replaceGlobal:s,rewrite:o}=e;return n.replace(new RegExp(t,s?"g":""),o)}),RA=Os(Eu,g1),AA={kernelName:Eu,backendName:"cpu",kernelFunc:RA};/** + */const g1=es((n,e)=>{const{pattern:t,replaceGlobal:s,rewrite:o}=e;return n.replace(new RegExp(t,s?"g":""),o)}),EA=Os(Tu,g1),RA={kernelName:Tu,backendName:"cpu",kernelFunc:EA};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -8792,7 +8792,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */class DA{constructor(e,t,s,o,r,i){this.separator=bs(e),this.nGramWidths=t,this.leftPad=bs(s),this.rightPad=bs(o),this.padWidth=r,this.preserveShort=i}getPadWidth(e){return Math.min(this.padWidth<0?e-1:this.padWidth,e-1)}getNumNGrams(e,t){const s=this.getPadWidth(t);return Math.max(0,e+2*s-t+1)}createNGrams(e,t,s,o,r,i){for(let a=0;a0?0:a-l);let p=0;p+=c*this.leftPad.length;for(let b=0;bb.forEach(w=>m[g++]=w);for(let b=0;b0){x(e[d+h-1]);for(let b=0;b0){let l=t[0];if(l!==0)throw new Error(`First split value must be 0, got ${l}`);for(let c=1;c=l;if(u=u&&t[c]<=s,!u)throw new Error(`Invalid split value ${t[c]}, must be in [${l}, ${s}]`);l=t[c]}if(l!==s)throw new Error(`Last split value must be data size. Expected ${s}, got ${l}`)}const r=o-1,i=et("int32",o);if(s===0||o===0){const l=new Array(s);for(let c=0;c<=r;++c)i[c]=0;return[l,i]}i[0]=0;for(let l=1;l<=r;++l){const c=t[l]-t[l-1];let u=0;this.nGramWidths.forEach(h=>{u+=this.getNumNGrams(c,h)}),this.preserveShort&&c>0&&u===0&&(u=1),i[l]=i[l-1]+u}const a=new Array(i[r]);for(let l=0;l{const d=t[l+1]-t[l],p=this.getNumNGrams(d,h);this.createNGrams(e,c,a,u,p,h),u+=p}),this.preserveShort&&u===i[l]){const h=t[l+1]-t[l];if(h===0)continue;const d=h+2*this.padWidth;this.createNGrams(e,c,a,u,1,d)}}return[a,i]}}function b1(n,e,t,s,o,r,i,a){return new DA(t,s,o,r,i,a).compute(n,e)}/** + */class AA{constructor(e,t,s,o,r,i){this.separator=bs(e),this.nGramWidths=t,this.leftPad=bs(s),this.rightPad=bs(o),this.padWidth=r,this.preserveShort=i}getPadWidth(e){return Math.min(this.padWidth<0?e-1:this.padWidth,e-1)}getNumNGrams(e,t){const s=this.getPadWidth(t);return Math.max(0,e+2*s-t+1)}createNGrams(e,t,s,o,r,i){for(let a=0;a0?0:a-l);let p=0;p+=c*this.leftPad.length;for(let b=0;bb.forEach(w=>m[g++]=w);for(let b=0;b0){x(e[d+h-1]);for(let b=0;b0){let l=t[0];if(l!==0)throw new Error(`First split value must be 0, got ${l}`);for(let c=1;c=l;if(u=u&&t[c]<=s,!u)throw new Error(`Invalid split value ${t[c]}, must be in [${l}, ${s}]`);l=t[c]}if(l!==s)throw new Error(`Last split value must be data size. Expected ${s}, got ${l}`)}const r=o-1,i=et("int32",o);if(s===0||o===0){const l=new Array(s);for(let c=0;c<=r;++c)i[c]=0;return[l,i]}i[0]=0;for(let l=1;l<=r;++l){const c=t[l]-t[l-1];let u=0;this.nGramWidths.forEach(h=>{u+=this.getNumNGrams(c,h)}),this.preserveShort&&c>0&&u===0&&(u=1),i[l]=i[l-1]+u}const a=new Array(i[r]);for(let l=0;l{const d=t[l+1]-t[l],p=this.getNumNGrams(d,h);this.createNGrams(e,c,a,u,p,h),u+=p}),this.preserveShort&&u===i[l]){const h=t[l+1]-t[l];if(h===0)continue;const d=h+2*this.padWidth;this.createNGrams(e,c,a,u,1,d)}}return[a,i]}}function b1(n,e,t,s,o,r,i,a){return new AA(t,s,o,r,i,a).compute(n,e)}/** * @license * Copyright 2021 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -8807,7 +8807,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function FA(n,e,t,s){if(!n.length)return;if(e.length===0){for(let r=0;rn-e),_A=Jd((n,e,t,s)=>({real:n-t,imag:e-s})),op=mt(ui,C1,_A),OA={kernelName:ui,backendName:"cpu",kernelFunc:op};/** + */const C1=it((n,e)=>n-e),FA=Zd((n,e,t,s)=>({real:n-t,imag:e-s})),np=mt(ui,C1,FA),_A={kernelName:ui,backendName:"cpu",kernelFunc:np};/** * @license * Copyright 2019 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -8897,7 +8897,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */var LA=Object.freeze({__proto__:null,addImpl:R0,bincountImpl:ep,bincountReduceImpl:A0,bitwiseAndImpl:D0,castImpl:E0,ceilImpl:F0,concatImpl:_0,equalImpl:O0,expImpl:M0,expm1Impl:B0,floorDivImpl:V0,floorImpl:z0,gatherNdImpl:W0,gatherV2Impl:U0,greaterEqualImpl:H0,greaterImpl:G0,lessEqualImpl:j0,lessImpl:q0,linSpaceImpl:K0,logImpl:X0,maxImpl:Y0,maximumImpl:Z0,minimumImpl:Q0,multiplyImpl:tp,negImpl:J0,notEqualImpl:e1,prodImpl:t1,raggedGatherImpl:s1,raggedRangeImpl:r1,raggedTensorToTensorImpl:l1,rangeImpl:c1,rsqrtImpl:u1,scatterImpl:Co,sigmoidImpl:IA,simpleAbsImpl:N0,sliceImpl:d1,sparseFillEmptyRowsImpl:p1,sparseReshapeImpl:f1,sparseSegmentReductionImpl:sp,sqrtImpl:vA,squaredDifferenceImpl:m1,staticRegexReplaceImpl:g1,stridedSliceImpl:x1,stringNGramsImpl:b1,stringSplitImpl:y1,stringToHashBucketFastImpl:w1,subImpl:C1,tileImpl:I1,topKImpl:k1,transposeImpl:np,uniqueImpl:v1});/** + */var OA=Object.freeze({__proto__:null,addImpl:R0,bincountImpl:Qd,bincountReduceImpl:A0,bitwiseAndImpl:D0,castImpl:E0,ceilImpl:F0,concatImpl:_0,equalImpl:O0,expImpl:M0,expm1Impl:B0,floorDivImpl:V0,floorImpl:z0,gatherNdImpl:W0,gatherV2Impl:U0,greaterEqualImpl:H0,greaterImpl:G0,lessEqualImpl:j0,lessImpl:q0,linSpaceImpl:K0,logImpl:X0,maxImpl:Y0,maximumImpl:Z0,minimumImpl:Q0,multiplyImpl:Jd,negImpl:J0,notEqualImpl:e1,prodImpl:t1,raggedGatherImpl:s1,raggedRangeImpl:r1,raggedTensorToTensorImpl:l1,rangeImpl:c1,rsqrtImpl:u1,scatterImpl:Co,sigmoidImpl:CA,simpleAbsImpl:N0,sliceImpl:d1,sparseFillEmptyRowsImpl:p1,sparseReshapeImpl:f1,sparseSegmentReductionImpl:tp,sqrtImpl:kA,squaredDifferenceImpl:m1,staticRegexReplaceImpl:g1,stridedSliceImpl:x1,stringNGramsImpl:b1,stringSplitImpl:y1,stringToHashBucketFastImpl:w1,subImpl:C1,tileImpl:I1,topKImpl:k1,transposeImpl:ep,uniqueImpl:v1});/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -8927,7 +8927,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const S1=Le(Fr,n=>n>=0?n:Math.exp(n)-1),MA={kernelName:Fr,backendName:"cpu",kernelFunc:S1};/** + */const S1=Le(Fr,n=>n>=0?n:Math.exp(n)-1),LA={kernelName:Fr,backendName:"cpu",kernelFunc:S1};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -8942,7 +8942,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function T1(n){const{inputs:e,backend:t,attrs:s}=n,{x:o}=e,{alpha:r}=s;le([o],"leakyRelu");const i=G(o.shape),a=t.data.get(o.dataId).values,l=Tt("float32",i);for(let c=0;cn<0?e*n:n);function N1(n){const{inputs:e,backend:t}=n,{x:s,alpha:o}=e;le([s,o],"prelu");const r=t.data.get(s.dataId).values,i=t.data.get(o.dataId).values,[a,l]=BA(s.shape,o.shape,r,i,"float32");return t.makeTensorInfo(l,"float32",a)}const zA={kernelName:Ka,backendName:"cpu",kernelFunc:N1};/** + */const PA=it((n,e)=>n<0?e*n:n);function N1(n){const{inputs:e,backend:t}=n,{x:s,alpha:o}=e;le([s,o],"prelu");const r=t.data.get(s.dataId).values,i=t.data.get(o.dataId).values,[a,l]=PA(s.shape,o.shape,r,i,"float32");return t.makeTensorInfo(l,"float32",a)}const BA={kernelName:Ka,backendName:"cpu",kernelFunc:N1};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the License); @@ -8972,7 +8972,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const E1=Le(Qr,n=>Math.max(0,n)),VA={kernelName:Qr,backendName:"cpu",kernelFunc:E1};/** + */const E1=Le(Qr,n=>Math.max(0,n)),zA={kernelName:Qr,backendName:"cpu",kernelFunc:E1};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the License); @@ -8987,7 +8987,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const R1=Le(Jr,n=>Math.min(Math.max(0,n),6)),WA={kernelName:Jr,backendName:"cpu",kernelFunc:R1};/** + */const R1=Le(Jr,n=>Math.min(Math.max(0,n),6)),VA={kernelName:Jr,backendName:"cpu",kernelFunc:R1};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -9017,7 +9017,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function We(n){const{inputs:e,backend:t,attrs:s}=n,{x:o}=e,{shape:r}=s,i=G(o.shape),a=Bp(r,i),l=G(a);v(i===l,()=>`The new shape (${a}) has ${l} elements and the old shape (${o.shape}) has ${i} elements. The new shape and old shape must have the same number of elements.`),t.incRef(o.dataId);const c=t.data.get(o.dataId);if(c.complexTensorInfos!=null){const u=c.complexTensorInfos.real,h=c.complexTensorInfos.imag;u.shape=a,h.shape=a}return{dataId:o.dataId,shape:a,dtype:o.dtype}}const UA={kernelName:Ya,backendName:"cpu",kernelFunc:We};/** + */function We(n){const{inputs:e,backend:t,attrs:s}=n,{x:o}=e,{shape:r}=s,i=G(o.shape),a=Bp(r,i),l=G(a);k(i===l,()=>`The new shape (${a}) has ${l} elements and the old shape (${o.shape}) has ${i} elements. The new shape and old shape must have the same number of elements.`),t.incRef(o.dataId);const c=t.data.get(o.dataId);if(c.complexTensorInfos!=null){const u=c.complexTensorInfos.real,h=c.complexTensorInfos.imag;u.shape=a,h.shape=a}return{dataId:o.dataId,shape:a,dtype:o.dtype}}const WA={kernelName:Ya,backendName:"cpu",kernelFunc:We};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the License); @@ -9032,7 +9032,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function A1(n){const{inputs:e,backend:t,attrs:s}=n,{a:o,b:r}=e,{transposeA:i,transposeB:a}=s;le([o,r],"matMul");const l=o.shape.length,c=r.shape.length,u=i?o.shape[l-2]:o.shape[l-1],h=a?r.shape[c-1]:r.shape[c-2],d=i?o.shape[l-1]:o.shape[l-2],p=a?r.shape[c-2]:r.shape[c-1],f=o.shape.slice(0,-2),m=r.shape.slice(0,-2),g=G(f),x=G(m),w=Ce(o.shape.slice(0,-2),r.shape.slice(0,-2)).concat([d,p]);v(u===h,()=>`Error in matMul: inner shapes (${u}) and (${h}) of Tensors with shapes ${o.shape} and ${r.shape} and transposeA=${i} and transposeB=${a} must match.`);const y=i?[g,u,d]:[g,d,u],C=a?[x,p,h]:[x,h,p],I=We({inputs:{x:o},backend:t,attrs:{shape:y}}),$=We({inputs:{x:r},backend:t,attrs:{shape:C}}),k=i?I.shape[1]:I.shape[2],S=i?I.shape[2]:I.shape[1],N=a?$.shape[1]:$.shape[2],A=Math.max(g,x),_=t.data.get(I.dataId).values,E=t.data.get($.dataId).values,M=ue(I.shape),z=ue($.shape),[P,H,W]=i?[M[0],1,M[1]]:[M[0],M[1],1],[q,K,j]=a?[1,z[1],z[0]]:[z[1],1,z[0]],Y=S*N,X=ke([A,S,N],I.dtype),ee=X.values,Q=t.blockSize;for(let ne=0;ne`Error in matMul: inner shapes (${u}) and (${h}) of Tensors with shapes ${o.shape} and ${r.shape} and transposeA=${i} and transposeB=${a} must match.`);const y=i?[g,u,d]:[g,d,u],C=a?[x,p,h]:[x,h,p],I=We({inputs:{x:o},backend:t,attrs:{shape:y}}),v=We({inputs:{x:r},backend:t,attrs:{shape:C}}),$=i?I.shape[1]:I.shape[2],S=i?I.shape[2]:I.shape[1],N=a?v.shape[1]:v.shape[2],A=Math.max(g,x),_=t.data.get(I.dataId).values,E=t.data.get(v.dataId).values,M=ue(I.shape),z=ue(v.shape),[P,H,W]=i?[M[0],1,M[1]]:[M[0],M[1],1],[q,K,j]=a?[1,z[1],z[0]]:[z[1],1,z[0]],Y=S*N,X=ke([A,S,N],I.dtype),ee=X.values,Q=t.blockSize;for(let ne=0;neMath.acos(n)),KA={kernelName:wr,backendName:"cpu",kernelFunc:jA};/** + */const qA=Le(wr,n=>Math.acos(n)),jA={kernelName:wr,backendName:"cpu",kernelFunc:qA};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the License); @@ -9077,7 +9077,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const XA=Le(Cr,n=>Math.acosh(n)),YA={kernelName:Cr,backendName:"cpu",kernelFunc:XA};/** + */const KA=Le(Cr,n=>Math.acosh(n)),XA={kernelName:Cr,backendName:"cpu",kernelFunc:KA};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -9092,7 +9092,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function ZA(n){const{inputs:e,backend:t}=n,s=e;le(e,"addN");const o=s.map(a=>t.data.get(a.dataId).values),r=ke(s[0].shape,s[0].dtype),i=r.values;for(let a=0;at.data.get(a.dataId).values),r=ke(s[0].shape,s[0].dtype),i=r.values;for(let a=0;ab&&(b=C,w=y)}p[g]=w}return c.forEach(g=>t.disposeIntermediateTensorInfo(g)),t.makeTensorInfo(u,"int32",p)}const oD={kernelName:ua,backendName:"cpu",kernelFunc:sD};/** + */function nD(n){const{inputs:e,backend:t,attrs:s}=n,{x:o}=e,{axis:r}=s;le(o,"argMax");let i=$e(r,o.shape);const a=Ze(i,o.shape.length);let l=o;const c=[];a!=null&&(l=qt({inputs:{x:o},backend:t,attrs:{perm:a}}),c.push(l),i=nt(i.length,l.shape.length)),i=[i[0]],$t("argMax",i,l.shape.length);const[u,h]=bt(l.shape,i),d=G(u),p=Nt(d,"int32"),f=G(h),m=t.data.get(l.dataId).values;for(let g=0;gb&&(b=C,w=y)}p[g]=w}return c.forEach(g=>t.disposeIntermediateTensorInfo(g)),t.makeTensorInfo(u,"int32",p)}const sD={kernelName:ua,backendName:"cpu",kernelFunc:nD};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -9152,7 +9152,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function rD(n){const{inputs:e,backend:t,attrs:s}=n,{x:o}=e,{axis:r}=s;le(o,"argMin");let i=$e(r,o.shape);const a=Ze(i,o.shape.length);let l=o;const c=[];a!=null&&(l=qt({inputs:{x:o},backend:t,attrs:{perm:a}}),c.push(l),i=nt(i.length,l.shape.length)),i=[i[0]],$t("argMin",i,l.shape.length);const[u,h]=bt(l.shape,i),d=G(u),p=Nt(d,"int32"),f=G(h),m=t.data.get(l.dataId).values;for(let g=0;gt.disposeIntermediateTensorInfo(g)),t.makeTensorInfo(u,"int32",p)}const iD={kernelName:ha,backendName:"cpu",kernelFunc:rD};/** + */function oD(n){const{inputs:e,backend:t,attrs:s}=n,{x:o}=e,{axis:r}=s;le(o,"argMin");let i=$e(r,o.shape);const a=Ze(i,o.shape.length);let l=o;const c=[];a!=null&&(l=qt({inputs:{x:o},backend:t,attrs:{perm:a}}),c.push(l),i=nt(i.length,l.shape.length)),i=[i[0]],$t("argMin",i,l.shape.length);const[u,h]=bt(l.shape,i),d=G(u),p=Nt(d,"int32"),f=G(h),m=t.data.get(l.dataId).values;for(let g=0;gt.disposeIntermediateTensorInfo(g)),t.makeTensorInfo(u,"int32",p)}const rD={kernelName:ha,backendName:"cpu",kernelFunc:oD};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the License); @@ -9167,7 +9167,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const aD=Le(Ir,n=>Math.asin(n)),lD={kernelName:Ir,backendName:"cpu",kernelFunc:aD};/** + */const iD=Le(Ir,n=>Math.asin(n)),aD={kernelName:Ir,backendName:"cpu",kernelFunc:iD};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the License); @@ -9182,7 +9182,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const cD=Le($r,n=>Math.asinh(n)),uD={kernelName:$r,backendName:"cpu",kernelFunc:cD};/** + */const lD=Le($r,n=>Math.asinh(n)),cD={kernelName:$r,backendName:"cpu",kernelFunc:lD};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the License); @@ -9197,7 +9197,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const hD=Le(kr,n=>Math.atan(n)),dD={kernelName:kr,backendName:"cpu",kernelFunc:hD};/** + */const uD=Le(kr,n=>Math.atan(n)),hD={kernelName:kr,backendName:"cpu",kernelFunc:uD};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the License); @@ -9212,7 +9212,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const pD=it((n,e)=>Math.atan2(n,e)),fD=mt(Sr,pD),mD={kernelName:Sr,backendName:"cpu",kernelFunc:fD};/** + */const dD=it((n,e)=>Math.atan2(n,e)),pD=mt(Sr,dD),fD={kernelName:Sr,backendName:"cpu",kernelFunc:pD};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the License); @@ -9227,7 +9227,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const gD=Le(vr,n=>Math.atanh(n)),xD={kernelName:vr,backendName:"cpu",kernelFunc:gD};/** + */const mD=Le(vr,n=>Math.atanh(n)),gD={kernelName:vr,backendName:"cpu",kernelFunc:mD};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -9242,7 +9242,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function rp(n,e,t,s,o,r){const i=o.strideHeight,a=o.strideWidth,l=o.dilationHeight,c=o.dilationWidth,u=o.effectiveFilterHeight,h=o.effectiveFilterWidth,d=o.padInfo.top,p=o.padInfo.left,f=r==="max"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,m=ke(o.outShape,t),g=m.values,x=o.outShape[1]*o.outShape[2]*o.outShape[3],b=o.outShape[2]*o.outShape[3],w=o.outShape[3];for(let y=0;yH?H=Q:r==="avg"&&(W+=Q,q++)}if(isNaN(H))break}const K=_+E*w+$;g[K]=r==="avg"?W/q:H}}}return m}function D1(n,e,t,s,o=!1,r=!1){const i=ke(s.outShape,"int32"),a=s.strideHeight,l=s.strideWidth,c=s.dilationHeight,u=s.dilationWidth,h=s.effectiveFilterHeight,d=s.effectiveFilterWidth,p=s.padInfo.top,f=s.padInfo.left,m=ke(e,t,n);for(let g=0;gN&&(N=P,o?A=r?((g*s.inHeight+_)*s.inWidth+M)*s.inChannels+x:(_*s.inWidth+M)*s.inChannels+x:A=E*d+z)}}i.set(A,g,b,I,x)}}return i}function F1(n,e,t,s,o,r){const i=o.strideDepth,a=o.strideHeight,l=o.strideWidth,c=o.dilationDepth,u=o.dilationHeight,h=o.dilationWidth,d=o.effectiveFilterDepth,p=o.effectiveFilterHeight,f=o.effectiveFilterWidth,m=o.padInfo.front,g=o.padInfo.top,x=o.padInfo.left,b=r==="max"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,w=ke(o.outShape,t),y=w.values,C=o.outShape[1]*o.outShape[2]*o.outShape[3]*o.outShape[4],I=o.outShape[2]*o.outShape[3]*o.outShape[4],$=o.outShape[3]*o.outShape[4],k=o.outShape[4];for(let S=0;Sse?se=Ye:r==="avg"&&(he+=Ye,we++),isNaN(se))break}if(isNaN(se))break}if(isNaN(se))break}const pe=ae+_;y[pe]=r==="avg"?he/Math.max(we,1):se}}}}return w}function bD(n,e){const t=ke(e.outShape,"int32"),s=e.strideDepth,o=e.strideHeight,r=e.strideWidth,i=e.dilationDepth,a=e.dilationHeight,l=e.dilationWidth,c=e.effectiveFilterDepth,u=e.effectiveFilterHeight,h=e.effectiveFilterWidth,d=e.padInfo.front,p=e.padInfo.top,f=e.padInfo.left;for(let m=0;m=E&&(E=j,M=P*u*h+W*u+K)}}}t.set(M,m,x,C,S,g)}}}return t}/** + */function sp(n,e,t,s,o,r){const i=o.strideHeight,a=o.strideWidth,l=o.dilationHeight,c=o.dilationWidth,u=o.effectiveFilterHeight,h=o.effectiveFilterWidth,d=o.padInfo.top,p=o.padInfo.left,f=r==="max"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,m=ke(o.outShape,t),g=m.values,x=o.outShape[1]*o.outShape[2]*o.outShape[3],b=o.outShape[2]*o.outShape[3],w=o.outShape[3];for(let y=0;yH?H=Q:r==="avg"&&(W+=Q,q++)}if(isNaN(H))break}const K=_+E*w+v;g[K]=r==="avg"?W/q:H}}}return m}function D1(n,e,t,s,o=!1,r=!1){const i=ke(s.outShape,"int32"),a=s.strideHeight,l=s.strideWidth,c=s.dilationHeight,u=s.dilationWidth,h=s.effectiveFilterHeight,d=s.effectiveFilterWidth,p=s.padInfo.top,f=s.padInfo.left,m=ke(e,t,n);for(let g=0;gN&&(N=P,o?A=r?((g*s.inHeight+_)*s.inWidth+M)*s.inChannels+x:(_*s.inWidth+M)*s.inChannels+x:A=E*d+z)}}i.set(A,g,b,I,x)}}return i}function F1(n,e,t,s,o,r){const i=o.strideDepth,a=o.strideHeight,l=o.strideWidth,c=o.dilationDepth,u=o.dilationHeight,h=o.dilationWidth,d=o.effectiveFilterDepth,p=o.effectiveFilterHeight,f=o.effectiveFilterWidth,m=o.padInfo.front,g=o.padInfo.top,x=o.padInfo.left,b=r==="max"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,w=ke(o.outShape,t),y=w.values,C=o.outShape[1]*o.outShape[2]*o.outShape[3]*o.outShape[4],I=o.outShape[2]*o.outShape[3]*o.outShape[4],v=o.outShape[3]*o.outShape[4],$=o.outShape[4];for(let S=0;Sse?se=Ye:r==="avg"&&(he+=Ye,we++),isNaN(se))break}if(isNaN(se))break}if(isNaN(se))break}const pe=ae+_;y[pe]=r==="avg"?he/Math.max(we,1):se}}}}return w}function xD(n,e){const t=ke(e.outShape,"int32"),s=e.strideDepth,o=e.strideHeight,r=e.strideWidth,i=e.dilationDepth,a=e.dilationHeight,l=e.dilationWidth,c=e.effectiveFilterDepth,u=e.effectiveFilterHeight,h=e.effectiveFilterWidth,d=e.padInfo.front,p=e.padInfo.top,f=e.padInfo.left;for(let m=0;m=E&&(E=j,M=P*u*h+W*u+K)}}}t.set(M,m,x,C,S,g)}}}return t}/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -9257,7 +9257,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function yD(n){const{inputs:e,backend:t,attrs:s}=n,{x:o}=e;le(o,"avgPool");const{filterSize:r,strides:i,pad:a,dimRoundingMode:l}=s,c=1;v(Et(i,c),()=>`Error in avgPool: Either strides or dilations must be 1. Got strides ${i} and dilations '${c}'`);const u=pn(o.shape,r,i,c,a,l);let h;if(u.filterWidth===1&&u.filterHeight===1&&_e(u.inShape,u.outShape))h=Jn({inputs:{x:o},backend:t});else{const d=t.data.get(o.dataId).values,p=ue(o.shape),f=rp(d,o.shape,o.dtype,p,u,"avg");h=t.makeTensorInfo(u.outShape,o.dtype,f.values)}return h}const wD={kernelName:da,backendName:"cpu",kernelFunc:yD};/** + */function bD(n){const{inputs:e,backend:t,attrs:s}=n,{x:o}=e;le(o,"avgPool");const{filterSize:r,strides:i,pad:a,dimRoundingMode:l}=s,c=1;k(Et(i,c),()=>`Error in avgPool: Either strides or dilations must be 1. Got strides ${i} and dilations '${c}'`);const u=pn(o.shape,r,i,c,a,l);let h;if(u.filterWidth===1&&u.filterHeight===1&&_e(u.inShape,u.outShape))h=Jn({inputs:{x:o},backend:t});else{const d=t.data.get(o.dataId).values,p=ue(o.shape),f=sp(d,o.shape,o.dtype,p,u,"avg");h=t.makeTensorInfo(u.outShape,o.dtype,f.values)}return h}const yD={kernelName:da,backendName:"cpu",kernelFunc:bD};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -9272,7 +9272,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function CD(n){const{inputs:e,backend:t,attrs:s}=n,{x:o}=e,{filterSize:r,strides:i,pad:a,dimRoundingMode:l,dataFormat:c}=s;le(o,"avgPool3d");const u=rs(o.shape,r,i,1,a,l,c),h=t.data.get(o.dataId).values,d=F1(h,o.shape,o.dtype,ue(o.shape),u,"avg");return t.makeTensorInfo(d.shape,"float32",d.values)}const ID={kernelName:pa,backendName:"cpu",kernelFunc:CD};/** + */function wD(n){const{inputs:e,backend:t,attrs:s}=n,{x:o}=e,{filterSize:r,strides:i,pad:a,dimRoundingMode:l,dataFormat:c}=s;le(o,"avgPool3d");const u=rs(o.shape,r,i,1,a,l,c),h=t.data.get(o.dataId).values,d=F1(h,o.shape,o.dtype,ue(o.shape),u,"avg");return t.makeTensorInfo(d.shape,"float32",d.values)}const CD={kernelName:pa,backendName:"cpu",kernelFunc:wD};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -9287,7 +9287,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function $D(n){const{inputs:e,backend:t,attrs:s}=n,{dy:o,input:r}=e,{filterSize:i,strides:a,pad:l,dimRoundingMode:c}=s;le([o,r],"avgPool3DGrad");const u=rs(r.shape,i,a,1,l,c),h=u.strideDepth,d=u.strideHeight,p=u.strideWidth,f=u.filterDepth,m=u.filterHeight,g=u.filterWidth,x=u.dilationDepth,b=u.dilationHeight,w=u.dilationWidth,y=u.effectiveFilterDepth,C=u.effectiveFilterHeight,I=u.effectiveFilterWidth,$=y-1-u.padInfo.front,k=I-1-u.padInfo.left,S=C-1-u.padInfo.top,N=ke(r.shape,"float32"),A=1/(f*m*g),_=t.bufferSync(o);for(let E=0;E=u.outDepth||Math.floor(X)!==X))for(let ee=0;ee=u.outHeight||Math.floor(Q)!==Q))for(let ne=0;ne=u.outWidth||Math.floor(ae)!==ae)continue;const se=_.get(E,X,Q,ae,M);j+=se}}}N.set(j*A,E,z,P,H,M)}return t.makeTensorInfo(N.shape,N.dtype,N.values)}const kD={kernelName:Yc,backendName:"cpu",kernelFunc:$D};/** + */function ID(n){const{inputs:e,backend:t,attrs:s}=n,{dy:o,input:r}=e,{filterSize:i,strides:a,pad:l,dimRoundingMode:c}=s;le([o,r],"avgPool3DGrad");const u=rs(r.shape,i,a,1,l,c),h=u.strideDepth,d=u.strideHeight,p=u.strideWidth,f=u.filterDepth,m=u.filterHeight,g=u.filterWidth,x=u.dilationDepth,b=u.dilationHeight,w=u.dilationWidth,y=u.effectiveFilterDepth,C=u.effectiveFilterHeight,I=u.effectiveFilterWidth,v=y-1-u.padInfo.front,$=I-1-u.padInfo.left,S=C-1-u.padInfo.top,N=ke(r.shape,"float32"),A=1/(f*m*g),_=t.bufferSync(o);for(let E=0;E=u.outDepth||Math.floor(X)!==X))for(let ee=0;ee=u.outHeight||Math.floor(Q)!==Q))for(let ne=0;ne=u.outWidth||Math.floor(ae)!==ae)continue;const se=_.get(E,X,Q,ae,M);j+=se}}}N.set(j*A,E,z,P,H,M)}return t.makeTensorInfo(N.shape,N.dtype,N.values)}const $D={kernelName:Kc,backendName:"cpu",kernelFunc:ID};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -9302,7 +9302,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function vD(n){const{inputs:e,backend:t,attrs:s}=n,{dy:o,input:r}=e,i=r;le([o,r],"avgPoolGrad");const{filterSize:a,strides:l,pad:c}=s,u=pn(i.shape,a,l,1,c),h=u.strideHeight,d=u.strideWidth,p=u.filterHeight,f=u.filterWidth,m=u.dilationHeight,g=u.dilationWidth,x=u.effectiveFilterHeight,b=u.effectiveFilterWidth,w=b-1-u.padInfo.left,y=x-1-u.padInfo.top,C=ke(i.shape,"float32"),I=1/(p*f),$=t.data.get(o.dataId).values,k=ke(o.shape,"float32",$);for(let S=0;S=u.outHeight||Math.floor(H)!==H))for(let W=0;W=u.outWidth||Math.floor(q)!==q)continue;const K=k.get(S,H,q,N);z+=K}}C.set(z*I,S,A,_,N)}return t.makeTensorInfo(C.shape,C.dtype,C.values)}const SD={kernelName:Xc,backendName:"cpu",kernelFunc:vD};/** + */function kD(n){const{inputs:e,backend:t,attrs:s}=n,{dy:o,input:r}=e,i=r;le([o,r],"avgPoolGrad");const{filterSize:a,strides:l,pad:c}=s,u=pn(i.shape,a,l,1,c),h=u.strideHeight,d=u.strideWidth,p=u.filterHeight,f=u.filterWidth,m=u.dilationHeight,g=u.dilationWidth,x=u.effectiveFilterHeight,b=u.effectiveFilterWidth,w=b-1-u.padInfo.left,y=x-1-u.padInfo.top,C=ke(i.shape,"float32"),I=1/(p*f),v=t.data.get(o.dataId).values,$=ke(o.shape,"float32",v);for(let S=0;S=u.outHeight||Math.floor(H)!==H))for(let W=0;W=u.outWidth||Math.floor(q)!==q)continue;const K=$.get(S,H,q,N);z+=K}}C.set(z*I,S,A,_,N)}return t.makeTensorInfo(C.shape,C.dtype,C.values)}const vD={kernelName:jc,backendName:"cpu",kernelFunc:kD};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -9317,7 +9317,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function TD(n){const{inputs:e,backend:t,attrs:s}=n,{x:o,scale:r,offset:i,mean:a,variance:l}=e;v(a.shape.length===l.shape.length,()=>"Batch normalization gradient requires mean and variance to have equal ranks."),v(i==null||a.shape.length===i.shape.length,()=>"Batch normalization gradient requires mean and offset to have equal ranks."),v(r==null||a.shape.length===r.shape.length,()=>"Batch normalization gradient requires mean and scale to have equal ranks."),le([o,a,l,r,i],"batchNorm");let{varianceEpsilon:c}=s;c==null&&(c=.001);const u=t.data.get(o.dataId).values,h=t.data.get(a.dataId).values,d=t.data.get(l.dataId).values,p=r?t.data.get(r.dataId).values:new Float32Array([1]),f=i?t.data.get(i.dataId).values:new Float32Array([0]),m=new Float32Array(u.length),g=f.length,x=p.length,b=d.length,w=h.length;let y=0,C=0,I=0,$=0;for(let k=0;k=g&&(y=0),C>=w&&(C=0),I>=x&&(I=0),$>=b&&($=0);return t.makeTensorInfo(o.shape,o.dtype,m)}const ND={kernelName:Sa,backendName:"cpu",kernelFunc:TD};/** + */function SD(n){const{inputs:e,backend:t,attrs:s}=n,{x:o,scale:r,offset:i,mean:a,variance:l}=e;k(a.shape.length===l.shape.length,()=>"Batch normalization gradient requires mean and variance to have equal ranks."),k(i==null||a.shape.length===i.shape.length,()=>"Batch normalization gradient requires mean and offset to have equal ranks."),k(r==null||a.shape.length===r.shape.length,()=>"Batch normalization gradient requires mean and scale to have equal ranks."),le([o,a,l,r,i],"batchNorm");let{varianceEpsilon:c}=s;c==null&&(c=.001);const u=t.data.get(o.dataId).values,h=t.data.get(a.dataId).values,d=t.data.get(l.dataId).values,p=r?t.data.get(r.dataId).values:new Float32Array([1]),f=i?t.data.get(i.dataId).values:new Float32Array([0]),m=new Float32Array(u.length),g=f.length,x=p.length,b=d.length,w=h.length;let y=0,C=0,I=0,v=0;for(let $=0;$=g&&(y=0),C>=w&&(C=0),I>=x&&(I=0),v>=b&&(v=0);return t.makeTensorInfo(o.shape,o.dtype,m)}const TD={kernelName:Sa,backendName:"cpu",kernelFunc:SD};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -9332,7 +9332,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function ED(n){const{inputs:e,backend:t,attrs:s}=n,{x:o}=e,{blockShape:r,crops:i}=s;le([o],"batchToSpaceND");const a=r.reduce((x,b)=>x*b),l=Ei(o.shape,r,a),c=Ri(l.length,r.length),u=Ai(o.shape,r,a),h=Qh(i,r.length),d=Jh(u,i,r.length),p=We({inputs:{x:o},backend:t,attrs:{shape:l}}),f=qt({inputs:{x:p},backend:t,attrs:{perm:c}}),m=We({inputs:{x:f},backend:t,attrs:{shape:u}}),g=Io({inputs:{x:m},backend:t,attrs:{begin:h,size:d}});return t.disposeIntermediateTensorInfo(p),t.disposeIntermediateTensorInfo(f),t.disposeIntermediateTensorInfo(m),g}const RD={kernelName:ma,backendName:"cpu",kernelFunc:ED};/** + */function ND(n){const{inputs:e,backend:t,attrs:s}=n,{x:o}=e,{blockShape:r,crops:i}=s;le([o],"batchToSpaceND");const a=r.reduce((x,b)=>x*b),l=Ei(o.shape,r,a),c=Ri(l.length,r.length),u=Ai(o.shape,r,a),h=Yh(i,r.length),d=Zh(u,i,r.length),p=We({inputs:{x:o},backend:t,attrs:{shape:l}}),f=qt({inputs:{x:p},backend:t,attrs:{perm:c}}),m=We({inputs:{x:f},backend:t,attrs:{shape:u}}),g=Io({inputs:{x:m},backend:t,attrs:{begin:h,size:d}});return t.disposeIntermediateTensorInfo(p),t.disposeIntermediateTensorInfo(f),t.disposeIntermediateTensorInfo(m),g}const ED={kernelName:ma,backendName:"cpu",kernelFunc:ND};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -9347,7 +9347,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function AD(n){const{inputs:e,backend:t,attrs:s}=n,{x:o,weights:r}=e,{size:i}=s,a=t.data.get(o.dataId).values,l=t.data.get(r.dataId).values,c=ep(a,l,r.dtype,r.shape,i);return t.makeTensorInfo([i],r.dtype,c)}const DD={kernelName:Zc,backendName:"cpu",kernelFunc:AD};/** + */function RD(n){const{inputs:e,backend:t,attrs:s}=n,{x:o,weights:r}=e,{size:i}=s,a=t.data.get(o.dataId).values,l=t.data.get(r.dataId).values,c=Qd(a,l,r.dtype,r.shape,i);return t.makeTensorInfo([i],r.dtype,c)}const AD={kernelName:Xc,backendName:"cpu",kernelFunc:RD};/** * @license * Copyright 2021 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -9362,7 +9362,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function FD(n){const{inputs:e,backend:t}=n,{s0:s,s1:o}=e,r=t.data.get(s.dataId).values,i=t.data.get(o.dataId).values,a=Ce(Array.from(r),Array.from(i));return t.makeTensorInfo([a.length],"int32",Int32Array.from(a))}const _D={kernelName:Hp,backendName:"cpu",kernelFunc:FD};/** + */function DD(n){const{inputs:e,backend:t}=n,{s0:s,s1:o}=e,r=t.data.get(s.dataId).values,i=t.data.get(o.dataId).values,a=Ce(Array.from(r),Array.from(i));return t.makeTensorInfo([a.length],"int32",Int32Array.from(a))}const FD={kernelName:Hp,backendName:"cpu",kernelFunc:DD};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the License); @@ -9377,7 +9377,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const OD=Le(Er,(n,e)=>{const t=e;return n>t.clipValueMax?t.clipValueMax:n{const t=e;return n>t.clipValueMax?t.clipValueMax:n{const{x:e}=n.inputs,t=n.backend,s=new Float32Array(G(e.shape)),o=t.data.get(e.dataId),r=o.complexTensorInfos.real,i=o.complexTensorInfos.imag,a=t.data.get(r.dataId).values,l=t.data.get(i.dataId).values;for(let c=0;c{const{x:e}=n.inputs,t=n.backend,s=new Float32Array(G(e.shape)),o=t.data.get(e.dataId),r=o.complexTensorInfos.real,i=o.complexTensorInfos.imag,a=t.data.get(r.dataId).values,l=t.data.get(i.dataId).values;for(let c=0;cm.shape);Xh(i,r);let a=Hn(e.map(m=>m.shape),r);if(G(a)===0)return t.makeTensorInfo(a,e[0].dtype,[]);const l=e.filter(m=>G(m.shape)>0);if(l.length===1)return Jn({inputs:{x:l[0]},backend:t});if(l[0].dtype==="complex64"){const m=l.map(y=>wo({inputs:{input:y},backend:t})),g=l.map(y=>rr({inputs:{input:y},backend:t})),x=ir({inputs:m,backend:t,attrs:{axis:r}}),b=ir({inputs:g,backend:t,attrs:{axis:r}}),w=Jt({inputs:{real:x,imag:b},backend:t});return m.forEach(y=>t.disposeIntermediateTensorInfo(y)),g.forEach(y=>t.disposeIntermediateTensorInfo(y)),t.disposeIntermediateTensorInfo(x),t.disposeIntermediateTensorInfo(b),w}const c=l.map(m=>{const x=[-1,G(m.shape.slice(r))];return We({inputs:{x:m},backend:t,attrs:{shape:x}})}),u=c.map(m=>({vals:t.data.get(m.dataId).values,shape:m.shape}));a=Hn(c.map(m=>m.shape),1);const h=c[0].shape[0]===1,d=_0(u,a,e[0].dtype,h),p=Hn(l.map(m=>m.shape),r),f=t.makeTensorInfo(p,e[0].dtype,d);return c.forEach(m=>t.disposeIntermediateTensorInfo(m)),f}const BD={kernelName:xa,backendName:"cpu",kernelFunc:ir};/** + */function ir(n){const{inputs:e,backend:t,attrs:s}=n,{axis:o}=s,r=$e(o,e[0].shape)[0],i=e.map(m=>m.shape);jh(i,r);let a=Hn(e.map(m=>m.shape),r);if(G(a)===0)return t.makeTensorInfo(a,e[0].dtype,[]);const l=e.filter(m=>G(m.shape)>0);if(l.length===1)return Jn({inputs:{x:l[0]},backend:t});if(l[0].dtype==="complex64"){const m=l.map(y=>wo({inputs:{input:y},backend:t})),g=l.map(y=>rr({inputs:{input:y},backend:t})),x=ir({inputs:m,backend:t,attrs:{axis:r}}),b=ir({inputs:g,backend:t,attrs:{axis:r}}),w=Jt({inputs:{real:x,imag:b},backend:t});return m.forEach(y=>t.disposeIntermediateTensorInfo(y)),g.forEach(y=>t.disposeIntermediateTensorInfo(y)),t.disposeIntermediateTensorInfo(x),t.disposeIntermediateTensorInfo(b),w}const c=l.map(m=>{const x=[-1,G(m.shape.slice(r))];return We({inputs:{x:m},backend:t,attrs:{shape:x}})}),u=c.map(m=>({vals:t.data.get(m.dataId).values,shape:m.shape}));a=Hn(c.map(m=>m.shape),1);const h=c[0].shape[0]===1,d=_0(u,a,e[0].dtype,h),p=Hn(l.map(m=>m.shape),r),f=t.makeTensorInfo(p,e[0].dtype,d);return c.forEach(m=>t.disposeIntermediateTensorInfo(m)),f}const PD={kernelName:xa,backendName:"cpu",kernelFunc:ir};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -9437,7 +9437,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function _1(n){const{inputs:e,backend:t,attrs:s}=n,{x:o,filter:r}=e,{strides:i,pad:a,dataFormat:l,dilations:c,dimRoundingMode:u}=s;le([o,r],"conv2d");const h=is(l),d=Ct(o.shape,r.shape,i,c,a,u,!1,h),p=d.filterHeight,f=d.filterWidth,m=d.dilationHeight,g=d.dilationWidth,x=d.padInfo.left,b=d.padInfo.top,w=d.dataFormat==="channelsLast",y=new wt(d.outShape,o.dtype),C=ue(o.shape),I=ue(r.shape),$=C[0],k=w?C[1]:C[2],S=w?C[2]:1,N=w?1:C[1],A=y.strides[0],_=w?y.strides[1]:y.strides[2],E=w?y.strides[2]:1,M=w?1:y.strides[1],z=t.data.get(o.dataId).values,P=t.data.get(r.dataId).values,H=y.values;for(let W=0;W=d.inHeight)continue;const ne=ee*I[0],ae=q+Q*k;for(let se=0;se=d.inWidth)continue;const Se=ne+pe*I[1],Xe=ae+xe*S;let Ue=Se;for(let Pe=0;Pe=d.inHeight)continue;const ne=ee*I[0],ae=q+Q*$;for(let se=0;se=d.inWidth)continue;const Se=ne+pe*I[1],Xe=ae+ge*S;let Ue=Se;for(let Pe=0;Pe=c.inDepth)continue;const W=P*S[0],q=A+H*k[1];for(let K=0;K=c.inHeight)continue;const Q=W+X*S[1],ne=q+ee*k[2];for(let ae=0;ae=c.inWidth)continue;const xe=Q+we*S[2],Se=ne+pe*c.inChannels;let Xe=xe;for(let Ue=0;Ue=c.inDepth)continue;const W=P*S[0],q=A+H*$[1];for(let K=0;K=c.inHeight)continue;const Q=W+X*S[1],ne=q+ee*$[2];for(let ae=0;ae=c.inWidth)continue;const ge=Q+we*S[2],Se=ne+pe*c.inChannels;let Xe=ge;for(let Ue=0;UeMath.cos(n)),QD={kernelName:Rr,backendName:"cpu",kernelFunc:ZD};/** + */const YD=Le(Rr,n=>Math.cos(n)),ZD={kernelName:Rr,backendName:"cpu",kernelFunc:YD};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the License); @@ -9542,7 +9542,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const JD=Le(Ar,n=>Math.cosh(n)),eF={kernelName:Ar,backendName:"cpu",kernelFunc:JD};/** + */const QD=Le(Ar,n=>Math.cosh(n)),JD={kernelName:Ar,backendName:"cpu",kernelFunc:QD};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -9557,7 +9557,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function tF(n){const{inputs:e,backend:t,attrs:s}=n,{image:o,boxes:r,boxInd:i}=e,{cropSize:a,method:l,extrapolationValue:c}=s,[u,h,d,p]=o.shape,f=r.shape[0],[m,g]=a,x=ke([f,m,g,p],"float32"),b=t.data.get(r.dataId).values,w=t.data.get(i.dataId).values,y=t.data.get(o.dataId).values,C=ue(o.shape),I=ue(x.shape);for(let $=0;$=u)continue;const M=m>1?(A-S)*(h-1)/(m-1):0,z=g>1?(_-N)*(d-1)/(g-1):0;for(let P=0;P1?S*(h-1)+P*M:.5*(S+A)*(h-1);if(H<0||H>h-1){for(let W=0;W1?N*(d-1)+j*z:.5*(N+_)*(d-1);if(Y<0||Y>d-1){for(let ne=0;ne1?N*(d-1)+W*z:.5*(N+_)*(d-1);if(q<0||q>d-1){for(let Y=0;Y=u)continue;const M=m>1?(A-S)*(h-1)/(m-1):0,z=g>1?(_-N)*(d-1)/(g-1):0;for(let P=0;P1?S*(h-1)+P*M:.5*(S+A)*(h-1);if(H<0||H>h-1){for(let W=0;W1?N*(d-1)+j*z:.5*(N+_)*(d-1);if(Y<0||Y>d-1){for(let ne=0;ne1?N*(d-1)+W*z:.5*(N+_)*(d-1);if(q<0||q>d-1){for(let Y=0;Yx+f-b-1:(x,b)=>x+b;for(let x=0;xx+f-b-1:(x,b)=>x+b;for(let x=0;xx+f-b-1:(x,b)=>x+b;for(let x=0;xx+f-b-1:(x,b)=>x+b;for(let x=0;x`Only NHWC dataFormat supported on CPU for depthToSpace. Got ${i}`);const a=o.shape[0],l=o.shape[1],c=o.shape[2],u=o.shape[3],h=l*r,d=c*r,p=u/(r*r),f=t.data.get(o.dataId).values,m=new Float32Array(a*h*d*p);let g=0;for(let x=0;x`Only NHWC dataFormat supported on CPU for depthToSpace. Got ${i}`);const a=o.shape[0],l=o.shape[1],c=o.shape[2],u=o.shape[3],h=l*r,d=c*r,p=u/(r*r),f=t.data.get(o.dataId).values,m=new Float32Array(a*h*d*p);let g=0;for(let x=0;x`Error in depthwiseConv2d: Either strides or dilations must be 1. Got strides ${i} and dilations '${d}'`);const p=Ct(o.shape,r.shape,i,d,a,c,!0),{filterHeight:f,filterWidth:m,dilationHeight:g,dilationWidth:x,padInfo:b}=p,w=b.left,y=b.top,C=p.outChannels/p.inChannels,I=new wt(p.outShape,o.dtype),$=t.data.get(o.dataId).values,k=t.data.get(r.dataId).values,S=I.values;for(let N=0;N=p.inHeight)continue;const W=P*h[0],q=A+H*u[1];for(let K=0;K=p.inWidth)continue;const Q=W+X*h[1],ne=q+ee*p.inChannels;let ae=j,se=Q;for(let he=0;he`Error in depthwiseConv2d: Either strides or dilations must be 1. Got strides ${i} and dilations '${d}'`);const p=Ct(o.shape,r.shape,i,d,a,c,!0),{filterHeight:f,filterWidth:m,dilationHeight:g,dilationWidth:x,padInfo:b}=p,w=b.left,y=b.top,C=p.outChannels/p.inChannels,I=new wt(p.outShape,o.dtype),v=t.data.get(o.dataId).values,$=t.data.get(r.dataId).values,S=I.values;for(let N=0;N=p.inHeight)continue;const W=P*h[0],q=A+H*u[1];for(let K=0;K=p.inWidth)continue;const Q=W+X*h[1],ne=q+ee*p.inChannels;let ae=j,se=Q;for(let he=0;he{const{x:s,filter:o}=n,{strides:r,pad:i,dilations:a}=t,l=e,c=l.data.get(s.dataId).values,u=s.shape.length,h=l.data.get(o.dataId).values,d=o.shape.length,{batchSize:p,inHeight:f,inWidth:m,inChannels:g,outHeight:x,outWidth:b,padInfo:w,strideHeight:y,strideWidth:C,filterHeight:I,filterWidth:$,dilationHeight:k,dilationWidth:S,outShape:N}=bi(s.shape,o.shape,r,i,"NHWC",a),A=G(N),_=N.length,E=et(s.dtype,A);for(let z=0;z=0&&ee=0&&nej&&(j=he)}}}const Y=Pn([z,P,W,K],_,ue(N));E[Y]=j}}}return{dataId:l.write(Xs(E,s.dtype),N,s.dtype),shape:N,dtype:s.dtype}}};/** + */const xF={kernelName:$a,backendName:"cpu",kernelFunc:({inputs:n,backend:e,attrs:t})=>{const{x:s,filter:o}=n,{strides:r,pad:i,dilations:a}=t,l=e,c=l.data.get(s.dataId).values,u=s.shape.length,h=l.data.get(o.dataId).values,d=o.shape.length,{batchSize:p,inHeight:f,inWidth:m,inChannels:g,outHeight:x,outWidth:b,padInfo:w,strideHeight:y,strideWidth:C,filterHeight:I,filterWidth:v,dilationHeight:$,dilationWidth:S,outShape:N}=bi(s.shape,o.shape,r,i,"NHWC",a),A=G(N),_=N.length,E=et(s.dtype,A);for(let z=0;z=0&&ee=0&&nej&&(j=he)}}}const Y=Pn([z,P,W,K],_,ue(N));E[Y]=j}}}return{dataId:l.write(Xs(E,s.dtype),N,s.dtype),shape:N,dtype:s.dtype}}};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -9707,7 +9707,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const yF={kernelName:uu,backendName:"cpu",kernelFunc:({inputs:n,backend:e,attrs:t})=>{const{x:s,filter:o,dy:r}=n,{strides:i,pad:a,dilations:l}=t,c=e,u=$n(s.shape,c.data.get(s.dataId).values),h=$n(o.shape,c.data.get(o.dataId).values),{batchSize:d,inHeight:p,inWidth:f,inChannels:m,outHeight:g,outWidth:x,padInfo:b,strideHeight:w,strideWidth:y,filterHeight:C,filterWidth:I,dilationHeight:$,dilationWidth:k,outShape:S}=bi(s.shape,o.shape,i,a,"NHWC",l);v(r.rank===S.length,()=>`Error in ${uu}, dy must have the same rank as output ${S.length}, but got ${r.rank}`);const N=$n(S,c.data.get(r.dataId).values),A=Wp(o.shape,o.dtype);for(let E=0;E=0&&X=0&&Qq&&(q=ne,K=Y,j=ee)}}}A[K][j][W]+=N[E][M][P][W]}}}return{dataId:c.write(Xs(A,s.dtype),o.shape,o.dtype),shape:o.shape,dtype:o.dtype}}};/** + */const bF={kernelName:lu,backendName:"cpu",kernelFunc:({inputs:n,backend:e,attrs:t})=>{const{x:s,filter:o,dy:r}=n,{strides:i,pad:a,dilations:l}=t,c=e,u=$n(s.shape,c.data.get(s.dataId).values),h=$n(o.shape,c.data.get(o.dataId).values),{batchSize:d,inHeight:p,inWidth:f,inChannels:m,outHeight:g,outWidth:x,padInfo:b,strideHeight:w,strideWidth:y,filterHeight:C,filterWidth:I,dilationHeight:v,dilationWidth:$,outShape:S}=bi(s.shape,o.shape,i,a,"NHWC",l);k(r.rank===S.length,()=>`Error in ${lu}, dy must have the same rank as output ${S.length}, but got ${r.rank}`);const N=$n(S,c.data.get(r.dataId).values),A=Wp(o.shape,o.dtype);for(let E=0;E=0&&X=0&&Qq&&(q=ne,K=Y,j=ee)}}}A[K][j][W]+=N[E][M][P][W]}}}return{dataId:c.write(Xs(A,s.dtype),o.shape,o.dtype),shape:o.shape,dtype:o.dtype}}};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -9722,7 +9722,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const wF={kernelName:cu,backendName:"cpu",kernelFunc:({inputs:n,backend:e,attrs:t})=>{const{x:s,filter:o,dy:r}=n,{strides:i,pad:a,dilations:l}=t,c=e,u=$n(s.shape,c.data.get(s.dataId).values),h=$n(o.shape,c.data.get(o.dataId).values),{batchSize:d,inHeight:p,inWidth:f,inChannels:m,outHeight:g,outWidth:x,padInfo:b,strideHeight:w,strideWidth:y,filterHeight:C,filterWidth:I,dilationHeight:$,dilationWidth:k,outShape:S}=bi(s.shape,o.shape,i,a,"NHWC",l);v(r.rank===S.length,()=>`Error in ${cu}, dy must have the same rank as output ${S.length}, but got ${r.rank}`);const N=$n(S,c.data.get(r.dataId).values),A=Wp(s.shape,s.dtype);for(let E=0;E=0&&X=0&&Qq&&(q=ne,K=X,j=Q)}}}A[E][K][j][W]+=N[E][M][P][W]}}}return{dataId:c.write(Xs(A,s.dtype),s.shape,s.dtype),shape:s.shape,dtype:s.dtype}}};/** + */const yF={kernelName:au,backendName:"cpu",kernelFunc:({inputs:n,backend:e,attrs:t})=>{const{x:s,filter:o,dy:r}=n,{strides:i,pad:a,dilations:l}=t,c=e,u=$n(s.shape,c.data.get(s.dataId).values),h=$n(o.shape,c.data.get(o.dataId).values),{batchSize:d,inHeight:p,inWidth:f,inChannels:m,outHeight:g,outWidth:x,padInfo:b,strideHeight:w,strideWidth:y,filterHeight:C,filterWidth:I,dilationHeight:v,dilationWidth:$,outShape:S}=bi(s.shape,o.shape,i,a,"NHWC",l);k(r.rank===S.length,()=>`Error in ${au}, dy must have the same rank as output ${S.length}, but got ${r.rank}`);const N=$n(S,c.data.get(r.dataId).values),A=Wp(s.shape,s.dtype);for(let E=0;E=0&&X=0&&Qq&&(q=ne,K=X,j=Q)}}}A[E][K][j][W]+=N[E][M][P][W]}}}return{dataId:c.write(Xs(A,s.dtype),s.shape,s.dtype),shape:s.shape,dtype:s.dtype}}};/** * @license * Copyright 2023 Google LLC. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -9737,7 +9737,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function CF(n){const{inputs:e,backend:t,attrs:s}=n,{image:o}=e,{canvas:r,options:i}=s,{contextOptions:a,imageOptions:l}=i||{},c=(l==null?void 0:l.alpha)||1,u=(a==null?void 0:a.contextType)||"2d";if(u!=="2d")throw new Error(`Context type ${a.contextType} is not supported by the CPU backend.`);const h=r.getContext(u,(a==null?void 0:a.contextAttributes)||{});if(h==null)throw new Error(`Could not get the context with ${u} type.`);const[d,p]=o.shape.slice(0,2),f=o.shape.length===2?1:o.shape[2],m=t.data.get(o.dataId).values,g=o.dtype==="float32"?255:1,x=new Uint8ClampedArray(p*d*4);for(let w=0;w1)throw new Error(`Tensor values for a float32 Tensor must be in the range [0 - 1] but encountered ${$}.`)}else if(o.dtype==="int32"&&($<0||$>255))throw new Error(`Tensor values for a int32 Tensor must be in the range [0 - 255] but encountered ${$}.`);f===1?(y[0]=$*g,y[1]=$*g,y[2]=$*g):y[I]=$*g}const C=w*4;x[C+0]=Math.round(y[0]),x[C+1]=Math.round(y[1]),x[C+2]=Math.round(y[2]),x[C+3]=Math.round(y[3])}r.width=p,r.height=d;const b=new ImageData(x,p,d);return h.putImageData(b,0,0),o}const IF={kernelName:Lw,backendName:"cpu",kernelFunc:CF};/** + */function wF(n){const{inputs:e,backend:t,attrs:s}=n,{image:o}=e,{canvas:r,options:i}=s,{contextOptions:a,imageOptions:l}=i||{},c=(l==null?void 0:l.alpha)||1,u=(a==null?void 0:a.contextType)||"2d";if(u!=="2d")throw new Error(`Context type ${a.contextType} is not supported by the CPU backend.`);const h=r.getContext(u,(a==null?void 0:a.contextAttributes)||{});if(h==null)throw new Error(`Could not get the context with ${u} type.`);const[d,p]=o.shape.slice(0,2),f=o.shape.length===2?1:o.shape[2],m=t.data.get(o.dataId).values,g=o.dtype==="float32"?255:1,x=new Uint8ClampedArray(p*d*4);for(let w=0;w1)throw new Error(`Tensor values for a float32 Tensor must be in the range [0 - 1] but encountered ${v}.`)}else if(o.dtype==="int32"&&(v<0||v>255))throw new Error(`Tensor values for a int32 Tensor must be in the range [0 - 255] but encountered ${v}.`);f===1?(y[0]=v*g,y[1]=v*g,y[2]=v*g):y[I]=v*g}const C=w*4;x[C+0]=Math.round(y[0]),x[C+1]=Math.round(y[1]),x[C+2]=Math.round(y[2]),x[C+3]=Math.round(y[3])}r.width=p,r.height=d;const b=new ImageData(x,p,d);return h.putImageData(b,0,0),o}const CF={kernelName:Ow,backendName:"cpu",kernelFunc:wF};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -9752,7 +9752,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function Xi(n){const{inputs:e,backend:t,attrs:s}=n,{x:o}=e,{axis:r,keepDims:i}=s;le(o,"sum");let a;o.dtype==="bool"?a=_s({inputs:{x:o},backend:t,attrs:{dtype:"int32"}}):a=Jn({inputs:{x:o},backend:t});const l=a.shape.length,c=$e(r,a.shape),u=Ze(c,l);let h=c,d=a;u!=null&&(d=qt({inputs:{x:a},backend:t,attrs:{perm:u}}),h=nt(h.length,l)),$t("sum",h,d.shape.length);const[p,f]=bt(d.shape,h),m=Yt(d.dtype,"int32");let g=rc(t,p,m);const x=G(f),b=t.data.get(g.dataId).values,w=t.data.get(d.dataId).values;for(let y=0;y=0&&(d=Xi({inputs:{x:d},backend:t,attrs:{axis:c[m]-(i.length-p),keepDims:!1}}),f.push(d)),p--)}for(const m of f)m!==d&&t.disposeIntermediateTensorInfo(m);return d}const vF={kernelName:hu,backendName:"cpu",kernelFunc:kF};/** + */function $F(n){const{inputs:e,backend:t,attrs:s}=n,{equation:o}=s,r=e,{allDims:i,summedDims:a,idDims:l}=id(o,r.length);ld(i.length,l,r);const{path:c,steps:u}=cd(a,l),h=u.length;let d=null,p=i.length;const f=[];for(let m=0;m=0&&(d=Xi({inputs:{x:d},backend:t,attrs:{axis:c[m]-(i.length-p),keepDims:!1}}),f.push(d)),p--)}for(const m of f)m!==d&&t.disposeIntermediateTensorInfo(m);return d}const kF={kernelName:cu,backendName:"cpu",kernelFunc:$F};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -9782,7 +9782,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function SF(n){const{inputs:e,backend:t}=n,{dy:s,y:o}=e;le([s,o],"eluGrad");const r=new Float32Array(G(o.shape)),i=t.data.get(o.dataId).values,a=t.data.get(s.dataId).values;for(let l=0;l=0?r[l]=a[l]:r[l]=a[l]*(c+1)}return t.makeTensorInfo(o.shape,"float32",r)}const TF={kernelName:du,backendName:"cpu",kernelFunc:SF};/** + */function vF(n){const{inputs:e,backend:t}=n,{dy:s,y:o}=e;le([s,o],"eluGrad");const r=new Float32Array(G(o.shape)),i=t.data.get(o.dataId).values,a=t.data.get(s.dataId).values;for(let l=0;l=0?r[l]=a[l]:r[l]=a[l]*(c+1)}return t.makeTensorInfo(o.shape,"float32",r)}const SF={kernelName:uu,backendName:"cpu",kernelFunc:vF};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the License); @@ -9797,7 +9797,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const NF=ed,EF=td,RF=nd,AF=sd,DF=od,FF=rd,_F=Le(_r,n=>{const e=Math.sign(n),t=Math.abs(n),s=1/(1+NF*t);return e*(1-((((FF*s+DF)*s+AF)*s+RF)*s+EF)*s*Math.exp(-t*t))}),OF={kernelName:_r,backendName:"cpu",kernelFunc:_F};/** + */const TF=Qh,NF=Jh,EF=ed,RF=td,AF=nd,DF=sd,FF=Le(_r,n=>{const e=Math.sign(n),t=Math.abs(n),s=1/(1+TF*t);return e*(1-((((DF*s+AF)*s+RF)*s+EF)*s+NF)*s*Math.exp(-t*t))}),_F={kernelName:_r,backendName:"cpu",kernelFunc:FF};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -9812,7 +9812,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function cc(n){const{inputs:e,backend:t,attrs:s}=n,{input:o}=e,{dim:r}=s,i=o.shape.length,a=o.shape.slice();let l=r;return r<0&&(v(-(i+1)<=r,()=>`Axis must be in the interval [${-(i+1)}, ${i}]`),l=i+r+1),a.splice(l,0,1),We({inputs:{x:o},backend:t,attrs:{shape:a}})}const LF={kernelName:va,backendName:"cpu",kernelFunc:cc};/** + */function cc(n){const{inputs:e,backend:t,attrs:s}=n,{input:o}=e,{dim:r}=s,i=o.shape.length,a=o.shape.slice();let l=r;return r<0&&(k(-(i+1)<=r,()=>`Axis must be in the interval [${-(i+1)}, ${i}]`),l=i+r+1),a.splice(l,0,1),We({inputs:{x:o},backend:t,attrs:{shape:a}})}const OF={kernelName:va,backendName:"cpu",kernelFunc:cc};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -9827,7 +9827,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const MF=it((n,e)=>n/e),ip=mt(Dr,MF),ap={kernelName:Dr,backendName:"cpu",kernelFunc:ip};/** + */const LF=it((n,e)=>n/e),op=mt(Dr,LF),rp={kernelName:Dr,backendName:"cpu",kernelFunc:op};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -9842,7 +9842,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function L1(n,e,t){const s=n.shape,o=s[0],r=s[1],i=t.data.get(n.dataId),a=i.complexTensorInfos.real,l=i.complexTensorInfos.imag,c=[o,r],u=G(c),h=Tt("float32",u),d=Tt("float32",u);for(let g=0;g{const{image:s}=n,o=t,r=Tt(s.dtype,G(s.shape)),[i,a,l,c]=s.shape,u=o.data.get(s.dataId).values;for(let d=0;d=0&&w{const{image:s}=n,o=t,r=Tt(s.dtype,G(s.shape)),[i,a,l,c]=s.shape,u=o.data.get(s.dataId).values;for(let d=0;d=0&&w=0,()=>`GatherV2: the index value ${C} is not in [0, ${u-1}]`)}let h=a;a==null&&(h=0);const d=G(r.shape),p=md(o,r,l,h),f=We({inputs:{x:o},backend:t,attrs:{shape:[p.batchSize,p.outerSize,p.dimSize,p.sliceSize]}}),m=We({inputs:{x:r},backend:t,attrs:{shape:[p.batchSize,d/p.batchSize]}}),g=[p.batchSize,p.outerSize,d/p.batchSize,p.sliceSize],x=t.bufferSync(m),b=t.bufferSync(f),w=U0(b,x,g);return t.disposeIntermediateTensorInfo(f),t.disposeIntermediateTensorInfo(m),t.makeTensorInfo(p.outputShape,w.dtype,w.values)}const JF={kernelName:Ta,backendName:"cpu",kernelFunc:QF};/** + */function ZF(n){const{inputs:e,backend:t,attrs:s}=n,{x:o,indices:r}=e,{axis:i,batchDims:a}=s;le([o,r],"gatherV2");const l=$e(i,o.shape)[0],c=t.data.get(r.dataId).values,u=o.shape[l];for(let y=0;y=0,()=>`GatherV2: the index value ${C} is not in [0, ${u-1}]`)}let h=a;a==null&&(h=0);const d=G(r.shape),p=pd(o,r,l,h),f=We({inputs:{x:o},backend:t,attrs:{shape:[p.batchSize,p.outerSize,p.dimSize,p.sliceSize]}}),m=We({inputs:{x:r},backend:t,attrs:{shape:[p.batchSize,d/p.batchSize]}}),g=[p.batchSize,p.outerSize,d/p.batchSize,p.sliceSize],x=t.bufferSync(m),b=t.bufferSync(f),w=U0(b,x,g);return t.disposeIntermediateTensorInfo(f),t.disposeIntermediateTensorInfo(m),t.makeTensorInfo(p.outputShape,w.dtype,w.values)}const QF={kernelName:Ta,backendName:"cpu",kernelFunc:ZF};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -9962,7 +9962,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function e_(n){const{inputs:e,backend:t}=n,{input:s}=e,o=G(s.shape),r=s.shape[s.shape.length-1],i=o/r,a=We({inputs:{x:s},backend:t,attrs:{shape:[i,r]}}),l=L1(a,!0,t),c=We({inputs:{x:l},backend:t,attrs:{shape:s.shape}});return t.disposeIntermediateTensorInfo(a),t.disposeIntermediateTensorInfo(l),c}const t_={kernelName:gu,backendName:"cpu",kernelFunc:e_};/** + */function JF(n){const{inputs:e,backend:t}=n,{input:s}=e,o=G(s.shape),r=s.shape[s.shape.length-1],i=o/r,a=We({inputs:{x:s},backend:t,attrs:{shape:[i,r]}}),l=L1(a,!0,t),c=We({inputs:{x:l},backend:t,attrs:{shape:s.shape}});return t.disposeIntermediateTensorInfo(a),t.disposeIntermediateTensorInfo(l),c}const e_={kernelName:fu,backendName:"cpu",kernelFunc:JF};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the License); @@ -9977,7 +9977,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const n_=Le(Vr,n=>Number.isFinite(n)?1:0,"bool"),s_={kernelName:Vr,backendName:"cpu",kernelFunc:n_};/** + */const t_=Le(Vr,n=>Number.isFinite(n)?1:0,"bool"),n_={kernelName:Vr,backendName:"cpu",kernelFunc:t_};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the License); @@ -9992,7 +9992,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const o_=Le(Wr,n=>Math.abs(n)===1/0?1:0,"bool"),r_={kernelName:Wr,backendName:"cpu",kernelFunc:o_};/** + */const s_=Le(Wr,n=>Math.abs(n)===1/0?1:0,"bool"),o_={kernelName:Wr,backendName:"cpu",kernelFunc:s_};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the License); @@ -10007,7 +10007,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const i_=Le(Ur,n=>Number.isNaN(n)?1:0,"bool"),a_={kernelName:Ur,backendName:"cpu",kernelFunc:i_};/** + */const r_=Le(Ur,n=>Number.isNaN(n)?1:0,"bool"),i_={kernelName:Ur,backendName:"cpu",kernelFunc:r_};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -10022,7 +10022,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function l_(n){const{backend:e,attrs:t}=n,{start:s,stop:o,num:r}=t,i=K0(s,o,r);return e.makeTensorInfo([i.length],"float32",i)}const c_={kernelName:Kp,backendName:"cpu",kernelFunc:l_};/** + */function a_(n){const{backend:e,attrs:t}=n,{start:s,stop:o,num:r}=t,i=K0(s,o,r);return e.makeTensorInfo([i.length],"float32",i)}const l_={kernelName:Kp,backendName:"cpu",kernelFunc:a_};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the License); @@ -10037,7 +10037,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const u_=Le(Hr,n=>Math.log1p(n)),h_={kernelName:Hr,backendName:"cpu",kernelFunc:u_};/** + */const c_=Le(Hr,n=>Math.log1p(n)),u_={kernelName:Hr,backendName:"cpu",kernelFunc:c_};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -10052,7 +10052,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const d_=it((n,e)=>n&&e),p_=mt(Da,d_,null,"bool"),f_={kernelName:Da,backendName:"cpu",kernelFunc:p_};/** + */const h_=it((n,e)=>n&&e),d_=mt(Da,h_,null,"bool"),p_={kernelName:Da,backendName:"cpu",kernelFunc:d_};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the License); @@ -10067,7 +10067,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const m_=Le(Fa,n=>n?0:1,"bool"),g_={kernelName:Fa,backendName:"cpu",kernelFunc:m_};/** + */const f_=Le(Fa,n=>n?0:1,"bool"),m_={kernelName:Fa,backendName:"cpu",kernelFunc:f_};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -10082,7 +10082,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const x_=it((n,e)=>n||e),b_=mt(_a,x_,null,"bool"),y_={kernelName:_a,backendName:"cpu",kernelFunc:b_};/** + */const g_=it((n,e)=>n||e),x_=mt(_a,g_,null,"bool"),b_={kernelName:_a,backendName:"cpu",kernelFunc:x_};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -10097,7 +10097,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function w_(n){const{inputs:e,backend:t,attrs:s}=n,{x:o}=e,{depthRadius:r,bias:i,alpha:a,beta:l}=s;le(o,"LRN");const c=o.shape[3],u=c-1,h=t.data.get(o.dataId).values,d=G(o.shape),p=new Float32Array(d);function f(m){const g=m%c;let x=m-g+Math.max(0,g-r);const b=m-g+Math.min(g+r,u);let w=0;for(;x<=b;x++){const y=h[x];w+=y*y}return w}for(let m=0;m`Error in maxPool: Either strides or dilations must be 1. Got strides ${i} and dilations '${c}'`);const u=pn(o.shape,r,i,c,a,l);let h;if(u.filterWidth===1&&u.filterHeight===1&&_e(u.inShape,u.outShape))h=Jn({inputs:{x:o},backend:t});else{const d=t.data.get(o.dataId).values,p=ue(o.shape),f=rp(d,o.shape,o.dtype,p,u,"max");h=t.makeTensorInfo(u.outShape,o.dtype,f.values)}return h}const S_={kernelName:Ma,backendName:"cpu",kernelFunc:v_};/** + */function k_(n){const{inputs:e,backend:t,attrs:s}=n,{x:o}=e;le(o,"maxPool");const{filterSize:r,strides:i,pad:a,dimRoundingMode:l}=s,c=1;k(Et(i,c),()=>`Error in maxPool: Either strides or dilations must be 1. Got strides ${i} and dilations '${c}'`);const u=pn(o.shape,r,i,c,a,l);let h;if(u.filterWidth===1&&u.filterHeight===1&&_e(u.inShape,u.outShape))h=Jn({inputs:{x:o},backend:t});else{const d=t.data.get(o.dataId).values,p=ue(o.shape),f=sp(d,o.shape,o.dtype,p,u,"max");h=t.makeTensorInfo(u.outShape,o.dtype,f.values)}return h}const v_={kernelName:Ma,backendName:"cpu",kernelFunc:k_};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -10157,7 +10157,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function T_(n){const{inputs:e,backend:t,attrs:s}=n,{x:o}=e,{filterSize:r,strides:i,pad:a,dimRoundingMode:l,dataFormat:c}=s;le(o,"maxPool3d");const u=rs(o.shape,r,i,1,a,l,c),h=t.data.get(o.dataId).values,d=F1(h,o.shape,o.dtype,ue(o.shape),u,"max");return t.makeTensorInfo(d.shape,"float32",d.values)}const N_={kernelName:Pa,backendName:"cpu",kernelFunc:T_};/** + */function S_(n){const{inputs:e,backend:t,attrs:s}=n,{x:o}=e,{filterSize:r,strides:i,pad:a,dimRoundingMode:l,dataFormat:c}=s;le(o,"maxPool3d");const u=rs(o.shape,r,i,1,a,l,c),h=t.data.get(o.dataId).values,d=F1(h,o.shape,o.dtype,ue(o.shape),u,"max");return t.makeTensorInfo(d.shape,"float32",d.values)}const T_={kernelName:Pa,backendName:"cpu",kernelFunc:S_};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -10172,7 +10172,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function E_(n){const{inputs:e,backend:t,attrs:s}=n,{dy:o,input:r}=e,{filterSize:i,strides:a,pad:l,dimRoundingMode:c}=s;le([o,r],"maxPool3DGrad");const u=rs(r.shape,i,a,1,l,c),h=t.bufferSync(r),d=bD(h,u),p=u.strideDepth,f=u.strideHeight,m=u.strideWidth,g=u.dilationDepth,x=u.dilationHeight,b=u.dilationWidth,w=u.effectiveFilterDepth,y=u.effectiveFilterHeight,C=u.effectiveFilterWidth,I=w-1-u.padInfo.front,$=C-1-u.padInfo.left,k=y-1-u.padInfo.top,S=ke(r.shape,"float32"),N=t.bufferSync(o);for(let A=0;A=u.outDepth||Math.floor(j)!==j))for(let Y=0;Y=u.outHeight||Math.floor(X)!==X))for(let ee=0;ee=u.outWidth||Math.floor(Q)!==Q)continue;const ne=w*y*C-1-d.get(A,j,X,Q,_),ae=K*y*C+Y*C+ee,se=ne===ae?1:0;if(se===0)continue;const he=N.get(A,j,X,Q,_);q+=he*se}}}S.set(q,A,E,M,z,_)}return t.makeTensorInfo(S.shape,S.dtype,S.values)}const R_={kernelName:wu,backendName:"cpu",kernelFunc:E_};/** + */function N_(n){const{inputs:e,backend:t,attrs:s}=n,{dy:o,input:r}=e,{filterSize:i,strides:a,pad:l,dimRoundingMode:c}=s;le([o,r],"maxPool3DGrad");const u=rs(r.shape,i,a,1,l,c),h=t.bufferSync(r),d=xD(h,u),p=u.strideDepth,f=u.strideHeight,m=u.strideWidth,g=u.dilationDepth,x=u.dilationHeight,b=u.dilationWidth,w=u.effectiveFilterDepth,y=u.effectiveFilterHeight,C=u.effectiveFilterWidth,I=w-1-u.padInfo.front,v=C-1-u.padInfo.left,$=y-1-u.padInfo.top,S=ke(r.shape,"float32"),N=t.bufferSync(o);for(let A=0;A=u.outDepth||Math.floor(j)!==j))for(let Y=0;Y=u.outHeight||Math.floor(X)!==X))for(let ee=0;ee=u.outWidth||Math.floor(Q)!==Q)continue;const ne=w*y*C-1-d.get(A,j,X,Q,_),ae=K*y*C+Y*C+ee,se=ne===ae?1:0;if(se===0)continue;const he=N.get(A,j,X,Q,_);q+=he*se}}}S.set(q,A,E,M,z,_)}return t.makeTensorInfo(S.shape,S.dtype,S.values)}const E_={kernelName:bu,backendName:"cpu",kernelFunc:N_};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -10187,7 +10187,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function A_(n){const{inputs:e,backend:t,attrs:s}=n,{dy:o,input:r,output:i}=e,a=r;le([r,i],"maxPoolGrad");const{filterSize:l,strides:c,pad:u,dimRoundingMode:h}=s,d=pn(a.shape,l,c,1,u,h),p=t.data.get(a.dataId).values,f=ke(d.outShape,a.dtype,D1(p,a.shape,a.dtype,d).values),m=d.strideHeight,g=d.strideWidth,x=d.dilationHeight,b=d.dilationWidth,w=d.effectiveFilterHeight,y=d.effectiveFilterWidth,C=y-1-d.padInfo.left,I=w-1-d.padInfo.top,$=ke(a.shape,"float32"),k=t.data.get(o.dataId).values,S=ke(o.shape,"float32",k);for(let N=0;N=d.outHeight||Math.floor(W)!==W))for(let q=0;q=d.outWidth||Math.floor(K)!==K)continue;const j=w*y-1-f.get(N,W,K,A),Y=H*y+q,X=j===Y?1:0;if(X===0)continue;const ee=S.get(N,W,K,A);P+=ee*X}}$.set(P,N,_,E,A)}return t.makeTensorInfo($.shape,$.dtype,$.values)}const D_={kernelName:yu,backendName:"cpu",kernelFunc:A_};/** + */function R_(n){const{inputs:e,backend:t,attrs:s}=n,{dy:o,input:r,output:i}=e,a=r;le([r,i],"maxPoolGrad");const{filterSize:l,strides:c,pad:u,dimRoundingMode:h}=s,d=pn(a.shape,l,c,1,u,h),p=t.data.get(a.dataId).values,f=ke(d.outShape,a.dtype,D1(p,a.shape,a.dtype,d).values),m=d.strideHeight,g=d.strideWidth,x=d.dilationHeight,b=d.dilationWidth,w=d.effectiveFilterHeight,y=d.effectiveFilterWidth,C=y-1-d.padInfo.left,I=w-1-d.padInfo.top,v=ke(a.shape,"float32"),$=t.data.get(o.dataId).values,S=ke(o.shape,"float32",$);for(let N=0;N=d.outHeight||Math.floor(W)!==W))for(let q=0;q=d.outWidth||Math.floor(K)!==K)continue;const j=w*y-1-f.get(N,W,K,A),Y=H*y+q,X=j===Y?1:0;if(X===0)continue;const ee=S.get(N,W,K,A);P+=ee*X}}v.set(P,N,_,E,A)}return t.makeTensorInfo(v.shape,v.dtype,v.values)}const A_={kernelName:xu,backendName:"cpu",kernelFunc:R_};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -10202,7 +10202,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function F_(n,e,t,s,o){const r=ue(e),i=rp(n,e,t,r,o,"max"),a=D1(n,e,t,o,!0,s);return[i.values,a.values]}/** + */function D_(n,e,t,s,o){const r=ue(e),i=sp(n,e,t,r,o,"max"),a=D1(n,e,t,o,!0,s);return[i.values,a.values]}/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -10217,7 +10217,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const __={kernelName:Xp,backendName:"cpu",kernelFunc:({inputs:n,attrs:e,backend:t})=>{const{x:s}=n,{filterSize:o,strides:r,pad:i,includeBatchInIndex:a}=e,l=t;le(s,"MaxPoolWithArgmax");const c=l.data.get(s.dataId).values,u=pn(s.shape,o,r,[1,1],i),[h,d]=F_(c,s.shape,s.dtype,a,u),p=l.write(h,u.outShape,s.dtype),f=l.write(d,u.outShape,s.dtype);return[{dataId:p,shape:u.outShape,dtype:s.dtype},{dataId:f,shape:u.outShape,dtype:"int32"}]}};/** + */const F_={kernelName:Xp,backendName:"cpu",kernelFunc:({inputs:n,attrs:e,backend:t})=>{const{x:s}=n,{filterSize:o,strides:r,pad:i,includeBatchInIndex:a}=e,l=t;le(s,"MaxPoolWithArgmax");const c=l.data.get(s.dataId).values,u=pn(s.shape,o,r,[1,1],i),[h,d]=D_(c,s.shape,s.dtype,a,u),p=l.write(h,u.outShape,s.dtype),f=l.write(d,u.outShape,s.dtype);return[{dataId:p,shape:u.outShape,dtype:s.dtype},{dataId:f,shape:u.outShape,dtype:"int32"}]}};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -10232,7 +10232,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function O_(n){const{inputs:e,backend:t,attrs:s}=n,{x:o}=e,{axis:r,keepDims:i}=s,a=$e(r,o.shape),c=bt(o.shape,a)[1],u=G(c),h=[],d=t.makeTensorInfo([],"float32",new Float32Array([u]));h.push(d);const p=_s({inputs:{x:o},backend:t,attrs:{dtype:"float32"}});h.push(p);const f=ip({inputs:{a:p,b:d},backend:t});h.push(f);const m=Xi({inputs:{x:f},backend:t,attrs:{axis:r,keepDims:i}});return h.forEach(g=>t.disposeIntermediateTensorInfo(g)),m}const L_={kernelName:Ba,backendName:"cpu",kernelFunc:O_};/** + */function __(n){const{inputs:e,backend:t,attrs:s}=n,{x:o}=e,{axis:r,keepDims:i}=s,a=$e(r,o.shape),c=bt(o.shape,a)[1],u=G(c),h=[],d=t.makeTensorInfo([],"float32",new Float32Array([u]));h.push(d);const p=_s({inputs:{x:o},backend:t,attrs:{dtype:"float32"}});h.push(p);const f=op({inputs:{a:p,b:d},backend:t});h.push(f);const m=Xi({inputs:{x:f},backend:t,attrs:{axis:r,keepDims:i}});return h.forEach(g=>t.disposeIntermediateTensorInfo(g)),m}const O_={kernelName:Ba,backendName:"cpu",kernelFunc:__};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -10247,7 +10247,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function M_(n){const{inputs:e,backend:t,attrs:s}=n,{x:o}=e,{axis:r,keepDims:i}=s;le(o,"min");const a=$e(r,o.shape);let l=a;const c=Ze(l,o.shape.length);let u=o;c!=null&&(u=qt({inputs:{x:o},backend:t,attrs:{perm:c}}),l=nt(l.length,o.shape.length)),$t("min",l,u.shape.length);const[h,d]=bt(u.shape,l),p=G(d),f=Nt(G(h),u.dtype),m=t.data.get(u.dataId).values;for(let x=0;xw[0]+o.shape[y]+w[1]),l=r.map(w=>w[0]),c=r.map((w,y)=>w[0]+o.shape[y]),u=i==="reflect"?0:1,h=t.data.get(o.dataId).values,d=o.shape.length,p=ue(o.shape),f=G(a),m=a.length,g=ue(a),x=Tt(o.dtype,f);for(let w=0;w=c[I]&&(y[I]=(c[I]-1)*2-y[I]+u);y=y.map((I,$)=>I-l[$]);const C=Pn(y,d,p);x[w]=h[C]}return{dataId:t.write(x,a,o.dtype),shape:a,dtype:o.dtype}}const z_={kernelName:Va,backendName:"cpu",kernelFunc:B_};/** + */function P_(n){const{inputs:e,backend:t,attrs:s}=n,{x:o}=e,{paddings:r,mode:i}=s;le(o,"mirrorPad");const a=r.map((w,y)=>w[0]+o.shape[y]+w[1]),l=r.map(w=>w[0]),c=r.map((w,y)=>w[0]+o.shape[y]),u=i==="reflect"?0:1,h=t.data.get(o.dataId).values,d=o.shape.length,p=ue(o.shape),f=G(a),m=a.length,g=ue(a),x=Tt(o.dtype,f);for(let w=0;w=c[I]&&(y[I]=(c[I]-1)*2-y[I]+u);y=y.map((I,v)=>I-l[v]);const C=Pn(y,d,p);x[w]=h[C]}return{dataId:t.write(x,a,o.dtype),shape:a,dtype:o.dtype}}const B_={kernelName:Va,backendName:"cpu",kernelFunc:P_};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -10277,7 +10277,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const V_=it((n,e)=>{const t=n%e;return n<0&&e<0||n>=0&&e>=0?t:(t+e)%e}),W_=mt(Kr,V_),U_={kernelName:Kr,backendName:"cpu",kernelFunc:W_};/** + */const z_=it((n,e)=>{const t=n%e;return n<0&&e<0||n>=0&&e>=0?t:(t+e)%e}),V_=mt(Kr,z_),W_={kernelName:Kr,backendName:"cpu",kernelFunc:V_};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -10292,7 +10292,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function P1(n){const{inputs:e,backend:t,attrs:s}=n,{logits:o}=e,{dim:r}=s,i=o.shape.length;let a=r;if(a===-1&&(a=i-1),a!==i-1)throw Error(`Softmax along a non-last dimension is not yet supported. Logits was rank ${i} and dim was ${a}`);const l=$e([a],o.shape),c=M1({inputs:{x:o},backend:t,attrs:{reductionIndices:l,keepDims:!1}}),u=at(c.shape,l),h=We({inputs:{x:c},backend:t,attrs:{shape:u}}),d=op({inputs:{a:o,b:h},backend:t}),p=P0({inputs:{x:d},backend:t}),f=Xi({inputs:{x:p},backend:t,attrs:{axis:l,keepDims:!1}}),m=We({inputs:{x:f},backend:t,attrs:{shape:u}}),g=ip({inputs:{a:p,b:m},backend:t});return t.disposeIntermediateTensorInfo(c),t.disposeIntermediateTensorInfo(h),t.disposeIntermediateTensorInfo(d),t.disposeIntermediateTensorInfo(p),t.disposeIntermediateTensorInfo(f),t.disposeIntermediateTensorInfo(m),g}const G_={kernelName:rl,backendName:"cpu",kernelFunc:P1};/** + */function P1(n){const{inputs:e,backend:t,attrs:s}=n,{logits:o}=e,{dim:r}=s,i=o.shape.length;let a=r;if(a===-1&&(a=i-1),a!==i-1)throw Error(`Softmax along a non-last dimension is not yet supported. Logits was rank ${i} and dim was ${a}`);const l=$e([a],o.shape),c=M1({inputs:{x:o},backend:t,attrs:{reductionIndices:l,keepDims:!1}}),u=at(c.shape,l),h=We({inputs:{x:c},backend:t,attrs:{shape:u}}),d=np({inputs:{a:o,b:h},backend:t}),p=P0({inputs:{x:d},backend:t}),f=Xi({inputs:{x:p},backend:t,attrs:{axis:l,keepDims:!1}}),m=We({inputs:{x:f},backend:t,attrs:{shape:u}}),g=op({inputs:{a:p,b:m},backend:t});return t.disposeIntermediateTensorInfo(c),t.disposeIntermediateTensorInfo(h),t.disposeIntermediateTensorInfo(d),t.disposeIntermediateTensorInfo(p),t.disposeIntermediateTensorInfo(f),t.disposeIntermediateTensorInfo(m),g}const U_={kernelName:rl,backendName:"cpu",kernelFunc:P1};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -10307,7 +10307,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function H_(n){const{inputs:e,backend:t,attrs:s}=n,{logits:o}=e,{numSamples:r,seed:i,normalized:a}=s;le(o,"multinomial");const l=a?o:P1({inputs:{logits:o},backend:t,attrs:{dim:-1}}),c=l.shape[0],u=l.shape[1],h=t.data.get(l.dataId).values,d=[c,r],p=Nt(G(d),"int32");for(let f=0;f=0&&h[d]=0&&h[d]{Mc(r,u.shape,"All tensors passed to stack must have matching shapes"),v(i===u.dtype,()=>"All tensors passed to stack must have matching dtypes")});const a=[],l=e.map(u=>{const h=cc({inputs:{input:u},backend:t,attrs:{dim:o}});return a.push(h),h}),c=ir({inputs:l,backend:t,attrs:{axis:o}});return a.forEach(u=>t.disposeIntermediateTensorInfo(u)),c}const iO={kernelName:qa,backendName:"cpu",kernelFunc:z1};/** + */function z1(n){const{inputs:e,backend:t,attrs:s}=n,{axis:o}=s;if(e.length===1)return cc({inputs:{input:e[0]},backend:t,attrs:{dim:o}});const r=e[0].shape,i=e[0].dtype;e.forEach(u=>{Oc(r,u.shape,"All tensors passed to stack must have matching shapes"),k(i===u.dtype,()=>"All tensors passed to stack must have matching dtypes")});const a=[],l=e.map(u=>{const h=cc({inputs:{input:u},backend:t,attrs:{dim:o}});return a.push(h),h}),c=ir({inputs:l,backend:t,attrs:{axis:o}});return a.forEach(u=>t.disposeIntermediateTensorInfo(u)),c}const rO={kernelName:qa,backendName:"cpu",kernelFunc:z1};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -10427,7 +10427,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function aO(n){const{inputs:e,backend:t,attrs:s}=n,{x:o}=e,{paddings:r,constantValue:i}=s;le(o,"pad");const a=r.map((b,w)=>b[0]+o.shape[w]+b[1]),l=r.map(b=>b[0]),c=t.data.get(o.dataId).values,u=G(o.shape),h=o.shape.length,d=ue(o.shape),p=G(a),f=a.length,m=ue(a),g=Tt(o.dtype,p);i!==0&&g.fill(i);for(let b=0;bI+l[$]),C=Pn(y,f,m);g[C]=c[b]}return{dataId:t.write(g,a,o.dtype),shape:a,dtype:o.dtype}}const V1={kernelName:ja,backendName:"cpu",kernelFunc:aO};/** + */function iO(n){const{inputs:e,backend:t,attrs:s}=n,{x:o}=e,{paddings:r,constantValue:i}=s;le(o,"pad");const a=r.map((b,w)=>b[0]+o.shape[w]+b[1]),l=r.map(b=>b[0]),c=t.data.get(o.dataId).values,u=G(o.shape),h=o.shape.length,d=ue(o.shape),p=G(a),f=a.length,m=ue(a),g=Tt(o.dtype,p);i!==0&&g.fill(i);for(let b=0;bI+l[v]),C=Pn(y,f,m);g[C]=c[b]}return{dataId:t.write(g,a,o.dtype),shape:a,dtype:o.dtype}}const V1={kernelName:ja,backendName:"cpu",kernelFunc:iO};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -10442,7 +10442,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const lO=it((n,e)=>Math.pow(n,e)),cO=mt(Yr,lO),uO={kernelName:Yr,backendName:"cpu",kernelFunc:cO};/** + */const aO=it((n,e)=>Math.pow(n,e)),lO=mt(Yr,aO),cO={kernelName:Yr,backendName:"cpu",kernelFunc:lO};/** * @license * Copyright 2022 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -10457,7 +10457,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function hO(n){const{inputs:e,backend:t,attrs:s}=n,{paramsNestedSplits:o,paramsDenseValues:r,indices:i}=e,a=o.map(g=>t.data.get(g.dataId).values),l=o.map(g=>g.shape),c=t.data.get(r.dataId).values,u=t.data.get(i.dataId).values,[h,d,p]=s1(a,l,c,r.shape,r.dtype,u,i.shape),f=h.map(g=>t.makeTensorInfo([g.length],"int32",g)),m=t.makeTensorInfo(p,r.dtype,d);return f.concat([m])}const dO={kernelName:Zp,backendName:"cpu",kernelFunc:hO};/** + */function uO(n){const{inputs:e,backend:t,attrs:s}=n,{paramsNestedSplits:o,paramsDenseValues:r,indices:i}=e,a=o.map(g=>t.data.get(g.dataId).values),l=o.map(g=>g.shape),c=t.data.get(r.dataId).values,u=t.data.get(i.dataId).values,[h,d,p]=s1(a,l,c,r.shape,r.dtype,u,i.shape),f=h.map(g=>t.makeTensorInfo([g.length],"int32",g)),m=t.makeTensorInfo(p,r.dtype,d);return f.concat([m])}const hO={kernelName:Zp,backendName:"cpu",kernelFunc:uO};/** * @license * Copyright 2022 Google LLC. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -10472,7 +10472,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function pO(n){const{inputs:e,backend:t}=n,{starts:s,limits:o,deltas:r}=e,i=t.data.get(s.dataId).values,a=t.data.get(o.dataId).values,l=t.data.get(r.dataId).values,[c,u]=r1(i,s.shape,s.dtype,a,o.shape,l,r.shape),h=t.makeTensorInfo([c.length],"int32",c),d=t.makeTensorInfo([u.length],s.dtype,u);return[h,d]}const fO={kernelName:Qp,backendName:"cpu",kernelFunc:pO};/** + */function dO(n){const{inputs:e,backend:t}=n,{starts:s,limits:o,deltas:r}=e,i=t.data.get(s.dataId).values,a=t.data.get(o.dataId).values,l=t.data.get(r.dataId).values,[c,u]=r1(i,s.shape,s.dtype,a,o.shape,l,r.shape),h=t.makeTensorInfo([c.length],"int32",c),d=t.makeTensorInfo([u.length],s.dtype,u);return[h,d]}const pO={kernelName:Qp,backendName:"cpu",kernelFunc:dO};/** * @license * Copyright 2022 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -10487,7 +10487,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function mO(n){const{inputs:e,backend:t,attrs:s}=n,{shape:o,values:r,defaultValue:i,rowPartitionTensors:a}=e,{rowPartitionTypes:l}=s,c=t.data.get(o.dataId).values,u=t.data.get(r.dataId).values,h=t.data.get(i.dataId).values,d=a.map(g=>t.data.get(g.dataId).values),p=a.map(g=>g.shape),[f,m]=l1(c,o.shape,u,r.shape,r.dtype,h,i.shape,d,p,l);return t.makeTensorInfo(f,r.dtype,m)}const gO={kernelName:Jp,backendName:"cpu",kernelFunc:mO};/** + */function fO(n){const{inputs:e,backend:t,attrs:s}=n,{shape:o,values:r,defaultValue:i,rowPartitionTensors:a}=e,{rowPartitionTypes:l}=s,c=t.data.get(o.dataId).values,u=t.data.get(r.dataId).values,h=t.data.get(i.dataId).values,d=a.map(g=>t.data.get(g.dataId).values),p=a.map(g=>g.shape),[f,m]=l1(c,o.shape,u,r.shape,r.dtype,h,i.shape,d,p,l);return t.makeTensorInfo(f,r.dtype,m)}const mO={kernelName:Jp,backendName:"cpu",kernelFunc:fO};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -10502,7 +10502,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function xO(n){const{backend:e,attrs:t}=n,{start:s,stop:o,dtype:r,step:i}=t,a=c1(s,o,i,r);return e.makeTensorInfo([a.length],r,a)}const bO={kernelName:ku,backendName:"cpu",kernelFunc:xO};/** + */function gO(n){const{backend:e,attrs:t}=n,{start:s,stop:o,dtype:r,step:i}=t,a=c1(s,o,i,r);return e.makeTensorInfo([a.length],r,a)}const xO={kernelName:Iu,backendName:"cpu",kernelFunc:gO};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the License); @@ -10517,7 +10517,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const yO=Le(Zr,n=>1/n),wO={kernelName:Zr,backendName:"cpu",kernelFunc:yO};/** + */const bO=Le(Zr,n=>1/n),yO={kernelName:Zr,backendName:"cpu",kernelFunc:bO};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -10532,7 +10532,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function CO(n){const{inputs:e,backend:t,attrs:s}=n,{images:o}=e,{alignCorners:r,halfPixelCenters:i,size:a}=s;le(o,"resizeBilinear");const l=ue(o.shape),[c,u]=a,[h,d,p,f]=o.shape,m=t.data.get(o.dataId).values,g=new Float32Array(G([h,c,u,f])),x=[r&&c>1?d-1:d,r&&u>1?p-1:p],b=[r&&c>1?c-1:c,r&&u>1?u-1:u];let w=0;const y=x[0]/b[0],C=x[1]/b[1];for(let I=0;I1?d-1:d,r&&u>1?p-1:p],b=[r&&c>1?c-1:c,r&&u>1?u-1:u];let w=0;const y=x[0]/b[0],C=x[1]/b[1];for(let I=0;I1?c-1:c,i&&p>1?u-1:u],g=[i&&d>1?d-1:d,i&&p>1?p-1:p],x=m[0]/g[0],b=m[1]/g[1],w=t.data.get(r.dataId).values;let y=0;for(let C=0;C1?c-1:c,i&&p>1?u-1:u],g=[i&&d>1?d-1:d,i&&p>1?p-1:p],x=m[0]/g[0],b=m[1]/g[1],w=t.data.get(r.dataId).values;let y=0;for(let C=0;C1?d-1:d,r&&u>1?p-1:p],b=[r&&c>1?c-1:c,r&&u>1?u-1:u],w=x[0]/b[0],y=x[1]/b[1];let C=0;for(let I=0;I1?d-1:d,r&&u>1?p-1:p],b=[r&&c>1?c-1:c,r&&u>1?u-1:u],w=x[0]/b[0],y=x[1]/b[1];let C=0;for(let I=0;I1?u-1:u,i&&f>1?h-1:h],b=[i&&p>1?p-1:p,i&&f>1?f-1:f],w=x[0]/b[0],y=x[1]/b[1],C=1/w,I=1/y,$=Math.ceil(C)*2+2,k=Math.ceil(I)*2+2;for(let S=0;S=p)continue;const X=N+Y*l[1],ee=Y*w,Q=Math.min(u-1,i?Math.round(ee):Math.floor(ee));if(A===Q)for(let ne=0;ne=f)continue;const se=X+ae*l[2],he=ae*y,we=Math.min(h-1,i?Math.round(he):Math.floor(he));z===we&&(K+=g[se+q])}}m[P+q]=K}}}}return t.makeTensorInfo(o.shape,o.dtype,m)}const NO={kernelName:Su,backendName:"cpu",kernelFunc:TO};/** + */function SO(n){const{inputs:e,backend:t,attrs:s}=n,{images:o,dy:r}=e,{alignCorners:i}=s;le([r,o],"resizeNearestNeighborGrad");const a=ue(o.shape),l=ue(r.shape),[c,u,h,d]=o.shape,[,p,f]=r.shape,m=new Float32Array(c*u*h*d),g=t.data.get(r.dataId).values,x=[i&&p>1?u-1:u,i&&f>1?h-1:h],b=[i&&p>1?p-1:p,i&&f>1?f-1:f],w=x[0]/b[0],y=x[1]/b[1],C=1/w,I=1/y,v=Math.ceil(C)*2+2,$=Math.ceil(I)*2+2;for(let S=0;S=p)continue;const X=N+Y*l[1],ee=Y*w,Q=Math.min(u-1,i?Math.round(ee):Math.floor(ee));if(A===Q)for(let ne=0;ne<$;ne++){const ae=ne+W;if(ae<0||ae>=f)continue;const se=X+ae*l[2],he=ae*y,we=Math.min(h-1,i?Math.round(he):Math.floor(he));z===we&&(K+=g[se+q])}}m[P+q]=K}}}}return t.makeTensorInfo(o.shape,o.dtype,m)}const TO={kernelName:ku,backendName:"cpu",kernelFunc:SO};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -10592,7 +10592,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function EO(n){const{inputs:e,backend:t,attrs:s}=n,{x:o}=e,{dims:r}=s;le(o,"reverse");const i=o.shape.length,a=$e(r,o.shape);if(i===0)return Jn({inputs:{x:o},backend:t});const l=new wt(o.shape,o.dtype),c=t.bufferSync(o);for(let u=0;ud[p]=o.shape[p]-1-d[p]),l.set(c.get(...d),...h)}return t.makeTensorInfo(l.shape,l.dtype,l.values)}const RO={kernelName:Ja,backendName:"cpu",kernelFunc:EO};/** + */function NO(n){const{inputs:e,backend:t,attrs:s}=n,{x:o}=e,{dims:r}=s;le(o,"reverse");const i=o.shape.length,a=$e(r,o.shape);if(i===0)return Jn({inputs:{x:o},backend:t});const l=new wt(o.shape,o.dtype),c=t.bufferSync(o);for(let u=0;ud[p]=o.shape[p]-1-d[p]),l.set(c.get(...d),...h)}return t.makeTensorInfo(l.shape,l.dtype,l.values)}const EO={kernelName:Ja,backendName:"cpu",kernelFunc:NO};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -10607,7 +10607,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const AO={kernelName:_u,backendName:"cpu",kernelFunc:({inputs:n,attrs:e,backend:t})=>{const{image:s}=n,{radians:o,fillValue:r,center:i}=e,a=t,l=Tt(s.dtype,G(s.shape)),[c,u,h,d]=s.shape,[p,f]=Zh(i,u,h),m=255,g=Math.sin(o),x=Math.cos(o),b=a.data.get(s.dataId).values;for(let y=0;y=0&&M=0&&z{const{image:s}=n,{radians:o,fillValue:r,center:i}=e,a=t,l=Tt(s.dtype,G(s.shape)),[c,u,h,d]=s.shape,[p,f]=Xh(i,u,h),m=255,g=Math.sin(o),x=Math.cos(o),b=a.data.get(s.dataId).values;for(let y=0;y=0&&M=0&&z{const e=Math.floor(n);return n-e<.5?Math.floor(n):n-e>.5?Math.ceil(n):e%2===0?e:e+1}),FO={kernelName:ei,backendName:"cpu",kernelFunc:DO};/** + */const AO=Le(ei,n=>{const e=Math.floor(n);return n-e<.5?Math.floor(n):n-e>.5?Math.ceil(n):e%2===0?e:e+1}),DO={kernelName:ei,backendName:"cpu",kernelFunc:AO};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -10637,7 +10637,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function _O(n){const{inputs:e,backend:t,attrs:s}=n,{indices:o,updates:r}=e,{shape:i}=s,{sliceRank:a,numUpdates:l,sliceSize:c,strides:u,outputSize:h}=ho(r,o,i),d=!0,p=t.bufferSync(o),f=t.bufferSync(r),m=Co(p,f,i,h,c,l,a,u,0,d);return t.makeTensorInfo(i,m.dtype,m.values)}const OO={kernelName:ef,backendName:"cpu",kernelFunc:_O};/** + */function FO(n){const{inputs:e,backend:t,attrs:s}=n,{indices:o,updates:r}=e,{shape:i}=s,{sliceRank:a,numUpdates:l,sliceSize:c,strides:u,outputSize:h}=ho(r,o,i),d=!0,p=t.bufferSync(o),f=t.bufferSync(r),m=Co(p,f,i,h,c,l,a,u,0,d);return t.makeTensorInfo(i,m.dtype,m.values)}const _O={kernelName:ef,backendName:"cpu",kernelFunc:FO};/** * @license * Copyright 2022 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -10652,7 +10652,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function LO(n,e){let t=0,s=n.length,o=0;for(;t1||o.shape.length===1?1:G(o.shape.slice(1));for(let f=0;f1||o.shape.length===1?1:G(o.shape.slice(1));for(let f=0;fn>=0?GO*n:UO*(Math.exp(n)-1)),qO={kernelName:ni,backendName:"cpu",kernelFunc:HO};/** + */const WO=Dl,UO=Fl,GO=Le(ni,n=>n>=0?UO*n:WO*(Math.exp(n)-1)),HO={kernelName:ni,backendName:"cpu",kernelFunc:GO};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the License); @@ -10712,7 +10712,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const jO=Le(ri,n=>n<0?-1:n>0?1:0),KO={kernelName:ri,backendName:"cpu",kernelFunc:jO};/** + */const qO=Le(ri,n=>n<0?-1:n>0?1:0),jO={kernelName:ri,backendName:"cpu",kernelFunc:qO};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the License); @@ -10727,7 +10727,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const XO=Le(si,n=>Math.sin(n)),YO={kernelName:si,backendName:"cpu",kernelFunc:XO};/** + */const KO=Le(si,n=>Math.sin(n)),XO={kernelName:si,backendName:"cpu",kernelFunc:KO};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the License); @@ -10742,7 +10742,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const ZO=Le(oi,n=>Math.sinh(n)),QO={kernelName:oi,backendName:"cpu",kernelFunc:ZO};/** + */const YO=Le(oi,n=>Math.sinh(n)),ZO={kernelName:oi,backendName:"cpu",kernelFunc:YO};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the License); @@ -10757,7 +10757,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const W1=Math.log(11920928955078125e-23)+2,JO=Le(ai,n=>{const e=n>-W1,t=n{const e=n>-W1,t=nNumber(g)))),t.makeTensorInfo([m.length],s.dtype,new Int32Array(m))]}const oL={kernelName:sf,backendName:"cpu",kernelFunc:sL};/** + ${i.shape}`);const a=t.data.get(s.dataId).values,l=t.data.get(o.dataId).values,c=t.data.get(r.dataId).values,u=t.data.get(i.dataId).values[0],[h,d,p,f,m]=p1(a,s.shape,s.dtype,l,o.dtype,c,u);return[t.makeTensorInfo(d,s.dtype,h),t.makeTensorInfo([d[0]],o.dtype,p),t.makeTensorInfo([f.length],"bool",new Uint8Array(f.map(g=>Number(g)))),t.makeTensorInfo([m.length],s.dtype,new Int32Array(m))]}const sL={kernelName:sf,backendName:"cpu",kernelFunc:nL};/** * @license * Copyright 2021 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -10806,9 +10806,9 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function rL(n){const{inputs:e,backend:t}=n,{inputIndices:s,inputShape:o,newShape:r}=e;if(s.shape.length!==2)throw new Error(`Input indices should be a matrix but received shape + */function oL(n){const{inputs:e,backend:t}=n,{inputIndices:s,inputShape:o,newShape:r}=e;if(s.shape.length!==2)throw new Error(`Input indices should be a matrix but received shape ${s.shape}`);if(o.shape.length!==1)throw new Error(`Input shape should be a vector but received shape - ${o.shape}`);if(r.shape.length!==1)throw new Error(`Target shape should be a vector but received shape ${r.shape}`);const i=Array.from(t.data.get(o.dataId).values),a=t.data.get(s.dataId).values,l=Array.from(t.data.get(r.dataId).values),[c,u,h]=f1(a,s.shape,s.dtype,i,l);return[t.makeTensorInfo(u,s.dtype,c),t.makeTensorInfo([h.length],r.dtype,new Int32Array(h))]}const iL={kernelName:of,backendName:"cpu",kernelFunc:rL};/** + ${o.shape}`);if(r.shape.length!==1)throw new Error(`Target shape should be a vector but received shape ${r.shape}`);const i=Array.from(t.data.get(o.dataId).values),a=t.data.get(s.dataId).values,l=Array.from(t.data.get(r.dataId).values),[c,u,h]=f1(a,s.shape,s.dtype,i,l);return[t.makeTensorInfo(u,s.dtype,c),t.makeTensorInfo([h.length],r.dtype,new Int32Array(h))]}const rL={kernelName:of,backendName:"cpu",kernelFunc:oL};/** * @license * Copyright 2021 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -10823,9 +10823,9 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function aL(n){const{inputs:e,backend:t}=n,{data:s,indices:o,segmentIds:r}=e;if(s.shape.length<1)throw new Error("Data should be at least 1 dimensional but received scalar");if(o.shape.length!==1)throw new Error(`Indices should be a vector but received shape + */function iL(n){const{inputs:e,backend:t}=n,{data:s,indices:o,segmentIds:r}=e;if(s.shape.length<1)throw new Error("Data should be at least 1 dimensional but received scalar");if(o.shape.length!==1)throw new Error(`Indices should be a vector but received shape ${o.shape}`);if(r.shape.length!==1)throw new Error(`Segment ids should be a vector but received shape - ${r.shape}`);if(o.shape[0]!==r.shape[0])throw new Error("segmentIds and indices should have same size.");const i=t.data.get(s.dataId).values,a=t.data.get(o.dataId).values,l=t.data.get(r.dataId).values,[c,u]=sp(i,s.shape,s.dtype,a,l,!0);return t.makeTensorInfo(u,s.dtype,c)}const lL={kernelName:rf,backendName:"cpu",kernelFunc:aL};/** + ${r.shape}`);if(o.shape[0]!==r.shape[0])throw new Error("segmentIds and indices should have same size.");const i=t.data.get(s.dataId).values,a=t.data.get(o.dataId).values,l=t.data.get(r.dataId).values,[c,u]=tp(i,s.shape,s.dtype,a,l,!0);return t.makeTensorInfo(u,s.dtype,c)}const aL={kernelName:rf,backendName:"cpu",kernelFunc:iL};/** * @license * Copyright 2021 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -10840,9 +10840,9 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function cL(n){const{inputs:e,backend:t}=n,{data:s,indices:o,segmentIds:r}=e;if(s.shape.length<1)throw new Error("Data should be at least 1 dimensional but received scalar");if(o.shape.length!==1)throw new Error(`Indices should be a vector but received shape + */function lL(n){const{inputs:e,backend:t}=n,{data:s,indices:o,segmentIds:r}=e;if(s.shape.length<1)throw new Error("Data should be at least 1 dimensional but received scalar");if(o.shape.length!==1)throw new Error(`Indices should be a vector but received shape ${o.shape}`);if(r.shape.length!==1)throw new Error(`Segment ids should be a vector but received shape - ${r.shape}`);if(o.shape[0]!==r.shape[0])throw new Error("segmentIds and indices should have same size.");const i=t.data.get(s.dataId).values,a=t.data.get(o.dataId).values,l=t.data.get(r.dataId).values,[c,u]=sp(i,s.shape,s.dtype,a,l);return t.makeTensorInfo(u,s.dtype,c)}const uL={kernelName:af,backendName:"cpu",kernelFunc:cL};/** + ${r.shape}`);if(o.shape[0]!==r.shape[0])throw new Error("segmentIds and indices should have same size.");const i=t.data.get(s.dataId).values,a=t.data.get(o.dataId).values,l=t.data.get(r.dataId).values,[c,u]=tp(i,s.shape,s.dtype,a,l);return t.makeTensorInfo(u,s.dtype,c)}const cL={kernelName:af,backendName:"cpu",kernelFunc:lL};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -10857,7 +10857,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function hL(n){const{inputs:e,backend:t,attrs:s}=n,{sparseIndices:o,sparseValues:r,defaultValue:i}=e,{outputShape:a}=s,{sliceRank:l,numUpdates:c,sliceSize:u,strides:h,outputSize:d}=ho(r,o,a),p=!1,f=t.bufferSync(o);let m;switch(r.dtype){case"bool":{const g=t.bufferSync(r),x=!!t.data.get(i.dataId).values[0];m=Co(f,g,a,d,u,c,l,h,x,p);break}case"float32":{const g=t.bufferSync(r),x=t.data.get(i.dataId).values[0];m=Co(f,g,a,d,u,c,l,h,x,p);break}case"int32":{const g=t.bufferSync(r),x=t.data.get(i.dataId).values[0];m=Co(f,g,a,d,u,c,l,h,x,p);break}case"string":{const g=t.bufferSync(r),x=ys(t.data.get(i.dataId).values[0]);m=Co(f,g,a,d,u,c,l,h,x,p);break}default:throw new Error(`Unsupported type ${r.dtype}`)}return t.makeTensorInfo(a,m.dtype,m.values)}const dL={kernelName:lf,backendName:"cpu",kernelFunc:hL};/** + */function uL(n){const{inputs:e,backend:t,attrs:s}=n,{sparseIndices:o,sparseValues:r,defaultValue:i}=e,{outputShape:a}=s,{sliceRank:l,numUpdates:c,sliceSize:u,strides:h,outputSize:d}=ho(r,o,a),p=!1,f=t.bufferSync(o);let m;switch(r.dtype){case"bool":{const g=t.bufferSync(r),x=!!t.data.get(i.dataId).values[0];m=Co(f,g,a,d,u,c,l,h,x,p);break}case"float32":{const g=t.bufferSync(r),x=t.data.get(i.dataId).values[0];m=Co(f,g,a,d,u,c,l,h,x,p);break}case"int32":{const g=t.bufferSync(r),x=t.data.get(i.dataId).values[0];m=Co(f,g,a,d,u,c,l,h,x,p);break}case"string":{const g=t.bufferSync(r),x=ys(t.data.get(i.dataId).values[0]);m=Co(f,g,a,d,u,c,l,h,x,p);break}default:throw new Error(`Unsupported type ${r.dtype}`)}return t.makeTensorInfo(a,m.dtype,m.values)}const hL={kernelName:lf,backendName:"cpu",kernelFunc:uL};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -10872,7 +10872,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function pL(n){const{inputs:e,backend:t,attrs:s}=n,{x:o}=e,{numOrSizeSplits:r,axis:i}=s,a=$e(i,o.shape)[0],l=pd(o,r,a),c=new Array(o.shape.length).fill(0),u=o.shape.slice();return l.map(h=>{const d=[...u];d[a]=h;const p=Io({inputs:{x:o},backend:t,attrs:{begin:c,size:d}});return c[a]+=h,p})}const fL={kernelName:ol,backendName:"cpu",kernelFunc:pL};/** + */function dL(n){const{inputs:e,backend:t,attrs:s}=n,{x:o}=e,{numOrSizeSplits:r,axis:i}=s,a=$e(i,o.shape)[0],l=hd(o,r,a),c=new Array(o.shape.length).fill(0),u=o.shape.slice();return l.map(h=>{const d=[...u];d[a]=h;const p=Io({inputs:{x:o},backend:t,attrs:{begin:c,size:d}});return c[a]+=h,p})}const pL={kernelName:ol,backendName:"cpu",kernelFunc:dL};/** * @license * Copyright 2019 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -10887,7 +10887,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const mL={kernelName:Nu,backendName:"cpu",kernelFunc:({inputs:n,backend:e})=>{const{x:t}=n,s=e;le(t,"square");const o=s.data.get(t.dataId).values,r=new Float32Array(o.length);for(let a=0;a{const{x:t}=n,s=e;le(t,"square");const o=s.data.get(t.dataId).values,r=new Float32Array(o.length);for(let a=0;a{const t=e;return isNaN(n)?NaN:n>0?1:t.alpha}),xL={kernelName:fi,backendName:"cpu",kernelFunc:gL};/** + */const mL=Le(fi,(n,e)=>{const t=e;return isNaN(n)?NaN:n>0?1:t.alpha}),gL={kernelName:fi,backendName:"cpu",kernelFunc:mL};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -10917,7 +10917,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function bL(n){const{inputs:e,backend:t,attrs:s}=n,{x:o}=e,{begin:r,end:i,strides:a,beginMask:l,endMask:c,ellipsisMask:u,newAxisMask:h,shrinkAxisMask:d}=s;le(o,"stridedSlice");const{finalShapeSparse:p,finalShape:f,isIdentity:m,sliceDim0:g,isSimpleSlice:x,begin:b,end:w,strides:y}=Kh(o.shape,r,i,a,l,c,u,h,d);let C;if(m)C=We({inputs:{x:o},backend:t,attrs:{shape:f}});else if(g||x){v(o.shape.length>=1,()=>`Input must have rank at least 1, got: ${o.shape.length}`);const I=Hh(b,w,y),$=Io({inputs:{x:o},backend:t,attrs:{begin:b,size:I}});C=We({inputs:{x:$},backend:t,attrs:{shape:f}}),t.disposeIntermediateTensorInfo($)}else{const I=t.bufferSync(o),$=x1(p,I,y,b);C=t.makeTensorInfo(f,$.dtype,$.values)}return C}const yL={kernelName:Ru,backendName:"cpu",kernelFunc:bL};/** + */function xL(n){const{inputs:e,backend:t,attrs:s}=n,{x:o}=e,{begin:r,end:i,strides:a,beginMask:l,endMask:c,ellipsisMask:u,newAxisMask:h,shrinkAxisMask:d}=s;le(o,"stridedSlice");const{finalShapeSparse:p,finalShape:f,isIdentity:m,sliceDim0:g,isSimpleSlice:x,begin:b,end:w,strides:y}=qh(o.shape,r,i,a,l,c,u,h,d);let C;if(m)C=We({inputs:{x:o},backend:t,attrs:{shape:f}});else if(g||x){k(o.shape.length>=1,()=>`Input must have rank at least 1, got: ${o.shape.length}`);const I=Uh(b,w,y),v=Io({inputs:{x:o},backend:t,attrs:{begin:b,size:I}});C=We({inputs:{x:v},backend:t,attrs:{shape:f}}),t.disposeIntermediateTensorInfo(v)}else{const I=t.bufferSync(o),v=x1(p,I,y,b);C=t.makeTensorInfo(f,v.dtype,v.values)}return C}const bL={kernelName:Nu,backendName:"cpu",kernelFunc:xL};/** * @license * Copyright 2021 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -10932,7 +10932,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function wL(n){const{inputs:e,backend:t,attrs:s}=n,{separator:o,nGramWidths:r,leftPad:i,rightPad:a,padWidth:l,preserveShortSequences:c}=s,{data:u,dataSplits:h}=e,d=t.data.get(u.dataId).values,p=t.data.get(h.dataId).values,[f,m]=b1(d,p,o,r,i,a,l,c);return[t.makeTensorInfo([f.length],"string",f),t.makeTensorInfo(h.shape,"int32",m)]}const CL={kernelName:cf,backendName:"cpu",kernelFunc:wL};/** + */function yL(n){const{inputs:e,backend:t,attrs:s}=n,{separator:o,nGramWidths:r,leftPad:i,rightPad:a,padWidth:l,preserveShortSequences:c}=s,{data:u,dataSplits:h}=e,d=t.data.get(u.dataId).values,p=t.data.get(h.dataId).values,[f,m]=b1(d,p,o,r,i,a,l,c);return[t.makeTensorInfo([f.length],"string",f),t.makeTensorInfo(h.shape,"int32",m)]}const wL={kernelName:cf,backendName:"cpu",kernelFunc:yL};/** * @license * Copyright 2021 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -10947,7 +10947,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function IL(n){const{inputs:e,backend:t,attrs:s}=n,{skipEmpty:o}=s,{input:r,delimiter:i}=e;if(r.dtype!=="string")throw new Error("Input must be of datatype string");if(r.shape.length!==1)throw new Error(`Input must be a vector, got shape: ${r.shape}`);if(i.shape.length!==0)throw new Error(`Delimiter must be a scalar, got shape: ${i.shape}`);const a=t.data.get(r.dataId).values,l=t.data.get(i.dataId).values[0],[c,u,h]=y1(a,l,o),d=u.length;return[t.makeTensorInfo([d,2],"int32",c),t.makeTensorInfo([d],"string",u),t.makeTensorInfo([2],"int32",new Int32Array(h))]}const $L={kernelName:uf,backendName:"cpu",kernelFunc:IL};/** + */function CL(n){const{inputs:e,backend:t,attrs:s}=n,{skipEmpty:o}=s,{input:r,delimiter:i}=e;if(r.dtype!=="string")throw new Error("Input must be of datatype string");if(r.shape.length!==1)throw new Error(`Input must be a vector, got shape: ${r.shape}`);if(i.shape.length!==0)throw new Error(`Delimiter must be a scalar, got shape: ${i.shape}`);const a=t.data.get(r.dataId).values,l=t.data.get(i.dataId).values[0],[c,u,h]=y1(a,l,o),d=u.length;return[t.makeTensorInfo([d,2],"int32",c),t.makeTensorInfo([d],"string",u),t.makeTensorInfo([2],"int32",new Int32Array(h))]}const IL={kernelName:uf,backendName:"cpu",kernelFunc:CL};/** * @license * Copyright 2021 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -10962,7 +10962,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function kL(n){const{inputs:e,backend:t,attrs:s}=n,{numBuckets:o}=s,{input:r}=e;if(r.dtype!=="string")throw new Error("Input must be of datatype string");if(o<=0)throw new Error("Number of buckets must be at least 1");const i=t.data.get(r.dataId).values,a=w1(i,o);return t.makeTensorInfo(r.shape,"int32",a)}const vL={kernelName:hf,backendName:"cpu",kernelFunc:kL};/** + */function $L(n){const{inputs:e,backend:t,attrs:s}=n,{numBuckets:o}=s,{input:r}=e;if(r.dtype!=="string")throw new Error("Input must be of datatype string");if(o<=0)throw new Error("Number of buckets must be at least 1");const i=t.data.get(r.dataId).values,a=w1(i,o);return t.makeTensorInfo(r.shape,"int32",a)}const kL={kernelName:hf,backendName:"cpu",kernelFunc:$L};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the License); @@ -10977,7 +10977,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const SL=Le(hi,n=>Math.tan(n)),TL={kernelName:hi,backendName:"cpu",kernelFunc:SL};/** + */const vL=Le(hi,n=>Math.tan(n)),SL={kernelName:hi,backendName:"cpu",kernelFunc:vL};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the License); @@ -10992,7 +10992,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const NL=Le(di,n=>Math.tanh(n)),EL={kernelName:di,backendName:"cpu",kernelFunc:NL};/** + */const TL=Le(di,n=>Math.tanh(n)),NL={kernelName:di,backendName:"cpu",kernelFunc:TL};/** * @license * Copyright 2022 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -11007,7 +11007,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function RL(n){const{inputs:e,backend:t}=n,{tensor:s,indices:o,updates:r}=e,{sliceRank:i,numUpdates:a,sliceSize:l,strides:c,outputSize:u}=ho(r,o,s.shape),h=!1,d=t.bufferSync(o),p=t.bufferSync(r),f=t.bufferSync(s),m=Co(d,p,s.shape,u,l,a,i,c,f,h);return t.makeTensorInfo(s.shape,m.dtype,m.values)}const AL={kernelName:tf,backendName:"cpu",kernelFunc:RL};/** + */function EL(n){const{inputs:e,backend:t}=n,{tensor:s,indices:o,updates:r}=e,{sliceRank:i,numUpdates:a,sliceSize:l,strides:c,outputSize:u}=ho(r,o,s.shape),h=!1,d=t.bufferSync(o),p=t.bufferSync(r),f=t.bufferSync(s),m=Co(d,p,s.shape,u,l,a,i,c,f,h);return t.makeTensorInfo(s.shape,m.dtype,m.values)}const RL={kernelName:tf,backendName:"cpu",kernelFunc:EL};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -11022,7 +11022,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function DL(n){const{inputs:e,backend:t,attrs:s}=n,{x:o}=e,{reps:r}=s;le(o,"tile");const i=I1(t.bufferSync(o),r);return t.makeTensorInfo(i.shape,i.dtype,i.values)}const FL={kernelName:pi,backendName:"cpu",kernelFunc:DL};/** + */function AL(n){const{inputs:e,backend:t,attrs:s}=n,{x:o}=e,{reps:r}=s;le(o,"tile");const i=I1(t.bufferSync(o),r);return t.makeTensorInfo(i.shape,i.dtype,i.values)}const DL={kernelName:pi,backendName:"cpu",kernelFunc:AL};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -11037,7 +11037,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function _L(n){const{inputs:e,backend:t,attrs:s}=n,{x:o}=e,{k:r,sorted:i}=s;le(o,"topk");const a=t.data.get(o.dataId).values,[l,c]=k1(a,o.shape,o.dtype,r,i);return[t.makeTensorInfo(l.shape,l.dtype,l.values),t.makeTensorInfo(c.shape,c.dtype,c.values)]}const OL={kernelName:Au,backendName:"cpu",kernelFunc:_L};/** + */function FL(n){const{inputs:e,backend:t,attrs:s}=n,{x:o}=e,{k:r,sorted:i}=s;le(o,"topk");const a=t.data.get(o.dataId).values,[l,c]=k1(a,o.shape,o.dtype,r,i);return[t.makeTensorInfo(l.shape,l.dtype,l.values),t.makeTensorInfo(c.shape,c.dtype,c.values)]}const _L={kernelName:Eu,backendName:"cpu",kernelFunc:FL};/** * @license * Copyright 2021 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -11052,7 +11052,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function LL(n){const{inputs:e,attrs:t,backend:s}=n,{image:o,transforms:r}=e,{interpolation:i,fillMode:a,fillValue:l,outputShape:c}=t,[u,h,d,p]=o.shape,[f,m]=c??[h,d],g=[u,f,m,p],x=ue(o.shape),b=x[0],w=x[1],y=x[2],C=ue(g),I=C[0],$=C[1],k=C[2],S=Tt(o.dtype,G(g));S.fill(l);const N=s.data.get(o.dataId).values,A=s.data.get(r.dataId).values;for(let E=0;Ee-1)if(e<=1)t=0;else{const s=2*e;t-=s*Math.trunc(t/s),t>=e&&(t=s-t-1)}return Us(0,t,e-1)}function BL(n,e){let t=n;if(t<0)if(e<=1)t=0;else{const s=e-1;t+=e*(Math.trunc(-t/s)+1)}else if(t>e-1)if(e<=1)t=0;else{const s=e-1;t-=e*Math.trunc(t/s)}return Us(0,t,e-1)}function zL(n,e){return n}function VL(n,e){return Us(0,n,e-1)}function Yi(n,e,t,s,o,r,i,a,l,c,u){const h=i*s+a*o+l*r+c;return 0<=a&&ae-1)if(e<=1)t=0;else{const s=2*e;t-=s*Math.trunc(t/s),t>=e&&(t=s-t-1)}return Us(0,t,e-1)}function PL(n,e){let t=n;if(t<0)if(e<=1)t=0;else{const s=e-1;t+=e*(Math.trunc(-t/s)+1)}else if(t>e-1)if(e<=1)t=0;else{const s=e-1;t-=e*Math.trunc(t/s)}return Us(0,t,e-1)}function BL(n,e){return n}function zL(n,e){return Us(0,n,e-1)}function Yi(n,e,t,s,o,r,i,a,l,c,u){const h=i*s+a*o+l*r+c;return 0<=a&&at.disposeIntermediateTensorInfo(f)),p}const XL={kernelName:al,backendName:"cpu",kernelFunc:KL};/** + */function jL(n){const{inputs:e,backend:t,attrs:s}=n,{x:o,segmentIds:r}=e,{numSegments:i}=s;le(o,"unsortedSegmentSum");const a=o.shape.length,l=r.shape.length,c=[],u=[],h=a-l;let d=r;for(let f=0;ft.disposeIntermediateTensorInfo(f)),p}const KL={kernelName:al,backendName:"cpu",kernelFunc:jL};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -11112,7 +11112,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const YL=[qA,SR,KA,YA,DR,QA,eD,nD,oD,iD,lD,uD,dD,mD,xD,wD,ID,kD,SD,GA,ND,RD,DD,_R,_D,RR,LR,LD,TR,MD,BD,zD,WD,GD,qD,KD,YD,QD,eF,nF,oF,iF,lF,uF,hF,pF,mF,xF,bF,yF,wF,IF,vF,MA,TF,MR,OF,PR,LF,zR,WF,UF,HF,WR,GR,jF,XF,ZF,JF,qR,KR,NR,t_,PD,s_,r_,a_,PA,YR,QR,c_,eA,h_,f_,g_,y_,C_,$_,k_,nA,S_,N_,R_,D_,__,L_,P_,oA,z_,U_,q_,iA,lA,X_,Q_,tO,uA,sO,rO,iO,V1,uO,zA,pA,dO,fO,gO,bO,ER,ap,wO,VA,WA,UA,IO,kO,SO,NO,RO,AO,FO,CA,OO,zO,WO,qO,$A,KO,YO,QO,kA,G_,eL,nL,oL,iL,lL,uL,dL,fL,TA,mL,EA,AA,xL,yL,CL,$L,vL,OA,$F,TL,EL,AL,FL,OL,ML,hA,HL,jL,XL,oO];for(const n of YL)gf(n);/** + */const XL=[HA,vR,jA,XA,AR,ZA,JA,tD,sD,rD,aD,cD,hD,fD,gD,yD,CD,$D,vD,UA,TD,ED,AD,FR,FD,ER,OR,OD,SR,LD,PD,BD,VD,UD,HD,jD,XD,ZD,JD,tF,sF,rF,aF,cF,uF,dF,fF,gF,xF,bF,yF,CF,kF,LA,SF,LR,_F,MR,OF,BR,VF,WF,GF,VR,UR,qF,KF,YF,QF,HR,jR,TR,e_,MD,n_,o_,i_,MA,XR,ZR,l_,JR,u_,p_,m_,b_,w_,I_,$_,tA,v_,T_,E_,A_,F_,O_,M_,sA,B_,W_,H_,rA,aA,K_,Z_,eO,cA,nO,oO,rO,V1,cO,BA,dA,hO,pO,mO,xO,NR,rp,yO,zA,VA,WA,CO,$O,vO,TO,EO,RO,DO,wA,_O,BO,VO,HO,IA,jO,XO,ZO,$A,U_,JO,tL,sL,rL,aL,cL,hL,pL,SA,fL,NA,RA,gL,bL,wL,IL,kL,_A,IF,SL,NL,RL,DL,_L,LL,uA,GL,qL,KL,sO];for(const n of XL)gf(n);/** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -11127,7 +11127,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const $o={},hc={alpha:!1,antialias:!1,premultipliedAlpha:!1,preserveDrawingBuffer:!1,depth:!1,stencil:!1,failIfMajorPerformanceCaveat:!0};function ZL(n,e){$o[n]=e}function Ln(n,e){if(!(n in $o)||e!=null){const s=JL(n,e);if(s!==null)$o[n]=s;else return console.log("Could not get context for WebGL version",n),null}const t=$o[n];return t==null||t.isContextLost()?(delete $o[n],Ln(n)):(t.disable(t.DEPTH_TEST),t.disable(t.STENCIL_TEST),t.disable(t.BLEND),t.disable(t.DITHER),t.disable(t.POLYGON_OFFSET_FILL),t.disable(t.SAMPLE_COVERAGE),t.enable(t.SCISSOR_TEST),t.enable(t.CULL_FACE),t.cullFace(t.BACK),$o[n])}function QL(n){if(!V().getBool("IS_SAFARI")&&typeof OffscreenCanvas<"u"&&n===2)return new OffscreenCanvas(300,150);if(typeof document<"u")return document.createElement("canvas");throw new Error("Cannot create a canvas in this context")}function JL(n,e){if(n!==1&&n!==2)throw new Error("Cannot get WebGL rendering context, WebGL is disabled.");const t=e??QL(n);return t.addEventListener("webglcontextlost",s=>{s.preventDefault(),delete $o[n]},!1),V().getBool("SOFTWARE_WEBGL_ENABLED")&&(hc.failIfMajorPerformanceCaveat=!1),n===1?t.getContext("webgl",hc)||t.getContext("experimental-webgl",hc):t.getContext("webgl2",hc)}/** + */const $o={},hc={alpha:!1,antialias:!1,premultipliedAlpha:!1,preserveDrawingBuffer:!1,depth:!1,stencil:!1,failIfMajorPerformanceCaveat:!0};function YL(n,e){$o[n]=e}function Ln(n,e){if(!(n in $o)||e!=null){const s=QL(n,e);if(s!==null)$o[n]=s;else return console.log("Could not get context for WebGL version",n),null}const t=$o[n];return t==null||t.isContextLost()?(delete $o[n],Ln(n)):(t.disable(t.DEPTH_TEST),t.disable(t.STENCIL_TEST),t.disable(t.BLEND),t.disable(t.DITHER),t.disable(t.POLYGON_OFFSET_FILL),t.disable(t.SAMPLE_COVERAGE),t.enable(t.SCISSOR_TEST),t.enable(t.CULL_FACE),t.cullFace(t.BACK),$o[n])}function ZL(n){if(!V().getBool("IS_SAFARI")&&typeof OffscreenCanvas<"u"&&n===2)return new OffscreenCanvas(300,150);if(typeof document<"u")return document.createElement("canvas");throw new Error("Cannot create a canvas in this context")}function QL(n,e){if(n!==1&&n!==2)throw new Error("Cannot get WebGL rendering context, WebGL is disabled.");const t=e??ZL(n);return t.addEventListener("webglcontextlost",s=>{s.preventDefault(),delete $o[n]},!1),V().getBool("SOFTWARE_WEBGL_ENABLED")&&(hc.failIfMajorPerformanceCaveat=!1),n===1?t.getContext("webgl",hc)||t.getContext("experimental-webgl",hc):t.getContext("webgl2",hc)}/** * @license * Copyright 2017 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -11142,7 +11142,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */var Zi;(function(n){n[n.DENSE=0]="DENSE",n[n.SHARED_BATCH=1]="SHARED_BATCH"})(Zi||(Zi={}));var rn;(function(n){n[n.RENDER=0]="RENDER",n[n.UPLOAD=1]="UPLOAD",n[n.PIXELS=2]="PIXELS",n[n.DOWNLOAD=3]="DOWNLOAD"})(rn||(rn={}));var kt;(function(n){n[n.UNPACKED_FLOAT16=0]="UNPACKED_FLOAT16",n[n.UNPACKED_FLOAT32=1]="UNPACKED_FLOAT32",n[n.PACKED_4X1_UNSIGNED_BYTE=2]="PACKED_4X1_UNSIGNED_BYTE",n[n.PACKED_2X2_FLOAT32=3]="PACKED_2X2_FLOAT32",n[n.PACKED_2X2_FLOAT16=4]="PACKED_2X2_FLOAT16"})(kt||(kt={}));function Qi(n,e){return[e,n]}function eM(n,e){return n*e}function dc(n){const e=G(n),t=Math.ceil(e/4);return Pc(t)}function ar(n,e){return[Math.max(1,Math.ceil(e/2)),Math.max(1,Math.ceil(n/2))]}function tM(n,e){const[t,s]=ar(n,e);return t*s*4}function up(n,e){const t=n;let s,o,r,i,a,l,c,u,h,d;return V().getNumber("WEBGL_VERSION")===2?(s=t.R32F,o=t.R16F,r=t.RGBA16F,i=t.RGBA32F,a=t.RED,c=4,u=1,h=t.HALF_FLOAT,d=t.FLOAT,l=t.RGBA8):(s=n.RGBA,o=n.RGBA,r=n.RGBA,i=t.RGBA,a=n.RGBA,c=4,u=4,h=e!=null?e.HALF_FLOAT_OES:null,d=n.FLOAT,l=n.RGBA),{internalFormatFloat:s,internalFormatHalfFloat:o,internalFormatPackedHalfFloat:r,internalFormatPackedFloat:i,textureFormatFloat:a,downloadTextureFormat:l,downloadUnpackNumChannels:c,defaultNumChannels:u,textureTypeHalfFloat:h,textureTypeFloat:d}}/** + */var Zi;(function(n){n[n.DENSE=0]="DENSE",n[n.SHARED_BATCH=1]="SHARED_BATCH"})(Zi||(Zi={}));var rn;(function(n){n[n.RENDER=0]="RENDER",n[n.UPLOAD=1]="UPLOAD",n[n.PIXELS=2]="PIXELS",n[n.DOWNLOAD=3]="DOWNLOAD"})(rn||(rn={}));var kt;(function(n){n[n.UNPACKED_FLOAT16=0]="UNPACKED_FLOAT16",n[n.UNPACKED_FLOAT32=1]="UNPACKED_FLOAT32",n[n.PACKED_4X1_UNSIGNED_BYTE=2]="PACKED_4X1_UNSIGNED_BYTE",n[n.PACKED_2X2_FLOAT32=3]="PACKED_2X2_FLOAT32",n[n.PACKED_2X2_FLOAT16=4]="PACKED_2X2_FLOAT16"})(kt||(kt={}));function Qi(n,e){return[e,n]}function JL(n,e){return n*e}function dc(n){const e=G(n),t=Math.ceil(e/4);return Lc(t)}function ar(n,e){return[Math.max(1,Math.ceil(e/2)),Math.max(1,Math.ceil(n/2))]}function eM(n,e){const[t,s]=ar(n,e);return t*s*4}function lp(n,e){const t=n;let s,o,r,i,a,l,c,u,h,d;return V().getNumber("WEBGL_VERSION")===2?(s=t.R32F,o=t.R16F,r=t.RGBA16F,i=t.RGBA32F,a=t.RED,c=4,u=1,h=t.HALF_FLOAT,d=t.FLOAT,l=t.RGBA8):(s=n.RGBA,o=n.RGBA,r=n.RGBA,i=t.RGBA,a=n.RGBA,c=4,u=4,h=e!=null?e.HALF_FLOAT_OES:null,d=n.FLOAT,l=n.RGBA),{internalFormatFloat:s,internalFormatHalfFloat:o,internalFormatPackedHalfFloat:r,internalFormatPackedFloat:i,textureFormatFloat:a,downloadTextureFormat:l,downloadUnpackNumChannels:c,defaultNumChannels:u,textureTypeHalfFloat:h,textureTypeFloat:d}}/** * @license * Copyright 2017 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -11157,11 +11157,11 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function ie(n,e){const t=e();return V().getBool("DEBUG")&&nM(n),t}function nM(n){const e=n.getError();if(e!==n.NO_ERROR)throw new Error("WebGL Error: "+iM(n,e))}const sM=596e-10,oM=65504;function rM(n){return!!(V().getBool("WEBGL_RENDER_FLOAT32_ENABLED")||n===0||sMn.getExtension(e),'Extension "'+e+'" not supported on this browser.')}function aM(n,e){const t=ds(n,()=>n.createShader(n.VERTEX_SHADER),"Unable to create vertex WebGLShader.");if(ie(n,()=>n.shaderSource(t,e)),ie(n,()=>n.compileShader(t)),n.getShaderParameter(t,n.COMPILE_STATUS)===!1)throw console.log(n.getShaderInfoLog(t)),new Error("Failed to compile vertex shader.");return t}function lM(n,e){const t=ds(n,()=>n.createShader(n.FRAGMENT_SHADER),"Unable to create fragment WebGLShader.");if(ie(n,()=>n.shaderSource(t,e)),ie(n,()=>n.compileShader(t)),V().get("ENGINE_COMPILE_ONLY"))return t;if(n.getShaderParameter(t,n.COMPILE_STATUS)===!1)throw G1(e,n.getShaderInfoLog(t)),new Error("Failed to compile fragment shader.");return t}const cM=/ERROR: [0-9]+:([0-9]+):/g;function G1(n,e){const t=cM.exec(e);if(t==null){console.log(`Couldn't parse line number in error: ${e}`),console.log(n);return}const s=+t[1],o=n.split(` + */function ie(n,e){const t=e();return V().getBool("DEBUG")&&tM(n),t}function tM(n){const e=n.getError();if(e!==n.NO_ERROR)throw new Error("WebGL Error: "+rM(n,e))}const nM=596e-10,sM=65504;function oM(n){return!!(V().getBool("WEBGL_RENDER_FLOAT32_ENABLED")||n===0||nMn.getExtension(e),'Extension "'+e+'" not supported on this browser.')}function iM(n,e){const t=ds(n,()=>n.createShader(n.VERTEX_SHADER),"Unable to create vertex WebGLShader.");if(ie(n,()=>n.shaderSource(t,e)),ie(n,()=>n.compileShader(t)),n.getShaderParameter(t,n.COMPILE_STATUS)===!1)throw console.log(n.getShaderInfoLog(t)),new Error("Failed to compile vertex shader.");return t}function aM(n,e){const t=ds(n,()=>n.createShader(n.FRAGMENT_SHADER),"Unable to create fragment WebGLShader.");if(ie(n,()=>n.shaderSource(t,e)),ie(n,()=>n.compileShader(t)),V().get("ENGINE_COMPILE_ONLY"))return t;if(n.getShaderParameter(t,n.COMPILE_STATUS)===!1)throw G1(e,n.getShaderInfoLog(t)),new Error("Failed to compile fragment shader.");return t}const lM=/ERROR: [0-9]+:([0-9]+):/g;function G1(n,e){const t=lM.exec(e);if(t==null){console.log(`Couldn't parse line number in error: ${e}`),console.log(n);return}const s=+t[1],o=n.split(` `),r=o.length.toString().length+2,i=o.map((h,d)=>Fo((d+1).toString(),r)+h);let a=0;for(let h=0;hn.createProgram(),"Unable to create WebGLProgram.")}function hM(n,e){if(ie(n,()=>n.linkProgram(e)),!V().get("ENGINE_COMPILE_ONLY")&&n.getProgramParameter(e,n.LINK_STATUS)===!1)throw console.log(n.getProgramInfoLog(e)),new Error("Failed to link vertex and fragment shaders.")}function hp(n,e){if(ie(n,()=>n.validateProgram(e)),n.getProgramParameter(e,n.VALIDATE_STATUS)===!1)throw console.log(n.getProgramInfoLog(e)),new Error("Shader program validation failed.")}function dM(n,e){const t=ds(n,()=>n.createBuffer(),"Unable to create WebGLBuffer");return ie(n,()=>n.bindBuffer(n.ARRAY_BUFFER,t)),ie(n,()=>n.bufferData(n.ARRAY_BUFFER,e,n.STATIC_DRAW)),t}function pM(n,e){const t=ds(n,()=>n.createBuffer(),"Unable to create WebGLBuffer");return ie(n,()=>n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,t)),ie(n,()=>n.bufferData(n.ELEMENT_ARRAY_BUFFER,e,n.STATIC_DRAW)),t}function fM(n){return ds(n,()=>n.createTexture(),"Unable to create WebGLTexture.")}function mM(n,e){const t=V().getNumber("WEBGL_MAX_TEXTURE_SIZE");if(n<=0||e<=0){const s=`[${n}x${e}]`;throw new Error("Requested texture size "+s+" is invalid.")}if(n>t||e>t){const s=`[${n}x${e}]`,o=`[${t}x${t}]`;throw new Error("Requested texture size "+s+" greater than WebGL maximum on this browser / GPU "+o+".")}}function gM(n){return ds(n,()=>n.createFramebuffer(),"Unable to create WebGLFramebuffer.")}function H1(n,e,t,s,o,r,i){const a=n.getAttribLocation(e,t);return a===-1?!1:(ie(n,()=>n.bindBuffer(n.ARRAY_BUFFER,s)),ie(n,()=>n.vertexAttribPointer(a,o,n.FLOAT,!1,r,i)),ie(n,()=>n.enableVertexAttribArray(a)),!0)}function xM(n,e,t){IM(n,t),ie(n,()=>n.activeTexture(n.TEXTURE0+t)),ie(n,()=>n.bindTexture(n.TEXTURE_2D,e))}function bM(n,e,t){return ds(n,()=>n.getUniformLocation(e,t),'uniform "'+t+'" not present in program.')}function yM(n,e,t){return n.getUniformLocation(e,t)}function wM(n,e,t,s){ie(n,()=>xM(n,e,s)),ie(n,()=>n.uniform1i(t,s))}function dp(n,e,t){ie(n,()=>n.bindFramebuffer(n.FRAMEBUFFER,t)),ie(n,()=>n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,e,0))}function q1(n,e){ie(n,()=>n.bindFramebuffer(n.FRAMEBUFFER,e)),ie(n,()=>n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,null,0))}function fc(n){const e=n.checkFramebufferStatus(n.FRAMEBUFFER);if(e!==n.FRAMEBUFFER_COMPLETE)throw new Error("Error binding framebuffer: "+CM(n,e))}function CM(n,e){switch(e){case n.FRAMEBUFFER_INCOMPLETE_ATTACHMENT:return"FRAMEBUFFER_INCOMPLETE_ATTACHMENT";case n.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:return"FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT";case n.FRAMEBUFFER_INCOMPLETE_DIMENSIONS:return"FRAMEBUFFER_INCOMPLETE_DIMENSIONS";case n.FRAMEBUFFER_UNSUPPORTED:return"FRAMEBUFFER_UNSUPPORTED";default:return`unknown error ${e}`}}function ds(n,e,t){const s=ie(n,()=>e());if(s==null)throw new Error(t);return s}function IM(n,e){const t=n.MAX_COMBINED_TEXTURE_IMAGE_UNITS-1,s=e+n.TEXTURE0;if(st){const o=`[gl.TEXTURE0, gl.TEXTURE${t}]`;throw new Error(`textureUnit must be in ${o}.`)}}function lr(n,e=2){return G(n.slice(0,n.length-e))}function cr(n){if(n.length===0)throw Error("Cannot get rows and columns of an empty shape array.");return[n.length>1?n[n.length-2]:1,n[n.length-1]]}function mc(n){let e=[1,1,1];return n.length===0||n.length===1&&n[0]===1||(e=[lr(n),...cr(n)]),e}function $M(n,e=!1){let t=V().getNumber("WEBGL_MAX_TEXTURE_SIZE"),s=V().getNumber("WEBGL_MAX_SIZE_FOR_NARROW_TEXTURE");s===1/0&&V().getBool("WEBGL_AUTO_SQUARIFY_NARROW_TEXTURE_SHAPE")&&(s=t/2),e&&(t=t*2,s=s*2,n=n.map((a,l)=>l>=n.length-2?Lc(n[l]):n[l]),n.length===1&&(n=[2,n[0]])),n.length!==2&&(n=ms(n).newShape);let o=G(n),r=null;n.length<=1&&o<=t?r=[1,o]:n.length===2&&n[0]<=t&&n[1]<=t?r=n:n.length===3&&n[0]*n[1]<=t&&n[2]<=t?r=[n[0]*n[1],n[2]]:n.length===3&&n[0]<=t&&n[1]*n[2]<=t?r=[n[0],n[1]*n[2]]:n.length===4&&n[0]*n[1]*n[2]<=t&&n[3]<=t?r=[n[0]*n[1]*n[2],n[3]]:n.length===4&&n[0]<=t&&n[1]*n[2]*n[3]<=t&&(r=[n[0],n[1]*n[2]*n[3]]);const i=r!=null&&Math.max(...r)>s&&Math.min(...r)<=(e?2:1)&&Math.min(...r)>0;if(r==null||i)if(e){const a=lr(n);let l=2,c=2;n.length&&([l,c]=cr(n)),o=a*(l/2)*(c/2),r=Pc(o).map(u=>u*2)}else r=Pc(o);return r}function gc(n){return n%2===0}function xc(n,e){if(n=n.slice(-2),e=e.slice(-2),_e(n,e)||!n.length||!e.length||n[0]===0||n[1]===0||e[0]===0||e[1]===0)return!0;if(n.length!==e.length){const t=n[n.length-1],s=e[e.length-1];if(t===s||gc(t)&&gc(s)&&(n[0]===1||e[0]===1))return!0}return n[1]===e[1]&&gc(n[0])&&gc(e[0])}let pp,fp;function kM(n){if(pp==null){const e=Ln(n);pp=e.getParameter(e.MAX_TEXTURE_SIZE)}return pp}function vM(n){if(fp==null){const e=Ln(n);fp=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS)}return Math.min(16,fp)}function SM(n){if(n===0)return 0;let e;const t=Ln(n);return Cn(t,"EXT_disjoint_timer_query_webgl2")&&n===2?e=2:Cn(t,"EXT_disjoint_timer_query")?e=1:e=0,e}function Cn(n,e){return n.getExtension(e)!=null}function j1(n){try{if(Ln(n)!=null)return!0}catch(e){return console.log("Error when getting WebGL context: ",e),!1}return!1}function TM(n){if(n===0)return!1;const e=Ln(n);if(n===1){if(!Cn(e,"OES_texture_float"))return!1}else if(!Cn(e,"EXT_color_buffer_float"))return!1;return mp(e)}function NM(n){if(n===0)return!1;const e=Ln(n);if(n===1){if(!Cn(e,"OES_texture_float")||!Cn(e,"WEBGL_color_buffer_float"))return!1}else{if(Cn(e,"EXT_color_buffer_float"))return mp(e);const s="EXT_color_buffer_half_float";if(Cn(e,s)){const o=e.getExtension(s);return EM(e,o)}return!1}return mp(e)}function mp(n){const e=up(n),t=n.createTexture();n.bindTexture(n.TEXTURE_2D,t),n.texImage2D(n.TEXTURE_2D,0,e.internalFormatFloat,1,1,0,e.textureFormatFloat,e.textureTypeFloat,null);const r=n.createFramebuffer();n.bindFramebuffer(n.FRAMEBUFFER,r),n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,t,0);const i=n.checkFramebufferStatus(n.FRAMEBUFFER)===n.FRAMEBUFFER_COMPLETE;return n.bindTexture(n.TEXTURE_2D,null),n.bindFramebuffer(n.FRAMEBUFFER,null),n.deleteTexture(t),n.deleteFramebuffer(r),i}function EM(n,e){const t=up(n,e),s=n.createTexture();n.bindTexture(n.TEXTURE_2D,s),n.texImage2D(n.TEXTURE_2D,0,t.internalFormatHalfFloat,1,1,0,t.textureFormatFloat,t.textureTypeHalfFloat,null);const i=n.createFramebuffer();n.bindFramebuffer(n.FRAMEBUFFER,i),n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,s,0);const a=n.checkFramebufferStatus(n.FRAMEBUFFER)===n.FRAMEBUFFER_COMPLETE;return n.bindTexture(n.TEXTURE_2D,null),n.bindFramebuffer(n.FRAMEBUFFER,null),n.deleteTexture(s),n.deleteFramebuffer(i),a}function RM(n){return n!==2?!1:Ln(n).fenceSync!=null}function Ji(n,e){Array.isArray(n)||(n=[n]),n.forEach(t=>{t!=null&&v(t.dtype!=="complex64",()=>`${e} does not support complex64 tensors in the WebGL backend.`)})}/** +`))}function cM(n){return ds(n,()=>n.createProgram(),"Unable to create WebGLProgram.")}function uM(n,e){if(ie(n,()=>n.linkProgram(e)),!V().get("ENGINE_COMPILE_ONLY")&&n.getProgramParameter(e,n.LINK_STATUS)===!1)throw console.log(n.getProgramInfoLog(e)),new Error("Failed to link vertex and fragment shaders.")}function cp(n,e){if(ie(n,()=>n.validateProgram(e)),n.getProgramParameter(e,n.VALIDATE_STATUS)===!1)throw console.log(n.getProgramInfoLog(e)),new Error("Shader program validation failed.")}function hM(n,e){const t=ds(n,()=>n.createBuffer(),"Unable to create WebGLBuffer");return ie(n,()=>n.bindBuffer(n.ARRAY_BUFFER,t)),ie(n,()=>n.bufferData(n.ARRAY_BUFFER,e,n.STATIC_DRAW)),t}function dM(n,e){const t=ds(n,()=>n.createBuffer(),"Unable to create WebGLBuffer");return ie(n,()=>n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,t)),ie(n,()=>n.bufferData(n.ELEMENT_ARRAY_BUFFER,e,n.STATIC_DRAW)),t}function pM(n){return ds(n,()=>n.createTexture(),"Unable to create WebGLTexture.")}function fM(n,e){const t=V().getNumber("WEBGL_MAX_TEXTURE_SIZE");if(n<=0||e<=0){const s=`[${n}x${e}]`;throw new Error("Requested texture size "+s+" is invalid.")}if(n>t||e>t){const s=`[${n}x${e}]`,o=`[${t}x${t}]`;throw new Error("Requested texture size "+s+" greater than WebGL maximum on this browser / GPU "+o+".")}}function mM(n){return ds(n,()=>n.createFramebuffer(),"Unable to create WebGLFramebuffer.")}function H1(n,e,t,s,o,r,i){const a=n.getAttribLocation(e,t);return a===-1?!1:(ie(n,()=>n.bindBuffer(n.ARRAY_BUFFER,s)),ie(n,()=>n.vertexAttribPointer(a,o,n.FLOAT,!1,r,i)),ie(n,()=>n.enableVertexAttribArray(a)),!0)}function gM(n,e,t){CM(n,t),ie(n,()=>n.activeTexture(n.TEXTURE0+t)),ie(n,()=>n.bindTexture(n.TEXTURE_2D,e))}function xM(n,e,t){return ds(n,()=>n.getUniformLocation(e,t),'uniform "'+t+'" not present in program.')}function bM(n,e,t){return n.getUniformLocation(e,t)}function yM(n,e,t,s){ie(n,()=>gM(n,e,s)),ie(n,()=>n.uniform1i(t,s))}function up(n,e,t){ie(n,()=>n.bindFramebuffer(n.FRAMEBUFFER,t)),ie(n,()=>n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,e,0))}function q1(n,e){ie(n,()=>n.bindFramebuffer(n.FRAMEBUFFER,e)),ie(n,()=>n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,null,0))}function fc(n){const e=n.checkFramebufferStatus(n.FRAMEBUFFER);if(e!==n.FRAMEBUFFER_COMPLETE)throw new Error("Error binding framebuffer: "+wM(n,e))}function wM(n,e){switch(e){case n.FRAMEBUFFER_INCOMPLETE_ATTACHMENT:return"FRAMEBUFFER_INCOMPLETE_ATTACHMENT";case n.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:return"FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT";case n.FRAMEBUFFER_INCOMPLETE_DIMENSIONS:return"FRAMEBUFFER_INCOMPLETE_DIMENSIONS";case n.FRAMEBUFFER_UNSUPPORTED:return"FRAMEBUFFER_UNSUPPORTED";default:return`unknown error ${e}`}}function ds(n,e,t){const s=ie(n,()=>e());if(s==null)throw new Error(t);return s}function CM(n,e){const t=n.MAX_COMBINED_TEXTURE_IMAGE_UNITS-1,s=e+n.TEXTURE0;if(st){const o=`[gl.TEXTURE0, gl.TEXTURE${t}]`;throw new Error(`textureUnit must be in ${o}.`)}}function lr(n,e=2){return G(n.slice(0,n.length-e))}function cr(n){if(n.length===0)throw Error("Cannot get rows and columns of an empty shape array.");return[n.length>1?n[n.length-2]:1,n[n.length-1]]}function mc(n){let e=[1,1,1];return n.length===0||n.length===1&&n[0]===1||(e=[lr(n),...cr(n)]),e}function IM(n,e=!1){let t=V().getNumber("WEBGL_MAX_TEXTURE_SIZE"),s=V().getNumber("WEBGL_MAX_SIZE_FOR_NARROW_TEXTURE");s===1/0&&V().getBool("WEBGL_AUTO_SQUARIFY_NARROW_TEXTURE_SHAPE")&&(s=t/2),e&&(t=t*2,s=s*2,n=n.map((a,l)=>l>=n.length-2?_c(n[l]):n[l]),n.length===1&&(n=[2,n[0]])),n.length!==2&&(n=ms(n).newShape);let o=G(n),r=null;n.length<=1&&o<=t?r=[1,o]:n.length===2&&n[0]<=t&&n[1]<=t?r=n:n.length===3&&n[0]*n[1]<=t&&n[2]<=t?r=[n[0]*n[1],n[2]]:n.length===3&&n[0]<=t&&n[1]*n[2]<=t?r=[n[0],n[1]*n[2]]:n.length===4&&n[0]*n[1]*n[2]<=t&&n[3]<=t?r=[n[0]*n[1]*n[2],n[3]]:n.length===4&&n[0]<=t&&n[1]*n[2]*n[3]<=t&&(r=[n[0],n[1]*n[2]*n[3]]);const i=r!=null&&Math.max(...r)>s&&Math.min(...r)<=(e?2:1)&&Math.min(...r)>0;if(r==null||i)if(e){const a=lr(n);let l=2,c=2;n.length&&([l,c]=cr(n)),o=a*(l/2)*(c/2),r=Lc(o).map(u=>u*2)}else r=Lc(o);return r}function gc(n){return n%2===0}function xc(n,e){if(n=n.slice(-2),e=e.slice(-2),_e(n,e)||!n.length||!e.length||n[0]===0||n[1]===0||e[0]===0||e[1]===0)return!0;if(n.length!==e.length){const t=n[n.length-1],s=e[e.length-1];if(t===s||gc(t)&&gc(s)&&(n[0]===1||e[0]===1))return!0}return n[1]===e[1]&&gc(n[0])&&gc(e[0])}let hp,dp;function $M(n){if(hp==null){const e=Ln(n);hp=e.getParameter(e.MAX_TEXTURE_SIZE)}return hp}function kM(n){if(dp==null){const e=Ln(n);dp=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS)}return Math.min(16,dp)}function vM(n){if(n===0)return 0;let e;const t=Ln(n);return Cn(t,"EXT_disjoint_timer_query_webgl2")&&n===2?e=2:Cn(t,"EXT_disjoint_timer_query")?e=1:e=0,e}function Cn(n,e){return n.getExtension(e)!=null}function j1(n){try{if(Ln(n)!=null)return!0}catch(e){return console.log("Error when getting WebGL context: ",e),!1}return!1}function SM(n){if(n===0)return!1;const e=Ln(n);if(n===1){if(!Cn(e,"OES_texture_float"))return!1}else if(!Cn(e,"EXT_color_buffer_float"))return!1;return pp(e)}function TM(n){if(n===0)return!1;const e=Ln(n);if(n===1){if(!Cn(e,"OES_texture_float")||!Cn(e,"WEBGL_color_buffer_float"))return!1}else{if(Cn(e,"EXT_color_buffer_float"))return pp(e);const s="EXT_color_buffer_half_float";if(Cn(e,s)){const o=e.getExtension(s);return NM(e,o)}return!1}return pp(e)}function pp(n){const e=lp(n),t=n.createTexture();n.bindTexture(n.TEXTURE_2D,t),n.texImage2D(n.TEXTURE_2D,0,e.internalFormatFloat,1,1,0,e.textureFormatFloat,e.textureTypeFloat,null);const r=n.createFramebuffer();n.bindFramebuffer(n.FRAMEBUFFER,r),n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,t,0);const i=n.checkFramebufferStatus(n.FRAMEBUFFER)===n.FRAMEBUFFER_COMPLETE;return n.bindTexture(n.TEXTURE_2D,null),n.bindFramebuffer(n.FRAMEBUFFER,null),n.deleteTexture(t),n.deleteFramebuffer(r),i}function NM(n,e){const t=lp(n,e),s=n.createTexture();n.bindTexture(n.TEXTURE_2D,s),n.texImage2D(n.TEXTURE_2D,0,t.internalFormatHalfFloat,1,1,0,t.textureFormatFloat,t.textureTypeHalfFloat,null);const i=n.createFramebuffer();n.bindFramebuffer(n.FRAMEBUFFER,i),n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,s,0);const a=n.checkFramebufferStatus(n.FRAMEBUFFER)===n.FRAMEBUFFER_COMPLETE;return n.bindTexture(n.TEXTURE_2D,null),n.bindFramebuffer(n.FRAMEBUFFER,null),n.deleteTexture(s),n.deleteFramebuffer(i),a}function EM(n){return n!==2?!1:Ln(n).fenceSync!=null}function Ji(n,e){Array.isArray(n)||(n=[n]),n.forEach(t=>{t!=null&&k(t.dtype!=="complex64",()=>`${e} does not support complex64 tensors in the WebGL backend.`)})}/** * @license * Copyright 2019 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -11176,7 +11176,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const ce=V();ce.registerFlag("HAS_WEBGL",()=>ce.getNumber("WEBGL_VERSION")>0),ce.registerFlag("WEBGL_VERSION",()=>j1(2)?2:j1(1)?1:0),ce.registerFlag("WEBGL_CHECK_NUMERICAL_PROBLEMS",()=>!1),ce.registerFlag("WEBGL_BUFFER_SUPPORTED",()=>ce.get("WEBGL_VERSION")===2),ce.registerFlag("WEBGL_CPU_FORWARD",()=>!0),ce.registerFlag("WEBGL_FORCE_F16_TEXTURES",()=>!1),ce.registerFlag("WEBGL_PACK",()=>ce.getBool("HAS_WEBGL")),ce.registerFlag("WEBGL_PACK_NORMALIZATION",()=>ce.getBool("WEBGL_PACK")),ce.registerFlag("WEBGL_PACK_CLIP",()=>ce.getBool("WEBGL_PACK")),ce.registerFlag("WEBGL_PACK_DEPTHWISECONV",()=>ce.getBool("WEBGL_PACK")),ce.registerFlag("WEBGL_PACK_BINARY_OPERATIONS",()=>ce.getBool("WEBGL_PACK")),ce.registerFlag("WEBGL_PACK_UNARY_OPERATIONS",()=>ce.getBool("WEBGL_PACK")),ce.registerFlag("WEBGL_PACK_ARRAY_OPERATIONS",()=>ce.getBool("WEBGL_PACK")),ce.registerFlag("WEBGL_PACK_IMAGE_OPERATIONS",()=>ce.getBool("WEBGL_PACK")),ce.registerFlag("WEBGL_PACK_REDUCE",()=>ce.getBool("WEBGL_PACK")),ce.registerFlag("WEBGL_LAZILY_UNPACK",()=>ce.getBool("WEBGL_PACK")),ce.registerFlag("WEBGL_CONV_IM2COL",()=>ce.getBool("WEBGL_PACK")),ce.registerFlag("WEBGL_PACK_CONV2DTRANSPOSE",()=>ce.getBool("WEBGL_PACK")),ce.registerFlag("WEBGL_MAX_TEXTURE_SIZE",()=>kM(ce.getNumber("WEBGL_VERSION"))),ce.registerFlag("WEBGL_MAX_TEXTURES_IN_SHADER",()=>vM(ce.getNumber("WEBGL_VERSION"))),ce.registerFlag("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION",()=>{const n=ce.getNumber("WEBGL_VERSION");return n===0?0:SM(n)}),ce.registerFlag("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE",()=>ce.getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")>0&&!Wf()),ce.registerFlag("WEBGL_RENDER_FLOAT32_CAPABLE",()=>TM(ce.getNumber("WEBGL_VERSION"))),ce.registerFlag("WEBGL_RENDER_FLOAT32_ENABLED",()=>ce.getBool("WEBGL_FORCE_F16_TEXTURES")?!1:ce.getBool("WEBGL_RENDER_FLOAT32_CAPABLE")),ce.registerFlag("WEBGL_DOWNLOAD_FLOAT_ENABLED",()=>NM(ce.getNumber("WEBGL_VERSION"))),ce.registerFlag("WEBGL_FENCE_API_ENABLED",()=>RM(ce.getNumber("WEBGL_VERSION"))),ce.registerFlag("WEBGL_SIZE_UPLOAD_UNIFORM",()=>ce.getBool("WEBGL_RENDER_FLOAT32_ENABLED")?4:0),ce.registerFlag("WEBGL_DELETE_TEXTURE_THRESHOLD",()=>-1,n=>{if(typeof n!="number")throw new Error(`WEBGL_DELETE_TEXTURE_THRESHOLD must be a number but got ${n}.`);if(n<0&&n!==-1)throw new Error(`WEBGL_DELETE_TEXTURE_THRESHOLD must be -1 (indicating never delete) or at least 0, but got ${n}.`)}),ce.registerFlag("WEBGL_FLUSH_THRESHOLD",()=>Wf()?1:-1,n=>{if(typeof n!="number")throw new Error(`WEBGL_FLUSH_THRESHOLD must be a number but got ${n}.`);if(n<0&&n!==-1)throw new Error(`WEBGL_FLUSH_THRESHOLD must be -1 (indicating never manual flush) or at least 0, but got ${n}.`)}),ce.registerFlag("CPU_HANDOFF_SIZE_THRESHOLD",()=>128),ce.registerFlag("WEBGL_USE_SHAPES_UNIFORMS",()=>!1),ce.registerFlag("TOPK_LAST_DIM_CPU_HANDOFF_SIZE_THRESHOLD",()=>1e5),ce.registerFlag("TOPK_K_CPU_HANDOFF_THRESHOLD",()=>128),ce.registerFlag("WEBGL_EXP_CONV",()=>!1),ce.registerFlag("SOFTWARE_WEBGL_ENABLED",()=>ce.getBool("IS_TEST")),ce.registerFlag("WEBGL_MAX_SIZE_FOR_NARROW_TEXTURE",()=>1/0),ce.registerFlag("WEBGL_AUTO_SQUARIFY_NARROW_TEXTURE_SHAPE",()=>!1),ce.registerFlag("WEBGL2_ISNAN_CUSTOM",()=>!1),ce.registerFlag("ENGINE_COMPILE_ONLY",()=>!1);/** + */const ce=V();ce.registerFlag("HAS_WEBGL",()=>ce.getNumber("WEBGL_VERSION")>0),ce.registerFlag("WEBGL_VERSION",()=>j1(2)?2:j1(1)?1:0),ce.registerFlag("WEBGL_CHECK_NUMERICAL_PROBLEMS",()=>!1),ce.registerFlag("WEBGL_BUFFER_SUPPORTED",()=>ce.get("WEBGL_VERSION")===2),ce.registerFlag("WEBGL_CPU_FORWARD",()=>!0),ce.registerFlag("WEBGL_FORCE_F16_TEXTURES",()=>!1),ce.registerFlag("WEBGL_PACK",()=>ce.getBool("HAS_WEBGL")),ce.registerFlag("WEBGL_PACK_NORMALIZATION",()=>ce.getBool("WEBGL_PACK")),ce.registerFlag("WEBGL_PACK_CLIP",()=>ce.getBool("WEBGL_PACK")),ce.registerFlag("WEBGL_PACK_DEPTHWISECONV",()=>ce.getBool("WEBGL_PACK")),ce.registerFlag("WEBGL_PACK_BINARY_OPERATIONS",()=>ce.getBool("WEBGL_PACK")),ce.registerFlag("WEBGL_PACK_UNARY_OPERATIONS",()=>ce.getBool("WEBGL_PACK")),ce.registerFlag("WEBGL_PACK_ARRAY_OPERATIONS",()=>ce.getBool("WEBGL_PACK")),ce.registerFlag("WEBGL_PACK_IMAGE_OPERATIONS",()=>ce.getBool("WEBGL_PACK")),ce.registerFlag("WEBGL_PACK_REDUCE",()=>ce.getBool("WEBGL_PACK")),ce.registerFlag("WEBGL_LAZILY_UNPACK",()=>ce.getBool("WEBGL_PACK")),ce.registerFlag("WEBGL_CONV_IM2COL",()=>ce.getBool("WEBGL_PACK")),ce.registerFlag("WEBGL_PACK_CONV2DTRANSPOSE",()=>ce.getBool("WEBGL_PACK")),ce.registerFlag("WEBGL_MAX_TEXTURE_SIZE",()=>$M(ce.getNumber("WEBGL_VERSION"))),ce.registerFlag("WEBGL_MAX_TEXTURES_IN_SHADER",()=>kM(ce.getNumber("WEBGL_VERSION"))),ce.registerFlag("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION",()=>{const n=ce.getNumber("WEBGL_VERSION");return n===0?0:vM(n)}),ce.registerFlag("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE",()=>ce.getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")>0&&!Wf()),ce.registerFlag("WEBGL_RENDER_FLOAT32_CAPABLE",()=>SM(ce.getNumber("WEBGL_VERSION"))),ce.registerFlag("WEBGL_RENDER_FLOAT32_ENABLED",()=>ce.getBool("WEBGL_FORCE_F16_TEXTURES")?!1:ce.getBool("WEBGL_RENDER_FLOAT32_CAPABLE")),ce.registerFlag("WEBGL_DOWNLOAD_FLOAT_ENABLED",()=>TM(ce.getNumber("WEBGL_VERSION"))),ce.registerFlag("WEBGL_FENCE_API_ENABLED",()=>EM(ce.getNumber("WEBGL_VERSION"))),ce.registerFlag("WEBGL_SIZE_UPLOAD_UNIFORM",()=>ce.getBool("WEBGL_RENDER_FLOAT32_ENABLED")?4:0),ce.registerFlag("WEBGL_DELETE_TEXTURE_THRESHOLD",()=>-1,n=>{if(typeof n!="number")throw new Error(`WEBGL_DELETE_TEXTURE_THRESHOLD must be a number but got ${n}.`);if(n<0&&n!==-1)throw new Error(`WEBGL_DELETE_TEXTURE_THRESHOLD must be -1 (indicating never delete) or at least 0, but got ${n}.`)}),ce.registerFlag("WEBGL_FLUSH_THRESHOLD",()=>Wf()?1:-1,n=>{if(typeof n!="number")throw new Error(`WEBGL_FLUSH_THRESHOLD must be a number but got ${n}.`);if(n<0&&n!==-1)throw new Error(`WEBGL_FLUSH_THRESHOLD must be -1 (indicating never manual flush) or at least 0, but got ${n}.`)}),ce.registerFlag("CPU_HANDOFF_SIZE_THRESHOLD",()=>128),ce.registerFlag("WEBGL_USE_SHAPES_UNIFORMS",()=>!1),ce.registerFlag("TOPK_LAST_DIM_CPU_HANDOFF_SIZE_THRESHOLD",()=>1e5),ce.registerFlag("TOPK_K_CPU_HANDOFF_THRESHOLD",()=>128),ce.registerFlag("WEBGL_EXP_CONV",()=>!1),ce.registerFlag("SOFTWARE_WEBGL_ENABLED",()=>ce.getBool("IS_TEST")),ce.registerFlag("WEBGL_MAX_SIZE_FOR_NARROW_TEXTURE",()=>1/0),ce.registerFlag("WEBGL_AUTO_SQUARIFY_NARROW_TEXTURE_SHAPE",()=>!1),ce.registerFlag("WEBGL2_ISNAN_CUSTOM",()=>!1),ce.registerFlag("ENGINE_COMPILE_ONLY",()=>!1);/** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -11191,7 +11191,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function Pt(){let n,e,t,s,o,r,i,a,l,c;return V().getNumber("WEBGL_VERSION")===2?(n="#version 300 es",e="in",t="out",s="in",o="texture",r="outputColor",i="out vec4 outputColor;",a=V().getBool("WEBGL2_ISNAN_CUSTOM")?` + */function Mt(){let n,e,t,s,o,r,i,a,l,c;return V().getNumber("WEBGL_VERSION")===2?(n="#version 300 es",e="in",t="out",s="in",o="texture",r="outputColor",i="out vec4 outputColor;",a=V().getBool("WEBGL2_ISNAN_CUSTOM")?` bool isnan_custom(float val) { uint floatToUint = floatBitsToUint(val); return (floatToUint & 0x7fffffffu) > 0x7f800000u; @@ -11252,11 +11252,11 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function ko(n,e,t="index"){const s=ue(e);return s.map((o,r)=>{const i=`int ${n[r]} = ${t} / ${o}`,a=r===s.length-1?`int ${n[r+1]} = ${t} - ${n[r]} * ${o}`:`index -= ${n[r]} * ${o}`;return`${i}; ${a};`}).join("")}function bc(n,e,t="index"){const s=ue(e);return s.map((o,r)=>{const i=`int ${n[r]} = ${t} / outShapeStrides[${r}]`,a=r===s.length-1?`int ${n[r+1]} = ${t} - ${n[r]} * outShapeStrides[${r}]`:`index -= ${n[r]} * outShapeStrides[${r}]`;return`${i}; ${a};`}).join("")}function AM(n,e){const t=n.length,s=n.map(r=>`${e}[${r}]`),o=new Array(t-1);o[t-2]=s[t-1];for(let r=t-3;r>=0;--r)o[r]=`(${o[r+1]} * ${s[r+1]})`;return o}function DM(n,e,t="index"){const s=n.map((r,i)=>i),o=AM(s,e);return o.map((r,i)=>{const a=`int ${n[i]} = ${t} / ${o[i]}`,l=i===o.length-1?`int ${n[i+1]} = ${t} - ${n[i]} * ${o[i]}`:`index -= ${n[i]} * ${o[i]}`;return`${a}; ${l};`}).join("")}function gp(n){const e=ue(n).map(t=>t.toString());return` + */function ko(n,e,t="index"){const s=ue(e);return s.map((o,r)=>{const i=`int ${n[r]} = ${t} / ${o}`,a=r===s.length-1?`int ${n[r+1]} = ${t} - ${n[r]} * ${o}`:`index -= ${n[r]} * ${o}`;return`${i}; ${a};`}).join("")}function bc(n,e,t="index"){const s=ue(e);return s.map((o,r)=>{const i=`int ${n[r]} = ${t} / outShapeStrides[${r}]`,a=r===s.length-1?`int ${n[r+1]} = ${t} - ${n[r]} * outShapeStrides[${r}]`:`index -= ${n[r]} * outShapeStrides[${r}]`;return`${i}; ${a};`}).join("")}function RM(n,e){const t=n.length,s=n.map(r=>`${e}[${r}]`),o=new Array(t-1);o[t-2]=s[t-1];for(let r=t-3;r>=0;--r)o[r]=`(${o[r+1]} * ${s[r+1]})`;return o}function AM(n,e,t="index"){const s=n.map((r,i)=>i),o=RM(s,e);return o.map((r,i)=>{const a=`int ${n[i]} = ${t} / ${o[i]}`,l=i===o.length-1?`int ${n[i+1]} = ${t} - ${n[i]} * ${o[i]}`:`index -= ${n[i]} * ${o[i]}`;return`${a}; ${l};`}).join("")}function fp(n){const e=ue(n).map(t=>t.toString());return` int getFlatIndex(ivec3 coords) { return coords.x * ${e[0]} + coords.y * ${e[1]} + coords.z; } -`}function xp(){return` +`}function mp(){return` int getFlatIndex(ivec3 coords) { return coords.x * outShapeStrides[0] + coords.y * outShapeStrides[1] + coords.z; } @@ -11314,22 +11314,22 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const{getBroadcastDims:X1}=k2;function FM(n,e,t){const s=[];if(n.forEach(p=>{const f=G(p.shapeInfo.logicalShape);if(p.shapeInfo.isUniform?s.push(`uniform float ${p.name}${f>1?`[${f}]`:""};`):(s.push(`uniform sampler2D ${p.name};`),s.push(`uniform int offset${p.name};`)),t.enableShapeUniforms){const{uniformShape:m}=bp(t.packedInputs,p.shapeInfo.logicalShape,p.shapeInfo.texShape);switch(m.length){case 1:s.push(`uniform int ${p.name}Shape;`);break;case 2:s.push(`uniform ivec2 ${p.name}Shape;`);break;case 3:s.push(`uniform ivec3 ${p.name}Shape;`);break;case 4:s.push(`uniform ivec4 ${p.name}Shape;`);break}s.push(`uniform ivec2 ${p.name}TexShape;`)}}),t.enableShapeUniforms){switch(e.logicalShape.length){case 1:s.push("uniform int outShape;");break;case 2:s.push("uniform ivec2 outShape;"),s.push("uniform int outShapeStrides;");break;case 3:s.push("uniform ivec3 outShape;"),s.push("uniform ivec2 outShapeStrides;");break;case 4:s.push("uniform ivec4 outShape;"),s.push("uniform ivec3 outShapeStrides;");break}s.push("uniform ivec2 outTexShape;")}t.customUniforms&&t.customUniforms.forEach(p=>{s.push(`uniform ${p.type} ${p.name}${p.arrayIndex?`[${p.arrayIndex}]`:""};`)});const o=s.join(` -`),r=n.map(p=>_M(p,e,t.packedInputs,t.enableShapeUniforms)).join(` -`),i=e.texShape,a=Pt(),l=MM(a);let c,u,h=zM(a);return e.isPacked?(c=OM(e.logicalShape,i,t.enableShapeUniforms),u=BM(a)):(c=LM(e.logicalShape,i,t.enableShapeUniforms),u=PM(a)),t.packedInputs&&(h+=GM),[h,l,u,o,c,r,t.userCode].join(` -`)}function ur(n,e=!1){const t=n.shapeInfo.logicalShape;switch(t.length){case 0:return nP(n,e);case 1:return oP(n,e);case 2:return iP(n,e);case 3:return lP(n,e);case 4:return uP(n,e);case 5:return hP(n);case 6:return dP(n);default:throw new Error(`${t.length}-D input sampling is not yet supported`)}}function Y1(n,e){switch(n.shapeInfo.logicalShape.length){case 0:return tP(n);case 1:return sP(n,e);case 2:return rP(n,e);case 3:return aP(n,e);default:return cP(n,e)}}function _M(n,e,t=!1,s){let o="";t?o+=Y1(n,s):o+=ur(n,s);const r=n.shapeInfo.logicalShape,i=e.logicalShape;return r.length<=i.length&&(t?o+=pP(n,e):o+=fP(n,e)),o}function OM(n,e,t){switch(n.length){case 0:return Z1();case 1:return HM(n,e,t);case 2:return JM(n,e,t);case 3:return jM(n,e,t);default:return XM(n,e,t)}}function LM(n,e,t){switch(n.length){case 0:return Z1();case 1:return qM(n,e,t);case 2:return eP(n,e,t);case 3:return KM(n,e,t);case 4:return YM(n,e,t);case 5:return ZM(n,e);case 6:return QM(n,e);default:throw new Error(`${n.length}-D output sampling is not yet supported`)}}function MM(n){return` + */const{getBroadcastDims:X1}=$2;function DM(n,e,t){const s=[];if(n.forEach(p=>{const f=G(p.shapeInfo.logicalShape);if(p.shapeInfo.isUniform?s.push(`uniform float ${p.name}${f>1?`[${f}]`:""};`):(s.push(`uniform sampler2D ${p.name};`),s.push(`uniform int offset${p.name};`)),t.enableShapeUniforms){const{uniformShape:m}=gp(t.packedInputs,p.shapeInfo.logicalShape,p.shapeInfo.texShape);switch(m.length){case 1:s.push(`uniform int ${p.name}Shape;`);break;case 2:s.push(`uniform ivec2 ${p.name}Shape;`);break;case 3:s.push(`uniform ivec3 ${p.name}Shape;`);break;case 4:s.push(`uniform ivec4 ${p.name}Shape;`);break}s.push(`uniform ivec2 ${p.name}TexShape;`)}}),t.enableShapeUniforms){switch(e.logicalShape.length){case 1:s.push("uniform int outShape;");break;case 2:s.push("uniform ivec2 outShape;"),s.push("uniform int outShapeStrides;");break;case 3:s.push("uniform ivec3 outShape;"),s.push("uniform ivec2 outShapeStrides;");break;case 4:s.push("uniform ivec4 outShape;"),s.push("uniform ivec3 outShapeStrides;");break}s.push("uniform ivec2 outTexShape;")}t.customUniforms&&t.customUniforms.forEach(p=>{s.push(`uniform ${p.type} ${p.name}${p.arrayIndex?`[${p.arrayIndex}]`:""};`)});const o=s.join(` +`),r=n.map(p=>FM(p,e,t.packedInputs,t.enableShapeUniforms)).join(` +`),i=e.texShape,a=Mt(),l=LM(a);let c,u,h=BM(a);return e.isPacked?(c=_M(e.logicalShape,i,t.enableShapeUniforms),u=PM(a)):(c=OM(e.logicalShape,i,t.enableShapeUniforms),u=MM(a)),t.packedInputs&&(h+=UM),[h,l,u,o,c,r,t.userCode].join(` +`)}function ur(n,e=!1){const t=n.shapeInfo.logicalShape;switch(t.length){case 0:return tP(n,e);case 1:return sP(n,e);case 2:return rP(n,e);case 3:return aP(n,e);case 4:return cP(n,e);case 5:return uP(n);case 6:return hP(n);default:throw new Error(`${t.length}-D input sampling is not yet supported`)}}function Y1(n,e){switch(n.shapeInfo.logicalShape.length){case 0:return eP(n);case 1:return nP(n,e);case 2:return oP(n,e);case 3:return iP(n,e);default:return lP(n,e)}}function FM(n,e,t=!1,s){let o="";t?o+=Y1(n,s):o+=ur(n,s);const r=n.shapeInfo.logicalShape,i=e.logicalShape;return r.length<=i.length&&(t?o+=dP(n,e):o+=pP(n,e)),o}function _M(n,e,t){switch(n.length){case 0:return Z1();case 1:return GM(n,e,t);case 2:return QM(n,e,t);case 3:return qM(n,e,t);default:return KM(n,e,t)}}function OM(n,e,t){switch(n.length){case 0:return Z1();case 1:return HM(n,e,t);case 2:return JM(n,e,t);case 3:return jM(n,e,t);case 4:return XM(n,e,t);case 5:return YM(n,e);case 6:return ZM(n,e);default:throw new Error(`${n.length}-D output sampling is not yet supported`)}}function LM(n){return` float sampleTexture(sampler2D textureSampler, vec2 uv) { return ${n.texture2D}(textureSampler, uv).r; } - `}function PM(n){return` + `}function MM(n){return` void setOutput(float val) { ${n.output} = vec4(val, 0, 0, 0); } - `}function BM(n){return` + `}function PM(n){return` void setOutput(vec4 val) { ${n.output} = val; } - `}function zM(n){return`${n.version} + `}function BM(n){return`${n.version} precision highp float; precision highp int; precision highp sampler2D; @@ -11384,10 +11384,10 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram return fract((p3.x + p3.y) * p3.z); } + ${zM} ${VM} ${WM} - ${UM} - `}const VM=` + `}const zM=` vec2 uvFromFlat(int texNumR, int texNumC, int index) { int texR = index / texNumC; int texC = index - texR * texNumC; @@ -11399,7 +11399,7 @@ vec2 packedUVfrom1D(int texNumR, int texNumC, int index) { int texC = texelIndex - texR * texNumC; return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR); } -`,WM=` +`,VM=` vec2 packedUVfrom2D(int texelsInLogicalRow, int texNumR, int texNumC, int row, int col) { int texelIndex = (row / 2) * texelsInLogicalRow + (col / 2); @@ -11407,7 +11407,7 @@ vec2 packedUVfrom2D(int texelsInLogicalRow, int texNumR, int texC = texelIndex - texR * texNumC; return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR); } -`,UM=` +`,WM=` vec2 packedUVfrom3D(int texNumR, int texNumC, int texelsInBatch, int texelsInLogicalRow, int b, int row, int col) { @@ -11416,7 +11416,7 @@ vec2 packedUVfrom3D(int texNumR, int texNumC, int texC = index - texR * texNumC; return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR); } -`,GM=` +`,UM=` float getChannel(vec4 frag, vec2 innerDims) { vec2 modCoord = mod(innerDims, 2.); return modCoord.x == 0. ? @@ -11431,7 +11431,7 @@ vec2 packedUVfrom3D(int texNumR, int texNumC, int getOutputCoords() { return 0; } - `}function HM(n,e,t){const s=[Math.ceil(e[0]/2),Math.ceil(e[1]/2)];return s[0]===1?t?` + `}function GM(n,e,t){const s=[Math.ceil(e[0]/2),Math.ceil(e[1]/2)];return s[0]===1?t?` int getOutputCoords() { return 2 * int(resultUV.x * ceil(float(outTexShape[1]) / 2.0)); } @@ -11460,7 +11460,7 @@ vec2 packedUVfrom3D(int texNumR, int texNumC, vec2(${s[0]}, ${s[1]})); return 2 * (resTexRC.x * ${s[1]} + resTexRC.y); } - `}function qM(n,e,t){return e[0]===1?t?` + `}function HM(n,e,t){return e[0]===1?t?` int getOutputCoords() { return int(resultUV.x * float(outTexShape[1])); } @@ -11488,7 +11488,7 @@ vec2 packedUVfrom3D(int texNumR, int texNumC, vec2(${e[0]}, ${e[1]})); return resTexRC.x * ${e[1]} + resTexRC.y; } - `}function jM(n,e,t){if(t)return` + `}function qM(n,e,t){if(t)return` ivec3 getOutputCoords() { ivec2 packedTexShape = ivec2(ceil(float(outTexShape[0]) / 2.0), ceil(float(outTexShape[1]) / 2.0)); int texelsInLogicalRow = int(ceil(float(outShape[2]) / 2.0)); @@ -11519,7 +11519,7 @@ vec2 packedUVfrom3D(int texNumR, int texNumC, return ivec3(b, r, c); } - `}function KM(n,e,t){if(t)return` + `}function jM(n,e,t){if(t)return` ivec3 getOutputCoords() { ivec2 resTexRC = ivec2(resultUV.yx * vec2(outTexShape[0], outTexShape[1])); @@ -11535,7 +11535,7 @@ vec2 packedUVfrom3D(int texNumR, int texNumC, ${s} return ivec3(r, c, d); } - `}function XM(n,e,t){if(t)return` + `}function KM(n,e,t){if(t)return` ivec4 getOutputCoords() { ivec2 packedTexShape = ivec2(ceil(float(outTexShape[0]) / 2.0), ceil(float(outTexShape[1]) / 2.0)); ivec2 resTexRC = ivec2(resultUV.yx * @@ -11576,7 +11576,7 @@ vec2 packedUVfrom3D(int texNumR, int texNumC, return ivec${n.length}(${l}); } - `}function YM(n,e,t){if(t)return` + `}function XM(n,e,t){if(t)return` ivec4 getOutputCoords() { ivec2 resTexRC = ivec2(resultUV.yx * vec2(outTexShape[0], outTexShape[1])); @@ -11592,7 +11592,7 @@ vec2 packedUVfrom3D(int texNumR, int texNumC, ${s} return ivec4(r, c, d, d2); } - `}function ZM(n,e){const t=ko(["r","c","d","d2","d3"],n);return` + `}function YM(n,e){const t=ko(["r","c","d","d2","d3"],n);return` ivec5 getOutputCoords() { ivec2 resTexRC = ivec2(resultUV.yx * vec2(${e[0]}, ${e[1]})); @@ -11604,7 +11604,7 @@ vec2 packedUVfrom3D(int texNumR, int texNumC, ivec5 outShape = ivec5(r, c, d, d2, d3); return outShape; } - `}function QM(n,e){const t=ko(["r","c","d","d2","d3","d4"],n);return` + `}function ZM(n,e){const t=ko(["r","c","d","d2","d3","d4"],n);return` ivec6 getOutputCoords() { ivec2 resTexRC = ivec2(resultUV.yx * vec2(${e[0]}, ${e[1]})); @@ -11615,7 +11615,7 @@ vec2 packedUVfrom3D(int texNumR, int texNumC, ivec6 result = ivec6(r, c, d, d2, d3, d4); return result; } - `}function JM(n,e,t){const s=[Math.ceil(e[0]/2),Math.ceil(e[1]/2)];if(_e(n,e))return t?` + `}function QM(n,e,t){const s=[Math.ceil(e[0]/2),Math.ceil(e[1]/2)];if(_e(n,e))return t?` ivec2 getOutputCoords() { ivec2 packedTexShape = ivec2(ceil(float(outTexShape[0]) / 2.0), ceil(float(outTexShape[1]) / 2.0)); return 2 * ivec2(resultUV.yx * vec2(packedTexShape[0], packedTexShape[1])); @@ -11648,7 +11648,7 @@ vec2 packedUVfrom3D(int texNumR, int texNumC, return ivec2(r, c); } - `}function eP(n,e,t){return _e(n,e)?t?` + `}function JM(n,e,t){return _e(n,e)?t?` ivec2 getOutputCoords() { return ivec2(resultUV.yx * vec2(outTexShape[0], outTexShape[1])); } @@ -11702,11 +11702,11 @@ vec2 packedUVfrom3D(int texNumR, int texNumC, int c = index - r * ${n[1]}; return ivec2(r, c); } - `}function vo(n){return`offset${n}`}function tP(n){const e=n.name,t="get"+e.charAt(0).toUpperCase()+e.slice(1),s=Pt();return` + `}function vo(n){return`offset${n}`}function eP(n){const e=n.name,t="get"+e.charAt(0).toUpperCase()+e.slice(1),s=Mt();return` vec4 ${t}() { return ${s.texture2D}(${e}, halfCR); } - `}function nP(n,e){const t=n.name,s="get"+t.charAt(0).toUpperCase()+t.slice(1);if(n.shapeInfo.isUniform)return`float ${s}() {return ${t};}`;const[o,r]=n.shapeInfo.texShape;if(o===1&&r===1)return` + `}function tP(n,e){const t=n.name,s="get"+t.charAt(0).toUpperCase()+t.slice(1);if(n.shapeInfo.isUniform)return`float ${s}() {return ${t};}`;const[o,r]=n.shapeInfo.texShape;if(o===1&&r===1)return` float ${s}() { return sampleTexture(${t}, halfCR); } @@ -11720,7 +11720,7 @@ vec2 packedUVfrom3D(int texNumR, int texNumC, vec2 uv = uvFromFlat(${a}, ${l}, ${i}); return sampleTexture(${t}, uv); } - `}function sP(n,e){const t=n.name,s="get"+t.charAt(0).toUpperCase()+t.slice(1),o=n.shapeInfo.texShape,r=Pt();if(e)return` + `}function nP(n,e){const t=n.name,s="get"+t.charAt(0).toUpperCase()+t.slice(1),o=n.shapeInfo.texShape,r=Mt();if(e)return` vec4 ${s}(int index) { ivec2 packedTexShape = ivec2(ceil(float(${t}TexShape[0]) / 2.0), ceil(float(${t}TexShape[1]) / 2.0)); vec2 uv = packedUVfrom1D( @@ -11733,7 +11733,7 @@ vec2 packedUVfrom3D(int texNumR, int texNumC, ${i[0]}, ${i[1]}, index); return ${r.texture2D}(${t}, uv); } - `}function oP(n,e){const t=n.name,s="get"+t.charAt(0).toUpperCase()+t.slice(1);if(n.shapeInfo.isUniform)return` + `}function sP(n,e){const t=n.name,s="get"+t.charAt(0).toUpperCase()+t.slice(1);if(n.shapeInfo.isUniform)return` float ${s}(int index) { ${hr(n)} } @@ -11771,7 +11771,7 @@ vec2 packedUVfrom3D(int texNumR, int texNumC, vec2 uv = uvFromFlat(${r}, ${i}, index + ${a}); return sampleTexture(${t}, uv); } - `}function rP(n,e){const t=n.shapeInfo.logicalShape,s=n.name,o="get"+s.charAt(0).toUpperCase()+s.slice(1),r=n.shapeInfo.texShape,i=r[0],a=r[1],l=Pt();if(r!=null&&_e(t,r))return e?` + `}function oP(n,e){const t=n.shapeInfo.logicalShape,s=n.name,o="get"+s.charAt(0).toUpperCase()+s.slice(1),r=n.shapeInfo.texShape,i=r[0],a=r[1],l=Mt();if(r!=null&&_e(t,r))return e?` vec4 ${o}(int row, int col) { vec2 uv = (vec2(col, row) + halfCR) / vec2(${s}TexShape[1], ${s}TexShape[0]); @@ -11795,7 +11795,7 @@ vec2 packedUVfrom3D(int texNumR, int texNumC, vec2 uv = packedUVfrom2D(${u}, ${c[0]}, ${c[1]}, row, col); return ${l.texture2D}(${s}, uv); } - `}function iP(n,e){const t=n.shapeInfo.logicalShape,s=n.name,o="get"+s.charAt(0).toUpperCase()+s.slice(1),r=n.shapeInfo.texShape;if(r!=null&&_e(t,r)){if(e)return` + `}function rP(n,e){const t=n.shapeInfo.logicalShape,s=n.name,o="get"+s.charAt(0).toUpperCase()+s.slice(1),r=n.shapeInfo.texShape;if(r!=null&&_e(t,r)){if(e)return` float ${o}(int row, int col) { vec2 uv = (vec2(col, row) + halfCR) / vec2(${s}TexShape[1], ${s}TexShape[0]); return sampleTexture(${s}, uv); @@ -11853,12 +11853,12 @@ vec2 packedUVfrom3D(int texNumR, int texNumC, vec2 uv = uvFromFlat(${c}, ${u}, index); return sampleTexture(${s}, uv); } -`}function aP(n,e){const t=n.shapeInfo.logicalShape,s=n.name,o="get"+s.charAt(0).toUpperCase()+s.slice(1),r=n.shapeInfo.texShape,i=[Math.ceil(r[0]/2),Math.ceil(r[1]/2)];if(t[0]===1){const d=t.slice(1),p=[1,2],f=dr(n,d),m=["b","row","col"];return` +`}function iP(n,e){const t=n.shapeInfo.logicalShape,s=n.name,o="get"+s.charAt(0).toUpperCase()+s.slice(1),r=n.shapeInfo.texShape,i=[Math.ceil(r[0]/2),Math.ceil(r[1]/2)];if(t[0]===1){const d=t.slice(1),p=[1,2],f=dr(n,d),m=["b","row","col"];return` ${Y1(f,e)} vec4 ${o}(int b, int row, int col) { return ${o}(${pr(m,p)}); } - `}const a=Pt();if(e)return` + `}const a=Mt();if(e)return` vec4 ${o}(int b, int row, int col) { ivec2 packedTexShape = ivec2(ceil(float(${s}TexShape[0]) / 2.0), ceil(float(${s}TexShape[1]) / 2.0)); int valuesPerRow = int(ceil(float(${s}Shape[2]) / 2.0)); @@ -11873,7 +11873,7 @@ vec2 packedUVfrom3D(int texNumR, int texNumC, ${l}, ${c}, ${h}, ${u}, b, row, col); return ${a.texture2D}(${s}, uv); } - `}function lP(n,e){const t=n.shapeInfo.logicalShape,s=n.name,o="get"+s.charAt(0).toUpperCase()+s.slice(1),r=t[1]*t[2],i=t[2],{newShape:a,keptDims:l}=ms(t),c=a;if(c.length=1?u="coords = 0;":u=a.map(b=>`coords.${h[b+c]} = 0;`).join(` + `}function dP(n,e){const t=n.name,s=t.charAt(0).toUpperCase()+t.slice(1),o="get"+s+"AtOutCoords",r=n.shapeInfo.logicalShape.length,i=e.logicalShape.length,a=X1(n.shapeInfo.logicalShape,e.logicalShape),l=Me(i),c=i-r;let u;const h=["x","y","z","w","u","v"];r===0?u="":i<2&&a.length>=1?u="coords = 0;":u=a.map(b=>`coords.${h[b+c]} = 0;`).join(` `);let d="";i<2&&r>0?d="coords":d=n.shapeInfo.logicalShape.map((b,w)=>`coords.${h[w+c]}`).join(", ");let p="return outputValue;";const m=G(n.shapeInfo.logicalShape)===1,x=G(e.logicalShape)===1;if(r===1&&!m&&!x)p=` return vec4(outputValue.xy, outputValue.xy); `;else if(m&&!x)i===1?p=` @@ -12132,7 +12132,7 @@ vec2 packedUVfrom3D(int texNumR, int texNumC, vec4 outputValue = get${s}(${d}); ${p} } - `}function fP(n,e){const t=n.name,s=t.charAt(0).toUpperCase()+t.slice(1),o="get"+s+"AtOutCoords",r=e.texShape,i=n.shapeInfo.texShape,a=n.shapeInfo.logicalShape.length,l=e.logicalShape.length;if(!n.shapeInfo.isUniform&&a===l&&n.shapeInfo.flatOffset==null&&_e(i,r))return` + `}function pP(n,e){const t=n.name,s=t.charAt(0).toUpperCase()+t.slice(1),o="get"+s+"AtOutCoords",r=e.texShape,i=n.shapeInfo.texShape,a=n.shapeInfo.logicalShape.length,l=e.logicalShape.length;if(!n.shapeInfo.isUniform&&a===l&&n.shapeInfo.flatOffset==null&&_e(i,r))return` float ${o}() { return sampleTexture(${t}, resultUV); } @@ -12143,7 +12143,7 @@ vec2 packedUVfrom3D(int texNumR, int texNumC, ${d} return get${s}(${f}); } - `}function Me(n){if(n<=1)return"int";if(n===2)return"ivec2";if(n===3)return"ivec3";if(n===4)return"ivec4";if(n===5)return"ivec5";if(n===6)return"ivec6";throw Error(`GPU for rank ${n} is not yet supported`)}function bp(n,e,t){const{newShape:s,keptDims:o}=ms(e),r=e.length,i=n&&r===3&&e[0]===1,a=i?e.slice(1):s,l=!n&&r>1&&!_e(e,t)&&s.lengthn[t]).join(", ")}/** + `}function Me(n){if(n<=1)return"int";if(n===2)return"ivec2";if(n===3)return"ivec3";if(n===4)return"ivec4";if(n===5)return"ivec5";if(n===6)return"ivec6";throw Error(`GPU for rank ${n} is not yet supported`)}function gp(n,e,t){const{newShape:s,keptDims:o}=ms(e),r=e.length,i=n&&r===3&&e[0]===1,a=i?e.slice(1):s,l=!n&&r>1&&!_e(e,t)&&s.lengthn[t]).join(", ")}/** * @license * Copyright 2017 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -12158,7 +12158,7 @@ vec2 packedUVfrom3D(int texNumR, int texNumC, * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function mP(n,e,t,s){const o=t.map((u,h)=>{const d={logicalShape:u.shape,texShape:u.isUniform?null:u.texData.texShape,isUniform:u.isUniform,isPacked:u.isUniform?!1:u.texData.isPacked,flatOffset:null};return u.texData!=null&&u.texData.slice!=null&&u.texData.slice.flatOffset>0&&(d.flatOffset=u.texData.slice.flatOffset),{name:e.variableNames[h],shapeInfo:d}}),r=o.map(u=>u.shapeInfo),i={logicalShape:s.shape,texShape:s.texData.texShape,isUniform:!1,isPacked:s.texData.isPacked,flatOffset:null},a=FM(o,i,e),l=lM(n.gl,a),c=n.createProgram(l);return V().get("ENGINE_COMPILE_ONLY")?{program:e,fragmentShader:l,source:a,webGLProgram:c,inShapeInfos:r,outShapeInfo:i,variablesLocations:null,customUniformLocations:null,infLoc:null,nanLoc:null,outShapeLocation:null,outShapeStridesLocation:null,outTexShapeLocation:null}:(n.buildVao(c),Object.assign({program:e,fragmentShader:l,source:a,webGLProgram:c,inShapeInfos:r,outShapeInfo:i},Q1(n,e,c)))}function Q1(n,e,t){const s=[],o=[];let r,i,a,l=null,c=null;c=n.getUniformLocation(t,"NAN",!1),V().getNumber("WEBGL_VERSION")===1&&(l=n.getUniformLocation(t,"INFINITY",!1));const u=!1;for(const h of e.variableNames){const d={name:h,uniform:n.getUniformLocation(t,h,u),offset:n.getUniformLocation(t,`offset${h}`,u)};e.enableShapeUniforms&&(d.shape=n.getUniformLocation(t,`${h}Shape`,u),d.texShape=n.getUniformLocation(t,`${h}TexShape`,u)),s.push(d)}if(e.enableShapeUniforms&&(r=n.getUniformLocation(t,"outShape",u),a=n.getUniformLocation(t,"outShapeStrides",u),i=n.getUniformLocation(t,"outTexShape",u)),e.customUniforms)for(const h of e.customUniforms)o.push(n.getUniformLocation(t,h.name,u));return{variablesLocations:s,customUniformLocations:o,infLoc:l,nanLoc:c,outShapeLocation:r,outShapeStridesLocation:a,outTexShapeLocation:i}}function J1(n,e){if(n.length!==e.length)throw Error(`Binary was compiled with ${n.length} inputs, but was executed with ${e.length} inputs`);n.forEach((t,s)=>{const o=t.logicalShape,r=e[s],i=r.shape;if(!_e(o,i))throw Error(`Binary was compiled with different shapes than the current args. Shapes ${o} and ${i} must match`);if(t.isUniform&&r.isUniform)return;const a=t.texShape,l=r.isUniform?null:r.texData.texShape;if(!_e(a,l))throw Error(`Binary was compiled with different texture shapes than the current args. Shape ${a} and ${l} must match`)})}function gP(n,e,t,s,o){e.program.enableShapeUniforms||(J1(e.inShapeInfos,t),J1([e.outShapeInfo],[s]));const r=s.texData.texture,i=s.texData.texShape;s.texData.isPacked?n.setOutputPackedMatrixTexture(r.texture,i[0],i[1]):n.setOutputMatrixTexture(r.texture,i[0],i[1]),n.setProgram(e.webGLProgram),n.bindVertexArray(e.webGLProgram.vao),V().getNumber("WEBGL_VERSION")===1&&e.infLoc!==null&&n.gl.uniform1f(e.infLoc,1/0),e.nanLoc!==null&&n.gl.uniform1f(e.nanLoc,NaN);for(let l=0;l{const a=i.texData!=null&&i.texData.slice!=null&&i.texData.slice.flatOffset>0;if(n.enableShapeUniforms&&!i.isUniform){const l=i.texData.texShape,{useSqueezeShape:c,uniformShape:u,keptDims:h}=bp(n.packedInputs,i.shape,l);let d="",p="",f="";if(u.length===1&&n.packedInputs){const C=[Math.ceil(l[0]/2),Math.ceil(l[1]/2)];d=`${C[0]>1}_${C[1]>1}`}else if(u.length===2&&!n.packedInputs)p=`${u[0]>1}_${u[1]>1}`;else if(u.length>2&&!n.packedInputs){const C=ue(u);f=`${C[0]===l[1]}_${C[C.length-1]===l[1]}`}const m=i.shape.length,g=u.length===2&&_e(i.shape,l),x=G(i.shape)===1,b=qo(i.shape,t.shape),w=!n.packedInputs&&m===t.shape.length&&_e(l,t.texData.texShape),y=n.packedInputs||u.length>2?"":`${l[0]>1}_${l[1]>1}`;s+=`${m}_${w}_${c?h:""}_${u.length}_${x}_${b}_${g}_${d}_${p}_${f}_${y}_${a}`}else{const l=i.isUniform?"uniform":i.texData.texShape;s+=`${i.shape}_${l}_${a}`}});const o=n.userCode;let r=n.constructor.name;return r+="_"+s+"_"+o+`${V().getNumber("WEBGL_VERSION")}`,r}function Ft(n){return V().getBool("WEBGL_USE_SHAPES_UNIFORMS")&&n<=4}/** + */function fP(n,e,t,s){const o=t.map((u,h)=>{const d={logicalShape:u.shape,texShape:u.isUniform?null:u.texData.texShape,isUniform:u.isUniform,isPacked:u.isUniform?!1:u.texData.isPacked,flatOffset:null};return u.texData!=null&&u.texData.slice!=null&&u.texData.slice.flatOffset>0&&(d.flatOffset=u.texData.slice.flatOffset),{name:e.variableNames[h],shapeInfo:d}}),r=o.map(u=>u.shapeInfo),i={logicalShape:s.shape,texShape:s.texData.texShape,isUniform:!1,isPacked:s.texData.isPacked,flatOffset:null},a=DM(o,i,e),l=aM(n.gl,a),c=n.createProgram(l);return V().get("ENGINE_COMPILE_ONLY")?{program:e,fragmentShader:l,source:a,webGLProgram:c,inShapeInfos:r,outShapeInfo:i,variablesLocations:null,customUniformLocations:null,infLoc:null,nanLoc:null,outShapeLocation:null,outShapeStridesLocation:null,outTexShapeLocation:null}:(n.buildVao(c),Object.assign({program:e,fragmentShader:l,source:a,webGLProgram:c,inShapeInfos:r,outShapeInfo:i},Q1(n,e,c)))}function Q1(n,e,t){const s=[],o=[];let r,i,a,l=null,c=null;c=n.getUniformLocation(t,"NAN",!1),V().getNumber("WEBGL_VERSION")===1&&(l=n.getUniformLocation(t,"INFINITY",!1));const u=!1;for(const h of e.variableNames){const d={name:h,uniform:n.getUniformLocation(t,h,u),offset:n.getUniformLocation(t,`offset${h}`,u)};e.enableShapeUniforms&&(d.shape=n.getUniformLocation(t,`${h}Shape`,u),d.texShape=n.getUniformLocation(t,`${h}TexShape`,u)),s.push(d)}if(e.enableShapeUniforms&&(r=n.getUniformLocation(t,"outShape",u),a=n.getUniformLocation(t,"outShapeStrides",u),i=n.getUniformLocation(t,"outTexShape",u)),e.customUniforms)for(const h of e.customUniforms)o.push(n.getUniformLocation(t,h.name,u));return{variablesLocations:s,customUniformLocations:o,infLoc:l,nanLoc:c,outShapeLocation:r,outShapeStridesLocation:a,outTexShapeLocation:i}}function J1(n,e){if(n.length!==e.length)throw Error(`Binary was compiled with ${n.length} inputs, but was executed with ${e.length} inputs`);n.forEach((t,s)=>{const o=t.logicalShape,r=e[s],i=r.shape;if(!_e(o,i))throw Error(`Binary was compiled with different shapes than the current args. Shapes ${o} and ${i} must match`);if(t.isUniform&&r.isUniform)return;const a=t.texShape,l=r.isUniform?null:r.texData.texShape;if(!_e(a,l))throw Error(`Binary was compiled with different texture shapes than the current args. Shape ${a} and ${l} must match`)})}function mP(n,e,t,s,o){e.program.enableShapeUniforms||(J1(e.inShapeInfos,t),J1([e.outShapeInfo],[s]));const r=s.texData.texture,i=s.texData.texShape;s.texData.isPacked?n.setOutputPackedMatrixTexture(r.texture,i[0],i[1]):n.setOutputMatrixTexture(r.texture,i[0],i[1]),n.setProgram(e.webGLProgram),n.bindVertexArray(e.webGLProgram.vao),V().getNumber("WEBGL_VERSION")===1&&e.infLoc!==null&&n.gl.uniform1f(e.infLoc,1/0),e.nanLoc!==null&&n.gl.uniform1f(e.nanLoc,NaN);for(let l=0;l{const a=i.texData!=null&&i.texData.slice!=null&&i.texData.slice.flatOffset>0;if(n.enableShapeUniforms&&!i.isUniform){const l=i.texData.texShape,{useSqueezeShape:c,uniformShape:u,keptDims:h}=gp(n.packedInputs,i.shape,l);let d="",p="",f="";if(u.length===1&&n.packedInputs){const C=[Math.ceil(l[0]/2),Math.ceil(l[1]/2)];d=`${C[0]>1}_${C[1]>1}`}else if(u.length===2&&!n.packedInputs)p=`${u[0]>1}_${u[1]>1}`;else if(u.length>2&&!n.packedInputs){const C=ue(u);f=`${C[0]===l[1]}_${C[C.length-1]===l[1]}`}const m=i.shape.length,g=u.length===2&&_e(i.shape,l),x=G(i.shape)===1,b=qo(i.shape,t.shape),w=!n.packedInputs&&m===t.shape.length&&_e(l,t.texData.texShape),y=n.packedInputs||u.length>2?"":`${l[0]>1}_${l[1]>1}`;s+=`${m}_${w}_${c?h:""}_${u.length}_${x}_${b}_${g}_${d}_${p}_${f}_${y}_${a}`}else{const l=i.isUniform?"uniform":i.texData.texShape;s+=`${i.shape}_${l}_${a}`}});const o=n.userCode;let r=n.constructor.name;return r+="_"+s+"_"+o+`${V().getNumber("WEBGL_VERSION")}`,r}function Dt(n){return V().getBool("WEBGL_USE_SHAPES_UNIFORMS")&&n<=4}/** * @license * Copyright 2019 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -12173,7 +12173,7 @@ vec2 packedUVfrom3D(int texNumR, int texNumC, * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */class bP{constructor(e){this.variableNames=["A"],this.packedInputs=!1,this.packedOutput=!0,this.outPackingScheme=Zi.DENSE,this.customUniforms=[{name:"texShape",type:"ivec2"}];const t=Pt();this.outputShape=e,this.enableShapeUniforms=Ft(this.outputShape.length),this.userCode=` + */class xP{constructor(e){this.variableNames=["A"],this.packedInputs=!1,this.packedOutput=!0,this.outPackingScheme=Zi.DENSE,this.customUniforms=[{name:"texShape",type:"ivec2"}];const t=Mt();this.outputShape=e,this.enableShapeUniforms=Dt(this.outputShape.length),this.userCode=` ivec3 outCoordsFromFlatIndex(int index) { ${this.enableShapeUniforms?bc(["r","c","d"],e):ko(["r","c","d"],e)} return ivec3(r, c, d); @@ -12208,7 +12208,7 @@ vec2 packedUVfrom3D(int texNumR, int texNumC, * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */class yP{constructor(e){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outPackingScheme=Zi.DENSE,this.customUniforms=[{name:"texShape",type:"ivec2"}];const t=Pt();this.outputShape=e,this.enableShapeUniforms=Ft(this.outputShape.length),this.userCode=` + */class bP{constructor(e){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outPackingScheme=Zi.DENSE,this.customUniforms=[{name:"texShape",type:"ivec2"}];const t=Mt();this.outputShape=e,this.enableShapeUniforms=Dt(this.outputShape.length),this.userCode=` ivec3 outCoordsFromFlatIndex(int index) { ${this.enableShapeUniforms?bc(["r","c","d"],e):ko(["r","c","d"],e)} return ivec3(r, c, d); @@ -12243,7 +12243,7 @@ vec2 packedUVfrom3D(int texNumR, int texNumC, * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */class wP{constructor(e){this.variableNames=["A"],this.outTexUsage=rn.DOWNLOAD;const t=Pt();this.outputShape=e,this.userCode=` + */class yP{constructor(e){this.variableNames=["A"],this.outTexUsage=rn.DOWNLOAD;const t=Mt();this.outputShape=e,this.userCode=` ${K1} void main() { @@ -12265,7 +12265,7 @@ vec2 packedUVfrom3D(int texNumR, int texNumC, * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */class CP{constructor(e){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!1,this.outTexUsage=rn.DOWNLOAD;const t=Pt();this.outputShape=e,this.userCode=` + */class wP{constructor(e){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!1,this.outTexUsage=rn.DOWNLOAD;const t=Mt();this.outputShape=e,this.userCode=` ${K1} void main() { @@ -12288,11 +12288,11 @@ vec2 packedUVfrom3D(int texNumR, int texNumC, * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const IP={R:0,G:1,B:2,A:3};class ey{constructor(e,t=!1,s="RGBA"){this.variableNames=["A"],this.customUniforms=[{name:"texShape",type:"ivec2"}];const o=Pt();this.outputShape=e,this.enableShapeUniforms=Ft(this.outputShape.length);let r="result";t&&(r="floor(result * 255. + 0.5)");let i="";for(let a=0;an.bindTexture(a,i)),ie(n,()=>n.texParameteri(a,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE)),ie(n,()=>n.texParameteri(a,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE)),ie(n,()=>n.texParameteri(a,n.TEXTURE_MIN_FILTER,n.NEAREST)),ie(n,()=>n.texParameteri(a,n.TEXTURE_MAG_FILTER,n.NEAREST)),V().getNumber("WEBGL_VERSION")===1?ie(n,()=>n.texImage2D(a,0,s,e,t,0,o,r,null)):ie(n,()=>n.texStorage2D(a,1,s,e,t)),ie(n,()=>n.bindTexture(n.TEXTURE_2D,null)),{texture:i,texShape:[t,e]}}function ty(n){return n.internalFormatFloat}function TP(n,e,t,s){const[o,r]=Qi(e,t);return ea(n,o,r,ty(s),s.textureFormatFloat,n.FLOAT)}function ny(n){return n.internalFormatHalfFloat}function NP(n,e,t,s){const[o,r]=Qi(e,t);return ea(n,o,r,ny(s),s.textureFormatFloat,s.textureTypeHalfFloat)}function sy(n){return n.downloadTextureFormat}function EP(n,e,t,s){const[o,r]=Qi(e,t);return ea(n,o,r,sy(s),n.RGBA,n.UNSIGNED_BYTE)}function oy(n){return n.internalFormatPackedFloat}function RP(n,e,t,s){const[o,r]=ar(e,t);return ea(n,o,r,oy(s),n.RGBA,n.FLOAT)}function ry(n){return n.internalFormatPackedHalfFloat}function AP(n,e,t,s){const[o,r]=ar(e,t);return ea(n,o,r,ry(s),n.RGBA,s.textureTypeHalfFloat)}function DP(n,e,t){return ie(n,()=>n.bindBuffer(n.ARRAY_BUFFER,t)),H1(n,e,"clipSpacePos",t,3,20,0)&&H1(n,e,"uv",t,2,20,12)}function FP(n,e,t,s,o,r){ie(n,()=>n.bindTexture(n.TEXTURE_2D,e));let i,a,l;o instanceof Uint8Array?(i=new Uint8Array(t*s*4),a=n.UNSIGNED_BYTE,l=n.RGBA):(i=new Float32Array(t*s*4),a=n.FLOAT,l=r.internalFormatPackedFloat),i.set(o),V().getNumber("WEBGL_VERSION")===2?ie(n,()=>n.texSubImage2D(n.TEXTURE_2D,0,0,0,t,s,n.RGBA,a,i)):ie(n,()=>n.texImage2D(n.TEXTURE_2D,0,l,t,s,0,n.RGBA,a,i)),ie(n,()=>n.bindTexture(n.TEXTURE_2D,null))}function _P(n,e,t){ie(n,()=>n.bindTexture(n.TEXTURE_2D,e)),t.data instanceof Uint8Array?V().getNumber("WEBGL_VERSION")===2?ie(n,()=>n.texSubImage2D(n.TEXTURE_2D,0,0,0,t.width,t.height,n.RGBA,n.UNSIGNED_BYTE,t.data)):ie(n,()=>n.texImage2D(n.TEXTURE_2D,0,n.RGBA,t.width,t.height,0,n.RGBA,n.UNSIGNED_BYTE,t.data)):V().getNumber("WEBGL_VERSION")===2?ie(n,()=>n.texSubImage2D(n.TEXTURE_2D,0,0,0,n.RGBA,n.UNSIGNED_BYTE,t)):ie(n,()=>n.texImage2D(n.TEXTURE_2D,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,t)),ie(n,()=>n.bindTexture(n.TEXTURE_2D,null))}function OP(n,e,t,s){const o=n.createBuffer();ie(n,()=>n.bindBuffer(n.PIXEL_PACK_BUFFER,o));const a=4*4*e*t;return ie(n,()=>n.bufferData(n.PIXEL_PACK_BUFFER,a,n.STREAM_READ)),ie(n,()=>n.readPixels(0,0,t,e,n.RGBA,n.FLOAT,0)),ie(n,()=>n.bindBuffer(n.PIXEL_PACK_BUFFER,null)),o}function LP(n,e,t){const s=n,o=new Float32Array(t);return s.bindBuffer(s.PIXEL_PACK_BUFFER,e),s.getBufferSubData(s.PIXEL_PACK_BUFFER,0,o),s.bindBuffer(s.PIXEL_PACK_BUFFER,null),o}function MP(n,e,t,s){const[o,r]=Qi(e,t),i=4,a=new Uint8Array(eM(e*t,i));return ie(n,()=>n.readPixels(0,0,o,r,s.downloadTextureFormat,n.UNSIGNED_BYTE,a)),new Float32Array(a.buffer)}function PP(n,e,t,s,o,r,i,a){const l=n,c=new Float32Array(tM(r,i));return l.bindBuffer(l.PIXEL_PACK_BUFFER,e),l.getBufferSubData(l.PIXEL_PACK_BUFFER,0,c),l.bindBuffer(l.PIXEL_PACK_BUFFER,null),c}function BP(n,e,t){const s=new Float32Array(e*t*4);return ie(n,()=>n.readPixels(0,0,t,e,n.RGBA,n.FLOAT,s)),s}/** + }`;return iM(n,t)}function kP(n){const e=new Float32Array([-1,1,0,0,1,-1,-1,0,0,0,1,1,0,1,1,1,-1,0,1,0]);return hM(n,e)}function vP(n){const e=new Uint16Array([0,1,2,2,1,3]);return dM(n,e)}function ea(n,e,t,s,o,r){fM(e,t);const i=pM(n),a=n.TEXTURE_2D;return ie(n,()=>n.bindTexture(a,i)),ie(n,()=>n.texParameteri(a,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE)),ie(n,()=>n.texParameteri(a,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE)),ie(n,()=>n.texParameteri(a,n.TEXTURE_MIN_FILTER,n.NEAREST)),ie(n,()=>n.texParameteri(a,n.TEXTURE_MAG_FILTER,n.NEAREST)),V().getNumber("WEBGL_VERSION")===1?ie(n,()=>n.texImage2D(a,0,s,e,t,0,o,r,null)):ie(n,()=>n.texStorage2D(a,1,s,e,t)),ie(n,()=>n.bindTexture(n.TEXTURE_2D,null)),{texture:i,texShape:[t,e]}}function ty(n){return n.internalFormatFloat}function SP(n,e,t,s){const[o,r]=Qi(e,t);return ea(n,o,r,ty(s),s.textureFormatFloat,n.FLOAT)}function ny(n){return n.internalFormatHalfFloat}function TP(n,e,t,s){const[o,r]=Qi(e,t);return ea(n,o,r,ny(s),s.textureFormatFloat,s.textureTypeHalfFloat)}function sy(n){return n.downloadTextureFormat}function NP(n,e,t,s){const[o,r]=Qi(e,t);return ea(n,o,r,sy(s),n.RGBA,n.UNSIGNED_BYTE)}function oy(n){return n.internalFormatPackedFloat}function EP(n,e,t,s){const[o,r]=ar(e,t);return ea(n,o,r,oy(s),n.RGBA,n.FLOAT)}function ry(n){return n.internalFormatPackedHalfFloat}function RP(n,e,t,s){const[o,r]=ar(e,t);return ea(n,o,r,ry(s),n.RGBA,s.textureTypeHalfFloat)}function AP(n,e,t){return ie(n,()=>n.bindBuffer(n.ARRAY_BUFFER,t)),H1(n,e,"clipSpacePos",t,3,20,0)&&H1(n,e,"uv",t,2,20,12)}function DP(n,e,t,s,o,r){ie(n,()=>n.bindTexture(n.TEXTURE_2D,e));let i,a,l;o instanceof Uint8Array?(i=new Uint8Array(t*s*4),a=n.UNSIGNED_BYTE,l=n.RGBA):(i=new Float32Array(t*s*4),a=n.FLOAT,l=r.internalFormatPackedFloat),i.set(o),V().getNumber("WEBGL_VERSION")===2?ie(n,()=>n.texSubImage2D(n.TEXTURE_2D,0,0,0,t,s,n.RGBA,a,i)):ie(n,()=>n.texImage2D(n.TEXTURE_2D,0,l,t,s,0,n.RGBA,a,i)),ie(n,()=>n.bindTexture(n.TEXTURE_2D,null))}function FP(n,e,t){ie(n,()=>n.bindTexture(n.TEXTURE_2D,e)),t.data instanceof Uint8Array?V().getNumber("WEBGL_VERSION")===2?ie(n,()=>n.texSubImage2D(n.TEXTURE_2D,0,0,0,t.width,t.height,n.RGBA,n.UNSIGNED_BYTE,t.data)):ie(n,()=>n.texImage2D(n.TEXTURE_2D,0,n.RGBA,t.width,t.height,0,n.RGBA,n.UNSIGNED_BYTE,t.data)):V().getNumber("WEBGL_VERSION")===2?ie(n,()=>n.texSubImage2D(n.TEXTURE_2D,0,0,0,n.RGBA,n.UNSIGNED_BYTE,t)):ie(n,()=>n.texImage2D(n.TEXTURE_2D,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,t)),ie(n,()=>n.bindTexture(n.TEXTURE_2D,null))}function _P(n,e,t,s){const o=n.createBuffer();ie(n,()=>n.bindBuffer(n.PIXEL_PACK_BUFFER,o));const a=4*4*e*t;return ie(n,()=>n.bufferData(n.PIXEL_PACK_BUFFER,a,n.STREAM_READ)),ie(n,()=>n.readPixels(0,0,t,e,n.RGBA,n.FLOAT,0)),ie(n,()=>n.bindBuffer(n.PIXEL_PACK_BUFFER,null)),o}function OP(n,e,t){const s=n,o=new Float32Array(t);return s.bindBuffer(s.PIXEL_PACK_BUFFER,e),s.getBufferSubData(s.PIXEL_PACK_BUFFER,0,o),s.bindBuffer(s.PIXEL_PACK_BUFFER,null),o}function LP(n,e,t,s){const[o,r]=Qi(e,t),i=4,a=new Uint8Array(JL(e*t,i));return ie(n,()=>n.readPixels(0,0,o,r,s.downloadTextureFormat,n.UNSIGNED_BYTE,a)),new Float32Array(a.buffer)}function MP(n,e,t,s,o,r,i,a){const l=n,c=new Float32Array(eM(r,i));return l.bindBuffer(l.PIXEL_PACK_BUFFER,e),l.getBufferSubData(l.PIXEL_PACK_BUFFER,0,c),l.bindBuffer(l.PIXEL_PACK_BUFFER,null),c}function PP(n,e,t){const s=new Float32Array(e*t*4);return ie(n,()=>n.readPixels(0,0,t,e,n.RGBA,n.FLOAT,s)),s}/** * @license * Copyright 2017 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -12409,7 +12409,7 @@ vec2 packedUVfrom3D(int texNumR, int texNumC, * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */class yp{constructor(e){this.outputTexture=null,this.program=null,this.disposed=!1,this.itemsToPoll=[];const t=V().getNumber("WEBGL_VERSION");if(e!=null?(this.gl=e,ZL(t,e)):this.gl=Ln(t),e=this.gl,V().getNumber("WEBGL_VERSION")===2){const r=e;this.createVertexArray=()=>ie(r,()=>r.createVertexArray()),this.bindVertexArray=i=>ie(r,()=>r.bindVertexArray(i)),this.deleteVertexArray=i=>ie(r,()=>r.deleteVertexArray(i)),this.getVertexArray=()=>ie(r,()=>r.getParameter(r.VERTEX_ARRAY_BINDING))}else if(e!=null){const r=e.getExtension("OES_vertex_array_object");if(r==null)throw new Error("All WebGL1 implementations are expected to offer OES_vertex_array_object.");this.createVertexArray=()=>ie(e,()=>r.createVertexArrayOES()),this.bindVertexArray=i=>ie(e,()=>r.bindVertexArrayOES(i)),this.deleteVertexArray=i=>ie(e,()=>r.deleteVertexArrayOES(i)),this.getVertexArray=()=>ie(e,()=>e.getParameter(r.VERTEX_ARRAY_BINDING_OES))}let s="WEBGL_color_buffer_float";const o="EXT_color_buffer_half_float";if(this.parallelCompilationExtension=this.gl.getExtension("KHR_parallel_shader_compile"),V().getNumber("WEBGL_VERSION")===1){const r="OES_texture_float",i="OES_texture_half_float";if(this.textureFloatExtension=pc(this.gl,r),Cn(this.gl,i))this.textureHalfFloatExtension=pc(this.gl,i);else if(V().get("WEBGL_FORCE_F16_TEXTURES"))throw new Error("GL context does not support half float textures, yet the environment flag WEBGL_FORCE_F16_TEXTURES is set to true.");if(this.colorBufferFloatExtension=this.gl.getExtension(s),Cn(this.gl,o))this.colorBufferHalfFloatExtension=pc(this.gl,o);else if(V().get("WEBGL_FORCE_F16_TEXTURES"))throw new Error("GL context does not support color renderable half floats, yet the environment flag WEBGL_FORCE_F16_TEXTURES is set to true.")}else if(s="EXT_color_buffer_float",Cn(this.gl,s))this.colorBufferFloatExtension=this.gl.getExtension(s);else if(Cn(this.gl,o))this.colorBufferHalfFloatExtension=this.gl.getExtension(o);else throw new Error("GL context does not support color renderable floats");this.vertexBuffer=vP(this.gl),this.indexBuffer=SP(this.gl),this.framebuffer=gM(this.gl),this.textureConfig=up(this.gl,this.textureHalfFloatExtension)}get debug(){return V().getBool("DEBUG")}dispose(){if(this.disposed)return;this.program!=null&&console.warn("Disposing a GPGPUContext that still has a bound WebGLProgram. This is probably a resource leak, delete the program with GPGPUContext.deleteProgram before disposing."),this.outputTexture!=null&&console.warn("Disposing a GPGPUContext that still has a bound output matrix texture. This is probably a resource leak, delete the output matrix texture with GPGPUContext.deleteMatrixTexture before disposing.");const e=this.gl;ie(e,()=>e.finish()),ie(e,()=>e.bindFramebuffer(e.FRAMEBUFFER,null)),ie(e,()=>e.deleteFramebuffer(this.framebuffer)),ie(e,()=>e.bindBuffer(e.ARRAY_BUFFER,null)),ie(e,()=>e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,null)),ie(e,()=>e.deleteBuffer(this.indexBuffer)),this.disposed=!0}createFloat32MatrixTexture(e,t){return this.throwIfDisposed(),TP(this.gl,e,t,this.textureConfig)}createFloat16MatrixTexture(e,t){return this.throwIfDisposed(),NP(this.gl,e,t,this.textureConfig)}createUnsignedBytesMatrixTexture(e,t){return this.throwIfDisposed(),EP(this.gl,e,t,this.textureConfig)}uploadPixelDataToTexture(e,t){this.throwIfDisposed(),_P(this.gl,e,t)}uploadDenseMatrixToTexture(e,t,s,o){this.throwIfDisposed(),FP(this.gl,e,t,s,o,this.textureConfig)}createFloat16PackedMatrixTexture(e,t){return this.throwIfDisposed(),AP(this.gl,e,t,this.textureConfig)}createPackedMatrixTexture(e,t){return this.throwIfDisposed(),RP(this.gl,e,t,this.textureConfig)}deleteMatrixTexture(e){this.throwIfDisposed(),this.outputTexture===e&&(q1(this.gl,this.framebuffer),this.outputTexture=null),ie(this.gl,()=>this.gl.deleteTexture(e))}downloadByteEncodedFloatMatrixFromOutputTexture(e,t,s){return this.downloadMatrixDriver(e,()=>MP(this.gl,t,s,this.textureConfig))}downloadPackedMatrixFromBuffer(e,t,s,o,r,i){return PP(this.gl,e,t,s,o,r,i,this.textureConfig)}downloadFloat32MatrixFromBuffer(e,t){return LP(this.gl,e,t)}createBufferFromTexture(e,t,s){this.bindTextureToFrameBuffer(e);const o=OP(this.gl,t,s,this.textureConfig);return this.unbindTextureToFrameBuffer(),o}createAndWaitForFence(){const e=this.createFence(this.gl);return this.pollFence(e)}createFence(e){let t,s;if(V().getBool("WEBGL_FENCE_API_ENABLED")){const o=e,r=o.fenceSync(o.SYNC_GPU_COMMANDS_COMPLETE,0);e.flush(),s=()=>{const i=o.clientWaitSync(r,0,0);return i===o.ALREADY_SIGNALED||i===o.CONDITION_SATISFIED},t=r}else V().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")>0?(t=this.beginQuery(),this.endQuery(),s=()=>this.isQueryAvailable(t,V().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION"))):s=()=>!0;return{query:t,isFencePassed:s}}downloadMatrixFromPackedTexture(e,t,s){return this.downloadMatrixDriver(e,()=>BP(this.gl,t,s))}createProgram(e){this.throwIfDisposed();const t=this.gl;this.vertexShader==null&&(this.vertexShader=kP(t));const s=uM(t);ie(t,()=>t.attachShader(s,this.vertexShader)),ie(t,()=>t.attachShader(s,e)),hM(t,s);const o=Object.assign(s,{vao:this.createVertexArray()});return this.debug&&hp(t,o),o}buildVao(e){this.setProgram(e),this.bindVertexArray(e.vao);const t=this.gl;ie(t,()=>t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,this.indexBuffer)),DP(t,e,this.vertexBuffer)}deleteProgram(e){this.throwIfDisposed(),e===this.program&&(this.program=null),e!=null&&(ie(this.gl,()=>this.gl.deleteProgram(e)),this.deleteVertexArray(e.vao))}setProgram(e){this.throwIfDisposed(),this.program=e,this.program!=null&&this.debug&&hp(this.gl,this.program),ie(this.gl,()=>this.gl.useProgram(e))}getUniformLocation(e,t,s=!0){return this.throwIfDisposed(),s?bM(this.gl,e,t):yM(this.gl,e,t)}getAttributeLocation(e,t){return this.throwIfDisposed(),ie(this.gl,()=>this.gl.getAttribLocation(e,t))}getUniformLocationNoThrow(e,t){return this.throwIfDisposed(),this.gl.getUniformLocation(e,t)}setInputMatrixTexture(e,t,s){this.throwIfDisposed(),this.throwIfNoProgram(),wM(this.gl,e,t,s)}setOutputMatrixTexture(e,t,s){this.setOutputMatrixTextureDriver(e,s,t)}setOutputPackedMatrixTexture(e,t,s){this.throwIfDisposed();const[o,r]=ar(t,s);this.setOutputMatrixTextureDriver(e,o,r)}setOutputMatrixWriteRegion(e,t,s,o){this.setOutputMatrixWriteRegionDriver(s,e,o,t)}setOutputPackedMatrixWriteRegion(e,t,s,o){throw new Error("setOutputPackedMatrixWriteRegion not implemented.")}debugValidate(){this.program!=null&&hp(this.gl,this.program),fc(this.gl)}executeProgram(){this.throwIfDisposed(),this.throwIfNoProgram();const e=this.gl;if(this.debug){const t=this.getVertexArray();console.assert(t===this.program.vao,"VAO changed between setProgram and executeProgram!"),this.debugValidate()}ie(e,()=>e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0))}blockUntilAllProgramsCompleted(){this.throwIfDisposed(),ie(this.gl,()=>this.gl.finish())}getQueryTimerExtension(){return this.disjointQueryTimerExtension==null&&(this.disjointQueryTimerExtension=pc(this.gl,V().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")===2?"EXT_disjoint_timer_query_webgl2":"EXT_disjoint_timer_query")),this.disjointQueryTimerExtension}getQueryTimerExtensionWebGL2(){return this.getQueryTimerExtension()}getQueryTimerExtensionWebGL1(){return this.getQueryTimerExtension()}beginQuery(){if(V().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")===2){const s=this.gl,o=this.getQueryTimerExtensionWebGL2(),r=s.createQuery();return s.beginQuery(o.TIME_ELAPSED_EXT,r),r}const e=this.getQueryTimerExtensionWebGL1(),t=e.createQueryEXT();return e.beginQueryEXT(e.TIME_ELAPSED_EXT,t),t}endQuery(){if(V().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")===2){const t=this.gl,s=this.getQueryTimerExtensionWebGL2();t.endQuery(s.TIME_ELAPSED_EXT);return}const e=this.getQueryTimerExtensionWebGL1();e.endQueryEXT(e.TIME_ELAPSED_EXT)}async waitForQueryAndGetTime(e){return await Pp(()=>this.disposed||this.isQueryAvailable(e,V().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION"))),this.getQueryTime(e,V().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION"))}getQueryTime(e,t){if(t===0)return null;if(t===2){const s=this.gl;return s.getQueryParameter(e,s.QUERY_RESULT)/1e6}else{const s=this.getQueryTimerExtensionWebGL1();return s.getQueryObjectEXT(e,s.QUERY_RESULT_EXT)/1e6}}isQueryAvailable(e,t){if(t===0)return!0;if(t===2){const s=this.gl,o=this.getQueryTimerExtensionWebGL2(),r=s.getQueryParameter(e,s.QUERY_RESULT_AVAILABLE);return this.disjoint==null&&(this.disjoint=this.gl.getParameter(o.GPU_DISJOINT_EXT)),r&&!this.disjoint}else{const s=this.getQueryTimerExtensionWebGL1(),o=s.getQueryObjectEXT(e,s.QUERY_RESULT_AVAILABLE_EXT);return this.disjoint==null&&(this.disjoint=this.gl.getParameter(s.GPU_DISJOINT_EXT)),o&&!this.disjoint}}pollFence(e){return new Promise(t=>{this.addItemToPoll(()=>e.isFencePassed(),()=>t())})}pollItems(){const e=zP(this.itemsToPoll.map(t=>t.isDoneFn));for(let t=0;t<=e;++t){const{resolveFn:s}=this.itemsToPoll[t];s()}this.itemsToPoll=this.itemsToPoll.slice(e+1)}addItemToPoll(e,t){if(this.itemsToPoll.push({isDoneFn:e,resolveFn:t}),this.itemsToPoll.length>1)return;let s;"setTimeoutCustom"in V().platform&&(s=V().platform.setTimeoutCustom.bind(V().platform)),Pp(()=>(this.pollItems(),this.itemsToPoll.length===0),()=>0,null,s)}bindTextureToFrameBuffer(e){this.throwIfDisposed(),dp(this.gl,e,this.framebuffer),this.debug&&fc(this.gl)}unbindTextureToFrameBuffer(){this.outputTexture!=null?(dp(this.gl,this.outputTexture,this.framebuffer),this.debug&&fc(this.gl)):q1(this.gl,this.framebuffer)}downloadMatrixDriver(e,t){this.bindTextureToFrameBuffer(e);const s=t();return this.unbindTextureToFrameBuffer(),s}setOutputMatrixTextureDriver(e,t,s){this.throwIfDisposed();const o=this.gl;dp(o,e,this.framebuffer),this.debug&&fc(o),this.outputTexture=e,ie(o,()=>o.viewport(0,0,t,s)),ie(o,()=>o.scissor(0,0,t,s))}setOutputMatrixWriteRegionDriver(e,t,s,o){this.throwIfDisposed(),ie(this.gl,()=>this.gl.scissor(e,t,s,o))}throwIfDisposed(){if(this.disposed)throw new Error("Attempted to use disposed GPGPUContext.")}throwIfNoProgram(){if(this.program==null)throw new Error("No GPU program is currently set.")}}function zP(n){let e=0;for(;eie(r,()=>r.createVertexArray()),this.bindVertexArray=i=>ie(r,()=>r.bindVertexArray(i)),this.deleteVertexArray=i=>ie(r,()=>r.deleteVertexArray(i)),this.getVertexArray=()=>ie(r,()=>r.getParameter(r.VERTEX_ARRAY_BINDING))}else if(e!=null){const r=e.getExtension("OES_vertex_array_object");if(r==null)throw new Error("All WebGL1 implementations are expected to offer OES_vertex_array_object.");this.createVertexArray=()=>ie(e,()=>r.createVertexArrayOES()),this.bindVertexArray=i=>ie(e,()=>r.bindVertexArrayOES(i)),this.deleteVertexArray=i=>ie(e,()=>r.deleteVertexArrayOES(i)),this.getVertexArray=()=>ie(e,()=>e.getParameter(r.VERTEX_ARRAY_BINDING_OES))}let s="WEBGL_color_buffer_float";const o="EXT_color_buffer_half_float";if(this.parallelCompilationExtension=this.gl.getExtension("KHR_parallel_shader_compile"),V().getNumber("WEBGL_VERSION")===1){const r="OES_texture_float",i="OES_texture_half_float";if(this.textureFloatExtension=pc(this.gl,r),Cn(this.gl,i))this.textureHalfFloatExtension=pc(this.gl,i);else if(V().get("WEBGL_FORCE_F16_TEXTURES"))throw new Error("GL context does not support half float textures, yet the environment flag WEBGL_FORCE_F16_TEXTURES is set to true.");if(this.colorBufferFloatExtension=this.gl.getExtension(s),Cn(this.gl,o))this.colorBufferHalfFloatExtension=pc(this.gl,o);else if(V().get("WEBGL_FORCE_F16_TEXTURES"))throw new Error("GL context does not support color renderable half floats, yet the environment flag WEBGL_FORCE_F16_TEXTURES is set to true.")}else if(s="EXT_color_buffer_float",Cn(this.gl,s))this.colorBufferFloatExtension=this.gl.getExtension(s);else if(Cn(this.gl,o))this.colorBufferHalfFloatExtension=this.gl.getExtension(o);else throw new Error("GL context does not support color renderable floats");this.vertexBuffer=kP(this.gl),this.indexBuffer=vP(this.gl),this.framebuffer=mM(this.gl),this.textureConfig=lp(this.gl,this.textureHalfFloatExtension)}get debug(){return V().getBool("DEBUG")}dispose(){if(this.disposed)return;this.program!=null&&console.warn("Disposing a GPGPUContext that still has a bound WebGLProgram. This is probably a resource leak, delete the program with GPGPUContext.deleteProgram before disposing."),this.outputTexture!=null&&console.warn("Disposing a GPGPUContext that still has a bound output matrix texture. This is probably a resource leak, delete the output matrix texture with GPGPUContext.deleteMatrixTexture before disposing.");const e=this.gl;ie(e,()=>e.finish()),ie(e,()=>e.bindFramebuffer(e.FRAMEBUFFER,null)),ie(e,()=>e.deleteFramebuffer(this.framebuffer)),ie(e,()=>e.bindBuffer(e.ARRAY_BUFFER,null)),ie(e,()=>e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,null)),ie(e,()=>e.deleteBuffer(this.indexBuffer)),this.disposed=!0}createFloat32MatrixTexture(e,t){return this.throwIfDisposed(),SP(this.gl,e,t,this.textureConfig)}createFloat16MatrixTexture(e,t){return this.throwIfDisposed(),TP(this.gl,e,t,this.textureConfig)}createUnsignedBytesMatrixTexture(e,t){return this.throwIfDisposed(),NP(this.gl,e,t,this.textureConfig)}uploadPixelDataToTexture(e,t){this.throwIfDisposed(),FP(this.gl,e,t)}uploadDenseMatrixToTexture(e,t,s,o){this.throwIfDisposed(),DP(this.gl,e,t,s,o,this.textureConfig)}createFloat16PackedMatrixTexture(e,t){return this.throwIfDisposed(),RP(this.gl,e,t,this.textureConfig)}createPackedMatrixTexture(e,t){return this.throwIfDisposed(),EP(this.gl,e,t,this.textureConfig)}deleteMatrixTexture(e){this.throwIfDisposed(),this.outputTexture===e&&(q1(this.gl,this.framebuffer),this.outputTexture=null),ie(this.gl,()=>this.gl.deleteTexture(e))}downloadByteEncodedFloatMatrixFromOutputTexture(e,t,s){return this.downloadMatrixDriver(e,()=>LP(this.gl,t,s,this.textureConfig))}downloadPackedMatrixFromBuffer(e,t,s,o,r,i){return MP(this.gl,e,t,s,o,r,i,this.textureConfig)}downloadFloat32MatrixFromBuffer(e,t){return OP(this.gl,e,t)}createBufferFromTexture(e,t,s){this.bindTextureToFrameBuffer(e);const o=_P(this.gl,t,s,this.textureConfig);return this.unbindTextureToFrameBuffer(),o}createAndWaitForFence(){const e=this.createFence(this.gl);return this.pollFence(e)}createFence(e){let t,s;if(V().getBool("WEBGL_FENCE_API_ENABLED")){const o=e,r=o.fenceSync(o.SYNC_GPU_COMMANDS_COMPLETE,0);e.flush(),s=()=>{const i=o.clientWaitSync(r,0,0);return i===o.ALREADY_SIGNALED||i===o.CONDITION_SATISFIED},t=r}else V().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")>0?(t=this.beginQuery(),this.endQuery(),s=()=>this.isQueryAvailable(t,V().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION"))):s=()=>!0;return{query:t,isFencePassed:s}}downloadMatrixFromPackedTexture(e,t,s){return this.downloadMatrixDriver(e,()=>PP(this.gl,t,s))}createProgram(e){this.throwIfDisposed();const t=this.gl;this.vertexShader==null&&(this.vertexShader=$P(t));const s=cM(t);ie(t,()=>t.attachShader(s,this.vertexShader)),ie(t,()=>t.attachShader(s,e)),uM(t,s);const o=Object.assign(s,{vao:this.createVertexArray()});return this.debug&&cp(t,o),o}buildVao(e){this.setProgram(e),this.bindVertexArray(e.vao);const t=this.gl;ie(t,()=>t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,this.indexBuffer)),AP(t,e,this.vertexBuffer)}deleteProgram(e){this.throwIfDisposed(),e===this.program&&(this.program=null),e!=null&&(ie(this.gl,()=>this.gl.deleteProgram(e)),this.deleteVertexArray(e.vao))}setProgram(e){this.throwIfDisposed(),this.program=e,this.program!=null&&this.debug&&cp(this.gl,this.program),ie(this.gl,()=>this.gl.useProgram(e))}getUniformLocation(e,t,s=!0){return this.throwIfDisposed(),s?xM(this.gl,e,t):bM(this.gl,e,t)}getAttributeLocation(e,t){return this.throwIfDisposed(),ie(this.gl,()=>this.gl.getAttribLocation(e,t))}getUniformLocationNoThrow(e,t){return this.throwIfDisposed(),this.gl.getUniformLocation(e,t)}setInputMatrixTexture(e,t,s){this.throwIfDisposed(),this.throwIfNoProgram(),yM(this.gl,e,t,s)}setOutputMatrixTexture(e,t,s){this.setOutputMatrixTextureDriver(e,s,t)}setOutputPackedMatrixTexture(e,t,s){this.throwIfDisposed();const[o,r]=ar(t,s);this.setOutputMatrixTextureDriver(e,o,r)}setOutputMatrixWriteRegion(e,t,s,o){this.setOutputMatrixWriteRegionDriver(s,e,o,t)}setOutputPackedMatrixWriteRegion(e,t,s,o){throw new Error("setOutputPackedMatrixWriteRegion not implemented.")}debugValidate(){this.program!=null&&cp(this.gl,this.program),fc(this.gl)}executeProgram(){this.throwIfDisposed(),this.throwIfNoProgram();const e=this.gl;if(this.debug){const t=this.getVertexArray();console.assert(t===this.program.vao,"VAO changed between setProgram and executeProgram!"),this.debugValidate()}ie(e,()=>e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0))}blockUntilAllProgramsCompleted(){this.throwIfDisposed(),ie(this.gl,()=>this.gl.finish())}getQueryTimerExtension(){return this.disjointQueryTimerExtension==null&&(this.disjointQueryTimerExtension=pc(this.gl,V().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")===2?"EXT_disjoint_timer_query_webgl2":"EXT_disjoint_timer_query")),this.disjointQueryTimerExtension}getQueryTimerExtensionWebGL2(){return this.getQueryTimerExtension()}getQueryTimerExtensionWebGL1(){return this.getQueryTimerExtension()}beginQuery(){if(V().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")===2){const s=this.gl,o=this.getQueryTimerExtensionWebGL2(),r=s.createQuery();return s.beginQuery(o.TIME_ELAPSED_EXT,r),r}const e=this.getQueryTimerExtensionWebGL1(),t=e.createQueryEXT();return e.beginQueryEXT(e.TIME_ELAPSED_EXT,t),t}endQuery(){if(V().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")===2){const t=this.gl,s=this.getQueryTimerExtensionWebGL2();t.endQuery(s.TIME_ELAPSED_EXT);return}const e=this.getQueryTimerExtensionWebGL1();e.endQueryEXT(e.TIME_ELAPSED_EXT)}async waitForQueryAndGetTime(e){return await Pp(()=>this.disposed||this.isQueryAvailable(e,V().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION"))),this.getQueryTime(e,V().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION"))}getQueryTime(e,t){if(t===0)return null;if(t===2){const s=this.gl;return s.getQueryParameter(e,s.QUERY_RESULT)/1e6}else{const s=this.getQueryTimerExtensionWebGL1();return s.getQueryObjectEXT(e,s.QUERY_RESULT_EXT)/1e6}}isQueryAvailable(e,t){if(t===0)return!0;if(t===2){const s=this.gl,o=this.getQueryTimerExtensionWebGL2(),r=s.getQueryParameter(e,s.QUERY_RESULT_AVAILABLE);return this.disjoint==null&&(this.disjoint=this.gl.getParameter(o.GPU_DISJOINT_EXT)),r&&!this.disjoint}else{const s=this.getQueryTimerExtensionWebGL1(),o=s.getQueryObjectEXT(e,s.QUERY_RESULT_AVAILABLE_EXT);return this.disjoint==null&&(this.disjoint=this.gl.getParameter(s.GPU_DISJOINT_EXT)),o&&!this.disjoint}}pollFence(e){return new Promise(t=>{this.addItemToPoll(()=>e.isFencePassed(),()=>t())})}pollItems(){const e=BP(this.itemsToPoll.map(t=>t.isDoneFn));for(let t=0;t<=e;++t){const{resolveFn:s}=this.itemsToPoll[t];s()}this.itemsToPoll=this.itemsToPoll.slice(e+1)}addItemToPoll(e,t){if(this.itemsToPoll.push({isDoneFn:e,resolveFn:t}),this.itemsToPoll.length>1)return;let s;"setTimeoutCustom"in V().platform&&(s=V().platform.setTimeoutCustom.bind(V().platform)),Pp(()=>(this.pollItems(),this.itemsToPoll.length===0),()=>0,null,s)}bindTextureToFrameBuffer(e){this.throwIfDisposed(),up(this.gl,e,this.framebuffer),this.debug&&fc(this.gl)}unbindTextureToFrameBuffer(){this.outputTexture!=null?(up(this.gl,this.outputTexture,this.framebuffer),this.debug&&fc(this.gl)):q1(this.gl,this.framebuffer)}downloadMatrixDriver(e,t){this.bindTextureToFrameBuffer(e);const s=t();return this.unbindTextureToFrameBuffer(),s}setOutputMatrixTextureDriver(e,t,s){this.throwIfDisposed();const o=this.gl;up(o,e,this.framebuffer),this.debug&&fc(o),this.outputTexture=e,ie(o,()=>o.viewport(0,0,t,s)),ie(o,()=>o.scissor(0,0,t,s))}setOutputMatrixWriteRegionDriver(e,t,s,o){this.throwIfDisposed(),ie(this.gl,()=>this.gl.scissor(e,t,s,o))}throwIfDisposed(){if(this.disposed)throw new Error("Attempted to use disposed GPGPUContext.")}throwIfNoProgram(){if(this.program==null)throw new Error("No GPU program is currently set.")}}function BP(n){let e=0;for(;e`${n}.${t}`)}function Bt(n,e){return e===1?[n]:cy(n,e)}function D3(n,e){if(n===1)return"rc";let t="";for(let s=0;s`${n}.${t}`)}function Pt(n,e){return e===1?[n]:cy(n,e)}function A3(n,e){if(n===1)return"rc";let t="";for(let s=0;s1&&(r+="thisRC.y += 1;"),s+=` + */class uy{constructor(e,t){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.customUniforms=[{name:"inputShape",type:"ivec3"}],this.outputShape=e,this.enableShapeUniforms=Dt(this.outputShape.length);let s="";for(let o=0;o<4;o++){let r="thisRC = rc;";o%2===1&&(r+="thisRC.z += 1;"),o>1&&(r+="thisRC.y += 1;"),s+=` ${r} ${o>0?"if(thisRC.y < rows && thisRC.z < cols){":""} int flatIndex = getFlatIndex(thisRC); @@ -12508,8 +12508,8 @@ vec2 packedUVfrom3D(int texNumR, int texNumC, getChannel(getA(inputRC.x, inputRC.y, inputRC.z), inputRCInnerDims); ${o>0?"}":""} `}this.userCode=` - ${_3(t,this.enableShapeUniforms)} - ${this.enableShapeUniforms?xp():gp(e)} + ${F3(t,this.enableShapeUniforms)} + ${this.enableShapeUniforms?mp():fp(e)} void main() { ivec3 rc = getOutputCoords(); @@ -12524,9 +12524,9 @@ vec2 packedUVfrom3D(int texNumR, int texNumC, setOutput(result); } - `}}function _3(n,e){return` + `}}function F3(n,e){return` ivec3 inputCoordsFromReshapedOutCoords(int index) { - ${e?DM(["r","c","d"],"inputShape"):ko(["r","c","d"],n)} + ${e?AM(["r","c","d"],"inputShape"):ko(["r","c","d"],n)} return ivec3(r, c, d); } `}/** @@ -12544,7 +12544,7 @@ vec2 packedUVfrom3D(int texNumR, int texNumC, * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */class O3{constructor(e){this.gpgpu=e,this.numUsedTextures=0,this.numFreeTextures=0,this._numBytesAllocated=0,this._numBytesFree=0,this.freeTextures={},this.usedTextures={},this.logEnabled=!1}acquireTexture(e,t,s){const o=dy(t,s),r=py(e,o,s);r in this.freeTextures||(this.freeTextures[r]=[]),r in this.usedTextures||(this.usedTextures[r]=[]);const i=hy(e,o,this.gpgpu.gl,this.gpgpu.textureConfig,s);if(this.freeTextures[r].length>0){this.numFreeTextures--,this.numUsedTextures++,this._numBytesFree-=i,this.log();const l=this.freeTextures[r].pop();return this.usedTextures[r].push(l),l}let a;return o===kt.PACKED_2X2_FLOAT32?a=this.gpgpu.createPackedMatrixTexture(e[0],e[1]):o===kt.PACKED_2X2_FLOAT16?a=this.gpgpu.createFloat16PackedMatrixTexture(e[0],e[1]):o===kt.UNPACKED_FLOAT32?a=this.gpgpu.createFloat32MatrixTexture(e[0],e[1]):o===kt.UNPACKED_FLOAT16?a=this.gpgpu.createFloat16MatrixTexture(e[0],e[1]):o===kt.PACKED_4X1_UNSIGNED_BYTE&&(a=this.gpgpu.createUnsignedBytesMatrixTexture(e[0],e[1])),this.usedTextures[r].push(a),this.numUsedTextures++,this._numBytesAllocated+=i,this.log(),a}releaseTexture(e,t,s,o){if(this.freeTextures==null)return;const r=dy(s,o),i=py(t,r,o);i in this.freeTextures||(this.freeTextures[i]=[]);const a=hy(t,r,this.gpgpu.gl,this.gpgpu.textureConfig,o),l=V().getNumber("WEBGL_DELETE_TEXTURE_THRESHOLD");l!==-1&&this._numBytesAllocated>l?(this.gpgpu.deleteMatrixTexture(e.texture),this._numBytesAllocated-=a):(this.freeTextures[i].push(e),this.numFreeTextures++,this._numBytesFree+=a),this.numUsedTextures--;const c=this.usedTextures[i],u=c&&c.indexOf(e);if(u==null||u<0)throw new Error("Cannot release a texture that was never provided by this texture manager");c[u]=c[c.length-1],c.pop(),this.log()}log(){if(!this.logEnabled)return;const e=this.numFreeTextures+this.numUsedTextures;console.log("Free/Used",`${this.numFreeTextures} / ${this.numUsedTextures}`,`(${e})`);const t=this._numBytesFree/this._numBytesAllocated;console.log(`Bytes allocated: ${this._numBytesAllocated}`),console.log(`Bytes unused: ${this._numBytesFree} (${Math.round(100*t)}%)`)}get numBytesAllocated(){return this._numBytesAllocated}get numBytesFree(){return this._numBytesFree}getNumUsedTextures(){return this.numUsedTextures}getNumFreeTextures(){return this.numFreeTextures}dispose(){if(this.freeTextures!=null){for(const e in this.freeTextures)this.freeTextures[e].forEach(t=>{this.gpgpu.deleteMatrixTexture(t.texture)});for(const e in this.usedTextures)this.usedTextures[e].forEach(t=>{this.gpgpu.deleteMatrixTexture(t.texture)});this.freeTextures=null,this.usedTextures=null,this.numUsedTextures=0,this.numFreeTextures=0,this._numBytesAllocated=0,this._numBytesFree=0}}}function L3(n,e){const t=n;if(e===t.R32F)return 4;if(e===t.R16F)return 2;if(e===t.RGBA32F)return 16;if(e===n.RGBA)return 16;if(e===t.RGBA16F)return 8;if(e===t.RGBA8)return 4;throw new Error(`Unknown internal format ${e}`)}function hy(n,e,t,s,o){const r=M3(e,s);let i;if(o){const[l,c]=ar(n[0],n[1]);i=l*c}else{const[l,c]=Qi(n[0],n[1]);i=l*c}const a=L3(t,r);return i*a}function M3(n,e){switch(n){case kt.PACKED_2X2_FLOAT32:return oy(e);case kt.PACKED_2X2_FLOAT16:return ry(e);case kt.UNPACKED_FLOAT32:return ty(e);case kt.UNPACKED_FLOAT16:return ny(e);case kt.PACKED_4X1_UNSIGNED_BYTE:return sy(e);default:throw new Error(`Unknown physical texture type ${n}`)}}function P3(n){return V().getBool("WEBGL_RENDER_FLOAT32_ENABLED")?n?kt.PACKED_2X2_FLOAT32:kt.UNPACKED_FLOAT32:n?kt.PACKED_2X2_FLOAT16:kt.UNPACKED_FLOAT16}function dy(n,e){if(n===rn.UPLOAD)return kt.PACKED_2X2_FLOAT32;if(n===rn.RENDER||n==null)return P3(e);if(n===rn.DOWNLOAD||n===rn.PIXELS)return kt.PACKED_4X1_UNSIGNED_BYTE;throw new Error(`Unknown logical texture type ${n}`)}function py(n,e,t){return`${n[0]}_${n[1]}_${e}_${t}`}/** + */class _3{constructor(e){this.gpgpu=e,this.numUsedTextures=0,this.numFreeTextures=0,this._numBytesAllocated=0,this._numBytesFree=0,this.freeTextures={},this.usedTextures={},this.logEnabled=!1}acquireTexture(e,t,s){const o=dy(t,s),r=py(e,o,s);r in this.freeTextures||(this.freeTextures[r]=[]),r in this.usedTextures||(this.usedTextures[r]=[]);const i=hy(e,o,this.gpgpu.gl,this.gpgpu.textureConfig,s);if(this.freeTextures[r].length>0){this.numFreeTextures--,this.numUsedTextures++,this._numBytesFree-=i,this.log();const l=this.freeTextures[r].pop();return this.usedTextures[r].push(l),l}let a;return o===kt.PACKED_2X2_FLOAT32?a=this.gpgpu.createPackedMatrixTexture(e[0],e[1]):o===kt.PACKED_2X2_FLOAT16?a=this.gpgpu.createFloat16PackedMatrixTexture(e[0],e[1]):o===kt.UNPACKED_FLOAT32?a=this.gpgpu.createFloat32MatrixTexture(e[0],e[1]):o===kt.UNPACKED_FLOAT16?a=this.gpgpu.createFloat16MatrixTexture(e[0],e[1]):o===kt.PACKED_4X1_UNSIGNED_BYTE&&(a=this.gpgpu.createUnsignedBytesMatrixTexture(e[0],e[1])),this.usedTextures[r].push(a),this.numUsedTextures++,this._numBytesAllocated+=i,this.log(),a}releaseTexture(e,t,s,o){if(this.freeTextures==null)return;const r=dy(s,o),i=py(t,r,o);i in this.freeTextures||(this.freeTextures[i]=[]);const a=hy(t,r,this.gpgpu.gl,this.gpgpu.textureConfig,o),l=V().getNumber("WEBGL_DELETE_TEXTURE_THRESHOLD");l!==-1&&this._numBytesAllocated>l?(this.gpgpu.deleteMatrixTexture(e.texture),this._numBytesAllocated-=a):(this.freeTextures[i].push(e),this.numFreeTextures++,this._numBytesFree+=a),this.numUsedTextures--;const c=this.usedTextures[i],u=c&&c.indexOf(e);if(u==null||u<0)throw new Error("Cannot release a texture that was never provided by this texture manager");c[u]=c[c.length-1],c.pop(),this.log()}log(){if(!this.logEnabled)return;const e=this.numFreeTextures+this.numUsedTextures;console.log("Free/Used",`${this.numFreeTextures} / ${this.numUsedTextures}`,`(${e})`);const t=this._numBytesFree/this._numBytesAllocated;console.log(`Bytes allocated: ${this._numBytesAllocated}`),console.log(`Bytes unused: ${this._numBytesFree} (${Math.round(100*t)}%)`)}get numBytesAllocated(){return this._numBytesAllocated}get numBytesFree(){return this._numBytesFree}getNumUsedTextures(){return this.numUsedTextures}getNumFreeTextures(){return this.numFreeTextures}dispose(){if(this.freeTextures!=null){for(const e in this.freeTextures)this.freeTextures[e].forEach(t=>{this.gpgpu.deleteMatrixTexture(t.texture)});for(const e in this.usedTextures)this.usedTextures[e].forEach(t=>{this.gpgpu.deleteMatrixTexture(t.texture)});this.freeTextures=null,this.usedTextures=null,this.numUsedTextures=0,this.numFreeTextures=0,this._numBytesAllocated=0,this._numBytesFree=0}}}function O3(n,e){const t=n;if(e===t.R32F)return 4;if(e===t.R16F)return 2;if(e===t.RGBA32F)return 16;if(e===n.RGBA)return 16;if(e===t.RGBA16F)return 8;if(e===t.RGBA8)return 4;throw new Error(`Unknown internal format ${e}`)}function hy(n,e,t,s,o){const r=L3(e,s);let i;if(o){const[l,c]=ar(n[0],n[1]);i=l*c}else{const[l,c]=Qi(n[0],n[1]);i=l*c}const a=O3(t,r);return i*a}function L3(n,e){switch(n){case kt.PACKED_2X2_FLOAT32:return oy(e);case kt.PACKED_2X2_FLOAT16:return ry(e);case kt.UNPACKED_FLOAT32:return ty(e);case kt.UNPACKED_FLOAT16:return ny(e);case kt.PACKED_4X1_UNSIGNED_BYTE:return sy(e);default:throw new Error(`Unknown physical texture type ${n}`)}}function M3(n){return V().getBool("WEBGL_RENDER_FLOAT32_ENABLED")?n?kt.PACKED_2X2_FLOAT32:kt.UNPACKED_FLOAT32:n?kt.PACKED_2X2_FLOAT16:kt.UNPACKED_FLOAT16}function dy(n,e){if(n===rn.UPLOAD)return kt.PACKED_2X2_FLOAT32;if(n===rn.RENDER||n==null)return M3(e);if(n===rn.DOWNLOAD||n===rn.PIXELS)return kt.PACKED_4X1_UNSIGNED_BYTE;throw new Error(`Unknown logical texture type ${n}`)}function py(n,e,t){return`${n[0]}_${n[1]}_${e}_${t}`}/** * @license * Copyright 2017 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -12559,7 +12559,7 @@ vec2 packedUVfrom3D(int texNumR, int texNumC, * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */class ts{constructor(e,t){this.variableNames=["A"],this.outputShape=e,this.enableShapeUniforms=Ft(this.outputShape.length),this.userCode=` + */class ts{constructor(e,t){this.variableNames=["A"],this.outputShape=e,this.enableShapeUniforms=Dt(this.outputShape.length),this.userCode=` float unaryOperation(float x) { ${t} } @@ -12570,11 +12570,11 @@ vec2 packedUVfrom3D(int texNumR, int texNumC, setOutput(y); } - `}}const In="if (isnan(x)) return x;",B3="return x;",fy="return abs(x);",z3="return (x >= 0.0) ? x : (exp(x) - 1.0);",V3=In+` + `}}const In="if (isnan(x)) return x;",P3="return x;",fy="return abs(x);",B3="return (x >= 0.0) ? x : (exp(x) - 1.0);",z3=In+` return (x < 0.0) ? 0.0 : x; -`,W3=In+` +`,V3=In+` return (x < 0.0) ? 0.0 : min(6.0, x); -`,Ls="return x;",U3="return 1.0 / (1.0 + exp(-1.0 * x));";/** +`,Ls="return x;",W3="return 1.0 / (1.0 + exp(-1.0 * x));";/** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -12589,7 +12589,7 @@ vec2 packedUVfrom3D(int texNumR, int texNumC, * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const G3="return x;",H3=` + */const U3="return x;",G3=` vec4 result; result.r = (x.r >= 0.0) ? x.r : (exp(x.r) - 1.0); @@ -12598,7 +12598,7 @@ vec2 packedUVfrom3D(int texNumR, int texNumC, result.a = (x.a >= 0.0) ? x.a : (exp(x.a) - 1.0); return result; -`,q3=` +`,H3=` vec4 result = x * vec4(greaterThanEqual(x, vec4(0.0))); bvec4 isNaN = isnan(x); @@ -12608,7 +12608,7 @@ vec2 packedUVfrom3D(int texNumR, int texNumC, result.a = isNaN.a ? x.a : result.a; return result; -`,j3=` +`,q3=` vec4 result = min(x, vec4(6.)) * vec4(greaterThanEqual(x, vec4(0.0))); bvec4 isNaN = isnan(x); @@ -12618,7 +12618,7 @@ vec2 packedUVfrom3D(int texNumR, int texNumC, result.a = isNaN.a ? x.a : result.a; return result; -`,K3="return 1.0 / (1.0 + exp(-1.0 * x));";class Ms{constructor(e,t){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=e,this.enableShapeUniforms=Ft(this.outputShape.length),this.userCode=` +`,j3="return 1.0 / (1.0 + exp(-1.0 * x));";class Ms{constructor(e,t){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=e,this.enableShapeUniforms=Dt(this.outputShape.length),this.userCode=` vec4 unaryOperation(vec4 x) { ${t} } @@ -12644,7 +12644,7 @@ vec2 packedUVfrom3D(int texNumR, int texNumC, * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */class X3{constructor(e){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!1,this.outputShape=e,this.enableShapeUniforms=Ft(this.outputShape.length);const t=e.length,s=Bt("rc",t),o=Me(t),r=D3(t,s),i=s.slice(-2),a=t<=1?"rc":`vec2(${i.join(",")})`;this.userCode=` + */class K3{constructor(e){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!1,this.outputShape=e,this.enableShapeUniforms=Dt(this.outputShape.length);const t=e.length,s=Pt("rc",t),o=Me(t),r=A3(t,s),i=s.slice(-2),a=t<=1?"rc":`vec2(${i.join(",")})`;this.userCode=` void main() { ${o} rc = getOutputCoords(); vec4 packedInput = getA(${r}); @@ -12666,7 +12666,7 @@ vec2 packedUVfrom3D(int texNumR, int texNumC, * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const Y3=Rh,Z3=1e-7,Q3=1e-4,yc={};function J3(n){return n in yc||(yc[n]={}),yc[n]}const eB=V().getNumber("CPU_HANDOFF_SIZE_THRESHOLD"),tB=600;function nB(){return V().global.screen==null?1024:V().global.screen.height*V().global.screen.width*window.devicePixelRatio*tB/1024/1024}class wc extends Oc{nextDataId(){return wc.nextDataId++}constructor(e){if(super(),this.pendingRead=new WeakMap,this.pendingDisposal=new WeakSet,this.dataRefCount=new WeakMap,this.numBytesInGPU=0,this.uploadWaitMs=0,this.downloadWaitMs=0,this.lastGlFlushTime=0,this.warnedAboutMemory=!1,this.pendingDeletes=0,this.disposed=!1,!V().getBool("HAS_WEBGL"))throw new Error("WebGL is not supported on this device");let t;if(e!=null){if(e instanceof yp)t=e;else{const s=Ln(V().getNumber("WEBGL_VERSION"),e);t=new yp(s)}this.binaryCache={},this.gpgpuCreatedLocally=!1}else{const s=Ln(V().getNumber("WEBGL_VERSION"));t=new yp(s),this.binaryCache=J3(V().getNumber("WEBGL_VERSION")),this.gpgpuCreatedLocally=!0}this.gpgpu=t,this.canvas=this.gpgpu.gl.canvas,this.textureManager=new O3(this.gpgpu),this.numMBBeforeWarning=nB(),this.texData=new Lp(this,Te())}numDataIds(){return this.texData.numDataIds()-this.pendingDeletes}writeTexture(e,t,s,o,r,i){const a=this.makeTensorInfo(t,s),l=this.texData.get(a.dataId);l.isPacked=!1,l.texture={texture:e,texShape:[o,r]},l.texShape=[o,r];const c=mc(t),u=new ey(c,!1,i),h=this.runWebGLProgram(u,[a],s,[[o,r]]);return h.shape=t,l.texture=null,this.disposeIntermediateTensorInfo(a),h.dataId}write(e,t,s){if((V().getBool("WEBGL_CHECK_NUMERICAL_PROBLEMS")||V().getBool("DEBUG"))&&this.checkNumericalProblems(e),s==="complex64"&&e!=null)throw new Error("Cannot write to a complex64 dtype. Please use tf.complex(real, imag).");const o={id:this.nextDataId()};return this.texData.set(o,{shape:t,dtype:s,values:e,usage:rn.UPLOAD,refCount:1}),o}refCount(e){return this.texData.has(e)?this.texData.get(e).refCount:0}incRef(e){const t=this.texData.get(e);t.refCount++}decRef(e){if(this.texData.has(e)){const t=this.texData.get(e);t.refCount--}}move(e,t,s,o,r){if(V().getBool("DEBUG")&&this.checkNumericalProblems(t),o==="complex64")throw new Error("Cannot write to a complex64 dtype. Please use tf.complex(real, imag).");this.texData.set(e,{shape:s,dtype:o,values:t,usage:rn.UPLOAD,refCount:r})}disposeIntermediateTensorInfo(e){this.disposeData(e.dataId)}readSync(e){const t=this.texData.get(e),{values:s,dtype:o,complexTensorInfos:r,slice:i,shape:a,isPacked:l}=t;if(i!=null){let d;l?d=new Ms(a,Ls):d=new ts(a,Ls);const p=this.runWebGLProgram(d,[{dataId:e,shape:a,dtype:o}],o),f=this.readSync(p.dataId);return this.disposeIntermediateTensorInfo(p),f}if(s!=null)return this.convertAndCacheOnCPU(e);if(o==="string")return s;const c=this.activeTimers!=null;let u;c&&(u=Vt());let h;if(o==="complex64"){const d=this.readSync(r.real.dataId),p=this.readSync(r.imag.dataId);h=cs(d,p)}else h=this.getValuesFromTexture(e);return c&&(this.downloadWaitMs+=Vt()-u),this.convertAndCacheOnCPU(e,h)}async read(e){if(this.pendingRead.has(e)){const f=this.pendingRead.get(e);return new Promise(m=>f.push(m))}const t=this.texData.get(e),{values:s,shape:o,slice:r,dtype:i,complexTensorInfos:a,isPacked:l}=t;if(r!=null){let f;l?f=new Ms(o,Ls):f=new ts(o,Ls);const m=this.runWebGLProgram(f,[{dataId:e,shape:o,dtype:i}],i),g=this.read(m.dataId);return this.disposeIntermediateTensorInfo(m),g}if(s!=null)return this.convertAndCacheOnCPU(e);if(V().getBool("DEBUG")&&!V().getBool("WEBGL_DOWNLOAD_FLOAT_ENABLED")&&V().getNumber("WEBGL_VERSION")===2)throw new Error("tensor.data() with WEBGL_DOWNLOAD_FLOAT_ENABLED=false and WEBGL_VERSION=2 not yet supported.");let c=null,u;if(i!=="complex64"&&V().get("WEBGL_BUFFER_SUPPORTED")){u=this.decode(e);const f=this.texData.get(u.dataId);c=this.gpgpu.createBufferFromTexture(f.texture.texture,...dc(o))}this.pendingRead.set(e,[]),i!=="complex64"&&await this.gpgpu.createAndWaitForFence();let h;if(i==="complex64"){const f=await Promise.all([this.read(a.real.dataId),this.read(a.imag.dataId)]),m=f[0],g=f[1];h=cs(m,g)}else if(c==null)h=this.getValuesFromTexture(e);else{const f=G(o);h=this.gpgpu.downloadFloat32MatrixFromBuffer(c,f)}if(u!=null&&this.disposeIntermediateTensorInfo(u),c!=null){const f=this.gpgpu.gl;ie(f,()=>f.deleteBuffer(c))}const d=this.convertAndCacheOnCPU(e,h),p=this.pendingRead.get(e);return this.pendingRead.delete(e),p.forEach(f=>f(d)),this.pendingDisposal.has(e)&&(this.pendingDisposal.delete(e),this.disposeData(e)&&Te().removeDataId(e,this),this.pendingDeletes--),d}readToGPU(e,t={}){const s=this.texData.get(e),{values:o,shape:r,slice:i,dtype:a,isPacked:l,texture:c}=s;if(a==="complex64")throw new Error("Does not support reading texture for complex64 dtype.");if(i!=null){let p;l?p=new Ms(r,Ls):p=new ts(r,Ls);const f=this.runWebGLProgram(p,[{dataId:e,shape:r,dtype:a}],a),m=this.readToGPU(f,t);return this.disposeIntermediateTensorInfo(f),m}if(c==null)throw o!=null?new Error("Data is not on GPU but on CPU."):new Error("There is no data on GPU or CPU.");const u=this.decode(e,t.customTexShape),h=Te().makeTensorFromTensorInfo(u),d=this.texData.get(u.dataId);return Object.assign({tensorRef:h},d.texture)}bufferSync(e){const t=this.readSync(e.dataId);if(e.dtype==="string")try{const s=t.map(o=>ys(o));return ke(e.shape,e.dtype,s)}catch{throw new Error("Failed to decode encoded string bytes into utf-8")}return ke(e.shape,e.dtype,t)}checkNumericalProblems(e){if(e!=null)for(let t=0;t0}time(e){const t=this.activeTimers,s=[];let o=!1;this.programTimersStack==null?(this.programTimersStack=s,o=!0):this.activeTimers.push(s),this.activeTimers=s,e();const r=Ys(this.activeTimers.map(l=>l.query)).filter(l=>l!=null),i=Ys(this.activeTimers.map(l=>l.name)).filter(l=>l!=null);this.activeTimers=t,o&&(this.programTimersStack=null);const a={uploadWaitMs:this.uploadWaitMs,downloadWaitMs:this.downloadWaitMs,kernelMs:null,wallMs:null};return(async()=>{if(V().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE")>0){const l=await Promise.all(r);a.kernelMs=$w(l),a.getExtraProfileInfo=()=>l.map((c,u)=>({name:i[u],ms:c})).map(c=>`${c.name}: ${c.ms}`).join(", ")}else a.kernelMs={error:"WebGL query timers are not supported in this environment."};return this.uploadWaitMs=0,this.downloadWaitMs=0,a})()}memory(){return{unreliable:!1,numBytesInGPU:this.numBytesInGPU,numBytesInGPUAllocated:this.textureManager.numBytesAllocated,numBytesInGPUFree:this.textureManager.numBytesFree}}startTimer(){return V().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE")>0?this.gpgpu.beginQuery():{startMs:Vt(),endMs:null}}endTimer(e){return V().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE")>0?(this.gpgpu.endQuery(),e):(e.endMs=Vt(),e)}async getQueryTime(e){if(V().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE")>0)return this.gpgpu.waitForQueryAndGetTime(e);const t=e;return t.endMs-t.startMs}disposeData(e,t=!1){if(this.pendingDisposal.has(e))return!1;if(!this.texData.has(e))return!0;if(t?this.texData.get(e).refCount=0:this.texData.get(e).refCount--,!t&&this.texData.get(e).refCount>0)return!1;if(this.pendingRead.has(e))return this.pendingDisposal.add(e),this.pendingDeletes++,!1;this.releaseGPUData(e);const{complexTensorInfos:s}=this.texData.get(e);return s!=null&&(this.disposeData(s.real.dataId,t),this.disposeData(s.imag.dataId,t)),this.texData.delete(e),!0}releaseGPUData(e){const{texture:t,dtype:s,texShape:o,usage:r,isPacked:i,slice:a}=this.texData.get(e),l=a&&a.origDataId||e,c=this.dataRefCount.get(l);c>1?this.dataRefCount.set(l,c-1):(this.dataRefCount.delete(l),t!=null&&(this.numBytesInGPU-=this.computeBytes(o,s),this.textureManager.releaseTexture(t,o,r,i)));const u=this.texData.get(e);u.texture=null,u.texShape=null,u.isPacked=!1,u.slice=null}getTexture(e){return this.uploadToGPU(e),this.texData.get(e).texture.texture}getDataInfo(e){return this.texData.get(e)}shouldExecuteOnCPU(e,t=eB){return V().getBool("WEBGL_CPU_FORWARD")&&e.every(s=>this.texData.get(s.dataId).texture==null&&G(s.shape)0&&br(s[0])){const r=s.map(i=>bs(i));o=this.write(r,e,t)}else o=this.write(s,e,t);return this.texData.get(o).usage=null,{dataId:o,shape:e,dtype:t}}makeOutput(e,t,s){return Te().makeTensorFromTensorInfo(this.makeTensorInfo(e,t,s),this)}unpackTensor(e){const t=new X3(e.shape);return this.runWebGLProgram(t,[e],e.dtype)}packTensor(e){const t=new F3(e.shape);return this.runWebGLProgram(t,[e],e.dtype,null,!0)}packedReshape(e,t){const s=[lr(e.shape),...cr(e.shape)],o={dtype:e.dtype,shape:s,dataId:e.dataId},r=[lr(t),...cr(t)],i=new uy(r,s),a=!0,l=[s],c=this.runWebGLProgram(i,[o],e.dtype,l,a);return{dataId:c.dataId,shape:t,dtype:c.dtype}}decode(e,t){const s=this.texData.get(e),{isPacked:o,shape:r,dtype:i}=s;if(t!=null){const d=G(r),p=t[0]*t[1]*4;v(d<=p,()=>"customTexShape is too small. Row * Column * 4 should be equal or larger than the size of the tensor data.")}const a=mc(r);let l;o?l=new yP(a):l=new bP(a);const c=!0,u=[t??dc(a)],h=this.runWebGLProgram(l,[{shape:a,dtype:i,dataId:e}],i,u,c,t);return{dtype:i,shape:r,dataId:h.dataId}}runWebGLProgram(e,t,s,o,r=!1,i){const a=this.makeTensorInfo(e.outputShape,s),l=this.texData.get(a.dataId);if(e.packedOutput&&(l.isPacked=!0),e.outPackingScheme===Zi.DENSE){const x=i??dc(e.outputShape);l.texShape=x.map(b=>b*2)}if(e.outTexUsage!=null&&(l.usage=e.outTexUsage),G(a.shape)===0)return l.values=Tt(a.dtype,0),a;const c=[],u=t.map(x=>{if(x.dtype==="complex64")throw new Error("GPGPUProgram does not support complex64 input. For complex64 dtypes, please separate the program into real and imaginary parts.");let b=this.texData.get(x.dataId);if(b.texture==null){if(!e.packedInputs&&G(x.shape)<=V().getNumber("WEBGL_SIZE_UPLOAD_UNIFORM"))return{shape:x.shape,texData:null,isUniform:!0,uniformValues:b.values};e.packedInputs&&(b.isPacked=!0,b.shape=x.shape)}if(this.uploadToGPU(x.dataId),!!b.isPacked!=!!e.packedInputs)x=b.isPacked?this.unpackTensor(x):this.packTensor(x),c.push(x),b=this.texData.get(x.dataId);else if(b.isPacked&&!xc(b.shape,x.shape)){const w=x,y=x.shape;x.shape=b.shape,x=this.packedReshape(x,y),c.push(x),b=this.texData.get(x.dataId),w.shape=y}return{shape:x.shape,texData:b,isUniform:!1}});this.uploadToGPU(a.dataId);const h={shape:a.shape,texData:l,isUniform:!1},d=xP(e,u,h),p=this.getAndSaveBinary(d,()=>mP(this.gpgpu,e,u,h)),f=this.activeTimers!=null;let m;f&&(m=this.startTimer()),V().get("ENGINE_COMPILE_ONLY")||gP(this.gpgpu,p,u,h,o),c.forEach(x=>this.disposeIntermediateTensorInfo(x)),f&&(m=this.endTimer(m),this.activeTimers.push({name:e.constructor.name,query:this.getQueryTime(m)}));const g=V().getNumber("WEBGL_FLUSH_THRESHOLD");if(g>0){const x=Vt();x-this.lastGlFlushTime>g&&(this.gpgpu.gl.flush(),this.lastGlFlushTime=x)}if(!V().getBool("WEBGL_LAZILY_UNPACK")&&l.isPacked&&r===!1){const x=this.unpackTensor(a);return this.disposeIntermediateTensorInfo(a),x}return a}compileAndRun(e,t,s,o,r=!1){return s=s||t[0].dtype,this.runWebGLProgram(e,t,s,o,r)}getAndSaveBinary(e,t){return e in this.binaryCache||(this.binaryCache[e]=t()),this.binaryCache[e]}getTextureManager(){return this.textureManager}dispose(){this.disposed||(V().getBool("IS_TEST")||Object.keys(this.binaryCache).forEach(t=>{this.gpgpu.deleteProgram(this.binaryCache[t].webGLProgram),delete this.binaryCache[t]}),this.textureManager.dispose(),this.canvas!=null&&typeof HTMLCanvasElement<"u"&&this.canvas instanceof HTMLCanvasElement?this.canvas.remove():this.canvas=null,this.gpgpuCreatedLocally&&(this.gpgpu.program=null,this.gpgpu.dispose()),this.disposed=!0)}floatPrecision(){return this.floatPrecisionValue==null&&(this.floatPrecisionValue=B(()=>{if(!V().get("WEBGL_RENDER_FLOAT32_ENABLED")){const e=V().getBool("DEBUG");V().set("DEBUG",!1);const t=this.abs(De(1e-8)).dataSync()[0];if(V().set("DEBUG",e),t>0)return 32}return 16})),this.floatPrecisionValue}epsilon(){return this.floatPrecision()===32?Z3:Q3}uploadToGPU(e){const t=this.texData.get(e),{shape:s,dtype:o,values:r,texture:i,usage:a,isPacked:l}=t;if(i!=null)return;const c=this.activeTimers!=null;let u;c&&(u=Vt());let h=t.texShape;if(h==null&&(h=$M(s,l),t.texShape=h),r!=null){const d=mc(s);let p,f=h[1],m=h[0];const g=r instanceof Uint8Array||r instanceof Uint8ClampedArray;(l||!g)&&([f,m]=ar(h[0],h[1])),l?p=new $P(d,g):p=new ey(d,g);const x=g?[m,f]:h,b=this.makeTensorInfo(x,o),w=this.texData.get(b.dataId);g?w.usage=rn.PIXELS:w.usage=rn.UPLOAD,w.texShape=x,this.gpgpu.uploadDenseMatrixToTexture(this.getTexture(b.dataId),f,m,r);const y=[[m,f]],I=this.runWebGLProgram(p,[b],o,y,!0),$=this.texData.get(I.dataId);t.texShape=$.texShape,t.isPacked=$.isPacked,t.usage=$.usage,V().get("ENGINE_COMPILE_ONLY")?this.disposeData(I.dataId):(t.texture=$.texture,t.values=null,this.texData.delete(I.dataId)),this.disposeIntermediateTensorInfo(b),c&&(this.uploadWaitMs+=Vt()-u)}else{const d=this.acquireTexture(h,a,o,l);t.texture=d}}convertAndCacheOnCPU(e,t){const s=this.texData.get(e),{dtype:o}=s;return t!=null&&(s.values=sB(t,o)),s.values}acquireTexture(e,t,s,o){if(this.numBytesInGPU+=this.computeBytes(e,s),!this.warnedAboutMemory&&this.numBytesInGPU>this.numMBBeforeWarning*1024*1024){const r=(this.numBytesInGPU/1024/1024).toFixed(2);this.warnedAboutMemory=!0,console.warn(`High memory usage in GPU: ${r} MB, most likely due to a memory leak`)}return this.textureManager.acquireTexture(e,t,o)}computeBytes(e,t){return e[0]*e[1]*la(t)}checkCompileCompletion(){for(const[,e]of Object.entries(this.binaryCache))this.checkCompletion_(e)}async checkCompileCompletionAsync(){const e=[];if(this.gpgpu.parallelCompilationExtension){for(const[,t]of Object.entries(this.binaryCache))e.push(this.checkCompletionAsync_(t));return Promise.all(e)}else{for(const[,t]of Object.entries(this.binaryCache)){const s=new Promise(o=>{try{this.checkCompletion_(t),o(!0)}catch(r){throw r}});e.push(s)}return Promise.all(e)}}async checkCompletionAsync_(e){return this.gpgpu.gl.getProgramParameter(e.webGLProgram,this.gpgpu.parallelCompilationExtension.COMPLETION_STATUS_KHR)?this.checkCompletion_(e):(await ag(),this.checkCompletionAsync_(e))}checkCompletion_(e){if(this.gpgpu.gl.getProgramParameter(e.webGLProgram,this.gpgpu.gl.LINK_STATUS)===!1)throw console.log(this.gpgpu.gl.getProgramInfoLog(e.webGLProgram)),this.gpgpu.gl.getShaderParameter(e.fragmentShader,this.gpgpu.gl.COMPILE_STATUS)===!1?(G1(e.source,this.gpgpu.gl.getShaderInfoLog(e.fragmentShader)),new Error("Failed to compile fragment shader.")):new Error("Failed to link vertex and fragment shaders.");return!0}getUniformLocations(){for(const e of Object.values(this.binaryCache)){this.gpgpu.buildVao(e.webGLProgram);const{variablesLocations:t,customUniformLocations:s,infLoc:o,nanLoc:r,outShapeLocation:i,outShapeStridesLocation:a,outTexShapeLocation:l}=Q1(this.gpgpu,e.program,e.webGLProgram);e.variablesLocations=t,e.customUniformLocations=s,e.infLoc=o,e.nanLoc=r,e.outShapeLocation=i,e.outShapeStridesLocation=a,e.outTexShapeLocation=l}}createTensorFromGPUData(e,t,s){e.channels=e.channels||"RGBA";const{texture:o,height:r,width:i,channels:a}=e,l=Te().backend;if(!l.gpgpu.gl.isTexture(o))throw new Error("The texture is invalid. Also, please make sure the texture and the TFJS WebGL backend are using the same canvas. If you want to use your own custom canvas, you have to create and use the custom TFJS WebGL backend created from the canvas through 'new tf.MathBackendWebGL(customCanvas)'.");const c=l.writeTexture(o,t,s,r,i,a);return Te().makeTensorFromDataId(c,t,s,l)}}wc.nextDataId=0;function sB(n,e){if(e==="float32"||e==="complex64")return n;if(e==="int32"||e==="bool"){const t=e==="int32"?new Int32Array(n.length):new Uint8Array(n.length);for(let s=0;sf.push(m))}const t=this.texData.get(e),{values:s,shape:o,slice:r,dtype:i,complexTensorInfos:a,isPacked:l}=t;if(r!=null){let f;l?f=new Ms(o,Ls):f=new ts(o,Ls);const m=this.runWebGLProgram(f,[{dataId:e,shape:o,dtype:i}],i),g=this.read(m.dataId);return this.disposeIntermediateTensorInfo(m),g}if(s!=null)return this.convertAndCacheOnCPU(e);if(V().getBool("DEBUG")&&!V().getBool("WEBGL_DOWNLOAD_FLOAT_ENABLED")&&V().getNumber("WEBGL_VERSION")===2)throw new Error("tensor.data() with WEBGL_DOWNLOAD_FLOAT_ENABLED=false and WEBGL_VERSION=2 not yet supported.");let c=null,u;if(i!=="complex64"&&V().get("WEBGL_BUFFER_SUPPORTED")){u=this.decode(e);const f=this.texData.get(u.dataId);c=this.gpgpu.createBufferFromTexture(f.texture.texture,...dc(o))}this.pendingRead.set(e,[]),i!=="complex64"&&await this.gpgpu.createAndWaitForFence();let h;if(i==="complex64"){const f=await Promise.all([this.read(a.real.dataId),this.read(a.imag.dataId)]),m=f[0],g=f[1];h=cs(m,g)}else if(c==null)h=this.getValuesFromTexture(e);else{const f=G(o);h=this.gpgpu.downloadFloat32MatrixFromBuffer(c,f)}if(u!=null&&this.disposeIntermediateTensorInfo(u),c!=null){const f=this.gpgpu.gl;ie(f,()=>f.deleteBuffer(c))}const d=this.convertAndCacheOnCPU(e,h),p=this.pendingRead.get(e);return this.pendingRead.delete(e),p.forEach(f=>f(d)),this.pendingDisposal.has(e)&&(this.pendingDisposal.delete(e),this.disposeData(e)&&Te().removeDataId(e,this),this.pendingDeletes--),d}readToGPU(e,t={}){const s=this.texData.get(e),{values:o,shape:r,slice:i,dtype:a,isPacked:l,texture:c}=s;if(a==="complex64")throw new Error("Does not support reading texture for complex64 dtype.");if(i!=null){let p;l?p=new Ms(r,Ls):p=new ts(r,Ls);const f=this.runWebGLProgram(p,[{dataId:e,shape:r,dtype:a}],a),m=this.readToGPU(f,t);return this.disposeIntermediateTensorInfo(f),m}if(c==null)throw o!=null?new Error("Data is not on GPU but on CPU."):new Error("There is no data on GPU or CPU.");const u=this.decode(e,t.customTexShape),h=Te().makeTensorFromTensorInfo(u),d=this.texData.get(u.dataId);return Object.assign({tensorRef:h},d.texture)}bufferSync(e){const t=this.readSync(e.dataId);if(e.dtype==="string")try{const s=t.map(o=>ys(o));return ke(e.shape,e.dtype,s)}catch{throw new Error("Failed to decode encoded string bytes into utf-8")}return ke(e.shape,e.dtype,t)}checkNumericalProblems(e){if(e!=null)for(let t=0;t0}time(e){const t=this.activeTimers,s=[];let o=!1;this.programTimersStack==null?(this.programTimersStack=s,o=!0):this.activeTimers.push(s),this.activeTimers=s,e();const r=Ys(this.activeTimers.map(l=>l.query)).filter(l=>l!=null),i=Ys(this.activeTimers.map(l=>l.name)).filter(l=>l!=null);this.activeTimers=t,o&&(this.programTimersStack=null);const a={uploadWaitMs:this.uploadWaitMs,downloadWaitMs:this.downloadWaitMs,kernelMs:null,wallMs:null};return(async()=>{if(V().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE")>0){const l=await Promise.all(r);a.kernelMs=Iw(l),a.getExtraProfileInfo=()=>l.map((c,u)=>({name:i[u],ms:c})).map(c=>`${c.name}: ${c.ms}`).join(", ")}else a.kernelMs={error:"WebGL query timers are not supported in this environment."};return this.uploadWaitMs=0,this.downloadWaitMs=0,a})()}memory(){return{unreliable:!1,numBytesInGPU:this.numBytesInGPU,numBytesInGPUAllocated:this.textureManager.numBytesAllocated,numBytesInGPUFree:this.textureManager.numBytesFree}}startTimer(){return V().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE")>0?this.gpgpu.beginQuery():{startMs:zt(),endMs:null}}endTimer(e){return V().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE")>0?(this.gpgpu.endQuery(),e):(e.endMs=zt(),e)}async getQueryTime(e){if(V().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE")>0)return this.gpgpu.waitForQueryAndGetTime(e);const t=e;return t.endMs-t.startMs}disposeData(e,t=!1){if(this.pendingDisposal.has(e))return!1;if(!this.texData.has(e))return!0;if(t?this.texData.get(e).refCount=0:this.texData.get(e).refCount--,!t&&this.texData.get(e).refCount>0)return!1;if(this.pendingRead.has(e))return this.pendingDisposal.add(e),this.pendingDeletes++,!1;this.releaseGPUData(e);const{complexTensorInfos:s}=this.texData.get(e);return s!=null&&(this.disposeData(s.real.dataId,t),this.disposeData(s.imag.dataId,t)),this.texData.delete(e),!0}releaseGPUData(e){const{texture:t,dtype:s,texShape:o,usage:r,isPacked:i,slice:a}=this.texData.get(e),l=a&&a.origDataId||e,c=this.dataRefCount.get(l);c>1?this.dataRefCount.set(l,c-1):(this.dataRefCount.delete(l),t!=null&&(this.numBytesInGPU-=this.computeBytes(o,s),this.textureManager.releaseTexture(t,o,r,i)));const u=this.texData.get(e);u.texture=null,u.texShape=null,u.isPacked=!1,u.slice=null}getTexture(e){return this.uploadToGPU(e),this.texData.get(e).texture.texture}getDataInfo(e){return this.texData.get(e)}shouldExecuteOnCPU(e,t=J3){return V().getBool("WEBGL_CPU_FORWARD")&&e.every(s=>this.texData.get(s.dataId).texture==null&&G(s.shape)0&&br(s[0])){const r=s.map(i=>bs(i));o=this.write(r,e,t)}else o=this.write(s,e,t);return this.texData.get(o).usage=null,{dataId:o,shape:e,dtype:t}}makeOutput(e,t,s){return Te().makeTensorFromTensorInfo(this.makeTensorInfo(e,t,s),this)}unpackTensor(e){const t=new K3(e.shape);return this.runWebGLProgram(t,[e],e.dtype)}packTensor(e){const t=new D3(e.shape);return this.runWebGLProgram(t,[e],e.dtype,null,!0)}packedReshape(e,t){const s=[lr(e.shape),...cr(e.shape)],o={dtype:e.dtype,shape:s,dataId:e.dataId},r=[lr(t),...cr(t)],i=new uy(r,s),a=!0,l=[s],c=this.runWebGLProgram(i,[o],e.dtype,l,a);return{dataId:c.dataId,shape:t,dtype:c.dtype}}decode(e,t){const s=this.texData.get(e),{isPacked:o,shape:r,dtype:i}=s;if(t!=null){const d=G(r),p=t[0]*t[1]*4;k(d<=p,()=>"customTexShape is too small. Row * Column * 4 should be equal or larger than the size of the tensor data.")}const a=mc(r);let l;o?l=new bP(a):l=new xP(a);const c=!0,u=[t??dc(a)],h=this.runWebGLProgram(l,[{shape:a,dtype:i,dataId:e}],i,u,c,t);return{dtype:i,shape:r,dataId:h.dataId}}runWebGLProgram(e,t,s,o,r=!1,i){const a=this.makeTensorInfo(e.outputShape,s),l=this.texData.get(a.dataId);if(e.packedOutput&&(l.isPacked=!0),e.outPackingScheme===Zi.DENSE){const x=i??dc(e.outputShape);l.texShape=x.map(b=>b*2)}if(e.outTexUsage!=null&&(l.usage=e.outTexUsage),G(a.shape)===0)return l.values=Tt(a.dtype,0),a;const c=[],u=t.map(x=>{if(x.dtype==="complex64")throw new Error("GPGPUProgram does not support complex64 input. For complex64 dtypes, please separate the program into real and imaginary parts.");let b=this.texData.get(x.dataId);if(b.texture==null){if(!e.packedInputs&&G(x.shape)<=V().getNumber("WEBGL_SIZE_UPLOAD_UNIFORM"))return{shape:x.shape,texData:null,isUniform:!0,uniformValues:b.values};e.packedInputs&&(b.isPacked=!0,b.shape=x.shape)}if(this.uploadToGPU(x.dataId),!!b.isPacked!=!!e.packedInputs)x=b.isPacked?this.unpackTensor(x):this.packTensor(x),c.push(x),b=this.texData.get(x.dataId);else if(b.isPacked&&!xc(b.shape,x.shape)){const w=x,y=x.shape;x.shape=b.shape,x=this.packedReshape(x,y),c.push(x),b=this.texData.get(x.dataId),w.shape=y}return{shape:x.shape,texData:b,isUniform:!1}});this.uploadToGPU(a.dataId);const h={shape:a.shape,texData:l,isUniform:!1},d=gP(e,u,h),p=this.getAndSaveBinary(d,()=>fP(this.gpgpu,e,u,h)),f=this.activeTimers!=null;let m;f&&(m=this.startTimer()),V().get("ENGINE_COMPILE_ONLY")||mP(this.gpgpu,p,u,h,o),c.forEach(x=>this.disposeIntermediateTensorInfo(x)),f&&(m=this.endTimer(m),this.activeTimers.push({name:e.constructor.name,query:this.getQueryTime(m)}));const g=V().getNumber("WEBGL_FLUSH_THRESHOLD");if(g>0){const x=zt();x-this.lastGlFlushTime>g&&(this.gpgpu.gl.flush(),this.lastGlFlushTime=x)}if(!V().getBool("WEBGL_LAZILY_UNPACK")&&l.isPacked&&r===!1){const x=this.unpackTensor(a);return this.disposeIntermediateTensorInfo(a),x}return a}compileAndRun(e,t,s,o,r=!1){return s=s||t[0].dtype,this.runWebGLProgram(e,t,s,o,r)}getAndSaveBinary(e,t){return e in this.binaryCache||(this.binaryCache[e]=t()),this.binaryCache[e]}getTextureManager(){return this.textureManager}dispose(){this.disposed||(V().getBool("IS_TEST")||Object.keys(this.binaryCache).forEach(t=>{this.gpgpu.deleteProgram(this.binaryCache[t].webGLProgram),delete this.binaryCache[t]}),this.textureManager.dispose(),this.canvas!=null&&typeof HTMLCanvasElement<"u"&&this.canvas instanceof HTMLCanvasElement?this.canvas.remove():this.canvas=null,this.gpgpuCreatedLocally&&(this.gpgpu.program=null,this.gpgpu.dispose()),this.disposed=!0)}floatPrecision(){return this.floatPrecisionValue==null&&(this.floatPrecisionValue=B(()=>{if(!V().get("WEBGL_RENDER_FLOAT32_ENABLED")){const e=V().getBool("DEBUG");V().set("DEBUG",!1);const t=this.abs(De(1e-8)).dataSync()[0];if(V().set("DEBUG",e),t>0)return 32}return 16})),this.floatPrecisionValue}epsilon(){return this.floatPrecision()===32?Y3:Z3}uploadToGPU(e){const t=this.texData.get(e),{shape:s,dtype:o,values:r,texture:i,usage:a,isPacked:l}=t;if(i!=null)return;const c=this.activeTimers!=null;let u;c&&(u=zt());let h=t.texShape;if(h==null&&(h=IM(s,l),t.texShape=h),r!=null){const d=mc(s);let p,f=h[1],m=h[0];const g=r instanceof Uint8Array||r instanceof Uint8ClampedArray;(l||!g)&&([f,m]=ar(h[0],h[1])),l?p=new IP(d,g):p=new ey(d,g);const x=g?[m,f]:h,b=this.makeTensorInfo(x,o),w=this.texData.get(b.dataId);g?w.usage=rn.PIXELS:w.usage=rn.UPLOAD,w.texShape=x,this.gpgpu.uploadDenseMatrixToTexture(this.getTexture(b.dataId),f,m,r);const y=[[m,f]],I=this.runWebGLProgram(p,[b],o,y,!0),v=this.texData.get(I.dataId);t.texShape=v.texShape,t.isPacked=v.isPacked,t.usage=v.usage,V().get("ENGINE_COMPILE_ONLY")?this.disposeData(I.dataId):(t.texture=v.texture,t.values=null,this.texData.delete(I.dataId)),this.disposeIntermediateTensorInfo(b),c&&(this.uploadWaitMs+=zt()-u)}else{const d=this.acquireTexture(h,a,o,l);t.texture=d}}convertAndCacheOnCPU(e,t){const s=this.texData.get(e),{dtype:o}=s;return t!=null&&(s.values=nB(t,o)),s.values}acquireTexture(e,t,s,o){if(this.numBytesInGPU+=this.computeBytes(e,s),!this.warnedAboutMemory&&this.numBytesInGPU>this.numMBBeforeWarning*1024*1024){const r=(this.numBytesInGPU/1024/1024).toFixed(2);this.warnedAboutMemory=!0,console.warn(`High memory usage in GPU: ${r} MB, most likely due to a memory leak`)}return this.textureManager.acquireTexture(e,t,o)}computeBytes(e,t){return e[0]*e[1]*la(t)}checkCompileCompletion(){for(const[,e]of Object.entries(this.binaryCache))this.checkCompletion_(e)}async checkCompileCompletionAsync(){const e=[];if(this.gpgpu.parallelCompilationExtension){for(const[,t]of Object.entries(this.binaryCache))e.push(this.checkCompletionAsync_(t));return Promise.all(e)}else{for(const[,t]of Object.entries(this.binaryCache)){const s=new Promise(o=>{try{this.checkCompletion_(t),o(!0)}catch(r){throw r}});e.push(s)}return Promise.all(e)}}async checkCompletionAsync_(e){return this.gpgpu.gl.getProgramParameter(e.webGLProgram,this.gpgpu.parallelCompilationExtension.COMPLETION_STATUS_KHR)?this.checkCompletion_(e):(await ag(),this.checkCompletionAsync_(e))}checkCompletion_(e){if(this.gpgpu.gl.getProgramParameter(e.webGLProgram,this.gpgpu.gl.LINK_STATUS)===!1)throw console.log(this.gpgpu.gl.getProgramInfoLog(e.webGLProgram)),this.gpgpu.gl.getShaderParameter(e.fragmentShader,this.gpgpu.gl.COMPILE_STATUS)===!1?(G1(e.source,this.gpgpu.gl.getShaderInfoLog(e.fragmentShader)),new Error("Failed to compile fragment shader.")):new Error("Failed to link vertex and fragment shaders.");return!0}getUniformLocations(){for(const e of Object.values(this.binaryCache)){this.gpgpu.buildVao(e.webGLProgram);const{variablesLocations:t,customUniformLocations:s,infLoc:o,nanLoc:r,outShapeLocation:i,outShapeStridesLocation:a,outTexShapeLocation:l}=Q1(this.gpgpu,e.program,e.webGLProgram);e.variablesLocations=t,e.customUniformLocations=s,e.infLoc=o,e.nanLoc=r,e.outShapeLocation=i,e.outShapeStridesLocation=a,e.outTexShapeLocation=l}}createTensorFromGPUData(e,t,s){e.channels=e.channels||"RGBA";const{texture:o,height:r,width:i,channels:a}=e,l=Te().backend;if(!l.gpgpu.gl.isTexture(o))throw new Error("The texture is invalid. Also, please make sure the texture and the TFJS WebGL backend are using the same canvas. If you want to use your own custom canvas, you have to create and use the custom TFJS WebGL backend created from the canvas through 'new tf.MathBackendWebGL(customCanvas)'.");const c=l.writeTexture(o,t,s,r,i,a);return Te().makeTensorFromDataId(c,t,s,l)}}wc.nextDataId=0;function nB(n,e){if(e==="float32"||e==="complex64")return n;if(e==="int32"||e==="bool"){const t=e==="int32"?new Int32Array(n.length):new Uint8Array(n.length);for(let s=0;s= ${this.outputShape[0]} ? 0. : result.y; result.z = 0.; result.w = 0.; - `;else{const l=Bt("coords",r);this.enableShapeUniforms?i+=` + `;else{const l=Pt("coords",r);this.enableShapeUniforms?i+=` bool nextRowOutOfBounds = (${l[r-2]} + 1) >= outShape[${r} - 2]; bool nextColOutOfBounds = @@ -12788,7 +12788,7 @@ vec2 packedUVfrom3D(int texNumR, int texNumC, * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function en(n){const{inputs:e,backend:t}=n,{x:s}=e;return t.incRef(s.dataId),{dataId:s.dataId,shape:s.shape,dtype:s.dtype}}const oB={kernelName:zr,backendName:"webgl",kernelFunc:en};/** + */function en(n){const{inputs:e,backend:t}=n,{x:s}=e;return t.incRef(s.dataId),{dataId:s.dataId,shape:s.shape,dtype:s.dtype}}const sB={kernelName:zr,backendName:"webgl",kernelFunc:en};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -12803,7 +12803,7 @@ vec2 packedUVfrom3D(int texNumR, int texNumC, * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function Ps(n){const{inputs:e,backend:t}=n,{real:s,imag:o}=e,r=t.makeTensorInfo(s.shape,"complex64"),i=t.texData.get(r.dataId),a=en({inputs:{x:s},backend:t}),l=en({inputs:{x:o},backend:t});return i.complexTensorInfos={real:a,imag:l},r}const rB={kernelName:Jc,backendName:"webgl",kernelFunc:Ps};/** + */function Ps(n){const{inputs:e,backend:t}=n,{real:s,imag:o}=e,r=t.makeTensorInfo(s.shape,"complex64"),i=t.texData.get(r.dataId),a=en({inputs:{x:s},backend:t}),l=en({inputs:{x:o},backend:t});return i.complexTensorInfos={real:a,imag:l},r}const oB={kernelName:Zc,backendName:"webgl",kernelFunc:Ps};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -12821,7 +12821,7 @@ vec2 packedUVfrom3D(int texNumR, int texNumC, */const my="return (a < 0.) ? b * a : a;",gy=` vec4 aLessThanZero = vec4(lessThan(a, vec4(0.))); return (aLessThanZero * (b * a)) + ((vec4(1.0) - aLessThanZero) * a); -`;function iB(n){const{inputs:e,backend:t,attrs:s}=n,{x:o}=e,{alpha:r}=s,i=t.makeTensorInfo([],"float32",xs(r,"float32")),a=V().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new fr(gy,o.shape,i.shape):new So(my,o.shape,i.shape),l=t.runWebGLProgram(a,[o,i],"float32");return t.disposeIntermediateTensorInfo(i),l}const aB={kernelName:Ea,backendName:"webgl",kernelFunc:iB};/** +`;function rB(n){const{inputs:e,backend:t,attrs:s}=n,{x:o}=e,{alpha:r}=s,i=t.makeTensorInfo([],"float32",xs(r,"float32")),a=V().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new fr(gy,o.shape,i.shape):new So(my,o.shape,i.shape),l=t.runWebGLProgram(a,[o,i],"float32");return t.disposeIntermediateTensorInfo(i),l}const iB={kernelName:Ea,backendName:"webgl",kernelFunc:rB};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -12839,7 +12839,7 @@ vec2 packedUVfrom3D(int texNumR, int texNumC, */const xy="return (a < 0.) ? b * a : a;",by=` vec4 aLessThanZero = vec4(lessThan(a, vec4(0.))); return (aLessThanZero * (b * a)) + ((vec4(1.0) - aLessThanZero) * a); -`;function lB(n){const{inputs:e,backend:t}=n,{x:s,alpha:o}=e,r=V().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new fr(by,s.shape,o.shape):new So(xy,s.shape,o.shape);return t.runWebGLProgram(r,[s,o],"float32")}const cB={kernelName:Ka,backendName:"webgl",kernelFunc:lB};/** +`;function aB(n){const{inputs:e,backend:t}=n,{x:s,alpha:o}=e,r=V().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new fr(by,s.shape,o.shape):new So(xy,s.shape,o.shape);return t.runWebGLProgram(r,[s,o],"float32")}const lB={kernelName:Ka,backendName:"webgl",kernelFunc:aB};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -12854,7 +12854,7 @@ vec2 packedUVfrom3D(int texNumR, int texNumC, * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const mr="if (isnan(x)) return x;";function Re({opSnippet:n,packedOpSnippet:e,cpuKernelImpl:t,dtype:s}){return({inputs:o,backend:r})=>{const{x:i}=o,a=r,l=s||i.dtype;if(a.shouldExecuteOnCPU([i])&&t!=null){const h=a.texData.get(i.dataId),d=t(h.values,l);return a.makeTensorInfo(i.shape,l,d)}const c=V().getBool("WEBGL_PACK_UNARY_OPERATIONS")&&e!=null;let u;return c?u=new Ms(i.shape,e):u=new ts(i.shape,n),a.runWebGLProgram(u,[i],l)}}function vt({opSnippet:n,packedOpSnippet:e,checkOutOfBounds:t=!1,supportsComplex:s=!1,cpuKernelImpl:o,dtype:r}){return({inputs:i,backend:a})=>{const{a:l,b:c}=i,u=a;if(s&&l.dtype==="complex64"){const f=u.texData.get(l.dataId),m=u.texData.get(c.dataId),[g,x]=[[f.complexTensorInfos.real,m.complexTensorInfos.real],[f.complexTensorInfos.imag,m.complexTensorInfos.imag]].map(w=>{const[y,C]=w,I={dataId:y.dataId,dtype:y.dtype,shape:l.shape},$={dataId:C.dataId,dtype:C.dtype,shape:c.shape},k=new So(n,l.shape,c.shape);return u.runWebGLProgram(k,[I,$],Yt(y.dtype,C.dtype))}),b=Ps({inputs:{real:g,imag:x},backend:u});return u.disposeIntermediateTensorInfo(g),u.disposeIntermediateTensorInfo(x),b}const h=r||Yt(l.dtype,c.dtype);if((l.dtype==="string"||c.dtype==="string"||u.shouldExecuteOnCPU([l,c]))&&o!=null){const f=u.texData.get(l.dataId).values,m=u.texData.get(c.dataId).values,g=l.dtype==="string"?us(f):f,x=l.dtype==="string"?us(m):m,[b,w]=o(l.shape,c.shape,g,x,h),y=u.makeTensorInfo(w,h),C=u.texData.get(y.dataId);return C.values=b,y}const d=V().getBool("WEBGL_PACK_BINARY_OPERATIONS")&&e!=null;let p;return d?p=new fr(e,l.shape,c.shape,t):p=new So(n,l.shape,c.shape),u.runWebGLProgram(p,[l,c],h)}}function ta(n,e=!1){if(n==="linear")return e?G3:B3;if(n==="relu")return e?q3:V3;if(n==="elu")return e?H3:z3;if(n==="relu6")return e?j3:W3;if(n==="prelu")return e?by:xy;if(n==="leakyrelu")return e?gy:my;if(n==="sigmoid")return e?K3:U3;throw new Error(`Activation ${n} has not been implemented for the WebGL backend.`)}/** + */const mr="if (isnan(x)) return x;";function Re({opSnippet:n,packedOpSnippet:e,cpuKernelImpl:t,dtype:s}){return({inputs:o,backend:r})=>{const{x:i}=o,a=r,l=s||i.dtype;if(a.shouldExecuteOnCPU([i])&&t!=null){const h=a.texData.get(i.dataId),d=t(h.values,l);return a.makeTensorInfo(i.shape,l,d)}const c=V().getBool("WEBGL_PACK_UNARY_OPERATIONS")&&e!=null;let u;return c?u=new Ms(i.shape,e):u=new ts(i.shape,n),a.runWebGLProgram(u,[i],l)}}function vt({opSnippet:n,packedOpSnippet:e,checkOutOfBounds:t=!1,supportsComplex:s=!1,cpuKernelImpl:o,dtype:r}){return({inputs:i,backend:a})=>{const{a:l,b:c}=i,u=a;if(s&&l.dtype==="complex64"){const f=u.texData.get(l.dataId),m=u.texData.get(c.dataId),[g,x]=[[f.complexTensorInfos.real,m.complexTensorInfos.real],[f.complexTensorInfos.imag,m.complexTensorInfos.imag]].map(w=>{const[y,C]=w,I={dataId:y.dataId,dtype:y.dtype,shape:l.shape},v={dataId:C.dataId,dtype:C.dtype,shape:c.shape},$=new So(n,l.shape,c.shape);return u.runWebGLProgram($,[I,v],Yt(y.dtype,C.dtype))}),b=Ps({inputs:{real:g,imag:x},backend:u});return u.disposeIntermediateTensorInfo(g),u.disposeIntermediateTensorInfo(x),b}const h=r||Yt(l.dtype,c.dtype);if((l.dtype==="string"||c.dtype==="string"||u.shouldExecuteOnCPU([l,c]))&&o!=null){const f=u.texData.get(l.dataId).values,m=u.texData.get(c.dataId).values,g=l.dtype==="string"?us(f):f,x=l.dtype==="string"?us(m):m,[b,w]=o(l.shape,c.shape,g,x,h),y=u.makeTensorInfo(w,h),C=u.texData.get(y.dataId);return C.values=b,y}const d=V().getBool("WEBGL_PACK_BINARY_OPERATIONS")&&e!=null;let p;return d?p=new fr(e,l.shape,c.shape,t):p=new So(n,l.shape,c.shape),u.runWebGLProgram(p,[l,c],h)}}function ta(n,e=!1){if(n==="linear")return e?U3:P3;if(n==="relu")return e?H3:z3;if(n==="elu")return e?G3:B3;if(n==="relu6")return e?q3:V3;if(n==="prelu")return e?by:xy;if(n==="leakyrelu")return e?gy:my;if(n==="sigmoid")return e?j3:W3;throw new Error(`Activation ${n} has not been implemented for the WebGL backend.`)}/** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -12869,7 +12869,7 @@ vec2 packedUVfrom3D(int texNumR, int texNumC, * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */class yy{constructor(e,t,s,o=!1,r=!1,i=!1,a=null,l=!1,c=!1){this.variableNames=["matrixA","matrixB"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=s,this.enableShapeUniforms=Ft(this.outputShape.length);const u=o?e[1]:e[2],h=Math.ceil(u/2),d=o?"i * 2, rc.y":"rc.y, i * 2",p=r?"rc.z, i * 2":"i * 2, rc.z",f=o?["a.xxyy","a.zzww"]:["a.xxzz","a.yyww"],m=r?["b.xzxz","b.ywyw"]:["b.xyxy","b.zwzw"];let g="",x="";a&&(l?g=`vec4 activation(vec4 a) { + */class yy{constructor(e,t,s,o=!1,r=!1,i=!1,a=null,l=!1,c=!1){this.variableNames=["matrixA","matrixB"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=s,this.enableShapeUniforms=Dt(this.outputShape.length);const u=o?e[1]:e[2],h=Math.ceil(u/2),d=o?"i * 2, rc.y":"rc.y, i * 2",p=r?"rc.z, i * 2":"i * 2, rc.z",f=o?["a.xxyy","a.zzww"]:["a.xxzz","a.yyww"],m=r?["b.xzxz","b.ywyw"]:["b.xyxy","b.zwzw"];let g="",x="";a&&(l?g=`vec4 activation(vec4 a) { vec4 b = getPreluActivationWeightsAtOutCoords(); ${a} }`:c?g=`vec4 activation(vec4 a) { @@ -12951,7 +12951,7 @@ vec2 packedUVfrom3D(int texNumR, int texNumC, * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const Iy="return a * b;";function Ip(n){const{inputs:e,backend:t}=n,{a:s,b:o}=e,r=Yt(s.dtype,o.dtype);if(s.dtype==="complex64"){const a=t.texData.get(s.dataId),l=t.texData.get(o.dataId),c=new Cy(wy.REAL,s.shape,o.shape),u=new Cy(wy.IMAG,s.shape,o.shape),h=[{dataId:a.complexTensorInfos.real.dataId,dtype:a.complexTensorInfos.real.dtype,shape:s.shape},{dataId:a.complexTensorInfos.imag.dataId,dtype:a.complexTensorInfos.imag.dtype,shape:s.shape},{dataId:l.complexTensorInfos.real.dataId,dtype:l.complexTensorInfos.real.dtype,shape:o.shape},{dataId:l.complexTensorInfos.imag.dataId,dtype:l.complexTensorInfos.imag.dtype,shape:o.shape}],d=t.runWebGLProgram(c,h,"float32"),p=t.runWebGLProgram(u,h,"float32"),f=Ps({inputs:{real:d,imag:p},backend:t});return t.disposeIntermediateTensorInfo(d),t.disposeIntermediateTensorInfo(p),f}if(t.shouldExecuteOnCPU([s,o])){const a=t.texData.get(s.dataId),l=t.texData.get(o.dataId),[c,u]=l3(s.shape,o.shape,a.values,l.values,r),h=t.makeTensorInfo(u,r),d=t.texData.get(h.dataId);return d.values=c,h}let i;return V().getBool("WEBGL_PACK_BINARY_OPERATIONS")?i=new fr(Iy,s.shape,o.shape):i=new So(Iy,s.shape,o.shape),t.runWebGLProgram(i,[s,o],r)}const uB={kernelName:Xr,backendName:"webgl",kernelFunc:Ip};/** + */const Iy="return a * b;";function wp(n){const{inputs:e,backend:t}=n,{a:s,b:o}=e,r=Yt(s.dtype,o.dtype);if(s.dtype==="complex64"){const a=t.texData.get(s.dataId),l=t.texData.get(o.dataId),c=new Cy(wy.REAL,s.shape,o.shape),u=new Cy(wy.IMAG,s.shape,o.shape),h=[{dataId:a.complexTensorInfos.real.dataId,dtype:a.complexTensorInfos.real.dtype,shape:s.shape},{dataId:a.complexTensorInfos.imag.dataId,dtype:a.complexTensorInfos.imag.dtype,shape:s.shape},{dataId:l.complexTensorInfos.real.dataId,dtype:l.complexTensorInfos.real.dtype,shape:o.shape},{dataId:l.complexTensorInfos.imag.dataId,dtype:l.complexTensorInfos.imag.dtype,shape:o.shape}],d=t.runWebGLProgram(c,h,"float32"),p=t.runWebGLProgram(u,h,"float32"),f=Ps({inputs:{real:d,imag:p},backend:t});return t.disposeIntermediateTensorInfo(d),t.disposeIntermediateTensorInfo(p),f}if(t.shouldExecuteOnCPU([s,o])){const a=t.texData.get(s.dataId),l=t.texData.get(o.dataId),[c,u]=a3(s.shape,o.shape,a.values,l.values,r),h=t.makeTensorInfo(u,r),d=t.texData.get(h.dataId);return d.values=c,h}let i;return V().getBool("WEBGL_PACK_BINARY_OPERATIONS")?i=new fr(Iy,s.shape,o.shape):i=new So(Iy,s.shape,o.shape),t.runWebGLProgram(i,[s,o],r)}const cB={kernelName:Xr,backendName:"webgl",kernelFunc:wp};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -12966,7 +12966,7 @@ vec2 packedUVfrom3D(int texNumR, int texNumC, * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function hB(n,e,t){const s=[lr(n.shape),...cr(n.shape)],o={dtype:n.dtype,shape:s,dataId:n.dataId},r=[lr(e),...cr(e)],i=new uy(r,s),a=!0,l=[s],c=t.runWebGLProgram(i,[o],n.dtype,l,a);return{dataId:c.dataId,shape:e,dtype:c.dtype}}/** + */function uB(n,e,t){const s=[lr(n.shape),...cr(n.shape)],o={dtype:n.dtype,shape:s,dataId:n.dataId},r=[lr(e),...cr(e)],i=new uy(r,s),a=!0,l=[s],c=t.runWebGLProgram(i,[o],n.dtype,l,a);return{dataId:c.dataId,shape:e,dtype:c.dtype}}/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -12981,7 +12981,7 @@ vec2 packedUVfrom3D(int texNumR, int texNumC, * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function te(n){const{inputs:e,backend:t,attrs:s}=n,{x:o}=e,{shape:r}=s,i=t,a=G(o.shape),l=Bp(r,a),c=G(l);v(a===c,()=>`The new shape (${l}) has ${c} elements and the old shape (${o.shape}) has ${a} elements. The new shape and old shape must have the same number of elements.`);const u=i.texData.get(o.dataId);return u.isPacked&&!xc(o.shape,l)&&!(u.texture!==null&&xc(u.shape,l))?hB(o,l,i):(i.incRef(o.dataId),{dataId:o.dataId,shape:l,dtype:o.dtype})}const dB={kernelName:Ya,backendName:"webgl",kernelFunc:te};/** + */function te(n){const{inputs:e,backend:t,attrs:s}=n,{x:o}=e,{shape:r}=s,i=t,a=G(o.shape),l=Bp(r,a),c=G(l);k(a===c,()=>`The new shape (${l}) has ${c} elements and the old shape (${o.shape}) has ${a} elements. The new shape and old shape must have the same number of elements.`);const u=i.texData.get(o.dataId);return u.isPacked&&!xc(o.shape,l)&&!(u.texture!==null&&xc(u.shape,l))?uB(o,l,i):(i.incRef(o.dataId),{dataId:o.dataId,shape:l,dtype:o.dtype})}const hB={kernelName:Ya,backendName:"webgl",kernelFunc:te};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -13064,7 +13064,7 @@ vec2 packedUVfrom3D(int texNumR, int texNumC, * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */class pB{constructor(e,t){this.variableNames=["x"];const{windowSize:s,batchSize:o,inSize:r,outSize:i}=e;this.outputShape=[o,i];let a="0.0",l="";t==="prod"?a="1.0":t==="min"?(a="1.0 / 1e-20",l="min"):t==="max"&&(a="-1.0 / 1e-20",l="max");let c=`${t}(${t}(${t}(minMaxValue[0], minMaxValue[1]), minMaxValue[2]), minMaxValue[3])`;t==="sum"?c="sumValue":t==="prod"?c="prodValue":t==="all"?c="allValue":t==="any"&&(c="anyValue");const u=Math.floor(s/4)*4,h=s%4;let d=` + */class dB{constructor(e,t){this.variableNames=["x"];const{windowSize:s,batchSize:o,inSize:r,outSize:i}=e;this.outputShape=[o,i];let a="0.0",l="";t==="prod"?a="1.0":t==="min"?(a="1.0 / 1e-20",l="min"):t==="max"&&(a="-1.0 / 1e-20",l="max");let c=`${t}(${t}(${t}(minMaxValue[0], minMaxValue[1]), minMaxValue[2]), minMaxValue[3])`;t==="sum"?c="sumValue":t==="prod"?c="prodValue":t==="all"?c="allValue":t==="any"&&(c="anyValue");const u=Math.floor(s/4)*4,h=s%4;let d=` if (${t==="sum"}) { sumValue += dot(values, ones); } else if (${t==="prod"}) { @@ -13171,7 +13171,7 @@ vec2 packedUVfrom3D(int texNumR, int texNumC, * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function fB(n){const e=[];for(;e.length===0||e[e.length-1].outSize!==1;){const t=e.length?e[e.length-1].outSize:n[1],s=Al(t);e.push({inSize:t,windowSize:s,outSize:Math.ceil(t/s)})}return e}function No(n,e,t,s){const o=fB(n.shape);let r=n;for(let i=0;i6)throw Error(`Transpose for rank ${e} is not yet supported`);const t=["resRC.x","resRC.y","resRC.z","resRC.w","resRC.u","resRC.v"],s=new Array(e);for(let o=0;o6)throw Error(`Transpose for rank ${e} is not yet supported`);const t=["resRC.x","resRC.y","resRC.z","resRC.w","resRC.u","resRC.v"],s=new Array(e);for(let o=0;o6)throw Error(`Packed transpose for rank ${this.rank} is not yet supported.`);const o=Me(this.rank),r=cy("rc",this.rank),i=new Array(this.rank);for(let u=0;u6)throw Error(`Packed transpose for rank ${this.rank} is not yet supported.`);const o=Me(this.rank),r=cy("rc",this.rank),i=new Array(this.rank);for(let u=0;u`Error in matMul: inner shapes (${h}) and (${d}) of Tensors with shapes ${n.shape} and ${e.shape} and transposeA=${t} and transposeB=${s} must match.`);const C=t?[x,h,p]:[x,p,h],I=s?[b,f,d]:[b,d,f],$=te({inputs:{x:n},backend:o,attrs:{shape:C}}),k=te({inputs:{x:e},backend:o,attrs:{shape:I}}),S=[$,k],N=Math.max(x,b),A=t?$.shape[1]:$.shape[2],_=r!=null,E=i!=null,M=l==="leakyrelu",z=l!=null?ta(l,!0):null,P=_||E||M||z!=null;let H;if((p===1||f===1)&&A>ky&&P===!1){let q=$,K=k;t&&(q=zt({inputs:{x:$},backend:o,attrs:{perm:[0,2,1]}}),S.push(q)),s&&(K=zt({inputs:{x:k},backend:o,attrs:{perm:[0,2,1]}}),S.push(K));const j=f!==1,Y=f===1;let X=q;j&&(X=te({inputs:{x:q},backend:o,attrs:{shape:[N,A,1]}}),S.push(X));const ee=f===1?2:1;let Q=K;Y&&(Q=te({inputs:{x:K},backend:o,attrs:{shape:[N,1,A]}}),S.push(Q));const ne=Ip({inputs:{a:X,b:Q},backend:o});H=Ic({inputs:{x:ne},backend:o,attrs:{axis:ee,keepDims:!0}}),S.push(ne)}else{const q=Yt(n.dtype,e.dtype),K=new yy(C,I,[N,p,f],t,s,_,z,E,M),j=[$,k];if(r!=null&&j.push(r),E&&j.push(i),M){const Y=o.makeTensorInfo([],"float32",xs(a,"float32"));j.push(Y),S.push(Y)}H=o.runWebGLProgram(K,j,q)}const W=te({inputs:{x:H},backend:o,attrs:{shape:y}});S.push(H);for(const q of S)o.disposeIntermediateTensorInfo(q);return W}/** + */const ky=1e3;function $c({a:n,b:e,transposeA:t,transposeB:s,backend:o,bias:r=null,preluActivationWeights:i=null,leakyreluAlpha:a=0,activation:l=null}){const c=n.shape.length,u=e.shape.length,h=t?n.shape[c-2]:n.shape[c-1],d=s?e.shape[u-1]:e.shape[u-2],p=t?n.shape[c-1]:n.shape[c-2],f=s?e.shape[u-2]:e.shape[u-1],m=n.shape.slice(0,-2),g=e.shape.slice(0,-2),x=G(m),b=G(g),y=Ce(n.shape.slice(0,-2),e.shape.slice(0,-2)).concat([p,f]);k(h===d,()=>`Error in matMul: inner shapes (${h}) and (${d}) of Tensors with shapes ${n.shape} and ${e.shape} and transposeA=${t} and transposeB=${s} must match.`);const C=t?[x,h,p]:[x,p,h],I=s?[b,f,d]:[b,d,f],v=te({inputs:{x:n},backend:o,attrs:{shape:C}}),$=te({inputs:{x:e},backend:o,attrs:{shape:I}}),S=[v,$],N=Math.max(x,b),A=t?v.shape[1]:v.shape[2],_=r!=null,E=i!=null,M=l==="leakyrelu",z=l!=null?ta(l,!0):null,P=_||E||M||z!=null;let H;if((p===1||f===1)&&A>ky&&P===!1){let q=v,K=$;t&&(q=Bt({inputs:{x:v},backend:o,attrs:{perm:[0,2,1]}}),S.push(q)),s&&(K=Bt({inputs:{x:$},backend:o,attrs:{perm:[0,2,1]}}),S.push(K));const j=f!==1,Y=f===1;let X=q;j&&(X=te({inputs:{x:q},backend:o,attrs:{shape:[N,A,1]}}),S.push(X));const ee=f===1?2:1;let Q=K;Y&&(Q=te({inputs:{x:K},backend:o,attrs:{shape:[N,1,A]}}),S.push(Q));const ne=wp({inputs:{a:X,b:Q},backend:o});H=Ic({inputs:{x:ne},backend:o,attrs:{axis:ee,keepDims:!0}}),S.push(ne)}else{const q=Yt(n.dtype,e.dtype),K=new yy(C,I,[N,p,f],t,s,_,z,E,M),j=[v,$];if(r!=null&&j.push(r),E&&j.push(i),M){const Y=o.makeTensorInfo([],"float32",xs(a,"float32"));j.push(Y),S.push(Y)}H=o.runWebGLProgram(K,j,q)}const W=te({inputs:{x:H},backend:o,attrs:{shape:y}});S.push(H);for(const q of S)o.disposeIntermediateTensorInfo(q);return W}/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the License); @@ -13313,7 +13313,7 @@ vec2 packedUVfrom3D(int texNumR, int texNumC, * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function CB(n){const{inputs:e,backend:t,attrs:s}=n,{a:o,b:r,bias:i,preluActivationWeights:a}=e,{transposeA:l,transposeB:c,activation:u,leakyreluAlpha:h}=s;return $c({a:o,b:r,transposeA:l,transposeB:c,backend:t,bias:i,preluActivationWeights:a,leakyreluAlpha:h,activation:u})}const IB={kernelName:cl,backendName:"webgl",kernelFunc:CB};/** + */function wB(n){const{inputs:e,backend:t,attrs:s}=n,{a:o,b:r,bias:i,preluActivationWeights:a}=e,{transposeA:l,transposeB:c,activation:u,leakyreluAlpha:h}=s;return $c({a:o,b:r,transposeA:l,transposeB:c,backend:t,bias:i,preluActivationWeights:a,leakyreluAlpha:h,activation:u})}const CB={kernelName:cl,backendName:"webgl",kernelFunc:wB};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -13328,7 +13328,7 @@ vec2 packedUVfrom3D(int texNumR, int texNumC, * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const vy="return abs(x);";function $B(n){const{inputs:e,backend:t}=n,{x:s}=e;if(t.shouldExecuteOnCPU([s])&&s.dtype!=="complex64"){const r=t.texData.get(s.dataId),i=ay(r.values);return t.makeTensorInfo(s.shape,s.dtype,i)}let o;return V().getBool("WEBGL_PACK_UNARY_OPERATIONS")?o=new Ms(s.shape,vy):o=new ts(s.shape,vy),t.runWebGLProgram(o,[s],s.dtype)}const kB={kernelName:ca,backendName:"webgl",kernelFunc:$B};/** + */const vy="return abs(x);";function IB(n){const{inputs:e,backend:t}=n,{x:s}=e;if(t.shouldExecuteOnCPU([s])&&s.dtype!=="complex64"){const r=t.texData.get(s.dataId),i=ay(r.values);return t.makeTensorInfo(s.shape,s.dtype,i)}let o;return V().getBool("WEBGL_PACK_UNARY_OPERATIONS")?o=new Ms(s.shape,vy):o=new ts(s.shape,vy),t.runWebGLProgram(o,[s],s.dtype)}const $B={kernelName:ca,backendName:"webgl",kernelFunc:IB};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -13343,12 +13343,12 @@ vec2 packedUVfrom3D(int texNumR, int texNumC, * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const vB=In+` + */const kB=In+` if (abs(x) > 1.) { return NAN; } return acos(x); -`,SB=Re({opSnippet:vB}),TB={kernelName:wr,backendName:"webgl",kernelFunc:SB};/** +`,vB=Re({opSnippet:kB}),SB={kernelName:wr,backendName:"webgl",kernelFunc:vB};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -13363,9 +13363,9 @@ vec2 packedUVfrom3D(int texNumR, int texNumC, * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const NB=In+` + */const TB=In+` if (x < 1.0) return NAN; -return log(x + sqrt(x * x - 1.0));`,EB=Re({opSnippet:NB}),RB={kernelName:Cr,backendName:"webgl",kernelFunc:EB};/** +return log(x + sqrt(x * x - 1.0));`,NB=Re({opSnippet:TB}),EB={kernelName:Cr,backendName:"webgl",kernelFunc:NB};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -13380,7 +13380,7 @@ return log(x + sqrt(x * x - 1.0));`,EB=Re({opSnippet:NB}),RB={kernelName:Cr,back * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const Sy="return a + b;",AB=vt({opSnippet:Sy,packedOpSnippet:Sy,supportsComplex:!0,cpuKernelImpl:VP}),DB={kernelName:Lo,backendName:"webgl",kernelFunc:AB};/** + */const Sy="return a + b;",RB=vt({opSnippet:Sy,packedOpSnippet:Sy,supportsComplex:!0,cpuKernelImpl:zP}),AB={kernelName:Lo,backendName:"webgl",kernelFunc:RB};/** * @license * Copyright 2019 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -13395,7 +13395,7 @@ return log(x + sqrt(x * x - 1.0));`,EB=Re({opSnippet:NB}),RB={kernelName:Cr,back * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */class FB{constructor(e,t){this.outputShape=[],this.outputShape=e,this.variableNames=t.map((r,i)=>`T${i}`);const s=[];this.variableNames.forEach(r=>{s.push(`float v${r} = get${r}AtOutCoords();`)});const o=this.variableNames.map(r=>`v${r}`).join(" + ");this.userCode=` + */class DB{constructor(e,t){this.outputShape=[],this.outputShape=e,this.variableNames=t.map((r,i)=>`T${i}`);const s=[];this.variableNames.forEach(r=>{s.push(`float v${r} = get${r}AtOutCoords();`)});const o=this.variableNames.map(r=>`v${r}`).join(" + ");this.userCode=` void main() { ${s.join(` `)} @@ -13418,7 +13418,7 @@ return log(x + sqrt(x * x - 1.0));`,EB=Re({opSnippet:NB}),RB={kernelName:Cr,back * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */class _B{constructor(e,t){this.outputShape=[],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=e,this.variableNames=t.map((r,i)=>`T${i}`);const s=[];this.variableNames.forEach(r=>{s.push(`vec4 v${r} = get${r}AtOutCoords();`)});const o=this.variableNames.map(r=>`v${r}`).join(" + ");this.userCode=` + */class FB{constructor(e,t){this.outputShape=[],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=e,this.variableNames=t.map((r,i)=>`T${i}`);const s=[];this.variableNames.forEach(r=>{s.push(`vec4 v${r} = get${r}AtOutCoords();`)});const o=this.variableNames.map(r=>`v${r}`).join(" + ");this.userCode=` void main() { ${s.join(` `)} @@ -13441,7 +13441,7 @@ return log(x + sqrt(x * x - 1.0));`,EB=Re({opSnippet:NB}),RB={kernelName:Cr,back * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function kc(n){const{inputs:e,backend:t}=n,s=e;if(s.length===1)return en({inputs:{x:s[0]},backend:t});if(s.length>V().getNumber("WEBGL_MAX_TEXTURES_IN_SHADER")){const l=Math.floor(s.length/2),c=kc({inputs:s.slice(0,l),backend:t}),u=kc({inputs:s.slice(l),backend:t});return kc({inputs:[c,u],backend:t})}const o=s.map(l=>l.dtype).reduce((l,c)=>Yt(l,c)),r=s.map(l=>l.shape),a=V().getBool("WEBGL_PACK")?new _B(s[0].shape,r):new FB(s[0].shape,r);return t.runWebGLProgram(a,s,o)}const OB={kernelName:qc,backendName:"webgl",kernelFunc:kc};/** + */function kc(n){const{inputs:e,backend:t}=n,s=e;if(s.length===1)return en({inputs:{x:s[0]},backend:t});if(s.length>V().getNumber("WEBGL_MAX_TEXTURES_IN_SHADER")){const l=Math.floor(s.length/2),c=kc({inputs:s.slice(0,l),backend:t}),u=kc({inputs:s.slice(l),backend:t});return kc({inputs:[c,u],backend:t})}const o=s.map(l=>l.dtype).reduce((l,c)=>Yt(l,c)),r=s.map(l=>l.shape),a=V().getBool("WEBGL_PACK")?new FB(s[0].shape,r):new DB(s[0].shape,r);return t.runWebGLProgram(a,s,o)}const _B={kernelName:Gc,backendName:"webgl",kernelFunc:kc};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -13456,7 +13456,7 @@ return log(x + sqrt(x * x - 1.0));`,EB=Re({opSnippet:NB}),RB={kernelName:Cr,back * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function LB(n){const{inputs:e,backend:t,attrs:s}=n,{x:o}=e,{axis:r,keepDims:i}=s,a=o.shape.length,l=$e(r,o.shape);let c=l;const u=Ze(c,a);let h=o;u!=null&&(h=zt({inputs:{x:o},backend:t,attrs:{perm:u}}),c=nt(c.length,a)),$t("all",c,a);const[d,p]=bt(h.shape,c),f=G(p),m=te({inputs:{x:h},backend:t,attrs:{shape:[-1,f]}}),g=No(m,m.dtype,"all",t);let x;if(i){const b=at(d,l);x=te({inputs:{x:g},backend:t,attrs:{shape:b}})}else x=te({inputs:{x:g},backend:t,attrs:{shape:d}});return t.disposeIntermediateTensorInfo(m),t.disposeIntermediateTensorInfo(g),u!=null&&t.disposeIntermediateTensorInfo(h),x}const MB={kernelName:jc,backendName:"webgl",kernelFunc:LB};/** + */function OB(n){const{inputs:e,backend:t,attrs:s}=n,{x:o}=e,{axis:r,keepDims:i}=s,a=o.shape.length,l=$e(r,o.shape);let c=l;const u=Ze(c,a);let h=o;u!=null&&(h=Bt({inputs:{x:o},backend:t,attrs:{perm:u}}),c=nt(c.length,a)),$t("all",c,a);const[d,p]=bt(h.shape,c),f=G(p),m=te({inputs:{x:h},backend:t,attrs:{shape:[-1,f]}}),g=No(m,m.dtype,"all",t);let x;if(i){const b=at(d,l);x=te({inputs:{x:g},backend:t,attrs:{shape:b}})}else x=te({inputs:{x:g},backend:t,attrs:{shape:d}});return t.disposeIntermediateTensorInfo(m),t.disposeIntermediateTensorInfo(g),u!=null&&t.disposeIntermediateTensorInfo(h),x}const LB={kernelName:Hc,backendName:"webgl",kernelFunc:OB};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -13471,7 +13471,7 @@ return log(x + sqrt(x * x - 1.0));`,EB=Re({opSnippet:NB}),RB={kernelName:Cr,back * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function PB(n){const{inputs:e,backend:t,attrs:s}=n,{x:o}=e,{axis:r,keepDims:i}=s,a=o.shape.length,l=$e(r,o.shape);let c=l;const u=Ze(c,a);let h=o;u!=null&&(h=zt({inputs:{x:o},backend:t,attrs:{perm:u}}),c=nt(c.length,a)),$t("any",c,a);const[d,p]=bt(h.shape,c),f=G(p),m=te({inputs:{x:h},backend:t,attrs:{shape:[-1,f]}}),g=No(m,m.dtype,"any",t);let x;if(i){const b=at(d,l);x=te({inputs:{x:g},backend:t,attrs:{shape:b}})}else x=te({inputs:{x:g},backend:t,attrs:{shape:d}});return t.disposeIntermediateTensorInfo(m),t.disposeIntermediateTensorInfo(g),u!=null&&t.disposeIntermediateTensorInfo(h),x}const BB={kernelName:Kc,backendName:"webgl",kernelFunc:PB};/** + */function MB(n){const{inputs:e,backend:t,attrs:s}=n,{x:o}=e,{axis:r,keepDims:i}=s,a=o.shape.length,l=$e(r,o.shape);let c=l;const u=Ze(c,a);let h=o;u!=null&&(h=Bt({inputs:{x:o},backend:t,attrs:{perm:u}}),c=nt(c.length,a)),$t("any",c,a);const[d,p]=bt(h.shape,c),f=G(p),m=te({inputs:{x:h},backend:t,attrs:{shape:[-1,f]}}),g=No(m,m.dtype,"any",t);let x;if(i){const b=at(d,l);x=te({inputs:{x:g},backend:t,attrs:{shape:b}})}else x=te({inputs:{x:g},backend:t,attrs:{shape:d}});return t.disposeIntermediateTensorInfo(m),t.disposeIntermediateTensorInfo(g),u!=null&&t.disposeIntermediateTensorInfo(h),x}const PB={kernelName:qc,backendName:"webgl",kernelFunc:MB};/** * @license * Copyright 2017 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -13486,7 +13486,7 @@ return log(x + sqrt(x * x - 1.0));`,EB=Re({opSnippet:NB}),RB={kernelName:Cr,back * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */class zB{constructor(e,t,s){this.variableNames=["A"];const{windowSize:o,batchSize:r,outSize:i}=e;s||this.variableNames.push("bestIndicesA"),this.outputShape=[r,i];const a=t==="max"?">":"<",l=s?"inOffset + i;":"round(getBestIndicesA(batch, inOffset + i));";this.userCode=` + */class BB{constructor(e,t,s){this.variableNames=["A"];const{windowSize:o,batchSize:r,outSize:i}=e;s||this.variableNames.push("bestIndicesA"),this.outputShape=[r,i];const a=t==="max"?">":"<",l=s?"inOffset + i;":"round(getBestIndicesA(batch, inOffset + i));";this.userCode=` void main() { ivec2 coords = getOutputCoords(); int batch = coords[0]; @@ -13521,14 +13521,14 @@ return log(x + sqrt(x * x - 1.0));`,EB=Re({opSnippet:NB}),RB={kernelName:Cr,back * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */class VB{constructor(e,t,s,o){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,v(e.length>2,()=>`Packed arg${s.charAt(0).toUpperCase()+s.slice(1)} supports only inputs with rank above 2.`);const r=e[e.length-1],i=Math.ceil(r/t);this.outputShape=e.slice(0,-1),i>1&&this.outputShape.push(i),o||this.variableNames.push("bestIndicesA");const a=this.outputShape,l=a.length,c=Me(l),u=Bt("coords",l);let h,d;if(i===1){d=l+1;const k=Me(d);h=` - ${k} sourceLocR = ${k}(${u.join()}, 0); + */class zB{constructor(e,t,s,o){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,k(e.length>2,()=>`Packed arg${s.charAt(0).toUpperCase()+s.slice(1)} supports only inputs with rank above 2.`);const r=e[e.length-1],i=Math.ceil(r/t);this.outputShape=e.slice(0,-1),i>1&&this.outputShape.push(i),o||this.variableNames.push("bestIndicesA");const a=this.outputShape,l=a.length,c=Me(l),u=Pt("coords",l);let h,d;if(i===1){d=l+1;const $=Me(d);h=` + ${$} sourceLocR = ${$}(${u.join()}, 0); ++${u[l-1]}; - ${k} sourceLocG = ${k}(${u.join()}, 0); + ${$} sourceLocG = ${$}(${u.join()}, 0); ++${u[l-2]}; - ${k} sourceLocA = ${k}(${u.join()}, 0); + ${$} sourceLocA = ${$}(${u.join()}, 0); --${u[l-1]}; - ${k} sourceLocB = ${k}(${u.join()}, 0); + ${$} sourceLocB = ${$}(${u.join()}, 0); --${u[l-2]};`}else d=l,h=` ${c} sourceLocR = coords; ++${u[l-1]}; @@ -13537,7 +13537,7 @@ return log(x + sqrt(x * x - 1.0));`,EB=Re({opSnippet:NB}),RB={kernelName:Cr,back ${c} sourceLocA = coords; --${u[l-1]}; ${c} sourceLocB = coords; - --${u[l-2]};`;const p=["x","y","z","w","u","v"].slice(0,d),f="."+p[d-1],m=p.map(k=>"int "+k),g=Bt("sourceLocR",d-1).concat("inIdx.r"),x=Bt("sourceLocG",d-1).concat("inIdx.g"),b=Bt("sourceLocB",d-1).concat("inIdx.b"),w=Bt("sourceLocA",d-1).concat("inIdx.a"),y=s==="max"?"greaterThan":"lessThan",C=o?"":` + --${u[l-2]};`;const p=["x","y","z","w","u","v"].slice(0,d),f="."+p[d-1],m=p.map($=>"int "+$),g=Pt("sourceLocR",d-1).concat("inIdx.r"),x=Pt("sourceLocG",d-1).concat("inIdx.g"),b=Pt("sourceLocB",d-1).concat("inIdx.b"),w=Pt("sourceLocA",d-1).concat("inIdx.a"),y=s==="max"?"greaterThan":"lessThan",C=o?"":` inIdx = round(vec4(getBestIndicesAChannel(${g.join()}), getBestIndicesAChannel(${x.join()}), getBestIndicesAChannel(${b.join()}), @@ -13545,7 +13545,7 @@ return log(x + sqrt(x * x - 1.0));`,EB=Re({opSnippet:NB}),RB={kernelName:Cr,back getAChannel(${g.join()}), hasNextCol ? getAChannel(${x.join()}) : 0., hasNextRow ? getAChannel(${b.join()}) : 0., - hasNextRow && hasNextCol ? getAChannel(${w.join()}) : 0.)`,$=o?"":` + hasNextRow && hasNextCol ? getAChannel(${w.join()}) : 0.)`,v=o?"":` float getBestIndicesAChannel(${m.join()}) { return getChannel(getBestIndicesA(${p.join()}), vec2(${p.slice(-2).join()})); @@ -13554,7 +13554,7 @@ return log(x + sqrt(x * x - 1.0));`,EB=Re({opSnippet:NB}),RB={kernelName:Cr,back return getChannel(getA(${p.join()}), vec2(${p.slice(-2).join()})); } - ${$} + ${v} void main() { ${c} coords = getOutputCoords(); bool hasNextCol = ${u[l-1]} < ${a[l-1]-1}; @@ -13598,7 +13598,7 @@ return log(x + sqrt(x * x - 1.0));`,EB=Re({opSnippet:NB}),RB={kernelName:Cr,back * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function Ty(n,e,t,s=null){let o=e.shape[0],r=e.shape[1];s!=null&&(o=s.shape[0],r=s.shape[1]);const i=Al(r),a={windowSize:i,inSize:r,batchSize:o,outSize:Math.ceil(r/i)},l=new zB(a,t,s==null),c=[e];s!=null&&c.push(s);const u=n.runWebGLProgram(l,c,"int32");if(u.shape[1]===1)return u;const h=Ty(n,e,t,u);return n.disposeIntermediateTensorInfo(u),h}function Ny(n,e,t,s=null){const o=s!=null?s.shape:e.shape,r=o[o.length-1],i=Al(r),a=new VB(o,i,t,s==null),l=s==null?[e]:[e,s],c=n.runWebGLProgram(a,l,"int32");if(c.shape.length===e.shape.length){const u=Ny(n,e,t,c);return n.disposeIntermediateTensorInfo(c),u}return c}function Ey(n,e,t,s){const o=[t];if($t("arg"+s.charAt(0).toUpperCase()+s.slice(1),o,e.shape.length),!V().getBool("WEBGL_PACK_REDUCE")||e.shape.length<=2){const r=[],i=n.texData.get(e.dataId),a=i!==null&&i.isPacked;let l=e;a&&(l=n.unpackTensor(e),r.push(l));const[c,u]=bt(l.shape,o),h=G(u),d=te({inputs:{x:l},backend:n,attrs:{shape:[-1,h]}});r.push(d);const p=Ty(n,d,s);r.push(p);const f=te({inputs:{x:p},backend:n,attrs:{shape:c}});return r.forEach(m=>n.disposeIntermediateTensorInfo(m)),f}return Ny(n,e,s)}/** + */function Ty(n,e,t,s=null){let o=e.shape[0],r=e.shape[1];s!=null&&(o=s.shape[0],r=s.shape[1]);const i=Al(r),a={windowSize:i,inSize:r,batchSize:o,outSize:Math.ceil(r/i)},l=new BB(a,t,s==null),c=[e];s!=null&&c.push(s);const u=n.runWebGLProgram(l,c,"int32");if(u.shape[1]===1)return u;const h=Ty(n,e,t,u);return n.disposeIntermediateTensorInfo(u),h}function Ny(n,e,t,s=null){const o=s!=null?s.shape:e.shape,r=o[o.length-1],i=Al(r),a=new zB(o,i,t,s==null),l=s==null?[e]:[e,s],c=n.runWebGLProgram(a,l,"int32");if(c.shape.length===e.shape.length){const u=Ny(n,e,t,c);return n.disposeIntermediateTensorInfo(c),u}return c}function Ey(n,e,t,s){const o=[t];if($t("arg"+s.charAt(0).toUpperCase()+s.slice(1),o,e.shape.length),!V().getBool("WEBGL_PACK_REDUCE")||e.shape.length<=2){const r=[],i=n.texData.get(e.dataId),a=i!==null&&i.isPacked;let l=e;a&&(l=n.unpackTensor(e),r.push(l));const[c,u]=bt(l.shape,o),h=G(u),d=te({inputs:{x:l},backend:n,attrs:{shape:[-1,h]}});r.push(d);const p=Ty(n,d,s);r.push(p);const f=te({inputs:{x:p},backend:n,attrs:{shape:c}});return r.forEach(m=>n.disposeIntermediateTensorInfo(m)),f}return Ny(n,e,s)}/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -13613,7 +13613,7 @@ return log(x + sqrt(x * x - 1.0));`,EB=Re({opSnippet:NB}),RB={kernelName:Cr,back * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function WB(n){const{inputs:e,backend:t,attrs:s}=n,{x:o}=e,{axis:r}=s;let i=$e(r,o.shape);const a=Ze(i,o.shape.length);let l=o;const c=[];a!=null&&(l=zt({inputs:{x:o},backend:t,attrs:{perm:a}}),c.push(l),i=nt(i.length,l.shape.length)),$t("argMax",[i[0]],l.shape.length);const u=Ey(t,l,i[0],"max");return c.forEach(h=>t.disposeIntermediateTensorInfo(h)),u}const UB={kernelName:ua,backendName:"webgl",kernelFunc:WB};/** + */function VB(n){const{inputs:e,backend:t,attrs:s}=n,{x:o}=e,{axis:r}=s;let i=$e(r,o.shape);const a=Ze(i,o.shape.length);let l=o;const c=[];a!=null&&(l=Bt({inputs:{x:o},backend:t,attrs:{perm:a}}),c.push(l),i=nt(i.length,l.shape.length)),$t("argMax",[i[0]],l.shape.length);const u=Ey(t,l,i[0],"max");return c.forEach(h=>t.disposeIntermediateTensorInfo(h)),u}const WB={kernelName:ua,backendName:"webgl",kernelFunc:VB};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -13628,7 +13628,7 @@ return log(x + sqrt(x * x - 1.0));`,EB=Re({opSnippet:NB}),RB={kernelName:Cr,back * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function GB(n){const{inputs:e,backend:t,attrs:s}=n,{x:o}=e,{axis:r}=s;let i=$e(r,o.shape);const a=Ze(i,o.shape.length);let l=o;const c=[];a!=null&&(l=zt({inputs:{x:o},backend:t,attrs:{perm:a}}),c.push(l),i=nt(i.length,l.shape.length)),$t("argMin",[i[0]],l.shape.length);const u=Ey(t,l,i[0],"min");return c.forEach(h=>t.disposeIntermediateTensorInfo(h)),u}const HB={kernelName:ha,backendName:"webgl",kernelFunc:GB};/** + */function UB(n){const{inputs:e,backend:t,attrs:s}=n,{x:o}=e,{axis:r}=s;let i=$e(r,o.shape);const a=Ze(i,o.shape.length);let l=o;const c=[];a!=null&&(l=Bt({inputs:{x:o},backend:t,attrs:{perm:a}}),c.push(l),i=nt(i.length,l.shape.length)),$t("argMin",[i[0]],l.shape.length);const u=Ey(t,l,i[0],"min");return c.forEach(h=>t.disposeIntermediateTensorInfo(h)),u}const GB={kernelName:ha,backendName:"webgl",kernelFunc:UB};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -13643,12 +13643,12 @@ return log(x + sqrt(x * x - 1.0));`,EB=Re({opSnippet:NB}),RB={kernelName:Cr,back * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const qB=In+` + */const HB=In+` if (abs(x) > 1.) { return NAN; } return asin(x); -`,jB=Re({opSnippet:qB}),KB={kernelName:Ir,backendName:"webgl",kernelFunc:jB};/** +`,qB=Re({opSnippet:HB}),jB={kernelName:Ir,backendName:"webgl",kernelFunc:qB};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -13663,7 +13663,7 @@ return log(x + sqrt(x * x - 1.0));`,EB=Re({opSnippet:NB}),RB={kernelName:Cr,back * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const XB=In+"return log(x + sqrt(x * x + 1.0));",YB=Re({opSnippet:XB}),ZB={kernelName:$r,backendName:"webgl",kernelFunc:YB};/** + */const KB=In+"return log(x + sqrt(x * x + 1.0));",XB=Re({opSnippet:KB}),YB={kernelName:$r,backendName:"webgl",kernelFunc:XB};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -13678,9 +13678,9 @@ return log(x + sqrt(x * x - 1.0));`,EB=Re({opSnippet:NB}),RB={kernelName:Cr,back * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const QB=In+` + */const ZB=In+` return atan(x); -`,JB=Re({opSnippet:QB}),ez={kernelName:kr,backendName:"webgl",kernelFunc:JB};/** +`,QB=Re({opSnippet:ZB}),JB={kernelName:kr,backendName:"webgl",kernelFunc:QB};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -13695,16 +13695,16 @@ return log(x + sqrt(x * x - 1.0));`,EB=Re({opSnippet:NB}),RB={kernelName:Cr,back * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const tz=Cp+` + */const ez=yp+` return atan(a, b); -`,nz=` +`,tz=` vec4 result = atan(a, b); bvec4 isNaNA = isnan(a); bvec4 isNaNB = isnan(b); bvec4 isNaN = bvec4(isNaNA.x || isNaNB.x, isNaNA.y || isNaNB.y, isNaNA.z || isNaNB.z, isNaNA.w || isNaNB.w); `+To+` return result; -`,sz=vt({opSnippet:tz,packedOpSnippet:nz}),oz={kernelName:Sr,backendName:"webgl",kernelFunc:sz};/** +`,nz=vt({opSnippet:ez,packedOpSnippet:tz}),sz={kernelName:Sr,backendName:"webgl",kernelFunc:nz};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -13719,9 +13719,9 @@ return log(x + sqrt(x * x - 1.0));`,EB=Re({opSnippet:NB}),RB={kernelName:Cr,back * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const rz=In+` + */const oz=In+` if ((x < -1.0) || (x > 1.0)) return NAN; -return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelName:vr,backendName:"webgl",kernelFunc:iz};/** +return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,rz=Re({opSnippet:oz}),iz={kernelName:vr,backendName:"webgl",kernelFunc:rz};/** * @license * Copyright 2017 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -13736,7 +13736,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */class na{constructor(e,t,s,o=!1,r=!1){if(this.variableNames=["x"],t==="avg"&&s)throw new Error("Cannot compute positions for average pool.");const i=e.filterWidth,a=e.strideHeight,l=e.strideWidth,c=e.dilationHeight,u=e.dilationWidth,h=e.effectiveFilterHeight,d=e.effectiveFilterWidth,p=e.padInfo.top,f=e.padInfo.left;this.outputShape=e.outShape;const m=t==="avg",g=`((batch * ${e.inHeight} + xR) * ${e.inWidth} + xC) * ${e.inChannels} + d`,x=`(xR * ${e.inWidth} + xC) * ${e.inChannels} + d`;let b="0.0";if(m||(b="-1.0 / 1e-20"),s){const k=">=";this.userCode=` + */class na{constructor(e,t,s,o=!1,r=!1){if(this.variableNames=["x"],t==="avg"&&s)throw new Error("Cannot compute positions for average pool.");const i=e.filterWidth,a=e.strideHeight,l=e.strideWidth,c=e.dilationHeight,u=e.dilationWidth,h=e.effectiveFilterHeight,d=e.effectiveFilterWidth,p=e.padInfo.top,f=e.padInfo.left;this.outputShape=e.outShape;const m=t==="avg",g=`((batch * ${e.inHeight} + xR) * ${e.inWidth} + xC) * ${e.inChannels} + d`,x=`(xR * ${e.inWidth} + xC) * ${e.inChannels} + d`;let b="0.0";if(m||(b="-1.0 / 1e-20"),s){const $=">=";this.userCode=` const ivec2 strides = ivec2(${a}, ${l}); const ivec2 pads = ivec2(${p}, ${f}); @@ -13778,7 +13778,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam // use the current value. float currMinMaxValue = mix( value, minMaxValue, minMaxValueFound); - if (value ${k} currMinMaxValue) { + if (value ${$} currMinMaxValue) { minMaxValue = value; minMaxValueFound = 1.0; minMaxPosition = ${o?r?g:x:`wR * ${d} + wC`}; @@ -13787,7 +13787,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam } setOutput(float(minMaxPosition)); } - `;return}const w="max";let y=`${t}(${t}(${t}(minMaxValue[0], minMaxValue[1]), minMaxValue[2]), minMaxValue[3])`;t==="avg"&&(y="avgValue / max(count, 1.0)");const C=Math.floor(i/4)*4,I=i%4,$=` + `;return}const w="max";let y=`${t}(${t}(${t}(minMaxValue[0], minMaxValue[1]), minMaxValue[2]), minMaxValue[3])`;t==="avg"&&(y="avgValue / max(count, 1.0)");const C=Math.floor(i/4)*4,I=i%4,v=` if (${m}) { avgValue += dot(values, ones); } else { @@ -13842,7 +13842,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam getValue(batch, xR, xC + 3 * ${u}, d) ); - ${$} + ${v} } int xC = xCCorner + ${C}; @@ -13854,7 +13854,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam initializationValue ); - ${$} + ${v} } else if (${I===2}) { vec4 values = vec4( getValue(batch, xR, xC, d), @@ -13863,7 +13863,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam initializationValue ); - ${$} + ${v} } else if (${I===3}) { vec4 values = vec4( getValue(batch, xR, xC, d), @@ -13872,12 +13872,12 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam initializationValue ); - ${$} + ${v} } } setOutput(${y}); } - `}}class $p{constructor(e,t,s,o=!1,r=!1){if(this.variableNames=["x"],t==="avg"&&s)throw new Error("Cannot compute positions for average pool.");const i=e.filterWidth,a=e.strideDepth,l=e.strideHeight,c=e.strideWidth,u=e.dilationDepth,h=e.dilationHeight,d=e.dilationWidth,p=e.effectiveFilterDepth,f=e.effectiveFilterHeight,m=e.effectiveFilterWidth,g=e.padInfo.front,x=e.padInfo.top,b=e.padInfo.left;this.outputShape=e.outShape;const w=t==="avg";let y="0.0";if(w||(y="-1.0 / 1e-20"),s){const N=">=";this.userCode=` + `}}class Cp{constructor(e,t,s,o=!1,r=!1){if(this.variableNames=["x"],t==="avg"&&s)throw new Error("Cannot compute positions for average pool.");const i=e.filterWidth,a=e.strideDepth,l=e.strideHeight,c=e.strideWidth,u=e.dilationDepth,h=e.dilationHeight,d=e.dilationWidth,p=e.effectiveFilterDepth,f=e.effectiveFilterHeight,m=e.effectiveFilterWidth,g=e.padInfo.front,x=e.padInfo.top,b=e.padInfo.left;this.outputShape=e.outShape;const w=t==="avg";let y="0.0";if(w||(y="-1.0 / 1e-20"),s){const N=">=";this.userCode=` const ivec3 strides = ivec3(${a}, ${l}, ${c}); const ivec3 pads = ivec3(${g}, ${x}, ${b}); @@ -13939,7 +13939,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam } setOutput(float(minMaxPosition)); } - `;return}const C="max";let I=`${t}(${t}(${t}(minMaxValue[0], minMaxValue[1]), minMaxValue[2]), minMaxValue[3])`;t==="avg"&&(I="avgValue / max(count, 1.0)");const $=Math.floor(i/4)*4,k=i%4,S=` + `;return}const C="max";let I=`${t}(${t}(${t}(minMaxValue[0], minMaxValue[1]), minMaxValue[2]), minMaxValue[3])`;t==="avg"&&(I="avgValue / max(count, 1.0)");const v=Math.floor(i/4)*4,$=i%4,S=` if (${w}) { avgValue += dot(values, ones); } else { @@ -13994,7 +13994,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam continue; } - for (int wC = 0; wC < ${$}; wC += 4) { + for (int wC = 0; wC < ${v}; wC += 4) { int xC = xCCorner + wC * ${d}; vec4 values = vec4( @@ -14007,8 +14007,8 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam ${S} } - int xC = xCCorner + ${$}; - if (${k===1}) { + int xC = xCCorner + ${v}; + if (${$===1}) { vec4 values = vec4( getValue(batch, xD, xR, xC, ch), initializationValue, @@ -14017,7 +14017,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam ); ${S} - } else if (${k===2}) { + } else if (${$===2}) { vec4 values = vec4( getValue(batch, xD, xR, xC, ch), getValue(batch, xD, xR, xC + ${d}, ch), @@ -14026,7 +14026,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam ); ${S} - } else if (${k===3}) { + } else if (${$===3}) { vec4 values = vec4( getValue(batch, xD, xR, xC, ch), getValue(batch, xD, xR, xC + ${d}, ch), @@ -14055,7 +14055,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function lz(n){const{inputs:e,backend:t,attrs:s}=n,{x:o}=e;Ji(o,"avgPool");const{filterSize:r,strides:i,pad:a,dimRoundingMode:l}=s,c=1;v(Et(i,c),()=>`Error in avgPool: Either strides or dilations must be 1. Got strides ${i} and dilations '${c}'`);const u=pn(o.shape,r,i,c,a,l);if(u.filterWidth===1&&u.filterHeight===1&&_e(u.inShape,u.outShape))return en({inputs:{x:o},backend:t});const h=new na(u,"avg",!1);return t.runWebGLProgram(h,[o],"float32")}const cz={kernelName:da,backendName:"webgl",kernelFunc:lz};/** + */function az(n){const{inputs:e,backend:t,attrs:s}=n,{x:o}=e;Ji(o,"avgPool");const{filterSize:r,strides:i,pad:a,dimRoundingMode:l}=s,c=1;k(Et(i,c),()=>`Error in avgPool: Either strides or dilations must be 1. Got strides ${i} and dilations '${c}'`);const u=pn(o.shape,r,i,c,a,l);if(u.filterWidth===1&&u.filterHeight===1&&_e(u.inShape,u.outShape))return en({inputs:{x:o},backend:t});const h=new na(u,"avg",!1);return t.runWebGLProgram(h,[o],"float32")}const lz={kernelName:da,backendName:"webgl",kernelFunc:az};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -14070,7 +14070,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function uz(n){const{inputs:e,backend:t,attrs:s}=n,{x:o}=e,{filterSize:r,strides:i,pad:a,dimRoundingMode:l,dataFormat:c}=s,u=[1,1,1],h=rs(o.shape,r,i,u,a,l,c),d=new $p(h,"avg",!1);return t.runWebGLProgram(d,[o],"float32")}const hz={kernelName:pa,backendName:"webgl",kernelFunc:uz};/** + */function cz(n){const{inputs:e,backend:t,attrs:s}=n,{x:o}=e,{filterSize:r,strides:i,pad:a,dimRoundingMode:l,dataFormat:c}=s,u=[1,1,1],h=rs(o.shape,r,i,u,a,l,c),d=new Cp(h,"avg",!1);return t.runWebGLProgram(d,[o],"float32")}const uz={kernelName:pa,backendName:"webgl",kernelFunc:cz};/** * @license * Copyright 2017 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -14085,7 +14085,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */class dz{constructor(e){this.variableNames=["dy"],this.outputShape=e.inShape;const t=e.filterHeight,s=e.filterWidth,o=e.strideHeight,r=e.strideWidth,i=e.dilationHeight,a=e.dilationWidth,l=e.effectiveFilterHeight,c=e.effectiveFilterWidth,u=l-1-e.padInfo.top,h=c-1-e.padInfo.left,d=1/(t*s);this.userCode=` + */class hz{constructor(e){this.variableNames=["dy"],this.outputShape=e.inShape;const t=e.filterHeight,s=e.filterWidth,o=e.strideHeight,r=e.strideWidth,i=e.dilationHeight,a=e.dilationWidth,l=e.effectiveFilterHeight,c=e.effectiveFilterWidth,u=l-1-e.padInfo.top,h=c-1-e.padInfo.left,d=1/(t*s);this.userCode=` const ivec2 pads = ivec2(${u}, ${h}); const float avgMultiplier = float(${d}); @@ -14127,7 +14127,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam } setOutput(dotProd); } - `}}class pz{constructor(e){this.variableNames=["dy"],this.outputShape=e.inShape;const t=e.filterDepth,s=e.filterHeight,o=e.filterWidth,r=e.strideDepth,i=e.strideHeight,a=e.strideWidth,l=e.dilationDepth,c=e.dilationHeight,u=e.dilationWidth,h=e.effectiveFilterDepth,d=e.effectiveFilterHeight,p=e.effectiveFilterWidth,f=h-1-e.padInfo.front,m=d-1-e.padInfo.top,g=p-1-e.padInfo.left,x=1/(t*s*o);this.userCode=` + `}}class dz{constructor(e){this.variableNames=["dy"],this.outputShape=e.inShape;const t=e.filterDepth,s=e.filterHeight,o=e.filterWidth,r=e.strideDepth,i=e.strideHeight,a=e.strideWidth,l=e.dilationDepth,c=e.dilationHeight,u=e.dilationWidth,h=e.effectiveFilterDepth,d=e.effectiveFilterHeight,p=e.effectiveFilterWidth,f=h-1-e.padInfo.front,m=d-1-e.padInfo.top,g=p-1-e.padInfo.left,x=1/(t*s*o);this.userCode=` const ivec3 pads = ivec3(${f}, ${m}, ${g}); const float avgMultiplier = float(${x}); @@ -14198,7 +14198,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function fz(n){const{inputs:e,backend:t,attrs:s}=n,{dy:o,input:r}=e,i=r,{filterSize:a,strides:l,pad:c,dimRoundingMode:u}=s,h=[1,1,1],d=rs(i.shape,a,l,h,c,u),p=new pz(d);return t.runWebGLProgram(p,[o],i.dtype)}const mz={kernelName:Yc,backendName:"webgl",kernelFunc:fz};/** + */function pz(n){const{inputs:e,backend:t,attrs:s}=n,{dy:o,input:r}=e,i=r,{filterSize:a,strides:l,pad:c,dimRoundingMode:u}=s,h=[1,1,1],d=rs(i.shape,a,l,h,c,u),p=new dz(d);return t.runWebGLProgram(p,[o],i.dtype)}const fz={kernelName:Kc,backendName:"webgl",kernelFunc:pz};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -14213,7 +14213,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function gz(n){const{inputs:e,backend:t,attrs:s}=n,{dy:o,input:r}=e,i=r;Ji([o,r],"avgPoolGrad");const{filterSize:a,strides:l,pad:c}=s,u=pn(i.shape,a,l,1,c),h=new dz(u);return t.runWebGLProgram(h,[o],i.dtype)}const xz={kernelName:Xc,backendName:"webgl",kernelFunc:gz};/** + */function mz(n){const{inputs:e,backend:t,attrs:s}=n,{dy:o,input:r}=e,i=r;Ji([o,r],"avgPoolGrad");const{filterSize:a,strides:l,pad:c}=s,u=pn(i.shape,a,l,1,c),h=new hz(u);return t.runWebGLProgram(h,[o],i.dtype)}const gz={kernelName:jc,backendName:"webgl",kernelFunc:mz};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -14228,7 +14228,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function bz(n){const{inputs:e,backend:t,attrs:s}=n,{a:o,b:r}=e,{transposeA:i,transposeB:a}=s;return $c({a:o,b:r,transposeA:i,transposeB:a,backend:t})}const yz={kernelName:fa,backendName:"webgl",kernelFunc:bz};/** + */function xz(n){const{inputs:e,backend:t,attrs:s}=n,{a:o,b:r}=e,{transposeA:i,transposeB:a}=s;return $c({a:o,b:r,transposeA:i,transposeB:a,backend:t})}const bz={kernelName:fa,backendName:"webgl",kernelFunc:xz};/** * @license * Copyright 2017 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -14243,7 +14243,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */class wz{constructor(e,t,s,o,r,i){this.outputShape=[],this.variableNames=["x","mean","variance"],Ce(e,t),Ce(e,s);let a="0.0";o!=null&&(Ce(e,o),this.variableNames.push("offset"),a="getOffsetAtOutCoords()");let l="1.0";r!=null&&(Ce(e,r),this.variableNames.push("scale"),l="getScaleAtOutCoords()"),this.outputShape=e,this.userCode=` + */class yz{constructor(e,t,s,o,r,i){this.outputShape=[],this.variableNames=["x","mean","variance"],Ce(e,t),Ce(e,s);let a="0.0";o!=null&&(Ce(e,o),this.variableNames.push("offset"),a="getOffsetAtOutCoords()");let l="1.0";r!=null&&(Ce(e,r),this.variableNames.push("scale"),l="getScaleAtOutCoords()"),this.outputShape=e,this.userCode=` void main() { float x = getXAtOutCoords(); float mean = getMeanAtOutCoords(); @@ -14268,7 +14268,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */class Cz{constructor(e,t,s,o,r,i){this.packedInputs=!0,this.packedOutput=!0,this.variableNames=["x","mean","variance"],Ce(e,t),Ce(e,s);let a="vec4(0.0)";o!=null&&(Ce(e,o),this.variableNames.push("offset"),a="getOffsetAtOutCoords()");let l="vec4(1.0)";r!=null&&(Ce(e,r),this.variableNames.push("scale"),l="getScaleAtOutCoords()"),this.outputShape=e,this.userCode=` + */class wz{constructor(e,t,s,o,r,i){this.packedInputs=!0,this.packedOutput=!0,this.variableNames=["x","mean","variance"],Ce(e,t),Ce(e,s);let a="vec4(0.0)";o!=null&&(Ce(e,o),this.variableNames.push("offset"),a="getOffsetAtOutCoords()");let l="vec4(1.0)";r!=null&&(Ce(e,r),this.variableNames.push("scale"),l="getScaleAtOutCoords()"),this.outputShape=e,this.userCode=` void main() { vec4 offset = ${a}; vec4 scale = ${l}; @@ -14296,7 +14296,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const Iz={kernelName:Sa,backendName:"webgl",kernelFunc:({inputs:n,backend:e,attrs:t})=>{const{x:s,mean:o,variance:r,offset:i,scale:a}=n;v(o.shape.length===r.shape.length,()=>"Batch normalization gradient requires mean and variance to have equal ranks."),v(i==null||o.shape.length===i.shape.length,()=>"Batch normalization gradient requires mean and offset to have equal ranks."),v(a==null||o.shape.length===a.shape.length,()=>"Batch normalization gradient requires mean and scale to have equal ranks.");let{varianceEpsilon:l}=t;l==null&&(l=.001);const c=[s,o,r];let u=null;i!=null&&(u=i.shape,c.push(i));let h=null;a!=null&&(h=a.shape,c.push(a));const d=V().getBool("WEBGL_PACK_NORMALIZATION")?new Cz(s.shape,o.shape,r.shape,u,h,l):new wz(s.shape,o.shape,r.shape,u,h,l);return e.runWebGLProgram(d,c,c[0].dtype)}};/** + */const Cz={kernelName:Sa,backendName:"webgl",kernelFunc:({inputs:n,backend:e,attrs:t})=>{const{x:s,mean:o,variance:r,offset:i,scale:a}=n;k(o.shape.length===r.shape.length,()=>"Batch normalization gradient requires mean and variance to have equal ranks."),k(i==null||o.shape.length===i.shape.length,()=>"Batch normalization gradient requires mean and offset to have equal ranks."),k(a==null||o.shape.length===a.shape.length,()=>"Batch normalization gradient requires mean and scale to have equal ranks.");let{varianceEpsilon:l}=t;l==null&&(l=.001);const c=[s,o,r];let u=null;i!=null&&(u=i.shape,c.push(i));let h=null;a!=null&&(h=a.shape,c.push(a));const d=V().getBool("WEBGL_PACK_NORMALIZATION")?new wz(s.shape,o.shape,r.shape,u,h,l):new yz(s.shape,o.shape,r.shape,u,h,l);return e.runWebGLProgram(d,c,c[0].dtype)}};/** * @license * Copyright 2017 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -14311,7 +14311,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */class $z{constructor(e){this.variableNames=["source"],this.outputShape=e,this.rank=e.length;const t=Me(this.rank);this.customUniforms=[{name:"start",arrayIndex:this.rank,type:"int"}];const s=kz(this.rank);let o;const r=e.map((i,a)=>`sourceLoc.${kp[a]} = start[${a}] + coords.${kp[a]};`);o=` + */class Iz{constructor(e){this.variableNames=["source"],this.outputShape=e,this.rank=e.length;const t=Me(this.rank);this.customUniforms=[{name:"start",arrayIndex:this.rank,type:"int"}];const s=$z(this.rank);let o;const r=e.map((i,a)=>`sourceLoc.${Ip[a]} = start[${a}] + coords.${Ip[a]};`);o=` ${t} sourceLoc; ${t} coords = getOutputCoords(); ${r.join(` @@ -14321,7 +14321,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam ${o} setOutput(getSource(${s})); } - `}}const kp=["x","y","z","w","u","v"];function kz(n){if(n===1)return"sourceLoc";if(n<=6)return kp.slice(0,n).map(e=>"sourceLoc."+e).join(",");throw Error(`Slicing for rank ${n} is not yet supported`)}/** + `}}const Ip=["x","y","z","w","u","v"];function $z(n){if(n===1)return"sourceLoc";if(n<=6)return Ip.slice(0,n).map(e=>"sourceLoc."+e).join(",");throw Error(`Slicing for rank ${n} is not yet supported`)}/** * @license * Copyright 2019 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -14336,7 +14336,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */class vz{constructor(e){this.variableNames=["source"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=e,this.rank=e.length,this.customUniforms=[{name:"start",arrayIndex:this.rank,type:"int"}];const t=Me(this.rank),s=Bt("coords",this.rank),o=Bt("sourceLoc",this.rank),r=this.rank===1?"sourceLoc":`vec2(${o.slice(-2).join()})`,i=`getChannel(getSource(${o.join()}), ${r})`,a=` + */class kz{constructor(e){this.variableNames=["source"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=e,this.rank=e.length,this.customUniforms=[{name:"start",arrayIndex:this.rank,type:"int"}];const t=Me(this.rank),s=Pt("coords",this.rank),o=Pt("sourceLoc",this.rank),r=this.rank===1?"sourceLoc":`vec2(${o.slice(-2).join()})`,i=`getChannel(getSource(${o.join()}), ${r})`,a=` result.x = ${i}; if (++${s[this.rank-1]} < ${e[this.rank-1]}) { ++${o[this.rank-1]}; @@ -14380,7 +14380,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function Sz(n,e,t,s){const o=s.texData.get(n.dataId),r=s.makeTensorInfo(t,n.dtype),i=s.texData.get(r.dataId);Object.assign(i,o),i.refCount=1,i.shape=t,i.dtype=n.dtype;let a=jh(e,ue(n.shape));o.slice&&(a+=o.slice.flatOffset),i.slice={flatOffset:a,origDataId:o.slice&&o.slice.origDataId||n.dataId};const l=s.dataRefCount.get(i.slice.origDataId)||1;return s.dataRefCount.set(i.slice.origDataId,l+1),r}function gr(n){const{inputs:e,backend:t,attrs:s}=n,{x:o}=e,{begin:r,size:i}=s,[a,l]=Rl(o,r,i);if(Gh(o,a,l),G(l)===0)return t.makeTensorInfo(l,o.dtype,[]);if(t.shouldExecuteOnCPU([o])||o.dtype==="string"){const h=t.texData.get(o.dataId),d=y3(h.values,a,l,o.shape,o.dtype);return t.makeTensorInfo(l,o.dtype,d)}const{isPacked:c}=t.texData.get(o.dataId),u=qh(o.shape,a,l);if(c||!u){const h=V().getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new vz(l):new $z(l),d=[a];return t.runWebGLProgram(h,[o],o.dtype,d)}return t.uploadToGPU(o.dataId),Sz(o,a,l,t)}const Tz={kernelName:tl,backendName:"webgl",kernelFunc:gr};/** + */function vz(n,e,t,s){const o=s.texData.get(n.dataId),r=s.makeTensorInfo(t,n.dtype),i=s.texData.get(r.dataId);Object.assign(i,o),i.refCount=1,i.shape=t,i.dtype=n.dtype;let a=Hh(e,ue(n.shape));o.slice&&(a+=o.slice.flatOffset),i.slice={flatOffset:a,origDataId:o.slice&&o.slice.origDataId||n.dataId};const l=s.dataRefCount.get(i.slice.origDataId)||1;return s.dataRefCount.set(i.slice.origDataId,l+1),r}function gr(n){const{inputs:e,backend:t,attrs:s}=n,{x:o}=e,{begin:r,size:i}=s,[a,l]=Rl(o,r,i);if(Wh(o,a,l),G(l)===0)return t.makeTensorInfo(l,o.dtype,[]);if(t.shouldExecuteOnCPU([o])||o.dtype==="string"){const h=t.texData.get(o.dataId),d=b3(h.values,a,l,o.shape,o.dtype);return t.makeTensorInfo(l,o.dtype,d)}const{isPacked:c}=t.texData.get(o.dataId),u=Gh(o.shape,a,l);if(c||!u){const h=V().getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new kz(l):new Iz(l),d=[a];return t.runWebGLProgram(h,[o],o.dtype,d)}return t.uploadToGPU(o.dataId),vz(o,a,l,t)}const Sz={kernelName:tl,backendName:"webgl",kernelFunc:gr};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -14395,7 +14395,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const Nz={kernelName:ma,backendName:"webgl",kernelFunc:n=>{const{inputs:e,backend:t,attrs:s}=n,{x:o}=e,{blockShape:r,crops:i}=s;v(o.shape.length<=4,()=>"batchToSpaceND for rank > 4 with a WebGL backend not implemented yet");const a=r.reduce((b,w)=>b*w),l=Ei(o.shape,r,a),c=Ri(l.length,r.length),u=Ai(o.shape,r,a),h=Qh(i,r.length),d=Jh(u,i,r.length),p=[],f=te({inputs:{x:o},backend:t,attrs:{shape:l}}),m=zt({inputs:{x:f},backend:t,attrs:{perm:c}}),g=te({inputs:{x:m},backend:t,attrs:{shape:u}}),x=gr({inputs:{x:g},backend:t,attrs:{begin:h,size:d}});return p.push(f),p.push(m),p.push(g),p.forEach(b=>t.disposeIntermediateTensorInfo(b)),x}};/** + */const Tz={kernelName:ma,backendName:"webgl",kernelFunc:n=>{const{inputs:e,backend:t,attrs:s}=n,{x:o}=e,{blockShape:r,crops:i}=s;k(o.shape.length<=4,()=>"batchToSpaceND for rank > 4 with a WebGL backend not implemented yet");const a=r.reduce((b,w)=>b*w),l=Ei(o.shape,r,a),c=Ri(l.length,r.length),u=Ai(o.shape,r,a),h=Yh(i,r.length),d=Zh(u,i,r.length),p=[],f=te({inputs:{x:o},backend:t,attrs:{shape:l}}),m=Bt({inputs:{x:f},backend:t,attrs:{perm:c}}),g=te({inputs:{x:m},backend:t,attrs:{shape:u}}),x=gr({inputs:{x:g},backend:t,attrs:{begin:h,size:d}});return p.push(f),p.push(m),p.push(g),p.forEach(b=>t.disposeIntermediateTensorInfo(b)),x}};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -14410,7 +14410,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function Ez(n){const{inputs:e,backend:t,attrs:s}=n,{x:o,weights:r}=e,{size:i}=s,a=t.readSync(o.dataId),l=t.readSync(r.dataId),c=iy(a,l,r.dtype,r.shape,i);return t.makeTensorInfo([i],r.dtype,c)}const Rz={kernelName:Zc,backendName:"webgl",kernelFunc:Ez};/** + */function Nz(n){const{inputs:e,backend:t,attrs:s}=n,{x:o,weights:r}=e,{size:i}=s,a=t.readSync(o.dataId),l=t.readSync(r.dataId),c=iy(a,l,r.dtype,r.shape,i);return t.makeTensorInfo([i],r.dtype,c)}const Ez={kernelName:Xc,backendName:"webgl",kernelFunc:Nz};/** * @license * Copyright 2023 Google LLC. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -14425,15 +14425,15 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const Az=` + */const Rz=` int r = int(a.r) & int(b.r); int g = int(a.g) & int(b.g); int rb = int(a.b) & int(b.b); int ra = int(a.a) & int(b.a); return vec4(r, g, rb, ra); -`,Dz=` +`,Az=` return float(int(a.r) & int(b.r)); -`;function Fz(n){const{inputs:e,backend:t}=n,{a:s,b:o}=e,r=V().getBool("WEBGL_PACK_BINARY_OPERATIONS"),i=V().getNumber("WEBGL_VERSION");if(t.shouldExecuteOnCPU([s,o])||i===1){const l=t.texData.get(s.dataId).values,c=t.texData.get(o.dataId).values,[u,h]=UP(s.shape,o.shape,l,c,s.dtype),d=t.makeTensorInfo(h,s.dtype),p=t.texData.get(d.dataId);return p.values=u,d}let a;return r?a=new fr(Az,s.shape,o.shape,!1):a=new So(Dz,s.shape,o.shape),t.runWebGLProgram(a,[s,o],s.dtype)}const _z={kernelName:Qc,backendName:"webgl",kernelFunc:Fz};/** +`;function Dz(n){const{inputs:e,backend:t}=n,{a:s,b:o}=e,r=V().getBool("WEBGL_PACK_BINARY_OPERATIONS"),i=V().getNumber("WEBGL_VERSION");if(t.shouldExecuteOnCPU([s,o])||i===1){const l=t.texData.get(s.dataId).values,c=t.texData.get(o.dataId).values,[u,h]=WP(s.shape,o.shape,l,c,s.dtype),d=t.makeTensorInfo(h,s.dtype),p=t.texData.get(d.dataId);return p.values=u,d}let a;return r?a=new fr(Rz,s.shape,o.shape,!1):a=new So(Az,s.shape,o.shape),t.runWebGLProgram(a,[s,o],s.dtype)}const Fz={kernelName:Yc,backendName:"webgl",kernelFunc:Dz};/** * @license * Copyright 2021 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -14448,7 +14448,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function Oz(n){const{inputs:e,backend:t}=n,{s0:s,s1:o}=e,r=t.readSync(s.dataId),i=t.readSync(o.dataId),a=Ce(Array.from(r),Array.from(i));return t.makeTensorInfo([a.length],"int32",Int32Array.from(a))}const Lz={kernelName:Hp,backendName:"webgl",kernelFunc:Oz};/** + */function _z(n){const{inputs:e,backend:t}=n,{s0:s,s1:o}=e,r=t.readSync(s.dataId),i=t.readSync(o.dataId),a=Ce(Array.from(r),Array.from(i));return t.makeTensorInfo([a.length],"int32",Int32Array.from(a))}const Oz={kernelName:Hp,backendName:"webgl",kernelFunc:_z};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -14463,7 +14463,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const Ry=vt({opSnippet:"return float(a != b);",cpuKernelImpl:u3,dtype:"bool"}),Mz={kernelName:Ua,backendName:"webgl",kernelFunc:Ry};/** + */const Ry=vt({opSnippet:"return float(a != b);",cpuKernelImpl:c3,dtype:"bool"}),Lz={kernelName:Ua,backendName:"webgl",kernelFunc:Ry};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -14478,7 +14478,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function sa(n){const{inputs:e,backend:t}=n,{input:s}=e,o=t.texData.get(s.dataId);return en({inputs:{x:o.complexTensorInfos.real},backend:t})}const Pz={kernelName:vu,backendName:"webgl",kernelFunc:sa};/** + */function sa(n){const{inputs:e,backend:t}=n,{input:s}=e,o=t.texData.get(s.dataId);return en({inputs:{x:o.complexTensorInfos.real},backend:t})}const Mz={kernelName:$u,backendName:"webgl",kernelFunc:sa};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -14493,7 +14493,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const Bz="return float(int(x));";function zz(n,e){const t=new ts(n.shape,Bz),s=e.runWebGLProgram(t,[n],"int32");return{dataId:s.dataId,shape:s.shape,dtype:s.dtype}}/** + */const Pz="return float(int(x));";function Bz(n,e){const t=new ts(n.shape,Pz),s=e.runWebGLProgram(t,[n],"int32");return{dataId:s.dataId,shape:s.shape,dtype:s.dtype}}/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -14508,7 +14508,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function vp(n){const{inputs:e,backend:t,attrs:s}=n,{x:o}=e,{dtype:r}=s;if(r==="complex64"){if(o.dtype==="complex64")return en({inputs:{x:o},backend:t});const i=ot(o.shape),a=vp({inputs:{x:o},backend:t,attrs:{dtype:"float32"}}),l=Ps({inputs:{real:a,imag:i},backend:t});return i.dispose(),t.disposeIntermediateTensorInfo(a),l}if(o.dtype==="complex64"){const i=sa({inputs:{input:o},backend:t}),a=vp({inputs:{x:i},backend:t,attrs:{dtype:r}});return t.disposeIntermediateTensorInfo(i),a}if(!zp(o.dtype,r)){const i=en({inputs:{x:o},backend:t});return{dataId:i.dataId,shape:i.shape,dtype:r}}if(t.shouldExecuteOnCPU([o])){const i=t.texData.get(o.dataId).values,[a,l,c]=GP(i,o.shape,o.dtype,r);return t.makeTensorInfo(a,l,c)}if(r==="int32")return zz(o,t);if(r==="bool"){const i=t.makeTensorInfo([],"bool",Tt("bool",1)),l=Ry({inputs:{a:o,b:i},backend:t});return t.disposeIntermediateTensorInfo(i),l}throw new Error(`Error in Cast: failed to cast ${o.dtype} to ${r}`)}const Vz={kernelName:Tr,backendName:"webgl",kernelFunc:vp};/** + */function $p(n){const{inputs:e,backend:t,attrs:s}=n,{x:o}=e,{dtype:r}=s;if(r==="complex64"){if(o.dtype==="complex64")return en({inputs:{x:o},backend:t});const i=ot(o.shape),a=$p({inputs:{x:o},backend:t,attrs:{dtype:"float32"}}),l=Ps({inputs:{real:a,imag:i},backend:t});return i.dispose(),t.disposeIntermediateTensorInfo(a),l}if(o.dtype==="complex64"){const i=sa({inputs:{input:o},backend:t}),a=$p({inputs:{x:i},backend:t,attrs:{dtype:r}});return t.disposeIntermediateTensorInfo(i),a}if(!zp(o.dtype,r)){const i=en({inputs:{x:o},backend:t});return{dataId:i.dataId,shape:i.shape,dtype:r}}if(t.shouldExecuteOnCPU([o])){const i=t.texData.get(o.dataId).values,[a,l,c]=UP(i,o.shape,o.dtype,r);return t.makeTensorInfo(a,l,c)}if(r==="int32")return Bz(o,t);if(r==="bool"){const i=t.makeTensorInfo([],"bool",Tt("bool",1)),l=Ry({inputs:{a:o,b:i},backend:t});return t.disposeIntermediateTensorInfo(i),l}throw new Error(`Error in Cast: failed to cast ${o.dtype} to ${r}`)}const zz={kernelName:Tr,backendName:"webgl",kernelFunc:$p};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -14523,7 +14523,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const Ay="return ceil(x);",Wz=Re({opSnippet:Ay,packedOpSnippet:Ay,cpuKernelImpl:HP}),Uz={kernelName:Nr,backendName:"webgl",kernelFunc:Wz};/** + */const Ay="return ceil(x);",Vz=Re({opSnippet:Ay,packedOpSnippet:Ay,cpuKernelImpl:GP}),Wz={kernelName:Nr,backendName:"webgl",kernelFunc:Vz};/** * @license * Copyright 2017 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -14538,7 +14538,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */class Gz{constructor(e){this.variableNames=["A"],this.customUniforms=[{name:"minVal",type:"float"},{name:"maxVal",type:"float"}],this.outputShape=e,this.userCode=` + */class Uz{constructor(e){this.variableNames=["A"],this.customUniforms=[{name:"minVal",type:"float"},{name:"maxVal",type:"float"}],this.outputShape=e,this.userCode=` void main() { float value = getAAtOutCoords(); @@ -14564,7 +14564,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */class Hz{constructor(e){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.customUniforms=[{name:"minVal",type:"float"},{name:"maxVal",type:"float"}],this.outputShape=e,this.userCode=` + */class Gz{constructor(e){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.customUniforms=[{name:"minVal",type:"float"},{name:"maxVal",type:"float"}],this.outputShape=e,this.userCode=` void main() { vec4 value = getAAtOutCoords(); @@ -14590,7 +14590,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function qz(n){const{inputs:e,backend:t,attrs:s}=n,{x:o}=e,{clipValueMin:r,clipValueMax:i}=s;let a;V().getBool("WEBGL_PACK_CLIP")?a=new Hz(o.shape):a=new Gz(o.shape);const l=[[r],[i]];return t.runWebGLProgram(a,[o],o.dtype,l)}const jz={kernelName:Er,backendName:"webgl",kernelFunc:qz};/** + */function Hz(n){const{inputs:e,backend:t,attrs:s}=n,{x:o}=e,{clipValueMin:r,clipValueMax:i}=s;let a;V().getBool("WEBGL_PACK_CLIP")?a=new Gz(o.shape):a=new Uz(o.shape);const l=[[r],[i]];return t.runWebGLProgram(a,[o],o.dtype,l)}const qz={kernelName:Er,backendName:"webgl",kernelFunc:Hz};/** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -14605,7 +14605,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */class Kz{constructor(e){this.variableNames=["real","imag"],this.outputShape=e,this.userCode=` + */class jz{constructor(e){this.variableNames=["real","imag"],this.outputShape=e,this.userCode=` void main() { float re = abs(getRealAtOutCoords()); float im = abs(getImagAtOutCoords()); @@ -14633,7 +14633,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function Dy(n,e){return{dataId:e.dataId,dtype:e.dtype,shape:n.shape}}function Xz(n){const{inputs:e,backend:t}=n,{x:s}=e,o=t.texData.get(s.dataId),r=new Kz(s.shape),i=[Dy(s,o.complexTensorInfos.real),Dy(s,o.complexTensorInfos.imag)];return t.runWebGLProgram(r,i,i[0].dtype)}const Yz={kernelName:ga,backendName:"webgl",kernelFunc:Xz};/** + */function Dy(n,e){return{dataId:e.dataId,dtype:e.dtype,shape:n.shape}}function Kz(n){const{inputs:e,backend:t}=n,{x:s}=e,o=t.texData.get(s.dataId),r=new jz(s.shape),i=[Dy(s,o.complexTensorInfos.real),Dy(s,o.complexTensorInfos.imag)];return t.runWebGLProgram(r,i,i[0].dtype)}const Xz={kernelName:ga,backendName:"webgl",kernelFunc:Kz};/** * @license * Copyright 2017 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -14648,7 +14648,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */class Zz{constructor(e){this.outputShape=[],this.outputShape=Hn(e,1),this.variableNames=e.map((i,a)=>`T${a}`);const t=new Array(e.length-1);t[0]=e[0][1];for(let i=1;i`T${a}`);const t=new Array(e.length-1);t[0]=e[0][1];for(let i=1;i`T${g}`);const l=new Array(e.length-1);l[0]=e[0][t];for(let m=1;m`T${g}`);const l=new Array(e.length-1);l[0]=e[0][t];for(let m=1;msa({inputs:{input:b},backend:t})),f=n.map(b=>Sc({inputs:{input:b},backend:t})),m=oa(p,e,t),g=oa(f,e,t),x=Ps({inputs:{real:m,imag:g},backend:t});return p.forEach(b=>t.disposeIntermediateTensorInfo(b)),f.forEach(b=>t.disposeIntermediateTensorInfo(b)),t.disposeIntermediateTensorInfo(m),t.disposeIntermediateTensorInfo(g),x}let o=t.shouldExecuteOnCPU(n);if(s==="string"&&(o=!0),o){const p=n.map(y=>{const I=[-1,G(y.shape.slice(e))];return te({inputs:{x:y},backend:t,attrs:{shape:I}})}),f=p.map(y=>({vals:t.readSync(y.dataId),shape:y.shape})),m=Hn(p.map(y=>y.shape),1),g=p[0].shape[0]===1,x=qP(f,m,s,g),b=Hn(n.map(y=>y.shape),e),w=t.makeTensorInfo(b,s,x);return p.forEach(y=>t.disposeIntermediateTensorInfo(y)),w}const r=n.filter(p=>G(p.shape)>0),i=V().getBool("WEBGL_PACK_ARRAY_OPERATIONS")&&r[0].shape.length>1;if(r.length===1){const p=i?new ts(n[0].shape,Ls):new Ms(n[0].shape,Ls);return t.runWebGLProgram(p,n,s)}const a=V().getNumber("WEBGL_MAX_TEXTURES_IN_SHADER");if(r.length>a){const p=[];for(let m=0;mf.shape),e);return t.runWebGLProgram(p,r,s)}const{tensors2D:l,outShape:c}=eV(r,e,t),u=new Zz(l.map(p=>p.shape)),h=t.runWebGLProgram(u,l,s);l.forEach(p=>t.disposeIntermediateTensorInfo(p));const d=te({inputs:{x:h},attrs:{shape:c},backend:t});return t.disposeIntermediateTensorInfo(h),d}function eV(n,e,t){const s=Hn(n.map(r=>r.shape),e);return{tensors2D:n.map(r=>te({inputs:{x:r},attrs:{shape:[-1,G(r.shape.slice(e))]},backend:t})),outShape:s}}/** + */function oa(n,e,t){const s=n[0].dtype;if(s==="complex64"){const p=n.map(b=>sa({inputs:{input:b},backend:t})),f=n.map(b=>Sc({inputs:{input:b},backend:t})),m=oa(p,e,t),g=oa(f,e,t),x=Ps({inputs:{real:m,imag:g},backend:t});return p.forEach(b=>t.disposeIntermediateTensorInfo(b)),f.forEach(b=>t.disposeIntermediateTensorInfo(b)),t.disposeIntermediateTensorInfo(m),t.disposeIntermediateTensorInfo(g),x}let o=t.shouldExecuteOnCPU(n);if(s==="string"&&(o=!0),o){const p=n.map(y=>{const I=[-1,G(y.shape.slice(e))];return te({inputs:{x:y},backend:t,attrs:{shape:I}})}),f=p.map(y=>({vals:t.readSync(y.dataId),shape:y.shape})),m=Hn(p.map(y=>y.shape),1),g=p[0].shape[0]===1,x=HP(f,m,s,g),b=Hn(n.map(y=>y.shape),e),w=t.makeTensorInfo(b,s,x);return p.forEach(y=>t.disposeIntermediateTensorInfo(y)),w}const r=n.filter(p=>G(p.shape)>0),i=V().getBool("WEBGL_PACK_ARRAY_OPERATIONS")&&r[0].shape.length>1;if(r.length===1){const p=i?new ts(n[0].shape,Ls):new Ms(n[0].shape,Ls);return t.runWebGLProgram(p,n,s)}const a=V().getNumber("WEBGL_MAX_TEXTURES_IN_SHADER");if(r.length>a){const p=[];for(let m=0;mf.shape),e);return t.runWebGLProgram(p,r,s)}const{tensors2D:l,outShape:c}=Jz(r,e,t),u=new Yz(l.map(p=>p.shape)),h=t.runWebGLProgram(u,l,s);l.forEach(p=>t.disposeIntermediateTensorInfo(p));const d=te({inputs:{x:h},attrs:{shape:c},backend:t});return t.disposeIntermediateTensorInfo(h),d}function Jz(n,e,t){const s=Hn(n.map(r=>r.shape),e);return{tensors2D:n.map(r=>te({inputs:{x:r},attrs:{shape:[-1,G(r.shape.slice(e))]},backend:t})),outShape:s}}/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -14754,7 +14754,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function Fy(n){const{inputs:e,backend:t,attrs:s}=n,{axis:o}=s,r=$e(o,e[0].shape)[0],i=e.map(c=>c.shape);Xh(i,r);const a=Hn(e.map(c=>c.shape),r);if(G(a)===0)return t.makeTensorInfo(a,e[0].dtype,[]);const l=e.filter(c=>G(c.shape)>0);return l.length===1?en({inputs:{x:l[0]},backend:t}):oa(l,r,t)}const tV={kernelName:xa,backendName:"webgl",kernelFunc:Fy};/** + */function Fy(n){const{inputs:e,backend:t,attrs:s}=n,{axis:o}=s,r=$e(o,e[0].shape)[0],i=e.map(c=>c.shape);jh(i,r);const a=Hn(e.map(c=>c.shape),r);if(G(a)===0)return t.makeTensorInfo(a,e[0].dtype,[]);const l=e.filter(c=>G(c.shape)>0);return l.length===1?en({inputs:{x:l[0]},backend:t}):oa(l,r,t)}const eV={kernelName:xa,backendName:"webgl",kernelFunc:Fy};/** * @license * Copyright 2017 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -14903,7 +14903,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam ${C} setOutput(result); } - `}}class nV{constructor(e){this.variableNames=["x","W"],this.outputShape=e.outShape;const t=e.padInfo.front,s=e.padInfo.top,o=e.padInfo.left,r=e.strideDepth,i=e.strideHeight,a=e.strideWidth,l=e.dilationDepth,c=e.dilationHeight,u=e.dilationWidth,h=e.filterDepth,d=e.filterHeight,p=e.filterWidth,f=Math.floor(e.inChannels/4)*4,m=e.inChannels%4;this.userCode=` + `}}class tV{constructor(e){this.variableNames=["x","W"],this.outputShape=e.outShape;const t=e.padInfo.front,s=e.padInfo.top,o=e.padInfo.left,r=e.strideDepth,i=e.strideHeight,a=e.strideWidth,l=e.dilationDepth,c=e.dilationHeight,u=e.dilationWidth,h=e.filterDepth,d=e.filterHeight,p=e.filterWidth,f=Math.floor(e.inChannels/4)*4,m=e.inChannels%4;this.userCode=` const ivec3 strides = ivec3(${r}, ${i}, ${a}); const ivec3 pads = ivec3(${t}, ${s}, ${o}); @@ -15006,7 +15006,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */class Oy{constructor(e,t=!1,s=null,o=!1,r=!1){this.variableNames=["x","W"],this.packedInputs=!0,this.packedOutput=!0,this.customUniforms=[{name:"pads",type:"ivec2"},{name:"strides",type:"ivec2"},{name:"dilations",type:"ivec2"},{name:"inDims",type:"ivec2"}],this.outputShape=e.outShape,this.enableShapeUniforms=Ft(this.outputShape.length);const i=e.padInfo.left,a=e.strideWidth,l=e.dilationWidth,c=e.filterHeight,u=e.filterWidth,h=u;let d=` + */class Oy{constructor(e,t=!1,s=null,o=!1,r=!1){this.variableNames=["x","W"],this.packedInputs=!0,this.packedOutput=!0,this.customUniforms=[{name:"pads",type:"ivec2"},{name:"strides",type:"ivec2"},{name:"dilations",type:"ivec2"},{name:"inDims",type:"ivec2"}],this.outputShape=e.outShape,this.enableShapeUniforms=Dt(this.outputShape.length);const i=e.padInfo.left,a=e.strideWidth,l=e.dilationWidth,c=e.filterHeight,u=e.filterWidth,h=u;let d=` int xR; int xC; int xCOffset; vec4 wTexel; vec4 previous; vec4 final;`;for(let g=0;g= 0 && xCOffset < inDims[1] && xTexelC${x+1}Ready == 0) { @@ -15217,7 +15217,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */class sV{constructor(e,t){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.customUniforms=[{name:"inputShape",type:"ivec4"},{name:"pad",type:"ivec2"},{name:"stride",type:"ivec2"},{name:"dilation",type:"ivec2"},{name:"inChannels",type:"int"},{name:"itemsPerBlockRow",type:"int"},{name:"outWidth",type:"int"}],this.outputShape=e,this.enableShapeUniforms=Ft(this.outputShape.length);const{dataFormat:s}=t,o=Pt(),r=s==="channelsLast",i=r?1:2,a=r?2:3,l=this.enableShapeUniforms?"if(blockIndex < outShape[2] && pos < outShape[1]) {":`if(blockIndex < ${e[2]} && pos < ${e[1]}) {`;let c="";for(let u=0;u<=1;u++)for(let h=0;h<=1;h++)c+=` + */class nV{constructor(e,t){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.customUniforms=[{name:"inputShape",type:"ivec4"},{name:"pad",type:"ivec2"},{name:"stride",type:"ivec2"},{name:"dilation",type:"ivec2"},{name:"inChannels",type:"int"},{name:"itemsPerBlockRow",type:"int"},{name:"outWidth",type:"int"}],this.outputShape=e,this.enableShapeUniforms=Dt(this.outputShape.length);const{dataFormat:s}=t,o=Mt(),r=s==="channelsLast",i=r?1:2,a=r?2:3,l=this.enableShapeUniforms?"if(blockIndex < outShape[2] && pos < outShape[1]) {":`if(blockIndex < ${e[2]} && pos < ${e[1]}) {`;let c="";for(let u=0;u<=1;u++)for(let h=0;h<=1;h++)c+=` blockIndex = rc.z + ${h}; pos = rc.y + ${u}; @@ -15279,7 +15279,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function Tc(n,e){const t=n.length;return t>=3?e?[...n.slice(0,-3),n[t-3]*n[t-2],n[t-1]]:[...n.slice(0,-3),n[t-3],n[t-2]*n[t-1]]:!e&&t===1&&n[0]>1?[n[0],1]:null}function Ly({x:n,filter:e,convInfo:t,backend:s,bias:o=null,preluActivationWeights:r=null,leakyreluAlpha:i=0,activation:a=null}){const l=n.shape,c=s.texData.get(n.dataId),u=t.inChannels,h=l[0]*l[1]*l[2],d=t.outChannels,p=t.dataFormat==="channelsLast",f=!1,m=!1;let g;const x=[];if(r!=null){const y=Tc(r.shape,p);y!=null&&(r=te({inputs:{x:r},backend:s,attrs:{shape:y}}),x.push(r))}if(o!=null){const y=Tc(o.shape,p);y!=null&&(o=te({inputs:{x:o},backend:s,attrs:{shape:y}}),x.push(o))}if(!((h===1||d===1)&&u>ky)&&c.isPacked&&p&&c.texture!=null&&l[2]%2!==0&&_e(c.shape.slice(-3),l.slice(-3))){const y=l[0]*l[1]*(l[2]+1),C={dataId:n.dataId,shape:[1,y,t.inChannels],dtype:n.dtype},I=c.shape;c.shape=c.shape.slice(),c.shape[c.shape.length-2]++,v(xc(c.shape,C.shape),()=>`packed reshape ${c.shape} to ${C.shape} isn't free`);const $=te({inputs:{x:e},backend:s,attrs:{shape:[1,t.inChannels,t.outChannels]}});x.push($);const k=$c({a:C,b:$,backend:s,transposeA:f,transposeB:m,bias:o,activation:a,preluActivationWeights:r,leakyreluAlpha:i}),S=s.texData.get(k.dataId);v(S.isPacked,()=>"batchMatMul result is expected to be packed"),c.shape=I,S.shape=t.outShape,g=en({inputs:{x:k},backend:s}),g.shape=t.outShape,x.push(k)}else{const y=t.outHeight*t.outWidth,C=te({inputs:{x:n},backend:s,attrs:{shape:p?[t.batchSize,y,t.inChannels]:[t.batchSize,t.inChannels,y]}}),I=te({inputs:{x:e},backend:s,attrs:{shape:[1,t.inChannels,t.outChannels]}}),$=$c({a:p?C:I,b:p?I:C,transposeA:!p,transposeB:m,backend:s,bias:o,activation:a,preluActivationWeights:r,leakyreluAlpha:i});g=te({inputs:{x:$},backend:s,attrs:{shape:t.outShape}}),x.push(C),x.push(I),x.push($)}for(const y of x)s.disposeIntermediateTensorInfo(y);return g}function My({x:n,filter:e,convInfo:t,backend:s,bias:o=null,preluActivationWeights:r=null,leakyreluAlpha:i=0,activation:a=null}){const{filterWidth:l,filterHeight:c,inChannels:u,outWidth:h,outHeight:d,dataFormat:p}=t,f=p==="channelsLast",m=l*c*u,g=d*h,x=[t.batchSize,m,g],b=!0,w=!1,y=[];if(r!=null){const W=Tc(r.shape,f);W!=null&&(r=te({inputs:{x:r},backend:s,attrs:{shape:W}}),y.push(r))}if(o!=null){const W=Tc(o.shape,f);W!=null&&(o=te({inputs:{x:o},backend:s,attrs:{shape:W}}),y.push(o))}const C=te({inputs:{x:e},backend:s,attrs:{shape:[1,m,G(e.shape)/m]}});y.push(C);const I=new sV(x,t),$=[n.shape,[t.padInfo.top,t.padInfo.left],[t.strideHeight,t.strideWidth],[t.dilationHeight,t.dilationWidth],[t.inChannels],[t.filterWidth*t.inChannels],[t.outWidth]],k=s.runWebGLProgram(I,[n],"float32",$),S=te({inputs:{x:k},backend:s,attrs:{shape:x}});y.push(k),y.push(S);const N=o!=null,A=r!=null,_=a==="leakyrelu",E=a?ta(a,!0):null,M=new yy(f?S.shape:C.shape,f?C.shape:S.shape,f?[t.batchSize,g,t.outChannels]:[t.batchSize,t.outChannels,g],b,w,N,E,A,_),z=f?[S,C]:[C,S];if(o&&z.push(o),A&&z.push(r),_){const W=s.makeTensorInfo([],"float32",xs(i,"float32"));z.push(W),y.push(W)}const P=s.runWebGLProgram(M,z,"float32"),H=te({inputs:{x:P},backend:s,attrs:{shape:t.outShape}});y.push(P);for(const W of y)s.disposeIntermediateTensorInfo(W);return H}/** + */function Tc(n,e){const t=n.length;return t>=3?e?[...n.slice(0,-3),n[t-3]*n[t-2],n[t-1]]:[...n.slice(0,-3),n[t-3],n[t-2]*n[t-1]]:!e&&t===1&&n[0]>1?[n[0],1]:null}function Ly({x:n,filter:e,convInfo:t,backend:s,bias:o=null,preluActivationWeights:r=null,leakyreluAlpha:i=0,activation:a=null}){const l=n.shape,c=s.texData.get(n.dataId),u=t.inChannels,h=l[0]*l[1]*l[2],d=t.outChannels,p=t.dataFormat==="channelsLast",f=!1,m=!1;let g;const x=[];if(r!=null){const y=Tc(r.shape,p);y!=null&&(r=te({inputs:{x:r},backend:s,attrs:{shape:y}}),x.push(r))}if(o!=null){const y=Tc(o.shape,p);y!=null&&(o=te({inputs:{x:o},backend:s,attrs:{shape:y}}),x.push(o))}if(!((h===1||d===1)&&u>ky)&&c.isPacked&&p&&c.texture!=null&&l[2]%2!==0&&_e(c.shape.slice(-3),l.slice(-3))){const y=l[0]*l[1]*(l[2]+1),C={dataId:n.dataId,shape:[1,y,t.inChannels],dtype:n.dtype},I=c.shape;c.shape=c.shape.slice(),c.shape[c.shape.length-2]++,k(xc(c.shape,C.shape),()=>`packed reshape ${c.shape} to ${C.shape} isn't free`);const v=te({inputs:{x:e},backend:s,attrs:{shape:[1,t.inChannels,t.outChannels]}});x.push(v);const $=$c({a:C,b:v,backend:s,transposeA:f,transposeB:m,bias:o,activation:a,preluActivationWeights:r,leakyreluAlpha:i}),S=s.texData.get($.dataId);k(S.isPacked,()=>"batchMatMul result is expected to be packed"),c.shape=I,S.shape=t.outShape,g=en({inputs:{x:$},backend:s}),g.shape=t.outShape,x.push($)}else{const y=t.outHeight*t.outWidth,C=te({inputs:{x:n},backend:s,attrs:{shape:p?[t.batchSize,y,t.inChannels]:[t.batchSize,t.inChannels,y]}}),I=te({inputs:{x:e},backend:s,attrs:{shape:[1,t.inChannels,t.outChannels]}}),v=$c({a:p?C:I,b:p?I:C,transposeA:!p,transposeB:m,backend:s,bias:o,activation:a,preluActivationWeights:r,leakyreluAlpha:i});g=te({inputs:{x:v},backend:s,attrs:{shape:t.outShape}}),x.push(C),x.push(I),x.push(v)}for(const y of x)s.disposeIntermediateTensorInfo(y);return g}function My({x:n,filter:e,convInfo:t,backend:s,bias:o=null,preluActivationWeights:r=null,leakyreluAlpha:i=0,activation:a=null}){const{filterWidth:l,filterHeight:c,inChannels:u,outWidth:h,outHeight:d,dataFormat:p}=t,f=p==="channelsLast",m=l*c*u,g=d*h,x=[t.batchSize,m,g],b=!0,w=!1,y=[];if(r!=null){const W=Tc(r.shape,f);W!=null&&(r=te({inputs:{x:r},backend:s,attrs:{shape:W}}),y.push(r))}if(o!=null){const W=Tc(o.shape,f);W!=null&&(o=te({inputs:{x:o},backend:s,attrs:{shape:W}}),y.push(o))}const C=te({inputs:{x:e},backend:s,attrs:{shape:[1,m,G(e.shape)/m]}});y.push(C);const I=new nV(x,t),v=[n.shape,[t.padInfo.top,t.padInfo.left],[t.strideHeight,t.strideWidth],[t.dilationHeight,t.dilationWidth],[t.inChannels],[t.filterWidth*t.inChannels],[t.outWidth]],$=s.runWebGLProgram(I,[n],"float32",v),S=te({inputs:{x:$},backend:s,attrs:{shape:x}});y.push($),y.push(S);const N=o!=null,A=r!=null,_=a==="leakyrelu",E=a?ta(a,!0):null,M=new yy(f?S.shape:C.shape,f?C.shape:S.shape,f?[t.batchSize,g,t.outChannels]:[t.batchSize,t.outChannels,g],b,w,N,E,A,_),z=f?[S,C]:[C,S];if(o&&z.push(o),A&&z.push(r),_){const W=s.makeTensorInfo([],"float32",xs(i,"float32"));z.push(W),y.push(W)}const P=s.runWebGLProgram(M,z,"float32"),H=te({inputs:{x:P},backend:s,attrs:{shape:t.outShape}});y.push(P);for(const W of y)s.disposeIntermediateTensorInfo(W);return H}/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -15294,7 +15294,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function oV(n){const{inputs:e,backend:t,attrs:s}=n,{x:o,filter:r}=e,{strides:i,pad:a,dataFormat:l,dilations:c,dimRoundingMode:u}=s,h=is(l),d=Ct(o.shape,r.shape,i,c,a,u,!1,h);let p;if(d.filterHeight===1&&d.filterWidth===1&&d.dilationHeight===1&&d.dilationWidth===1&&d.strideHeight===1&&d.strideWidth===1&&(d.padInfo.type==="SAME"||d.padInfo.type==="VALID"))p=Ly({x:o,filter:r,convInfo:d,backend:t});else if(d.strideWidth<=2&&h==="channelsLast"&&V().getBool("WEBGL_EXP_CONV")){const m=new Oy(d),g=[[d.padInfo.top,d.padInfo.left],[d.strideHeight,d.strideWidth],[d.dilationHeight,d.dilationWidth],[d.inHeight,d.inWidth]];p=t.runWebGLProgram(m,[o,r],"float32",g)}else if(V().getBool("WEBGL_CONV_IM2COL"))p=My({x:o,filter:r,convInfo:d,backend:t});else{const m=new _y(d);p=t.runWebGLProgram(m,[o,r],"float32")}const f=te({inputs:{x:p},backend:t,attrs:{shape:d.outShape}});return t.disposeIntermediateTensorInfo(p),f}const rV={kernelName:ba,backendName:"webgl",kernelFunc:oV};/** + */function sV(n){const{inputs:e,backend:t,attrs:s}=n,{x:o,filter:r}=e,{strides:i,pad:a,dataFormat:l,dilations:c,dimRoundingMode:u}=s,h=is(l),d=Ct(o.shape,r.shape,i,c,a,u,!1,h);let p;if(d.filterHeight===1&&d.filterWidth===1&&d.dilationHeight===1&&d.dilationWidth===1&&d.strideHeight===1&&d.strideWidth===1&&(d.padInfo.type==="SAME"||d.padInfo.type==="VALID"))p=Ly({x:o,filter:r,convInfo:d,backend:t});else if(d.strideWidth<=2&&h==="channelsLast"&&V().getBool("WEBGL_EXP_CONV")){const m=new Oy(d),g=[[d.padInfo.top,d.padInfo.left],[d.strideHeight,d.strideWidth],[d.dilationHeight,d.dilationWidth],[d.inHeight,d.inWidth]];p=t.runWebGLProgram(m,[o,r],"float32",g)}else if(V().getBool("WEBGL_CONV_IM2COL"))p=My({x:o,filter:r,convInfo:d,backend:t});else{const m=new _y(d);p=t.runWebGLProgram(m,[o,r],"float32")}const f=te({inputs:{x:p},backend:t,attrs:{shape:d.outShape}});return t.disposeIntermediateTensorInfo(p),f}const oV={kernelName:ba,backendName:"webgl",kernelFunc:sV};/** * @license * Copyright 2017 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -15309,7 +15309,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */class iV{constructor(e){this.variableNames=["x","dy"],this.outputShape=e.filterShape;const t=e.strideHeight,s=e.strideWidth,o=e.padInfo.top,r=e.padInfo.left,i=e.dataFormat==="channelsLast";this.userCode=` + */class rV{constructor(e){this.variableNames=["x","dy"],this.outputShape=e.filterShape;const t=e.strideHeight,s=e.strideWidth,o=e.padInfo.top,r=e.padInfo.left,i=e.dataFormat==="channelsLast";this.userCode=` void main() { ivec4 coords = getOutputCoords(); int wR = coords.x; @@ -15346,7 +15346,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam } setOutput(dotProd); } - `}}class aV{constructor(e){this.variableNames=["dy","W"],this.outputShape=e.inShape;const t=e.filterHeight,s=e.filterWidth,o=e.strideHeight,r=e.strideWidth,i=e.dataFormat==="channelsLast",a=t-1-e.padInfo.top,l=s-1-e.padInfo.left,c=i?1:2,u=i?2:3,h=i?3:1;this.userCode=` + `}}class iV{constructor(e){this.variableNames=["dy","W"],this.outputShape=e.inShape;const t=e.filterHeight,s=e.filterWidth,o=e.strideHeight,r=e.strideWidth,i=e.dataFormat==="channelsLast",a=t-1-e.padInfo.top,l=s-1-e.padInfo.left,c=i?1:2,u=i?2:3,h=i?3:1;this.userCode=` const ivec2 pads = ivec2(${a}, ${l}); void main() { @@ -15399,7 +15399,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam } setOutput(dotProd); } - `}}class lV{constructor(e){this.variableNames=["x","dy"],this.outputShape=e.filterShape;const t=e.strideDepth,s=e.strideHeight,o=e.strideWidth,r=e.padInfo.front,i=e.padInfo.top,a=e.padInfo.left;this.userCode=` + `}}class aV{constructor(e){this.variableNames=["x","dy"],this.outputShape=e.filterShape;const t=e.strideDepth,s=e.strideHeight,o=e.strideWidth,r=e.padInfo.front,i=e.padInfo.top,a=e.padInfo.left;this.userCode=` void main() { ivec5 coords = getOutputCoords(); int wF = coords.x; @@ -15441,7 +15441,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam } setOutput(dotProd); } - `}}class cV{constructor(e){this.variableNames=["dy","W"],this.outputShape=e.inShape;const t=e.filterDepth,s=e.filterHeight,o=e.filterWidth,r=e.strideDepth,i=e.strideHeight,a=e.strideWidth,l=t-1-e.padInfo.front,c=s-1-e.padInfo.top,u=o-1-e.padInfo.left;this.userCode=` + `}}class lV{constructor(e){this.variableNames=["dy","W"],this.outputShape=e.inShape;const t=e.filterDepth,s=e.filterHeight,o=e.filterWidth,r=e.strideDepth,i=e.strideHeight,a=e.strideWidth,l=t-1-e.padInfo.front,c=s-1-e.padInfo.top,u=o-1-e.padInfo.left;this.userCode=` const ivec3 pads = ivec3(${l}, ${c}, ${u}); void main() { @@ -15513,7 +15513,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function uV(n){const{inputs:e,backend:t,attrs:s}=n,{x:o,dy:r}=e,{strides:i,pad:a,dataFormat:l,dimRoundingMode:c,filterShape:u}=s,h=is(l),d=Ct(o.shape,u,i,1,a,c,!1,h),p=new iV(d);return t.runWebGLProgram(p,[o,r],"float32")}const hV={kernelName:eu,backendName:"webgl",kernelFunc:uV};/** + */function cV(n){const{inputs:e,backend:t,attrs:s}=n,{x:o,dy:r}=e,{strides:i,pad:a,dataFormat:l,dimRoundingMode:c,filterShape:u}=s,h=is(l),d=Ct(o.shape,u,i,1,a,c,!1,h),p=new rV(d);return t.runWebGLProgram(p,[o,r],"float32")}const uV={kernelName:Qc,backendName:"webgl",kernelFunc:cV};/** * @license * Copyright 2023 Google LLC. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -15528,7 +15528,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */class dV{constructor(e){this.variableNames=["dy","W"],this.packedInputs=!0,this.packedOutput=!0,this.customUniforms=[{name:"strides",type:"vec2"}],this.outputShape=e.inShape,this.enableShapeUniforms=Ft(this.outputShape.length);const t=e.filterHeight,s=e.filterWidth,o=t-1-e.padInfo.top,r=s-1-e.padInfo.left;this.userCode=` + */class hV{constructor(e){this.variableNames=["dy","W"],this.packedInputs=!0,this.packedOutput=!0,this.customUniforms=[{name:"strides",type:"vec2"}],this.outputShape=e.inShape,this.enableShapeUniforms=Dt(this.outputShape.length);const t=e.filterHeight,s=e.filterWidth,o=t-1-e.padInfo.top,r=s-1-e.padInfo.left;this.userCode=` const ivec2 pads = ivec2(${o}, ${r}); void main() { @@ -15617,7 +15617,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function pV(n){const{inputs:e,backend:t,attrs:s}=n,{dy:o,filter:r}=e,{inputShape:i,strides:a,pad:l,dataFormat:c,dimRoundingMode:u}=s,h=is(c),d=Ct(i,r.shape,a,1,l,u,!1,h);if(V().getBool("WEBGL_PACK_CONV2DTRANSPOSE")&&h==="channelsLast"){const p=[[d.strideHeight,d.strideWidth]],f=new dV(d);return t.runWebGLProgram(f,[o,r],"float32",p)}else{const p=new aV(d);return t.runWebGLProgram(p,[o,r],"float32")}}const fV={kernelName:ya,backendName:"webgl",kernelFunc:pV};/** + */function dV(n){const{inputs:e,backend:t,attrs:s}=n,{dy:o,filter:r}=e,{inputShape:i,strides:a,pad:l,dataFormat:c,dimRoundingMode:u}=s,h=is(c),d=Ct(i,r.shape,a,1,l,u,!1,h);if(V().getBool("WEBGL_PACK_CONV2DTRANSPOSE")&&h==="channelsLast"){const p=[[d.strideHeight,d.strideWidth]],f=new hV(d);return t.runWebGLProgram(f,[o,r],"float32",p)}else{const p=new iV(d);return t.runWebGLProgram(p,[o,r],"float32")}}const pV={kernelName:ya,backendName:"webgl",kernelFunc:dV};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -15632,7 +15632,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function mV(n){const{inputs:e,backend:t,attrs:s}=n,{x:o,filter:r}=e,{strides:i,pad:a,dilations:l}=s,c=Is(o.shape,r.shape,i,l,a),u=new nV(c);return t.runWebGLProgram(u,[o,r],"float32")}const gV={kernelName:wa,backendName:"webgl",kernelFunc:mV};/** + */function fV(n){const{inputs:e,backend:t,attrs:s}=n,{x:o,filter:r}=e,{strides:i,pad:a,dilations:l}=s,c=Is(o.shape,r.shape,i,l,a),u=new tV(c);return t.runWebGLProgram(u,[o,r],"float32")}const mV={kernelName:wa,backendName:"webgl",kernelFunc:fV};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -15647,7 +15647,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function xV(n){const{inputs:e,backend:t,attrs:s}=n,{x:o,dy:r}=e,{strides:i,pad:a,filterShape:l}=s,c=Is(o.shape,l,i,1,a),u=new lV(c);return t.runWebGLProgram(u,[o,r],"float32")}const bV={kernelName:tu,backendName:"webgl",kernelFunc:xV};/** + */function gV(n){const{inputs:e,backend:t,attrs:s}=n,{x:o,dy:r}=e,{strides:i,pad:a,filterShape:l}=s,c=Is(o.shape,l,i,1,a),u=new aV(c);return t.runWebGLProgram(u,[o,r],"float32")}const xV={kernelName:Jc,backendName:"webgl",kernelFunc:gV};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -15662,7 +15662,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function yV(n){const{inputs:e,backend:t,attrs:s}=n,{dy:o,filter:r}=e,{pad:i,strides:a,inputShape:l}=s,c=Is(l,r.shape,a,1,i),u=new cV(c);return t.runWebGLProgram(u,[o,r],"float32")}const wV={kernelName:nu,backendName:"webgl",kernelFunc:yV};/** + */function bV(n){const{inputs:e,backend:t,attrs:s}=n,{dy:o,filter:r}=e,{pad:i,strides:a,inputShape:l}=s,c=Is(l,r.shape,a,1,i),u=new lV(c);return t.runWebGLProgram(u,[o,r],"float32")}const yV={kernelName:eu,backendName:"webgl",kernelFunc:bV};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -15677,14 +15677,14 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const CV=mr+` + */const wV=mr+` return cos(x); -`,IV=` +`,CV=` vec4 result = cos(x); bvec4 isNaN = isnan(x); ${To} return result; -`,$V=Re({opSnippet:CV,packedOpSnippet:IV}),kV={kernelName:Rr,backendName:"webgl",kernelFunc:$V};/** +`,IV=Re({opSnippet:wV,packedOpSnippet:CV}),$V={kernelName:Rr,backendName:"webgl",kernelFunc:IV};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -15699,10 +15699,10 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const vV=Re({opSnippet:` + */const kV=Re({opSnippet:` float e2x = exp(-x); return (e2x + 1.0 / e2x) / 2.0; -`}),SV={kernelName:Ar,backendName:"webgl",kernelFunc:vV};/** +`}),vV={kernelName:Ar,backendName:"webgl",kernelFunc:kV};/** * @license * Copyright 2017 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -15717,7 +15717,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */class TV{constructor(e,t,s,o,r){this.variableNames=["Image","Boxes","BoxInd"],this.outputShape=[];const[i,a,l,c]=e,[u]=t,[h,d]=s;this.outputShape=[u,h,d,c];const p=o==="bilinear"?1:0,[f,m]=[`${a-1}.0`,`${l-1}.0`],[g,x,b]=h>1?[`${(a-1)/(h-1)}`,"(y2-y1) * height_ratio",`y1*${f} + float(y)*(height_scale)`]:["0.0","0.0",`0.5 * (y1+y2) * ${f}`],[w,y,C]=d>1?[`${(l-1)/(d-1)}`,"(x2-x1) * width_ratio",`x1*${m} + float(x)*(width_scale)`]:["0.0","0.0",`0.5 * (x1+x2) * ${m}`];this.userCode=` + */class SV{constructor(e,t,s,o,r){this.variableNames=["Image","Boxes","BoxInd"],this.outputShape=[];const[i,a,l,c]=e,[u]=t,[h,d]=s;this.outputShape=[u,h,d,c];const p=o==="bilinear"?1:0,[f,m]=[`${a-1}.0`,`${l-1}.0`],[g,x,b]=h>1?[`${(a-1)/(h-1)}`,"(y2-y1) * height_ratio",`y1*${f} + float(y)*(height_scale)`]:["0.0","0.0",`0.5 * (y1+y2) * ${f}`],[w,y,C]=d>1?[`${(l-1)/(d-1)}`,"(x2-x1) * width_ratio",`x1*${m} + float(x)*(width_scale)`]:["0.0","0.0",`0.5 * (x1+x2) * ${m}`];this.userCode=` const float height_ratio = float(${g}); const float width_ratio = float(${w}); void main() { @@ -15793,7 +15793,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const NV={kernelName:ou,backendName:"webgl",kernelFunc:n=>{const{inputs:e,backend:t,attrs:s}=n,{image:o,boxes:r,boxInd:i}=e,{cropSize:a,method:l,extrapolationValue:c}=s,u=new TV(o.shape,r.shape,a,l,c);return t.runWebGLProgram(u,[o,r,i],"float32")}};var ra;(function(n){n.Prod="*",n.Sum="+"})(ra||(ra={}));class Py{constructor(e,t,s,o){this.op=e,this.outputShape=t,this.variableNames=["x"],this.customUniforms=[{name:"index",type:"float"}];const r=this.outputShape.length,i=this.op===ra.Prod?"1.0":"0.0",a=s?i:`getX(${By(r,"coords",this.op)})`,l=this.outputShape[this.outputShape.length-1];let c="",u="";s?(c=o?`end != ${l-1}`:"end != 0",u=o?"end + 1":"end - 1"):(c=o?`end + pow2 < ${l}`:"end >= pow2",u=o?"end + pow2":"end - pow2"),this.userCode=` + */const TV={kernelName:nu,backendName:"webgl",kernelFunc:n=>{const{inputs:e,backend:t,attrs:s}=n,{image:o,boxes:r,boxInd:i}=e,{cropSize:a,method:l,extrapolationValue:c}=s,u=new SV(o.shape,r.shape,a,l,c);return t.runWebGLProgram(u,[o,r,i],"float32")}};var ra;(function(n){n.Prod="*",n.Sum="+"})(ra||(ra={}));class Py{constructor(e,t,s,o){this.op=e,this.outputShape=t,this.variableNames=["x"],this.customUniforms=[{name:"index",type:"float"}];const r=this.outputShape.length,i=this.op===ra.Prod?"1.0":"0.0",a=s?i:`getX(${By(r,"coords",this.op)})`,l=this.outputShape[this.outputShape.length-1];let c="",u="";s?(c=o?`end != ${l-1}`:"end != 0",u=o?"end + 1":"end - 1"):(c=o?`end + pow2 < ${l}`:"end >= pow2",u=o?"end + pow2":"end - pow2"),this.userCode=` void main() { ${Me(r)} coords = getOutputCoords(); int end = ${zy(r,"coords",this.op)}; @@ -15821,7 +15821,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function Vy(n,e,t,s,o,r){const i=e.shape.length,a=Ze([s],i);let l=e;a!=null&&(l=zt({inputs:{x:e},backend:t,attrs:{perm:a}}));const c=nt(1,i)[0];if(c!==i-1)throw new Error(`WebGL cumprod shader expects an inner-most axis=${e.shape.length-1} but got axis=${s}`);const u=l.shape[c];let h=en({inputs:{x:l},backend:t});for(let d=0;d<=Math.ceil(Math.log2(u))-1;d++){const p=new Py(n,l.shape,!1,r),f=[[d]],m=h;h=t.runWebGLProgram(p,[h],h.dtype,f),t.disposeIntermediateTensorInfo(m)}if(o){const d=new Py(n,l.shape,o,r),p=h;h=t.runWebGLProgram(d,[h],h.dtype),t.disposeIntermediateTensorInfo(p)}if(a!=null){const d=$s(a),p=zt({inputs:{x:h},backend:t,attrs:{perm:d}});return t.disposeIntermediateTensorInfo(h),t.disposeIntermediateTensorInfo(l),p}return h}/** + */function Vy(n,e,t,s,o,r){const i=e.shape.length,a=Ze([s],i);let l=e;a!=null&&(l=Bt({inputs:{x:e},backend:t,attrs:{perm:a}}));const c=nt(1,i)[0];if(c!==i-1)throw new Error(`WebGL cumprod shader expects an inner-most axis=${e.shape.length-1} but got axis=${s}`);const u=l.shape[c];let h=en({inputs:{x:l},backend:t});for(let d=0;d<=Math.ceil(Math.log2(u))-1;d++){const p=new Py(n,l.shape,!1,r),f=[[d]],m=h;h=t.runWebGLProgram(p,[h],h.dtype,f),t.disposeIntermediateTensorInfo(m)}if(o){const d=new Py(n,l.shape,o,r),p=h;h=t.runWebGLProgram(d,[h],h.dtype),t.disposeIntermediateTensorInfo(p)}if(a!=null){const d=$s(a),p=Bt({inputs:{x:h},backend:t,attrs:{perm:d}});return t.disposeIntermediateTensorInfo(h),t.disposeIntermediateTensorInfo(l),p}return h}/** * @license * Copyright 2022 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -15836,7 +15836,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function EV(n){const{inputs:e,backend:t,attrs:s}=n,{x:o}=e,{axis:r,exclusive:i,reverse:a}=s;return Vy(ra.Prod,o,t,r,i,a)}const RV={kernelName:su,backendName:"webgl",kernelFunc:EV};/** + */function NV(n){const{inputs:e,backend:t,attrs:s}=n,{x:o}=e,{axis:r,exclusive:i,reverse:a}=s;return Vy(ra.Prod,o,t,r,i,a)}const EV={kernelName:tu,backendName:"webgl",kernelFunc:NV};/** * @license * Copyright 2022 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -15851,7 +15851,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function AV(n){const{inputs:e,backend:t,attrs:s}=n,{x:o}=e,{axis:r,exclusive:i,reverse:a}=s;return Vy(ra.Sum,o,t,r,i,a)}const DV={kernelName:Ca,backendName:"webgl",kernelFunc:AV};/** + */function RV(n){const{inputs:e,backend:t,attrs:s}=n,{x:o}=e,{axis:r,exclusive:i,reverse:a}=s;return Vy(ra.Sum,o,t,r,i,a)}const AV={kernelName:Ca,backendName:"webgl",kernelFunc:RV};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -15866,7 +15866,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function FV(n){const{inputs:e,backend:t,attrs:s}=n,{x:o,weights:r}=e,{size:i,binaryOutput:a}=s;if(o.shape.length===1){const l=t.readSync(o.dataId),c=t.readSync(r.dataId),u=iy(l,c,r.dtype,r.shape,i);return t.makeTensorInfo([i],r.dtype,u)}else if(o.shape.length===2){const l=t.bufferSync(o),c=t.bufferSync(r),u=WP(l,c,i,a);return t.makeTensorInfo(u.shape,r.dtype,u.values)}throw new Error(`Error in denseBincount: input must be at most rank 2, but got rank${o.shape.length}.`)}const _V={kernelName:ru,backendName:"webgl",kernelFunc:FV};/** + */function DV(n){const{inputs:e,backend:t,attrs:s}=n,{x:o,weights:r}=e,{size:i,binaryOutput:a}=s;if(o.shape.length===1){const l=t.readSync(o.dataId),c=t.readSync(r.dataId),u=iy(l,c,r.dtype,r.shape,i);return t.makeTensorInfo([i],r.dtype,u)}else if(o.shape.length===2){const l=t.bufferSync(o),c=t.bufferSync(r),u=VP(l,c,i,a);return t.makeTensorInfo(u.shape,r.dtype,u.values)}throw new Error(`Error in denseBincount: input must be at most rank 2, but got rank${o.shape.length}.`)}const FV={kernelName:su,backendName:"webgl",kernelFunc:DV};/** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -15881,7 +15881,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */class OV{constructor(e,t,s){this.variableNames=["x"],this.outputShape=[],this.outputShape=e,this.blockSize=t,this.dataFormat=s,this.userCode=` + */class _V{constructor(e,t,s){this.variableNames=["x"],this.outputShape=[],this.outputShape=e,this.blockSize=t,this.dataFormat=s,this.userCode=` void main() { ivec4 coords = getOutputCoords(); int b = coords[0]; @@ -15915,7 +15915,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function LV(n){const{inputs:e,backend:t,attrs:s}=n,{x:o}=e,{blockSize:r,dataFormat:i}=s,a=o.shape[0],l=i==="NHWC"?o.shape[1]:o.shape[2],c=i==="NHWC"?o.shape[2]:o.shape[3],u=i==="NHWC"?o.shape[3]:o.shape[1],h=l*r,d=c*r,p=u/(r*r),f=i==="NHWC"?[a,h,d,p]:[a,p,h,d],m=new OV(f,r,i);return t.runWebGLProgram(m,[o],o.dtype)}const MV={kernelName:iu,backendName:"webgl",kernelFunc:LV};/** + */function OV(n){const{inputs:e,backend:t,attrs:s}=n,{x:o}=e,{blockSize:r,dataFormat:i}=s,a=o.shape[0],l=i==="NHWC"?o.shape[1]:o.shape[2],c=i==="NHWC"?o.shape[2]:o.shape[3],u=i==="NHWC"?o.shape[3]:o.shape[1],h=l*r,d=c*r,p=u/(r*r),f=i==="NHWC"?[a,h,d,p]:[a,p,h,d],m=new _V(f,r,i);return t.runWebGLProgram(m,[o],o.dtype)}const LV={kernelName:ou,backendName:"webgl",kernelFunc:OV};/** * @license * Copyright 2017 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -15930,7 +15930,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */class Wy{constructor(e,t=!1,s=null,o=!1,r=!1){this.variableNames=["x","W"],this.customUniforms=[{name:"pads",type:"ivec2"},{name:"strides",type:"ivec2"},{name:"dilations",type:"ivec2"},{name:"inDims",type:"ivec2"}],this.outputShape=e.outShape,this.enableShapeUniforms=Ft(this.outputShape.length);const i=e.filterHeight,a=e.filterWidth,l=e.outChannels/e.inChannels;let c="",u="";s&&(o?c=`float activation(float a) { + */class Wy{constructor(e,t=!1,s=null,o=!1,r=!1){this.variableNames=["x","W"],this.customUniforms=[{name:"pads",type:"ivec2"},{name:"strides",type:"ivec2"},{name:"dilations",type:"ivec2"},{name:"inDims",type:"ivec2"}],this.outputShape=e.outShape,this.enableShapeUniforms=Dt(this.outputShape.length);const i=e.filterHeight,a=e.filterWidth,l=e.outChannels/e.inChannels;let c="",u="";s&&(o?c=`float activation(float a) { float b = getPreluActivationWeightsAtOutCoords(); ${s} }`:r?c=`float activation(float a) { @@ -15998,7 +15998,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */class Uy{constructor(e,t=!1,s=null,o=!1,r=!1){this.variableNames=["x","W"],this.packedInputs=!0,this.packedOutput=!0,this.customUniforms=[{name:"pads",type:"ivec2"},{name:"strides",type:"ivec2"},{name:"dilations",type:"ivec2"},{name:"inDims",type:"ivec2"}],this.outputShape=e.outShape,this.enableShapeUniforms=Ft(this.outputShape.length);const i=e.outChannels/e.inChannels,a=e.padInfo.left,l=e.strideWidth,c=e.dilationWidth,u=e.filterHeight,h=e.filterWidth,d=h;let p=` + */class Uy{constructor(e,t=!1,s=null,o=!1,r=!1){this.variableNames=["x","W"],this.packedInputs=!0,this.packedOutput=!0,this.customUniforms=[{name:"pads",type:"ivec2"},{name:"strides",type:"ivec2"},{name:"dilations",type:"ivec2"},{name:"inDims",type:"ivec2"}],this.outputShape=e.outShape,this.enableShapeUniforms=Dt(this.outputShape.length);const i=e.outChannels/e.inChannels,a=e.padInfo.left,l=e.strideWidth,c=e.dilationWidth,u=e.filterHeight,h=e.filterWidth,d=h;let p=` int xR; int xC; int xCOffset; vec4 wTexel; vec4 previous; vec4 final;`;for(let x=0;x= 0 && xCOffset < inDims[1] && xTexelC${b+1}Ready == 0) { @@ -16202,7 +16202,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function PV(n){const{inputs:e,backend:t,attrs:s}=n,{x:o,filter:r}=e,{strides:i,pad:a,dilations:l,dimRoundingMode:c}=s;let u=l;u==null&&(u=[1,1]),v(Et(i,u),()=>`Error in depthwiseConv2d: Either strides or dilations must be 1. Got strides ${i} and dilations '${u}'`);const h=Ct(o.shape,r.shape,i,u,a,c,!0);let d;V().getBool("WEBGL_PACK_DEPTHWISECONV")&&h.strideWidth<=2&&h.outChannels/h.inChannels===1?d=new Uy(h):d=new Wy(h);const p=[[h.padInfo.top,h.padInfo.left],[h.strideHeight,h.strideWidth],[h.dilationHeight,h.dilationWidth],[h.inHeight,h.inWidth]];return t.runWebGLProgram(d,[o,r],"float32",p)}const BV={kernelName:Ia,backendName:"webgl",kernelFunc:PV};/** + */function MV(n){const{inputs:e,backend:t,attrs:s}=n,{x:o,filter:r}=e,{strides:i,pad:a,dilations:l,dimRoundingMode:c}=s;let u=l;u==null&&(u=[1,1]),k(Et(i,u),()=>`Error in depthwiseConv2d: Either strides or dilations must be 1. Got strides ${i} and dilations '${u}'`);const h=Ct(o.shape,r.shape,i,u,a,c,!0);let d;V().getBool("WEBGL_PACK_DEPTHWISECONV")&&h.strideWidth<=2&&h.outChannels/h.inChannels===1?d=new Uy(h):d=new Wy(h);const p=[[h.padInfo.top,h.padInfo.left],[h.strideHeight,h.strideWidth],[h.dilationHeight,h.dilationWidth],[h.inHeight,h.inWidth]];return t.runWebGLProgram(d,[o,r],"float32",p)}const PV={kernelName:Ia,backendName:"webgl",kernelFunc:MV};/** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -16217,7 +16217,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */class zV{constructor(e){this.variableNames=["x","dy"],this.outputShape=e.filterShape;const t=e.strideHeight,s=e.strideWidth,o=e.padInfo.top,r=e.padInfo.left,i=e.outChannels/e.inChannels;this.userCode=` + */class BV{constructor(e){this.variableNames=["x","dy"],this.outputShape=e.filterShape;const t=e.strideHeight,s=e.strideWidth,o=e.padInfo.top,r=e.padInfo.left,i=e.outChannels/e.inChannels;this.userCode=` void main() { ivec4 coords = getOutputCoords(); int wR = coords.x; @@ -16252,7 +16252,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam } setOutput(dotProd); } - `}}class VV{constructor(e){this.variableNames=["dy","W"],this.outputShape=e.inShape;const t=e.filterHeight,s=e.filterWidth,o=e.strideHeight,r=e.strideWidth,i=t-1-e.padInfo.top,a=s-1-e.padInfo.left,l=e.outChannels/e.inChannels;this.userCode=` + `}}class zV{constructor(e){this.variableNames=["dy","W"],this.outputShape=e.inShape;const t=e.filterHeight,s=e.filterWidth,o=e.strideHeight,r=e.strideWidth,i=t-1-e.padInfo.top,a=s-1-e.padInfo.left,l=e.outChannels/e.inChannels;this.userCode=` const ivec2 pads = ivec2(${i}, ${a}); void main() { @@ -16312,7 +16312,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function WV(n){const{inputs:e,backend:t,attrs:s}=n,{x:o,dy:r}=e,{strides:i,dilations:a,pad:l,dimRoundingMode:c,filterShape:u}=s,h=Ct(o.shape,u,i,a,l,c,!0),d=new zV(h);return t.runWebGLProgram(d,[o,r],"float32")}const UV={kernelName:au,backendName:"webgl",kernelFunc:WV};/** + */function VV(n){const{inputs:e,backend:t,attrs:s}=n,{x:o,dy:r}=e,{strides:i,dilations:a,pad:l,dimRoundingMode:c,filterShape:u}=s,h=Ct(o.shape,u,i,a,l,c,!0),d=new BV(h);return t.runWebGLProgram(d,[o,r],"float32")}const WV={kernelName:ru,backendName:"webgl",kernelFunc:VV};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -16327,7 +16327,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function GV(n){const{inputs:e,backend:t,attrs:s}=n,{dy:o,filter:r}=e,{strides:i,dilations:a,pad:l,dimRoundingMode:c,inputShape:u}=s,h=Ct(u,r.shape,i,a,l,c,!0),d=new VV(h);return t.runWebGLProgram(d,[o,r],"float32")}const HV={kernelName:lu,backendName:"webgl",kernelFunc:GV};/** + */function UV(n){const{inputs:e,backend:t,attrs:s}=n,{dy:o,filter:r}=e,{strides:i,dilations:a,pad:l,dimRoundingMode:c,inputShape:u}=s,h=Ct(u,r.shape,i,a,l,c,!0),d=new zV(h);return t.runWebGLProgram(d,[o,r],"float32")}const GV={kernelName:iu,backendName:"webgl",kernelFunc:UV};/** * @license * Copyright 2019 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -16342,7 +16342,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */class qV{constructor(e){this.variableNames=["X"],this.outputShape=[e,e],this.userCode=` + */class HV{constructor(e){this.variableNames=["X"],this.outputShape=[e,e],this.userCode=` void main() { ivec2 coords = getOutputCoords(); float val = coords[0] == coords[1] ? getX(coords[0]) : 0.0; @@ -16363,7 +16363,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function jV(n){const{inputs:e,backend:t}=n,{x:s}=e,o=[...s.shape,...s.shape],r=G(s.shape),i=te({inputs:{x:s},backend:t,attrs:{shape:[r]}}),a=new qV(r),l=t.runWebGLProgram(a,[i],i.dtype),c=te({inputs:{x:l},backend:t,attrs:{shape:o}});return t.disposeIntermediateTensorInfo(i),t.disposeIntermediateTensorInfo(l),c}const KV={kernelName:qp,backendName:"webgl",kernelFunc:jV};/** + */function qV(n){const{inputs:e,backend:t}=n,{x:s}=e,o=[...s.shape,...s.shape],r=G(s.shape),i=te({inputs:{x:s},backend:t,attrs:{shape:[r]}}),a=new HV(r),l=t.runWebGLProgram(a,[i],i.dtype),c=te({inputs:{x:l},backend:t,attrs:{shape:o}});return t.disposeIntermediateTensorInfo(i),t.disposeIntermediateTensorInfo(l),c}const jV={kernelName:qp,backendName:"webgl",kernelFunc:qV};/** * @license * Copyright 2017 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -16378,7 +16378,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */class XV{constructor(e){this.variableNames=["x","W"],this.outputShape=e.outShape;const{inHeight:t,inWidth:s,padInfo:o,strideHeight:r,strideWidth:i,filterHeight:a,filterWidth:l,dilationHeight:c,dilationWidth:u}=e,{top:h,left:d}=o;this.userCode=` + */class KV{constructor(e){this.variableNames=["x","W"],this.outputShape=e.outShape;const{inHeight:t,inWidth:s,padInfo:o,strideHeight:r,strideWidth:i,filterHeight:a,filterWidth:l,dilationHeight:c,dilationWidth:u}=e,{top:h,left:d}=o;this.userCode=` const ivec2 strides = ivec2(${r}, ${i}); const ivec2 pads = ivec2(${h}, ${d}); const float neg_infinity = -3.4e38; @@ -16431,7 +16431,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function YV(n){const{inputs:e,backend:t,attrs:s}=n,{x:o,filter:r}=e,{strides:i,pad:a,dilations:l}=s,c=bi(o.shape,r.shape,i,a,"NHWC",l);let u;const h=new XV(c);u=t.runWebGLProgram(h,[o,r],"float32");const d=te({inputs:{x:u},backend:t,attrs:{shape:c.outShape}});return t.disposeIntermediateTensorInfo(u),d}const ZV={kernelName:$a,backendName:"webgl",kernelFunc:YV};/** + */function XV(n){const{inputs:e,backend:t,attrs:s}=n,{x:o,filter:r}=e,{strides:i,pad:a,dilations:l}=s,c=bi(o.shape,r.shape,i,a,"NHWC",l);let u;const h=new KV(c);u=t.runWebGLProgram(h,[o,r],"float32");const d=te({inputs:{x:u},backend:t,attrs:{shape:c.outShape}});return t.disposeIntermediateTensorInfo(u),d}const YV={kernelName:$a,backendName:"webgl",kernelFunc:XV};/** * @license * Copyright 2021 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -16446,7 +16446,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function QV(n){const{inputs:e,backend:t,attrs:s}=n,{equation:o}=s,r=e,{allDims:i,summedDims:a,idDims:l}=ld(o,r.length);ud(i.length,l,r);const{path:c,steps:u}=hd(a,l),h=u.length;let d=null,p=i.length;const f=[];for(let m=0;m=0&&(d=Ic({inputs:{x:d},backend:t,attrs:{axis:c[m]-(i.length-p),keepDims:!1}}),f.push(d)),p--)}for(const m of f)m!==d&&t.disposeIntermediateTensorInfo(m);return d}const JV={kernelName:hu,backendName:"webgl",kernelFunc:QV};/** + */function ZV(n){const{inputs:e,backend:t,attrs:s}=n,{equation:o}=s,r=e,{allDims:i,summedDims:a,idDims:l}=id(o,r.length);ld(i.length,l,r);const{path:c,steps:u}=cd(a,l),h=u.length;let d=null,p=i.length;const f=[];for(let m=0;m=0&&(d=Ic({inputs:{x:d},backend:t,attrs:{axis:c[m]-(i.length-p),keepDims:!1}}),f.push(d)),p--)}for(const m of f)m!==d&&t.disposeIntermediateTensorInfo(m);return d}const QV={kernelName:cu,backendName:"webgl",kernelFunc:ZV};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -16461,7 +16461,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const eW=Re({opSnippet:"return (x >= 0.0) ? x : (exp(x) - 1.0);",packedOpSnippet:` + */const JV=Re({opSnippet:"return (x >= 0.0) ? x : (exp(x) - 1.0);",packedOpSnippet:` vec4 result; result.r = (x.r >= 0.0) ? x.r : (exp(x.r) - 1.0); @@ -16470,7 +16470,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam result.a = (x.a >= 0.0) ? x.a : (exp(x.a) - 1.0); return result; -`}),tW={kernelName:Fr,backendName:"webgl",kernelFunc:eW};/** +`}),eW={kernelName:Fr,backendName:"webgl",kernelFunc:JV};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -16485,10 +16485,10 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const nW="return (b >= 0.0) ? a : a * (b + 1.0);",sW=` + */const tW="return (b >= 0.0) ? a : a * (b + 1.0);",nW=` vec4 bGTEZero = vec4(greaterThanEqual(b, vec4(0.))); return (bGTEZero * a) + ((vec4(1.0) - bGTEZero) * (a * (b + vec4(1.0)))); -`,oW={kernelName:du,backendName:"webgl",kernelFunc:n=>{const{inputs:e,backend:t}=n,{dy:s,y:o}=e,r=V().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new fr(sW,s.shape,o.shape):new So(nW,s.shape,o.shape);return t.runWebGLProgram(r,[s,o],s.dtype)}};/** +`,sW={kernelName:uu,backendName:"webgl",kernelFunc:n=>{const{inputs:e,backend:t}=n,{dy:s,y:o}=e,r=V().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new fr(nW,s.shape,o.shape):new So(tW,s.shape,o.shape);return t.runWebGLProgram(r,[s,o],s.dtype)}};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -16503,9 +16503,9 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const rW=vt({opSnippet:"return float(a == b);",packedOpSnippet:` + */const oW=vt({opSnippet:"return float(a == b);",packedOpSnippet:` return vec4(equal(a, b)); -`,dtype:"bool",cpuKernelImpl:jP}),iW={kernelName:ka,backendName:"webgl",kernelFunc:rW};/** +`,dtype:"bool",cpuKernelImpl:qP}),rW={kernelName:ka,backendName:"webgl",kernelFunc:oW};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -16520,22 +16520,22 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const aW=` + */const iW=` // Error function is calculated approximately with elementary function. // See "Handbook of Mathematical Functions with Formulas, // Graphs, and Mathematical Tables", Abramowitz and Stegun. - float p = ${ed}; - float a1 = ${td}; - float a2 = ${nd}; - float a3 = ${sd}; - float a4 = ${od}; - float a5 = ${rd}; + float p = ${Qh}; + float a1 = ${Jh}; + float a2 = ${ed}; + float a3 = ${td}; + float a4 = ${nd}; + float a5 = ${sd}; float sign = sign(x); x = abs(x); float t = 1.0 / (1.0 + p * x); return sign * (1.0 - (((((a5*t + a4)*t) + a3)*t + a2)*t + a1)*t*exp(-x*x)); -`,lW=Re({opSnippet:aW}),cW={kernelName:_r,backendName:"webgl",kernelFunc:lW};/** +`,aW=Re({opSnippet:iW}),lW={kernelName:_r,backendName:"webgl",kernelFunc:aW};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -16550,9 +16550,9 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const uW=mr+` + */const cW=mr+` return exp(x); -`,Gy=Re({opSnippet:uW,packedOpSnippet:` +`,Gy=Re({opSnippet:cW,packedOpSnippet:` vec4 result = exp(x); bvec4 isNaN = isnan(x); result.r = isNaN.r ? x.r : result.r; @@ -16561,7 +16561,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam result.a = isNaN.a ? x.a : result.a; return result; -`,cpuKernelImpl:KP,dtype:"float32"}),hW={kernelName:Or,backendName:"webgl",kernelFunc:Gy};/** +`,cpuKernelImpl:jP,dtype:"float32"}),uW={kernelName:Or,backendName:"webgl",kernelFunc:Gy};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the License); @@ -16576,7 +16576,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function Sp(n){const{inputs:e,attrs:t,backend:s}=n,{dim:o}=t,{input:r}=e,i=r.shape.length,a=r.shape.slice();let l=o;return o<0&&(v(-(i+1)<=o,()=>`Axis must be in the interval [${-(i+1)}, ${i}]`),l=i+o+1),a.splice(l,0,1),te({inputs:{x:r},backend:s,attrs:{shape:a}})}const dW={kernelName:va,backendName:"webgl",kernelFunc:Sp};/** + */function kp(n){const{inputs:e,attrs:t,backend:s}=n,{dim:o}=t,{input:r}=e,i=r.shape.length,a=r.shape.slice();let l=o;return o<0&&(k(-(i+1)<=o,()=>`Axis must be in the interval [${-(i+1)}, ${i}]`),l=i+o+1),a.splice(l,0,1),te({inputs:{x:r},backend:s,attrs:{shape:a}})}const hW={kernelName:va,backendName:"webgl",kernelFunc:kp};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -16591,7 +16591,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const Hy="return exp(x) - 1.0;",pW=Re({opSnippet:Hy,packedOpSnippet:Hy,cpuKernelImpl:XP}),fW={kernelName:Lr,backendName:"webgl",kernelFunc:pW};/** + */const Hy="return exp(x) - 1.0;",dW=Re({opSnippet:Hy,packedOpSnippet:Hy,cpuKernelImpl:KP}),pW={kernelName:Lr,backendName:"webgl",kernelFunc:dW};/** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -16669,7 +16669,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function mW(n){const{inputs:e,backend:t}=n,{input:s}=e;return jy(s,!1,t)}const gW={kernelName:pu,backendName:"webgl",kernelFunc:mW};/** + */function fW(n){const{inputs:e,backend:t}=n,{input:s}=e;return jy(s,!1,t)}const mW={kernelName:hu,backendName:"webgl",kernelFunc:fW};/** * @license * Copyright 2019 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -16684,7 +16684,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */class xW{constructor(e,t){this.outputShape=[],this.customUniforms=[{name:"value",type:"float"}],this.variableNames=["x"],this.outputShape=e,this.userCode=` + */class gW{constructor(e,t){this.outputShape=[],this.customUniforms=[{name:"value",type:"float"}],this.variableNames=["x"],this.outputShape=e,this.userCode=` void main() { // Input can be obtained from uniform value. setOutput(value); @@ -16704,7 +16704,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function ia(n){const{backend:e,attrs:t}=n,{shape:s,value:o}=t;let{dtype:r}=t;if(r=r||_o(o),r==="string"){const i=et(r,G(s));return i.fill(o),e.makeTensorInfo(s,r,i)}else{const i=new xW(s,o),a=[[o]];return e.runWebGLProgram(i,[],r,a)}}const bW={kernelName:fu,backendName:"webgl",kernelFunc:ia};/** + */function ia(n){const{backend:e,attrs:t}=n,{shape:s,value:o}=t;let{dtype:r}=t;if(r=r||_o(o),r==="string"){const i=et(r,G(s));return i.fill(o),e.makeTensorInfo(s,r,i)}else{const i=new gW(s,o),a=[[o]];return e.runWebGLProgram(i,[],r,a)}}const xW={kernelName:du,backendName:"webgl",kernelFunc:ia};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -16719,7 +16719,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */class yW{constructor(e){this.variableNames=["Image"],this.outputShape=[];const t=e[2];this.outputShape=e,this.userCode=` + */class bW{constructor(e){this.variableNames=["Image"],this.outputShape=[];const t=e[2];this.outputShape=e,this.userCode=` void main() { ivec4 coords = getOutputCoords(); int x = coords[2]; @@ -16748,7 +16748,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const wW={kernelName:mu,backendName:"webgl",kernelFunc:({inputs:n,backend:e})=>{const{image:t}=n,s=e,o=new yW(t.shape);return s.runWebGLProgram(o,[t],t.dtype)}};/** + */const yW={kernelName:pu,backendName:"webgl",kernelFunc:({inputs:n,backend:e})=>{const{image:t}=n,s=e,o=new bW(t.shape);return s.runWebGLProgram(o,[t],t.dtype)}};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -16763,7 +16763,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const Ky="return floor(x);",CW=Re({opSnippet:Ky,packedOpSnippet:Ky,cpuKernelImpl:YP}),IW={kernelName:Mr,backendName:"webgl",kernelFunc:CW};/** + */const Ky="return floor(x);",wW=Re({opSnippet:Ky,packedOpSnippet:Ky,cpuKernelImpl:XP}),CW={kernelName:Mr,backendName:"webgl",kernelFunc:wW};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -16778,7 +16778,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const $W=vt({opSnippet:` + */const IW=vt({opSnippet:` float s = sign(a) * sign(b); int ia = round(a); int ib = round(b); @@ -16809,7 +16809,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam result[3] = idiv(ia[3], ib[3], s[3]); } return vec4(result); -`,dtype:"int32"}),kW={kernelName:Pr,backendName:"webgl",kernelFunc:$W};/** +`,dtype:"int32"}),$W={kernelName:Pr,backendName:"webgl",kernelFunc:IW};/** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -16824,7 +16824,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */class vW{constructor(e){this.variableNames=["A"];const t=Pt(),[s,o]=e;this.outputShape=e,this.userCode=` + */class kW{constructor(e){this.variableNames=["A"];const t=Mt(),[s,o]=e;this.outputShape=e,this.userCode=` void main() { ivec3 coords = getOutputCoords(); int texR = coords[0]; @@ -16861,7 +16861,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */class SW{constructor(e){this.variableNames=["A"],this.packedInputs=!1,this.packedOutput=!0;const t=Pt(),[s,o]=e;this.outputShape=e,this.userCode=` + */class vW{constructor(e){this.variableNames=["A"],this.packedInputs=!1,this.packedOutput=!0;const t=Mt(),[s,o]=e;this.outputShape=e,this.userCode=` void main() { ivec3 coords = getOutputCoords(); int texR = coords[0]; @@ -16910,7 +16910,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const TW={kernelName:Pw,backendName:"webgl",kernelFunc:NW};let xr,Tp=V().getBool("CANVAS2D_WILL_READ_FREQUENTLY_FOR_GPU");function NW(n){const{inputs:e,backend:t,attrs:s}=n;let{pixels:o}=e;const{numChannels:r}=s,i=typeof HTMLVideoElement<"u"&&o instanceof HTMLVideoElement,a=typeof HTMLImageElement<"u"&&o instanceof HTMLImageElement,[l,c]=i?[o.videoWidth,o.videoHeight]:[o.width,o.height],u=[c,l],h=[c,l,r];if(a||i){const m=V().getBool("CANVAS2D_WILL_READ_FREQUENTLY_FOR_GPU");(xr==null||m!==Tp)&&(Tp=m,xr=document.createElement("canvas").getContext("2d",{willReadFrequently:Tp})),xr.canvas.width=l,xr.canvas.height=c,xr.drawImage(o,0,0,l,c),o=xr.canvas}const d=t.makeTensorInfo(u,"int32");t.texData.get(d.dataId).usage=rn.PIXELS,t.gpgpu.uploadPixelDataToTexture(t.getTexture(d.dataId),o);const p=V().getBool("WEBGL_PACK")?new SW(h):new vW(h),f=t.runWebGLProgram(p,[d],"int32");return t.disposeData(d.dataId),f}/** + */const SW={kernelName:Mw,backendName:"webgl",kernelFunc:TW};let xr,vp=V().getBool("CANVAS2D_WILL_READ_FREQUENTLY_FOR_GPU");function TW(n){const{inputs:e,backend:t,attrs:s}=n;let{pixels:o}=e;const{numChannels:r}=s,i=typeof HTMLVideoElement<"u"&&o instanceof HTMLVideoElement,a=typeof HTMLImageElement<"u"&&o instanceof HTMLImageElement,[l,c]=i?[o.videoWidth,o.videoHeight]:[o.width,o.height],u=[c,l],h=[c,l,r];if(a||i){const m=V().getBool("CANVAS2D_WILL_READ_FREQUENTLY_FOR_GPU");(xr==null||m!==vp)&&(vp=m,xr=document.createElement("canvas").getContext("2d",{willReadFrequently:vp})),xr.canvas.width=l,xr.canvas.height=c,xr.drawImage(o,0,0,l,c),o=xr.canvas}const d=t.makeTensorInfo(u,"int32");t.texData.get(d.dataId).usage=rn.PIXELS,t.gpgpu.uploadPixelDataToTexture(t.getTexture(d.dataId),o);const p=V().getBool("WEBGL_PACK")?new vW(h):new kW(h),f=t.runWebGLProgram(p,[d],"int32");return t.disposeData(d.dataId),f}/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -16925,7 +16925,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function EW(n){const{inputs:e,backend:t,attrs:s}=n,{x:o,filter:r,bias:i,preluActivationWeights:a}=e,{strides:l,pad:c,dataFormat:u,dilations:h,dimRoundingMode:d,activation:p,leakyreluAlpha:f}=s,m=is(u),g=Ct(o.shape,r.shape,l,h,c,d,!1,m);let x;const b=[],w=i!=null,y=a!=null,C=p==="leakyrelu",I=()=>{const k=[o,r],S=(N,A)=>{if(A==="NCHW"&&N.shape.length===1&&N.shape[0]!==1){const _=te({inputs:{x:N},backend:t,attrs:{shape:[N.shape[0],1,1]}});return b.push(_),_}return N};if(w&&k.push(S(i,u)),y&&k.push(S(a,u)),C){const N=t.makeTensorInfo([],"float32",xs(f,"float32"));k.push(N),b.push(N)}return k};if(g.filterHeight===1&&g.filterWidth===1&&g.dilationHeight===1&&g.dilationWidth===1&&g.strideHeight===1&&g.strideWidth===1&&(g.padInfo.type==="SAME"||g.padInfo.type==="VALID"))x=Ly({x:o,filter:r,convInfo:g,backend:t,bias:i,activation:p,preluActivationWeights:a,leakyreluAlpha:f});else if(g.strideWidth<=2&&m==="channelsLast"&&V().getBool("WEBGL_EXP_CONV")){const k=p?ta(p,!0):null,S=new Oy(g,w,k,y,C),N=[[g.padInfo.top,g.padInfo.left],[g.strideHeight,g.strideWidth],[g.dilationHeight,g.dilationWidth],[g.inHeight,g.inWidth]],A=I();x=t.runWebGLProgram(S,A,"float32",N)}else if(V().getBool("WEBGL_CONV_IM2COL"))x=My({x:o,filter:r,convInfo:g,backend:t,bias:i,activation:p,preluActivationWeights:a,leakyreluAlpha:f});else{const k=p?ta(p,!1):null,S=new _y(g,w,k,y,C),N=I();x=t.runWebGLProgram(S,N,"float32")}const $=te({inputs:{x},backend:t,attrs:{shape:g.outShape}});return b.push(x),b.forEach(k=>t.disposeIntermediateTensorInfo(k)),$}const RW={kernelName:ul,backendName:"webgl",kernelFunc:EW};/** + */function NW(n){const{inputs:e,backend:t,attrs:s}=n,{x:o,filter:r,bias:i,preluActivationWeights:a}=e,{strides:l,pad:c,dataFormat:u,dilations:h,dimRoundingMode:d,activation:p,leakyreluAlpha:f}=s,m=is(u),g=Ct(o.shape,r.shape,l,h,c,d,!1,m);let x;const b=[],w=i!=null,y=a!=null,C=p==="leakyrelu",I=()=>{const $=[o,r],S=(N,A)=>{if(A==="NCHW"&&N.shape.length===1&&N.shape[0]!==1){const _=te({inputs:{x:N},backend:t,attrs:{shape:[N.shape[0],1,1]}});return b.push(_),_}return N};if(w&&$.push(S(i,u)),y&&$.push(S(a,u)),C){const N=t.makeTensorInfo([],"float32",xs(f,"float32"));$.push(N),b.push(N)}return $};if(g.filterHeight===1&&g.filterWidth===1&&g.dilationHeight===1&&g.dilationWidth===1&&g.strideHeight===1&&g.strideWidth===1&&(g.padInfo.type==="SAME"||g.padInfo.type==="VALID"))x=Ly({x:o,filter:r,convInfo:g,backend:t,bias:i,activation:p,preluActivationWeights:a,leakyreluAlpha:f});else if(g.strideWidth<=2&&m==="channelsLast"&&V().getBool("WEBGL_EXP_CONV")){const $=p?ta(p,!0):null,S=new Oy(g,w,$,y,C),N=[[g.padInfo.top,g.padInfo.left],[g.strideHeight,g.strideWidth],[g.dilationHeight,g.dilationWidth],[g.inHeight,g.inWidth]],A=I();x=t.runWebGLProgram(S,A,"float32",N)}else if(V().getBool("WEBGL_CONV_IM2COL"))x=My({x:o,filter:r,convInfo:g,backend:t,bias:i,activation:p,preluActivationWeights:a,leakyreluAlpha:f});else{const $=p?ta(p,!1):null,S=new _y(g,w,$,y,C),N=I();x=t.runWebGLProgram(S,N,"float32")}const v=te({inputs:{x},backend:t,attrs:{shape:g.outShape}});return b.push(x),b.forEach($=>t.disposeIntermediateTensorInfo($)),v}const EW={kernelName:ul,backendName:"webgl",kernelFunc:NW};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -16940,7 +16940,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function AW(n){const{inputs:e,backend:t,attrs:s}=n,{x:o,filter:r,bias:i,preluActivationWeights:a}=e,{strides:l,pad:c,dilations:u,dimRoundingMode:h,activation:d,leakyreluAlpha:p}=s,f=[];let m=u;m==null&&(m=[1,1]),v(Et(l,m),()=>`Error in depthwiseConv2d: Either strides or dilations must be 1. Got strides ${l} and dilations '${m}'`);const g=Ct(o.shape,r.shape,l,m,c,h,!0),x=V().getBool("WEBGL_PACK_DEPTHWISECONV")&&g.strideWidth<=2&&g.outChannels/g.inChannels===1,b=d?ta(d,x):null,w=[o,r],y=i!=null,C=a!=null,I=d==="leakyrelu";if(y&&w.push(i),C&&w.push(a),I){const N=t.makeTensorInfo([],"float32",xs(p,"float32"));w.push(N),f.push(N)}let $;x?$=new Uy(g,y,b,C,I):$=new Wy(g,y,b,C,I);const k=[[g.padInfo.top,g.padInfo.left],[g.strideHeight,g.strideWidth],[g.dilationHeight,g.dilationWidth],[g.inHeight,g.inWidth]],S=t.runWebGLProgram($,w,"float32",k);return f.forEach(N=>t.disposeIntermediateTensorInfo(N)),S}const DW={kernelName:df,backendName:"webgl",kernelFunc:AW};class FW{constructor(e,t,s,o){this.sliceDim=e,this.strides=t,this.paramsShape=o,this.variableNames=["x","indices"],this.outputShape=s;const r=Me(s.length);let i=` + */function RW(n){const{inputs:e,backend:t,attrs:s}=n,{x:o,filter:r,bias:i,preluActivationWeights:a}=e,{strides:l,pad:c,dilations:u,dimRoundingMode:h,activation:d,leakyreluAlpha:p}=s,f=[];let m=u;m==null&&(m=[1,1]),k(Et(l,m),()=>`Error in depthwiseConv2d: Either strides or dilations must be 1. Got strides ${l} and dilations '${m}'`);const g=Ct(o.shape,r.shape,l,m,c,h,!0),x=V().getBool("WEBGL_PACK_DEPTHWISECONV")&&g.strideWidth<=2&&g.outChannels/g.inChannels===1,b=d?ta(d,x):null,w=[o,r],y=i!=null,C=a!=null,I=d==="leakyrelu";if(y&&w.push(i),C&&w.push(a),I){const N=t.makeTensorInfo([],"float32",xs(p,"float32"));w.push(N),f.push(N)}let v;x?v=new Uy(g,y,b,C,I):v=new Wy(g,y,b,C,I);const $=[[g.padInfo.top,g.padInfo.left],[g.strideHeight,g.strideWidth],[g.dilationHeight,g.dilationWidth],[g.inHeight,g.inWidth]],S=t.runWebGLProgram(v,w,"float32",$);return f.forEach(N=>t.disposeIntermediateTensorInfo(N)),S}const AW={kernelName:df,backendName:"webgl",kernelFunc:RW};class DW{constructor(e,t,s,o){this.sliceDim=e,this.strides=t,this.paramsShape=o,this.variableNames=["x","indices"],this.outputShape=s;const r=Me(s.length);let i=` int index;`;for(let a=0;a= 0) && (index < ${e[2]}) ? 1.0 : 0.0; setOutput(inBounds * getA(${o})); } - `}}function MW(n,e){const t=["resRC.x","resRC.y","resRC.z","resRC.w"],s=[];for(let o=0;o=0,()=>`GatherV2: the index value ${C} is not in [0, ${w-1}]`)}}const c=md(o,r,l,a),u=G(r.shape),h=[],d=te({inputs:{x:o},backend:t,attrs:{shape:[c.batchSize,c.outerSize,c.dimSize,c.sliceSize]}}),p=te({inputs:{x:r},backend:t,attrs:{shape:[c.batchSize,u/c.batchSize]}});h.push(d),h.push(p);const f=[c.batchSize,c.outerSize,u/c.batchSize,c.sliceSize];if(t.shouldExecuteOnCPU([o,r])||o.dtype==="string"){const b=t.bufferSync(p),w=t.bufferSync(d),y=QP(w,b,f);return h.forEach(C=>t.disposeIntermediateTensorInfo(C)),t.makeTensorInfo(c.outputShape,y.dtype,y.values)}const m=new LW(d.shape,f),g=t.runWebGLProgram(m,[d,p],d.dtype);h.push(g);const x=te({inputs:{x:g},backend:t,attrs:{shape:c.outputShape}});return h.forEach(b=>t.disposeIntermediateTensorInfo(b)),x}const PW={kernelName:Ta,backendName:"webgl",kernelFunc:Xy};/** + */function Xy(n){const{inputs:e,backend:t,attrs:s}=n,{x:o,indices:r}=e,{axis:i,batchDims:a}=s,l=$e(i,o.shape)[0];if(V().get("DEBUG")){const b=t.readSync(r.dataId),w=o.shape[l];for(let y=0;y=0,()=>`GatherV2: the index value ${C} is not in [0, ${w-1}]`)}}const c=pd(o,r,l,a),u=G(r.shape),h=[],d=te({inputs:{x:o},backend:t,attrs:{shape:[c.batchSize,c.outerSize,c.dimSize,c.sliceSize]}}),p=te({inputs:{x:r},backend:t,attrs:{shape:[c.batchSize,u/c.batchSize]}});h.push(d),h.push(p);const f=[c.batchSize,c.outerSize,u/c.batchSize,c.sliceSize];if(t.shouldExecuteOnCPU([o,r])||o.dtype==="string"){const b=t.bufferSync(p),w=t.bufferSync(d),y=ZP(w,b,f);return h.forEach(C=>t.disposeIntermediateTensorInfo(C)),t.makeTensorInfo(c.outputShape,y.dtype,y.values)}const m=new OW(d.shape,f),g=t.runWebGLProgram(m,[d,p],d.dtype);h.push(g);const x=te({inputs:{x:g},backend:t,attrs:{shape:c.outputShape}});return h.forEach(b=>t.disposeIntermediateTensorInfo(b)),x}const MW={kernelName:Ta,backendName:"webgl",kernelFunc:Xy};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -17022,9 +17022,9 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const BW=vt({opSnippet:"return float(a > b);",packedOpSnippet:` + */const PW=vt({opSnippet:"return float(a > b);",packedOpSnippet:` return vec4(greaterThan(a, b)); -`,cpuKernelImpl:JP,dtype:"bool"}),zW={kernelName:Na,backendName:"webgl",kernelFunc:BW};/** +`,cpuKernelImpl:QP,dtype:"bool"}),BW={kernelName:Na,backendName:"webgl",kernelFunc:PW};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -17039,9 +17039,9 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const VW=vt({opSnippet:"return float(a >= b);",packedOpSnippet:` + */const zW=vt({opSnippet:"return float(a >= b);",packedOpSnippet:` return vec4(greaterThanEqual(a, b)); -`,dtype:"bool",cpuKernelImpl:e3}),WW={kernelName:Br,backendName:"webgl",kernelFunc:VW};/** +`,dtype:"bool",cpuKernelImpl:JP}),VW={kernelName:Br,backendName:"webgl",kernelFunc:zW};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -17056,7 +17056,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function UW(n){const{inputs:e,backend:t}=n,{input:s}=e;return jy(s,!0,t)}const GW={kernelName:gu,backendName:"webgl",kernelFunc:UW};/** + */function WW(n){const{inputs:e,backend:t}=n,{input:s}=e;return jy(s,!0,t)}const UW={kernelName:fu,backendName:"webgl",kernelFunc:WW};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -17071,7 +17071,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const HW=Re({opSnippet:"return float(!isnan(x) && !isinf(x));",dtype:"bool"}),qW={kernelName:Vr,backendName:"webgl",kernelFunc:HW};/** + */const GW=Re({opSnippet:"return float(!isnan(x) && !isinf(x));",dtype:"bool"}),HW={kernelName:Vr,backendName:"webgl",kernelFunc:GW};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -17086,7 +17086,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const jW=Re({opSnippet:"return float(isinf(x));",dtype:"bool"}),KW={kernelName:Wr,backendName:"webgl",kernelFunc:jW};/** + */const qW=Re({opSnippet:"return float(isinf(x));",dtype:"bool"}),jW={kernelName:Wr,backendName:"webgl",kernelFunc:qW};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -17101,7 +17101,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const XW=Re({opSnippet:"return float(isnan(x));",dtype:"bool"}),YW={kernelName:Ur,backendName:"webgl",kernelFunc:XW};/** + */const KW=Re({opSnippet:"return float(isnan(x));",dtype:"bool"}),XW={kernelName:Ur,backendName:"webgl",kernelFunc:KW};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -17116,9 +17116,9 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const ZW=vt({opSnippet:"return float(a < b);",packedOpSnippet:` + */const YW=vt({opSnippet:"return float(a < b);",packedOpSnippet:` return vec4(lessThan(a, b)); -`,cpuKernelImpl:t3,dtype:"bool"}),QW={kernelName:Ra,backendName:"webgl",kernelFunc:ZW};/** +`,cpuKernelImpl:e3,dtype:"bool"}),ZW={kernelName:Ra,backendName:"webgl",kernelFunc:YW};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -17133,9 +17133,9 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const JW=vt({opSnippet:"return float(a <= b);",packedOpSnippet:` + */const QW=vt({opSnippet:"return float(a <= b);",packedOpSnippet:` return vec4(lessThanEqual(a, b)); -`,cpuKernelImpl:n3,dtype:"bool"}),e4={kernelName:Aa,backendName:"webgl",kernelFunc:JW};/** +`,cpuKernelImpl:t3,dtype:"bool"}),JW={kernelName:Aa,backendName:"webgl",kernelFunc:QW};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -17150,7 +17150,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function t4(n){const{backend:e,attrs:t}=n,{start:s,stop:o,num:r}=t,i=s3(s,o,r);return e.makeTensorInfo([i.length],"float32",i)}const n4={kernelName:Kp,backendName:"webgl",kernelFunc:t4};/** + */function e4(n){const{backend:e,attrs:t}=n,{start:s,stop:o,num:r}=t,i=n3(s,o,r);return e.makeTensorInfo([i.length],"float32",i)}const t4={kernelName:Kp,backendName:"webgl",kernelFunc:e4};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -17165,9 +17165,9 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const s4=mr+` + */const n4=mr+` return x < 0.0 ? 0./0. : log(x); -`,o4=Re({opSnippet:s4,packedOpSnippet:` +`,s4=Re({opSnippet:n4,packedOpSnippet:` vec4 result = log(x); bvec4 isNaN = isnan(x); result.r = isNaN.r ? x.r : (x.r < 0.0 ? 0./0. : result.r); @@ -17175,7 +17175,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam result.b = isNaN.b ? x.b : (x.b < 0.0 ? 0./0. : result.b); result.a = isNaN.a ? x.a : (x.a < 0.0 ? 0./0. : result.a); return result; -`,cpuKernelImpl:o3}),r4={kernelName:Gr,backendName:"webgl",kernelFunc:o4};/** +`,cpuKernelImpl:s3}),o4={kernelName:Gr,backendName:"webgl",kernelFunc:s4};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -17190,9 +17190,9 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const i4=mr+` + */const r4=mr+` return log(1.0 + x); -`,a4=Re({opSnippet:i4}),l4={kernelName:Hr,backendName:"webgl",kernelFunc:a4};/** +`,i4=Re({opSnippet:r4}),a4={kernelName:Hr,backendName:"webgl",kernelFunc:i4};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -17207,11 +17207,11 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const c4=vt({opSnippet:"return float(a >= 1.0 && b >= 1.0);",packedOpSnippet:` + */const l4=vt({opSnippet:"return float(a >= 1.0 && b >= 1.0);",packedOpSnippet:` return vec4( vec4(greaterThanEqual(a, vec4(1.0))) * vec4(greaterThanEqual(b, vec4(1.0)))); -`,dtype:"bool"}),u4={kernelName:Da,backendName:"webgl",kernelFunc:c4};/** +`,dtype:"bool"}),c4={kernelName:Da,backendName:"webgl",kernelFunc:l4};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -17226,7 +17226,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const h4=Re({opSnippet:"return float(!(x >= 1.0));"}),d4={kernelName:Fa,backendName:"webgl",kernelFunc:h4};/** + */const u4=Re({opSnippet:"return float(!(x >= 1.0));"}),h4={kernelName:Fa,backendName:"webgl",kernelFunc:u4};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -17241,12 +17241,12 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const p4=vt({opSnippet:"return float(a >= 1.0 || b >= 1.0);",packedOpSnippet:` + */const d4=vt({opSnippet:"return float(a >= 1.0 || b >= 1.0);",packedOpSnippet:` return min( vec4(greaterThanEqual(a, vec4(1.0))) + vec4(greaterThanEqual(b, vec4(1.0))), vec4(1.0)); -`,dtype:"bool"}),f4={kernelName:_a,backendName:"webgl",kernelFunc:p4};/** +`,dtype:"bool"}),p4={kernelName:_a,backendName:"webgl",kernelFunc:d4};/** * @license * Copyright 2017 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -17261,7 +17261,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */class m4{constructor(e,t,s,o,r){this.variableNames=["x"],this.outputShape=[];const i=t,a=e[3]-1;this.outputShape=e;let l;const c=`float(${s}) + float(${o}) * sum`;r===.5?l=`inversesqrt(${c})`:r===1?l=`1.0/(${c})`:l=`exp(log(${c}) * float(-${r}));`,this.userCode=` + */class f4{constructor(e,t,s,o,r){this.variableNames=["x"],this.outputShape=[];const i=t,a=e[3]-1;this.outputShape=e;let l;const c=`float(${s}) + float(${o}) * sum`;r===.5?l=`inversesqrt(${c})`:r===1?l=`1.0/(${c})`:l=`exp(log(${c}) * float(-${r}));`,this.userCode=` void main() { ivec4 coords = getOutputCoords(); int b = coords[0]; @@ -17295,7 +17295,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */class g4{constructor(e,t,s,o,r){this.variableNames=["x"],this.outputShape=[],this.packedInputs=!0,this.packedOutput=!0;const i=t,a=e[3]-1;this.outputShape=e;let l;const c=`float(${s}) + float(${o}) * sum`;r===.5?l=`inversesqrt(${c})`:r===1?l=`1.0/(${c})`:l=`exp(log(${c}) * float(-${r}));`,this.userCode=` + */class m4{constructor(e,t,s,o,r){this.variableNames=["x"],this.outputShape=[],this.packedInputs=!0,this.packedOutput=!0;const i=t,a=e[3]-1;this.outputShape=e;let l;const c=`float(${s}) + float(${o}) * sum`;r===.5?l=`inversesqrt(${c})`:r===1?l=`1.0/(${c})`:l=`exp(log(${c}) * float(-${r}));`,this.userCode=` void main() { ivec4 coords = getOutputCoords(); int b = coords.x; @@ -17372,7 +17372,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const x4={kernelName:Oa,backendName:"webgl",kernelFunc:n=>{const{inputs:e,backend:t,attrs:s}=n,{x:o}=e,{depthRadius:r,bias:i,alpha:a,beta:l}=s,c=V().getBool("WEBGL_PACK_NORMALIZATION")?new g4(o.shape,r,i,a,l):new m4(o.shape,r,i,a,l);return t.runWebGLProgram(c,[o],o.dtype)}};/** + */const g4={kernelName:Oa,backendName:"webgl",kernelFunc:n=>{const{inputs:e,backend:t,attrs:s}=n,{x:o}=e,{depthRadius:r,bias:i,alpha:a,beta:l}=s,c=V().getBool("WEBGL_PACK_NORMALIZATION")?new m4(o.shape,r,i,a,l):new f4(o.shape,r,i,a,l);return t.runWebGLProgram(c,[o],o.dtype)}};/** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -17387,7 +17387,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */class b4{constructor(e,t,s,o,r){this.variableNames=["inputImage","outputImage","dy"],this.outputShape=[],this.outputShape=e,this.depth=e[3],this.depthRadius=t,this.bias=s,this.alpha=o,this.beta=r,this.userCode=` + */class x4{constructor(e,t,s,o,r){this.variableNames=["inputImage","outputImage","dy"],this.outputShape=[],this.outputShape=e,this.depth=e[3],this.depthRadius=t,this.bias=s,this.alpha=o,this.beta=r,this.userCode=` void main() { ivec4 coords = getOutputCoords(); int b = coords[0]; @@ -17457,7 +17457,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const y4={kernelName:bu,backendName:"webgl",kernelFunc:n=>{const{inputs:e,backend:t,attrs:s}=n,{x:o,y:r,dy:i}=e,{depthRadius:a,bias:l,alpha:c,beta:u}=s,h=new b4(o.shape,a,l,c,u);return t.runWebGLProgram(h,[o,r,i],o.dtype)}};/** + */const b4={kernelName:gu,backendName:"webgl",kernelFunc:n=>{const{inputs:e,backend:t,attrs:s}=n,{x:o,y:r,dy:i}=e,{depthRadius:a,bias:l,alpha:c,beta:u}=s,h=new x4(o.shape,a,l,c,u);return t.runWebGLProgram(h,[o,r,i],o.dtype)}};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -17472,7 +17472,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function w4(n,e,t,s){const o=G(e),i=G(n.shape)/o,a=te({inputs:{x:n},attrs:{shape:[i,o]},backend:s}),l=No(a,n.dtype,"max",s),c=te({inputs:{x:l},attrs:{shape:t},backend:s});return s.disposeIntermediateTensorInfo(a),s.disposeIntermediateTensorInfo(l),c}/** + */function y4(n,e,t,s){const o=G(e),i=G(n.shape)/o,a=te({inputs:{x:n},attrs:{shape:[i,o]},backend:s}),l=No(a,n.dtype,"max",s),c=te({inputs:{x:l},attrs:{shape:t},backend:s});return s.disposeIntermediateTensorInfo(a),s.disposeIntermediateTensorInfo(l),c}/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -17487,7 +17487,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function Yy(n){const{inputs:e,backend:t,attrs:s}=n,{x:o}=e,{reductionIndices:r,keepDims:i}=s,a=o.shape.length,l=$e(r,o.shape);let c=l;const u=Ze(c,a),h=u!=null,d=t.shouldExecuteOnCPU([o]);let p=o;if(h){if(d){const w=t.texData.get(p.dataId).values,y=new Array(a);for(let $=0;$`Error in maxPool: Either strides or dilations must be 1. Got strides ${i} and dilations '${c}'`);const u=pn(o.shape,r,i,c,a,l);if(u.filterWidth===1&&u.filterHeight===1&&_e(u.inShape,u.outShape))return en({inputs:{x:o},backend:t});const h=new na(u,"max",!1);return t.runWebGLProgram(h,[o],o.dtype)}const T4={kernelName:Ma,backendName:"webgl",kernelFunc:S4};/** + */function v4(n){const{inputs:e,backend:t,attrs:s}=n,{x:o}=e;Ji(o,"maxPool");const{filterSize:r,strides:i,pad:a,dimRoundingMode:l}=s,c=1;k(Et(i,c),()=>`Error in maxPool: Either strides or dilations must be 1. Got strides ${i} and dilations '${c}'`);const u=pn(o.shape,r,i,c,a,l);if(u.filterWidth===1&&u.filterHeight===1&&_e(u.inShape,u.outShape))return en({inputs:{x:o},backend:t});const h=new na(u,"max",!1);return t.runWebGLProgram(h,[o],o.dtype)}const S4={kernelName:Ma,backendName:"webgl",kernelFunc:v4};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -17541,7 +17541,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function N4(n){const{inputs:e,backend:t,attrs:s}=n,{x:o}=e,{filterSize:r,strides:i,pad:a,dataFormat:l,dimRoundingMode:c}=s,u=[1,1,1],h=rs(o.shape,r,i,u,a,c,l),d=new $p(h,"max",!1);return t.runWebGLProgram(d,[o],o.dtype)}const E4={kernelName:Pa,backendName:"webgl",kernelFunc:N4};/** + */function T4(n){const{inputs:e,backend:t,attrs:s}=n,{x:o}=e,{filterSize:r,strides:i,pad:a,dataFormat:l,dimRoundingMode:c}=s,u=[1,1,1],h=rs(o.shape,r,i,u,a,c,l),d=new Cp(h,"max",!1);return t.runWebGLProgram(d,[o],o.dtype)}const N4={kernelName:Pa,backendName:"webgl",kernelFunc:T4};/** * @license * Copyright 2017 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -17556,7 +17556,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */class R4{constructor(e){this.variableNames=["dy","maxPos"],this.outputShape=e.inShape;const t=e.strideHeight,s=e.strideWidth,o=e.dilationHeight,r=e.effectiveFilterHeight,i=e.effectiveFilterWidth,a=r-1-e.padInfo.top,l=i-1-e.padInfo.left,c=r*i-1;this.userCode=` + */class E4{constructor(e){this.variableNames=["dy","maxPos"],this.outputShape=e.inShape;const t=e.strideHeight,s=e.strideWidth,o=e.dilationHeight,r=e.effectiveFilterHeight,i=e.effectiveFilterWidth,a=r-1-e.padInfo.top,l=i-1-e.padInfo.left,c=r*i-1;this.userCode=` const ivec2 pads = ivec2(${a}, ${l}); void main() { @@ -17602,7 +17602,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam } setOutput(dotProd); } - `}}class A4{constructor(e){this.variableNames=["dy","maxPos"],this.outputShape=e.inShape;const t=e.strideDepth,s=e.strideHeight,o=e.strideWidth,r=e.dilationDepth,i=e.dilationHeight,a=e.dilationWidth,l=e.effectiveFilterDepth,c=e.effectiveFilterHeight,u=e.effectiveFilterWidth,h=l-1-e.padInfo.front,d=c-1-e.padInfo.top,p=u-1-e.padInfo.left,f=l*c*u-1;this.userCode=` + `}}class R4{constructor(e){this.variableNames=["dy","maxPos"],this.outputShape=e.inShape;const t=e.strideDepth,s=e.strideHeight,o=e.strideWidth,r=e.dilationDepth,i=e.dilationHeight,a=e.dilationWidth,l=e.effectiveFilterDepth,c=e.effectiveFilterHeight,u=e.effectiveFilterWidth,h=l-1-e.padInfo.front,d=c-1-e.padInfo.top,p=u-1-e.padInfo.left,f=l*c*u-1;this.userCode=` const ivec3 pads = ivec3(${h}, ${d}, ${p}); void main() { @@ -17681,7 +17681,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function D4(n){const{inputs:e,backend:t,attrs:s}=n,{dy:o,input:r}=e,i=r,{filterSize:a,strides:l,pad:c,dimRoundingMode:u}=s,h=[1,1,1],d=rs(i.shape,a,l,h,c,u),p=new $p(d,"max",!0),f=t.runWebGLProgram(p,[i],i.dtype),m=new A4(d),g=t.runWebGLProgram(m,[o,f],i.dtype);return t.disposeIntermediateTensorInfo(f),g}const F4={kernelName:wu,backendName:"webgl",kernelFunc:D4};/** + */function A4(n){const{inputs:e,backend:t,attrs:s}=n,{dy:o,input:r}=e,i=r,{filterSize:a,strides:l,pad:c,dimRoundingMode:u}=s,h=[1,1,1],d=rs(i.shape,a,l,h,c,u),p=new Cp(d,"max",!0),f=t.runWebGLProgram(p,[i],i.dtype),m=new R4(d),g=t.runWebGLProgram(m,[o,f],i.dtype);return t.disposeIntermediateTensorInfo(f),g}const D4={kernelName:bu,backendName:"webgl",kernelFunc:A4};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -17696,7 +17696,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function _4(n){const{inputs:e,backend:t,attrs:s}=n,{dy:o,input:r,output:i}=e,a=r;Ji([r,i],"maxPoolGrad");const{filterSize:l,strides:c,pad:u,dimRoundingMode:h}=s,d=pn(a.shape,l,c,1,u,h),p=!0,f=new na(d,"max",p),m=t.runWebGLProgram(f,[a],a.dtype),g=new R4(d),x=t.runWebGLProgram(g,[o,m],a.dtype);return t.disposeIntermediateTensorInfo(m),x}const O4={kernelName:yu,backendName:"webgl",kernelFunc:_4};/** + */function F4(n){const{inputs:e,backend:t,attrs:s}=n,{dy:o,input:r,output:i}=e,a=r;Ji([r,i],"maxPoolGrad");const{filterSize:l,strides:c,pad:u,dimRoundingMode:h}=s,d=pn(a.shape,l,c,1,u,h),p=!0,f=new na(d,"max",p),m=t.runWebGLProgram(f,[a],a.dtype),g=new E4(d),x=t.runWebGLProgram(g,[o,m],a.dtype);return t.disposeIntermediateTensorInfo(m),x}const _4={kernelName:xu,backendName:"webgl",kernelFunc:F4};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -17711,7 +17711,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function L4(n,e,t,s){let o=new na(t,"max",!1);const r=s.runWebGLProgram(o,[n],"float32");o=new na(t,"max",!0,!0,e);const i=s.runWebGLProgram(o,[n],"float32");return[r,i]}/** + */function O4(n,e,t,s){let o=new na(t,"max",!1);const r=s.runWebGLProgram(o,[n],"float32");o=new na(t,"max",!0,!0,e);const i=s.runWebGLProgram(o,[n],"float32");return[r,i]}/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -17726,7 +17726,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const M4={kernelName:Xp,backendName:"webgl",kernelFunc:({inputs:n,attrs:e,backend:t})=>{const{x:s}=n,{filterSize:o,strides:r,pad:i,includeBatchInIndex:a}=e,l=t;v(s.shape.length===4,()=>`Error in maxPool: input must be rank 4 but got rank ${s.shape.length}.`);const c=[1,1];v(Et(r,c),()=>`Error in maxPool: Either strides or dilations must be 1. Got strides ${r} and dilations '${c}'`);const u=pn(s.shape,o,r,c,i),[h,d]=L4(s,a,u,l);return[h,d]}};/** + */const L4={kernelName:Xp,backendName:"webgl",kernelFunc:({inputs:n,attrs:e,backend:t})=>{const{x:s}=n,{filterSize:o,strides:r,pad:i,includeBatchInIndex:a}=e,l=t;k(s.shape.length===4,()=>`Error in maxPool: input must be rank 4 but got rank ${s.shape.length}.`);const c=[1,1];k(Et(r,c),()=>`Error in maxPool: Either strides or dilations must be 1. Got strides ${r} and dilations '${c}'`);const u=pn(s.shape,o,r,c,i),[h,d]=O4(s,a,u,l);return[h,d]}};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -17741,7 +17741,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function P4(n,e,t,s){const o=G(e),i=G(n.shape)/o,a=te({inputs:{x:n},attrs:{shape:[i,o]},backend:s}),l=No(a,"float32","mean",s),c=te({inputs:{x:l},attrs:{shape:t},backend:s});return s.disposeIntermediateTensorInfo(a),s.disposeIntermediateTensorInfo(l),c}/** + */function M4(n,e,t,s){const o=G(e),i=G(n.shape)/o,a=te({inputs:{x:n},attrs:{shape:[i,o]},backend:s}),l=No(a,"float32","mean",s),c=te({inputs:{x:l},attrs:{shape:t},backend:s});return s.disposeIntermediateTensorInfo(a),s.disposeIntermediateTensorInfo(l),c}/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -17756,7 +17756,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const B4={kernelName:Ba,backendName:"webgl",kernelFunc:({inputs:n,attrs:e,backend:t})=>{const{x:s}=n,{keepDims:o,axis:r}=e,i=t,a=s.shape.length,l=$e(r,s.shape);let c=l;const u=Ze(c,a),h=u!=null,d=i.shouldExecuteOnCPU([s]),p=[];let f=s;if(h){if(d){const y=i.texData.get(f.dataId).values,C=new Array(a);for(let k=0;k{const{x:s}=n,{keepDims:o,axis:r}=e,i=t,a=s.shape.length,l=$e(r,s.shape);let c=l;const u=Ze(c,a),h=u!=null,d=i.shouldExecuteOnCPU([s]),p=[];let f=s;if(h){if(d){const y=i.texData.get(f.dataId).values,C=new Array(a);for(let $=0;$u[0]+e[h]+u[1]);const o=e.length,r=Me(o),i=t.map(u=>u[0]).join(","),a=t.map((u,h)=>u[0]+e[h]).join(","),l=["coords[0]","coords[1]","coords[2]","coords[3]"].slice(0,o),c=s==="reflect"?0:1;if(o===1){this.userCode=` + */class H4{constructor(e,t,s){this.variableNames=["x"],this.outputShape=t.map((u,h)=>u[0]+e[h]+u[1]);const o=e.length,r=Me(o),i=t.map(u=>u[0]).join(","),a=t.map((u,h)=>u[0]+e[h]).join(","),l=["coords[0]","coords[1]","coords[2]","coords[3]"].slice(0,o),c=s==="reflect"?0:1;if(o===1){this.userCode=` int start = ${i}; int end = ${a}; @@ -17854,7 +17854,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */class j4{constructor(e,t,s){this.variableNames=["x"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=t.map((f,m)=>f[0]+e[m]+f[1]);const o=e.length,r=Me(o),i=t.map(f=>f[0]).join(","),a=t.map((f,m)=>f[0]+e[m]).join(","),l=Bt("rc",o),c=Bt("source",o),u=`${l[o-1]} < ${this.outputShape[o-1]}`,h=o===1?"source":`vec2(${c.slice(-2).join()})`,d=s==="reflect"?0:1;let p="";if(o===1){const f=` + */class q4{constructor(e,t,s){this.variableNames=["x"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=t.map((f,m)=>f[0]+e[m]+f[1]);const o=e.length,r=Me(o),i=t.map(f=>f[0]).join(","),a=t.map((f,m)=>f[0]+e[m]).join(","),l=Pt("rc",o),c=Pt("source",o),u=`${l[o-1]} < ${this.outputShape[o-1]}`,h=o===1?"source":`vec2(${c.slice(-2).join()})`,d=s==="reflect"?0:1;let p="";if(o===1){const f=` ${r} source = rc; if (source < start) { source = start * 2 - source - ${d}; @@ -17925,7 +17925,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const K4={kernelName:Va,backendName:"webgl",kernelFunc:({inputs:n,backend:e,attrs:t})=>{const{x:s}=n,{paddings:o,mode:r}=t,i=V().getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new j4(s.shape,o,r):new q4(s.shape,o,r);return e.runWebGLProgram(i,[s],s.dtype)}};/** + */const j4={kernelName:Va,backendName:"webgl",kernelFunc:({inputs:n,backend:e,attrs:t})=>{const{x:s}=n,{paddings:o,mode:r}=t,i=V().getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new q4(s.shape,o,r):new H4(s.shape,o,r);return e.runWebGLProgram(i,[s],s.dtype)}};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -17940,13 +17940,13 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const X4=`if (b == 0.0) return NAN; - return mod(a, b);`,Y4=` + */const K4=`if (b == 0.0) return NAN; + return mod(a, b);`,X4=` vec4 result = mod(a, b); bvec4 isNaN = equal(b, vec4(0.0)); `+To+` return result; -`,Z4=vt({opSnippet:X4,packedOpSnippet:Y4}),Q4={kernelName:Kr,backendName:"webgl",kernelFunc:Z4};/** +`,Y4=vt({opSnippet:K4,packedOpSnippet:X4}),Z4={kernelName:Kr,backendName:"webgl",kernelFunc:Y4};/** * @license * Copyright 2017 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -17961,7 +17961,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,iz=Re({opSnippet:rz}),az={kernelNam * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */class J4{constructor(e,t,s){this.variableNames=["probs"],this.customUniforms=[{name:"seed",type:"float"}],this.outputShape=[e,s],this.userCode=` + */class Q4{constructor(e,t,s){this.variableNames=["probs"],this.customUniforms=[{name:"seed",type:"float"}],this.outputShape=[e,s],this.userCode=` void main() { ivec2 coords = getOutputCoords(); int batch = coords[0]; @@ -18018,7 +18018,7 @@ return a / b;`,packedOpSnippet:` } return result; -`,checkOutOfBounds:!0}),eU={kernelName:Dr,backendName:"webgl",kernelFunc:Zy};/** +`,checkOutOfBounds:!0}),J4={kernelName:Dr,backendName:"webgl",kernelFunc:Zy};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -18033,7 +18033,7 @@ return a / b;`,packedOpSnippet:` * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const Qy="return a - b;",Jy=vt({opSnippet:Qy,packedOpSnippet:Qy,supportsComplex:!0,cpuKernelImpl:N3}),tU={kernelName:ui,backendName:"webgl",kernelFunc:Jy};/** + */const Qy="return a - b;",Jy=vt({opSnippet:Qy,packedOpSnippet:Qy,supportsComplex:!0,cpuKernelImpl:T3}),eU={kernelName:ui,backendName:"webgl",kernelFunc:Jy};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -18048,7 +18048,7 @@ return a / b;`,packedOpSnippet:` * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function ew(n){const{inputs:e,backend:t,attrs:s}=n,{logits:o}=e,{dim:r}=s,i=$e([r],o.shape),a=Yy({inputs:{x:o},backend:t,attrs:{reductionIndices:i,keepDims:!1}}),l=at(a.shape,i),c=te({inputs:{x:a},backend:t,attrs:{shape:l}}),u=Jy({inputs:{a:o,b:c},backend:t}),h=Gy({inputs:{x:u},backend:t}),d=Ic({inputs:{x:h},backend:t,attrs:{axis:i,keepDims:!1}}),p=te({inputs:{x:d},backend:t,attrs:{shape:l}}),f=Zy({inputs:{a:h,b:p},backend:t});return t.disposeIntermediateTensorInfo(a),t.disposeIntermediateTensorInfo(c),t.disposeIntermediateTensorInfo(u),t.disposeIntermediateTensorInfo(h),t.disposeIntermediateTensorInfo(d),t.disposeIntermediateTensorInfo(p),f}const nU={kernelName:rl,backendName:"webgl",kernelFunc:ew};/** + */function ew(n){const{inputs:e,backend:t,attrs:s}=n,{logits:o}=e,{dim:r}=s,i=$e([r],o.shape),a=Yy({inputs:{x:o},backend:t,attrs:{reductionIndices:i,keepDims:!1}}),l=at(a.shape,i),c=te({inputs:{x:a},backend:t,attrs:{shape:l}}),u=Jy({inputs:{a:o,b:c},backend:t}),h=Gy({inputs:{x:u},backend:t}),d=Ic({inputs:{x:h},backend:t,attrs:{axis:i,keepDims:!1}}),p=te({inputs:{x:d},backend:t,attrs:{shape:l}}),f=Zy({inputs:{a:h,b:p},backend:t});return t.disposeIntermediateTensorInfo(a),t.disposeIntermediateTensorInfo(c),t.disposeIntermediateTensorInfo(u),t.disposeIntermediateTensorInfo(h),t.disposeIntermediateTensorInfo(d),t.disposeIntermediateTensorInfo(p),f}const tU={kernelName:rl,backendName:"webgl",kernelFunc:ew};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -18063,7 +18063,7 @@ return a / b;`,packedOpSnippet:` * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function sU(n){const{inputs:e,backend:t,attrs:s}=n,{logits:o}=e,{numSamples:r,seed:i,normalized:a}=s,l=a?o:ew({inputs:{logits:o},backend:t,attrs:{dim:o.shape.length-1}}),c=l.shape[0],u=l.shape[1],h=new J4(c,u,r),d=[[i]],p=t.runWebGLProgram(h,[l],"int32",d);return a||t.disposeIntermediateTensorInfo(l),p}const oU={kernelName:Yp,backendName:"webgl",kernelFunc:sU};/** + */function nU(n){const{inputs:e,backend:t,attrs:s}=n,{logits:o}=e,{numSamples:r,seed:i,normalized:a}=s,l=a?o:ew({inputs:{logits:o},backend:t,attrs:{dim:o.shape.length-1}}),c=l.shape[0],u=l.shape[1],h=new Q4(c,u,r),d=[[i]],p=t.runWebGLProgram(h,[l],"int32",d);return a||t.disposeIntermediateTensorInfo(l),p}const sU={kernelName:Yp,backendName:"webgl",kernelFunc:nU};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -18078,9 +18078,9 @@ return a / b;`,packedOpSnippet:` * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const rU=In+` + */const oU=In+` return -x; -`,iU=` +`,rU=` vec4 result = -x; bvec4 isNaN = isnan(x); @@ -18090,7 +18090,7 @@ return a / b;`,packedOpSnippet:` result.a = isNaN.a ? x.a : result.a; return result; -`;function aU(n){const{inputs:e,backend:t}=n,{x:s}=e;if(t.shouldExecuteOnCPU([s])){const r=t.texData.get(s.dataId),[i,a]=c3(r.values,s.shape,s.dtype);return t.makeTensorInfo(a,s.dtype,i)}let o;return V().getBool("WEBGL_PACK_UNARY_OPERATIONS")?o=new Ms(s.shape,iU):o=new ts(s.shape,rU),t.runWebGLProgram(o,[s],s.dtype)}const lU={kernelName:Wa,backendName:"webgl",kernelFunc:aU};/** +`;function iU(n){const{inputs:e,backend:t}=n,{x:s}=e;if(t.shouldExecuteOnCPU([s])){const r=t.texData.get(s.dataId),[i,a]=l3(r.values,s.shape,s.dtype);return t.makeTensorInfo(a,s.dtype,i)}let o;return V().getBool("WEBGL_PACK_UNARY_OPERATIONS")?o=new Ms(s.shape,rU):o=new ts(s.shape,oU),t.runWebGLProgram(o,[s],s.dtype)}const aU={kernelName:Wa,backendName:"webgl",kernelFunc:iU};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -18105,7 +18105,7 @@ return a / b;`,packedOpSnippet:` * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const cU=Lh;function uU(n){tn("tf.nonMaxSuppression() in webgl locks the UI thread. Call tf.nonMaxSuppressionAsync() instead");const{inputs:e,backend:t,attrs:s}=n,{boxes:o,scores:r}=e,{maxOutputSize:i,iouThreshold:a,scoreThreshold:l}=s,c=t.readSync(o.dataId),u=t.readSync(r.dataId),{selectedIndices:h}=cU(c,u,i,a,l);return t.makeTensorInfo([h.length],"int32",new Int32Array(h))}const hU={kernelName:Cu,backendName:"webgl",kernelFunc:uU};/** + */const lU=_h;function cU(n){tn("tf.nonMaxSuppression() in webgl locks the UI thread. Call tf.nonMaxSuppressionAsync() instead");const{inputs:e,backend:t,attrs:s}=n,{boxes:o,scores:r}=e,{maxOutputSize:i,iouThreshold:a,scoreThreshold:l}=s,c=t.readSync(o.dataId),u=t.readSync(r.dataId),{selectedIndices:h}=lU(c,u,i,a,l);return t.makeTensorInfo([h.length],"int32",new Int32Array(h))}const uU={kernelName:yu,backendName:"webgl",kernelFunc:cU};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -18120,7 +18120,7 @@ return a / b;`,packedOpSnippet:` * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const dU=Mh;function pU(n){tn("tf.nonMaxSuppression() in webgl locks the UI thread. Call tf.nonMaxSuppressionAsync() instead");const{inputs:e,backend:t,attrs:s}=n,{boxes:o,scores:r}=e,{maxOutputSize:i,iouThreshold:a,scoreThreshold:l,padToMaxOutputSize:c}=s,u=t.readSync(o.dataId),h=t.readSync(r.dataId),{selectedIndices:d,validOutputs:p}=dU(u,h,i,a,l,c);return[t.makeTensorInfo([d.length],"int32",new Int32Array(d)),t.makeTensorInfo([],"int32",new Int32Array([p]))]}const fU={kernelName:Iu,backendName:"webgl",kernelFunc:pU};/** + */const hU=Oh;function dU(n){tn("tf.nonMaxSuppression() in webgl locks the UI thread. Call tf.nonMaxSuppressionAsync() instead");const{inputs:e,backend:t,attrs:s}=n,{boxes:o,scores:r}=e,{maxOutputSize:i,iouThreshold:a,scoreThreshold:l,padToMaxOutputSize:c}=s,u=t.readSync(o.dataId),h=t.readSync(r.dataId),{selectedIndices:d,validOutputs:p}=hU(u,h,i,a,l,c);return[t.makeTensorInfo([d.length],"int32",new Int32Array(d)),t.makeTensorInfo([],"int32",new Int32Array([p]))]}const pU={kernelName:wu,backendName:"webgl",kernelFunc:dU};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -18135,7 +18135,7 @@ return a / b;`,packedOpSnippet:` * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const mU=Ph;function gU(n){tn("tf.nonMaxSuppression() in webgl locks the UI thread. Call tf.nonMaxSuppressionAsync() instead");const{inputs:e,backend:t,attrs:s}=n,{boxes:o,scores:r}=e,{maxOutputSize:i,iouThreshold:a,scoreThreshold:l,softNmsSigma:c}=s,u=t.readSync(o.dataId),h=t.readSync(r.dataId),d=i,p=a,f=l,m=c,{selectedIndices:g,selectedScores:x}=mU(u,h,d,p,f,m);return[t.makeTensorInfo([g.length],"int32",new Int32Array(g)),t.makeTensorInfo([x.length],"float32",new Float32Array(x))]}const xU={kernelName:$u,backendName:"webgl",kernelFunc:gU};/** + */const fU=Lh;function mU(n){tn("tf.nonMaxSuppression() in webgl locks the UI thread. Call tf.nonMaxSuppressionAsync() instead");const{inputs:e,backend:t,attrs:s}=n,{boxes:o,scores:r}=e,{maxOutputSize:i,iouThreshold:a,scoreThreshold:l,softNmsSigma:c}=s,u=t.readSync(o.dataId),h=t.readSync(r.dataId),d=i,p=a,f=l,m=c,{selectedIndices:g,selectedScores:x}=fU(u,h,d,p,f,m);return[t.makeTensorInfo([g.length],"int32",new Int32Array(g)),t.makeTensorInfo([x.length],"float32",new Float32Array(x))]}const gU={kernelName:Cu,backendName:"webgl",kernelFunc:mU};/** * @license * Copyright 2017 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -18150,7 +18150,7 @@ return a / b;`,packedOpSnippet:` * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */class bU{constructor(e,t,s,o){this.variableNames=["indices"],this.outputShape=[e,t],this.userCode=` + */class xU{constructor(e,t,s,o){this.variableNames=["indices"],this.outputShape=[e,t],this.userCode=` void main() { ivec2 coords = getOutputCoords(); int index = round(getIndices(coords.x)); @@ -18172,7 +18172,7 @@ return a / b;`,packedOpSnippet:` * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const yU={kernelName:Ha,backendName:"webgl",kernelFunc:n=>{const{inputs:e,backend:t,attrs:s}=n,{indices:o}=e,{dtype:r,depth:i,onValue:a,offValue:l}=s,c=G(o.shape),u=new bU(c,i,a,l),h=te({inputs:{x:o},backend:t,attrs:{shape:[c]}}),d=t.runWebGLProgram(u,[h],r);t.disposeIntermediateTensorInfo(h);const p=[...o.shape,i],f=te({inputs:{x:d},backend:t,attrs:{shape:p}});return t.disposeIntermediateTensorInfo(d),f}};/** + */const bU={kernelName:Ha,backendName:"webgl",kernelFunc:n=>{const{inputs:e,backend:t,attrs:s}=n,{indices:o}=e,{dtype:r,depth:i,onValue:a,offValue:l}=s,c=G(o.shape),u=new xU(c,i,a,l),h=te({inputs:{x:o},backend:t,attrs:{shape:[c]}}),d=t.runWebGLProgram(u,[h],r);t.disposeIntermediateTensorInfo(h);const p=[...o.shape,i],f=te({inputs:{x:d},backend:t,attrs:{shape:p}});return t.disposeIntermediateTensorInfo(d),f}};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -18187,7 +18187,7 @@ return a / b;`,packedOpSnippet:` * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function Nc(n){const{inputs:e,backend:t}=n,{x:s}=e;if(s.dtype==="complex64"){const o=sa({inputs:{input:s},backend:t}),r=Nc({inputs:{x:o},backend:t}),i=Sc({inputs:{input:s},backend:t}),a=Nc({inputs:{x:i},backend:t}),l=Ps({inputs:{real:r,imag:a},backend:t});return t.disposeIntermediateTensorInfo(o),t.disposeIntermediateTensorInfo(r),t.disposeIntermediateTensorInfo(i),t.disposeIntermediateTensorInfo(a),l}else return ia({attrs:{shape:s.shape,dtype:s.dtype,value:s.dtype==="string"?"":0},backend:t})}const wU={kernelName:ll,backendName:"webgl",kernelFunc:Nc};/** + */function Nc(n){const{inputs:e,backend:t}=n,{x:s}=e;if(s.dtype==="complex64"){const o=sa({inputs:{input:s},backend:t}),r=Nc({inputs:{x:o},backend:t}),i=Sc({inputs:{input:s},backend:t}),a=Nc({inputs:{x:i},backend:t}),l=Ps({inputs:{real:r,imag:a},backend:t});return t.disposeIntermediateTensorInfo(o),t.disposeIntermediateTensorInfo(r),t.disposeIntermediateTensorInfo(i),t.disposeIntermediateTensorInfo(a),l}else return ia({attrs:{shape:s.shape,dtype:s.dtype,value:s.dtype==="string"?"":0},backend:t})}const yU={kernelName:ll,backendName:"webgl",kernelFunc:Nc};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -18202,7 +18202,7 @@ return a / b;`,packedOpSnippet:` * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function tw(n){const{inputs:e,backend:t}=n,{x:s}=e;if(s.dtype==="string")throw new Error("onesLike is not supported under string dtype");if(s.dtype==="complex64"){const o=sa({inputs:{input:s},backend:t}),r=tw({inputs:{x:o},backend:t}),i=Sc({inputs:{input:s},backend:t}),a=Nc({inputs:{x:i},backend:t}),l=Ps({inputs:{real:r,imag:a},backend:t});return t.disposeIntermediateTensorInfo(o),t.disposeIntermediateTensorInfo(r),t.disposeIntermediateTensorInfo(i),t.disposeIntermediateTensorInfo(a),l}else return ia({attrs:{shape:s.shape,dtype:s.dtype,value:1},backend:t})}const CU={kernelName:Ga,backendName:"webgl",kernelFunc:tw};/** + */function tw(n){const{inputs:e,backend:t}=n,{x:s}=e;if(s.dtype==="string")throw new Error("onesLike is not supported under string dtype");if(s.dtype==="complex64"){const o=sa({inputs:{input:s},backend:t}),r=tw({inputs:{x:o},backend:t}),i=Sc({inputs:{input:s},backend:t}),a=Nc({inputs:{x:i},backend:t}),l=Ps({inputs:{real:r,imag:a},backend:t});return t.disposeIntermediateTensorInfo(o),t.disposeIntermediateTensorInfo(r),t.disposeIntermediateTensorInfo(i),t.disposeIntermediateTensorInfo(a),l}else return ia({attrs:{shape:s.shape,dtype:s.dtype,value:1},backend:t})}const wU={kernelName:Ga,backendName:"webgl",kernelFunc:tw};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -18217,7 +18217,7 @@ return a / b;`,packedOpSnippet:` * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function IU(n){const{inputs:e,backend:t,attrs:s}=n,{axis:o}=s;if(e.length===1)return Sp({inputs:{input:e[0]},backend:t,attrs:{dim:o}});const r=e[0].shape,i=e[0].dtype;e.forEach(u=>{Mc(r,u.shape,"All tensors passed to stack must have matching shapes"),v(i===u.dtype,()=>"All tensors passed to stack must have matching dtypes")});const a=[],l=e.map(u=>{const h=Sp({inputs:{input:u},backend:t,attrs:{dim:o}});return a.push(h),h}),c=Fy({inputs:l,backend:t,attrs:{axis:o}});return a.forEach(u=>t.disposeIntermediateTensorInfo(u)),c}const $U={kernelName:qa,backendName:"webgl",kernelFunc:IU};/** + */function CU(n){const{inputs:e,backend:t,attrs:s}=n,{axis:o}=s;if(e.length===1)return kp({inputs:{input:e[0]},backend:t,attrs:{dim:o}});const r=e[0].shape,i=e[0].dtype;e.forEach(u=>{Oc(r,u.shape,"All tensors passed to stack must have matching shapes"),k(i===u.dtype,()=>"All tensors passed to stack must have matching dtypes")});const a=[],l=e.map(u=>{const h=kp({inputs:{input:u},backend:t,attrs:{dim:o}});return a.push(h),h}),c=Fy({inputs:l,backend:t,attrs:{axis:o}});return a.forEach(u=>t.disposeIntermediateTensorInfo(u)),c}const IU={kernelName:qa,backendName:"webgl",kernelFunc:CU};/** * @license * Copyright 2017 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -18232,7 +18232,7 @@ return a / b;`,packedOpSnippet:` * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */class kU{constructor(e,t,s){this.variableNames=["x"],this.customUniforms=[{name:"value",type:"float"}],this.outputShape=t.map((c,u)=>c[0]+e[u]+c[1]);const o=e.length,r=Me(o),i=t.map(c=>c[0]).join(","),a=t.map((c,u)=>c[0]+e[u]).join(","),l=["coords[0]","coords[1]","coords[2]","coords[3]"].slice(0,o);if(o===1){this.userCode=` + */class $U{constructor(e,t,s){this.variableNames=["x"],this.customUniforms=[{name:"value",type:"float"}],this.outputShape=t.map((c,u)=>c[0]+e[u]+c[1]);const o=e.length,r=Me(o),i=t.map(c=>c[0]).join(","),a=t.map((c,u)=>c[0]+e[u]).join(","),l=["coords[0]","coords[1]","coords[2]","coords[3]"].slice(0,o);if(o===1){this.userCode=` int start = ${i}; int end = ${a}; @@ -18272,7 +18272,7 @@ return a / b;`,packedOpSnippet:` * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */class vU{constructor(e,t,s){this.variableNames=["x"],this.packedInputs=!0,this.packedOutput=!0,this.customUniforms=[{name:"value",type:"float"}],this.outputShape=t.map((m,g)=>m[0]+e[g]+m[1]);const o=e.length,r=Me(o),i=t.map(m=>m[0]).join(","),a=t.map((m,g)=>m[0]+e[g]).join(","),l=Bt("rc",o),c=Bt("source",o),u=`${l[o-1]} < ${this.outputShape[o-1]}`,h=o===1?"source":`vec2(${c.slice(-2).join()})`,d=[`${r} rc = outputLoc;`,`${l[o-1]} += 1; + */class kU{constructor(e,t,s){this.variableNames=["x"],this.packedInputs=!0,this.packedOutput=!0,this.customUniforms=[{name:"value",type:"float"}],this.outputShape=t.map((m,g)=>m[0]+e[g]+m[1]);const o=e.length,r=Me(o),i=t.map(m=>m[0]).join(","),a=t.map((m,g)=>m[0]+e[g]).join(","),l=Pt("rc",o),c=Pt("source",o),u=`${l[o-1]} < ${this.outputShape[o-1]}`,h=o===1?"source":`vec2(${c.slice(-2).join()})`,d=[`${r} rc = outputLoc;`,`${l[o-1]} += 1; if(${u}) { `,o===1?"":`} rc = outputLoc; @@ -18311,7 +18311,7 @@ return a / b;`,packedOpSnippet:` * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const nw=n=>{const{inputs:e,backend:t,attrs:s}=n,{x:o}=e,{paddings:r,constantValue:i}=s;if(G(o.shape)===0){const c=r.map((u,h)=>u[0]+o.shape[h]+u[1]);return ia({backend:t,attrs:{shape:c,value:i,dtype:o.dtype}})}const a=V().getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new vU(o.shape,r,i):new kU(o.shape,r,i),l=[[i]];return t.runWebGLProgram(a,[o],o.dtype,l)},SU={kernelName:ja,backendName:"webgl",kernelFunc:nw};/** + */const nw=n=>{const{inputs:e,backend:t,attrs:s}=n,{x:o}=e,{paddings:r,constantValue:i}=s;if(G(o.shape)===0){const c=r.map((u,h)=>u[0]+o.shape[h]+u[1]);return ia({backend:t,attrs:{shape:c,value:i,dtype:o.dtype}})}const a=V().getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new kU(o.shape,r,i):new $U(o.shape,r,i),l=[[i]];return t.runWebGLProgram(a,[o],o.dtype,l)},vU={kernelName:ja,backendName:"webgl",kernelFunc:nw};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -18326,7 +18326,7 @@ return a / b;`,packedOpSnippet:` * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const TU=` + */const SU=` if(a < 0.0 && floor(b) < b){ return NAN; } @@ -18335,7 +18335,7 @@ return a / b;`,packedOpSnippet:` } return (round(mod(b, 2.0)) != 1) ? pow(abs(a), b) : sign(a) * pow(abs(a), b); -`,NU=` +`,TU=` // isModRound1 has 1 for components with round(mod(b, 2.0)) == 1, 0 otherwise. vec4 isModRound1 = vec4(equal(round(mod(b, 2.0)), ivec4(1))); vec4 multiplier = sign(a) * isModRound1 + (vec4(1.0) - isModRound1); @@ -18353,7 +18353,7 @@ return a / b;`,packedOpSnippet:` bvec4 isNaN = bvec4(isNaN1.x && isNaN2.x, isNaN1.y && isNaN2.y, isNaN1.z && isNaN2.z, isNaN1.w && isNaN2.w); `+To+` return result; -`,EU=vt({opSnippet:TU,packedOpSnippet:NU}),RU={kernelName:Yr,backendName:"webgl",kernelFunc:EU};/** +`,NU=vt({opSnippet:SU,packedOpSnippet:TU}),EU={kernelName:Yr,backendName:"webgl",kernelFunc:NU};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -18368,7 +18368,7 @@ return a / b;`,packedOpSnippet:` * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function AU(n){const{inputs:e,backend:t,attrs:s}=n,{x:o}=e,{axis:r,keepDims:i}=s,a=o.shape.length,l=[],c=$e(r,o.shape);let u=c;const h=Ze(u,a);let d=o;h!=null&&(d=zt({inputs:{x:o},backend:t,attrs:{perm:h}}),u=nt(u.length,a),l.push(d)),$t("prod",u,a);let p;if(t.shouldExecuteOnCPU([d])){const f=t.texData.get(d.dataId).values,{outVals:m,outShape:g,outDtype:x}=h3(d.shape,d.dtype,f,u);p=t.makeTensorInfo(g,x,m)}else{const[f,m]=bt(d.shape,u),g=G(m),x=te({inputs:{x:d},backend:t,attrs:{shape:[-1,g]}}),b=Gu(o.dtype),w=No(x,b,"prod",t);p=te({inputs:{x:w},backend:t,attrs:{shape:f}}),l.push(x),l.push(w)}if(i){l.push(p);const f=at(p.shape,c);p=te({inputs:{x:p},backend:t,attrs:{shape:f}})}return l.forEach(f=>t.disposeIntermediateTensorInfo(f)),p}const DU={kernelName:Xa,backendName:"webgl",kernelFunc:AU};/** + */function RU(n){const{inputs:e,backend:t,attrs:s}=n,{x:o}=e,{axis:r,keepDims:i}=s,a=o.shape.length,l=[],c=$e(r,o.shape);let u=c;const h=Ze(u,a);let d=o;h!=null&&(d=Bt({inputs:{x:o},backend:t,attrs:{perm:h}}),u=nt(u.length,a),l.push(d)),$t("prod",u,a);let p;if(t.shouldExecuteOnCPU([d])){const f=t.texData.get(d.dataId).values,{outVals:m,outShape:g,outDtype:x}=u3(d.shape,d.dtype,f,u);p=t.makeTensorInfo(g,x,m)}else{const[f,m]=bt(d.shape,u),g=G(m),x=te({inputs:{x:d},backend:t,attrs:{shape:[-1,g]}}),b=Wu(o.dtype),w=No(x,b,"prod",t);p=te({inputs:{x:w},backend:t,attrs:{shape:f}}),l.push(x),l.push(w)}if(i){l.push(p);const f=at(p.shape,c);p=te({inputs:{x:p},backend:t,attrs:{shape:f}})}return l.forEach(f=>t.disposeIntermediateTensorInfo(f)),p}const AU={kernelName:Xa,backendName:"webgl",kernelFunc:RU};/** * @license * Copyright 2022 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -18383,7 +18383,7 @@ return a / b;`,packedOpSnippet:` * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function FU(n){const{inputs:e,backend:t,attrs:s}=n,{paramsNestedSplits:o,paramsDenseValues:r,indices:i}=e,{outputRaggedRank:a}=s,l=o.map(x=>t.readSync(x.dataId)),c=o.map(x=>x.shape),u=t.readSync(r.dataId),h=t.readSync(i.dataId),[d,p,f]=d3(l,c,u,r.shape,r.dtype,h,i.shape,a),m=d.map(x=>t.makeTensorInfo([x.length],"int32",x)),g=t.makeTensorInfo(f,r.dtype,p);return m.concat([g])}const _U={kernelName:Zp,backendName:"webgl",kernelFunc:FU};/** + */function DU(n){const{inputs:e,backend:t,attrs:s}=n,{paramsNestedSplits:o,paramsDenseValues:r,indices:i}=e,{outputRaggedRank:a}=s,l=o.map(x=>t.readSync(x.dataId)),c=o.map(x=>x.shape),u=t.readSync(r.dataId),h=t.readSync(i.dataId),[d,p,f]=h3(l,c,u,r.shape,r.dtype,h,i.shape,a),m=d.map(x=>t.makeTensorInfo([x.length],"int32",x)),g=t.makeTensorInfo(f,r.dtype,p);return m.concat([g])}const FU={kernelName:Zp,backendName:"webgl",kernelFunc:DU};/** * @license * Copyright 2022 Google LLC. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -18398,7 +18398,7 @@ return a / b;`,packedOpSnippet:` * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function OU(n){const{inputs:e,backend:t}=n,{starts:s,limits:o,deltas:r}=e,i=t.readSync(s.dataId),a=t.readSync(o.dataId),l=t.readSync(r.dataId),[c,u]=p3(i,s.shape,s.dtype,a,o.shape,l,r.shape),h=t.makeTensorInfo([c.length],"int32",c),d=t.makeTensorInfo([u.length],s.dtype,u);return[h,d]}const LU={kernelName:Qp,backendName:"webgl",kernelFunc:OU};/** + */function _U(n){const{inputs:e,backend:t}=n,{starts:s,limits:o,deltas:r}=e,i=t.readSync(s.dataId),a=t.readSync(o.dataId),l=t.readSync(r.dataId),[c,u]=d3(i,s.shape,s.dtype,a,o.shape,l,r.shape),h=t.makeTensorInfo([c.length],"int32",c),d=t.makeTensorInfo([u.length],s.dtype,u);return[h,d]}const OU={kernelName:Qp,backendName:"webgl",kernelFunc:_U};/** * @license * Copyright 2022 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -18413,7 +18413,7 @@ return a / b;`,packedOpSnippet:` * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function MU(n){const{inputs:e,backend:t,attrs:s}=n,{shape:o,values:r,defaultValue:i,rowPartitionTensors:a}=e,{rowPartitionTypes:l}=s,c=t.readSync(o.dataId),u=t.readSync(r.dataId),h=t.readSync(i.dataId),d=a.map(g=>t.readSync(g.dataId)),p=a.map(g=>g.shape),[f,m]=f3(c,o.shape,u,r.shape,r.dtype,h,i.shape,d,p,l);return t.makeTensorInfo(f,r.dtype,m)}const PU={kernelName:Jp,backendName:"webgl",kernelFunc:MU};/** + */function LU(n){const{inputs:e,backend:t,attrs:s}=n,{shape:o,values:r,defaultValue:i,rowPartitionTensors:a}=e,{rowPartitionTypes:l}=s,c=t.readSync(o.dataId),u=t.readSync(r.dataId),h=t.readSync(i.dataId),d=a.map(g=>t.readSync(g.dataId)),p=a.map(g=>g.shape),[f,m]=p3(c,o.shape,u,r.shape,r.dtype,h,i.shape,d,p,l);return t.makeTensorInfo(f,r.dtype,m)}const MU={kernelName:Jp,backendName:"webgl",kernelFunc:LU};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -18428,7 +18428,7 @@ return a / b;`,packedOpSnippet:` * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const sw=n=>{const{backend:e,attrs:t}=n,{start:s,stop:o,step:r,dtype:i}=t,a=m3(s,o,r,i);return e.makeTensorInfo([a.length],i,a)},BU={kernelName:ku,backendName:"webgl",kernelFunc:sw};/** + */const sw=n=>{const{backend:e,attrs:t}=n,{start:s,stop:o,step:r,dtype:i}=t,a=f3(s,o,r,i);return e.makeTensorInfo([a.length],i,a)},PU={kernelName:Iu,backendName:"webgl",kernelFunc:sw};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -18443,7 +18443,7 @@ return a / b;`,packedOpSnippet:` * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const zU=Re({opSnippet:"return 1.0 / x;"}),VU={kernelName:Zr,backendName:"webgl",kernelFunc:zU};/** + */const BU=Re({opSnippet:"return 1.0 / x;"}),zU={kernelName:Zr,backendName:"webgl",kernelFunc:BU};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -18458,9 +18458,9 @@ return a / b;`,packedOpSnippet:` * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const WU=In+` + */const VU=In+` return (x < 0.0) ? 0.0 : x; -`,UU=Re({opSnippet:WU,packedOpSnippet:` +`,WU=Re({opSnippet:VU,packedOpSnippet:` vec4 result = x * vec4(greaterThanEqual(x, vec4(0.0))); bvec4 isNaN = isnan(x); @@ -18470,7 +18470,7 @@ return a / b;`,packedOpSnippet:` result.a = isNaN.a ? x.a : result.a; return result; -`}),GU={kernelName:Qr,backendName:"webgl",kernelFunc:UU};/** +`}),UU={kernelName:Qr,backendName:"webgl",kernelFunc:WU};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -18485,9 +18485,9 @@ return a / b;`,packedOpSnippet:` * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const HU=In+` + */const GU=In+` return (x < 0.0) ? 0.0 : min(6.0, x); -`,qU=Re({opSnippet:HU,packedOpSnippet:` +`,HU=Re({opSnippet:GU,packedOpSnippet:` vec4 result = min(x, vec4(6.)) * vec4(greaterThanEqual(x, vec4(0.0))); bvec4 isNaN = isnan(x); @@ -18497,7 +18497,7 @@ return a / b;`,packedOpSnippet:` result.a = isNaN.a ? x.a : result.a; return result; -`}),jU={kernelName:Jr,backendName:"webgl",kernelFunc:qU};/** +`}),qU={kernelName:Jr,backendName:"webgl",kernelFunc:HU};/** * @license * Copyright 2017 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -18512,7 +18512,7 @@ return a / b;`,packedOpSnippet:` * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */class KU{constructor(e,t,s,o,r){this.variableNames=["A"],this.outputShape=[];const[i,a,l,c]=e;this.outputShape=[i,t,s,c];const u=[o&&t>1?a-1:a,o&&s>1?l-1:l],h=[o&&t>1?t-1:t,o&&s>1?s-1:s];let d;r?d="(vec2(yRC) + vec2(0.5)) * effectiveInputOverOutputRatioRC - vec2(0.5)":d="vec2(yRC) * effectiveInputOverOutputRatioRC",this.userCode=` + */class jU{constructor(e,t,s,o,r){this.variableNames=["A"],this.outputShape=[];const[i,a,l,c]=e;this.outputShape=[i,t,s,c];const u=[o&&t>1?a-1:a,o&&s>1?l-1:l],h=[o&&t>1?t-1:t,o&&s>1?s-1:s];let d;r?d="(vec2(yRC) + vec2(0.5)) * effectiveInputOverOutputRatioRC - vec2(0.5)":d="vec2(yRC) * effectiveInputOverOutputRatioRC",this.userCode=` const vec2 effectiveInputOverOutputRatioRC = vec2( ${u[0]/h[0]}, ${u[1]/h[1]}); @@ -18560,7 +18560,7 @@ return a / b;`,packedOpSnippet:` * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */class XU{constructor(e,t,s,o,r){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=[];const[i,a,l,c]=e;this.outputShape=[i,t,s,c];const u=[o&&t>1?a-1:a,o&&s>1?l-1:l],h=[o&&t>1?t-1:t,o&&s>1?s-1:s];let d;r?d="(vec3(yRC) + vec3(0.5)) * effectiveInputOverOutputRatioRC - vec3(0.5)":d="vec3(yRC) * effectiveInputOverOutputRatioRC",this.userCode=` + */class KU{constructor(e,t,s,o,r){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=[];const[i,a,l,c]=e;this.outputShape=[i,t,s,c];const u=[o&&t>1?a-1:a,o&&s>1?l-1:l],h=[o&&t>1?t-1:t,o&&s>1?s-1:s];let d;r?d="(vec3(yRC) + vec3(0.5)) * effectiveInputOverOutputRatioRC - vec3(0.5)":d="vec3(yRC) * effectiveInputOverOutputRatioRC",this.userCode=` const vec3 effectiveInputOverOutputRatioRC = vec3( ${u[0]/h[0]}, ${u[1]/h[1]}, @@ -18652,7 +18652,7 @@ return a / b;`,packedOpSnippet:` * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function YU(n){const{inputs:e,backend:t,attrs:s}=n,{images:o}=e,{alignCorners:r,halfPixelCenters:i,size:a}=s,[l,c]=a,u=V().getBool("WEBGL_PACK_IMAGE_OPERATIONS")?new XU(o.shape,l,c,r,i):new KU(o.shape,l,c,r,i);return t.runWebGLProgram(u,[o],"float32")}const ZU={kernelName:Qa,backendName:"webgl",kernelFunc:YU};/** + */function XU(n){const{inputs:e,backend:t,attrs:s}=n,{images:o}=e,{alignCorners:r,halfPixelCenters:i,size:a}=s,[l,c]=a,u=V().getBool("WEBGL_PACK_IMAGE_OPERATIONS")?new KU(o.shape,l,c,r,i):new jU(o.shape,l,c,r,i);return t.runWebGLProgram(u,[o],"float32")}const YU={kernelName:Qa,backendName:"webgl",kernelFunc:XU};/** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -18667,7 +18667,7 @@ return a / b;`,packedOpSnippet:` * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */class QU{constructor(e,t,s){this.variableNames=["dy"],this.outputShape=[],this.outputShape=t;const[,o,r]=t,[,i,a]=e,l=[s&&i>1?o-1:o,s&&a>1?r-1:r],c=[s&&i>1?i-1:i,s&&a>1?a-1:a],u=l[0]/c[0],h=l[1]/c[1],d=1/u,p=1/h,f=Math.ceil(d)*2+2,m=Math.ceil(p)*2+2;this.userCode=` + */class ZU{constructor(e,t,s){this.variableNames=["dy"],this.outputShape=[],this.outputShape=t;const[,o,r]=t,[,i,a]=e,l=[s&&i>1?o-1:o,s&&a>1?r-1:r],c=[s&&i>1?i-1:i,s&&a>1?a-1:a],u=l[0]/c[0],h=l[1]/c[1],d=1/u,p=1/h,f=Math.ceil(d)*2+2,m=Math.ceil(p)*2+2;this.userCode=` void main() { ivec4 coords = getOutputCoords(); int b = coords[0]; @@ -18763,7 +18763,7 @@ return a / b;`,packedOpSnippet:` * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function JU(n){const{inputs:e,backend:t,attrs:s}=n,{images:o,dy:r}=e,{alignCorners:i}=s,a=new QU(r.shape,o.shape,i);return t.runWebGLProgram(a,[r],r.dtype)}const eG={kernelName:Tu,backendName:"webgl",kernelFunc:JU};/** + */function QU(n){const{inputs:e,backend:t,attrs:s}=n,{images:o,dy:r}=e,{alignCorners:i}=s,a=new ZU(r.shape,o.shape,i);return t.runWebGLProgram(a,[r],r.dtype)}const JU={kernelName:vu,backendName:"webgl",kernelFunc:QU};/** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -18778,7 +18778,7 @@ return a / b;`,packedOpSnippet:` * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */class tG{constructor(e,t,s,o,r){this.variableNames=["A"],this.outputShape=[];const[i,a,l,c]=e;this.outputShape=[i,t,s,c];const u=[o&&t>1?a-1:a,o&&s>1?l-1:l],h=[o&&t>1?t-1:t,o&&s>1?s-1:s],d=o?"0.5":"0.0";let p;r?p="max((vec2(yRC) + vec2(0.5)) * effectiveInputOverOutputRatioRC, vec2(0.0))":p="vec2(yRC) * effectiveInputOverOutputRatioRC",this.userCode=` + */class eG{constructor(e,t,s,o,r){this.variableNames=["A"],this.outputShape=[];const[i,a,l,c]=e;this.outputShape=[i,t,s,c];const u=[o&&t>1?a-1:a,o&&s>1?l-1:l],h=[o&&t>1?t-1:t,o&&s>1?s-1:s],d=o?"0.5":"0.0";let p;r?p="max((vec2(yRC) + vec2(0.5)) * effectiveInputOverOutputRatioRC, vec2(0.0))":p="vec2(yRC) * effectiveInputOverOutputRatioRC",this.userCode=` const vec2 effectiveInputOverOutputRatioRC = vec2( ${u[0]/h[0]}, ${u[1]/h[1]}); @@ -18815,7 +18815,7 @@ return a / b;`,packedOpSnippet:` * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */class nG{constructor(e,t,s,o,r){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=[];const[i,a,l,c]=e;this.outputShape=[i,t,s,c];const u=[o&&t>1?a-1:a,o&&s>1?l-1:l],h=[o&&t>1?t-1:t,o&&s>1?s-1:s],d=o?"0.5":"0.0";let p;r?p="max((vec3(yRC) + vec3(0.5)) * effectiveInputOverOutputRatioRC, vec3(0.0))":p="vec3(yRC) * effectiveInputOverOutputRatioRC",this.userCode=` + */class tG{constructor(e,t,s,o,r){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=[];const[i,a,l,c]=e;this.outputShape=[i,t,s,c];const u=[o&&t>1?a-1:a,o&&s>1?l-1:l],h=[o&&t>1?t-1:t,o&&s>1?s-1:s],d=o?"0.5":"0.0";let p;r?p="max((vec3(yRC) + vec3(0.5)) * effectiveInputOverOutputRatioRC, vec3(0.0))":p="vec3(yRC) * effectiveInputOverOutputRatioRC",this.userCode=` const vec3 effectiveInputOverOutputRatioRC = vec3( ${u[0]/h[0]}, ${u[1]/h[1]}, @@ -18871,7 +18871,7 @@ return a / b;`,packedOpSnippet:` * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function sG(n){const{inputs:e,backend:t,attrs:s}=n,{images:o}=e,{alignCorners:r,halfPixelCenters:i,size:a}=s,[l,c]=a,u=V().getBool("WEBGL_PACK_IMAGE_OPERATIONS")?new nG(o.shape,l,c,r,i):new tG(o.shape,l,c,r,i);return t.runWebGLProgram(u,[o],o.dtype)}const oG={kernelName:Za,backendName:"webgl",kernelFunc:sG};/** + */function nG(n){const{inputs:e,backend:t,attrs:s}=n,{images:o}=e,{alignCorners:r,halfPixelCenters:i,size:a}=s,[l,c]=a,u=V().getBool("WEBGL_PACK_IMAGE_OPERATIONS")?new tG(o.shape,l,c,r,i):new eG(o.shape,l,c,r,i);return t.runWebGLProgram(u,[o],o.dtype)}const sG={kernelName:Za,backendName:"webgl",kernelFunc:nG};/** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -18886,7 +18886,7 @@ return a / b;`,packedOpSnippet:` * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */class rG{constructor(e,t,s){this.variableNames=["dy"],this.outputShape=[],this.outputShape=t;const[,o,r]=t,[,i,a]=e,l=[s&&i>1?o-1:o,s&&a>1?r-1:r],c=[s&&i>1?i-1:i,s&&a>1?a-1:a],u=l[0]/c[0],h=l[1]/c[1],d=1/u,p=1/h,f=Math.ceil(d)*2+2,m=Math.ceil(p)*2+2;this.userCode=` + */class oG{constructor(e,t,s){this.variableNames=["dy"],this.outputShape=[],this.outputShape=t;const[,o,r]=t,[,i,a]=e,l=[s&&i>1?o-1:o,s&&a>1?r-1:r],c=[s&&i>1?i-1:i,s&&a>1?a-1:a],u=l[0]/c[0],h=l[1]/c[1],d=1/u,p=1/h,f=Math.ceil(d)*2+2,m=Math.ceil(p)*2+2;this.userCode=` void main() { ivec4 coords = getOutputCoords(); int b = coords[0]; @@ -18971,7 +18971,7 @@ return a / b;`,packedOpSnippet:` * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function iG(n){const{inputs:e,backend:t,attrs:s}=n,{images:o,dy:r}=e,{alignCorners:i}=s,a=new rG(r.shape,o.shape,i);return t.runWebGLProgram(a,[r],r.dtype)}const aG={kernelName:Su,backendName:"webgl",kernelFunc:iG};/** + */function rG(n){const{inputs:e,backend:t,attrs:s}=n,{images:o,dy:r}=e,{alignCorners:i}=s,a=new oG(r.shape,o.shape,i);return t.runWebGLProgram(a,[r],r.dtype)}const iG={kernelName:ku,backendName:"webgl",kernelFunc:rG};/** * @license * Copyright 2017 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -18986,7 +18986,7 @@ return a / b;`,packedOpSnippet:` * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */class lG{constructor(e,t){this.variableNames=["x"];const s=e.length;if(s>4)throw new Error(`WebGL backend: Reverse of rank-${s} tensor is not yet supported`);if(this.outputShape=e,s===1){this.userCode=` + */class aG{constructor(e,t){this.variableNames=["x"];const s=e.length;if(s>4)throw new Error(`WebGL backend: Reverse of rank-${s} tensor is not yet supported`);if(this.outputShape=e,s===1){this.userCode=` void main() { int coord = getOutputCoords(); setOutput(getX(${e[0]} - coord - 1)); @@ -19011,7 +19011,7 @@ return a / b;`,packedOpSnippet:` * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */class cG{constructor(e,t){this.variableNames=["x"],this.packedInputs=!0,this.packedOutput=!0;const s=e.length;if(s>4)throw new Error(`WebGL backend: Reverse of rank-${s} tensor is not yet supported`);this.outputShape=e;const o=Bt("rc",s),r=`${o[s-1]} + 1 < ${this.outputShape[s-1]}`,i=`${o[s-2]} + 1 < ${this.outputShape[s-2]}`,a=Me(s);s===1?this.userCode=` + */class lG{constructor(e,t){this.variableNames=["x"],this.packedInputs=!0,this.packedOutput=!0;const s=e.length;if(s>4)throw new Error(`WebGL backend: Reverse of rank-${s} tensor is not yet supported`);this.outputShape=e;const o=Pt("rc",s),r=`${o[s-1]} + 1 < ${this.outputShape[s-1]}`,i=`${o[s-2]} + 1 < ${this.outputShape[s-2]}`,a=Me(s);s===1?this.userCode=` void main(){ int rc = getOutputCoords(); vec4 result = vec4(0.); @@ -19054,7 +19054,7 @@ return a / b;`,packedOpSnippet:` * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function uG(n){const{inputs:e,backend:t,attrs:s}=n,{x:o}=e,{dims:r}=s,i=o.shape.length,a=$e(r,o.shape);if(i===0)return en({inputs:{x:o},backend:t});const l=V().getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new cG(o.shape,a):new lG(o.shape,a);return t.runWebGLProgram(l,[o],o.dtype)}const hG={kernelName:Ja,backendName:"webgl",kernelFunc:uG};/** + */function cG(n){const{inputs:e,backend:t,attrs:s}=n,{x:o}=e,{dims:r}=s,i=o.shape.length,a=$e(r,o.shape);if(i===0)return en({inputs:{x:o},backend:t});const l=V().getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new lG(o.shape,a):new aG(o.shape,a);return t.runWebGLProgram(l,[o],o.dtype)}const uG={kernelName:Ja,backendName:"webgl",kernelFunc:cG};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -19069,7 +19069,7 @@ return a / b;`,packedOpSnippet:` * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */class dG{constructor(e,t){this.variableNames=["Image"],this.outputShape=[],this.customUniforms=[{name:"params",type:"vec4"}];const s=e[1],o=e[2];this.outputShape=e;let r="";typeof t=="number"?r=`float outputValue = ${t.toFixed(2)};`:r=` + */class hG{constructor(e,t){this.variableNames=["Image"],this.outputShape=[],this.customUniforms=[{name:"params",type:"vec4"}];const s=e[1],o=e[2];this.outputShape=e;let r="";typeof t=="number"?r=`float outputValue = ${t.toFixed(2)};`:r=` vec3 fill = vec3(${t.join(",")}); float outputValue = fill[coords[3]];`,this.userCode=` void main() { @@ -19103,7 +19103,7 @@ return a / b;`,packedOpSnippet:` * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const pG={kernelName:_u,backendName:"webgl",kernelFunc:({inputs:n,attrs:e,backend:t})=>{const{image:s}=n,{radians:o,fillValue:r,center:i}=e,a=t,l=new dG(s.shape,r),[c,u]=Zh(i,s.shape[1],s.shape[2]),h=[[c,u,Math.sin(o),Math.cos(o)]];return a.runWebGLProgram(l,[s],s.dtype,h)}};/** + */const dG={kernelName:Du,backendName:"webgl",kernelFunc:({inputs:n,attrs:e,backend:t})=>{const{image:s}=n,{radians:o,fillValue:r,center:i}=e,a=t,l=new hG(s.shape,r),[c,u]=Xh(i,s.shape[1],s.shape[2]),h=[[c,u,Math.sin(o),Math.cos(o)]];return a.runWebGLProgram(l,[s],s.dtype,h)}};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -19118,7 +19118,7 @@ return a / b;`,packedOpSnippet:` * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const fG=Re({opSnippet:` + */const pG=Re({opSnippet:` // OpenGL ES does not support round function. // The algorithm is based on banker's rounding. float base = floor(x); @@ -19133,7 +19133,7 @@ return a / b;`,packedOpSnippet:` return base + 1.0; } } -`}),mG={kernelName:ei,backendName:"webgl",kernelFunc:fG};/** +`}),fG={kernelName:ei,backendName:"webgl",kernelFunc:pG};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -19148,7 +19148,7 @@ return a / b;`,packedOpSnippet:` * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const gG=Re({opSnippet:"return inversesqrt(x);",cpuKernelImpl:g3}),xG={kernelName:ti,backendName:"webgl",kernelFunc:gG};/** + */const mG=Re({opSnippet:"return inversesqrt(x);",cpuKernelImpl:m3}),gG={kernelName:ti,backendName:"webgl",kernelFunc:mG};/** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -19163,7 +19163,7 @@ return a / b;`,packedOpSnippet:` * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */class Np{constructor(e,t,s,o,r,i,a=!0,l=!1){this.variableNames=["updates","indices","defaultValue"],this.outputShape=i;const c=Me(r.length),u=Me(i.length);let h="";s===1?h="i":s===2&&(h="i, j");const d=`getIndices(${h})`;let p="";o===1?p="i":o===2&&(p="i, coords[1]");const f=`getUpdates(${p})`;let m="";l&&(m="coords[0], coords[1]");const g=`getDefaultValue(${m})`,x=t>1?"strides[j]":"strides";this.userCode=` + */class Sp{constructor(e,t,s,o,r,i,a=!0,l=!1){this.variableNames=["updates","indices","defaultValue"],this.outputShape=i;const c=Me(r.length),u=Me(i.length);let h="";s===1?h="i":s===2&&(h="i, j");const d=`getIndices(${h})`;let p="";o===1?p="i":o===2&&(p="i, coords[1]");const f=`getUpdates(${p})`;let m="";l&&(m="coords[0], coords[1]");const g=`getDefaultValue(${m})`,x=t>1?"strides[j]":"strides";this.userCode=` ${c} strides = ${c}(${r}); void main() { @@ -19198,7 +19198,7 @@ return a / b;`,packedOpSnippet:` * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */class bG{constructor(e,t,s,o,r,i,a=!0,l=!1){this.variableNames=["updates","indices","defaultValue"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=i;const c=Me(r.length),u=Me(i.length);let h="";s===1?h="i":s===2&&(h="i, j");const d=`getIndices(${h})`;let p="";o===1?p="i":o===2&&(p="i, coords[1]");const f=`getUpdates(${p})`;let m="";l&&(m="coords[0], coords[1]");const g=`getDefaultValue(${m})`,x=t>1?"strides[j]":"strides",b=t>1?"strides[j + 1]":"strides";this.userCode=` + */class xG{constructor(e,t,s,o,r,i,a=!0,l=!1){this.variableNames=["updates","indices","defaultValue"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=i;const c=Me(r.length),u=Me(i.length);let h="";s===1?h="i":s===2&&(h="i, j");const d=`getIndices(${h})`;let p="";o===1?p="i":o===2&&(p="i, coords[1]");const f=`getUpdates(${p})`;let m="";l&&(m="coords[0], coords[1]");const g=`getDefaultValue(${m})`,x=t>1?"strides[j]":"strides",b=t>1?"strides[j + 1]":"strides";this.userCode=` ${c} strides = ${c}(${r}); void main() { @@ -19250,7 +19250,7 @@ return a / b;`,packedOpSnippet:` * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function yG(n){const{inputs:e,backend:t,attrs:s}=n,{indices:o,updates:r}=e,{shape:i}=s,{sliceRank:a,numUpdates:l,sliceSize:c,strides:u,outputSize:h}=ho(r,o,i),d=[h/c,c];if(h===0)return t.makeTensorInfo(i,o.dtype);const p=te({inputs:{x:o},backend:t,attrs:{shape:[l,a]}}),f=te({inputs:{x:r},backend:t,attrs:{shape:[l,c]}}),m=t.makeTensorInfo([],"float32",new Float32Array([0]));let g;V().getBool("WEBGL_PACK")?g=new bG(l,a,p.shape.length,f.shape.length,u,d):g=new Np(l,a,p.shape.length,f.shape.length,u,d);const x=t.runWebGLProgram(g,[f,p,m],f.dtype),b=te({inputs:{x},backend:t,attrs:{shape:i}});return t.disposeIntermediateTensorInfo(p),t.disposeIntermediateTensorInfo(f),t.disposeIntermediateTensorInfo(x),t.disposeIntermediateTensorInfo(m),b}const wG={kernelName:ef,backendName:"webgl",kernelFunc:yG};/** + */function bG(n){const{inputs:e,backend:t,attrs:s}=n,{indices:o,updates:r}=e,{shape:i}=s,{sliceRank:a,numUpdates:l,sliceSize:c,strides:u,outputSize:h}=ho(r,o,i),d=[h/c,c];if(h===0)return t.makeTensorInfo(i,o.dtype);const p=te({inputs:{x:o},backend:t,attrs:{shape:[l,a]}}),f=te({inputs:{x:r},backend:t,attrs:{shape:[l,c]}}),m=t.makeTensorInfo([],"float32",new Float32Array([0]));let g;V().getBool("WEBGL_PACK")?g=new xG(l,a,p.shape.length,f.shape.length,u,d):g=new Sp(l,a,p.shape.length,f.shape.length,u,d);const x=t.runWebGLProgram(g,[f,p,m],f.dtype),b=te({inputs:{x},backend:t,attrs:{shape:i}});return t.disposeIntermediateTensorInfo(p),t.disposeIntermediateTensorInfo(f),t.disposeIntermediateTensorInfo(x),t.disposeIntermediateTensorInfo(m),b}const yG={kernelName:ef,backendName:"webgl",kernelFunc:bG};/** * @license * Copyright 2022 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -19265,7 +19265,7 @@ return a / b;`,packedOpSnippet:` * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */class CG{constructor(e,t,s,o){this.variableNames=["sortedSequence","values"],this.customUniforms=[{name:"numInputs",type:"int"}],this.outputShape=[e,s];const r="while (left < right) {",i=`for (int i = 0; i < ${Math.ceil(Math.log2(t+1))}; ++i) { if (left >= right) break;`,a=V().getNumber("WEBGL_VERSION")===2?r:i,l=o==="left"?"<":"<=";this.userCode=` + */class wG{constructor(e,t,s,o){this.variableNames=["sortedSequence","values"],this.customUniforms=[{name:"numInputs",type:"int"}],this.outputShape=[e,s];const r="while (left < right) {",i=`for (int i = 0; i < ${Math.ceil(Math.log2(t+1))}; ++i) { if (left >= right) break;`,a=V().getNumber("WEBGL_VERSION")===2?r:i,l=o==="left"?"<":"<=";this.userCode=` int findBound(int batch, float value) { int left = 0; int right = numInputs; @@ -19305,7 +19305,7 @@ return a / b;`,packedOpSnippet:` * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function IG(n){const{inputs:e,backend:t,attrs:s}=n,{sortedSequence:o,values:r}=e,{side:i}=s,a=new CG(o.shape[0],o.shape[1],r.shape[1],i),l=[[o.shape[1]]];return t.runWebGLProgram(a,[o,r],"int32",l)}const $G={kernelName:nf,backendName:"webgl",kernelFunc:IG};/** + */function CG(n){const{inputs:e,backend:t,attrs:s}=n,{sortedSequence:o,values:r}=e,{side:i}=s,a=new wG(o.shape[0],o.shape[1],r.shape[1],i),l=[[o.shape[1]]];return t.runWebGLProgram(a,[o,r],"int32",l)}const IG={kernelName:nf,backendName:"webgl",kernelFunc:CG};/** * @license * Copyright 2017 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -19320,7 +19320,7 @@ return a / b;`,packedOpSnippet:` * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */class kG{constructor(e,t,s){this.variableNames=["c","a","b"],this.outputShape=t;let o,r;if(s>4)throw Error(`Where for rank ${s} is not yet supported`);if(s===1)r="resRC",o="resRC";else{const a=["resRC.x","resRC.y","resRC.z","resRC.w"],l=[],c=[];for(let u=0;u4)throw Error(`Where for rank ${s} is not yet supported`);if(s===1)r="resRC",o="resRC";else{const a=["resRC.x","resRC.y","resRC.z","resRC.w"],l=[],c=[];for(let u=0;u= 0.0) ? scale * x : scaleAlpha * (exp(x) - 1.0); -`,NG=Re({opSnippet:TG}),EG={kernelName:ni,backendName:"webgl",kernelFunc:NG};/** +`,TG=Re({opSnippet:SG}),NG={kernelName:ni,backendName:"webgl",kernelFunc:TG};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -19381,9 +19381,9 @@ return a / b;`,packedOpSnippet:` * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const RG=mr+` + */const EG=mr+` return 1.0 / (1.0 + exp(-1.0 * x)); -`,AG=Re({opSnippet:RG,packedOpSnippet:` +`,RG=Re({opSnippet:EG,packedOpSnippet:` vec4 result = 1.0 / (1.0 + exp(-1.0 * x)); bvec4 isNaN = isnan(x); @@ -19393,7 +19393,7 @@ return a / b;`,packedOpSnippet:` result.a = isNaN.a ? x.a : result.a; return result; -`,cpuKernelImpl:b3}),DG={kernelName:ii,backendName:"webgl",kernelFunc:AG};/** +`,cpuKernelImpl:x3}),AG={kernelName:ii,backendName:"webgl",kernelFunc:RG};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -19408,10 +19408,10 @@ return a / b;`,packedOpSnippet:` * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const FG=Re({opSnippet:` + */const DG=Re({opSnippet:` if (isnan(x)) { return 0.0; } return sign(x); -`}),_G={kernelName:ri,backendName:"webgl",kernelFunc:FG};/** +`}),FG={kernelName:ri,backendName:"webgl",kernelFunc:DG};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -19426,14 +19426,14 @@ return a / b;`,packedOpSnippet:` * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const OG=mr+` + */const _G=mr+` return sin(x); -`,LG=` +`,OG=` vec4 result = sin(x); bvec4 isNaN = isnan(x); ${To} return result; -`,MG=Re({opSnippet:OG,packedOpSnippet:LG}),PG={kernelName:si,backendName:"webgl",kernelFunc:MG};/** +`,LG=Re({opSnippet:_G,packedOpSnippet:OG}),MG={kernelName:si,backendName:"webgl",kernelFunc:LG};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -19448,10 +19448,10 @@ return a / b;`,packedOpSnippet:` * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const BG=Re({opSnippet:` + */const PG=Re({opSnippet:` float e2x = exp(x); return (e2x - 1.0 / e2x) / 2.0; -`}),zG={kernelName:oi,backendName:"webgl",kernelFunc:BG};/** +`}),BG={kernelName:oi,backendName:"webgl",kernelFunc:PG};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -19466,7 +19466,7 @@ return a / b;`,packedOpSnippet:` * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const VG=Re({opSnippet:` + */const zG=Re({opSnippet:` float epsilon = 1.1920928955078125e-7; float threshold = log(epsilon) + 2.0; @@ -19486,7 +19486,7 @@ return a / b;`,packedOpSnippet:` result = log(exp_x + 1.0); } return result; -`}),WG={kernelName:ai,backendName:"webgl",kernelFunc:VG};/** +`}),VG={kernelName:ai,backendName:"webgl",kernelFunc:zG};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -19501,7 +19501,7 @@ return a / b;`,packedOpSnippet:` * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const UG={kernelName:sl,backendName:"webgl",kernelFunc:n=>{const{inputs:e,backend:t,attrs:s}=n,{x:o}=e,{blockShape:r,paddings:i}=s;v(o.shape.length<=4,()=>"spaceToBatchND for rank > 4 with a WebGL backend not implemented yet");const a=r.reduce((x,b)=>x*b),l=[[0,0]];l.push(...i);for(let x=1+r.length;xt.disposeIntermediateTensorInfo(x)),g}};/** + */const WG={kernelName:sl,backendName:"webgl",kernelFunc:n=>{const{inputs:e,backend:t,attrs:s}=n,{x:o}=e,{blockShape:r,paddings:i}=s;k(o.shape.length<=4,()=>"spaceToBatchND for rank > 4 with a WebGL backend not implemented yet");const a=r.reduce((x,b)=>x*b),l=[[0,0]];l.push(...i);for(let x=1+r.length;xt.disposeIntermediateTensorInfo(x)),g}};/** * @license * Copyright 2021 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -19516,11 +19516,11 @@ return a / b;`,packedOpSnippet:` * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function GG(n){const{inputs:e,backend:t}=n,{indices:s,values:o,denseShape:r,defaultValue:i}=e;if(r.shape.length!==1)throw new Error(`Dense shape must be a vector, saw: + */function UG(n){const{inputs:e,backend:t}=n,{indices:s,values:o,denseShape:r,defaultValue:i}=e;if(r.shape.length!==1)throw new Error(`Dense shape must be a vector, saw: ${r.shape}`);if(s.shape.length!==2)throw new Error(`Indices must be a matrix, saw: ${s.shape}`);if(o.shape.length!==1)throw new Error(`Values must be a vector, saw: ${o.shape}`);if(i.shape.length!==0)throw new Error(`Default value must be a scalar, saw: - ${i.shape}`);const a=t.readSync(s.dataId),l=t.readSync(o.dataId),c=t.readSync(r.dataId),u=t.readSync(i.dataId)[0],[h,d,p,f,m]=w3(a,s.shape,s.dtype,l,o.dtype,c,u);return[t.makeTensorInfo(d,s.dtype,h),t.makeTensorInfo([d[0]],o.dtype,p),t.makeTensorInfo([f.length],"bool",new Uint8Array(f.map(g=>Number(g)))),t.makeTensorInfo([m.length],s.dtype,new Int32Array(m))]}const HG={kernelName:sf,backendName:"webgl",kernelFunc:GG};/** + ${i.shape}`);const a=t.readSync(s.dataId),l=t.readSync(o.dataId),c=t.readSync(r.dataId),u=t.readSync(i.dataId)[0],[h,d,p,f,m]=y3(a,s.shape,s.dtype,l,o.dtype,c,u);return[t.makeTensorInfo(d,s.dtype,h),t.makeTensorInfo([d[0]],o.dtype,p),t.makeTensorInfo([f.length],"bool",new Uint8Array(f.map(g=>Number(g)))),t.makeTensorInfo([m.length],s.dtype,new Int32Array(m))]}const GG={kernelName:sf,backendName:"webgl",kernelFunc:UG};/** * @license * Copyright 2021 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -19535,7 +19535,7 @@ return a / b;`,packedOpSnippet:` * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function qG(n){const{inputs:e,backend:t}=n,{inputIndices:s,inputShape:o,newShape:r}=e;if(s.shape.length!==2)throw new Error(`Input indices should be a matrix but received shape ${s.shape}`);if(o.shape.length!==1)throw new Error(`Input shape should be a vector but received shape ${o.shape}`);if(r.shape.length!==1)throw new Error(`Target shape should be a vector but received shape ${r.shape}`);const i=Array.from(t.readSync(o.dataId)),a=t.readSync(s.dataId),l=Array.from(t.readSync(r.dataId)),[c,u,h]=C3(a,s.shape,s.dtype,i,l);return[t.makeTensorInfo(u,s.dtype,c),t.makeTensorInfo([h.length],r.dtype,new Int32Array(h))]}const jG={kernelName:of,backendName:"webgl",kernelFunc:qG};/** + */function HG(n){const{inputs:e,backend:t}=n,{inputIndices:s,inputShape:o,newShape:r}=e;if(s.shape.length!==2)throw new Error(`Input indices should be a matrix but received shape ${s.shape}`);if(o.shape.length!==1)throw new Error(`Input shape should be a vector but received shape ${o.shape}`);if(r.shape.length!==1)throw new Error(`Target shape should be a vector but received shape ${r.shape}`);const i=Array.from(t.readSync(o.dataId)),a=t.readSync(s.dataId),l=Array.from(t.readSync(r.dataId)),[c,u,h]=w3(a,s.shape,s.dtype,i,l);return[t.makeTensorInfo(u,s.dtype,c),t.makeTensorInfo([h.length],r.dtype,new Int32Array(h))]}const qG={kernelName:of,backendName:"webgl",kernelFunc:HG};/** * @license * Copyright 2021 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -19550,9 +19550,9 @@ return a / b;`,packedOpSnippet:` * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function KG(n){const{inputs:e,backend:t}=n,{data:s,indices:o,segmentIds:r}=e;if(s.shape.length<1)throw new Error("Data should be at least 1 dimensional but received scalar");if(o.shape.length!==1)throw new Error(`Indices should be a vector but received shape + */function jG(n){const{inputs:e,backend:t}=n,{data:s,indices:o,segmentIds:r}=e;if(s.shape.length<1)throw new Error("Data should be at least 1 dimensional but received scalar");if(o.shape.length!==1)throw new Error(`Indices should be a vector but received shape ${o.shape}`);if(r.shape.length!==1)throw new Error(`Segment ids should be a vector but received shape - ${r.shape}`);const i=t.readSync(s.dataId),a=t.readSync(o.dataId),l=t.readSync(r.dataId),[c,u]=ly(i,s.shape,s.dtype,a,l,!0);return t.makeTensorInfo(u,s.dtype,c)}const XG={kernelName:rf,backendName:"webgl",kernelFunc:KG};/** + ${r.shape}`);const i=t.readSync(s.dataId),a=t.readSync(o.dataId),l=t.readSync(r.dataId),[c,u]=ly(i,s.shape,s.dtype,a,l,!0);return t.makeTensorInfo(u,s.dtype,c)}const KG={kernelName:rf,backendName:"webgl",kernelFunc:jG};/** * @license * Copyright 2021 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -19567,9 +19567,9 @@ return a / b;`,packedOpSnippet:` * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function YG(n){const{inputs:e,backend:t}=n,{data:s,indices:o,segmentIds:r}=e;if(s.shape.length<1)throw new Error("Data should be at least 1 dimensional but received scalar");if(o.shape.length!==1)throw new Error(`Indices should be a vector but received shape + */function XG(n){const{inputs:e,backend:t}=n,{data:s,indices:o,segmentIds:r}=e;if(s.shape.length<1)throw new Error("Data should be at least 1 dimensional but received scalar");if(o.shape.length!==1)throw new Error(`Indices should be a vector but received shape ${o.shape}`);if(r.shape.length!==1)throw new Error(`Segment ids should be a vector but received shape - ${r.shape}`);const i=t.readSync(s.dataId),a=t.readSync(o.dataId),l=t.readSync(r.dataId),[c,u]=ly(i,s.shape,s.dtype,a,l);return t.makeTensorInfo(u,s.dtype,c)}const ZG={kernelName:af,backendName:"webgl",kernelFunc:YG};/** + ${r.shape}`);const i=t.readSync(s.dataId),a=t.readSync(o.dataId),l=t.readSync(r.dataId),[c,u]=ly(i,s.shape,s.dtype,a,l);return t.makeTensorInfo(u,s.dtype,c)}const YG={kernelName:af,backendName:"webgl",kernelFunc:XG};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -19584,7 +19584,7 @@ return a / b;`,packedOpSnippet:` * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function QG(n){const{inputs:e,backend:t,attrs:s}=n,{sparseIndices:o,sparseValues:r,defaultValue:i}=e,{outputShape:a}=s,{sliceRank:l,numUpdates:c,sliceSize:u,strides:h,outputSize:d}=ho(r,o,a),p=!1;if(r.dtype==="string"){const x=t.bufferSync(o),b=t.bufferSync(r),w=ys(t.readSync(i.dataId)[0]),y=x3(x,b,a,d,u,c,l,h,w,p);return t.makeTensorInfo(a,y.dtype,y.values)}const f=new Np(c,l,o.shape.length,r.shape.length,h,[d,1],p),m=t.runWebGLProgram(f,[r,o,i],r.dtype),g=te({inputs:{x:m},backend:t,attrs:{shape:a}});return t.disposeIntermediateTensorInfo(m),g}const JG={kernelName:lf,backendName:"webgl",kernelFunc:QG};/** + */function ZG(n){const{inputs:e,backend:t,attrs:s}=n,{sparseIndices:o,sparseValues:r,defaultValue:i}=e,{outputShape:a}=s,{sliceRank:l,numUpdates:c,sliceSize:u,strides:h,outputSize:d}=ho(r,o,a),p=!1;if(r.dtype==="string"){const x=t.bufferSync(o),b=t.bufferSync(r),w=ys(t.readSync(i.dataId)[0]),y=g3(x,b,a,d,u,c,l,h,w,p);return t.makeTensorInfo(a,y.dtype,y.values)}const f=new Sp(c,l,o.shape.length,r.shape.length,h,[d,1],p),m=t.runWebGLProgram(f,[r,o,i],r.dtype),g=te({inputs:{x:m},backend:t,attrs:{shape:a}});return t.disposeIntermediateTensorInfo(m),g}const QG={kernelName:lf,backendName:"webgl",kernelFunc:ZG};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -19599,7 +19599,7 @@ return a / b;`,packedOpSnippet:` * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function eH(n){const{inputs:e,backend:t,attrs:s}=n,{x:o}=e,{numOrSizeSplits:r,axis:i}=s,a=$e(i,o.shape)[0],l=pd(o,r,a),c=o.shape.length,u=new Array(c).fill(0),h=o.shape.slice();return l.map(d=>{const p=[...h];p[a]=d;const f=gr({inputs:{x:o},backend:t,attrs:{begin:u,size:p}});return u[a]+=d,f})}const tH={kernelName:ol,backendName:"webgl",kernelFunc:eH};/** + */function JG(n){const{inputs:e,backend:t,attrs:s}=n,{x:o}=e,{numOrSizeSplits:r,axis:i}=s,a=$e(i,o.shape)[0],l=hd(o,r,a),c=o.shape.length,u=new Array(c).fill(0),h=o.shape.slice();return l.map(d=>{const p=[...h];p[a]=d;const f=gr({inputs:{x:o},backend:t,attrs:{begin:u,size:p}});return u[a]+=d,f})}const eH={kernelName:ol,backendName:"webgl",kernelFunc:JG};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -19614,7 +19614,7 @@ return a / b;`,packedOpSnippet:` * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const ow="return sqrt(x);",nH=Re({opSnippet:ow,packedOpSnippet:ow,cpuKernelImpl:I3}),sH={kernelName:li,backendName:"webgl",kernelFunc:nH};/** + */const ow="return sqrt(x);",tH=Re({opSnippet:ow,packedOpSnippet:ow,cpuKernelImpl:C3}),nH={kernelName:li,backendName:"webgl",kernelFunc:tH};/** * @license * Copyright 2019 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -19629,7 +19629,7 @@ return a / b;`,packedOpSnippet:` * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const oH=Re({opSnippet:"return x * x;"}),rH={kernelName:Nu,backendName:"webgl",kernelFunc:oH};/** + */const sH=Re({opSnippet:"return x * x;"}),oH={kernelName:Su,backendName:"webgl",kernelFunc:sH};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -19644,7 +19644,7 @@ return a / b;`,packedOpSnippet:` * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const rw="return (a - b) * (a - b);",iH=vt({opSnippet:rw,packedOpSnippet:rw}),aH={kernelName:ci,backendName:"webgl",kernelFunc:iH};/** + */const rw="return (a - b) * (a - b);",rH=vt({opSnippet:rw,packedOpSnippet:rw}),iH={kernelName:ci,backendName:"webgl",kernelFunc:rH};/** * @license * Copyright 2023 Google LLC. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -19659,7 +19659,7 @@ return a / b;`,packedOpSnippet:` * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function lH(n){const{inputs:e,backend:t,attrs:s}=n,{x:o}=e;if(o.dtype!=="string")throw new Error("Input must be of datatype string");const r=t.readSync(o.dataId),i=us(r),a=$3(i,"string",s);return t.makeTensorInfo(o.shape,"string",a)}const cH={kernelName:Eu,backendName:"webgl",kernelFunc:lH};/** + */function aH(n){const{inputs:e,backend:t,attrs:s}=n,{x:o}=e;if(o.dtype!=="string")throw new Error("Input must be of datatype string");const r=t.readSync(o.dataId),i=us(r),a=I3(i,"string",s);return t.makeTensorInfo(o.shape,"string",a)}const lH={kernelName:Tu,backendName:"webgl",kernelFunc:aH};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -19674,9 +19674,9 @@ return a / b;`,packedOpSnippet:` * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function uH({inputs:n,attrs:e,backend:t}){const{x:s}=n,o=In+` + */function cH({inputs:n,attrs:e,backend:t}){const{x:s}=n,o=In+` return x > 0.0 ? 1.0 : float(${e.alpha}); - `,r=new ts(s.shape,o);return t.runWebGLProgram(r,[s],s.dtype)}const hH={kernelName:fi,backendName:"webgl",kernelFunc:uH};/** + `,r=new ts(s.shape,o);return t.runWebGLProgram(r,[s],s.dtype)}const uH={kernelName:fi,backendName:"webgl",kernelFunc:cH};/** * @license * Copyright 2017 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -19691,7 +19691,7 @@ return a / b;`,packedOpSnippet:` * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */class dH{constructor(e,t,s){this.variableNames=["x"],this.outputShape=s;const o=s.length,r=Me(s.length),i=Me(s.length);let a="";if(o===1)a="coords * strides + begin";else{let l=0;a=s.map((c,u)=>(l++,s.length===1?`coords * strides[${u}] + begin[${u}]`:`coords[${l-1}] * strides[${u}] + begin[${u}]`)).join(",")}this.userCode=` + */class hH{constructor(e,t,s){this.variableNames=["x"],this.outputShape=s;const o=s.length,r=Me(s.length),i=Me(s.length);let a="";if(o===1)a="coords * strides + begin";else{let l=0;a=s.map((c,u)=>(l++,s.length===1?`coords * strides[${u}] + begin[${u}]`:`coords[${l-1}] * strides[${u}] + begin[${u}]`)).join(",")}this.userCode=` ${r} begin = ${r}(${e}); ${r} strides = ${r}(${t}); @@ -19714,7 +19714,7 @@ return a / b;`,packedOpSnippet:` * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function pH(n){const{inputs:e,backend:t,attrs:s}=n,{x:o}=e,{begin:r,end:i,strides:a,beginMask:l,endMask:c,ellipsisMask:u,newAxisMask:h,shrinkAxisMask:d}=s,{finalShapeSparse:p,finalShape:f,isIdentity:m,sliceDim0:g,isSimpleSlice:x,begin:b,end:w,strides:y}=Kh(o.shape,r,i,a,l,c,u,h,d);let C;if(m)C=te({inputs:{x:o},backend:t,attrs:{shape:f}});else if(g||x){v(o.shape.length>=1,()=>`Input must have rank at least 1, got: ${o.shape.length}`);const $=Hh(b,w,y),k=gr({inputs:{x:o},backend:t,attrs:{begin:b,size:$}});C=te({inputs:{x:k},backend:t,attrs:{shape:f}}),t.disposeIntermediateTensorInfo(k)}else if(t.shouldExecuteOnCPU([o])){const k=t.readSync(o.dataId),S=ke(o.shape,o.dtype,k),N=k3(p,S,y,b);C=t.makeTensorInfo(f,o.dtype,N.values)}else{const k=new dH(b,y,p);C=t.runWebGLProgram(k,[o],o.dtype)}const I=te({inputs:{x:C},backend:t,attrs:{shape:f}});return t.disposeIntermediateTensorInfo(C),I}const fH={kernelName:Ru,backendName:"webgl",kernelFunc:pH};/** + */function dH(n){const{inputs:e,backend:t,attrs:s}=n,{x:o}=e,{begin:r,end:i,strides:a,beginMask:l,endMask:c,ellipsisMask:u,newAxisMask:h,shrinkAxisMask:d}=s,{finalShapeSparse:p,finalShape:f,isIdentity:m,sliceDim0:g,isSimpleSlice:x,begin:b,end:w,strides:y}=qh(o.shape,r,i,a,l,c,u,h,d);let C;if(m)C=te({inputs:{x:o},backend:t,attrs:{shape:f}});else if(g||x){k(o.shape.length>=1,()=>`Input must have rank at least 1, got: ${o.shape.length}`);const v=Uh(b,w,y),$=gr({inputs:{x:o},backend:t,attrs:{begin:b,size:v}});C=te({inputs:{x:$},backend:t,attrs:{shape:f}}),t.disposeIntermediateTensorInfo($)}else if(t.shouldExecuteOnCPU([o])){const $=t.readSync(o.dataId),S=ke(o.shape,o.dtype,$),N=$3(p,S,y,b);C=t.makeTensorInfo(f,o.dtype,N.values)}else{const $=new hH(b,y,p);C=t.runWebGLProgram($,[o],o.dtype)}const I=te({inputs:{x:C},backend:t,attrs:{shape:f}});return t.disposeIntermediateTensorInfo(C),I}const pH={kernelName:Nu,backendName:"webgl",kernelFunc:dH};/** * @license * Copyright 2021 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -19729,7 +19729,7 @@ return a / b;`,packedOpSnippet:` * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function mH(n){const{inputs:e,backend:t,attrs:s}=n,{separator:o,nGramWidths:r,leftPad:i,rightPad:a,padWidth:l,preserveShortSequences:c}=s,{data:u,dataSplits:h}=e,d=t.readSync(u.dataId),p=t.readSync(h.dataId),[f,m]=v3(d,p,o,r,i,a,l,c);return[t.makeTensorInfo([f.length],"string",f),t.makeTensorInfo(h.shape,"int32",m)]}const gH={kernelName:cf,backendName:"webgl",kernelFunc:mH};/** + */function fH(n){const{inputs:e,backend:t,attrs:s}=n,{separator:o,nGramWidths:r,leftPad:i,rightPad:a,padWidth:l,preserveShortSequences:c}=s,{data:u,dataSplits:h}=e,d=t.readSync(u.dataId),p=t.readSync(h.dataId),[f,m]=k3(d,p,o,r,i,a,l,c);return[t.makeTensorInfo([f.length],"string",f),t.makeTensorInfo(h.shape,"int32",m)]}const mH={kernelName:cf,backendName:"webgl",kernelFunc:fH};/** * @license * Copyright 2021 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -19744,7 +19744,7 @@ return a / b;`,packedOpSnippet:` * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function xH(n){const{inputs:e,backend:t,attrs:s}=n,{skipEmpty:o}=s,{input:r,delimiter:i}=e;if(r.dtype!=="string")throw new Error("Input must be of datatype string");if(r.shape.length!==1)throw new Error(`Input must be a vector, got shape: ${r.shape}`);if(i.shape.length!==0)throw new Error(`Delimiter must be a scalar, got shape: ${i.shape}`);const a=t.readSync(r.dataId),l=t.readSync(i.dataId)[0],[c,u,h]=S3(a,l,o),d=u.length;return[t.makeTensorInfo([d,2],"int32",c),t.makeTensorInfo([d],"string",u),t.makeTensorInfo([2],"int32",new Int32Array(h))]}const bH={kernelName:uf,backendName:"webgl",kernelFunc:xH};/** + */function gH(n){const{inputs:e,backend:t,attrs:s}=n,{skipEmpty:o}=s,{input:r,delimiter:i}=e;if(r.dtype!=="string")throw new Error("Input must be of datatype string");if(r.shape.length!==1)throw new Error(`Input must be a vector, got shape: ${r.shape}`);if(i.shape.length!==0)throw new Error(`Delimiter must be a scalar, got shape: ${i.shape}`);const a=t.readSync(r.dataId),l=t.readSync(i.dataId)[0],[c,u,h]=v3(a,l,o),d=u.length;return[t.makeTensorInfo([d,2],"int32",c),t.makeTensorInfo([d],"string",u),t.makeTensorInfo([2],"int32",new Int32Array(h))]}const xH={kernelName:uf,backendName:"webgl",kernelFunc:gH};/** * @license * Copyright 2021 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -19759,7 +19759,7 @@ return a / b;`,packedOpSnippet:` * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function yH(n){const{inputs:e,backend:t,attrs:s}=n,{numBuckets:o}=s,{input:r}=e;if(r.dtype!=="string")throw new Error("Input must be of datatype string");if(o<=0)throw new Error("Number of buckets must be at least 1");const i=t.readSync(r.dataId),a=T3(i,o);return t.makeTensorInfo(r.shape,"int32",a)}const wH={kernelName:hf,backendName:"webgl",kernelFunc:yH};/** + */function bH(n){const{inputs:e,backend:t,attrs:s}=n,{numBuckets:o}=s,{input:r}=e;if(r.dtype!=="string")throw new Error("Input must be of datatype string");if(o<=0)throw new Error("Number of buckets must be at least 1");const i=t.readSync(r.dataId),a=S3(i,o);return t.makeTensorInfo(r.shape,"int32",a)}const yH={kernelName:hf,backendName:"webgl",kernelFunc:bH};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -19774,7 +19774,7 @@ return a / b;`,packedOpSnippet:` * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const CH=Re({opSnippet:"return tan(x);"}),IH={kernelName:hi,backendName:"webgl",kernelFunc:CH};/** + */const wH=Re({opSnippet:"return tan(x);"}),CH={kernelName:hi,backendName:"webgl",kernelFunc:wH};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -19789,10 +19789,10 @@ return a / b;`,packedOpSnippet:` * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const $H=Re({opSnippet:` + */const IH=Re({opSnippet:` float e2x = exp(-2.0 * abs(x)); return sign(x) * (1.0 - e2x) / (1.0 + e2x); -`}),kH={kernelName:di,backendName:"webgl",kernelFunc:$H};/** +`}),$H={kernelName:di,backendName:"webgl",kernelFunc:IH};/** * @license * Copyright 2022 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -19807,7 +19807,7 @@ return a / b;`,packedOpSnippet:` * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function vH(n){const{inputs:e,backend:t,attrs:s}=n,{tensor:o,indices:r,updates:i}=e,{sliceRank:a,numUpdates:l,sliceSize:c,strides:u,outputSize:h}=ho(i,r,o.shape),d=[h/c,c];if(h===0)return t.makeTensorInfo(o.shape,r.dtype);const p=te({inputs:{x:r},backend:t,attrs:{shape:[l,a]}}),f=te({inputs:{x:i},backend:t,attrs:{shape:[l,c]}}),m=te({inputs:{x:o},backend:t,attrs:{shape:d}}),g=new Np(l,a,p.shape.length,f.shape.length,u,d,!1,!0),x=t.runWebGLProgram(g,[f,p,m],m.dtype),b=te({inputs:{x},backend:t,attrs:{shape:o.shape}});return t.disposeIntermediateTensorInfo(p),t.disposeIntermediateTensorInfo(f),t.disposeIntermediateTensorInfo(m),t.disposeIntermediateTensorInfo(x),b}const SH={kernelName:tf,backendName:"webgl",kernelFunc:vH};/** + */function kH(n){const{inputs:e,backend:t,attrs:s}=n,{tensor:o,indices:r,updates:i}=e,{sliceRank:a,numUpdates:l,sliceSize:c,strides:u,outputSize:h}=ho(i,r,o.shape),d=[h/c,c];if(h===0)return t.makeTensorInfo(o.shape,r.dtype);const p=te({inputs:{x:r},backend:t,attrs:{shape:[l,a]}}),f=te({inputs:{x:i},backend:t,attrs:{shape:[l,c]}}),m=te({inputs:{x:o},backend:t,attrs:{shape:d}}),g=new Sp(l,a,p.shape.length,f.shape.length,u,d,!1,!0),x=t.runWebGLProgram(g,[f,p,m],m.dtype),b=te({inputs:{x},backend:t,attrs:{shape:o.shape}});return t.disposeIntermediateTensorInfo(p),t.disposeIntermediateTensorInfo(f),t.disposeIntermediateTensorInfo(m),t.disposeIntermediateTensorInfo(x),b}const vH={kernelName:tf,backendName:"webgl",kernelFunc:kH};/** * @license * Copyright 2017 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -19822,12 +19822,12 @@ return a / b;`,packedOpSnippet:` * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */class TH{constructor(e,t){this.variableNames=["A"];const s=new Array(e.length);for(let i=0;i5)throw Error(`Tile for rank ${e} is not yet supported`);if(e===1)return`imod(resRC, ${n[0]})`;const t=["resRC.x","resRC.y","resRC.z","resRC.w","resRC.u"],s=[];for(let o=0;o5)throw Error(`Tile for rank ${e} is not yet supported`);if(e===1)return`imod(resRC, ${n[0]})`;const t=["resRC.x","resRC.y","resRC.z","resRC.w","resRC.u"],s=[];for(let o=0;o5){const l=t.readSync(o.dataId),c=o.dtype==="string"?l.map(d=>ys(d)):l,u=ke(o.shape,o.dtype,c),h=E3(u,r);return t.makeTensorInfo(h.shape,h.dtype,h.values)}const i=new TH(o.shape,r);return t.runWebGLProgram(i,[o],o.dtype)}const EH={kernelName:pi,backendName:"webgl",kernelFunc:iw};class RH{constructor(e){this.variableNames=["x","indices"],this.customUniforms=[{name:"n",type:"int"},{name:"firstPass",type:"int"},{name:"negativeInf",type:"float"},{name:"dir",type:"int"},{name:"inc",type:"int"}],this.outputShape=e,this.userCode=` + */function iw(n){const{inputs:e,backend:t,attrs:s}=n,{x:o}=e,{reps:r}=s;if(o.dtype==="string"||o.shape.length>5){const l=t.readSync(o.dataId),c=o.dtype==="string"?l.map(d=>ys(d)):l,u=ke(o.shape,o.dtype,c),h=N3(u,r);return t.makeTensorInfo(h.shape,h.dtype,h.values)}const i=new SH(o.shape,r);return t.runWebGLProgram(i,[o],o.dtype)}const NH={kernelName:pi,backendName:"webgl",kernelFunc:iw};class EH{constructor(e){this.variableNames=["x","indices"],this.customUniforms=[{name:"n",type:"int"},{name:"firstPass",type:"int"},{name:"negativeInf",type:"float"},{name:"dir",type:"int"},{name:"inc",type:"int"}],this.outputShape=e,this.userCode=` void main() { ivec2 coords = getOutputCoords(); int batch = coords[0]; @@ -19882,7 +19882,7 @@ return a / b;`,packedOpSnippet:` setOutput(float(i1)); } } - `}}class AH{constructor(e){this.variableNames=["x","indices"],this.customUniforms=[{name:"n",type:"int"},{name:"firstPass",type:"int"},{name:"k",type:"int"}],this.outputShape=e,this.userCode=` + `}}class RH{constructor(e){this.variableNames=["x","indices"],this.customUniforms=[{name:"n",type:"int"},{name:"firstPass",type:"int"},{name:"k",type:"int"}],this.outputShape=e,this.userCode=` void main() { // Takes max of indices (0, k), (1, k + 1), (2, k + 2) ... ivec2 coords = getOutputCoords(); @@ -19931,7 +19931,7 @@ return a / b;`,packedOpSnippet:` * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function Eo(n,e){e!==null&&n.disposeIntermediateTensorInfo(e)}function aw(n){let e=1;for(;el){const N=t.readSync(o.dataId),[A,_]=R3(N,c,o.dtype,r,i);return[t.makeTensorInfo(A.shape,A.dtype,A.values),t.makeTensorInfo(_.shape,_.dtype,_.values)]}if(r===0)return c[c.length-1]=0,[t.makeTensorInfo(c,o.dtype,[]),t.makeTensorInfo(c,"int32",[])];if(u===1)return[o,ia({attrs:{shape:c,dtype:"int32",value:0},backend:t})];const h=t.texData.get(o.dataId),d=h!==null&&h.isPacked,p=d?t.unpackTensor(o):o,m=G(c)/u,g=te({inputs:{x:p},attrs:{shape:[m,u]},backend:t});d&&Eo(t,p);const x=aw(r),b=aw(u);let w=null;const y=()=>w===null?[g,g]:[g,w],C=(N,A,_)=>{const E=y(),M=new RH(_),P=[[u],[w===null?1:0],[Number.NEGATIVE_INFINITY],[N],[A]],H=w;w=t.runWebGLProgram(M,E,"int32",P),Eo(t,H)};for(let N=1;N=1;_/=2)C(A,_,[m,b])}for(let N=b;N>x;N/=2){const A=y(),_=new AH([m,N/2]),M=[[u],[w===null?1:0],[x]],z=w;w=t.runWebGLProgram(_,A,"int32",M),Eo(t,z);const P=x/2,H=P*2;for(let W=P;W>=1;W/=2)C(H,W,w.shape)}let I=w;w=gr({inputs:{x:w},backend:t,attrs:{begin:0,size:[m,r]}}),Eo(t,I);let $=Xy({inputs:{x:g,indices:w},backend:t,attrs:{axis:1,batchDims:1}});Eo(t,g);const k=c.slice(0,-1);k.push(r),I=w,w=te({inputs:{x:w},attrs:{shape:k},backend:t}),Eo(t,I);const S=$;return $=te({inputs:{x:$},attrs:{shape:k},backend:t}),Eo(t,S),[$,w]}const FH={kernelName:Au,backendName:"webgl",kernelFunc:DH};/** + */function Eo(n,e){e!==null&&n.disposeIntermediateTensorInfo(e)}function aw(n){let e=1;for(;el){const N=t.readSync(o.dataId),[A,_]=E3(N,c,o.dtype,r,i);return[t.makeTensorInfo(A.shape,A.dtype,A.values),t.makeTensorInfo(_.shape,_.dtype,_.values)]}if(r===0)return c[c.length-1]=0,[t.makeTensorInfo(c,o.dtype,[]),t.makeTensorInfo(c,"int32",[])];if(u===1)return[o,ia({attrs:{shape:c,dtype:"int32",value:0},backend:t})];const h=t.texData.get(o.dataId),d=h!==null&&h.isPacked,p=d?t.unpackTensor(o):o,m=G(c)/u,g=te({inputs:{x:p},attrs:{shape:[m,u]},backend:t});d&&Eo(t,p);const x=aw(r),b=aw(u);let w=null;const y=()=>w===null?[g,g]:[g,w],C=(N,A,_)=>{const E=y(),M=new EH(_),P=[[u],[w===null?1:0],[Number.NEGATIVE_INFINITY],[N],[A]],H=w;w=t.runWebGLProgram(M,E,"int32",P),Eo(t,H)};for(let N=1;N=1;_/=2)C(A,_,[m,b])}for(let N=b;N>x;N/=2){const A=y(),_=new RH([m,N/2]),M=[[u],[w===null?1:0],[x]],z=w;w=t.runWebGLProgram(_,A,"int32",M),Eo(t,z);const P=x/2,H=P*2;for(let W=P;W>=1;W/=2)C(H,W,w.shape)}let I=w;w=gr({inputs:{x:w},backend:t,attrs:{begin:0,size:[m,r]}}),Eo(t,I);let v=Xy({inputs:{x:g,indices:w},backend:t,attrs:{axis:1,batchDims:1}});Eo(t,g);const $=c.slice(0,-1);$.push(r),I=w,w=te({inputs:{x:w},attrs:{shape:$},backend:t}),Eo(t,I);const S=v;return v=te({inputs:{x:v},attrs:{shape:$},backend:t}),Eo(t,S),[v,w]}const DH={kernelName:Eu,backendName:"webgl",kernelFunc:AH};/** * @license * Copyright 2021 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -19946,7 +19946,7 @@ return a / b;`,packedOpSnippet:` * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */class _H{constructor(e,t,s,o,r,i){this.variableNames=["Image","Transforms"],this.outputShape=i;const a=s==="nearest"?1:2;let l;switch(o){case"constant":l=1;break;case"reflect":l=2;break;case"wrap":l=3;break;case"nearest":l=4;break;default:l=1;break}this.userCode=` + */class FH{constructor(e,t,s,o,r,i){this.variableNames=["Image","Transforms"],this.outputShape=i;const a=s==="nearest"?1:2;let l;switch(o){case"constant":l=1;break;case"reflect":l=2;break;case"wrap":l=3;break;case"nearest":l=4;break;default:l=1;break}this.userCode=` float mapCoord(float outCoord, float len) { float inCoord = outCoord; if(${l} == 2) { @@ -20073,7 +20073,7 @@ return a / b;`,packedOpSnippet:` * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function OH(n){const{inputs:e,backend:t,attrs:s}=n,{image:o,transforms:r}=e,{interpolation:i,fillMode:a,fillValue:l,outputShape:c}=s,[u,h,d,p]=o.shape,[f,m]=c??[h,d],g=[u,f,m,p],x=new _H(h,d,i,a,l,g);return t.runWebGLProgram(x,[o,r],"float32")}const LH={kernelName:Du,backendName:"webgl",kernelFunc:OH};/** + */function _H(n){const{inputs:e,backend:t,attrs:s}=n,{image:o,transforms:r}=e,{interpolation:i,fillMode:a,fillValue:l,outputShape:c}=s,[u,h,d,p]=o.shape,[f,m]=c??[h,d],g=[u,f,m,p],x=new FH(h,d,i,a,l,g);return t.runWebGLProgram(x,[o,r],"float32")}const OH={kernelName:Ru,backendName:"webgl",kernelFunc:_H};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the License); @@ -20088,7 +20088,7 @@ return a / b;`,packedOpSnippet:` * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function MH(n){const{inputs:e,attrs:t,backend:s}=n,{axis:o}=t,{x:r}=e;Ji(r,"unique"),console.warn("WARNING: ","UI might be locked temporarily as data is being downloaded");const i=s.readSync(r.dataId),{outputValues:a,outputShape:l,indices:c}=A3(i,o,r.shape,r.dtype);return[s.makeTensorInfo(l,r.dtype,a),s.makeTensorInfo([c.length],"int32",c)]}const PH={kernelName:Fu,backendName:"webgl",kernelFunc:MH};/** + */function LH(n){const{inputs:e,attrs:t,backend:s}=n,{axis:o}=t,{x:r}=e;Ji(r,"unique"),console.warn("WARNING: ","UI might be locked temporarily as data is being downloaded");const i=s.readSync(r.dataId),{outputValues:a,outputShape:l,indices:c}=R3(i,o,r.shape,r.dtype);return[s.makeTensorInfo(l,r.dtype,a),s.makeTensorInfo([c.length],"int32",c)]}const MH={kernelName:Au,backendName:"webgl",kernelFunc:LH};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -20103,7 +20103,7 @@ return a / b;`,packedOpSnippet:` * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function BH(n){const{inputs:e,backend:t,attrs:s}=n,{value:o}=e;let{axis:r}=s;r<0&&(r+=o.shape.length);const i=o,a=i.shape.length,l=o.shape[r],c=new Array(a-1);let u=0;for(let m=0;mt.disposeIntermediateTensorInfo(m)),f}const zH={kernelName:il,backendName:"webgl",kernelFunc:BH};/** + */function PH(n){const{inputs:e,backend:t,attrs:s}=n,{value:o}=e;let{axis:r}=s;r<0&&(r+=o.shape.length);const i=o,a=i.shape.length,l=o.shape[r],c=new Array(a-1);let u=0;for(let m=0;mt.disposeIntermediateTensorInfo(m)),f}const BH={kernelName:il,backendName:"webgl",kernelFunc:PH};/** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -20118,7 +20118,7 @@ return a / b;`,packedOpSnippet:` * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */class VH{constructor(e,t){this.variableNames=["x","segmentIds"];const s=e.windowSize,o=e.batchSize,r=e.inSize,i=e.numSegments,a=i*Math.ceil(r/s);this.outputShape=[o,a];const l="0.0",c="sumValue",u=Math.floor(s/4)*4,h=s%4,d=` + */class zH{constructor(e,t){this.variableNames=["x","segmentIds"];const s=e.windowSize,o=e.batchSize,r=e.inSize,i=e.numSegments,a=i*Math.ceil(r/s);this.outputShape=[o,a];const l="0.0",c="sumValue",u=Math.floor(s/4)*4,h=s%4,d=` sumValue += dot(values, segFilter); `;let p="";r%s>0&&(p=` if (inIdx < 0 || inIdx >= ${r}) { @@ -20239,7 +20239,7 @@ return a / b;`,packedOpSnippet:` * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function WH(n){const{inputs:e,backend:t,attrs:s}=n,{x:o,segmentIds:r}=e,{numSegments:i}=s,a=o.shape.length,l=[];let c=0;const u=Ze([c],a);let h=o;u!=null&&(h=zt({inputs:{x:o},backend:t,attrs:{perm:u}}),l.push(h),c=nt(1,a)[0]);const d=Dg(h.shape,c,i),p=G([h.shape[c]]),f=te({inputs:{x:h},backend:t,attrs:{shape:[-1,p]}});l.push(f);const m=Gu(o.dtype),g=(y,C,I,$,k)=>{const S=y.shape[0],N=y.shape[1],A=Ag(N,k),_={windowSize:A,inSize:N,batchSize:S,numSegments:k},E=new VH(_,C),M=t.compileAndRun(E,[y,I],$);if(l.push(M),M.shape[1]===k)return M;const z=sw({backend:t,attrs:{start:0,stop:k,step:1,dtype:"float32"}}),P=iw({inputs:{x:z},backend:t,attrs:{reps:[N/A]}});return l.push(z),l.push(P),g(M,C,P,$,k)},x=g(f,"unsortedSegmentSum",r,m,i),b=te({inputs:{x},backend:t,attrs:{shape:d}});let w=b;if(u!=null){l.push(b);const y=$s(u);w=zt({inputs:{x:w},backend:t,attrs:{perm:y}})}return l.forEach(y=>t.disposeIntermediateTensorInfo(y)),w}const UH={kernelName:al,backendName:"webgl",kernelFunc:WH};/** + */function VH(n){const{inputs:e,backend:t,attrs:s}=n,{x:o,segmentIds:r}=e,{numSegments:i}=s,a=o.shape.length,l=[];let c=0;const u=Ze([c],a);let h=o;u!=null&&(h=Bt({inputs:{x:o},backend:t,attrs:{perm:u}}),l.push(h),c=nt(1,a)[0]);const d=Dg(h.shape,c,i),p=G([h.shape[c]]),f=te({inputs:{x:h},backend:t,attrs:{shape:[-1,p]}});l.push(f);const m=Wu(o.dtype),g=(y,C,I,v,$)=>{const S=y.shape[0],N=y.shape[1],A=Ag(N,$),_={windowSize:A,inSize:N,batchSize:S,numSegments:$},E=new zH(_,C),M=t.compileAndRun(E,[y,I],v);if(l.push(M),M.shape[1]===$)return M;const z=sw({backend:t,attrs:{start:0,stop:$,step:1,dtype:"float32"}}),P=iw({inputs:{x:z},backend:t,attrs:{reps:[N/A]}});return l.push(z),l.push(P),g(M,C,P,v,$)},x=g(f,"unsortedSegmentSum",r,m,i),b=te({inputs:{x},backend:t,attrs:{shape:d}});let w=b;if(u!=null){l.push(b);const y=$s(u);w=Bt({inputs:{x:w},backend:t,attrs:{perm:y}})}return l.forEach(y=>t.disposeIntermediateTensorInfo(y)),w}const WH={kernelName:al,backendName:"webgl",kernelFunc:VH};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -20254,4 +20254,4 @@ return a / b;`,packedOpSnippet:` * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const GH=[IB,kB,TB,RB,DB,OB,MB,BB,UB,HB,KB,ZB,ez,oz,az,cz,hz,mz,xz,yz,Iz,Nz,Rz,_z,Lz,Vz,Uz,jz,rB,Yz,tV,rV,hV,fV,gV,bV,wV,kV,SV,NV,RV,DV,_V,MV,BV,UV,HV,KV,ZV,JV,tW,oW,iW,cW,hW,dW,fW,gW,bW,wW,IW,kW,TW,RW,DW,OW,PW,zW,WW,oB,GW,Jz,qW,KW,YW,aB,QW,e4,n4,r4,l4,u4,d4,f4,x4,y4,C4,v4,T4,E4,F4,O4,M4,B4,V4,H4,K4,Q4,oU,uB,lU,hU,fU,xU,Mz,yU,CU,$U,SU,RU,cB,DU,_U,LU,PU,BU,Pz,eU,VU,GU,jU,dB,ZU,eG,oG,aG,hG,pG,mG,xG,wG,$G,SG,EG,DG,_G,PG,zG,Tz,nU,WG,UG,HG,jG,XG,ZG,JG,tH,sH,rH,aH,cH,hH,fH,gH,bH,wH,tU,yB,IH,kH,SH,EH,FH,LH,wB,PH,zH,UH,wU];for(const n of GH)gf(n);class HH{idx(e,t,s,o){return s*o[0]*o[1]+t*o[0]+e}check_previous_slice(e,t,s,o,r,i,a,l,c,u){let h=0;if(!r)return 0;const d=e[this.idx(s,o,r,i)];if(a>=6){const p=this.idx(s,o,r-1,i);d===e[p]&&(c[h++]=t[p])}if(a>=18){if(s){const p=this.idx(s-1,o,r-1,i);d===e[p]&&(c[h++]=t[p])}if(o){const p=this.idx(s,o-1,r-1,i);d===e[p]&&(c[h++]=t[p])}if(s=6){if(f){const x=this.idx(f-1,p,d,t);g===e[x]&&(h[m++]=u[x])}if(p){const x=this.idx(f,p-1,d,t);g===e[x]&&(h[m++]=u[x])}}if(s>=18){if(p&&f){const x=this.idx(f-1,p-1,d,t);g===e[x]&&(h[m++]=u[x])}if(p&&f=l){l+=a;const x=new Uint32Array(l);x.set(c),c=x}c[i-1]=i,i++}}}for(let d=0;d.",inferenceDelay:100,description:"Gray and white matter segmentation model. Operates on full T1 image in a single pass but needs a dedicated graphics card to operate. Provides the best accuracy with hard cropping for better speed"},{id:3,type:"Segmentation",path:"/models/model20chan3cls/model.json",modelName:"🔪 Tissue GWM (High Acc, Low Mem)",labelsPath:"./models/model20chan3cls/labels.json",colorsPath:"./models/model20chan3cls/colorLUT.json",colormapPath:"./models/model20chan3cls/colormap.json",preModelId:null,preModelPostProcess:!1,isBatchOverlapEnable:!1,numOverlapBatches:0,enableTranspose:!0,enableCrop:!0,cropPadding:0,autoThreshold:.2,enableQuantileNorm:!0,filterOutWithPreMask:!1,enableSeqConv:!0,textureSize:0,warning:"This model may need dedicated graphics card. For more info please check with Browser Resources .",inferenceDelay:100,description:"Gray and white matter segmentation model. Operates on full T1 image in a single pass but needs a dedicated graphics card to operate. Provides high accuracy and fit low memory available but slower"},{id:4,type:"Atlas",path:"/models/model30chan18cls/model.json",modelName:"🪓 Subcortical + GWM (High Mem, Fast)",labelsPath:"./models/model30chan18cls/labels.json",colorsPath:"./models/model30chan18cls/colorLUT.json",colormapPath:"./models/model30chan18cls/colormap.json",preModelId:null,preModelPostProcess:!1,isBatchOverlapEnable:!1,numOverlapBatches:200,enableTranspose:!0,enableCrop:!0,cropPadding:0,autoThreshold:.2,enableQuantileNorm:!1,filterOutWithPreMask:!1,enableSeqConv:!1,textureSize:0,warning:"This model may need dedicated graphics card. For more info please check with Browser Resources .",inferenceDelay:100,description:"Parcellation of the brain into 17 regions: gray and white matter plus subcortical areas. This is a robust model able to handle range of data quality, including varying saturation, and even clinical scans. It may work on infant brains, but your mileage may vary."},{id:5,type:"Atlas",path:"/models/model30chan18cls/model.json",modelName:"🪓 Subcortical + GWM (Low Mem, Slow)",labelsPath:"./models/model30chan18cls/labels.json",colorsPath:"./models/model30chan18cls/colorLUT.json",colormapPath:"./models/model30chan18cls/colormap.json",preModelId:null,preModelPostProcess:!1,isBatchOverlapEnable:!1,numOverlapBatches:200,enableTranspose:!0,enableCrop:!0,cropPadding:0,autoThreshold:.2,enableQuantileNorm:!1,filterOutWithPreMask:!1,enableSeqConv:!0,textureSize:0,warning:"This model may need dedicated graphics card. For more info please check with Browser Resources .",inferenceDelay:100,description:"Parcellation of the brain into 17 regions: gray and white matter plus subcortical areas. This is a robust model able to handle range of data quality, including varying saturation, and even clinical scans. It may work on infant brains, but your mileage may vary."},{id:6,type:"Atlas",path:"/models/model18cls/model.json",modelName:"🪓 Subcortical + GWM (Low Mem, Faster)",labelsPath:"./models/model18cls/labels.json",colorsPath:"./models/model18cls/colorLUT.json",colormapPath:"./models/model18cls/colormap.json",preModelId:null,preModelPostProcess:!1,isBatchOverlapEnable:!1,numOverlapBatches:200,enableTranspose:!0,enableCrop:!0,cropPadding:0,autoThreshold:.2,enableQuantileNorm:!1,filterOutWithPreMask:!1,enableSeqConv:!0,textureSize:0,warning:"This model may need dedicated graphics card. For more info please check with Browser Resources .",inferenceDelay:100,description:"Parcellation of the brain into 17 regions: gray and white matter plus subcortical areas. This is a robust model able to handle range of data quality, including varying saturation, and even clinical scans. It may work on infant brains, but your mileage may vary."},{id:7,type:"Atlas",path:"/models/model30chan18cls/model.json",modelName:"🔪🪓 Subcortical + GWM (Failsafe, Less Acc)",labelsPath:"./models/model30chan18cls/labels.json",colorsPath:"./models/model30chan18cls/colorLUT.json",colormapPath:"./models/model30chan18cls/colormap.json",preModelId:1,preModelPostProcess:!1,isBatchOverlapEnable:!1,numOverlapBatches:200,enableTranspose:!0,enableCrop:!0,cropPadding:0,autoThreshold:0,enableQuantileNorm:!1,filterOutWithPreMask:!1,enableSeqConv:!1,textureSize:0,warning:"This model may need dedicated graphics card. For more info please check with Browser Resources .",inferenceDelay:100,description:"Parcellation of the brain into 17 regions: gray and white matter plus subcortical areas. This is not a robust model, it may work on low data quality, including varying saturation, and even clinical scans. It may work also on infant brains, but your mileage may vary."},{id:8,type:"Atlas",path:"/models/model30chan50cls/model.json",modelName:"🔪 Aparc+Aseg 50 (High Mem, Fast)",labelsPath:"./models/model30chan50cls/labels.json",colorsPath:"./models/model30chan50cls/colorLUT.json",colormapPath:"./models/model30chan50cls/colormap.json",preModelId:1,preModelPostProcess:!1,isBatchOverlapEnable:!1,numOverlapBatches:200,enableTranspose:!0,enableCrop:!0,cropPadding:0,autoThreshold:0,enableQuantileNorm:!0,filterOutWithPreMask:!1,enableSeqConv:!1,textureSize:0,warning:"This model may need dedicated graphics card. For more info please check with Browser Resources .",inferenceDelay:100,description:"This is a 50-class model, that segments the brain into the Aparc+Aseg Freesurfer Atlas but one where cortical homologues are merged into a single class."},{id:9,type:"Atlas",path:"/models/model30chan50cls/model.json",modelName:"🔪 Aparc+Aseg 50 (Low Mem, Slow)",labelsPath:"./models/model30chan50cls/labels.json",colorsPath:"./models/model30chan50cls/colorLUT.json",colormapPath:"./models/model30chan50cls/colormap.json",preModelId:1,preModelPostProcess:!1,isBatchOverlapEnable:!1,numOverlapBatches:200,enableTranspose:!0,enableCrop:!0,cropPadding:0,autoThreshold:0,enableQuantileNorm:!0,filterOutWithPreMask:!1,enableSeqConv:!0,textureSize:0,warning:"This model may need dedicated graphics card. For more info please check with Browser Resources .",inferenceDelay:100,description:"This is a 50-class model, that segments the brain into the Aparc+Aseg Freesurfer Atlas but one where cortical homologues are merged into a single class. The model use sequential convolution for inference to overcome browser memory limitations but leads to longer computation time."},{id:10,type:"Brain_Extraction",path:"/models/model5_gw_ae/model.json",modelName:"⚡ Extract the Brain (FAST)",labelsPath:null,colorsPath:null,preModelId:null,preModelPostProcess:!1,isBatchOverlapEnable:!1,numOverlapBatches:0,enableTranspose:!0,enableCrop:!0,cropPadding:18,autoThreshold:0,enableQuantileNorm:!1,filterOutWithPreMask:!1,enableSeqConv:!1,textureSize:0,warning:null,inferenceDelay:100,description:"Extract the brain fast model operates on full T1 image in a single pass, but uses only 5 filters per layer. Can work on integrated graphics cards but is barely large enough to provide good accuracy. Still more accurate than the failsafe version."},{id:11,type:"Brain_Extraction",path:"/models/model11_gw_ae/model.json",modelName:"🔪 Extract the Brain (High Acc, Slow)",labelsPath:null,colorsPath:null,preModelId:null,preModelPostProcess:!1,isBatchOverlapEnable:!1,numOverlapBatches:0,enableTranspose:!0,enableCrop:!0,cropPadding:0,autoThreshold:0,enableQuantileNorm:!1,filterOutWithPreMask:!1,enableSeqConv:!0,textureSize:0,warning:"This model may need dedicated graphics card. For more info please check with Browser Resources .",inferenceDelay:100,description:"Extract the brain high accuracy model operates on full T1 image in a single pass, but uses only 11 filters per layer. Can work on dedicated graphics cards. Still more accurate than the fast version."},{id:12,type:"Brain_Masking",path:"/models/model5_gw_ae/model.json",modelName:"⚡ Brain Mask (FAST)",labelsPath:null,colorsPath:null,colormapPath:"./models/model5_gw_ae/colormap.json",preModelId:null,preModelPostProcess:!1,isBatchOverlapEnable:!1,numOverlapBatches:0,enableTranspose:!0,enableCrop:!0,cropPadding:17,autoThreshold:0,enableQuantileNorm:!1,filterOutWithPreMask:!1,enableSeqConv:!1,textureSize:0,warning:null,inferenceDelay:100,description:"This fast masking model operates on full T1 image in a single pass, but uses only 5 filters per layer. Can work on integrated graphics cards but is barely large enough to provide good accuracy. Still more accurate than failsafe version."},{id:13,type:"Brain_Masking",path:"/models/model11_gw_ae/model.json",modelName:"🔪 Brain Mask (High Acc, Low Mem)",labelsPath:null,colorsPath:null,preModelId:null,preModelPostProcess:!1,isBatchOverlapEnable:!1,numOverlapBatches:0,enableTranspose:!0,enableCrop:!0,cropPadding:0,autoThreshold:0,enableQuantileNorm:!0,filterOutWithPreMask:!1,enableSeqConv:!0,textureSize:0,warning:"This model may need dedicated graphics card. For more info please check with Browser Resources .",inferenceDelay:100,description:"This masking model operates on full T1 image in a single pass, but uses 11 filters per layer. Can work on dedicated graphics cards. Still more accurate than fast version."},{id:14,type:"Atlas",path:"/models/model21_104class/model.json",modelName:"🔪 Aparc+Aseg 104 (High Mem, Fast)",labelsPath:"./models/model21_104class/labels.json",colorsPath:"./models/model21_104class/colorLUT.json",colormapPath:"./models/model21_104class/colormap.json",preModelId:1,preModelPostProcess:!1,isBatchOverlapEnable:!1,numOverlapBatches:200,enableTranspose:!0,enableCrop:!0,cropPadding:0,autoThreshold:0,enableQuantileNorm:!1,filterOutWithPreMask:!1,enableSeqConv:!1,textureSize:0,warning:"This model may need dedicated graphics card. For more info please check with Browser Resources .",inferenceDelay:100,description:"FreeSurfer aparc+aseg atlas 104 parcellate brain areas into 104 regions. It contains a combination of the Desikan-Killiany atlas for cortical area and also segmentation of subcortical regions."},{id:15,type:"Atlas",path:"/models/model21_104class/model.json",modelName:"🔪 Aparc+Aseg 104 (Low Mem, Slow)",labelsPath:"./models/model21_104class/labels.json",colorsPath:"./models/model21_104class/colorLUT.json",colormapPath:"./models/model21_104class/colormap.json",preModelId:1,preModelPostProcess:!1,isBatchOverlapEnable:!1,numOverlapBatches:200,enableTranspose:!0,enableCrop:!0,cropPadding:0,autoThreshold:0,enableQuantileNorm:!1,filterOutWithPreMask:!1,enableSeqConv:!0,textureSize:0,warning:"This model may need dedicated graphics card. For more info please check with Browser Resources .",inferenceDelay:100,description:"FreeSurfer aparc+aseg atlas 104 parcellate brain areas into 104 regions. It contains a combination of the Desikan-Killiany atlas for cortical area and also segmentation of subcortical regions. The model use sequential convolution for inference to overcome browser memory limitations but leads to longer computation time. "}];function ge(n="",e=-1,t="",s=[]){let o=[];Object.keys(s).length>0&&(o=function(){const i={};for(const a in s)i[a]=s[a];return JSON.stringify(i)}()),self.postMessage({cmd:"ui",message:n,progressFrac:e,modalMessage:t,statData:o})}function Ec(n,e,t){self.postMessage({cmd:"img",img:n,opts:e,modelEntry:t})}async function Rp(n){let e=0;for(let t=0;tp-f);const r=At(o),i=r.shape[0],a=Math.floor(i*e),l=Math.ceil(i*t)-1,c=r.slice(a,1),u=r.slice(l,1),h=(await c.array())[0],d=(await u.array())[0];return s.dispose(),r.dispose(),c.dispose(),u.dispose(),{qmin:h,qmax:d}}async function Dp(n,e=.05,t=.95){const{qmin:s,qmax:o}=await KH(n,e,t),r=De(s),i=De(o),a=n.sub(r).div(i.sub(r));return r.dispose(),i.dispose(),a}async function Fp(n){const e=n.max(),t=n.min();return await n.sub(t).div(e.sub(t))}async function XH(n,e,t,s,o,r,i){ge("",-1,"inferenceFullVolumeSeqCovLayer() is not dead code?")}async function YH(n,e,t,s,o,r,i){ge("",-1,"inferenceFullVolume() is not dead code?")}async function uw(n,e,t,s,o,r=null){ge("",-1,"inferenceSubVolumes() is not dead code?")}async function hw(n,e){ge("",-1,"tensor2LightBuffer() is not dead code?")}async function dw(n,e,t,s,o,r="float32"){ge("",-1,"argMaxLarge() is not dead code?")}async function Ac(n){return n.step(0)}async function pw(n,e,t){const s=[];for(let l=0;l0?t-c-1:0,p=s-u-1>0?s-u-1:0,f=e-h-1>0?e-h-1:0;return n.pad([[i,d],[a,p],[l,f]])}async function mw(n,e){const t=n.max(),s=t.mul(e),o=await s.data();return t.dispose(),s.dispose(),B(()=>n.clone().greater(o[0]))}async function ZH(n,e,t,s,o,r,i,a,l=!0){console.log("Generate Brain Masking ... ");let c=[];for(let f=0;f{const f="postProcessSlices3D() should be upgraded to BWLabeler";ge(f,-1,f)}),console.log("Post processing done ")):console.log("Phase-1 Post processing disabled ... ");const h=new Array(c[0].length*c.length);let d=0;for(let f=0;f{const w=n.slice([0,0,0,0,g],[-1,-1,-1,-1,x-g]),y=e.slice([0,0,0,g,u],[-1,-1,-1,x-g,1]);return oh(w,y,s,o,"NDHWC",r)});if(p===null)p=b;else{const w=p.add(b);p.dispose(),b.dispose(),p=w}}}const f=p.add(d);if(p.dispose(),d.dispose(),c==null)c=f;else{const m=await Mt([c,f],4);f.dispose(),c.dispose(),c=m}}return c}function JH(n,e,t){const i=n.shape[4],a=Math.ceil(i/t);let l=null;for(let c=0;cn.slice([0,0,0,0,u],[-1,-1,-1,-1,d])),f=B(()=>e.slice([0,0,0,u,0],[-1,-1,-1,d,-1])),m=oh(p,f,1,0,"NDHWC",1);p.dispose(),f.dispose();const g=Xo(m);if(m.dispose(),l===null)l=g;else{const x=l.add(g);l.dispose(),l!==g&&g.dispose(),l=x}B(()=>{Ae(ot([1,1]),ot([1,1]))})}return l}class eq{constructor(e,t,s){this.model=e,this.outChannels=e.outputLayers[0].kernel.shape[4],this.chunkSize=t,this.isChannelLast=s}async apply(e){const t=yr.get("WEBGL_DELETE_TEXTURE_THRESHOLD");yr.set("WEBGL_DELETE_TEXTURE_THRESHOLD",0);const s=this,o=performance.now(),r=s.model.layers[s.model.layers.length-1],i=r.getWeights()[0],a=r.getWeights()[1],l=s.isChannelLast?e.shape.slice(1,-1):e.shape.slice(2);let c=D(Nn(l),-1e4),u=ot(l),h=0;for(console.log(" channel loop");;){Te().startScope(),console.log("=======================");const d=await Ot();console.log(`| Number of Tensors: ${d.numTensors}`),console.log(`| Number of Data Buffers: ${d.numDataBuffers}`),console.log("Channel : ",h);const p=await B(()=>{const m=i.slice([0,0,0,0,h],[-1,-1,-1,-1,1]),g=a.slice([h],[1]),x=JH(e,m,Math.min(s.chunkSize,s.outChannels)).add(g),b=Zt(x,c),w=It(b,x,c),y=It(b,Ii(u.shape,h),u);return fe([c,u,m,g,x,b]),B(()=>Ae(Nn([1,1]),Nn([1,1]))),[y,w]});console.log("=======================");const f=await Ot();if(ge(`Iteration ${h}`,h/s.outChannels),console.log(`Number of Tensors: ${f.numTensors}`),console.log(`Number of Data Buffers: ${f.numDataBuffers}`),console.log(`Megabytes In Use: ${(f.numBytes/1048576).toFixed(3)} MB`),f.unreliable&&console.log(`Unreliable: ${f.unreliable}`),typeof u<"u"&&u.dispose(),typeof c<"u"&&c.dispose(),u=dn(p[0]),c=dn(p[1]),Te().endScope(),h===s.outChannels-1){fe(c);const g=performance.now()-o;return console.log(`Execution time for output layer: ${g} milliseconds`),yr.set("WEBGL_DELETE_TEXTURE_THRESHOLD",t),u}else{h++;const m=u.shape,g=u.dataSync(),x=u.shape,b=c.dataSync();u.dispose(),c.dispose(),u=ss(g,m),c=ss(b,x)}}}}async function gw(n,e,t,s,o,r,i,a,l,c){if(l.isPostProcessEnable){const d=new HH,p=new Uint32Array(e),f=26,m=!0,g=!0,[x,b]=d.bwlabel(n,p,f,m,g);for(let w=0;w0&&S<=1?h=await mw(s,S):(console.log("No valid crop threshold value"),h=await s.greater([0]).asType("bool"))}else h=await a.greater([0]).asType("bool");console.log(" mask_3d shape : ",h.shape);const d=await Lm(h);h.dispose();const p=d.min(0).arraySync()[0],f=d.max(0).arraySync()[0],m=d.min(0).arraySync()[1],g=d.max(0).arraySync()[1],x=d.min(0).arraySync()[2],b=d.max(0).arraySync()[2];console.log("row min and max :",p,f),console.log("col min and max :",m,g),console.log("depth min and max :",x,b);const w=[p,m,x],y=[f-p+1,g-m+1,b-x+1];d.dispose();const C=await s.slice([p,m,x],[f-p+1,g-m+1,b-x+1]);s.dispose();const I=e.cropPadding;let $=await fw(C,[I,I],[I,I],[I,I]);if(console.log(" cropped slices_3d with padding shape: ",$.shape),C.dispose(),n.drawBoundingVolume){let S=await Dc($,I,I,I);return console.log(" outLabelVolume without padding shape : ",S.shape),S=await Fc(S,o,r,i,w,y),console.log(" outLabelVolume final shape after resizing : ",S.shape),pw(Gn(S),n,e),S.dispose(),0}l.Brainchop_Ver="FullVolume";const k=await t;try{let S=performance.now();const N=performance.now();let A=0;const _=e.enableTranspose;_?($=await $.transpose(),console.log("Input transposed for pre-model")):console.log("Transpose not enabled for pre-model");let E=1;const M=k.layers.length;console.log("res.layers.length ",M);const z=Rc(k),P=n.batchSize,H=n.numOfChan;let W;z?(k.layers[0].batchInputShape[1]=$.shape[0],k.layers[0].batchInputShape[2]=$.shape[1],k.layers[0].batchInputShape[3]=$.shape[2],W=[P,k.layers[0].batchInputShape[1],k.layers[0].batchInputShape[2],k.layers[0].batchInputShape[3],H]):(k.layers[0].batchInputShape[2]=$.shape[0],k.layers[0].batchInputShape[3]=$.shape[1],k.layers[0].batchInputShape[4]=$.shape[2],W=[P,H,k.layers[0].batchInputShape[2],k.layers[0].batchInputShape[3],k.layers[0].batchInputShape[4]]),console.log(" Model batch input shape : ",k.layers[0].batchInputShape),l.Input_Shape=JSON.stringify(k.layers[0].batchInputShape),l.Output_Shape=JSON.stringify(k.output.shape),l.Channel_Last=await z,l.Model_Param=await Rp(k),l.Model_Layers=await Ap(k),l.Model=e.modelName,l.Seq_Conv=e.enableSeqConv;const q=k.layers[k.layers.length-1];console.log("Output Layer : ",q);const K=z?q.outputShape[q.outputShape.length-1]:q.outputShape[1];console.log("Num of output channels x: ",K);const j=[];for(j[0]=await $.reshape(W);;){try{k.layers[E].activation.getClassName()!=="linear"?j[E]=await k.layers[E].apply(j[E-1]):j[E]=await QH(j[E-1],k.layers[E].getWeights()[0],k.layers[E].getWeights()[1],k.layers[E].strides,k.layers[E].padding,k.layers[E].dilationRate,3),fe(j[E-1])}catch(Y){const X="Your graphics card (e.g. Intel) may not be compatible with WebGL. "+Y.message;return ge(X,-1,X),Te().endScope(),Te().disposeVariables(),l.Inference_t=1/0,l.Postprocess_t=1/0,l.Status="Fail",l.Error_Type=Y.message,l.Extra_Err_Info="Failed while model layer "+E+" apply",ge("",-1,"",l),0}if(console.log("layer output Tensor shape : ",j[E].shape),console.log("layer count params ",k.layers[E].countParams()),k.layers[E].dispose(),j[E-1].dispose(),ge("Layer "+E.toString(),(E+1)/M),Ot().unreliable){const Y="unreliable reasons :"+Ot().reasons;ge(Y,NaN,Y)}if(E===M-2){const Y=await new eq(k,10,z);let X=null;const ee=await mC(async()=>{X=await Y.apply(j[E])});if(console.log("profileInfo : ",ee),fe(j[E]),console.log(" Output tensor",X),console.log(" Output tensor shape : ",X.shape),X.shape.length!==3){const xe="Output tensor shape should be 3 dims but it is "+X.shape.length;ge(xe,-1,xe)}const Q=((performance.now()-S)/1e3).toFixed(4);console.log(" find array max ");const ne=await X.max().dataSync()[0];Ahere'),Ot().unreliable){const N="unreliable reasons :"+Ot().reasons;ge(N,NaN,N)}}}async function bw(n,e,t,s,o,r,i,a,l,c){let u=[];console.log(" ---- Start FullVolume inference phase-II ---- "),i.enableQuantileNorm?(console.log("preModel Quantile normalization enabled"),e=await Dp(e)):(console.log("preModel Min Max normalization enabled"),e=await Fp(e));let d;if(r==null){const E=i.autoThreshold;E>0&&E<=1?d=await mw(e,E):(console.log("No valid crop threshold value"),d=await e.greater([0]).asType("bool"))}else d=await r.greater([0]).asType("bool");console.log(" mask_3d shape : ",d.shape);const p=await Lm(d);d.dispose();const f=p.arraySync();let m=s,g=0,x=o,b=0,w=t,y=0;for(let E=0;Ef[E][0]?m=f[E][0]:gf[E][1]?x=f[E][1]:bf[E][2]?w=f[E][2]:yhere')}}async function tq(n,e,t,s,o,r,i,a,l,c,u){if(a.No_SubVolumes=1,i.preModelId){const h=await lw(l.rootURL+Ep[i.preModelId-1].path),d=Ep[i.preModelId-1].enableTranspose,p=Ep[i.preModelId-1].enableQuantileNorm;let f=null;p?(console.log("preModel Quantile normalization enabled"),f=await Dp(e)):(console.log("preModel Min Max normalization enabled"),f=await Fp(e)),d?(f=f.transpose(),console.log("Input transposed for pre-model")):console.log("Transpose not enabled for pre-model"),a.Brainchop_Ver="PreModel_FV";const m=await h;try{const g=performance.now(),x=m,b=x.layers[0].batchInputShape;if(console.log(" Pre-Model batch input shape : ",b),b.length!==5){const M="The pre-model input shape must be 5D ";return ge(M,-1,M),0}const w=await Rc(x),y=l.batchSize,C=l.numOfChan;let I,$,k,S;if(w){if(console.log("Pre-Model Channel Last"),isNaN(b[4])||b[4]!==1){const M="The number of channels for pre-model input shape must be 1";return ge(M,-1,M),0}I=b[1],$=b[2],k=b[3],S=[y,I,$,k,C]}else{if(console.log("Pre-Model Channel First"),isNaN(b[1])||b[1]!==1){const M="The number of channels for pre-model input shape must be 1";return ge(M,-1,M),0}I=b[2],$=b[3],k=b[4],S=[y,C,I,$,k]}a.Input_Shape=JSON.stringify(S),a.Output_Shape=JSON.stringify(x.output.shape),a.Channel_Last=await w,a.Model_Param=await Rp(x),a.Model_Layers=await Ap(x);let N=0,A=1;const _=m.layers.length,E=[];for(E[0]=f.reshape(S),fe(f);;){try{E[A]=m.layers[A].apply(E[A-1])}catch(M){const z="Your graphics card (e.g. Intel) may not be compatible with WebGL. "+M.message;return ge(z,-1,z),Te().endScope(),Te().disposeVariables(),a.Inference_t=1/0,a.Postprocess_t=1/0,a.Status="Fail",a.Error_Type=M.message,a.Extra_Err_Info="PreModel Failed while model layer "+A+" apply",ge("",-1,"",a),0}if(m.layers[A].dispose(),E[A-1].dispose(),ge("Layer "+A.toString(),(A+1)/_),Ot().unreliable){const M="unreliable reasons :"+Ot().reasons;ge(M,NaN,M)}if(A===_-1){const M=w?-1:1;console.log(" find argmax "),console.log("last Tensor shape : ",E[A].shape);const z=w?E[A].shape[4]:E[A].shape[1];let P;try{console.log(" Try tf.argMax for fullVolume .."),P=await no(E[A],M)}catch(ee){if(M===-1)try{const Q=performance.now();console.log(" tf.argMax failed .. try argMaxLarge ..");const ne=hw(E[A].reshape([t,s,o,z]),"float16");P=dw(ne,t,s,o,z,"float16"),console.log("argMaxLarge for fullVolume takes : ",((performance.now()-Q)/1e3).toFixed(4))}catch(Q){const ne="argMax buffer couldn't be created due to limited memory resources.";return ge(ne,-1,ne),P.dispose(),Te().endScope(),Te().disposeVariables(),a.Inference_t=1/0,a.Postprocess_t=1/0,a.Status="Fail",a.Error_Type=Q.message,a.Extra_Err_Info="preModel prediction_argmax from argMaxLarge failed",ge("",-1,"",a),0}else{const Q="argMax buffer couldn't be created due to limited memory resources.";return ge(Q,-1,Q),P.dispose(),Te().endScope(),Te().disposeVariables(),a.Inference_t=1/0,a.Postprocess_t=1/0,a.Status="Fail",a.Error_Type=ee.message,a.Extra_Err_Info="preModel prediction_argmax from argMaxLarge not support yet channel first",ge("",-1,"",a),0}}console.log(" Pre-model prediction_argmax shape : ",P.shape);const H=((performance.now()-g)/1e3).toFixed(4);fe(E[A]),console.log(" Pre-model find array max ");const W=await P.max().dataSync()[0];Nhere')}}else console.log("--- No pre-model is selected ---"),console.log("------ Run voxel cropping ------"),r?i.enableSeqConv?(console.log("------ Seq Convoluton ------"),await xw(l,i,n,e,t,s,o,null,a,u)):bw(n,e,t,s,o,null,i,a,l,u):uw(n,e,t,s,o,null)}async function nq(n=!0){gC("webgl"),await fC(),V().set("DEBUG",!1),V().set("WEBGL_FORCE_F16_TEXTURES",n),V().set("WEBGL_DELETE_TEXTURE_THRESHOLD",0),await xC(),console.log("tf env() flags :",V().flags),console.log("tf env() features :",V().features),console.log("tf env total features: ",Object.keys(V().features).length),console.log("tf backend: ",jf())}async function sq(n,e,t,s){const o=[];o.startTime=Date.now(),ge("Segmentation started",0);const r=n.batchSize,i=n.numOfChan;if(isNaN(r)||r!==1){const $="The batch Size for input shape must be 1";return ge($,-1,$),0}if(isNaN(i)||i!==1){const $="The number of channels for input shape must be 1";return ge($,-1,$),0}Te().startScope(),console.log("Batch size: ",r),console.log("Num of Channels: ",i);const a=await lw(n.rootURL+e.path);await nq(!0),o.TF_Backend=jf();const l=a;let c=[];if(c=l.layers[0].batchInputShape,console.log(" Model batch input shape : ",c),c.length!==5){const $="The model input shape must be 5D";return ge($,-1,$),0}let u,h,d;const p=t.dims[1],f=t.dims[2],m=t.dims[3];if(await Rc(l)){if(console.log("Model Channel Last"),isNaN(c[4])||c[4]!==1){const $="The number of channels for input shape must be 1";return ge($,-1,$),0}u=c[1],h=c[2],d=c[3]}else{if(console.log("Model Channel First"),isNaN(c[1])||c[1]!==1){const $="The number of channels for input shape must be 1";return ge($,-1,$),0}u=c[2],h=c[3],d=c[4]}let x;u===256&&h===256&&d===256?x=!0:x=!1,o.isModelFullVol=x;let b=await cw(m,t,s);const w=await qH(b,f,p);b=null;let y=await jH(w);fe(w);const C=e.enableTranspose,I=e.enableCrop;x&&(I?await tq(a,y,m,f,p,x,e,o,n,t,s):(console.log("Cropping Disabled"),C?(y=y.transpose(),console.log("Input transposed")):console.log("Transpose NOT Enabled"),e.enableSeqConv?(console.log("Seq Convoluton Enabled"),await XH()):(console.log("Seq Convoluton Disabled"),await YH())))}self.addEventListener("message",function(n){sq(n.data.opts,n.data.modelEntry,n.data.niftiHeader,n.data.niftiImage)},!1)})(); + */const UH=[CB,$B,SB,EB,AB,_B,LB,PB,WB,GB,jB,YB,JB,sz,iz,lz,uz,fz,gz,bz,Cz,Tz,Ez,Fz,Oz,zz,Wz,qz,oB,Xz,eV,oV,uV,pV,mV,xV,yV,$V,vV,TV,EV,AV,FV,LV,PV,WV,GV,jV,YV,QV,eW,sW,rW,lW,uW,hW,pW,mW,xW,yW,CW,$W,SW,EW,AW,_W,MW,BW,VW,sB,UW,Qz,HW,jW,XW,iB,ZW,JW,t4,o4,a4,c4,h4,p4,g4,b4,w4,k4,S4,N4,D4,_4,L4,P4,z4,G4,j4,Z4,sU,cB,aU,uU,pU,gU,Lz,bU,wU,IU,vU,EU,lB,AU,FU,OU,MU,PU,Mz,J4,zU,UU,qU,hB,YU,JU,sG,iG,uG,dG,fG,gG,yG,IG,vG,NG,AG,FG,MG,BG,Sz,tU,VG,WG,GG,qG,KG,YG,QG,eH,nH,oH,iH,lH,uH,pH,mH,xH,yH,eU,bB,CH,$H,vH,NH,DH,OH,yB,MH,BH,WH,yU];for(const n of UH)gf(n);class GH{idx(e,t,s,o){return s*o[0]*o[1]+t*o[0]+e}check_previous_slice(e,t,s,o,r,i,a,l,c,u){let h=0;if(!r)return 0;const d=e[this.idx(s,o,r,i)];if(a>=6){const p=this.idx(s,o,r-1,i);d===e[p]&&(c[h++]=t[p])}if(a>=18){if(s){const p=this.idx(s-1,o,r-1,i);d===e[p]&&(c[h++]=t[p])}if(o){const p=this.idx(s,o-1,r-1,i);d===e[p]&&(c[h++]=t[p])}if(s=6){if(f){const x=this.idx(f-1,p,d,t);g===e[x]&&(h[m++]=u[x])}if(p){const x=this.idx(f,p-1,d,t);g===e[x]&&(h[m++]=u[x])}}if(s>=18){if(p&&f){const x=this.idx(f-1,p-1,d,t);g===e[x]&&(h[m++]=u[x])}if(p&&f=l){l+=a;const x=new Uint32Array(l);x.set(c),c=x}c[i-1]=i,i++}}}for(let d=0;d.",inferenceDelay:100,description:"Gray and white matter segmentation model. Operates on full T1 image in a single pass but needs a dedicated graphics card to operate. Provides the best accuracy with hard cropping for better speed"},{id:3,type:"Segmentation",path:"/models/model20chan3cls/model.json",modelName:"🔪 Tissue GWM (High Acc, Low Mem)",labelsPath:"./models/model20chan3cls/labels.json",colorsPath:"./models/model20chan3cls/colorLUT.json",colormapPath:"./models/model20chan3cls/colormap.json",preModelId:null,preModelPostProcess:!1,isBatchOverlapEnable:!1,numOverlapBatches:0,enableTranspose:!0,enableCrop:!0,cropPadding:0,autoThreshold:.2,enableQuantileNorm:!0,filterOutWithPreMask:!1,enableSeqConv:!0,textureSize:0,warning:"This model may need dedicated graphics card. For more info please check with Browser Resources .",inferenceDelay:100,description:"Gray and white matter segmentation model. Operates on full T1 image in a single pass but needs a dedicated graphics card to operate. Provides high accuracy and fit low memory available but slower"},{id:4,type:"Atlas",path:"/models/model30chan18cls/model.json",modelName:"🪓 Subcortical + GWM (High Mem, Fast)",labelsPath:"./models/model30chan18cls/labels.json",colorsPath:"./models/model30chan18cls/colorLUT.json",colormapPath:"./models/model30chan18cls/colormap.json",preModelId:null,preModelPostProcess:!1,isBatchOverlapEnable:!1,numOverlapBatches:200,enableTranspose:!0,enableCrop:!0,cropPadding:0,autoThreshold:.2,enableQuantileNorm:!1,filterOutWithPreMask:!1,enableSeqConv:!1,textureSize:0,warning:"This model may need dedicated graphics card. For more info please check with Browser Resources .",inferenceDelay:100,description:"Parcellation of the brain into 17 regions: gray and white matter plus subcortical areas. This is a robust model able to handle range of data quality, including varying saturation, and even clinical scans. It may work on infant brains, but your mileage may vary."},{id:5,type:"Atlas",path:"/models/model30chan18cls/model.json",modelName:"🪓 Subcortical + GWM (Low Mem, Slow)",labelsPath:"./models/model30chan18cls/labels.json",colorsPath:"./models/model30chan18cls/colorLUT.json",colormapPath:"./models/model30chan18cls/colormap.json",preModelId:null,preModelPostProcess:!1,isBatchOverlapEnable:!1,numOverlapBatches:200,enableTranspose:!0,enableCrop:!0,cropPadding:0,autoThreshold:.2,enableQuantileNorm:!1,filterOutWithPreMask:!1,enableSeqConv:!0,textureSize:0,warning:"This model may need dedicated graphics card. For more info please check with Browser Resources .",inferenceDelay:100,description:"Parcellation of the brain into 17 regions: gray and white matter plus subcortical areas. This is a robust model able to handle range of data quality, including varying saturation, and even clinical scans. It may work on infant brains, but your mileage may vary."},{id:6,type:"Atlas",path:"/models/model18cls/model.json",modelName:"🪓 Subcortical + GWM (Low Mem, Faster)",labelsPath:"./models/model18cls/labels.json",colorsPath:"./models/model18cls/colorLUT.json",colormapPath:"./models/model18cls/colormap.json",preModelId:null,preModelPostProcess:!1,isBatchOverlapEnable:!1,numOverlapBatches:200,enableTranspose:!0,enableCrop:!0,cropPadding:0,autoThreshold:.2,enableQuantileNorm:!1,filterOutWithPreMask:!1,enableSeqConv:!0,textureSize:0,warning:"This model may need dedicated graphics card. For more info please check with Browser Resources .",inferenceDelay:100,description:"Parcellation of the brain into 17 regions: gray and white matter plus subcortical areas. This is a robust model able to handle range of data quality, including varying saturation, and even clinical scans. It may work on infant brains, but your mileage may vary."},{id:7,type:"Atlas",path:"/models/model30chan18cls/model.json",modelName:"🔪🪓 Subcortical + GWM (Failsafe, Less Acc)",labelsPath:"./models/model30chan18cls/labels.json",colorsPath:"./models/model30chan18cls/colorLUT.json",colormapPath:"./models/model30chan18cls/colormap.json",preModelId:1,preModelPostProcess:!1,isBatchOverlapEnable:!1,numOverlapBatches:200,enableTranspose:!0,enableCrop:!0,cropPadding:0,autoThreshold:0,enableQuantileNorm:!1,filterOutWithPreMask:!1,enableSeqConv:!1,textureSize:0,warning:"This model may need dedicated graphics card. For more info please check with Browser Resources .",inferenceDelay:100,description:"Parcellation of the brain into 17 regions: gray and white matter plus subcortical areas. This is not a robust model, it may work on low data quality, including varying saturation, and even clinical scans. It may work also on infant brains, but your mileage may vary."},{id:8,type:"Atlas",path:"/models/model30chan50cls/model.json",modelName:"🔪 Aparc+Aseg 50 (High Mem, Fast)",labelsPath:"./models/model30chan50cls/labels.json",colorsPath:"./models/model30chan50cls/colorLUT.json",colormapPath:"./models/model30chan50cls/colormap.json",preModelId:1,preModelPostProcess:!1,isBatchOverlapEnable:!1,numOverlapBatches:200,enableTranspose:!0,enableCrop:!0,cropPadding:0,autoThreshold:0,enableQuantileNorm:!0,filterOutWithPreMask:!1,enableSeqConv:!1,textureSize:0,warning:"This model may need dedicated graphics card. For more info please check with Browser Resources .",inferenceDelay:100,description:"This is a 50-class model, that segments the brain into the Aparc+Aseg Freesurfer Atlas but one where cortical homologues are merged into a single class."},{id:9,type:"Atlas",path:"/models/model30chan50cls/model.json",modelName:"🔪 Aparc+Aseg 50 (Low Mem, Slow)",labelsPath:"./models/model30chan50cls/labels.json",colorsPath:"./models/model30chan50cls/colorLUT.json",colormapPath:"./models/model30chan50cls/colormap.json",preModelId:1,preModelPostProcess:!1,isBatchOverlapEnable:!1,numOverlapBatches:200,enableTranspose:!0,enableCrop:!0,cropPadding:0,autoThreshold:0,enableQuantileNorm:!0,filterOutWithPreMask:!1,enableSeqConv:!0,textureSize:0,warning:"This model may need dedicated graphics card. For more info please check with Browser Resources .",inferenceDelay:100,description:"This is a 50-class model, that segments the brain into the Aparc+Aseg Freesurfer Atlas but one where cortical homologues are merged into a single class. The model use sequential convolution for inference to overcome browser memory limitations but leads to longer computation time."},{id:10,type:"Brain_Extraction",path:"/models/model5_gw_ae/model.json",modelName:"⚡ Extract the Brain (FAST)",labelsPath:null,colorsPath:null,preModelId:null,preModelPostProcess:!1,isBatchOverlapEnable:!1,numOverlapBatches:0,enableTranspose:!0,enableCrop:!0,cropPadding:18,autoThreshold:0,enableQuantileNorm:!1,filterOutWithPreMask:!1,enableSeqConv:!1,textureSize:0,warning:null,inferenceDelay:100,description:"Extract the brain fast model operates on full T1 image in a single pass, but uses only 5 filters per layer. Can work on integrated graphics cards but is barely large enough to provide good accuracy. Still more accurate than the failsafe version."},{id:11,type:"Brain_Extraction",path:"/models/model11_gw_ae/model.json",modelName:"🔪 Extract the Brain (High Acc, Slow)",labelsPath:null,colorsPath:null,preModelId:null,preModelPostProcess:!1,isBatchOverlapEnable:!1,numOverlapBatches:0,enableTranspose:!0,enableCrop:!0,cropPadding:0,autoThreshold:0,enableQuantileNorm:!1,filterOutWithPreMask:!1,enableSeqConv:!0,textureSize:0,warning:"This model may need dedicated graphics card. For more info please check with Browser Resources .",inferenceDelay:100,description:"Extract the brain high accuracy model operates on full T1 image in a single pass, but uses only 11 filters per layer. Can work on dedicated graphics cards. Still more accurate than the fast version."},{id:12,type:"Brain_Masking",path:"/models/model5_gw_ae/model.json",modelName:"⚡ Brain Mask (FAST)",labelsPath:null,colorsPath:null,colormapPath:"./models/model5_gw_ae/colormap.json",preModelId:null,preModelPostProcess:!1,isBatchOverlapEnable:!1,numOverlapBatches:0,enableTranspose:!0,enableCrop:!0,cropPadding:17,autoThreshold:0,enableQuantileNorm:!1,filterOutWithPreMask:!1,enableSeqConv:!1,textureSize:0,warning:null,inferenceDelay:100,description:"This fast masking model operates on full T1 image in a single pass, but uses only 5 filters per layer. Can work on integrated graphics cards but is barely large enough to provide good accuracy. Still more accurate than failsafe version."},{id:13,type:"Brain_Masking",path:"/models/model11_gw_ae/model.json",modelName:"🔪 Brain Mask (High Acc, Low Mem)",labelsPath:null,colorsPath:null,preModelId:null,preModelPostProcess:!1,isBatchOverlapEnable:!1,numOverlapBatches:0,enableTranspose:!0,enableCrop:!0,cropPadding:0,autoThreshold:0,enableQuantileNorm:!0,filterOutWithPreMask:!1,enableSeqConv:!0,textureSize:0,warning:"This model may need dedicated graphics card. For more info please check with Browser Resources .",inferenceDelay:100,description:"This masking model operates on full T1 image in a single pass, but uses 11 filters per layer. Can work on dedicated graphics cards. Still more accurate than fast version."},{id:14,type:"Atlas",path:"/models/model21_104class/model.json",modelName:"🔪 Aparc+Aseg 104 (High Mem, Fast)",labelsPath:"./models/model21_104class/labels.json",colorsPath:"./models/model21_104class/colorLUT.json",colormapPath:"./models/model21_104class/colormap.json",preModelId:1,preModelPostProcess:!1,isBatchOverlapEnable:!1,numOverlapBatches:200,enableTranspose:!0,enableCrop:!0,cropPadding:0,autoThreshold:0,enableQuantileNorm:!1,filterOutWithPreMask:!1,enableSeqConv:!1,textureSize:0,warning:"This model may need dedicated graphics card. For more info please check with Browser Resources .",inferenceDelay:100,description:"FreeSurfer aparc+aseg atlas 104 parcellate brain areas into 104 regions. It contains a combination of the Desikan-Killiany atlas for cortical area and also segmentation of subcortical regions."},{id:15,type:"Atlas",path:"/models/model21_104class/model.json",modelName:"🔪 Aparc+Aseg 104 (Low Mem, Slow)",labelsPath:"./models/model21_104class/labels.json",colorsPath:"./models/model21_104class/colorLUT.json",colormapPath:"./models/model21_104class/colormap.json",preModelId:1,preModelPostProcess:!1,isBatchOverlapEnable:!1,numOverlapBatches:200,enableTranspose:!0,enableCrop:!0,cropPadding:0,autoThreshold:0,enableQuantileNorm:!1,filterOutWithPreMask:!1,enableSeqConv:!0,textureSize:0,warning:"This model may need dedicated graphics card. For more info please check with Browser Resources .",inferenceDelay:100,description:"FreeSurfer aparc+aseg atlas 104 parcellate brain areas into 104 regions. It contains a combination of the Desikan-Killiany atlas for cortical area and also segmentation of subcortical regions. The model use sequential convolution for inference to overcome browser memory limitations but leads to longer computation time. "}];function xe(n="",e=-1,t="",s=[]){let o=[];Object.keys(s).length>0&&(o=function(){const i={};for(const a in s)i[a]=s[a];return JSON.stringify(i)}()),self.postMessage({cmd:"ui",message:n,progressFrac:e,modalMessage:t,statData:o})}function Np(n,e,t){self.postMessage({cmd:"img",img:n,opts:e,modelEntry:t})}async function Ep(n){let e=0;for(let t=0;tp-f);const r=Lt(o),i=r.shape[0],a=Math.floor(i*e),l=Math.ceil(i*t)-1,c=r.slice(a,1),u=r.slice(l,1),h=(await c.array())[0],d=(await u.array())[0];return s.dispose(),r.dispose(),c.dispose(),u.dispose(),{qmin:h,qmax:d}}async function Ap(n,e=.05,t=.95){const{qmin:s,qmax:o}=await qH(n,e,t),r=De(s),i=De(o),a=n.sub(r).div(i.sub(r));return r.dispose(),i.dispose(),a}async function Dp(n){const e=n.max(),t=n.min();return await n.sub(t).div(e.sub(t))}async function jH(n,e,t,s,o,r,i){xe("",-1,"inferenceFullVolumeSeqCovLayer() is not dead code?")}async function KH(n,e,t,s,o,r,i){xe("",-1,"inferenceFullVolume() is not dead code?")}async function cw(n,e,t,s,o,r=null){xe("",-1,"inferenceSubVolumes() is not dead code?")}async function uw(n,e){xe("",-1,"tensor2LightBuffer() is not dead code?")}async function hw(n,e,t,s,o,r="float32"){xe("",-1,"argMaxLarge() is not dead code?")}async function Fp(n){return n.step(0)}async function dw(n,e,t){const s=[];for(let l=0;l0?t-c-1:0,p=s-u-1>0?s-u-1:0,f=e-h-1>0?e-h-1:0;return n.pad([[i,d],[a,p],[l,f]])}async function fw(n,e){const t=n.max(),s=t.mul(e),o=await s.data();return t.dispose(),s.dispose(),B(()=>n.clone().greater(o[0]))}async function XH(n,e,t,s,o,r,i,a,l=!0){n[0].dtype!=="int32"&&i("",-1,"generateBrainMask assumes int32"),o.preModelPostProcess&&i("",-1,"generateBrainMask assumes BWLabeler instead of preModelPostProcess");const c=n.length,u=n[0].size,h=c*u,d=new Int32Array(h);let p=0;for(let f=0;f{const w=n.slice([0,0,0,0,g],[-1,-1,-1,-1,x-g]),y=e.slice([0,0,0,g,u],[-1,-1,-1,x-g,1]);return nh(w,y,s,o,"NDHWC",r)});if(p===null)p=b;else{const w=p.add(b);p.dispose(),b.dispose(),p=w}}}const f=p.add(d);if(p.dispose(),d.dispose(),c==null)c=f;else{const m=await Ot([c,f],4);f.dispose(),c.dispose(),c=m}}return c}function ZH(n,e,t){const i=n.shape[4],a=Math.ceil(i/t);let l=null;for(let c=0;cn.slice([0,0,0,0,u],[-1,-1,-1,-1,d])),f=B(()=>e.slice([0,0,0,u,0],[-1,-1,-1,d,-1])),m=nh(p,f,1,0,"NDHWC",1);p.dispose(),f.dispose();const g=Xo(m);if(m.dispose(),l===null)l=g;else{const x=l.add(g);l.dispose(),l!==g&&g.dispose(),l=x}B(()=>{Ae(ot([1,1]),ot([1,1]))})}return l}class QH{constructor(e,t,s){this.model=e,this.outChannels=e.outputLayers[0].kernel.shape[4],this.chunkSize=t,this.isChannelLast=s}async apply(e){const t=yr.get("WEBGL_DELETE_TEXTURE_THRESHOLD");yr.set("WEBGL_DELETE_TEXTURE_THRESHOLD",0);const s=this,o=performance.now(),r=s.model.layers[s.model.layers.length-1],i=r.getWeights()[0],a=r.getWeights()[1],l=s.isChannelLast?e.shape.slice(1,-1):e.shape.slice(2);let c=D(Nn(l),-1e4),u=ot(l),h=0;for(console.log(" channel loop");;){Te().startScope();const d=await B(()=>{const f=i.slice([0,0,0,0,h],[-1,-1,-1,-1,1]),m=a.slice([h],[1]),g=ZH(e,f,Math.min(s.chunkSize,s.outChannels)).add(m),x=Zt(g,c),b=It(x,g,c),w=It(x,Ii(u.shape,h),u);return fe([c,u,f,m,g,x]),B(()=>Ae(Nn([1,1]),Nn([1,1]))),[w,b]});console.log("======================="),xe(`Iteration ${h}`,h/s.outChannels);const p=await Wt();if(console.log(`Number of Tensors: ${p.numTensors}`),console.log(`Number of Data Buffers: ${p.numDataBuffers}`),console.log(`Megabytes In Use: ${(p.numBytes/1048576).toFixed(3)} MB`),p.unreliable&&console.log(`Unreliable: ${p.unreliable}`),typeof u<"u"&&u.dispose(),typeof c<"u"&&c.dispose(),u=dn(d[0]),c=dn(d[1]),Te().endScope(),h===s.outChannels-1){fe(c);const m=performance.now()-o;return console.log(`Execution time for output layer: ${m} milliseconds`),yr.set("WEBGL_DELETE_TEXTURE_THRESHOLD",t),u}else{h++;const f=u.shape,m=u.dataSync(),g=u.shape,x=c.dataSync();u.dispose(),c.dispose(),u=ss(m,f),c=ss(x,g)}}}}async function mw(n,e,t,s,o,r,i,a,l,c){if(l.isPostProcessEnable){const d=new GH,p=new Uint32Array(e),f=26,m=!0,g=!0,[x,b]=d.bwlabel(n,p,f,m,g);for(let w=0;w0&&S<=1?h=await fw(s,S):(console.log("No valid crop threshold value"),h=await s.greater([0]).asType("bool"))}else h=await a.greater([0]).asType("bool");console.log(" mask_3d shape : ",h.shape);const d=await Lm(h);h.dispose();const p=d.min(0).arraySync()[0],f=d.max(0).arraySync()[0],m=d.min(0).arraySync()[1],g=d.max(0).arraySync()[1],x=d.min(0).arraySync()[2],b=d.max(0).arraySync()[2];console.log("row min and max :",p,f),console.log("col min and max :",m,g),console.log("depth min and max :",x,b);const w=[p,m,x],y=[f-p+1,g-m+1,b-x+1];d.dispose();const C=await s.slice([p,m,x],[f-p+1,g-m+1,b-x+1]);s.dispose();const I=e.cropPadding;let v=await pw(C,[I,I],[I,I],[I,I]);if(console.log(" cropped slices_3d with padding shape: ",v.shape),C.dispose(),n.drawBoundingVolume){let S=await Rc(v,I,I,I);return console.log(" outLabelVolume without padding shape : ",S.shape),S=await Ac(S,o,r,i,w,y),console.log(" outLabelVolume final shape after resizing : ",S.shape),dw(Gn(S),n,e),S.dispose(),0}l.Brainchop_Ver="FullVolume";const $=await t;try{let S=performance.now();const N=performance.now();let A=0;const _=e.enableTranspose;_?(v=await v.transpose(),console.log("Input transposed for pre-model")):console.log("Transpose not enabled for pre-model");let E=1;const M=$.layers.length;console.log("res.layers.length ",M);const z=Ec($),P=n.batchSize,H=n.numOfChan;let W;z?($.layers[0].batchInputShape[1]=v.shape[0],$.layers[0].batchInputShape[2]=v.shape[1],$.layers[0].batchInputShape[3]=v.shape[2],W=[P,$.layers[0].batchInputShape[1],$.layers[0].batchInputShape[2],$.layers[0].batchInputShape[3],H]):($.layers[0].batchInputShape[2]=v.shape[0],$.layers[0].batchInputShape[3]=v.shape[1],$.layers[0].batchInputShape[4]=v.shape[2],W=[P,H,$.layers[0].batchInputShape[2],$.layers[0].batchInputShape[3],$.layers[0].batchInputShape[4]]),console.log(" Model batch input shape : ",$.layers[0].batchInputShape),l.Input_Shape=JSON.stringify($.layers[0].batchInputShape),l.Output_Shape=JSON.stringify($.output.shape),l.Channel_Last=await z,l.Model_Param=await Ep($),l.Model_Layers=await Rp($),l.Model=e.modelName,l.Seq_Conv=e.enableSeqConv;const q=$.layers[$.layers.length-1];console.log("Output Layer : ",q);const K=z?q.outputShape[q.outputShape.length-1]:q.outputShape[1];console.log("Num of output channels x: ",K);const j=[];for(j[0]=await v.reshape(W);;){try{$.layers[E].activation.getClassName()!=="linear"?j[E]=await $.layers[E].apply(j[E-1]):j[E]=await YH(j[E-1],$.layers[E].getWeights()[0],$.layers[E].getWeights()[1],$.layers[E].strides,$.layers[E].padding,$.layers[E].dilationRate,3),fe(j[E-1])}catch(Y){const X="Your graphics card (e.g. Intel) may not be compatible with WebGL. "+Y.message;return xe(X,-1,X),Te().endScope(),Te().disposeVariables(),l.Inference_t=1/0,l.Postprocess_t=1/0,l.Status="Fail",l.Error_Type=Y.message,l.Extra_Err_Info="Failed while model layer "+E+" apply",xe("",-1,"",l),0}if(console.log("layer output Tensor shape : ",j[E].shape),console.log("layer count params ",$.layers[E].countParams()),$.layers[E].dispose(),j[E-1].dispose(),xe("Layer "+E.toString(),(E+1)/M),Wt().unreliable){const Y="unreliable reasons :"+Wt().reasons;xe(Y,NaN,Y)}if(E===M-2){const Y=await new QH($,10,z);let X=null;const ee=await fC(async()=>{X=await Y.apply(j[E])});if(console.log("profileInfo : ",ee),fe(j[E]),console.log(" Output tensor",X),console.log(" Output tensor shape : ",X.shape),X.shape.length!==3){const ge="Output tensor shape should be 3 dims but it is "+X.shape.length;xe(ge,-1,ge)}const Q=((performance.now()-S)/1e3).toFixed(4);console.log(" find array max ");const ne=await X.max().dataSync()[0];Ahere'),Wt().unreliable){const N="unreliable reasons :"+Wt().reasons;xe(N,NaN,N)}}}async function xw(n,e,t,s,o,r,i,a,l,c){let u=[];console.log(" ---- Start FullVolume inference phase-II ---- "),i.enableQuantileNorm?(console.log("preModel Quantile normalization enabled"),e=await Ap(e)):(console.log("preModel Min Max normalization enabled"),e=await Dp(e));let d;if(r==null){const E=i.autoThreshold;E>0&&E<=1?d=await fw(e,E):(console.log("No valid crop threshold value"),d=await e.greater([0]).asType("bool"))}else d=await r.greater([0]).asType("bool");console.log(" mask_3d shape : ",d.shape);const p=await Lm(d);d.dispose();const f=p.arraySync();let m=s,g=0,x=o,b=0,w=t,y=0;for(let E=0;Ef[E][0]?m=f[E][0]:gf[E][1]?x=f[E][1]:bf[E][2]?w=f[E][2]:yhere')}}async function JH(n,e,t,s,o,r,i,a,l,c,u){if(a.No_SubVolumes=1,i.preModelId){const h=await lw(l.rootURL+Tp[i.preModelId-1].path),d=Tp[i.preModelId-1].enableTranspose,p=Tp[i.preModelId-1].enableQuantileNorm;let f=null;p?(console.log("preModel Quantile normalization enabled"),f=await Ap(e)):(console.log("preModel Min Max normalization enabled"),f=await Dp(e)),d?(f=f.transpose(),console.log("Input transposed for pre-model")):console.log("Transpose not enabled for pre-model"),a.Brainchop_Ver="PreModel_FV";const m=await h;try{const g=performance.now(),x=m,b=x.layers[0].batchInputShape;if(console.log(" Pre-Model batch input shape : ",b),b.length!==5){const M="The pre-model input shape must be 5D ";return xe(M,-1,M),0}const w=await Ec(x),y=l.batchSize,C=l.numOfChan;let I,v,$,S;if(w){if(console.log("Pre-Model Channel Last"),isNaN(b[4])||b[4]!==1){const M="The number of channels for pre-model input shape must be 1";return xe(M,-1,M),0}I=b[1],v=b[2],$=b[3],S=[y,I,v,$,C]}else{if(console.log("Pre-Model Channel First"),isNaN(b[1])||b[1]!==1){const M="The number of channels for pre-model input shape must be 1";return xe(M,-1,M),0}I=b[2],v=b[3],$=b[4],S=[y,C,I,v,$]}a.Input_Shape=JSON.stringify(S),a.Output_Shape=JSON.stringify(x.output.shape),a.Channel_Last=await w,a.Model_Param=await Ep(x),a.Model_Layers=await Rp(x);let N=0,A=1;const _=m.layers.length,E=[];for(E[0]=f.reshape(S),fe(f);;){try{E[A]=m.layers[A].apply(E[A-1])}catch(M){const z="Your graphics card (e.g. Intel) may not be compatible with WebGL. "+M.message;return xe(z,-1,z),Te().endScope(),Te().disposeVariables(),a.Inference_t=1/0,a.Postprocess_t=1/0,a.Status="Fail",a.Error_Type=M.message,a.Extra_Err_Info="PreModel Failed while model layer "+A+" apply",xe("",-1,"",a),0}if(m.layers[A].dispose(),E[A-1].dispose(),xe("Layer "+A.toString(),(A+1)/_),Wt().unreliable){const M="unreliable reasons :"+Wt().reasons;xe(M,NaN,M)}if(A===_-1){const M=w?-1:1;console.log(" find argmax "),console.log("last Tensor shape : ",E[A].shape);const z=w?E[A].shape[4]:E[A].shape[1];let P;try{console.log(" Try tf.argMax for fullVolume .."),P=await no(E[A],M)}catch(ee){if(M===-1)try{const Q=performance.now();console.log(" tf.argMax failed .. try argMaxLarge ..");const ne=uw(E[A].reshape([t,s,o,z]),"float16");P=hw(ne,t,s,o,z,"float16"),console.log("argMaxLarge for fullVolume takes : ",((performance.now()-Q)/1e3).toFixed(4))}catch(Q){const ne="argMax buffer couldn't be created due to limited memory resources.";return xe(ne,-1,ne),P.dispose(),Te().endScope(),Te().disposeVariables(),a.Inference_t=1/0,a.Postprocess_t=1/0,a.Status="Fail",a.Error_Type=Q.message,a.Extra_Err_Info="preModel prediction_argmax from argMaxLarge failed",xe("",-1,"",a),0}else{const Q="argMax buffer couldn't be created due to limited memory resources.";return xe(Q,-1,Q),P.dispose(),Te().endScope(),Te().disposeVariables(),a.Inference_t=1/0,a.Postprocess_t=1/0,a.Status="Fail",a.Error_Type=ee.message,a.Extra_Err_Info="preModel prediction_argmax from argMaxLarge not support yet channel first",xe("",-1,"",a),0}}console.log(" Pre-model prediction_argmax shape : ",P.shape);const H=((performance.now()-g)/1e3).toFixed(4);fe(E[A]),console.log(" Pre-model find array max ");const W=await P.max().dataSync()[0];Nhere')}}else console.log("--- No pre-model is selected ---"),console.log("------ Run voxel cropping ------"),r?i.enableSeqConv?(console.log("------ Seq Convoluton ------"),await gw(l,i,n,e,t,s,o,null,a,u)):xw(n,e,t,s,o,null,i,a,l,u):cw(n,e,t,s,o,null)}async function eq(n=!0){mC("webgl"),await pC(),V().set("DEBUG",!1),V().set("WEBGL_FORCE_F16_TEXTURES",n),V().set("WEBGL_DELETE_TEXTURE_THRESHOLD",0),await gC(),console.log("tf env() flags :",V().flags),console.log("tf env() features :",V().features),console.log("tf env total features: ",Object.keys(V().features).length),console.log("tf backend: ",jf())}async function tq(n,e,t,s){const o=[];o.startTime=Date.now(),xe("Segmentation started",0);const r=n.batchSize,i=n.numOfChan;if(isNaN(r)||r!==1){const C="The batch Size for input shape must be 1";return xe(C,-1,C),0}if(isNaN(i)||i!==1){const C="The number of channels for input shape must be 1";return xe(C,-1,C),0}Te().startScope(),console.log("Batch size: ",r),console.log("Num of Channels: ",i);const a=await lw(n.rootURL+e.path);await eq(!0),o.TF_Backend=jf();const l=a;let c=[];if(c=l.layers[0].batchInputShape,console.log(" Model batch input shape : ",c),c.length!==5){const C="The model input shape must be 5D";return xe(C,-1,C),0}let u,h,d;const p=t.dims[1],f=t.dims[2],m=t.dims[3];if(await Ec(l)){if(console.log("Model Channel Last"),isNaN(c[4])||c[4]!==1){const C="The number of channels for input shape must be 1";return xe(C,-1,C),0}u=c[1],h=c[2],d=c[3]}else{if(console.log("Model Channel First"),isNaN(c[1])||c[1]!==1){const C="The number of channels for input shape must be 1";return xe(C,-1,C),0}u=c[2],h=c[3],d=c[4]}let x;u===256&&h===256&&d===256?x=!0:x=!1,o.isModelFullVol=x;let b=await HH(m,t,s);const w=e.enableTranspose,y=e.enableCrop;x&&(y?await JH(a,b,m,f,p,x,e,o,n,t,s):(console.log("Cropping Disabled"),w?(b=b.transpose(),console.log("Input transposed")):console.log("Transpose NOT Enabled"),e.enableSeqConv?(console.log("Seq Convoluton Enabled"),await jH()):(console.log("Seq Convoluton Disabled"),await KH())))}self.addEventListener("message",function(n){tq(n.data.opts,n.data.modelEntry,n.data.niftiHeader,n.data.niftiImage)},!1)})(); diff --git a/assets/index-D4okLGuZ.js b/assets/index-l4BLiQ-A.js similarity index 96% rename from assets/index-D4okLGuZ.js rename to assets/index-l4BLiQ-A.js index 9f4cf03..59193e5 100644 --- a/assets/index-D4okLGuZ.js +++ b/assets/index-l4BLiQ-A.js @@ -1,4 +1,4 @@ -var tA=Object.defineProperty;var iA=(a,n,s)=>n in a?tA(a,n,{enumerable:!0,configurable:!0,writable:!0,value:s}):a[n]=s;var ct=(a,n,s)=>(iA(a,typeof n!="symbol"?n+"":n,s),s);function _mergeNamespaces(a,n){for(var s=0;su[f]})}}}return Object.freeze(Object.defineProperty(a,Symbol.toStringTag,{value:"Module"}))}(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const f of document.querySelectorAll('link[rel="modulepreload"]'))u(f);new MutationObserver(f=>{for(const m of f)if(m.type==="childList")for(const A of m.addedNodes)A.tagName==="LINK"&&A.rel==="modulepreload"&&u(A)}).observe(document,{childList:!0,subtree:!0});function s(f){const m={};return f.integrity&&(m.integrity=f.integrity),f.referrerPolicy&&(m.referrerPolicy=f.referrerPolicy),f.crossOrigin==="use-credentials"?m.credentials="include":f.crossOrigin==="anonymous"?m.credentials="omit":m.credentials="same-origin",m}function u(f){if(f.ep)return;f.ep=!0;const m=s(f);fetch(f.href,m)}})();var EPSILON=1e-6,ARRAY_TYPE=typeof Float32Array<"u"?Float32Array:Array;Math.hypot||(Math.hypot=function(){for(var a=0,n=arguments.length;n--;)a+=arguments[n]*arguments[n];return Math.sqrt(a)});function create$4(){var a=new ARRAY_TYPE(9);return ARRAY_TYPE!=Float32Array&&(a[1]=0,a[2]=0,a[3]=0,a[5]=0,a[6]=0,a[7]=0),a[0]=1,a[4]=1,a[8]=1,a}function fromValues$4(a,n,s,u,f,m,A,v,y){var T=new ARRAY_TYPE(9);return T[0]=a,T[1]=n,T[2]=s,T[3]=u,T[4]=f,T[5]=m,T[6]=A,T[7]=v,T[8]=y,T}function multiply$3(a,n,s){var u=n[0],f=n[1],m=n[2],A=n[3],v=n[4],y=n[5],T=n[6],E=n[7],S=n[8],I=s[0],e=s[1],F=s[2],M=s[3],L=s[4],V=s[5],B=s[6],z=s[7],b=s[8];return a[0]=I*u+e*A+F*T,a[1]=I*f+e*v+F*E,a[2]=I*m+e*y+F*S,a[3]=M*u+L*A+V*T,a[4]=M*f+L*v+V*E,a[5]=M*m+L*y+V*S,a[6]=B*u+z*A+b*T,a[7]=B*f+z*v+b*E,a[8]=B*m+z*y+b*S,a}function create$3(){var a=new ARRAY_TYPE(16);return ARRAY_TYPE!=Float32Array&&(a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[11]=0,a[12]=0,a[13]=0,a[14]=0),a[0]=1,a[5]=1,a[10]=1,a[15]=1,a}function clone$3(a){var n=new ARRAY_TYPE(16);return n[0]=a[0],n[1]=a[1],n[2]=a[2],n[3]=a[3],n[4]=a[4],n[5]=a[5],n[6]=a[6],n[7]=a[7],n[8]=a[8],n[9]=a[9],n[10]=a[10],n[11]=a[11],n[12]=a[12],n[13]=a[13],n[14]=a[14],n[15]=a[15],n}function copy$1(a,n){return a[0]=n[0],a[1]=n[1],a[2]=n[2],a[3]=n[3],a[4]=n[4],a[5]=n[5],a[6]=n[6],a[7]=n[7],a[8]=n[8],a[9]=n[9],a[10]=n[10],a[11]=n[11],a[12]=n[12],a[13]=n[13],a[14]=n[14],a[15]=n[15],a}function fromValues$3(a,n,s,u,f,m,A,v,y,T,E,S,I,e,F,M){var L=new ARRAY_TYPE(16);return L[0]=a,L[1]=n,L[2]=s,L[3]=u,L[4]=f,L[5]=m,L[6]=A,L[7]=v,L[8]=y,L[9]=T,L[10]=E,L[11]=S,L[12]=I,L[13]=e,L[14]=F,L[15]=M,L}function identity$2(a){return a[0]=1,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=1,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=1,a[11]=0,a[12]=0,a[13]=0,a[14]=0,a[15]=1,a}function transpose$3(a,n){if(a===n){var s=n[1],u=n[2],f=n[3],m=n[6],A=n[7],v=n[11];a[1]=n[4],a[2]=n[8],a[3]=n[12],a[4]=s,a[6]=n[9],a[7]=n[13],a[8]=u,a[9]=m,a[11]=n[14],a[12]=f,a[13]=A,a[14]=v}else a[0]=n[0],a[1]=n[4],a[2]=n[8],a[3]=n[12],a[4]=n[1],a[5]=n[5],a[6]=n[9],a[7]=n[13],a[8]=n[2],a[9]=n[6],a[10]=n[10],a[11]=n[14],a[12]=n[3],a[13]=n[7],a[14]=n[11],a[15]=n[15];return a}function invert(a,n){var s=n[0],u=n[1],f=n[2],m=n[3],A=n[4],v=n[5],y=n[6],T=n[7],E=n[8],S=n[9],I=n[10],e=n[11],F=n[12],M=n[13],L=n[14],V=n[15],B=s*v-u*A,z=s*y-f*A,b=s*T-m*A,W=u*y-f*v,q=u*T-m*v,Y=f*T-m*y,X=E*M-S*F,H=E*L-I*F,g=E*V-e*F,J=S*L-I*M,re=S*V-e*M,ae=I*V-e*L,fe=B*ae-z*re+b*J+W*g-q*H+Y*X;return fe?(fe=1/fe,a[0]=(v*ae-y*re+T*J)*fe,a[1]=(f*re-u*ae-m*J)*fe,a[2]=(M*Y-L*q+V*W)*fe,a[3]=(I*q-S*Y-e*W)*fe,a[4]=(y*g-A*ae-T*H)*fe,a[5]=(s*ae-f*g+m*H)*fe,a[6]=(L*b-F*Y-V*z)*fe,a[7]=(E*Y-I*b+e*z)*fe,a[8]=(A*re-v*g+T*X)*fe,a[9]=(u*g-s*re-m*X)*fe,a[10]=(F*q-M*b+V*B)*fe,a[11]=(S*b-E*q-e*B)*fe,a[12]=(v*H-A*J-y*X)*fe,a[13]=(s*J-u*H+f*X)*fe,a[14]=(M*z-F*W-L*B)*fe,a[15]=(E*W-S*z+I*B)*fe,a):null}function multiply$2(a,n,s){var u=n[0],f=n[1],m=n[2],A=n[3],v=n[4],y=n[5],T=n[6],E=n[7],S=n[8],I=n[9],e=n[10],F=n[11],M=n[12],L=n[13],V=n[14],B=n[15],z=s[0],b=s[1],W=s[2],q=s[3];return a[0]=z*u+b*v+W*S+q*M,a[1]=z*f+b*y+W*I+q*L,a[2]=z*m+b*T+W*e+q*V,a[3]=z*A+b*E+W*F+q*B,z=s[4],b=s[5],W=s[6],q=s[7],a[4]=z*u+b*v+W*S+q*M,a[5]=z*f+b*y+W*I+q*L,a[6]=z*m+b*T+W*e+q*V,a[7]=z*A+b*E+W*F+q*B,z=s[8],b=s[9],W=s[10],q=s[11],a[8]=z*u+b*v+W*S+q*M,a[9]=z*f+b*y+W*I+q*L,a[10]=z*m+b*T+W*e+q*V,a[11]=z*A+b*E+W*F+q*B,z=s[12],b=s[13],W=s[14],q=s[15],a[12]=z*u+b*v+W*S+q*M,a[13]=z*f+b*y+W*I+q*L,a[14]=z*m+b*T+W*e+q*V,a[15]=z*A+b*E+W*F+q*B,a}function translate(a,n,s){var u=s[0],f=s[1],m=s[2],A,v,y,T,E,S,I,e,F,M,L,V;return n===a?(a[12]=n[0]*u+n[4]*f+n[8]*m+n[12],a[13]=n[1]*u+n[5]*f+n[9]*m+n[13],a[14]=n[2]*u+n[6]*f+n[10]*m+n[14],a[15]=n[3]*u+n[7]*f+n[11]*m+n[15]):(A=n[0],v=n[1],y=n[2],T=n[3],E=n[4],S=n[5],I=n[6],e=n[7],F=n[8],M=n[9],L=n[10],V=n[11],a[0]=A,a[1]=v,a[2]=y,a[3]=T,a[4]=E,a[5]=S,a[6]=I,a[7]=e,a[8]=F,a[9]=M,a[10]=L,a[11]=V,a[12]=A*u+E*f+F*m+n[12],a[13]=v*u+S*f+M*m+n[13],a[14]=y*u+I*f+L*m+n[14],a[15]=T*u+e*f+V*m+n[15]),a}function scale$4(a,n,s){var u=s[0],f=s[1],m=s[2];return a[0]=n[0]*u,a[1]=n[1]*u,a[2]=n[2]*u,a[3]=n[3]*u,a[4]=n[4]*f,a[5]=n[5]*f,a[6]=n[6]*f,a[7]=n[7]*f,a[8]=n[8]*m,a[9]=n[9]*m,a[10]=n[10]*m,a[11]=n[11]*m,a[12]=n[12],a[13]=n[13],a[14]=n[14],a[15]=n[15],a}function rotateX(a,n,s){var u=Math.sin(s),f=Math.cos(s),m=n[4],A=n[5],v=n[6],y=n[7],T=n[8],E=n[9],S=n[10],I=n[11];return n!==a&&(a[0]=n[0],a[1]=n[1],a[2]=n[2],a[3]=n[3],a[12]=n[12],a[13]=n[13],a[14]=n[14],a[15]=n[15]),a[4]=m*f+T*u,a[5]=A*f+E*u,a[6]=v*f+S*u,a[7]=y*f+I*u,a[8]=T*f-m*u,a[9]=E*f-A*u,a[10]=S*f-v*u,a[11]=I*f-y*u,a}function rotateZ(a,n,s){var u=Math.sin(s),f=Math.cos(s),m=n[0],A=n[1],v=n[2],y=n[3],T=n[4],E=n[5],S=n[6],I=n[7];return n!==a&&(a[8]=n[8],a[9]=n[9],a[10]=n[10],a[11]=n[11],a[12]=n[12],a[13]=n[13],a[14]=n[14],a[15]=n[15]),a[0]=m*f+T*u,a[1]=A*f+E*u,a[2]=v*f+S*u,a[3]=y*f+I*u,a[4]=T*f-m*u,a[5]=E*f-A*u,a[6]=S*f-v*u,a[7]=I*f-y*u,a}function fromRotation(a,n,s){var u=s[0],f=s[1],m=s[2],A=Math.hypot(u,f,m),v,y,T;return A0&&(m=1/Math.sqrt(m)),a[0]=n[0]*m,a[1]=n[1]*m,a[2]=n[2]*m,a}function dot$2(a,n){return a[0]*n[0]+a[1]*n[1]+a[2]*n[2]}function cross(a,n,s){var u=n[0],f=n[1],m=n[2],A=s[0],v=s[1],y=s[2];return a[0]=f*y-m*v,a[1]=m*A-u*y,a[2]=u*v-f*A,a}function lerp(a,n,s,u){var f=n[0],m=n[1],A=n[2];return a[0]=f+u*(s[0]-f),a[1]=m+u*(s[1]-m),a[2]=A+u*(s[2]-A),a}function angle(a,n){var s=a[0],u=a[1],f=a[2],m=n[0],A=n[1],v=n[2],y=Math.sqrt(s*s+u*u+f*f),T=Math.sqrt(m*m+A*A+v*v),E=y*T,S=E&&dot$2(a,n)/E;return Math.acos(Math.min(Math.max(S,-1),1))}var sub$4=subtract$1,len=length$1;(function(){var a=create$2();return function(n,s,u,f,m,A){var v,y;for(s||(s=3),u||(u=0),f?y=Math.min(f*s+u,n.length):y=n.length,v=u;v0&&(f=1/Math.sqrt(f)),a[0]=n[0]*f,a[1]=n[1]*f,a}(function(){var a=create();return function(n,s,u,f,m,A){var v,y;for(s||(s=2),u||(u=0),f?y=Math.min(f*s+u,n.length):y=n.length,v=u;v256){for(BUFFER=Array(a=256);a--;)BUFFER[a]=256*Math.random()|0;a=IDX=0}for(;a<16;a++)n=BUFFER[IDX+a],a==6?s+=HEX[n&15|64]:a==8?s+=HEX[n&63|128]:s+=HEX[n],a&1&&a>1&&a<11&&(s+="-");return IDX++,s}var u8$1=Uint8Array,u16$1=Uint16Array,i32$1=Int32Array,fleb$1=new u8$1([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),fdeb$1=new u8$1([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),clim$1=new u8$1([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),freb$1=function(a,n){for(var s=new u16$1(31),u=0;u<31;++u)s[u]=n+=1<>1|(i$1&21845)<<1;x$1=(x$1&52428)>>2|(x$1&13107)<<2,x$1=(x$1&61680)>>4|(x$1&3855)<<4,rev$1[i$1]=((x$1&65280)>>8|(x$1&255)<<8)>>1}var hMap$1=function(a,n,s){for(var u=a.length,f=0,m=new u16$1(n);f>y]=T}else for(v=new u16$1(u),f=0;f>15-a[f]);return v},flt$1=new u8$1(288);for(var i$1=0;i$1<144;++i$1)flt$1[i$1]=8;for(var i$1=144;i$1<256;++i$1)flt$1[i$1]=9;for(var i$1=256;i$1<280;++i$1)flt$1[i$1]=7;for(var i$1=280;i$1<288;++i$1)flt$1[i$1]=8;var fdt$1=new u8$1(32);for(var i$1=0;i$1<32;++i$1)fdt$1[i$1]=5;var flm$1=hMap$1(flt$1,9,0),flrm$1=hMap$1(flt$1,9,1),fdm$1=hMap$1(fdt$1,5,0),fdrm$1=hMap$1(fdt$1,5,1),max$5=function(a){for(var n=a[0],s=1;sn&&(n=a[s]);return n},bits$1=function(a,n,s){var u=n/8|0;return(a[u]|a[u+1]<<8)>>(n&7)&s},bits16$1=function(a,n){var s=n/8|0;return(a[s]|a[s+1]<<8|a[s+2]<<16)>>(n&7)},shft$1=function(a){return(a+7)/8|0},slc$1=function(a,n,s){return(n==null||n<0)&&(n=0),(s==null||s>a.length)&&(s=a.length),new u8$1(a.subarray(n,s))},ec$1=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],err$1=function(a,n,s){var u=new Error(n||ec$1[a]);if(u.code=a,Error.captureStackTrace&&Error.captureStackTrace(u,err$1),!s)throw u;return u},inflt$1=function(a,n,s,u){var f=a.length,m=u?u.length:0;if(!f||n.f&&!n.l)return s||new u8$1(0);var A=!s,v=A||n.i!=2,y=n.i;A&&(s=new u8$1(f*3));var T=function(Et){var Rt=s.length;if(Et>Rt){var Ze=new u8$1(Math.max(Rt*2,Et));Ze.set(s),s=Ze}},E=n.f||0,S=n.p||0,I=n.b||0,e=n.l,F=n.d,M=n.m,L=n.n,V=f*8;do{if(!e){E=bits$1(a,S,1);var B=bits$1(a,S+1,3);if(S+=3,B)if(B==1)e=flrm$1,F=fdrm$1,M=9,L=5;else if(B==2){var q=bits$1(a,S,31)+257,Y=bits$1(a,S+10,15)+4,X=q+bits$1(a,S+5,31)+1;S+=14;for(var H=new u8$1(X),g=new u8$1(19),J=0;J>4;if(z<16)H[J++]=z;else{var me=0,Se=0;for(z==16?(Se=3+bits$1(a,S,3),S+=2,me=H[J-1]):z==17?(Se=3+bits$1(a,S,7),S+=3):z==18&&(Se=11+bits$1(a,S,127),S+=7);Se--;)H[J++]=me}}var ve=H.subarray(0,q),we=H.subarray(q);M=max$5(ve),L=max$5(we),e=hMap$1(ve,M,1),F=hMap$1(we,L,1)}else err$1(1);else{var z=shft$1(S)+4,b=a[z-4]|a[z-3]<<8,W=z+b;if(W>f){y&&err$1(0);break}v&&T(I+b),s.set(a.subarray(z,W),I),n.b=I+=b,n.p=S=W*8,n.f=E;continue}if(S>V){y&&err$1(0);break}}v&&T(I+131072);for(var Ne=(1<>4;if(S+=me&15,S>V){y&&err$1(0);break}if(me||err$1(2),nt<256)s[I++]=nt;else if(nt==256){je=S,e=null;break}else{var Ue=nt-254;if(nt>264){var J=nt-257,ye=fleb$1[J];Ue=bits$1(a,S,(1<>4;ut||err$1(3),S+=ut&15;var we=fd$1[pt];if(pt>3){var ye=fdeb$1[pt];we+=bits16$1(a,S)&(1<V){y&&err$1(0);break}v&&T(I+131072);var It=I+Ue;if(I>8},wbits16$1=function(a,n,s){s<<=n&7;var u=n/8|0;a[u]|=s,a[u+1]|=s>>8,a[u+2]|=s>>16},hTree$1=function(a,n){for(var s=[],u=0;uI&&(I=m[u].s);var e=new u16$1(I+1),F=ln$1(s[E-1],e,0);if(F>n){var u=0,M=0,L=F-n,V=1<n)M+=V-(1<>=L;M>0;){var z=m[u].s;e[z]=0&&M;--u){var b=m[u].s;e[b]==n&&(--e[b],++M)}F=n}return{t:new u8$1(e),l:F}},ln$1=function(a,n,s){return a.s==-1?Math.max(ln$1(a.l,n,s+1),ln$1(a.r,n,s+1)):n[a.s]=s},lc$1=function(a){for(var n=a.length;n&&!a[--n];);for(var s=new u16$1(++n),u=0,f=a[0],m=1,A=function(y){s[u++]=y},v=1;v<=n;++v)if(a[v]==f&&v!=n)++m;else{if(!f&&m>2){for(;m>138;m-=138)A(32754);m>2&&(A(m>10?m-11<<5|28690:m-3<<5|12305),m=0)}else if(m>3){for(A(f),--m;m>6;m-=6)A(8304);m>2&&(A(m-3<<5|8208),m=0)}for(;m--;)A(f);m=1,f=a[v]}return{c:s.subarray(0,u),n}},clen$1=function(a,n){for(var s=0,u=0;u>8,a[f+2]=a[f]^255,a[f+3]=a[f+1]^255;for(var m=0;m4&&!g[clim$1[re-1]];--re);var ae=T+5<<3,fe=clen$1(f,flt$1)+clen$1(m,fdt$1)+A,pe=clen$1(f,I)+clen$1(m,M)+A+14+3*re+clen$1(Y,g)+2*Y[16]+3*Y[17]+7*Y[18];if(y>=0&&ae<=fe&&ae<=pe)return wfblk$1(n,E,a.subarray(y,y+T));var me,Se,ve,we;if(wbits$1(n,E,1+(pe15&&(wbits$1(n,E,nt[X]>>5&127),E+=nt[X]>>12)}}else me=flm$1,Se=flt$1,ve=fdm$1,we=fdt$1;for(var X=0;X255){var Ue=ye>>18&31;wbits16$1(n,E,me[Ue+257]),E+=Se[Ue+257],Ue>7&&(wbits$1(n,E,ye>>23&31),E+=fleb$1[Ue]);var ut=ye&31;wbits16$1(n,E,ve[ut]),E+=we[ut],ut>3&&(wbits16$1(n,E,ye>>5&8191),E+=fdeb$1[ut])}else wbits16$1(n,E,me[ye]),E+=Se[ye]}return wbits16$1(n,E,me[256]),E+Se[256]},deo$1=new i32$1([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),et$1=new u8$1(0),dflt$1=function(a,n,s,u,f,m){var A=m.z||a.length,v=new u8$1(u+A+5*(1+Math.ceil(A/7e3))+f),y=v.subarray(u,v.length-f),T=m.l,E=(m.r||0)&7;if(n){E&&(y[0]=m.r>>3);for(var S=deo$1[n-1],I=S>>13,e=S&8191,F=(1<7e3||g>24576)&&(me>423||!T)){E=wblk$1(a,y,0,b,W,q,X,g,re,H-re,E),g=Y=X=0,re=H;for(var Se=0;Se<286;++Se)W[Se]=0;for(var Se=0;Se<30;++Se)q[Se]=0}var ve=2,we=0,Ne=e,De=fe-pe&32767;if(me>2&&ae==z(H-De))for(var je=Math.min(I,me)-1,nt=Math.min(32767,H),Ue=Math.min(258,me);De<=nt&&--Ne&&fe!=pe;){if(a[H+ve]==a[H+ve-De]){for(var ye=0;yeve){if(ve=ye,we=De,ye>je)break;for(var ut=Math.min(De,ye-2),pt=0,Se=0;Sept&&(pt=Ot,pe=It)}}}fe=pe,pe=M[fe],De+=fe-pe&32767}if(we){b[g++]=268435456|revfl$1[ve]<<18|revfd$1[we];var Et=revfl$1[ve]&31,Rt=revfd$1[we]&31;X+=fleb$1[Et]+fdeb$1[Rt],++W[257+Et],++q[Rt],J=H+ve,++Y}else b[g++]=a[H],++W[a[H]]}}for(H=Math.max(H,J);H=A&&(y[E/8|0]=T,Ze=A),E=wfblk$1(y,E+1,a.subarray(H,Ze))}m.i=A}return slc$1(v,0,u+shft$1(E)+f)},crct$1=function(){for(var a=new Int32Array(256),n=0;n<256;++n){for(var s=n,u=9;--u;)s=(s&1&&-306674912)^s>>>1;a[n]=s}return a}(),crc$1=function(){var a=-1;return{p:function(n){for(var s=a,u=0;u>>8;a=s},d:function(){return~a}}},dopt$1=function(a,n,s,u,f){if(!f&&(f={l:1},n.dictionary)){var m=n.dictionary.subarray(-32768),A=new u8$1(m.length+a.length);A.set(m),A.set(a,m.length),a=A,f.w=m.length}return dflt$1(a,n.level==null?6:n.level,n.mem==null?f.l?Math.ceil(Math.max(8,Math.min(13,Math.log(a.length)))*1.5):20:12+n.mem,s,u,f)},b2$1=function(a,n){return a[n]|a[n+1]<<8},b4$1=function(a,n){return(a[n]|a[n+1]<<8|a[n+2]<<16|a[n+3]<<24)>>>0},b8$1=function(a,n){return b4$1(a,n)+b4$1(a,n+4)*4294967296},wbytes$1=function(a,n,s){for(;s;++n)a[n]=s,s>>>=8},gzh$1=function(a,n){var s=n.filename;if(a[0]=31,a[1]=139,a[2]=8,a[8]=n.level<2?4:n.level==9?2:0,a[9]=3,n.mtime!=0&&wbytes$1(a,4,Math.floor(new Date(n.mtime||Date.now())/1e3)),s){a[3]=8;for(var u=0;u<=s.length;++u)a[u+10]=s.charCodeAt(u)}},gzs$1=function(a){(a[0]!=31||a[1]!=139||a[2]!=8)&&err$1(6,"invalid gzip data");var n=a[3],s=10;n&4&&(s+=(a[10]|a[11]<<8)+2);for(var u=(n>>3&1)+(n>>4&1);u>0;u-=!a[s++]);return s+(n&2)},gzl$1=function(a){var n=a.length;return(a[n-4]|a[n-3]<<8|a[n-2]<<16|a[n-1]<<24)>>>0},gzhl$1=function(a){return 10+(a.filename?a.filename.length+1:0)},zls$1=function(a,n){return((a[0]&15)!=8||a[0]>>4>7||(a[0]<<8|a[1])%31)&&err$1(6,"invalid zlib data"),(a[1]>>5&1)==+!n&&err$1(6,"invalid zlib data: "+(a[1]&32?"need":"unexpected")+" dictionary"),(a[1]>>3&4)+2};function StrmOpt$1(a,n){return typeof a=="function"&&(n=a,a={}),this.ondata=n,a}var Inflate$1=function(){function a(n,s){typeof n=="function"&&(s=n,n={}),this.ondata=s;var u=n&&n.dictionary&&n.dictionary.subarray(-32768);this.s={i:0,b:u?u.length:0},this.o=new u8$1(32768),this.p=new u8$1(0),u&&this.o.set(u)}return a.prototype.e=function(n){if(this.ondata||err$1(5),this.d&&err$1(4),!this.p.length)this.p=n;else if(n.length){var s=new u8$1(this.p.length+n.length);s.set(this.p),s.set(n,this.p.length),this.p=s}},a.prototype.c=function(n){this.s.i=+(this.d=n||!1);var s=this.s.b,u=inflt$1(this.p,this.s,this.o);this.ondata(slc$1(u,s,this.s.b),this.d),this.o=slc$1(u,this.s.b-32768),this.s.b=this.o.length,this.p=slc$1(this.p,this.s.p/8|0),this.s.p&=7},a.prototype.push=function(n,s){this.e(n),this.c(s)},a}();function inflateSync$1(a,n){return inflt$1(a,{i:2},n&&n.out,n&&n.dictionary)}function gzipSync$1(a,n){n||(n={});var s=crc$1(),u=a.length;s.p(a);var f=dopt$1(a,n,gzhl$1(n),8),m=f.length;return gzh$1(f,n),wbytes$1(f,m-8,s.d()),wbytes$1(f,m-4,u),f}var Gunzip$1=function(){function a(n,s){this.v=1,this.r=0,Inflate$1.call(this,n,s)}return a.prototype.push=function(n,s){if(Inflate$1.prototype.e.call(this,n),this.r+=n.length,this.v){var u=this.p.subarray(this.v-1),f=u.length>3?gzs$1(u):4;if(f>u.length){if(!s)return}else this.v>1&&this.onmember&&this.onmember(this.r-u.length);this.p=u.subarray(f),this.v=0}Inflate$1.prototype.c.call(this,s),this.s.f&&!this.s.l&&!s&&(this.v=shft$1(this.s.p)+9,this.s={i:0},this.o=new u8$1(0),this.push(new u8$1(0),s))},a}();function gunzipSync$1(a,n){var s=gzs$1(a);return s+8>a.length&&err$1(6,"invalid gzip data"),inflt$1(a.subarray(s,-8),{i:2},n&&n.out||new u8$1(gzl$1(a)),n&&n.dictionary)}var Unzlib$1=function(){function a(n,s){Inflate$1.call(this,n,s),this.v=n&&n.dictionary?2:1}return a.prototype.push=function(n,s){if(Inflate$1.prototype.e.call(this,n),this.v){if(this.p.length<6&&!s)return;this.p=this.p.subarray(zls$1(this.p,this.v-1)),this.v=0}s&&(this.p.length<4&&err$1(6,"invalid zlib data"),this.p=this.p.subarray(0,-4)),Inflate$1.prototype.c.call(this,s)},a}();function unzlibSync$1(a,n){return inflt$1(a.subarray(zls$1(a,n&&n.dictionary),-4),{i:2},n&&n.out,n&&n.dictionary)}var Decompress$1=function(){function a(n,s){this.o=StrmOpt$1.call(this,n,s)||{},this.G=Gunzip$1,this.I=Inflate$1,this.Z=Unzlib$1}return a.prototype.i=function(){var n=this;this.s.ondata=function(s,u){n.ondata(s,u)}},a.prototype.push=function(n,s){if(this.ondata||err$1(5),this.s)this.s.push(n,s);else{if(this.p&&this.p.length){var u=new u8$1(this.p.length+n.length);u.set(this.p),u.set(n,this.p.length)}else this.p=n;this.p.length>2&&(this.s=this.p[0]==31&&this.p[1]==139&&this.p[2]==8?new this.G(this.o):(this.p[0]&15)!=8||this.p[0]>>4>7||(this.p[0]<<8|this.p[1])%31?new this.I(this.o):new this.Z(this.o),this.i(),this.s.push(this.p,s),this.p=null)}},a}();function decompressSync$1(a,n){return a[0]==31&&a[1]==139&&a[2]==8?gunzipSync$1(a,n):(a[0]&15)!=8||a[0]>>4>7||(a[0]<<8|a[1])%31?inflateSync$1(a,n):unzlibSync$1(a,n)}var te$1=typeof TextEncoder<"u"&&new TextEncoder,td$1=typeof TextDecoder<"u"&&new TextDecoder,tds$1=0;try{td$1.decode(et$1,{stream:!0}),tds$1=1}catch{}var dutf8$1=function(a){for(var n="",s=0;;){var u=a[s++],f=(u>127)+(u>223)+(u>239);if(s+f>a.length)return{s:n,r:slc$1(a,s-1)};f?f==3?(u=((u&15)<<18|(a[s++]&63)<<12|(a[s++]&63)<<6|a[s++]&63)-65536,n+=String.fromCharCode(55296|u>>10,56320|u&1023)):f&1?n+=String.fromCharCode((u&31)<<6|a[s++]&63):n+=String.fromCharCode((u&15)<<12|(a[s++]&63)<<6|a[s++]&63):n+=String.fromCharCode(u)}};function strToU8$1(a,n){if(n){for(var s=new u8$1(a.length),u=0;u>1)),A=0,v=function(E){m[A++]=E},u=0;um.length){var y=new u8$1(A+8+(f-u<<1));y.set(m),m=y}var T=a.charCodeAt(u);T<128||n?v(T):T<2048?(v(192|T>>6),v(128|T&63)):T>55295&&T<57344?(T=65536+(T&1047552)|a.charCodeAt(++u)&1023,v(240|T>>18),v(128|T>>12&63),v(128|T>>6&63),v(128|T&63)):(v(224|T>>12),v(128|T>>6&63),v(128|T&63))}return slc$1(m,0,A)}function strFromU8$1(a,n){if(n){for(var s="",u=0;u65558)&&err$1(13);var f=b2$1(a,u+8);if(!f)return{};var m=b4$1(a,u+16),A=m==4294967295||f==65535;if(A){var v=b4$1(a,u-12);A=b4$1(a,v)==101075792,A&&(f=b4$1(a,v+32),m=b4$1(a,v+48))}for(var y=n&&n.filter,T=0;T{const s=(f,m)=>(a.set(m,f),f),u=f=>{if(a.has(f))return a.get(f);const[m,A]=n[f];switch(m){case PRIMITIVE:case VOID:return s(A,f);case ARRAY:{const v=s([],f);for(const y of A)v.push(u(y));return v}case OBJECT:{const v=s({},f);for(const[y,T]of A)v[u(y)]=u(T);return v}case DATE:return s(new Date(A),f);case REGEXP:{const{source:v,flags:y}=A;return s(new RegExp(v,y),f)}case MAP:{const v=s(new Map,f);for(const[y,T]of A)v.set(u(y),u(T));return v}case SET:{const v=s(new Set,f);for(const y of A)v.add(u(y));return v}case ERROR:{const{name:v,message:y}=A;return s(new env$1[v](y),f)}case BIGINT:return s(BigInt(A),f);case"BigInt":return s(Object(BigInt(A)),f)}return s(new env$1[m](A),f)};return u},deserialize$1=a=>deserializer(new Map,a)(0),EMPTY="",{toString}={},{keys}=Object,typeOf=a=>{const n=typeof a;if(n!=="object"||!a)return[PRIMITIVE,n];const s=toString.call(a).slice(8,-1);switch(s){case"Array":return[ARRAY,EMPTY];case"Object":return[OBJECT,EMPTY];case"Date":return[DATE,EMPTY];case"RegExp":return[REGEXP,EMPTY];case"Map":return[MAP,EMPTY];case"Set":return[SET,EMPTY]}return s.includes("Array")?[ARRAY,s]:s.includes("Error")?[ERROR,s]:[OBJECT,s]},shouldSkip=([a,n])=>a===PRIMITIVE&&(n==="function"||n==="symbol"),serializer=(a,n,s,u)=>{const f=(A,v)=>{const y=u.push(A)-1;return s.set(v,y),y},m=A=>{if(s.has(A))return s.get(A);let[v,y]=typeOf(A);switch(v){case PRIMITIVE:{let E=A;switch(y){case"bigint":v=BIGINT,E=A.toString();break;case"function":case"symbol":if(a)throw new TypeError("unable to serialize "+y);E=null;break;case"undefined":return f([VOID],A)}return f([v,E],A)}case ARRAY:{if(y)return f([y,[...A]],A);const E=[],S=f([v,E],A);for(const I of A)E.push(m(I));return S}case OBJECT:{if(y)switch(y){case"BigInt":return f([y,A.toString()],A);case"Boolean":case"Number":case"String":return f([y,A.valueOf()],A)}if(n&&"toJSON"in A)return m(A.toJSON());const E=[],S=f([v,E],A);for(const I of keys(A))(a||!shouldSkip(typeOf(A[I])))&&E.push([m(I),m(A[I])]);return S}case DATE:return f([v,A.toISOString()],A);case REGEXP:{const{source:E,flags:S}=A;return f([v,{source:E,flags:S}],A)}case MAP:{const E=[],S=f([v,E],A);for(const[I,e]of A)(a||!(shouldSkip(typeOf(I))||shouldSkip(typeOf(e))))&&E.push([m(I),m(e)]);return S}case SET:{const E=[],S=f([v,E],A);for(const I of A)(a||!shouldSkip(typeOf(I)))&&E.push(m(I));return S}}const{message:T}=A;return f([v,{name:y,message:T}],A)};return m},serialize=(a,{json:n,lossy:s}={})=>{const u=[];return serializer(!(n||s),!!n,new Map,u)(a),u};var commonjsGlobal=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function getDefaultExportFromCjs(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}function getAugmentedNamespace(a){if(a.__esModule)return a;var n=a.default;if(typeof n=="function"){var s=function u(){return this instanceof u?Reflect.construct(n,arguments,this.constructor):n.apply(this,arguments)};s.prototype=n.prototype}else s={};return Object.defineProperty(s,"__esModule",{value:!0}),Object.keys(a).forEach(function(u){var f=Object.getOwnPropertyDescriptor(a,u);Object.defineProperty(s,u,f.get?f:{enumerable:!0,get:function(){return a[u]}})}),s}var arrayEqual=function(n,s){var u=n.length;if(n===s)return!0;if(u!==s.length)return!1;for(var f=0;f>1|(i&21845)<<1;x=(x&52428)>>2|(x&13107)<<2,x=(x&61680)>>4|(x&3855)<<4,rev[i]=((x&65280)>>8|(x&255)<<8)>>1}var hMap=function(a,n,s){for(var u=a.length,f=0,m=new u16(n);f>y]=T}else for(v=new u16(u),f=0;f>15-a[f]);return v},flt=new u8(288);for(var i=0;i<144;++i)flt[i]=8;for(var i=144;i<256;++i)flt[i]=9;for(var i=256;i<280;++i)flt[i]=7;for(var i=280;i<288;++i)flt[i]=8;var fdt=new u8(32);for(var i=0;i<32;++i)fdt[i]=5;var flm=hMap(flt,9,0),flrm=hMap(flt,9,1),fdm=hMap(fdt,5,0),fdrm=hMap(fdt,5,1),max$4=function(a){for(var n=a[0],s=1;sn&&(n=a[s]);return n},bits=function(a,n,s){var u=n/8|0;return(a[u]|a[u+1]<<8)>>(n&7)&s},bits16=function(a,n){var s=n/8|0;return(a[s]|a[s+1]<<8|a[s+2]<<16)>>(n&7)},shft=function(a){return(a+7)/8|0},slc=function(a,n,s){return(n==null||n<0)&&(n=0),(s==null||s>a.length)&&(s=a.length),new u8(a.subarray(n,s))};browser.FlateErrorCode={UnexpectedEOF:0,InvalidBlockType:1,InvalidLengthLiteral:2,InvalidDistance:3,StreamFinished:4,NoStreamHandler:5,InvalidHeader:6,NoCallback:7,InvalidUTF8:8,ExtraFieldTooLong:9,InvalidDate:10,FilenameTooLong:11,StreamFinishing:12,InvalidZipData:13,UnknownCompressionMethod:14};var ec=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],err=function(a,n,s){var u=new Error(n||ec[a]);if(u.code=a,Error.captureStackTrace&&Error.captureStackTrace(u,err),!s)throw u;return u},inflt=function(a,n,s,u){var f=a.length,m=u?u.length:0;if(!f||n.f&&!n.l)return s||new u8(0);var A=!s,v=A||n.i!=2,y=n.i;A&&(s=new u8(f*3));var T=function(Et){var Rt=s.length;if(Et>Rt){var Ze=new u8(Math.max(Rt*2,Et));Ze.set(s),s=Ze}},E=n.f||0,S=n.p||0,I=n.b||0,e=n.l,F=n.d,M=n.m,L=n.n,V=f*8;do{if(!e){E=bits(a,S,1);var B=bits(a,S+1,3);if(S+=3,B)if(B==1)e=flrm,F=fdrm,M=9,L=5;else if(B==2){var q=bits(a,S,31)+257,Y=bits(a,S+10,15)+4,X=q+bits(a,S+5,31)+1;S+=14;for(var H=new u8(X),g=new u8(19),J=0;J>4;if(z<16)H[J++]=z;else{var me=0,Se=0;for(z==16?(Se=3+bits(a,S,3),S+=2,me=H[J-1]):z==17?(Se=3+bits(a,S,7),S+=3):z==18&&(Se=11+bits(a,S,127),S+=7);Se--;)H[J++]=me}}var ve=H.subarray(0,q),we=H.subarray(q);M=max$4(ve),L=max$4(we),e=hMap(ve,M,1),F=hMap(we,L,1)}else err(1);else{var z=shft(S)+4,b=a[z-4]|a[z-3]<<8,W=z+b;if(W>f){y&&err(0);break}v&&T(I+b),s.set(a.subarray(z,W),I),n.b=I+=b,n.p=S=W*8,n.f=E;continue}if(S>V){y&&err(0);break}}v&&T(I+131072);for(var Ne=(1<>4;if(S+=me&15,S>V){y&&err(0);break}if(me||err(2),nt<256)s[I++]=nt;else if(nt==256){je=S,e=null;break}else{var Ue=nt-254;if(nt>264){var J=nt-257,ye=fleb[J];Ue=bits(a,S,(1<>4;ut||err(3),S+=ut&15;var we=fd[pt];if(pt>3){var ye=fdeb[pt];we+=bits16(a,S)&(1<V){y&&err(0);break}v&&T(I+131072);var It=I+Ue;if(I>8},wbits16=function(a,n,s){s<<=n&7;var u=n/8|0;a[u]|=s,a[u+1]|=s>>8,a[u+2]|=s>>16},hTree=function(a,n){for(var s=[],u=0;uI&&(I=m[u].s);var e=new u16(I+1),F=ln(s[E-1],e,0);if(F>n){var u=0,M=0,L=F-n,V=1<n)M+=V-(1<>=L;M>0;){var z=m[u].s;e[z]=0&&M;--u){var b=m[u].s;e[b]==n&&(--e[b],++M)}F=n}return{t:new u8(e),l:F}},ln=function(a,n,s){return a.s==-1?Math.max(ln(a.l,n,s+1),ln(a.r,n,s+1)):n[a.s]=s},lc=function(a){for(var n=a.length;n&&!a[--n];);for(var s=new u16(++n),u=0,f=a[0],m=1,A=function(y){s[u++]=y},v=1;v<=n;++v)if(a[v]==f&&v!=n)++m;else{if(!f&&m>2){for(;m>138;m-=138)A(32754);m>2&&(A(m>10?m-11<<5|28690:m-3<<5|12305),m=0)}else if(m>3){for(A(f),--m;m>6;m-=6)A(8304);m>2&&(A(m-3<<5|8208),m=0)}for(;m--;)A(f);m=1,f=a[v]}return{c:s.subarray(0,u),n}},clen=function(a,n){for(var s=0,u=0;u>8,a[f+2]=a[f]^255,a[f+3]=a[f+1]^255;for(var m=0;m4&&!g[clim[re-1]];--re);var ae=T+5<<3,fe=clen(f,flt)+clen(m,fdt)+A,pe=clen(f,I)+clen(m,M)+A+14+3*re+clen(Y,g)+2*Y[16]+3*Y[17]+7*Y[18];if(y>=0&&ae<=fe&&ae<=pe)return wfblk(n,E,a.subarray(y,y+T));var me,Se,ve,we;if(wbits(n,E,1+(pe15&&(wbits(n,E,nt[X]>>5&127),E+=nt[X]>>12)}}else me=flm,Se=flt,ve=fdm,we=fdt;for(var X=0;X255){var Ue=ye>>18&31;wbits16(n,E,me[Ue+257]),E+=Se[Ue+257],Ue>7&&(wbits(n,E,ye>>23&31),E+=fleb[Ue]);var ut=ye&31;wbits16(n,E,ve[ut]),E+=we[ut],ut>3&&(wbits16(n,E,ye>>5&8191),E+=fdeb[ut])}else wbits16(n,E,me[ye]),E+=Se[ye]}return wbits16(n,E,me[256]),E+Se[256]},deo=new i32([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),et=new u8(0),dflt=function(a,n,s,u,f,m){var A=m.z||a.length,v=new u8(u+A+5*(1+Math.ceil(A/7e3))+f),y=v.subarray(u,v.length-f),T=m.l,E=(m.r||0)&7;if(n){E&&(y[0]=m.r>>3);for(var S=deo[n-1],I=S>>13,e=S&8191,F=(1<7e3||g>24576)&&(me>423||!T)){E=wblk(a,y,0,b,W,q,X,g,re,H-re,E),g=Y=X=0,re=H;for(var Se=0;Se<286;++Se)W[Se]=0;for(var Se=0;Se<30;++Se)q[Se]=0}var ve=2,we=0,Ne=e,De=fe-pe&32767;if(me>2&&ae==z(H-De))for(var je=Math.min(I,me)-1,nt=Math.min(32767,H),Ue=Math.min(258,me);De<=nt&&--Ne&&fe!=pe;){if(a[H+ve]==a[H+ve-De]){for(var ye=0;yeve){if(ve=ye,we=De,ye>je)break;for(var ut=Math.min(De,ye-2),pt=0,Se=0;Sept&&(pt=Ot,pe=It)}}}fe=pe,pe=M[fe],De+=fe-pe&32767}if(we){b[g++]=268435456|revfl[ve]<<18|revfd[we];var Et=revfl[ve]&31,Rt=revfd[we]&31;X+=fleb[Et]+fdeb[Rt],++W[257+Et],++q[Rt],J=H+ve,++Y}else b[g++]=a[H],++W[a[H]]}}for(H=Math.max(H,J);H=A&&(y[E/8|0]=T,Ze=A),E=wfblk(y,E+1,a.subarray(H,Ze))}m.i=A}return slc(v,0,u+shft(E)+f)},crct=function(){for(var a=new Int32Array(256),n=0;n<256;++n){for(var s=n,u=9;--u;)s=(s&1&&-306674912)^s>>>1;a[n]=s}return a}(),crc=function(){var a=-1;return{p:function(n){for(var s=a,u=0;u>>8;a=s},d:function(){return~a}}},adler=function(){var a=1,n=0;return{p:function(s){for(var u=a,f=n,m=s.length|0,A=0;A!=m;){for(var v=Math.min(A+2655,m);A>16),f=(f&65535)+15*(f>>16)}a=u,n=f},d:function(){return a%=65521,n%=65521,(a&255)<<24|(a&65280)<<8|(n&255)<<8|n>>8}}},dopt=function(a,n,s,u,f){if(!f&&(f={l:1},n.dictionary)){var m=n.dictionary.subarray(-32768),A=new u8(m.length+a.length);A.set(m),A.set(a,m.length),a=A,f.w=m.length}return dflt(a,n.level==null?6:n.level,n.mem==null?f.l?Math.ceil(Math.max(8,Math.min(13,Math.log(a.length)))*1.5):20:12+n.mem,s,u,f)},mrg=function(a,n){var s={};for(var u in a)s[u]=a[u];for(var u in n)s[u]=n[u];return s},wcln=function(a,n,s){for(var u=a(),f=a.toString(),m=f.slice(f.indexOf("[")+1,f.lastIndexOf("]")).replace(/\s+/g,"").split(","),A=0;A>>0},b8=function(a,n){return b4(a,n)+b4(a,n+4)*4294967296},wbytes=function(a,n,s){for(;s;++n)a[n]=s,s>>>=8},gzh=function(a,n){var s=n.filename;if(a[0]=31,a[1]=139,a[2]=8,a[8]=n.level<2?4:n.level==9?2:0,a[9]=3,n.mtime!=0&&wbytes(a,4,Math.floor(new Date(n.mtime||Date.now())/1e3)),s){a[3]=8;for(var u=0;u<=s.length;++u)a[u+10]=s.charCodeAt(u)}},gzs=function(a){(a[0]!=31||a[1]!=139||a[2]!=8)&&err(6,"invalid gzip data");var n=a[3],s=10;n&4&&(s+=(a[10]|a[11]<<8)+2);for(var u=(n>>3&1)+(n>>4&1);u>0;u-=!a[s++]);return s+(n&2)},gzl=function(a){var n=a.length;return(a[n-4]|a[n-3]<<8|a[n-2]<<16|a[n-1]<<24)>>>0},gzhl=function(a){return 10+(a.filename?a.filename.length+1:0)},zlh=function(a,n){var s=n.level,u=s==0?0:s<6?1:s==9?3:2;if(a[0]=120,a[1]=u<<6|(n.dictionary&&32),a[1]|=31-(a[0]<<8|a[1])%31,n.dictionary){var f=adler();f.p(n.dictionary),wbytes(a,2,f.d())}},zls=function(a,n){return((a[0]&15)!=8||a[0]>>4>7||(a[0]<<8|a[1])%31)&&err(6,"invalid zlib data"),(a[1]>>5&1)==+!n&&err(6,"invalid zlib data: "+(a[1]&32?"need":"unexpected")+" dictionary"),(a[1]>>3&4)+2};function StrmOpt(a,n){return typeof a=="function"&&(n=a,a={}),this.ondata=n,a}var Deflate=function(){function a(n,s){if(typeof n=="function"&&(s=n,n={}),this.ondata=s,this.o=n||{},this.s={l:0,i:32768,w:32768,z:32768},this.b=new u8(98304),this.o.dictionary){var u=this.o.dictionary.subarray(-32768);this.b.set(u,32768-u.length),this.s.i=32768-u.length}}return a.prototype.p=function(n,s){this.ondata(dopt(n,this.o,0,0,this.s),s)},a.prototype.push=function(n,s){this.ondata||err(5),this.s.l&&err(4);var u=n.length+this.s.z;if(u>this.b.length){if(u>2*this.b.length-32768){var f=new u8(u&-32768);f.set(this.b.subarray(0,this.s.z)),this.b=f}var m=this.b.length-this.s.z;this.b.set(n.subarray(0,m),this.s.z),this.s.z=this.b.length,this.p(this.b,!1),this.b.set(this.b.subarray(-32768)),this.b.set(n.subarray(m),32768),this.s.z=n.length-m+32768,this.s.i=32766,this.s.w=32768}else this.b.set(n,this.s.z),this.s.z+=n.length;this.s.l=s&1,(this.s.z>this.s.w+8191||s)&&(this.p(this.b,s||!1),this.s.w=this.s.i,this.s.i-=2)},a.prototype.flush=function(){this.ondata||err(5),this.s.l&&err(4),this.p(this.b,!1),this.s.w=this.s.i,this.s.i-=2},a}();browser.Deflate=Deflate;var AsyncDeflate=function(){function a(n,s){astrmify([bDflt,function(){return[astrm,Deflate]}],this,StrmOpt.call(this,n,s),function(u){var f=new Deflate(u.data);onmessage=astrm(f)},6,1)}return a}();browser.AsyncDeflate=AsyncDeflate;function deflate$2(a,n,s){return s||(s=n,n={}),typeof s!="function"&&err(7),cbify(a,n,[bDflt],function(u){return pbf(deflateSync(u.data[0],u.data[1]))},0,s)}browser.deflate=deflate$2;function deflateSync(a,n){return dopt(a,n||{},0,0)}browser.deflateSync=deflateSync;var Inflate=function(){function a(n,s){typeof n=="function"&&(s=n,n={}),this.ondata=s;var u=n&&n.dictionary&&n.dictionary.subarray(-32768);this.s={i:0,b:u?u.length:0},this.o=new u8(32768),this.p=new u8(0),u&&this.o.set(u)}return a.prototype.e=function(n){if(this.ondata||err(5),this.d&&err(4),!this.p.length)this.p=n;else if(n.length){var s=new u8(this.p.length+n.length);s.set(this.p),s.set(n,this.p.length),this.p=s}},a.prototype.c=function(n){this.s.i=+(this.d=n||!1);var s=this.s.b,u=inflt(this.p,this.s,this.o);this.ondata(slc(u,s,this.s.b),this.d),this.o=slc(u,this.s.b-32768),this.s.b=this.o.length,this.p=slc(this.p,this.s.p/8|0),this.s.p&=7},a.prototype.push=function(n,s){this.e(n),this.c(s)},a}();browser.Inflate=Inflate;var AsyncInflate=function(){function a(n,s){astrmify([bInflt,function(){return[astrm,Inflate]}],this,StrmOpt.call(this,n,s),function(u){var f=new Inflate(u.data);onmessage=astrm(f)},7,0)}return a}();browser.AsyncInflate=AsyncInflate;function inflate$2(a,n,s){return s||(s=n,n={}),typeof s!="function"&&err(7),cbify(a,n,[bInflt],function(u){return pbf(inflateSync(u.data[0],gopt(u.data[1])))},1,s)}browser.inflate=inflate$2;function inflateSync(a,n){return inflt(a,{i:2},n&&n.out,n&&n.dictionary)}browser.inflateSync=inflateSync;var Gzip=function(){function a(n,s){this.c=crc(),this.l=0,this.v=1,Deflate.call(this,n,s)}return a.prototype.push=function(n,s){this.c.p(n),this.l+=n.length,Deflate.prototype.push.call(this,n,s)},a.prototype.p=function(n,s){var u=dopt(n,this.o,this.v&&gzhl(this.o),s&&8,this.s);this.v&&(gzh(u,this.o),this.v=0),s&&(wbytes(u,u.length-8,this.c.d()),wbytes(u,u.length-4,this.l)),this.ondata(u,s)},a.prototype.flush=function(){Deflate.prototype.flush.call(this)},a}();browser.Gzip=Gzip;browser.Compress=Gzip;var AsyncGzip=function(){function a(n,s){astrmify([bDflt,gze,function(){return[astrm,Deflate,Gzip]}],this,StrmOpt.call(this,n,s),function(u){var f=new Gzip(u.data);onmessage=astrm(f)},8,1)}return a}();browser.AsyncGzip=AsyncGzip;browser.AsyncCompress=AsyncGzip;function gzip(a,n,s){return s||(s=n,n={}),typeof s!="function"&&err(7),cbify(a,n,[bDflt,gze,function(){return[gzipSync]}],function(u){return pbf(gzipSync(u.data[0],u.data[1]))},2,s)}browser.gzip=gzip;browser.compress=gzip;function gzipSync(a,n){n||(n={});var s=crc(),u=a.length;s.p(a);var f=dopt(a,n,gzhl(n),8),m=f.length;return gzh(f,n),wbytes(f,m-8,s.d()),wbytes(f,m-4,u),f}browser.gzipSync=gzipSync;browser.compressSync=gzipSync;var Gunzip=function(){function a(n,s){this.v=1,this.r=0,Inflate.call(this,n,s)}return a.prototype.push=function(n,s){if(Inflate.prototype.e.call(this,n),this.r+=n.length,this.v){var u=this.p.subarray(this.v-1),f=u.length>3?gzs(u):4;if(f>u.length){if(!s)return}else this.v>1&&this.onmember&&this.onmember(this.r-u.length);this.p=u.subarray(f),this.v=0}Inflate.prototype.c.call(this,s),this.s.f&&!this.s.l&&!s&&(this.v=shft(this.s.p)+9,this.s={i:0},this.o=new u8(0),this.push(new u8(0),s))},a}();browser.Gunzip=Gunzip;var AsyncGunzip=function(){function a(n,s){var u=this;astrmify([bInflt,guze,function(){return[astrm,Inflate,Gunzip]}],this,StrmOpt.call(this,n,s),function(f){var m=new Gunzip(f.data);m.onmember=function(A){return postMessage(A)},onmessage=astrm(m)},9,0,function(f){return u.onmember&&u.onmember(f)})}return a}();browser.AsyncGunzip=AsyncGunzip;function gunzip(a,n,s){return s||(s=n,n={}),typeof s!="function"&&err(7),cbify(a,n,[bInflt,guze,function(){return[gunzipSync]}],function(u){return pbf(gunzipSync(u.data[0],u.data[1]))},3,s)}browser.gunzip=gunzip;function gunzipSync(a,n){var s=gzs(a);return s+8>a.length&&err(6,"invalid gzip data"),inflt(a.subarray(s,-8),{i:2},n&&n.out||new u8(gzl(a)),n&&n.dictionary)}browser.gunzipSync=gunzipSync;var Zlib=function(){function a(n,s){this.c=adler(),this.v=1,Deflate.call(this,n,s)}return a.prototype.push=function(n,s){this.c.p(n),Deflate.prototype.push.call(this,n,s)},a.prototype.p=function(n,s){var u=dopt(n,this.o,this.v&&(this.o.dictionary?6:2),s&&4,this.s);this.v&&(zlh(u,this.o),this.v=0),s&&wbytes(u,u.length-4,this.c.d()),this.ondata(u,s)},a.prototype.flush=function(){Deflate.prototype.flush.call(this)},a}();browser.Zlib=Zlib;var AsyncZlib=function(){function a(n,s){astrmify([bDflt,zle,function(){return[astrm,Deflate,Zlib]}],this,StrmOpt.call(this,n,s),function(u){var f=new Zlib(u.data);onmessage=astrm(f)},10,1)}return a}();browser.AsyncZlib=AsyncZlib;function zlib(a,n,s){return s||(s=n,n={}),typeof s!="function"&&err(7),cbify(a,n,[bDflt,zle,function(){return[zlibSync]}],function(u){return pbf(zlibSync(u.data[0],u.data[1]))},4,s)}browser.zlib=zlib;function zlibSync(a,n){n||(n={});var s=adler();s.p(a);var u=dopt(a,n,n.dictionary?6:2,4);return zlh(u,n),wbytes(u,u.length-4,s.d()),u}browser.zlibSync=zlibSync;var Unzlib=function(){function a(n,s){Inflate.call(this,n,s),this.v=n&&n.dictionary?2:1}return a.prototype.push=function(n,s){if(Inflate.prototype.e.call(this,n),this.v){if(this.p.length<6&&!s)return;this.p=this.p.subarray(zls(this.p,this.v-1)),this.v=0}s&&(this.p.length<4&&err(6,"invalid zlib data"),this.p=this.p.subarray(0,-4)),Inflate.prototype.c.call(this,s)},a}();browser.Unzlib=Unzlib;var AsyncUnzlib=function(){function a(n,s){astrmify([bInflt,zule,function(){return[astrm,Inflate,Unzlib]}],this,StrmOpt.call(this,n,s),function(u){var f=new Unzlib(u.data);onmessage=astrm(f)},11,0)}return a}();browser.AsyncUnzlib=AsyncUnzlib;function unzlib(a,n,s){return s||(s=n,n={}),typeof s!="function"&&err(7),cbify(a,n,[bInflt,zule,function(){return[unzlibSync]}],function(u){return pbf(unzlibSync(u.data[0],gopt(u.data[1])))},5,s)}browser.unzlib=unzlib;function unzlibSync(a,n){return inflt(a.subarray(zls(a,n&&n.dictionary),-4),{i:2},n&&n.out,n&&n.dictionary)}browser.unzlibSync=unzlibSync;var Decompress=function(){function a(n,s){this.o=StrmOpt.call(this,n,s)||{},this.G=Gunzip,this.I=Inflate,this.Z=Unzlib}return a.prototype.i=function(){var n=this;this.s.ondata=function(s,u){n.ondata(s,u)}},a.prototype.push=function(n,s){if(this.ondata||err(5),this.s)this.s.push(n,s);else{if(this.p&&this.p.length){var u=new u8(this.p.length+n.length);u.set(this.p),u.set(n,this.p.length)}else this.p=n;this.p.length>2&&(this.s=this.p[0]==31&&this.p[1]==139&&this.p[2]==8?new this.G(this.o):(this.p[0]&15)!=8||this.p[0]>>4>7||(this.p[0]<<8|this.p[1])%31?new this.I(this.o):new this.Z(this.o),this.i(),this.s.push(this.p,s),this.p=null)}},a}();browser.Decompress=Decompress;var AsyncDecompress=function(){function a(n,s){Decompress.call(this,n,s),this.queuedSize=0,this.G=AsyncGunzip,this.I=AsyncInflate,this.Z=AsyncUnzlib}return a.prototype.i=function(){var n=this;this.s.ondata=function(s,u,f){n.ondata(s,u,f)},this.s.ondrain=function(s){n.queuedSize-=s,n.ondrain&&n.ondrain(s)}},a.prototype.push=function(n,s){this.queuedSize+=n.length,Decompress.prototype.push.call(this,n,s)},a}();browser.AsyncDecompress=AsyncDecompress;function decompress(a,n,s){return s||(s=n,n={}),typeof s!="function"&&err(7),a[0]==31&&a[1]==139&&a[2]==8?gunzip(a,n,s):(a[0]&15)!=8||a[0]>>4>7||(a[0]<<8|a[1])%31?inflate$2(a,n,s):unzlib(a,n,s)}browser.decompress=decompress;function decompressSync(a,n){return a[0]==31&&a[1]==139&&a[2]==8?gunzipSync(a,n):(a[0]&15)!=8||a[0]>>4>7||(a[0]<<8|a[1])%31?inflateSync(a,n):unzlibSync(a,n)}browser.decompressSync=decompressSync;var fltn=function(a,n,s,u){for(var f in a){var m=a[f],A=n+f,v=u;Array.isArray(m)&&(v=mrg(u,m[1]),m=m[0]),m instanceof u8?s[A]=[m,v]:(s[A+="/"]=[new u8(0),v],fltn(m,A,s,u))}},te=typeof TextEncoder<"u"&&new TextEncoder,td=typeof TextDecoder<"u"&&new TextDecoder,tds=0;try{td.decode(et,{stream:!0}),tds=1}catch{}var dutf8=function(a){for(var n="",s=0;;){var u=a[s++],f=(u>127)+(u>223)+(u>239);if(s+f>a.length)return{s:n,r:slc(a,s-1)};f?f==3?(u=((u&15)<<18|(a[s++]&63)<<12|(a[s++]&63)<<6|a[s++]&63)-65536,n+=String.fromCharCode(55296|u>>10,56320|u&1023)):f&1?n+=String.fromCharCode((u&31)<<6|a[s++]&63):n+=String.fromCharCode((u&15)<<12|(a[s++]&63)<<6|a[s++]&63):n+=String.fromCharCode(u)}},DecodeUTF8=function(){function a(n){this.ondata=n,tds?this.t=new TextDecoder:this.p=et}return a.prototype.push=function(n,s){if(this.ondata||err(5),s=!!s,this.t){this.ondata(this.t.decode(n,{stream:!0}),s),s&&(this.t.decode().length&&err(8),this.t=null);return}this.p||err(4);var u=new u8(this.p.length+n.length);u.set(this.p),u.set(n,this.p.length);var f=dutf8(u),m=f.s,A=f.r;s?(A.length&&err(8),this.p=null):this.p=A,this.ondata(m,s)},a}();browser.DecodeUTF8=DecodeUTF8;var EncodeUTF8=function(){function a(n){this.ondata=n}return a.prototype.push=function(n,s){this.ondata||err(5),this.d&&err(4),this.ondata(strToU8(n),this.d=s||!1)},a}();browser.EncodeUTF8=EncodeUTF8;function strToU8(a,n){if(n){for(var s=new u8(a.length),u=0;u>1)),A=0,v=function(E){m[A++]=E},u=0;um.length){var y=new u8(A+8+(f-u<<1));y.set(m),m=y}var T=a.charCodeAt(u);T<128||n?v(T):T<2048?(v(192|T>>6),v(128|T&63)):T>55295&&T<57344?(T=65536+(T&1047552)|a.charCodeAt(++u)&1023,v(240|T>>18),v(128|T>>12&63),v(128|T>>6&63),v(128|T&63)):(v(224|T>>12),v(128|T>>6&63),v(128|T&63))}return slc(m,0,A)}browser.strToU8=strToU8;function strFromU8(a,n){if(n){for(var s="",u=0;u65535&&err(9),n+=u+4}return n},wzh=function(a,n,s,u,f,m,A,v){var y=u.length,T=s.extra,E=v&&v.length,S=exfl(T);wbytes(a,n,A!=null?33639248:67324752),n+=4,A!=null&&(a[n++]=20,a[n++]=s.os),a[n]=20,n+=2,a[n++]=s.flag<<1|(m<0&&8),a[n++]=f&&8,a[n++]=s.compression&255,a[n++]=s.compression>>8;var I=new Date(s.mtime==null?Date.now():s.mtime),e=I.getFullYear()-1980;if((e<0||e>119)&&err(10),wbytes(a,n,e<<25|I.getMonth()+1<<21|I.getDate()<<16|I.getHours()<<11|I.getMinutes()<<5|I.getSeconds()>>1),n+=4,m!=-1&&(wbytes(a,n,s.crc),wbytes(a,n+4,m<0?-m-2:m),wbytes(a,n+8,s.size)),wbytes(a,n+12,y),wbytes(a,n+14,S),n+=16,A!=null&&(wbytes(a,n,E),wbytes(a,n+6,s.attrs),wbytes(a,n+10,A),n+=14),a.set(u,n),n+=y,S)for(var F in T){var M=T[F],L=M.length;wbytes(a,n,+F),wbytes(a,n+2,L),a.set(M,n+4),n+=4+L}return E&&(a.set(v,n),n+=E),n},wzf=function(a,n,s,u,f){wbytes(a,n,101010256),wbytes(a,n+8,s),wbytes(a,n+10,s),wbytes(a,n+12,u),wbytes(a,n+16,f)},ZipPassThrough=function(){function a(n){this.filename=n,this.c=crc(),this.size=0,this.compression=0}return a.prototype.process=function(n,s){this.ondata(null,n,s)},a.prototype.push=function(n,s){this.ondata||err(5),this.c.p(n),this.size+=n.length,s&&(this.crc=this.c.d()),this.process(n,s||!1)},a}();browser.ZipPassThrough=ZipPassThrough;var ZipDeflate=function(){function a(n,s){var u=this;s||(s={}),ZipPassThrough.call(this,n),this.d=new Deflate(s,function(f,m){u.ondata(null,f,m)}),this.compression=8,this.flag=dbf(s.level)}return a.prototype.process=function(n,s){try{this.d.push(n,s)}catch(u){this.ondata(u,null,s)}},a.prototype.push=function(n,s){ZipPassThrough.prototype.push.call(this,n,s)},a}();browser.ZipDeflate=ZipDeflate;var AsyncZipDeflate=function(){function a(n,s){var u=this;s||(s={}),ZipPassThrough.call(this,n),this.d=new AsyncDeflate(s,function(f,m,A){u.ondata(f,m,A)}),this.compression=8,this.flag=dbf(s.level),this.terminate=this.d.terminate}return a.prototype.process=function(n,s){this.d.push(n,s)},a.prototype.push=function(n,s){ZipPassThrough.prototype.push.call(this,n,s)},a}();browser.AsyncZipDeflate=AsyncZipDeflate;var Zip=function(){function a(n){this.ondata=n,this.u=[],this.d=1}return a.prototype.add=function(n){var s=this;if(this.ondata||err(5),this.d&2)this.ondata(err(4+(this.d&1)*8,0,1),null,!1);else{var u=strToU8(n.filename),f=u.length,m=n.comment,A=m&&strToU8(m),v=f!=n.filename.length||A&&m.length!=A.length,y=f+exfl(n.extra)+30;f>65535&&this.ondata(err(11,0,1),null,!1);var T=new u8(y);wzh(T,0,n,u,v,-1);var E=[T],S=function(){for(var L=0,V=E;L65535&&fe(err(11,0,1),null),!ae)fe(null,z);else if(q<16e4)try{fe(null,deflateSync(z,b))}catch(pe){fe(pe,null)}else E.push(deflate$2(z,b,fe))},M=0;M65535&&err(11);var V=E?deflateSync(y,T):y,B=V.length,z=crc();z.p(y),u.push(mrg(T,{size:y.length,crc:z.d(),c:V,f:S,m:F,u:I!=A.length||F&&e.length!=M,o:f,compression:E})),f+=30+I+L+B,m+=76+2*(I+L)+(M||0)+B}for(var b=new u8(m+22),W=f,q=m-f,Y=0;Y0){var f=Math.min(this.c,n.length),m=n.subarray(0,f);if(this.c-=f,this.d?this.d.push(m,!this.c):this.k[0].push(m),n=n.subarray(f),n.length)return this.push(n,s)}else{var A=0,v=0,y=void 0,T=void 0;this.p.length?n.length?(T=new u8(this.p.length+n.length),T.set(this.p),T.set(n,this.p.length)):T=this.p:T=n;for(var E=T.length,S=this.c,I=S&&this.d,e=function(){var V,B=b4(T,v);if(B==67324752){A=1,y=v,F.d=null,F.c=0;var z=b2(T,v+6),b=b2(T,v+8),W=z&2048,q=z&8,Y=b2(T,v+26),X=b2(T,v+28);if(E>v+30+Y+X){var H=[];F.k.unshift(H),A=2;var g=b4(T,v+18),J=b4(T,v+22),re=strFromU8(T.subarray(v+30,v+=30+Y),!W);g==4294967295?(V=q?[-2]:z64e(T,v),g=V[0],J=V[1]):q&&(g=-1),v+=X,F.c=g;var ae,fe={name:re,compression:b,start:function(){if(fe.ondata||err(5),!g)fe.ondata(null,et,!0);else{var pe=u.o[b];pe||fe.ondata(err(14,"unknown compression type "+b,1),null,!1),ae=g<0?new pe(re):new pe(re,g,J),ae.ondata=function(we,Ne,De){fe.ondata(we,Ne,De)};for(var me=0,Se=H;me=0&&(fe.size=g,fe.originalSize=J),F.onfile(fe)}return"break"}else if(S){if(B==134695760)return y=v+=12+(S==-2&&8),A=3,F.c=0,"break";if(B==33639248)return y=v-=4,A=3,F.c=0,"break"}},F=this;v65558)return A(err(13,0,1),null),f;var y=b2(a,v+8);if(y){var T=y,E=b4(a,v+16),S=E==4294967295||T==65535;if(S){var I=b4(a,v-12);S=b4(a,I)==101075792,S&&(T=y=b4(a,I+32),E=b4(a,I+48))}for(var e=n&&n.filter,F=function(L){var V=zh(a,E,S),B=V[0],z=V[1],b=V[2],W=V[3],q=V[4],Y=V[5],X=slzh(a,Y);E=q;var H=function(J,re){J?(f(),A(J,null)):(re&&(m[W]=re),--y||A(null,m))};if(!e||e({name:W,size:z,originalSize:b,compression:B}))if(!B)H(null,slc(a,X,X+z));else if(B==8){var g=a.subarray(X,X+z);if(b<524288||z>.8*b)try{H(null,inflateSync(g,{out:new u8(b)}))}catch(J){H(J,null)}else u.push(inflate$2(g,{size:b},H))}else H(err(14,"unknown compression type "+B,1),null);else H(null,null)},M=0;M65558)&&err(13);var f=b2(a,u+8);if(!f)return{};var m=b4(a,u+16),A=m==4294967295||f==65535;if(A){var v=b4(a,u-12);A=b4(a,v)==101075792,A&&(f=b4(a,v+32),m=b4(a,v+48))}for(var y=n&&n.filter,T=0;T=0;f--)A=A*256+m[f];return A}static getExtensionsAt(n,s,u,f){let m=[],A=s;for(;Af&&(v=!v,y=J0.getIntAt(n,A,v),y+A>f))throw new Error("This does not appear to be a valid NIFTI extension");if(y%16!=0)throw new Error("This does not appear to be a NIFTI extension");let T=J0.getIntAt(n,A+4,v),E=n.buffer.slice(A+8,A+y);console.log("extensionByteIndex: "+(A+8)+" esize: "+y),console.log(E);let S=new nifti_extension_1.NIFTIEXTENSION(y,T,E,v);m.push(S),A+=y}return m}static toArrayBuffer(n){var s,u,f;for(s=new ArrayBuffer(n.length),u=new Uint8Array(s),f=0;f>>1:n>>>1;s[u]=n}return s}static crc32(n){J0.crcTable||(J0.crcTable=J0.makeCRCTable());const s=J0.crcTable;let u=-1;for(var f=0;f>>8^s[(u^n.getUint8(f))&255];return(u^-1)>>>0}};ct(J0,"crcTable",null),ct(J0,"GUNZIP_MAGIC_COOKIE1",31),ct(J0,"GUNZIP_MAGIC_COOKIE2",139),ct(J0,"getByteAt",function(n,s){return n.getInt8(s)}),ct(J0,"getShortAt",function(n,s,u){return n.getInt16(s,u)});let Utils=J0;utilities$1.Utils=Utils;Object.defineProperty(nifti1,"__esModule",{value:!0});nifti1.NIFTI1=void 0;const utilities_1$1=utilities$1,Ht=class Ht{constructor(){ct(this,"littleEndian",!1);ct(this,"dim_info",0);ct(this,"dims",[]);ct(this,"intent_p1",0);ct(this,"intent_p2",0);ct(this,"intent_p3",0);ct(this,"intent_code",0);ct(this,"datatypeCode",0);ct(this,"numBitsPerVoxel",0);ct(this,"slice_start",0);ct(this,"slice_end",0);ct(this,"slice_code",0);ct(this,"pixDims",[]);ct(this,"vox_offset",0);ct(this,"scl_slope",1);ct(this,"scl_inter",0);ct(this,"xyzt_units",0);ct(this,"cal_max",0);ct(this,"cal_min",0);ct(this,"slice_duration",0);ct(this,"toffset",0);ct(this,"description","");ct(this,"aux_file","");ct(this,"intent_name","");ct(this,"qform_code",0);ct(this,"sform_code",0);ct(this,"quatern_a",0);ct(this,"quatern_b",0);ct(this,"quatern_c",0);ct(this,"quatern_d",0);ct(this,"qoffset_x",0);ct(this,"qoffset_y",0);ct(this,"qoffset_z",0);ct(this,"affine",[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]]);ct(this,"qfac",1);ct(this,"quatern_R");ct(this,"magic","0");ct(this,"isHDR",!1);ct(this,"extensionFlag",[0,0,0,0]);ct(this,"extensionSize",0);ct(this,"extensionCode",0);ct(this,"extensions",[]);ct(this,"getDatatypeCodeString",function(n){return n===Ht.TYPE_UINT8?"1-Byte Unsigned Integer":n===Ht.TYPE_INT16?"2-Byte Signed Integer":n===Ht.TYPE_INT32?"4-Byte Signed Integer":n===Ht.TYPE_FLOAT32?"4-Byte Float":n===Ht.TYPE_FLOAT64?"8-Byte Float":n===Ht.TYPE_RGB24?"RGB":n===Ht.TYPE_INT8?"1-Byte Signed Integer":n===Ht.TYPE_UINT16?"2-Byte Unsigned Integer":n===Ht.TYPE_UINT32?"4-Byte Unsigned Integer":n===Ht.TYPE_INT64?"8-Byte Signed Integer":n===Ht.TYPE_UINT64?"8-Byte Unsigned Integer":"Unknown"});ct(this,"getTransformCodeString",function(n){return n===Ht.XFORM_SCANNER_ANAT?"Scanner":n===Ht.XFORM_ALIGNED_ANAT?"Aligned":n===Ht.XFORM_TALAIRACH?"Talairach":n===Ht.XFORM_MNI_152?"MNI":"Unknown"});ct(this,"getUnitsCodeString",function(n){return n===Ht.UNITS_METER?"Meters":n===Ht.UNITS_MM?"Millimeters":n===Ht.UNITS_MICRON?"Microns":n===Ht.UNITS_SEC?"Seconds":n===Ht.UNITS_MSEC?"Milliseconds":n===Ht.UNITS_USEC?"Microseconds":n===Ht.UNITS_HZ?"Hz":n===Ht.UNITS_PPM?"PPM":n===Ht.UNITS_RADS?"Rads":"Unknown"});ct(this,"nifti_mat33_mul",function(n,s){var u=[[0,0,0],[0,0,0],[0,0,0]],f,m;for(f=0;f<3;f+=1)for(m=0;m<3;m+=1)u[f][m]=n[f][0]*s[0][m]+n[f][1]*s[1][m]+n[f][2]*s[2][m];return u});ct(this,"nifti_mat33_determ",function(n){var s,u,f,m,A,v,y,T,E;return s=n[0][0],u=n[0][1],f=n[0][2],m=n[1][0],A=n[1][1],v=n[1][2],y=n[2][0],T=n[2][1],E=n[2][2],s*A*E-s*T*v-m*u*E+m*T*f+y*u*v-y*A*f})}readHeader(n){var s=new DataView(n),u=utilities_1$1.Utils.getIntAt(s,0,this.littleEndian),f,m,A,v;if(u!==Ht.MAGIC_COOKIE&&(this.littleEndian=!0,u=utilities_1$1.Utils.getIntAt(s,0,this.littleEndian)),u!==Ht.MAGIC_COOKIE)throw new Error("This does not appear to be a NIFTI file!");for(this.dim_info=utilities_1$1.Utils.getByteAt(s,39),f=0;f<8;f+=1)v=40+f*2,this.dims[f]=utilities_1$1.Utils.getShortAt(s,v,this.littleEndian);for(this.intent_p1=utilities_1$1.Utils.getFloatAt(s,56,this.littleEndian),this.intent_p2=utilities_1$1.Utils.getFloatAt(s,60,this.littleEndian),this.intent_p3=utilities_1$1.Utils.getFloatAt(s,64,this.littleEndian),this.intent_code=utilities_1$1.Utils.getShortAt(s,68,this.littleEndian),this.datatypeCode=utilities_1$1.Utils.getShortAt(s,70,this.littleEndian),this.numBitsPerVoxel=utilities_1$1.Utils.getShortAt(s,72,this.littleEndian),this.slice_start=utilities_1$1.Utils.getShortAt(s,74,this.littleEndian),f=0;f<8;f+=1)v=76+f*4,this.pixDims[f]=utilities_1$1.Utils.getFloatAt(s,v,this.littleEndian);if(this.vox_offset=utilities_1$1.Utils.getFloatAt(s,108,this.littleEndian),this.scl_slope=utilities_1$1.Utils.getFloatAt(s,112,this.littleEndian),this.scl_inter=utilities_1$1.Utils.getFloatAt(s,116,this.littleEndian),this.slice_end=utilities_1$1.Utils.getShortAt(s,120,this.littleEndian),this.slice_code=utilities_1$1.Utils.getByteAt(s,122),this.xyzt_units=utilities_1$1.Utils.getByteAt(s,123),this.cal_max=utilities_1$1.Utils.getFloatAt(s,124,this.littleEndian),this.cal_min=utilities_1$1.Utils.getFloatAt(s,128,this.littleEndian),this.slice_duration=utilities_1$1.Utils.getFloatAt(s,132,this.littleEndian),this.toffset=utilities_1$1.Utils.getFloatAt(s,136,this.littleEndian),this.description=utilities_1$1.Utils.getStringAt(s,148,228),this.aux_file=utilities_1$1.Utils.getStringAt(s,228,252),this.qform_code=utilities_1$1.Utils.getShortAt(s,252,this.littleEndian),this.sform_code=utilities_1$1.Utils.getShortAt(s,254,this.littleEndian),this.quatern_b=utilities_1$1.Utils.getFloatAt(s,256,this.littleEndian),this.quatern_c=utilities_1$1.Utils.getFloatAt(s,260,this.littleEndian),this.quatern_d=utilities_1$1.Utils.getFloatAt(s,264,this.littleEndian),this.quatern_a=Math.sqrt(1-(Math.pow(this.quatern_b,2)+Math.pow(this.quatern_c,2)+Math.pow(this.quatern_d,2))),this.qoffset_x=utilities_1$1.Utils.getFloatAt(s,268,this.littleEndian),this.qoffset_y=utilities_1$1.Utils.getFloatAt(s,272,this.littleEndian),this.qoffset_z=utilities_1$1.Utils.getFloatAt(s,276,this.littleEndian),this.qform_code<1&&this.sform_code<1&&(this.affine[0][0]=this.pixDims[1],this.affine[1][1]=this.pixDims[2],this.affine[2][2]=this.pixDims[3]),this.qform_code>0&&this.sform_code0)for(m=0;m<3;m+=1)for(A=0;A<4;A+=1)v=280+(m*4+A)*4,this.affine[m][A]=utilities_1$1.Utils.getFloatAt(s,v,this.littleEndian);if(this.affine[3][0]=0,this.affine[3][1]=0,this.affine[3][2]=0,this.affine[3][3]=1,this.intent_name=utilities_1$1.Utils.getStringAt(s,328,344),this.magic=utilities_1$1.Utils.getStringAt(s,344,348),this.isHDR=this.magic===String.fromCharCode.apply(null,Ht.MAGIC_NUMBER2),s.byteLength>Ht.MAGIC_COOKIE){this.extensionFlag[0]=utilities_1$1.Utils.getByteAt(s,348),this.extensionFlag[1]=utilities_1$1.Utils.getByteAt(s,349),this.extensionFlag[2]=utilities_1$1.Utils.getByteAt(s,350),this.extensionFlag[3]=utilities_1$1.Utils.getByteAt(s,351);let y=!0;!this.isHDR&&this.vox_offset<=352&&(y=!1),s.byteLength<=368&&(y=!1),y&&this.extensionFlag[0]&&(this.extensions=utilities_1$1.Utils.getExtensionsAt(s,this.getExtensionLocation(),this.littleEndian,this.vox_offset),this.extensionSize=this.extensions[0].esize,this.extensionCode=this.extensions[0].ecode)}}toFormattedString(){var n=utilities_1$1.Utils.formatNumber,s="";return s+="Dim Info = "+this.dim_info+` +var tA=Object.defineProperty;var iA=(a,n,s)=>n in a?tA(a,n,{enumerable:!0,configurable:!0,writable:!0,value:s}):a[n]=s;var ct=(a,n,s)=>(iA(a,typeof n!="symbol"?n+"":n,s),s);function _mergeNamespaces(a,n){for(var s=0;su[f]})}}}return Object.freeze(Object.defineProperty(a,Symbol.toStringTag,{value:"Module"}))}(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const f of document.querySelectorAll('link[rel="modulepreload"]'))u(f);new MutationObserver(f=>{for(const m of f)if(m.type==="childList")for(const A of m.addedNodes)A.tagName==="LINK"&&A.rel==="modulepreload"&&u(A)}).observe(document,{childList:!0,subtree:!0});function s(f){const m={};return f.integrity&&(m.integrity=f.integrity),f.referrerPolicy&&(m.referrerPolicy=f.referrerPolicy),f.crossOrigin==="use-credentials"?m.credentials="include":f.crossOrigin==="anonymous"?m.credentials="omit":m.credentials="same-origin",m}function u(f){if(f.ep)return;f.ep=!0;const m=s(f);fetch(f.href,m)}})();var EPSILON=1e-6,ARRAY_TYPE=typeof Float32Array<"u"?Float32Array:Array;Math.hypot||(Math.hypot=function(){for(var a=0,n=arguments.length;n--;)a+=arguments[n]*arguments[n];return Math.sqrt(a)});function create$4(){var a=new ARRAY_TYPE(9);return ARRAY_TYPE!=Float32Array&&(a[1]=0,a[2]=0,a[3]=0,a[5]=0,a[6]=0,a[7]=0),a[0]=1,a[4]=1,a[8]=1,a}function fromValues$4(a,n,s,u,f,m,A,v,y){var T=new ARRAY_TYPE(9);return T[0]=a,T[1]=n,T[2]=s,T[3]=u,T[4]=f,T[5]=m,T[6]=A,T[7]=v,T[8]=y,T}function multiply$3(a,n,s){var u=n[0],f=n[1],m=n[2],A=n[3],v=n[4],y=n[5],T=n[6],E=n[7],S=n[8],I=s[0],e=s[1],F=s[2],M=s[3],L=s[4],V=s[5],B=s[6],z=s[7],b=s[8];return a[0]=I*u+e*A+F*T,a[1]=I*f+e*v+F*E,a[2]=I*m+e*y+F*S,a[3]=M*u+L*A+V*T,a[4]=M*f+L*v+V*E,a[5]=M*m+L*y+V*S,a[6]=B*u+z*A+b*T,a[7]=B*f+z*v+b*E,a[8]=B*m+z*y+b*S,a}function create$3(){var a=new ARRAY_TYPE(16);return ARRAY_TYPE!=Float32Array&&(a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[11]=0,a[12]=0,a[13]=0,a[14]=0),a[0]=1,a[5]=1,a[10]=1,a[15]=1,a}function clone$3(a){var n=new ARRAY_TYPE(16);return n[0]=a[0],n[1]=a[1],n[2]=a[2],n[3]=a[3],n[4]=a[4],n[5]=a[5],n[6]=a[6],n[7]=a[7],n[8]=a[8],n[9]=a[9],n[10]=a[10],n[11]=a[11],n[12]=a[12],n[13]=a[13],n[14]=a[14],n[15]=a[15],n}function copy$1(a,n){return a[0]=n[0],a[1]=n[1],a[2]=n[2],a[3]=n[3],a[4]=n[4],a[5]=n[5],a[6]=n[6],a[7]=n[7],a[8]=n[8],a[9]=n[9],a[10]=n[10],a[11]=n[11],a[12]=n[12],a[13]=n[13],a[14]=n[14],a[15]=n[15],a}function fromValues$3(a,n,s,u,f,m,A,v,y,T,E,S,I,e,F,M){var L=new ARRAY_TYPE(16);return L[0]=a,L[1]=n,L[2]=s,L[3]=u,L[4]=f,L[5]=m,L[6]=A,L[7]=v,L[8]=y,L[9]=T,L[10]=E,L[11]=S,L[12]=I,L[13]=e,L[14]=F,L[15]=M,L}function identity$2(a){return a[0]=1,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=1,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=1,a[11]=0,a[12]=0,a[13]=0,a[14]=0,a[15]=1,a}function transpose$3(a,n){if(a===n){var s=n[1],u=n[2],f=n[3],m=n[6],A=n[7],v=n[11];a[1]=n[4],a[2]=n[8],a[3]=n[12],a[4]=s,a[6]=n[9],a[7]=n[13],a[8]=u,a[9]=m,a[11]=n[14],a[12]=f,a[13]=A,a[14]=v}else a[0]=n[0],a[1]=n[4],a[2]=n[8],a[3]=n[12],a[4]=n[1],a[5]=n[5],a[6]=n[9],a[7]=n[13],a[8]=n[2],a[9]=n[6],a[10]=n[10],a[11]=n[14],a[12]=n[3],a[13]=n[7],a[14]=n[11],a[15]=n[15];return a}function invert(a,n){var s=n[0],u=n[1],f=n[2],m=n[3],A=n[4],v=n[5],y=n[6],T=n[7],E=n[8],S=n[9],I=n[10],e=n[11],F=n[12],M=n[13],L=n[14],V=n[15],B=s*v-u*A,z=s*y-f*A,b=s*T-m*A,W=u*y-f*v,q=u*T-m*v,Y=f*T-m*y,X=E*M-S*F,Q=E*L-I*F,g=E*V-e*F,J=S*L-I*M,re=S*V-e*M,ae=I*V-e*L,fe=B*ae-z*re+b*J+W*g-q*Q+Y*X;return fe?(fe=1/fe,a[0]=(v*ae-y*re+T*J)*fe,a[1]=(f*re-u*ae-m*J)*fe,a[2]=(M*Y-L*q+V*W)*fe,a[3]=(I*q-S*Y-e*W)*fe,a[4]=(y*g-A*ae-T*Q)*fe,a[5]=(s*ae-f*g+m*Q)*fe,a[6]=(L*b-F*Y-V*z)*fe,a[7]=(E*Y-I*b+e*z)*fe,a[8]=(A*re-v*g+T*X)*fe,a[9]=(u*g-s*re-m*X)*fe,a[10]=(F*q-M*b+V*B)*fe,a[11]=(S*b-E*q-e*B)*fe,a[12]=(v*Q-A*J-y*X)*fe,a[13]=(s*J-u*Q+f*X)*fe,a[14]=(M*z-F*W-L*B)*fe,a[15]=(E*W-S*z+I*B)*fe,a):null}function multiply$2(a,n,s){var u=n[0],f=n[1],m=n[2],A=n[3],v=n[4],y=n[5],T=n[6],E=n[7],S=n[8],I=n[9],e=n[10],F=n[11],M=n[12],L=n[13],V=n[14],B=n[15],z=s[0],b=s[1],W=s[2],q=s[3];return a[0]=z*u+b*v+W*S+q*M,a[1]=z*f+b*y+W*I+q*L,a[2]=z*m+b*T+W*e+q*V,a[3]=z*A+b*E+W*F+q*B,z=s[4],b=s[5],W=s[6],q=s[7],a[4]=z*u+b*v+W*S+q*M,a[5]=z*f+b*y+W*I+q*L,a[6]=z*m+b*T+W*e+q*V,a[7]=z*A+b*E+W*F+q*B,z=s[8],b=s[9],W=s[10],q=s[11],a[8]=z*u+b*v+W*S+q*M,a[9]=z*f+b*y+W*I+q*L,a[10]=z*m+b*T+W*e+q*V,a[11]=z*A+b*E+W*F+q*B,z=s[12],b=s[13],W=s[14],q=s[15],a[12]=z*u+b*v+W*S+q*M,a[13]=z*f+b*y+W*I+q*L,a[14]=z*m+b*T+W*e+q*V,a[15]=z*A+b*E+W*F+q*B,a}function translate(a,n,s){var u=s[0],f=s[1],m=s[2],A,v,y,T,E,S,I,e,F,M,L,V;return n===a?(a[12]=n[0]*u+n[4]*f+n[8]*m+n[12],a[13]=n[1]*u+n[5]*f+n[9]*m+n[13],a[14]=n[2]*u+n[6]*f+n[10]*m+n[14],a[15]=n[3]*u+n[7]*f+n[11]*m+n[15]):(A=n[0],v=n[1],y=n[2],T=n[3],E=n[4],S=n[5],I=n[6],e=n[7],F=n[8],M=n[9],L=n[10],V=n[11],a[0]=A,a[1]=v,a[2]=y,a[3]=T,a[4]=E,a[5]=S,a[6]=I,a[7]=e,a[8]=F,a[9]=M,a[10]=L,a[11]=V,a[12]=A*u+E*f+F*m+n[12],a[13]=v*u+S*f+M*m+n[13],a[14]=y*u+I*f+L*m+n[14],a[15]=T*u+e*f+V*m+n[15]),a}function scale$4(a,n,s){var u=s[0],f=s[1],m=s[2];return a[0]=n[0]*u,a[1]=n[1]*u,a[2]=n[2]*u,a[3]=n[3]*u,a[4]=n[4]*f,a[5]=n[5]*f,a[6]=n[6]*f,a[7]=n[7]*f,a[8]=n[8]*m,a[9]=n[9]*m,a[10]=n[10]*m,a[11]=n[11]*m,a[12]=n[12],a[13]=n[13],a[14]=n[14],a[15]=n[15],a}function rotateX(a,n,s){var u=Math.sin(s),f=Math.cos(s),m=n[4],A=n[5],v=n[6],y=n[7],T=n[8],E=n[9],S=n[10],I=n[11];return n!==a&&(a[0]=n[0],a[1]=n[1],a[2]=n[2],a[3]=n[3],a[12]=n[12],a[13]=n[13],a[14]=n[14],a[15]=n[15]),a[4]=m*f+T*u,a[5]=A*f+E*u,a[6]=v*f+S*u,a[7]=y*f+I*u,a[8]=T*f-m*u,a[9]=E*f-A*u,a[10]=S*f-v*u,a[11]=I*f-y*u,a}function rotateZ(a,n,s){var u=Math.sin(s),f=Math.cos(s),m=n[0],A=n[1],v=n[2],y=n[3],T=n[4],E=n[5],S=n[6],I=n[7];return n!==a&&(a[8]=n[8],a[9]=n[9],a[10]=n[10],a[11]=n[11],a[12]=n[12],a[13]=n[13],a[14]=n[14],a[15]=n[15]),a[0]=m*f+T*u,a[1]=A*f+E*u,a[2]=v*f+S*u,a[3]=y*f+I*u,a[4]=T*f-m*u,a[5]=E*f-A*u,a[6]=S*f-v*u,a[7]=I*f-y*u,a}function fromRotation(a,n,s){var u=s[0],f=s[1],m=s[2],A=Math.hypot(u,f,m),v,y,T;return A0&&(m=1/Math.sqrt(m)),a[0]=n[0]*m,a[1]=n[1]*m,a[2]=n[2]*m,a}function dot$2(a,n){return a[0]*n[0]+a[1]*n[1]+a[2]*n[2]}function cross(a,n,s){var u=n[0],f=n[1],m=n[2],A=s[0],v=s[1],y=s[2];return a[0]=f*y-m*v,a[1]=m*A-u*y,a[2]=u*v-f*A,a}function lerp(a,n,s,u){var f=n[0],m=n[1],A=n[2];return a[0]=f+u*(s[0]-f),a[1]=m+u*(s[1]-m),a[2]=A+u*(s[2]-A),a}function angle(a,n){var s=a[0],u=a[1],f=a[2],m=n[0],A=n[1],v=n[2],y=Math.sqrt(s*s+u*u+f*f),T=Math.sqrt(m*m+A*A+v*v),E=y*T,S=E&&dot$2(a,n)/E;return Math.acos(Math.min(Math.max(S,-1),1))}var sub$4=subtract$1,len=length$1;(function(){var a=create$2();return function(n,s,u,f,m,A){var v,y;for(s||(s=3),u||(u=0),f?y=Math.min(f*s+u,n.length):y=n.length,v=u;v0&&(f=1/Math.sqrt(f)),a[0]=n[0]*f,a[1]=n[1]*f,a}(function(){var a=create();return function(n,s,u,f,m,A){var v,y;for(s||(s=2),u||(u=0),f?y=Math.min(f*s+u,n.length):y=n.length,v=u;v256){for(BUFFER=Array(a=256);a--;)BUFFER[a]=256*Math.random()|0;a=IDX=0}for(;a<16;a++)n=BUFFER[IDX+a],a==6?s+=HEX[n&15|64]:a==8?s+=HEX[n&63|128]:s+=HEX[n],a&1&&a>1&&a<11&&(s+="-");return IDX++,s}var u8$1=Uint8Array,u16$1=Uint16Array,i32$1=Int32Array,fleb$1=new u8$1([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),fdeb$1=new u8$1([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),clim$1=new u8$1([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),freb$1=function(a,n){for(var s=new u16$1(31),u=0;u<31;++u)s[u]=n+=1<>1|(i$1&21845)<<1;x$1=(x$1&52428)>>2|(x$1&13107)<<2,x$1=(x$1&61680)>>4|(x$1&3855)<<4,rev$1[i$1]=((x$1&65280)>>8|(x$1&255)<<8)>>1}var hMap$1=function(a,n,s){for(var u=a.length,f=0,m=new u16$1(n);f>y]=T}else for(v=new u16$1(u),f=0;f>15-a[f]);return v},flt$1=new u8$1(288);for(var i$1=0;i$1<144;++i$1)flt$1[i$1]=8;for(var i$1=144;i$1<256;++i$1)flt$1[i$1]=9;for(var i$1=256;i$1<280;++i$1)flt$1[i$1]=7;for(var i$1=280;i$1<288;++i$1)flt$1[i$1]=8;var fdt$1=new u8$1(32);for(var i$1=0;i$1<32;++i$1)fdt$1[i$1]=5;var flm$1=hMap$1(flt$1,9,0),flrm$1=hMap$1(flt$1,9,1),fdm$1=hMap$1(fdt$1,5,0),fdrm$1=hMap$1(fdt$1,5,1),max$5=function(a){for(var n=a[0],s=1;sn&&(n=a[s]);return n},bits$1=function(a,n,s){var u=n/8|0;return(a[u]|a[u+1]<<8)>>(n&7)&s},bits16$1=function(a,n){var s=n/8|0;return(a[s]|a[s+1]<<8|a[s+2]<<16)>>(n&7)},shft$1=function(a){return(a+7)/8|0},slc$1=function(a,n,s){return(n==null||n<0)&&(n=0),(s==null||s>a.length)&&(s=a.length),new u8$1(a.subarray(n,s))},ec$1=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],err$1=function(a,n,s){var u=new Error(n||ec$1[a]);if(u.code=a,Error.captureStackTrace&&Error.captureStackTrace(u,err$1),!s)throw u;return u},inflt$1=function(a,n,s,u){var f=a.length,m=u?u.length:0;if(!f||n.f&&!n.l)return s||new u8$1(0);var A=!s,v=A||n.i!=2,y=n.i;A&&(s=new u8$1(f*3));var T=function(Et){var Rt=s.length;if(Et>Rt){var Ze=new u8$1(Math.max(Rt*2,Et));Ze.set(s),s=Ze}},E=n.f||0,S=n.p||0,I=n.b||0,e=n.l,F=n.d,M=n.m,L=n.n,V=f*8;do{if(!e){E=bits$1(a,S,1);var B=bits$1(a,S+1,3);if(S+=3,B)if(B==1)e=flrm$1,F=fdrm$1,M=9,L=5;else if(B==2){var q=bits$1(a,S,31)+257,Y=bits$1(a,S+10,15)+4,X=q+bits$1(a,S+5,31)+1;S+=14;for(var Q=new u8$1(X),g=new u8$1(19),J=0;J>4;if(z<16)Q[J++]=z;else{var me=0,Se=0;for(z==16?(Se=3+bits$1(a,S,3),S+=2,me=Q[J-1]):z==17?(Se=3+bits$1(a,S,7),S+=3):z==18&&(Se=11+bits$1(a,S,127),S+=7);Se--;)Q[J++]=me}}var ve=Q.subarray(0,q),we=Q.subarray(q);M=max$5(ve),L=max$5(we),e=hMap$1(ve,M,1),F=hMap$1(we,L,1)}else err$1(1);else{var z=shft$1(S)+4,b=a[z-4]|a[z-3]<<8,W=z+b;if(W>f){y&&err$1(0);break}v&&T(I+b),s.set(a.subarray(z,W),I),n.b=I+=b,n.p=S=W*8,n.f=E;continue}if(S>V){y&&err$1(0);break}}v&&T(I+131072);for(var Ne=(1<>4;if(S+=me&15,S>V){y&&err$1(0);break}if(me||err$1(2),nt<256)s[I++]=nt;else if(nt==256){je=S,e=null;break}else{var Ue=nt-254;if(nt>264){var J=nt-257,ye=fleb$1[J];Ue=bits$1(a,S,(1<>4;ut||err$1(3),S+=ut&15;var we=fd$1[pt];if(pt>3){var ye=fdeb$1[pt];we+=bits16$1(a,S)&(1<V){y&&err$1(0);break}v&&T(I+131072);var It=I+Ue;if(I>8},wbits16$1=function(a,n,s){s<<=n&7;var u=n/8|0;a[u]|=s,a[u+1]|=s>>8,a[u+2]|=s>>16},hTree$1=function(a,n){for(var s=[],u=0;uI&&(I=m[u].s);var e=new u16$1(I+1),F=ln$1(s[E-1],e,0);if(F>n){var u=0,M=0,L=F-n,V=1<n)M+=V-(1<>=L;M>0;){var z=m[u].s;e[z]=0&&M;--u){var b=m[u].s;e[b]==n&&(--e[b],++M)}F=n}return{t:new u8$1(e),l:F}},ln$1=function(a,n,s){return a.s==-1?Math.max(ln$1(a.l,n,s+1),ln$1(a.r,n,s+1)):n[a.s]=s},lc$1=function(a){for(var n=a.length;n&&!a[--n];);for(var s=new u16$1(++n),u=0,f=a[0],m=1,A=function(y){s[u++]=y},v=1;v<=n;++v)if(a[v]==f&&v!=n)++m;else{if(!f&&m>2){for(;m>138;m-=138)A(32754);m>2&&(A(m>10?m-11<<5|28690:m-3<<5|12305),m=0)}else if(m>3){for(A(f),--m;m>6;m-=6)A(8304);m>2&&(A(m-3<<5|8208),m=0)}for(;m--;)A(f);m=1,f=a[v]}return{c:s.subarray(0,u),n}},clen$1=function(a,n){for(var s=0,u=0;u>8,a[f+2]=a[f]^255,a[f+3]=a[f+1]^255;for(var m=0;m4&&!g[clim$1[re-1]];--re);var ae=T+5<<3,fe=clen$1(f,flt$1)+clen$1(m,fdt$1)+A,pe=clen$1(f,I)+clen$1(m,M)+A+14+3*re+clen$1(Y,g)+2*Y[16]+3*Y[17]+7*Y[18];if(y>=0&&ae<=fe&&ae<=pe)return wfblk$1(n,E,a.subarray(y,y+T));var me,Se,ve,we;if(wbits$1(n,E,1+(pe15&&(wbits$1(n,E,nt[X]>>5&127),E+=nt[X]>>12)}}else me=flm$1,Se=flt$1,ve=fdm$1,we=fdt$1;for(var X=0;X255){var Ue=ye>>18&31;wbits16$1(n,E,me[Ue+257]),E+=Se[Ue+257],Ue>7&&(wbits$1(n,E,ye>>23&31),E+=fleb$1[Ue]);var ut=ye&31;wbits16$1(n,E,ve[ut]),E+=we[ut],ut>3&&(wbits16$1(n,E,ye>>5&8191),E+=fdeb$1[ut])}else wbits16$1(n,E,me[ye]),E+=Se[ye]}return wbits16$1(n,E,me[256]),E+Se[256]},deo$1=new i32$1([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),et$1=new u8$1(0),dflt$1=function(a,n,s,u,f,m){var A=m.z||a.length,v=new u8$1(u+A+5*(1+Math.ceil(A/7e3))+f),y=v.subarray(u,v.length-f),T=m.l,E=(m.r||0)&7;if(n){E&&(y[0]=m.r>>3);for(var S=deo$1[n-1],I=S>>13,e=S&8191,F=(1<7e3||g>24576)&&(me>423||!T)){E=wblk$1(a,y,0,b,W,q,X,g,re,Q-re,E),g=Y=X=0,re=Q;for(var Se=0;Se<286;++Se)W[Se]=0;for(var Se=0;Se<30;++Se)q[Se]=0}var ve=2,we=0,Ne=e,De=fe-pe&32767;if(me>2&&ae==z(Q-De))for(var je=Math.min(I,me)-1,nt=Math.min(32767,Q),Ue=Math.min(258,me);De<=nt&&--Ne&&fe!=pe;){if(a[Q+ve]==a[Q+ve-De]){for(var ye=0;yeve){if(ve=ye,we=De,ye>je)break;for(var ut=Math.min(De,ye-2),pt=0,Se=0;Sept&&(pt=Ot,pe=It)}}}fe=pe,pe=M[fe],De+=fe-pe&32767}if(we){b[g++]=268435456|revfl$1[ve]<<18|revfd$1[we];var Et=revfl$1[ve]&31,Rt=revfd$1[we]&31;X+=fleb$1[Et]+fdeb$1[Rt],++W[257+Et],++q[Rt],J=Q+ve,++Y}else b[g++]=a[Q],++W[a[Q]]}}for(Q=Math.max(Q,J);Q=A&&(y[E/8|0]=T,Ze=A),E=wfblk$1(y,E+1,a.subarray(Q,Ze))}m.i=A}return slc$1(v,0,u+shft$1(E)+f)},crct$1=function(){for(var a=new Int32Array(256),n=0;n<256;++n){for(var s=n,u=9;--u;)s=(s&1&&-306674912)^s>>>1;a[n]=s}return a}(),crc$1=function(){var a=-1;return{p:function(n){for(var s=a,u=0;u>>8;a=s},d:function(){return~a}}},dopt$1=function(a,n,s,u,f){if(!f&&(f={l:1},n.dictionary)){var m=n.dictionary.subarray(-32768),A=new u8$1(m.length+a.length);A.set(m),A.set(a,m.length),a=A,f.w=m.length}return dflt$1(a,n.level==null?6:n.level,n.mem==null?f.l?Math.ceil(Math.max(8,Math.min(13,Math.log(a.length)))*1.5):20:12+n.mem,s,u,f)},b2$1=function(a,n){return a[n]|a[n+1]<<8},b4$1=function(a,n){return(a[n]|a[n+1]<<8|a[n+2]<<16|a[n+3]<<24)>>>0},b8$1=function(a,n){return b4$1(a,n)+b4$1(a,n+4)*4294967296},wbytes$1=function(a,n,s){for(;s;++n)a[n]=s,s>>>=8},gzh$1=function(a,n){var s=n.filename;if(a[0]=31,a[1]=139,a[2]=8,a[8]=n.level<2?4:n.level==9?2:0,a[9]=3,n.mtime!=0&&wbytes$1(a,4,Math.floor(new Date(n.mtime||Date.now())/1e3)),s){a[3]=8;for(var u=0;u<=s.length;++u)a[u+10]=s.charCodeAt(u)}},gzs$1=function(a){(a[0]!=31||a[1]!=139||a[2]!=8)&&err$1(6,"invalid gzip data");var n=a[3],s=10;n&4&&(s+=(a[10]|a[11]<<8)+2);for(var u=(n>>3&1)+(n>>4&1);u>0;u-=!a[s++]);return s+(n&2)},gzl$1=function(a){var n=a.length;return(a[n-4]|a[n-3]<<8|a[n-2]<<16|a[n-1]<<24)>>>0},gzhl$1=function(a){return 10+(a.filename?a.filename.length+1:0)},zls$1=function(a,n){return((a[0]&15)!=8||a[0]>>4>7||(a[0]<<8|a[1])%31)&&err$1(6,"invalid zlib data"),(a[1]>>5&1)==+!n&&err$1(6,"invalid zlib data: "+(a[1]&32?"need":"unexpected")+" dictionary"),(a[1]>>3&4)+2};function StrmOpt$1(a,n){return typeof a=="function"&&(n=a,a={}),this.ondata=n,a}var Inflate$1=function(){function a(n,s){typeof n=="function"&&(s=n,n={}),this.ondata=s;var u=n&&n.dictionary&&n.dictionary.subarray(-32768);this.s={i:0,b:u?u.length:0},this.o=new u8$1(32768),this.p=new u8$1(0),u&&this.o.set(u)}return a.prototype.e=function(n){if(this.ondata||err$1(5),this.d&&err$1(4),!this.p.length)this.p=n;else if(n.length){var s=new u8$1(this.p.length+n.length);s.set(this.p),s.set(n,this.p.length),this.p=s}},a.prototype.c=function(n){this.s.i=+(this.d=n||!1);var s=this.s.b,u=inflt$1(this.p,this.s,this.o);this.ondata(slc$1(u,s,this.s.b),this.d),this.o=slc$1(u,this.s.b-32768),this.s.b=this.o.length,this.p=slc$1(this.p,this.s.p/8|0),this.s.p&=7},a.prototype.push=function(n,s){this.e(n),this.c(s)},a}();function inflateSync$1(a,n){return inflt$1(a,{i:2},n&&n.out,n&&n.dictionary)}function gzipSync$1(a,n){n||(n={});var s=crc$1(),u=a.length;s.p(a);var f=dopt$1(a,n,gzhl$1(n),8),m=f.length;return gzh$1(f,n),wbytes$1(f,m-8,s.d()),wbytes$1(f,m-4,u),f}var Gunzip$1=function(){function a(n,s){this.v=1,this.r=0,Inflate$1.call(this,n,s)}return a.prototype.push=function(n,s){if(Inflate$1.prototype.e.call(this,n),this.r+=n.length,this.v){var u=this.p.subarray(this.v-1),f=u.length>3?gzs$1(u):4;if(f>u.length){if(!s)return}else this.v>1&&this.onmember&&this.onmember(this.r-u.length);this.p=u.subarray(f),this.v=0}Inflate$1.prototype.c.call(this,s),this.s.f&&!this.s.l&&!s&&(this.v=shft$1(this.s.p)+9,this.s={i:0},this.o=new u8$1(0),this.push(new u8$1(0),s))},a}();function gunzipSync$1(a,n){var s=gzs$1(a);return s+8>a.length&&err$1(6,"invalid gzip data"),inflt$1(a.subarray(s,-8),{i:2},n&&n.out||new u8$1(gzl$1(a)),n&&n.dictionary)}var Unzlib$1=function(){function a(n,s){Inflate$1.call(this,n,s),this.v=n&&n.dictionary?2:1}return a.prototype.push=function(n,s){if(Inflate$1.prototype.e.call(this,n),this.v){if(this.p.length<6&&!s)return;this.p=this.p.subarray(zls$1(this.p,this.v-1)),this.v=0}s&&(this.p.length<4&&err$1(6,"invalid zlib data"),this.p=this.p.subarray(0,-4)),Inflate$1.prototype.c.call(this,s)},a}();function unzlibSync$1(a,n){return inflt$1(a.subarray(zls$1(a,n&&n.dictionary),-4),{i:2},n&&n.out,n&&n.dictionary)}var Decompress$1=function(){function a(n,s){this.o=StrmOpt$1.call(this,n,s)||{},this.G=Gunzip$1,this.I=Inflate$1,this.Z=Unzlib$1}return a.prototype.i=function(){var n=this;this.s.ondata=function(s,u){n.ondata(s,u)}},a.prototype.push=function(n,s){if(this.ondata||err$1(5),this.s)this.s.push(n,s);else{if(this.p&&this.p.length){var u=new u8$1(this.p.length+n.length);u.set(this.p),u.set(n,this.p.length)}else this.p=n;this.p.length>2&&(this.s=this.p[0]==31&&this.p[1]==139&&this.p[2]==8?new this.G(this.o):(this.p[0]&15)!=8||this.p[0]>>4>7||(this.p[0]<<8|this.p[1])%31?new this.I(this.o):new this.Z(this.o),this.i(),this.s.push(this.p,s),this.p=null)}},a}();function decompressSync$1(a,n){return a[0]==31&&a[1]==139&&a[2]==8?gunzipSync$1(a,n):(a[0]&15)!=8||a[0]>>4>7||(a[0]<<8|a[1])%31?inflateSync$1(a,n):unzlibSync$1(a,n)}var te$1=typeof TextEncoder<"u"&&new TextEncoder,td$1=typeof TextDecoder<"u"&&new TextDecoder,tds$1=0;try{td$1.decode(et$1,{stream:!0}),tds$1=1}catch{}var dutf8$1=function(a){for(var n="",s=0;;){var u=a[s++],f=(u>127)+(u>223)+(u>239);if(s+f>a.length)return{s:n,r:slc$1(a,s-1)};f?f==3?(u=((u&15)<<18|(a[s++]&63)<<12|(a[s++]&63)<<6|a[s++]&63)-65536,n+=String.fromCharCode(55296|u>>10,56320|u&1023)):f&1?n+=String.fromCharCode((u&31)<<6|a[s++]&63):n+=String.fromCharCode((u&15)<<12|(a[s++]&63)<<6|a[s++]&63):n+=String.fromCharCode(u)}};function strToU8$1(a,n){if(n){for(var s=new u8$1(a.length),u=0;u>1)),A=0,v=function(E){m[A++]=E},u=0;um.length){var y=new u8$1(A+8+(f-u<<1));y.set(m),m=y}var T=a.charCodeAt(u);T<128||n?v(T):T<2048?(v(192|T>>6),v(128|T&63)):T>55295&&T<57344?(T=65536+(T&1047552)|a.charCodeAt(++u)&1023,v(240|T>>18),v(128|T>>12&63),v(128|T>>6&63),v(128|T&63)):(v(224|T>>12),v(128|T>>6&63),v(128|T&63))}return slc$1(m,0,A)}function strFromU8$1(a,n){if(n){for(var s="",u=0;u65558)&&err$1(13);var f=b2$1(a,u+8);if(!f)return{};var m=b4$1(a,u+16),A=m==4294967295||f==65535;if(A){var v=b4$1(a,u-12);A=b4$1(a,v)==101075792,A&&(f=b4$1(a,v+32),m=b4$1(a,v+48))}for(var y=n&&n.filter,T=0;T{const s=(f,m)=>(a.set(m,f),f),u=f=>{if(a.has(f))return a.get(f);const[m,A]=n[f];switch(m){case PRIMITIVE:case VOID:return s(A,f);case ARRAY:{const v=s([],f);for(const y of A)v.push(u(y));return v}case OBJECT:{const v=s({},f);for(const[y,T]of A)v[u(y)]=u(T);return v}case DATE:return s(new Date(A),f);case REGEXP:{const{source:v,flags:y}=A;return s(new RegExp(v,y),f)}case MAP:{const v=s(new Map,f);for(const[y,T]of A)v.set(u(y),u(T));return v}case SET:{const v=s(new Set,f);for(const y of A)v.add(u(y));return v}case ERROR:{const{name:v,message:y}=A;return s(new env$1[v](y),f)}case BIGINT:return s(BigInt(A),f);case"BigInt":return s(Object(BigInt(A)),f)}return s(new env$1[m](A),f)};return u},deserialize$1=a=>deserializer(new Map,a)(0),EMPTY="",{toString}={},{keys}=Object,typeOf=a=>{const n=typeof a;if(n!=="object"||!a)return[PRIMITIVE,n];const s=toString.call(a).slice(8,-1);switch(s){case"Array":return[ARRAY,EMPTY];case"Object":return[OBJECT,EMPTY];case"Date":return[DATE,EMPTY];case"RegExp":return[REGEXP,EMPTY];case"Map":return[MAP,EMPTY];case"Set":return[SET,EMPTY]}return s.includes("Array")?[ARRAY,s]:s.includes("Error")?[ERROR,s]:[OBJECT,s]},shouldSkip=([a,n])=>a===PRIMITIVE&&(n==="function"||n==="symbol"),serializer=(a,n,s,u)=>{const f=(A,v)=>{const y=u.push(A)-1;return s.set(v,y),y},m=A=>{if(s.has(A))return s.get(A);let[v,y]=typeOf(A);switch(v){case PRIMITIVE:{let E=A;switch(y){case"bigint":v=BIGINT,E=A.toString();break;case"function":case"symbol":if(a)throw new TypeError("unable to serialize "+y);E=null;break;case"undefined":return f([VOID],A)}return f([v,E],A)}case ARRAY:{if(y)return f([y,[...A]],A);const E=[],S=f([v,E],A);for(const I of A)E.push(m(I));return S}case OBJECT:{if(y)switch(y){case"BigInt":return f([y,A.toString()],A);case"Boolean":case"Number":case"String":return f([y,A.valueOf()],A)}if(n&&"toJSON"in A)return m(A.toJSON());const E=[],S=f([v,E],A);for(const I of keys(A))(a||!shouldSkip(typeOf(A[I])))&&E.push([m(I),m(A[I])]);return S}case DATE:return f([v,A.toISOString()],A);case REGEXP:{const{source:E,flags:S}=A;return f([v,{source:E,flags:S}],A)}case MAP:{const E=[],S=f([v,E],A);for(const[I,e]of A)(a||!(shouldSkip(typeOf(I))||shouldSkip(typeOf(e))))&&E.push([m(I),m(e)]);return S}case SET:{const E=[],S=f([v,E],A);for(const I of A)(a||!shouldSkip(typeOf(I)))&&E.push(m(I));return S}}const{message:T}=A;return f([v,{name:y,message:T}],A)};return m},serialize=(a,{json:n,lossy:s}={})=>{const u=[];return serializer(!(n||s),!!n,new Map,u)(a),u};var commonjsGlobal=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function getDefaultExportFromCjs(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}function getAugmentedNamespace(a){if(a.__esModule)return a;var n=a.default;if(typeof n=="function"){var s=function u(){return this instanceof u?Reflect.construct(n,arguments,this.constructor):n.apply(this,arguments)};s.prototype=n.prototype}else s={};return Object.defineProperty(s,"__esModule",{value:!0}),Object.keys(a).forEach(function(u){var f=Object.getOwnPropertyDescriptor(a,u);Object.defineProperty(s,u,f.get?f:{enumerable:!0,get:function(){return a[u]}})}),s}var arrayEqual=function(n,s){var u=n.length;if(n===s)return!0;if(u!==s.length)return!1;for(var f=0;f>1|(i&21845)<<1;x=(x&52428)>>2|(x&13107)<<2,x=(x&61680)>>4|(x&3855)<<4,rev[i]=((x&65280)>>8|(x&255)<<8)>>1}var hMap=function(a,n,s){for(var u=a.length,f=0,m=new u16(n);f>y]=T}else for(v=new u16(u),f=0;f>15-a[f]);return v},flt=new u8(288);for(var i=0;i<144;++i)flt[i]=8;for(var i=144;i<256;++i)flt[i]=9;for(var i=256;i<280;++i)flt[i]=7;for(var i=280;i<288;++i)flt[i]=8;var fdt=new u8(32);for(var i=0;i<32;++i)fdt[i]=5;var flm=hMap(flt,9,0),flrm=hMap(flt,9,1),fdm=hMap(fdt,5,0),fdrm=hMap(fdt,5,1),max$4=function(a){for(var n=a[0],s=1;sn&&(n=a[s]);return n},bits=function(a,n,s){var u=n/8|0;return(a[u]|a[u+1]<<8)>>(n&7)&s},bits16=function(a,n){var s=n/8|0;return(a[s]|a[s+1]<<8|a[s+2]<<16)>>(n&7)},shft=function(a){return(a+7)/8|0},slc=function(a,n,s){return(n==null||n<0)&&(n=0),(s==null||s>a.length)&&(s=a.length),new u8(a.subarray(n,s))};browser.FlateErrorCode={UnexpectedEOF:0,InvalidBlockType:1,InvalidLengthLiteral:2,InvalidDistance:3,StreamFinished:4,NoStreamHandler:5,InvalidHeader:6,NoCallback:7,InvalidUTF8:8,ExtraFieldTooLong:9,InvalidDate:10,FilenameTooLong:11,StreamFinishing:12,InvalidZipData:13,UnknownCompressionMethod:14};var ec=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],err=function(a,n,s){var u=new Error(n||ec[a]);if(u.code=a,Error.captureStackTrace&&Error.captureStackTrace(u,err),!s)throw u;return u},inflt=function(a,n,s,u){var f=a.length,m=u?u.length:0;if(!f||n.f&&!n.l)return s||new u8(0);var A=!s,v=A||n.i!=2,y=n.i;A&&(s=new u8(f*3));var T=function(Et){var Rt=s.length;if(Et>Rt){var Ze=new u8(Math.max(Rt*2,Et));Ze.set(s),s=Ze}},E=n.f||0,S=n.p||0,I=n.b||0,e=n.l,F=n.d,M=n.m,L=n.n,V=f*8;do{if(!e){E=bits(a,S,1);var B=bits(a,S+1,3);if(S+=3,B)if(B==1)e=flrm,F=fdrm,M=9,L=5;else if(B==2){var q=bits(a,S,31)+257,Y=bits(a,S+10,15)+4,X=q+bits(a,S+5,31)+1;S+=14;for(var Q=new u8(X),g=new u8(19),J=0;J>4;if(z<16)Q[J++]=z;else{var me=0,Se=0;for(z==16?(Se=3+bits(a,S,3),S+=2,me=Q[J-1]):z==17?(Se=3+bits(a,S,7),S+=3):z==18&&(Se=11+bits(a,S,127),S+=7);Se--;)Q[J++]=me}}var ve=Q.subarray(0,q),we=Q.subarray(q);M=max$4(ve),L=max$4(we),e=hMap(ve,M,1),F=hMap(we,L,1)}else err(1);else{var z=shft(S)+4,b=a[z-4]|a[z-3]<<8,W=z+b;if(W>f){y&&err(0);break}v&&T(I+b),s.set(a.subarray(z,W),I),n.b=I+=b,n.p=S=W*8,n.f=E;continue}if(S>V){y&&err(0);break}}v&&T(I+131072);for(var Ne=(1<>4;if(S+=me&15,S>V){y&&err(0);break}if(me||err(2),nt<256)s[I++]=nt;else if(nt==256){je=S,e=null;break}else{var Ue=nt-254;if(nt>264){var J=nt-257,ye=fleb[J];Ue=bits(a,S,(1<>4;ut||err(3),S+=ut&15;var we=fd[pt];if(pt>3){var ye=fdeb[pt];we+=bits16(a,S)&(1<V){y&&err(0);break}v&&T(I+131072);var It=I+Ue;if(I>8},wbits16=function(a,n,s){s<<=n&7;var u=n/8|0;a[u]|=s,a[u+1]|=s>>8,a[u+2]|=s>>16},hTree=function(a,n){for(var s=[],u=0;uI&&(I=m[u].s);var e=new u16(I+1),F=ln(s[E-1],e,0);if(F>n){var u=0,M=0,L=F-n,V=1<n)M+=V-(1<>=L;M>0;){var z=m[u].s;e[z]=0&&M;--u){var b=m[u].s;e[b]==n&&(--e[b],++M)}F=n}return{t:new u8(e),l:F}},ln=function(a,n,s){return a.s==-1?Math.max(ln(a.l,n,s+1),ln(a.r,n,s+1)):n[a.s]=s},lc=function(a){for(var n=a.length;n&&!a[--n];);for(var s=new u16(++n),u=0,f=a[0],m=1,A=function(y){s[u++]=y},v=1;v<=n;++v)if(a[v]==f&&v!=n)++m;else{if(!f&&m>2){for(;m>138;m-=138)A(32754);m>2&&(A(m>10?m-11<<5|28690:m-3<<5|12305),m=0)}else if(m>3){for(A(f),--m;m>6;m-=6)A(8304);m>2&&(A(m-3<<5|8208),m=0)}for(;m--;)A(f);m=1,f=a[v]}return{c:s.subarray(0,u),n}},clen=function(a,n){for(var s=0,u=0;u>8,a[f+2]=a[f]^255,a[f+3]=a[f+1]^255;for(var m=0;m4&&!g[clim[re-1]];--re);var ae=T+5<<3,fe=clen(f,flt)+clen(m,fdt)+A,pe=clen(f,I)+clen(m,M)+A+14+3*re+clen(Y,g)+2*Y[16]+3*Y[17]+7*Y[18];if(y>=0&&ae<=fe&&ae<=pe)return wfblk(n,E,a.subarray(y,y+T));var me,Se,ve,we;if(wbits(n,E,1+(pe15&&(wbits(n,E,nt[X]>>5&127),E+=nt[X]>>12)}}else me=flm,Se=flt,ve=fdm,we=fdt;for(var X=0;X255){var Ue=ye>>18&31;wbits16(n,E,me[Ue+257]),E+=Se[Ue+257],Ue>7&&(wbits(n,E,ye>>23&31),E+=fleb[Ue]);var ut=ye&31;wbits16(n,E,ve[ut]),E+=we[ut],ut>3&&(wbits16(n,E,ye>>5&8191),E+=fdeb[ut])}else wbits16(n,E,me[ye]),E+=Se[ye]}return wbits16(n,E,me[256]),E+Se[256]},deo=new i32([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),et=new u8(0),dflt=function(a,n,s,u,f,m){var A=m.z||a.length,v=new u8(u+A+5*(1+Math.ceil(A/7e3))+f),y=v.subarray(u,v.length-f),T=m.l,E=(m.r||0)&7;if(n){E&&(y[0]=m.r>>3);for(var S=deo[n-1],I=S>>13,e=S&8191,F=(1<7e3||g>24576)&&(me>423||!T)){E=wblk(a,y,0,b,W,q,X,g,re,Q-re,E),g=Y=X=0,re=Q;for(var Se=0;Se<286;++Se)W[Se]=0;for(var Se=0;Se<30;++Se)q[Se]=0}var ve=2,we=0,Ne=e,De=fe-pe&32767;if(me>2&&ae==z(Q-De))for(var je=Math.min(I,me)-1,nt=Math.min(32767,Q),Ue=Math.min(258,me);De<=nt&&--Ne&&fe!=pe;){if(a[Q+ve]==a[Q+ve-De]){for(var ye=0;yeve){if(ve=ye,we=De,ye>je)break;for(var ut=Math.min(De,ye-2),pt=0,Se=0;Sept&&(pt=Ot,pe=It)}}}fe=pe,pe=M[fe],De+=fe-pe&32767}if(we){b[g++]=268435456|revfl[ve]<<18|revfd[we];var Et=revfl[ve]&31,Rt=revfd[we]&31;X+=fleb[Et]+fdeb[Rt],++W[257+Et],++q[Rt],J=Q+ve,++Y}else b[g++]=a[Q],++W[a[Q]]}}for(Q=Math.max(Q,J);Q=A&&(y[E/8|0]=T,Ze=A),E=wfblk(y,E+1,a.subarray(Q,Ze))}m.i=A}return slc(v,0,u+shft(E)+f)},crct=function(){for(var a=new Int32Array(256),n=0;n<256;++n){for(var s=n,u=9;--u;)s=(s&1&&-306674912)^s>>>1;a[n]=s}return a}(),crc=function(){var a=-1;return{p:function(n){for(var s=a,u=0;u>>8;a=s},d:function(){return~a}}},adler=function(){var a=1,n=0;return{p:function(s){for(var u=a,f=n,m=s.length|0,A=0;A!=m;){for(var v=Math.min(A+2655,m);A>16),f=(f&65535)+15*(f>>16)}a=u,n=f},d:function(){return a%=65521,n%=65521,(a&255)<<24|(a&65280)<<8|(n&255)<<8|n>>8}}},dopt=function(a,n,s,u,f){if(!f&&(f={l:1},n.dictionary)){var m=n.dictionary.subarray(-32768),A=new u8(m.length+a.length);A.set(m),A.set(a,m.length),a=A,f.w=m.length}return dflt(a,n.level==null?6:n.level,n.mem==null?f.l?Math.ceil(Math.max(8,Math.min(13,Math.log(a.length)))*1.5):20:12+n.mem,s,u,f)},mrg=function(a,n){var s={};for(var u in a)s[u]=a[u];for(var u in n)s[u]=n[u];return s},wcln=function(a,n,s){for(var u=a(),f=a.toString(),m=f.slice(f.indexOf("[")+1,f.lastIndexOf("]")).replace(/\s+/g,"").split(","),A=0;A>>0},b8=function(a,n){return b4(a,n)+b4(a,n+4)*4294967296},wbytes=function(a,n,s){for(;s;++n)a[n]=s,s>>>=8},gzh=function(a,n){var s=n.filename;if(a[0]=31,a[1]=139,a[2]=8,a[8]=n.level<2?4:n.level==9?2:0,a[9]=3,n.mtime!=0&&wbytes(a,4,Math.floor(new Date(n.mtime||Date.now())/1e3)),s){a[3]=8;for(var u=0;u<=s.length;++u)a[u+10]=s.charCodeAt(u)}},gzs=function(a){(a[0]!=31||a[1]!=139||a[2]!=8)&&err(6,"invalid gzip data");var n=a[3],s=10;n&4&&(s+=(a[10]|a[11]<<8)+2);for(var u=(n>>3&1)+(n>>4&1);u>0;u-=!a[s++]);return s+(n&2)},gzl=function(a){var n=a.length;return(a[n-4]|a[n-3]<<8|a[n-2]<<16|a[n-1]<<24)>>>0},gzhl=function(a){return 10+(a.filename?a.filename.length+1:0)},zlh=function(a,n){var s=n.level,u=s==0?0:s<6?1:s==9?3:2;if(a[0]=120,a[1]=u<<6|(n.dictionary&&32),a[1]|=31-(a[0]<<8|a[1])%31,n.dictionary){var f=adler();f.p(n.dictionary),wbytes(a,2,f.d())}},zls=function(a,n){return((a[0]&15)!=8||a[0]>>4>7||(a[0]<<8|a[1])%31)&&err(6,"invalid zlib data"),(a[1]>>5&1)==+!n&&err(6,"invalid zlib data: "+(a[1]&32?"need":"unexpected")+" dictionary"),(a[1]>>3&4)+2};function StrmOpt(a,n){return typeof a=="function"&&(n=a,a={}),this.ondata=n,a}var Deflate=function(){function a(n,s){if(typeof n=="function"&&(s=n,n={}),this.ondata=s,this.o=n||{},this.s={l:0,i:32768,w:32768,z:32768},this.b=new u8(98304),this.o.dictionary){var u=this.o.dictionary.subarray(-32768);this.b.set(u,32768-u.length),this.s.i=32768-u.length}}return a.prototype.p=function(n,s){this.ondata(dopt(n,this.o,0,0,this.s),s)},a.prototype.push=function(n,s){this.ondata||err(5),this.s.l&&err(4);var u=n.length+this.s.z;if(u>this.b.length){if(u>2*this.b.length-32768){var f=new u8(u&-32768);f.set(this.b.subarray(0,this.s.z)),this.b=f}var m=this.b.length-this.s.z;this.b.set(n.subarray(0,m),this.s.z),this.s.z=this.b.length,this.p(this.b,!1),this.b.set(this.b.subarray(-32768)),this.b.set(n.subarray(m),32768),this.s.z=n.length-m+32768,this.s.i=32766,this.s.w=32768}else this.b.set(n,this.s.z),this.s.z+=n.length;this.s.l=s&1,(this.s.z>this.s.w+8191||s)&&(this.p(this.b,s||!1),this.s.w=this.s.i,this.s.i-=2)},a.prototype.flush=function(){this.ondata||err(5),this.s.l&&err(4),this.p(this.b,!1),this.s.w=this.s.i,this.s.i-=2},a}();browser.Deflate=Deflate;var AsyncDeflate=function(){function a(n,s){astrmify([bDflt,function(){return[astrm,Deflate]}],this,StrmOpt.call(this,n,s),function(u){var f=new Deflate(u.data);onmessage=astrm(f)},6,1)}return a}();browser.AsyncDeflate=AsyncDeflate;function deflate$2(a,n,s){return s||(s=n,n={}),typeof s!="function"&&err(7),cbify(a,n,[bDflt],function(u){return pbf(deflateSync(u.data[0],u.data[1]))},0,s)}browser.deflate=deflate$2;function deflateSync(a,n){return dopt(a,n||{},0,0)}browser.deflateSync=deflateSync;var Inflate=function(){function a(n,s){typeof n=="function"&&(s=n,n={}),this.ondata=s;var u=n&&n.dictionary&&n.dictionary.subarray(-32768);this.s={i:0,b:u?u.length:0},this.o=new u8(32768),this.p=new u8(0),u&&this.o.set(u)}return a.prototype.e=function(n){if(this.ondata||err(5),this.d&&err(4),!this.p.length)this.p=n;else if(n.length){var s=new u8(this.p.length+n.length);s.set(this.p),s.set(n,this.p.length),this.p=s}},a.prototype.c=function(n){this.s.i=+(this.d=n||!1);var s=this.s.b,u=inflt(this.p,this.s,this.o);this.ondata(slc(u,s,this.s.b),this.d),this.o=slc(u,this.s.b-32768),this.s.b=this.o.length,this.p=slc(this.p,this.s.p/8|0),this.s.p&=7},a.prototype.push=function(n,s){this.e(n),this.c(s)},a}();browser.Inflate=Inflate;var AsyncInflate=function(){function a(n,s){astrmify([bInflt,function(){return[astrm,Inflate]}],this,StrmOpt.call(this,n,s),function(u){var f=new Inflate(u.data);onmessage=astrm(f)},7,0)}return a}();browser.AsyncInflate=AsyncInflate;function inflate$2(a,n,s){return s||(s=n,n={}),typeof s!="function"&&err(7),cbify(a,n,[bInflt],function(u){return pbf(inflateSync(u.data[0],gopt(u.data[1])))},1,s)}browser.inflate=inflate$2;function inflateSync(a,n){return inflt(a,{i:2},n&&n.out,n&&n.dictionary)}browser.inflateSync=inflateSync;var Gzip=function(){function a(n,s){this.c=crc(),this.l=0,this.v=1,Deflate.call(this,n,s)}return a.prototype.push=function(n,s){this.c.p(n),this.l+=n.length,Deflate.prototype.push.call(this,n,s)},a.prototype.p=function(n,s){var u=dopt(n,this.o,this.v&&gzhl(this.o),s&&8,this.s);this.v&&(gzh(u,this.o),this.v=0),s&&(wbytes(u,u.length-8,this.c.d()),wbytes(u,u.length-4,this.l)),this.ondata(u,s)},a.prototype.flush=function(){Deflate.prototype.flush.call(this)},a}();browser.Gzip=Gzip;browser.Compress=Gzip;var AsyncGzip=function(){function a(n,s){astrmify([bDflt,gze,function(){return[astrm,Deflate,Gzip]}],this,StrmOpt.call(this,n,s),function(u){var f=new Gzip(u.data);onmessage=astrm(f)},8,1)}return a}();browser.AsyncGzip=AsyncGzip;browser.AsyncCompress=AsyncGzip;function gzip(a,n,s){return s||(s=n,n={}),typeof s!="function"&&err(7),cbify(a,n,[bDflt,gze,function(){return[gzipSync]}],function(u){return pbf(gzipSync(u.data[0],u.data[1]))},2,s)}browser.gzip=gzip;browser.compress=gzip;function gzipSync(a,n){n||(n={});var s=crc(),u=a.length;s.p(a);var f=dopt(a,n,gzhl(n),8),m=f.length;return gzh(f,n),wbytes(f,m-8,s.d()),wbytes(f,m-4,u),f}browser.gzipSync=gzipSync;browser.compressSync=gzipSync;var Gunzip=function(){function a(n,s){this.v=1,this.r=0,Inflate.call(this,n,s)}return a.prototype.push=function(n,s){if(Inflate.prototype.e.call(this,n),this.r+=n.length,this.v){var u=this.p.subarray(this.v-1),f=u.length>3?gzs(u):4;if(f>u.length){if(!s)return}else this.v>1&&this.onmember&&this.onmember(this.r-u.length);this.p=u.subarray(f),this.v=0}Inflate.prototype.c.call(this,s),this.s.f&&!this.s.l&&!s&&(this.v=shft(this.s.p)+9,this.s={i:0},this.o=new u8(0),this.push(new u8(0),s))},a}();browser.Gunzip=Gunzip;var AsyncGunzip=function(){function a(n,s){var u=this;astrmify([bInflt,guze,function(){return[astrm,Inflate,Gunzip]}],this,StrmOpt.call(this,n,s),function(f){var m=new Gunzip(f.data);m.onmember=function(A){return postMessage(A)},onmessage=astrm(m)},9,0,function(f){return u.onmember&&u.onmember(f)})}return a}();browser.AsyncGunzip=AsyncGunzip;function gunzip(a,n,s){return s||(s=n,n={}),typeof s!="function"&&err(7),cbify(a,n,[bInflt,guze,function(){return[gunzipSync]}],function(u){return pbf(gunzipSync(u.data[0],u.data[1]))},3,s)}browser.gunzip=gunzip;function gunzipSync(a,n){var s=gzs(a);return s+8>a.length&&err(6,"invalid gzip data"),inflt(a.subarray(s,-8),{i:2},n&&n.out||new u8(gzl(a)),n&&n.dictionary)}browser.gunzipSync=gunzipSync;var Zlib=function(){function a(n,s){this.c=adler(),this.v=1,Deflate.call(this,n,s)}return a.prototype.push=function(n,s){this.c.p(n),Deflate.prototype.push.call(this,n,s)},a.prototype.p=function(n,s){var u=dopt(n,this.o,this.v&&(this.o.dictionary?6:2),s&&4,this.s);this.v&&(zlh(u,this.o),this.v=0),s&&wbytes(u,u.length-4,this.c.d()),this.ondata(u,s)},a.prototype.flush=function(){Deflate.prototype.flush.call(this)},a}();browser.Zlib=Zlib;var AsyncZlib=function(){function a(n,s){astrmify([bDflt,zle,function(){return[astrm,Deflate,Zlib]}],this,StrmOpt.call(this,n,s),function(u){var f=new Zlib(u.data);onmessage=astrm(f)},10,1)}return a}();browser.AsyncZlib=AsyncZlib;function zlib(a,n,s){return s||(s=n,n={}),typeof s!="function"&&err(7),cbify(a,n,[bDflt,zle,function(){return[zlibSync]}],function(u){return pbf(zlibSync(u.data[0],u.data[1]))},4,s)}browser.zlib=zlib;function zlibSync(a,n){n||(n={});var s=adler();s.p(a);var u=dopt(a,n,n.dictionary?6:2,4);return zlh(u,n),wbytes(u,u.length-4,s.d()),u}browser.zlibSync=zlibSync;var Unzlib=function(){function a(n,s){Inflate.call(this,n,s),this.v=n&&n.dictionary?2:1}return a.prototype.push=function(n,s){if(Inflate.prototype.e.call(this,n),this.v){if(this.p.length<6&&!s)return;this.p=this.p.subarray(zls(this.p,this.v-1)),this.v=0}s&&(this.p.length<4&&err(6,"invalid zlib data"),this.p=this.p.subarray(0,-4)),Inflate.prototype.c.call(this,s)},a}();browser.Unzlib=Unzlib;var AsyncUnzlib=function(){function a(n,s){astrmify([bInflt,zule,function(){return[astrm,Inflate,Unzlib]}],this,StrmOpt.call(this,n,s),function(u){var f=new Unzlib(u.data);onmessage=astrm(f)},11,0)}return a}();browser.AsyncUnzlib=AsyncUnzlib;function unzlib(a,n,s){return s||(s=n,n={}),typeof s!="function"&&err(7),cbify(a,n,[bInflt,zule,function(){return[unzlibSync]}],function(u){return pbf(unzlibSync(u.data[0],gopt(u.data[1])))},5,s)}browser.unzlib=unzlib;function unzlibSync(a,n){return inflt(a.subarray(zls(a,n&&n.dictionary),-4),{i:2},n&&n.out,n&&n.dictionary)}browser.unzlibSync=unzlibSync;var Decompress=function(){function a(n,s){this.o=StrmOpt.call(this,n,s)||{},this.G=Gunzip,this.I=Inflate,this.Z=Unzlib}return a.prototype.i=function(){var n=this;this.s.ondata=function(s,u){n.ondata(s,u)}},a.prototype.push=function(n,s){if(this.ondata||err(5),this.s)this.s.push(n,s);else{if(this.p&&this.p.length){var u=new u8(this.p.length+n.length);u.set(this.p),u.set(n,this.p.length)}else this.p=n;this.p.length>2&&(this.s=this.p[0]==31&&this.p[1]==139&&this.p[2]==8?new this.G(this.o):(this.p[0]&15)!=8||this.p[0]>>4>7||(this.p[0]<<8|this.p[1])%31?new this.I(this.o):new this.Z(this.o),this.i(),this.s.push(this.p,s),this.p=null)}},a}();browser.Decompress=Decompress;var AsyncDecompress=function(){function a(n,s){Decompress.call(this,n,s),this.queuedSize=0,this.G=AsyncGunzip,this.I=AsyncInflate,this.Z=AsyncUnzlib}return a.prototype.i=function(){var n=this;this.s.ondata=function(s,u,f){n.ondata(s,u,f)},this.s.ondrain=function(s){n.queuedSize-=s,n.ondrain&&n.ondrain(s)}},a.prototype.push=function(n,s){this.queuedSize+=n.length,Decompress.prototype.push.call(this,n,s)},a}();browser.AsyncDecompress=AsyncDecompress;function decompress(a,n,s){return s||(s=n,n={}),typeof s!="function"&&err(7),a[0]==31&&a[1]==139&&a[2]==8?gunzip(a,n,s):(a[0]&15)!=8||a[0]>>4>7||(a[0]<<8|a[1])%31?inflate$2(a,n,s):unzlib(a,n,s)}browser.decompress=decompress;function decompressSync(a,n){return a[0]==31&&a[1]==139&&a[2]==8?gunzipSync(a,n):(a[0]&15)!=8||a[0]>>4>7||(a[0]<<8|a[1])%31?inflateSync(a,n):unzlibSync(a,n)}browser.decompressSync=decompressSync;var fltn=function(a,n,s,u){for(var f in a){var m=a[f],A=n+f,v=u;Array.isArray(m)&&(v=mrg(u,m[1]),m=m[0]),m instanceof u8?s[A]=[m,v]:(s[A+="/"]=[new u8(0),v],fltn(m,A,s,u))}},te=typeof TextEncoder<"u"&&new TextEncoder,td=typeof TextDecoder<"u"&&new TextDecoder,tds=0;try{td.decode(et,{stream:!0}),tds=1}catch{}var dutf8=function(a){for(var n="",s=0;;){var u=a[s++],f=(u>127)+(u>223)+(u>239);if(s+f>a.length)return{s:n,r:slc(a,s-1)};f?f==3?(u=((u&15)<<18|(a[s++]&63)<<12|(a[s++]&63)<<6|a[s++]&63)-65536,n+=String.fromCharCode(55296|u>>10,56320|u&1023)):f&1?n+=String.fromCharCode((u&31)<<6|a[s++]&63):n+=String.fromCharCode((u&15)<<12|(a[s++]&63)<<6|a[s++]&63):n+=String.fromCharCode(u)}},DecodeUTF8=function(){function a(n){this.ondata=n,tds?this.t=new TextDecoder:this.p=et}return a.prototype.push=function(n,s){if(this.ondata||err(5),s=!!s,this.t){this.ondata(this.t.decode(n,{stream:!0}),s),s&&(this.t.decode().length&&err(8),this.t=null);return}this.p||err(4);var u=new u8(this.p.length+n.length);u.set(this.p),u.set(n,this.p.length);var f=dutf8(u),m=f.s,A=f.r;s?(A.length&&err(8),this.p=null):this.p=A,this.ondata(m,s)},a}();browser.DecodeUTF8=DecodeUTF8;var EncodeUTF8=function(){function a(n){this.ondata=n}return a.prototype.push=function(n,s){this.ondata||err(5),this.d&&err(4),this.ondata(strToU8(n),this.d=s||!1)},a}();browser.EncodeUTF8=EncodeUTF8;function strToU8(a,n){if(n){for(var s=new u8(a.length),u=0;u>1)),A=0,v=function(E){m[A++]=E},u=0;um.length){var y=new u8(A+8+(f-u<<1));y.set(m),m=y}var T=a.charCodeAt(u);T<128||n?v(T):T<2048?(v(192|T>>6),v(128|T&63)):T>55295&&T<57344?(T=65536+(T&1047552)|a.charCodeAt(++u)&1023,v(240|T>>18),v(128|T>>12&63),v(128|T>>6&63),v(128|T&63)):(v(224|T>>12),v(128|T>>6&63),v(128|T&63))}return slc(m,0,A)}browser.strToU8=strToU8;function strFromU8(a,n){if(n){for(var s="",u=0;u65535&&err(9),n+=u+4}return n},wzh=function(a,n,s,u,f,m,A,v){var y=u.length,T=s.extra,E=v&&v.length,S=exfl(T);wbytes(a,n,A!=null?33639248:67324752),n+=4,A!=null&&(a[n++]=20,a[n++]=s.os),a[n]=20,n+=2,a[n++]=s.flag<<1|(m<0&&8),a[n++]=f&&8,a[n++]=s.compression&255,a[n++]=s.compression>>8;var I=new Date(s.mtime==null?Date.now():s.mtime),e=I.getFullYear()-1980;if((e<0||e>119)&&err(10),wbytes(a,n,e<<25|I.getMonth()+1<<21|I.getDate()<<16|I.getHours()<<11|I.getMinutes()<<5|I.getSeconds()>>1),n+=4,m!=-1&&(wbytes(a,n,s.crc),wbytes(a,n+4,m<0?-m-2:m),wbytes(a,n+8,s.size)),wbytes(a,n+12,y),wbytes(a,n+14,S),n+=16,A!=null&&(wbytes(a,n,E),wbytes(a,n+6,s.attrs),wbytes(a,n+10,A),n+=14),a.set(u,n),n+=y,S)for(var F in T){var M=T[F],L=M.length;wbytes(a,n,+F),wbytes(a,n+2,L),a.set(M,n+4),n+=4+L}return E&&(a.set(v,n),n+=E),n},wzf=function(a,n,s,u,f){wbytes(a,n,101010256),wbytes(a,n+8,s),wbytes(a,n+10,s),wbytes(a,n+12,u),wbytes(a,n+16,f)},ZipPassThrough=function(){function a(n){this.filename=n,this.c=crc(),this.size=0,this.compression=0}return a.prototype.process=function(n,s){this.ondata(null,n,s)},a.prototype.push=function(n,s){this.ondata||err(5),this.c.p(n),this.size+=n.length,s&&(this.crc=this.c.d()),this.process(n,s||!1)},a}();browser.ZipPassThrough=ZipPassThrough;var ZipDeflate=function(){function a(n,s){var u=this;s||(s={}),ZipPassThrough.call(this,n),this.d=new Deflate(s,function(f,m){u.ondata(null,f,m)}),this.compression=8,this.flag=dbf(s.level)}return a.prototype.process=function(n,s){try{this.d.push(n,s)}catch(u){this.ondata(u,null,s)}},a.prototype.push=function(n,s){ZipPassThrough.prototype.push.call(this,n,s)},a}();browser.ZipDeflate=ZipDeflate;var AsyncZipDeflate=function(){function a(n,s){var u=this;s||(s={}),ZipPassThrough.call(this,n),this.d=new AsyncDeflate(s,function(f,m,A){u.ondata(f,m,A)}),this.compression=8,this.flag=dbf(s.level),this.terminate=this.d.terminate}return a.prototype.process=function(n,s){this.d.push(n,s)},a.prototype.push=function(n,s){ZipPassThrough.prototype.push.call(this,n,s)},a}();browser.AsyncZipDeflate=AsyncZipDeflate;var Zip=function(){function a(n){this.ondata=n,this.u=[],this.d=1}return a.prototype.add=function(n){var s=this;if(this.ondata||err(5),this.d&2)this.ondata(err(4+(this.d&1)*8,0,1),null,!1);else{var u=strToU8(n.filename),f=u.length,m=n.comment,A=m&&strToU8(m),v=f!=n.filename.length||A&&m.length!=A.length,y=f+exfl(n.extra)+30;f>65535&&this.ondata(err(11,0,1),null,!1);var T=new u8(y);wzh(T,0,n,u,v,-1);var E=[T],S=function(){for(var L=0,V=E;L65535&&fe(err(11,0,1),null),!ae)fe(null,z);else if(q<16e4)try{fe(null,deflateSync(z,b))}catch(pe){fe(pe,null)}else E.push(deflate$2(z,b,fe))},M=0;M65535&&err(11);var V=E?deflateSync(y,T):y,B=V.length,z=crc();z.p(y),u.push(mrg(T,{size:y.length,crc:z.d(),c:V,f:S,m:F,u:I!=A.length||F&&e.length!=M,o:f,compression:E})),f+=30+I+L+B,m+=76+2*(I+L)+(M||0)+B}for(var b=new u8(m+22),W=f,q=m-f,Y=0;Y0){var f=Math.min(this.c,n.length),m=n.subarray(0,f);if(this.c-=f,this.d?this.d.push(m,!this.c):this.k[0].push(m),n=n.subarray(f),n.length)return this.push(n,s)}else{var A=0,v=0,y=void 0,T=void 0;this.p.length?n.length?(T=new u8(this.p.length+n.length),T.set(this.p),T.set(n,this.p.length)):T=this.p:T=n;for(var E=T.length,S=this.c,I=S&&this.d,e=function(){var V,B=b4(T,v);if(B==67324752){A=1,y=v,F.d=null,F.c=0;var z=b2(T,v+6),b=b2(T,v+8),W=z&2048,q=z&8,Y=b2(T,v+26),X=b2(T,v+28);if(E>v+30+Y+X){var Q=[];F.k.unshift(Q),A=2;var g=b4(T,v+18),J=b4(T,v+22),re=strFromU8(T.subarray(v+30,v+=30+Y),!W);g==4294967295?(V=q?[-2]:z64e(T,v),g=V[0],J=V[1]):q&&(g=-1),v+=X,F.c=g;var ae,fe={name:re,compression:b,start:function(){if(fe.ondata||err(5),!g)fe.ondata(null,et,!0);else{var pe=u.o[b];pe||fe.ondata(err(14,"unknown compression type "+b,1),null,!1),ae=g<0?new pe(re):new pe(re,g,J),ae.ondata=function(we,Ne,De){fe.ondata(we,Ne,De)};for(var me=0,Se=Q;me=0&&(fe.size=g,fe.originalSize=J),F.onfile(fe)}return"break"}else if(S){if(B==134695760)return y=v+=12+(S==-2&&8),A=3,F.c=0,"break";if(B==33639248)return y=v-=4,A=3,F.c=0,"break"}},F=this;v65558)return A(err(13,0,1),null),f;var y=b2(a,v+8);if(y){var T=y,E=b4(a,v+16),S=E==4294967295||T==65535;if(S){var I=b4(a,v-12);S=b4(a,I)==101075792,S&&(T=y=b4(a,I+32),E=b4(a,I+48))}for(var e=n&&n.filter,F=function(L){var V=zh(a,E,S),B=V[0],z=V[1],b=V[2],W=V[3],q=V[4],Y=V[5],X=slzh(a,Y);E=q;var Q=function(J,re){J?(f(),A(J,null)):(re&&(m[W]=re),--y||A(null,m))};if(!e||e({name:W,size:z,originalSize:b,compression:B}))if(!B)Q(null,slc(a,X,X+z));else if(B==8){var g=a.subarray(X,X+z);if(b<524288||z>.8*b)try{Q(null,inflateSync(g,{out:new u8(b)}))}catch(J){Q(J,null)}else u.push(inflate$2(g,{size:b},Q))}else Q(err(14,"unknown compression type "+B,1),null);else Q(null,null)},M=0;M65558)&&err(13);var f=b2(a,u+8);if(!f)return{};var m=b4(a,u+16),A=m==4294967295||f==65535;if(A){var v=b4(a,u-12);A=b4(a,v)==101075792,A&&(f=b4(a,v+32),m=b4(a,v+48))}for(var y=n&&n.filter,T=0;T=0;f--)A=A*256+m[f];return A}static getExtensionsAt(n,s,u,f){let m=[],A=s;for(;Af&&(v=!v,y=J0.getIntAt(n,A,v),y+A>f))throw new Error("This does not appear to be a valid NIFTI extension");if(y%16!=0)throw new Error("This does not appear to be a NIFTI extension");let T=J0.getIntAt(n,A+4,v),E=n.buffer.slice(A+8,A+y);console.log("extensionByteIndex: "+(A+8)+" esize: "+y),console.log(E);let S=new nifti_extension_1.NIFTIEXTENSION(y,T,E,v);m.push(S),A+=y}return m}static toArrayBuffer(n){var s,u,f;for(s=new ArrayBuffer(n.length),u=new Uint8Array(s),f=0;f>>1:n>>>1;s[u]=n}return s}static crc32(n){J0.crcTable||(J0.crcTable=J0.makeCRCTable());const s=J0.crcTable;let u=-1;for(var f=0;f>>8^s[(u^n.getUint8(f))&255];return(u^-1)>>>0}};ct(J0,"crcTable",null),ct(J0,"GUNZIP_MAGIC_COOKIE1",31),ct(J0,"GUNZIP_MAGIC_COOKIE2",139),ct(J0,"getByteAt",function(n,s){return n.getInt8(s)}),ct(J0,"getShortAt",function(n,s,u){return n.getInt16(s,u)});let Utils=J0;utilities$1.Utils=Utils;Object.defineProperty(nifti1,"__esModule",{value:!0});nifti1.NIFTI1=void 0;const utilities_1$1=utilities$1,Ht=class Ht{constructor(){ct(this,"littleEndian",!1);ct(this,"dim_info",0);ct(this,"dims",[]);ct(this,"intent_p1",0);ct(this,"intent_p2",0);ct(this,"intent_p3",0);ct(this,"intent_code",0);ct(this,"datatypeCode",0);ct(this,"numBitsPerVoxel",0);ct(this,"slice_start",0);ct(this,"slice_end",0);ct(this,"slice_code",0);ct(this,"pixDims",[]);ct(this,"vox_offset",0);ct(this,"scl_slope",1);ct(this,"scl_inter",0);ct(this,"xyzt_units",0);ct(this,"cal_max",0);ct(this,"cal_min",0);ct(this,"slice_duration",0);ct(this,"toffset",0);ct(this,"description","");ct(this,"aux_file","");ct(this,"intent_name","");ct(this,"qform_code",0);ct(this,"sform_code",0);ct(this,"quatern_a",0);ct(this,"quatern_b",0);ct(this,"quatern_c",0);ct(this,"quatern_d",0);ct(this,"qoffset_x",0);ct(this,"qoffset_y",0);ct(this,"qoffset_z",0);ct(this,"affine",[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]]);ct(this,"qfac",1);ct(this,"quatern_R");ct(this,"magic","0");ct(this,"isHDR",!1);ct(this,"extensionFlag",[0,0,0,0]);ct(this,"extensionSize",0);ct(this,"extensionCode",0);ct(this,"extensions",[]);ct(this,"getDatatypeCodeString",function(n){return n===Ht.TYPE_UINT8?"1-Byte Unsigned Integer":n===Ht.TYPE_INT16?"2-Byte Signed Integer":n===Ht.TYPE_INT32?"4-Byte Signed Integer":n===Ht.TYPE_FLOAT32?"4-Byte Float":n===Ht.TYPE_FLOAT64?"8-Byte Float":n===Ht.TYPE_RGB24?"RGB":n===Ht.TYPE_INT8?"1-Byte Signed Integer":n===Ht.TYPE_UINT16?"2-Byte Unsigned Integer":n===Ht.TYPE_UINT32?"4-Byte Unsigned Integer":n===Ht.TYPE_INT64?"8-Byte Signed Integer":n===Ht.TYPE_UINT64?"8-Byte Unsigned Integer":"Unknown"});ct(this,"getTransformCodeString",function(n){return n===Ht.XFORM_SCANNER_ANAT?"Scanner":n===Ht.XFORM_ALIGNED_ANAT?"Aligned":n===Ht.XFORM_TALAIRACH?"Talairach":n===Ht.XFORM_MNI_152?"MNI":"Unknown"});ct(this,"getUnitsCodeString",function(n){return n===Ht.UNITS_METER?"Meters":n===Ht.UNITS_MM?"Millimeters":n===Ht.UNITS_MICRON?"Microns":n===Ht.UNITS_SEC?"Seconds":n===Ht.UNITS_MSEC?"Milliseconds":n===Ht.UNITS_USEC?"Microseconds":n===Ht.UNITS_HZ?"Hz":n===Ht.UNITS_PPM?"PPM":n===Ht.UNITS_RADS?"Rads":"Unknown"});ct(this,"nifti_mat33_mul",function(n,s){var u=[[0,0,0],[0,0,0],[0,0,0]],f,m;for(f=0;f<3;f+=1)for(m=0;m<3;m+=1)u[f][m]=n[f][0]*s[0][m]+n[f][1]*s[1][m]+n[f][2]*s[2][m];return u});ct(this,"nifti_mat33_determ",function(n){var s,u,f,m,A,v,y,T,E;return s=n[0][0],u=n[0][1],f=n[0][2],m=n[1][0],A=n[1][1],v=n[1][2],y=n[2][0],T=n[2][1],E=n[2][2],s*A*E-s*T*v-m*u*E+m*T*f+y*u*v-y*A*f})}readHeader(n){var s=new DataView(n),u=utilities_1$1.Utils.getIntAt(s,0,this.littleEndian),f,m,A,v;if(u!==Ht.MAGIC_COOKIE&&(this.littleEndian=!0,u=utilities_1$1.Utils.getIntAt(s,0,this.littleEndian)),u!==Ht.MAGIC_COOKIE)throw new Error("This does not appear to be a NIFTI file!");for(this.dim_info=utilities_1$1.Utils.getByteAt(s,39),f=0;f<8;f+=1)v=40+f*2,this.dims[f]=utilities_1$1.Utils.getShortAt(s,v,this.littleEndian);for(this.intent_p1=utilities_1$1.Utils.getFloatAt(s,56,this.littleEndian),this.intent_p2=utilities_1$1.Utils.getFloatAt(s,60,this.littleEndian),this.intent_p3=utilities_1$1.Utils.getFloatAt(s,64,this.littleEndian),this.intent_code=utilities_1$1.Utils.getShortAt(s,68,this.littleEndian),this.datatypeCode=utilities_1$1.Utils.getShortAt(s,70,this.littleEndian),this.numBitsPerVoxel=utilities_1$1.Utils.getShortAt(s,72,this.littleEndian),this.slice_start=utilities_1$1.Utils.getShortAt(s,74,this.littleEndian),f=0;f<8;f+=1)v=76+f*4,this.pixDims[f]=utilities_1$1.Utils.getFloatAt(s,v,this.littleEndian);if(this.vox_offset=utilities_1$1.Utils.getFloatAt(s,108,this.littleEndian),this.scl_slope=utilities_1$1.Utils.getFloatAt(s,112,this.littleEndian),this.scl_inter=utilities_1$1.Utils.getFloatAt(s,116,this.littleEndian),this.slice_end=utilities_1$1.Utils.getShortAt(s,120,this.littleEndian),this.slice_code=utilities_1$1.Utils.getByteAt(s,122),this.xyzt_units=utilities_1$1.Utils.getByteAt(s,123),this.cal_max=utilities_1$1.Utils.getFloatAt(s,124,this.littleEndian),this.cal_min=utilities_1$1.Utils.getFloatAt(s,128,this.littleEndian),this.slice_duration=utilities_1$1.Utils.getFloatAt(s,132,this.littleEndian),this.toffset=utilities_1$1.Utils.getFloatAt(s,136,this.littleEndian),this.description=utilities_1$1.Utils.getStringAt(s,148,228),this.aux_file=utilities_1$1.Utils.getStringAt(s,228,252),this.qform_code=utilities_1$1.Utils.getShortAt(s,252,this.littleEndian),this.sform_code=utilities_1$1.Utils.getShortAt(s,254,this.littleEndian),this.quatern_b=utilities_1$1.Utils.getFloatAt(s,256,this.littleEndian),this.quatern_c=utilities_1$1.Utils.getFloatAt(s,260,this.littleEndian),this.quatern_d=utilities_1$1.Utils.getFloatAt(s,264,this.littleEndian),this.quatern_a=Math.sqrt(1-(Math.pow(this.quatern_b,2)+Math.pow(this.quatern_c,2)+Math.pow(this.quatern_d,2))),this.qoffset_x=utilities_1$1.Utils.getFloatAt(s,268,this.littleEndian),this.qoffset_y=utilities_1$1.Utils.getFloatAt(s,272,this.littleEndian),this.qoffset_z=utilities_1$1.Utils.getFloatAt(s,276,this.littleEndian),this.qform_code<1&&this.sform_code<1&&(this.affine[0][0]=this.pixDims[1],this.affine[1][1]=this.pixDims[2],this.affine[2][2]=this.pixDims[3]),this.qform_code>0&&this.sform_code0)for(m=0;m<3;m+=1)for(A=0;A<4;A+=1)v=280+(m*4+A)*4,this.affine[m][A]=utilities_1$1.Utils.getFloatAt(s,v,this.littleEndian);if(this.affine[3][0]=0,this.affine[3][1]=0,this.affine[3][2]=0,this.affine[3][3]=1,this.intent_name=utilities_1$1.Utils.getStringAt(s,328,344),this.magic=utilities_1$1.Utils.getStringAt(s,344,348),this.isHDR=this.magic===String.fromCharCode.apply(null,Ht.MAGIC_NUMBER2),s.byteLength>Ht.MAGIC_COOKIE){this.extensionFlag[0]=utilities_1$1.Utils.getByteAt(s,348),this.extensionFlag[1]=utilities_1$1.Utils.getByteAt(s,349),this.extensionFlag[2]=utilities_1$1.Utils.getByteAt(s,350),this.extensionFlag[3]=utilities_1$1.Utils.getByteAt(s,351);let y=!0;!this.isHDR&&this.vox_offset<=352&&(y=!1),s.byteLength<=368&&(y=!1),y&&this.extensionFlag[0]&&(this.extensions=utilities_1$1.Utils.getExtensionsAt(s,this.getExtensionLocation(),this.littleEndian,this.vox_offset),this.extensionSize=this.extensions[0].esize,this.extensionCode=this.extensions[0].ecode)}}toFormattedString(){var n=utilities_1$1.Utils.formatNumber,s="";return s+="Dim Info = "+this.dim_info+` `,s+="Image Dimensions (1-8): "+this.dims[0]+", "+this.dims[1]+", "+this.dims[2]+", "+this.dims[3]+", "+this.dims[4]+", "+this.dims[5]+", "+this.dims[6]+", "+this.dims[7]+` `,s+="Intent Parameters (1-3): "+this.intent_p1+", "+this.intent_p2+", "+this.intent_p3+` `,s+="Intent Code = "+this.intent_code+` @@ -25,7 +25,7 @@ var tA=Object.defineProperty;var iA=(a,n,s)=>n in a?tA(a,n,{enumerable:!0,config `,s+="S-Form Parameters Z: "+n(this.affine[2][0])+", "+n(this.affine[2][1])+", "+n(this.affine[2][2])+", "+n(this.affine[2][3])+` `,s+='Intent Name: "'+this.intent_name+`" `,this.extensionFlag[0]&&(s+="Extension: Size = "+this.extensionSize+" Code = "+this.extensionCode+` -`),s}getQformMat(){return this.convertNiftiQFormToNiftiSForm(this.quatern_b,this.quatern_c,this.quatern_d,this.qoffset_x,this.qoffset_y,this.qoffset_z,this.pixDims[1],this.pixDims[2],this.pixDims[3],this.pixDims[0])}convertNiftiQFormToNiftiSForm(n,s,u,f,m,A,v,y,T,E){var S=[[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0]],I,e=n,F=s,M=u,L,V,B;return S[3][0]=S[3][1]=S[3][2]=0,S[3][3]=1,I=1-(e*e+F*F+M*M),I<1e-7?(I=1/Math.sqrt(e*e+F*F+M*M),e*=I,F*=I,M*=I,I=0):I=Math.sqrt(I),L=v>0?v:1,V=y>0?y:1,B=T>0?T:1,E<0&&(B=-B),S[0][0]=(I*I+e*e-F*F-M*M)*L,S[0][1]=2*(e*F-I*M)*V,S[0][2]=2*(e*M+I*F)*B,S[1][0]=2*(e*F+I*M)*L,S[1][1]=(I*I+F*F-e*e-M*M)*V,S[1][2]=2*(F*M-I*e)*B,S[2][0]=2*(e*M-I*F)*L,S[2][1]=2*(F*M+I*e)*V,S[2][2]=(I*I+M*M-F*F-e*e)*B,S[0][3]=f,S[1][3]=m,S[2][3]=A,S}convertNiftiSFormToNEMA(n){var s,u,f,m,A,v,y,T,E,S,I,e,F,M,L,V,B,z,b,W,q,Y,X,H,g,J,re,ae,fe,pe,me,Se,ve,we;if(L=0,re=[[0,0,0],[0,0,0],[0,0,0]],ae=[[0,0,0],[0,0,0],[0,0,0]],s=n[0][0],u=n[0][1],f=n[0][2],m=n[1][0],A=n[1][1],v=n[1][2],y=n[2][0],T=n[2][1],E=n[2][2],S=Math.sqrt(s*s+m*m+y*y),S===0||(s/=S,m/=S,y/=S,S=Math.sqrt(u*u+A*A+T*T),S===0))return null;if(u/=S,A/=S,T/=S,S=s*u+m*A+y*T,Math.abs(S)>1e-4){if(u-=S*s,A-=S*m,T-=S*y,S=Math.sqrt(u*u+A*A+T*T),S===0)return null;u/=S,A/=S,T/=S}if(S=Math.sqrt(f*f+v*v+E*E),S===0?(f=m*T-y*A,v=y*u-T*s,E=s*A-m*u):(f/=S,v/=S,E/=S),S=s*f+m*v+y*E,Math.abs(S)>1e-4){if(f-=S*s,v-=S*m,E-=S*y,S=Math.sqrt(f*f+v*v+E*E),S===0)return null;f/=S,v/=S,E/=S}if(S=u*f+A*v+T*E,Math.abs(S)>1e-4){if(f-=S*u,v-=S*A,E-=S*T,S=Math.sqrt(f*f+v*v+E*E),S===0)return null;f/=S,v/=S,E/=S}if(re[0][0]=s,re[0][1]=u,re[0][2]=f,re[1][0]=m,re[1][1]=A,re[1][2]=v,re[2][0]=y,re[2][1]=T,re[2][2]=E,I=this.nifti_mat33_determ(re),I===0)return null;for(J=-666,b=Y=X=H=1,W=2,q=3,F=1;F<=3;F+=1)for(M=1;M<=3;M+=1)if(F!==M){for(L=1;L<=3;L+=1)if(!(F===L||M===L))for(ae[0][0]=ae[0][1]=ae[0][2]=ae[1][0]=ae[1][1]=ae[1][2]=ae[2][0]=ae[2][1]=ae[2][2]=0,V=-1;V<=1;V+=2)for(B=-1;B<=1;B+=2)for(z=-1;z<=1;z+=2)ae[0][F-1]=V,ae[1][M-1]=B,ae[2][L-1]=z,e=this.nifti_mat33_determ(ae),e*I>0&&(g=this.nifti_mat33_mul(ae,re),S=g[0][0]+g[1][1]+g[2][2],S>J&&(J=S,b=F,W=M,q=L,Y=V,X=B,H=z))}switch(fe=pe=me=Se=ve=we="",b*Y){case 1:fe="X",Se="+";break;case-1:fe="X",Se="-";break;case 2:fe="Y",Se="+";break;case-2:fe="Y",Se="-";break;case 3:fe="Z",Se="+";break;case-3:fe="Z",Se="-";break}switch(W*X){case 1:pe="X",ve="+";break;case-1:pe="X",ve="-";break;case 2:pe="Y",ve="+";break;case-2:pe="Y",ve="-";break;case 3:pe="Z",ve="+";break;case-3:pe="Z",ve="-";break}switch(q*H){case 1:me="X",we="+";break;case-1:me="X",we="-";break;case 2:me="Y",we="+";break;case-2:me="Y",we="-";break;case 3:me="Z",we="+";break;case-3:me="Z",we="-";break}return fe+pe+me+Se+ve+we}getExtensionLocation(){return Ht.MAGIC_COOKIE+4}getExtensionSize(n){return utilities_1$1.Utils.getIntAt(n,this.getExtensionLocation(),this.littleEndian)}getExtensionCode(n){return utilities_1$1.Utils.getIntAt(n,this.getExtensionLocation()+4,this.littleEndian)}addExtension(n,s=-1){s==-1?this.extensions.push(n):this.extensions.splice(s,0,n),this.vox_offset+=n.esize}removeExtension(n){let s=this.extensions[n];s&&(this.vox_offset-=s.esize),this.extensions.splice(n,1)}toArrayBuffer(n=!1){let f=352;if(n)for(let y of this.extensions)f+=y.esize;let m=new Uint8Array(f),A=new DataView(m.buffer);A.setInt32(0,348,this.littleEndian),A.setUint8(39,this.dim_info);for(let y=0;y<8;y++)A.setUint16(40+2*y,this.dims[y],this.littleEndian);A.setFloat32(56,this.intent_p1,this.littleEndian),A.setFloat32(60,this.intent_p2,this.littleEndian),A.setFloat32(64,this.intent_p3,this.littleEndian),A.setInt16(68,this.intent_code,this.littleEndian),A.setInt16(70,this.datatypeCode,this.littleEndian),A.setInt16(72,this.numBitsPerVoxel,this.littleEndian),A.setInt16(74,this.slice_start,this.littleEndian);for(let y=0;y<8;y++)A.setFloat32(76+4*y,this.pixDims[y],this.littleEndian);A.setFloat32(108,this.vox_offset,this.littleEndian),A.setFloat32(112,this.scl_slope,this.littleEndian),A.setFloat32(116,this.scl_inter,this.littleEndian),A.setInt16(120,this.slice_end,this.littleEndian),A.setUint8(122,this.slice_code),A.setUint8(123,this.xyzt_units),A.setFloat32(124,this.cal_max,this.littleEndian),A.setFloat32(128,this.cal_min,this.littleEndian),A.setFloat32(132,this.slice_duration,this.littleEndian),A.setFloat32(136,this.toffset,this.littleEndian),m.set(Buffer.from(this.description),148),m.set(Buffer.from(this.aux_file),228),A.setInt16(252,this.qform_code,this.littleEndian),A.setInt16(254,this.sform_code,this.littleEndian),A.setFloat32(256,this.quatern_b,this.littleEndian),A.setFloat32(260,this.quatern_c,this.littleEndian),A.setFloat32(264,this.quatern_d,this.littleEndian),A.setFloat32(268,this.qoffset_x,this.littleEndian),A.setFloat32(272,this.qoffset_y,this.littleEndian),A.setFloat32(276,this.qoffset_z,this.littleEndian);const v=this.affine.flat();for(let y=0;y<12;y++)A.setFloat32(280+4*y,v[y],this.littleEndian);if(m.set(Buffer.from(this.intent_name),328),m.set(Buffer.from(this.magic),344),n){m.set(Uint8Array.from([1,0,0,0]),348);let y=this.getExtensionLocation();for(const T of this.extensions)A.setInt32(y,T.esize,T.littleEndian),A.setInt32(y+4,T.ecode,T.littleEndian),m.set(new Uint8Array(T.edata),y+8),y+=T.esize}else m.set(new Uint8Array(4).fill(0),348);return m.buffer}};ct(Ht,"TYPE_NONE",0),ct(Ht,"TYPE_BINARY",1),ct(Ht,"TYPE_UINT8",2),ct(Ht,"TYPE_INT16",4),ct(Ht,"TYPE_INT32",8),ct(Ht,"TYPE_FLOAT32",16),ct(Ht,"TYPE_COMPLEX64",32),ct(Ht,"TYPE_FLOAT64",64),ct(Ht,"TYPE_RGB24",128),ct(Ht,"TYPE_INT8",256),ct(Ht,"TYPE_UINT16",512),ct(Ht,"TYPE_UINT32",768),ct(Ht,"TYPE_INT64",1024),ct(Ht,"TYPE_UINT64",1280),ct(Ht,"TYPE_FLOAT128",1536),ct(Ht,"TYPE_COMPLEX128",1792),ct(Ht,"TYPE_COMPLEX256",2048),ct(Ht,"XFORM_UNKNOWN",0),ct(Ht,"XFORM_SCANNER_ANAT",1),ct(Ht,"XFORM_ALIGNED_ANAT",2),ct(Ht,"XFORM_TALAIRACH",3),ct(Ht,"XFORM_MNI_152",4),ct(Ht,"SPATIAL_UNITS_MASK",7),ct(Ht,"TEMPORAL_UNITS_MASK",56),ct(Ht,"UNITS_UNKNOWN",0),ct(Ht,"UNITS_METER",1),ct(Ht,"UNITS_MM",2),ct(Ht,"UNITS_MICRON",3),ct(Ht,"UNITS_SEC",8),ct(Ht,"UNITS_MSEC",16),ct(Ht,"UNITS_USEC",24),ct(Ht,"UNITS_HZ",32),ct(Ht,"UNITS_PPM",40),ct(Ht,"UNITS_RADS",48),ct(Ht,"MAGIC_COOKIE",348),ct(Ht,"STANDARD_HEADER_SIZE",348),ct(Ht,"MAGIC_NUMBER_LOCATION",344),ct(Ht,"MAGIC_NUMBER",[110,43,49]),ct(Ht,"MAGIC_NUMBER2",[110,105,49]),ct(Ht,"EXTENSION_HEADER_SIZE",8);let NIFTI1=Ht;nifti1.NIFTI1=NIFTI1;var nifti2={};Object.defineProperty(nifti2,"__esModule",{value:!0});nifti2.NIFTI2=void 0;const nifti1_1=nifti1,utilities_1=utilities$1,Ai=class Ai{constructor(){ct(this,"littleEndian",!1);ct(this,"dim_info",0);ct(this,"dims",[]);ct(this,"intent_p1",0);ct(this,"intent_p2",0);ct(this,"intent_p3",0);ct(this,"intent_code",0);ct(this,"datatypeCode",0);ct(this,"numBitsPerVoxel",0);ct(this,"slice_start",0);ct(this,"slice_end",0);ct(this,"slice_code",0);ct(this,"pixDims",[]);ct(this,"vox_offset",0);ct(this,"scl_slope",1);ct(this,"scl_inter",0);ct(this,"xyzt_units",0);ct(this,"cal_max",0);ct(this,"cal_min",0);ct(this,"slice_duration",0);ct(this,"toffset",0);ct(this,"description","");ct(this,"aux_file","");ct(this,"intent_name","");ct(this,"qform_code",0);ct(this,"sform_code",0);ct(this,"quatern_b",0);ct(this,"quatern_c",0);ct(this,"quatern_d",0);ct(this,"qoffset_x",0);ct(this,"qoffset_y",0);ct(this,"qoffset_z",0);ct(this,"affine",[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]]);ct(this,"magic","0");ct(this,"extensionFlag",[0,0,0,0]);ct(this,"extensions",[]);ct(this,"extensionSize",0);ct(this,"extensionCode",0);ct(this,"getExtensionLocation",function(){return Ai.MAGIC_COOKIE+4});ct(this,"getExtensionSize",nifti1_1.NIFTI1.prototype.getExtensionSize);ct(this,"getExtensionCode",nifti1_1.NIFTI1.prototype.getExtensionCode);ct(this,"addExtension",nifti1_1.NIFTI1.prototype.addExtension);ct(this,"removeExtension",nifti1_1.NIFTI1.prototype.removeExtension);ct(this,"getDatatypeCodeString",nifti1_1.NIFTI1.prototype.getDatatypeCodeString);ct(this,"getTransformCodeString",nifti1_1.NIFTI1.prototype.getTransformCodeString);ct(this,"getUnitsCodeString",nifti1_1.NIFTI1.prototype.getUnitsCodeString);ct(this,"getQformMat",nifti1_1.NIFTI1.prototype.getQformMat);ct(this,"convertNiftiQFormToNiftiSForm",nifti1_1.NIFTI1.prototype.convertNiftiQFormToNiftiSForm);ct(this,"convertNiftiSFormToNEMA",nifti1_1.NIFTI1.prototype.convertNiftiSFormToNEMA);ct(this,"nifti_mat33_mul",nifti1_1.NIFTI1.prototype.nifti_mat33_mul);ct(this,"nifti_mat33_determ",nifti1_1.NIFTI1.prototype.nifti_mat33_determ)}readHeader(n){var s=new DataView(n),u=utilities_1.Utils.getIntAt(s,0,this.littleEndian),f,m,A,v;if(u!==Ai.MAGIC_COOKIE&&(this.littleEndian=!0,u=utilities_1.Utils.getIntAt(s,0,this.littleEndian)),u!==Ai.MAGIC_COOKIE)throw new Error("This does not appear to be a NIFTI file!");for(this.magic=utilities_1.Utils.getStringAt(s,4,12),this.datatypeCode=utilities_1.Utils.getShortAt(s,12,this.littleEndian),this.numBitsPerVoxel=utilities_1.Utils.getShortAt(s,14,this.littleEndian),f=0;f<8;f+=1)v=16+f*8,this.dims[f]=utilities_1.Utils.getLongAt(s,v,this.littleEndian);for(this.intent_p1=utilities_1.Utils.getDoubleAt(s,80,this.littleEndian),this.intent_p2=utilities_1.Utils.getDoubleAt(s,88,this.littleEndian),this.intent_p3=utilities_1.Utils.getDoubleAt(s,96,this.littleEndian),f=0;f<8;f+=1)v=104+f*8,this.pixDims[f]=utilities_1.Utils.getDoubleAt(s,v,this.littleEndian);for(this.vox_offset=utilities_1.Utils.getLongAt(s,168,this.littleEndian),this.scl_slope=utilities_1.Utils.getDoubleAt(s,176,this.littleEndian),this.scl_inter=utilities_1.Utils.getDoubleAt(s,184,this.littleEndian),this.cal_max=utilities_1.Utils.getDoubleAt(s,192,this.littleEndian),this.cal_min=utilities_1.Utils.getDoubleAt(s,200,this.littleEndian),this.slice_duration=utilities_1.Utils.getDoubleAt(s,208,this.littleEndian),this.toffset=utilities_1.Utils.getDoubleAt(s,216,this.littleEndian),this.slice_start=utilities_1.Utils.getLongAt(s,224,this.littleEndian),this.slice_end=utilities_1.Utils.getLongAt(s,232,this.littleEndian),this.description=utilities_1.Utils.getStringAt(s,240,320),this.aux_file=utilities_1.Utils.getStringAt(s,320,344),this.qform_code=utilities_1.Utils.getIntAt(s,344,this.littleEndian),this.sform_code=utilities_1.Utils.getIntAt(s,348,this.littleEndian),this.quatern_b=utilities_1.Utils.getDoubleAt(s,352,this.littleEndian),this.quatern_c=utilities_1.Utils.getDoubleAt(s,360,this.littleEndian),this.quatern_d=utilities_1.Utils.getDoubleAt(s,368,this.littleEndian),this.qoffset_x=utilities_1.Utils.getDoubleAt(s,376,this.littleEndian),this.qoffset_y=utilities_1.Utils.getDoubleAt(s,384,this.littleEndian),this.qoffset_z=utilities_1.Utils.getDoubleAt(s,392,this.littleEndian),m=0;m<3;m+=1)for(A=0;A<4;A+=1)v=400+(m*4+A)*8,this.affine[m][A]=utilities_1.Utils.getDoubleAt(s,v,this.littleEndian);this.affine[3][0]=0,this.affine[3][1]=0,this.affine[3][2]=0,this.affine[3][3]=1,this.slice_code=utilities_1.Utils.getIntAt(s,496,this.littleEndian),this.xyzt_units=utilities_1.Utils.getIntAt(s,500,this.littleEndian),this.intent_code=utilities_1.Utils.getIntAt(s,504,this.littleEndian),this.intent_name=utilities_1.Utils.getStringAt(s,508,524),this.dim_info=utilities_1.Utils.getByteAt(s,524),s.byteLength>Ai.MAGIC_COOKIE&&(this.extensionFlag[0]=utilities_1.Utils.getByteAt(s,540),this.extensionFlag[1]=utilities_1.Utils.getByteAt(s,541),this.extensionFlag[2]=utilities_1.Utils.getByteAt(s,542),this.extensionFlag[3]=utilities_1.Utils.getByteAt(s,543),this.extensionFlag[0]&&(this.extensions=utilities_1.Utils.getExtensionsAt(s,this.getExtensionLocation(),this.littleEndian,this.vox_offset),this.extensionSize=this.extensions[0].esize,this.extensionCode=this.extensions[0].ecode))}toFormattedString(){var n=utilities_1.Utils.formatNumber,s="";return s+="Datatype = "+ +this.datatypeCode+" ("+this.getDatatypeCodeString(this.datatypeCode)+`) +`),s}getQformMat(){return this.convertNiftiQFormToNiftiSForm(this.quatern_b,this.quatern_c,this.quatern_d,this.qoffset_x,this.qoffset_y,this.qoffset_z,this.pixDims[1],this.pixDims[2],this.pixDims[3],this.pixDims[0])}convertNiftiQFormToNiftiSForm(n,s,u,f,m,A,v,y,T,E){var S=[[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0]],I,e=n,F=s,M=u,L,V,B;return S[3][0]=S[3][1]=S[3][2]=0,S[3][3]=1,I=1-(e*e+F*F+M*M),I<1e-7?(I=1/Math.sqrt(e*e+F*F+M*M),e*=I,F*=I,M*=I,I=0):I=Math.sqrt(I),L=v>0?v:1,V=y>0?y:1,B=T>0?T:1,E<0&&(B=-B),S[0][0]=(I*I+e*e-F*F-M*M)*L,S[0][1]=2*(e*F-I*M)*V,S[0][2]=2*(e*M+I*F)*B,S[1][0]=2*(e*F+I*M)*L,S[1][1]=(I*I+F*F-e*e-M*M)*V,S[1][2]=2*(F*M-I*e)*B,S[2][0]=2*(e*M-I*F)*L,S[2][1]=2*(F*M+I*e)*V,S[2][2]=(I*I+M*M-F*F-e*e)*B,S[0][3]=f,S[1][3]=m,S[2][3]=A,S}convertNiftiSFormToNEMA(n){var s,u,f,m,A,v,y,T,E,S,I,e,F,M,L,V,B,z,b,W,q,Y,X,Q,g,J,re,ae,fe,pe,me,Se,ve,we;if(L=0,re=[[0,0,0],[0,0,0],[0,0,0]],ae=[[0,0,0],[0,0,0],[0,0,0]],s=n[0][0],u=n[0][1],f=n[0][2],m=n[1][0],A=n[1][1],v=n[1][2],y=n[2][0],T=n[2][1],E=n[2][2],S=Math.sqrt(s*s+m*m+y*y),S===0||(s/=S,m/=S,y/=S,S=Math.sqrt(u*u+A*A+T*T),S===0))return null;if(u/=S,A/=S,T/=S,S=s*u+m*A+y*T,Math.abs(S)>1e-4){if(u-=S*s,A-=S*m,T-=S*y,S=Math.sqrt(u*u+A*A+T*T),S===0)return null;u/=S,A/=S,T/=S}if(S=Math.sqrt(f*f+v*v+E*E),S===0?(f=m*T-y*A,v=y*u-T*s,E=s*A-m*u):(f/=S,v/=S,E/=S),S=s*f+m*v+y*E,Math.abs(S)>1e-4){if(f-=S*s,v-=S*m,E-=S*y,S=Math.sqrt(f*f+v*v+E*E),S===0)return null;f/=S,v/=S,E/=S}if(S=u*f+A*v+T*E,Math.abs(S)>1e-4){if(f-=S*u,v-=S*A,E-=S*T,S=Math.sqrt(f*f+v*v+E*E),S===0)return null;f/=S,v/=S,E/=S}if(re[0][0]=s,re[0][1]=u,re[0][2]=f,re[1][0]=m,re[1][1]=A,re[1][2]=v,re[2][0]=y,re[2][1]=T,re[2][2]=E,I=this.nifti_mat33_determ(re),I===0)return null;for(J=-666,b=Y=X=Q=1,W=2,q=3,F=1;F<=3;F+=1)for(M=1;M<=3;M+=1)if(F!==M){for(L=1;L<=3;L+=1)if(!(F===L||M===L))for(ae[0][0]=ae[0][1]=ae[0][2]=ae[1][0]=ae[1][1]=ae[1][2]=ae[2][0]=ae[2][1]=ae[2][2]=0,V=-1;V<=1;V+=2)for(B=-1;B<=1;B+=2)for(z=-1;z<=1;z+=2)ae[0][F-1]=V,ae[1][M-1]=B,ae[2][L-1]=z,e=this.nifti_mat33_determ(ae),e*I>0&&(g=this.nifti_mat33_mul(ae,re),S=g[0][0]+g[1][1]+g[2][2],S>J&&(J=S,b=F,W=M,q=L,Y=V,X=B,Q=z))}switch(fe=pe=me=Se=ve=we="",b*Y){case 1:fe="X",Se="+";break;case-1:fe="X",Se="-";break;case 2:fe="Y",Se="+";break;case-2:fe="Y",Se="-";break;case 3:fe="Z",Se="+";break;case-3:fe="Z",Se="-";break}switch(W*X){case 1:pe="X",ve="+";break;case-1:pe="X",ve="-";break;case 2:pe="Y",ve="+";break;case-2:pe="Y",ve="-";break;case 3:pe="Z",ve="+";break;case-3:pe="Z",ve="-";break}switch(q*Q){case 1:me="X",we="+";break;case-1:me="X",we="-";break;case 2:me="Y",we="+";break;case-2:me="Y",we="-";break;case 3:me="Z",we="+";break;case-3:me="Z",we="-";break}return fe+pe+me+Se+ve+we}getExtensionLocation(){return Ht.MAGIC_COOKIE+4}getExtensionSize(n){return utilities_1$1.Utils.getIntAt(n,this.getExtensionLocation(),this.littleEndian)}getExtensionCode(n){return utilities_1$1.Utils.getIntAt(n,this.getExtensionLocation()+4,this.littleEndian)}addExtension(n,s=-1){s==-1?this.extensions.push(n):this.extensions.splice(s,0,n),this.vox_offset+=n.esize}removeExtension(n){let s=this.extensions[n];s&&(this.vox_offset-=s.esize),this.extensions.splice(n,1)}toArrayBuffer(n=!1){let f=352;if(n)for(let y of this.extensions)f+=y.esize;let m=new Uint8Array(f),A=new DataView(m.buffer);A.setInt32(0,348,this.littleEndian),A.setUint8(39,this.dim_info);for(let y=0;y<8;y++)A.setUint16(40+2*y,this.dims[y],this.littleEndian);A.setFloat32(56,this.intent_p1,this.littleEndian),A.setFloat32(60,this.intent_p2,this.littleEndian),A.setFloat32(64,this.intent_p3,this.littleEndian),A.setInt16(68,this.intent_code,this.littleEndian),A.setInt16(70,this.datatypeCode,this.littleEndian),A.setInt16(72,this.numBitsPerVoxel,this.littleEndian),A.setInt16(74,this.slice_start,this.littleEndian);for(let y=0;y<8;y++)A.setFloat32(76+4*y,this.pixDims[y],this.littleEndian);A.setFloat32(108,this.vox_offset,this.littleEndian),A.setFloat32(112,this.scl_slope,this.littleEndian),A.setFloat32(116,this.scl_inter,this.littleEndian),A.setInt16(120,this.slice_end,this.littleEndian),A.setUint8(122,this.slice_code),A.setUint8(123,this.xyzt_units),A.setFloat32(124,this.cal_max,this.littleEndian),A.setFloat32(128,this.cal_min,this.littleEndian),A.setFloat32(132,this.slice_duration,this.littleEndian),A.setFloat32(136,this.toffset,this.littleEndian),m.set(Buffer.from(this.description),148),m.set(Buffer.from(this.aux_file),228),A.setInt16(252,this.qform_code,this.littleEndian),A.setInt16(254,this.sform_code,this.littleEndian),A.setFloat32(256,this.quatern_b,this.littleEndian),A.setFloat32(260,this.quatern_c,this.littleEndian),A.setFloat32(264,this.quatern_d,this.littleEndian),A.setFloat32(268,this.qoffset_x,this.littleEndian),A.setFloat32(272,this.qoffset_y,this.littleEndian),A.setFloat32(276,this.qoffset_z,this.littleEndian);const v=this.affine.flat();for(let y=0;y<12;y++)A.setFloat32(280+4*y,v[y],this.littleEndian);if(m.set(Buffer.from(this.intent_name),328),m.set(Buffer.from(this.magic),344),n){m.set(Uint8Array.from([1,0,0,0]),348);let y=this.getExtensionLocation();for(const T of this.extensions)A.setInt32(y,T.esize,T.littleEndian),A.setInt32(y+4,T.ecode,T.littleEndian),m.set(new Uint8Array(T.edata),y+8),y+=T.esize}else m.set(new Uint8Array(4).fill(0),348);return m.buffer}};ct(Ht,"TYPE_NONE",0),ct(Ht,"TYPE_BINARY",1),ct(Ht,"TYPE_UINT8",2),ct(Ht,"TYPE_INT16",4),ct(Ht,"TYPE_INT32",8),ct(Ht,"TYPE_FLOAT32",16),ct(Ht,"TYPE_COMPLEX64",32),ct(Ht,"TYPE_FLOAT64",64),ct(Ht,"TYPE_RGB24",128),ct(Ht,"TYPE_INT8",256),ct(Ht,"TYPE_UINT16",512),ct(Ht,"TYPE_UINT32",768),ct(Ht,"TYPE_INT64",1024),ct(Ht,"TYPE_UINT64",1280),ct(Ht,"TYPE_FLOAT128",1536),ct(Ht,"TYPE_COMPLEX128",1792),ct(Ht,"TYPE_COMPLEX256",2048),ct(Ht,"XFORM_UNKNOWN",0),ct(Ht,"XFORM_SCANNER_ANAT",1),ct(Ht,"XFORM_ALIGNED_ANAT",2),ct(Ht,"XFORM_TALAIRACH",3),ct(Ht,"XFORM_MNI_152",4),ct(Ht,"SPATIAL_UNITS_MASK",7),ct(Ht,"TEMPORAL_UNITS_MASK",56),ct(Ht,"UNITS_UNKNOWN",0),ct(Ht,"UNITS_METER",1),ct(Ht,"UNITS_MM",2),ct(Ht,"UNITS_MICRON",3),ct(Ht,"UNITS_SEC",8),ct(Ht,"UNITS_MSEC",16),ct(Ht,"UNITS_USEC",24),ct(Ht,"UNITS_HZ",32),ct(Ht,"UNITS_PPM",40),ct(Ht,"UNITS_RADS",48),ct(Ht,"MAGIC_COOKIE",348),ct(Ht,"STANDARD_HEADER_SIZE",348),ct(Ht,"MAGIC_NUMBER_LOCATION",344),ct(Ht,"MAGIC_NUMBER",[110,43,49]),ct(Ht,"MAGIC_NUMBER2",[110,105,49]),ct(Ht,"EXTENSION_HEADER_SIZE",8);let NIFTI1=Ht;nifti1.NIFTI1=NIFTI1;var nifti2={};Object.defineProperty(nifti2,"__esModule",{value:!0});nifti2.NIFTI2=void 0;const nifti1_1=nifti1,utilities_1=utilities$1,Ai=class Ai{constructor(){ct(this,"littleEndian",!1);ct(this,"dim_info",0);ct(this,"dims",[]);ct(this,"intent_p1",0);ct(this,"intent_p2",0);ct(this,"intent_p3",0);ct(this,"intent_code",0);ct(this,"datatypeCode",0);ct(this,"numBitsPerVoxel",0);ct(this,"slice_start",0);ct(this,"slice_end",0);ct(this,"slice_code",0);ct(this,"pixDims",[]);ct(this,"vox_offset",0);ct(this,"scl_slope",1);ct(this,"scl_inter",0);ct(this,"xyzt_units",0);ct(this,"cal_max",0);ct(this,"cal_min",0);ct(this,"slice_duration",0);ct(this,"toffset",0);ct(this,"description","");ct(this,"aux_file","");ct(this,"intent_name","");ct(this,"qform_code",0);ct(this,"sform_code",0);ct(this,"quatern_b",0);ct(this,"quatern_c",0);ct(this,"quatern_d",0);ct(this,"qoffset_x",0);ct(this,"qoffset_y",0);ct(this,"qoffset_z",0);ct(this,"affine",[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]]);ct(this,"magic","0");ct(this,"extensionFlag",[0,0,0,0]);ct(this,"extensions",[]);ct(this,"extensionSize",0);ct(this,"extensionCode",0);ct(this,"getExtensionLocation",function(){return Ai.MAGIC_COOKIE+4});ct(this,"getExtensionSize",nifti1_1.NIFTI1.prototype.getExtensionSize);ct(this,"getExtensionCode",nifti1_1.NIFTI1.prototype.getExtensionCode);ct(this,"addExtension",nifti1_1.NIFTI1.prototype.addExtension);ct(this,"removeExtension",nifti1_1.NIFTI1.prototype.removeExtension);ct(this,"getDatatypeCodeString",nifti1_1.NIFTI1.prototype.getDatatypeCodeString);ct(this,"getTransformCodeString",nifti1_1.NIFTI1.prototype.getTransformCodeString);ct(this,"getUnitsCodeString",nifti1_1.NIFTI1.prototype.getUnitsCodeString);ct(this,"getQformMat",nifti1_1.NIFTI1.prototype.getQformMat);ct(this,"convertNiftiQFormToNiftiSForm",nifti1_1.NIFTI1.prototype.convertNiftiQFormToNiftiSForm);ct(this,"convertNiftiSFormToNEMA",nifti1_1.NIFTI1.prototype.convertNiftiSFormToNEMA);ct(this,"nifti_mat33_mul",nifti1_1.NIFTI1.prototype.nifti_mat33_mul);ct(this,"nifti_mat33_determ",nifti1_1.NIFTI1.prototype.nifti_mat33_determ)}readHeader(n){var s=new DataView(n),u=utilities_1.Utils.getIntAt(s,0,this.littleEndian),f,m,A,v;if(u!==Ai.MAGIC_COOKIE&&(this.littleEndian=!0,u=utilities_1.Utils.getIntAt(s,0,this.littleEndian)),u!==Ai.MAGIC_COOKIE)throw new Error("This does not appear to be a NIFTI file!");for(this.magic=utilities_1.Utils.getStringAt(s,4,12),this.datatypeCode=utilities_1.Utils.getShortAt(s,12,this.littleEndian),this.numBitsPerVoxel=utilities_1.Utils.getShortAt(s,14,this.littleEndian),f=0;f<8;f+=1)v=16+f*8,this.dims[f]=utilities_1.Utils.getLongAt(s,v,this.littleEndian);for(this.intent_p1=utilities_1.Utils.getDoubleAt(s,80,this.littleEndian),this.intent_p2=utilities_1.Utils.getDoubleAt(s,88,this.littleEndian),this.intent_p3=utilities_1.Utils.getDoubleAt(s,96,this.littleEndian),f=0;f<8;f+=1)v=104+f*8,this.pixDims[f]=utilities_1.Utils.getDoubleAt(s,v,this.littleEndian);for(this.vox_offset=utilities_1.Utils.getLongAt(s,168,this.littleEndian),this.scl_slope=utilities_1.Utils.getDoubleAt(s,176,this.littleEndian),this.scl_inter=utilities_1.Utils.getDoubleAt(s,184,this.littleEndian),this.cal_max=utilities_1.Utils.getDoubleAt(s,192,this.littleEndian),this.cal_min=utilities_1.Utils.getDoubleAt(s,200,this.littleEndian),this.slice_duration=utilities_1.Utils.getDoubleAt(s,208,this.littleEndian),this.toffset=utilities_1.Utils.getDoubleAt(s,216,this.littleEndian),this.slice_start=utilities_1.Utils.getLongAt(s,224,this.littleEndian),this.slice_end=utilities_1.Utils.getLongAt(s,232,this.littleEndian),this.description=utilities_1.Utils.getStringAt(s,240,320),this.aux_file=utilities_1.Utils.getStringAt(s,320,344),this.qform_code=utilities_1.Utils.getIntAt(s,344,this.littleEndian),this.sform_code=utilities_1.Utils.getIntAt(s,348,this.littleEndian),this.quatern_b=utilities_1.Utils.getDoubleAt(s,352,this.littleEndian),this.quatern_c=utilities_1.Utils.getDoubleAt(s,360,this.littleEndian),this.quatern_d=utilities_1.Utils.getDoubleAt(s,368,this.littleEndian),this.qoffset_x=utilities_1.Utils.getDoubleAt(s,376,this.littleEndian),this.qoffset_y=utilities_1.Utils.getDoubleAt(s,384,this.littleEndian),this.qoffset_z=utilities_1.Utils.getDoubleAt(s,392,this.littleEndian),m=0;m<3;m+=1)for(A=0;A<4;A+=1)v=400+(m*4+A)*8,this.affine[m][A]=utilities_1.Utils.getDoubleAt(s,v,this.littleEndian);this.affine[3][0]=0,this.affine[3][1]=0,this.affine[3][2]=0,this.affine[3][3]=1,this.slice_code=utilities_1.Utils.getIntAt(s,496,this.littleEndian),this.xyzt_units=utilities_1.Utils.getIntAt(s,500,this.littleEndian),this.intent_code=utilities_1.Utils.getIntAt(s,504,this.littleEndian),this.intent_name=utilities_1.Utils.getStringAt(s,508,524),this.dim_info=utilities_1.Utils.getByteAt(s,524),s.byteLength>Ai.MAGIC_COOKIE&&(this.extensionFlag[0]=utilities_1.Utils.getByteAt(s,540),this.extensionFlag[1]=utilities_1.Utils.getByteAt(s,541),this.extensionFlag[2]=utilities_1.Utils.getByteAt(s,542),this.extensionFlag[3]=utilities_1.Utils.getByteAt(s,543),this.extensionFlag[0]&&(this.extensions=utilities_1.Utils.getExtensionsAt(s,this.getExtensionLocation(),this.littleEndian,this.vox_offset),this.extensionSize=this.extensions[0].esize,this.extensionCode=this.extensions[0].ecode))}toFormattedString(){var n=utilities_1.Utils.formatNumber,s="";return s+="Datatype = "+ +this.datatypeCode+" ("+this.getDatatypeCodeString(this.datatypeCode)+`) `,s+="Bits Per Voxel = = "+this.numBitsPerVoxel+` `,s+="Image Dimensions (1-8): "+this.dims[0]+", "+this.dims[1]+", "+this.dims[2]+", "+this.dims[3]+", "+this.dims[4]+", "+this.dims[5]+", "+this.dims[6]+", "+this.dims[7]+` `,s+="Intent Parameters (1-3): "+this.intent_p1+", "+this.intent_p2+", "+this.intent_p3+` @@ -51,12 +51,12 @@ var tA=Object.defineProperty;var iA=(a,n,s)=>n in a?tA(a,n,{enumerable:!0,config `,s+="Intent Code = "+this.intent_code+` `,s+='Intent Name: "'+this.intent_name+`" `,s+="Dim Info = "+this.dim_info+` -`,s}toArrayBuffer(n=!1){let f=544;if(n)for(let y of this.extensions)f+=y.esize;let m=new Uint8Array(f),A=new DataView(m.buffer);A.setInt32(0,540,this.littleEndian),m.set(Buffer.from(this.magic),4),A.setInt16(12,this.datatypeCode,this.littleEndian),A.setInt16(14,this.numBitsPerVoxel,this.littleEndian);for(let y=0;y<8;y++)A.setBigInt64(16+8*y,BigInt(this.dims[y]),this.littleEndian);A.setFloat64(80,this.intent_p1,this.littleEndian),A.setFloat64(88,this.intent_p2,this.littleEndian),A.setFloat64(96,this.intent_p3,this.littleEndian);for(let y=0;y<8;y++)A.setFloat64(104+8*y,this.pixDims[y],this.littleEndian);A.setBigInt64(168,BigInt(this.vox_offset),this.littleEndian),A.setFloat64(176,this.scl_slope,this.littleEndian),A.setFloat64(184,this.scl_inter,this.littleEndian),A.setFloat64(192,this.cal_max,this.littleEndian),A.setFloat64(200,this.cal_min,this.littleEndian),A.setFloat64(208,this.slice_duration,this.littleEndian),A.setFloat64(216,this.toffset,this.littleEndian),A.setBigInt64(224,BigInt(this.slice_start),this.littleEndian),A.setBigInt64(232,BigInt(this.slice_end),this.littleEndian),m.set(Buffer.from(this.description),240),m.set(Buffer.from(this.aux_file),320),A.setInt32(344,this.qform_code,this.littleEndian),A.setInt32(348,this.sform_code,this.littleEndian),A.setFloat64(352,this.quatern_b,this.littleEndian),A.setFloat64(360,this.quatern_c,this.littleEndian),A.setFloat64(368,this.quatern_d,this.littleEndian),A.setFloat64(376,this.qoffset_x,this.littleEndian),A.setFloat64(384,this.qoffset_y,this.littleEndian),A.setFloat64(392,this.qoffset_z,this.littleEndian);const v=this.affine.flat();for(let y=0;y<12;y++)A.setFloat64(400+8*y,v[y],this.littleEndian);if(A.setInt32(496,this.slice_code,this.littleEndian),A.setInt32(500,this.xyzt_units,this.littleEndian),A.setInt32(504,this.intent_code,this.littleEndian),m.set(Buffer.from(this.intent_name),508),A.setUint8(524,this.dim_info),n){m.set(Uint8Array.from([1,0,0,0]),540);let y=this.getExtensionLocation();for(const T of this.extensions)A.setInt32(y,T.esize,T.littleEndian),A.setInt32(y+4,T.ecode,T.littleEndian),m.set(new Uint8Array(T.edata),y+8),y+=T.esize}else m.set(new Uint8Array(4).fill(0),540);return m.buffer}};ct(Ai,"MAGIC_COOKIE",540),ct(Ai,"MAGIC_NUMBER_LOCATION",4),ct(Ai,"MAGIC_NUMBER",[110,43,50,0,13,10,26,10]),ct(Ai,"MAGIC_NUMBER2",[110,105,50,0,13,10,26,10]);let NIFTI2=Ai;nifti2.NIFTI2=NIFTI2;(function(a){var n=commonjsGlobal&&commonjsGlobal.__createBinding||(Object.create?function(q,Y,X,H){H===void 0&&(H=X);var g=Object.getOwnPropertyDescriptor(Y,X);(!g||("get"in g?!Y.__esModule:g.writable||g.configurable))&&(g={enumerable:!0,get:function(){return Y[X]}}),Object.defineProperty(q,H,g)}:function(q,Y,X,H){H===void 0&&(H=X),q[H]=Y[X]}),s=commonjsGlobal&&commonjsGlobal.__setModuleDefault||(Object.create?function(q,Y){Object.defineProperty(q,"default",{enumerable:!0,value:Y})}:function(q,Y){q.default=Y}),u=commonjsGlobal&&commonjsGlobal.__importStar||function(q){if(q&&q.__esModule)return q;var Y={};if(q!=null)for(var X in q)X!=="default"&&Object.prototype.hasOwnProperty.call(q,X)&&n(Y,q,X);return s(Y,q),Y};Object.defineProperty(a,"__esModule",{value:!0}),a.readExtensionData=a.readExtension=a.readImage=a.hasExtension=a.readHeader=a.decompress=a.isCompressed=a.isNIFTI=a.isNIFTI2=a.isNIFTI1=a.NIFTIEXTENSION=a.Utils=a.NIFTI2=a.NIFTI1=void 0;const f=u(browser),m=nifti1,A=nifti2,v=utilities$1;var y=nifti1;Object.defineProperty(a,"NIFTI1",{enumerable:!0,get:function(){return y.NIFTI1}});var T=nifti2;Object.defineProperty(a,"NIFTI2",{enumerable:!0,get:function(){return T.NIFTI2}});var E=utilities$1;Object.defineProperty(a,"Utils",{enumerable:!0,get:function(){return E.Utils}});var S=niftiExtension;Object.defineProperty(a,"NIFTIEXTENSION",{enumerable:!0,get:function(){return S.NIFTIEXTENSION}});function I(q,Y=!1){var X,H,g,J;return q.byteLength1)for(var m=Array.prototype.slice.call(arguments,1);f--;)u[s-1-f]=n.Utils.createArray.apply(this,m);return u},n.Utils.getStringAt=function(s,u,f,m,A){var v="",y,T;for(y=0;y0?parseInt(s,10):0},n.Utils.convertCamcelCaseToTitleCase=function(s){var u=s.replace(/([A-Z][a-z])/g," $1");return n.Utils.trim(u.charAt(0).toUpperCase()+u.slice(1))},n.Utils.safeParseFloat=function(s){return s=n.Utils.stripLeadingZeros(s),s.length>0?parseFloat(s):0},n.Utils.bytesToDouble=function(s){var u=(s[0]&128)>>7,f=(s[0]&127)<<4|(s[1]&240)>>4;if(f==0)return 0;if(f==2047)return u?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY;var m=Math.pow(2,f-1023-52),A=s[7]+s[6]*Math.pow(2,8)+s[5]*Math.pow(2,8*2)+s[4]*Math.pow(2,8*3)+s[3]*Math.pow(2,8*4)+s[2]*Math.pow(2,8*5)+(s[1]&15)*Math.pow(2,8*6)+Math.pow(2,52);return Math.pow(-1,u)*A*m},n.Utils.concatArrayBuffers=function(s,u){var f=new Uint8Array(s.byteLength+u.byteLength);return f.set(new Uint8Array(s),0),f.set(new Uint8Array(u),s.byteLength),f.buffer},n.Utils.concatArrayBuffers2=function(s){var u=0,f=0,m;for(m=0;m>8&65280|s>>24&255},n.Utils.swap16=function(s){return((s&255)<<8|s>>8&255)<<16>>16},n.Utils.makeCRCTable=function(){for(var s,u=[],f=0;f<256;f++){s=f;for(var m=0;m<8;m++)s=s&1?3988292384^s>>>1:s>>>1;u[f]=s}return u},n.Utils.crc32=function(s){for(var u=n.Utils.crcTable||(n.Utils.crcTable=n.Utils.makeCRCTable()),f=-1,m=0;m>>8^u[(f^s.getUint8(m))&255];return(f^-1)>>>0},n.Utils.createBitMask=function(s,u,f){var m=4294967295;return m>>>=(4-s)*8+(s*8-u),f?s==1?m&=255:s==2?m&=65535:s==4?m&=4294967295:s==8&&(m=4294967295):m=4294967295,m},a.exports&&(a.exports=n.Utils)}(utilities)),utilities.exports}var hasRequiredDictionary;function requireDictionary(){return hasRequiredDictionary||(hasRequiredDictionary=1,function(a){var n=n||{};n.Dictionary=n.Dictionary||{},n.Utils=n.Utils||(typeof commonjsRequire<"u"?requireUtilities():null),n.Dictionary.dictPrivate={"0207":{"101F":["FE","ElscintDataScale"]}},n.Dictionary.dict={"0002":{"0001":["OB","FileMetaInformationVersion"],"0002":["UI","MediaStoredSOPClassUID"],"0003":["UI","MediaStoredSOPInstanceUID"],"0010":["UI","TransferSyntaxUID"],"0012":["UI","ImplementationClassUID"],"0013":["SH","ImplementationVersionName"],"0016":["AE","SourceApplicationEntityTitle"],"0100":["UI","PrivateInformationCreatorUID"],"0102":["OB","PrivateInformation"]},"0004":{1130:["CS","FilesetID"],1141:["CS","FilesetDescriptorFileFileID"],1142:["CS","FilesetDescriptorFileFormat"],1200:["UL","RootDirectoryEntitysFirstDirectoryRecordOffset"],1202:["UL","RootDirectoryEntitysLastDirectoryRecordOffset"],1212:["US","File-setConsistenceFlag"],1220:["SQ","DirectoryRecordSequence"],1400:["UL","NextDirectoryRecordOffset"],1410:["US","RecordInuseFlag"],1420:["UL","ReferencedLowerlevelDirectoryEntityOffset"],1430:["CS","DirectoryRecordType"],1432:["UI","PrivateRecordUID"],1500:["CS","ReferencedFileID"],1510:["UI","ReferencedSOPClassUIDInFile"],1511:["UI","ReferencedSOPInstanceUIDInFile"],1600:["UL","NumberOfReferences"]},"0008":{"0001":["UL","LengthToEnd"],"0005":["CS","SpecificCharacterSet"],"0006":["SQ","LanguageCodeSequence"],"0008":["CS","ImageType"],"0010":["SH","RecognitionCode"],"0012":["DA","InstanceCreationDate"],"0013":["TM","InstanceCreationTime"],"0014":["UI","InstanceCreatorUID"],"0016":["UI","SOPClassUID"],"0018":["UI","SOPInstanceUID"],"001A":["UI","RelatedGeneralSOPClassUID"],"001B":["UI","OriginalSpecializedSOPClassUID"],"0020":["DA","StudyDate"],"0021":["DA","SeriesDate"],"0022":["DA","AcquisitionDate"],"0023":["DA","ContentDate"],"0024":["DA","OverlayDate"],"0025":["DA","CurveDate"],"002A":["DT","AcquisitionDateTime"],"0030":["TM","StudyTime"],"0031":["TM","SeriesTime"],"0032":["TM","AcquisitionTime"],"0033":["TM","ContentTime"],"0034":["TM","OverlayTime"],"0035":["TM","CurveTime"],"0040":["US","DataSetType"],"0041":["LO","DataSetSubtype"],"0042":["CS","NuclearMedicineSeriesType"],"0050":["SH","AccessionNumber"],"0051":["SQ","IssuerOfAccessionNumberSequence"],"0052":["CS","QueryRetrieveLevel"],"0054":["AE","RetrieveAETitle"],"0056":["CS","InstanceAvailability"],"0058":["UI","FailedSOPInstanceUIDList"],"0060":["CS","Modality"],"0061":["CS","ModalitiesInStudy"],"0062":["UI","SOPClassesInStudy"],"0064":["CS","ConversionType"],"0068":["CS","PresentationIntentType"],"0070":["LO","Manufacturer"],"0080":["LO","InstitutionName"],"0081":["ST","InstitutionAddress"],"0082":["SQ","InstitutionCodeSequence"],"0090":["PN","ReferringPhysicianName"],"0092":["ST","ReferringPhysicianAddress"],"0094":["SH","ReferringPhysicianTelephoneNumbers"],"0096":["SQ","ReferringPhysicianIdentificationSequence"],"0100":["SH","CodeValue"],"0102":["SH","CodingSchemeDesignator"],"0103":["SH","CodingSchemeVersion"],"0104":["LO","CodeMeaning"],"0105":["CS","MappingResource"],"0106":["DT","ContextGroupVersion"],"0107":["DT","ContextGroupLocalVersion"],"010B":["CS","ContextGroupExtensionFlag"],"010C":["UI","CodingSchemeUID"],"010D":["UI","ContextGroupExtensionCreatorUID"],"010F":["CS","ContextIdentifier"],"0110":["SQ","CodingSchemeIdentificationSequence"],"0112":["LO","CodingSchemeRegistry"],"0114":["ST","CodingSchemeExternalID"],"0115":["ST","CodingSchemeName"],"0116":["ST","CodingSchemeResponsibleOrganization"],"0117":["UI","ContextUID"],"0201":["SH","TimezoneOffsetFromUTC"],1e3:["AE","NetworkID"],1010:["SH","StationName"],1030:["LO","StudyDescription"],1032:["SQ","ProcedureCodeSequence"],"103E":["LO","SeriesDescription"],"103F":["SQ","SeriesDescriptionCodeSequence"],1040:["LO","InstitutionalDepartmentName"],1048:["PN","PhysiciansOfRecord"],1049:["SQ","PhysiciansOfRecordIdentificationSequence"],1050:["PN","PerformingPhysicianName"],1052:["SQ","PerformingPhysicianIdentificationSequence"],1060:["PN","NameOfPhysiciansReadingStudy"],1062:["SQ","PhysiciansReadingStudyIdentificationSequence"],1070:["PN","OperatorsName"],1072:["SQ","OperatorIdentificationSequence"],1080:["LO","AdmittingDiagnosesDescription"],1084:["SQ","AdmittingDiagnosesCodeSequence"],1090:["LO","ManufacturerModelName"],1100:["SQ","ReferencedResultsSequence"],1110:["SQ","ReferencedStudySequence"],1111:["SQ","ReferencedPerformedProcedureStepSequence"],1115:["SQ","ReferencedSeriesSequence"],1120:["SQ","ReferencedPatientSequence"],1125:["SQ","ReferencedVisitSequence"],1130:["SQ","ReferencedOverlaySequence"],1134:["SQ","ReferencedStereometricInstanceSequence"],"113A":["SQ","ReferencedWaveformSequence"],1140:["SQ","ReferencedImageSequence"],1145:["SQ","ReferencedCurveSequence"],"114A":["SQ","ReferencedInstanceSequence"],"114B":["SQ","ReferencedRealWorldValueMappingInstanceSequence"],1150:["UI","ReferencedSOPClassUID"],1155:["UI","ReferencedSOPInstanceUID"],"115A":["UI","SOPClassesSupported"],1160:["IS","ReferencedFrameNumber"],1161:["UL","SimpleFrameList"],1162:["UL","CalculatedFrameList"],1163:["FD","TimeRange"],1164:["SQ","FrameExtractionSequence"],1167:["UI","MultiFrameSourceSOPInstanceUID"],1195:["UI","TransactionUID"],1197:["US","FailureReason"],1198:["SQ","FailedSOPSequence"],1199:["SQ","ReferencedSOPSequence"],1200:["SQ","StudiesContainingOtherReferencedInstancesSequence"],1250:["SQ","RelatedSeriesSequence"],2110:["CS","LossyImageCompressionRetired"],2111:["ST","DerivationDescription"],2112:["SQ","SourceImageSequence"],2120:["SH","StageName"],2122:["IS","StageNumber"],2124:["IS","NumberOfStages"],2127:["SH","ViewName"],2128:["IS","ViewNumber"],2129:["IS","NumberOfEventTimers"],"212A":["IS","NumberOfViewsInStage"],2130:["DS","EventElapsedTimes"],2132:["LO","EventTimerNames"],2133:["SQ","EventTimerSequence"],2134:["FD","EventTimeOffset"],2135:["SQ","EventCodeSequence"],2142:["IS","StartTrim"],2143:["IS","StopTrim"],2144:["IS","RecommendedDisplayFrameRate"],2200:["CS","TransducerPosition"],2204:["CS","TransducerOrientation"],2208:["CS","AnatomicStructure"],2218:["SQ","AnatomicRegionSequence"],2220:["SQ","AnatomicRegionModifierSequence"],2228:["SQ","PrimaryAnatomicStructureSequence"],2229:["SQ","AnatomicStructureSpaceOrRegionSequence"],2230:["SQ","PrimaryAnatomicStructureModifierSequence"],2240:["SQ","TransducerPositionSequence"],2242:["SQ","TransducerPositionModifierSequence"],2244:["SQ","TransducerOrientationSequence"],2246:["SQ","TransducerOrientationModifierSequence"],2251:["SQ","AnatomicStructureSpaceOrRegionCodeSequenceTrial"],2253:["SQ","AnatomicPortalOfEntranceCodeSequenceTrial"],2255:["SQ","AnatomicApproachDirectionCodeSequenceTrial"],2256:["ST","AnatomicPerspectiveDescriptionTrial"],2257:["SQ","AnatomicPerspectiveCodeSequenceTrial"],2258:["ST","AnatomicLocationOfExaminingInstrumentDescriptionTrial"],2259:["SQ","AnatomicLocationOfExaminingInstrumentCodeSequenceTrial"],"225A":["SQ","AnatomicStructureSpaceOrRegionModifierCodeSequenceTrial"],"225C":["SQ","OnAxisBackgroundAnatomicStructureCodeSequenceTrial"],3001:["SQ","AlternateRepresentationSequence"],3010:["UI","IrradiationEventUID"],4e3:["LT","IdentifyingComments"],9007:["CS","FrameType"],9092:["SQ","ReferencedImageEvidenceSequence"],9121:["SQ","ReferencedRawDataSequence"],9123:["UI","CreatorVersionUID"],9124:["SQ","DerivationImageSequence"],9154:["SQ","SourceImageEvidenceSequence"],9205:["CS","PixelPresentation"],9206:["CS","VolumetricProperties"],9207:["CS","VolumeBasedCalculationTechnique"],9208:["CS","ComplexImageComponent"],9209:["CS","AcquisitionContrast"],9215:["SQ","DerivationCodeSequence"],9237:["SQ","ReferencedPresentationStateSequence"],9410:["SQ","ReferencedOtherPlaneSequence"],9458:["SQ","FrameDisplaySequence"],9459:["FL","RecommendedDisplayFrameRateInFloat"],9460:["CS","SkipFrameRangeFlag"]},"0010":{"0010":["PN","PatientName"],"0020":["LO","PatientID"],"0021":["LO","IssuerOfPatientID"],"0022":["CS","TypeOfPatientID"],"0024":["SQ","IssuerOfPatientIDQualifiersSequence"],"0030":["DA","PatientBirthDate"],"0032":["TM","PatientBirthTime"],"0040":["CS","PatientSex"],"0050":["SQ","PatientInsurancePlanCodeSequence"],"0101":["SQ","PatientPrimaryLanguageCodeSequence"],"0102":["SQ","PatientPrimaryLanguageModifierCodeSequence"],1e3:["LO","OtherPatientIDs"],1001:["PN","OtherPatientNames"],1002:["SQ","OtherPatientIDsSequence"],1005:["PN","PatientBirthName"],1010:["AS","PatientAge"],1020:["DS","PatientSize"],1021:["SQ","PatientSizeCodeSequence"],1030:["DS","PatientWeight"],1040:["LO","PatientAddress"],1050:["LO","InsurancePlanIdentification"],1060:["PN","PatientMotherBirthName"],1080:["LO","MilitaryRank"],1081:["LO","BranchOfService"],1090:["LO","MedicalRecordLocator"],2e3:["LO","MedicalAlerts"],2110:["LO","Allergies"],2150:["LO","CountryOfResidence"],2152:["LO","RegionOfResidence"],2154:["SH","PatientTelephoneNumbers"],2160:["SH","EthnicGroup"],2180:["SH","Occupation"],"21A0":["CS","SmokingStatus"],"21B0":["LT","AdditionalPatientHistory"],"21C0":["US","PregnancyStatus"],"21D0":["DA","LastMenstrualDate"],"21F0":["LO","PatientReligiousPreference"],2201:["LO","PatientSpeciesDescription"],2202:["SQ","PatientSpeciesCodeSequence"],2203:["CS","PatientSexNeutered"],2210:["CS","AnatomicalOrientationType"],2292:["LO","PatientBreedDescription"],2293:["SQ","PatientBreedCodeSequence"],2294:["SQ","BreedRegistrationSequence"],2295:["LO","BreedRegistrationNumber"],2296:["SQ","BreedRegistryCodeSequence"],2297:["PN","ResponsiblePerson"],2298:["CS","ResponsiblePersonRole"],2299:["LO","ResponsibleOrganization"],4e3:["LT","PatientComments"],9431:["FL","ExaminedBodyThickness"]},"0012":{"0010":["LO","ClinicalTrialSponsorName"],"0020":["LO","ClinicalTrialProtocolID"],"0021":["LO","ClinicalTrialProtocolName"],"0030":["LO","ClinicalTrialSiteID"],"0031":["LO","ClinicalTrialSiteName"],"0040":["LO","ClinicalTrialSubjectID"],"0042":["LO","ClinicalTrialSubjectReadingID"],"0050":["LO","ClinicalTrialTimePointID"],"0051":["ST","ClinicalTrialTimePointDescription"],"0060":["LO","ClinicalTrialCoordinatingCenterName"],"0062":["CS","PatientIdentityRemoved"],"0063":["LO","DeidentificationMethod"],"0064":["SQ","DeidentificationMethodCodeSequence"],"0071":["LO","ClinicalTrialSeriesID"],"0072":["LO","ClinicalTrialSeriesDescription"],"0081":["LO","ClinicalTrialProtocolEthicsCommitteeName"],"0082":["LO","ClinicalTrialProtocolEthicsCommitteeApprovalNumber"],"0083":["SQ","ConsentForClinicalTrialUseSequence"],"0084":["CS","DistributionType"],"0085":["CS","ConsentForDistributionFlag"]},"0014":{"0023":["ST","CADFileFormat"],"0024":["ST","ComponentReferenceSystem"],"0025":["ST","ComponentManufacturingProcedure"],"0028":["ST","ComponentManufacturer"],"0030":["DS","MaterialThickness"],"0032":["DS","MaterialPipeDiameter"],"0034":["DS","MaterialIsolationDiameter"],"0042":["ST","MaterialGrade"],"0044":["ST","MaterialPropertiesFileID"],"0045":["ST","MaterialPropertiesFileFormat"],"0046":["LT","MaterialNotes"],"0050":["CS","ComponentShape"],"0052":["CS","CurvatureType"],"0054":["DS","OuterDiameter"],"0056":["DS","InnerDiameter"],1010:["ST","ActualEnvironmentalConditions"],1020:["DA","ExpiryDate"],1040:["ST","EnvironmentalConditions"],2002:["SQ","EvaluatorSequence"],2004:["IS","EvaluatorNumber"],2006:["PN","EvaluatorName"],2008:["IS","EvaluationAttempt"],2012:["SQ","IndicationSequence"],2014:["IS","IndicationNumber "],2016:["SH","IndicationLabel"],2018:["ST","IndicationDescription"],"201A":["CS","IndicationType"],"201C":["CS","IndicationDisposition"],"201E":["SQ","IndicationROISequence"],2030:["SQ","IndicationPhysicalPropertySequence"],2032:["SH","PropertyLabel"],2202:["IS","CoordinateSystemNumberOfAxes "],2204:["SQ","CoordinateSystemAxesSequence"],2206:["ST","CoordinateSystemAxisDescription"],2208:["CS","CoordinateSystemDataSetMapping"],"220A":["IS","CoordinateSystemAxisNumber"],"220C":["CS","CoordinateSystemAxisType"],"220E":["CS","CoordinateSystemAxisUnits"],2210:["OB","CoordinateSystemAxisValues"],2220:["SQ","CoordinateSystemTransformSequence"],2222:["ST","TransformDescription"],2224:["IS","TransformNumberOfAxes"],2226:["IS","TransformOrderOfAxes"],2228:["CS","TransformedAxisUnits"],"222A":["DS","CoordinateSystemTransformRotationAndScaleMatrix"],"222C":["DS","CoordinateSystemTransformTranslationMatrix"],3011:["DS","InternalDetectorFrameTime"],3012:["DS","NumberOfFramesIntegrated"],3020:["SQ","DetectorTemperatureSequence"],3022:["DS","SensorName"],3024:["DS","HorizontalOffsetOfSensor"],3026:["DS","VerticalOffsetOfSensor"],3028:["DS","SensorTemperature"],3040:["SQ","DarkCurrentSequence"],3050:["OB","DarkCurrentCounts"],3060:["SQ","GainCorrectionReferenceSequence"],3070:["OB","AirCounts"],3071:["DS","KVUsedInGainCalibration"],3072:["DS","MAUsedInGainCalibration"],3073:["DS","NumberOfFramesUsedForIntegration"],3074:["LO","FilterMaterialUsedInGainCalibration"],3075:["DS","FilterThicknessUsedInGainCalibration"],3076:["DA","DateOfGainCalibration"],3077:["TM","TimeOfGainCalibration"],3080:["OB","BadPixelImage"],3099:["LT","CalibrationNotes"],4002:["SQ","PulserEquipmentSequence"],4004:["CS","PulserType"],4006:["LT","PulserNotes"],4008:["SQ","ReceiverEquipmentSequence"],"400A":["CS","AmplifierType"],"400C":["LT","ReceiverNotes"],"400E":["SQ","PreAmplifierEquipmentSequence"],"400F":["LT","PreAmplifierNotes"],4010:["SQ","TransmitTransducerSequence"],4011:["SQ","ReceiveTransducerSequence"],4012:["US","NumberOfElements"],4013:["CS","ElementShape"],4014:["DS","ElementDimensionA"],4015:["DS","ElementDimensionB"],4016:["DS","ElementPitch"],4017:["DS","MeasuredBeamDimensionA"],4018:["DS","MeasuredBeamDimensionB"],4019:["DS","LocationOfMeasuredBeamDiameter"],"401A":["DS","NominalFrequency"],"401B":["DS","MeasuredCenterFrequency"],"401C":["DS","MeasuredBandwidth"],4020:["SQ","PulserSettingsSequence"],4022:["DS","PulseWidth"],4024:["DS","ExcitationFrequency"],4026:["CS","ModulationType"],4028:["DS","Damping"],4030:["SQ","ReceiverSettingsSequence"],4031:["DS","AcquiredSoundpathLength"],4032:["CS","AcquisitionCompressionType"],4033:["IS","AcquisitionSampleSize"],4034:["DS","RectifierSmoothing"],4035:["SQ","DACSequence"],4036:["CS","DACType"],4038:["DS","DACGainPoints"],"403A":["DS","DACTimePoints"],"403C":["DS","DACAmplitude"],4040:["SQ","PreAmplifierSettingsSequence"],4050:["SQ","TransmitTransducerSettingsSequence"],4051:["SQ","ReceiveTransducerSettingsSequence"],4052:["DS","IncidentAngle"],4054:["ST","CouplingTechnique"],4056:["ST","CouplingMedium"],4057:["DS","CouplingVelocity"],4058:["DS","CrystalCenterLocationX"],4059:["DS","CrystalCenterLocationZ"],"405A":["DS","SoundPathLength"],"405C":["ST","DelayLawIdentifier"],4060:["SQ","GateSettingsSequence"],4062:["DS","GateThreshold"],4064:["DS","VelocityOfSound"],4070:["SQ","CalibrationSettingsSequence"],4072:["ST","CalibrationProcedure"],4074:["SH","ProcedureVersion"],4076:["DA","ProcedureCreationDate"],4078:["DA","ProcedureExpirationDate"],"407A":["DA","ProcedureLastModifiedDate"],"407C":["TM","CalibrationTime"],"407E":["DA","CalibrationDate"],5002:["IS","LINACEnergy"],5004:["IS","LINACOutput"]},"0018":{"0010":["LO","ContrastBolusAgent"],"0012":["SQ","ContrastBolusAgentSequence"],"0014":["SQ","ContrastBolusAdministrationRouteSequence"],"0015":["CS","BodyPartExamined"],"0020":["CS","ScanningSequence"],"0021":["CS","SequenceVariant"],"0022":["CS","ScanOptions"],"0023":["CS","MRAcquisitionType"],"0024":["SH","SequenceName"],"0025":["CS","AngioFlag"],"0026":["SQ","InterventionDrugInformationSequence"],"0027":["TM","InterventionDrugStopTime"],"0028":["DS","InterventionDrugDose"],"0029":["SQ","InterventionDrugCodeSequence"],"002A":["SQ","AdditionalDrugSequence"],"0030":["LO","Radionuclide"],"0031":["LO","Radiopharmaceutical"],"0032":["DS","EnergyWindowCenterline"],"0033":["DS","EnergyWindowTotalWidth"],"0034":["LO","InterventionDrugName"],"0035":["TM","InterventionDrugStartTime"],"0036":["SQ","InterventionSequence"],"0037":["CS","TherapyType"],"0038":["CS","InterventionStatus"],"0039":["CS","TherapyDescription"],"003A":["ST","InterventionDescription"],"0040":["IS","CineRate"],"0042":["CS","InitialCineRunState"],"0050":["DS","SliceThickness"],"0060":["DS","KVP"],"0070":["IS","CountsAccumulated"],"0071":["CS","AcquisitionTerminationCondition"],"0072":["DS","EffectiveDuration"],"0073":["CS","AcquisitionStartCondition"],"0074":["IS","AcquisitionStartConditionData"],"0075":["IS","AcquisitionTerminationConditionData"],"0080":["DS","RepetitionTime"],"0081":["DS","EchoTime"],"0082":["DS","InversionTime"],"0083":["DS","NumberOfAverages"],"0084":["DS","ImagingFrequency"],"0085":["SH","ImagedNucleus"],"0086":["IS","EchoNumbers"],"0087":["DS","MagneticFieldStrength"],"0088":["DS","SpacingBetweenSlices"],"0089":["IS","NumberOfPhaseEncodingSteps"],"0090":["DS","DataCollectionDiameter"],"0091":["IS","EchoTrainLength"],"0093":["DS","PercentSampling"],"0094":["DS","PercentPhaseFieldOfView"],"0095":["DS","PixelBandwidth"],1e3:["LO","DeviceSerialNumber"],1002:["UI","DeviceUID"],1003:["LO","DeviceID"],1004:["LO","PlateID"],1005:["LO","GeneratorID"],1006:["LO","GridID"],1007:["LO","CassetteID"],1008:["LO","GantryID"],1010:["LO","SecondaryCaptureDeviceID"],1011:["LO","HardcopyCreationDeviceID"],1012:["DA","DateOfSecondaryCapture"],1014:["TM","TimeOfSecondaryCapture"],1016:["LO","SecondaryCaptureDeviceManufacturer"],1017:["LO","HardcopyDeviceManufacturer"],1018:["LO","SecondaryCaptureDeviceManufacturerModelName"],1019:["LO","SecondaryCaptureDeviceSoftwareVersions"],"101A":["LO","HardcopyDeviceSoftwareVersion"],"101B":["LO","HardcopyDeviceManufacturerModelName"],1020:["LO","SoftwareVersions"],1022:["SH","VideoImageFormatAcquired"],1023:["LO","DigitalImageFormatAcquired"],1030:["LO","ProtocolName"],1040:["LO","ContrastBolusRoute"],1041:["DS","ContrastBolusVolume"],1042:["TM","ContrastBolusStartTime"],1043:["TM","ContrastBolusStopTime"],1044:["DS","ContrastBolusTotalDose"],1045:["IS","SyringeCounts"],1046:["DS","ContrastFlowRate"],1047:["DS","ContrastFlowDuration"],1048:["CS","ContrastBolusIngredient"],1049:["DS","ContrastBolusIngredientConcentration"],1050:["DS","SpatialResolution"],1060:["DS","TriggerTime"],1061:["LO","TriggerSourceOrType"],1062:["IS","NominalInterval"],1063:["DS","FrameTime"],1064:["LO","CardiacFramingType"],1065:["DS","FrameTimeVector"],1066:["DS","FrameDelay"],1067:["DS","ImageTriggerDelay"],1068:["DS","MultiplexGroupTimeOffset"],1069:["DS","TriggerTimeOffset"],"106A":["CS","SynchronizationTrigger"],"106C":["US","SynchronizationChannel"],"106E":["UL","TriggerSamplePosition"],1070:["LO","RadiopharmaceuticalRoute"],1071:["DS","RadiopharmaceuticalVolume"],1072:["TM","RadiopharmaceuticalStartTime"],1073:["TM","RadiopharmaceuticalStopTime"],1074:["DS","RadionuclideTotalDose"],1075:["DS","RadionuclideHalfLife"],1076:["DS","RadionuclidePositronFraction"],1077:["DS","RadiopharmaceuticalSpecificActivity"],1078:["DT","RadiopharmaceuticalStartDateTime"],1079:["DT","RadiopharmaceuticalStopDateTime"],1080:["CS","BeatRejectionFlag"],1081:["IS","LowRRValue"],1082:["IS","HighRRValue"],1083:["IS","IntervalsAcquired"],1084:["IS","IntervalsRejected"],1085:["LO","PVCRejection"],1086:["IS","SkipBeats"],1088:["IS","HeartRate"],1090:["IS","CardiacNumberOfImages"],1094:["IS","TriggerWindow"],1100:["DS","ReconstructionDiameter"],1110:["DS","DistanceSourceToDetector"],1111:["DS","DistanceSourceToPatient"],1114:["DS","EstimatedRadiographicMagnificationFactor"],1120:["DS","GantryDetectorTilt"],1121:["DS","GantryDetectorSlew"],1130:["DS","TableHeight"],1131:["DS","TableTraverse"],1134:["CS","TableMotion"],1135:["DS","TableVerticalIncrement"],1136:["DS","TableLateralIncrement"],1137:["DS","TableLongitudinalIncrement"],1138:["DS","TableAngle"],"113A":["CS","TableType"],1140:["CS","RotationDirection"],1141:["DS","AngularPosition"],1142:["DS","RadialPosition"],1143:["DS","ScanArc"],1144:["DS","AngularStep"],1145:["DS","CenterOfRotationOffset"],1146:["DS","RotationOffset"],1147:["CS","FieldOfViewShape"],1149:["IS","FieldOfViewDimensions"],1150:["IS","ExposureTime"],1151:["IS","XRayTubeCurrent"],1152:["IS","Exposure"],1153:["IS","ExposureInuAs"],1154:["DS","AveragePulseWidth"],1155:["CS","RadiationSetting"],1156:["CS","RectificationType"],"115A":["CS","RadiationMode"],"115E":["DS","ImageAndFluoroscopyAreaDoseProduct"],1160:["SH","FilterType"],1161:["LO","TypeOfFilters"],1162:["DS","IntensifierSize"],1164:["DS","ImagerPixelSpacing"],1166:["CS","Grid"],1170:["IS","GeneratorPower"],1180:["SH","CollimatorGridName"],1181:["CS","CollimatorType"],1182:["IS","FocalDistance"],1183:["DS","XFocusCenter"],1184:["DS","YFocusCenter"],1190:["DS","FocalSpots"],1191:["CS","AnodeTargetMaterial"],"11A0":["DS","BodyPartThickness"],"11A2":["DS","CompressionForce"],1200:["DA","DateOfLastCalibration"],1201:["TM","TimeOfLastCalibration"],1210:["SH","ConvolutionKernel"],1240:["IS","UpperLowerPixelValues"],1242:["IS","ActualFrameDuration"],1243:["IS","CountRate"],1244:["US","PreferredPlaybackSequencing"],1250:["SH","ReceiveCoilName"],1251:["SH","TransmitCoilName"],1260:["SH","PlateType"],1261:["LO","PhosphorType"],1300:["DS","ScanVelocity"],1301:["CS","WholeBodyTechnique"],1302:["IS","ScanLength"],1310:["US","AcquisitionMatrix"],1312:["CS","InPlanePhaseEncodingDirection"],1314:["DS","FlipAngle"],1315:["CS","VariableFlipAngleFlag"],1316:["DS","SAR"],1318:["DS","dBdt"],1400:["LO","AcquisitionDeviceProcessingDescription"],1401:["LO","AcquisitionDeviceProcessingCode"],1402:["CS","CassetteOrientation"],1403:["CS","CassetteSize"],1404:["US","ExposuresOnPlate"],1405:["IS","RelativeXRayExposure"],1411:["DS","ExposureIndex"],1412:["DS","TargetExposureIndex"],1413:["DS","DeviationIndex"],1450:["DS","ColumnAngulation"],1460:["DS","TomoLayerHeight"],1470:["DS","TomoAngle"],1480:["DS","TomoTime"],1490:["CS","TomoType"],1491:["CS","TomoClass"],1495:["IS","NumberOfTomosynthesisSourceImages"],1500:["CS","PositionerMotion"],1508:["CS","PositionerType"],1510:["DS","PositionerPrimaryAngle"],1511:["DS","PositionerSecondaryAngle"],1520:["DS","PositionerPrimaryAngleIncrement"],1521:["DS","PositionerSecondaryAngleIncrement"],1530:["DS","DetectorPrimaryAngle"],1531:["DS","DetectorSecondaryAngle"],1600:["CS","ShutterShape"],1602:["IS","ShutterLeftVerticalEdge"],1604:["IS","ShutterRightVerticalEdge"],1606:["IS","ShutterUpperHorizontalEdge"],1608:["IS","ShutterLowerHorizontalEdge"],1610:["IS","CenterOfCircularShutter"],1612:["IS","RadiusOfCircularShutter"],1620:["IS","VerticesOfThePolygonalShutter"],1622:["US","ShutterPresentationValue"],1623:["US","ShutterOverlayGroup"],1624:["US","ShutterPresentationColorCIELabValue"],1700:["CS","CollimatorShape"],1702:["IS","CollimatorLeftVerticalEdge"],1704:["IS","CollimatorRightVerticalEdge"],1706:["IS","CollimatorUpperHorizontalEdge"],1708:["IS","CollimatorLowerHorizontalEdge"],1710:["IS","CenterOfCircularCollimator"],1712:["IS","RadiusOfCircularCollimator"],1720:["IS","VerticesOfThePolygonalCollimator"],1800:["CS","AcquisitionTimeSynchronized"],1801:["SH","TimeSource"],1802:["CS","TimeDistributionProtocol"],1803:["LO","NTPSourceAddress"],2001:["IS","PageNumberVector"],2002:["SH","FrameLabelVector"],2003:["DS","FramePrimaryAngleVector"],2004:["DS","FrameSecondaryAngleVector"],2005:["DS","SliceLocationVector"],2006:["SH","DisplayWindowLabelVector"],2010:["DS","NominalScannedPixelSpacing"],2020:["CS","DigitizingDeviceTransportDirection"],2030:["DS","RotationOfScannedFilm"],3100:["CS","IVUSAcquisition"],3101:["DS","IVUSPullbackRate"],3102:["DS","IVUSGatedRate"],3103:["IS","IVUSPullbackStartFrameNumber"],3104:["IS","IVUSPullbackStopFrameNumber"],3105:["IS","LesionNumber"],4e3:["LT","AcquisitionComments"],5e3:["SH","OutputPower"],5010:["LO","TransducerData"],5012:["DS","FocusDepth"],5020:["LO","ProcessingFunction"],5021:["LO","PostprocessingFunction"],5022:["DS","MechanicalIndex"],5024:["DS","BoneThermalIndex"],5026:["DS","CranialThermalIndex"],5027:["DS","SoftTissueThermalIndex"],5028:["DS","SoftTissueFocusThermalIndex"],5029:["DS","SoftTissueSurfaceThermalIndex"],5030:["DS","DynamicRange"],5040:["DS","TotalGain"],5050:["IS","DepthOfScanField"],5100:["CS","PatientPosition"],5101:["CS","ViewPosition"],5104:["SQ","ProjectionEponymousNameCodeSequence"],5210:["DS","ImageTransformationMatrix"],5212:["DS","ImageTranslationVector"],6e3:["DS","Sensitivity"],6011:["SQ","SequenceOfUltrasoundRegions"],6012:["US","RegionSpatialFormat"],6014:["US","RegionDataType"],6016:["UL","RegionFlags"],6018:["UL","RegionLocationMinX0"],"601A":["UL","RegionLocationMinY0"],"601C":["UL","RegionLocationMaxX1"],"601E":["UL","RegionLocationMaxY1"],6020:["SL","ReferencePixelX0"],6022:["SL","ReferencePixelY0"],6024:["US","PhysicalUnitsXDirection"],6026:["US","PhysicalUnitsYDirection"],6028:["FD","ReferencePixelPhysicalValueX"],"602A":["FD","ReferencePixelPhysicalValueY"],"602C":["FD","PhysicalDeltaX"],"602E":["FD","PhysicalDeltaY"],6030:["UL","TransducerFrequency"],6031:["CS","TransducerType"],6032:["UL","PulseRepetitionFrequency"],6034:["FD","DopplerCorrectionAngle"],6036:["FD","SteeringAngle"],6038:["UL","DopplerSampleVolumeXPositionRetired"],6039:["SL","DopplerSampleVolumeXPosition"],"603A":["UL","DopplerSampleVolumeYPositionRetired"],"603B":["SL","DopplerSampleVolumeYPosition"],"603C":["UL","TMLinePositionX0Retired"],"603D":["SL","TMLinePositionX0"],"603E":["UL","TMLinePositionY0Retired"],"603F":["SL","TMLinePositionY0"],6040:["UL","TMLinePositionX1Retired"],6041:["SL","TMLinePositionX1"],6042:["UL","TMLinePositionY1Retired"],6043:["SL","TMLinePositionY1"],6044:["US","PixelComponentOrganization"],6046:["UL","PixelComponentMask"],6048:["UL","PixelComponentRangeStart"],"604A":["UL","PixelComponentRangeStop"],"604C":["US","PixelComponentPhysicalUnits"],"604E":["US","PixelComponentDataType"],6050:["UL","NumberOfTableBreakPoints"],6052:["UL","TableOfXBreakPoints"],6054:["FD","TableOfYBreakPoints"],6056:["UL","NumberOfTableEntries"],6058:["UL","TableOfPixelValues"],"605A":["FL","TableOfParameterValues"],6060:["FL","RWaveTimeVector"],7e3:["CS","DetectorConditionsNominalFlag"],7001:["DS","DetectorTemperature"],7004:["CS","DetectorType"],7005:["CS","DetectorConfiguration"],7006:["LT","DetectorDescription"],7008:["LT","DetectorMode"],"700A":["SH","DetectorID"],"700C":["DA","DateOfLastDetectorCalibration"],"700E":["TM","TimeOfLastDetectorCalibration"],7010:["IS","ExposuresOnDetectorSinceLastCalibration"],7011:["IS","ExposuresOnDetectorSinceManufactured"],7012:["DS","DetectorTimeSinceLastExposure"],7014:["DS","DetectorActiveTime"],7016:["DS","DetectorActivationOffsetFromExposure"],"701A":["DS","DetectorBinning"],7020:["DS","DetectorElementPhysicalSize"],7022:["DS","DetectorElementSpacing"],7024:["CS","DetectorActiveShape"],7026:["DS","DetectorActiveDimensions"],7028:["DS","DetectorActiveOrigin"],"702A":["LO","DetectorManufacturerName"],"702B":["LO","DetectorManufacturerModelName"],7030:["DS","FieldOfViewOrigin"],7032:["DS","FieldOfViewRotation"],7034:["CS","FieldOfViewHorizontalFlip"],7036:["FL","PixelDataAreaOriginRelativeToFOV"],7038:["FL","PixelDataAreaRotationAngleRelativeToFOV"],7040:["LT","GridAbsorbingMaterial"],7041:["LT","GridSpacingMaterial"],7042:["DS","GridThickness"],7044:["DS","GridPitch"],7046:["IS","GridAspectRatio"],7048:["DS","GridPeriod"],"704C":["DS","GridFocalDistance"],7050:["CS","FilterMaterial"],7052:["DS","FilterThicknessMinimum"],7054:["DS","FilterThicknessMaximum"],7056:["FL","FilterBeamPathLengthMinimum"],7058:["FL","FilterBeamPathLengthMaximum"],7060:["CS","ExposureControlMode"],7062:["LT","ExposureControlModeDescription"],7064:["CS","ExposureStatus"],7065:["DS","PhototimerSetting"],8150:["DS","ExposureTimeInuS"],8151:["DS","XRayTubeCurrentInuA"],9004:["CS","ContentQualification"],9005:["SH","PulseSequenceName"],9006:["SQ","MRImagingModifierSequence"],9008:["CS","EchoPulseSequence"],9009:["CS","InversionRecovery"],9010:["CS","FlowCompensation"],9011:["CS","MultipleSpinEcho"],9012:["CS","MultiPlanarExcitation"],9014:["CS","PhaseContrast"],9015:["CS","TimeOfFlightContrast"],9016:["CS","Spoiling"],9017:["CS","SteadyStatePulseSequence"],9018:["CS","EchoPlanarPulseSequence"],9019:["FD","TagAngleFirstAxis"],9020:["CS","MagnetizationTransfer"],9021:["CS","T2Preparation"],9022:["CS","BloodSignalNulling"],9024:["CS","SaturationRecovery"],9025:["CS","SpectrallySelectedSuppression"],9026:["CS","SpectrallySelectedExcitation"],9027:["CS","SpatialPresaturation"],9028:["CS","Tagging"],9029:["CS","OversamplingPhase"],9030:["FD","TagSpacingFirstDimension"],9032:["CS","GeometryOfKSpaceTraversal"],9033:["CS","SegmentedKSpaceTraversal"],9034:["CS","RectilinearPhaseEncodeReordering"],9035:["FD","TagThickness"],9036:["CS","PartialFourierDirection"],9037:["CS","CardiacSynchronizationTechnique"],9041:["LO","ReceiveCoilManufacturerName"],9042:["SQ","MRReceiveCoilSequence"],9043:["CS","ReceiveCoilType"],9044:["CS","QuadratureReceiveCoil"],9045:["SQ","MultiCoilDefinitionSequence"],9046:["LO","MultiCoilConfiguration"],9047:["SH","MultiCoilElementName"],9048:["CS","MultiCoilElementUsed"],9049:["SQ","MRTransmitCoilSequence"],9050:["LO","TransmitCoilManufacturerName"],9051:["CS","TransmitCoilType"],9052:["FD","SpectralWidth"],9053:["FD","ChemicalShiftReference"],9054:["CS","VolumeLocalizationTechnique"],9058:["US","MRAcquisitionFrequencyEncodingSteps"],9059:["CS","Decoupling"],9060:["CS","DecoupledNucleus"],9061:["FD","DecouplingFrequency"],9062:["CS","DecouplingMethod"],9063:["FD","DecouplingChemicalShiftReference"],9064:["CS","KSpaceFiltering"],9065:["CS","TimeDomainFiltering"],9066:["US","NumberOfZeroFills"],9067:["CS","BaselineCorrection"],9069:["FD","ParallelReductionFactorInPlane"],9070:["FD","CardiacRRIntervalSpecified"],9073:["FD","AcquisitionDuration"],9074:["DT","FrameAcquisitionDateTime"],9075:["CS","DiffusionDirectionality"],9076:["SQ","DiffusionGradientDirectionSequence"],9077:["CS","ParallelAcquisition"],9078:["CS","ParallelAcquisitionTechnique"],9079:["FD","InversionTimes"],9080:["ST","MetaboliteMapDescription"],9081:["CS","PartialFourier"],9082:["FD","EffectiveEchoTime"],9083:["SQ","MetaboliteMapCodeSequence"],9084:["SQ","ChemicalShiftSequence"],9085:["CS","CardiacSignalSource"],9087:["FD","DiffusionBValue"],9089:["FD","DiffusionGradientOrientation"],9090:["FD","VelocityEncodingDirection"],9091:["FD","VelocityEncodingMinimumValue"],9092:["SQ","VelocityEncodingAcquisitionSequence"],9093:["US","NumberOfKSpaceTrajectories"],9094:["CS","CoverageOfKSpace"],9095:["UL","SpectroscopyAcquisitionPhaseRows"],9096:["FD","ParallelReductionFactorInPlaneRetired"],9098:["FD","TransmitterFrequency"],9100:["CS","ResonantNucleus"],9101:["CS","FrequencyCorrection"],9103:["SQ","MRSpectroscopyFOVGeometrySequence"],9104:["FD","SlabThickness"],9105:["FD","SlabOrientation"],9106:["FD","MidSlabPosition"],9107:["SQ","MRSpatialSaturationSequence"],9112:["SQ","MRTimingAndRelatedParametersSequence"],9114:["SQ","MREchoSequence"],9115:["SQ","MRModifierSequence"],9117:["SQ","MRDiffusionSequence"],9118:["SQ","CardiacSynchronizationSequence"],9119:["SQ","MRAveragesSequence"],9125:["SQ","MRFOVGeometrySequence"],9126:["SQ","VolumeLocalizationSequence"],9127:["UL","SpectroscopyAcquisitionDataColumns"],9147:["CS","DiffusionAnisotropyType"],9151:["DT","FrameReferenceDateTime"],9152:["SQ","MRMetaboliteMapSequence"],9155:["FD","ParallelReductionFactorOutOfPlane"],9159:["UL","SpectroscopyAcquisitionOutOfPlanePhaseSteps"],9166:["CS","BulkMotionStatus"],9168:["FD","ParallelReductionFactorSecondInPlane"],9169:["CS","CardiacBeatRejectionTechnique"],9170:["CS","RespiratoryMotionCompensationTechnique"],9171:["CS","RespiratorySignalSource"],9172:["CS","BulkMotionCompensationTechnique"],9173:["CS","BulkMotionSignalSource"],9174:["CS","ApplicableSafetyStandardAgency"],9175:["LO","ApplicableSafetyStandardDescription"],9176:["SQ","OperatingModeSequence"],9177:["CS","OperatingModeType"],9178:["CS","OperatingMode"],9179:["CS","SpecificAbsorptionRateDefinition"],9180:["CS","GradientOutputType"],9181:["FD","SpecificAbsorptionRateValue"],9182:["FD","GradientOutput"],9183:["CS","FlowCompensationDirection"],9184:["FD","TaggingDelay"],9185:["ST","RespiratoryMotionCompensationTechniqueDescription"],9186:["SH","RespiratorySignalSourceID"],9195:["FD","ChemicalShiftMinimumIntegrationLimitInHz"],9196:["FD","ChemicalShiftMaximumIntegrationLimitInHz"],9197:["SQ","MRVelocityEncodingSequence"],9198:["CS","FirstOrderPhaseCorrection"],9199:["CS","WaterReferencedPhaseCorrection"],9200:["CS","MRSpectroscopyAcquisitionType"],9214:["CS","RespiratoryCyclePosition"],9217:["FD","VelocityEncodingMaximumValue"],9218:["FD","TagSpacingSecondDimension"],9219:["SS","TagAngleSecondAxis"],9220:["FD","FrameAcquisitionDuration"],9226:["SQ","MRImageFrameTypeSequence"],9227:["SQ","MRSpectroscopyFrameTypeSequence"],9231:["US","MRAcquisitionPhaseEncodingStepsInPlane"],9232:["US","MRAcquisitionPhaseEncodingStepsOutOfPlane"],9234:["UL","SpectroscopyAcquisitionPhaseColumns"],9236:["CS","CardiacCyclePosition"],9239:["SQ","SpecificAbsorptionRateSequence"],9240:["US","RFEchoTrainLength"],9241:["US","GradientEchoTrainLength"],9250:["CS","ArterialSpinLabelingContrast"],9251:["SQ","MRArterialSpinLabelingSequence"],9252:["LO","ASLTechniqueDescription"],9253:["US","ASLSlabNumber"],9254:["FD ","ASLSlabThickness"],9255:["FD ","ASLSlabOrientation"],9256:["FD ","ASLMidSlabPosition"],9257:["CS","ASLContext"],9258:["UL","ASLPulseTrainDuration"],9259:["CS","ASLCrusherFlag"],"925A":["FD","ASLCrusherFlow"],"925B":["LO","ASLCrusherDescription"],"925C":["CS","ASLBolusCutoffFlag"],"925D":["SQ","ASLBolusCutoffTimingSequence"],"925E":["LO","ASLBolusCutoffTechnique"],"925F":["UL","ASLBolusCutoffDelayTime"],9260:["SQ","ASLSlabSequence"],9295:["FD","ChemicalShiftMinimumIntegrationLimitInppm"],9296:["FD","ChemicalShiftMaximumIntegrationLimitInppm"],9301:["SQ","CTAcquisitionTypeSequence"],9302:["CS","AcquisitionType"],9303:["FD","TubeAngle"],9304:["SQ","CTAcquisitionDetailsSequence"],9305:["FD","RevolutionTime"],9306:["FD","SingleCollimationWidth"],9307:["FD","TotalCollimationWidth"],9308:["SQ","CTTableDynamicsSequence"],9309:["FD","TableSpeed"],9310:["FD","TableFeedPerRotation"],9311:["FD","SpiralPitchFactor"],9312:["SQ","CTGeometrySequence"],9313:["FD","DataCollectionCenterPatient"],9314:["SQ","CTReconstructionSequence"],9315:["CS","ReconstructionAlgorithm"],9316:["CS","ConvolutionKernelGroup"],9317:["FD","ReconstructionFieldOfView"],9318:["FD","ReconstructionTargetCenterPatient"],9319:["FD","ReconstructionAngle"],9320:["SH","ImageFilter"],9321:["SQ","CTExposureSequence"],9322:["FD","ReconstructionPixelSpacing"],9323:["CS","ExposureModulationType"],9324:["FD","EstimatedDoseSaving"],9325:["SQ","CTXRayDetailsSequence"],9326:["SQ","CTPositionSequence"],9327:["FD","TablePosition"],9328:["FD","ExposureTimeInms"],9329:["SQ","CTImageFrameTypeSequence"],9330:["FD","XRayTubeCurrentInmA"],9332:["FD","ExposureInmAs"],9333:["CS","ConstantVolumeFlag"],9334:["CS","FluoroscopyFlag"],9335:["FD","DistanceSourceToDataCollectionCenter"],9337:["US","ContrastBolusAgentNumber"],9338:["SQ","ContrastBolusIngredientCodeSequence"],9340:["SQ","ContrastAdministrationProfileSequence"],9341:["SQ","ContrastBolusUsageSequence"],9342:["CS","ContrastBolusAgentAdministered"],9343:["CS","ContrastBolusAgentDetected"],9344:["CS","ContrastBolusAgentPhase"],9345:["FD","CTDIvol"],9346:["SQ","CTDIPhantomTypeCodeSequence"],9351:["FL","CalciumScoringMassFactorPatient"],9352:["FL","CalciumScoringMassFactorDevice"],9353:["FL","EnergyWeightingFactor"],9360:["SQ","CTAdditionalXRaySourceSequence"],9401:["SQ","ProjectionPixelCalibrationSequence"],9402:["FL","DistanceSourceToIsocenter"],9403:["FL","DistanceObjectToTableTop"],9404:["FL","ObjectPixelSpacingInCenterOfBeam"],9405:["SQ","PositionerPositionSequence"],9406:["SQ","TablePositionSequence"],9407:["SQ","CollimatorShapeSequence"],9410:["CS","PlanesInAcquisition"],9412:["SQ","XAXRFFrameCharacteristicsSequence"],9417:["SQ","FrameAcquisitionSequence"],9420:["CS","XRayReceptorType"],9423:["LO","AcquisitionProtocolName"],9424:["LT","AcquisitionProtocolDescription"],9425:["CS","ContrastBolusIngredientOpaque"],9426:["FL","DistanceReceptorPlaneToDetectorHousing"],9427:["CS","IntensifierActiveShape"],9428:["FL","IntensifierActiveDimensions"],9429:["FL","PhysicalDetectorSize"],9430:["FL","PositionOfIsocenterProjection"],9432:["SQ","FieldOfViewSequence"],9433:["LO","FieldOfViewDescription"],9434:["SQ","ExposureControlSensingRegionsSequence"],9435:["CS","ExposureControlSensingRegionShape"],9436:["SS","ExposureControlSensingRegionLeftVerticalEdge"],9437:["SS","ExposureControlSensingRegionRightVerticalEdge"],9438:["SS","ExposureControlSensingRegionUpperHorizontalEdge"],9439:["SS","ExposureControlSensingRegionLowerHorizontalEdge"],9440:["SS","CenterOfCircularExposureControlSensingRegion"],9441:["US","RadiusOfCircularExposureControlSensingRegion"],9442:["SS","VerticesOfThePolygonalExposureControlSensingRegion"],9447:["FL","ColumnAngulationPatient"],9449:["FL","BeamAngle"],9451:["SQ","FrameDetectorParametersSequence"],9452:["FL","CalculatedAnatomyThickness"],9455:["SQ","CalibrationSequence"],9456:["SQ","ObjectThicknessSequence"],9457:["CS","PlaneIdentification"],9461:["FL","FieldOfViewDimensionsInFloat"],9462:["SQ","IsocenterReferenceSystemSequence"],9463:["FL","PositionerIsocenterPrimaryAngle"],9464:["FL","PositionerIsocenterSecondaryAngle"],9465:["FL","PositionerIsocenterDetectorRotationAngle"],9466:["FL","TableXPositionToIsocenter"],9467:["FL","TableYPositionToIsocenter"],9468:["FL","TableZPositionToIsocenter"],9469:["FL","TableHorizontalRotationAngle"],9470:["FL","TableHeadTiltAngle"],9471:["FL","TableCradleTiltAngle"],9472:["SQ","FrameDisplayShutterSequence"],9473:["FL","AcquiredImageAreaDoseProduct"],9474:["CS","CArmPositionerTabletopRelationship"],9476:["SQ","XRayGeometrySequence"],9477:["SQ","IrradiationEventIdentificationSequence"],9504:["SQ","XRay3DFrameTypeSequence"],9506:["SQ","ContributingSourcesSequence"],9507:["SQ","XRay3DAcquisitionSequence"],9508:["FL","PrimaryPositionerScanArc"],9509:["FL","SecondaryPositionerScanArc"],9510:["FL ","PrimaryPositionerScanStartAngle"],9511:["FL","SecondaryPositionerScanStartAngle"],9514:["FL","PrimaryPositionerIncrement"],9515:["FL","SecondaryPositionerIncrement"],9516:["DT","StartAcquisitionDateTime"],9517:["DT","EndAcquisitionDateTime"],9524:["LO","ApplicationName"],9525:["LO","ApplicationVersion"],9526:["LO","ApplicationManufacturer"],9527:["CS","AlgorithmType"],9528:["LO","AlgorithmDescription"],9530:["SQ","XRay3DReconstructionSequence"],9531:["LO","ReconstructionDescription"],9538:["SQ","PerProjectionAcquisitionSequence"],9601:["SQ","DiffusionBMatrixSequence"],9602:["FD","DiffusionBValueXX"],9603:["FD","DiffusionBValueXY"],9604:["FD","DiffusionBValueXZ"],9605:["FD","DiffusionBValueYY"],9606:["FD","DiffusionBValueYZ"],9607:["FD","DiffusionBValueZZ"],9701:["DT","DecayCorrectionDateTime"],9715:["FD","StartDensityThreshold"],9716:["FD","StartRelativeDensityDifferenceThreshold"],9717:["FD","StartCardiacTriggerCountThreshold"],9718:["FD","StartRespiratoryTriggerCountThreshold"],9719:["FD","TerminationCountsThreshold"],9720:["FD","TerminationDensityThreshold"],9721:["FD","TerminationRelativeDensityThreshold"],9722:["FD","TerminationTimeThreshold"],9723:["FD","TerminationCardiacTriggerCountThreshold"],9724:["FD","TerminationRespiratoryTriggerCountThreshold"],9725:["CS","DetectorGeometry"],9726:["FD","TransverseDetectorSeparation"],9727:["FD","AxialDetectorDimension"],9729:["US","RadiopharmaceuticalAgentNumber"],9732:["SQ","PETFrameAcquisitionSequence"],9733:["SQ","PETDetectorMotionDetailsSequence"],9734:["SQ","PETTableDynamicsSequence"],9735:["SQ","PETPositionSequence"],9736:["SQ","PETFrameCorrectionFactorsSequence"],9737:["SQ","RadiopharmaceuticalUsageSequence"],9738:["CS","AttenuationCorrectionSource"],9739:["US","NumberOfIterations"],9740:["US","NumberOfSubsets"],9749:["SQ","PETReconstructionSequence"],9751:["SQ","PETFrameTypeSequence"],9755:["CS","TimeOfFlightInformationUsed"],9756:["CS","ReconstructionType"],9758:["CS","DecayCorrected"],9759:["CS","AttenuationCorrected"],9760:["CS","ScatterCorrected"],9761:["CS","DeadTimeCorrected"],9762:["CS","GantryMotionCorrected"],9763:["CS","PatientMotionCorrected"],9764:["CS","CountLossNormalizationCorrected"],9765:["CS","RandomsCorrected"],9766:["CS","NonUniformRadialSamplingCorrected"],9767:["CS","SensitivityCalibrated"],9768:["CS","DetectorNormalizationCorrection"],9769:["CS","IterativeReconstructionMethod"],9770:["CS","AttenuationCorrectionTemporalRelationship"],9771:["SQ","PatientPhysiologicalStateSequence"],9772:["SQ","PatientPhysiologicalStateCodeSequence"],9801:["FD","DepthsOfFocus"],9803:["SQ","ExcludedIntervalsSequence"],9804:["DT","ExclusionStartDatetime"],9805:["FD","ExclusionDuration"],9806:["SQ","USImageDescriptionSequence"],9807:["SQ","ImageDataTypeSequence"],9808:["CS","DataType"],9809:["SQ","TransducerScanPatternCodeSequence"],"980B":["CS","AliasedDataType"],"980C":["CS","PositionMeasuringDeviceUsed"],"980D":["SQ","TransducerGeometryCodeSequence"],"980E":["SQ","TransducerBeamSteeringCodeSequence"],"980F":["SQ","TransducerApplicationCodeSequence"],A001:["SQ","ContributingEquipmentSequence"],A002:["DT","ContributionDateTime"],A003:["ST","ContributionDescription"]},"0020":{"000D":["UI","StudyInstanceUID"],"000E":["UI","SeriesInstanceUID"],"0010":["SH","StudyID"],"0011":["IS","SeriesNumber"],"0012":["IS","AcquisitionNumber"],"0013":["IS","InstanceNumber"],"0014":["IS","IsotopeNumber"],"0015":["IS","PhaseNumber"],"0016":["IS","IntervalNumber"],"0017":["IS","TimeSlotNumber"],"0018":["IS","AngleNumber"],"0019":["IS","ItemNumber"],"0020":["CS","PatientOrientation"],"0022":["IS","OverlayNumber"],"0024":["IS","CurveNumber"],"0026":["IS","LUTNumber"],"0030":["DS","ImagePosition"],"0032":["DS","ImagePositionPatient"],"0035":["DS","ImageOrientation"],"0037":["DS","ImageOrientationPatient"],"0050":["DS","Location"],"0052":["UI","FrameOfReferenceUID"],"0060":["CS","Laterality"],"0062":["CS","ImageLaterality"],"0070":["LO","ImageGeometryType"],"0080":["CS","MaskingImage"],"00AA":["IS","ReportNumber"],"0100":["IS","TemporalPositionIdentifier"],"0105":["IS","NumberOfTemporalPositions"],"0110":["DS","TemporalResolution"],"0200":["UI","SynchronizationFrameOfReferenceUID"],"0242":["UI","SOPInstanceUIDOfConcatenationSource"],1e3:["IS","SeriesInStudy"],1001:["IS","AcquisitionsInSeries"],1002:["IS","ImagesInAcquisition"],1003:["IS","ImagesInSeries"],1004:["IS","AcquisitionsInStudy"],1005:["IS","ImagesInStudy"],1020:["LO","Reference"],1040:["LO","PositionReferenceIndicator"],1041:["DS","SliceLocation"],1070:["IS","OtherStudyNumbers"],1200:["IS","NumberOfPatientRelatedStudies"],1202:["IS","NumberOfPatientRelatedSeries"],1204:["IS","NumberOfPatientRelatedInstances"],1206:["IS","NumberOfStudyRelatedSeries"],1208:["IS","NumberOfStudyRelatedInstances"],1209:["IS","NumberOfSeriesRelatedInstances"],3401:["CS","ModifyingDeviceID"],3402:["CS","ModifiedImageID"],3403:["DA","ModifiedImageDate"],3404:["LO","ModifyingDeviceManufacturer"],3405:["TM","ModifiedImageTime"],3406:["LO","ModifiedImageDescription"],4e3:["LT","ImageComments"],5e3:["AT","OriginalImageIdentification"],5002:["LO","OriginalImageIdentificationNomenclature"],9056:["SH","StackID"],9057:["UL","InStackPositionNumber"],9071:["SQ","FrameAnatomySequence"],9072:["CS","FrameLaterality"],9111:["SQ","FrameContentSequence"],9113:["SQ","PlanePositionSequence"],9116:["SQ","PlaneOrientationSequence"],9128:["UL","TemporalPositionIndex"],9153:["FD","NominalCardiacTriggerDelayTime"],9154:["FL","NominalCardiacTriggerTimePriorToRPeak"],9155:["FL","ActualCardiacTriggerTimePriorToRPeak"],9156:["US","FrameAcquisitionNumber"],9157:["UL","DimensionIndexValues"],9158:["LT","FrameComments"],9161:["UI","ConcatenationUID"],9162:["US","InConcatenationNumber"],9163:["US","InConcatenationTotalNumber"],9164:["UI","DimensionOrganizationUID"],9165:["AT","DimensionIndexPointer"],9167:["AT","FunctionalGroupPointer"],9213:["LO","DimensionIndexPrivateCreator"],9221:["SQ","DimensionOrganizationSequence"],9222:["SQ","DimensionIndexSequence"],9228:["UL","ConcatenationFrameOffsetNumber"],9238:["LO","FunctionalGroupPrivateCreator"],9241:["FL","NominalPercentageOfCardiacPhase"],9245:["FL","NominalPercentageOfRespiratoryPhase"],9246:["FL","StartingRespiratoryAmplitude"],9247:["CS","StartingRespiratoryPhase"],9248:["FL","EndingRespiratoryAmplitude"],9249:["CS","EndingRespiratoryPhase"],9250:["CS","RespiratoryTriggerType"],9251:["FD","RRIntervalTimeNominal"],9252:["FD","ActualCardiacTriggerDelayTime"],9253:["SQ","RespiratorySynchronizationSequence"],9254:["FD","RespiratoryIntervalTime"],9255:["FD","NominalRespiratoryTriggerDelayTime"],9256:["FD","RespiratoryTriggerDelayThreshold"],9257:["FD","ActualRespiratoryTriggerDelayTime"],9301:["FD","ImagePositionVolume"],9302:["FD","ImageOrientationVolume"],9307:["CS","UltrasoundAcquisitionGeometry"],9308:["FD","ApexPosition"],9309:["FD","VolumeToTransducerMappingMatrix"],"930A":["FD","VolumeToTableMappingMatrix"],"930C":["CS","PatientFrameOfReferenceSource"],"930D":["FD","TemporalPositionTimeOffset"],"930E":["SQ","PlanePositionVolumeSequence"],"930F":["SQ","PlaneOrientationVolumeSequence"],9310:["SQ","TemporalPositionSequence"],9311:["CS","DimensionOrganizationType"],9312:["UI","VolumeFrameOfReferenceUID"],9313:["UI","TableFrameOfReferenceUID"],9421:["LO","DimensionDescriptionLabel"],9450:["SQ","PatientOrientationInFrameSequence"],9453:["LO","FrameLabel"],9518:["US","AcquisitionIndex"],9529:["SQ","ContributingSOPInstancesReferenceSequence"],9536:["US","ReconstructionIndex"]},"0022":{"0001":["US","LightPathFilterPassThroughWavelength"],"0002":["US","LightPathFilterPassBand"],"0003":["US","ImagePathFilterPassThroughWavelength"],"0004":["US","ImagePathFilterPassBand"],"0005":["CS","PatientEyeMovementCommanded"],"0006":["SQ","PatientEyeMovementCommandCodeSequence"],"0007":["FL","SphericalLensPower"],"0008":["FL","CylinderLensPower"],"0009":["FL","CylinderAxis"],"000A":["FL","EmmetropicMagnification"],"000B":["FL","IntraOcularPressure"],"000C":["FL","HorizontalFieldOfView"],"000D":["CS","PupilDilated"],"000E":["FL","DegreeOfDilation"],"0010":["FL","StereoBaselineAngle"],"0011":["FL","StereoBaselineDisplacement"],"0012":["FL","StereoHorizontalPixelOffset"],"0013":["FL","StereoVerticalPixelOffset"],"0014":["FL","StereoRotation"],"0015":["SQ","AcquisitionDeviceTypeCodeSequence"],"0016":["SQ","IlluminationTypeCodeSequence"],"0017":["SQ","LightPathFilterTypeStackCodeSequence"],"0018":["SQ","ImagePathFilterTypeStackCodeSequence"],"0019":["SQ","LensesCodeSequence"],"001A":["SQ","ChannelDescriptionCodeSequence"],"001B":["SQ","RefractiveStateSequence"],"001C":["SQ","MydriaticAgentCodeSequence"],"001D":["SQ","RelativeImagePositionCodeSequence"],"001E":["FL","CameraAngleOfView"],"0020":["SQ","StereoPairsSequence"],"0021":["SQ","LeftImageSequence"],"0022":["SQ","RightImageSequence"],"0030":["FL","AxialLengthOfTheEye"],"0031":["SQ","OphthalmicFrameLocationSequence"],"0032":["FL","ReferenceCoordinates"],"0035":["FL","DepthSpatialResolution"],"0036":["FL","MaximumDepthDistortion"],"0037":["FL","AlongScanSpatialResolution"],"0038":["FL","MaximumAlongScanDistortion"],"0039":["CS","OphthalmicImageOrientation"],"0041":["FL","DepthOfTransverseImage"],"0042":["SQ","MydriaticAgentConcentrationUnitsSequence"],"0048":["FL","AcrossScanSpatialResolution"],"0049":["FL","MaximumAcrossScanDistortion"],"004E":["DS","MydriaticAgentConcentration"],"0055":["FL","IlluminationWaveLength"],"0056":["FL","IlluminationPower"],"0057":["FL","IlluminationBandwidth"],"0058":["SQ","MydriaticAgentSequence"],1007:["SQ","OphthalmicAxialMeasurementsRightEyeSequence"],1008:["SQ","OphthalmicAxialMeasurementsLeftEyeSequence"],1010:["CS","OphthalmicAxialLengthMeasurementsType"],1019:["FL","OphthalmicAxialLength"],1024:["SQ","LensStatusCodeSequence"],1025:["SQ","VitreousStatusCodeSequence"],1028:["SQ","IOLFormulaCodeSequence"],1029:["LO","IOLFormulaDetail"],1033:["FL","KeratometerIndex"],1035:["SQ","SourceOfOphthalmicAxialLengthCodeSequence"],1037:["FL","TargetRefraction"],1039:["CS","RefractiveProcedureOccurred"],1040:["SQ","RefractiveSurgeryTypeCodeSequence"],1044:["SQ","OphthalmicUltrasoundAxialMeasurementsTypeCodeSequence"],1050:["SQ","OphthalmicAxialLengthMeasurementsSequence"],1053:["FL","IOLPower"],1054:["FL","PredictedRefractiveError"],1059:["FL","OphthalmicAxialLengthVelocity"],1065:["LO","LensStatusDescription"],1066:["LO","VitreousStatusDescription"],1090:["SQ","IOLPowerSequence"],1092:["SQ","LensConstantSequence"],1093:["LO","IOLManufacturer"],1094:["LO","LensConstantDescription"],1096:["SQ","KeratometryMeasurementTypeCodeSequence"],1100:["SQ","ReferencedOphthalmicAxialMeasurementsSequence"],1101:["SQ","OphthalmicAxialLengthMeasurementsSegmentNameCodeSequence"],1103:["SQ","RefractiveErrorBeforeRefractiveSurgeryCodeSequence"],1121:["FL","IOLPowerForExactEmmetropia"],1122:["FL","IOLPowerForExactTargetRefraction"],1125:["SQ","AnteriorChamberDepthDefinitionCodeSequence"],1130:["FL","LensThickness"],1131:["FL","AnteriorChamberDepth"],1132:["SQ","SourceOfLensThicknessDataCodeSequence"],1133:["SQ","SourceOfAnteriorChamberDepthDataCodeSequence"],1135:["SQ","SourceOfRefractiveErrorDataCodeSequence"],1140:["CS","OphthalmicAxialLengthMeasurementModified"],1150:["SQ","OphthalmicAxialLengthDataSourceCodeSequence"],1153:["SQ","OphthalmicAxialLengthAcquisitionMethodCodeSequence"],1155:["FL","SignalToNoiseRatio"],1159:["LO","OphthalmicAxialLengthDataSourceDescription"],1210:["SQ","OphthalmicAxialLengthMeasurementsTotalLengthSequence"],1211:["SQ","OphthalmicAxialLengthMeasurementsSegmentalLengthSequence"],1212:["SQ","OphthalmicAxialLengthMeasurementsLengthSummationSequence"],1220:["SQ","UltrasoundOphthalmicAxialLengthMeasurementsSequence"],1225:["SQ","OpticalOphthalmicAxialLengthMeasurementsSequence"],1230:["SQ","UltrasoundSelectedOphthalmicAxialLengthSequence"],1250:["SQ","OphthalmicAxialLengthSelectionMethodCodeSequence"],1255:["SQ","OpticalSelectedOphthalmicAxialLengthSequence"],1257:["SQ","SelectedSegmentalOphthalmicAxialLengthSequence"],1260:["SQ","SelectedTotalOphthalmicAxialLengthSequence"],1262:["SQ","OphthalmicAxialLengthQualityMetricSequence"],1273:["LO","OphthalmicAxialLengthQualityMetricTypeDescription"],1300:["SQ","IntraocularLensCalculationsRightEyeSequence"],1310:["SQ","IntraocularLensCalculationsLeftEyeSequence"],1330:["SQ","ReferencedOphthalmicAxialLengthMeasurementQCImageSequence"]},"0024":{"0010":["FL","VisualFieldHorizontalExtent"],"0011":["FL","VisualFieldVerticalExtent"],"0012":["CS","VisualFieldShape"],"0016":["SQ","ScreeningTestModeCodeSequence"],"0018":["FL","MaximumStimulusLuminance"],"0020":["FL","BackgroundLuminance"],"0021":["SQ","StimulusColorCodeSequence"],"0024":["SQ","BackgroundIlluminationColorCodeSequence"],"0025":["FL","StimulusArea"],"0028":["FL","StimulusPresentationTime"],"0032":["SQ","FixationSequence"],"0033":["SQ","FixationMonitoringCodeSequence"],"0034":["SQ","VisualFieldCatchTrialSequence"],"0035":["US","FixationCheckedQuantity"],"0036":["US","PatientNotProperlyFixatedQuantity"],"0037":["CS","PresentedVisualStimuliDataFlag"],"0038":["US","NumberOfVisualStimuli"],"0039":["CS","ExcessiveFixationLossesDataFlag"],"0040":["CS","ExcessiveFixationLosses"],"0042":["US","StimuliRetestingQuantity"],"0044":["LT","CommentsOnPatientPerformanceOfVisualField"],"0045":["CS","FalseNegativesEstimateFlag"],"0046":["FL","FalseNegativesEstimate"],"0048":["US","NegativeCatchTrialsQuantity"],"0050":["US","FalseNegativesQuantity"],"0051":["CS","ExcessiveFalseNegativesDataFlag"],"0052":["CS","ExcessiveFalseNegatives"],"0053":["CS","FalsePositivesEstimateFlag"],"0054":["FL","FalsePositivesEstimate"],"0055":["CS","CatchTrialsDataFlag"],"0056":["US","PositiveCatchTrialsQuantity"],"0057":["CS","TestPointNormalsDataFlag"],"0058":["SQ","TestPointNormalsSequence"],"0059":["CS","GlobalDeviationProbabilityNormalsFlag"],"0060":["US","FalsePositivesQuantity"],"0061":["CS","ExcessiveFalsePositivesDataFlag"],"0062":["CS","ExcessiveFalsePositives"],"0063":["CS","VisualFieldTestNormalsFlag"],"0064":["SQ","ResultsNormalsSequence"],"0065":["SQ","AgeCorrectedSensitivityDeviationAlgorithmSequence"],"0066":["FL","GlobalDeviationFromNormal"],"0067":["SQ","GeneralizedDefectSensitivityDeviationAlgorithmSequence"],"0068":["FL","LocalizedDeviationfromNormal"],"0069":["LO","PatientReliabilityIndicator"],"0070":["FL","VisualFieldMeanSensitivity"],"0071":["FL","GlobalDeviationProbability"],"0072":["CS","LocalDeviationProbabilityNormalsFlag"],"0073":["FL","LocalizedDeviationProbability"],"0074":["CS","ShortTermFluctuationCalculated"],"0075":["FL","ShortTermFluctuation"],"0076":["CS","ShortTermFluctuationProbabilityCalculated"],"0077":["FL","ShortTermFluctuationProbability"],"0078":["CS","CorrectedLocalizedDeviationFromNormalCalculated"],"0079":["FL","CorrectedLocalizedDeviationFromNormal"],"0080":["CS","CorrectedLocalizedDeviationFromNormalProbabilityCalculated"],"0081":["FL","CorrectedLocalizedDeviationFromNormalProbability"],"0083":["SQ","GlobalDeviationProbabilitySequence"],"0085":["SQ","LocalizedDeviationProbabilitySequence"],"0086":["CS","FovealSensitivityMeasured"],"0087":["FL","FovealSensitivity"],"0088":["FL","VisualFieldTestDuration"],"0089":["SQ","VisualFieldTestPointSequence"],"0090":["FL","VisualFieldTestPointXCoordinate"],"0091":["FL","VisualFieldTestPointYCoordinate"],"0092":["FL","AgeCorrectedSensitivityDeviationValue"],"0093":["CS","StimulusResults"],"0094":["FL","SensitivityValue"],"0095":["CS","RetestStimulusSeen"],"0096":["FL","RetestSensitivityValue"],"0097":["SQ","VisualFieldTestPointNormalsSequence"],"0098":["FL","QuantifiedDefect"],"0100":["FL","AgeCorrectedSensitivityDeviationProbabilityValue"],"0102":["CS","GeneralizedDefectCorrectedSensitivityDeviationFlag "],"0103":["FL","GeneralizedDefectCorrectedSensitivityDeviationValue "],"0104":["FL","GeneralizedDefectCorrectedSensitivityDeviationProbabilityValue"],"0105":["FL ","MinimumSensitivityValue"],"0106":["CS","BlindSpotLocalized"],"0107":["FL","BlindSpotXCoordinate"],"0108":["FL","BlindSpotYCoordinate "],"0110":["SQ","VisualAcuityMeasurementSequence"],"0112":["SQ","RefractiveParametersUsedOnPatientSequence"],"0113":["CS","MeasurementLaterality"],"0114":["SQ","OphthalmicPatientClinicalInformationLeftEyeSequence"],"0115":["SQ","OphthalmicPatientClinicalInformationRightEyeSequence"],"0117":["CS","FovealPointNormativeDataFlag"],"0118":["FL","FovealPointProbabilityValue"],"0120":["CS","ScreeningBaselineMeasured"],"0122":["SQ","ScreeningBaselineMeasuredSequence"],"0124":["CS","ScreeningBaselineType"],"0126":["FL","ScreeningBaselineValue"],"0202":["LO","AlgorithmSource"],"0306":["LO","DataSetName"],"0307":["LO","DataSetVersion"],"0308":["LO","DataSetSource"],"0309":["LO","DataSetDescription"],"0317":["SQ","VisualFieldTestReliabilityGlobalIndexSequence"],"0320":["SQ","VisualFieldGlobalResultsIndexSequence"],"0325":["SQ","DataObservationSequence"],"0338":["CS","IndexNormalsFlag"],"0341":["FL","IndexProbability"],"0344":["SQ","IndexProbabilitySequence"]},"0028":{"0002":["US","SamplesPerPixel"],"0003":["US","SamplesPerPixelUsed"],"0004":["CS","PhotometricInterpretation"],"0005":["US","ImageDimensions"],"0006":["US","PlanarConfiguration"],"0008":["IS","NumberOfFrames"],"0009":["AT","FrameIncrementPointer"],"000A":["AT","FrameDimensionPointer"],"0010":["US","Rows"],"0011":["US","Columns"],"0012":["US","Planes"],"0014":["US","UltrasoundColorDataPresent"],"0030":["DS","PixelSpacing"],"0031":["DS","ZoomFactor"],"0032":["DS","ZoomCenter"],"0034":["IS","PixelAspectRatio"],"0040":["CS","ImageFormat"],"0050":["LO","ManipulatedImage"],"0051":["CS","CorrectedImage"],"005F":["LO","CompressionRecognitionCode"],"0060":["CS","CompressionCode"],"0061":["SH","CompressionOriginator"],"0062":["LO","CompressionLabel"],"0063":["SH","CompressionDescription"],"0065":["CS","CompressionSequence"],"0066":["AT","CompressionStepPointers"],"0068":["US","RepeatInterval"],"0069":["US","BitsGrouped"],"0070":["US","PerimeterTable"],"0071":["SS","PerimeterValue"],"0080":["US","PredictorRows"],"0081":["US","PredictorColumns"],"0082":["US","PredictorConstants"],"0090":["CS","BlockedPixels"],"0091":["US","BlockRows"],"0092":["US","BlockColumns"],"0093":["US","RowOverlap"],"0094":["US","ColumnOverlap"],"0100":["US","BitsAllocated"],"0101":["US","BitsStored"],"0102":["US","HighBit"],"0103":["US","PixelRepresentation"],"0104":["SS","SmallestValidPixelValue"],"0105":["SS","LargestValidPixelValue"],"0106":["SS","SmallestImagePixelValue"],"0107":["SS","LargestImagePixelValue"],"0108":["SS","SmallestPixelValueInSeries"],"0109":["SS","LargestPixelValueInSeries"],"0110":["SS","SmallestImagePixelValueInPlane"],"0111":["SS","LargestImagePixelValueInPlane"],"0120":["SS","PixelPaddingValue"],"0121":["SS","PixelPaddingRangeLimit"],"0200":["US","ImageLocation"],"0300":["CS","QualityControlImage"],"0301":["CS","BurnedInAnnotation"],"0302":["CS","RecognizableVisualFeatures"],"0303":["CS","LongitudinalTemporalInformationModified"],"0400":["LO","TransformLabel"],"0401":["LO","TransformVersionNumber"],"0402":["US","NumberOfTransformSteps"],"0403":["LO","SequenceOfCompressedData"],"0404":["AT","DetailsOfCoefficients"],"0700":["LO","DCTLabel"],"0701":["CS","DataBlockDescription"],"0702":["AT","DataBlock"],"0710":["US","NormalizationFactorFormat"],"0720":["US","ZonalMapNumberFormat"],"0721":["AT","ZonalMapLocation"],"0722":["US","ZonalMapFormat"],"0730":["US","AdaptiveMapFormat"],"0740":["US","CodeNumberFormat"],"0A02":["CS","PixelSpacingCalibrationType"],"0A04":["LO","PixelSpacingCalibrationDescription"],1040:["CS","PixelIntensityRelationship"],1041:["SS","PixelIntensityRelationshipSign"],1050:["DS","WindowCenter"],1051:["DS","WindowWidth"],1052:["DS","RescaleIntercept"],1053:["DS","RescaleSlope"],1054:["LO","RescaleType"],1055:["LO","WindowCenterWidthExplanation"],1056:["CS","VOILUTFunction"],1080:["CS","GrayScale"],1090:["CS","RecommendedViewingMode"],1100:["SS","GrayLookupTableDescriptor"],1101:["SS","RedPaletteColorLookupTableDescriptor"],1102:["SS","GreenPaletteColorLookupTableDescriptor"],1103:["SS","BluePaletteColorLookupTableDescriptor"],1104:["US","AlphaPaletteColorLookupTableDescriptor"],1111:["SS","LargeRedPaletteColorLookupTableDescriptor"],1112:["SS","LargeGreenPaletteColorLookupTableDescriptor"],1113:["SS","LargeBluePaletteColorLookupTableDescriptor"],1199:["UI","PaletteColorLookupTableUID"],1200:["OW","GrayLookupTableData"],1201:["OW","RedPaletteColorLookupTableData"],1202:["OW","GreenPaletteColorLookupTableData"],1203:["OW","BluePaletteColorLookupTableData"],1204:["OW","AlphaPaletteColorLookupTableData"],1211:["OW","LargeRedPaletteColorLookupTableData"],1212:["OW","LargeGreenPaletteColorLookupTableData"],1213:["OW","LargeBluePaletteColorLookupTableData"],1214:["UI","LargePaletteColorLookupTableUID"],1221:["OW","SegmentedRedPaletteColorLookupTableData"],1222:["OW","SegmentedGreenPaletteColorLookupTableData"],1223:["OW","SegmentedBluePaletteColorLookupTableData"],1300:["CS","BreastImplantPresent"],1350:["CS","PartialView"],1351:["ST","PartialViewDescription"],1352:["SQ","PartialViewCodeSequence"],"135A":["CS","SpatialLocationsPreserved"],1401:["SQ","DataFrameAssignmentSequence"],1402:["CS","DataPathAssignment"],1403:["US","BitsMappedToColorLookupTable"],1404:["SQ","BlendingLUT1Sequence"],1405:["CS","BlendingLUT1TransferFunction"],1406:["FD","BlendingWeightConstant"],1407:["US","BlendingLookupTableDescriptor"],1408:["OW","BlendingLookupTableData"],"140B":["SQ","EnhancedPaletteColorLookupTableSequence"],"140C":["SQ","BlendingLUT2Sequence"],"140D":["CS","BlendingLUT2TransferFunction"],"140E":["CS","DataPathID"],"140F":["CS","RGBLUTTransferFunction"],1410:["CS","AlphaLUTTransferFunction"],2e3:["OB","ICCProfile"],2110:["CS","LossyImageCompression"],2112:["DS","LossyImageCompressionRatio"],2114:["CS","LossyImageCompressionMethod"],3e3:["SQ","ModalityLUTSequence"],3002:["SS","LUTDescriptor"],3003:["LO","LUTExplanation"],3004:["LO","ModalityLUTType"],3006:["OW","LUTData"],3010:["SQ","VOILUTSequence"],3110:["SQ","SoftcopyVOILUTSequence"],4e3:["LT","ImagePresentationComments"],5e3:["SQ","BiPlaneAcquisitionSequence"],6010:["US","RepresentativeFrameNumber"],6020:["US","FrameNumbersOfInterest"],6022:["LO","FrameOfInterestDescription"],6023:["CS","FrameOfInterestType"],6030:["US","MaskPointers"],6040:["US","RWavePointer"],6100:["SQ","MaskSubtractionSequence"],6101:["CS","MaskOperation"],6102:["US","ApplicableFrameRange"],6110:["US","MaskFrameNumbers"],6112:["US","ContrastFrameAveraging"],6114:["FL","MaskSubPixelShift"],6120:["SS","TIDOffset"],6190:["ST","MaskOperationExplanation"],"7FE0":["UT","PixelDataProviderURL"],9001:["UL","DataPointRows"],9002:["UL","DataPointColumns"],9003:["CS","SignalDomainColumns"],9099:["US","LargestMonochromePixelValue"],9108:["CS","DataRepresentation"],9110:["SQ","PixelMeasuresSequence"],9132:["SQ","FrameVOILUTSequence"],9145:["SQ","PixelValueTransformationSequence"],9235:["CS","SignalDomainRows"],9411:["FL","DisplayFilterPercentage"],9415:["SQ","FramePixelShiftSequence"],9416:["US","SubtractionItemID"],9422:["SQ","PixelIntensityRelationshipLUTSequence"],9443:["SQ","FramePixelDataPropertiesSequence"],9444:["CS","GeometricalProperties"],9445:["FL","GeometricMaximumDistortion"],9446:["CS","ImageProcessingApplied"],9454:["CS","MaskSelectionMode"],9474:["CS","LUTFunction"],9478:["FL","MaskVisibilityPercentage"],9501:["SQ","PixelShiftSequence"],9502:["SQ","RegionPixelShiftSequence"],9503:["SS","VerticesOfTheRegion"],9505:["SQ","MultiFramePresentationSequence"],9506:["US","PixelShiftFrameRange"],9507:["US","LUTFrameRange"],9520:["DS","ImageToEquipmentMappingMatrix"],9537:["CS","EquipmentCoordinateSystemIdentification"]},"0032":{"000A":["CS","StudyStatusID"],"000C":["CS","StudyPriorityID"],"0012":["LO","StudyIDIssuer"],"0032":["DA","StudyVerifiedDate"],"0033":["TM","StudyVerifiedTime"],"0034":["DA","StudyReadDate"],"0035":["TM","StudyReadTime"],1e3:["DA","ScheduledStudyStartDate"],1001:["TM","ScheduledStudyStartTime"],1010:["DA","ScheduledStudyStopDate"],1011:["TM","ScheduledStudyStopTime"],1020:["LO","ScheduledStudyLocation"],1021:["AE","ScheduledStudyLocationAETitle"],1030:["LO","ReasonForStudy"],1031:["SQ","RequestingPhysicianIdentificationSequence"],1032:["PN","RequestingPhysician"],1033:["LO","RequestingService"],1034:["SQ","RequestingServiceCodeSequence"],1040:["DA","StudyArrivalDate"],1041:["TM","StudyArrivalTime"],1050:["DA","StudyCompletionDate"],1051:["TM","StudyCompletionTime"],1055:["CS","StudyComponentStatusID"],1060:["LO","RequestedProcedureDescription"],1064:["SQ","RequestedProcedureCodeSequence"],1070:["LO","RequestedContrastAgent"],4e3:["LT","StudyComments"]},"0038":{"0004":["SQ","ReferencedPatientAliasSequence"],"0008":["CS","VisitStatusID"],"0010":["LO","AdmissionID"],"0011":["LO","IssuerOfAdmissionID"],"0014":["SQ","IssuerOfAdmissionIDSequence"],"0016":["LO","RouteOfAdmissions"],"001A":["DA","ScheduledAdmissionDate"],"001B":["TM","ScheduledAdmissionTime"],"001C":["DA","ScheduledDischargeDate"],"001D":["TM","ScheduledDischargeTime"],"001E":["LO","ScheduledPatientInstitutionResidence"],"0020":["DA","AdmittingDate"],"0021":["TM","AdmittingTime"],"0030":["DA","DischargeDate"],"0032":["TM","DischargeTime"],"0040":["LO","DischargeDiagnosisDescription"],"0044":["SQ","DischargeDiagnosisCodeSequence"],"0050":["LO","SpecialNeeds"],"0060":["LO","ServiceEpisodeID"],"0061":["LO","IssuerOfServiceEpisodeID"],"0062":["LO","ServiceEpisodeDescription"],"0064":["SQ","IssuerOfServiceEpisodeIDSequence"],"0100":["SQ","PertinentDocumentsSequence"],"0300":["LO","CurrentPatientLocation"],"0400":["LO","PatientInstitutionResidence"],"0500":["LO","PatientState"],"0502":["SQ","PatientClinicalTrialParticipationSequence"],4e3:["LT","VisitComments"]},"003A":{"0004":["CS","WaveformOriginality"],"0005":["US","NumberOfWaveformChannels"],"0010":["UL","NumberOfWaveformSamples"],"001A":["DS","SamplingFrequency"],"0020":["SH","MultiplexGroupLabel"],"0200":["SQ","ChannelDefinitionSequence"],"0202":["IS","WaveformChannelNumber"],"0203":["SH","ChannelLabel"],"0205":["CS","ChannelStatus"],"0208":["SQ","ChannelSourceSequence"],"0209":["SQ","ChannelSourceModifiersSequence"],"020A":["SQ","SourceWaveformSequence"],"020C":["LO","ChannelDerivationDescription"],"0210":["DS","ChannelSensitivity"],"0211":["SQ","ChannelSensitivityUnitsSequence"],"0212":["DS","ChannelSensitivityCorrectionFactor"],"0213":["DS","ChannelBaseline"],"0214":["DS","ChannelTimeSkew"],"0215":["DS","ChannelSampleSkew"],"0218":["DS","ChannelOffset"],"021A":["US","WaveformBitsStored"],"0220":["DS","FilterLowFrequency"],"0221":["DS","FilterHighFrequency"],"0222":["DS","NotchFilterFrequency"],"0223":["DS","NotchFilterBandwidth"],"0230":["FL","WaveformDataDisplayScale"],"0231":["US","WaveformDisplayBackgroundCIELabValue"],"0240":["SQ","WaveformPresentationGroupSequence"],"0241":["US","PresentationGroupNumber"],"0242":["SQ","ChannelDisplaySequence"],"0244":["US","ChannelRecommendedDisplayCIELabValue"],"0245":["FL","ChannelPosition"],"0246":["CS","DisplayShadingFlag"],"0247":["FL","FractionalChannelDisplayScale"],"0248":["FL","AbsoluteChannelDisplayScale"],"0300":["SQ","MultiplexedAudioChannelsDescriptionCodeSequence"],"0301":["IS","ChannelIdentificationCode"],"0302":["CS","ChannelMode"]},"0040":{"0001":["AE","ScheduledStationAETitle"],"0002":["DA","ScheduledProcedureStepStartDate"],"0003":["TM","ScheduledProcedureStepStartTime"],"0004":["DA","ScheduledProcedureStepEndDate"],"0005":["TM","ScheduledProcedureStepEndTime"],"0006":["PN","ScheduledPerformingPhysicianName"],"0007":["LO","ScheduledProcedureStepDescription"],"0008":["SQ","ScheduledProtocolCodeSequence"],"0009":["SH","ScheduledProcedureStepID"],"000A":["SQ","StageCodeSequence"],"000B":["SQ","ScheduledPerformingPhysicianIdentificationSequence"],"0010":["SH","ScheduledStationName"],"0011":["SH","ScheduledProcedureStepLocation"],"0012":["LO","PreMedication"],"0020":["CS","ScheduledProcedureStepStatus"],"0026":["SQ","OrderPlacerIdentifierSequence"],"0027":["SQ","OrderFillerIdentifierSequence"],"0031":["UT","LocalNamespaceEntityID"],"0032":["UT","UniversalEntityID"],"0033":["CS","UniversalEntityIDType"],"0035":["CS","IdentifierTypeCode"],"0036":["SQ","AssigningFacilitySequence"],"0039":["SQ","AssigningJurisdictionCodeSequence"],"003A":["SQ","AssigningAgencyOrDepartmentCodeSequence"],"0100":["SQ","ScheduledProcedureStepSequence"],"0220":["SQ","ReferencedNonImageCompositeSOPInstanceSequence"],"0241":["AE","PerformedStationAETitle"],"0242":["SH","PerformedStationName"],"0243":["SH","PerformedLocation"],"0244":["DA","PerformedProcedureStepStartDate"],"0245":["TM","PerformedProcedureStepStartTime"],"0250":["DA","PerformedProcedureStepEndDate"],"0251":["TM","PerformedProcedureStepEndTime"],"0252":["CS","PerformedProcedureStepStatus"],"0253":["SH","PerformedProcedureStepID"],"0254":["LO","PerformedProcedureStepDescription"],"0255":["LO","PerformedProcedureTypeDescription"],"0260":["SQ","PerformedProtocolCodeSequence"],"0261":["CS","PerformedProtocolType"],"0270":["SQ","ScheduledStepAttributesSequence"],"0275":["SQ","RequestAttributesSequence"],"0280":["ST","CommentsOnThePerformedProcedureStep"],"0281":["SQ","PerformedProcedureStepDiscontinuationReasonCodeSequence"],"0293":["SQ","QuantitySequence"],"0294":["DS","Quantity"],"0295":["SQ","MeasuringUnitsSequence"],"0296":["SQ","BillingItemSequence"],"0300":["US","TotalTimeOfFluoroscopy"],"0301":["US","TotalNumberOfExposures"],"0302":["US","EntranceDose"],"0303":["US","ExposedArea"],"0306":["DS","DistanceSourceToEntrance"],"0307":["DS","DistanceSourceToSupport"],"030E":["SQ","ExposureDoseSequence"],"0310":["ST","CommentsOnRadiationDose"],"0312":["DS","XRayOutput"],"0314":["DS","HalfValueLayer"],"0316":["DS","OrganDose"],"0318":["CS","OrganExposed"],"0320":["SQ","BillingProcedureStepSequence"],"0321":["SQ","FilmConsumptionSequence"],"0324":["SQ","BillingSuppliesAndDevicesSequence"],"0330":["SQ","ReferencedProcedureStepSequence"],"0340":["SQ","PerformedSeriesSequence"],"0400":["LT","CommentsOnTheScheduledProcedureStep"],"0440":["SQ","ProtocolContextSequence"],"0441":["SQ","ContentItemModifierSequence"],"0500":["SQ","ScheduledSpecimenSequence"],"050A":["LO","SpecimenAccessionNumber"],"0512":["LO","ContainerIdentifier"],"0513":["SQ","IssuerOfTheContainerIdentifierSequence"],"0515":["SQ","AlternateContainerIdentifierSequence"],"0518":["SQ","ContainerTypeCodeSequence"],"051A":["LO","ContainerDescription"],"0520":["SQ","ContainerComponentSequence"],"0550":["SQ","SpecimenSequence"],"0551":["LO","SpecimenIdentifier"],"0552":["SQ","SpecimenDescriptionSequenceTrial"],"0553":["ST","SpecimenDescriptionTrial"],"0554":["UI","SpecimenUID"],"0555":["SQ","AcquisitionContextSequence"],"0556":["ST","AcquisitionContextDescription"],"059A":["SQ","SpecimenTypeCodeSequence"],"0560":["SQ","SpecimenDescriptionSequence"],"0562":["SQ","IssuerOfTheSpecimenIdentifierSequence"],"0600":["LO","SpecimenShortDescription"],"0602":["UT","SpecimenDetailedDescription"],"0610":["SQ","SpecimenPreparationSequence"],"0612":["SQ","SpecimenPreparationStepContentItemSequence"],"0620":["SQ","SpecimenLocalizationContentItemSequence"],"06FA":["LO","SlideIdentifier"],"071A":["SQ","ImageCenterPointCoordinatesSequence"],"072A":["DS","XOffsetInSlideCoordinateSystem"],"073A":["DS","YOffsetInSlideCoordinateSystem"],"074A":["DS","ZOffsetInSlideCoordinateSystem"],"08D8":["SQ","PixelSpacingSequence"],"08DA":["SQ","CoordinateSystemAxisCodeSequence"],"08EA":["SQ","MeasurementUnitsCodeSequence"],"09F8":["SQ","VitalStainCodeSequenceTrial"],1001:["SH","RequestedProcedureID"],1002:["LO","ReasonForTheRequestedProcedure"],1003:["SH","RequestedProcedurePriority"],1004:["LO","PatientTransportArrangements"],1005:["LO","RequestedProcedureLocation"],1006:["SH","PlacerOrderNumberProcedure"],1007:["SH","FillerOrderNumberProcedure"],1008:["LO","ConfidentialityCode"],1009:["SH","ReportingPriority"],"100A":["SQ","ReasonForRequestedProcedureCodeSequence"],1010:["PN","NamesOfIntendedRecipientsOfResults"],1011:["SQ","IntendedRecipientsOfResultsIdentificationSequence"],1012:["SQ","ReasonForPerformedProcedureCodeSequence"],1060:["LO","RequestedProcedureDescriptionTrial"],1101:["SQ","PersonIdentificationCodeSequence"],1102:["ST","PersonAddress"],1103:["LO","PersonTelephoneNumbers"],1400:["LT","RequestedProcedureComments"],2001:["LO","ReasonForTheImagingServiceRequest"],2004:["DA","IssueDateOfImagingServiceRequest"],2005:["TM","IssueTimeOfImagingServiceRequest"],2006:["SH","PlacerOrderNumberImagingServiceRequestRetired"],2007:["SH","FillerOrderNumberImagingServiceRequestRetired"],2008:["PN","OrderEnteredBy"],2009:["SH","OrderEntererLocation"],2010:["SH","OrderCallbackPhoneNumber"],2016:["LO","PlacerOrderNumberImagingServiceRequest"],2017:["LO","FillerOrderNumberImagingServiceRequest"],2400:["LT","ImagingServiceRequestComments"],3001:["LO","ConfidentialityConstraintOnPatientDataDescription"],4001:["CS","GeneralPurposeScheduledProcedureStepStatus"],4002:["CS","GeneralPurposePerformedProcedureStepStatus"],4003:["CS","GeneralPurposeScheduledProcedureStepPriority"],4004:["SQ","ScheduledProcessingApplicationsCodeSequence"],4005:["DT","ScheduledProcedureStepStartDateTime"],4006:["CS","MultipleCopiesFlag"],4007:["SQ","PerformedProcessingApplicationsCodeSequence"],4009:["SQ","HumanPerformerCodeSequence"],4010:["DT","ScheduledProcedureStepModificationDateTime"],4011:["DT","ExpectedCompletionDateTime"],4015:["SQ","ResultingGeneralPurposePerformedProcedureStepsSequence"],4016:["SQ","ReferencedGeneralPurposeScheduledProcedureStepSequence"],4018:["SQ","ScheduledWorkitemCodeSequence"],4019:["SQ","PerformedWorkitemCodeSequence"],4020:["CS","InputAvailabilityFlag"],4021:["SQ","InputInformationSequence"],4022:["SQ","RelevantInformationSequence"],4023:["UI","ReferencedGeneralPurposeScheduledProcedureStepTransactionUID"],4025:["SQ","ScheduledStationNameCodeSequence"],4026:["SQ","ScheduledStationClassCodeSequence"],4027:["SQ","ScheduledStationGeographicLocationCodeSequence"],4028:["SQ","PerformedStationNameCodeSequence"],4029:["SQ","PerformedStationClassCodeSequence"],4030:["SQ","PerformedStationGeographicLocationCodeSequence"],4031:["SQ","RequestedSubsequentWorkitemCodeSequence"],4032:["SQ","NonDICOMOutputCodeSequence"],4033:["SQ","OutputInformationSequence"],4034:["SQ","ScheduledHumanPerformersSequence"],4035:["SQ","ActualHumanPerformersSequence"],4036:["LO","HumanPerformerOrganization"],4037:["PN","HumanPerformerName"],4040:["CS","RawDataHandling"],4041:["CS","InputReadinessState"],4050:["DT","PerformedProcedureStepStartDateTime"],4051:["DT","PerformedProcedureStepEndDateTime"],4052:["DT","ProcedureStepCancellationDateTime"],8302:["DS","EntranceDoseInmGy"],9094:["SQ","ReferencedImageRealWorldValueMappingSequence"],9096:["SQ","RealWorldValueMappingSequence"],9098:["SQ","PixelValueMappingCodeSequence"],9210:["SH","LUTLabel"],9211:["SS","RealWorldValueLastValueMapped"],9212:["FD","RealWorldValueLUTData"],9216:["SS","RealWorldValueFirstValueMapped"],9224:["FD","RealWorldValueIntercept"],9225:["FD","RealWorldValueSlope"],A007:["CS","FindingsFlagTrial"],A010:["CS","RelationshipType"],A020:["SQ","FindingsSequenceTrial"],A021:["UI","FindingsGroupUIDTrial"],A022:["UI","ReferencedFindingsGroupUIDTrial"],A023:["DA","FindingsGroupRecordingDateTrial"],A024:["TM","FindingsGroupRecordingTimeTrial"],A026:["SQ","FindingsSourceCategoryCodeSequenceTrial"],A027:["LO","VerifyingOrganization"],A028:["SQ","DocumentingOrganizationIdentifierCodeSequenceTrial"],A030:["DT","VerificationDateTime"],A032:["DT","ObservationDateTime"],A040:["CS","ValueType"],A043:["SQ","ConceptNameCodeSequence"],A047:["LO","MeasurementPrecisionDescriptionTrial"],A050:["CS","ContinuityOfContent"],A057:["CS","UrgencyOrPriorityAlertsTrial"],A060:["LO","SequencingIndicatorTrial"],A066:["SQ","DocumentIdentifierCodeSequenceTrial"],A067:["PN","DocumentAuthorTrial"],A068:["SQ","DocumentAuthorIdentifierCodeSequenceTrial"],A070:["SQ","IdentifierCodeSequenceTrial"],A073:["SQ","VerifyingObserverSequence"],A074:["OB","ObjectBinaryIdentifierTrial"],A075:["PN","VerifyingObserverName"],A076:["SQ","DocumentingObserverIdentifierCodeSequenceTrial"],A078:["SQ","AuthorObserverSequence"],A07A:["SQ","ParticipantSequence"],A07C:["SQ","CustodialOrganizationSequence"],A080:["CS","ParticipationType"],A082:["DT","ParticipationDateTime"],A084:["CS","ObserverType"],A085:["SQ","ProcedureIdentifierCodeSequenceTrial"],A088:["SQ","VerifyingObserverIdentificationCodeSequence"],A089:["OB","ObjectDirectoryBinaryIdentifierTrial"],A090:["SQ","EquivalentCDADocumentSequence"],A0B0:["US","ReferencedWaveformChannels"],A110:["DA","DateOfDocumentOrVerbalTransactionTrial"],A112:["TM","TimeOfDocumentCreationOrVerbalTransactionTrial"],A120:["DT","DateTime"],A121:["DA","Date"],A122:["TM","Time"],A123:["PN","PersonName"],A124:["UI","UID"],A125:["CS","ReportStatusIDTrial"],A130:["CS","TemporalRangeType"],A132:["UL","ReferencedSamplePositions"],A136:["US","ReferencedFrameNumbers"],A138:["DS","ReferencedTimeOffsets"],A13A:["DT","ReferencedDateTime"],A160:["UT","TextValue"],A167:["SQ","ObservationCategoryCodeSequenceTrial"],A168:["SQ","ConceptCodeSequence"],A16A:["ST","BibliographicCitationTrial"],A170:["SQ","PurposeOfReferenceCodeSequence"],A171:["UI","ObservationUIDTrial"],A172:["UI","ReferencedObservationUIDTrial"],A173:["CS","ReferencedObservationClassTrial"],A174:["CS","ReferencedObjectObservationClassTrial"],A180:["US","AnnotationGroupNumber"],A192:["DA","ObservationDateTrial"],A193:["TM","ObservationTimeTrial"],A194:["CS","MeasurementAutomationTrial"],A195:["SQ","ModifierCodeSequence"],A224:["ST","IdentificationDescriptionTrial"],A290:["CS","CoordinatesSetGeometricTypeTrial"],A296:["SQ","AlgorithmCodeSequenceTrial"],A297:["ST","AlgorithmDescriptionTrial"],A29A:["SL","PixelCoordinatesSetTrial"],A300:["SQ","MeasuredValueSequence"],A301:["SQ","NumericValueQualifierCodeSequence"],A307:["PN","CurrentObserverTrial"],A30A:["DS","NumericValue"],A313:["SQ","ReferencedAccessionSequenceTrial"],A33A:["ST","ReportStatusCommentTrial"],A340:["SQ","ProcedureContextSequenceTrial"],A352:["PN","VerbalSourceTrial"],A353:["ST","AddressTrial"],A354:["LO","TelephoneNumberTrial"],A358:["SQ","VerbalSourceIdentifierCodeSequenceTrial"],A360:["SQ","PredecessorDocumentsSequence"],A370:["SQ","ReferencedRequestSequence"],A372:["SQ","PerformedProcedureCodeSequence"],A375:["SQ","CurrentRequestedProcedureEvidenceSequence"],A380:["SQ","ReportDetailSequenceTrial"],A385:["SQ","PertinentOtherEvidenceSequence"],A390:["SQ","HL7StructuredDocumentReferenceSequence"],A402:["UI","ObservationSubjectUIDTrial"],A403:["CS","ObservationSubjectClassTrial"],A404:["SQ","ObservationSubjectTypeCodeSequenceTrial"],A491:["CS","CompletionFlag"],A492:["LO","CompletionFlagDescription"],A493:["CS","VerificationFlag"],A494:["CS","ArchiveRequested"],A496:["CS","PreliminaryFlag"],A504:["SQ","ContentTemplateSequence"],A525:["SQ","IdenticalDocumentsSequence"],A600:["CS","ObservationSubjectContextFlagTrial"],A601:["CS","ObserverContextFlagTrial"],A603:["CS","ProcedureContextFlagTrial"],A730:["SQ","ContentSequence"],A731:["SQ","RelationshipSequenceTrial"],A732:["SQ","RelationshipTypeCodeSequenceTrial"],A744:["SQ","LanguageCodeSequenceTrial"],A992:["ST","UniformResourceLocatorTrial"],B020:["SQ","WaveformAnnotationSequence"],DB00:["CS","TemplateIdentifier"],DB06:["DT","TemplateVersion"],DB07:["DT","TemplateLocalVersion"],DB0B:["CS","TemplateExtensionFlag"],DB0C:["UI","TemplateExtensionOrganizationUID"],DB0D:["UI","TemplateExtensionCreatorUID"],DB73:["UL","ReferencedContentItemIdentifier"],E001:["ST","HL7InstanceIdentifier"],E004:["DT","HL7DocumentEffectiveTime"],E006:["SQ","HL7DocumentTypeCodeSequence"],E008:["SQ","DocumentClassCodeSequence"],E010:["UT","RetrieveURI"],E011:["UI","RetrieveLocationUID"],E020:["CS","TypeOfInstances"],E021:["SQ","DICOMRetrievalSequence"],E022:["SQ","DICOMMediaRetrievalSequence"],E023:["SQ","WADORetrievalSequence"],E024:["SQ","XDSRetrievalSequence"],E030:["UI","RepositoryUniqueID"],E031:["UI","HomeCommunityID"]},"0042":{"0010":["ST","DocumentTitle"],"0011":["OB","EncapsulatedDocument"],"0012":["LO","MIMETypeOfEncapsulatedDocument"],"0013":["SQ","SourceInstanceSequence"],"0014":["LO","ListOfMIMETypes"]},"0044":{"0001":["ST","ProductPackageIdentifier"],"0002":["CS","SubstanceAdministrationApproval"],"0003":["LT","ApprovalStatusFurtherDescription"],"0004":["DT","ApprovalStatusDateTime"],"0007":["SQ","ProductTypeCodeSequence"],"0008":["LO","ProductName"],"0009":["LT","ProductDescription"],"000A":["LO","ProductLotIdentifier"],"000B":["DT","ProductExpirationDateTime"],"0010":["DT","SubstanceAdministrationDateTime"],"0011":["LO","SubstanceAdministrationNotes"],"0012":["LO","SubstanceAdministrationDeviceID"],"0013":["SQ","ProductParameterSequence"],"0019":["SQ","SubstanceAdministrationParameterSequence"]},"0046":{"0012":["LO","LensDescription"],"0014":["SQ","RightLensSequence"],"0015":["SQ","LeftLensSequence"],"0016":["SQ","UnspecifiedLateralityLensSequence"],"0018":["SQ","CylinderSequence"],"0028":["SQ","PrismSequence"],"0030":["FD","HorizontalPrismPower"],"0032":["CS","HorizontalPrismBase"],"0034":["FD","VerticalPrismPower"],"0036":["CS","VerticalPrismBase"],"0038":["CS","LensSegmentType"],"0040":["FD","OpticalTransmittance"],"0042":["FD","ChannelWidth"],"0044":["FD","PupilSize"],"0046":["FD","CornealSize"],"0050":["SQ","AutorefractionRightEyeSequence"],"0052":["SQ","AutorefractionLeftEyeSequence"],"0060":["FD","DistancePupillaryDistance"],"0062":["FD","NearPupillaryDistance"],"0063":["FD","IntermediatePupillaryDistance"],"0064":["FD","OtherPupillaryDistance"],"0070":["SQ","KeratometryRightEyeSequence"],"0071":["SQ","KeratometryLeftEyeSequence"],"0074":["SQ","SteepKeratometricAxisSequence"],"0075":["FD","RadiusOfCurvature"],"0076":["FD","KeratometricPower"],"0077":["FD","KeratometricAxis"],"0080":["SQ","FlatKeratometricAxisSequence"],"0092":["CS","BackgroundColor"],"0094":["CS","Optotype"],"0095":["CS","OptotypePresentation"],"0097":["SQ","SubjectiveRefractionRightEyeSequence"],"0098":["SQ","SubjectiveRefractionLeftEyeSequence"],"0100":["SQ","AddNearSequence"],"0101":["SQ","AddIntermediateSequence"],"0102":["SQ","AddOtherSequence"],"0104":["FD","AddPower"],"0106":["FD","ViewingDistance"],"0121":["SQ","VisualAcuityTypeCodeSequence"],"0122":["SQ","VisualAcuityRightEyeSequence"],"0123":["SQ","VisualAcuityLeftEyeSequence"],"0124":["SQ","VisualAcuityBothEyesOpenSequence"],"0125":["CS","ViewingDistanceType"],"0135":["SS","VisualAcuityModifiers"],"0137":["FD","DecimalVisualAcuity"],"0139":["LO","OptotypeDetailedDefinition"],"0145":["SQ","ReferencedRefractiveMeasurementsSequence"],"0146":["FD","SpherePower"],"0147":["FD","CylinderPower"]},"0048":{"0001":["FL","ImagedVolumeWidth"],"0002":["FL","ImagedVolumeHeight"],"0003":["FL","ImagedVolumeDepth"],"0006":["UL","TotalPixelMatrixColumns"],"0007":["UL","TotalPixelMatrixRows"],"0008":["SQ","TotalPixelMatrixOriginSequence"],"0010":["CS","SpecimenLabelInImage"],"0011":["CS","FocusMethod"],"0012":["CS","ExtendedDepthOfField"],"0013":["US","NumberOfFocalPlanes"],"0014":["FL","DistanceBetweenFocalPlanes"],"0015":["US","RecommendedAbsentPixelCIELabValue"],"0100":["SQ","IlluminatorTypeCodeSequence"],"0102":["DS","ImageOrientationSlide"],"0105":["SQ","OpticalPathSequence"],"0106":["SH","OpticalPathIdentifier"],"0107":["ST","OpticalPathDescription"],"0108":["SQ","IlluminationColorCodeSequence"],"0110":["SQ","SpecimenReferenceSequence"],"0111":["DS","CondenserLensPower"],"0112":["DS","ObjectiveLensPower"],"0113":["DS","ObjectiveLensNumericalAperture"],"0120":["SQ","PaletteColorLookupTableSequence"],"0200":["SQ","ReferencedImageNavigationSequence"],"0201":["US","TopLeftHandCornerOfLocalizerArea"],"0202":["US","BottomRightHandCornerOfLocalizerArea"],"0207":["SQ","OpticalPathIdentificationSequence"],"021A":["SQ","PlanePositionSlideSequence"],"021E":["SL","RowPositionInTotalImagePixelMatrix"],"021F":["SL","ColumnPositionInTotalImagePixelMatrix"],"0301":["CS","PixelOriginInterpretation"]},"0050":{"0004":["CS","CalibrationImage"],"0010":["SQ","DeviceSequence"],"0012":["SQ","ContainerComponentTypeCodeSequence"],"0013":["FD","ContainerComponentThickness"],"0014":["DS","DeviceLength"],"0015":["FD","ContainerComponentWidth"],"0016":["DS","DeviceDiameter"],"0017":["CS","DeviceDiameterUnits"],"0018":["DS","DeviceVolume"],"0019":["DS","InterMarkerDistance"],"001A":["CS","ContainerComponentMaterial"],"001B":["LO","ContainerComponentID"],"001C":["FD","ContainerComponentLength"],"001D":["FD","ContainerComponentDiameter"],"001E":["LO","ContainerComponentDescription"],"0020":["LO","DeviceDescription"]},"0052":{"0001":["FL","ContrastBolusIngredientPercentByVolume"],"0002":["FD","OCTFocalDistance"],"0003":["FD","BeamSpotSize"],"0004":["FD","EffectiveRefractiveIndex"],"0006":["CS","OCTAcquisitionDomain"],"0007":["FD","OCTOpticalCenterWavelength"],"0008":["FD","AxialResolution"],"0009":["FD","RangingDepth"],"0011":["FD","ALineRate"],"0012":["US","ALinesPerFrame"],"0013":["FD","CatheterRotationalRate"],"0014":["FD","ALinePixelSpacing"],"0016":["SQ","ModeOfPercutaneousAccessSequence"],"0025":["SQ","IntravascularOCTFrameTypeSequence"],"0026":["CS","OCTZOffsetApplied"],"0027":["SQ","IntravascularFrameContentSequence"],"0028":["FD","IntravascularLongitudinalDistance"],"0029":["SQ","IntravascularOCTFrameContentSequence"],"0030":["SS","OCTZOffsetCorrection"],"0031":["CS","CatheterDirectionOfRotation"],"0033":["FD","SeamLineLocation"],"0034":["FD","FirstALineLocation"],"0036":["US","SeamLineIndex"],"0038":["US","NumberOfPaddedAlines"],"0039":["CS","InterpolationType"],"003A":["CS","RefractiveIndexApplied"]},"0054":{"0010":["US","EnergyWindowVector"],"0011":["US","NumberOfEnergyWindows"],"0012":["SQ","EnergyWindowInformationSequence"],"0013":["SQ","EnergyWindowRangeSequence"],"0014":["DS","EnergyWindowLowerLimit"],"0015":["DS","EnergyWindowUpperLimit"],"0016":["SQ","RadiopharmaceuticalInformationSequence"],"0017":["IS","ResidualSyringeCounts"],"0018":["SH","EnergyWindowName"],"0020":["US","DetectorVector"],"0021":["US","NumberOfDetectors"],"0022":["SQ","DetectorInformationSequence"],"0030":["US","PhaseVector"],"0031":["US","NumberOfPhases"],"0032":["SQ","PhaseInformationSequence"],"0033":["US","NumberOfFramesInPhase"],"0036":["IS","PhaseDelay"],"0038":["IS","PauseBetweenFrames"],"0039":["CS","PhaseDescription"],"0050":["US","RotationVector"],"0051":["US","NumberOfRotations"],"0052":["SQ","RotationInformationSequence"],"0053":["US","NumberOfFramesInRotation"],"0060":["US","RRIntervalVector"],"0061":["US","NumberOfRRIntervals"],"0062":["SQ","GatedInformationSequence"],"0063":["SQ","DataInformationSequence"],"0070":["US","TimeSlotVector"],"0071":["US","NumberOfTimeSlots"],"0072":["SQ","TimeSlotInformationSequence"],"0073":["DS","TimeSlotTime"],"0080":["US","SliceVector"],"0081":["US","NumberOfSlices"],"0090":["US","AngularViewVector"],"0100":["US","TimeSliceVector"],"0101":["US","NumberOfTimeSlices"],"0200":["DS","StartAngle"],"0202":["CS","TypeOfDetectorMotion"],"0210":["IS","TriggerVector"],"0211":["US","NumberOfTriggersInPhase"],"0220":["SQ","ViewCodeSequence"],"0222":["SQ","ViewModifierCodeSequence"],"0300":["SQ","RadionuclideCodeSequence"],"0302":["SQ","AdministrationRouteCodeSequence"],"0304":["SQ","RadiopharmaceuticalCodeSequence"],"0306":["SQ","CalibrationDataSequence"],"0308":["US","EnergyWindowNumber"],"0400":["SH","ImageID"],"0410":["SQ","PatientOrientationCodeSequence"],"0412":["SQ","PatientOrientationModifierCodeSequence"],"0414":["SQ","PatientGantryRelationshipCodeSequence"],"0500":["CS","SliceProgressionDirection"],1e3:["CS","SeriesType"],1001:["CS","Units"],1002:["CS","CountsSource"],1004:["CS","ReprojectionMethod"],1006:["CS","SUVType"],1100:["CS","RandomsCorrectionMethod"],1101:["LO","AttenuationCorrectionMethod"],1102:["CS","DecayCorrection"],1103:["LO","ReconstructionMethod"],1104:["LO","DetectorLinesOfResponseUsed"],1105:["LO","ScatterCorrectionMethod"],1200:["DS","AxialAcceptance"],1201:["IS","AxialMash"],1202:["IS","TransverseMash"],1203:["DS","DetectorElementSize"],1210:["DS","CoincidenceWindowWidth"],1220:["CS","SecondaryCountsType"],1300:["DS","FrameReferenceTime"],1310:["IS","PrimaryPromptsCountsAccumulated"],1311:["IS","SecondaryCountsAccumulated"],1320:["DS","SliceSensitivityFactor"],1321:["DS","DecayFactor"],1322:["DS","DoseCalibrationFactor"],1323:["DS","ScatterFractionFactor"],1324:["DS","DeadTimeFactor"],1330:["US","ImageIndex"],1400:["CS","CountsIncluded"],1401:["CS","DeadTimeCorrectionFlag"]},"0060":{3e3:["SQ","HistogramSequence"],3002:["US","HistogramNumberOfBins"],3004:["SS","HistogramFirstBinValue"],3006:["SS","HistogramLastBinValue"],3008:["US","HistogramBinWidth"],3010:["LO","HistogramExplanation"],3020:["UL","HistogramData"]},"0062":{"0001":["CS","SegmentationType"],"0002":["SQ","SegmentSequence"],"0003":["SQ","SegmentedPropertyCategoryCodeSequence"],"0004":["US","SegmentNumber"],"0005":["LO","SegmentLabel"],"0006":["ST","SegmentDescription"],"0008":["CS","SegmentAlgorithmType"],"0009":["LO","SegmentAlgorithmName"],"000A":["SQ","SegmentIdentificationSequence"],"000B":["US","ReferencedSegmentNumber"],"000C":["US","RecommendedDisplayGrayscaleValue"],"000D":["US","RecommendedDisplayCIELabValue"],"000E":["US","MaximumFractionalValue"],"000F":["SQ","SegmentedPropertyTypeCodeSequence"],"0010":["CS","SegmentationFractionalType"]},"0064":{"0002":["SQ","DeformableRegistrationSequence"],"0003":["UI","SourceFrameOfReferenceUID"],"0005":["SQ","DeformableRegistrationGridSequence"],"0007":["UL","GridDimensions"],"0008":["FD","GridResolution"],"0009":["OF","VectorGridData"],"000F":["SQ","PreDeformationMatrixRegistrationSequence"],"0010":["SQ","PostDeformationMatrixRegistrationSequence"]},"0066":{"0001":["UL","NumberOfSurfaces"],"0002":["SQ","SurfaceSequence"],"0003":["UL","SurfaceNumber"],"0004":["LT","SurfaceComments"],"0009":["CS","SurfaceProcessing"],"000A":["FL","SurfaceProcessingRatio"],"000B":["LO","SurfaceProcessingDescription"],"000C":["FL","RecommendedPresentationOpacity"],"000D":["CS","RecommendedPresentationType"],"000E":["CS","FiniteVolume"],"0010":["CS","Manifold"],"0011":["SQ","SurfacePointsSequence"],"0012":["SQ","SurfacePointsNormalsSequence"],"0013":["SQ","SurfaceMeshPrimitivesSequence"],"0015":["UL","NumberOfSurfacePoints"],"0016":["OF","PointCoordinatesData"],"0017":["FL","PointPositionAccuracy"],"0018":["FL","MeanPointDistance"],"0019":["FL","MaximumPointDistance"],"001A":["FL","PointsBoundingBoxCoordinates"],"001B":["FL","AxisOfRotation"],"001C":["FL","CenterOfRotation"],"001E":["UL","NumberOfVectors"],"001F":["US","VectorDimensionality"],"0020":["FL","VectorAccuracy"],"0021":["OF","VectorCoordinateData"],"0023":["OW","TrianglePointIndexList"],"0024":["OW","EdgePointIndexList"],"0025":["OW","VertexPointIndexList"],"0026":["SQ","TriangleStripSequence"],"0027":["SQ","TriangleFanSequence"],"0028":["SQ","LineSequence"],"0029":["OW","PrimitivePointIndexList"],"002A":["UL","SurfaceCount"],"002B":["SQ","ReferencedSurfaceSequence"],"002C":["UL","ReferencedSurfaceNumber"],"002D":["SQ","SegmentSurfaceGenerationAlgorithmIdentificationSequence"],"002E":["SQ","SegmentSurfaceSourceInstanceSequence"],"002F":["SQ","AlgorithmFamilyCodeSequence"],"0030":["SQ","AlgorithmNameCodeSequence"],"0031":["LO","AlgorithmVersion"],"0032":["LT","AlgorithmParameters"],"0034":["SQ","FacetSequence"],"0035":["SQ","SurfaceProcessingAlgorithmIdentificationSequence"],"0036":["LO","AlgorithmName"]},"0068":{6210:["LO","ImplantSize"],6221:["LO","ImplantTemplateVersion"],6222:["SQ","ReplacedImplantTemplateSequence"],6223:["CS","ImplantType"],6224:["SQ","DerivationImplantTemplateSequence"],6225:["SQ","OriginalImplantTemplateSequence"],6226:["DT","EffectiveDateTime"],6230:["SQ","ImplantTargetAnatomySequence"],6260:["SQ","InformationFromManufacturerSequence"],6265:["SQ","NotificationFromManufacturerSequence"],6270:["DT","InformationIssueDateTime"],6280:["ST","InformationSummary"],"62A0":["SQ","ImplantRegulatoryDisapprovalCodeSequence"],"62A5":["FD","OverallTemplateSpatialTolerance"],"62C0":["SQ","HPGLDocumentSequence"],"62D0":["US","HPGLDocumentID"],"62D5":["LO","HPGLDocumentLabel"],"62E0":["SQ","ViewOrientationCodeSequence"],"62F0":["FD","ViewOrientationModifier"],"62F2":["FD","HPGLDocumentScaling"],6300:["OB","HPGLDocument"],6310:["US","HPGLContourPenNumber"],6320:["SQ","HPGLPenSequence"],6330:["US","HPGLPenNumber"],6340:["LO","HPGLPenLabel"],6345:["ST","HPGLPenDescription"],6346:["FD","RecommendedRotationPoint"],6347:["FD","BoundingRectangle"],6350:["US","ImplantTemplate3DModelSurfaceNumber"],6360:["SQ","SurfaceModelDescriptionSequence"],6380:["LO","SurfaceModelLabel"],6390:["FD","SurfaceModelScalingFactor"],"63A0":["SQ","MaterialsCodeSequence"],"63A4":["SQ","CoatingMaterialsCodeSequence"],"63A8":["SQ","ImplantTypeCodeSequence"],"63AC":["SQ","FixationMethodCodeSequence"],"63B0":["SQ","MatingFeatureSetsSequence"],"63C0":["US","MatingFeatureSetID"],"63D0":["LO","MatingFeatureSetLabel"],"63E0":["SQ","MatingFeatureSequence"],"63F0":["US","MatingFeatureID"],6400:["SQ","MatingFeatureDegreeOfFreedomSequence"],6410:["US","DegreeOfFreedomID"],6420:["CS","DegreeOfFreedomType"],6430:["SQ","TwoDMatingFeatureCoordinatesSequence"],6440:["US","ReferencedHPGLDocumentID"],6450:["FD","TwoDMatingPoint"],6460:["FD","TwoDMatingAxes"],6470:["SQ","TwoDDegreeOfFreedomSequence"],6490:["FD","ThreeDDegreeOfFreedomAxis"],"64A0":["FD","RangeOfFreedom"],"64C0":["FD","ThreeDMatingPoint"],"64D0":["FD","ThreeDMatingAxes"],"64F0":["FD","TwoDDegreeOfFreedomAxis"],6500:["SQ","PlanningLandmarkPointSequence"],6510:["SQ","PlanningLandmarkLineSequence"],6520:["SQ","PlanningLandmarkPlaneSequence"],6530:["US","PlanningLandmarkID"],6540:["LO","PlanningLandmarkDescription"],6545:["SQ","PlanningLandmarkIdentificationCodeSequence"],6550:["SQ","TwoDPointCoordinatesSequence"],6560:["FD","TwoDPointCoordinates"],6590:["FD","ThreeDPointCoordinates"],"65A0":["SQ","TwoDLineCoordinatesSequence"],"65B0":["FD","TwoDLineCoordinates"],"65D0":["FD","ThreeDLineCoordinates"],"65E0":["SQ","TwoDPlaneCoordinatesSequence"],"65F0":["FD","TwoDPlaneIntersection"],6610:["FD","ThreeDPlaneOrigin"],6620:["FD","ThreeDPlaneNormal"]},"0070":{"0001":["SQ","GraphicAnnotationSequence"],"0002":["CS","GraphicLayer"],"0003":["CS","BoundingBoxAnnotationUnits"],"0004":["CS","AnchorPointAnnotationUnits"],"0005":["CS","GraphicAnnotationUnits"],"0006":["ST","UnformattedTextValue"],"0008":["SQ","TextObjectSequence"],"0009":["SQ","GraphicObjectSequence"],"0010":["FL","BoundingBoxTopLeftHandCorner"],"0011":["FL","BoundingBoxBottomRightHandCorner"],"0012":["CS","BoundingBoxTextHorizontalJustification"],"0014":["FL","AnchorPoint"],"0015":["CS","AnchorPointVisibility"],"0020":["US","GraphicDimensions"],"0021":["US","NumberOfGraphicPoints"],"0022":["FL","GraphicData"],"0023":["CS","GraphicType"],"0024":["CS","GraphicFilled"],"0040":["IS","ImageRotationRetired"],"0041":["CS","ImageHorizontalFlip"],"0042":["US","ImageRotation"],"0050":["US","DisplayedAreaTopLeftHandCornerTrial"],"0051":["US","DisplayedAreaBottomRightHandCornerTrial"],"0052":["SL","DisplayedAreaTopLeftHandCorner"],"0053":["SL","DisplayedAreaBottomRightHandCorner"],"005A":["SQ","DisplayedAreaSelectionSequence"],"0060":["SQ","GraphicLayerSequence"],"0062":["IS","GraphicLayerOrder"],"0066":["US","GraphicLayerRecommendedDisplayGrayscaleValue"],"0067":["US","GraphicLayerRecommendedDisplayRGBValue"],"0068":["LO","GraphicLayerDescription"],"0080":["CS","ContentLabel"],"0081":["LO","ContentDescription"],"0082":["DA","PresentationCreationDate"],"0083":["TM","PresentationCreationTime"],"0084":["PN","ContentCreatorName"],"0086":["SQ","ContentCreatorIdentificationCodeSequence"],"0087":["SQ","AlternateContentDescriptionSequence"],"0100":["CS","PresentationSizeMode"],"0101":["DS","PresentationPixelSpacing"],"0102":["IS","PresentationPixelAspectRatio"],"0103":["FL","PresentationPixelMagnificationRatio"],"0207":["LO","GraphicGroupLabel"],"0208":["ST","GraphicGroupDescription"],"0209":["SQ","CompoundGraphicSequence"],"0226":["UL","CompoundGraphicInstanceID"],"0227":["LO","FontName"],"0228":["CS","FontNameType"],"0229":["LO","CSSFontName"],"0230":["FD","RotationAngle"],"0231":["SQ","TextStyleSequence"],"0232":["SQ","LineStyleSequence"],"0233":["SQ","FillStyleSequence"],"0234":["SQ","GraphicGroupSequence"],"0241":["US","TextColorCIELabValue"],"0242":["CS","HorizontalAlignment"],"0243":["CS","VerticalAlignment"],"0244":["CS","ShadowStyle"],"0245":["FL","ShadowOffsetX"],"0246":["FL","ShadowOffsetY"],"0247":["US","ShadowColorCIELabValue"],"0248":["CS","Underlined"],"0249":["CS","Bold"],"0250":["CS","Italic"],"0251":["US","PatternOnColorCIELabValue"],"0252":["US","PatternOffColorCIELabValue"],"0253":["FL","LineThickness"],"0254":["CS","LineDashingStyle"],"0255":["UL","LinePattern"],"0256":["OB","FillPattern"],"0257":["CS","FillMode"],"0258":["FL","ShadowOpacity"],"0261":["FL","GapLength"],"0262":["FL","DiameterOfVisibility"],"0273":["FL","RotationPoint"],"0274":["CS","TickAlignment"],"0278":["CS","ShowTickLabel"],"0279":["CS","TickLabelAlignment"],"0282":["CS","CompoundGraphicUnits"],"0284":["FL","PatternOnOpacity"],"0285":["FL","PatternOffOpacity"],"0287":["SQ","MajorTicksSequence"],"0288":["FL","TickPosition"],"0289":["SH","TickLabel"],"0294":["CS","CompoundGraphicType"],"0295":["UL","GraphicGroupID"],"0306":["CS","ShapeType"],"0308":["SQ","RegistrationSequence"],"0309":["SQ","MatrixRegistrationSequence"],"030A":["SQ","MatrixSequence"],"030C":["CS","FrameOfReferenceTransformationMatrixType"],"030D":["SQ","RegistrationTypeCodeSequence"],"030F":["ST","FiducialDescription"],"0310":["SH","FiducialIdentifier"],"0311":["SQ","FiducialIdentifierCodeSequence"],"0312":["FD","ContourUncertaintyRadius"],"0314":["SQ","UsedFiducialsSequence"],"0318":["SQ","GraphicCoordinatesDataSequence"],"031A":["UI","FiducialUID"],"031C":["SQ","FiducialSetSequence"],"031E":["SQ","FiducialSequence"],"0401":["US","GraphicLayerRecommendedDisplayCIELabValue"],"0402":["SQ","BlendingSequence"],"0403":["FL","RelativeOpacity"],"0404":["SQ","ReferencedSpatialRegistrationSequence"],"0405":["CS","BlendingPosition"]},"0072":{"0002":["SH","HangingProtocolName"],"0004":["LO","HangingProtocolDescription"],"0006":["CS","HangingProtocolLevel"],"0008":["LO","HangingProtocolCreator"],"000A":["DT","HangingProtocolCreationDateTime"],"000C":["SQ","HangingProtocolDefinitionSequence"],"000E":["SQ","HangingProtocolUserIdentificationCodeSequence"],"0010":["LO","HangingProtocolUserGroupName"],"0012":["SQ","SourceHangingProtocolSequence"],"0014":["US","NumberOfPriorsReferenced"],"0020":["SQ","ImageSetsSequence"],"0022":["SQ","ImageSetSelectorSequence"],"0024":["CS","ImageSetSelectorUsageFlag"],"0026":["AT","SelectorAttribute"],"0028":["US","SelectorValueNumber"],"0030":["SQ","TimeBasedImageSetsSequence"],"0032":["US","ImageSetNumber"],"0034":["CS","ImageSetSelectorCategory"],"0038":["US","RelativeTime"],"003A":["CS","RelativeTimeUnits"],"003C":["SS","AbstractPriorValue"],"003E":["SQ","AbstractPriorCodeSequence"],"0040":["LO","ImageSetLabel"],"0050":["CS","SelectorAttributeVR"],"0052":["AT","SelectorSequencePointer"],"0054":["LO","SelectorSequencePointerPrivateCreator"],"0056":["LO","SelectorAttributePrivateCreator"],"0060":["AT","SelectorATValue"],"0062":["CS","SelectorCSValue"],"0064":["IS","SelectorISValue"],"0066":["LO","SelectorLOValue"],"0068":["LT","SelectorLTValue"],"006A":["PN","SelectorPNValue"],"006C":["SH","SelectorSHValue"],"006E":["ST","SelectorSTValue"],"0070":["UT","SelectorUTValue"],"0072":["DS","SelectorDSValue"],"0074":["FD","SelectorFDValue"],"0076":["FL","SelectorFLValue"],"0078":["UL","SelectorULValue"],"007A":["US","SelectorUSValue"],"007C":["SL","SelectorSLValue"],"007E":["SS","SelectorSSValue"],"0080":["SQ","SelectorCodeSequenceValue"],"0100":["US","NumberOfScreens"],"0102":["SQ","NominalScreenDefinitionSequence"],"0104":["US","NumberOfVerticalPixels"],"0106":["US","NumberOfHorizontalPixels"],"0108":["FD","DisplayEnvironmentSpatialPosition"],"010A":["US","ScreenMinimumGrayscaleBitDepth"],"010C":["US","ScreenMinimumColorBitDepth"],"010E":["US","ApplicationMaximumRepaintTime"],"0200":["SQ","DisplaySetsSequence"],"0202":["US","DisplaySetNumber"],"0203":["LO","DisplaySetLabel"],"0204":["US","DisplaySetPresentationGroup"],"0206":["LO","DisplaySetPresentationGroupDescription"],"0208":["CS","PartialDataDisplayHandling"],"0210":["SQ","SynchronizedScrollingSequence"],"0212":["US","DisplaySetScrollingGroup"],"0214":["SQ","NavigationIndicatorSequence"],"0216":["US","NavigationDisplaySet"],"0218":["US","ReferenceDisplaySets"],"0300":["SQ","ImageBoxesSequence"],"0302":["US","ImageBoxNumber"],"0304":["CS","ImageBoxLayoutType"],"0306":["US","ImageBoxTileHorizontalDimension"],"0308":["US","ImageBoxTileVerticalDimension"],"0310":["CS","ImageBoxScrollDirection"],"0312":["CS","ImageBoxSmallScrollType"],"0314":["US","ImageBoxSmallScrollAmount"],"0316":["CS","ImageBoxLargeScrollType"],"0318":["US","ImageBoxLargeScrollAmount"],"0320":["US","ImageBoxOverlapPriority"],"0330":["FD","CineRelativeToRealTime"],"0400":["SQ","FilterOperationsSequence"],"0402":["CS","FilterByCategory"],"0404":["CS","FilterByAttributePresence"],"0406":["CS","FilterByOperator"],"0420":["US","StructuredDisplayBackgroundCIELabValue"],"0421":["US","EmptyImageBoxCIELabValue"],"0422":["SQ","StructuredDisplayImageBoxSequence"],"0424":["SQ","StructuredDisplayTextBoxSequence"],"0427":["SQ","ReferencedFirstFrameSequence"],"0430":["SQ","ImageBoxSynchronizationSequence"],"0432":["US","SynchronizedImageBoxList"],"0434":["CS","TypeOfSynchronization"],"0500":["CS","BlendingOperationType"],"0510":["CS","ReformattingOperationType"],"0512":["FD","ReformattingThickness"],"0514":["FD","ReformattingInterval"],"0516":["CS","ReformattingOperationInitialViewDirection"],"0520":["CS","ThreeDRenderingType"],"0600":["SQ","SortingOperationsSequence"],"0602":["CS","SortByCategory"],"0604":["CS","SortingDirection"],"0700":["CS","DisplaySetPatientOrientation"],"0702":["CS","VOIType"],"0704":["CS","PseudoColorType"],"0705":["SQ","PseudoColorPaletteInstanceReferenceSequence"],"0706":["CS","ShowGrayscaleInverted"],"0710":["CS","ShowImageTrueSizeFlag"],"0712":["CS","ShowGraphicAnnotationFlag"],"0714":["CS","ShowPatientDemographicsFlag"],"0716":["CS","ShowAcquisitionTechniquesFlag"],"0717":["CS","DisplaySetHorizontalJustification"],"0718":["CS","DisplaySetVerticalJustification"]},"0074":{"0120":["FD","ContinuationStartMeterset"],"0121":["FD","ContinuationEndMeterset"],1e3:["CS","ProcedureStepState"],1002:["SQ","ProcedureStepProgressInformationSequence"],1004:["DS","ProcedureStepProgress"],1006:["ST","ProcedureStepProgressDescription"],1008:["SQ","ProcedureStepCommunicationsURISequence"],"100A":["ST","ContactURI"],"100C":["LO","ContactDisplayName"],"100E":["SQ","ProcedureStepDiscontinuationReasonCodeSequence"],1020:["SQ","BeamTaskSequence"],1022:["CS","BeamTaskType"],1024:["IS","BeamOrderIndexTrial"],1026:["FD","TableTopVerticalAdjustedPosition"],1027:["FD","TableTopLongitudinalAdjustedPosition"],1028:["FD","TableTopLateralAdjustedPosition"],"102A":["FD","PatientSupportAdjustedAngle"],"102B":["FD","TableTopEccentricAdjustedAngle"],"102C":["FD","TableTopPitchAdjustedAngle"],"102D":["FD","TableTopRollAdjustedAngle"],1030:["SQ","DeliveryVerificationImageSequence"],1032:["CS","VerificationImageTiming"],1034:["CS","DoubleExposureFlag"],1036:["CS","DoubleExposureOrdering"],1038:["DS","DoubleExposureMetersetTrial"],"103A":["DS","DoubleExposureFieldDeltaTrial"],1040:["SQ","RelatedReferenceRTImageSequence"],1042:["SQ","GeneralMachineVerificationSequence"],1044:["SQ","ConventionalMachineVerificationSequence"],1046:["SQ","IonMachineVerificationSequence"],1048:["SQ","FailedAttributesSequence"],"104A":["SQ","OverriddenAttributesSequence"],"104C":["SQ","ConventionalControlPointVerificationSequence"],"104E":["SQ","IonControlPointVerificationSequence"],1050:["SQ","AttributeOccurrenceSequence"],1052:["AT","AttributeOccurrencePointer"],1054:["UL","AttributeItemSelector"],1056:["LO","AttributeOccurrencePrivateCreator"],1057:["IS","SelectorSequencePointerItems"],1200:["CS","ScheduledProcedureStepPriority"],1202:["LO","WorklistLabel"],1204:["LO","ProcedureStepLabel"],1210:["SQ","ScheduledProcessingParametersSequence"],1212:["SQ","PerformedProcessingParametersSequence"],1216:["SQ","UnifiedProcedureStepPerformedProcedureSequence"],1220:["SQ","RelatedProcedureStepSequence"],1222:["LO","ProcedureStepRelationshipType"],1224:["SQ","ReplacedProcedureStepSequence"],1230:["LO","DeletionLock"],1234:["AE","ReceivingAE"],1236:["AE","RequestingAE"],1238:["LT","ReasonForCancellation"],1242:["CS","SCPStatus"],1244:["CS","SubscriptionListStatus"],1246:["CS","UnifiedProcedureStepListStatus"],1324:["UL","BeamOrderIndex"],1338:["FD","DoubleExposureMeterset"],"133A":["FD","DoubleExposureFieldDelta"]},"0076":{"0001":["LO","ImplantAssemblyTemplateName"],"0003":["LO","ImplantAssemblyTemplateIssuer"],"0006":["LO","ImplantAssemblyTemplateVersion"],"0008":["SQ","ReplacedImplantAssemblyTemplateSequence"],"000A":["CS","ImplantAssemblyTemplateType"],"000C":["SQ","OriginalImplantAssemblyTemplateSequence"],"000E":["SQ","DerivationImplantAssemblyTemplateSequence"],"0010":["SQ","ImplantAssemblyTemplateTargetAnatomySequence"],"0020":["SQ","ProcedureTypeCodeSequence"],"0030":["LO","SurgicalTechnique"],"0032":["SQ","ComponentTypesSequence"],"0034":["CS","ComponentTypeCodeSequence"],"0036":["CS","ExclusiveComponentType"],"0038":["CS","MandatoryComponentType"],"0040":["SQ","ComponentSequence"],"0055":["US","ComponentID"],"0060":["SQ","ComponentAssemblySequence"],"0070":["US","Component1ReferencedID"],"0080":["US","Component1ReferencedMatingFeatureSetID"],"0090":["US","Component1ReferencedMatingFeatureID"],"00A0":["US","Component2ReferencedID"],"00B0":["US","Component2ReferencedMatingFeatureSetID"],"00C0":["US","Component2ReferencedMatingFeatureID"]},"0078":{"0001":["LO","ImplantTemplateGroupName"],"0010":["ST","ImplantTemplateGroupDescription"],"0020":["LO","ImplantTemplateGroupIssuer"],"0024":["LO","ImplantTemplateGroupVersion"],"0026":["SQ","ReplacedImplantTemplateGroupSequence"],"0028":["SQ","ImplantTemplateGroupTargetAnatomySequence"],"002A":["SQ","ImplantTemplateGroupMembersSequence"],"002E":["US","ImplantTemplateGroupMemberID"],"0050":["FD","ThreeDImplantTemplateGroupMemberMatchingPoint"],"0060":["FD","ThreeDImplantTemplateGroupMemberMatchingAxes"],"0070":["SQ","ImplantTemplateGroupMemberMatching2DCoordinatesSequence"],"0090":["FD","TwoDImplantTemplateGroupMemberMatchingPoint"],"00A0":["FD","TwoDImplantTemplateGroupMemberMatchingAxes"],"00B0":["SQ","ImplantTemplateGroupVariationDimensionSequence"],"00B2":["LO","ImplantTemplateGroupVariationDimensionName"],"00B4":["SQ","ImplantTemplateGroupVariationDimensionRankSequence"],"00B6":["US","ReferencedImplantTemplateGroupMemberID"],"00B8":["US","ImplantTemplateGroupVariationDimensionRank"]},"0088":{"0130":["SH","StorageMediaFileSetID"],"0140":["UI","StorageMediaFileSetUID"],"0200":["SQ","IconImageSequence"],"0904":["LO","TopicTitle"],"0906":["ST","TopicSubject"],"0910":["LO","TopicAuthor"],"0912":["LO","TopicKeywords"]},"0100":{"0410":["CS","SOPInstanceStatus"],"0420":["DT","SOPAuthorizationDateTime"],"0424":["LT","SOPAuthorizationComment"],"0426":["LO","AuthorizationEquipmentCertificationNumber"]},"0400":{"0005":["US","MACIDNumber"],"0010":["UI","MACCalculationTransferSyntaxUID"],"0015":["CS","MACAlgorithm"],"0020":["AT","DataElementsSigned"],"0100":["UI","DigitalSignatureUID"],"0105":["DT","DigitalSignatureDateTime"],"0110":["CS","CertificateType"],"0115":["OB","CertificateOfSigner"],"0120":["OB","Signature"],"0305":["CS","CertifiedTimestampType"],"0310":["OB","CertifiedTimestamp"],"0401":["SQ","DigitalSignaturePurposeCodeSequence"],"0402":["SQ","ReferencedDigitalSignatureSequence"],"0403":["SQ","ReferencedSOPInstanceMACSequence"],"0404":["OB","MAC"],"0500":["SQ","EncryptedAttributesSequence"],"0510":["UI","EncryptedContentTransferSyntaxUID"],"0520":["OB","EncryptedContent"],"0550":["SQ","ModifiedAttributesSequence"],"0561":["SQ","OriginalAttributesSequence"],"0562":["DT","AttributeModificationDateTime"],"0563":["LO","ModifyingSystem"],"0564":["LO","SourceOfPreviousValues"],"0565":["CS","ReasonForTheAttributeModification"]},2e3:{"0010":["IS","NumberOfCopies"],"001E":["SQ","PrinterConfigurationSequence"],"0020":["CS","PrintPriority"],"0030":["CS","MediumType"],"0040":["CS","FilmDestination"],"0050":["LO","FilmSessionLabel"],"0060":["IS","MemoryAllocation"],"0061":["IS","MaximumMemoryAllocation"],"0062":["CS","ColorImagePrintingFlag"],"0063":["CS","CollationFlag"],"0065":["CS","AnnotationFlag"],"0067":["CS","ImageOverlayFlag"],"0069":["CS","PresentationLUTFlag"],"006A":["CS","ImageBoxPresentationLUTFlag"],"00A0":["US","MemoryBitDepth"],"00A1":["US","PrintingBitDepth"],"00A2":["SQ","MediaInstalledSequence"],"00A4":["SQ","OtherMediaAvailableSequence"],"00A8":["SQ","SupportedImageDisplayFormatsSequence"],"0500":["SQ","ReferencedFilmBoxSequence"],"0510":["SQ","ReferencedStoredPrintSequence"]},2010:{"0010":["ST","ImageDisplayFormat"],"0030":["CS","AnnotationDisplayFormatID"],"0040":["CS","FilmOrientation"],"0050":["CS","FilmSizeID"],"0052":["CS","PrinterResolutionID"],"0054":["CS","DefaultPrinterResolutionID"],"0060":["CS","MagnificationType"],"0080":["CS","SmoothingType"],"00A6":["CS","DefaultMagnificationType"],"00A7":["CS","OtherMagnificationTypesAvailable"],"00A8":["CS","DefaultSmoothingType"],"00A9":["CS","OtherSmoothingTypesAvailable"],"0100":["CS","BorderDensity"],"0110":["CS","EmptyImageDensity"],"0120":["US","MinDensity"],"0130":["US","MaxDensity"],"0140":["CS","Trim"],"0150":["ST","ConfigurationInformation"],"0152":["LT","ConfigurationInformationDescription"],"0154":["IS","MaximumCollatedFilms"],"015E":["US","Illumination"],"0160":["US","ReflectedAmbientLight"],"0376":["DS","PrinterPixelSpacing"],"0500":["SQ","ReferencedFilmSessionSequence"],"0510":["SQ","ReferencedImageBoxSequence"],"0520":["SQ","ReferencedBasicAnnotationBoxSequence"]},2020:{"0010":["US","ImageBoxPosition"],"0020":["CS","Polarity"],"0030":["DS","RequestedImageSize"],"0040":["CS","RequestedDecimateCropBehavior"],"0050":["CS","RequestedResolutionID"],"00A0":["CS","RequestedImageSizeFlag"],"00A2":["CS","DecimateCropResult"],"0110":["SQ","BasicGrayscaleImageSequence"],"0111":["SQ","BasicColorImageSequence"],"0130":["SQ","ReferencedImageOverlayBoxSequence"],"0140":["SQ","ReferencedVOILUTBoxSequence"]},2030:{"0010":["US","AnnotationPosition"],"0020":["LO","TextString"]},2040:{"0010":["SQ","ReferencedOverlayPlaneSequence"],"0011":["US","ReferencedOverlayPlaneGroups"],"0020":["SQ","OverlayPixelDataSequence"],"0060":["CS","OverlayMagnificationType"],"0070":["CS","OverlaySmoothingType"],"0072":["CS","OverlayOrImageMagnification"],"0074":["US","MagnifyToNumberOfColumns"],"0080":["CS","OverlayForegroundDensity"],"0082":["CS","OverlayBackgroundDensity"],"0090":["CS","OverlayMode"],"0100":["CS","ThresholdDensity"],"0500":["SQ","ReferencedImageBoxSequenceRetired"]},2050:{"0010":["SQ","PresentationLUTSequence"],"0020":["CS","PresentationLUTShape"],"0500":["SQ","ReferencedPresentationLUTSequence"]},2100:{"0010":["SH","PrintJobID"],"0020":["CS","ExecutionStatus"],"0030":["CS","ExecutionStatusInfo"],"0040":["DA","CreationDate"],"0050":["TM","CreationTime"],"0070":["AE","Originator"],"0140":["AE","DestinationAE"],"0160":["SH","OwnerID"],"0170":["IS","NumberOfFilms"],"0500":["SQ","ReferencedPrintJobSequencePullStoredPrint"]},2110:{"0010":["CS","PrinterStatus"],"0020":["CS","PrinterStatusInfo"],"0030":["LO","PrinterName"],"0099":["SH","PrintQueueID"]},2120:{"0010":["CS","QueueStatus"],"0050":["SQ","PrintJobDescriptionSequence"],"0070":["SQ","ReferencedPrintJobSequence"]},2130:{"0010":["SQ","PrintManagementCapabilitiesSequence"],"0015":["SQ","PrinterCharacteristicsSequence"],"0030":["SQ","FilmBoxContentSequence"],"0040":["SQ","ImageBoxContentSequence"],"0050":["SQ","AnnotationContentSequence"],"0060":["SQ","ImageOverlayBoxContentSequence"],"0080":["SQ","PresentationLUTContentSequence"],"00A0":["SQ","ProposedStudySequence"],"00C0":["SQ","OriginalImageSequence"]},2200:{"0001":["CS","LabelUsingInformationExtractedFromInstances"],"0002":["UT","LabelText"],"0003":["CS","LabelStyleSelection"],"0004":["LT","MediaDisposition"],"0005":["LT","BarcodeValue"],"0006":["CS","BarcodeSymbology"],"0007":["CS","AllowMediaSplitting"],"0008":["CS","IncludeNonDICOMObjects"],"0009":["CS","IncludeDisplayApplication"],"000A":["CS","PreserveCompositeInstancesAfterMediaCreation"],"000B":["US","TotalNumberOfPiecesOfMediaCreated"],"000C":["LO","RequestedMediaApplicationProfile"],"000D":["SQ","ReferencedStorageMediaSequence"],"000E":["AT","FailureAttributes"],"000F":["CS","AllowLossyCompression"],"0020":["CS","RequestPriority"]},3002:{"0002":["SH","RTImageLabel"],"0003":["LO","RTImageName"],"0004":["ST","RTImageDescription"],"000A":["CS","ReportedValuesOrigin"],"000C":["CS","RTImagePlane"],"000D":["DS","XRayImageReceptorTranslation"],"000E":["DS","XRayImageReceptorAngle"],"0010":["DS","RTImageOrientation"],"0011":["DS","ImagePlanePixelSpacing"],"0012":["DS","RTImagePosition"],"0020":["SH","RadiationMachineName"],"0022":["DS","RadiationMachineSAD"],"0024":["DS","RadiationMachineSSD"],"0026":["DS","RTImageSID"],"0028":["DS","SourceToReferenceObjectDistance"],"0029":["IS","FractionNumber"],"0030":["SQ","ExposureSequence"],"0032":["DS","MetersetExposure"],"0034":["DS","DiaphragmPosition"],"0040":["SQ","FluenceMapSequence"],"0041":["CS","FluenceDataSource"],"0042":["DS","FluenceDataScale"],"0050":["SQ","PrimaryFluenceModeSequence"],"0051":["CS","FluenceMode"],"0052":["SH","FluenceModeID"]},3004:{"0001":["CS","DVHType"],"0002":["CS","DoseUnits"],"0004":["CS","DoseType"],"0006":["LO","DoseComment"],"0008":["DS","NormalizationPoint"],"000A":["CS","DoseSummationType"],"000C":["DS","GridFrameOffsetVector"],"000E":["DS","DoseGridScaling"],"0010":["SQ","RTDoseROISequence"],"0012":["DS","DoseValue"],"0014":["CS","TissueHeterogeneityCorrection"],"0040":["DS","DVHNormalizationPoint"],"0042":["DS","DVHNormalizationDoseValue"],"0050":["SQ","DVHSequence"],"0052":["DS","DVHDoseScaling"],"0054":["CS","DVHVolumeUnits"],"0056":["IS","DVHNumberOfBins"],"0058":["DS","DVHData"],"0060":["SQ","DVHReferencedROISequence"],"0062":["CS","DVHROIContributionType"],"0070":["DS","DVHMinimumDose"],"0072":["DS","DVHMaximumDose"],"0074":["DS","DVHMeanDose"]},3006:{"0002":["SH","StructureSetLabel"],"0004":["LO","StructureSetName"],"0006":["ST","StructureSetDescription"],"0008":["DA","StructureSetDate"],"0009":["TM","StructureSetTime"],"0010":["SQ","ReferencedFrameOfReferenceSequence"],"0012":["SQ","RTReferencedStudySequence"],"0014":["SQ","RTReferencedSeriesSequence"],"0016":["SQ","ContourImageSequence"],"0020":["SQ","StructureSetROISequence"],"0022":["IS","ROINumber"],"0024":["UI","ReferencedFrameOfReferenceUID"],"0026":["LO","ROIName"],"0028":["ST","ROIDescription"],"002A":["IS","ROIDisplayColor"],"002C":["DS","ROIVolume"],"0030":["SQ","RTRelatedROISequence"],"0033":["CS","RTROIRelationship"],"0036":["CS","ROIGenerationAlgorithm"],"0038":["LO","ROIGenerationDescription"],"0039":["SQ","ROIContourSequence"],"0040":["SQ","ContourSequence"],"0042":["CS","ContourGeometricType"],"0044":["DS","ContourSlabThickness"],"0045":["DS","ContourOffsetVector"],"0046":["IS","NumberOfContourPoints"],"0048":["IS","ContourNumber"],"0049":["IS","AttachedContours"],"0050":["DS","ContourData"],"0080":["SQ","RTROIObservationsSequence"],"0082":["IS","ObservationNumber"],"0084":["IS","ReferencedROINumber"],"0085":["SH","ROIObservationLabel"],"0086":["SQ","RTROIIdentificationCodeSequence"],"0088":["ST","ROIObservationDescription"],"00A0":["SQ","RelatedRTROIObservationsSequence"],"00A4":["CS","RTROIInterpretedType"],"00A6":["PN","ROIInterpreter"],"00B0":["SQ","ROIPhysicalPropertiesSequence"],"00B2":["CS","ROIPhysicalProperty"],"00B4":["DS","ROIPhysicalPropertyValue"],"00B6":["SQ","ROIElementalCompositionSequence"],"00B7":["US","ROIElementalCompositionAtomicNumber"],"00B8":["FL","ROIElementalCompositionAtomicMassFraction"],"00C0":["SQ","FrameOfReferenceRelationshipSequence"],"00C2":["UI","RelatedFrameOfReferenceUID"],"00C4":["CS","FrameOfReferenceTransformationType"],"00C6":["DS","FrameOfReferenceTransformationMatrix"],"00C8":["LO","FrameOfReferenceTransformationComment"]},3008:{"0010":["SQ","MeasuredDoseReferenceSequence"],"0012":["ST","MeasuredDoseDescription"],"0014":["CS","MeasuredDoseType"],"0016":["DS","MeasuredDoseValue"],"0020":["SQ","TreatmentSessionBeamSequence"],"0021":["SQ","TreatmentSessionIonBeamSequence"],"0022":["IS","CurrentFractionNumber"],"0024":["DA","TreatmentControlPointDate"],"0025":["TM","TreatmentControlPointTime"],"002A":["CS","TreatmentTerminationStatus"],"002B":["SH","TreatmentTerminationCode"],"002C":["CS","TreatmentVerificationStatus"],"0030":["SQ","ReferencedTreatmentRecordSequence"],"0032":["DS","SpecifiedPrimaryMeterset"],"0033":["DS","SpecifiedSecondaryMeterset"],"0036":["DS","DeliveredPrimaryMeterset"],"0037":["DS","DeliveredSecondaryMeterset"],"003A":["DS","SpecifiedTreatmentTime"],"003B":["DS","DeliveredTreatmentTime"],"0040":["SQ","ControlPointDeliverySequence"],"0041":["SQ","IonControlPointDeliverySequence"],"0042":["DS","SpecifiedMeterset"],"0044":["DS","DeliveredMeterset"],"0045":["FL","MetersetRateSet"],"0046":["FL","MetersetRateDelivered"],"0047":["FL","ScanSpotMetersetsDelivered"],"0048":["DS","DoseRateDelivered"],"0050":["SQ","TreatmentSummaryCalculatedDoseReferenceSequence"],"0052":["DS","CumulativeDoseToDoseReference"],"0054":["DA","FirstTreatmentDate"],"0056":["DA","MostRecentTreatmentDate"],"005A":["IS","NumberOfFractionsDelivered"],"0060":["SQ","OverrideSequence"],"0061":["AT","ParameterSequencePointer"],"0062":["AT","OverrideParameterPointer"],"0063":["IS","ParameterItemIndex"],"0064":["IS","MeasuredDoseReferenceNumber"],"0065":["AT","ParameterPointer"],"0066":["ST","OverrideReason"],"0068":["SQ","CorrectedParameterSequence"],"006A":["FL","CorrectionValue"],"0070":["SQ","CalculatedDoseReferenceSequence"],"0072":["IS","CalculatedDoseReferenceNumber"],"0074":["ST","CalculatedDoseReferenceDescription"],"0076":["DS","CalculatedDoseReferenceDoseValue"],"0078":["DS","StartMeterset"],"007A":["DS","EndMeterset"],"0080":["SQ","ReferencedMeasuredDoseReferenceSequence"],"0082":["IS","ReferencedMeasuredDoseReferenceNumber"],"0090":["SQ","ReferencedCalculatedDoseReferenceSequence"],"0092":["IS","ReferencedCalculatedDoseReferenceNumber"],"00A0":["SQ","BeamLimitingDeviceLeafPairsSequence"],"00B0":["SQ","RecordedWedgeSequence"],"00C0":["SQ","RecordedCompensatorSequence"],"00D0":["SQ","RecordedBlockSequence"],"00E0":["SQ","TreatmentSummaryMeasuredDoseReferenceSequence"],"00F0":["SQ","RecordedSnoutSequence"],"00F2":["SQ","RecordedRangeShifterSequence"],"00F4":["SQ","RecordedLateralSpreadingDeviceSequence"],"00F6":["SQ","RecordedRangeModulatorSequence"],"0100":["SQ","RecordedSourceSequence"],"0105":["LO","SourceSerialNumber"],"0110":["SQ","TreatmentSessionApplicationSetupSequence"],"0116":["CS","ApplicationSetupCheck"],"0120":["SQ","RecordedBrachyAccessoryDeviceSequence"],"0122":["IS","ReferencedBrachyAccessoryDeviceNumber"],"0130":["SQ","RecordedChannelSequence"],"0132":["DS","SpecifiedChannelTotalTime"],"0134":["DS","DeliveredChannelTotalTime"],"0136":["IS","SpecifiedNumberOfPulses"],"0138":["IS","DeliveredNumberOfPulses"],"013A":["DS","SpecifiedPulseRepetitionInterval"],"013C":["DS","DeliveredPulseRepetitionInterval"],"0140":["SQ","RecordedSourceApplicatorSequence"],"0142":["IS","ReferencedSourceApplicatorNumber"],"0150":["SQ","RecordedChannelShieldSequence"],"0152":["IS","ReferencedChannelShieldNumber"],"0160":["SQ","BrachyControlPointDeliveredSequence"],"0162":["DA","SafePositionExitDate"],"0164":["TM","SafePositionExitTime"],"0166":["DA","SafePositionReturnDate"],"0168":["TM","SafePositionReturnTime"],"0200":["CS","CurrentTreatmentStatus"],"0202":["ST","TreatmentStatusComment"],"0220":["SQ","FractionGroupSummarySequence"],"0223":["IS","ReferencedFractionNumber"],"0224":["CS","FractionGroupType"],"0230":["CS","BeamStopperPosition"],"0240":["SQ","FractionStatusSummarySequence"],"0250":["DA","TreatmentDate"],"0251":["TM","TreatmentTime"]},"300A":{"0002":["SH","RTPlanLabel"],"0003":["LO","RTPlanName"],"0004":["ST","RTPlanDescription"],"0006":["DA","RTPlanDate"],"0007":["TM","RTPlanTime"],"0009":["LO","TreatmentProtocols"],"000A":["CS","PlanIntent"],"000B":["LO","TreatmentSites"],"000C":["CS","RTPlanGeometry"],"000E":["ST","PrescriptionDescription"],"0010":["SQ","DoseReferenceSequence"],"0012":["IS","DoseReferenceNumber"],"0013":["UI","DoseReferenceUID"],"0014":["CS","DoseReferenceStructureType"],"0015":["CS","NominalBeamEnergyUnit"],"0016":["LO","DoseReferenceDescription"],"0018":["DS","DoseReferencePointCoordinates"],"001A":["DS","NominalPriorDose"],"0020":["CS","DoseReferenceType"],"0021":["DS","ConstraintWeight"],"0022":["DS","DeliveryWarningDose"],"0023":["DS","DeliveryMaximumDose"],"0025":["DS","TargetMinimumDose"],"0026":["DS","TargetPrescriptionDose"],"0027":["DS","TargetMaximumDose"],"0028":["DS","TargetUnderdoseVolumeFraction"],"002A":["DS","OrganAtRiskFullVolumeDose"],"002B":["DS","OrganAtRiskLimitDose"],"002C":["DS","OrganAtRiskMaximumDose"],"002D":["DS","OrganAtRiskOverdoseVolumeFraction"],"0040":["SQ","ToleranceTableSequence"],"0042":["IS","ToleranceTableNumber"],"0043":["SH","ToleranceTableLabel"],"0044":["DS","GantryAngleTolerance"],"0046":["DS","BeamLimitingDeviceAngleTolerance"],"0048":["SQ","BeamLimitingDeviceToleranceSequence"],"004A":["DS","BeamLimitingDevicePositionTolerance"],"004B":["FL","SnoutPositionTolerance"],"004C":["DS","PatientSupportAngleTolerance"],"004E":["DS","TableTopEccentricAngleTolerance"],"004F":["FL","TableTopPitchAngleTolerance"],"0050":["FL","TableTopRollAngleTolerance"],"0051":["DS","TableTopVerticalPositionTolerance"],"0052":["DS","TableTopLongitudinalPositionTolerance"],"0053":["DS","TableTopLateralPositionTolerance"],"0055":["CS","RTPlanRelationship"],"0070":["SQ","FractionGroupSequence"],"0071":["IS","FractionGroupNumber"],"0072":["LO","FractionGroupDescription"],"0078":["IS","NumberOfFractionsPlanned"],"0079":["IS","NumberOfFractionPatternDigitsPerDay"],"007A":["IS","RepeatFractionCycleLength"],"007B":["LT","FractionPattern"],"0080":["IS","NumberOfBeams"],"0082":["DS","BeamDoseSpecificationPoint"],"0084":["DS","BeamDose"],"0086":["DS","BeamMeterset"],"0088":["FL","BeamDosePointDepth"],"0089":["FL","BeamDosePointEquivalentDepth"],"008A":["FL","BeamDosePointSSD"],"00A0":["IS","NumberOfBrachyApplicationSetups"],"00A2":["DS","BrachyApplicationSetupDoseSpecificationPoint"],"00A4":["DS","BrachyApplicationSetupDose"],"00B0":["SQ","BeamSequence"],"00B2":["SH","TreatmentMachineName"],"00B3":["CS","PrimaryDosimeterUnit"],"00B4":["DS","SourceAxisDistance"],"00B6":["SQ","BeamLimitingDeviceSequence"],"00B8":["CS","RTBeamLimitingDeviceType"],"00BA":["DS","SourceToBeamLimitingDeviceDistance"],"00BB":["FL","IsocenterToBeamLimitingDeviceDistance"],"00BC":["IS","NumberOfLeafJawPairs"],"00BE":["DS","LeafPositionBoundaries"],"00C0":["IS","BeamNumber"],"00C2":["LO","BeamName"],"00C3":["ST","BeamDescription"],"00C4":["CS","BeamType"],"00C6":["CS","RadiationType"],"00C7":["CS","HighDoseTechniqueType"],"00C8":["IS","ReferenceImageNumber"],"00CA":["SQ","PlannedVerificationImageSequence"],"00CC":["LO","ImagingDeviceSpecificAcquisitionParameters"],"00CE":["CS","TreatmentDeliveryType"],"00D0":["IS","NumberOfWedges"],"00D1":["SQ","WedgeSequence"],"00D2":["IS","WedgeNumber"],"00D3":["CS","WedgeType"],"00D4":["SH","WedgeID"],"00D5":["IS","WedgeAngle"],"00D6":["DS","WedgeFactor"],"00D7":["FL","TotalWedgeTrayWaterEquivalentThickness"],"00D8":["DS","WedgeOrientation"],"00D9":["FL","IsocenterToWedgeTrayDistance"],"00DA":["DS","SourceToWedgeTrayDistance"],"00DB":["FL","WedgeThinEdgePosition"],"00DC":["SH","BolusID"],"00DD":["ST","BolusDescription"],"00E0":["IS","NumberOfCompensators"],"00E1":["SH","MaterialID"],"00E2":["DS","TotalCompensatorTrayFactor"],"00E3":["SQ","CompensatorSequence"],"00E4":["IS","CompensatorNumber"],"00E5":["SH","CompensatorID"],"00E6":["DS","SourceToCompensatorTrayDistance"],"00E7":["IS","CompensatorRows"],"00E8":["IS","CompensatorColumns"],"00E9":["DS","CompensatorPixelSpacing"],"00EA":["DS","CompensatorPosition"],"00EB":["DS","CompensatorTransmissionData"],"00EC":["DS","CompensatorThicknessData"],"00ED":["IS","NumberOfBoli"],"00EE":["CS","CompensatorType"],"00F0":["IS","NumberOfBlocks"],"00F2":["DS","TotalBlockTrayFactor"],"00F3":["FL","TotalBlockTrayWaterEquivalentThickness"],"00F4":["SQ","BlockSequence"],"00F5":["SH","BlockTrayID"],"00F6":["DS","SourceToBlockTrayDistance"],"00F7":["FL","IsocenterToBlockTrayDistance"],"00F8":["CS","BlockType"],"00F9":["LO","AccessoryCode"],"00FA":["CS","BlockDivergence"],"00FB":["CS","BlockMountingPosition"],"00FC":["IS","BlockNumber"],"00FE":["LO","BlockName"],"0100":["DS","BlockThickness"],"0102":["DS","BlockTransmission"],"0104":["IS","BlockNumberOfPoints"],"0106":["DS","BlockData"],"0107":["SQ","ApplicatorSequence"],"0108":["SH","ApplicatorID"],"0109":["CS","ApplicatorType"],"010A":["LO","ApplicatorDescription"],"010C":["DS","CumulativeDoseReferenceCoefficient"],"010E":["DS","FinalCumulativeMetersetWeight"],"0110":["IS","NumberOfControlPoints"],"0111":["SQ","ControlPointSequence"],"0112":["IS","ControlPointIndex"],"0114":["DS","NominalBeamEnergy"],"0115":["DS","DoseRateSet"],"0116":["SQ","WedgePositionSequence"],"0118":["CS","WedgePosition"],"011A":["SQ","BeamLimitingDevicePositionSequence"],"011C":["DS","LeafJawPositions"],"011E":["DS","GantryAngle"],"011F":["CS","GantryRotationDirection"],"0120":["DS","BeamLimitingDeviceAngle"],"0121":["CS","BeamLimitingDeviceRotationDirection"],"0122":["DS","PatientSupportAngle"],"0123":["CS","PatientSupportRotationDirection"],"0124":["DS","TableTopEccentricAxisDistance"],"0125":["DS","TableTopEccentricAngle"],"0126":["CS","TableTopEccentricRotationDirection"],"0128":["DS","TableTopVerticalPosition"],"0129":["DS","TableTopLongitudinalPosition"],"012A":["DS","TableTopLateralPosition"],"012C":["DS","IsocenterPosition"],"012E":["DS","SurfaceEntryPoint"],"0130":["DS","SourceToSurfaceDistance"],"0134":["DS","CumulativeMetersetWeight"],"0140":["FL","TableTopPitchAngle"],"0142":["CS","TableTopPitchRotationDirection"],"0144":["FL","TableTopRollAngle"],"0146":["CS","TableTopRollRotationDirection"],"0148":["FL","HeadFixationAngle"],"014A":["FL","GantryPitchAngle"],"014C":["CS","GantryPitchRotationDirection"],"014E":["FL","GantryPitchAngleTolerance"],"0180":["SQ","PatientSetupSequence"],"0182":["IS","PatientSetupNumber"],"0183":["LO","PatientSetupLabel"],"0184":["LO","PatientAdditionalPosition"],"0190":["SQ","FixationDeviceSequence"],"0192":["CS","FixationDeviceType"],"0194":["SH","FixationDeviceLabel"],"0196":["ST","FixationDeviceDescription"],"0198":["SH","FixationDevicePosition"],"0199":["FL","FixationDevicePitchAngle"],"019A":["FL","FixationDeviceRollAngle"],"01A0":["SQ","ShieldingDeviceSequence"],"01A2":["CS","ShieldingDeviceType"],"01A4":["SH","ShieldingDeviceLabel"],"01A6":["ST","ShieldingDeviceDescription"],"01A8":["SH","ShieldingDevicePosition"],"01B0":["CS","SetupTechnique"],"01B2":["ST","SetupTechniqueDescription"],"01B4":["SQ","SetupDeviceSequence"],"01B6":["CS","SetupDeviceType"],"01B8":["SH","SetupDeviceLabel"],"01BA":["ST","SetupDeviceDescription"],"01BC":["DS","SetupDeviceParameter"],"01D0":["ST","SetupReferenceDescription"],"01D2":["DS","TableTopVerticalSetupDisplacement"],"01D4":["DS","TableTopLongitudinalSetupDisplacement"],"01D6":["DS","TableTopLateralSetupDisplacement"],"0200":["CS","BrachyTreatmentTechnique"],"0202":["CS","BrachyTreatmentType"],"0206":["SQ","TreatmentMachineSequence"],"0210":["SQ","SourceSequence"],"0212":["IS","SourceNumber"],"0214":["CS","SourceType"],"0216":["LO","SourceManufacturer"],"0218":["DS","ActiveSourceDiameter"],"021A":["DS","ActiveSourceLength"],"0222":["DS","SourceEncapsulationNominalThickness"],"0224":["DS","SourceEncapsulationNominalTransmission"],"0226":["LO","SourceIsotopeName"],"0228":["DS","SourceIsotopeHalfLife"],"0229":["CS","SourceStrengthUnits"],"022A":["DS","ReferenceAirKermaRate"],"022B":["DS","SourceStrength"],"022C":["DA","SourceStrengthReferenceDate"],"022E":["TM","SourceStrengthReferenceTime"],"0230":["SQ","ApplicationSetupSequence"],"0232":["CS","ApplicationSetupType"],"0234":["IS","ApplicationSetupNumber"],"0236":["LO","ApplicationSetupName"],"0238":["LO","ApplicationSetupManufacturer"],"0240":["IS","TemplateNumber"],"0242":["SH","TemplateType"],"0244":["LO","TemplateName"],"0250":["DS","TotalReferenceAirKerma"],"0260":["SQ","BrachyAccessoryDeviceSequence"],"0262":["IS","BrachyAccessoryDeviceNumber"],"0263":["SH","BrachyAccessoryDeviceID"],"0264":["CS","BrachyAccessoryDeviceType"],"0266":["LO","BrachyAccessoryDeviceName"],"026A":["DS","BrachyAccessoryDeviceNominalThickness"],"026C":["DS","BrachyAccessoryDeviceNominalTransmission"],"0280":["SQ","ChannelSequence"],"0282":["IS","ChannelNumber"],"0284":["DS","ChannelLength"],"0286":["DS","ChannelTotalTime"],"0288":["CS","SourceMovementType"],"028A":["IS","NumberOfPulses"],"028C":["DS","PulseRepetitionInterval"],"0290":["IS","SourceApplicatorNumber"],"0291":["SH","SourceApplicatorID"],"0292":["CS","SourceApplicatorType"],"0294":["LO","SourceApplicatorName"],"0296":["DS","SourceApplicatorLength"],"0298":["LO","SourceApplicatorManufacturer"],"029C":["DS","SourceApplicatorWallNominalThickness"],"029E":["DS","SourceApplicatorWallNominalTransmission"],"02A0":["DS","SourceApplicatorStepSize"],"02A2":["IS","TransferTubeNumber"],"02A4":["DS","TransferTubeLength"],"02B0":["SQ","ChannelShieldSequence"],"02B2":["IS","ChannelShieldNumber"],"02B3":["SH","ChannelShieldID"],"02B4":["LO","ChannelShieldName"],"02B8":["DS","ChannelShieldNominalThickness"],"02BA":["DS","ChannelShieldNominalTransmission"],"02C8":["DS","FinalCumulativeTimeWeight"],"02D0":["SQ","BrachyControlPointSequence"],"02D2":["DS","ControlPointRelativePosition"],"02D4":["DS","ControlPoint3DPosition"],"02D6":["DS","CumulativeTimeWeight"],"02E0":["CS","CompensatorDivergence"],"02E1":["CS","CompensatorMountingPosition"],"02E2":["DS","SourceToCompensatorDistance"],"02E3":["FL","TotalCompensatorTrayWaterEquivalentThickness"],"02E4":["FL","IsocenterToCompensatorTrayDistance"],"02E5":["FL","CompensatorColumnOffset"],"02E6":["FL","IsocenterToCompensatorDistances"],"02E7":["FL","CompensatorRelativeStoppingPowerRatio"],"02E8":["FL","CompensatorMillingToolDiameter"],"02EA":["SQ","IonRangeCompensatorSequence"],"02EB":["LT","CompensatorDescription"],"0302":["IS","RadiationMassNumber"],"0304":["IS","RadiationAtomicNumber"],"0306":["SS","RadiationChargeState"],"0308":["CS","ScanMode"],"030A":["FL","VirtualSourceAxisDistances"],"030C":["SQ","SnoutSequence"],"030D":["FL","SnoutPosition"],"030F":["SH","SnoutID"],"0312":["IS","NumberOfRangeShifters"],"0314":["SQ","RangeShifterSequence"],"0316":["IS","RangeShifterNumber"],"0318":["SH","RangeShifterID"],"0320":["CS","RangeShifterType"],"0322":["LO","RangeShifterDescription"],"0330":["IS","NumberOfLateralSpreadingDevices"],"0332":["SQ","LateralSpreadingDeviceSequence"],"0334":["IS","LateralSpreadingDeviceNumber"],"0336":["SH","LateralSpreadingDeviceID"],"0338":["CS","LateralSpreadingDeviceType"],"033A":["LO","LateralSpreadingDeviceDescription"],"033C":["FL","LateralSpreadingDeviceWaterEquivalentThickness"],"0340":["IS","NumberOfRangeModulators"],"0342":["SQ","RangeModulatorSequence"],"0344":["IS","RangeModulatorNumber"],"0346":["SH","RangeModulatorID"],"0348":["CS","RangeModulatorType"],"034A":["LO","RangeModulatorDescription"],"034C":["SH","BeamCurrentModulationID"],"0350":["CS","PatientSupportType"],"0352":["SH","PatientSupportID"],"0354":["LO","PatientSupportAccessoryCode"],"0356":["FL","FixationLightAzimuthalAngle"],"0358":["FL","FixationLightPolarAngle"],"035A":["FL","MetersetRate"],"0360":["SQ","RangeShifterSettingsSequence"],"0362":["LO","RangeShifterSetting"],"0364":["FL","IsocenterToRangeShifterDistance"],"0366":["FL","RangeShifterWaterEquivalentThickness"],"0370":["SQ","LateralSpreadingDeviceSettingsSequence"],"0372":["LO","LateralSpreadingDeviceSetting"],"0374":["FL","IsocenterToLateralSpreadingDeviceDistance"],"0380":["SQ","RangeModulatorSettingsSequence"],"0382":["FL","RangeModulatorGatingStartValue"],"0384":["FL","RangeModulatorGatingStopValue"],"0386":["FL","RangeModulatorGatingStartWaterEquivalentThickness"],"0388":["FL","RangeModulatorGatingStopWaterEquivalentThickness"],"038A":["FL","IsocenterToRangeModulatorDistance"],"0390":["SH","ScanSpotTuneID"],"0392":["IS","NumberOfScanSpotPositions"],"0394":["FL","ScanSpotPositionMap"],"0396":["FL","ScanSpotMetersetWeights"],"0398":["FL","ScanningSpotSize"],"039A":["IS","NumberOfPaintings"],"03A0":["SQ","IonToleranceTableSequence"],"03A2":["SQ","IonBeamSequence"],"03A4":["SQ","IonBeamLimitingDeviceSequence"],"03A6":["SQ","IonBlockSequence"],"03A8":["SQ","IonControlPointSequence"],"03AA":["SQ","IonWedgeSequence"],"03AC":["SQ","IonWedgePositionSequence"],"0401":["SQ","ReferencedSetupImageSequence"],"0402":["ST","SetupImageComment"],"0410":["SQ","MotionSynchronizationSequence"],"0412":["FL","ControlPointOrientation"],"0420":["SQ","GeneralAccessorySequence"],"0421":["SH","GeneralAccessoryID"],"0422":["ST","GeneralAccessoryDescription"],"0423":["CS","GeneralAccessoryType"],"0424":["IS","GeneralAccessoryNumber"],"0431":["SQ","ApplicatorGeometrySequence"],"0432":["CS","ApplicatorApertureShape"],"0433":["FL","ApplicatorOpening"],"0434":["FL","ApplicatorOpeningX"],"0435":["FL","ApplicatorOpeningY"],"0436":["FL","SourceToApplicatorMountingPositionDistance"]},"300C":{"0002":["SQ","ReferencedRTPlanSequence"],"0004":["SQ","ReferencedBeamSequence"],"0006":["IS","ReferencedBeamNumber"],"0007":["IS","ReferencedReferenceImageNumber"],"0008":["DS","StartCumulativeMetersetWeight"],"0009":["DS","EndCumulativeMetersetWeight"],"000A":["SQ","ReferencedBrachyApplicationSetupSequence"],"000C":["IS","ReferencedBrachyApplicationSetupNumber"],"000E":["IS","ReferencedSourceNumber"],"0020":["SQ","ReferencedFractionGroupSequence"],"0022":["IS","ReferencedFractionGroupNumber"],"0040":["SQ","ReferencedVerificationImageSequence"],"0042":["SQ","ReferencedReferenceImageSequence"],"0050":["SQ","ReferencedDoseReferenceSequence"],"0051":["IS","ReferencedDoseReferenceNumber"],"0055":["SQ","BrachyReferencedDoseReferenceSequence"],"0060":["SQ","ReferencedStructureSetSequence"],"006A":["IS","ReferencedPatientSetupNumber"],"0080":["SQ","ReferencedDoseSequence"],"00A0":["IS","ReferencedToleranceTableNumber"],"00B0":["SQ","ReferencedBolusSequence"],"00C0":["IS","ReferencedWedgeNumber"],"00D0":["IS","ReferencedCompensatorNumber"],"00E0":["IS","ReferencedBlockNumber"],"00F0":["IS","ReferencedControlPointIndex"],"00F2":["SQ","ReferencedControlPointSequence"],"00F4":["IS","ReferencedStartControlPointIndex"],"00F6":["IS","ReferencedStopControlPointIndex"],"0100":["IS","ReferencedRangeShifterNumber"],"0102":["IS","ReferencedLateralSpreadingDeviceNumber"],"0104":["IS","ReferencedRangeModulatorNumber"]},"300E":{"0002":["CS","ApprovalStatus"],"0004":["DA","ReviewDate"],"0005":["TM","ReviewTime"],"0008":["PN","ReviewerName"]},4e3:{"0010":["LT","Arbitrary"],4e3:["LT","TextComments"]},4008:{"0040":["SH","ResultsID"],"0042":["LO","ResultsIDIssuer"],"0050":["SQ","ReferencedInterpretationSequence"],"00FF":["CS","ReportProductionStatusTrial"],"0100":["DA","InterpretationRecordedDate"],"0101":["TM","InterpretationRecordedTime"],"0102":["PN","InterpretationRecorder"],"0103":["LO","ReferenceToRecordedSound"],"0108":["DA","InterpretationTranscriptionDate"],"0109":["TM","InterpretationTranscriptionTime"],"010A":["PN","InterpretationTranscriber"],"010B":["ST","InterpretationText"],"010C":["PN","InterpretationAuthor"],"0111":["SQ","InterpretationApproverSequence"],"0112":["DA","InterpretationApprovalDate"],"0113":["TM","InterpretationApprovalTime"],"0114":["PN","PhysicianApprovingInterpretation"],"0115":["LT","InterpretationDiagnosisDescription"],"0117":["SQ","InterpretationDiagnosisCodeSequence"],"0118":["SQ","ResultsDistributionListSequence"],"0119":["PN","DistributionName"],"011A":["LO","DistributionAddress"],"0200":["SH","InterpretationID"],"0202":["LO","InterpretationIDIssuer"],"0210":["CS","InterpretationTypeID"],"0212":["CS","InterpretationStatusID"],"0300":["ST","Impressions"],4e3:["ST","ResultsComments"]},4010:{"0001":["CS","LowEnergyDetectors"],"0002":["CS","HighEnergyDetectors"],"0004":["SQ","DetectorGeometrySequence"],1001:["SQ","ThreatROIVoxelSequence"],1004:["FL","ThreatROIBase"],1005:["FL","ThreatROIExtents"],1006:["OB","ThreatROIBitmap"],1007:["SH","RouteSegmentID"],1008:["CS","GantryType"],1009:["CS","OOIOwnerType"],"100A":["SQ","RouteSegmentSequence"],1010:["US","PotentialThreatObjectID"],1011:["SQ","ThreatSequence"],1012:["CS","ThreatCategory"],1013:["LT","ThreatCategoryDescription"],1014:["CS","ATDAbilityAssessment"],1015:["CS","ATDAssessmentFlag"],1016:["FL","ATDAssessmentProbability"],1017:["FL","Mass"],1018:["FL","Density"],1019:["FL","ZEffective"],"101A":["SH","BoardingPassID"],"101B":["FL","CenterOfMass"],"101C":["FL","CenterOfPTO"],"101D":["FL","BoundingPolygon"],"101E":["SH","RouteSegmentStartLocationID"],"101F":["SH","RouteSegmentEndLocationID"],1020:["CS","RouteSegmentLocationIDType"],1021:["CS","AbortReason"],1023:["FL","VolumeOfPTO"],1024:["CS","AbortFlag"],1025:["DT","RouteSegmentStartTime"],1026:["DT","RouteSegmentEndTime"],1027:["CS","TDRType"],1028:["CS","InternationalRouteSegment"],1029:["LO","ThreatDetectionAlgorithmandVersion"],"102A":["SH","AssignedLocation"],"102B":["DT","AlarmDecisionTime"],1031:["CS","AlarmDecision"],1033:["US","NumberOfTotalObjects"],1034:["US","NumberOfAlarmObjects"],1037:["SQ","PTORepresentationSequence"],1038:["SQ","ATDAssessmentSequence"],1039:["CS","TIPType"],"103A":["CS","DICOSVersion"],1041:["DT","OOIOwnerCreationTime"],1042:["CS","OOIType"],1043:["FL","OOISize"],1044:["CS","AcquisitionStatus"],1045:["SQ","BasisMaterialsCodeSequence"],1046:["CS","PhantomType"],1047:["SQ","OOIOwnerSequence"],1048:["CS","ScanType"],1051:["LO","ItineraryID"],1052:["SH","ItineraryIDType"],1053:["LO","ItineraryIDAssigningAuthority"],1054:["SH","RouteID"],1055:["SH","RouteIDAssigningAuthority"],1056:["CS","InboundArrivalType"],1058:["SH","CarrierID"],1059:["CS","CarrierIDAssigningAuthority"],1060:["FL","SourceOrientation"],1061:["FL","SourcePosition"],1062:["FL","BeltHeight"],1064:["SQ","AlgorithmRoutingCodeSequence"],1067:["CS","TransportClassification"],1068:["LT","OOITypeDescriptor"],1069:["FL","TotalProcessingTime"],"106C":["OB","DetectorCalibrationData"]}},n.Dictionary.getVR=function(s,u){var f,m,A;return A=n.Dictionary.dict[n.Utils.dec2hex(s)],A&&(m=A[n.Utils.dec2hex(u)],m?f=m[0]:u===0&&(f="UL")),f||(A=n.Dictionary.dictPrivate[n.Utils.dec2hex(s)],A&&(m=A[n.Utils.dec2hex(u)],m&&(f=m[0]))),f||(f="OB"),f},n.Dictionary.getDescription=function(s,u){var f,m,A;return A=n.Dictionary.dict[n.Utils.dec2hex(s)],A&&(m=A[n.Utils.dec2hex(u)],m?f=m[1]:u===0&&(f="Group "+n.Utils.dec2hex(s)+" Length")),f||(A=n.Dictionary.dictPrivate[n.Utils.dec2hex(s)],A&&(m=A[n.Utils.dec2hex(u)],m&&(f=m[1]))),f||(f="PrivateData"),f},a.exports&&(a.exports=n.Dictionary)}(dictionary)),dictionary.exports}var image$1={exports:{}},tag={exports:{}},lib$1={exports:{}},_default$1={},lib={exports:{}},_default={},hasRequired_default$1;function require_default$1(){if(hasRequired_default$1)return _default;hasRequired_default$1=1;function a(){var m={};return m["align-content"]=!1,m["align-items"]=!1,m["align-self"]=!1,m["alignment-adjust"]=!1,m["alignment-baseline"]=!1,m.all=!1,m["anchor-point"]=!1,m.animation=!1,m["animation-delay"]=!1,m["animation-direction"]=!1,m["animation-duration"]=!1,m["animation-fill-mode"]=!1,m["animation-iteration-count"]=!1,m["animation-name"]=!1,m["animation-play-state"]=!1,m["animation-timing-function"]=!1,m.azimuth=!1,m["backface-visibility"]=!1,m.background=!0,m["background-attachment"]=!0,m["background-clip"]=!0,m["background-color"]=!0,m["background-image"]=!0,m["background-origin"]=!0,m["background-position"]=!0,m["background-repeat"]=!0,m["background-size"]=!0,m["baseline-shift"]=!1,m.binding=!1,m.bleed=!1,m["bookmark-label"]=!1,m["bookmark-level"]=!1,m["bookmark-state"]=!1,m.border=!0,m["border-bottom"]=!0,m["border-bottom-color"]=!0,m["border-bottom-left-radius"]=!0,m["border-bottom-right-radius"]=!0,m["border-bottom-style"]=!0,m["border-bottom-width"]=!0,m["border-collapse"]=!0,m["border-color"]=!0,m["border-image"]=!0,m["border-image-outset"]=!0,m["border-image-repeat"]=!0,m["border-image-slice"]=!0,m["border-image-source"]=!0,m["border-image-width"]=!0,m["border-left"]=!0,m["border-left-color"]=!0,m["border-left-style"]=!0,m["border-left-width"]=!0,m["border-radius"]=!0,m["border-right"]=!0,m["border-right-color"]=!0,m["border-right-style"]=!0,m["border-right-width"]=!0,m["border-spacing"]=!0,m["border-style"]=!0,m["border-top"]=!0,m["border-top-color"]=!0,m["border-top-left-radius"]=!0,m["border-top-right-radius"]=!0,m["border-top-style"]=!0,m["border-top-width"]=!0,m["border-width"]=!0,m.bottom=!1,m["box-decoration-break"]=!0,m["box-shadow"]=!0,m["box-sizing"]=!0,m["box-snap"]=!0,m["box-suppress"]=!0,m["break-after"]=!0,m["break-before"]=!0,m["break-inside"]=!0,m["caption-side"]=!1,m.chains=!1,m.clear=!0,m.clip=!1,m["clip-path"]=!1,m["clip-rule"]=!1,m.color=!0,m["color-interpolation-filters"]=!0,m["column-count"]=!1,m["column-fill"]=!1,m["column-gap"]=!1,m["column-rule"]=!1,m["column-rule-color"]=!1,m["column-rule-style"]=!1,m["column-rule-width"]=!1,m["column-span"]=!1,m["column-width"]=!1,m.columns=!1,m.contain=!1,m.content=!1,m["counter-increment"]=!1,m["counter-reset"]=!1,m["counter-set"]=!1,m.crop=!1,m.cue=!1,m["cue-after"]=!1,m["cue-before"]=!1,m.cursor=!1,m.direction=!1,m.display=!0,m["display-inside"]=!0,m["display-list"]=!0,m["display-outside"]=!0,m["dominant-baseline"]=!1,m.elevation=!1,m["empty-cells"]=!1,m.filter=!1,m.flex=!1,m["flex-basis"]=!1,m["flex-direction"]=!1,m["flex-flow"]=!1,m["flex-grow"]=!1,m["flex-shrink"]=!1,m["flex-wrap"]=!1,m.float=!1,m["float-offset"]=!1,m["flood-color"]=!1,m["flood-opacity"]=!1,m["flow-from"]=!1,m["flow-into"]=!1,m.font=!0,m["font-family"]=!0,m["font-feature-settings"]=!0,m["font-kerning"]=!0,m["font-language-override"]=!0,m["font-size"]=!0,m["font-size-adjust"]=!0,m["font-stretch"]=!0,m["font-style"]=!0,m["font-synthesis"]=!0,m["font-variant"]=!0,m["font-variant-alternates"]=!0,m["font-variant-caps"]=!0,m["font-variant-east-asian"]=!0,m["font-variant-ligatures"]=!0,m["font-variant-numeric"]=!0,m["font-variant-position"]=!0,m["font-weight"]=!0,m.grid=!1,m["grid-area"]=!1,m["grid-auto-columns"]=!1,m["grid-auto-flow"]=!1,m["grid-auto-rows"]=!1,m["grid-column"]=!1,m["grid-column-end"]=!1,m["grid-column-start"]=!1,m["grid-row"]=!1,m["grid-row-end"]=!1,m["grid-row-start"]=!1,m["grid-template"]=!1,m["grid-template-areas"]=!1,m["grid-template-columns"]=!1,m["grid-template-rows"]=!1,m["hanging-punctuation"]=!1,m.height=!0,m.hyphens=!1,m.icon=!1,m["image-orientation"]=!1,m["image-resolution"]=!1,m["ime-mode"]=!1,m["initial-letters"]=!1,m["inline-box-align"]=!1,m["justify-content"]=!1,m["justify-items"]=!1,m["justify-self"]=!1,m.left=!1,m["letter-spacing"]=!0,m["lighting-color"]=!0,m["line-box-contain"]=!1,m["line-break"]=!1,m["line-grid"]=!1,m["line-height"]=!1,m["line-snap"]=!1,m["line-stacking"]=!1,m["line-stacking-ruby"]=!1,m["line-stacking-shift"]=!1,m["line-stacking-strategy"]=!1,m["list-style"]=!0,m["list-style-image"]=!0,m["list-style-position"]=!0,m["list-style-type"]=!0,m.margin=!0,m["margin-bottom"]=!0,m["margin-left"]=!0,m["margin-right"]=!0,m["margin-top"]=!0,m["marker-offset"]=!1,m["marker-side"]=!1,m.marks=!1,m.mask=!1,m["mask-box"]=!1,m["mask-box-outset"]=!1,m["mask-box-repeat"]=!1,m["mask-box-slice"]=!1,m["mask-box-source"]=!1,m["mask-box-width"]=!1,m["mask-clip"]=!1,m["mask-image"]=!1,m["mask-origin"]=!1,m["mask-position"]=!1,m["mask-repeat"]=!1,m["mask-size"]=!1,m["mask-source-type"]=!1,m["mask-type"]=!1,m["max-height"]=!0,m["max-lines"]=!1,m["max-width"]=!0,m["min-height"]=!0,m["min-width"]=!0,m["move-to"]=!1,m["nav-down"]=!1,m["nav-index"]=!1,m["nav-left"]=!1,m["nav-right"]=!1,m["nav-up"]=!1,m["object-fit"]=!1,m["object-position"]=!1,m.opacity=!1,m.order=!1,m.orphans=!1,m.outline=!1,m["outline-color"]=!1,m["outline-offset"]=!1,m["outline-style"]=!1,m["outline-width"]=!1,m.overflow=!1,m["overflow-wrap"]=!1,m["overflow-x"]=!1,m["overflow-y"]=!1,m.padding=!0,m["padding-bottom"]=!0,m["padding-left"]=!0,m["padding-right"]=!0,m["padding-top"]=!0,m.page=!1,m["page-break-after"]=!1,m["page-break-before"]=!1,m["page-break-inside"]=!1,m["page-policy"]=!1,m.pause=!1,m["pause-after"]=!1,m["pause-before"]=!1,m.perspective=!1,m["perspective-origin"]=!1,m.pitch=!1,m["pitch-range"]=!1,m["play-during"]=!1,m.position=!1,m["presentation-level"]=!1,m.quotes=!1,m["region-fragment"]=!1,m.resize=!1,m.rest=!1,m["rest-after"]=!1,m["rest-before"]=!1,m.richness=!1,m.right=!1,m.rotation=!1,m["rotation-point"]=!1,m["ruby-align"]=!1,m["ruby-merge"]=!1,m["ruby-position"]=!1,m["shape-image-threshold"]=!1,m["shape-outside"]=!1,m["shape-margin"]=!1,m.size=!1,m.speak=!1,m["speak-as"]=!1,m["speak-header"]=!1,m["speak-numeral"]=!1,m["speak-punctuation"]=!1,m["speech-rate"]=!1,m.stress=!1,m["string-set"]=!1,m["tab-size"]=!1,m["table-layout"]=!1,m["text-align"]=!0,m["text-align-last"]=!0,m["text-combine-upright"]=!0,m["text-decoration"]=!0,m["text-decoration-color"]=!0,m["text-decoration-line"]=!0,m["text-decoration-skip"]=!0,m["text-decoration-style"]=!0,m["text-emphasis"]=!0,m["text-emphasis-color"]=!0,m["text-emphasis-position"]=!0,m["text-emphasis-style"]=!0,m["text-height"]=!0,m["text-indent"]=!0,m["text-justify"]=!0,m["text-orientation"]=!0,m["text-overflow"]=!0,m["text-shadow"]=!0,m["text-space-collapse"]=!0,m["text-transform"]=!0,m["text-underline-position"]=!0,m["text-wrap"]=!0,m.top=!1,m.transform=!1,m["transform-origin"]=!1,m["transform-style"]=!1,m.transition=!1,m["transition-delay"]=!1,m["transition-duration"]=!1,m["transition-property"]=!1,m["transition-timing-function"]=!1,m["unicode-bidi"]=!1,m["vertical-align"]=!1,m.visibility=!1,m["voice-balance"]=!1,m["voice-duration"]=!1,m["voice-family"]=!1,m["voice-pitch"]=!1,m["voice-range"]=!1,m["voice-rate"]=!1,m["voice-stress"]=!1,m["voice-volume"]=!1,m.volume=!1,m["white-space"]=!1,m.widows=!1,m.width=!0,m["will-change"]=!1,m["word-break"]=!0,m["word-spacing"]=!0,m["word-wrap"]=!0,m["wrap-flow"]=!1,m["wrap-through"]=!1,m["writing-mode"]=!1,m["z-index"]=!1,m}function n(m,A,v){}function s(m,A,v){}var u=/javascript\s*\:/img;function f(m,A){return u.test(A)?"":A}return _default.whiteList=a(),_default.getDefaultWhiteList=a,_default.onAttr=n,_default.onIgnoreAttr=s,_default.safeAttrValue=f,_default}var util$1,hasRequiredUtil$1;function requireUtil$1(){return hasRequiredUtil$1||(hasRequiredUtil$1=1,util$1={indexOf:function(a,n){var s,u;if(Array.prototype.indexOf)return a.indexOf(n);for(s=0,u=a.length;s/g,e=/"/g,F=/"/g,M=/&#([a-zA-Z0-9]*);?/gim,L=/:?/gim,V=/&newline;?/gim,B=/((j\s*a\s*v\s*a|v\s*b|l\s*i\s*v\s*e)\s*s\s*c\s*r\s*i\s*p\s*t\s*|m\s*o\s*c\s*h\s*a):/gi,z=/e\s*x\s*p\s*r\s*e\s*s\s*s\s*i\s*o\s*n\s*\(.*/gi,b=/u\s*r\s*l\s*\(.*/gi;function W(me){return me.replace(e,""")}function q(me){return me.replace(F,'"')}function Y(me){return me.replace(M,function(ve,we){return we[0]==="x"||we[0]==="X"?String.fromCharCode(parseInt(we.substr(1),16)):String.fromCharCode(parseInt(we,10))})}function X(me){return me.replace(L,":").replace(V," ")}function H(me){for(var Se="",ve=0,we=me.length;ve",we);if(Ne===-1)break;ve=Ne+3}return Se}function pe(me){var Se=me.split("");return Se=Se.filter(function(ve){var we=ve.charCodeAt(0);return we===127?!1:we<=31?we===10||we===13:!0}),Se.join("")}return _default$1.whiteList=u(),_default$1.getDefaultWhiteList=u,_default$1.onTag=m,_default$1.onIgnoreTag=A,_default$1.onTagAttr=v,_default$1.onIgnoreTagAttr=y,_default$1.safeAttrValue=E,_default$1.escapeHtml=T,_default$1.escapeQuote=W,_default$1.unescapeQuote=q,_default$1.escapeHtmlEntities=Y,_default$1.escapeDangerHtml5Entities=X,_default$1.clearNonPrintableCharacter=H,_default$1.friendlyAttrValue=g,_default$1.escapeAttrValue=J,_default$1.onIgnoreTagStripAll=re,_default$1.StripTagBody=ae,_default$1.stripCommentTag=fe,_default$1.stripBlankChar=pe,_default$1.cssFilter=f,_default$1.getDefaultCSSWhiteList=n,_default$1}var parser$1={},hasRequiredParser$1;function requireParser$1(){if(hasRequiredParser$1)return parser$1;hasRequiredParser$1=1;var a=requireUtil();function n(S){var I=a.spaceIndex(S),e;return I===-1?e=S.slice(1,-1):e=S.slice(1,I+1),e=a.trim(e).toLowerCase(),e.slice(0,1)==="/"&&(e=e.slice(1)),e.slice(-1)==="/"&&(e=e.slice(0,-1)),e}function s(S){return S.slice(0,2)===""||B===z-1){F+=e(S.slice(M,L)),W=S.slice(L,B+1),b=n(W),F+=I(L,F.length,b,W,s(W)),M=B+1,L=!1;continue}if(q==='"'||q==="'")for(var Y=1,X=S.charAt(B-Y);X.trim()===""||X==="=";){if(X==="="){V=q;continue e}X=S.charAt(B-++Y)}}else if(q===V){V=!1;continue}}return M0;I--){var e=S[I];if(e!==" ")return e==="="?I:-1}}function T(S){return S[0]==='"'&&S[S.length-1]==='"'||S[0]==="'"&&S[S.length-1]==="'"}function E(S){return T(S)?S.substr(1,S.length-2):S}return parser$1.parseTag=u,parser$1.parseAttr=m,parser$1}var xss,hasRequiredXss;function requireXss(){if(hasRequiredXss)return xss;hasRequiredXss=1;var a=requireLib$1().FilterCSS,n=require_default(),s=requireParser$1(),u=s.parseTag,f=s.parseAttr,m=requireUtil();function A(S){return S==null}function v(S){var I=m.spaceIndex(S);if(I===-1)return{html:"",closing:S[S.length-2]==="/"};S=m.trim(S.slice(I+1,-1));var e=S[S.length-1]==="/";return e&&(S=m.trim(S.slice(0,-1))),{html:S,closing:e}}function y(S){var I={};for(var e in S)I[e]=S[e];return I}function T(S){var I={};for(var e in S)Array.isArray(S[e])?I[e.toLowerCase()]=S[e].map(function(F){return F.toLowerCase()}):I[e.toLowerCase()]=S[e];return I}function E(S){S=y(S||{}),S.stripIgnoreTag&&(S.onIgnoreTag&&console.error('Notes: cannot use these two options "stripIgnoreTag" and "onIgnoreTag" at the same time'),S.onIgnoreTag=n.onIgnoreTagStripAll),S.whiteList||S.allowList?S.whiteList=T(S.whiteList||S.allowList):S.whiteList=n.whiteList,S.onTag=S.onTag||n.onTag,S.onTagAttr=S.onTagAttr||n.onTagAttr,S.onIgnoreTag=S.onIgnoreTag||n.onIgnoreTag,S.onIgnoreTagAttr=S.onIgnoreTagAttr||n.onIgnoreTagAttr,S.safeAttrValue=S.safeAttrValue||n.safeAttrValue,S.escapeHtml=S.escapeHtml||n.escapeHtml,this.options=S,S.css===!1?this.cssFilter=!1:(S.css=S.css||{},this.cssFilter=new a(S.css))}return E.prototype.process=function(S){if(S=S||"",S=S.toString(),!S)return"";var I=this,e=I.options,F=e.whiteList,M=e.onTag,L=e.onIgnoreTag,V=e.onTagAttr,B=e.onIgnoreTagAttr,z=e.safeAttrValue,b=e.escapeHtml,W=I.cssFilter;e.stripBlankChar&&(S=n.stripBlankChar(S)),e.allowCommentTag||(S=n.stripCommentTag(S));var q=!1;e.stripIgnoreTagBody&&(q=n.StripTagBody(e.stripIgnoreTagBody,L),L=q.onIgnoreTag);var Y=u(S,function(X,H,g,J,re){var ae={sourcePosition:X,position:H,isClosing:re,isWhite:Object.prototype.hasOwnProperty.call(F,g)},fe=M(g,J,ae);if(!A(fe))return fe;if(ae.isWhite){if(ae.isClosing)return"";var pe=v(J),me=F[g],Se=f(pe.html,function(ve,we){var Ne=m.indexOf(me,ve)!==-1,De=V(g,ve,we,Ne);return A(De)?Ne?(we=z(g,ve,we,W),we?ve+'="'+we+'"':ve):(De=B(g,ve,we,Ne),A(De)?void 0:De):De});return J="<"+g,Se&&(J+=" "+Se),pe.closing&&(J+=" /"),J+=">",J}else return fe=L(g,J,ae),A(fe)?b(J):fe},b);return q&&(Y=q.remove(Y)),Y},xss=E,xss}var hasRequiredLib;function requireLib(){return hasRequiredLib||(hasRequiredLib=1,function(a,n){var s=require_default(),u=requireParser$1(),f=requireXss();function m(v,y){var T=new f(y);return T.process(v)}n=a.exports=m,n.filterXSS=m,n.FilterXSS=f,function(){for(var v in s)n[v]=s[v];for(var y in u)n[y]=u[y]}(),typeof window<"u"&&(window.filterXSS=a.exports);function A(){return typeof self<"u"&&typeof DedicatedWorkerGlobalScope<"u"&&self instanceof DedicatedWorkerGlobalScope}A()&&(self.filterXSS=a.exports)}(lib$1,lib$1.exports)),lib$1.exports}var siemens={exports:{}},hasRequiredSiemens;function requireSiemens(){return hasRequiredSiemens||(hasRequiredSiemens=1,function(a){var n=n||{};n.Utils=n.Utils||(typeof commonjsRequire<"u"?requireUtilities():null),n.Siemens=n.Siemens||function(s){this.output="",this.data=new DataView(s,0)},n.Siemens.CSA2_MAGIC_NUMBER=[83,86,49,48],n.Siemens.NAME_LENGTH=64,n.Siemens.ELEMENT_CSA1=4112,n.Siemens.ELEMENT_CSA2=4128,n.Siemens.GROUP_CSA=41,n.Siemens.prototype.readHeader=function(){var s,u;try{if(this.data.byteLength>n.Siemens.CSA2_MAGIC_NUMBER.length){for(u=!0,s=0;s1)for(var m=Array.prototype.slice.call(arguments,1);f--;)u[s-1-f]=n.Utils.createArray.apply(this,m);return u},n.Utils.getStringAt=function(s,u,f,m,A){var v="",y,T;for(y=0;y0?parseInt(s,10):0},n.Utils.convertCamcelCaseToTitleCase=function(s){var u=s.replace(/([A-Z][a-z])/g," $1");return n.Utils.trim(u.charAt(0).toUpperCase()+u.slice(1))},n.Utils.safeParseFloat=function(s){return s=n.Utils.stripLeadingZeros(s),s.length>0?parseFloat(s):0},n.Utils.bytesToDouble=function(s){var u=(s[0]&128)>>7,f=(s[0]&127)<<4|(s[1]&240)>>4;if(f==0)return 0;if(f==2047)return u?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY;var m=Math.pow(2,f-1023-52),A=s[7]+s[6]*Math.pow(2,8)+s[5]*Math.pow(2,8*2)+s[4]*Math.pow(2,8*3)+s[3]*Math.pow(2,8*4)+s[2]*Math.pow(2,8*5)+(s[1]&15)*Math.pow(2,8*6)+Math.pow(2,52);return Math.pow(-1,u)*A*m},n.Utils.concatArrayBuffers=function(s,u){var f=new Uint8Array(s.byteLength+u.byteLength);return f.set(new Uint8Array(s),0),f.set(new Uint8Array(u),s.byteLength),f.buffer},n.Utils.concatArrayBuffers2=function(s){var u=0,f=0,m;for(m=0;m>8&65280|s>>24&255},n.Utils.swap16=function(s){return((s&255)<<8|s>>8&255)<<16>>16},n.Utils.makeCRCTable=function(){for(var s,u=[],f=0;f<256;f++){s=f;for(var m=0;m<8;m++)s=s&1?3988292384^s>>>1:s>>>1;u[f]=s}return u},n.Utils.crc32=function(s){for(var u=n.Utils.crcTable||(n.Utils.crcTable=n.Utils.makeCRCTable()),f=-1,m=0;m>>8^u[(f^s.getUint8(m))&255];return(f^-1)>>>0},n.Utils.createBitMask=function(s,u,f){var m=4294967295;return m>>>=(4-s)*8+(s*8-u),f?s==1?m&=255:s==2?m&=65535:s==4?m&=4294967295:s==8&&(m=4294967295):m=4294967295,m},a.exports&&(a.exports=n.Utils)}(utilities)),utilities.exports}var hasRequiredDictionary;function requireDictionary(){return hasRequiredDictionary||(hasRequiredDictionary=1,function(a){var n=n||{};n.Dictionary=n.Dictionary||{},n.Utils=n.Utils||(typeof commonjsRequire<"u"?requireUtilities():null),n.Dictionary.dictPrivate={"0207":{"101F":["FE","ElscintDataScale"]}},n.Dictionary.dict={"0002":{"0001":["OB","FileMetaInformationVersion"],"0002":["UI","MediaStoredSOPClassUID"],"0003":["UI","MediaStoredSOPInstanceUID"],"0010":["UI","TransferSyntaxUID"],"0012":["UI","ImplementationClassUID"],"0013":["SH","ImplementationVersionName"],"0016":["AE","SourceApplicationEntityTitle"],"0100":["UI","PrivateInformationCreatorUID"],"0102":["OB","PrivateInformation"]},"0004":{1130:["CS","FilesetID"],1141:["CS","FilesetDescriptorFileFileID"],1142:["CS","FilesetDescriptorFileFormat"],1200:["UL","RootDirectoryEntitysFirstDirectoryRecordOffset"],1202:["UL","RootDirectoryEntitysLastDirectoryRecordOffset"],1212:["US","File-setConsistenceFlag"],1220:["SQ","DirectoryRecordSequence"],1400:["UL","NextDirectoryRecordOffset"],1410:["US","RecordInuseFlag"],1420:["UL","ReferencedLowerlevelDirectoryEntityOffset"],1430:["CS","DirectoryRecordType"],1432:["UI","PrivateRecordUID"],1500:["CS","ReferencedFileID"],1510:["UI","ReferencedSOPClassUIDInFile"],1511:["UI","ReferencedSOPInstanceUIDInFile"],1600:["UL","NumberOfReferences"]},"0008":{"0001":["UL","LengthToEnd"],"0005":["CS","SpecificCharacterSet"],"0006":["SQ","LanguageCodeSequence"],"0008":["CS","ImageType"],"0010":["SH","RecognitionCode"],"0012":["DA","InstanceCreationDate"],"0013":["TM","InstanceCreationTime"],"0014":["UI","InstanceCreatorUID"],"0016":["UI","SOPClassUID"],"0018":["UI","SOPInstanceUID"],"001A":["UI","RelatedGeneralSOPClassUID"],"001B":["UI","OriginalSpecializedSOPClassUID"],"0020":["DA","StudyDate"],"0021":["DA","SeriesDate"],"0022":["DA","AcquisitionDate"],"0023":["DA","ContentDate"],"0024":["DA","OverlayDate"],"0025":["DA","CurveDate"],"002A":["DT","AcquisitionDateTime"],"0030":["TM","StudyTime"],"0031":["TM","SeriesTime"],"0032":["TM","AcquisitionTime"],"0033":["TM","ContentTime"],"0034":["TM","OverlayTime"],"0035":["TM","CurveTime"],"0040":["US","DataSetType"],"0041":["LO","DataSetSubtype"],"0042":["CS","NuclearMedicineSeriesType"],"0050":["SH","AccessionNumber"],"0051":["SQ","IssuerOfAccessionNumberSequence"],"0052":["CS","QueryRetrieveLevel"],"0054":["AE","RetrieveAETitle"],"0056":["CS","InstanceAvailability"],"0058":["UI","FailedSOPInstanceUIDList"],"0060":["CS","Modality"],"0061":["CS","ModalitiesInStudy"],"0062":["UI","SOPClassesInStudy"],"0064":["CS","ConversionType"],"0068":["CS","PresentationIntentType"],"0070":["LO","Manufacturer"],"0080":["LO","InstitutionName"],"0081":["ST","InstitutionAddress"],"0082":["SQ","InstitutionCodeSequence"],"0090":["PN","ReferringPhysicianName"],"0092":["ST","ReferringPhysicianAddress"],"0094":["SH","ReferringPhysicianTelephoneNumbers"],"0096":["SQ","ReferringPhysicianIdentificationSequence"],"0100":["SH","CodeValue"],"0102":["SH","CodingSchemeDesignator"],"0103":["SH","CodingSchemeVersion"],"0104":["LO","CodeMeaning"],"0105":["CS","MappingResource"],"0106":["DT","ContextGroupVersion"],"0107":["DT","ContextGroupLocalVersion"],"010B":["CS","ContextGroupExtensionFlag"],"010C":["UI","CodingSchemeUID"],"010D":["UI","ContextGroupExtensionCreatorUID"],"010F":["CS","ContextIdentifier"],"0110":["SQ","CodingSchemeIdentificationSequence"],"0112":["LO","CodingSchemeRegistry"],"0114":["ST","CodingSchemeExternalID"],"0115":["ST","CodingSchemeName"],"0116":["ST","CodingSchemeResponsibleOrganization"],"0117":["UI","ContextUID"],"0201":["SH","TimezoneOffsetFromUTC"],1e3:["AE","NetworkID"],1010:["SH","StationName"],1030:["LO","StudyDescription"],1032:["SQ","ProcedureCodeSequence"],"103E":["LO","SeriesDescription"],"103F":["SQ","SeriesDescriptionCodeSequence"],1040:["LO","InstitutionalDepartmentName"],1048:["PN","PhysiciansOfRecord"],1049:["SQ","PhysiciansOfRecordIdentificationSequence"],1050:["PN","PerformingPhysicianName"],1052:["SQ","PerformingPhysicianIdentificationSequence"],1060:["PN","NameOfPhysiciansReadingStudy"],1062:["SQ","PhysiciansReadingStudyIdentificationSequence"],1070:["PN","OperatorsName"],1072:["SQ","OperatorIdentificationSequence"],1080:["LO","AdmittingDiagnosesDescription"],1084:["SQ","AdmittingDiagnosesCodeSequence"],1090:["LO","ManufacturerModelName"],1100:["SQ","ReferencedResultsSequence"],1110:["SQ","ReferencedStudySequence"],1111:["SQ","ReferencedPerformedProcedureStepSequence"],1115:["SQ","ReferencedSeriesSequence"],1120:["SQ","ReferencedPatientSequence"],1125:["SQ","ReferencedVisitSequence"],1130:["SQ","ReferencedOverlaySequence"],1134:["SQ","ReferencedStereometricInstanceSequence"],"113A":["SQ","ReferencedWaveformSequence"],1140:["SQ","ReferencedImageSequence"],1145:["SQ","ReferencedCurveSequence"],"114A":["SQ","ReferencedInstanceSequence"],"114B":["SQ","ReferencedRealWorldValueMappingInstanceSequence"],1150:["UI","ReferencedSOPClassUID"],1155:["UI","ReferencedSOPInstanceUID"],"115A":["UI","SOPClassesSupported"],1160:["IS","ReferencedFrameNumber"],1161:["UL","SimpleFrameList"],1162:["UL","CalculatedFrameList"],1163:["FD","TimeRange"],1164:["SQ","FrameExtractionSequence"],1167:["UI","MultiFrameSourceSOPInstanceUID"],1195:["UI","TransactionUID"],1197:["US","FailureReason"],1198:["SQ","FailedSOPSequence"],1199:["SQ","ReferencedSOPSequence"],1200:["SQ","StudiesContainingOtherReferencedInstancesSequence"],1250:["SQ","RelatedSeriesSequence"],2110:["CS","LossyImageCompressionRetired"],2111:["ST","DerivationDescription"],2112:["SQ","SourceImageSequence"],2120:["SH","StageName"],2122:["IS","StageNumber"],2124:["IS","NumberOfStages"],2127:["SH","ViewName"],2128:["IS","ViewNumber"],2129:["IS","NumberOfEventTimers"],"212A":["IS","NumberOfViewsInStage"],2130:["DS","EventElapsedTimes"],2132:["LO","EventTimerNames"],2133:["SQ","EventTimerSequence"],2134:["FD","EventTimeOffset"],2135:["SQ","EventCodeSequence"],2142:["IS","StartTrim"],2143:["IS","StopTrim"],2144:["IS","RecommendedDisplayFrameRate"],2200:["CS","TransducerPosition"],2204:["CS","TransducerOrientation"],2208:["CS","AnatomicStructure"],2218:["SQ","AnatomicRegionSequence"],2220:["SQ","AnatomicRegionModifierSequence"],2228:["SQ","PrimaryAnatomicStructureSequence"],2229:["SQ","AnatomicStructureSpaceOrRegionSequence"],2230:["SQ","PrimaryAnatomicStructureModifierSequence"],2240:["SQ","TransducerPositionSequence"],2242:["SQ","TransducerPositionModifierSequence"],2244:["SQ","TransducerOrientationSequence"],2246:["SQ","TransducerOrientationModifierSequence"],2251:["SQ","AnatomicStructureSpaceOrRegionCodeSequenceTrial"],2253:["SQ","AnatomicPortalOfEntranceCodeSequenceTrial"],2255:["SQ","AnatomicApproachDirectionCodeSequenceTrial"],2256:["ST","AnatomicPerspectiveDescriptionTrial"],2257:["SQ","AnatomicPerspectiveCodeSequenceTrial"],2258:["ST","AnatomicLocationOfExaminingInstrumentDescriptionTrial"],2259:["SQ","AnatomicLocationOfExaminingInstrumentCodeSequenceTrial"],"225A":["SQ","AnatomicStructureSpaceOrRegionModifierCodeSequenceTrial"],"225C":["SQ","OnAxisBackgroundAnatomicStructureCodeSequenceTrial"],3001:["SQ","AlternateRepresentationSequence"],3010:["UI","IrradiationEventUID"],4e3:["LT","IdentifyingComments"],9007:["CS","FrameType"],9092:["SQ","ReferencedImageEvidenceSequence"],9121:["SQ","ReferencedRawDataSequence"],9123:["UI","CreatorVersionUID"],9124:["SQ","DerivationImageSequence"],9154:["SQ","SourceImageEvidenceSequence"],9205:["CS","PixelPresentation"],9206:["CS","VolumetricProperties"],9207:["CS","VolumeBasedCalculationTechnique"],9208:["CS","ComplexImageComponent"],9209:["CS","AcquisitionContrast"],9215:["SQ","DerivationCodeSequence"],9237:["SQ","ReferencedPresentationStateSequence"],9410:["SQ","ReferencedOtherPlaneSequence"],9458:["SQ","FrameDisplaySequence"],9459:["FL","RecommendedDisplayFrameRateInFloat"],9460:["CS","SkipFrameRangeFlag"]},"0010":{"0010":["PN","PatientName"],"0020":["LO","PatientID"],"0021":["LO","IssuerOfPatientID"],"0022":["CS","TypeOfPatientID"],"0024":["SQ","IssuerOfPatientIDQualifiersSequence"],"0030":["DA","PatientBirthDate"],"0032":["TM","PatientBirthTime"],"0040":["CS","PatientSex"],"0050":["SQ","PatientInsurancePlanCodeSequence"],"0101":["SQ","PatientPrimaryLanguageCodeSequence"],"0102":["SQ","PatientPrimaryLanguageModifierCodeSequence"],1e3:["LO","OtherPatientIDs"],1001:["PN","OtherPatientNames"],1002:["SQ","OtherPatientIDsSequence"],1005:["PN","PatientBirthName"],1010:["AS","PatientAge"],1020:["DS","PatientSize"],1021:["SQ","PatientSizeCodeSequence"],1030:["DS","PatientWeight"],1040:["LO","PatientAddress"],1050:["LO","InsurancePlanIdentification"],1060:["PN","PatientMotherBirthName"],1080:["LO","MilitaryRank"],1081:["LO","BranchOfService"],1090:["LO","MedicalRecordLocator"],2e3:["LO","MedicalAlerts"],2110:["LO","Allergies"],2150:["LO","CountryOfResidence"],2152:["LO","RegionOfResidence"],2154:["SH","PatientTelephoneNumbers"],2160:["SH","EthnicGroup"],2180:["SH","Occupation"],"21A0":["CS","SmokingStatus"],"21B0":["LT","AdditionalPatientHistory"],"21C0":["US","PregnancyStatus"],"21D0":["DA","LastMenstrualDate"],"21F0":["LO","PatientReligiousPreference"],2201:["LO","PatientSpeciesDescription"],2202:["SQ","PatientSpeciesCodeSequence"],2203:["CS","PatientSexNeutered"],2210:["CS","AnatomicalOrientationType"],2292:["LO","PatientBreedDescription"],2293:["SQ","PatientBreedCodeSequence"],2294:["SQ","BreedRegistrationSequence"],2295:["LO","BreedRegistrationNumber"],2296:["SQ","BreedRegistryCodeSequence"],2297:["PN","ResponsiblePerson"],2298:["CS","ResponsiblePersonRole"],2299:["LO","ResponsibleOrganization"],4e3:["LT","PatientComments"],9431:["FL","ExaminedBodyThickness"]},"0012":{"0010":["LO","ClinicalTrialSponsorName"],"0020":["LO","ClinicalTrialProtocolID"],"0021":["LO","ClinicalTrialProtocolName"],"0030":["LO","ClinicalTrialSiteID"],"0031":["LO","ClinicalTrialSiteName"],"0040":["LO","ClinicalTrialSubjectID"],"0042":["LO","ClinicalTrialSubjectReadingID"],"0050":["LO","ClinicalTrialTimePointID"],"0051":["ST","ClinicalTrialTimePointDescription"],"0060":["LO","ClinicalTrialCoordinatingCenterName"],"0062":["CS","PatientIdentityRemoved"],"0063":["LO","DeidentificationMethod"],"0064":["SQ","DeidentificationMethodCodeSequence"],"0071":["LO","ClinicalTrialSeriesID"],"0072":["LO","ClinicalTrialSeriesDescription"],"0081":["LO","ClinicalTrialProtocolEthicsCommitteeName"],"0082":["LO","ClinicalTrialProtocolEthicsCommitteeApprovalNumber"],"0083":["SQ","ConsentForClinicalTrialUseSequence"],"0084":["CS","DistributionType"],"0085":["CS","ConsentForDistributionFlag"]},"0014":{"0023":["ST","CADFileFormat"],"0024":["ST","ComponentReferenceSystem"],"0025":["ST","ComponentManufacturingProcedure"],"0028":["ST","ComponentManufacturer"],"0030":["DS","MaterialThickness"],"0032":["DS","MaterialPipeDiameter"],"0034":["DS","MaterialIsolationDiameter"],"0042":["ST","MaterialGrade"],"0044":["ST","MaterialPropertiesFileID"],"0045":["ST","MaterialPropertiesFileFormat"],"0046":["LT","MaterialNotes"],"0050":["CS","ComponentShape"],"0052":["CS","CurvatureType"],"0054":["DS","OuterDiameter"],"0056":["DS","InnerDiameter"],1010:["ST","ActualEnvironmentalConditions"],1020:["DA","ExpiryDate"],1040:["ST","EnvironmentalConditions"],2002:["SQ","EvaluatorSequence"],2004:["IS","EvaluatorNumber"],2006:["PN","EvaluatorName"],2008:["IS","EvaluationAttempt"],2012:["SQ","IndicationSequence"],2014:["IS","IndicationNumber "],2016:["SH","IndicationLabel"],2018:["ST","IndicationDescription"],"201A":["CS","IndicationType"],"201C":["CS","IndicationDisposition"],"201E":["SQ","IndicationROISequence"],2030:["SQ","IndicationPhysicalPropertySequence"],2032:["SH","PropertyLabel"],2202:["IS","CoordinateSystemNumberOfAxes "],2204:["SQ","CoordinateSystemAxesSequence"],2206:["ST","CoordinateSystemAxisDescription"],2208:["CS","CoordinateSystemDataSetMapping"],"220A":["IS","CoordinateSystemAxisNumber"],"220C":["CS","CoordinateSystemAxisType"],"220E":["CS","CoordinateSystemAxisUnits"],2210:["OB","CoordinateSystemAxisValues"],2220:["SQ","CoordinateSystemTransformSequence"],2222:["ST","TransformDescription"],2224:["IS","TransformNumberOfAxes"],2226:["IS","TransformOrderOfAxes"],2228:["CS","TransformedAxisUnits"],"222A":["DS","CoordinateSystemTransformRotationAndScaleMatrix"],"222C":["DS","CoordinateSystemTransformTranslationMatrix"],3011:["DS","InternalDetectorFrameTime"],3012:["DS","NumberOfFramesIntegrated"],3020:["SQ","DetectorTemperatureSequence"],3022:["DS","SensorName"],3024:["DS","HorizontalOffsetOfSensor"],3026:["DS","VerticalOffsetOfSensor"],3028:["DS","SensorTemperature"],3040:["SQ","DarkCurrentSequence"],3050:["OB","DarkCurrentCounts"],3060:["SQ","GainCorrectionReferenceSequence"],3070:["OB","AirCounts"],3071:["DS","KVUsedInGainCalibration"],3072:["DS","MAUsedInGainCalibration"],3073:["DS","NumberOfFramesUsedForIntegration"],3074:["LO","FilterMaterialUsedInGainCalibration"],3075:["DS","FilterThicknessUsedInGainCalibration"],3076:["DA","DateOfGainCalibration"],3077:["TM","TimeOfGainCalibration"],3080:["OB","BadPixelImage"],3099:["LT","CalibrationNotes"],4002:["SQ","PulserEquipmentSequence"],4004:["CS","PulserType"],4006:["LT","PulserNotes"],4008:["SQ","ReceiverEquipmentSequence"],"400A":["CS","AmplifierType"],"400C":["LT","ReceiverNotes"],"400E":["SQ","PreAmplifierEquipmentSequence"],"400F":["LT","PreAmplifierNotes"],4010:["SQ","TransmitTransducerSequence"],4011:["SQ","ReceiveTransducerSequence"],4012:["US","NumberOfElements"],4013:["CS","ElementShape"],4014:["DS","ElementDimensionA"],4015:["DS","ElementDimensionB"],4016:["DS","ElementPitch"],4017:["DS","MeasuredBeamDimensionA"],4018:["DS","MeasuredBeamDimensionB"],4019:["DS","LocationOfMeasuredBeamDiameter"],"401A":["DS","NominalFrequency"],"401B":["DS","MeasuredCenterFrequency"],"401C":["DS","MeasuredBandwidth"],4020:["SQ","PulserSettingsSequence"],4022:["DS","PulseWidth"],4024:["DS","ExcitationFrequency"],4026:["CS","ModulationType"],4028:["DS","Damping"],4030:["SQ","ReceiverSettingsSequence"],4031:["DS","AcquiredSoundpathLength"],4032:["CS","AcquisitionCompressionType"],4033:["IS","AcquisitionSampleSize"],4034:["DS","RectifierSmoothing"],4035:["SQ","DACSequence"],4036:["CS","DACType"],4038:["DS","DACGainPoints"],"403A":["DS","DACTimePoints"],"403C":["DS","DACAmplitude"],4040:["SQ","PreAmplifierSettingsSequence"],4050:["SQ","TransmitTransducerSettingsSequence"],4051:["SQ","ReceiveTransducerSettingsSequence"],4052:["DS","IncidentAngle"],4054:["ST","CouplingTechnique"],4056:["ST","CouplingMedium"],4057:["DS","CouplingVelocity"],4058:["DS","CrystalCenterLocationX"],4059:["DS","CrystalCenterLocationZ"],"405A":["DS","SoundPathLength"],"405C":["ST","DelayLawIdentifier"],4060:["SQ","GateSettingsSequence"],4062:["DS","GateThreshold"],4064:["DS","VelocityOfSound"],4070:["SQ","CalibrationSettingsSequence"],4072:["ST","CalibrationProcedure"],4074:["SH","ProcedureVersion"],4076:["DA","ProcedureCreationDate"],4078:["DA","ProcedureExpirationDate"],"407A":["DA","ProcedureLastModifiedDate"],"407C":["TM","CalibrationTime"],"407E":["DA","CalibrationDate"],5002:["IS","LINACEnergy"],5004:["IS","LINACOutput"]},"0018":{"0010":["LO","ContrastBolusAgent"],"0012":["SQ","ContrastBolusAgentSequence"],"0014":["SQ","ContrastBolusAdministrationRouteSequence"],"0015":["CS","BodyPartExamined"],"0020":["CS","ScanningSequence"],"0021":["CS","SequenceVariant"],"0022":["CS","ScanOptions"],"0023":["CS","MRAcquisitionType"],"0024":["SH","SequenceName"],"0025":["CS","AngioFlag"],"0026":["SQ","InterventionDrugInformationSequence"],"0027":["TM","InterventionDrugStopTime"],"0028":["DS","InterventionDrugDose"],"0029":["SQ","InterventionDrugCodeSequence"],"002A":["SQ","AdditionalDrugSequence"],"0030":["LO","Radionuclide"],"0031":["LO","Radiopharmaceutical"],"0032":["DS","EnergyWindowCenterline"],"0033":["DS","EnergyWindowTotalWidth"],"0034":["LO","InterventionDrugName"],"0035":["TM","InterventionDrugStartTime"],"0036":["SQ","InterventionSequence"],"0037":["CS","TherapyType"],"0038":["CS","InterventionStatus"],"0039":["CS","TherapyDescription"],"003A":["ST","InterventionDescription"],"0040":["IS","CineRate"],"0042":["CS","InitialCineRunState"],"0050":["DS","SliceThickness"],"0060":["DS","KVP"],"0070":["IS","CountsAccumulated"],"0071":["CS","AcquisitionTerminationCondition"],"0072":["DS","EffectiveDuration"],"0073":["CS","AcquisitionStartCondition"],"0074":["IS","AcquisitionStartConditionData"],"0075":["IS","AcquisitionTerminationConditionData"],"0080":["DS","RepetitionTime"],"0081":["DS","EchoTime"],"0082":["DS","InversionTime"],"0083":["DS","NumberOfAverages"],"0084":["DS","ImagingFrequency"],"0085":["SH","ImagedNucleus"],"0086":["IS","EchoNumbers"],"0087":["DS","MagneticFieldStrength"],"0088":["DS","SpacingBetweenSlices"],"0089":["IS","NumberOfPhaseEncodingSteps"],"0090":["DS","DataCollectionDiameter"],"0091":["IS","EchoTrainLength"],"0093":["DS","PercentSampling"],"0094":["DS","PercentPhaseFieldOfView"],"0095":["DS","PixelBandwidth"],1e3:["LO","DeviceSerialNumber"],1002:["UI","DeviceUID"],1003:["LO","DeviceID"],1004:["LO","PlateID"],1005:["LO","GeneratorID"],1006:["LO","GridID"],1007:["LO","CassetteID"],1008:["LO","GantryID"],1010:["LO","SecondaryCaptureDeviceID"],1011:["LO","HardcopyCreationDeviceID"],1012:["DA","DateOfSecondaryCapture"],1014:["TM","TimeOfSecondaryCapture"],1016:["LO","SecondaryCaptureDeviceManufacturer"],1017:["LO","HardcopyDeviceManufacturer"],1018:["LO","SecondaryCaptureDeviceManufacturerModelName"],1019:["LO","SecondaryCaptureDeviceSoftwareVersions"],"101A":["LO","HardcopyDeviceSoftwareVersion"],"101B":["LO","HardcopyDeviceManufacturerModelName"],1020:["LO","SoftwareVersions"],1022:["SH","VideoImageFormatAcquired"],1023:["LO","DigitalImageFormatAcquired"],1030:["LO","ProtocolName"],1040:["LO","ContrastBolusRoute"],1041:["DS","ContrastBolusVolume"],1042:["TM","ContrastBolusStartTime"],1043:["TM","ContrastBolusStopTime"],1044:["DS","ContrastBolusTotalDose"],1045:["IS","SyringeCounts"],1046:["DS","ContrastFlowRate"],1047:["DS","ContrastFlowDuration"],1048:["CS","ContrastBolusIngredient"],1049:["DS","ContrastBolusIngredientConcentration"],1050:["DS","SpatialResolution"],1060:["DS","TriggerTime"],1061:["LO","TriggerSourceOrType"],1062:["IS","NominalInterval"],1063:["DS","FrameTime"],1064:["LO","CardiacFramingType"],1065:["DS","FrameTimeVector"],1066:["DS","FrameDelay"],1067:["DS","ImageTriggerDelay"],1068:["DS","MultiplexGroupTimeOffset"],1069:["DS","TriggerTimeOffset"],"106A":["CS","SynchronizationTrigger"],"106C":["US","SynchronizationChannel"],"106E":["UL","TriggerSamplePosition"],1070:["LO","RadiopharmaceuticalRoute"],1071:["DS","RadiopharmaceuticalVolume"],1072:["TM","RadiopharmaceuticalStartTime"],1073:["TM","RadiopharmaceuticalStopTime"],1074:["DS","RadionuclideTotalDose"],1075:["DS","RadionuclideHalfLife"],1076:["DS","RadionuclidePositronFraction"],1077:["DS","RadiopharmaceuticalSpecificActivity"],1078:["DT","RadiopharmaceuticalStartDateTime"],1079:["DT","RadiopharmaceuticalStopDateTime"],1080:["CS","BeatRejectionFlag"],1081:["IS","LowRRValue"],1082:["IS","HighRRValue"],1083:["IS","IntervalsAcquired"],1084:["IS","IntervalsRejected"],1085:["LO","PVCRejection"],1086:["IS","SkipBeats"],1088:["IS","HeartRate"],1090:["IS","CardiacNumberOfImages"],1094:["IS","TriggerWindow"],1100:["DS","ReconstructionDiameter"],1110:["DS","DistanceSourceToDetector"],1111:["DS","DistanceSourceToPatient"],1114:["DS","EstimatedRadiographicMagnificationFactor"],1120:["DS","GantryDetectorTilt"],1121:["DS","GantryDetectorSlew"],1130:["DS","TableHeight"],1131:["DS","TableTraverse"],1134:["CS","TableMotion"],1135:["DS","TableVerticalIncrement"],1136:["DS","TableLateralIncrement"],1137:["DS","TableLongitudinalIncrement"],1138:["DS","TableAngle"],"113A":["CS","TableType"],1140:["CS","RotationDirection"],1141:["DS","AngularPosition"],1142:["DS","RadialPosition"],1143:["DS","ScanArc"],1144:["DS","AngularStep"],1145:["DS","CenterOfRotationOffset"],1146:["DS","RotationOffset"],1147:["CS","FieldOfViewShape"],1149:["IS","FieldOfViewDimensions"],1150:["IS","ExposureTime"],1151:["IS","XRayTubeCurrent"],1152:["IS","Exposure"],1153:["IS","ExposureInuAs"],1154:["DS","AveragePulseWidth"],1155:["CS","RadiationSetting"],1156:["CS","RectificationType"],"115A":["CS","RadiationMode"],"115E":["DS","ImageAndFluoroscopyAreaDoseProduct"],1160:["SH","FilterType"],1161:["LO","TypeOfFilters"],1162:["DS","IntensifierSize"],1164:["DS","ImagerPixelSpacing"],1166:["CS","Grid"],1170:["IS","GeneratorPower"],1180:["SH","CollimatorGridName"],1181:["CS","CollimatorType"],1182:["IS","FocalDistance"],1183:["DS","XFocusCenter"],1184:["DS","YFocusCenter"],1190:["DS","FocalSpots"],1191:["CS","AnodeTargetMaterial"],"11A0":["DS","BodyPartThickness"],"11A2":["DS","CompressionForce"],1200:["DA","DateOfLastCalibration"],1201:["TM","TimeOfLastCalibration"],1210:["SH","ConvolutionKernel"],1240:["IS","UpperLowerPixelValues"],1242:["IS","ActualFrameDuration"],1243:["IS","CountRate"],1244:["US","PreferredPlaybackSequencing"],1250:["SH","ReceiveCoilName"],1251:["SH","TransmitCoilName"],1260:["SH","PlateType"],1261:["LO","PhosphorType"],1300:["DS","ScanVelocity"],1301:["CS","WholeBodyTechnique"],1302:["IS","ScanLength"],1310:["US","AcquisitionMatrix"],1312:["CS","InPlanePhaseEncodingDirection"],1314:["DS","FlipAngle"],1315:["CS","VariableFlipAngleFlag"],1316:["DS","SAR"],1318:["DS","dBdt"],1400:["LO","AcquisitionDeviceProcessingDescription"],1401:["LO","AcquisitionDeviceProcessingCode"],1402:["CS","CassetteOrientation"],1403:["CS","CassetteSize"],1404:["US","ExposuresOnPlate"],1405:["IS","RelativeXRayExposure"],1411:["DS","ExposureIndex"],1412:["DS","TargetExposureIndex"],1413:["DS","DeviationIndex"],1450:["DS","ColumnAngulation"],1460:["DS","TomoLayerHeight"],1470:["DS","TomoAngle"],1480:["DS","TomoTime"],1490:["CS","TomoType"],1491:["CS","TomoClass"],1495:["IS","NumberOfTomosynthesisSourceImages"],1500:["CS","PositionerMotion"],1508:["CS","PositionerType"],1510:["DS","PositionerPrimaryAngle"],1511:["DS","PositionerSecondaryAngle"],1520:["DS","PositionerPrimaryAngleIncrement"],1521:["DS","PositionerSecondaryAngleIncrement"],1530:["DS","DetectorPrimaryAngle"],1531:["DS","DetectorSecondaryAngle"],1600:["CS","ShutterShape"],1602:["IS","ShutterLeftVerticalEdge"],1604:["IS","ShutterRightVerticalEdge"],1606:["IS","ShutterUpperHorizontalEdge"],1608:["IS","ShutterLowerHorizontalEdge"],1610:["IS","CenterOfCircularShutter"],1612:["IS","RadiusOfCircularShutter"],1620:["IS","VerticesOfThePolygonalShutter"],1622:["US","ShutterPresentationValue"],1623:["US","ShutterOverlayGroup"],1624:["US","ShutterPresentationColorCIELabValue"],1700:["CS","CollimatorShape"],1702:["IS","CollimatorLeftVerticalEdge"],1704:["IS","CollimatorRightVerticalEdge"],1706:["IS","CollimatorUpperHorizontalEdge"],1708:["IS","CollimatorLowerHorizontalEdge"],1710:["IS","CenterOfCircularCollimator"],1712:["IS","RadiusOfCircularCollimator"],1720:["IS","VerticesOfThePolygonalCollimator"],1800:["CS","AcquisitionTimeSynchronized"],1801:["SH","TimeSource"],1802:["CS","TimeDistributionProtocol"],1803:["LO","NTPSourceAddress"],2001:["IS","PageNumberVector"],2002:["SH","FrameLabelVector"],2003:["DS","FramePrimaryAngleVector"],2004:["DS","FrameSecondaryAngleVector"],2005:["DS","SliceLocationVector"],2006:["SH","DisplayWindowLabelVector"],2010:["DS","NominalScannedPixelSpacing"],2020:["CS","DigitizingDeviceTransportDirection"],2030:["DS","RotationOfScannedFilm"],3100:["CS","IVUSAcquisition"],3101:["DS","IVUSPullbackRate"],3102:["DS","IVUSGatedRate"],3103:["IS","IVUSPullbackStartFrameNumber"],3104:["IS","IVUSPullbackStopFrameNumber"],3105:["IS","LesionNumber"],4e3:["LT","AcquisitionComments"],5e3:["SH","OutputPower"],5010:["LO","TransducerData"],5012:["DS","FocusDepth"],5020:["LO","ProcessingFunction"],5021:["LO","PostprocessingFunction"],5022:["DS","MechanicalIndex"],5024:["DS","BoneThermalIndex"],5026:["DS","CranialThermalIndex"],5027:["DS","SoftTissueThermalIndex"],5028:["DS","SoftTissueFocusThermalIndex"],5029:["DS","SoftTissueSurfaceThermalIndex"],5030:["DS","DynamicRange"],5040:["DS","TotalGain"],5050:["IS","DepthOfScanField"],5100:["CS","PatientPosition"],5101:["CS","ViewPosition"],5104:["SQ","ProjectionEponymousNameCodeSequence"],5210:["DS","ImageTransformationMatrix"],5212:["DS","ImageTranslationVector"],6e3:["DS","Sensitivity"],6011:["SQ","SequenceOfUltrasoundRegions"],6012:["US","RegionSpatialFormat"],6014:["US","RegionDataType"],6016:["UL","RegionFlags"],6018:["UL","RegionLocationMinX0"],"601A":["UL","RegionLocationMinY0"],"601C":["UL","RegionLocationMaxX1"],"601E":["UL","RegionLocationMaxY1"],6020:["SL","ReferencePixelX0"],6022:["SL","ReferencePixelY0"],6024:["US","PhysicalUnitsXDirection"],6026:["US","PhysicalUnitsYDirection"],6028:["FD","ReferencePixelPhysicalValueX"],"602A":["FD","ReferencePixelPhysicalValueY"],"602C":["FD","PhysicalDeltaX"],"602E":["FD","PhysicalDeltaY"],6030:["UL","TransducerFrequency"],6031:["CS","TransducerType"],6032:["UL","PulseRepetitionFrequency"],6034:["FD","DopplerCorrectionAngle"],6036:["FD","SteeringAngle"],6038:["UL","DopplerSampleVolumeXPositionRetired"],6039:["SL","DopplerSampleVolumeXPosition"],"603A":["UL","DopplerSampleVolumeYPositionRetired"],"603B":["SL","DopplerSampleVolumeYPosition"],"603C":["UL","TMLinePositionX0Retired"],"603D":["SL","TMLinePositionX0"],"603E":["UL","TMLinePositionY0Retired"],"603F":["SL","TMLinePositionY0"],6040:["UL","TMLinePositionX1Retired"],6041:["SL","TMLinePositionX1"],6042:["UL","TMLinePositionY1Retired"],6043:["SL","TMLinePositionY1"],6044:["US","PixelComponentOrganization"],6046:["UL","PixelComponentMask"],6048:["UL","PixelComponentRangeStart"],"604A":["UL","PixelComponentRangeStop"],"604C":["US","PixelComponentPhysicalUnits"],"604E":["US","PixelComponentDataType"],6050:["UL","NumberOfTableBreakPoints"],6052:["UL","TableOfXBreakPoints"],6054:["FD","TableOfYBreakPoints"],6056:["UL","NumberOfTableEntries"],6058:["UL","TableOfPixelValues"],"605A":["FL","TableOfParameterValues"],6060:["FL","RWaveTimeVector"],7e3:["CS","DetectorConditionsNominalFlag"],7001:["DS","DetectorTemperature"],7004:["CS","DetectorType"],7005:["CS","DetectorConfiguration"],7006:["LT","DetectorDescription"],7008:["LT","DetectorMode"],"700A":["SH","DetectorID"],"700C":["DA","DateOfLastDetectorCalibration"],"700E":["TM","TimeOfLastDetectorCalibration"],7010:["IS","ExposuresOnDetectorSinceLastCalibration"],7011:["IS","ExposuresOnDetectorSinceManufactured"],7012:["DS","DetectorTimeSinceLastExposure"],7014:["DS","DetectorActiveTime"],7016:["DS","DetectorActivationOffsetFromExposure"],"701A":["DS","DetectorBinning"],7020:["DS","DetectorElementPhysicalSize"],7022:["DS","DetectorElementSpacing"],7024:["CS","DetectorActiveShape"],7026:["DS","DetectorActiveDimensions"],7028:["DS","DetectorActiveOrigin"],"702A":["LO","DetectorManufacturerName"],"702B":["LO","DetectorManufacturerModelName"],7030:["DS","FieldOfViewOrigin"],7032:["DS","FieldOfViewRotation"],7034:["CS","FieldOfViewHorizontalFlip"],7036:["FL","PixelDataAreaOriginRelativeToFOV"],7038:["FL","PixelDataAreaRotationAngleRelativeToFOV"],7040:["LT","GridAbsorbingMaterial"],7041:["LT","GridSpacingMaterial"],7042:["DS","GridThickness"],7044:["DS","GridPitch"],7046:["IS","GridAspectRatio"],7048:["DS","GridPeriod"],"704C":["DS","GridFocalDistance"],7050:["CS","FilterMaterial"],7052:["DS","FilterThicknessMinimum"],7054:["DS","FilterThicknessMaximum"],7056:["FL","FilterBeamPathLengthMinimum"],7058:["FL","FilterBeamPathLengthMaximum"],7060:["CS","ExposureControlMode"],7062:["LT","ExposureControlModeDescription"],7064:["CS","ExposureStatus"],7065:["DS","PhototimerSetting"],8150:["DS","ExposureTimeInuS"],8151:["DS","XRayTubeCurrentInuA"],9004:["CS","ContentQualification"],9005:["SH","PulseSequenceName"],9006:["SQ","MRImagingModifierSequence"],9008:["CS","EchoPulseSequence"],9009:["CS","InversionRecovery"],9010:["CS","FlowCompensation"],9011:["CS","MultipleSpinEcho"],9012:["CS","MultiPlanarExcitation"],9014:["CS","PhaseContrast"],9015:["CS","TimeOfFlightContrast"],9016:["CS","Spoiling"],9017:["CS","SteadyStatePulseSequence"],9018:["CS","EchoPlanarPulseSequence"],9019:["FD","TagAngleFirstAxis"],9020:["CS","MagnetizationTransfer"],9021:["CS","T2Preparation"],9022:["CS","BloodSignalNulling"],9024:["CS","SaturationRecovery"],9025:["CS","SpectrallySelectedSuppression"],9026:["CS","SpectrallySelectedExcitation"],9027:["CS","SpatialPresaturation"],9028:["CS","Tagging"],9029:["CS","OversamplingPhase"],9030:["FD","TagSpacingFirstDimension"],9032:["CS","GeometryOfKSpaceTraversal"],9033:["CS","SegmentedKSpaceTraversal"],9034:["CS","RectilinearPhaseEncodeReordering"],9035:["FD","TagThickness"],9036:["CS","PartialFourierDirection"],9037:["CS","CardiacSynchronizationTechnique"],9041:["LO","ReceiveCoilManufacturerName"],9042:["SQ","MRReceiveCoilSequence"],9043:["CS","ReceiveCoilType"],9044:["CS","QuadratureReceiveCoil"],9045:["SQ","MultiCoilDefinitionSequence"],9046:["LO","MultiCoilConfiguration"],9047:["SH","MultiCoilElementName"],9048:["CS","MultiCoilElementUsed"],9049:["SQ","MRTransmitCoilSequence"],9050:["LO","TransmitCoilManufacturerName"],9051:["CS","TransmitCoilType"],9052:["FD","SpectralWidth"],9053:["FD","ChemicalShiftReference"],9054:["CS","VolumeLocalizationTechnique"],9058:["US","MRAcquisitionFrequencyEncodingSteps"],9059:["CS","Decoupling"],9060:["CS","DecoupledNucleus"],9061:["FD","DecouplingFrequency"],9062:["CS","DecouplingMethod"],9063:["FD","DecouplingChemicalShiftReference"],9064:["CS","KSpaceFiltering"],9065:["CS","TimeDomainFiltering"],9066:["US","NumberOfZeroFills"],9067:["CS","BaselineCorrection"],9069:["FD","ParallelReductionFactorInPlane"],9070:["FD","CardiacRRIntervalSpecified"],9073:["FD","AcquisitionDuration"],9074:["DT","FrameAcquisitionDateTime"],9075:["CS","DiffusionDirectionality"],9076:["SQ","DiffusionGradientDirectionSequence"],9077:["CS","ParallelAcquisition"],9078:["CS","ParallelAcquisitionTechnique"],9079:["FD","InversionTimes"],9080:["ST","MetaboliteMapDescription"],9081:["CS","PartialFourier"],9082:["FD","EffectiveEchoTime"],9083:["SQ","MetaboliteMapCodeSequence"],9084:["SQ","ChemicalShiftSequence"],9085:["CS","CardiacSignalSource"],9087:["FD","DiffusionBValue"],9089:["FD","DiffusionGradientOrientation"],9090:["FD","VelocityEncodingDirection"],9091:["FD","VelocityEncodingMinimumValue"],9092:["SQ","VelocityEncodingAcquisitionSequence"],9093:["US","NumberOfKSpaceTrajectories"],9094:["CS","CoverageOfKSpace"],9095:["UL","SpectroscopyAcquisitionPhaseRows"],9096:["FD","ParallelReductionFactorInPlaneRetired"],9098:["FD","TransmitterFrequency"],9100:["CS","ResonantNucleus"],9101:["CS","FrequencyCorrection"],9103:["SQ","MRSpectroscopyFOVGeometrySequence"],9104:["FD","SlabThickness"],9105:["FD","SlabOrientation"],9106:["FD","MidSlabPosition"],9107:["SQ","MRSpatialSaturationSequence"],9112:["SQ","MRTimingAndRelatedParametersSequence"],9114:["SQ","MREchoSequence"],9115:["SQ","MRModifierSequence"],9117:["SQ","MRDiffusionSequence"],9118:["SQ","CardiacSynchronizationSequence"],9119:["SQ","MRAveragesSequence"],9125:["SQ","MRFOVGeometrySequence"],9126:["SQ","VolumeLocalizationSequence"],9127:["UL","SpectroscopyAcquisitionDataColumns"],9147:["CS","DiffusionAnisotropyType"],9151:["DT","FrameReferenceDateTime"],9152:["SQ","MRMetaboliteMapSequence"],9155:["FD","ParallelReductionFactorOutOfPlane"],9159:["UL","SpectroscopyAcquisitionOutOfPlanePhaseSteps"],9166:["CS","BulkMotionStatus"],9168:["FD","ParallelReductionFactorSecondInPlane"],9169:["CS","CardiacBeatRejectionTechnique"],9170:["CS","RespiratoryMotionCompensationTechnique"],9171:["CS","RespiratorySignalSource"],9172:["CS","BulkMotionCompensationTechnique"],9173:["CS","BulkMotionSignalSource"],9174:["CS","ApplicableSafetyStandardAgency"],9175:["LO","ApplicableSafetyStandardDescription"],9176:["SQ","OperatingModeSequence"],9177:["CS","OperatingModeType"],9178:["CS","OperatingMode"],9179:["CS","SpecificAbsorptionRateDefinition"],9180:["CS","GradientOutputType"],9181:["FD","SpecificAbsorptionRateValue"],9182:["FD","GradientOutput"],9183:["CS","FlowCompensationDirection"],9184:["FD","TaggingDelay"],9185:["ST","RespiratoryMotionCompensationTechniqueDescription"],9186:["SH","RespiratorySignalSourceID"],9195:["FD","ChemicalShiftMinimumIntegrationLimitInHz"],9196:["FD","ChemicalShiftMaximumIntegrationLimitInHz"],9197:["SQ","MRVelocityEncodingSequence"],9198:["CS","FirstOrderPhaseCorrection"],9199:["CS","WaterReferencedPhaseCorrection"],9200:["CS","MRSpectroscopyAcquisitionType"],9214:["CS","RespiratoryCyclePosition"],9217:["FD","VelocityEncodingMaximumValue"],9218:["FD","TagSpacingSecondDimension"],9219:["SS","TagAngleSecondAxis"],9220:["FD","FrameAcquisitionDuration"],9226:["SQ","MRImageFrameTypeSequence"],9227:["SQ","MRSpectroscopyFrameTypeSequence"],9231:["US","MRAcquisitionPhaseEncodingStepsInPlane"],9232:["US","MRAcquisitionPhaseEncodingStepsOutOfPlane"],9234:["UL","SpectroscopyAcquisitionPhaseColumns"],9236:["CS","CardiacCyclePosition"],9239:["SQ","SpecificAbsorptionRateSequence"],9240:["US","RFEchoTrainLength"],9241:["US","GradientEchoTrainLength"],9250:["CS","ArterialSpinLabelingContrast"],9251:["SQ","MRArterialSpinLabelingSequence"],9252:["LO","ASLTechniqueDescription"],9253:["US","ASLSlabNumber"],9254:["FD ","ASLSlabThickness"],9255:["FD ","ASLSlabOrientation"],9256:["FD ","ASLMidSlabPosition"],9257:["CS","ASLContext"],9258:["UL","ASLPulseTrainDuration"],9259:["CS","ASLCrusherFlag"],"925A":["FD","ASLCrusherFlow"],"925B":["LO","ASLCrusherDescription"],"925C":["CS","ASLBolusCutoffFlag"],"925D":["SQ","ASLBolusCutoffTimingSequence"],"925E":["LO","ASLBolusCutoffTechnique"],"925F":["UL","ASLBolusCutoffDelayTime"],9260:["SQ","ASLSlabSequence"],9295:["FD","ChemicalShiftMinimumIntegrationLimitInppm"],9296:["FD","ChemicalShiftMaximumIntegrationLimitInppm"],9301:["SQ","CTAcquisitionTypeSequence"],9302:["CS","AcquisitionType"],9303:["FD","TubeAngle"],9304:["SQ","CTAcquisitionDetailsSequence"],9305:["FD","RevolutionTime"],9306:["FD","SingleCollimationWidth"],9307:["FD","TotalCollimationWidth"],9308:["SQ","CTTableDynamicsSequence"],9309:["FD","TableSpeed"],9310:["FD","TableFeedPerRotation"],9311:["FD","SpiralPitchFactor"],9312:["SQ","CTGeometrySequence"],9313:["FD","DataCollectionCenterPatient"],9314:["SQ","CTReconstructionSequence"],9315:["CS","ReconstructionAlgorithm"],9316:["CS","ConvolutionKernelGroup"],9317:["FD","ReconstructionFieldOfView"],9318:["FD","ReconstructionTargetCenterPatient"],9319:["FD","ReconstructionAngle"],9320:["SH","ImageFilter"],9321:["SQ","CTExposureSequence"],9322:["FD","ReconstructionPixelSpacing"],9323:["CS","ExposureModulationType"],9324:["FD","EstimatedDoseSaving"],9325:["SQ","CTXRayDetailsSequence"],9326:["SQ","CTPositionSequence"],9327:["FD","TablePosition"],9328:["FD","ExposureTimeInms"],9329:["SQ","CTImageFrameTypeSequence"],9330:["FD","XRayTubeCurrentInmA"],9332:["FD","ExposureInmAs"],9333:["CS","ConstantVolumeFlag"],9334:["CS","FluoroscopyFlag"],9335:["FD","DistanceSourceToDataCollectionCenter"],9337:["US","ContrastBolusAgentNumber"],9338:["SQ","ContrastBolusIngredientCodeSequence"],9340:["SQ","ContrastAdministrationProfileSequence"],9341:["SQ","ContrastBolusUsageSequence"],9342:["CS","ContrastBolusAgentAdministered"],9343:["CS","ContrastBolusAgentDetected"],9344:["CS","ContrastBolusAgentPhase"],9345:["FD","CTDIvol"],9346:["SQ","CTDIPhantomTypeCodeSequence"],9351:["FL","CalciumScoringMassFactorPatient"],9352:["FL","CalciumScoringMassFactorDevice"],9353:["FL","EnergyWeightingFactor"],9360:["SQ","CTAdditionalXRaySourceSequence"],9401:["SQ","ProjectionPixelCalibrationSequence"],9402:["FL","DistanceSourceToIsocenter"],9403:["FL","DistanceObjectToTableTop"],9404:["FL","ObjectPixelSpacingInCenterOfBeam"],9405:["SQ","PositionerPositionSequence"],9406:["SQ","TablePositionSequence"],9407:["SQ","CollimatorShapeSequence"],9410:["CS","PlanesInAcquisition"],9412:["SQ","XAXRFFrameCharacteristicsSequence"],9417:["SQ","FrameAcquisitionSequence"],9420:["CS","XRayReceptorType"],9423:["LO","AcquisitionProtocolName"],9424:["LT","AcquisitionProtocolDescription"],9425:["CS","ContrastBolusIngredientOpaque"],9426:["FL","DistanceReceptorPlaneToDetectorHousing"],9427:["CS","IntensifierActiveShape"],9428:["FL","IntensifierActiveDimensions"],9429:["FL","PhysicalDetectorSize"],9430:["FL","PositionOfIsocenterProjection"],9432:["SQ","FieldOfViewSequence"],9433:["LO","FieldOfViewDescription"],9434:["SQ","ExposureControlSensingRegionsSequence"],9435:["CS","ExposureControlSensingRegionShape"],9436:["SS","ExposureControlSensingRegionLeftVerticalEdge"],9437:["SS","ExposureControlSensingRegionRightVerticalEdge"],9438:["SS","ExposureControlSensingRegionUpperHorizontalEdge"],9439:["SS","ExposureControlSensingRegionLowerHorizontalEdge"],9440:["SS","CenterOfCircularExposureControlSensingRegion"],9441:["US","RadiusOfCircularExposureControlSensingRegion"],9442:["SS","VerticesOfThePolygonalExposureControlSensingRegion"],9447:["FL","ColumnAngulationPatient"],9449:["FL","BeamAngle"],9451:["SQ","FrameDetectorParametersSequence"],9452:["FL","CalculatedAnatomyThickness"],9455:["SQ","CalibrationSequence"],9456:["SQ","ObjectThicknessSequence"],9457:["CS","PlaneIdentification"],9461:["FL","FieldOfViewDimensionsInFloat"],9462:["SQ","IsocenterReferenceSystemSequence"],9463:["FL","PositionerIsocenterPrimaryAngle"],9464:["FL","PositionerIsocenterSecondaryAngle"],9465:["FL","PositionerIsocenterDetectorRotationAngle"],9466:["FL","TableXPositionToIsocenter"],9467:["FL","TableYPositionToIsocenter"],9468:["FL","TableZPositionToIsocenter"],9469:["FL","TableHorizontalRotationAngle"],9470:["FL","TableHeadTiltAngle"],9471:["FL","TableCradleTiltAngle"],9472:["SQ","FrameDisplayShutterSequence"],9473:["FL","AcquiredImageAreaDoseProduct"],9474:["CS","CArmPositionerTabletopRelationship"],9476:["SQ","XRayGeometrySequence"],9477:["SQ","IrradiationEventIdentificationSequence"],9504:["SQ","XRay3DFrameTypeSequence"],9506:["SQ","ContributingSourcesSequence"],9507:["SQ","XRay3DAcquisitionSequence"],9508:["FL","PrimaryPositionerScanArc"],9509:["FL","SecondaryPositionerScanArc"],9510:["FL ","PrimaryPositionerScanStartAngle"],9511:["FL","SecondaryPositionerScanStartAngle"],9514:["FL","PrimaryPositionerIncrement"],9515:["FL","SecondaryPositionerIncrement"],9516:["DT","StartAcquisitionDateTime"],9517:["DT","EndAcquisitionDateTime"],9524:["LO","ApplicationName"],9525:["LO","ApplicationVersion"],9526:["LO","ApplicationManufacturer"],9527:["CS","AlgorithmType"],9528:["LO","AlgorithmDescription"],9530:["SQ","XRay3DReconstructionSequence"],9531:["LO","ReconstructionDescription"],9538:["SQ","PerProjectionAcquisitionSequence"],9601:["SQ","DiffusionBMatrixSequence"],9602:["FD","DiffusionBValueXX"],9603:["FD","DiffusionBValueXY"],9604:["FD","DiffusionBValueXZ"],9605:["FD","DiffusionBValueYY"],9606:["FD","DiffusionBValueYZ"],9607:["FD","DiffusionBValueZZ"],9701:["DT","DecayCorrectionDateTime"],9715:["FD","StartDensityThreshold"],9716:["FD","StartRelativeDensityDifferenceThreshold"],9717:["FD","StartCardiacTriggerCountThreshold"],9718:["FD","StartRespiratoryTriggerCountThreshold"],9719:["FD","TerminationCountsThreshold"],9720:["FD","TerminationDensityThreshold"],9721:["FD","TerminationRelativeDensityThreshold"],9722:["FD","TerminationTimeThreshold"],9723:["FD","TerminationCardiacTriggerCountThreshold"],9724:["FD","TerminationRespiratoryTriggerCountThreshold"],9725:["CS","DetectorGeometry"],9726:["FD","TransverseDetectorSeparation"],9727:["FD","AxialDetectorDimension"],9729:["US","RadiopharmaceuticalAgentNumber"],9732:["SQ","PETFrameAcquisitionSequence"],9733:["SQ","PETDetectorMotionDetailsSequence"],9734:["SQ","PETTableDynamicsSequence"],9735:["SQ","PETPositionSequence"],9736:["SQ","PETFrameCorrectionFactorsSequence"],9737:["SQ","RadiopharmaceuticalUsageSequence"],9738:["CS","AttenuationCorrectionSource"],9739:["US","NumberOfIterations"],9740:["US","NumberOfSubsets"],9749:["SQ","PETReconstructionSequence"],9751:["SQ","PETFrameTypeSequence"],9755:["CS","TimeOfFlightInformationUsed"],9756:["CS","ReconstructionType"],9758:["CS","DecayCorrected"],9759:["CS","AttenuationCorrected"],9760:["CS","ScatterCorrected"],9761:["CS","DeadTimeCorrected"],9762:["CS","GantryMotionCorrected"],9763:["CS","PatientMotionCorrected"],9764:["CS","CountLossNormalizationCorrected"],9765:["CS","RandomsCorrected"],9766:["CS","NonUniformRadialSamplingCorrected"],9767:["CS","SensitivityCalibrated"],9768:["CS","DetectorNormalizationCorrection"],9769:["CS","IterativeReconstructionMethod"],9770:["CS","AttenuationCorrectionTemporalRelationship"],9771:["SQ","PatientPhysiologicalStateSequence"],9772:["SQ","PatientPhysiologicalStateCodeSequence"],9801:["FD","DepthsOfFocus"],9803:["SQ","ExcludedIntervalsSequence"],9804:["DT","ExclusionStartDatetime"],9805:["FD","ExclusionDuration"],9806:["SQ","USImageDescriptionSequence"],9807:["SQ","ImageDataTypeSequence"],9808:["CS","DataType"],9809:["SQ","TransducerScanPatternCodeSequence"],"980B":["CS","AliasedDataType"],"980C":["CS","PositionMeasuringDeviceUsed"],"980D":["SQ","TransducerGeometryCodeSequence"],"980E":["SQ","TransducerBeamSteeringCodeSequence"],"980F":["SQ","TransducerApplicationCodeSequence"],A001:["SQ","ContributingEquipmentSequence"],A002:["DT","ContributionDateTime"],A003:["ST","ContributionDescription"]},"0020":{"000D":["UI","StudyInstanceUID"],"000E":["UI","SeriesInstanceUID"],"0010":["SH","StudyID"],"0011":["IS","SeriesNumber"],"0012":["IS","AcquisitionNumber"],"0013":["IS","InstanceNumber"],"0014":["IS","IsotopeNumber"],"0015":["IS","PhaseNumber"],"0016":["IS","IntervalNumber"],"0017":["IS","TimeSlotNumber"],"0018":["IS","AngleNumber"],"0019":["IS","ItemNumber"],"0020":["CS","PatientOrientation"],"0022":["IS","OverlayNumber"],"0024":["IS","CurveNumber"],"0026":["IS","LUTNumber"],"0030":["DS","ImagePosition"],"0032":["DS","ImagePositionPatient"],"0035":["DS","ImageOrientation"],"0037":["DS","ImageOrientationPatient"],"0050":["DS","Location"],"0052":["UI","FrameOfReferenceUID"],"0060":["CS","Laterality"],"0062":["CS","ImageLaterality"],"0070":["LO","ImageGeometryType"],"0080":["CS","MaskingImage"],"00AA":["IS","ReportNumber"],"0100":["IS","TemporalPositionIdentifier"],"0105":["IS","NumberOfTemporalPositions"],"0110":["DS","TemporalResolution"],"0200":["UI","SynchronizationFrameOfReferenceUID"],"0242":["UI","SOPInstanceUIDOfConcatenationSource"],1e3:["IS","SeriesInStudy"],1001:["IS","AcquisitionsInSeries"],1002:["IS","ImagesInAcquisition"],1003:["IS","ImagesInSeries"],1004:["IS","AcquisitionsInStudy"],1005:["IS","ImagesInStudy"],1020:["LO","Reference"],1040:["LO","PositionReferenceIndicator"],1041:["DS","SliceLocation"],1070:["IS","OtherStudyNumbers"],1200:["IS","NumberOfPatientRelatedStudies"],1202:["IS","NumberOfPatientRelatedSeries"],1204:["IS","NumberOfPatientRelatedInstances"],1206:["IS","NumberOfStudyRelatedSeries"],1208:["IS","NumberOfStudyRelatedInstances"],1209:["IS","NumberOfSeriesRelatedInstances"],3401:["CS","ModifyingDeviceID"],3402:["CS","ModifiedImageID"],3403:["DA","ModifiedImageDate"],3404:["LO","ModifyingDeviceManufacturer"],3405:["TM","ModifiedImageTime"],3406:["LO","ModifiedImageDescription"],4e3:["LT","ImageComments"],5e3:["AT","OriginalImageIdentification"],5002:["LO","OriginalImageIdentificationNomenclature"],9056:["SH","StackID"],9057:["UL","InStackPositionNumber"],9071:["SQ","FrameAnatomySequence"],9072:["CS","FrameLaterality"],9111:["SQ","FrameContentSequence"],9113:["SQ","PlanePositionSequence"],9116:["SQ","PlaneOrientationSequence"],9128:["UL","TemporalPositionIndex"],9153:["FD","NominalCardiacTriggerDelayTime"],9154:["FL","NominalCardiacTriggerTimePriorToRPeak"],9155:["FL","ActualCardiacTriggerTimePriorToRPeak"],9156:["US","FrameAcquisitionNumber"],9157:["UL","DimensionIndexValues"],9158:["LT","FrameComments"],9161:["UI","ConcatenationUID"],9162:["US","InConcatenationNumber"],9163:["US","InConcatenationTotalNumber"],9164:["UI","DimensionOrganizationUID"],9165:["AT","DimensionIndexPointer"],9167:["AT","FunctionalGroupPointer"],9213:["LO","DimensionIndexPrivateCreator"],9221:["SQ","DimensionOrganizationSequence"],9222:["SQ","DimensionIndexSequence"],9228:["UL","ConcatenationFrameOffsetNumber"],9238:["LO","FunctionalGroupPrivateCreator"],9241:["FL","NominalPercentageOfCardiacPhase"],9245:["FL","NominalPercentageOfRespiratoryPhase"],9246:["FL","StartingRespiratoryAmplitude"],9247:["CS","StartingRespiratoryPhase"],9248:["FL","EndingRespiratoryAmplitude"],9249:["CS","EndingRespiratoryPhase"],9250:["CS","RespiratoryTriggerType"],9251:["FD","RRIntervalTimeNominal"],9252:["FD","ActualCardiacTriggerDelayTime"],9253:["SQ","RespiratorySynchronizationSequence"],9254:["FD","RespiratoryIntervalTime"],9255:["FD","NominalRespiratoryTriggerDelayTime"],9256:["FD","RespiratoryTriggerDelayThreshold"],9257:["FD","ActualRespiratoryTriggerDelayTime"],9301:["FD","ImagePositionVolume"],9302:["FD","ImageOrientationVolume"],9307:["CS","UltrasoundAcquisitionGeometry"],9308:["FD","ApexPosition"],9309:["FD","VolumeToTransducerMappingMatrix"],"930A":["FD","VolumeToTableMappingMatrix"],"930C":["CS","PatientFrameOfReferenceSource"],"930D":["FD","TemporalPositionTimeOffset"],"930E":["SQ","PlanePositionVolumeSequence"],"930F":["SQ","PlaneOrientationVolumeSequence"],9310:["SQ","TemporalPositionSequence"],9311:["CS","DimensionOrganizationType"],9312:["UI","VolumeFrameOfReferenceUID"],9313:["UI","TableFrameOfReferenceUID"],9421:["LO","DimensionDescriptionLabel"],9450:["SQ","PatientOrientationInFrameSequence"],9453:["LO","FrameLabel"],9518:["US","AcquisitionIndex"],9529:["SQ","ContributingSOPInstancesReferenceSequence"],9536:["US","ReconstructionIndex"]},"0022":{"0001":["US","LightPathFilterPassThroughWavelength"],"0002":["US","LightPathFilterPassBand"],"0003":["US","ImagePathFilterPassThroughWavelength"],"0004":["US","ImagePathFilterPassBand"],"0005":["CS","PatientEyeMovementCommanded"],"0006":["SQ","PatientEyeMovementCommandCodeSequence"],"0007":["FL","SphericalLensPower"],"0008":["FL","CylinderLensPower"],"0009":["FL","CylinderAxis"],"000A":["FL","EmmetropicMagnification"],"000B":["FL","IntraOcularPressure"],"000C":["FL","HorizontalFieldOfView"],"000D":["CS","PupilDilated"],"000E":["FL","DegreeOfDilation"],"0010":["FL","StereoBaselineAngle"],"0011":["FL","StereoBaselineDisplacement"],"0012":["FL","StereoHorizontalPixelOffset"],"0013":["FL","StereoVerticalPixelOffset"],"0014":["FL","StereoRotation"],"0015":["SQ","AcquisitionDeviceTypeCodeSequence"],"0016":["SQ","IlluminationTypeCodeSequence"],"0017":["SQ","LightPathFilterTypeStackCodeSequence"],"0018":["SQ","ImagePathFilterTypeStackCodeSequence"],"0019":["SQ","LensesCodeSequence"],"001A":["SQ","ChannelDescriptionCodeSequence"],"001B":["SQ","RefractiveStateSequence"],"001C":["SQ","MydriaticAgentCodeSequence"],"001D":["SQ","RelativeImagePositionCodeSequence"],"001E":["FL","CameraAngleOfView"],"0020":["SQ","StereoPairsSequence"],"0021":["SQ","LeftImageSequence"],"0022":["SQ","RightImageSequence"],"0030":["FL","AxialLengthOfTheEye"],"0031":["SQ","OphthalmicFrameLocationSequence"],"0032":["FL","ReferenceCoordinates"],"0035":["FL","DepthSpatialResolution"],"0036":["FL","MaximumDepthDistortion"],"0037":["FL","AlongScanSpatialResolution"],"0038":["FL","MaximumAlongScanDistortion"],"0039":["CS","OphthalmicImageOrientation"],"0041":["FL","DepthOfTransverseImage"],"0042":["SQ","MydriaticAgentConcentrationUnitsSequence"],"0048":["FL","AcrossScanSpatialResolution"],"0049":["FL","MaximumAcrossScanDistortion"],"004E":["DS","MydriaticAgentConcentration"],"0055":["FL","IlluminationWaveLength"],"0056":["FL","IlluminationPower"],"0057":["FL","IlluminationBandwidth"],"0058":["SQ","MydriaticAgentSequence"],1007:["SQ","OphthalmicAxialMeasurementsRightEyeSequence"],1008:["SQ","OphthalmicAxialMeasurementsLeftEyeSequence"],1010:["CS","OphthalmicAxialLengthMeasurementsType"],1019:["FL","OphthalmicAxialLength"],1024:["SQ","LensStatusCodeSequence"],1025:["SQ","VitreousStatusCodeSequence"],1028:["SQ","IOLFormulaCodeSequence"],1029:["LO","IOLFormulaDetail"],1033:["FL","KeratometerIndex"],1035:["SQ","SourceOfOphthalmicAxialLengthCodeSequence"],1037:["FL","TargetRefraction"],1039:["CS","RefractiveProcedureOccurred"],1040:["SQ","RefractiveSurgeryTypeCodeSequence"],1044:["SQ","OphthalmicUltrasoundAxialMeasurementsTypeCodeSequence"],1050:["SQ","OphthalmicAxialLengthMeasurementsSequence"],1053:["FL","IOLPower"],1054:["FL","PredictedRefractiveError"],1059:["FL","OphthalmicAxialLengthVelocity"],1065:["LO","LensStatusDescription"],1066:["LO","VitreousStatusDescription"],1090:["SQ","IOLPowerSequence"],1092:["SQ","LensConstantSequence"],1093:["LO","IOLManufacturer"],1094:["LO","LensConstantDescription"],1096:["SQ","KeratometryMeasurementTypeCodeSequence"],1100:["SQ","ReferencedOphthalmicAxialMeasurementsSequence"],1101:["SQ","OphthalmicAxialLengthMeasurementsSegmentNameCodeSequence"],1103:["SQ","RefractiveErrorBeforeRefractiveSurgeryCodeSequence"],1121:["FL","IOLPowerForExactEmmetropia"],1122:["FL","IOLPowerForExactTargetRefraction"],1125:["SQ","AnteriorChamberDepthDefinitionCodeSequence"],1130:["FL","LensThickness"],1131:["FL","AnteriorChamberDepth"],1132:["SQ","SourceOfLensThicknessDataCodeSequence"],1133:["SQ","SourceOfAnteriorChamberDepthDataCodeSequence"],1135:["SQ","SourceOfRefractiveErrorDataCodeSequence"],1140:["CS","OphthalmicAxialLengthMeasurementModified"],1150:["SQ","OphthalmicAxialLengthDataSourceCodeSequence"],1153:["SQ","OphthalmicAxialLengthAcquisitionMethodCodeSequence"],1155:["FL","SignalToNoiseRatio"],1159:["LO","OphthalmicAxialLengthDataSourceDescription"],1210:["SQ","OphthalmicAxialLengthMeasurementsTotalLengthSequence"],1211:["SQ","OphthalmicAxialLengthMeasurementsSegmentalLengthSequence"],1212:["SQ","OphthalmicAxialLengthMeasurementsLengthSummationSequence"],1220:["SQ","UltrasoundOphthalmicAxialLengthMeasurementsSequence"],1225:["SQ","OpticalOphthalmicAxialLengthMeasurementsSequence"],1230:["SQ","UltrasoundSelectedOphthalmicAxialLengthSequence"],1250:["SQ","OphthalmicAxialLengthSelectionMethodCodeSequence"],1255:["SQ","OpticalSelectedOphthalmicAxialLengthSequence"],1257:["SQ","SelectedSegmentalOphthalmicAxialLengthSequence"],1260:["SQ","SelectedTotalOphthalmicAxialLengthSequence"],1262:["SQ","OphthalmicAxialLengthQualityMetricSequence"],1273:["LO","OphthalmicAxialLengthQualityMetricTypeDescription"],1300:["SQ","IntraocularLensCalculationsRightEyeSequence"],1310:["SQ","IntraocularLensCalculationsLeftEyeSequence"],1330:["SQ","ReferencedOphthalmicAxialLengthMeasurementQCImageSequence"]},"0024":{"0010":["FL","VisualFieldHorizontalExtent"],"0011":["FL","VisualFieldVerticalExtent"],"0012":["CS","VisualFieldShape"],"0016":["SQ","ScreeningTestModeCodeSequence"],"0018":["FL","MaximumStimulusLuminance"],"0020":["FL","BackgroundLuminance"],"0021":["SQ","StimulusColorCodeSequence"],"0024":["SQ","BackgroundIlluminationColorCodeSequence"],"0025":["FL","StimulusArea"],"0028":["FL","StimulusPresentationTime"],"0032":["SQ","FixationSequence"],"0033":["SQ","FixationMonitoringCodeSequence"],"0034":["SQ","VisualFieldCatchTrialSequence"],"0035":["US","FixationCheckedQuantity"],"0036":["US","PatientNotProperlyFixatedQuantity"],"0037":["CS","PresentedVisualStimuliDataFlag"],"0038":["US","NumberOfVisualStimuli"],"0039":["CS","ExcessiveFixationLossesDataFlag"],"0040":["CS","ExcessiveFixationLosses"],"0042":["US","StimuliRetestingQuantity"],"0044":["LT","CommentsOnPatientPerformanceOfVisualField"],"0045":["CS","FalseNegativesEstimateFlag"],"0046":["FL","FalseNegativesEstimate"],"0048":["US","NegativeCatchTrialsQuantity"],"0050":["US","FalseNegativesQuantity"],"0051":["CS","ExcessiveFalseNegativesDataFlag"],"0052":["CS","ExcessiveFalseNegatives"],"0053":["CS","FalsePositivesEstimateFlag"],"0054":["FL","FalsePositivesEstimate"],"0055":["CS","CatchTrialsDataFlag"],"0056":["US","PositiveCatchTrialsQuantity"],"0057":["CS","TestPointNormalsDataFlag"],"0058":["SQ","TestPointNormalsSequence"],"0059":["CS","GlobalDeviationProbabilityNormalsFlag"],"0060":["US","FalsePositivesQuantity"],"0061":["CS","ExcessiveFalsePositivesDataFlag"],"0062":["CS","ExcessiveFalsePositives"],"0063":["CS","VisualFieldTestNormalsFlag"],"0064":["SQ","ResultsNormalsSequence"],"0065":["SQ","AgeCorrectedSensitivityDeviationAlgorithmSequence"],"0066":["FL","GlobalDeviationFromNormal"],"0067":["SQ","GeneralizedDefectSensitivityDeviationAlgorithmSequence"],"0068":["FL","LocalizedDeviationfromNormal"],"0069":["LO","PatientReliabilityIndicator"],"0070":["FL","VisualFieldMeanSensitivity"],"0071":["FL","GlobalDeviationProbability"],"0072":["CS","LocalDeviationProbabilityNormalsFlag"],"0073":["FL","LocalizedDeviationProbability"],"0074":["CS","ShortTermFluctuationCalculated"],"0075":["FL","ShortTermFluctuation"],"0076":["CS","ShortTermFluctuationProbabilityCalculated"],"0077":["FL","ShortTermFluctuationProbability"],"0078":["CS","CorrectedLocalizedDeviationFromNormalCalculated"],"0079":["FL","CorrectedLocalizedDeviationFromNormal"],"0080":["CS","CorrectedLocalizedDeviationFromNormalProbabilityCalculated"],"0081":["FL","CorrectedLocalizedDeviationFromNormalProbability"],"0083":["SQ","GlobalDeviationProbabilitySequence"],"0085":["SQ","LocalizedDeviationProbabilitySequence"],"0086":["CS","FovealSensitivityMeasured"],"0087":["FL","FovealSensitivity"],"0088":["FL","VisualFieldTestDuration"],"0089":["SQ","VisualFieldTestPointSequence"],"0090":["FL","VisualFieldTestPointXCoordinate"],"0091":["FL","VisualFieldTestPointYCoordinate"],"0092":["FL","AgeCorrectedSensitivityDeviationValue"],"0093":["CS","StimulusResults"],"0094":["FL","SensitivityValue"],"0095":["CS","RetestStimulusSeen"],"0096":["FL","RetestSensitivityValue"],"0097":["SQ","VisualFieldTestPointNormalsSequence"],"0098":["FL","QuantifiedDefect"],"0100":["FL","AgeCorrectedSensitivityDeviationProbabilityValue"],"0102":["CS","GeneralizedDefectCorrectedSensitivityDeviationFlag "],"0103":["FL","GeneralizedDefectCorrectedSensitivityDeviationValue "],"0104":["FL","GeneralizedDefectCorrectedSensitivityDeviationProbabilityValue"],"0105":["FL ","MinimumSensitivityValue"],"0106":["CS","BlindSpotLocalized"],"0107":["FL","BlindSpotXCoordinate"],"0108":["FL","BlindSpotYCoordinate "],"0110":["SQ","VisualAcuityMeasurementSequence"],"0112":["SQ","RefractiveParametersUsedOnPatientSequence"],"0113":["CS","MeasurementLaterality"],"0114":["SQ","OphthalmicPatientClinicalInformationLeftEyeSequence"],"0115":["SQ","OphthalmicPatientClinicalInformationRightEyeSequence"],"0117":["CS","FovealPointNormativeDataFlag"],"0118":["FL","FovealPointProbabilityValue"],"0120":["CS","ScreeningBaselineMeasured"],"0122":["SQ","ScreeningBaselineMeasuredSequence"],"0124":["CS","ScreeningBaselineType"],"0126":["FL","ScreeningBaselineValue"],"0202":["LO","AlgorithmSource"],"0306":["LO","DataSetName"],"0307":["LO","DataSetVersion"],"0308":["LO","DataSetSource"],"0309":["LO","DataSetDescription"],"0317":["SQ","VisualFieldTestReliabilityGlobalIndexSequence"],"0320":["SQ","VisualFieldGlobalResultsIndexSequence"],"0325":["SQ","DataObservationSequence"],"0338":["CS","IndexNormalsFlag"],"0341":["FL","IndexProbability"],"0344":["SQ","IndexProbabilitySequence"]},"0028":{"0002":["US","SamplesPerPixel"],"0003":["US","SamplesPerPixelUsed"],"0004":["CS","PhotometricInterpretation"],"0005":["US","ImageDimensions"],"0006":["US","PlanarConfiguration"],"0008":["IS","NumberOfFrames"],"0009":["AT","FrameIncrementPointer"],"000A":["AT","FrameDimensionPointer"],"0010":["US","Rows"],"0011":["US","Columns"],"0012":["US","Planes"],"0014":["US","UltrasoundColorDataPresent"],"0030":["DS","PixelSpacing"],"0031":["DS","ZoomFactor"],"0032":["DS","ZoomCenter"],"0034":["IS","PixelAspectRatio"],"0040":["CS","ImageFormat"],"0050":["LO","ManipulatedImage"],"0051":["CS","CorrectedImage"],"005F":["LO","CompressionRecognitionCode"],"0060":["CS","CompressionCode"],"0061":["SH","CompressionOriginator"],"0062":["LO","CompressionLabel"],"0063":["SH","CompressionDescription"],"0065":["CS","CompressionSequence"],"0066":["AT","CompressionStepPointers"],"0068":["US","RepeatInterval"],"0069":["US","BitsGrouped"],"0070":["US","PerimeterTable"],"0071":["SS","PerimeterValue"],"0080":["US","PredictorRows"],"0081":["US","PredictorColumns"],"0082":["US","PredictorConstants"],"0090":["CS","BlockedPixels"],"0091":["US","BlockRows"],"0092":["US","BlockColumns"],"0093":["US","RowOverlap"],"0094":["US","ColumnOverlap"],"0100":["US","BitsAllocated"],"0101":["US","BitsStored"],"0102":["US","HighBit"],"0103":["US","PixelRepresentation"],"0104":["SS","SmallestValidPixelValue"],"0105":["SS","LargestValidPixelValue"],"0106":["SS","SmallestImagePixelValue"],"0107":["SS","LargestImagePixelValue"],"0108":["SS","SmallestPixelValueInSeries"],"0109":["SS","LargestPixelValueInSeries"],"0110":["SS","SmallestImagePixelValueInPlane"],"0111":["SS","LargestImagePixelValueInPlane"],"0120":["SS","PixelPaddingValue"],"0121":["SS","PixelPaddingRangeLimit"],"0200":["US","ImageLocation"],"0300":["CS","QualityControlImage"],"0301":["CS","BurnedInAnnotation"],"0302":["CS","RecognizableVisualFeatures"],"0303":["CS","LongitudinalTemporalInformationModified"],"0400":["LO","TransformLabel"],"0401":["LO","TransformVersionNumber"],"0402":["US","NumberOfTransformSteps"],"0403":["LO","SequenceOfCompressedData"],"0404":["AT","DetailsOfCoefficients"],"0700":["LO","DCTLabel"],"0701":["CS","DataBlockDescription"],"0702":["AT","DataBlock"],"0710":["US","NormalizationFactorFormat"],"0720":["US","ZonalMapNumberFormat"],"0721":["AT","ZonalMapLocation"],"0722":["US","ZonalMapFormat"],"0730":["US","AdaptiveMapFormat"],"0740":["US","CodeNumberFormat"],"0A02":["CS","PixelSpacingCalibrationType"],"0A04":["LO","PixelSpacingCalibrationDescription"],1040:["CS","PixelIntensityRelationship"],1041:["SS","PixelIntensityRelationshipSign"],1050:["DS","WindowCenter"],1051:["DS","WindowWidth"],1052:["DS","RescaleIntercept"],1053:["DS","RescaleSlope"],1054:["LO","RescaleType"],1055:["LO","WindowCenterWidthExplanation"],1056:["CS","VOILUTFunction"],1080:["CS","GrayScale"],1090:["CS","RecommendedViewingMode"],1100:["SS","GrayLookupTableDescriptor"],1101:["SS","RedPaletteColorLookupTableDescriptor"],1102:["SS","GreenPaletteColorLookupTableDescriptor"],1103:["SS","BluePaletteColorLookupTableDescriptor"],1104:["US","AlphaPaletteColorLookupTableDescriptor"],1111:["SS","LargeRedPaletteColorLookupTableDescriptor"],1112:["SS","LargeGreenPaletteColorLookupTableDescriptor"],1113:["SS","LargeBluePaletteColorLookupTableDescriptor"],1199:["UI","PaletteColorLookupTableUID"],1200:["OW","GrayLookupTableData"],1201:["OW","RedPaletteColorLookupTableData"],1202:["OW","GreenPaletteColorLookupTableData"],1203:["OW","BluePaletteColorLookupTableData"],1204:["OW","AlphaPaletteColorLookupTableData"],1211:["OW","LargeRedPaletteColorLookupTableData"],1212:["OW","LargeGreenPaletteColorLookupTableData"],1213:["OW","LargeBluePaletteColorLookupTableData"],1214:["UI","LargePaletteColorLookupTableUID"],1221:["OW","SegmentedRedPaletteColorLookupTableData"],1222:["OW","SegmentedGreenPaletteColorLookupTableData"],1223:["OW","SegmentedBluePaletteColorLookupTableData"],1300:["CS","BreastImplantPresent"],1350:["CS","PartialView"],1351:["ST","PartialViewDescription"],1352:["SQ","PartialViewCodeSequence"],"135A":["CS","SpatialLocationsPreserved"],1401:["SQ","DataFrameAssignmentSequence"],1402:["CS","DataPathAssignment"],1403:["US","BitsMappedToColorLookupTable"],1404:["SQ","BlendingLUT1Sequence"],1405:["CS","BlendingLUT1TransferFunction"],1406:["FD","BlendingWeightConstant"],1407:["US","BlendingLookupTableDescriptor"],1408:["OW","BlendingLookupTableData"],"140B":["SQ","EnhancedPaletteColorLookupTableSequence"],"140C":["SQ","BlendingLUT2Sequence"],"140D":["CS","BlendingLUT2TransferFunction"],"140E":["CS","DataPathID"],"140F":["CS","RGBLUTTransferFunction"],1410:["CS","AlphaLUTTransferFunction"],2e3:["OB","ICCProfile"],2110:["CS","LossyImageCompression"],2112:["DS","LossyImageCompressionRatio"],2114:["CS","LossyImageCompressionMethod"],3e3:["SQ","ModalityLUTSequence"],3002:["SS","LUTDescriptor"],3003:["LO","LUTExplanation"],3004:["LO","ModalityLUTType"],3006:["OW","LUTData"],3010:["SQ","VOILUTSequence"],3110:["SQ","SoftcopyVOILUTSequence"],4e3:["LT","ImagePresentationComments"],5e3:["SQ","BiPlaneAcquisitionSequence"],6010:["US","RepresentativeFrameNumber"],6020:["US","FrameNumbersOfInterest"],6022:["LO","FrameOfInterestDescription"],6023:["CS","FrameOfInterestType"],6030:["US","MaskPointers"],6040:["US","RWavePointer"],6100:["SQ","MaskSubtractionSequence"],6101:["CS","MaskOperation"],6102:["US","ApplicableFrameRange"],6110:["US","MaskFrameNumbers"],6112:["US","ContrastFrameAveraging"],6114:["FL","MaskSubPixelShift"],6120:["SS","TIDOffset"],6190:["ST","MaskOperationExplanation"],"7FE0":["UT","PixelDataProviderURL"],9001:["UL","DataPointRows"],9002:["UL","DataPointColumns"],9003:["CS","SignalDomainColumns"],9099:["US","LargestMonochromePixelValue"],9108:["CS","DataRepresentation"],9110:["SQ","PixelMeasuresSequence"],9132:["SQ","FrameVOILUTSequence"],9145:["SQ","PixelValueTransformationSequence"],9235:["CS","SignalDomainRows"],9411:["FL","DisplayFilterPercentage"],9415:["SQ","FramePixelShiftSequence"],9416:["US","SubtractionItemID"],9422:["SQ","PixelIntensityRelationshipLUTSequence"],9443:["SQ","FramePixelDataPropertiesSequence"],9444:["CS","GeometricalProperties"],9445:["FL","GeometricMaximumDistortion"],9446:["CS","ImageProcessingApplied"],9454:["CS","MaskSelectionMode"],9474:["CS","LUTFunction"],9478:["FL","MaskVisibilityPercentage"],9501:["SQ","PixelShiftSequence"],9502:["SQ","RegionPixelShiftSequence"],9503:["SS","VerticesOfTheRegion"],9505:["SQ","MultiFramePresentationSequence"],9506:["US","PixelShiftFrameRange"],9507:["US","LUTFrameRange"],9520:["DS","ImageToEquipmentMappingMatrix"],9537:["CS","EquipmentCoordinateSystemIdentification"]},"0032":{"000A":["CS","StudyStatusID"],"000C":["CS","StudyPriorityID"],"0012":["LO","StudyIDIssuer"],"0032":["DA","StudyVerifiedDate"],"0033":["TM","StudyVerifiedTime"],"0034":["DA","StudyReadDate"],"0035":["TM","StudyReadTime"],1e3:["DA","ScheduledStudyStartDate"],1001:["TM","ScheduledStudyStartTime"],1010:["DA","ScheduledStudyStopDate"],1011:["TM","ScheduledStudyStopTime"],1020:["LO","ScheduledStudyLocation"],1021:["AE","ScheduledStudyLocationAETitle"],1030:["LO","ReasonForStudy"],1031:["SQ","RequestingPhysicianIdentificationSequence"],1032:["PN","RequestingPhysician"],1033:["LO","RequestingService"],1034:["SQ","RequestingServiceCodeSequence"],1040:["DA","StudyArrivalDate"],1041:["TM","StudyArrivalTime"],1050:["DA","StudyCompletionDate"],1051:["TM","StudyCompletionTime"],1055:["CS","StudyComponentStatusID"],1060:["LO","RequestedProcedureDescription"],1064:["SQ","RequestedProcedureCodeSequence"],1070:["LO","RequestedContrastAgent"],4e3:["LT","StudyComments"]},"0038":{"0004":["SQ","ReferencedPatientAliasSequence"],"0008":["CS","VisitStatusID"],"0010":["LO","AdmissionID"],"0011":["LO","IssuerOfAdmissionID"],"0014":["SQ","IssuerOfAdmissionIDSequence"],"0016":["LO","RouteOfAdmissions"],"001A":["DA","ScheduledAdmissionDate"],"001B":["TM","ScheduledAdmissionTime"],"001C":["DA","ScheduledDischargeDate"],"001D":["TM","ScheduledDischargeTime"],"001E":["LO","ScheduledPatientInstitutionResidence"],"0020":["DA","AdmittingDate"],"0021":["TM","AdmittingTime"],"0030":["DA","DischargeDate"],"0032":["TM","DischargeTime"],"0040":["LO","DischargeDiagnosisDescription"],"0044":["SQ","DischargeDiagnosisCodeSequence"],"0050":["LO","SpecialNeeds"],"0060":["LO","ServiceEpisodeID"],"0061":["LO","IssuerOfServiceEpisodeID"],"0062":["LO","ServiceEpisodeDescription"],"0064":["SQ","IssuerOfServiceEpisodeIDSequence"],"0100":["SQ","PertinentDocumentsSequence"],"0300":["LO","CurrentPatientLocation"],"0400":["LO","PatientInstitutionResidence"],"0500":["LO","PatientState"],"0502":["SQ","PatientClinicalTrialParticipationSequence"],4e3:["LT","VisitComments"]},"003A":{"0004":["CS","WaveformOriginality"],"0005":["US","NumberOfWaveformChannels"],"0010":["UL","NumberOfWaveformSamples"],"001A":["DS","SamplingFrequency"],"0020":["SH","MultiplexGroupLabel"],"0200":["SQ","ChannelDefinitionSequence"],"0202":["IS","WaveformChannelNumber"],"0203":["SH","ChannelLabel"],"0205":["CS","ChannelStatus"],"0208":["SQ","ChannelSourceSequence"],"0209":["SQ","ChannelSourceModifiersSequence"],"020A":["SQ","SourceWaveformSequence"],"020C":["LO","ChannelDerivationDescription"],"0210":["DS","ChannelSensitivity"],"0211":["SQ","ChannelSensitivityUnitsSequence"],"0212":["DS","ChannelSensitivityCorrectionFactor"],"0213":["DS","ChannelBaseline"],"0214":["DS","ChannelTimeSkew"],"0215":["DS","ChannelSampleSkew"],"0218":["DS","ChannelOffset"],"021A":["US","WaveformBitsStored"],"0220":["DS","FilterLowFrequency"],"0221":["DS","FilterHighFrequency"],"0222":["DS","NotchFilterFrequency"],"0223":["DS","NotchFilterBandwidth"],"0230":["FL","WaveformDataDisplayScale"],"0231":["US","WaveformDisplayBackgroundCIELabValue"],"0240":["SQ","WaveformPresentationGroupSequence"],"0241":["US","PresentationGroupNumber"],"0242":["SQ","ChannelDisplaySequence"],"0244":["US","ChannelRecommendedDisplayCIELabValue"],"0245":["FL","ChannelPosition"],"0246":["CS","DisplayShadingFlag"],"0247":["FL","FractionalChannelDisplayScale"],"0248":["FL","AbsoluteChannelDisplayScale"],"0300":["SQ","MultiplexedAudioChannelsDescriptionCodeSequence"],"0301":["IS","ChannelIdentificationCode"],"0302":["CS","ChannelMode"]},"0040":{"0001":["AE","ScheduledStationAETitle"],"0002":["DA","ScheduledProcedureStepStartDate"],"0003":["TM","ScheduledProcedureStepStartTime"],"0004":["DA","ScheduledProcedureStepEndDate"],"0005":["TM","ScheduledProcedureStepEndTime"],"0006":["PN","ScheduledPerformingPhysicianName"],"0007":["LO","ScheduledProcedureStepDescription"],"0008":["SQ","ScheduledProtocolCodeSequence"],"0009":["SH","ScheduledProcedureStepID"],"000A":["SQ","StageCodeSequence"],"000B":["SQ","ScheduledPerformingPhysicianIdentificationSequence"],"0010":["SH","ScheduledStationName"],"0011":["SH","ScheduledProcedureStepLocation"],"0012":["LO","PreMedication"],"0020":["CS","ScheduledProcedureStepStatus"],"0026":["SQ","OrderPlacerIdentifierSequence"],"0027":["SQ","OrderFillerIdentifierSequence"],"0031":["UT","LocalNamespaceEntityID"],"0032":["UT","UniversalEntityID"],"0033":["CS","UniversalEntityIDType"],"0035":["CS","IdentifierTypeCode"],"0036":["SQ","AssigningFacilitySequence"],"0039":["SQ","AssigningJurisdictionCodeSequence"],"003A":["SQ","AssigningAgencyOrDepartmentCodeSequence"],"0100":["SQ","ScheduledProcedureStepSequence"],"0220":["SQ","ReferencedNonImageCompositeSOPInstanceSequence"],"0241":["AE","PerformedStationAETitle"],"0242":["SH","PerformedStationName"],"0243":["SH","PerformedLocation"],"0244":["DA","PerformedProcedureStepStartDate"],"0245":["TM","PerformedProcedureStepStartTime"],"0250":["DA","PerformedProcedureStepEndDate"],"0251":["TM","PerformedProcedureStepEndTime"],"0252":["CS","PerformedProcedureStepStatus"],"0253":["SH","PerformedProcedureStepID"],"0254":["LO","PerformedProcedureStepDescription"],"0255":["LO","PerformedProcedureTypeDescription"],"0260":["SQ","PerformedProtocolCodeSequence"],"0261":["CS","PerformedProtocolType"],"0270":["SQ","ScheduledStepAttributesSequence"],"0275":["SQ","RequestAttributesSequence"],"0280":["ST","CommentsOnThePerformedProcedureStep"],"0281":["SQ","PerformedProcedureStepDiscontinuationReasonCodeSequence"],"0293":["SQ","QuantitySequence"],"0294":["DS","Quantity"],"0295":["SQ","MeasuringUnitsSequence"],"0296":["SQ","BillingItemSequence"],"0300":["US","TotalTimeOfFluoroscopy"],"0301":["US","TotalNumberOfExposures"],"0302":["US","EntranceDose"],"0303":["US","ExposedArea"],"0306":["DS","DistanceSourceToEntrance"],"0307":["DS","DistanceSourceToSupport"],"030E":["SQ","ExposureDoseSequence"],"0310":["ST","CommentsOnRadiationDose"],"0312":["DS","XRayOutput"],"0314":["DS","HalfValueLayer"],"0316":["DS","OrganDose"],"0318":["CS","OrganExposed"],"0320":["SQ","BillingProcedureStepSequence"],"0321":["SQ","FilmConsumptionSequence"],"0324":["SQ","BillingSuppliesAndDevicesSequence"],"0330":["SQ","ReferencedProcedureStepSequence"],"0340":["SQ","PerformedSeriesSequence"],"0400":["LT","CommentsOnTheScheduledProcedureStep"],"0440":["SQ","ProtocolContextSequence"],"0441":["SQ","ContentItemModifierSequence"],"0500":["SQ","ScheduledSpecimenSequence"],"050A":["LO","SpecimenAccessionNumber"],"0512":["LO","ContainerIdentifier"],"0513":["SQ","IssuerOfTheContainerIdentifierSequence"],"0515":["SQ","AlternateContainerIdentifierSequence"],"0518":["SQ","ContainerTypeCodeSequence"],"051A":["LO","ContainerDescription"],"0520":["SQ","ContainerComponentSequence"],"0550":["SQ","SpecimenSequence"],"0551":["LO","SpecimenIdentifier"],"0552":["SQ","SpecimenDescriptionSequenceTrial"],"0553":["ST","SpecimenDescriptionTrial"],"0554":["UI","SpecimenUID"],"0555":["SQ","AcquisitionContextSequence"],"0556":["ST","AcquisitionContextDescription"],"059A":["SQ","SpecimenTypeCodeSequence"],"0560":["SQ","SpecimenDescriptionSequence"],"0562":["SQ","IssuerOfTheSpecimenIdentifierSequence"],"0600":["LO","SpecimenShortDescription"],"0602":["UT","SpecimenDetailedDescription"],"0610":["SQ","SpecimenPreparationSequence"],"0612":["SQ","SpecimenPreparationStepContentItemSequence"],"0620":["SQ","SpecimenLocalizationContentItemSequence"],"06FA":["LO","SlideIdentifier"],"071A":["SQ","ImageCenterPointCoordinatesSequence"],"072A":["DS","XOffsetInSlideCoordinateSystem"],"073A":["DS","YOffsetInSlideCoordinateSystem"],"074A":["DS","ZOffsetInSlideCoordinateSystem"],"08D8":["SQ","PixelSpacingSequence"],"08DA":["SQ","CoordinateSystemAxisCodeSequence"],"08EA":["SQ","MeasurementUnitsCodeSequence"],"09F8":["SQ","VitalStainCodeSequenceTrial"],1001:["SH","RequestedProcedureID"],1002:["LO","ReasonForTheRequestedProcedure"],1003:["SH","RequestedProcedurePriority"],1004:["LO","PatientTransportArrangements"],1005:["LO","RequestedProcedureLocation"],1006:["SH","PlacerOrderNumberProcedure"],1007:["SH","FillerOrderNumberProcedure"],1008:["LO","ConfidentialityCode"],1009:["SH","ReportingPriority"],"100A":["SQ","ReasonForRequestedProcedureCodeSequence"],1010:["PN","NamesOfIntendedRecipientsOfResults"],1011:["SQ","IntendedRecipientsOfResultsIdentificationSequence"],1012:["SQ","ReasonForPerformedProcedureCodeSequence"],1060:["LO","RequestedProcedureDescriptionTrial"],1101:["SQ","PersonIdentificationCodeSequence"],1102:["ST","PersonAddress"],1103:["LO","PersonTelephoneNumbers"],1400:["LT","RequestedProcedureComments"],2001:["LO","ReasonForTheImagingServiceRequest"],2004:["DA","IssueDateOfImagingServiceRequest"],2005:["TM","IssueTimeOfImagingServiceRequest"],2006:["SH","PlacerOrderNumberImagingServiceRequestRetired"],2007:["SH","FillerOrderNumberImagingServiceRequestRetired"],2008:["PN","OrderEnteredBy"],2009:["SH","OrderEntererLocation"],2010:["SH","OrderCallbackPhoneNumber"],2016:["LO","PlacerOrderNumberImagingServiceRequest"],2017:["LO","FillerOrderNumberImagingServiceRequest"],2400:["LT","ImagingServiceRequestComments"],3001:["LO","ConfidentialityConstraintOnPatientDataDescription"],4001:["CS","GeneralPurposeScheduledProcedureStepStatus"],4002:["CS","GeneralPurposePerformedProcedureStepStatus"],4003:["CS","GeneralPurposeScheduledProcedureStepPriority"],4004:["SQ","ScheduledProcessingApplicationsCodeSequence"],4005:["DT","ScheduledProcedureStepStartDateTime"],4006:["CS","MultipleCopiesFlag"],4007:["SQ","PerformedProcessingApplicationsCodeSequence"],4009:["SQ","HumanPerformerCodeSequence"],4010:["DT","ScheduledProcedureStepModificationDateTime"],4011:["DT","ExpectedCompletionDateTime"],4015:["SQ","ResultingGeneralPurposePerformedProcedureStepsSequence"],4016:["SQ","ReferencedGeneralPurposeScheduledProcedureStepSequence"],4018:["SQ","ScheduledWorkitemCodeSequence"],4019:["SQ","PerformedWorkitemCodeSequence"],4020:["CS","InputAvailabilityFlag"],4021:["SQ","InputInformationSequence"],4022:["SQ","RelevantInformationSequence"],4023:["UI","ReferencedGeneralPurposeScheduledProcedureStepTransactionUID"],4025:["SQ","ScheduledStationNameCodeSequence"],4026:["SQ","ScheduledStationClassCodeSequence"],4027:["SQ","ScheduledStationGeographicLocationCodeSequence"],4028:["SQ","PerformedStationNameCodeSequence"],4029:["SQ","PerformedStationClassCodeSequence"],4030:["SQ","PerformedStationGeographicLocationCodeSequence"],4031:["SQ","RequestedSubsequentWorkitemCodeSequence"],4032:["SQ","NonDICOMOutputCodeSequence"],4033:["SQ","OutputInformationSequence"],4034:["SQ","ScheduledHumanPerformersSequence"],4035:["SQ","ActualHumanPerformersSequence"],4036:["LO","HumanPerformerOrganization"],4037:["PN","HumanPerformerName"],4040:["CS","RawDataHandling"],4041:["CS","InputReadinessState"],4050:["DT","PerformedProcedureStepStartDateTime"],4051:["DT","PerformedProcedureStepEndDateTime"],4052:["DT","ProcedureStepCancellationDateTime"],8302:["DS","EntranceDoseInmGy"],9094:["SQ","ReferencedImageRealWorldValueMappingSequence"],9096:["SQ","RealWorldValueMappingSequence"],9098:["SQ","PixelValueMappingCodeSequence"],9210:["SH","LUTLabel"],9211:["SS","RealWorldValueLastValueMapped"],9212:["FD","RealWorldValueLUTData"],9216:["SS","RealWorldValueFirstValueMapped"],9224:["FD","RealWorldValueIntercept"],9225:["FD","RealWorldValueSlope"],A007:["CS","FindingsFlagTrial"],A010:["CS","RelationshipType"],A020:["SQ","FindingsSequenceTrial"],A021:["UI","FindingsGroupUIDTrial"],A022:["UI","ReferencedFindingsGroupUIDTrial"],A023:["DA","FindingsGroupRecordingDateTrial"],A024:["TM","FindingsGroupRecordingTimeTrial"],A026:["SQ","FindingsSourceCategoryCodeSequenceTrial"],A027:["LO","VerifyingOrganization"],A028:["SQ","DocumentingOrganizationIdentifierCodeSequenceTrial"],A030:["DT","VerificationDateTime"],A032:["DT","ObservationDateTime"],A040:["CS","ValueType"],A043:["SQ","ConceptNameCodeSequence"],A047:["LO","MeasurementPrecisionDescriptionTrial"],A050:["CS","ContinuityOfContent"],A057:["CS","UrgencyOrPriorityAlertsTrial"],A060:["LO","SequencingIndicatorTrial"],A066:["SQ","DocumentIdentifierCodeSequenceTrial"],A067:["PN","DocumentAuthorTrial"],A068:["SQ","DocumentAuthorIdentifierCodeSequenceTrial"],A070:["SQ","IdentifierCodeSequenceTrial"],A073:["SQ","VerifyingObserverSequence"],A074:["OB","ObjectBinaryIdentifierTrial"],A075:["PN","VerifyingObserverName"],A076:["SQ","DocumentingObserverIdentifierCodeSequenceTrial"],A078:["SQ","AuthorObserverSequence"],A07A:["SQ","ParticipantSequence"],A07C:["SQ","CustodialOrganizationSequence"],A080:["CS","ParticipationType"],A082:["DT","ParticipationDateTime"],A084:["CS","ObserverType"],A085:["SQ","ProcedureIdentifierCodeSequenceTrial"],A088:["SQ","VerifyingObserverIdentificationCodeSequence"],A089:["OB","ObjectDirectoryBinaryIdentifierTrial"],A090:["SQ","EquivalentCDADocumentSequence"],A0B0:["US","ReferencedWaveformChannels"],A110:["DA","DateOfDocumentOrVerbalTransactionTrial"],A112:["TM","TimeOfDocumentCreationOrVerbalTransactionTrial"],A120:["DT","DateTime"],A121:["DA","Date"],A122:["TM","Time"],A123:["PN","PersonName"],A124:["UI","UID"],A125:["CS","ReportStatusIDTrial"],A130:["CS","TemporalRangeType"],A132:["UL","ReferencedSamplePositions"],A136:["US","ReferencedFrameNumbers"],A138:["DS","ReferencedTimeOffsets"],A13A:["DT","ReferencedDateTime"],A160:["UT","TextValue"],A167:["SQ","ObservationCategoryCodeSequenceTrial"],A168:["SQ","ConceptCodeSequence"],A16A:["ST","BibliographicCitationTrial"],A170:["SQ","PurposeOfReferenceCodeSequence"],A171:["UI","ObservationUIDTrial"],A172:["UI","ReferencedObservationUIDTrial"],A173:["CS","ReferencedObservationClassTrial"],A174:["CS","ReferencedObjectObservationClassTrial"],A180:["US","AnnotationGroupNumber"],A192:["DA","ObservationDateTrial"],A193:["TM","ObservationTimeTrial"],A194:["CS","MeasurementAutomationTrial"],A195:["SQ","ModifierCodeSequence"],A224:["ST","IdentificationDescriptionTrial"],A290:["CS","CoordinatesSetGeometricTypeTrial"],A296:["SQ","AlgorithmCodeSequenceTrial"],A297:["ST","AlgorithmDescriptionTrial"],A29A:["SL","PixelCoordinatesSetTrial"],A300:["SQ","MeasuredValueSequence"],A301:["SQ","NumericValueQualifierCodeSequence"],A307:["PN","CurrentObserverTrial"],A30A:["DS","NumericValue"],A313:["SQ","ReferencedAccessionSequenceTrial"],A33A:["ST","ReportStatusCommentTrial"],A340:["SQ","ProcedureContextSequenceTrial"],A352:["PN","VerbalSourceTrial"],A353:["ST","AddressTrial"],A354:["LO","TelephoneNumberTrial"],A358:["SQ","VerbalSourceIdentifierCodeSequenceTrial"],A360:["SQ","PredecessorDocumentsSequence"],A370:["SQ","ReferencedRequestSequence"],A372:["SQ","PerformedProcedureCodeSequence"],A375:["SQ","CurrentRequestedProcedureEvidenceSequence"],A380:["SQ","ReportDetailSequenceTrial"],A385:["SQ","PertinentOtherEvidenceSequence"],A390:["SQ","HL7StructuredDocumentReferenceSequence"],A402:["UI","ObservationSubjectUIDTrial"],A403:["CS","ObservationSubjectClassTrial"],A404:["SQ","ObservationSubjectTypeCodeSequenceTrial"],A491:["CS","CompletionFlag"],A492:["LO","CompletionFlagDescription"],A493:["CS","VerificationFlag"],A494:["CS","ArchiveRequested"],A496:["CS","PreliminaryFlag"],A504:["SQ","ContentTemplateSequence"],A525:["SQ","IdenticalDocumentsSequence"],A600:["CS","ObservationSubjectContextFlagTrial"],A601:["CS","ObserverContextFlagTrial"],A603:["CS","ProcedureContextFlagTrial"],A730:["SQ","ContentSequence"],A731:["SQ","RelationshipSequenceTrial"],A732:["SQ","RelationshipTypeCodeSequenceTrial"],A744:["SQ","LanguageCodeSequenceTrial"],A992:["ST","UniformResourceLocatorTrial"],B020:["SQ","WaveformAnnotationSequence"],DB00:["CS","TemplateIdentifier"],DB06:["DT","TemplateVersion"],DB07:["DT","TemplateLocalVersion"],DB0B:["CS","TemplateExtensionFlag"],DB0C:["UI","TemplateExtensionOrganizationUID"],DB0D:["UI","TemplateExtensionCreatorUID"],DB73:["UL","ReferencedContentItemIdentifier"],E001:["ST","HL7InstanceIdentifier"],E004:["DT","HL7DocumentEffectiveTime"],E006:["SQ","HL7DocumentTypeCodeSequence"],E008:["SQ","DocumentClassCodeSequence"],E010:["UT","RetrieveURI"],E011:["UI","RetrieveLocationUID"],E020:["CS","TypeOfInstances"],E021:["SQ","DICOMRetrievalSequence"],E022:["SQ","DICOMMediaRetrievalSequence"],E023:["SQ","WADORetrievalSequence"],E024:["SQ","XDSRetrievalSequence"],E030:["UI","RepositoryUniqueID"],E031:["UI","HomeCommunityID"]},"0042":{"0010":["ST","DocumentTitle"],"0011":["OB","EncapsulatedDocument"],"0012":["LO","MIMETypeOfEncapsulatedDocument"],"0013":["SQ","SourceInstanceSequence"],"0014":["LO","ListOfMIMETypes"]},"0044":{"0001":["ST","ProductPackageIdentifier"],"0002":["CS","SubstanceAdministrationApproval"],"0003":["LT","ApprovalStatusFurtherDescription"],"0004":["DT","ApprovalStatusDateTime"],"0007":["SQ","ProductTypeCodeSequence"],"0008":["LO","ProductName"],"0009":["LT","ProductDescription"],"000A":["LO","ProductLotIdentifier"],"000B":["DT","ProductExpirationDateTime"],"0010":["DT","SubstanceAdministrationDateTime"],"0011":["LO","SubstanceAdministrationNotes"],"0012":["LO","SubstanceAdministrationDeviceID"],"0013":["SQ","ProductParameterSequence"],"0019":["SQ","SubstanceAdministrationParameterSequence"]},"0046":{"0012":["LO","LensDescription"],"0014":["SQ","RightLensSequence"],"0015":["SQ","LeftLensSequence"],"0016":["SQ","UnspecifiedLateralityLensSequence"],"0018":["SQ","CylinderSequence"],"0028":["SQ","PrismSequence"],"0030":["FD","HorizontalPrismPower"],"0032":["CS","HorizontalPrismBase"],"0034":["FD","VerticalPrismPower"],"0036":["CS","VerticalPrismBase"],"0038":["CS","LensSegmentType"],"0040":["FD","OpticalTransmittance"],"0042":["FD","ChannelWidth"],"0044":["FD","PupilSize"],"0046":["FD","CornealSize"],"0050":["SQ","AutorefractionRightEyeSequence"],"0052":["SQ","AutorefractionLeftEyeSequence"],"0060":["FD","DistancePupillaryDistance"],"0062":["FD","NearPupillaryDistance"],"0063":["FD","IntermediatePupillaryDistance"],"0064":["FD","OtherPupillaryDistance"],"0070":["SQ","KeratometryRightEyeSequence"],"0071":["SQ","KeratometryLeftEyeSequence"],"0074":["SQ","SteepKeratometricAxisSequence"],"0075":["FD","RadiusOfCurvature"],"0076":["FD","KeratometricPower"],"0077":["FD","KeratometricAxis"],"0080":["SQ","FlatKeratometricAxisSequence"],"0092":["CS","BackgroundColor"],"0094":["CS","Optotype"],"0095":["CS","OptotypePresentation"],"0097":["SQ","SubjectiveRefractionRightEyeSequence"],"0098":["SQ","SubjectiveRefractionLeftEyeSequence"],"0100":["SQ","AddNearSequence"],"0101":["SQ","AddIntermediateSequence"],"0102":["SQ","AddOtherSequence"],"0104":["FD","AddPower"],"0106":["FD","ViewingDistance"],"0121":["SQ","VisualAcuityTypeCodeSequence"],"0122":["SQ","VisualAcuityRightEyeSequence"],"0123":["SQ","VisualAcuityLeftEyeSequence"],"0124":["SQ","VisualAcuityBothEyesOpenSequence"],"0125":["CS","ViewingDistanceType"],"0135":["SS","VisualAcuityModifiers"],"0137":["FD","DecimalVisualAcuity"],"0139":["LO","OptotypeDetailedDefinition"],"0145":["SQ","ReferencedRefractiveMeasurementsSequence"],"0146":["FD","SpherePower"],"0147":["FD","CylinderPower"]},"0048":{"0001":["FL","ImagedVolumeWidth"],"0002":["FL","ImagedVolumeHeight"],"0003":["FL","ImagedVolumeDepth"],"0006":["UL","TotalPixelMatrixColumns"],"0007":["UL","TotalPixelMatrixRows"],"0008":["SQ","TotalPixelMatrixOriginSequence"],"0010":["CS","SpecimenLabelInImage"],"0011":["CS","FocusMethod"],"0012":["CS","ExtendedDepthOfField"],"0013":["US","NumberOfFocalPlanes"],"0014":["FL","DistanceBetweenFocalPlanes"],"0015":["US","RecommendedAbsentPixelCIELabValue"],"0100":["SQ","IlluminatorTypeCodeSequence"],"0102":["DS","ImageOrientationSlide"],"0105":["SQ","OpticalPathSequence"],"0106":["SH","OpticalPathIdentifier"],"0107":["ST","OpticalPathDescription"],"0108":["SQ","IlluminationColorCodeSequence"],"0110":["SQ","SpecimenReferenceSequence"],"0111":["DS","CondenserLensPower"],"0112":["DS","ObjectiveLensPower"],"0113":["DS","ObjectiveLensNumericalAperture"],"0120":["SQ","PaletteColorLookupTableSequence"],"0200":["SQ","ReferencedImageNavigationSequence"],"0201":["US","TopLeftHandCornerOfLocalizerArea"],"0202":["US","BottomRightHandCornerOfLocalizerArea"],"0207":["SQ","OpticalPathIdentificationSequence"],"021A":["SQ","PlanePositionSlideSequence"],"021E":["SL","RowPositionInTotalImagePixelMatrix"],"021F":["SL","ColumnPositionInTotalImagePixelMatrix"],"0301":["CS","PixelOriginInterpretation"]},"0050":{"0004":["CS","CalibrationImage"],"0010":["SQ","DeviceSequence"],"0012":["SQ","ContainerComponentTypeCodeSequence"],"0013":["FD","ContainerComponentThickness"],"0014":["DS","DeviceLength"],"0015":["FD","ContainerComponentWidth"],"0016":["DS","DeviceDiameter"],"0017":["CS","DeviceDiameterUnits"],"0018":["DS","DeviceVolume"],"0019":["DS","InterMarkerDistance"],"001A":["CS","ContainerComponentMaterial"],"001B":["LO","ContainerComponentID"],"001C":["FD","ContainerComponentLength"],"001D":["FD","ContainerComponentDiameter"],"001E":["LO","ContainerComponentDescription"],"0020":["LO","DeviceDescription"]},"0052":{"0001":["FL","ContrastBolusIngredientPercentByVolume"],"0002":["FD","OCTFocalDistance"],"0003":["FD","BeamSpotSize"],"0004":["FD","EffectiveRefractiveIndex"],"0006":["CS","OCTAcquisitionDomain"],"0007":["FD","OCTOpticalCenterWavelength"],"0008":["FD","AxialResolution"],"0009":["FD","RangingDepth"],"0011":["FD","ALineRate"],"0012":["US","ALinesPerFrame"],"0013":["FD","CatheterRotationalRate"],"0014":["FD","ALinePixelSpacing"],"0016":["SQ","ModeOfPercutaneousAccessSequence"],"0025":["SQ","IntravascularOCTFrameTypeSequence"],"0026":["CS","OCTZOffsetApplied"],"0027":["SQ","IntravascularFrameContentSequence"],"0028":["FD","IntravascularLongitudinalDistance"],"0029":["SQ","IntravascularOCTFrameContentSequence"],"0030":["SS","OCTZOffsetCorrection"],"0031":["CS","CatheterDirectionOfRotation"],"0033":["FD","SeamLineLocation"],"0034":["FD","FirstALineLocation"],"0036":["US","SeamLineIndex"],"0038":["US","NumberOfPaddedAlines"],"0039":["CS","InterpolationType"],"003A":["CS","RefractiveIndexApplied"]},"0054":{"0010":["US","EnergyWindowVector"],"0011":["US","NumberOfEnergyWindows"],"0012":["SQ","EnergyWindowInformationSequence"],"0013":["SQ","EnergyWindowRangeSequence"],"0014":["DS","EnergyWindowLowerLimit"],"0015":["DS","EnergyWindowUpperLimit"],"0016":["SQ","RadiopharmaceuticalInformationSequence"],"0017":["IS","ResidualSyringeCounts"],"0018":["SH","EnergyWindowName"],"0020":["US","DetectorVector"],"0021":["US","NumberOfDetectors"],"0022":["SQ","DetectorInformationSequence"],"0030":["US","PhaseVector"],"0031":["US","NumberOfPhases"],"0032":["SQ","PhaseInformationSequence"],"0033":["US","NumberOfFramesInPhase"],"0036":["IS","PhaseDelay"],"0038":["IS","PauseBetweenFrames"],"0039":["CS","PhaseDescription"],"0050":["US","RotationVector"],"0051":["US","NumberOfRotations"],"0052":["SQ","RotationInformationSequence"],"0053":["US","NumberOfFramesInRotation"],"0060":["US","RRIntervalVector"],"0061":["US","NumberOfRRIntervals"],"0062":["SQ","GatedInformationSequence"],"0063":["SQ","DataInformationSequence"],"0070":["US","TimeSlotVector"],"0071":["US","NumberOfTimeSlots"],"0072":["SQ","TimeSlotInformationSequence"],"0073":["DS","TimeSlotTime"],"0080":["US","SliceVector"],"0081":["US","NumberOfSlices"],"0090":["US","AngularViewVector"],"0100":["US","TimeSliceVector"],"0101":["US","NumberOfTimeSlices"],"0200":["DS","StartAngle"],"0202":["CS","TypeOfDetectorMotion"],"0210":["IS","TriggerVector"],"0211":["US","NumberOfTriggersInPhase"],"0220":["SQ","ViewCodeSequence"],"0222":["SQ","ViewModifierCodeSequence"],"0300":["SQ","RadionuclideCodeSequence"],"0302":["SQ","AdministrationRouteCodeSequence"],"0304":["SQ","RadiopharmaceuticalCodeSequence"],"0306":["SQ","CalibrationDataSequence"],"0308":["US","EnergyWindowNumber"],"0400":["SH","ImageID"],"0410":["SQ","PatientOrientationCodeSequence"],"0412":["SQ","PatientOrientationModifierCodeSequence"],"0414":["SQ","PatientGantryRelationshipCodeSequence"],"0500":["CS","SliceProgressionDirection"],1e3:["CS","SeriesType"],1001:["CS","Units"],1002:["CS","CountsSource"],1004:["CS","ReprojectionMethod"],1006:["CS","SUVType"],1100:["CS","RandomsCorrectionMethod"],1101:["LO","AttenuationCorrectionMethod"],1102:["CS","DecayCorrection"],1103:["LO","ReconstructionMethod"],1104:["LO","DetectorLinesOfResponseUsed"],1105:["LO","ScatterCorrectionMethod"],1200:["DS","AxialAcceptance"],1201:["IS","AxialMash"],1202:["IS","TransverseMash"],1203:["DS","DetectorElementSize"],1210:["DS","CoincidenceWindowWidth"],1220:["CS","SecondaryCountsType"],1300:["DS","FrameReferenceTime"],1310:["IS","PrimaryPromptsCountsAccumulated"],1311:["IS","SecondaryCountsAccumulated"],1320:["DS","SliceSensitivityFactor"],1321:["DS","DecayFactor"],1322:["DS","DoseCalibrationFactor"],1323:["DS","ScatterFractionFactor"],1324:["DS","DeadTimeFactor"],1330:["US","ImageIndex"],1400:["CS","CountsIncluded"],1401:["CS","DeadTimeCorrectionFlag"]},"0060":{3e3:["SQ","HistogramSequence"],3002:["US","HistogramNumberOfBins"],3004:["SS","HistogramFirstBinValue"],3006:["SS","HistogramLastBinValue"],3008:["US","HistogramBinWidth"],3010:["LO","HistogramExplanation"],3020:["UL","HistogramData"]},"0062":{"0001":["CS","SegmentationType"],"0002":["SQ","SegmentSequence"],"0003":["SQ","SegmentedPropertyCategoryCodeSequence"],"0004":["US","SegmentNumber"],"0005":["LO","SegmentLabel"],"0006":["ST","SegmentDescription"],"0008":["CS","SegmentAlgorithmType"],"0009":["LO","SegmentAlgorithmName"],"000A":["SQ","SegmentIdentificationSequence"],"000B":["US","ReferencedSegmentNumber"],"000C":["US","RecommendedDisplayGrayscaleValue"],"000D":["US","RecommendedDisplayCIELabValue"],"000E":["US","MaximumFractionalValue"],"000F":["SQ","SegmentedPropertyTypeCodeSequence"],"0010":["CS","SegmentationFractionalType"]},"0064":{"0002":["SQ","DeformableRegistrationSequence"],"0003":["UI","SourceFrameOfReferenceUID"],"0005":["SQ","DeformableRegistrationGridSequence"],"0007":["UL","GridDimensions"],"0008":["FD","GridResolution"],"0009":["OF","VectorGridData"],"000F":["SQ","PreDeformationMatrixRegistrationSequence"],"0010":["SQ","PostDeformationMatrixRegistrationSequence"]},"0066":{"0001":["UL","NumberOfSurfaces"],"0002":["SQ","SurfaceSequence"],"0003":["UL","SurfaceNumber"],"0004":["LT","SurfaceComments"],"0009":["CS","SurfaceProcessing"],"000A":["FL","SurfaceProcessingRatio"],"000B":["LO","SurfaceProcessingDescription"],"000C":["FL","RecommendedPresentationOpacity"],"000D":["CS","RecommendedPresentationType"],"000E":["CS","FiniteVolume"],"0010":["CS","Manifold"],"0011":["SQ","SurfacePointsSequence"],"0012":["SQ","SurfacePointsNormalsSequence"],"0013":["SQ","SurfaceMeshPrimitivesSequence"],"0015":["UL","NumberOfSurfacePoints"],"0016":["OF","PointCoordinatesData"],"0017":["FL","PointPositionAccuracy"],"0018":["FL","MeanPointDistance"],"0019":["FL","MaximumPointDistance"],"001A":["FL","PointsBoundingBoxCoordinates"],"001B":["FL","AxisOfRotation"],"001C":["FL","CenterOfRotation"],"001E":["UL","NumberOfVectors"],"001F":["US","VectorDimensionality"],"0020":["FL","VectorAccuracy"],"0021":["OF","VectorCoordinateData"],"0023":["OW","TrianglePointIndexList"],"0024":["OW","EdgePointIndexList"],"0025":["OW","VertexPointIndexList"],"0026":["SQ","TriangleStripSequence"],"0027":["SQ","TriangleFanSequence"],"0028":["SQ","LineSequence"],"0029":["OW","PrimitivePointIndexList"],"002A":["UL","SurfaceCount"],"002B":["SQ","ReferencedSurfaceSequence"],"002C":["UL","ReferencedSurfaceNumber"],"002D":["SQ","SegmentSurfaceGenerationAlgorithmIdentificationSequence"],"002E":["SQ","SegmentSurfaceSourceInstanceSequence"],"002F":["SQ","AlgorithmFamilyCodeSequence"],"0030":["SQ","AlgorithmNameCodeSequence"],"0031":["LO","AlgorithmVersion"],"0032":["LT","AlgorithmParameters"],"0034":["SQ","FacetSequence"],"0035":["SQ","SurfaceProcessingAlgorithmIdentificationSequence"],"0036":["LO","AlgorithmName"]},"0068":{6210:["LO","ImplantSize"],6221:["LO","ImplantTemplateVersion"],6222:["SQ","ReplacedImplantTemplateSequence"],6223:["CS","ImplantType"],6224:["SQ","DerivationImplantTemplateSequence"],6225:["SQ","OriginalImplantTemplateSequence"],6226:["DT","EffectiveDateTime"],6230:["SQ","ImplantTargetAnatomySequence"],6260:["SQ","InformationFromManufacturerSequence"],6265:["SQ","NotificationFromManufacturerSequence"],6270:["DT","InformationIssueDateTime"],6280:["ST","InformationSummary"],"62A0":["SQ","ImplantRegulatoryDisapprovalCodeSequence"],"62A5":["FD","OverallTemplateSpatialTolerance"],"62C0":["SQ","HPGLDocumentSequence"],"62D0":["US","HPGLDocumentID"],"62D5":["LO","HPGLDocumentLabel"],"62E0":["SQ","ViewOrientationCodeSequence"],"62F0":["FD","ViewOrientationModifier"],"62F2":["FD","HPGLDocumentScaling"],6300:["OB","HPGLDocument"],6310:["US","HPGLContourPenNumber"],6320:["SQ","HPGLPenSequence"],6330:["US","HPGLPenNumber"],6340:["LO","HPGLPenLabel"],6345:["ST","HPGLPenDescription"],6346:["FD","RecommendedRotationPoint"],6347:["FD","BoundingRectangle"],6350:["US","ImplantTemplate3DModelSurfaceNumber"],6360:["SQ","SurfaceModelDescriptionSequence"],6380:["LO","SurfaceModelLabel"],6390:["FD","SurfaceModelScalingFactor"],"63A0":["SQ","MaterialsCodeSequence"],"63A4":["SQ","CoatingMaterialsCodeSequence"],"63A8":["SQ","ImplantTypeCodeSequence"],"63AC":["SQ","FixationMethodCodeSequence"],"63B0":["SQ","MatingFeatureSetsSequence"],"63C0":["US","MatingFeatureSetID"],"63D0":["LO","MatingFeatureSetLabel"],"63E0":["SQ","MatingFeatureSequence"],"63F0":["US","MatingFeatureID"],6400:["SQ","MatingFeatureDegreeOfFreedomSequence"],6410:["US","DegreeOfFreedomID"],6420:["CS","DegreeOfFreedomType"],6430:["SQ","TwoDMatingFeatureCoordinatesSequence"],6440:["US","ReferencedHPGLDocumentID"],6450:["FD","TwoDMatingPoint"],6460:["FD","TwoDMatingAxes"],6470:["SQ","TwoDDegreeOfFreedomSequence"],6490:["FD","ThreeDDegreeOfFreedomAxis"],"64A0":["FD","RangeOfFreedom"],"64C0":["FD","ThreeDMatingPoint"],"64D0":["FD","ThreeDMatingAxes"],"64F0":["FD","TwoDDegreeOfFreedomAxis"],6500:["SQ","PlanningLandmarkPointSequence"],6510:["SQ","PlanningLandmarkLineSequence"],6520:["SQ","PlanningLandmarkPlaneSequence"],6530:["US","PlanningLandmarkID"],6540:["LO","PlanningLandmarkDescription"],6545:["SQ","PlanningLandmarkIdentificationCodeSequence"],6550:["SQ","TwoDPointCoordinatesSequence"],6560:["FD","TwoDPointCoordinates"],6590:["FD","ThreeDPointCoordinates"],"65A0":["SQ","TwoDLineCoordinatesSequence"],"65B0":["FD","TwoDLineCoordinates"],"65D0":["FD","ThreeDLineCoordinates"],"65E0":["SQ","TwoDPlaneCoordinatesSequence"],"65F0":["FD","TwoDPlaneIntersection"],6610:["FD","ThreeDPlaneOrigin"],6620:["FD","ThreeDPlaneNormal"]},"0070":{"0001":["SQ","GraphicAnnotationSequence"],"0002":["CS","GraphicLayer"],"0003":["CS","BoundingBoxAnnotationUnits"],"0004":["CS","AnchorPointAnnotationUnits"],"0005":["CS","GraphicAnnotationUnits"],"0006":["ST","UnformattedTextValue"],"0008":["SQ","TextObjectSequence"],"0009":["SQ","GraphicObjectSequence"],"0010":["FL","BoundingBoxTopLeftHandCorner"],"0011":["FL","BoundingBoxBottomRightHandCorner"],"0012":["CS","BoundingBoxTextHorizontalJustification"],"0014":["FL","AnchorPoint"],"0015":["CS","AnchorPointVisibility"],"0020":["US","GraphicDimensions"],"0021":["US","NumberOfGraphicPoints"],"0022":["FL","GraphicData"],"0023":["CS","GraphicType"],"0024":["CS","GraphicFilled"],"0040":["IS","ImageRotationRetired"],"0041":["CS","ImageHorizontalFlip"],"0042":["US","ImageRotation"],"0050":["US","DisplayedAreaTopLeftHandCornerTrial"],"0051":["US","DisplayedAreaBottomRightHandCornerTrial"],"0052":["SL","DisplayedAreaTopLeftHandCorner"],"0053":["SL","DisplayedAreaBottomRightHandCorner"],"005A":["SQ","DisplayedAreaSelectionSequence"],"0060":["SQ","GraphicLayerSequence"],"0062":["IS","GraphicLayerOrder"],"0066":["US","GraphicLayerRecommendedDisplayGrayscaleValue"],"0067":["US","GraphicLayerRecommendedDisplayRGBValue"],"0068":["LO","GraphicLayerDescription"],"0080":["CS","ContentLabel"],"0081":["LO","ContentDescription"],"0082":["DA","PresentationCreationDate"],"0083":["TM","PresentationCreationTime"],"0084":["PN","ContentCreatorName"],"0086":["SQ","ContentCreatorIdentificationCodeSequence"],"0087":["SQ","AlternateContentDescriptionSequence"],"0100":["CS","PresentationSizeMode"],"0101":["DS","PresentationPixelSpacing"],"0102":["IS","PresentationPixelAspectRatio"],"0103":["FL","PresentationPixelMagnificationRatio"],"0207":["LO","GraphicGroupLabel"],"0208":["ST","GraphicGroupDescription"],"0209":["SQ","CompoundGraphicSequence"],"0226":["UL","CompoundGraphicInstanceID"],"0227":["LO","FontName"],"0228":["CS","FontNameType"],"0229":["LO","CSSFontName"],"0230":["FD","RotationAngle"],"0231":["SQ","TextStyleSequence"],"0232":["SQ","LineStyleSequence"],"0233":["SQ","FillStyleSequence"],"0234":["SQ","GraphicGroupSequence"],"0241":["US","TextColorCIELabValue"],"0242":["CS","HorizontalAlignment"],"0243":["CS","VerticalAlignment"],"0244":["CS","ShadowStyle"],"0245":["FL","ShadowOffsetX"],"0246":["FL","ShadowOffsetY"],"0247":["US","ShadowColorCIELabValue"],"0248":["CS","Underlined"],"0249":["CS","Bold"],"0250":["CS","Italic"],"0251":["US","PatternOnColorCIELabValue"],"0252":["US","PatternOffColorCIELabValue"],"0253":["FL","LineThickness"],"0254":["CS","LineDashingStyle"],"0255":["UL","LinePattern"],"0256":["OB","FillPattern"],"0257":["CS","FillMode"],"0258":["FL","ShadowOpacity"],"0261":["FL","GapLength"],"0262":["FL","DiameterOfVisibility"],"0273":["FL","RotationPoint"],"0274":["CS","TickAlignment"],"0278":["CS","ShowTickLabel"],"0279":["CS","TickLabelAlignment"],"0282":["CS","CompoundGraphicUnits"],"0284":["FL","PatternOnOpacity"],"0285":["FL","PatternOffOpacity"],"0287":["SQ","MajorTicksSequence"],"0288":["FL","TickPosition"],"0289":["SH","TickLabel"],"0294":["CS","CompoundGraphicType"],"0295":["UL","GraphicGroupID"],"0306":["CS","ShapeType"],"0308":["SQ","RegistrationSequence"],"0309":["SQ","MatrixRegistrationSequence"],"030A":["SQ","MatrixSequence"],"030C":["CS","FrameOfReferenceTransformationMatrixType"],"030D":["SQ","RegistrationTypeCodeSequence"],"030F":["ST","FiducialDescription"],"0310":["SH","FiducialIdentifier"],"0311":["SQ","FiducialIdentifierCodeSequence"],"0312":["FD","ContourUncertaintyRadius"],"0314":["SQ","UsedFiducialsSequence"],"0318":["SQ","GraphicCoordinatesDataSequence"],"031A":["UI","FiducialUID"],"031C":["SQ","FiducialSetSequence"],"031E":["SQ","FiducialSequence"],"0401":["US","GraphicLayerRecommendedDisplayCIELabValue"],"0402":["SQ","BlendingSequence"],"0403":["FL","RelativeOpacity"],"0404":["SQ","ReferencedSpatialRegistrationSequence"],"0405":["CS","BlendingPosition"]},"0072":{"0002":["SH","HangingProtocolName"],"0004":["LO","HangingProtocolDescription"],"0006":["CS","HangingProtocolLevel"],"0008":["LO","HangingProtocolCreator"],"000A":["DT","HangingProtocolCreationDateTime"],"000C":["SQ","HangingProtocolDefinitionSequence"],"000E":["SQ","HangingProtocolUserIdentificationCodeSequence"],"0010":["LO","HangingProtocolUserGroupName"],"0012":["SQ","SourceHangingProtocolSequence"],"0014":["US","NumberOfPriorsReferenced"],"0020":["SQ","ImageSetsSequence"],"0022":["SQ","ImageSetSelectorSequence"],"0024":["CS","ImageSetSelectorUsageFlag"],"0026":["AT","SelectorAttribute"],"0028":["US","SelectorValueNumber"],"0030":["SQ","TimeBasedImageSetsSequence"],"0032":["US","ImageSetNumber"],"0034":["CS","ImageSetSelectorCategory"],"0038":["US","RelativeTime"],"003A":["CS","RelativeTimeUnits"],"003C":["SS","AbstractPriorValue"],"003E":["SQ","AbstractPriorCodeSequence"],"0040":["LO","ImageSetLabel"],"0050":["CS","SelectorAttributeVR"],"0052":["AT","SelectorSequencePointer"],"0054":["LO","SelectorSequencePointerPrivateCreator"],"0056":["LO","SelectorAttributePrivateCreator"],"0060":["AT","SelectorATValue"],"0062":["CS","SelectorCSValue"],"0064":["IS","SelectorISValue"],"0066":["LO","SelectorLOValue"],"0068":["LT","SelectorLTValue"],"006A":["PN","SelectorPNValue"],"006C":["SH","SelectorSHValue"],"006E":["ST","SelectorSTValue"],"0070":["UT","SelectorUTValue"],"0072":["DS","SelectorDSValue"],"0074":["FD","SelectorFDValue"],"0076":["FL","SelectorFLValue"],"0078":["UL","SelectorULValue"],"007A":["US","SelectorUSValue"],"007C":["SL","SelectorSLValue"],"007E":["SS","SelectorSSValue"],"0080":["SQ","SelectorCodeSequenceValue"],"0100":["US","NumberOfScreens"],"0102":["SQ","NominalScreenDefinitionSequence"],"0104":["US","NumberOfVerticalPixels"],"0106":["US","NumberOfHorizontalPixels"],"0108":["FD","DisplayEnvironmentSpatialPosition"],"010A":["US","ScreenMinimumGrayscaleBitDepth"],"010C":["US","ScreenMinimumColorBitDepth"],"010E":["US","ApplicationMaximumRepaintTime"],"0200":["SQ","DisplaySetsSequence"],"0202":["US","DisplaySetNumber"],"0203":["LO","DisplaySetLabel"],"0204":["US","DisplaySetPresentationGroup"],"0206":["LO","DisplaySetPresentationGroupDescription"],"0208":["CS","PartialDataDisplayHandling"],"0210":["SQ","SynchronizedScrollingSequence"],"0212":["US","DisplaySetScrollingGroup"],"0214":["SQ","NavigationIndicatorSequence"],"0216":["US","NavigationDisplaySet"],"0218":["US","ReferenceDisplaySets"],"0300":["SQ","ImageBoxesSequence"],"0302":["US","ImageBoxNumber"],"0304":["CS","ImageBoxLayoutType"],"0306":["US","ImageBoxTileHorizontalDimension"],"0308":["US","ImageBoxTileVerticalDimension"],"0310":["CS","ImageBoxScrollDirection"],"0312":["CS","ImageBoxSmallScrollType"],"0314":["US","ImageBoxSmallScrollAmount"],"0316":["CS","ImageBoxLargeScrollType"],"0318":["US","ImageBoxLargeScrollAmount"],"0320":["US","ImageBoxOverlapPriority"],"0330":["FD","CineRelativeToRealTime"],"0400":["SQ","FilterOperationsSequence"],"0402":["CS","FilterByCategory"],"0404":["CS","FilterByAttributePresence"],"0406":["CS","FilterByOperator"],"0420":["US","StructuredDisplayBackgroundCIELabValue"],"0421":["US","EmptyImageBoxCIELabValue"],"0422":["SQ","StructuredDisplayImageBoxSequence"],"0424":["SQ","StructuredDisplayTextBoxSequence"],"0427":["SQ","ReferencedFirstFrameSequence"],"0430":["SQ","ImageBoxSynchronizationSequence"],"0432":["US","SynchronizedImageBoxList"],"0434":["CS","TypeOfSynchronization"],"0500":["CS","BlendingOperationType"],"0510":["CS","ReformattingOperationType"],"0512":["FD","ReformattingThickness"],"0514":["FD","ReformattingInterval"],"0516":["CS","ReformattingOperationInitialViewDirection"],"0520":["CS","ThreeDRenderingType"],"0600":["SQ","SortingOperationsSequence"],"0602":["CS","SortByCategory"],"0604":["CS","SortingDirection"],"0700":["CS","DisplaySetPatientOrientation"],"0702":["CS","VOIType"],"0704":["CS","PseudoColorType"],"0705":["SQ","PseudoColorPaletteInstanceReferenceSequence"],"0706":["CS","ShowGrayscaleInverted"],"0710":["CS","ShowImageTrueSizeFlag"],"0712":["CS","ShowGraphicAnnotationFlag"],"0714":["CS","ShowPatientDemographicsFlag"],"0716":["CS","ShowAcquisitionTechniquesFlag"],"0717":["CS","DisplaySetHorizontalJustification"],"0718":["CS","DisplaySetVerticalJustification"]},"0074":{"0120":["FD","ContinuationStartMeterset"],"0121":["FD","ContinuationEndMeterset"],1e3:["CS","ProcedureStepState"],1002:["SQ","ProcedureStepProgressInformationSequence"],1004:["DS","ProcedureStepProgress"],1006:["ST","ProcedureStepProgressDescription"],1008:["SQ","ProcedureStepCommunicationsURISequence"],"100A":["ST","ContactURI"],"100C":["LO","ContactDisplayName"],"100E":["SQ","ProcedureStepDiscontinuationReasonCodeSequence"],1020:["SQ","BeamTaskSequence"],1022:["CS","BeamTaskType"],1024:["IS","BeamOrderIndexTrial"],1026:["FD","TableTopVerticalAdjustedPosition"],1027:["FD","TableTopLongitudinalAdjustedPosition"],1028:["FD","TableTopLateralAdjustedPosition"],"102A":["FD","PatientSupportAdjustedAngle"],"102B":["FD","TableTopEccentricAdjustedAngle"],"102C":["FD","TableTopPitchAdjustedAngle"],"102D":["FD","TableTopRollAdjustedAngle"],1030:["SQ","DeliveryVerificationImageSequence"],1032:["CS","VerificationImageTiming"],1034:["CS","DoubleExposureFlag"],1036:["CS","DoubleExposureOrdering"],1038:["DS","DoubleExposureMetersetTrial"],"103A":["DS","DoubleExposureFieldDeltaTrial"],1040:["SQ","RelatedReferenceRTImageSequence"],1042:["SQ","GeneralMachineVerificationSequence"],1044:["SQ","ConventionalMachineVerificationSequence"],1046:["SQ","IonMachineVerificationSequence"],1048:["SQ","FailedAttributesSequence"],"104A":["SQ","OverriddenAttributesSequence"],"104C":["SQ","ConventionalControlPointVerificationSequence"],"104E":["SQ","IonControlPointVerificationSequence"],1050:["SQ","AttributeOccurrenceSequence"],1052:["AT","AttributeOccurrencePointer"],1054:["UL","AttributeItemSelector"],1056:["LO","AttributeOccurrencePrivateCreator"],1057:["IS","SelectorSequencePointerItems"],1200:["CS","ScheduledProcedureStepPriority"],1202:["LO","WorklistLabel"],1204:["LO","ProcedureStepLabel"],1210:["SQ","ScheduledProcessingParametersSequence"],1212:["SQ","PerformedProcessingParametersSequence"],1216:["SQ","UnifiedProcedureStepPerformedProcedureSequence"],1220:["SQ","RelatedProcedureStepSequence"],1222:["LO","ProcedureStepRelationshipType"],1224:["SQ","ReplacedProcedureStepSequence"],1230:["LO","DeletionLock"],1234:["AE","ReceivingAE"],1236:["AE","RequestingAE"],1238:["LT","ReasonForCancellation"],1242:["CS","SCPStatus"],1244:["CS","SubscriptionListStatus"],1246:["CS","UnifiedProcedureStepListStatus"],1324:["UL","BeamOrderIndex"],1338:["FD","DoubleExposureMeterset"],"133A":["FD","DoubleExposureFieldDelta"]},"0076":{"0001":["LO","ImplantAssemblyTemplateName"],"0003":["LO","ImplantAssemblyTemplateIssuer"],"0006":["LO","ImplantAssemblyTemplateVersion"],"0008":["SQ","ReplacedImplantAssemblyTemplateSequence"],"000A":["CS","ImplantAssemblyTemplateType"],"000C":["SQ","OriginalImplantAssemblyTemplateSequence"],"000E":["SQ","DerivationImplantAssemblyTemplateSequence"],"0010":["SQ","ImplantAssemblyTemplateTargetAnatomySequence"],"0020":["SQ","ProcedureTypeCodeSequence"],"0030":["LO","SurgicalTechnique"],"0032":["SQ","ComponentTypesSequence"],"0034":["CS","ComponentTypeCodeSequence"],"0036":["CS","ExclusiveComponentType"],"0038":["CS","MandatoryComponentType"],"0040":["SQ","ComponentSequence"],"0055":["US","ComponentID"],"0060":["SQ","ComponentAssemblySequence"],"0070":["US","Component1ReferencedID"],"0080":["US","Component1ReferencedMatingFeatureSetID"],"0090":["US","Component1ReferencedMatingFeatureID"],"00A0":["US","Component2ReferencedID"],"00B0":["US","Component2ReferencedMatingFeatureSetID"],"00C0":["US","Component2ReferencedMatingFeatureID"]},"0078":{"0001":["LO","ImplantTemplateGroupName"],"0010":["ST","ImplantTemplateGroupDescription"],"0020":["LO","ImplantTemplateGroupIssuer"],"0024":["LO","ImplantTemplateGroupVersion"],"0026":["SQ","ReplacedImplantTemplateGroupSequence"],"0028":["SQ","ImplantTemplateGroupTargetAnatomySequence"],"002A":["SQ","ImplantTemplateGroupMembersSequence"],"002E":["US","ImplantTemplateGroupMemberID"],"0050":["FD","ThreeDImplantTemplateGroupMemberMatchingPoint"],"0060":["FD","ThreeDImplantTemplateGroupMemberMatchingAxes"],"0070":["SQ","ImplantTemplateGroupMemberMatching2DCoordinatesSequence"],"0090":["FD","TwoDImplantTemplateGroupMemberMatchingPoint"],"00A0":["FD","TwoDImplantTemplateGroupMemberMatchingAxes"],"00B0":["SQ","ImplantTemplateGroupVariationDimensionSequence"],"00B2":["LO","ImplantTemplateGroupVariationDimensionName"],"00B4":["SQ","ImplantTemplateGroupVariationDimensionRankSequence"],"00B6":["US","ReferencedImplantTemplateGroupMemberID"],"00B8":["US","ImplantTemplateGroupVariationDimensionRank"]},"0088":{"0130":["SH","StorageMediaFileSetID"],"0140":["UI","StorageMediaFileSetUID"],"0200":["SQ","IconImageSequence"],"0904":["LO","TopicTitle"],"0906":["ST","TopicSubject"],"0910":["LO","TopicAuthor"],"0912":["LO","TopicKeywords"]},"0100":{"0410":["CS","SOPInstanceStatus"],"0420":["DT","SOPAuthorizationDateTime"],"0424":["LT","SOPAuthorizationComment"],"0426":["LO","AuthorizationEquipmentCertificationNumber"]},"0400":{"0005":["US","MACIDNumber"],"0010":["UI","MACCalculationTransferSyntaxUID"],"0015":["CS","MACAlgorithm"],"0020":["AT","DataElementsSigned"],"0100":["UI","DigitalSignatureUID"],"0105":["DT","DigitalSignatureDateTime"],"0110":["CS","CertificateType"],"0115":["OB","CertificateOfSigner"],"0120":["OB","Signature"],"0305":["CS","CertifiedTimestampType"],"0310":["OB","CertifiedTimestamp"],"0401":["SQ","DigitalSignaturePurposeCodeSequence"],"0402":["SQ","ReferencedDigitalSignatureSequence"],"0403":["SQ","ReferencedSOPInstanceMACSequence"],"0404":["OB","MAC"],"0500":["SQ","EncryptedAttributesSequence"],"0510":["UI","EncryptedContentTransferSyntaxUID"],"0520":["OB","EncryptedContent"],"0550":["SQ","ModifiedAttributesSequence"],"0561":["SQ","OriginalAttributesSequence"],"0562":["DT","AttributeModificationDateTime"],"0563":["LO","ModifyingSystem"],"0564":["LO","SourceOfPreviousValues"],"0565":["CS","ReasonForTheAttributeModification"]},2e3:{"0010":["IS","NumberOfCopies"],"001E":["SQ","PrinterConfigurationSequence"],"0020":["CS","PrintPriority"],"0030":["CS","MediumType"],"0040":["CS","FilmDestination"],"0050":["LO","FilmSessionLabel"],"0060":["IS","MemoryAllocation"],"0061":["IS","MaximumMemoryAllocation"],"0062":["CS","ColorImagePrintingFlag"],"0063":["CS","CollationFlag"],"0065":["CS","AnnotationFlag"],"0067":["CS","ImageOverlayFlag"],"0069":["CS","PresentationLUTFlag"],"006A":["CS","ImageBoxPresentationLUTFlag"],"00A0":["US","MemoryBitDepth"],"00A1":["US","PrintingBitDepth"],"00A2":["SQ","MediaInstalledSequence"],"00A4":["SQ","OtherMediaAvailableSequence"],"00A8":["SQ","SupportedImageDisplayFormatsSequence"],"0500":["SQ","ReferencedFilmBoxSequence"],"0510":["SQ","ReferencedStoredPrintSequence"]},2010:{"0010":["ST","ImageDisplayFormat"],"0030":["CS","AnnotationDisplayFormatID"],"0040":["CS","FilmOrientation"],"0050":["CS","FilmSizeID"],"0052":["CS","PrinterResolutionID"],"0054":["CS","DefaultPrinterResolutionID"],"0060":["CS","MagnificationType"],"0080":["CS","SmoothingType"],"00A6":["CS","DefaultMagnificationType"],"00A7":["CS","OtherMagnificationTypesAvailable"],"00A8":["CS","DefaultSmoothingType"],"00A9":["CS","OtherSmoothingTypesAvailable"],"0100":["CS","BorderDensity"],"0110":["CS","EmptyImageDensity"],"0120":["US","MinDensity"],"0130":["US","MaxDensity"],"0140":["CS","Trim"],"0150":["ST","ConfigurationInformation"],"0152":["LT","ConfigurationInformationDescription"],"0154":["IS","MaximumCollatedFilms"],"015E":["US","Illumination"],"0160":["US","ReflectedAmbientLight"],"0376":["DS","PrinterPixelSpacing"],"0500":["SQ","ReferencedFilmSessionSequence"],"0510":["SQ","ReferencedImageBoxSequence"],"0520":["SQ","ReferencedBasicAnnotationBoxSequence"]},2020:{"0010":["US","ImageBoxPosition"],"0020":["CS","Polarity"],"0030":["DS","RequestedImageSize"],"0040":["CS","RequestedDecimateCropBehavior"],"0050":["CS","RequestedResolutionID"],"00A0":["CS","RequestedImageSizeFlag"],"00A2":["CS","DecimateCropResult"],"0110":["SQ","BasicGrayscaleImageSequence"],"0111":["SQ","BasicColorImageSequence"],"0130":["SQ","ReferencedImageOverlayBoxSequence"],"0140":["SQ","ReferencedVOILUTBoxSequence"]},2030:{"0010":["US","AnnotationPosition"],"0020":["LO","TextString"]},2040:{"0010":["SQ","ReferencedOverlayPlaneSequence"],"0011":["US","ReferencedOverlayPlaneGroups"],"0020":["SQ","OverlayPixelDataSequence"],"0060":["CS","OverlayMagnificationType"],"0070":["CS","OverlaySmoothingType"],"0072":["CS","OverlayOrImageMagnification"],"0074":["US","MagnifyToNumberOfColumns"],"0080":["CS","OverlayForegroundDensity"],"0082":["CS","OverlayBackgroundDensity"],"0090":["CS","OverlayMode"],"0100":["CS","ThresholdDensity"],"0500":["SQ","ReferencedImageBoxSequenceRetired"]},2050:{"0010":["SQ","PresentationLUTSequence"],"0020":["CS","PresentationLUTShape"],"0500":["SQ","ReferencedPresentationLUTSequence"]},2100:{"0010":["SH","PrintJobID"],"0020":["CS","ExecutionStatus"],"0030":["CS","ExecutionStatusInfo"],"0040":["DA","CreationDate"],"0050":["TM","CreationTime"],"0070":["AE","Originator"],"0140":["AE","DestinationAE"],"0160":["SH","OwnerID"],"0170":["IS","NumberOfFilms"],"0500":["SQ","ReferencedPrintJobSequencePullStoredPrint"]},2110:{"0010":["CS","PrinterStatus"],"0020":["CS","PrinterStatusInfo"],"0030":["LO","PrinterName"],"0099":["SH","PrintQueueID"]},2120:{"0010":["CS","QueueStatus"],"0050":["SQ","PrintJobDescriptionSequence"],"0070":["SQ","ReferencedPrintJobSequence"]},2130:{"0010":["SQ","PrintManagementCapabilitiesSequence"],"0015":["SQ","PrinterCharacteristicsSequence"],"0030":["SQ","FilmBoxContentSequence"],"0040":["SQ","ImageBoxContentSequence"],"0050":["SQ","AnnotationContentSequence"],"0060":["SQ","ImageOverlayBoxContentSequence"],"0080":["SQ","PresentationLUTContentSequence"],"00A0":["SQ","ProposedStudySequence"],"00C0":["SQ","OriginalImageSequence"]},2200:{"0001":["CS","LabelUsingInformationExtractedFromInstances"],"0002":["UT","LabelText"],"0003":["CS","LabelStyleSelection"],"0004":["LT","MediaDisposition"],"0005":["LT","BarcodeValue"],"0006":["CS","BarcodeSymbology"],"0007":["CS","AllowMediaSplitting"],"0008":["CS","IncludeNonDICOMObjects"],"0009":["CS","IncludeDisplayApplication"],"000A":["CS","PreserveCompositeInstancesAfterMediaCreation"],"000B":["US","TotalNumberOfPiecesOfMediaCreated"],"000C":["LO","RequestedMediaApplicationProfile"],"000D":["SQ","ReferencedStorageMediaSequence"],"000E":["AT","FailureAttributes"],"000F":["CS","AllowLossyCompression"],"0020":["CS","RequestPriority"]},3002:{"0002":["SH","RTImageLabel"],"0003":["LO","RTImageName"],"0004":["ST","RTImageDescription"],"000A":["CS","ReportedValuesOrigin"],"000C":["CS","RTImagePlane"],"000D":["DS","XRayImageReceptorTranslation"],"000E":["DS","XRayImageReceptorAngle"],"0010":["DS","RTImageOrientation"],"0011":["DS","ImagePlanePixelSpacing"],"0012":["DS","RTImagePosition"],"0020":["SH","RadiationMachineName"],"0022":["DS","RadiationMachineSAD"],"0024":["DS","RadiationMachineSSD"],"0026":["DS","RTImageSID"],"0028":["DS","SourceToReferenceObjectDistance"],"0029":["IS","FractionNumber"],"0030":["SQ","ExposureSequence"],"0032":["DS","MetersetExposure"],"0034":["DS","DiaphragmPosition"],"0040":["SQ","FluenceMapSequence"],"0041":["CS","FluenceDataSource"],"0042":["DS","FluenceDataScale"],"0050":["SQ","PrimaryFluenceModeSequence"],"0051":["CS","FluenceMode"],"0052":["SH","FluenceModeID"]},3004:{"0001":["CS","DVHType"],"0002":["CS","DoseUnits"],"0004":["CS","DoseType"],"0006":["LO","DoseComment"],"0008":["DS","NormalizationPoint"],"000A":["CS","DoseSummationType"],"000C":["DS","GridFrameOffsetVector"],"000E":["DS","DoseGridScaling"],"0010":["SQ","RTDoseROISequence"],"0012":["DS","DoseValue"],"0014":["CS","TissueHeterogeneityCorrection"],"0040":["DS","DVHNormalizationPoint"],"0042":["DS","DVHNormalizationDoseValue"],"0050":["SQ","DVHSequence"],"0052":["DS","DVHDoseScaling"],"0054":["CS","DVHVolumeUnits"],"0056":["IS","DVHNumberOfBins"],"0058":["DS","DVHData"],"0060":["SQ","DVHReferencedROISequence"],"0062":["CS","DVHROIContributionType"],"0070":["DS","DVHMinimumDose"],"0072":["DS","DVHMaximumDose"],"0074":["DS","DVHMeanDose"]},3006:{"0002":["SH","StructureSetLabel"],"0004":["LO","StructureSetName"],"0006":["ST","StructureSetDescription"],"0008":["DA","StructureSetDate"],"0009":["TM","StructureSetTime"],"0010":["SQ","ReferencedFrameOfReferenceSequence"],"0012":["SQ","RTReferencedStudySequence"],"0014":["SQ","RTReferencedSeriesSequence"],"0016":["SQ","ContourImageSequence"],"0020":["SQ","StructureSetROISequence"],"0022":["IS","ROINumber"],"0024":["UI","ReferencedFrameOfReferenceUID"],"0026":["LO","ROIName"],"0028":["ST","ROIDescription"],"002A":["IS","ROIDisplayColor"],"002C":["DS","ROIVolume"],"0030":["SQ","RTRelatedROISequence"],"0033":["CS","RTROIRelationship"],"0036":["CS","ROIGenerationAlgorithm"],"0038":["LO","ROIGenerationDescription"],"0039":["SQ","ROIContourSequence"],"0040":["SQ","ContourSequence"],"0042":["CS","ContourGeometricType"],"0044":["DS","ContourSlabThickness"],"0045":["DS","ContourOffsetVector"],"0046":["IS","NumberOfContourPoints"],"0048":["IS","ContourNumber"],"0049":["IS","AttachedContours"],"0050":["DS","ContourData"],"0080":["SQ","RTROIObservationsSequence"],"0082":["IS","ObservationNumber"],"0084":["IS","ReferencedROINumber"],"0085":["SH","ROIObservationLabel"],"0086":["SQ","RTROIIdentificationCodeSequence"],"0088":["ST","ROIObservationDescription"],"00A0":["SQ","RelatedRTROIObservationsSequence"],"00A4":["CS","RTROIInterpretedType"],"00A6":["PN","ROIInterpreter"],"00B0":["SQ","ROIPhysicalPropertiesSequence"],"00B2":["CS","ROIPhysicalProperty"],"00B4":["DS","ROIPhysicalPropertyValue"],"00B6":["SQ","ROIElementalCompositionSequence"],"00B7":["US","ROIElementalCompositionAtomicNumber"],"00B8":["FL","ROIElementalCompositionAtomicMassFraction"],"00C0":["SQ","FrameOfReferenceRelationshipSequence"],"00C2":["UI","RelatedFrameOfReferenceUID"],"00C4":["CS","FrameOfReferenceTransformationType"],"00C6":["DS","FrameOfReferenceTransformationMatrix"],"00C8":["LO","FrameOfReferenceTransformationComment"]},3008:{"0010":["SQ","MeasuredDoseReferenceSequence"],"0012":["ST","MeasuredDoseDescription"],"0014":["CS","MeasuredDoseType"],"0016":["DS","MeasuredDoseValue"],"0020":["SQ","TreatmentSessionBeamSequence"],"0021":["SQ","TreatmentSessionIonBeamSequence"],"0022":["IS","CurrentFractionNumber"],"0024":["DA","TreatmentControlPointDate"],"0025":["TM","TreatmentControlPointTime"],"002A":["CS","TreatmentTerminationStatus"],"002B":["SH","TreatmentTerminationCode"],"002C":["CS","TreatmentVerificationStatus"],"0030":["SQ","ReferencedTreatmentRecordSequence"],"0032":["DS","SpecifiedPrimaryMeterset"],"0033":["DS","SpecifiedSecondaryMeterset"],"0036":["DS","DeliveredPrimaryMeterset"],"0037":["DS","DeliveredSecondaryMeterset"],"003A":["DS","SpecifiedTreatmentTime"],"003B":["DS","DeliveredTreatmentTime"],"0040":["SQ","ControlPointDeliverySequence"],"0041":["SQ","IonControlPointDeliverySequence"],"0042":["DS","SpecifiedMeterset"],"0044":["DS","DeliveredMeterset"],"0045":["FL","MetersetRateSet"],"0046":["FL","MetersetRateDelivered"],"0047":["FL","ScanSpotMetersetsDelivered"],"0048":["DS","DoseRateDelivered"],"0050":["SQ","TreatmentSummaryCalculatedDoseReferenceSequence"],"0052":["DS","CumulativeDoseToDoseReference"],"0054":["DA","FirstTreatmentDate"],"0056":["DA","MostRecentTreatmentDate"],"005A":["IS","NumberOfFractionsDelivered"],"0060":["SQ","OverrideSequence"],"0061":["AT","ParameterSequencePointer"],"0062":["AT","OverrideParameterPointer"],"0063":["IS","ParameterItemIndex"],"0064":["IS","MeasuredDoseReferenceNumber"],"0065":["AT","ParameterPointer"],"0066":["ST","OverrideReason"],"0068":["SQ","CorrectedParameterSequence"],"006A":["FL","CorrectionValue"],"0070":["SQ","CalculatedDoseReferenceSequence"],"0072":["IS","CalculatedDoseReferenceNumber"],"0074":["ST","CalculatedDoseReferenceDescription"],"0076":["DS","CalculatedDoseReferenceDoseValue"],"0078":["DS","StartMeterset"],"007A":["DS","EndMeterset"],"0080":["SQ","ReferencedMeasuredDoseReferenceSequence"],"0082":["IS","ReferencedMeasuredDoseReferenceNumber"],"0090":["SQ","ReferencedCalculatedDoseReferenceSequence"],"0092":["IS","ReferencedCalculatedDoseReferenceNumber"],"00A0":["SQ","BeamLimitingDeviceLeafPairsSequence"],"00B0":["SQ","RecordedWedgeSequence"],"00C0":["SQ","RecordedCompensatorSequence"],"00D0":["SQ","RecordedBlockSequence"],"00E0":["SQ","TreatmentSummaryMeasuredDoseReferenceSequence"],"00F0":["SQ","RecordedSnoutSequence"],"00F2":["SQ","RecordedRangeShifterSequence"],"00F4":["SQ","RecordedLateralSpreadingDeviceSequence"],"00F6":["SQ","RecordedRangeModulatorSequence"],"0100":["SQ","RecordedSourceSequence"],"0105":["LO","SourceSerialNumber"],"0110":["SQ","TreatmentSessionApplicationSetupSequence"],"0116":["CS","ApplicationSetupCheck"],"0120":["SQ","RecordedBrachyAccessoryDeviceSequence"],"0122":["IS","ReferencedBrachyAccessoryDeviceNumber"],"0130":["SQ","RecordedChannelSequence"],"0132":["DS","SpecifiedChannelTotalTime"],"0134":["DS","DeliveredChannelTotalTime"],"0136":["IS","SpecifiedNumberOfPulses"],"0138":["IS","DeliveredNumberOfPulses"],"013A":["DS","SpecifiedPulseRepetitionInterval"],"013C":["DS","DeliveredPulseRepetitionInterval"],"0140":["SQ","RecordedSourceApplicatorSequence"],"0142":["IS","ReferencedSourceApplicatorNumber"],"0150":["SQ","RecordedChannelShieldSequence"],"0152":["IS","ReferencedChannelShieldNumber"],"0160":["SQ","BrachyControlPointDeliveredSequence"],"0162":["DA","SafePositionExitDate"],"0164":["TM","SafePositionExitTime"],"0166":["DA","SafePositionReturnDate"],"0168":["TM","SafePositionReturnTime"],"0200":["CS","CurrentTreatmentStatus"],"0202":["ST","TreatmentStatusComment"],"0220":["SQ","FractionGroupSummarySequence"],"0223":["IS","ReferencedFractionNumber"],"0224":["CS","FractionGroupType"],"0230":["CS","BeamStopperPosition"],"0240":["SQ","FractionStatusSummarySequence"],"0250":["DA","TreatmentDate"],"0251":["TM","TreatmentTime"]},"300A":{"0002":["SH","RTPlanLabel"],"0003":["LO","RTPlanName"],"0004":["ST","RTPlanDescription"],"0006":["DA","RTPlanDate"],"0007":["TM","RTPlanTime"],"0009":["LO","TreatmentProtocols"],"000A":["CS","PlanIntent"],"000B":["LO","TreatmentSites"],"000C":["CS","RTPlanGeometry"],"000E":["ST","PrescriptionDescription"],"0010":["SQ","DoseReferenceSequence"],"0012":["IS","DoseReferenceNumber"],"0013":["UI","DoseReferenceUID"],"0014":["CS","DoseReferenceStructureType"],"0015":["CS","NominalBeamEnergyUnit"],"0016":["LO","DoseReferenceDescription"],"0018":["DS","DoseReferencePointCoordinates"],"001A":["DS","NominalPriorDose"],"0020":["CS","DoseReferenceType"],"0021":["DS","ConstraintWeight"],"0022":["DS","DeliveryWarningDose"],"0023":["DS","DeliveryMaximumDose"],"0025":["DS","TargetMinimumDose"],"0026":["DS","TargetPrescriptionDose"],"0027":["DS","TargetMaximumDose"],"0028":["DS","TargetUnderdoseVolumeFraction"],"002A":["DS","OrganAtRiskFullVolumeDose"],"002B":["DS","OrganAtRiskLimitDose"],"002C":["DS","OrganAtRiskMaximumDose"],"002D":["DS","OrganAtRiskOverdoseVolumeFraction"],"0040":["SQ","ToleranceTableSequence"],"0042":["IS","ToleranceTableNumber"],"0043":["SH","ToleranceTableLabel"],"0044":["DS","GantryAngleTolerance"],"0046":["DS","BeamLimitingDeviceAngleTolerance"],"0048":["SQ","BeamLimitingDeviceToleranceSequence"],"004A":["DS","BeamLimitingDevicePositionTolerance"],"004B":["FL","SnoutPositionTolerance"],"004C":["DS","PatientSupportAngleTolerance"],"004E":["DS","TableTopEccentricAngleTolerance"],"004F":["FL","TableTopPitchAngleTolerance"],"0050":["FL","TableTopRollAngleTolerance"],"0051":["DS","TableTopVerticalPositionTolerance"],"0052":["DS","TableTopLongitudinalPositionTolerance"],"0053":["DS","TableTopLateralPositionTolerance"],"0055":["CS","RTPlanRelationship"],"0070":["SQ","FractionGroupSequence"],"0071":["IS","FractionGroupNumber"],"0072":["LO","FractionGroupDescription"],"0078":["IS","NumberOfFractionsPlanned"],"0079":["IS","NumberOfFractionPatternDigitsPerDay"],"007A":["IS","RepeatFractionCycleLength"],"007B":["LT","FractionPattern"],"0080":["IS","NumberOfBeams"],"0082":["DS","BeamDoseSpecificationPoint"],"0084":["DS","BeamDose"],"0086":["DS","BeamMeterset"],"0088":["FL","BeamDosePointDepth"],"0089":["FL","BeamDosePointEquivalentDepth"],"008A":["FL","BeamDosePointSSD"],"00A0":["IS","NumberOfBrachyApplicationSetups"],"00A2":["DS","BrachyApplicationSetupDoseSpecificationPoint"],"00A4":["DS","BrachyApplicationSetupDose"],"00B0":["SQ","BeamSequence"],"00B2":["SH","TreatmentMachineName"],"00B3":["CS","PrimaryDosimeterUnit"],"00B4":["DS","SourceAxisDistance"],"00B6":["SQ","BeamLimitingDeviceSequence"],"00B8":["CS","RTBeamLimitingDeviceType"],"00BA":["DS","SourceToBeamLimitingDeviceDistance"],"00BB":["FL","IsocenterToBeamLimitingDeviceDistance"],"00BC":["IS","NumberOfLeafJawPairs"],"00BE":["DS","LeafPositionBoundaries"],"00C0":["IS","BeamNumber"],"00C2":["LO","BeamName"],"00C3":["ST","BeamDescription"],"00C4":["CS","BeamType"],"00C6":["CS","RadiationType"],"00C7":["CS","HighDoseTechniqueType"],"00C8":["IS","ReferenceImageNumber"],"00CA":["SQ","PlannedVerificationImageSequence"],"00CC":["LO","ImagingDeviceSpecificAcquisitionParameters"],"00CE":["CS","TreatmentDeliveryType"],"00D0":["IS","NumberOfWedges"],"00D1":["SQ","WedgeSequence"],"00D2":["IS","WedgeNumber"],"00D3":["CS","WedgeType"],"00D4":["SH","WedgeID"],"00D5":["IS","WedgeAngle"],"00D6":["DS","WedgeFactor"],"00D7":["FL","TotalWedgeTrayWaterEquivalentThickness"],"00D8":["DS","WedgeOrientation"],"00D9":["FL","IsocenterToWedgeTrayDistance"],"00DA":["DS","SourceToWedgeTrayDistance"],"00DB":["FL","WedgeThinEdgePosition"],"00DC":["SH","BolusID"],"00DD":["ST","BolusDescription"],"00E0":["IS","NumberOfCompensators"],"00E1":["SH","MaterialID"],"00E2":["DS","TotalCompensatorTrayFactor"],"00E3":["SQ","CompensatorSequence"],"00E4":["IS","CompensatorNumber"],"00E5":["SH","CompensatorID"],"00E6":["DS","SourceToCompensatorTrayDistance"],"00E7":["IS","CompensatorRows"],"00E8":["IS","CompensatorColumns"],"00E9":["DS","CompensatorPixelSpacing"],"00EA":["DS","CompensatorPosition"],"00EB":["DS","CompensatorTransmissionData"],"00EC":["DS","CompensatorThicknessData"],"00ED":["IS","NumberOfBoli"],"00EE":["CS","CompensatorType"],"00F0":["IS","NumberOfBlocks"],"00F2":["DS","TotalBlockTrayFactor"],"00F3":["FL","TotalBlockTrayWaterEquivalentThickness"],"00F4":["SQ","BlockSequence"],"00F5":["SH","BlockTrayID"],"00F6":["DS","SourceToBlockTrayDistance"],"00F7":["FL","IsocenterToBlockTrayDistance"],"00F8":["CS","BlockType"],"00F9":["LO","AccessoryCode"],"00FA":["CS","BlockDivergence"],"00FB":["CS","BlockMountingPosition"],"00FC":["IS","BlockNumber"],"00FE":["LO","BlockName"],"0100":["DS","BlockThickness"],"0102":["DS","BlockTransmission"],"0104":["IS","BlockNumberOfPoints"],"0106":["DS","BlockData"],"0107":["SQ","ApplicatorSequence"],"0108":["SH","ApplicatorID"],"0109":["CS","ApplicatorType"],"010A":["LO","ApplicatorDescription"],"010C":["DS","CumulativeDoseReferenceCoefficient"],"010E":["DS","FinalCumulativeMetersetWeight"],"0110":["IS","NumberOfControlPoints"],"0111":["SQ","ControlPointSequence"],"0112":["IS","ControlPointIndex"],"0114":["DS","NominalBeamEnergy"],"0115":["DS","DoseRateSet"],"0116":["SQ","WedgePositionSequence"],"0118":["CS","WedgePosition"],"011A":["SQ","BeamLimitingDevicePositionSequence"],"011C":["DS","LeafJawPositions"],"011E":["DS","GantryAngle"],"011F":["CS","GantryRotationDirection"],"0120":["DS","BeamLimitingDeviceAngle"],"0121":["CS","BeamLimitingDeviceRotationDirection"],"0122":["DS","PatientSupportAngle"],"0123":["CS","PatientSupportRotationDirection"],"0124":["DS","TableTopEccentricAxisDistance"],"0125":["DS","TableTopEccentricAngle"],"0126":["CS","TableTopEccentricRotationDirection"],"0128":["DS","TableTopVerticalPosition"],"0129":["DS","TableTopLongitudinalPosition"],"012A":["DS","TableTopLateralPosition"],"012C":["DS","IsocenterPosition"],"012E":["DS","SurfaceEntryPoint"],"0130":["DS","SourceToSurfaceDistance"],"0134":["DS","CumulativeMetersetWeight"],"0140":["FL","TableTopPitchAngle"],"0142":["CS","TableTopPitchRotationDirection"],"0144":["FL","TableTopRollAngle"],"0146":["CS","TableTopRollRotationDirection"],"0148":["FL","HeadFixationAngle"],"014A":["FL","GantryPitchAngle"],"014C":["CS","GantryPitchRotationDirection"],"014E":["FL","GantryPitchAngleTolerance"],"0180":["SQ","PatientSetupSequence"],"0182":["IS","PatientSetupNumber"],"0183":["LO","PatientSetupLabel"],"0184":["LO","PatientAdditionalPosition"],"0190":["SQ","FixationDeviceSequence"],"0192":["CS","FixationDeviceType"],"0194":["SH","FixationDeviceLabel"],"0196":["ST","FixationDeviceDescription"],"0198":["SH","FixationDevicePosition"],"0199":["FL","FixationDevicePitchAngle"],"019A":["FL","FixationDeviceRollAngle"],"01A0":["SQ","ShieldingDeviceSequence"],"01A2":["CS","ShieldingDeviceType"],"01A4":["SH","ShieldingDeviceLabel"],"01A6":["ST","ShieldingDeviceDescription"],"01A8":["SH","ShieldingDevicePosition"],"01B0":["CS","SetupTechnique"],"01B2":["ST","SetupTechniqueDescription"],"01B4":["SQ","SetupDeviceSequence"],"01B6":["CS","SetupDeviceType"],"01B8":["SH","SetupDeviceLabel"],"01BA":["ST","SetupDeviceDescription"],"01BC":["DS","SetupDeviceParameter"],"01D0":["ST","SetupReferenceDescription"],"01D2":["DS","TableTopVerticalSetupDisplacement"],"01D4":["DS","TableTopLongitudinalSetupDisplacement"],"01D6":["DS","TableTopLateralSetupDisplacement"],"0200":["CS","BrachyTreatmentTechnique"],"0202":["CS","BrachyTreatmentType"],"0206":["SQ","TreatmentMachineSequence"],"0210":["SQ","SourceSequence"],"0212":["IS","SourceNumber"],"0214":["CS","SourceType"],"0216":["LO","SourceManufacturer"],"0218":["DS","ActiveSourceDiameter"],"021A":["DS","ActiveSourceLength"],"0222":["DS","SourceEncapsulationNominalThickness"],"0224":["DS","SourceEncapsulationNominalTransmission"],"0226":["LO","SourceIsotopeName"],"0228":["DS","SourceIsotopeHalfLife"],"0229":["CS","SourceStrengthUnits"],"022A":["DS","ReferenceAirKermaRate"],"022B":["DS","SourceStrength"],"022C":["DA","SourceStrengthReferenceDate"],"022E":["TM","SourceStrengthReferenceTime"],"0230":["SQ","ApplicationSetupSequence"],"0232":["CS","ApplicationSetupType"],"0234":["IS","ApplicationSetupNumber"],"0236":["LO","ApplicationSetupName"],"0238":["LO","ApplicationSetupManufacturer"],"0240":["IS","TemplateNumber"],"0242":["SH","TemplateType"],"0244":["LO","TemplateName"],"0250":["DS","TotalReferenceAirKerma"],"0260":["SQ","BrachyAccessoryDeviceSequence"],"0262":["IS","BrachyAccessoryDeviceNumber"],"0263":["SH","BrachyAccessoryDeviceID"],"0264":["CS","BrachyAccessoryDeviceType"],"0266":["LO","BrachyAccessoryDeviceName"],"026A":["DS","BrachyAccessoryDeviceNominalThickness"],"026C":["DS","BrachyAccessoryDeviceNominalTransmission"],"0280":["SQ","ChannelSequence"],"0282":["IS","ChannelNumber"],"0284":["DS","ChannelLength"],"0286":["DS","ChannelTotalTime"],"0288":["CS","SourceMovementType"],"028A":["IS","NumberOfPulses"],"028C":["DS","PulseRepetitionInterval"],"0290":["IS","SourceApplicatorNumber"],"0291":["SH","SourceApplicatorID"],"0292":["CS","SourceApplicatorType"],"0294":["LO","SourceApplicatorName"],"0296":["DS","SourceApplicatorLength"],"0298":["LO","SourceApplicatorManufacturer"],"029C":["DS","SourceApplicatorWallNominalThickness"],"029E":["DS","SourceApplicatorWallNominalTransmission"],"02A0":["DS","SourceApplicatorStepSize"],"02A2":["IS","TransferTubeNumber"],"02A4":["DS","TransferTubeLength"],"02B0":["SQ","ChannelShieldSequence"],"02B2":["IS","ChannelShieldNumber"],"02B3":["SH","ChannelShieldID"],"02B4":["LO","ChannelShieldName"],"02B8":["DS","ChannelShieldNominalThickness"],"02BA":["DS","ChannelShieldNominalTransmission"],"02C8":["DS","FinalCumulativeTimeWeight"],"02D0":["SQ","BrachyControlPointSequence"],"02D2":["DS","ControlPointRelativePosition"],"02D4":["DS","ControlPoint3DPosition"],"02D6":["DS","CumulativeTimeWeight"],"02E0":["CS","CompensatorDivergence"],"02E1":["CS","CompensatorMountingPosition"],"02E2":["DS","SourceToCompensatorDistance"],"02E3":["FL","TotalCompensatorTrayWaterEquivalentThickness"],"02E4":["FL","IsocenterToCompensatorTrayDistance"],"02E5":["FL","CompensatorColumnOffset"],"02E6":["FL","IsocenterToCompensatorDistances"],"02E7":["FL","CompensatorRelativeStoppingPowerRatio"],"02E8":["FL","CompensatorMillingToolDiameter"],"02EA":["SQ","IonRangeCompensatorSequence"],"02EB":["LT","CompensatorDescription"],"0302":["IS","RadiationMassNumber"],"0304":["IS","RadiationAtomicNumber"],"0306":["SS","RadiationChargeState"],"0308":["CS","ScanMode"],"030A":["FL","VirtualSourceAxisDistances"],"030C":["SQ","SnoutSequence"],"030D":["FL","SnoutPosition"],"030F":["SH","SnoutID"],"0312":["IS","NumberOfRangeShifters"],"0314":["SQ","RangeShifterSequence"],"0316":["IS","RangeShifterNumber"],"0318":["SH","RangeShifterID"],"0320":["CS","RangeShifterType"],"0322":["LO","RangeShifterDescription"],"0330":["IS","NumberOfLateralSpreadingDevices"],"0332":["SQ","LateralSpreadingDeviceSequence"],"0334":["IS","LateralSpreadingDeviceNumber"],"0336":["SH","LateralSpreadingDeviceID"],"0338":["CS","LateralSpreadingDeviceType"],"033A":["LO","LateralSpreadingDeviceDescription"],"033C":["FL","LateralSpreadingDeviceWaterEquivalentThickness"],"0340":["IS","NumberOfRangeModulators"],"0342":["SQ","RangeModulatorSequence"],"0344":["IS","RangeModulatorNumber"],"0346":["SH","RangeModulatorID"],"0348":["CS","RangeModulatorType"],"034A":["LO","RangeModulatorDescription"],"034C":["SH","BeamCurrentModulationID"],"0350":["CS","PatientSupportType"],"0352":["SH","PatientSupportID"],"0354":["LO","PatientSupportAccessoryCode"],"0356":["FL","FixationLightAzimuthalAngle"],"0358":["FL","FixationLightPolarAngle"],"035A":["FL","MetersetRate"],"0360":["SQ","RangeShifterSettingsSequence"],"0362":["LO","RangeShifterSetting"],"0364":["FL","IsocenterToRangeShifterDistance"],"0366":["FL","RangeShifterWaterEquivalentThickness"],"0370":["SQ","LateralSpreadingDeviceSettingsSequence"],"0372":["LO","LateralSpreadingDeviceSetting"],"0374":["FL","IsocenterToLateralSpreadingDeviceDistance"],"0380":["SQ","RangeModulatorSettingsSequence"],"0382":["FL","RangeModulatorGatingStartValue"],"0384":["FL","RangeModulatorGatingStopValue"],"0386":["FL","RangeModulatorGatingStartWaterEquivalentThickness"],"0388":["FL","RangeModulatorGatingStopWaterEquivalentThickness"],"038A":["FL","IsocenterToRangeModulatorDistance"],"0390":["SH","ScanSpotTuneID"],"0392":["IS","NumberOfScanSpotPositions"],"0394":["FL","ScanSpotPositionMap"],"0396":["FL","ScanSpotMetersetWeights"],"0398":["FL","ScanningSpotSize"],"039A":["IS","NumberOfPaintings"],"03A0":["SQ","IonToleranceTableSequence"],"03A2":["SQ","IonBeamSequence"],"03A4":["SQ","IonBeamLimitingDeviceSequence"],"03A6":["SQ","IonBlockSequence"],"03A8":["SQ","IonControlPointSequence"],"03AA":["SQ","IonWedgeSequence"],"03AC":["SQ","IonWedgePositionSequence"],"0401":["SQ","ReferencedSetupImageSequence"],"0402":["ST","SetupImageComment"],"0410":["SQ","MotionSynchronizationSequence"],"0412":["FL","ControlPointOrientation"],"0420":["SQ","GeneralAccessorySequence"],"0421":["SH","GeneralAccessoryID"],"0422":["ST","GeneralAccessoryDescription"],"0423":["CS","GeneralAccessoryType"],"0424":["IS","GeneralAccessoryNumber"],"0431":["SQ","ApplicatorGeometrySequence"],"0432":["CS","ApplicatorApertureShape"],"0433":["FL","ApplicatorOpening"],"0434":["FL","ApplicatorOpeningX"],"0435":["FL","ApplicatorOpeningY"],"0436":["FL","SourceToApplicatorMountingPositionDistance"]},"300C":{"0002":["SQ","ReferencedRTPlanSequence"],"0004":["SQ","ReferencedBeamSequence"],"0006":["IS","ReferencedBeamNumber"],"0007":["IS","ReferencedReferenceImageNumber"],"0008":["DS","StartCumulativeMetersetWeight"],"0009":["DS","EndCumulativeMetersetWeight"],"000A":["SQ","ReferencedBrachyApplicationSetupSequence"],"000C":["IS","ReferencedBrachyApplicationSetupNumber"],"000E":["IS","ReferencedSourceNumber"],"0020":["SQ","ReferencedFractionGroupSequence"],"0022":["IS","ReferencedFractionGroupNumber"],"0040":["SQ","ReferencedVerificationImageSequence"],"0042":["SQ","ReferencedReferenceImageSequence"],"0050":["SQ","ReferencedDoseReferenceSequence"],"0051":["IS","ReferencedDoseReferenceNumber"],"0055":["SQ","BrachyReferencedDoseReferenceSequence"],"0060":["SQ","ReferencedStructureSetSequence"],"006A":["IS","ReferencedPatientSetupNumber"],"0080":["SQ","ReferencedDoseSequence"],"00A0":["IS","ReferencedToleranceTableNumber"],"00B0":["SQ","ReferencedBolusSequence"],"00C0":["IS","ReferencedWedgeNumber"],"00D0":["IS","ReferencedCompensatorNumber"],"00E0":["IS","ReferencedBlockNumber"],"00F0":["IS","ReferencedControlPointIndex"],"00F2":["SQ","ReferencedControlPointSequence"],"00F4":["IS","ReferencedStartControlPointIndex"],"00F6":["IS","ReferencedStopControlPointIndex"],"0100":["IS","ReferencedRangeShifterNumber"],"0102":["IS","ReferencedLateralSpreadingDeviceNumber"],"0104":["IS","ReferencedRangeModulatorNumber"]},"300E":{"0002":["CS","ApprovalStatus"],"0004":["DA","ReviewDate"],"0005":["TM","ReviewTime"],"0008":["PN","ReviewerName"]},4e3:{"0010":["LT","Arbitrary"],4e3:["LT","TextComments"]},4008:{"0040":["SH","ResultsID"],"0042":["LO","ResultsIDIssuer"],"0050":["SQ","ReferencedInterpretationSequence"],"00FF":["CS","ReportProductionStatusTrial"],"0100":["DA","InterpretationRecordedDate"],"0101":["TM","InterpretationRecordedTime"],"0102":["PN","InterpretationRecorder"],"0103":["LO","ReferenceToRecordedSound"],"0108":["DA","InterpretationTranscriptionDate"],"0109":["TM","InterpretationTranscriptionTime"],"010A":["PN","InterpretationTranscriber"],"010B":["ST","InterpretationText"],"010C":["PN","InterpretationAuthor"],"0111":["SQ","InterpretationApproverSequence"],"0112":["DA","InterpretationApprovalDate"],"0113":["TM","InterpretationApprovalTime"],"0114":["PN","PhysicianApprovingInterpretation"],"0115":["LT","InterpretationDiagnosisDescription"],"0117":["SQ","InterpretationDiagnosisCodeSequence"],"0118":["SQ","ResultsDistributionListSequence"],"0119":["PN","DistributionName"],"011A":["LO","DistributionAddress"],"0200":["SH","InterpretationID"],"0202":["LO","InterpretationIDIssuer"],"0210":["CS","InterpretationTypeID"],"0212":["CS","InterpretationStatusID"],"0300":["ST","Impressions"],4e3:["ST","ResultsComments"]},4010:{"0001":["CS","LowEnergyDetectors"],"0002":["CS","HighEnergyDetectors"],"0004":["SQ","DetectorGeometrySequence"],1001:["SQ","ThreatROIVoxelSequence"],1004:["FL","ThreatROIBase"],1005:["FL","ThreatROIExtents"],1006:["OB","ThreatROIBitmap"],1007:["SH","RouteSegmentID"],1008:["CS","GantryType"],1009:["CS","OOIOwnerType"],"100A":["SQ","RouteSegmentSequence"],1010:["US","PotentialThreatObjectID"],1011:["SQ","ThreatSequence"],1012:["CS","ThreatCategory"],1013:["LT","ThreatCategoryDescription"],1014:["CS","ATDAbilityAssessment"],1015:["CS","ATDAssessmentFlag"],1016:["FL","ATDAssessmentProbability"],1017:["FL","Mass"],1018:["FL","Density"],1019:["FL","ZEffective"],"101A":["SH","BoardingPassID"],"101B":["FL","CenterOfMass"],"101C":["FL","CenterOfPTO"],"101D":["FL","BoundingPolygon"],"101E":["SH","RouteSegmentStartLocationID"],"101F":["SH","RouteSegmentEndLocationID"],1020:["CS","RouteSegmentLocationIDType"],1021:["CS","AbortReason"],1023:["FL","VolumeOfPTO"],1024:["CS","AbortFlag"],1025:["DT","RouteSegmentStartTime"],1026:["DT","RouteSegmentEndTime"],1027:["CS","TDRType"],1028:["CS","InternationalRouteSegment"],1029:["LO","ThreatDetectionAlgorithmandVersion"],"102A":["SH","AssignedLocation"],"102B":["DT","AlarmDecisionTime"],1031:["CS","AlarmDecision"],1033:["US","NumberOfTotalObjects"],1034:["US","NumberOfAlarmObjects"],1037:["SQ","PTORepresentationSequence"],1038:["SQ","ATDAssessmentSequence"],1039:["CS","TIPType"],"103A":["CS","DICOSVersion"],1041:["DT","OOIOwnerCreationTime"],1042:["CS","OOIType"],1043:["FL","OOISize"],1044:["CS","AcquisitionStatus"],1045:["SQ","BasisMaterialsCodeSequence"],1046:["CS","PhantomType"],1047:["SQ","OOIOwnerSequence"],1048:["CS","ScanType"],1051:["LO","ItineraryID"],1052:["SH","ItineraryIDType"],1053:["LO","ItineraryIDAssigningAuthority"],1054:["SH","RouteID"],1055:["SH","RouteIDAssigningAuthority"],1056:["CS","InboundArrivalType"],1058:["SH","CarrierID"],1059:["CS","CarrierIDAssigningAuthority"],1060:["FL","SourceOrientation"],1061:["FL","SourcePosition"],1062:["FL","BeltHeight"],1064:["SQ","AlgorithmRoutingCodeSequence"],1067:["CS","TransportClassification"],1068:["LT","OOITypeDescriptor"],1069:["FL","TotalProcessingTime"],"106C":["OB","DetectorCalibrationData"]}},n.Dictionary.getVR=function(s,u){var f,m,A;return A=n.Dictionary.dict[n.Utils.dec2hex(s)],A&&(m=A[n.Utils.dec2hex(u)],m?f=m[0]:u===0&&(f="UL")),f||(A=n.Dictionary.dictPrivate[n.Utils.dec2hex(s)],A&&(m=A[n.Utils.dec2hex(u)],m&&(f=m[0]))),f||(f="OB"),f},n.Dictionary.getDescription=function(s,u){var f,m,A;return A=n.Dictionary.dict[n.Utils.dec2hex(s)],A&&(m=A[n.Utils.dec2hex(u)],m?f=m[1]:u===0&&(f="Group "+n.Utils.dec2hex(s)+" Length")),f||(A=n.Dictionary.dictPrivate[n.Utils.dec2hex(s)],A&&(m=A[n.Utils.dec2hex(u)],m&&(f=m[1]))),f||(f="PrivateData"),f},a.exports&&(a.exports=n.Dictionary)}(dictionary)),dictionary.exports}var image$1={exports:{}},tag={exports:{}},lib$1={exports:{}},_default$1={},lib={exports:{}},_default={},hasRequired_default$1;function require_default$1(){if(hasRequired_default$1)return _default;hasRequired_default$1=1;function a(){var m={};return m["align-content"]=!1,m["align-items"]=!1,m["align-self"]=!1,m["alignment-adjust"]=!1,m["alignment-baseline"]=!1,m.all=!1,m["anchor-point"]=!1,m.animation=!1,m["animation-delay"]=!1,m["animation-direction"]=!1,m["animation-duration"]=!1,m["animation-fill-mode"]=!1,m["animation-iteration-count"]=!1,m["animation-name"]=!1,m["animation-play-state"]=!1,m["animation-timing-function"]=!1,m.azimuth=!1,m["backface-visibility"]=!1,m.background=!0,m["background-attachment"]=!0,m["background-clip"]=!0,m["background-color"]=!0,m["background-image"]=!0,m["background-origin"]=!0,m["background-position"]=!0,m["background-repeat"]=!0,m["background-size"]=!0,m["baseline-shift"]=!1,m.binding=!1,m.bleed=!1,m["bookmark-label"]=!1,m["bookmark-level"]=!1,m["bookmark-state"]=!1,m.border=!0,m["border-bottom"]=!0,m["border-bottom-color"]=!0,m["border-bottom-left-radius"]=!0,m["border-bottom-right-radius"]=!0,m["border-bottom-style"]=!0,m["border-bottom-width"]=!0,m["border-collapse"]=!0,m["border-color"]=!0,m["border-image"]=!0,m["border-image-outset"]=!0,m["border-image-repeat"]=!0,m["border-image-slice"]=!0,m["border-image-source"]=!0,m["border-image-width"]=!0,m["border-left"]=!0,m["border-left-color"]=!0,m["border-left-style"]=!0,m["border-left-width"]=!0,m["border-radius"]=!0,m["border-right"]=!0,m["border-right-color"]=!0,m["border-right-style"]=!0,m["border-right-width"]=!0,m["border-spacing"]=!0,m["border-style"]=!0,m["border-top"]=!0,m["border-top-color"]=!0,m["border-top-left-radius"]=!0,m["border-top-right-radius"]=!0,m["border-top-style"]=!0,m["border-top-width"]=!0,m["border-width"]=!0,m.bottom=!1,m["box-decoration-break"]=!0,m["box-shadow"]=!0,m["box-sizing"]=!0,m["box-snap"]=!0,m["box-suppress"]=!0,m["break-after"]=!0,m["break-before"]=!0,m["break-inside"]=!0,m["caption-side"]=!1,m.chains=!1,m.clear=!0,m.clip=!1,m["clip-path"]=!1,m["clip-rule"]=!1,m.color=!0,m["color-interpolation-filters"]=!0,m["column-count"]=!1,m["column-fill"]=!1,m["column-gap"]=!1,m["column-rule"]=!1,m["column-rule-color"]=!1,m["column-rule-style"]=!1,m["column-rule-width"]=!1,m["column-span"]=!1,m["column-width"]=!1,m.columns=!1,m.contain=!1,m.content=!1,m["counter-increment"]=!1,m["counter-reset"]=!1,m["counter-set"]=!1,m.crop=!1,m.cue=!1,m["cue-after"]=!1,m["cue-before"]=!1,m.cursor=!1,m.direction=!1,m.display=!0,m["display-inside"]=!0,m["display-list"]=!0,m["display-outside"]=!0,m["dominant-baseline"]=!1,m.elevation=!1,m["empty-cells"]=!1,m.filter=!1,m.flex=!1,m["flex-basis"]=!1,m["flex-direction"]=!1,m["flex-flow"]=!1,m["flex-grow"]=!1,m["flex-shrink"]=!1,m["flex-wrap"]=!1,m.float=!1,m["float-offset"]=!1,m["flood-color"]=!1,m["flood-opacity"]=!1,m["flow-from"]=!1,m["flow-into"]=!1,m.font=!0,m["font-family"]=!0,m["font-feature-settings"]=!0,m["font-kerning"]=!0,m["font-language-override"]=!0,m["font-size"]=!0,m["font-size-adjust"]=!0,m["font-stretch"]=!0,m["font-style"]=!0,m["font-synthesis"]=!0,m["font-variant"]=!0,m["font-variant-alternates"]=!0,m["font-variant-caps"]=!0,m["font-variant-east-asian"]=!0,m["font-variant-ligatures"]=!0,m["font-variant-numeric"]=!0,m["font-variant-position"]=!0,m["font-weight"]=!0,m.grid=!1,m["grid-area"]=!1,m["grid-auto-columns"]=!1,m["grid-auto-flow"]=!1,m["grid-auto-rows"]=!1,m["grid-column"]=!1,m["grid-column-end"]=!1,m["grid-column-start"]=!1,m["grid-row"]=!1,m["grid-row-end"]=!1,m["grid-row-start"]=!1,m["grid-template"]=!1,m["grid-template-areas"]=!1,m["grid-template-columns"]=!1,m["grid-template-rows"]=!1,m["hanging-punctuation"]=!1,m.height=!0,m.hyphens=!1,m.icon=!1,m["image-orientation"]=!1,m["image-resolution"]=!1,m["ime-mode"]=!1,m["initial-letters"]=!1,m["inline-box-align"]=!1,m["justify-content"]=!1,m["justify-items"]=!1,m["justify-self"]=!1,m.left=!1,m["letter-spacing"]=!0,m["lighting-color"]=!0,m["line-box-contain"]=!1,m["line-break"]=!1,m["line-grid"]=!1,m["line-height"]=!1,m["line-snap"]=!1,m["line-stacking"]=!1,m["line-stacking-ruby"]=!1,m["line-stacking-shift"]=!1,m["line-stacking-strategy"]=!1,m["list-style"]=!0,m["list-style-image"]=!0,m["list-style-position"]=!0,m["list-style-type"]=!0,m.margin=!0,m["margin-bottom"]=!0,m["margin-left"]=!0,m["margin-right"]=!0,m["margin-top"]=!0,m["marker-offset"]=!1,m["marker-side"]=!1,m.marks=!1,m.mask=!1,m["mask-box"]=!1,m["mask-box-outset"]=!1,m["mask-box-repeat"]=!1,m["mask-box-slice"]=!1,m["mask-box-source"]=!1,m["mask-box-width"]=!1,m["mask-clip"]=!1,m["mask-image"]=!1,m["mask-origin"]=!1,m["mask-position"]=!1,m["mask-repeat"]=!1,m["mask-size"]=!1,m["mask-source-type"]=!1,m["mask-type"]=!1,m["max-height"]=!0,m["max-lines"]=!1,m["max-width"]=!0,m["min-height"]=!0,m["min-width"]=!0,m["move-to"]=!1,m["nav-down"]=!1,m["nav-index"]=!1,m["nav-left"]=!1,m["nav-right"]=!1,m["nav-up"]=!1,m["object-fit"]=!1,m["object-position"]=!1,m.opacity=!1,m.order=!1,m.orphans=!1,m.outline=!1,m["outline-color"]=!1,m["outline-offset"]=!1,m["outline-style"]=!1,m["outline-width"]=!1,m.overflow=!1,m["overflow-wrap"]=!1,m["overflow-x"]=!1,m["overflow-y"]=!1,m.padding=!0,m["padding-bottom"]=!0,m["padding-left"]=!0,m["padding-right"]=!0,m["padding-top"]=!0,m.page=!1,m["page-break-after"]=!1,m["page-break-before"]=!1,m["page-break-inside"]=!1,m["page-policy"]=!1,m.pause=!1,m["pause-after"]=!1,m["pause-before"]=!1,m.perspective=!1,m["perspective-origin"]=!1,m.pitch=!1,m["pitch-range"]=!1,m["play-during"]=!1,m.position=!1,m["presentation-level"]=!1,m.quotes=!1,m["region-fragment"]=!1,m.resize=!1,m.rest=!1,m["rest-after"]=!1,m["rest-before"]=!1,m.richness=!1,m.right=!1,m.rotation=!1,m["rotation-point"]=!1,m["ruby-align"]=!1,m["ruby-merge"]=!1,m["ruby-position"]=!1,m["shape-image-threshold"]=!1,m["shape-outside"]=!1,m["shape-margin"]=!1,m.size=!1,m.speak=!1,m["speak-as"]=!1,m["speak-header"]=!1,m["speak-numeral"]=!1,m["speak-punctuation"]=!1,m["speech-rate"]=!1,m.stress=!1,m["string-set"]=!1,m["tab-size"]=!1,m["table-layout"]=!1,m["text-align"]=!0,m["text-align-last"]=!0,m["text-combine-upright"]=!0,m["text-decoration"]=!0,m["text-decoration-color"]=!0,m["text-decoration-line"]=!0,m["text-decoration-skip"]=!0,m["text-decoration-style"]=!0,m["text-emphasis"]=!0,m["text-emphasis-color"]=!0,m["text-emphasis-position"]=!0,m["text-emphasis-style"]=!0,m["text-height"]=!0,m["text-indent"]=!0,m["text-justify"]=!0,m["text-orientation"]=!0,m["text-overflow"]=!0,m["text-shadow"]=!0,m["text-space-collapse"]=!0,m["text-transform"]=!0,m["text-underline-position"]=!0,m["text-wrap"]=!0,m.top=!1,m.transform=!1,m["transform-origin"]=!1,m["transform-style"]=!1,m.transition=!1,m["transition-delay"]=!1,m["transition-duration"]=!1,m["transition-property"]=!1,m["transition-timing-function"]=!1,m["unicode-bidi"]=!1,m["vertical-align"]=!1,m.visibility=!1,m["voice-balance"]=!1,m["voice-duration"]=!1,m["voice-family"]=!1,m["voice-pitch"]=!1,m["voice-range"]=!1,m["voice-rate"]=!1,m["voice-stress"]=!1,m["voice-volume"]=!1,m.volume=!1,m["white-space"]=!1,m.widows=!1,m.width=!0,m["will-change"]=!1,m["word-break"]=!0,m["word-spacing"]=!0,m["word-wrap"]=!0,m["wrap-flow"]=!1,m["wrap-through"]=!1,m["writing-mode"]=!1,m["z-index"]=!1,m}function n(m,A,v){}function s(m,A,v){}var u=/javascript\s*\:/img;function f(m,A){return u.test(A)?"":A}return _default.whiteList=a(),_default.getDefaultWhiteList=a,_default.onAttr=n,_default.onIgnoreAttr=s,_default.safeAttrValue=f,_default}var util$1,hasRequiredUtil$1;function requireUtil$1(){return hasRequiredUtil$1||(hasRequiredUtil$1=1,util$1={indexOf:function(a,n){var s,u;if(Array.prototype.indexOf)return a.indexOf(n);for(s=0,u=a.length;s/g,e=/"/g,F=/"/g,M=/&#([a-zA-Z0-9]*);?/gim,L=/:?/gim,V=/&newline;?/gim,B=/((j\s*a\s*v\s*a|v\s*b|l\s*i\s*v\s*e)\s*s\s*c\s*r\s*i\s*p\s*t\s*|m\s*o\s*c\s*h\s*a):/gi,z=/e\s*x\s*p\s*r\s*e\s*s\s*s\s*i\s*o\s*n\s*\(.*/gi,b=/u\s*r\s*l\s*\(.*/gi;function W(me){return me.replace(e,""")}function q(me){return me.replace(F,'"')}function Y(me){return me.replace(M,function(ve,we){return we[0]==="x"||we[0]==="X"?String.fromCharCode(parseInt(we.substr(1),16)):String.fromCharCode(parseInt(we,10))})}function X(me){return me.replace(L,":").replace(V," ")}function Q(me){for(var Se="",ve=0,we=me.length;ve",we);if(Ne===-1)break;ve=Ne+3}return Se}function pe(me){var Se=me.split("");return Se=Se.filter(function(ve){var we=ve.charCodeAt(0);return we===127?!1:we<=31?we===10||we===13:!0}),Se.join("")}return _default$1.whiteList=u(),_default$1.getDefaultWhiteList=u,_default$1.onTag=m,_default$1.onIgnoreTag=A,_default$1.onTagAttr=v,_default$1.onIgnoreTagAttr=y,_default$1.safeAttrValue=E,_default$1.escapeHtml=T,_default$1.escapeQuote=W,_default$1.unescapeQuote=q,_default$1.escapeHtmlEntities=Y,_default$1.escapeDangerHtml5Entities=X,_default$1.clearNonPrintableCharacter=Q,_default$1.friendlyAttrValue=g,_default$1.escapeAttrValue=J,_default$1.onIgnoreTagStripAll=re,_default$1.StripTagBody=ae,_default$1.stripCommentTag=fe,_default$1.stripBlankChar=pe,_default$1.cssFilter=f,_default$1.getDefaultCSSWhiteList=n,_default$1}var parser$1={},hasRequiredParser$1;function requireParser$1(){if(hasRequiredParser$1)return parser$1;hasRequiredParser$1=1;var a=requireUtil();function n(S){var I=a.spaceIndex(S),e;return I===-1?e=S.slice(1,-1):e=S.slice(1,I+1),e=a.trim(e).toLowerCase(),e.slice(0,1)==="/"&&(e=e.slice(1)),e.slice(-1)==="/"&&(e=e.slice(0,-1)),e}function s(S){return S.slice(0,2)===""||B===z-1){F+=e(S.slice(M,L)),W=S.slice(L,B+1),b=n(W),F+=I(L,F.length,b,W,s(W)),M=B+1,L=!1;continue}if(q==='"'||q==="'")for(var Y=1,X=S.charAt(B-Y);X.trim()===""||X==="=";){if(X==="="){V=q;continue e}X=S.charAt(B-++Y)}}else if(q===V){V=!1;continue}}return M0;I--){var e=S[I];if(e!==" ")return e==="="?I:-1}}function T(S){return S[0]==='"'&&S[S.length-1]==='"'||S[0]==="'"&&S[S.length-1]==="'"}function E(S){return T(S)?S.substr(1,S.length-2):S}return parser$1.parseTag=u,parser$1.parseAttr=m,parser$1}var xss,hasRequiredXss;function requireXss(){if(hasRequiredXss)return xss;hasRequiredXss=1;var a=requireLib$1().FilterCSS,n=require_default(),s=requireParser$1(),u=s.parseTag,f=s.parseAttr,m=requireUtil();function A(S){return S==null}function v(S){var I=m.spaceIndex(S);if(I===-1)return{html:"",closing:S[S.length-2]==="/"};S=m.trim(S.slice(I+1,-1));var e=S[S.length-1]==="/";return e&&(S=m.trim(S.slice(0,-1))),{html:S,closing:e}}function y(S){var I={};for(var e in S)I[e]=S[e];return I}function T(S){var I={};for(var e in S)Array.isArray(S[e])?I[e.toLowerCase()]=S[e].map(function(F){return F.toLowerCase()}):I[e.toLowerCase()]=S[e];return I}function E(S){S=y(S||{}),S.stripIgnoreTag&&(S.onIgnoreTag&&console.error('Notes: cannot use these two options "stripIgnoreTag" and "onIgnoreTag" at the same time'),S.onIgnoreTag=n.onIgnoreTagStripAll),S.whiteList||S.allowList?S.whiteList=T(S.whiteList||S.allowList):S.whiteList=n.whiteList,S.onTag=S.onTag||n.onTag,S.onTagAttr=S.onTagAttr||n.onTagAttr,S.onIgnoreTag=S.onIgnoreTag||n.onIgnoreTag,S.onIgnoreTagAttr=S.onIgnoreTagAttr||n.onIgnoreTagAttr,S.safeAttrValue=S.safeAttrValue||n.safeAttrValue,S.escapeHtml=S.escapeHtml||n.escapeHtml,this.options=S,S.css===!1?this.cssFilter=!1:(S.css=S.css||{},this.cssFilter=new a(S.css))}return E.prototype.process=function(S){if(S=S||"",S=S.toString(),!S)return"";var I=this,e=I.options,F=e.whiteList,M=e.onTag,L=e.onIgnoreTag,V=e.onTagAttr,B=e.onIgnoreTagAttr,z=e.safeAttrValue,b=e.escapeHtml,W=I.cssFilter;e.stripBlankChar&&(S=n.stripBlankChar(S)),e.allowCommentTag||(S=n.stripCommentTag(S));var q=!1;e.stripIgnoreTagBody&&(q=n.StripTagBody(e.stripIgnoreTagBody,L),L=q.onIgnoreTag);var Y=u(S,function(X,Q,g,J,re){var ae={sourcePosition:X,position:Q,isClosing:re,isWhite:Object.prototype.hasOwnProperty.call(F,g)},fe=M(g,J,ae);if(!A(fe))return fe;if(ae.isWhite){if(ae.isClosing)return"";var pe=v(J),me=F[g],Se=f(pe.html,function(ve,we){var Ne=m.indexOf(me,ve)!==-1,De=V(g,ve,we,Ne);return A(De)?Ne?(we=z(g,ve,we,W),we?ve+'="'+we+'"':ve):(De=B(g,ve,we,Ne),A(De)?void 0:De):De});return J="<"+g,Se&&(J+=" "+Se),pe.closing&&(J+=" /"),J+=">",J}else return fe=L(g,J,ae),A(fe)?b(J):fe},b);return q&&(Y=q.remove(Y)),Y},xss=E,xss}var hasRequiredLib;function requireLib(){return hasRequiredLib||(hasRequiredLib=1,function(a,n){var s=require_default(),u=requireParser$1(),f=requireXss();function m(v,y){var T=new f(y);return T.process(v)}n=a.exports=m,n.filterXSS=m,n.FilterXSS=f,function(){for(var v in s)n[v]=s[v];for(var y in u)n[y]=u[y]}(),typeof window<"u"&&(window.filterXSS=a.exports);function A(){return typeof self<"u"&&typeof DedicatedWorkerGlobalScope<"u"&&self instanceof DedicatedWorkerGlobalScope}A()&&(self.filterXSS=a.exports)}(lib$1,lib$1.exports)),lib$1.exports}var siemens={exports:{}},hasRequiredSiemens;function requireSiemens(){return hasRequiredSiemens||(hasRequiredSiemens=1,function(a){var n=n||{};n.Utils=n.Utils||(typeof commonjsRequire<"u"?requireUtilities():null),n.Siemens=n.Siemens||function(s){this.output="",this.data=new DataView(s,0)},n.Siemens.CSA2_MAGIC_NUMBER=[83,86,49,48],n.Siemens.NAME_LENGTH=64,n.Siemens.ELEMENT_CSA1=4112,n.Siemens.ELEMENT_CSA2=4128,n.Siemens.GROUP_CSA=41,n.Siemens.prototype.readHeader=function(){var s,u;try{if(this.data.byteLength>n.Siemens.CSA2_MAGIC_NUMBER.length){for(u=!0,s=0;s128)return this.output;for(s+=4,s+=4,f=0;fthis.data.buffer.length?-1:(s+=16,u>0&&(this.output+=this.readString(s,u)+" "),s+u)},n.Siemens.prototype.canRead=function(s,u){return s===n.Siemens.GROUP_CSA&&(u===n.Siemens.ELEMENT_CSA1||u===n.Siemens.ELEMENT_CSA2)},a.exports&&(a.exports=n.Siemens)}(siemens)),siemens.exports}var hasRequiredTag;function requireTag(){return hasRequiredTag||(hasRequiredTag=1,function(a){var n=requireLib(),s=s||{};s.Utils=s.Utils||(typeof commonjsRequire<"u"?requireUtilities():null),s.Dictionary=s.Dictionary||(typeof commonjsRequire<"u"?requireDictionary():null),s.Siemens=s.Siemens||(typeof commonjsRequire<"u"?requireSiemens():null),s.Tag=s.Tag||function(u,f,m,A,v,y,T,E,S){if(this.group=u,this.element=f,this.vr=m,this.offsetStart=v,this.offsetValue=y,this.offsetEnd=T,this.sublist=!1,this.preformatted=!1,this.id=s.Tag.createId(u,f),A instanceof Array)this.value=A,this.sublist=!0;else if(A!==null){var I=new DataView(A);this.value=s.Tag.convertValue(m,I,E,S),this.value===I&&this.isPrivateData()&&(this.value=s.Tag.convertPrivateValue(u,f,I),this.preformatted=this.value!==I)}else this.value=null},s.Tag.PRIVATE_DATA_READERS=[s.Siemens],s.Tag.VR_AE_MAX_LENGTH=16,s.Tag.VR_AS_MAX_LENGTH=4,s.Tag.VR_AT_MAX_LENGTH=4,s.Tag.VR_CS_MAX_LENGTH=16,s.Tag.VR_DA_MAX_LENGTH=8,s.Tag.VR_DS_MAX_LENGTH=16,s.Tag.VR_DT_MAX_LENGTH=26,s.Tag.VR_FL_MAX_LENGTH=4,s.Tag.VR_FD_MAX_LENGTH=8,s.Tag.VR_IS_MAX_LENGTH=12,s.Tag.VR_LO_MAX_LENGTH=64,s.Tag.VR_LT_MAX_LENGTH=10240,s.Tag.VR_OB_MAX_LENGTH=-1,s.Tag.VR_OD_MAX_LENGTH=-1,s.Tag.VR_OF_MAX_LENGTH=-1,s.Tag.VR_OW_MAX_LENGTH=-1,s.Tag.VR_PN_MAX_LENGTH=64*5,s.Tag.VR_SH_MAX_LENGTH=16,s.Tag.VR_SL_MAX_LENGTH=4,s.Tag.VR_SS_MAX_LENGTH=2,s.Tag.VR_ST_MAX_LENGTH=1024,s.Tag.VR_TM_MAX_LENGTH=16,s.Tag.VR_UI_MAX_LENGTH=64,s.Tag.VR_UL_MAX_LENGTH=4,s.Tag.VR_UN_MAX_LENGTH=-1,s.Tag.VR_US_MAX_LENGTH=2,s.Tag.VR_UT_MAX_LENGTH=-1,s.Tag.VR_UC_MAX_LENGTH=-1,s.Tag.TAG_TRANSFER_SYNTAX=[2,16],s.Tag.TAG_META_LENGTH=[2,0],s.Tag.TAG_SUBLIST_ITEM=[65534,57344],s.Tag.TAG_SUBLIST_ITEM_DELIM=[65534,57357],s.Tag.TAG_SUBLIST_SEQ_DELIM=[65534,57565],s.Tag.TAG_ROWS=[40,16],s.Tag.TAG_COLS=[40,17],s.Tag.TAG_ACQUISITION_MATRIX=[24,4880],s.Tag.TAG_NUMBER_OF_FRAMES=[40,8],s.Tag.TAG_NUMBER_TEMPORAL_POSITIONS=[32,261],s.Tag.TAG_PIXEL_SPACING=[40,48],s.Tag.TAG_SLICE_THICKNESS=[24,80],s.Tag.TAG_SLICE_GAP=[24,136],s.Tag.TAG_TR=[24,128],s.Tag.TAG_FRAME_TIME=[24,4195],s.Tag.TAG_BITS_ALLOCATED=[40,256],s.Tag.TAG_BITS_STORED=[40,257],s.Tag.TAG_PIXEL_REPRESENTATION=[40,259],s.Tag.TAG_HIGH_BIT=[40,258],s.Tag.TAG_PHOTOMETRIC_INTERPRETATION=[40,4],s.Tag.TAG_SAMPLES_PER_PIXEL=[40,2],s.Tag.TAG_PLANAR_CONFIG=[40,6],s.Tag.TAG_PALETTE_RED=[40,4609],s.Tag.TAG_PALETTE_GREEN=[40,4610],s.Tag.TAG_PALETTE_BLUE=[40,4611],s.Tag.TAG_DATA_SCALE_SLOPE=[40,4179],s.Tag.TAG_DATA_SCALE_INTERCEPT=[40,4178],s.Tag.TAG_DATA_SCALE_ELSCINT=[519,4127],s.Tag.TAG_PIXEL_BANDWIDTH=[24,149],s.Tag.TAG_IMAGE_MIN=[40,262],s.Tag.TAG_IMAGE_MAX=[40,263],s.Tag.TAG_WINDOW_CENTER=[40,4176],s.Tag.TAG_WINDOW_WIDTH=[40,4177],s.Tag.TAG_SPECIFIC_CHAR_SET=[8,5],s.Tag.TAG_PATIENT_NAME=[16,16],s.Tag.TAG_PATIENT_ID=[16,32],s.Tag.TAG_STUDY_DATE=[8,32],s.Tag.TAG_STUDY_TIME=[8,48],s.Tag.TAG_STUDY_DES=[8,4144],s.Tag.TAG_IMAGE_TYPE=[8,8],s.Tag.TAG_IMAGE_COMMENTS=[32,16384],s.Tag.TAG_SEQUENCE_NAME=[24,36],s.Tag.TAG_MODALITY=[8,96],s.Tag.TAG_FRAME_OF_REF_UID=[32,82],s.Tag.TAG_STUDY_UID=[32,13],s.Tag.TAG_SERIES_DESCRIPTION=[8,4158],s.Tag.TAG_SERIES_INSTANCE_UID=[32,14],s.Tag.TAG_SERIES_NUMBER=[32,17],s.Tag.TAG_ECHO_NUMBER=[24,134],s.Tag.TAG_TEMPORAL_POSITION=[32,256],s.Tag.TAG_IMAGE_NUM=[32,19],s.Tag.TAG_SLICE_LOCATION=[32,4161],s.Tag.TAG_IMAGE_ORIENTATION=[32,55],s.Tag.TAG_IMAGE_POSITION=[32,50],s.Tag.TAG_SLICE_LOCATION_VECTOR=[24,8197],s.Tag.TAG_LUT_SHAPE=[8272,32],s.Tag.TAG_PIXEL_DATA=[32736,16],s.Tag.createId=function(u,f){var m=s.Utils.dec2hex(u),A=s.Utils.dec2hex(f);return m+A},s.Tag.getUnsignedInteger16=function(u,f){var m,A,v;for(A=u.byteLength/2,m=[],v=0;v=4?(v=parseInt(f[A].substring(0,4),10),f[A].length>=6&&(y=s.Utils.safeParseInt(f[A].substring(4,6))-1),f[A].length>=8&&(T=s.Utils.safeParseInt(f[A].substring(6,8))),f[A].length>=10&&(E=s.Utils.safeParseInt(f[A].substring(8,10))),f[A].length>=12&&(S=s.Utils.safeParseInt(f[A].substring(10,12))),f[A].length>=14&&(I=s.Utils.safeParseInt(f[A].substring(12,14))),m[A]=new Date(v,y,T,E,S,I)):m[A]=Date.parse(f[A]),s.Utils.isValidDate(m[A])||(m[A]=f[A]);return m},s.Tag.getTimeStringValue=function(u,f){var m=s.Tag.getStringValue(u),A=[];if(f){var v=null,y,T=0,E=0,S=0;for(y=0;y1&&(E=s.Utils.safeParseInt(v[1])),v.length>2&&(S=s.Utils.safeParseFloat(v[2]))):(m[y].length>=2&&(T=s.Utils.safeParseInt(m[y].substring(0,2))),m[y].length>=4&&(E=s.Utils.safeParseInt(m[y].substring(2,4))),m[y].length>=6&&(S=s.Utils.safeParseFloat(m[y].substring(4)))),A[y]=Math.round(T*60*60*1e3+E*60*1e3+S*1e3);return A}return m},s.Tag.getDoubleStringValue=function(u){var f=s.Tag.getStringValue(u),m=[],A;for(A=0;A"+this.value+"]":m="["+this.value+"]":m="";return this.isSublistItem()?T="Sequence Item":this.isSublistItemDelim()?T="Sequence Item Delimiter":this.isSequenceDelim()?T="Sequence Delimiter":this.isPixelData()?T="Pixel Data":E=s.Utils.convertCamcelCaseToTitleCase(s.Dictionary.getDescription(this.group,this.element)),m=n(m),f?S+""+T+"   "+E+"   "+m:S+" "+T+" "+E+" "+m},s.Tag.prototype.toHTMLString=function(u){return this.toString(u,!0)},s.Tag.prototype.isTransformSyntax=function(){return this.group===s.Tag.TAG_TRANSFER_SYNTAX[0]&&this.element===s.Tag.TAG_TRANSFER_SYNTAX[1]},s.Tag.prototype.isCharset=function(){return this.group===s.Tag.TAG_SPECIFIC_CHAR_SET[0]&&this.element===s.Tag.TAG_SPECIFIC_CHAR_SET[1]},s.Tag.prototype.isPixelData=function(){return this.group===s.Tag.TAG_PIXEL_DATA[0]&&this.element===s.Tag.TAG_PIXEL_DATA[1]},s.Tag.prototype.isPrivateData=function(){return(this.group&1)===1},s.Tag.prototype.hasInterpretedPrivateData=function(){return this.isPrivateData()&&s.Utils.isString(this.value)},s.Tag.prototype.isSublistItem=function(){return this.group===s.Tag.TAG_SUBLIST_ITEM[0]&&this.element===s.Tag.TAG_SUBLIST_ITEM[1]},s.Tag.prototype.isSublistItemDelim=function(){return this.group===s.Tag.TAG_SUBLIST_ITEM_DELIM[0]&&this.element===s.Tag.TAG_SUBLIST_ITEM_DELIM[1]},s.Tag.prototype.isSequenceDelim=function(){return this.group===s.Tag.TAG_SUBLIST_SEQ_DELIM[0]&&this.element===s.Tag.TAG_SUBLIST_SEQ_DELIM[1]},s.Tag.prototype.isMetaLength=function(){return this.group===s.Tag.TAG_META_LENGTH[0]&&this.element===s.Tag.TAG_META_LENGTH[1]},a.exports&&(a.exports=s.Tag)}(tag)),tag.exports}var rle={exports:{}},hasRequiredRle;function requireRle(){return hasRequiredRle||(hasRequiredRle=1,function(a){var n=n||{};n.RLE=n.RLE||function(){this.rawData=null,this.bytesRead=0,this.bytesPut=0,this.segElemPut=0,this.numSegments=0,this.segmentOffsets=[],this.littleEndian=!0,this.segmentIndex=0,this.numElements=0,this.size=0,this.output=null},n.RLE.HEADER_SIZE=64,n.RLE.prototype.decode=function(s,u,f){var m;for(this.rawData=new DataView(s),this.littleEndian=u,this.numElements=f,this.readHeader(),this.output=new DataView(new ArrayBuffer(this.size)),m=0;m=0&&s<128?this.readLiteral(s):s<=-1&&s>-128?this.readEncoded(s):s===-128&&console.warn("RLE: unsupported code!");this.segmentIndex+=1},n.RLE.prototype.readLiteral=function(s){var u,f=s+1;if(this.hasValidInput())for(u=0;u1)for(var m=Array.prototype.slice.call(arguments,1);f--;)u[s-1-f]=n.lossless.Utils.createArray.apply(this,m);return u},n.lossless.Utils.makeCRCTable=function(){for(var s,u=[],f=0;f<256;f++){s=f;for(var m=0;m<8;m++)s=s&1?3988292384^s>>>1:s>>>1;u[f]=s}return u},n.lossless.Utils.crc32=function(s){for(var u=new Uint8Array(s.buffer),f=n.lossless.Utils.crcTable||(n.lossless.Utils.crcTable=n.lossless.Utils.makeCRCTable()),m=-1,A=0;A>>8^f[(m^u[A])&255];return(m^-1)>>>0},a.exports&&(a.exports=n.lossless.Utils)}(utils)),utils.exports}var hasRequiredHuffmanTable;function requireHuffmanTable(){return hasRequiredHuffmanTable||(hasRequiredHuffmanTable=1,function(a){var n=n||{};n.lossless=n.lossless||{},n.lossless.DataStream=n.lossless.DataStream||(typeof commonjsRequire<"u"?requireDataStream():null),n.lossless.Utils=n.lossless.Utils||(typeof commonjsRequire<"u"?requireUtils():null),n.lossless.HuffmanTable=n.lossless.HuffmanTable||function(){this.l=n.lossless.Utils.createArray(4,2,16),this.th=[],this.v=n.lossless.Utils.createArray(4,2,16,200),this.tc=n.lossless.Utils.createArray(4,2),this.tc[0][0]=0,this.tc[1][0]=0,this.tc[2][0]=0,this.tc[3][0]=0,this.tc[0][1]=0,this.tc[1][1]=0,this.tc[2][1]=0,this.tc[3][1]=0,this.th[0]=0,this.th[1]=0,this.th[2]=0,this.th[3]=0},n.lossless.HuffmanTable.MSB=2147483648,n.lossless.HuffmanTable.prototype.read=function(s,u){var f=0,m,A,v,y,T,E;for(m=s.get16(),f+=2;f3)throw new Error("ERROR: Huffman table ID > 3");if(y=A>>4,y>2)throw new Error("ERROR: Huffman table [Table class > 2 ]");for(this.th[v]=1,this.tc[v][y]=1,T=0;T<16;T+=1)this.l[v][y][T]=s.get8(),f+=1;for(T=0;T<16;T+=1)for(E=0;Em)throw new Error("ERROR: Huffman table format error [count>Lh]");this.v[v][y][T][E]=s.get8(),f+=1}}if(f!==m)throw new Error("ERROR: Huffman table format error [count!=Lf]");for(T=0;T<4;T+=1)for(E=0;E<2;E+=1)this.tc[T][E]!==0&&this.buildHuffTable(u[T][E],this.l[T][E],this.v[T][E]);return 1},n.lossless.HuffmanTable.prototype.buildHuffTable=function(s,u,f){var m,A,v,y,T,E;for(A=256,v=0,y=0;y<8;y+=1)for(T=0;T>y+1;E+=1)s[v]=f[y][T]|y+1<<8,v+=1;for(y=1;v<256;y+=1,v+=1)s[v]=y|n.lossless.HuffmanTable.MSB;for(m=1,v=0,y=8;y<16;y+=1)for(T=0;T>y-7;E+=1)s[m*256+v]=f[y][T]|y+1<<8,v+=1;if(v>=256){if(v>256)throw new Error("ERROR: Huffman table error(1)!");v=0,m+=1}}},a.exports&&(a.exports=n.lossless.HuffmanTable)}(huffmanTable)),huffmanTable.exports}var quantizationTable={exports:{}},hasRequiredQuantizationTable;function requireQuantizationTable(){return hasRequiredQuantizationTable||(hasRequiredQuantizationTable=1,function(a){var n=n||{};n.lossless=n.lossless||{},n.lossless.DataStream=n.lossless.DataStream||(typeof commonjsRequire<"u"?requireDataStream():null),n.lossless.Utils=n.lossless.Utils||(typeof commonjsRequire<"u"?requireUtils():null),n.lossless.QuantizationTable=n.lossless.QuantizationTable||function(){this.precision=[],this.tq=[],this.quantTables=n.lossless.Utils.createArray(4,64),this.tq[0]=0,this.tq[1]=0,this.tq[2]=0,this.tq[3]=0},n.lossless.QuantizationTable.enhanceQuantizationTable=function(s,u){var f;for(f=0;f<8;f+=1)s[u[0*8+f]]*=90,s[u[4*8+f]]*=90,s[u[2*8+f]]*=118,s[u[6*8+f]]*=49,s[u[5*8+f]]*=71,s[u[1*8+f]]*=126,s[u[7*8+f]]*=25,s[u[3*8+f]]*=106;for(f=0;f<8;f+=1)s[u[0+8*f]]*=90,s[u[4+8*f]]*=90,s[u[2+8*f]]*=118,s[u[6+8*f]]*=49,s[u[5+8*f]]*=71,s[u[1+8*f]]*=126,s[u[7+8*f]]*=25,s[u[3+8*f]]*=106;for(f=0;f<64;f+=1)s[f]>>=6},n.lossless.QuantizationTable.prototype.read=function(s,u){var f=0,m,A,v,y;for(m=s.get16(),f+=2;f3)throw new Error("ERROR: Quantization table ID > 3");if(this.precision[v]=A>>4,this.precision[v]===0)this.precision[v]=8;else if(this.precision[v]===1)this.precision[v]=16;else throw new Error("ERROR: Quantization table precision error");if(this.tq[v]=1,this.precision[v]===8){for(y=0;y<64;y+=1){if(f>m)throw new Error("ERROR: Quantization table format error");this.quantTables[v][y]=s.get8(),f+=1}n.lossless.QuantizationTable.enhanceQuantizationTable(this.quantTables[v],u)}else{for(y=0;y<64;y+=1){if(f>m)throw new Error("ERROR: Quantization table format error");this.quantTables[v][y]=s.get16(),f+=2}n.lossless.QuantizationTable.enhanceQuantizationTable(this.quantTables[v],u)}}if(f!==m)throw new Error("ERROR: Quantization table error [count!=Lq]");return 1},a.exports&&(a.exports=n.lossless.QuantizationTable)}(quantizationTable)),quantizationTable.exports}var scanHeader={exports:{}},scanComponent={exports:{}},hasRequiredScanComponent;function requireScanComponent(){return hasRequiredScanComponent||(hasRequiredScanComponent=1,function(a){var n=n||{};n.lossless=n.lossless||{},n.lossless.ScanComponent=n.lossless.ScanComponent||function(){this.acTabSel=0,this.dcTabSel=0,this.scanCompSel=0},a.exports&&(a.exports=n.lossless.ScanComponent)}(scanComponent)),scanComponent.exports}var hasRequiredScanHeader;function requireScanHeader(){return hasRequiredScanHeader||(hasRequiredScanHeader=1,function(a){var n=n||{};n.lossless=n.lossless||{},n.lossless.DataStream=n.lossless.DataStream||(typeof commonjsRequire<"u"?requireDataStream():null),n.lossless.ScanComponent=n.lossless.ScanComponent||(typeof commonjsRequire<"u"?requireScanComponent():null),n.lossless.ScanHeader=n.lossless.ScanHeader||function(){this.ah=0,this.al=0,this.numComp=0,this.selection=0,this.spectralEnd=0,this.components=[]},n.lossless.ScanHeader.prototype.read=function(s){var u=0,f,m,A;for(f=s.get16(),u+=2,this.numComp=s.get8(),u+=1,m=0;mf)throw new Error("ERROR: scan header format error");this.components[m].scanCompSel=s.get8(),u+=1,A=s.get8(),u+=1,this.components[m].dcTabSel=A>>4,this.components[m].acTabSel=A&15}if(this.selection=s.get8(),u+=1,this.spectralEnd=s.get8(),u+=1,A=s.get8(),this.ah=A>>4,this.al=A&15,u+=1,u!==f)throw new Error("ERROR: scan header format error [count!=Ns]");return 1},a.exports&&(a.exports=n.lossless.ScanHeader)}(scanHeader)),scanHeader.exports}var frameHeader={exports:{}},hasRequiredFrameHeader;function requireFrameHeader(){return hasRequiredFrameHeader||(hasRequiredFrameHeader=1,function(a){var n=n||{};n.lossless=n.lossless||{},n.lossless.ComponentSpec=n.lossless.ComponentSpec||(typeof commonjsRequire<"u"?requireComponentSpec():null),n.lossless.DataStream=n.lossless.DataStream||(typeof commonjsRequire<"u"?requireDataStream():null),n.lossless.FrameHeader=n.lossless.FrameHeader||function(){this.components=[],this.dimX=0,this.dimY=0,this.numComp=0,this.precision=0},n.lossless.FrameHeader.prototype.read=function(s){var u=0,f,m,A,v;for(f=s.get16(),u+=2,this.precision=s.get8(),u+=1,this.dimY=s.get16(),u+=2,this.dimX=s.get16(),u+=2,this.numComp=s.get8(),u+=1,m=1;m<=this.numComp;m+=1){if(u>f)throw new Error("ERROR: frame format error");if(A=s.get8(),u+=1,u>=f)throw new Error("ERROR: frame format error [c>=Lf]");v=s.get8(),u+=1,this.components[A]||(this.components[A]=new n.lossless.ComponentSpec),this.components[A].hSamp=v>>4,this.components[A].vSamp=v&15,this.components[A].quantTableSel=s.get8(),u+=1}if(u!==f)throw new Error("ERROR: frame format error [Lf!=count]");return 1},a.exports&&(a.exports=n.lossless.FrameHeader)}(frameHeader)),frameHeader.exports}var hasRequiredDecoder;function requireDecoder(){return hasRequiredDecoder||(hasRequiredDecoder=1,function(a){var n=n||{};n.lossless=n.lossless||{},n.lossless.DataStream=n.lossless.DataStream||(typeof commonjsRequire<"u"?requireDataStream():null),n.lossless.HuffmanTable=n.lossless.HuffmanTable||(typeof commonjsRequire<"u"?requireHuffmanTable():null),n.lossless.QuantizationTable=n.lossless.QuantizationTable||(typeof commonjsRequire<"u"?requireQuantizationTable():null),n.lossless.ScanHeader=n.lossless.ScanHeader||(typeof commonjsRequire<"u"?requireScanHeader():null),n.lossless.FrameHeader=n.lossless.FrameHeader||(typeof commonjsRequire<"u"?requireFrameHeader():null),n.lossless.Utils=n.lossless.Utils||(typeof commonjsRequire<"u"?requireUtils():null),n.lossless.Decoder=n.lossless.Decoder||function(u,f){this.buffer=u,this.frame=new n.lossless.FrameHeader,this.huffTable=new n.lossless.HuffmanTable,this.quantTable=new n.lossless.QuantizationTable,this.scan=new n.lossless.ScanHeader,this.DU=n.lossless.Utils.createArray(10,4,64),this.HuffTab=n.lossless.Utils.createArray(4,2,50*256),this.IDCT_Source=[],this.nBlock=[],this.acTab=n.lossless.Utils.createArray(10,1),this.dcTab=n.lossless.Utils.createArray(10,1),this.qTab=n.lossless.Utils.createArray(10,1),this.marker=0,this.markerIndex=0,this.numComp=0,this.restartInterval=0,this.selection=0,this.xDim=0,this.yDim=0,this.xLoc=0,this.yLoc=0,this.numBytes=0,this.outputData=null,this.restarting=!1,this.mask=0,typeof f<"u"&&(this.numBytes=f)},n.lossless.Decoder.IDCT_P=[0,5,40,16,45,2,7,42,21,56,8,61,18,47,1,4,41,23,58,13,32,24,37,10,63,17,44,3,6,43,20,57,15,34,29,48,53,26,39,9,60,19,46,22,59,12,33,31,50,55,25,36,11,62,14,35,28,49,52,27,38,30,51,54],n.lossless.Decoder.TABLE=[0,1,5,6,14,15,27,28,2,4,7,13,16,26,29,42,3,8,12,17,25,30,41,43,9,11,18,24,31,40,44,53,10,19,23,32,39,45,52,54,20,22,33,38,46,51,55,60,21,34,37,47,50,56,59,61,35,36,48,49,57,58,62,63],n.lossless.Decoder.MAX_HUFFMAN_SUBTREE=50,n.lossless.Decoder.MSB=2147483648,n.lossless.Decoder.RESTART_MARKER_BEGIN=65488,n.lossless.Decoder.RESTART_MARKER_END=65495,n.lossless.Decoder.prototype.decompress=function(u,f,m){return this.decode(u,f,m).buffer},n.lossless.Decoder.prototype.decode=function(u,f,m,A){var v,y=0,T=[],E,S,I=[],e=[],F;if(typeof u<"u"&&(this.buffer=u),typeof A<"u"&&(this.numBytes=A),this.stream=new n.lossless.DataStream(this.buffer,f,m),this.buffer=null,this.xLoc=0,this.yLoc=0,v=this.stream.get16(),v!==65496)throw new Error("Not a JPEG file");for(v=this.stream.get16();v>>4!==4092||v===65476;){switch(v){case 65476:this.huffTable.read(this.stream,this.HuffTab);break;case 65484:throw new Error("Program doesn't support arithmetic coding. (format throw new IOException)");case 65499:this.quantTable.read(this.stream,n.lossless.Decoder.TABLE);break;case 65501:this.restartInterval=this.readNumber();break;case 65504:case 65505:case 65506:case 65507:case 65508:case 65509:case 65510:case 65511:case 65512:case 65513:case 65514:case 65515:case 65516:case 65517:case 65518:case 65519:this.readApp();break;case 65534:this.readComment();break;default:if(v>>8!==255)throw new Error("ERROR: format throw new IOException! (decode)")}v=this.stream.get16()}if(v<65472||v>65479)throw new Error("ERROR: could not handle arithmetic code!");this.frame.read(this.stream),v=this.stream.get16();do{for(;v!==65498;){switch(v){case 65476:this.huffTable.read(this.stream,this.HuffTab);break;case 65484:throw new Error("Program doesn't support arithmetic coding. (format throw new IOException)");case 65499:this.quantTable.read(this.stream,n.lossless.Decoder.TABLE);break;case 65501:this.restartInterval=this.readNumber();break;case 65504:case 65505:case 65506:case 65507:case 65508:case 65509:case 65510:case 65511:case 65512:case 65513:case 65514:case 65515:case 65516:case 65517:case 65518:case 65519:this.readApp();break;case 65534:this.readComment();break;default:if(v>>8!==255)throw new Error("ERROR: format throw new IOException! (Parser.decode)")}v=this.stream.get16()}switch(this.precision=this.frame.precision,this.components=this.frame.components,this.numBytes||(this.numBytes=parseInt(Math.ceil(this.precision/8))),this.numBytes==1?this.mask=255:this.mask=65535,this.scan.read(this.stream),this.numComp=this.scan.numComp,this.selection=this.scan.selection,this.numBytes===1?this.numComp===3?(this.getter=this.getValueRGB,this.setter=this.setValueRGB,this.output=this.outputRGB):(this.getter=this.getValue8,this.setter=this.setValue8,this.output=this.outputSingle):(this.getter=this.getValue16,this.setter=this.setValue16,this.output=this.outputSingle),this.selection){case 2:this.selector=this.select2;break;case 3:this.selector=this.select3;break;case 4:this.selector=this.select4;break;case 5:this.selector=this.select5;break;case 6:this.selector=this.select6;break;case 7:this.selector=this.select7;break;default:this.selector=this.select1;break}for(this.scanComps=this.scan.components,this.quantTables=this.quantTable.quantTables,E=0;E=n.lossless.Decoder.RESTART_MARKER_BEGIN&&v<=n.lossless.Decoder.RESTART_MARKER_END))break}v===65500&&y===1&&(this.readNumber(),v=this.stream.get16())}while(v!==65497&&this.xLoc>1)},n.lossless.Decoder.prototype.select6=function(u){return this.getPreviousY(u)+(this.getPreviousX(u)-this.getPreviousXY(u)>>1)},n.lossless.Decoder.prototype.select7=function(u){return(this.getPreviousX(u)+this.getPreviousY(u))/2},n.lossless.Decoder.prototype.decodeRGB=function(u,f,m){var A,v,y,T,E,S,I,e;for(u[0]=this.selector(0),u[1]=this.selector(1),u[2]=this.selector(2),E=0;E=65280)return A;for(u[E]=this.IDCT_Source[0]=u[E]+this.getn(m,A,f,m),this.IDCT_Source[0]*=T[0],e=1;e<64;e+=1){if(A=this.getHuffmanValue(v,f,m),A>=65280)return A;if(e+=A>>4,A&15)this.IDCT_Source[n.lossless.Decoder.IDCT_P[e]]=this.getn(m,A&15,f,m)*T[e];else if(!(A>>4))break}}return 0},n.lossless.Decoder.prototype.decodeSingle=function(u,f,m){var A,v,y,T;for(this.restarting?(this.restarting=!1,u[0]=1<=65280)return A;if(y=this.getn(u,A,f,m),T=y>>8,T>=n.lossless.Decoder.RESTART_MARKER_BEGIN&&T<=n.lossless.Decoder.RESTART_MARKER_END)return T;u[0]+=y}return 0},n.lossless.Decoder.prototype.getHuffmanValue=function(u,f,m){var A,v,y;if(y=65535,m[0]<8?(f[0]<<=8,v=this.stream.get8(),v===255&&(this.marker=this.stream.get8(),this.marker!==0&&(this.markerIndex=9)),f[0]|=v):m[0]-=8,A=u[f[0]>>m[0]],A&n.lossless.Decoder.MSB){if(this.markerIndex!==0)return this.markerIndex=0,65280|this.marker;f[0]&=y>>16-m[0],f[0]<<=8,v=this.stream.get8(),v===255&&(this.marker=this.stream.get8(),this.marker!==0&&(this.markerIndex=9)),f[0]|=v,A=u[(A&255)*256+(f[0]>>m[0])],m[0]+=8}if(m[0]+=8-(A>>8),m[0]<0)throw new Error("index="+m[0]+" temp="+f[0]+" code="+A+" in HuffmanValue()");return m[0]>16-m[0],A&255)},n.lossless.Decoder.prototype.getn=function(u,f,m,A){var v,y,T,E,S;if(y=1,T=-1,E=65535,f===0)return 0;if(f===16)return u[0]>=0?-32768:32768;if(A[0]-=f,A[0]>=0){if(A[0]>A[0],m[0]&=E>>16-A[0]}else{if(m[0]<<=8,S=this.stream.get8(),S===255&&(this.marker=this.stream.get8(),this.marker!==0&&(this.markerIndex=9)),m[0]|=S,A[0]+=8,A[0]<0){if(this.markerIndex!==0)return this.markerIndex=0,(65280|this.marker)<<8;m[0]<<=8,S=this.stream.get8(),S===255&&(this.marker=this.stream.get8(),this.marker!==0&&(this.markerIndex=9)),m[0]|=S,A[0]+=8}if(A[0]<0)throw new Error("index="+A[0]+" in getn()");if(A[0]>A[0],m[0]&=E>>16-A[0]}return v0?this.getter(this.yLoc*this.xDim+this.xLoc-1,u):this.yLoc>0?this.getPreviousY(u):1<0&&this.yLoc>0?this.getter((this.yLoc-1)*this.xDim+this.xLoc-1,u):this.getPreviousY(u)},n.lossless.Decoder.prototype.getPreviousY=function(u){return this.yLoc>0?this.getter((this.yLoc-1)*this.xDim+this.xLoc,u):this.getPreviousX(u)},n.lossless.Decoder.prototype.isLastPixel=function(){return this.xLoc===this.xDim-1&&this.yLoc===this.yDim-1},n.lossless.Decoder.prototype.outputSingle=function(u){this.xLoc=this.xDim&&(this.yLoc+=1,this.xLoc=0))},n.lossless.Decoder.prototype.outputRGB=function(u){var f=this.yLoc*this.xDim+this.xLoc;this.xLoc=this.xDim&&(this.yLoc+=1,this.xLoc=0))},n.lossless.Decoder.prototype.setValue8=function(u,f){this.outputData[u]=f},n.lossless.Decoder.prototype.getValue8=function(u){return this.outputData[u]};var s=function(){var u=new ArrayBuffer(2);return new DataView(u).setInt16(0,256,!0),new Int16Array(u)[0]===256}();s?(n.lossless.Decoder.prototype.setValue16=n.lossless.Decoder.prototype.setValue8,n.lossless.Decoder.prototype.getValue16=n.lossless.Decoder.prototype.getValue8):(n.lossless.Decoder.prototype.setValue16=function(u,f){this.outputData[u]=(f&255)<<8|f>>8&255},n.lossless.Decoder.prototype.getValue16=function(u){var f=this.outputData[u];return(f&255)<<8|f>>8&255}),n.lossless.Decoder.prototype.setValueRGB=function(u,f,m){this.outputData[u*3+m]=f},n.lossless.Decoder.prototype.getValueRGB=function(u,f){return this.outputData[u*3+f]},n.lossless.Decoder.prototype.readApp=function(){var u=0,f=this.stream.get16();for(u+=2;u0&&!b[g-1];)g--;Y.push({children:[],index:0});var J=Y[0],re;for(X=0;X0;)J=Y.pop();for(J.index++,Y.push(J);Y.length<=X;)Y.push(re={children:[],index:0}),J.children[J.index]=re.children,J=re;q++}X+10)return Se--,me>>Se&1;if(me=b[W++],me==255){var We=b[W++];if(We)throw"unexpected marker: "+(me<<8|We).toString(16)}return Se=7,me>>>7}function we(We){for(var Ge=We,xt;(xt=ve())!==null;){if(Ge=Ge[xt],typeof Ge=="number")return Ge;if(typeof Ge!="object")throw"invalid huffman sequence"}return null}function Ne(We){for(var Ge=0;We>0;){var xt=ve();if(xt===null)return;Ge=Ge<<1|xt,We--}return Ge}function De(We){var Ge=Ne(We);return Ge>=1<>4;if(Be===0){if(st<15)break;rt+=16;continue}rt+=st;var Ke=f[rt];We.blockData[Ge+Ke]=De(Be),rt++}}function nt(We,Ge){var xt=we(We.huffmanTableDC),He=xt===0?0:De(xt)<0){ye--;return}for(var xt=H,He=g;xt<=He;){var rt=we(We.huffmanTableAC),ee=rt&15,Be=rt>>4;if(ee===0){if(Be<15){ye=Ne(Be)+(1<>4,st===0)rt<15?(ye=Ne(rt)+(1<=65488&&Le<=65495)W+=2;else break}return W-pe}function V(b,W,q){var Y=b.quantizationTable,X,H,g,J,re,ae,fe,pe,me,Se;for(Se=0;Se<64;Se++)q[Se]=b.blockData[W+Se]*Y[Se];for(Se=0;Se<8;++Se){var ve=8*Se;if(q[1+ve]===0&&q[2+ve]===0&&q[3+ve]===0&&q[4+ve]===0&&q[5+ve]===0&&q[6+ve]===0&&q[7+ve]===0){me=S*q[0+ve]+512>>10,q[0+ve]=me,q[1+ve]=me,q[2+ve]=me,q[3+ve]=me,q[4+ve]=me,q[5+ve]=me,q[6+ve]=me,q[7+ve]=me;continue}X=S*q[0+ve]+128>>8,H=S*q[4+ve]+128>>8,g=q[2+ve],J=q[6+ve],re=I*(q[1+ve]-q[7+ve])+128>>8,pe=I*(q[1+ve]+q[7+ve])+128>>8,ae=q[3+ve]<<4,fe=q[5+ve]<<4,me=X-H+1>>1,X=X+H+1>>1,H=me,me=g*E+J*T+128>>8,g=g*T-J*E+128>>8,J=me,me=re-fe+1>>1,re=re+fe+1>>1,fe=me,me=pe+ae+1>>1,ae=pe-ae+1>>1,pe=me,me=X-J+1>>1,X=X+J+1>>1,J=me,me=H-g+1>>1,H=H+g+1>>1,g=me,me=re*y+pe*v+2048>>12,re=re*v-pe*y+2048>>12,pe=me,me=ae*A+fe*m+2048>>12,ae=ae*m-fe*A+2048>>12,fe=me,q[0+ve]=X+pe,q[7+ve]=X-pe,q[1+ve]=H+fe,q[6+ve]=H-fe,q[2+ve]=g+ae,q[5+ve]=g-ae,q[3+ve]=J+re,q[4+ve]=J-re}for(Se=0;Se<8;++Se){var we=Se;if(q[1*8+we]===0&&q[2*8+we]===0&&q[3*8+we]===0&&q[4*8+we]===0&&q[5*8+we]===0&&q[6*8+we]===0&&q[7*8+we]===0){me=S*q[Se+0]+8192>>14,q[0*8+we]=me,q[1*8+we]=me,q[2*8+we]=me,q[3*8+we]=me,q[4*8+we]=me,q[5*8+we]=me,q[6*8+we]=me,q[7*8+we]=me;continue}X=S*q[0*8+we]+2048>>12,H=S*q[4*8+we]+2048>>12,g=q[2*8+we],J=q[6*8+we],re=I*(q[1*8+we]-q[7*8+we])+2048>>12,pe=I*(q[1*8+we]+q[7*8+we])+2048>>12,ae=q[3*8+we],fe=q[5*8+we],me=X-H+1>>1,X=X+H+1>>1,H=me,me=g*E+J*T+2048>>12,g=g*T-J*E+2048>>12,J=me,me=re-fe+1>>1,re=re+fe+1>>1,fe=me,me=pe+ae+1>>1,ae=pe-ae+1>>1,pe=me,me=X-J+1>>1,X=X+J+1>>1,J=me,me=H-g+1>>1,H=H+g+1>>1,g=me,me=re*y+pe*v+2048>>12,re=re*v-pe*y+2048>>12,pe=me,me=ae*A+fe*m+2048>>12,ae=ae*m-fe*A+2048>>12,fe=me,q[0*8+we]=X+pe,q[7*8+we]=X-pe,q[1*8+we]=H+fe,q[6*8+we]=H-fe,q[2*8+we]=g+ae,q[5*8+we]=g-ae,q[3*8+we]=J+re,q[4*8+we]=J-re}for(Se=0;Se<64;++Se){var Ne=W+Se,De=q[Se];De=De<=-2056/b.bitConversion?0:De>=2024/b.bitConversion?255/b.bitConversion:De+2056/b.bitConversion>>4,b.blockData[Ne]=De}}function B(b,W){for(var q=W.blocksPerLine,Y=W.blocksPerColumn,X=new Int32Array(64),H=0;H=255?255:b|0}return e.prototype={load:function(W){var q=(function(re){this.parse(re),this.onload&&this.onload()}).bind(this);if(W.indexOf("data:")>-1){for(var Y=W.indexOf("base64,")+7,X=atob(W.substring(Y)),H=new Uint8Array(X.length),g=X.length-1;g>=0;g--)H[g]=X.charCodeAt(g);q(X)}else{var J=new XMLHttpRequest;J.open("GET",W,!0),J.responseType="arraybuffer",J.onload=(function(){var re=new Uint8Array(J.response);q(re)}).bind(this),J.send(null)}},parse:function(W){function q(){var ee=W[H]<<8|W[H+1];return H+=2,ee}function Y(){var ee=q(),Be=W.subarray(H,H+ee-2);return H+=Be.length,Be}function X(ee){for(var Be=Math.ceil(ee.samplesPerLine/8/ee.maxH),st=Math.ceil(ee.scanLines/8/ee.maxV),Ke=0;Ke>4)if(Ue>>4===1)for(we=0;we<64;we++){var pt=f[we];ye[pt]=q()}else throw"DQT: invalid table spec";else for(we=0;we<64;we++){var ut=f[we];ye[ut]=W[H++]}fe[Ue&15]=ye}break;case 65472:case 65473:case 65474:if(re)throw"Only single frame JPEGs supported";q(),re={},re.extended=Se===65473,re.progressive=Se===65474,re.precision=W[H++],re.scanLines=q(),re.samplesPerLine=q(),re.components=[],re.componentIds={};var It=W[H++],Lt,Ot=0,Et=0;for(ve=0;ve>4,Ze=W[H+1]&15;Ot>4?pe:me)[Ie&15]=F(Fe,ze)}break;case 65501:q(),ae=q();break;case 65498:q();var Le=W[H++],qe=[],_e;for(ve=0;ve>4],_e.huffmanTableAC=pe[We&15],qe.push(_e)}var Ge=W[H++],xt=W[H++],He=W[H++],rt=L(W,H,re,qe,ae,Ge,xt,He>>4,He&15);H+=rt;break;default:if(W[H-3]==255&&W[H-2]>=192&&W[H-2]<=254){H-=3;break}throw"unknown JPEG marker "+Se.toString(16)}Se=q()}switch(this.width=re.samplesPerLine,this.height=re.scanLines,this.jfif=g,this.adobe=J,this.components=[],re.components.length){case 1:this.colorspace=n.Grayscale;break;case 3:this.adobe?this.colorspace=n.AdobeRGB:this.colorspace=n.RGB;break;case 4:this.colorspace=n.CYMK;break;default:this.colorspace=n.Unknown}for(var ve=0;ve>24&255,Le>>16&255,Le>>8&255,Le&255);A("Unsupported header type "+Le+" ("+Ge+")");break}_e&&(Ie+=qe)}},parseImageProperties:function(Me){for(var Qe=Me.getByte();Qe>=0;){var Ie=Qe;Qe=Me.getByte();var Fe=Ie<<8|Qe;if(Fe===65361){Me.skip(4);var at=Me.getInt32()>>>0,ze=Me.getInt32()>>>0,Le=Me.getInt32()>>>0,qe=Me.getInt32()>>>0;Me.skip(16);var _e=Me.getUint16();this.width=at-Le,this.height=ze-qe,this.componentsCount=_e,this.bitsPerComponent=8;return}}throw new Error("JPX Error: No size marker found in JPX stream")},parseCodestream:function(Me,Qe,Ie){var Fe={};try{for(var at=!1,ze=Qe;ze+1>5,We=[];_e>3,vt.mu=0):(vt.epsilon=Me[_e]>>3,vt.mu=(Me[_e]&7)<<8|Me[_e+1],_e+=2),We.push(vt)}ft.SPqcds=We,Fe.mainHeader?Fe.QCD=ft:(Fe.currentTile.QCD=ft,Fe.currentTile.QCC=[]);break;case 65373:qe=M(Me,ze);var Re={};_e=ze+2;var Ye;switch(Fe.SIZ.Csiz<257?Ye=Me[_e++]:(Ye=M(Me,_e),_e+=2),Je=Me[_e++],Je&31){case 0:Ge=8,xt=!0;break;case 1:Ge=16,xt=!1;break;case 2:Ge=16,xt=!0;break;default:throw new Error("JPX Error: Invalid SQcd value "+Je)}for(Re.noQuantization=Ge===8,Re.scalarExpounded=xt,Re.guardBits=Je>>5,We=[];_e>3,vt.mu=0):(vt.epsilon=Me[_e]>>3,vt.mu=(Me[_e]&7)<<8|Me[_e+1],_e+=2),We.push(vt);Re.SPqcds=We,Fe.mainHeader?Fe.QCC[Ye]=Re:Fe.currentTile.QCC[Ye]=Re;break;case 65362:qe=M(Me,ze);var ue={};_e=ze+2;var Ae=Me[_e++];ue.entropyCoderWithCustomPrecincts=!!(Ae&1),ue.sopMarkerUsed=!!(Ae&2),ue.ephMarkerUsed=!!(Ae&4),ue.progressionOrder=Me[_e++],ue.layersCount=M(Me,_e),_e+=2,ue.multipleComponentTransform=Me[_e++],ue.decompositionLevelsCount=Me[_e++],ue.xcb=(Me[_e++]&15)+2,ue.ycb=(Me[_e++]&15)+2;var Vt=Me[_e++];if(ue.selectiveArithmeticCodingBypass=!!(Vt&1),ue.resetContextProbabilities=!!(Vt&2),ue.terminationOnEachCodingPass=!!(Vt&4),ue.verticalyStripe=!!(Vt&8),ue.predictableTermination=!!(Vt&16),ue.segmentationSymbolUsed=!!(Vt&32),ue.reversibleTransformation=Me[_e++],ue.entropyCoderWithCustomPrecincts){for(var ge=[];_e>4})}ue.precinctsSizes=ge}var Ve=[];if(ue.selectiveArithmeticCodingBypass&&Ve.push("selectiveArithmeticCodingBypass"),ue.resetContextProbabilities&&Ve.push("resetContextProbabilities"),ue.terminationOnEachCodingPass&&Ve.push("terminationOnEachCodingPass"),ue.verticalyStripe&&Ve.push("verticalyStripe"),ue.predictableTermination&&Ve.push("predictableTermination"),Ve.length>0)throw at=!0,new Error("JPX Error: Unsupported COD options ("+Ve.join(", ")+")");Fe.mainHeader?Fe.COD=ue:(Fe.currentTile.COD=ue,Fe.currentTile.COC=[]);break;case 65424:qe=M(Me,ze),He={},He.index=M(Me,ze+2),He.length=L(Me,ze+4),He.dataEnd=He.length+ze-2,He.partIndex=Me[ze+8],He.partsCount=Me[ze+9],Fe.mainHeader=!1,He.partIndex===0&&(He.COD=Fe.COD,He.COC=Fe.COC.slice(0),He.QCD=Fe.QCD,He.QCC=Fe.QCC.slice(0)),Fe.currentTile=He;break;case 65427:He=Fe.currentTile,He.partIndex===0&&(ut(Fe,He.index),De(Fe)),qe=He.dataEnd-ze,je(Fe,Me,ze,qe);break;case 65365:case 65367:case 65368:case 65380:qe=M(Me,ze);break;case 65363:throw new Error("JPX Error: Codestream code 0xFF53 (COC) is not implemented");default:throw new Error("JPX Error: Unknown codestream code: "+Le.toString(16))}ze+=qe}}catch(Zt){if(at||this.failOnCorruptedImage)throw Zt;A("Trying to recover from "+Zt.message)}this.tiles=ye(Fe),this.width=Fe.SIZ.Xsiz-Fe.SIZ.XOsiz,this.height=Fe.SIZ.Ysiz-Fe.SIZ.YOsiz,this.componentsCount=Fe.SIZ.Csiz}};function X(Ze,Me){Ze.x0=Math.ceil(Me.XOsiz/Ze.XRsiz),Ze.x1=Math.ceil(Me.Xsiz/Ze.XRsiz),Ze.y0=Math.ceil(Me.YOsiz/Ze.YRsiz),Ze.y1=Math.ceil(Me.Ysiz/Ze.YRsiz),Ze.width=Ze.x1-Ze.x0,Ze.height=Ze.y1-Ze.y0}function H(Ze,Me){for(var Qe=Ze.SIZ,Ie,Fe=[],at=Math.ceil((Qe.Xsiz-Qe.XTOsiz)/Qe.XTsiz),ze=Math.ceil((Qe.Ysiz-Qe.YTOsiz)/Qe.YTsiz),Le=0;Le0?Math.min(Ie.xcb,Fe.PPx-1):Math.min(Ie.xcb,Fe.PPx),Fe.ycb_=Qe>0?Math.min(Ie.ycb,Fe.PPy-1):Math.min(Ie.ycb,Fe.PPy),Fe}function J(Ze,Me,Qe){var Ie=1<Me.trx0?Math.ceil(Me.trx1/Ie)-Math.floor(Me.trx0/Ie):0,_e=Me.try1>Me.try0?Math.ceil(Me.try1/Fe)-Math.floor(Me.try0/Fe):0,Je=qe*_e;Me.precinctParameters={precinctWidth:Ie,precinctHeight:Fe,numprecinctswide:qe,numprecinctshigh:_e,numprecincts:Je,precinctWidthInSubband:ze,precinctHeightInSubband:Le}}function re(Ze,Me,Qe){var Ie=Qe.xcb_,Fe=Qe.ycb_,at=1<>Ie,qe=Me.tby0>>Fe,_e=Me.tbx1+at-1>>Ie,Je=Me.tby1+ze-1>>Fe,We=Me.resolution.precinctParameters,Ge=[],xt=[],He,rt,ee,Be;for(rt=qe;rtft.cbxMax&&(ft.cbxMax=He),rtft.cbyMax&&(ft.cbyMax=rt)):xt[Be]=ft={cbxMin:He,cbyMin:rt,cbxMax:He,cbyMax:rt},ee.precinct=ft}}Me.codeblockParameters={codeblockWidth:Ie,codeblockHeight:Fe,numcodeblockwide:_e-Le+1,numcodeblockhigh:Je-qe+1},Me.codeblocks=Ge,Me.precincts=xt}function ae(Ze,Me,Qe){for(var Ie=[],Fe=Ze.subbands,at=0,ze=Fe.length;atxt.codingStyleParameters.decompositionLevelsCount)){for(var He=xt.resolutions[_e],rt=He.precinctParameters.numprecincts;Wext.codingStyleParameters.decompositionLevelsCount)){for(var He=xt.resolutions[qe],rt=He.precinctParameters.numprecincts;Weee.codingStyleParameters.decompositionLevelsCount)){var Be=ee.resolutions[Le],st=Be.precinctParameters.numprecincts;if(!(_e>=st)){for(;ze=0;--ee){var Be=qe.resolutions[ee],st=rt*Be.precinctParameters.precinctWidth,Ke=rt*Be.precinctParameters.precinctHeight;We=Math.min(We,st),Ge=Math.min(Ge,Ke),xt=Math.max(xt,Be.precinctParameters.numprecinctswide),He=Math.max(He,Be.precinctParameters.numprecinctshigh),Je[ee]={width:st,height:Ke},rt<<=1}Qe=Math.min(Qe,We),Ie=Math.min(Ie,Ge),Fe=Math.max(Fe,xt),at=Math.max(at,He),ze[Le]={resolutions:Je,minWidth:We,minHeight:Ge,maxNumWide:xt,maxNumHigh:He}}return{components:ze,minWidth:Qe,minHeight:Ie,maxNumWide:Fe,maxNumHigh:at}}function De(Ze){for(var Me=Ze.SIZ,Qe=Ze.currentTile.index,Ie=Ze.tiles[Qe],Fe=Me.Csiz,at=0;at=Me.length)throw new Error("Unexpected EOF");var Nt=Me[Qe+Fe];Fe++,Le?(at=at<<7|Nt,ze+=7,Le=!1):(at=at<<8|Nt,ze+=8),Nt===255&&(Le=!0)}return ze-=xe,at>>>ze&(1<=Me.length)return;if(Zt.isAboveThreshold())break;if(Zt.isKnown()){Zt.nextLevel();continue}if(qe(1))if(Zt.setKnown(),Zt.isLeaf()){vt.included=!0,ge=Ut=!0;break}else Zt.nextLevel();else Zt.incrementValue()}}if(ge){if(Ut){for(ot=ue.zeroBitPlanesTree,ot.reset(Ae,Vt);;){if(Fe>=Me.length)return;if(qe(1)){if(Ve=!ot.nextLevel(),Ve)break}else ot.incrementValue()}vt.zeroBitPlanes=ot.value}for(var be=Ge();qe(1);)vt.Lblock++;var se=F(be),lt=(be<1<0;){var Pe=ft.shift();vt=Pe.codeblock,vt.data===void 0&&(vt.data=[]),vt.data.push({data:Me,start:Qe+Fe,end:Qe+Fe+Pe.dataLength,codingpasses:Pe.codingpasses}),Fe+=Pe.dataLength}}catch{return}return Fe}function nt(Ze,Me,Qe,Ie,Fe,at,ze,Le){for(var qe=Ie.tbx0,_e=Ie.tby0,Je=Ie.tbx1-Ie.tbx0,We=Ie.codeblocks,Ge=Ie.type.charAt(0)==="H"?1:0,xt=Ie.type.charAt(1)==="H"?Me:0,He=0,rt=We.length;He=at?Ze[Wt]=Ce:Ze[Wt]=Ce*(1<0?1-ee:0));var Ae=Be.subbands[vt],Vt=q[Ae.type],ge=Ge?1:Math.pow(2,We+Vt-ue)*(1+Ye/2048),Ut=_e+ue-1;nt(ft,st,Ke,Ae,ge,Ut,Ge,Je)}He.push({width:st,height:Ke,items:ft})}var Ve=xt.calculate(He,Ie.tcx0,Ie.tcy0);return{left:Ie.tcx0,top:Ie.tcy0,width:Ve.width,height:Ve.height,items:Ve.items}}function ye(Ze){for(var Me=Ze.SIZ,Qe=Ze.components,Ie=Me.Csiz,Fe=[],at=0,ze=Ze.tiles.length;at>2),Ae=Vt+ue,ge=Vt+Ye,Ge[Ke++]=Ae<=0?0:Ae>=ee?255:Ae>>He,Ge[Ke++]=Vt<=0?0:Vt>=ee?255:Vt>>He,Ge[Ke++]=ge<=0?0:ge>=ee?255:ge>>He;else for(ft=0;ft=ee?255:Ae>>He,Ge[Ke++]=Vt<=0?0:Vt>=ee?255:Vt>>He,Ge[Ke++]=ge<=0?0:ge>=ee?255:ge>>He;if(Zt)for(ft=0,Ke=3;ft=st?255:Ut+rt>>He}else for(_e=0;_e=ee?255:Ve+rt>>He,Ke+=Ie}else{var We=Qe[_e].isSigned,Ce=qe[_e].items;if(We)for(Ke=_e,ft=0,vt=Ce.length;ft>=1,Fe>>=1,at++}at--,Le=this.levels[at],Le.items[Le.index]=ze,this.currentLevel=at,delete this.value},incrementValue:function(){var Ie=this.levels[this.currentLevel];Ie.items[Ie.index]++},nextLevel:function(){var Ie=this.currentLevel,Fe=this.levels[Ie],at=Fe.items[Fe.index];return Ie--,Ie<0?(this.value=at,!1):(this.currentLevel=Ie,Fe=this.levels[Ie],Fe.items[Fe.index]=at,!0)}},Me}(),It=function(){function Me(Qe,Ie){var Fe=F(Math.max(Qe,Ie))+1;this.levels=[];for(var at=0;at>=1,Fe>>=1,ze++}this.currentLevel=this.levels.length-1,this.minValue=this.levels[this.currentLevel].items[0]},incrementValue:function(){var Ie=this.levels[this.currentLevel];Ie.items[Ie.index]=Ie.items[Ie.index]+1,Ie.items[Ie.index]>this.minValue&&(this.minValue=Ie.items[Ie.index])},nextLevel:function(){var Ie=this.currentLevel;if(Ie--,Ie<0)return!1;this.currentLevel=Ie;var Fe=this.levels[Ie];return Fe.items[Fe.index]this.minValue&&(this.minValue=Fe.items[Fe.index]),!0},isLeaf:function(){return this.currentLevel===0},isAboveThreshold:function(){var Ie=this.currentLevel,Fe=this.levels[Ie];return Fe.items[Fe.index]>this.currentStopValue},isKnown:function(){var Ie=this.currentLevel,Fe=this.levels[Ie];return Fe.status[Fe.index]>0},setKnown:function(){var Ie=this.currentLevel,Fe=this.levels[Ie];Fe.status[Fe.index]=1}},Me}(),Lt=function(){var Me=17,Qe=18,Ie=new Uint8Array([0,5,8,0,3,7,8,0,4,7,8,0,0,0,0,0,1,6,8,0,3,7,8,0,4,7,8,0,0,0,0,0,2,6,8,0,3,7,8,0,4,7,8,0,0,0,0,0,2,6,8,0,3,7,8,0,4,7,8,0,0,0,0,0,2,6,8,0,3,7,8,0,4,7,8]),Fe=new Uint8Array([0,3,4,0,5,7,7,0,8,8,8,0,0,0,0,0,1,3,4,0,6,7,7,0,8,8,8,0,0,0,0,0,2,3,4,0,6,7,7,0,8,8,8,0,0,0,0,0,2,3,4,0,6,7,7,0,8,8,8,0,0,0,0,0,2,3,4,0,6,7,7,0,8,8,8]),at=new Uint8Array([0,1,2,0,1,2,2,0,2,2,2,0,0,0,0,0,3,4,5,0,4,5,5,0,5,5,5,0,0,0,0,0,6,7,7,0,7,7,7,0,7,7,7,0,0,0,0,0,8,8,8,0,8,8,8,0,8,8,8,0,0,0,0,0,8,8,8,0,8,8,8,0,8,8,8]);function ze(Le,qe,_e,Je,We){this.width=Le,this.height=qe,this.contextLabelTable=_e==="HH"?at:_e==="HL"?Fe:Ie;var Ge=Le*qe;this.neighborsSignificance=new Uint8Array(Ge),this.coefficentsSign=new Uint8Array(Ge),this.coefficentsMagnitude=We>14?new Uint32Array(Ge):We>6?new Uint16Array(Ge):new Uint8Array(Ge),this.processingFlags=new Uint8Array(Ge);var xt=new Uint8Array(Ge);if(Je!==0)for(var He=0;He0,rt=_e+10&&(ee=Je-Ge,He&&(We[ee-1]+=16),rt&&(We[ee+1]+=16),We[ee]+=4),qe+1=Je)break;if(He[Ye]&=st,!(We[Ye]||!xt[Ye])){var Vt=ee[xt[Ye]],ge=qe.readBit(rt,Vt);if(ge){var Ut=this.decodeSignBit(Ae,Re,Ye);Ge[Ye]=Ut,We[Ye]=1,this.setNeighborsSignificance(Ae,Re,Ye),He[Ye]|=ft}Be[Ye]++,He[Ye]|=Ke}}},decodeSignBit:function(qe,_e,Je){var We=this.width,Ge=this.height,xt=this.coefficentsMagnitude,He=this.coefficentsSign,rt,ee,Be,st,Ke,ft;st=_e>0&&xt[Je-1]!==0,_e+10&&xt[Je-We]!==0,qe+1=0?(Ke=9+rt,ft=this.decoder.readBit(this.contexts,Ke)):(Ke=9-rt,ft=this.decoder.readBit(this.contexts,Ke)^1),ft},runMagnitudeRefinementPass:function(){for(var qe=this.decoder,_e=this.width,Je=this.height,We=this.coefficentsMagnitude,Ge=this.neighborsSignificance,xt=this.contexts,He=this.bitsDecoded,rt=this.processingFlags,ee=1,Be=2,st=_e*Je,Ke=_e*4,ft=0,vt;ft>1;Fe=Fe|0;var Le,qe,_e,Je,We=-1.586134342059924,Ge=-.052980118572961,xt=.882911075530934,He=.443506852043971,rt=1.230174104914001,ee=1/rt;for(Le=Fe-3,qe=ze+4;qe--;Le+=2)Ie[Le]*=ee;for(Le=Fe-2,_e=He*Ie[Le-1],qe=ze+3;qe--&&(Je=He*Ie[Le+1],Ie[Le]=rt*Ie[Le]-_e-Je,qe--);Le+=2)Le+=2,_e=He*Ie[Le+1],Ie[Le]=rt*Ie[Le]-_e-Je;for(Le=Fe-1,_e=xt*Ie[Le-1],qe=ze+2;qe--&&(Je=xt*Ie[Le+1],Ie[Le]-=_e+Je,qe--);Le+=2)Le+=2,_e=xt*Ie[Le+1],Ie[Le]-=_e+Je;for(Le=Fe,_e=Ge*Ie[Le-1],qe=ze+1;qe--&&(Je=Ge*Ie[Le+1],Ie[Le]-=_e+Je,qe--);Le+=2)Le+=2,_e=Ge*Ie[Le+1],Ie[Le]-=_e+Je;if(ze!==0)for(Le=Fe+1,_e=We*Ie[Le-1],qe=ze;qe--&&(Je=We*Ie[Le+1],Ie[Le]-=_e+Je,qe--);Le+=2)Le+=2,_e=We*Ie[Le+1],Ie[Le]-=_e+Je},Me}(),Rt=function(){function Me(){Ot.call(this)}return Me.prototype=Object.create(Ot.prototype),Me.prototype.filter=function(Ie,Fe,at){var ze=at>>1;Fe=Fe|0;var Le,qe;for(Le=Fe,qe=ze+1;qe--;Le+=2)Ie[Le]-=Ie[Le-1]+Ie[Le+1]+2>>2;for(Le=Fe+1,qe=ze;qe--;Le+=2)Ie[Le]+=Ie[Le-1]+Ie[Le+1]>>1},Me}();return Y}(),s=function(){var q=[{qe:22017,nmps:1,nlps:1,switchFlag:1},{qe:13313,nmps:2,nlps:6,switchFlag:0},{qe:6145,nmps:3,nlps:9,switchFlag:0},{qe:2753,nmps:4,nlps:12,switchFlag:0},{qe:1313,nmps:5,nlps:29,switchFlag:0},{qe:545,nmps:38,nlps:33,switchFlag:0},{qe:22017,nmps:7,nlps:6,switchFlag:1},{qe:21505,nmps:8,nlps:14,switchFlag:0},{qe:18433,nmps:9,nlps:14,switchFlag:0},{qe:14337,nmps:10,nlps:14,switchFlag:0},{qe:12289,nmps:11,nlps:17,switchFlag:0},{qe:9217,nmps:12,nlps:18,switchFlag:0},{qe:7169,nmps:13,nlps:20,switchFlag:0},{qe:5633,nmps:29,nlps:21,switchFlag:0},{qe:22017,nmps:15,nlps:14,switchFlag:1},{qe:21505,nmps:16,nlps:14,switchFlag:0},{qe:20737,nmps:17,nlps:15,switchFlag:0},{qe:18433,nmps:18,nlps:16,switchFlag:0},{qe:14337,nmps:19,nlps:17,switchFlag:0},{qe:13313,nmps:20,nlps:18,switchFlag:0},{qe:12289,nmps:21,nlps:19,switchFlag:0},{qe:10241,nmps:22,nlps:19,switchFlag:0},{qe:9217,nmps:23,nlps:20,switchFlag:0},{qe:8705,nmps:24,nlps:21,switchFlag:0},{qe:7169,nmps:25,nlps:22,switchFlag:0},{qe:6145,nmps:26,nlps:23,switchFlag:0},{qe:5633,nmps:27,nlps:24,switchFlag:0},{qe:5121,nmps:28,nlps:25,switchFlag:0},{qe:4609,nmps:29,nlps:26,switchFlag:0},{qe:4353,nmps:30,nlps:27,switchFlag:0},{qe:2753,nmps:31,nlps:28,switchFlag:0},{qe:2497,nmps:32,nlps:29,switchFlag:0},{qe:2209,nmps:33,nlps:30,switchFlag:0},{qe:1313,nmps:34,nlps:31,switchFlag:0},{qe:1089,nmps:35,nlps:32,switchFlag:0},{qe:673,nmps:36,nlps:33,switchFlag:0},{qe:545,nmps:37,nlps:34,switchFlag:0},{qe:321,nmps:38,nlps:35,switchFlag:0},{qe:273,nmps:39,nlps:36,switchFlag:0},{qe:133,nmps:40,nlps:37,switchFlag:0},{qe:73,nmps:41,nlps:38,switchFlag:0},{qe:37,nmps:42,nlps:39,switchFlag:0},{qe:21,nmps:43,nlps:40,switchFlag:0},{qe:9,nmps:44,nlps:41,switchFlag:0},{qe:5,nmps:45,nlps:42,switchFlag:0},{qe:1,nmps:45,nlps:43,switchFlag:0},{qe:22017,nmps:46,nlps:46,switchFlag:0}];function Y(X,H,g){this.data=X,this.bp=H,this.dataEnd=g,this.chigh=X[H],this.clow=0,this.byteIn(),this.chigh=this.chigh<<7&65535|this.clow>>9&127,this.clow=this.clow<<7&65535,this.ct-=7,this.a=32768}return Y.prototype={byteIn:function(){var H=this.data,g=this.bp;if(H[g]===255){var J=H[g+1];J>143?(this.clow+=65280,this.ct=8):(g++,this.clow+=H[g]<<9,this.ct=7,this.bp=g)}else g++,this.clow+=g65535&&(this.chigh+=this.clow>>16,this.clow&=65535)},readBit:function(H,g){var J=H[g]>>1,re=H[g]&1,ae=q[J],fe=ae.qe,pe,me=this.a-fe;if(this.chigh>15&1,this.clow=this.clow<<1&65535,this.ct--;while(!(me&32768));return this.a=me,H[g]=J<<1|re,pe}},Y}(),u=typeof window>"u"?commonjsGlobal:window;u.PDFJS||(u.PDFJS={});var f=f||{};f.VERBOSITY_LEVELS={errors:0,warnings:1,infos:5},f.OPS={dependency:1,setLineWidth:2,setLineCap:3,setLineJoin:4,setMiterLimit:5,setDash:6,setRenderingIntent:7,setFlatness:8,setGState:9,save:10,restore:11,transform:12,moveTo:13,lineTo:14,curveTo:15,curveTo2:16,curveTo3:17,closePath:18,rectangle:19,stroke:20,closeStroke:21,fill:22,eoFill:23,fillStroke:24,eoFillStroke:25,closeFillStroke:26,closeEOFillStroke:27,endPath:28,clip:29,eoClip:30,beginText:31,endText:32,setCharSpacing:33,setWordSpacing:34,setHScale:35,setLeading:36,setFont:37,setTextRenderingMode:38,setTextRise:39,moveText:40,setLeadingMoveText:41,setTextMatrix:42,nextLine:43,showText:44,showSpacedText:45,nextLineShowText:46,nextLineSetSpacingShowText:47,setCharWidth:48,setCharWidthAndBounds:49,setStrokeColorSpace:50,setFillColorSpace:51,setStrokeColor:52,setStrokeColorN:53,setFillColor:54,setFillColorN:55,setStrokeGray:56,setFillGray:57,setStrokeRGBColor:58,setFillRGBColor:59,setStrokeCMYKColor:60,setFillCMYKColor:61,shadingFill:62,beginInlineImage:63,beginImageData:64,endInlineImage:65,paintXObject:66,markPoint:67,markPointProps:68,beginMarkedContent:69,beginMarkedContentProps:70,endMarkedContent:71,beginCompat:72,endCompat:73,paintFormXObjectBegin:74,paintFormXObjectEnd:75,beginGroup:76,endGroup:77,beginAnnotations:78,endAnnotations:79,beginAnnotation:80,endAnnotation:81,paintJpegXObject:82,paintImageMaskXObject:83,paintImageMaskXObjectGroup:84,paintImageXObject:85,paintInlineImageXObject:86,paintInlineImageXObjectGroup:87,paintImageXObjectRepeat:88,paintImageMaskXObjectRepeat:89,paintSolidColorImageMask:90,constructPath:91};function m(W){f.verbosity>=f.VERBOSITY_LEVELS.infos&&console.log("Info: "+W)}function A(W){f.verbosity>=f.VERBOSITY_LEVELS.warnings&&console.log("Warning: "+W)}f.UNSUPPORTED_FEATURES={unknown:"unknown",forms:"forms",javaScript:"javaScript",smask:"smask",shadingPattern:"shadingPattern",font:"font"},f.UnsupportedManager=function(){var q=[];return{listen:function(Y){q.push(Y)},notify:function(Y){A('Unsupported feature "'+Y+'"');for(var X=0,H=q.length;Xq;)q<<=1,Y++;return Y}function M(W,q){return W[q]<<8|W[q+1]}function L(W,q){return(W[q]<<24|W[q+1]<<16|W[q+2]<<8|W[q+3])>>>0}function V(){var W=new Uint8Array(2);W[0]=1;var q=new Uint16Array(W.buffer);return q[0]===1}Object.defineProperty(f,"isLittleEndian",{configurable:!0,get:function(){return y(f,"isLittleEndian",V())}});function B(){var W=document.createElement("canvas");W.width=W.height=1;var q=W.getContext("2d"),Y=q.createImageData(1,1);return typeof Y.data.buffer<"u"}Object.defineProperty(f,"hasCanvasTypedArrays",{configurable:!0,get:function(){return y(f,"hasCanvasTypedArrays",B())}});var z=f.Util=function(){function q(){}var Y=["rgb(",0,",",0,",",0,")"];return q.makeCssRgb=function(H,g,J){return Y[1]=H,Y[3]=g,Y[5]=J,Y.join("")},q.transform=function(H,g){return[H[0]*g[0]+H[2]*g[1],H[1]*g[0]+H[3]*g[1],H[0]*g[2]+H[2]*g[3],H[1]*g[2]+H[3]*g[3],H[0]*g[4]+H[2]*g[5]+H[4],H[1]*g[4]+H[3]*g[5]+H[5]]},q.applyTransform=function(H,g){var J=H[0]*g[0]+H[1]*g[2]+g[4],re=H[0]*g[1]+H[1]*g[3]+g[5];return[J,re]},q.applyInverseTransform=function(H,g){var J=g[0]*g[3]-g[1]*g[2],re=(H[0]*g[3]-H[1]*g[2]+g[2]*g[5]-g[4]*g[3])/J,ae=(-H[0]*g[1]+H[1]*g[0]+g[4]*g[1]-g[5]*g[0])/J;return[re,ae]},q.getAxialAlignedBoundingBox=function(H,g){var J=q.applyTransform(H,g),re=q.applyTransform(H.slice(2,4),g),ae=q.applyTransform([H[0],H[3]],g),fe=q.applyTransform([H[2],H[1]],g);return[Math.min(J[0],re[0],ae[0],fe[0]),Math.min(J[1],re[1],ae[1],fe[1]),Math.max(J[0],re[0],ae[0],fe[0]),Math.max(J[1],re[1],ae[1],fe[1])]},q.inverseTransform=function(H){var g=H[0]*H[3]-H[1]*H[2];return[H[3]/g,-H[1]/g,-H[2]/g,H[0]/g,(H[2]*H[5]-H[4]*H[3])/g,(H[4]*H[1]-H[5]*H[0])/g]},q.apply3dTransform=function(H,g){return[H[0]*g[0]+H[1]*g[1]+H[2]*g[2],H[3]*g[0]+H[4]*g[1]+H[5]*g[2],H[6]*g[0]+H[7]*g[1]+H[8]*g[2]]},q.singularValueDecompose2dScale=function(H){var g=[H[0],H[2],H[1],H[3]],J=H[0]*g[0]+H[1]*g[2],re=H[0]*g[1]+H[1]*g[3],ae=H[2]*g[0]+H[3]*g[2],fe=H[2]*g[1]+H[3]*g[3],pe=(J+fe)/2,me=Math.sqrt((J+fe)*(J+fe)-4*(J*fe-ae*re))/2,Se=pe+me||1,ve=pe-me||1;return[Math.sqrt(Se),Math.sqrt(ve)]},q.normalizeRect=function(H){var g=H.slice(0);return H[0]>H[2]&&(g[0]=H[2],g[2]=H[0]),H[1]>H[3]&&(g[1]=H[3],g[3]=H[1]),g},q.intersect=function(H,g){function J(pe,me){return pe-me}var re=[H[0],H[2],g[0],g[2]].sort(J),ae=[H[1],H[3],g[1],g[3]].sort(J),fe=[];if(H=q.normalizeRect(H),g=q.normalizeRect(g),re[0]===H[0]&&re[1]===g[0]||re[0]===g[0]&&re[1]===H[0])fe[0]=re[1],fe[2]=re[2];else return!1;if(ae[0]===H[1]&&ae[1]===g[1]||ae[0]===g[1]&&ae[1]===H[1])fe[1]=ae[1],fe[3]=ae[2];else return!1;return fe},q.sign=function(H){return H<0?-1:1},q.appendToArray=function(H,g){Array.prototype.push.apply(H,g)},q.prependToArray=function(H,g){Array.prototype.unshift.apply(H,g)},q.extendObj=function(H,g){for(var J in g)H[J]=g[J]},q.getInheritableProperty=function(H,g){for(;H&&!H.has(g);)H=H.get("Parent");return H?H.get(g):null},q.inherit=function(H,g,J){H.prototype=Object.create(g.prototype),H.prototype.constructor=H;for(var re in J)H.prototype[re]=J[re]},q.loadScript=function(H,g){var J=document.createElement("script"),re=!1;J.setAttribute("src",H),g&&(J.onload=function(){re||g(),re=!0}),document.getElementsByTagName("head")[0].appendChild(J)},q}();f.PageViewport=function(){function q(Y,X,H,g,J,re){this.viewBox=Y,this.scale=X,this.rotation=H,this.offsetX=g,this.offsetY=J;var ae=(Y[2]+Y[0])/2,fe=(Y[3]+Y[1])/2,pe,me,Se,ve;switch(H=H%360,H=H<0?H+360:H,H){case 180:pe=-1,me=0,Se=0,ve=1;break;case 90:pe=0,me=1,Se=1,ve=0;break;case 270:pe=0,me=-1,Se=-1,ve=0;break;default:pe=1,me=0,Se=0,ve=-1;break}re&&(Se=-Se,ve=-ve);var we,Ne,De,je;pe===0?(we=Math.abs(fe-Y[1])*X+g,Ne=Math.abs(ae-Y[0])*X+J,De=Math.abs(Y[3]-Y[1])*X,je=Math.abs(Y[2]-Y[0])*X):(we=Math.abs(ae-Y[0])*X+g,Ne=Math.abs(fe-Y[1])*X+J,De=Math.abs(Y[2]-Y[0])*X,je=Math.abs(Y[3]-Y[1])*X),this.transform=[pe*X,me*X,Se*X,ve*X,we-pe*X*ae-Se*X*fe,Ne-me*X*ae-ve*X*fe],this.width=De,this.height=je,this.fontScale=X}return q.prototype={clone:function(X){X=X||{};var H="scale"in X?X.scale:this.scale,g="rotation"in X?X.rotation:this.rotation;return new q(this.viewBox.slice(),H,g,this.offsetX,this.offsetY,X.dontFlip)},convertToViewportPoint:function(X,H){return z.applyTransform([X,H],this.transform)},convertToViewportRectangle:function(X){var H=z.applyTransform([X[0],X[1]],this.transform),g=z.applyTransform([X[2],X[3]],this.transform);return[H[0],H[1],g[0],g[1]]},convertToPdfPoint:function(X,H){return z.applyInverseTransform([X,H],this.transform)}},q}();function b(){var W={};return W.promise=new Promise(function(q,Y){W.resolve=q,W.reject=Y}),W}f.createPromiseCapability=b,function(){if(u.Promise){typeof u.Promise.all!="function"&&(u.Promise.all=function(re){var ae=0,fe=[],pe,me,Se=new u.Promise(function(ve,we){pe=ve,me=we});return re.forEach(function(ve,we){ae++,ve.then(function(Ne){fe[we]=Ne,ae--,ae===0&&pe(fe)},me)}),ae===0&&pe(fe),Se}),typeof u.Promise.resolve!="function"&&(u.Promise.resolve=function(re){return new u.Promise(function(ae){ae(re)})}),typeof u.Promise.reject!="function"&&(u.Promise.reject=function(re){return new u.Promise(function(ae,fe){fe(re)})}),typeof u.Promise.prototype.catch2!="function"&&(u.Promise.prototype.catch2=function(re){return u.Promise.prototype.then(void 0,re)});return}var q=0,Y=1,X=2,H=500,g={handlers:[],running:!1,unhandledRejections:[],pendingRejectionCheck:!1,scheduleHandlers:function(ae){ae._status!==q&&(this.handlers=this.handlers.concat(ae._handlers),ae._handlers=[],!this.running&&(this.running=!0,setTimeout(this.runHandlers.bind(this),0)))},runHandlers:function(){for(var ae=1,fe=Date.now()+ae;this.handlers.length>0;){var pe=this.handlers.shift(),me=pe.thisPromise._status,Se=pe.thisPromise._value;try{me===Y?typeof pe.onResolve=="function"&&(Se=pe.onResolve(Se)):typeof pe.onReject=="function"&&(Se=pe.onReject(Se),me=Y,pe.thisPromise._unhandledRejection&&this.removeUnhandeledRejection(pe.thisPromise))}catch(ve){me=X,Se=ve}if(pe.nextPromise._updateStatus(me,Se),Date.now()>=fe)break}if(this.handlers.length>0){setTimeout(this.runHandlers.bind(this),0);return}this.running=!1},addUnhandledRejection:function(ae){this.unhandledRejections.push({promise:ae,time:Date.now()}),this.scheduleRejectionCheck()},removeUnhandeledRejection:function(ae){ae._unhandledRejection=!1;for(var fe=0;feH){var me=this.unhandledRejections[pe].promise._value,Se="Unhandled rejection: "+me;me.stack&&(Se+=` -`+me.stack),A(Se),this.unhandledRejections.splice(pe),pe--}this.unhandledRejections.length&&this.scheduleRejectionCheck()}).bind(this),H))}};function J(re){this._status=q,this._handlers=[];try{re.call(this,this._resolve.bind(this),this._reject.bind(this))}catch(ae){this._reject(ae)}}J.all=function(ae){var fe,pe,me=new J(function(Ue,ye){fe=Ue,pe=ye}),Se=ae.length,ve=[];if(Se===0)return fe(ve),me;function we(Ue){me._status!==X&&(ve=[],pe(Ue))}for(var Ne=0,De=ae.length;Ne>2,ve=(fe&3)<<4|pe>>4,we=re+1>6:64,Ne=re+2"+this.value+"]":m="["+this.value+"]":m="";return this.isSublistItem()?T="Sequence Item":this.isSublistItemDelim()?T="Sequence Item Delimiter":this.isSequenceDelim()?T="Sequence Delimiter":this.isPixelData()?T="Pixel Data":E=s.Utils.convertCamcelCaseToTitleCase(s.Dictionary.getDescription(this.group,this.element)),m=n(m),f?S+""+T+"   "+E+"   "+m:S+" "+T+" "+E+" "+m},s.Tag.prototype.toHTMLString=function(u){return this.toString(u,!0)},s.Tag.prototype.isTransformSyntax=function(){return this.group===s.Tag.TAG_TRANSFER_SYNTAX[0]&&this.element===s.Tag.TAG_TRANSFER_SYNTAX[1]},s.Tag.prototype.isCharset=function(){return this.group===s.Tag.TAG_SPECIFIC_CHAR_SET[0]&&this.element===s.Tag.TAG_SPECIFIC_CHAR_SET[1]},s.Tag.prototype.isPixelData=function(){return this.group===s.Tag.TAG_PIXEL_DATA[0]&&this.element===s.Tag.TAG_PIXEL_DATA[1]},s.Tag.prototype.isPrivateData=function(){return(this.group&1)===1},s.Tag.prototype.hasInterpretedPrivateData=function(){return this.isPrivateData()&&s.Utils.isString(this.value)},s.Tag.prototype.isSublistItem=function(){return this.group===s.Tag.TAG_SUBLIST_ITEM[0]&&this.element===s.Tag.TAG_SUBLIST_ITEM[1]},s.Tag.prototype.isSublistItemDelim=function(){return this.group===s.Tag.TAG_SUBLIST_ITEM_DELIM[0]&&this.element===s.Tag.TAG_SUBLIST_ITEM_DELIM[1]},s.Tag.prototype.isSequenceDelim=function(){return this.group===s.Tag.TAG_SUBLIST_SEQ_DELIM[0]&&this.element===s.Tag.TAG_SUBLIST_SEQ_DELIM[1]},s.Tag.prototype.isMetaLength=function(){return this.group===s.Tag.TAG_META_LENGTH[0]&&this.element===s.Tag.TAG_META_LENGTH[1]},a.exports&&(a.exports=s.Tag)}(tag)),tag.exports}var rle={exports:{}},hasRequiredRle;function requireRle(){return hasRequiredRle||(hasRequiredRle=1,function(a){var n=n||{};n.RLE=n.RLE||function(){this.rawData=null,this.bytesRead=0,this.bytesPut=0,this.segElemPut=0,this.numSegments=0,this.segmentOffsets=[],this.littleEndian=!0,this.segmentIndex=0,this.numElements=0,this.size=0,this.output=null},n.RLE.HEADER_SIZE=64,n.RLE.prototype.decode=function(s,u,f){var m;for(this.rawData=new DataView(s),this.littleEndian=u,this.numElements=f,this.readHeader(),this.output=new DataView(new ArrayBuffer(this.size)),m=0;m=0&&s<128?this.readLiteral(s):s<=-1&&s>-128?this.readEncoded(s):s===-128&&console.warn("RLE: unsupported code!");this.segmentIndex+=1},n.RLE.prototype.readLiteral=function(s){var u,f=s+1;if(this.hasValidInput())for(u=0;u1)for(var m=Array.prototype.slice.call(arguments,1);f--;)u[s-1-f]=n.lossless.Utils.createArray.apply(this,m);return u},n.lossless.Utils.makeCRCTable=function(){for(var s,u=[],f=0;f<256;f++){s=f;for(var m=0;m<8;m++)s=s&1?3988292384^s>>>1:s>>>1;u[f]=s}return u},n.lossless.Utils.crc32=function(s){for(var u=new Uint8Array(s.buffer),f=n.lossless.Utils.crcTable||(n.lossless.Utils.crcTable=n.lossless.Utils.makeCRCTable()),m=-1,A=0;A>>8^f[(m^u[A])&255];return(m^-1)>>>0},a.exports&&(a.exports=n.lossless.Utils)}(utils)),utils.exports}var hasRequiredHuffmanTable;function requireHuffmanTable(){return hasRequiredHuffmanTable||(hasRequiredHuffmanTable=1,function(a){var n=n||{};n.lossless=n.lossless||{},n.lossless.DataStream=n.lossless.DataStream||(typeof commonjsRequire<"u"?requireDataStream():null),n.lossless.Utils=n.lossless.Utils||(typeof commonjsRequire<"u"?requireUtils():null),n.lossless.HuffmanTable=n.lossless.HuffmanTable||function(){this.l=n.lossless.Utils.createArray(4,2,16),this.th=[],this.v=n.lossless.Utils.createArray(4,2,16,200),this.tc=n.lossless.Utils.createArray(4,2),this.tc[0][0]=0,this.tc[1][0]=0,this.tc[2][0]=0,this.tc[3][0]=0,this.tc[0][1]=0,this.tc[1][1]=0,this.tc[2][1]=0,this.tc[3][1]=0,this.th[0]=0,this.th[1]=0,this.th[2]=0,this.th[3]=0},n.lossless.HuffmanTable.MSB=2147483648,n.lossless.HuffmanTable.prototype.read=function(s,u){var f=0,m,A,v,y,T,E;for(m=s.get16(),f+=2;f3)throw new Error("ERROR: Huffman table ID > 3");if(y=A>>4,y>2)throw new Error("ERROR: Huffman table [Table class > 2 ]");for(this.th[v]=1,this.tc[v][y]=1,T=0;T<16;T+=1)this.l[v][y][T]=s.get8(),f+=1;for(T=0;T<16;T+=1)for(E=0;Em)throw new Error("ERROR: Huffman table format error [count>Lh]");this.v[v][y][T][E]=s.get8(),f+=1}}if(f!==m)throw new Error("ERROR: Huffman table format error [count!=Lf]");for(T=0;T<4;T+=1)for(E=0;E<2;E+=1)this.tc[T][E]!==0&&this.buildHuffTable(u[T][E],this.l[T][E],this.v[T][E]);return 1},n.lossless.HuffmanTable.prototype.buildHuffTable=function(s,u,f){var m,A,v,y,T,E;for(A=256,v=0,y=0;y<8;y+=1)for(T=0;T>y+1;E+=1)s[v]=f[y][T]|y+1<<8,v+=1;for(y=1;v<256;y+=1,v+=1)s[v]=y|n.lossless.HuffmanTable.MSB;for(m=1,v=0,y=8;y<16;y+=1)for(T=0;T>y-7;E+=1)s[m*256+v]=f[y][T]|y+1<<8,v+=1;if(v>=256){if(v>256)throw new Error("ERROR: Huffman table error(1)!");v=0,m+=1}}},a.exports&&(a.exports=n.lossless.HuffmanTable)}(huffmanTable)),huffmanTable.exports}var quantizationTable={exports:{}},hasRequiredQuantizationTable;function requireQuantizationTable(){return hasRequiredQuantizationTable||(hasRequiredQuantizationTable=1,function(a){var n=n||{};n.lossless=n.lossless||{},n.lossless.DataStream=n.lossless.DataStream||(typeof commonjsRequire<"u"?requireDataStream():null),n.lossless.Utils=n.lossless.Utils||(typeof commonjsRequire<"u"?requireUtils():null),n.lossless.QuantizationTable=n.lossless.QuantizationTable||function(){this.precision=[],this.tq=[],this.quantTables=n.lossless.Utils.createArray(4,64),this.tq[0]=0,this.tq[1]=0,this.tq[2]=0,this.tq[3]=0},n.lossless.QuantizationTable.enhanceQuantizationTable=function(s,u){var f;for(f=0;f<8;f+=1)s[u[0*8+f]]*=90,s[u[4*8+f]]*=90,s[u[2*8+f]]*=118,s[u[6*8+f]]*=49,s[u[5*8+f]]*=71,s[u[1*8+f]]*=126,s[u[7*8+f]]*=25,s[u[3*8+f]]*=106;for(f=0;f<8;f+=1)s[u[0+8*f]]*=90,s[u[4+8*f]]*=90,s[u[2+8*f]]*=118,s[u[6+8*f]]*=49,s[u[5+8*f]]*=71,s[u[1+8*f]]*=126,s[u[7+8*f]]*=25,s[u[3+8*f]]*=106;for(f=0;f<64;f+=1)s[f]>>=6},n.lossless.QuantizationTable.prototype.read=function(s,u){var f=0,m,A,v,y;for(m=s.get16(),f+=2;f3)throw new Error("ERROR: Quantization table ID > 3");if(this.precision[v]=A>>4,this.precision[v]===0)this.precision[v]=8;else if(this.precision[v]===1)this.precision[v]=16;else throw new Error("ERROR: Quantization table precision error");if(this.tq[v]=1,this.precision[v]===8){for(y=0;y<64;y+=1){if(f>m)throw new Error("ERROR: Quantization table format error");this.quantTables[v][y]=s.get8(),f+=1}n.lossless.QuantizationTable.enhanceQuantizationTable(this.quantTables[v],u)}else{for(y=0;y<64;y+=1){if(f>m)throw new Error("ERROR: Quantization table format error");this.quantTables[v][y]=s.get16(),f+=2}n.lossless.QuantizationTable.enhanceQuantizationTable(this.quantTables[v],u)}}if(f!==m)throw new Error("ERROR: Quantization table error [count!=Lq]");return 1},a.exports&&(a.exports=n.lossless.QuantizationTable)}(quantizationTable)),quantizationTable.exports}var scanHeader={exports:{}},scanComponent={exports:{}},hasRequiredScanComponent;function requireScanComponent(){return hasRequiredScanComponent||(hasRequiredScanComponent=1,function(a){var n=n||{};n.lossless=n.lossless||{},n.lossless.ScanComponent=n.lossless.ScanComponent||function(){this.acTabSel=0,this.dcTabSel=0,this.scanCompSel=0},a.exports&&(a.exports=n.lossless.ScanComponent)}(scanComponent)),scanComponent.exports}var hasRequiredScanHeader;function requireScanHeader(){return hasRequiredScanHeader||(hasRequiredScanHeader=1,function(a){var n=n||{};n.lossless=n.lossless||{},n.lossless.DataStream=n.lossless.DataStream||(typeof commonjsRequire<"u"?requireDataStream():null),n.lossless.ScanComponent=n.lossless.ScanComponent||(typeof commonjsRequire<"u"?requireScanComponent():null),n.lossless.ScanHeader=n.lossless.ScanHeader||function(){this.ah=0,this.al=0,this.numComp=0,this.selection=0,this.spectralEnd=0,this.components=[]},n.lossless.ScanHeader.prototype.read=function(s){var u=0,f,m,A;for(f=s.get16(),u+=2,this.numComp=s.get8(),u+=1,m=0;mf)throw new Error("ERROR: scan header format error");this.components[m].scanCompSel=s.get8(),u+=1,A=s.get8(),u+=1,this.components[m].dcTabSel=A>>4,this.components[m].acTabSel=A&15}if(this.selection=s.get8(),u+=1,this.spectralEnd=s.get8(),u+=1,A=s.get8(),this.ah=A>>4,this.al=A&15,u+=1,u!==f)throw new Error("ERROR: scan header format error [count!=Ns]");return 1},a.exports&&(a.exports=n.lossless.ScanHeader)}(scanHeader)),scanHeader.exports}var frameHeader={exports:{}},hasRequiredFrameHeader;function requireFrameHeader(){return hasRequiredFrameHeader||(hasRequiredFrameHeader=1,function(a){var n=n||{};n.lossless=n.lossless||{},n.lossless.ComponentSpec=n.lossless.ComponentSpec||(typeof commonjsRequire<"u"?requireComponentSpec():null),n.lossless.DataStream=n.lossless.DataStream||(typeof commonjsRequire<"u"?requireDataStream():null),n.lossless.FrameHeader=n.lossless.FrameHeader||function(){this.components=[],this.dimX=0,this.dimY=0,this.numComp=0,this.precision=0},n.lossless.FrameHeader.prototype.read=function(s){var u=0,f,m,A,v;for(f=s.get16(),u+=2,this.precision=s.get8(),u+=1,this.dimY=s.get16(),u+=2,this.dimX=s.get16(),u+=2,this.numComp=s.get8(),u+=1,m=1;m<=this.numComp;m+=1){if(u>f)throw new Error("ERROR: frame format error");if(A=s.get8(),u+=1,u>=f)throw new Error("ERROR: frame format error [c>=Lf]");v=s.get8(),u+=1,this.components[A]||(this.components[A]=new n.lossless.ComponentSpec),this.components[A].hSamp=v>>4,this.components[A].vSamp=v&15,this.components[A].quantTableSel=s.get8(),u+=1}if(u!==f)throw new Error("ERROR: frame format error [Lf!=count]");return 1},a.exports&&(a.exports=n.lossless.FrameHeader)}(frameHeader)),frameHeader.exports}var hasRequiredDecoder;function requireDecoder(){return hasRequiredDecoder||(hasRequiredDecoder=1,function(a){var n=n||{};n.lossless=n.lossless||{},n.lossless.DataStream=n.lossless.DataStream||(typeof commonjsRequire<"u"?requireDataStream():null),n.lossless.HuffmanTable=n.lossless.HuffmanTable||(typeof commonjsRequire<"u"?requireHuffmanTable():null),n.lossless.QuantizationTable=n.lossless.QuantizationTable||(typeof commonjsRequire<"u"?requireQuantizationTable():null),n.lossless.ScanHeader=n.lossless.ScanHeader||(typeof commonjsRequire<"u"?requireScanHeader():null),n.lossless.FrameHeader=n.lossless.FrameHeader||(typeof commonjsRequire<"u"?requireFrameHeader():null),n.lossless.Utils=n.lossless.Utils||(typeof commonjsRequire<"u"?requireUtils():null),n.lossless.Decoder=n.lossless.Decoder||function(u,f){this.buffer=u,this.frame=new n.lossless.FrameHeader,this.huffTable=new n.lossless.HuffmanTable,this.quantTable=new n.lossless.QuantizationTable,this.scan=new n.lossless.ScanHeader,this.DU=n.lossless.Utils.createArray(10,4,64),this.HuffTab=n.lossless.Utils.createArray(4,2,50*256),this.IDCT_Source=[],this.nBlock=[],this.acTab=n.lossless.Utils.createArray(10,1),this.dcTab=n.lossless.Utils.createArray(10,1),this.qTab=n.lossless.Utils.createArray(10,1),this.marker=0,this.markerIndex=0,this.numComp=0,this.restartInterval=0,this.selection=0,this.xDim=0,this.yDim=0,this.xLoc=0,this.yLoc=0,this.numBytes=0,this.outputData=null,this.restarting=!1,this.mask=0,typeof f<"u"&&(this.numBytes=f)},n.lossless.Decoder.IDCT_P=[0,5,40,16,45,2,7,42,21,56,8,61,18,47,1,4,41,23,58,13,32,24,37,10,63,17,44,3,6,43,20,57,15,34,29,48,53,26,39,9,60,19,46,22,59,12,33,31,50,55,25,36,11,62,14,35,28,49,52,27,38,30,51,54],n.lossless.Decoder.TABLE=[0,1,5,6,14,15,27,28,2,4,7,13,16,26,29,42,3,8,12,17,25,30,41,43,9,11,18,24,31,40,44,53,10,19,23,32,39,45,52,54,20,22,33,38,46,51,55,60,21,34,37,47,50,56,59,61,35,36,48,49,57,58,62,63],n.lossless.Decoder.MAX_HUFFMAN_SUBTREE=50,n.lossless.Decoder.MSB=2147483648,n.lossless.Decoder.RESTART_MARKER_BEGIN=65488,n.lossless.Decoder.RESTART_MARKER_END=65495,n.lossless.Decoder.prototype.decompress=function(u,f,m){return this.decode(u,f,m).buffer},n.lossless.Decoder.prototype.decode=function(u,f,m,A){var v,y=0,T=[],E,S,I=[],e=[],F;if(typeof u<"u"&&(this.buffer=u),typeof A<"u"&&(this.numBytes=A),this.stream=new n.lossless.DataStream(this.buffer,f,m),this.buffer=null,this.xLoc=0,this.yLoc=0,v=this.stream.get16(),v!==65496)throw new Error("Not a JPEG file");for(v=this.stream.get16();v>>4!==4092||v===65476;){switch(v){case 65476:this.huffTable.read(this.stream,this.HuffTab);break;case 65484:throw new Error("Program doesn't support arithmetic coding. (format throw new IOException)");case 65499:this.quantTable.read(this.stream,n.lossless.Decoder.TABLE);break;case 65501:this.restartInterval=this.readNumber();break;case 65504:case 65505:case 65506:case 65507:case 65508:case 65509:case 65510:case 65511:case 65512:case 65513:case 65514:case 65515:case 65516:case 65517:case 65518:case 65519:this.readApp();break;case 65534:this.readComment();break;default:if(v>>8!==255)throw new Error("ERROR: format throw new IOException! (decode)")}v=this.stream.get16()}if(v<65472||v>65479)throw new Error("ERROR: could not handle arithmetic code!");this.frame.read(this.stream),v=this.stream.get16();do{for(;v!==65498;){switch(v){case 65476:this.huffTable.read(this.stream,this.HuffTab);break;case 65484:throw new Error("Program doesn't support arithmetic coding. (format throw new IOException)");case 65499:this.quantTable.read(this.stream,n.lossless.Decoder.TABLE);break;case 65501:this.restartInterval=this.readNumber();break;case 65504:case 65505:case 65506:case 65507:case 65508:case 65509:case 65510:case 65511:case 65512:case 65513:case 65514:case 65515:case 65516:case 65517:case 65518:case 65519:this.readApp();break;case 65534:this.readComment();break;default:if(v>>8!==255)throw new Error("ERROR: format throw new IOException! (Parser.decode)")}v=this.stream.get16()}switch(this.precision=this.frame.precision,this.components=this.frame.components,this.numBytes||(this.numBytes=parseInt(Math.ceil(this.precision/8))),this.numBytes==1?this.mask=255:this.mask=65535,this.scan.read(this.stream),this.numComp=this.scan.numComp,this.selection=this.scan.selection,this.numBytes===1?this.numComp===3?(this.getter=this.getValueRGB,this.setter=this.setValueRGB,this.output=this.outputRGB):(this.getter=this.getValue8,this.setter=this.setValue8,this.output=this.outputSingle):(this.getter=this.getValue16,this.setter=this.setValue16,this.output=this.outputSingle),this.selection){case 2:this.selector=this.select2;break;case 3:this.selector=this.select3;break;case 4:this.selector=this.select4;break;case 5:this.selector=this.select5;break;case 6:this.selector=this.select6;break;case 7:this.selector=this.select7;break;default:this.selector=this.select1;break}for(this.scanComps=this.scan.components,this.quantTables=this.quantTable.quantTables,E=0;E=n.lossless.Decoder.RESTART_MARKER_BEGIN&&v<=n.lossless.Decoder.RESTART_MARKER_END))break}v===65500&&y===1&&(this.readNumber(),v=this.stream.get16())}while(v!==65497&&this.xLoc>1)},n.lossless.Decoder.prototype.select6=function(u){return this.getPreviousY(u)+(this.getPreviousX(u)-this.getPreviousXY(u)>>1)},n.lossless.Decoder.prototype.select7=function(u){return(this.getPreviousX(u)+this.getPreviousY(u))/2},n.lossless.Decoder.prototype.decodeRGB=function(u,f,m){var A,v,y,T,E,S,I,e;for(u[0]=this.selector(0),u[1]=this.selector(1),u[2]=this.selector(2),E=0;E=65280)return A;for(u[E]=this.IDCT_Source[0]=u[E]+this.getn(m,A,f,m),this.IDCT_Source[0]*=T[0],e=1;e<64;e+=1){if(A=this.getHuffmanValue(v,f,m),A>=65280)return A;if(e+=A>>4,A&15)this.IDCT_Source[n.lossless.Decoder.IDCT_P[e]]=this.getn(m,A&15,f,m)*T[e];else if(!(A>>4))break}}return 0},n.lossless.Decoder.prototype.decodeSingle=function(u,f,m){var A,v,y,T;for(this.restarting?(this.restarting=!1,u[0]=1<=65280)return A;if(y=this.getn(u,A,f,m),T=y>>8,T>=n.lossless.Decoder.RESTART_MARKER_BEGIN&&T<=n.lossless.Decoder.RESTART_MARKER_END)return T;u[0]+=y}return 0},n.lossless.Decoder.prototype.getHuffmanValue=function(u,f,m){var A,v,y;if(y=65535,m[0]<8?(f[0]<<=8,v=this.stream.get8(),v===255&&(this.marker=this.stream.get8(),this.marker!==0&&(this.markerIndex=9)),f[0]|=v):m[0]-=8,A=u[f[0]>>m[0]],A&n.lossless.Decoder.MSB){if(this.markerIndex!==0)return this.markerIndex=0,65280|this.marker;f[0]&=y>>16-m[0],f[0]<<=8,v=this.stream.get8(),v===255&&(this.marker=this.stream.get8(),this.marker!==0&&(this.markerIndex=9)),f[0]|=v,A=u[(A&255)*256+(f[0]>>m[0])],m[0]+=8}if(m[0]+=8-(A>>8),m[0]<0)throw new Error("index="+m[0]+" temp="+f[0]+" code="+A+" in HuffmanValue()");return m[0]>16-m[0],A&255)},n.lossless.Decoder.prototype.getn=function(u,f,m,A){var v,y,T,E,S;if(y=1,T=-1,E=65535,f===0)return 0;if(f===16)return u[0]>=0?-32768:32768;if(A[0]-=f,A[0]>=0){if(A[0]>A[0],m[0]&=E>>16-A[0]}else{if(m[0]<<=8,S=this.stream.get8(),S===255&&(this.marker=this.stream.get8(),this.marker!==0&&(this.markerIndex=9)),m[0]|=S,A[0]+=8,A[0]<0){if(this.markerIndex!==0)return this.markerIndex=0,(65280|this.marker)<<8;m[0]<<=8,S=this.stream.get8(),S===255&&(this.marker=this.stream.get8(),this.marker!==0&&(this.markerIndex=9)),m[0]|=S,A[0]+=8}if(A[0]<0)throw new Error("index="+A[0]+" in getn()");if(A[0]>A[0],m[0]&=E>>16-A[0]}return v0?this.getter(this.yLoc*this.xDim+this.xLoc-1,u):this.yLoc>0?this.getPreviousY(u):1<0&&this.yLoc>0?this.getter((this.yLoc-1)*this.xDim+this.xLoc-1,u):this.getPreviousY(u)},n.lossless.Decoder.prototype.getPreviousY=function(u){return this.yLoc>0?this.getter((this.yLoc-1)*this.xDim+this.xLoc,u):this.getPreviousX(u)},n.lossless.Decoder.prototype.isLastPixel=function(){return this.xLoc===this.xDim-1&&this.yLoc===this.yDim-1},n.lossless.Decoder.prototype.outputSingle=function(u){this.xLoc=this.xDim&&(this.yLoc+=1,this.xLoc=0))},n.lossless.Decoder.prototype.outputRGB=function(u){var f=this.yLoc*this.xDim+this.xLoc;this.xLoc=this.xDim&&(this.yLoc+=1,this.xLoc=0))},n.lossless.Decoder.prototype.setValue8=function(u,f){this.outputData[u]=f},n.lossless.Decoder.prototype.getValue8=function(u){return this.outputData[u]};var s=function(){var u=new ArrayBuffer(2);return new DataView(u).setInt16(0,256,!0),new Int16Array(u)[0]===256}();s?(n.lossless.Decoder.prototype.setValue16=n.lossless.Decoder.prototype.setValue8,n.lossless.Decoder.prototype.getValue16=n.lossless.Decoder.prototype.getValue8):(n.lossless.Decoder.prototype.setValue16=function(u,f){this.outputData[u]=(f&255)<<8|f>>8&255},n.lossless.Decoder.prototype.getValue16=function(u){var f=this.outputData[u];return(f&255)<<8|f>>8&255}),n.lossless.Decoder.prototype.setValueRGB=function(u,f,m){this.outputData[u*3+m]=f},n.lossless.Decoder.prototype.getValueRGB=function(u,f){return this.outputData[u*3+f]},n.lossless.Decoder.prototype.readApp=function(){var u=0,f=this.stream.get16();for(u+=2;u0&&!b[g-1];)g--;Y.push({children:[],index:0});var J=Y[0],re;for(X=0;X0;)J=Y.pop();for(J.index++,Y.push(J);Y.length<=X;)Y.push(re={children:[],index:0}),J.children[J.index]=re.children,J=re;q++}X+10)return Se--,me>>Se&1;if(me=b[W++],me==255){var We=b[W++];if(We)throw"unexpected marker: "+(me<<8|We).toString(16)}return Se=7,me>>>7}function we(We){for(var Ge=We,xt;(xt=ve())!==null;){if(Ge=Ge[xt],typeof Ge=="number")return Ge;if(typeof Ge!="object")throw"invalid huffman sequence"}return null}function Ne(We){for(var Ge=0;We>0;){var xt=ve();if(xt===null)return;Ge=Ge<<1|xt,We--}return Ge}function De(We){var Ge=Ne(We);return Ge>=1<>4;if(Be===0){if(st<15)break;rt+=16;continue}rt+=st;var Ke=f[rt];We.blockData[Ge+Ke]=De(Be),rt++}}function nt(We,Ge){var xt=we(We.huffmanTableDC),He=xt===0?0:De(xt)<0){ye--;return}for(var xt=Q,He=g;xt<=He;){var rt=we(We.huffmanTableAC),ee=rt&15,Be=rt>>4;if(ee===0){if(Be<15){ye=Ne(Be)+(1<>4,st===0)rt<15?(ye=Ne(rt)+(1<=65488&&Le<=65495)W+=2;else break}return W-pe}function V(b,W,q){var Y=b.quantizationTable,X,Q,g,J,re,ae,fe,pe,me,Se;for(Se=0;Se<64;Se++)q[Se]=b.blockData[W+Se]*Y[Se];for(Se=0;Se<8;++Se){var ve=8*Se;if(q[1+ve]===0&&q[2+ve]===0&&q[3+ve]===0&&q[4+ve]===0&&q[5+ve]===0&&q[6+ve]===0&&q[7+ve]===0){me=S*q[0+ve]+512>>10,q[0+ve]=me,q[1+ve]=me,q[2+ve]=me,q[3+ve]=me,q[4+ve]=me,q[5+ve]=me,q[6+ve]=me,q[7+ve]=me;continue}X=S*q[0+ve]+128>>8,Q=S*q[4+ve]+128>>8,g=q[2+ve],J=q[6+ve],re=I*(q[1+ve]-q[7+ve])+128>>8,pe=I*(q[1+ve]+q[7+ve])+128>>8,ae=q[3+ve]<<4,fe=q[5+ve]<<4,me=X-Q+1>>1,X=X+Q+1>>1,Q=me,me=g*E+J*T+128>>8,g=g*T-J*E+128>>8,J=me,me=re-fe+1>>1,re=re+fe+1>>1,fe=me,me=pe+ae+1>>1,ae=pe-ae+1>>1,pe=me,me=X-J+1>>1,X=X+J+1>>1,J=me,me=Q-g+1>>1,Q=Q+g+1>>1,g=me,me=re*y+pe*v+2048>>12,re=re*v-pe*y+2048>>12,pe=me,me=ae*A+fe*m+2048>>12,ae=ae*m-fe*A+2048>>12,fe=me,q[0+ve]=X+pe,q[7+ve]=X-pe,q[1+ve]=Q+fe,q[6+ve]=Q-fe,q[2+ve]=g+ae,q[5+ve]=g-ae,q[3+ve]=J+re,q[4+ve]=J-re}for(Se=0;Se<8;++Se){var we=Se;if(q[1*8+we]===0&&q[2*8+we]===0&&q[3*8+we]===0&&q[4*8+we]===0&&q[5*8+we]===0&&q[6*8+we]===0&&q[7*8+we]===0){me=S*q[Se+0]+8192>>14,q[0*8+we]=me,q[1*8+we]=me,q[2*8+we]=me,q[3*8+we]=me,q[4*8+we]=me,q[5*8+we]=me,q[6*8+we]=me,q[7*8+we]=me;continue}X=S*q[0*8+we]+2048>>12,Q=S*q[4*8+we]+2048>>12,g=q[2*8+we],J=q[6*8+we],re=I*(q[1*8+we]-q[7*8+we])+2048>>12,pe=I*(q[1*8+we]+q[7*8+we])+2048>>12,ae=q[3*8+we],fe=q[5*8+we],me=X-Q+1>>1,X=X+Q+1>>1,Q=me,me=g*E+J*T+2048>>12,g=g*T-J*E+2048>>12,J=me,me=re-fe+1>>1,re=re+fe+1>>1,fe=me,me=pe+ae+1>>1,ae=pe-ae+1>>1,pe=me,me=X-J+1>>1,X=X+J+1>>1,J=me,me=Q-g+1>>1,Q=Q+g+1>>1,g=me,me=re*y+pe*v+2048>>12,re=re*v-pe*y+2048>>12,pe=me,me=ae*A+fe*m+2048>>12,ae=ae*m-fe*A+2048>>12,fe=me,q[0*8+we]=X+pe,q[7*8+we]=X-pe,q[1*8+we]=Q+fe,q[6*8+we]=Q-fe,q[2*8+we]=g+ae,q[5*8+we]=g-ae,q[3*8+we]=J+re,q[4*8+we]=J-re}for(Se=0;Se<64;++Se){var Ne=W+Se,De=q[Se];De=De<=-2056/b.bitConversion?0:De>=2024/b.bitConversion?255/b.bitConversion:De+2056/b.bitConversion>>4,b.blockData[Ne]=De}}function B(b,W){for(var q=W.blocksPerLine,Y=W.blocksPerColumn,X=new Int32Array(64),Q=0;Q=255?255:b|0}return e.prototype={load:function(W){var q=(function(re){this.parse(re),this.onload&&this.onload()}).bind(this);if(W.indexOf("data:")>-1){for(var Y=W.indexOf("base64,")+7,X=atob(W.substring(Y)),Q=new Uint8Array(X.length),g=X.length-1;g>=0;g--)Q[g]=X.charCodeAt(g);q(X)}else{var J=new XMLHttpRequest;J.open("GET",W,!0),J.responseType="arraybuffer",J.onload=(function(){var re=new Uint8Array(J.response);q(re)}).bind(this),J.send(null)}},parse:function(W){function q(){var ee=W[Q]<<8|W[Q+1];return Q+=2,ee}function Y(){var ee=q(),Be=W.subarray(Q,Q+ee-2);return Q+=Be.length,Be}function X(ee){for(var Be=Math.ceil(ee.samplesPerLine/8/ee.maxH),st=Math.ceil(ee.scanLines/8/ee.maxV),Ke=0;Ke>4)if(Ue>>4===1)for(we=0;we<64;we++){var pt=f[we];ye[pt]=q()}else throw"DQT: invalid table spec";else for(we=0;we<64;we++){var ut=f[we];ye[ut]=W[Q++]}fe[Ue&15]=ye}break;case 65472:case 65473:case 65474:if(re)throw"Only single frame JPEGs supported";q(),re={},re.extended=Se===65473,re.progressive=Se===65474,re.precision=W[Q++],re.scanLines=q(),re.samplesPerLine=q(),re.components=[],re.componentIds={};var It=W[Q++],Lt,Ot=0,Et=0;for(ve=0;ve>4,Ze=W[Q+1]&15;Ot>4?pe:me)[Ie&15]=F(Fe,ze)}break;case 65501:q(),ae=q();break;case 65498:q();var Le=W[Q++],qe=[],_e;for(ve=0;ve>4],_e.huffmanTableAC=pe[We&15],qe.push(_e)}var Ge=W[Q++],xt=W[Q++],He=W[Q++],rt=L(W,Q,re,qe,ae,Ge,xt,He>>4,He&15);Q+=rt;break;default:if(W[Q-3]==255&&W[Q-2]>=192&&W[Q-2]<=254){Q-=3;break}throw"unknown JPEG marker "+Se.toString(16)}Se=q()}switch(this.width=re.samplesPerLine,this.height=re.scanLines,this.jfif=g,this.adobe=J,this.components=[],re.components.length){case 1:this.colorspace=n.Grayscale;break;case 3:this.adobe?this.colorspace=n.AdobeRGB:this.colorspace=n.RGB;break;case 4:this.colorspace=n.CYMK;break;default:this.colorspace=n.Unknown}for(var ve=0;ve>24&255,Le>>16&255,Le>>8&255,Le&255);A("Unsupported header type "+Le+" ("+Ge+")");break}_e&&(Ie+=qe)}},parseImageProperties:function(Me){for(var Qe=Me.getByte();Qe>=0;){var Ie=Qe;Qe=Me.getByte();var Fe=Ie<<8|Qe;if(Fe===65361){Me.skip(4);var at=Me.getInt32()>>>0,ze=Me.getInt32()>>>0,Le=Me.getInt32()>>>0,qe=Me.getInt32()>>>0;Me.skip(16);var _e=Me.getUint16();this.width=at-Le,this.height=ze-qe,this.componentsCount=_e,this.bitsPerComponent=8;return}}throw new Error("JPX Error: No size marker found in JPX stream")},parseCodestream:function(Me,Qe,Ie){var Fe={};try{for(var at=!1,ze=Qe;ze+1>5,We=[];_e>3,vt.mu=0):(vt.epsilon=Me[_e]>>3,vt.mu=(Me[_e]&7)<<8|Me[_e+1],_e+=2),We.push(vt)}ft.SPqcds=We,Fe.mainHeader?Fe.QCD=ft:(Fe.currentTile.QCD=ft,Fe.currentTile.QCC=[]);break;case 65373:qe=M(Me,ze);var Re={};_e=ze+2;var Ye;switch(Fe.SIZ.Csiz<257?Ye=Me[_e++]:(Ye=M(Me,_e),_e+=2),Je=Me[_e++],Je&31){case 0:Ge=8,xt=!0;break;case 1:Ge=16,xt=!1;break;case 2:Ge=16,xt=!0;break;default:throw new Error("JPX Error: Invalid SQcd value "+Je)}for(Re.noQuantization=Ge===8,Re.scalarExpounded=xt,Re.guardBits=Je>>5,We=[];_e>3,vt.mu=0):(vt.epsilon=Me[_e]>>3,vt.mu=(Me[_e]&7)<<8|Me[_e+1],_e+=2),We.push(vt);Re.SPqcds=We,Fe.mainHeader?Fe.QCC[Ye]=Re:Fe.currentTile.QCC[Ye]=Re;break;case 65362:qe=M(Me,ze);var ue={};_e=ze+2;var Ae=Me[_e++];ue.entropyCoderWithCustomPrecincts=!!(Ae&1),ue.sopMarkerUsed=!!(Ae&2),ue.ephMarkerUsed=!!(Ae&4),ue.progressionOrder=Me[_e++],ue.layersCount=M(Me,_e),_e+=2,ue.multipleComponentTransform=Me[_e++],ue.decompositionLevelsCount=Me[_e++],ue.xcb=(Me[_e++]&15)+2,ue.ycb=(Me[_e++]&15)+2;var Vt=Me[_e++];if(ue.selectiveArithmeticCodingBypass=!!(Vt&1),ue.resetContextProbabilities=!!(Vt&2),ue.terminationOnEachCodingPass=!!(Vt&4),ue.verticalyStripe=!!(Vt&8),ue.predictableTermination=!!(Vt&16),ue.segmentationSymbolUsed=!!(Vt&32),ue.reversibleTransformation=Me[_e++],ue.entropyCoderWithCustomPrecincts){for(var ge=[];_e>4})}ue.precinctsSizes=ge}var Ve=[];if(ue.selectiveArithmeticCodingBypass&&Ve.push("selectiveArithmeticCodingBypass"),ue.resetContextProbabilities&&Ve.push("resetContextProbabilities"),ue.terminationOnEachCodingPass&&Ve.push("terminationOnEachCodingPass"),ue.verticalyStripe&&Ve.push("verticalyStripe"),ue.predictableTermination&&Ve.push("predictableTermination"),Ve.length>0)throw at=!0,new Error("JPX Error: Unsupported COD options ("+Ve.join(", ")+")");Fe.mainHeader?Fe.COD=ue:(Fe.currentTile.COD=ue,Fe.currentTile.COC=[]);break;case 65424:qe=M(Me,ze),He={},He.index=M(Me,ze+2),He.length=L(Me,ze+4),He.dataEnd=He.length+ze-2,He.partIndex=Me[ze+8],He.partsCount=Me[ze+9],Fe.mainHeader=!1,He.partIndex===0&&(He.COD=Fe.COD,He.COC=Fe.COC.slice(0),He.QCD=Fe.QCD,He.QCC=Fe.QCC.slice(0)),Fe.currentTile=He;break;case 65427:He=Fe.currentTile,He.partIndex===0&&(ut(Fe,He.index),De(Fe)),qe=He.dataEnd-ze,je(Fe,Me,ze,qe);break;case 65365:case 65367:case 65368:case 65380:qe=M(Me,ze);break;case 65363:throw new Error("JPX Error: Codestream code 0xFF53 (COC) is not implemented");default:throw new Error("JPX Error: Unknown codestream code: "+Le.toString(16))}ze+=qe}}catch(Zt){if(at||this.failOnCorruptedImage)throw Zt;A("Trying to recover from "+Zt.message)}this.tiles=ye(Fe),this.width=Fe.SIZ.Xsiz-Fe.SIZ.XOsiz,this.height=Fe.SIZ.Ysiz-Fe.SIZ.YOsiz,this.componentsCount=Fe.SIZ.Csiz}};function X(Ze,Me){Ze.x0=Math.ceil(Me.XOsiz/Ze.XRsiz),Ze.x1=Math.ceil(Me.Xsiz/Ze.XRsiz),Ze.y0=Math.ceil(Me.YOsiz/Ze.YRsiz),Ze.y1=Math.ceil(Me.Ysiz/Ze.YRsiz),Ze.width=Ze.x1-Ze.x0,Ze.height=Ze.y1-Ze.y0}function Q(Ze,Me){for(var Qe=Ze.SIZ,Ie,Fe=[],at=Math.ceil((Qe.Xsiz-Qe.XTOsiz)/Qe.XTsiz),ze=Math.ceil((Qe.Ysiz-Qe.YTOsiz)/Qe.YTsiz),Le=0;Le0?Math.min(Ie.xcb,Fe.PPx-1):Math.min(Ie.xcb,Fe.PPx),Fe.ycb_=Qe>0?Math.min(Ie.ycb,Fe.PPy-1):Math.min(Ie.ycb,Fe.PPy),Fe}function J(Ze,Me,Qe){var Ie=1<Me.trx0?Math.ceil(Me.trx1/Ie)-Math.floor(Me.trx0/Ie):0,_e=Me.try1>Me.try0?Math.ceil(Me.try1/Fe)-Math.floor(Me.try0/Fe):0,Je=qe*_e;Me.precinctParameters={precinctWidth:Ie,precinctHeight:Fe,numprecinctswide:qe,numprecinctshigh:_e,numprecincts:Je,precinctWidthInSubband:ze,precinctHeightInSubband:Le}}function re(Ze,Me,Qe){var Ie=Qe.xcb_,Fe=Qe.ycb_,at=1<>Ie,qe=Me.tby0>>Fe,_e=Me.tbx1+at-1>>Ie,Je=Me.tby1+ze-1>>Fe,We=Me.resolution.precinctParameters,Ge=[],xt=[],He,rt,ee,Be;for(rt=qe;rtft.cbxMax&&(ft.cbxMax=He),rtft.cbyMax&&(ft.cbyMax=rt)):xt[Be]=ft={cbxMin:He,cbyMin:rt,cbxMax:He,cbyMax:rt},ee.precinct=ft}}Me.codeblockParameters={codeblockWidth:Ie,codeblockHeight:Fe,numcodeblockwide:_e-Le+1,numcodeblockhigh:Je-qe+1},Me.codeblocks=Ge,Me.precincts=xt}function ae(Ze,Me,Qe){for(var Ie=[],Fe=Ze.subbands,at=0,ze=Fe.length;atxt.codingStyleParameters.decompositionLevelsCount)){for(var He=xt.resolutions[_e],rt=He.precinctParameters.numprecincts;Wext.codingStyleParameters.decompositionLevelsCount)){for(var He=xt.resolutions[qe],rt=He.precinctParameters.numprecincts;Weee.codingStyleParameters.decompositionLevelsCount)){var Be=ee.resolutions[Le],st=Be.precinctParameters.numprecincts;if(!(_e>=st)){for(;ze=0;--ee){var Be=qe.resolutions[ee],st=rt*Be.precinctParameters.precinctWidth,Ke=rt*Be.precinctParameters.precinctHeight;We=Math.min(We,st),Ge=Math.min(Ge,Ke),xt=Math.max(xt,Be.precinctParameters.numprecinctswide),He=Math.max(He,Be.precinctParameters.numprecinctshigh),Je[ee]={width:st,height:Ke},rt<<=1}Qe=Math.min(Qe,We),Ie=Math.min(Ie,Ge),Fe=Math.max(Fe,xt),at=Math.max(at,He),ze[Le]={resolutions:Je,minWidth:We,minHeight:Ge,maxNumWide:xt,maxNumHigh:He}}return{components:ze,minWidth:Qe,minHeight:Ie,maxNumWide:Fe,maxNumHigh:at}}function De(Ze){for(var Me=Ze.SIZ,Qe=Ze.currentTile.index,Ie=Ze.tiles[Qe],Fe=Me.Csiz,at=0;at=Me.length)throw new Error("Unexpected EOF");var Nt=Me[Qe+Fe];Fe++,Le?(at=at<<7|Nt,ze+=7,Le=!1):(at=at<<8|Nt,ze+=8),Nt===255&&(Le=!0)}return ze-=xe,at>>>ze&(1<=Me.length)return;if(Zt.isAboveThreshold())break;if(Zt.isKnown()){Zt.nextLevel();continue}if(qe(1))if(Zt.setKnown(),Zt.isLeaf()){vt.included=!0,ge=Ut=!0;break}else Zt.nextLevel();else Zt.incrementValue()}}if(ge){if(Ut){for(ot=ue.zeroBitPlanesTree,ot.reset(Ae,Vt);;){if(Fe>=Me.length)return;if(qe(1)){if(Ve=!ot.nextLevel(),Ve)break}else ot.incrementValue()}vt.zeroBitPlanes=ot.value}for(var be=Ge();qe(1);)vt.Lblock++;var se=F(be),lt=(be<1<0;){var Pe=ft.shift();vt=Pe.codeblock,vt.data===void 0&&(vt.data=[]),vt.data.push({data:Me,start:Qe+Fe,end:Qe+Fe+Pe.dataLength,codingpasses:Pe.codingpasses}),Fe+=Pe.dataLength}}catch{return}return Fe}function nt(Ze,Me,Qe,Ie,Fe,at,ze,Le){for(var qe=Ie.tbx0,_e=Ie.tby0,Je=Ie.tbx1-Ie.tbx0,We=Ie.codeblocks,Ge=Ie.type.charAt(0)==="H"?1:0,xt=Ie.type.charAt(1)==="H"?Me:0,He=0,rt=We.length;He=at?Ze[Wt]=Ce:Ze[Wt]=Ce*(1<0?1-ee:0));var Ae=Be.subbands[vt],Vt=q[Ae.type],ge=Ge?1:Math.pow(2,We+Vt-ue)*(1+Ye/2048),Ut=_e+ue-1;nt(ft,st,Ke,Ae,ge,Ut,Ge,Je)}He.push({width:st,height:Ke,items:ft})}var Ve=xt.calculate(He,Ie.tcx0,Ie.tcy0);return{left:Ie.tcx0,top:Ie.tcy0,width:Ve.width,height:Ve.height,items:Ve.items}}function ye(Ze){for(var Me=Ze.SIZ,Qe=Ze.components,Ie=Me.Csiz,Fe=[],at=0,ze=Ze.tiles.length;at>2),Ae=Vt+ue,ge=Vt+Ye,Ge[Ke++]=Ae<=0?0:Ae>=ee?255:Ae>>He,Ge[Ke++]=Vt<=0?0:Vt>=ee?255:Vt>>He,Ge[Ke++]=ge<=0?0:ge>=ee?255:ge>>He;else for(ft=0;ft=ee?255:Ae>>He,Ge[Ke++]=Vt<=0?0:Vt>=ee?255:Vt>>He,Ge[Ke++]=ge<=0?0:ge>=ee?255:ge>>He;if(Zt)for(ft=0,Ke=3;ft=st?255:Ut+rt>>He}else for(_e=0;_e=ee?255:Ve+rt>>He,Ke+=Ie}else{var We=Qe[_e].isSigned,Ce=qe[_e].items;if(We)for(Ke=_e,ft=0,vt=Ce.length;ft>=1,Fe>>=1,at++}at--,Le=this.levels[at],Le.items[Le.index]=ze,this.currentLevel=at,delete this.value},incrementValue:function(){var Ie=this.levels[this.currentLevel];Ie.items[Ie.index]++},nextLevel:function(){var Ie=this.currentLevel,Fe=this.levels[Ie],at=Fe.items[Fe.index];return Ie--,Ie<0?(this.value=at,!1):(this.currentLevel=Ie,Fe=this.levels[Ie],Fe.items[Fe.index]=at,!0)}},Me}(),It=function(){function Me(Qe,Ie){var Fe=F(Math.max(Qe,Ie))+1;this.levels=[];for(var at=0;at>=1,Fe>>=1,ze++}this.currentLevel=this.levels.length-1,this.minValue=this.levels[this.currentLevel].items[0]},incrementValue:function(){var Ie=this.levels[this.currentLevel];Ie.items[Ie.index]=Ie.items[Ie.index]+1,Ie.items[Ie.index]>this.minValue&&(this.minValue=Ie.items[Ie.index])},nextLevel:function(){var Ie=this.currentLevel;if(Ie--,Ie<0)return!1;this.currentLevel=Ie;var Fe=this.levels[Ie];return Fe.items[Fe.index]this.minValue&&(this.minValue=Fe.items[Fe.index]),!0},isLeaf:function(){return this.currentLevel===0},isAboveThreshold:function(){var Ie=this.currentLevel,Fe=this.levels[Ie];return Fe.items[Fe.index]>this.currentStopValue},isKnown:function(){var Ie=this.currentLevel,Fe=this.levels[Ie];return Fe.status[Fe.index]>0},setKnown:function(){var Ie=this.currentLevel,Fe=this.levels[Ie];Fe.status[Fe.index]=1}},Me}(),Lt=function(){var Me=17,Qe=18,Ie=new Uint8Array([0,5,8,0,3,7,8,0,4,7,8,0,0,0,0,0,1,6,8,0,3,7,8,0,4,7,8,0,0,0,0,0,2,6,8,0,3,7,8,0,4,7,8,0,0,0,0,0,2,6,8,0,3,7,8,0,4,7,8,0,0,0,0,0,2,6,8,0,3,7,8,0,4,7,8]),Fe=new Uint8Array([0,3,4,0,5,7,7,0,8,8,8,0,0,0,0,0,1,3,4,0,6,7,7,0,8,8,8,0,0,0,0,0,2,3,4,0,6,7,7,0,8,8,8,0,0,0,0,0,2,3,4,0,6,7,7,0,8,8,8,0,0,0,0,0,2,3,4,0,6,7,7,0,8,8,8]),at=new Uint8Array([0,1,2,0,1,2,2,0,2,2,2,0,0,0,0,0,3,4,5,0,4,5,5,0,5,5,5,0,0,0,0,0,6,7,7,0,7,7,7,0,7,7,7,0,0,0,0,0,8,8,8,0,8,8,8,0,8,8,8,0,0,0,0,0,8,8,8,0,8,8,8,0,8,8,8]);function ze(Le,qe,_e,Je,We){this.width=Le,this.height=qe,this.contextLabelTable=_e==="HH"?at:_e==="HL"?Fe:Ie;var Ge=Le*qe;this.neighborsSignificance=new Uint8Array(Ge),this.coefficentsSign=new Uint8Array(Ge),this.coefficentsMagnitude=We>14?new Uint32Array(Ge):We>6?new Uint16Array(Ge):new Uint8Array(Ge),this.processingFlags=new Uint8Array(Ge);var xt=new Uint8Array(Ge);if(Je!==0)for(var He=0;He0,rt=_e+10&&(ee=Je-Ge,He&&(We[ee-1]+=16),rt&&(We[ee+1]+=16),We[ee]+=4),qe+1=Je)break;if(He[Ye]&=st,!(We[Ye]||!xt[Ye])){var Vt=ee[xt[Ye]],ge=qe.readBit(rt,Vt);if(ge){var Ut=this.decodeSignBit(Ae,Re,Ye);Ge[Ye]=Ut,We[Ye]=1,this.setNeighborsSignificance(Ae,Re,Ye),He[Ye]|=ft}Be[Ye]++,He[Ye]|=Ke}}},decodeSignBit:function(qe,_e,Je){var We=this.width,Ge=this.height,xt=this.coefficentsMagnitude,He=this.coefficentsSign,rt,ee,Be,st,Ke,ft;st=_e>0&&xt[Je-1]!==0,_e+10&&xt[Je-We]!==0,qe+1=0?(Ke=9+rt,ft=this.decoder.readBit(this.contexts,Ke)):(Ke=9-rt,ft=this.decoder.readBit(this.contexts,Ke)^1),ft},runMagnitudeRefinementPass:function(){for(var qe=this.decoder,_e=this.width,Je=this.height,We=this.coefficentsMagnitude,Ge=this.neighborsSignificance,xt=this.contexts,He=this.bitsDecoded,rt=this.processingFlags,ee=1,Be=2,st=_e*Je,Ke=_e*4,ft=0,vt;ft>1;Fe=Fe|0;var Le,qe,_e,Je,We=-1.586134342059924,Ge=-.052980118572961,xt=.882911075530934,He=.443506852043971,rt=1.230174104914001,ee=1/rt;for(Le=Fe-3,qe=ze+4;qe--;Le+=2)Ie[Le]*=ee;for(Le=Fe-2,_e=He*Ie[Le-1],qe=ze+3;qe--&&(Je=He*Ie[Le+1],Ie[Le]=rt*Ie[Le]-_e-Je,qe--);Le+=2)Le+=2,_e=He*Ie[Le+1],Ie[Le]=rt*Ie[Le]-_e-Je;for(Le=Fe-1,_e=xt*Ie[Le-1],qe=ze+2;qe--&&(Je=xt*Ie[Le+1],Ie[Le]-=_e+Je,qe--);Le+=2)Le+=2,_e=xt*Ie[Le+1],Ie[Le]-=_e+Je;for(Le=Fe,_e=Ge*Ie[Le-1],qe=ze+1;qe--&&(Je=Ge*Ie[Le+1],Ie[Le]-=_e+Je,qe--);Le+=2)Le+=2,_e=Ge*Ie[Le+1],Ie[Le]-=_e+Je;if(ze!==0)for(Le=Fe+1,_e=We*Ie[Le-1],qe=ze;qe--&&(Je=We*Ie[Le+1],Ie[Le]-=_e+Je,qe--);Le+=2)Le+=2,_e=We*Ie[Le+1],Ie[Le]-=_e+Je},Me}(),Rt=function(){function Me(){Ot.call(this)}return Me.prototype=Object.create(Ot.prototype),Me.prototype.filter=function(Ie,Fe,at){var ze=at>>1;Fe=Fe|0;var Le,qe;for(Le=Fe,qe=ze+1;qe--;Le+=2)Ie[Le]-=Ie[Le-1]+Ie[Le+1]+2>>2;for(Le=Fe+1,qe=ze;qe--;Le+=2)Ie[Le]+=Ie[Le-1]+Ie[Le+1]>>1},Me}();return Y}(),s=function(){var q=[{qe:22017,nmps:1,nlps:1,switchFlag:1},{qe:13313,nmps:2,nlps:6,switchFlag:0},{qe:6145,nmps:3,nlps:9,switchFlag:0},{qe:2753,nmps:4,nlps:12,switchFlag:0},{qe:1313,nmps:5,nlps:29,switchFlag:0},{qe:545,nmps:38,nlps:33,switchFlag:0},{qe:22017,nmps:7,nlps:6,switchFlag:1},{qe:21505,nmps:8,nlps:14,switchFlag:0},{qe:18433,nmps:9,nlps:14,switchFlag:0},{qe:14337,nmps:10,nlps:14,switchFlag:0},{qe:12289,nmps:11,nlps:17,switchFlag:0},{qe:9217,nmps:12,nlps:18,switchFlag:0},{qe:7169,nmps:13,nlps:20,switchFlag:0},{qe:5633,nmps:29,nlps:21,switchFlag:0},{qe:22017,nmps:15,nlps:14,switchFlag:1},{qe:21505,nmps:16,nlps:14,switchFlag:0},{qe:20737,nmps:17,nlps:15,switchFlag:0},{qe:18433,nmps:18,nlps:16,switchFlag:0},{qe:14337,nmps:19,nlps:17,switchFlag:0},{qe:13313,nmps:20,nlps:18,switchFlag:0},{qe:12289,nmps:21,nlps:19,switchFlag:0},{qe:10241,nmps:22,nlps:19,switchFlag:0},{qe:9217,nmps:23,nlps:20,switchFlag:0},{qe:8705,nmps:24,nlps:21,switchFlag:0},{qe:7169,nmps:25,nlps:22,switchFlag:0},{qe:6145,nmps:26,nlps:23,switchFlag:0},{qe:5633,nmps:27,nlps:24,switchFlag:0},{qe:5121,nmps:28,nlps:25,switchFlag:0},{qe:4609,nmps:29,nlps:26,switchFlag:0},{qe:4353,nmps:30,nlps:27,switchFlag:0},{qe:2753,nmps:31,nlps:28,switchFlag:0},{qe:2497,nmps:32,nlps:29,switchFlag:0},{qe:2209,nmps:33,nlps:30,switchFlag:0},{qe:1313,nmps:34,nlps:31,switchFlag:0},{qe:1089,nmps:35,nlps:32,switchFlag:0},{qe:673,nmps:36,nlps:33,switchFlag:0},{qe:545,nmps:37,nlps:34,switchFlag:0},{qe:321,nmps:38,nlps:35,switchFlag:0},{qe:273,nmps:39,nlps:36,switchFlag:0},{qe:133,nmps:40,nlps:37,switchFlag:0},{qe:73,nmps:41,nlps:38,switchFlag:0},{qe:37,nmps:42,nlps:39,switchFlag:0},{qe:21,nmps:43,nlps:40,switchFlag:0},{qe:9,nmps:44,nlps:41,switchFlag:0},{qe:5,nmps:45,nlps:42,switchFlag:0},{qe:1,nmps:45,nlps:43,switchFlag:0},{qe:22017,nmps:46,nlps:46,switchFlag:0}];function Y(X,Q,g){this.data=X,this.bp=Q,this.dataEnd=g,this.chigh=X[Q],this.clow=0,this.byteIn(),this.chigh=this.chigh<<7&65535|this.clow>>9&127,this.clow=this.clow<<7&65535,this.ct-=7,this.a=32768}return Y.prototype={byteIn:function(){var Q=this.data,g=this.bp;if(Q[g]===255){var J=Q[g+1];J>143?(this.clow+=65280,this.ct=8):(g++,this.clow+=Q[g]<<9,this.ct=7,this.bp=g)}else g++,this.clow+=g65535&&(this.chigh+=this.clow>>16,this.clow&=65535)},readBit:function(Q,g){var J=Q[g]>>1,re=Q[g]&1,ae=q[J],fe=ae.qe,pe,me=this.a-fe;if(this.chigh>15&1,this.clow=this.clow<<1&65535,this.ct--;while(!(me&32768));return this.a=me,Q[g]=J<<1|re,pe}},Y}(),u=typeof window>"u"?commonjsGlobal:window;u.PDFJS||(u.PDFJS={});var f=f||{};f.VERBOSITY_LEVELS={errors:0,warnings:1,infos:5},f.OPS={dependency:1,setLineWidth:2,setLineCap:3,setLineJoin:4,setMiterLimit:5,setDash:6,setRenderingIntent:7,setFlatness:8,setGState:9,save:10,restore:11,transform:12,moveTo:13,lineTo:14,curveTo:15,curveTo2:16,curveTo3:17,closePath:18,rectangle:19,stroke:20,closeStroke:21,fill:22,eoFill:23,fillStroke:24,eoFillStroke:25,closeFillStroke:26,closeEOFillStroke:27,endPath:28,clip:29,eoClip:30,beginText:31,endText:32,setCharSpacing:33,setWordSpacing:34,setHScale:35,setLeading:36,setFont:37,setTextRenderingMode:38,setTextRise:39,moveText:40,setLeadingMoveText:41,setTextMatrix:42,nextLine:43,showText:44,showSpacedText:45,nextLineShowText:46,nextLineSetSpacingShowText:47,setCharWidth:48,setCharWidthAndBounds:49,setStrokeColorSpace:50,setFillColorSpace:51,setStrokeColor:52,setStrokeColorN:53,setFillColor:54,setFillColorN:55,setStrokeGray:56,setFillGray:57,setStrokeRGBColor:58,setFillRGBColor:59,setStrokeCMYKColor:60,setFillCMYKColor:61,shadingFill:62,beginInlineImage:63,beginImageData:64,endInlineImage:65,paintXObject:66,markPoint:67,markPointProps:68,beginMarkedContent:69,beginMarkedContentProps:70,endMarkedContent:71,beginCompat:72,endCompat:73,paintFormXObjectBegin:74,paintFormXObjectEnd:75,beginGroup:76,endGroup:77,beginAnnotations:78,endAnnotations:79,beginAnnotation:80,endAnnotation:81,paintJpegXObject:82,paintImageMaskXObject:83,paintImageMaskXObjectGroup:84,paintImageXObject:85,paintInlineImageXObject:86,paintInlineImageXObjectGroup:87,paintImageXObjectRepeat:88,paintImageMaskXObjectRepeat:89,paintSolidColorImageMask:90,constructPath:91};function m(W){f.verbosity>=f.VERBOSITY_LEVELS.infos&&console.log("Info: "+W)}function A(W){f.verbosity>=f.VERBOSITY_LEVELS.warnings&&console.log("Warning: "+W)}f.UNSUPPORTED_FEATURES={unknown:"unknown",forms:"forms",javaScript:"javaScript",smask:"smask",shadingPattern:"shadingPattern",font:"font"},f.UnsupportedManager=function(){var q=[];return{listen:function(Y){q.push(Y)},notify:function(Y){A('Unsupported feature "'+Y+'"');for(var X=0,Q=q.length;Xq;)q<<=1,Y++;return Y}function M(W,q){return W[q]<<8|W[q+1]}function L(W,q){return(W[q]<<24|W[q+1]<<16|W[q+2]<<8|W[q+3])>>>0}function V(){var W=new Uint8Array(2);W[0]=1;var q=new Uint16Array(W.buffer);return q[0]===1}Object.defineProperty(f,"isLittleEndian",{configurable:!0,get:function(){return y(f,"isLittleEndian",V())}});function B(){var W=document.createElement("canvas");W.width=W.height=1;var q=W.getContext("2d"),Y=q.createImageData(1,1);return typeof Y.data.buffer<"u"}Object.defineProperty(f,"hasCanvasTypedArrays",{configurable:!0,get:function(){return y(f,"hasCanvasTypedArrays",B())}});var z=f.Util=function(){function q(){}var Y=["rgb(",0,",",0,",",0,")"];return q.makeCssRgb=function(Q,g,J){return Y[1]=Q,Y[3]=g,Y[5]=J,Y.join("")},q.transform=function(Q,g){return[Q[0]*g[0]+Q[2]*g[1],Q[1]*g[0]+Q[3]*g[1],Q[0]*g[2]+Q[2]*g[3],Q[1]*g[2]+Q[3]*g[3],Q[0]*g[4]+Q[2]*g[5]+Q[4],Q[1]*g[4]+Q[3]*g[5]+Q[5]]},q.applyTransform=function(Q,g){var J=Q[0]*g[0]+Q[1]*g[2]+g[4],re=Q[0]*g[1]+Q[1]*g[3]+g[5];return[J,re]},q.applyInverseTransform=function(Q,g){var J=g[0]*g[3]-g[1]*g[2],re=(Q[0]*g[3]-Q[1]*g[2]+g[2]*g[5]-g[4]*g[3])/J,ae=(-Q[0]*g[1]+Q[1]*g[0]+g[4]*g[1]-g[5]*g[0])/J;return[re,ae]},q.getAxialAlignedBoundingBox=function(Q,g){var J=q.applyTransform(Q,g),re=q.applyTransform(Q.slice(2,4),g),ae=q.applyTransform([Q[0],Q[3]],g),fe=q.applyTransform([Q[2],Q[1]],g);return[Math.min(J[0],re[0],ae[0],fe[0]),Math.min(J[1],re[1],ae[1],fe[1]),Math.max(J[0],re[0],ae[0],fe[0]),Math.max(J[1],re[1],ae[1],fe[1])]},q.inverseTransform=function(Q){var g=Q[0]*Q[3]-Q[1]*Q[2];return[Q[3]/g,-Q[1]/g,-Q[2]/g,Q[0]/g,(Q[2]*Q[5]-Q[4]*Q[3])/g,(Q[4]*Q[1]-Q[5]*Q[0])/g]},q.apply3dTransform=function(Q,g){return[Q[0]*g[0]+Q[1]*g[1]+Q[2]*g[2],Q[3]*g[0]+Q[4]*g[1]+Q[5]*g[2],Q[6]*g[0]+Q[7]*g[1]+Q[8]*g[2]]},q.singularValueDecompose2dScale=function(Q){var g=[Q[0],Q[2],Q[1],Q[3]],J=Q[0]*g[0]+Q[1]*g[2],re=Q[0]*g[1]+Q[1]*g[3],ae=Q[2]*g[0]+Q[3]*g[2],fe=Q[2]*g[1]+Q[3]*g[3],pe=(J+fe)/2,me=Math.sqrt((J+fe)*(J+fe)-4*(J*fe-ae*re))/2,Se=pe+me||1,ve=pe-me||1;return[Math.sqrt(Se),Math.sqrt(ve)]},q.normalizeRect=function(Q){var g=Q.slice(0);return Q[0]>Q[2]&&(g[0]=Q[2],g[2]=Q[0]),Q[1]>Q[3]&&(g[1]=Q[3],g[3]=Q[1]),g},q.intersect=function(Q,g){function J(pe,me){return pe-me}var re=[Q[0],Q[2],g[0],g[2]].sort(J),ae=[Q[1],Q[3],g[1],g[3]].sort(J),fe=[];if(Q=q.normalizeRect(Q),g=q.normalizeRect(g),re[0]===Q[0]&&re[1]===g[0]||re[0]===g[0]&&re[1]===Q[0])fe[0]=re[1],fe[2]=re[2];else return!1;if(ae[0]===Q[1]&&ae[1]===g[1]||ae[0]===g[1]&&ae[1]===Q[1])fe[1]=ae[1],fe[3]=ae[2];else return!1;return fe},q.sign=function(Q){return Q<0?-1:1},q.appendToArray=function(Q,g){Array.prototype.push.apply(Q,g)},q.prependToArray=function(Q,g){Array.prototype.unshift.apply(Q,g)},q.extendObj=function(Q,g){for(var J in g)Q[J]=g[J]},q.getInheritableProperty=function(Q,g){for(;Q&&!Q.has(g);)Q=Q.get("Parent");return Q?Q.get(g):null},q.inherit=function(Q,g,J){Q.prototype=Object.create(g.prototype),Q.prototype.constructor=Q;for(var re in J)Q.prototype[re]=J[re]},q.loadScript=function(Q,g){var J=document.createElement("script"),re=!1;J.setAttribute("src",Q),g&&(J.onload=function(){re||g(),re=!0}),document.getElementsByTagName("head")[0].appendChild(J)},q}();f.PageViewport=function(){function q(Y,X,Q,g,J,re){this.viewBox=Y,this.scale=X,this.rotation=Q,this.offsetX=g,this.offsetY=J;var ae=(Y[2]+Y[0])/2,fe=(Y[3]+Y[1])/2,pe,me,Se,ve;switch(Q=Q%360,Q=Q<0?Q+360:Q,Q){case 180:pe=-1,me=0,Se=0,ve=1;break;case 90:pe=0,me=1,Se=1,ve=0;break;case 270:pe=0,me=-1,Se=-1,ve=0;break;default:pe=1,me=0,Se=0,ve=-1;break}re&&(Se=-Se,ve=-ve);var we,Ne,De,je;pe===0?(we=Math.abs(fe-Y[1])*X+g,Ne=Math.abs(ae-Y[0])*X+J,De=Math.abs(Y[3]-Y[1])*X,je=Math.abs(Y[2]-Y[0])*X):(we=Math.abs(ae-Y[0])*X+g,Ne=Math.abs(fe-Y[1])*X+J,De=Math.abs(Y[2]-Y[0])*X,je=Math.abs(Y[3]-Y[1])*X),this.transform=[pe*X,me*X,Se*X,ve*X,we-pe*X*ae-Se*X*fe,Ne-me*X*ae-ve*X*fe],this.width=De,this.height=je,this.fontScale=X}return q.prototype={clone:function(X){X=X||{};var Q="scale"in X?X.scale:this.scale,g="rotation"in X?X.rotation:this.rotation;return new q(this.viewBox.slice(),Q,g,this.offsetX,this.offsetY,X.dontFlip)},convertToViewportPoint:function(X,Q){return z.applyTransform([X,Q],this.transform)},convertToViewportRectangle:function(X){var Q=z.applyTransform([X[0],X[1]],this.transform),g=z.applyTransform([X[2],X[3]],this.transform);return[Q[0],Q[1],g[0],g[1]]},convertToPdfPoint:function(X,Q){return z.applyInverseTransform([X,Q],this.transform)}},q}();function b(){var W={};return W.promise=new Promise(function(q,Y){W.resolve=q,W.reject=Y}),W}f.createPromiseCapability=b,function(){if(u.Promise){typeof u.Promise.all!="function"&&(u.Promise.all=function(re){var ae=0,fe=[],pe,me,Se=new u.Promise(function(ve,we){pe=ve,me=we});return re.forEach(function(ve,we){ae++,ve.then(function(Ne){fe[we]=Ne,ae--,ae===0&&pe(fe)},me)}),ae===0&&pe(fe),Se}),typeof u.Promise.resolve!="function"&&(u.Promise.resolve=function(re){return new u.Promise(function(ae){ae(re)})}),typeof u.Promise.reject!="function"&&(u.Promise.reject=function(re){return new u.Promise(function(ae,fe){fe(re)})}),typeof u.Promise.prototype.catch2!="function"&&(u.Promise.prototype.catch2=function(re){return u.Promise.prototype.then(void 0,re)});return}var q=0,Y=1,X=2,Q=500,g={handlers:[],running:!1,unhandledRejections:[],pendingRejectionCheck:!1,scheduleHandlers:function(ae){ae._status!==q&&(this.handlers=this.handlers.concat(ae._handlers),ae._handlers=[],!this.running&&(this.running=!0,setTimeout(this.runHandlers.bind(this),0)))},runHandlers:function(){for(var ae=1,fe=Date.now()+ae;this.handlers.length>0;){var pe=this.handlers.shift(),me=pe.thisPromise._status,Se=pe.thisPromise._value;try{me===Y?typeof pe.onResolve=="function"&&(Se=pe.onResolve(Se)):typeof pe.onReject=="function"&&(Se=pe.onReject(Se),me=Y,pe.thisPromise._unhandledRejection&&this.removeUnhandeledRejection(pe.thisPromise))}catch(ve){me=X,Se=ve}if(pe.nextPromise._updateStatus(me,Se),Date.now()>=fe)break}if(this.handlers.length>0){setTimeout(this.runHandlers.bind(this),0);return}this.running=!1},addUnhandledRejection:function(ae){this.unhandledRejections.push({promise:ae,time:Date.now()}),this.scheduleRejectionCheck()},removeUnhandeledRejection:function(ae){ae._unhandledRejection=!1;for(var fe=0;feQ){var me=this.unhandledRejections[pe].promise._value,Se="Unhandled rejection: "+me;me.stack&&(Se+=` +`+me.stack),A(Se),this.unhandledRejections.splice(pe),pe--}this.unhandledRejections.length&&this.scheduleRejectionCheck()}).bind(this),Q))}};function J(re){this._status=q,this._handlers=[];try{re.call(this,this._resolve.bind(this),this._reject.bind(this))}catch(ae){this._reject(ae)}}J.all=function(ae){var fe,pe,me=new J(function(Ue,ye){fe=Ue,pe=ye}),Se=ae.length,ve=[];if(Se===0)return fe(ve),me;function we(Ue){me._status!==X&&(ve=[],pe(Ue))}for(var Ne=0,De=ae.length;Ne>2,ve=(fe&3)<<4|pe>>4,we=re+1>6:64,Ne=re+2n in a?tA(a,n,{enumerable:!0,config */var CharLS=function(Module){Module=Module||{};var Module;Module||(Module=(typeof CharLS<"u"?CharLS:null)||{});var moduleOverrides={};for(var key in Module)Module.hasOwnProperty(key)&&(moduleOverrides[key]=Module[key]);var ENVIRONMENT_IS_WEB=typeof window=="object",ENVIRONMENT_IS_WORKER=typeof importScripts=="function",ENVIRONMENT_IS_NODE=typeof process=="object"&&typeof commonjsRequire=="function"&&!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_WORKER,ENVIRONMENT_IS_SHELL=!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_NODE&&!ENVIRONMENT_IS_WORKER;if(ENVIRONMENT_IS_NODE){Module.print||(Module.print=function(n){process.stdout.write(n+` `)}),Module.printErr||(Module.printErr=function(n){process.stderr.write(n+` `)});var nodeFS=require$$0,nodePath=require$$0;Module.read=function(n,s){n=nodePath.normalize(n);var u=nodeFS.readFileSync(n);return!u&&n!=nodePath.resolve(n)&&(n=path.join(__dirname,"..","src",n),u=nodeFS.readFileSync(n)),u&&!s&&(u=u.toString()),u},Module.readBinary=function(n){var s=Module.read(n,!0);return s.buffer||(s=new Uint8Array(s)),assert(s.buffer),s},Module.load=function(n){globalEval(read(n))},Module.thisProgram||(process.argv.length>1?Module.thisProgram=process.argv[1].replace(/\\/g,"/"):Module.thisProgram="unknown-program"),Module.arguments=process.argv.slice(2),module.exports=Module,process.on("uncaughtException",function(a){if(!(a instanceof ExitStatus))throw a}),Module.inspect=function(){return"[Emscripten Module object]"}}else if(ENVIRONMENT_IS_SHELL)Module.print||(Module.print=print),typeof printErr<"u"&&(Module.printErr=printErr),typeof read<"u"?Module.read=read:Module.read=function(){throw"no read() available (jsc?)"},Module.readBinary=function(n){if(typeof readbuffer=="function")return new Uint8Array(readbuffer(n));var s=read(n,"binary");return assert(typeof s=="object"),s},typeof scriptArgs<"u"?Module.arguments=scriptArgs:typeof arguments<"u"&&(Module.arguments=arguments);else if(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER){if(Module.read=function(n){var s=new XMLHttpRequest;return s.open("GET",n,!1),s.send(null),s.responseText},typeof arguments<"u"&&(Module.arguments=arguments),typeof console<"u")Module.print||(Module.print=function(n){console.log(n)}),Module.printErr||(Module.printErr=function(n){console.log(n)});else{var TRY_USE_DUMP=!1;Module.print||(Module.print=TRY_USE_DUMP&&typeof dump<"u"?function(a){dump(a)}:function(a){})}ENVIRONMENT_IS_WORKER&&(Module.load=importScripts),typeof Module.setWindowTitle>"u"&&(Module.setWindowTitle=function(a){document.title=a})}else throw"Unknown runtime environment. Where are we?";function globalEval(a){eval.call(null,a)}!Module.load&&Module.read&&(Module.load=function(n){globalEval(Module.read(n))}),Module.print||(Module.print=function(){}),Module.printErr||(Module.printErr=Module.print),Module.arguments||(Module.arguments=[]),Module.thisProgram||(Module.thisProgram="./this.program"),Module.print=Module.print,Module.printErr=Module.printErr,Module.preRun=[],Module.postRun=[];for(var key in moduleOverrides)moduleOverrides.hasOwnProperty(key)&&(Module[key]=moduleOverrides[key]);var Runtime={setTempRet0:function(a){tempRet0=a},getTempRet0:function(){return tempRet0},stackSave:function(){return STACKTOP},stackRestore:function(a){STACKTOP=a},getNativeTypeSize:function(a){switch(a){case"i1":case"i8":return 1;case"i16":return 2;case"i32":return 4;case"i64":return 8;case"float":return 4;case"double":return 8;default:{if(a[a.length-1]==="*")return Runtime.QUANTUM_SIZE;if(a[0]==="i"){var n=parseInt(a.substr(1));return assert(n%8===0),n/8}else return 0}}},getNativeFieldSize:function(a){return Math.max(Runtime.getNativeTypeSize(a),Runtime.QUANTUM_SIZE)},STACK_ALIGN:16,prepVararg:function(a,n){return n==="double"||n==="i64"?a&7&&(assert((a&7)===4),a+=4):assert((a&3)===0),a},getAlignSize:function(a,n,s){return!s&&(a=="i64"||a=="double")?8:a?Math.min(n||(a?Runtime.getNativeFieldSize(a):0),Runtime.QUANTUM_SIZE):Math.min(n,8)},dynCall:function(a,n,s){return s&&s.length?(s.splice||(s=Array.prototype.slice.call(s)),s.splice(0,0,n),Module["dynCall_"+a].apply(null,s)):Module["dynCall_"+a].call(null,n)},functionPointers:[],addFunction:function(a){for(var n=0;n=TOTAL_MEMORY){var s=enlargeMemory();if(!s)return DYNAMICTOP=n,0}return n},alignMemory:function(a,n){var s=a=Math.ceil(a/(n||16))*(n||16);return s},makeBigInt:function(a,n,s){var u=s?+(a>>>0)+ +(n>>>0)*4294967296:+(a>>>0)+ +(n|0)*4294967296;return u},GLOBAL_BASE:8,QUANTUM_SIZE:4,__dummy__:0};Module.Runtime=Runtime;var ABORT=!1,tempDouble,tempI64,tempRet0;function assert(a,n){a||abort("Assertion failed: "+n)}function getCFunc(ident){var func=Module["_"+ident];if(!func)try{func=eval("_"+ident)}catch(a){}return assert(func,"Cannot call unknown function "+ident+" (perhaps LLVM optimizations or closure removed it?)"),func}var cwrap,ccall;(function(){var JSfuncs={stackSave:function(){Runtime.stackSave()},stackRestore:function(){Runtime.stackRestore()},arrayToC:function(a){var n=Runtime.stackAlloc(a.length);return writeArrayToMemory(a,n),n},stringToC:function(a){var n=0;return a!=null&&a!==0&&(n=Runtime.stackAlloc((a.length<<2)+1),writeStringToMemory(a,n)),n}},toC={string:JSfuncs.stringToC,array:JSfuncs.arrayToC};ccall=function(n,s,u,f,m){var A=getCFunc(n),v=[],y=0;if(f)for(var T=0;T>0]=n;break;case"i8":HEAP8[a>>0]=n;break;case"i16":HEAP16[a>>1]=n;break;case"i32":HEAP32[a>>2]=n;break;case"i64":tempI64=[n>>>0,(tempDouble=n,+Math_abs(tempDouble)>=1?tempDouble>0?(Math_min(+Math_floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math_ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[a>>2]=tempI64[0],HEAP32[a+4>>2]=tempI64[1];break;case"float":HEAPF32[a>>2]=n;break;case"double":HEAPF64[a>>3]=n;break;default:abort("invalid type for setValue: "+s)}}Module.setValue=setValue;function getValue(a,n,s){switch(n=n||"i8",n.charAt(n.length-1)==="*"&&(n="i32"),n){case"i1":return HEAP8[a>>0];case"i8":return HEAP8[a>>0];case"i16":return HEAP16[a>>1];case"i32":return HEAP32[a>>2];case"i64":return HEAP32[a>>2];case"float":return HEAPF32[a>>2];case"double":return HEAPF64[a>>3];default:abort("invalid type for setValue: "+n)}return null}Module.getValue=getValue;var ALLOC_NORMAL=0,ALLOC_STACK=1,ALLOC_STATIC=2,ALLOC_DYNAMIC=3,ALLOC_NONE=4;Module.ALLOC_NORMAL=ALLOC_NORMAL,Module.ALLOC_STACK=ALLOC_STACK,Module.ALLOC_STATIC=ALLOC_STATIC,Module.ALLOC_DYNAMIC=ALLOC_DYNAMIC,Module.ALLOC_NONE=ALLOC_NONE;function allocate(a,n,s,u){var f,m;typeof a=="number"?(f=!0,m=a):(f=!1,m=a.length);var A=typeof n=="string"?n:null,v;if(s==ALLOC_NONE?v=u:v=[_malloc,Runtime.stackAlloc,Runtime.staticAlloc,Runtime.dynamicAlloc][s===void 0?ALLOC_STATIC:s](Math.max(m,A?1:n.length)),f){var u=v,y;for(assert((v&3)==0),y=v+(m&-4);u>2]=0;for(y=v+m;u>0]=0;return v}if(A==="i8")return a.subarray||a.slice?HEAPU8.set(a,v):HEAPU8.set(new Uint8Array(a),v),v;for(var T=0,E,S,I;T>0],s|=u,!(u==0&&!n||(f++,n&&f==n)););n||(n=f);var m="";if(s<128){for(var A=1024,v;n>0;)v=String.fromCharCode.apply(String,HEAPU8.subarray(a,a+Math.min(n,A))),m=m?m+v:v,a+=A,n-=A;return m}return Module.UTF8ToString(a)}Module.Pointer_stringify=Pointer_stringify;function AsciiToString(a){for(var n="";;){var s=HEAP8[a++>>0];if(!s)return n;n+=String.fromCharCode(s)}}Module.AsciiToString=AsciiToString;function stringToAscii(a,n){return writeAsciiToMemory(a,n,!1)}Module.stringToAscii=stringToAscii;function UTF8ArrayToString(a,n){for(var s,u,f,m,A,v,y="";;){if(s=a[n++],!s)return y;if(!(s&128)){y+=String.fromCharCode(s);continue}if(u=a[n++]&63,(s&224)==192){y+=String.fromCharCode((s&31)<<6|u);continue}if(f=a[n++]&63,(s&240)==224?s=(s&15)<<12|u<<6|f:(m=a[n++]&63,(s&248)==240?s=(s&7)<<18|u<<12|f<<6|m:(A=a[n++]&63,(s&252)==248?s=(s&3)<<24|u<<18|f<<12|m<<6|A:(v=a[n++]&63,s=(s&1)<<30|u<<24|f<<18|m<<12|A<<6|v))),s<65536)y+=String.fromCharCode(s);else{var T=s-65536;y+=String.fromCharCode(55296|T>>10,56320|T&1023)}}}Module.UTF8ArrayToString=UTF8ArrayToString;function UTF8ToString(a){return UTF8ArrayToString(HEAPU8,a)}Module.UTF8ToString=UTF8ToString;function stringToUTF8Array(a,n,s,u){if(!(u>0))return 0;for(var f=s,m=s+u-1,A=0;A=55296&&v<=57343&&(v=65536+((v&1023)<<10)|a.charCodeAt(++A)&1023),v<=127){if(s>=m)break;n[s++]=v}else if(v<=2047){if(s+1>=m)break;n[s++]=192|v>>6,n[s++]=128|v&63}else if(v<=65535){if(s+2>=m)break;n[s++]=224|v>>12,n[s++]=128|v>>6&63,n[s++]=128|v&63}else if(v<=2097151){if(s+3>=m)break;n[s++]=240|v>>18,n[s++]=128|v>>12&63,n[s++]=128|v>>6&63,n[s++]=128|v&63}else if(v<=67108863){if(s+4>=m)break;n[s++]=248|v>>24,n[s++]=128|v>>18&63,n[s++]=128|v>>12&63,n[s++]=128|v>>6&63,n[s++]=128|v&63}else{if(s+5>=m)break;n[s++]=252|v>>30,n[s++]=128|v>>24&63,n[s++]=128|v>>18&63,n[s++]=128|v>>12&63,n[s++]=128|v>>6&63,n[s++]=128|v&63}}return n[s]=0,s-f}Module.stringToUTF8Array=stringToUTF8Array;function stringToUTF8(a,n,s){return stringToUTF8Array(a,HEAPU8,n,s)}Module.stringToUTF8=stringToUTF8;function lengthBytesUTF8(a){for(var n=0,s=0;s=55296&&u<=57343&&(u=65536+((u&1023)<<10)|a.charCodeAt(++s)&1023),u<=127?++n:u<=2047?n+=2:u<=65535?n+=3:u<=2097151?n+=4:u<=67108863?n+=5:n+=6}return n}Module.lengthBytesUTF8=lengthBytesUTF8;function UTF16ToString(a){for(var n=0,s="";;){var u=HEAP16[a+n*2>>1];if(u==0)return s;++n,s+=String.fromCharCode(u)}}Module.UTF16ToString=UTF16ToString;function stringToUTF16(a,n,s){if(s===void 0&&(s=2147483647),s<2)return 0;s-=2;for(var u=n,f=s>1]=A,n+=2}return HEAP16[n>>1]=0,n-u}Module.stringToUTF16=stringToUTF16;function lengthBytesUTF16(a){return a.length*2}Module.lengthBytesUTF16=lengthBytesUTF16;function UTF32ToString(a){for(var n=0,s="";;){var u=HEAP32[a+n*4>>2];if(u==0)return s;if(++n,u>=65536){var f=u-65536;s+=String.fromCharCode(55296|f>>10,56320|f&1023)}else s+=String.fromCharCode(u)}}Module.UTF32ToString=UTF32ToString;function stringToUTF32(a,n,s){if(s===void 0&&(s=2147483647),s<4)return 0;for(var u=n,f=u+s-4,m=0;m=55296&&A<=57343){var v=a.charCodeAt(++m);A=65536+((A&1023)<<10)|v&1023}if(HEAP32[n>>2]=A,n+=4,n+4>f)break}return HEAP32[n>>2]=0,n-u}Module.stringToUTF32=stringToUTF32;function lengthBytesUTF32(a){for(var n=0,s=0;s=55296&&u<=57343&&++s,n+=4}return n}Module.lengthBytesUTF32=lengthBytesUTF32;function demangle(a){var n=!!Module.___cxa_demangle;if(n)try{var s=_malloc(a.length);writeStringToMemory(a.substr(1),s);var u=_malloc(4),f=Module.___cxa_demangle(s,0,0,u);if(getValue(u,"i32")===0&&f)return Pointer_stringify(f)}catch{}finally{s&&_free(s),u&&_free(u),f&&_free(f)}var m=3,A={v:"void",b:"bool",c:"char",s:"short",i:"int",l:"long",f:"float",d:"double",w:"wchar_t",a:"signed char",h:"unsigned char",t:"unsigned short",j:"unsigned int",m:"unsigned long",x:"long long",y:"unsigned long long",z:"..."},v=[],y=!0;function T(){m++,a[m]==="K"&&m++;for(var I=[];a[m]!=="E";){if(a[m]==="S"){m++;var e=a.indexOf("_",m),F=a.substring(m,e)||0;I.push(v[F]||"?"),m=e+1;continue}if(a[m]==="C"){I.push(I[I.length-1]),m+=2;continue}var M=parseInt(a.substr(m)),L=M.toString().length;if(!M||!L){m--;break}var V=a.substr(m+L,M);I.push(V),v.push(V),m+=L+M}return m++,I}function E(I,e,F){e=e||1/0;var M="",L=[];function V(){return"("+L.join(", ")+")"}var B;if(a[m]==="N"){if(B=T().join("::"),e--,e===0)return I?[B]:B}else{(a[m]==="K"||y&&a[m]==="L")&&m++;var z=parseInt(a.substr(m));if(z){var b=z.toString().length;B=a.substr(m+b,z),m+=b+z}}if(y=!1,a[m]==="I"){m++;var W=E(!0),q=E(!0,1,!0);M+=q[0]+" "+B+"<"+W.join(", ")+">"}else M=B;e:for(;m0;){var Y=a[m++];if(Y in A)L.push(A[Y]);else switch(Y){case"P":L.push(E(!0,1,!0)[0]+"*");break;case"R":L.push(E(!0,1,!0)[0]+"&");break;case"L":{m++;var X=a.indexOf("E",m),z=X-m;L.push(a.substr(m,z)),m+=z+2;break}case"A":{var z=parseInt(a.substr(m));if(m+=z.toString().length,a[m]!=="_")throw"?";m++,L.push(E(!0,1,!0)[0]+" ["+z+"]");break}case"E":break e;default:M+="?"+Y;break e}}return!F&&L.length===1&&L[0]==="void"&&(L=[]),I?(M&&L.push(M+"?"),L):M+V()}var S=a;try{if(a=="Object._main"||a=="_main")return"main()";if(typeof a=="number"&&(a=Pointer_stringify(a)),a[0]!=="_"||a[1]!=="_"||a[2]!=="Z")return a;switch(a[3]){case"n":return"operator new()";case"d":return"operator delete()"}S=E()}catch{S+="?"}return S.indexOf("?")>=0&&!n&&Runtime.warnOnce("warning: a problem occurred in builtin C++ name demangling; build with -s DEMANGLE_SUPPORT=1 to link in libcxxabi demangling"),S}function demangleAll(a){return a.replace(/__Z[\w\d_]+/g,function(n){var s=demangle(n);return n===s?n:n+" ["+s+"]"})}function jsStackTrace(){var a=new Error;if(!a.stack){try{throw new Error(0)}catch(n){a=n}if(!a.stack)return"(no stack trace available)"}return a.stack.toString()}function stackTrace(){return demangleAll(jsStackTrace())}Module.stackTrace=stackTrace;var PAGE_SIZE=4096;function alignMemoryPage(a){return a%4096>0&&(a+=4096-a%4096),a}var HEAP,HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64,STATIC_BASE=0,STATICTOP=0,staticSealed=!1,STACK_BASE=0,STACKTOP=0,STACK_MAX=0,DYNAMIC_BASE=0,DYNAMICTOP=0;function enlargeMemory(){var a=Math.pow(2,31);if(DYNAMICTOP>=a)return!1;for(;TOTAL_MEMORY<=DYNAMICTOP;)if(TOTAL_MEMORY=a)return!1;try{if(ArrayBuffer.transfer)buffer=ArrayBuffer.transfer(buffer,TOTAL_MEMORY);else{var s=HEAP8;buffer=new ArrayBuffer(TOTAL_MEMORY)}}catch{return!1}var u=_emscripten_replace_memory(buffer);return u?(Module.buffer=buffer,Module.HEAP8=HEAP8=new Int8Array(buffer),Module.HEAP16=HEAP16=new Int16Array(buffer),Module.HEAP32=HEAP32=new Int32Array(buffer),Module.HEAPU8=HEAPU8=new Uint8Array(buffer),Module.HEAPU16=HEAPU16=new Uint16Array(buffer),Module.HEAPU32=HEAPU32=new Uint32Array(buffer),Module.HEAPF32=HEAPF32=new Float32Array(buffer),Module.HEAPF64=HEAPF64=new Float64Array(buffer),ArrayBuffer.transfer||HEAP8.set(s),!0):!1}var byteLength;try{byteLength=Function.prototype.call.bind(Object.getOwnPropertyDescriptor(ArrayBuffer.prototype,"byteLength").get),byteLength(new ArrayBuffer(4))}catch(a){byteLength=function(n){return n.byteLength}}for(var TOTAL_STACK=Module.TOTAL_STACK||5242880,TOTAL_MEMORY=Module.TOTAL_MEMORY||16777216,totalMemory=64*1024;totalMemory0;){var n=a.shift();if(typeof n=="function"){n();continue}var s=n.func;typeof s=="number"?n.arg===void 0?Runtime.dynCall("v",s):Runtime.dynCall("vi",s,[n.arg]):s(n.arg===void 0?null:n.arg)}}var __ATPRERUN__=[],__ATINIT__=[],__ATMAIN__=[],__ATEXIT__=[],__ATPOSTRUN__=[],runtimeInitialized=!1;function preRun(){if(Module.preRun)for(typeof Module.preRun=="function"&&(Module.preRun=[Module.preRun]);Module.preRun.length;)addOnPreRun(Module.preRun.shift());callRuntimeCallbacks(__ATPRERUN__)}function ensureInitRuntime(){runtimeInitialized||(runtimeInitialized=!0,callRuntimeCallbacks(__ATINIT__))}function preMain(){callRuntimeCallbacks(__ATMAIN__)}function exitRuntime(){callRuntimeCallbacks(__ATEXIT__)}function postRun(){if(Module.postRun)for(typeof Module.postRun=="function"&&(Module.postRun=[Module.postRun]);Module.postRun.length;)addOnPostRun(Module.postRun.shift());callRuntimeCallbacks(__ATPOSTRUN__)}function addOnPreRun(a){__ATPRERUN__.unshift(a)}Module.addOnPreRun=addOnPreRun;function addOnInit(a){__ATINIT__.unshift(a)}Module.addOnInit=addOnInit;function addOnPreMain(a){__ATMAIN__.unshift(a)}Module.addOnPreMain=addOnPreMain;function addOnExit(a){__ATEXIT__.unshift(a)}Module.addOnExit=addOnExit;function addOnPostRun(a){__ATPOSTRUN__.unshift(a)}Module.addOnPostRun=addOnPostRun;function intArrayFromString(a,n,s){var u=s>0?s:lengthBytesUTF8(a)+1,f=new Array(u),m=stringToUTF8Array(a,f,0,f.length);return n&&(f.length=m),f}Module.intArrayFromString=intArrayFromString;function intArrayToString(a){for(var n=[],s=0;s255&&(u&=255),n.push(String.fromCharCode(u))}return n.join("")}Module.intArrayToString=intArrayToString;function writeStringToMemory(a,n,s){for(var u=intArrayFromString(a,s),f=0;f>0]=m,f=f+1}}Module.writeStringToMemory=writeStringToMemory;function writeArrayToMemory(a,n){for(var s=0;s>0]=a[s]}Module.writeArrayToMemory=writeArrayToMemory;function writeAsciiToMemory(a,n,s){for(var u=0;u>0]=a.charCodeAt(u);s||(HEAP8[n>>0]=0)}Module.writeAsciiToMemory=writeAsciiToMemory,(!Math.imul||Math.imul(4294967295,5)!==-5)&&(Math.imul=function a(n,s){var u=n>>>16,f=n&65535,m=s>>>16,A=s&65535;return f*A+(u*A+f*m<<16)|0}),Math.imul=Math.imul,Math.clz32||(Math.clz32=function(a){a=a>>>0;for(var n=0;n<32;n++)if(a&1<<31-n)return n;return 32}),Math.clz32=Math.clz32;var Math_abs=Math.abs,Math_ceil=Math.ceil,Math_floor=Math.floor,Math_min=Math.min,runDependencies=0,dependenciesFulfilled=null;function addRunDependency(a){runDependencies++,Module.monitorRunDependencies&&Module.monitorRunDependencies(runDependencies)}Module.addRunDependency=addRunDependency;function removeRunDependency(a){if(runDependencies--,Module.monitorRunDependencies&&Module.monitorRunDependencies(runDependencies),runDependencies==0&&dependenciesFulfilled){var n=dependenciesFulfilled;dependenciesFulfilled=null,n()}}Module.removeRunDependency=removeRunDependency,Module.preloadedImages={},Module.preloadedAudios={},STATIC_BASE=8,STATICTOP=STATIC_BASE+59744,__ATINIT__.push({func:function(){__GLOBAL__I_000101()}},{func:function(){__GLOBAL__sub_I_jpegls_cpp()}},{func:function(){}}),allocate([0,0,0,0,0,0,0,0,84,144,0,0,31,194,0,0,216,0,0,0,0,0,0,0,84,144,0,0,237,191,0,0,48,0,0,0,0,0,0,0,44,144,0,0,41,192,0,0,84,144,0,0,55,192,0,0,48,0,0,0,0,0,0,0,84,144,0,0,115,192,0,0,48,0,0,0,0,0,0,0,84,144,0,0,175,192,0,0,152,3,0,0,0,0,0,0,84,144,0,0,241,192,0,0,216,3,0,0,0,0,0,0,84,144,0,0,55,193,0,0,48,0,0,0,0,0,0,0,84,144,0,0,95,193,0,0,48,0,0,0,0,0,0,0,84,144,0,0,135,193,0,0,48,0,0,0,0,0,0,0,84,144,0,0,175,193,0,0,48,0,0,0,0,0,0,0,84,144,0,0,216,193,0,0,48,0,0,0,0,0,0,0,84,144,0,0,241,193,0,0,48,0,0,0,0,0,0,0,44,144,0,0,13,194,0,0,84,144,0,0,80,194,0,0,216,0,0,0,0,0,0,0,84,144,0,0,44,195,0,0,216,0,0,0,0,0,0,0,84,144,0,0,139,194,0,0,48,0,0,0,0,0,0,0,84,144,0,0,179,194,0,0,48,0,0,0,0,0,0,0,84,144,0,0,219,194,0,0,48,0,0,0,0,0,0,0,84,144,0,0,3,195,0,0,48,0,0,0,0,0,0,0,84,144,0,0,103,195,0,0,216,0,0,0,0,0,0,0,84,144,0,0,157,195,0,0,216,0,0,0,0,0,0,0,84,144,0,0,211,195,0,0,216,0,0,0,0,0,0,0,84,144,0,0,8,196,0,0,216,0,0,0,0,0,0,0,84,144,0,0,71,196,0,0,216,0,0,0,0,0,0,0,84,144,0,0,138,196,0,0,160,1,0,0,0,0,0,0,44,144,0,0,120,196,0,0,84,144,0,0,187,196,0,0,160,1,0,0,0,0,0,0,84,144,0,0,246,196,0,0,160,1,0,0,0,0,0,0,84,144,0,0,49,197,0,0,160,1,0,0,0,0,0,0,84,144,0,0,103,197,0,0,160,1,0,0,0,0,0,0,84,144,0,0,157,197,0,0,160,1,0,0,0,0,0,0,84,144,0,0,210,197,0,0,160,1,0,0,0,0,0,0,84,144,0,0,17,198,0,0,160,1,0,0,0,0,0,0,84,144,0,0,86,198,0,0,72,3,0,0,0,0,0,0,84,144,0,0,162,198,0,0,56,2,0,0,0,0,0,0,44,144,0,0,182,198,0,0,84,144,0,0,196,198,0,0,56,2,0,0,0,0,0,0,84,144,0,0,112,199,0,0,96,2,0,0,0,0,0,0,44,144,0,0,125,199,0,0,84,144,0,0,138,199,0,0,96,2,0,0,0,0,0,0,44,144,0,0,156,199,0,0,84,144,0,0,169,199,0,0,96,2,0,0,0,0,0,0,84,144,0,0,181,199,0,0,120,2,0,0,0,0,0,0,84,144,0,0,214,199,0,0,144,2,0,0,0,0,0,0,84,144,0,0,28,200,0,0,144,2,0,0,0,0,0,0,84,144,0,0,248,199,0,0,176,2,0,0,0,0,0,0,84,144,0,0,62,200,0,0,160,2,0,0,0,0,0,0,84,144,0,0,99,200,0,0,160,2,0,0,0,0,0,0,84,144,0,0,182,221,0,0,160,3,0,0,0,0,0,0,84,144,0,0,245,221,0,0,160,3,0,0,0,0,0,0,84,144,0,0,13,222,0,0,152,3,0,0,0,0,0,0,84,144,0,0,38,222,0,0,152,3,0,0,0,0,0,0,44,144,0,0,62,222,0,0,84,144,0,0,87,222,0,0,104,2,0,0,0,0,0,0,44,144,0,0,110,222,0,0,84,144,0,0,135,222,0,0,72,3,0,0,0,0,0,0,84,144,0,0,161,222,0,0,56,3,0,0,0,0,0,0,44,144,0,0,187,222,0,0,84,144,0,0,205,222,0,0,112,3,0,0,0,0,0,0,84,144,0,0,247,222,0,0,112,3,0,0,0,0,0,0,44,144,0,0,33,223,0,0,44,144,0,0,82,223,0,0,124,144,0,0,131,223,0,0,0,0,0,0,1,0,0,0,120,3,0,0,3,244,255,255,124,144,0,0,178,223,0,0,0,0,0,0,1,0,0,0,136,3,0,0,3,244,255,255,124,144,0,0,225,223,0,0,0,0,0,0,1,0,0,0,120,3,0,0,3,244,255,255,124,144,0,0,16,224,0,0,0,0,0,0,1,0,0,0,136,3,0,0,3,244,255,255,84,144,0,0,63,224,0,0,80,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,84,144,0,0,187,224,0,0,48,3,0,0,0,0,0,0,124,144,0,0,209,224,0,0,0,0,0,0,2,0,0,0,32,4,0,0,2,0,0,0,64,10,0,0,2,0,0,0,124,144,0,0,227,224,0,0,0,0,0,0,2,0,0,0,32,4,0,0,2,0,0,0,72,10,0,0,2,0,0,0,124,144,0,0,5,225,0,0,0,0,0,0,2,0,0,0,32,4,0,0,2,0,0,0,72,10,0,0,2,0,0,0,124,144,0,0,40,225,0,0,0,0,0,0,2,0,0,0,32,4,0,0,2,0,0,0,72,10,0,0,2,0,0,0,84,144,0,0,75,225,0,0,144,4,0,0,0,0,0,0,84,144,0,0,109,225,0,0,144,4,0,0,0,0,0,0,124,144,0,0,144,225,0,0,0,0,0,0,2,0,0,0,32,4,0,0,2,0,0,0,72,10,0,0,2,0,0,0,84,144,0,0,178,225,0,0,32,4,0,0,0,0,0,0,84,144,0,0,200,225,0,0,32,4,0,0,0,0,0,0,84,144,0,0,220,225,0,0,32,4,0,0,0,0,0,0,124,144,0,0,240,225,0,0,0,0,0,0,2,0,0,0,32,4,0,0,2,0,0,0,64,10,0,0,2,0,0,0,84,144,0,0,2,226,0,0,32,4,0,0,0,0,0,0,84,144,0,0,23,226,0,0,32,4,0,0,0,0,0,0,124,144,0,0,44,226,0,0,0,0,0,0,2,0,0,0,32,4,0,0,2,0,0,0,80,10,0,0,0,0,0,0,124,144,0,0,112,226,0,0,0,0,0,0,2,0,0,0,32,4,0,0,2,0,0,0,104,10,0,0,0,0,0,0,124,144,0,0,180,226,0,0,0,0,0,0,2,0,0,0,32,4,0,0,2,0,0,0,128,10,0,0,0,0,0,0,124,144,0,0,248,226,0,0,0,0,0,0,2,0,0,0,32,4,0,0,2,0,0,0,152,10,0,0,0,0,0,0,124,144,0,0,60,227,0,0,0,0,0,0,3,0,0,0,32,4,0,0,2,0,0,0,176,10,0,0,2,0,0,0,184,10,0,0,0,8,0,0,124,144,0,0,129,227,0,0,0,0,0,0,3,0,0,0,32,4,0,0,2,0,0,0,176,10,0,0,2,0,0,0,192,10,0,0,0,8,0,0,124,144,0,0,198,227,0,0,0,0,0,0,2,0,0,0,32,4,0,0,2,0,0,0,200,10,0,0,0,8,0,0,124,144,0,0,11,228,0,0,0,0,0,0,2,0,0,0,32,4,0,0,2,0,0,0,200,10,0,0,0,8,0,0,124,144,0,0,80,228,0,0,0,0,0,0,2,0,0,0,32,4,0,0,2,0,0,0,208,10,0,0,2,0,0,0,124,144,0,0,108,228,0,0,0,0,0,0,2,0,0,0,32,4,0,0,2,0,0,0,208,10,0,0,2,0,0,0,124,144,0,0,136,228,0,0,0,0,0,0,2,0,0,0,32,4,0,0,2,0,0,0,208,10,0,0,2,0,0,0,124,144,0,0,164,228,0,0,0,0,0,0,2,0,0,0,32,4,0,0,2,0,0,0,208,10,0,0,2,0,0,0,124,144,0,0,192,228,0,0,0,0,0,0,2,0,0,0,32,4,0,0,2,0,0,0,216,10,0,0,0,0,0,0,124,144,0,0,6,229,0,0,0,0,0,0,2,0,0,0,32,4,0,0,2,0,0,0,224,10,0,0,0,0,0,0,124,144,0,0,76,229,0,0,0,0,0,0,2,0,0,0,32,4,0,0,2,0,0,0,232,10,0,0,0,0,0,0,124,144,0,0,146,229,0,0,0,0,0,0,2,0,0,0,32,4,0,0,2,0,0,0,240,10,0,0,0,0,0,0,124,144,0,0,216,229,0,0,0,0,0,0,2,0,0,0,32,4,0,0,2,0,0,0,248,10,0,0,2,0,0,0,124,144,0,0,237,229,0,0,0,0,0,0,2,0,0,0,32,4,0,0,2,0,0,0,248,10,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,44,144,0,0,73,233,0,0,44,144,0,0,50,233,0,0,124,144,0,0,28,233,0,0,0,0,0,0,1,0,0,0,8,11,0,0,0,0,0,0,124,144,0,0,237,232,0,0,0,0,0,0,1,0,0,0,8,11,0,0,0,0,0,0,124,144,0,0,215,232,0,0,0,0,0,0,1,0,0,0,0,11,0,0,0,0,0,0,124,144,0,0,168,232,0,0,0,0,0,0,1,0,0,0,0,11,0,0,0,0,0,0,44,144,0,0,149,232,0,0,44,144,0,0,115,232,0,0,44,144,0,0,81,232,0,0,44,144,0,0,60,232,0,0,44,144,0,0,39,232,0,0,44,144,0,0,14,232,0,0,44,144,0,0,245,231,0,0,44,144,0,0,220,231,0,0,44,144,0,0,195,231,0,0,44,144,0,0,171,231,0,0,44,144,0,0,190,232,0,0,44,144,0,0,3,233],"i8",ALLOC_NONE,Runtime.GLOBAL_BASE),allocate([156,143,0,0,0,0,0,0,8,2,0,0,1,0,0,0,2,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,248,1,0,0,3,0,0,0,4,0,0,0,2,0,0,0,2,0,0,0,2,0,0,0,0,0,0,0,232,1,0,0,5,0,0,0,6,0,0,0,3,0,0,0,3,0,0,0,3,0,0,0,0,0,0,0,216,1,0,0,7,0,0,0,8,0,0,0,4,0,0,0,4,0,0,0,4,0,0,0,0,0,0,0,200,1,0,0,9,0,0,0,10,0,0,0,5,0,0,0,5,0,0,0,5,0,0,0,0,0,0,0,184,1,0,0,11,0,0,0,12,0,0,0,6,0,0,0,6,0,0,0,6,0,0,0,0,0,0,0,168,1,0,0,13,0,0,0,14,0,0,0,7,0,0,0,7,0,0,0,7,0,0,0,0,0,0,0,144,1,0,0,15,0,0,0,16,0,0,0,8,0,0,0,8,0,0,0,8,0,0,0,0,0,0,0,128,1,0,0,17,0,0,0,18,0,0,0,9,0,0,0,1,0,0,0,9,0,0,0,0,0,0,0,112,1,0,0,19,0,0,0,20,0,0,0,10,0,0,0,2,0,0,0,10,0,0,0,0,0,0,0,96,1,0,0,21,0,0,0,22,0,0,0,11,0,0,0,3,0,0,0,11,0,0,0,0,0,0,0,80,1,0,0,23,0,0,0,24,0,0,0,12,0,0,0,4,0,0,0,12,0,0,0,0,0,0,0,64,1,0,0,25,0,0,0,26,0,0,0,13,0,0,0,5,0,0,0,13,0,0,0,0,0,0,0,240,0,0,0,27,0,0,0,28,0,0,0,14,0,0,0,6,0,0,0,14,0,0,0,0,0,0,0,224,0,0,0,29,0,0,0,30,0,0,0,15,0,0,0,7,0,0,0,15,0,0,0,0,0,0,0,16,0,0,0,31,0,0,0,32,0,0,0,16,0,0,0,8,0,0,0,16,0,0,0,0,0,0,0,200,0,0,0,33,0,0,0,34,0,0,0,1,0,0,0,2,0,0,0,0,0,0,0,184,0,0,0,33,0,0,0,35,0,0,0,3,0,0,0,4,0,0,0,56,0,0,0,0,0,0,0,216,3,0,0,36,0,0,0,37,0,0,0,200,255,255,255,200,255,255,255,216,3,0,0,38,0,0,0,39,0,0,0,56,0,0,0,0,0,0,0,104,0,0,0,40,0,0,0,41,0,0,0,200,255,255,255,200,255,255,255,104,0,0,0,42,0,0,0,43,0,0,0,0,0,0,0,88,0,0,0,44,0,0,0,45,0,0,0,17,0,0,0,1,0,0,0,1,0,0,0,5,0,0,0,1,0,0,0,2,0,0,0,2,0,0,0,3,0,0,0,4,0,0,0,17,0,0,0,3,0,0,0,18,0,0,0,104,141,0,0,64,141,0,0,84,141,0,0,124,141,0,0,0,0,0,0,32,0,0,0,46,0,0,0,47,0,0,0,6,0,0,0,7,0,0,0,0,0,0,0,56,0,0,0,48,0,0,0,49,0,0,0,8,0,0,0,9,0,0,0,0,0,0,0,72,0,0,0,50,0,0,0,51,0,0,0,10,0,0,0,11,0,0,0,0,0,0,0,120,0,0,0,52,0,0,0,53,0,0,0,12,0,0,0,13,0,0,0,0,0,0,0,136,0,0,0,54,0,0,0,55,0,0,0,14,0,0,0,15,0,0,0,0,0,0,0,152,0,0,0,56,0,0,0,57,0,0,0,16,0,0,0,17,0,0,0,0,0,0,0,168,0,0,0,58,0,0,0,59,0,0,0,18,0,0,0,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,2,0,0,0,2,0,0,0,2,0,0,0,2,0,0,0,3,0,0,0,3,0,0,0,3,0,0,0,3,0,0,0,4,0,0,0,4,0,0,0,5,0,0,0,5,0,0,0,6,0,0,0,6,0,0,0,7,0,0,0,7,0,0,0,8,0,0,0,9,0,0,0,10,0,0,0,11,0,0,0,12,0,0,0,13,0,0,0,14,0,0,0,15,0,0,0,0,0,0,0,216,0,0,0,60,0,0,0,61,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,62,0,0,0,63,0,0,0,20,0,0,0,21,0,0,0,0,0,0,0,16,1,0,0,64,0,0,0,65,0,0,0,22,0,0,0,23,0,0,0,0,0,0,0,32,1,0,0,66,0,0,0,67,0,0,0,24,0,0,0,25,0,0,0,0,0,0,0,48,1,0,0,68,0,0,0,69,0,0,0,26,0,0,0,27,0,0,0,0,0,0,0,160,1,0,0,70,0,0,0,71,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,24,2,0,0,72,0,0,0,73,0,0,0,5,0,0,0,1,0,0,0,4,0,0,0,5,0,0,0,2,0,0,0,0,0,0,0,40,2,0,0,74,0,0,0,75,0,0,0,18,0,0,0,0,0,0,0,64,2,0,0,76,0,0,0,77,0,0,0,19,0,0,0,2,0,0,0,0,0,0,0,80,2,0,0,78,0,0,0,79,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,104,2,0,0,80,0,0,0,81,0,0,0,7,0,0,0,0,0,0,0,128,2,0,0,82,0,0,0,83,0,0,0,8,0,0,0,0,0,0,0,160,2,0,0,84,0,0,0,85,0,0,0,86,0,0,0,87,0,0,0,6,0,0,0,2,0,0,0,9,0,0,0,28,0,0,0,0,0,0,0,208,2,0,0,84,0,0,0,88,0,0,0,86,0,0,0,87,0,0,0,6,0,0,0,3,0,0,0,10,0,0,0,29,0,0,0,0,0,0,0,224,2,0,0,84,0,0,0,89,0,0,0,86,0,0,0,87,0,0,0,6,0,0,0,4,0,0,0,11,0,0,0,30,0,0,0,0,0,0,0,0,0,0,0,1,203,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,192,3,0,0,192,4,0,0,192,5,0,0,192,6,0,0,192,7,0,0,192,8,0,0,192,9,0,0,192,10,0,0,192,11,0,0,192,12,0,0,192,13,0,0,192,14,0,0,192,15,0,0,192,16,0,0,192,17,0,0,192,18,0,0,192,19,0,0,192,20,0,0,192,21,0,0,192,22,0,0,192,23,0,0,192,24,0,0,192,25,0,0,192,26,0,0,192,27,0,0,192,28,0,0,192,29,0,0,192,30,0,0,192,31,0,0,192,0,0,0,179,1,0,0,195,2,0,0,195,3,0,0,195,4,0,0,195,5,0,0,195,6,0,0,195,7,0,0,195,8,0,0,195,9,0,0,195,10,0,0,195,11,0,0,195,12,0,0,195,13,0,0,211,14,0,0,195,15,0,0,195,0,0,12,187,1,0,12,195,2,0,12,195,3,0,12,195,4,0,12,211,88,146,0,0,200,146,0,0,56,147,0,0,56,147,0,0,120,187,0,0,168,155,0,0,168,149,0,0,0,0,0,0,10,0,0,0,100,0,0,0,232,3,0,0,16,39,0,0,160,134,1,0,64,66,15,0,128,150,152,0,0,225,245,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,0,0,0,9,0,0,0,159,219,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,0,0,0,0,0,0,0,9,0,0,0,151,215,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,11,0,0,0,9,0,0,0,143,211,0,0,0,4,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,2,0,0,0,3,0,0,0,4,0,0,0,5,0,0,0,6,0,0,0,7,0,0,0,8,0,0,0,9,0,0,0,10,0,0,0,11,0,0,0,12,0,0,0,13,0,0,0,14,0,0,0,15,0,0,0,16,0,0,0,17,0,0,0,18,0,0,0,19,0,0,0,20,0,0,0,21,0,0,0,22,0,0,0,23,0,0,0,24,0,0,0,25,0,0,0,26,0,0,0,27,0,0,0,28,0,0,0,29,0,0,0,30,0,0,0,31,0,0,0,32,0,0,0,33,0,0,0,34,0,0,0,35,0,0,0,36,0,0,0,37,0,0,0,38,0,0,0,39,0,0,0,40,0,0,0,41,0,0,0,42,0,0,0,43,0,0,0,44,0,0,0,45,0,0,0,46,0,0,0,47,0,0,0,48,0,0,0,49,0,0,0,50,0,0,0,51,0,0,0,52,0,0,0,53,0,0,0,54,0,0,0,55,0,0,0,56,0,0,0,57,0,0,0,58,0,0,0,59,0,0,0,60,0,0,0,61,0,0,0,62,0,0,0,63,0,0,0,64,0,0,0,65,0,0,0,66,0,0,0,67,0,0,0,68,0,0,0,69,0,0,0,70,0,0,0,71,0,0,0,72,0,0,0,73,0,0,0,74,0,0,0,75,0,0,0,76,0,0,0,77,0,0,0,78,0,0,0,79,0,0,0,80,0,0,0,81,0,0,0,82,0,0,0,83,0,0,0,84,0,0,0,85,0,0,0,86,0,0,0,87,0,0,0,88,0,0,0,89,0,0,0,90,0,0,0,91,0,0,0,92,0,0,0,93,0,0,0,94,0,0,0,95,0,0,0,96,0,0,0,65,0,0,0,66,0,0,0,67,0,0,0,68,0,0,0,69,0,0,0,70,0,0,0,71,0,0,0,72,0,0,0,73,0,0,0,74,0,0,0,75,0,0,0,76,0,0,0,77,0,0,0,78,0,0,0,79,0,0,0,80,0,0,0,81,0,0,0,82,0,0,0,83,0,0,0,84,0,0,0,85,0,0,0,86,0,0,0,87,0,0,0,88,0,0,0,89,0,0,0,90,0,0,0,123,0,0,0,124,0,0,0,125,0,0,0,126,0,0,0,127],"i8",ALLOC_NONE,Runtime.GLOBAL_BASE+35640),allocate([1,0,0,0,2,0,0,0,3,0,0,0,4,0,0,0,5,0,0,0,6,0,0,0,7,0,0,0,8,0,0,0,9,0,0,0,10,0,0,0,11,0,0,0,12,0,0,0,13,0,0,0,14,0,0,0,15,0,0,0,16,0,0,0,17,0,0,0,18,0,0,0,19,0,0,0,20,0,0,0,21,0,0,0,22,0,0,0,23,0,0,0,24,0,0,0,25,0,0,0,26,0,0,0,27,0,0,0,28,0,0,0,29,0,0,0,30,0,0,0,31,0,0,0,32,0,0,0,33,0,0,0,34,0,0,0,35,0,0,0,36,0,0,0,37,0,0,0,38,0,0,0,39,0,0,0,40,0,0,0,41,0,0,0,42,0,0,0,43,0,0,0,44,0,0,0,45,0,0,0,46,0,0,0,47,0,0,0,48,0,0,0,49,0,0,0,50,0,0,0,51,0,0,0,52,0,0,0,53,0,0,0,54,0,0,0,55,0,0,0,56,0,0,0,57,0,0,0,58,0,0,0,59,0,0,0,60,0,0,0,61,0,0,0,62,0,0,0,63,0,0,0,64,0,0,0,97,0,0,0,98,0,0,0,99,0,0,0,100,0,0,0,101,0,0,0,102,0,0,0,103,0,0,0,104,0,0,0,105,0,0,0,106,0,0,0,107,0,0,0,108,0,0,0,109,0,0,0,110,0,0,0,111,0,0,0,112,0,0,0,113,0,0,0,114,0,0,0,115,0,0,0,116,0,0,0,117,0,0,0,118,0,0,0,119,0,0,0,120,0,0,0,121,0,0,0,122,0,0,0,91,0,0,0,92,0,0,0,93,0,0,0,94,0,0,0,95,0,0,0,96,0,0,0,97,0,0,0,98,0,0,0,99,0,0,0,100,0,0,0,101,0,0,0,102,0,0,0,103,0,0,0,104,0,0,0,105,0,0,0,106,0,0,0,107,0,0,0,108,0,0,0,109,0,0,0,110,0,0,0,111,0,0,0,112,0,0,0,113,0,0,0,114,0,0,0,115,0,0,0,116,0,0,0,117,0,0,0,118,0,0,0,119,0,0,0,120,0,0,0,121,0,0,0,122,0,0,0,123,0,0,0,124,0,0,0,125,0,0,0,126,0,0,0,127],"i8",ALLOC_NONE,Runtime.GLOBAL_BASE+39844),allocate([240,2,0,0,90,0,0,0,91,0,0,0,20,0,0,0,12,0,0,0,5,0,0,0,31,0,0,0,10,0,0,0,11,0,0,0,13,0,0,0,12,0,0,0,13,0,0,0,19,0,0,0,14,0,0,0,20,0,0,0,0,0,0,0,0,3,0,0,90,0,0,0,92,0,0,0,21,0,0,0,12,0,0,0,5,0,0,0,31,0,0,0,14,0,0,0,11,0,0,0,13,0,0,0,15,0,0,0,16,0,0,0,21,0,0,0,15,0,0,0,22,0,0,0,0,0,0,0,16,3,0,0,93,0,0,0,94,0,0,0,22,0,0,0,1,0,0,0,6,0,0,0,32,0,0,0,17,0,0,0,2,0,0,0,2,0,0,0,18,0,0,0,4,0,0,0,23,0,0,0,16,0,0,0,24,0,0,0,0,0,0,0,32,3,0,0,93,0,0,0,95,0,0,0,23,0,0,0,1,0,0,0,6,0,0,0,32,0,0,0,1,0,0,0,2,0,0,0,2,0,0,0,19,0,0,0,20,0,0,0,25,0,0,0,3,0,0,0,26,0,0,0,0,0,0,0,56,3,0,0,96,0,0,0,97,0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,152,3,0,0,93,0,0,0,98,0,0,0,17,0,0,0,1,0,0,0,6,0,0,0,32,0,0,0,1,0,0,0,2,0,0,0,2,0,0,0,18,0,0,0,4,0,0,0,23,0,0,0,3,0,0,0,26,0,0,0,0,0,0,0,160,3,0,0,90,0,0,0,99,0,0,0,24,0,0,0,12,0,0,0,5,0,0,0,31,0,0,0,14,0,0,0,11,0,0,0,13,0,0,0,12,0,0,0,13,0,0,0,19,0,0,0,15,0,0,0,22,0,0,0,8,0,0,0,0,0,0,0,168,3,0,0,100,0,0,0,101,0,0,0,248,255,255,255,248,255,255,255,168,3,0,0,102,0,0,0,103,0,0,0,8,0,0,0,0,0,0,0,192,3,0,0,104,0,0,0,105,0,0,0,248,255,255,255,248,255,255,255,192,3,0,0,106,0,0,0,107,0,0,0,4,0,0,0,0,0,0,0,216,3,0,0,36,0,0,0,37,0,0,0,252,255,255,255,252,255,255,255,216,3,0,0,38,0,0,0,39,0,0,0,4,0,0,0,0,0,0,0,240,3,0,0,108,0,0,0,109,0,0,0,252,255,255,255,252,255,255,255,240,3,0,0,110,0,0,0,111,0,0,0,0,0,0,0,96,3,0,0,112,0,0,0,113,0,0,0,7,0,0,0,0,0,0,0,112,3,0,0,114,0,0,0,115,0,0,0,0,0,0,0,8,4,0,0,72,0,0,0,116,0,0,0,21,0,0,0,1,0,0,0,4,0,0,0,5,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,117,0,0,0,118,0,0,0,119,0,0,0,1,0,0,0,33,0,0,0,17,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,5,0,0,120,0,0,0,121,0,0,0,119,0,0,0,2,0,0,0,34,0,0,0,18,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,96,5,0,0,122,0,0,0,123,0,0,0,119,0,0,0,1,0,0,0,2,0,0,0,3,0,0,0,4,0,0,0,5,0,0,0,6,0,0,0,7,0,0,0,8,0,0,0,9,0,0,0,10,0,0,0,11,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,5,0,0,124,0,0,0,125,0,0,0,119,0,0,0,12,0,0,0,13,0,0,0,14,0,0,0,15,0,0,0,16,0,0,0,17,0,0,0,18,0,0,0,19,0,0,0,20,0,0,0,21,0,0,0,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,160,5,0,0,126,0,0,0,127,0,0,0,119,0,0,0,3,0,0,0,4,0,0,0,23,0,0,0,5,0,0,0,24,0,0,0,1,0,0,0,2,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,192,5,0,0,128,0,0,0,129,0,0,0,119,0,0,0,7,0,0,0,8,0,0,0,25,0,0,0,9,0,0,0,26,0,0,0,3,0,0,0,4,0,0,0,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,224,5,0,0,130,0,0,0,131,0,0,0,119,0,0,0,22,0,0,0,27,0,0,0,28,0,0,0,29,0,0,0,30,0,0,0,31,0,0,0,1,0,0,0,248,255,255,255,224,5,0,0,23,0,0,0,24,0,0,0,25,0,0,0,26,0,0,0,27,0,0,0,28,0,0,0,29,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,6,0,0,132,0,0,0,133,0,0,0,119,0,0,0,30,0,0,0,32,0,0,0,33,0,0,0,34,0,0,0,35,0,0,0,36,0,0,0,2,0,0,0,248,255,255,255,8,6,0,0,31,0,0,0,32,0,0,0,33,0,0,0,34,0,0,0,35,0,0,0,36,0,0,0,37,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,48,6,0,0,134,0,0,0,135,0,0,0,119,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,80,6,0,0,136,0,0,0,137,0,0,0,119,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,112,6,0,0,138,0,0,0,139,0,0,0,119,0,0,0,38,0,0,0,39,0,0,0,25,0,0,0,26,0,0,0,27,0,0,0,28,0,0,0,40,0,0,0,29,0,0,0,30,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,144,6,0,0,140,0,0,0,141,0,0,0,119,0,0,0,41,0,0,0,42,0,0,0,31,0,0,0,32,0,0,0,33,0,0,0,34,0,0,0,43,0,0,0,35,0,0,0,36,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,176,6,0,0,142,0,0,0,143,0,0,0,119,0,0,0,44,0,0,0,45,0,0,0,37,0,0,0,38,0,0,0,39,0,0,0,40,0,0,0,46,0,0,0,41,0,0,0,42,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,208,6,0,0,144,0,0,0,145,0,0,0,119,0,0,0,47,0,0,0,48,0,0,0,43,0,0,0,44,0,0,0,45,0,0,0,46,0,0,0,49,0,0,0,47,0,0,0,48,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,240,6,0,0,146,0,0,0,147,0,0,0,119,0,0,0,3,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,7,0,0,148,0,0,0,149,0,0,0,119,0,0,0,5,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,48,7,0,0,150,0,0,0,151,0,0,0,119,0,0,0,1,0,0,0,37,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,80,7,0,0,152,0,0,0,153,0,0,0,119,0,0,0,2,0,0,0,38,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,112,7,0,0,154,0,0,0,155,0,0,0,119,0,0,0,19,0,0,0,7,0,0,0,49,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,144,7,0,0,156,0,0,0,157,0,0,0,119,0,0,0,20,0,0,0,8,0,0,0,50,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,240,4,0,0,158,0,0,0,159,0,0,0,119,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,5,0,0,160,0,0,0,161,0,0,0,119,0,0,0,27,0,0,0,21,0,0,0,28,0,0,0,22,0,0,0,29,0,0,0,9,0,0,0,23,0,0,0,11,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,208,4,0,0,162,0,0,0,163,0,0,0,119,0,0,0,3,0,0,0,4,0,0,0,12,0,0,0,50,0,0,0,51,0,0,0,13,0,0,0,52,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,5,0,0,164,0,0,0,165,0,0,0,119,0,0,0,53,0,0,0,54,0,0,0,51,0,0,0,52,0,0,0,53,0,0,0,0,0,0,0,80,5,0,0,166,0,0,0,167,0,0,0,119,0,0,0,55,0,0,0,56,0,0,0,54,0,0,0,55,0,0,0,56,0,0,0,0,0,0,0,32,4,0,0,168,0,0,0,169,0,0,0,119,0,0,0,0,0,0,0,48,4,0,0,168,0,0,0,170,0,0,0,119,0,0,0,24,0,0,0,10,0,0,0,11,0,0,0,12,0,0,0,30,0,0,0,25,0,0,0,31,0,0,0,26,0,0,0,32,0,0,0,13,0,0,0,27,0,0,0,14,0,0,0,0,0,0,0,80,4,0,0,168,0,0,0,171,0,0,0,119,0,0,0,5,0,0,0,6,0,0,0,15,0,0,0,57,0,0,0,58,0,0,0,16,0,0,0,59,0,0,0,0,0,0,0,112,4,0,0,168,0,0,0,172,0,0,0,119,0,0,0,7,0,0,0,8,0,0,0,17,0,0,0,60,0,0,0,61,0,0,0,18,0,0,0,62,0,0,0,0,0,0,0,144,4,0,0,168,0,0,0,173,0,0,0,119,0,0,0,9,0,0,0,10,0,0,0,19,0,0,0,63,0,0,0,64,0,0,0,20,0,0,0,65,0,0,0,0,0,0,0,176,4,0,0,168,0,0,0,174,0,0,0,119,0,0,0,9,0,0,0,10,0,0,0,19,0,0,0,63,0,0,0,64,0,0,0,20,0,0,0,65,0,0,0,0,0,0,0,192,4,0,0,168,0,0,0,175,0,0,0,119,0,0,0,9,0,0,0,10,0,0,0,19,0,0,0,63,0,0,0,64,0,0,0,20,0,0,0,65,0,0,0,0,0,0,0,37,0,0,0,72,0,0,0,58,0,0,0,37,0,0,0,77,0,0,0,58,0,0,0,37,0,0,0,83,0,0,0,37,0,0,0,109,0,0,0,47,0,0,0,37,0,0,0,100,0,0,0,47,0,0,0,37,0,0,0,121,0,0,0,37,0,0,0,89,0,0,0,45,0,0,0,37,0,0,0,109,0,0,0,45,0,0,0,37,0,0,0,100,0,0,0,37,0,0,0,73,0,0,0,58,0,0,0,37,0,0,0,77,0,0,0,58,0,0,0,37,0,0,0,83,0,0,0,32,0,0,0,37,0,0,0,112,0,0,0,37,0,0,0,72,0,0,0,58,0,0,0,37,0,0,0,77,0,0,0,37,0,0,0,72,0,0,0,58,0,0,0,37,0,0,0,77,0,0,0,58,0,0,0,37,0,0,0,83,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,116,0,0,0,114,0,0,0,117,0,0,0,101,0,0,0,0,0,0,0,102,0,0,0,97,0,0,0,108,0,0,0,115,0,0,0,101,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,83,0,0,0,117,0,0,0,110,0,0,0,100,0,0,0,97,0,0,0,121,0,0,0,0,0,0,0,77,0,0,0,111,0,0,0,110,0,0,0,100,0,0,0,97,0,0,0,121,0,0,0,0,0,0,0,84,0,0,0,117,0,0,0,101,0,0,0,115,0,0,0,100,0,0,0,97,0,0,0,121,0,0,0,0,0,0,0,87,0,0,0,101,0,0,0,100,0,0,0,110,0,0,0,101,0,0,0,115,0,0,0,100,0,0,0,97,0,0,0,121,0,0,0,0,0,0,0,84,0,0,0,104,0,0,0,117,0,0,0,114,0,0,0,115,0,0,0,100,0,0,0,97,0,0,0,121,0,0,0,0,0,0,0,70,0,0,0,114,0,0,0,105,0,0,0,100,0,0,0,97,0,0,0,121,0,0,0,0,0,0,0,83,0,0,0,97,0,0,0,116,0,0,0,117,0,0,0,114,0,0,0,100,0,0,0,97,0,0,0,121,0,0,0,0,0,0,0,83,0,0,0,117,0,0,0,110,0,0,0,0,0,0,0,77,0,0,0,111,0,0,0,110,0,0,0,0,0,0,0,84,0,0,0,117,0,0,0,101,0,0,0,0,0,0,0,87,0,0,0,101,0,0,0,100,0,0,0,0,0,0,0,84,0,0,0,104,0,0,0,117,0,0,0,0,0,0,0,70,0,0,0,114,0,0,0,105,0,0,0,0,0,0,0,83,0,0,0,97,0,0,0,116,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,74,0,0,0,97,0,0,0,110,0,0,0,117,0,0,0,97,0,0,0,114,0,0,0,121,0,0,0,0,0,0,0,70,0,0,0,101,0,0,0,98,0,0,0,114,0,0,0,117,0,0,0,97,0,0,0,114,0,0,0,121,0,0,0,0,0,0,0,77,0,0,0,97,0,0,0,114,0,0,0,99,0,0,0,104,0,0,0,0,0,0,0,65,0,0,0,112,0,0,0,114,0,0,0,105,0,0,0,108,0,0,0,0,0,0,0,77,0,0,0,97,0,0,0,121,0,0,0,0,0,0,0,74,0,0,0,117,0,0,0,110,0,0,0,101,0,0,0,0,0,0,0,74,0,0,0,117,0,0,0,108,0,0,0,121,0,0,0,0,0,0,0,65,0,0,0,117,0,0,0,103,0,0,0,117,0,0,0,115,0,0,0,116,0,0,0,0,0,0,0,83,0,0,0,101,0,0,0,112,0,0,0,116,0,0,0,101,0,0,0,109,0,0,0,98,0,0,0,101,0,0,0,114,0,0,0,0,0,0,0,79,0,0,0,99,0,0,0,116,0,0,0,111,0,0,0,98,0,0,0,101,0,0,0,114,0,0,0,0,0,0,0,78,0,0,0,111,0,0,0,118,0,0,0,101,0,0,0,109,0,0,0,98,0,0,0,101,0,0,0,114,0,0,0,0,0,0,0,68,0,0,0,101,0,0,0,99,0,0,0,101,0,0,0,109,0,0,0,98,0,0,0,101,0,0,0,114,0,0,0,0,0,0,0,74,0,0,0,97,0,0,0,110,0,0,0,0,0,0,0,70,0,0,0,101,0,0,0,98,0,0,0,0,0,0,0,77,0,0,0,97,0,0,0,114,0,0,0,0,0,0,0,65,0,0,0,112,0,0,0,114,0,0,0,0,0,0,0,74,0,0,0,117,0,0,0,110,0,0,0,0,0,0,0,74,0,0,0,117,0,0,0,108,0,0,0,0,0,0,0,65,0,0,0,117,0,0,0,103,0,0,0,0,0,0,0,83,0,0,0,101,0,0,0,112,0,0,0,0,0,0,0,79,0,0,0,99,0,0,0,116,0,0,0,0,0,0,0,78,0,0,0,111,0,0,0,118,0,0,0,0,0,0,0,68,0,0,0,101,0,0,0,99,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,65,0,0,0,77,0,0,0,0,0,0,0,80,0,0,0,77,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,37,0,0,0,109,0,0,0,47,0,0,0,37,0,0,0,100,0,0,0,47,0,0,0,37,0,0,0,121,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,37,0,0,0,72,0,0,0,58,0,0,0,37,0,0,0,77,0,0,0,58,0,0,0,37,0,0,0,83,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,37,0,0,0,97,0,0,0,32,0,0,0,37,0,0,0,98,0,0,0,32,0,0,0,37,0,0,0,100,0,0,0,32,0,0,0,37,0,0,0,72,0,0,0,58,0,0,0,37,0,0,0,77,0,0,0,58,0,0,0,37,0,0,0,83,0,0,0,32,0,0,0,37,0,0,0,89,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,37,0,0,0,73,0,0,0,58,0,0,0,37,0,0,0,77,0,0,0,58,0,0,0,37,0,0,0,83,0,0,0,32,0,0,0,37,0,0,0,112,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,3,32,2,32,2,32,2,32,2,32,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,1,96,4,192,4,192,4,192,4,192,4,192,4,192,4,192,4,192,4,192,4,192,4,192,4,192,4,192,4,192,4,192,8,216,8,216,8,216,8,216,8,216,8,216,8,216,8,216,8,216,8,216,4,192,4,192,4,192,4,192,4,192,4,192,4,192,8,213,8,213,8,213,8,213,8,213,8,213,8,197,8,197,8,197,8,197,8,197,8,197,8,197,8,197,8,197,8,197,8,197,8,197,8,197,8,197,8,197,8,197,8,197,8,197,8,197,8,197,4,192,4,192,4,192,4,192,4,192,4,192,8,214,8,214,8,214,8,214,8,214,8,214,8,198,8,198,8,198,8,198,8,198,8,198,8,198,8,198,8,198,8,198,8,198,8,198,8,198,8,198,8,198,8,198,8,198,8,198,8,198,8,198,4,192,4,192,4,192,4,192,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,114,97,119,83,116,114,101,97,109,32,111,114,32,114,97,119,68,97,116,97,32,110,101,101,100,115,32,116,111,32,114,101,102,101,114,101,110,99,101,32,116,111,32,115,111,109,101,116,104,105,110,103,0,119,105,100,116,104,32,110,101,101,100,115,32,116,111,32,98,101,32,105,110,32,116,104,101,32,114,97,110,103,101,32,91,49,44,32,54,53,53,51,53,93,0,104,101,105,103,104,116,32,110,101,101,100,115,32,116,111,32,98,101,32,105,110,32,116,104,101,32,114,97,110,103,101,32,91,49,44,32,54,53,53,51,53,93,0,98,105,116,115,112,101,114,115,97,109,112,108,101,32,110,101,101,100,115,32,116,111,32,98,101,32,105,110,32,116,104,101,32,114,97,110,103,101,32,91,50,44,32,49,54,93,0,105,110,116,101,114,108,101,97,118,101,77,111,100,101,32,110,101,101,100,115,32,116,111,32,98,101,32,115,101,116,32,116,111,32,97,32,118,97,108,117,101,32,111,102,32,123,78,111,110,101,44,32,83,97,109,112,108,101,44,32,76,105,110,101,125,0,99,111,109,112,111,110,101,110,116,115,32,110,101,101,100,115,32,116,111,32,98,101,32,105,110,32,116,104,101,32,114,97,110,103,101,32,91,49,44,32,50,53,53,93,0,117,110,99,111,109,112,114,101,115,115,101,100,32,115,105,122,101,32,100,111,101,115,32,110,111,116,32,109,97,116,99,104,32,119,105,116,104,32,116,104,101,32,111,116,104,101,114,32,112,97,114,97,109,101,116,101,114,115,0,105,110,116,101,114,108,101,97,118,101,77,111,100,101,32,99,97,110,110,111,116,32,98,101,32,115,101,116,32,116,111,32,83,97,109,112,108,101,32,105,110,32,99,111,109,98,105,110,97,116,105,111,110,32,119,105,116,104,32,99,111,109,112,111,110,101,110,116,115,32,61,32,52,0,105,110,116,101,114,108,101,97,118,101,77,111,100,101,32,99,97,110,32,111,110,108,121,32,98,101,32,115,101,116,32,116,111,32,78,111,110,101,32,105,110,32,99,111,109,98,105,110,97,116,105,111,110,32,119,105,116,104,32,99,111,109,112,111,110,101,110,116,115,32,61,32,49,0,67,111,108,111,114,32,116,114,97,110,115,102,111,114,109,97,116,105,111,110,32,0,78,111,32,109,111,114,101,32,98,121,116,101,115,32,97,118,97,105,108,97,98,108,101,32,105,110,32,105,110,112,117,116,32,98,117,102,102,101,114,44,32,115,116,105,108,108,32,110,101,101,100,101,100,105,110,103,32,0,65,110,32,111,100,100,32,110,117,109,98,101,114,32,111,102,32,98,121,116,101,115,32,40,0,41,32,99,97,110,110,111,116,32,98,101,32,115,119,97,112,112,101,100,46,0,49,56,80,114,111,99,101,115,115,84,114,97,110,115,102,111,114,109,101,100,73,49,54,84,114,97,110,115,102,111,114,109,83,104,105,102,116,101,100,73,49,50,84,114,97,110,115,102,111,114,109,72,112,51,73,116,69,69,69,0,49,49,80,114,111,99,101,115,115,76,105,110,101,0,49,56,80,114,111,99,101,115,115,84,114,97,110,115,102,111,114,109,101,100,73,49,54,84,114,97,110,115,102,111,114,109,83,104,105,102,116,101,100,73,49,50,84,114,97,110,115,102,111,114,109,72,112,50,73,116,69,69,69,0,49,56,80,114,111,99,101,115,115,84,114,97,110,115,102,111,114,109,101,100,73,49,54,84,114,97,110,115,102,111,114,109,83,104,105,102,116,101,100,73,49,50,84,114,97,110,115,102,111,114,109,72,112,49,73,116,69,69,69,0,78,83,116,51,95,95,49,49,53,98,97,115,105,99,95,115,116,114,105,110,103,98,117,102,73,99,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,99,69,69,78,83,95,57,97,108,108,111,99,97,116,111,114,73,99,69,69,69,69,0,78,83,116,51,95,95,49,49,57,98,97,115,105,99,95,111,115,116,114,105,110,103,115,116,114,101,97,109,73,99,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,99,69,69,78,83,95,57,97,108,108,111,99,97,116,111,114,73,99,69,69,69,69,0,49,56,80,114,111,99,101,115,115,84,114,97,110,115,102,111,114,109,101,100,73,49,50,84,114,97,110,115,102,111,114,109,72,112,51,73,116,69,69,0,49,56,80,114,111,99,101,115,115,84,114,97,110,115,102,111,114,109,101,100,73,49,50,84,114,97,110,115,102,111,114,109,72,112,50,73,116,69,69,0,49,56,80,114,111,99,101,115,115,84,114,97,110,115,102,111,114,109,101,100,73,49,50,84,114,97,110,115,102,111,114,109,72,112,49,73,116,69,69,0,49,56,80,114,111,99,101,115,115,84,114,97,110,115,102,111,114,109,101,100,73,49,51,84,114,97,110,115,102,111,114,109,78,111,110,101,73,116,69,69,0,50,50,80,111,115,116,80,114,111,99,101,115,83,105,110,103,108,101,83,116,114,101,97,109,0,50,53,80,111,115,116,80,114,111,99,101,115,83,105,110,103,108,101,67,111,109,112,111,110,101,110,116,0,49,53,69,110,99,111,100,101,114,83,116,114,97,116,101,103,121,0,56,74,108,115,67,111,100,101,99,73,49,52,68,101,102,97,117,108,116,84,114,97,105,116,115,84,73,116,116,69,49,53,69,110,99,111,100,101,114,83,116,114,97,116,101,103,121,69,0,56,74,108,115,67,111,100,101,99,73,49,52,68,101,102,97,117,108,116,84,114,97,105,116,115,84,73,116,55,84,114,105,112,108,101,116,73,116,69,69,49,53,69,110,99,111,100,101,114,83,116,114,97,116,101,103,121,69,0,49,56,80,114,111,99,101,115,115,84,114,97,110,115,102,111,114,109,101,100,73,49,50,84,114,97,110,115,102,111,114,109,72,112,51,73,104,69,69,0,49,56,80,114,111,99,101,115,115,84,114,97,110,115,102,111,114,109,101,100,73,49,50,84,114,97,110,115,102,111,114,109,72,112,50,73,104,69,69,0,49,56,80,114,111,99,101,115,115,84,114,97,110,115,102,111,114,109,101,100,73,49,50,84,114,97,110,115,102,111,114,109,72,112,49,73,104,69,69,0,49,56,80,114,111,99,101,115,115,84,114,97,110,115,102,111,114,109,101,100,73,49,51,84,114,97,110,115,102,111,114,109,78,111,110,101,73,104,69,69,0,56,74,108,115,67,111,100,101,99,73,49,52,68,101,102,97,117,108,116,84,114,97,105,116,115,84,73,104,55,84,114,105,112,108,101,116,73,104,69,69,49,53,69,110,99,111,100,101,114,83,116,114,97,116,101,103,121,69,0,56,74,108,115,67,111,100,101,99,73,49,53,76,111,115,115,108,101,115,115,84,114,97,105,116,115,84,73,116,76,105,49,54,69,69,49,53,69,110,99,111,100,101,114,83,116,114,97,116,101,103,121,69,0,56,74,108,115,67,111,100,101,99,73,49,53,76,111,115,115,108,101,115,115,84,114,97,105,116,115,84,73,116,76,105,49,50,69,69,49,53,69,110,99,111,100,101,114,83,116,114,97,116,101,103,121,69,0,56,74,108,115,67,111,100,101,99,73,49,53,76,111,115,115,108,101,115,115,84,114,97,105,116,115,84,73,104,76,105,56,69,69,49,53,69,110,99,111,100,101,114,83,116,114,97,116,101,103,121,69,0,56,74,108,115,67,111,100,101,99,73,49,53,76,111,115,115,108,101,115,115,84,114,97,105,116,115,84,73,55,84,114,105,112,108,101,116,73,104,69,76,105,56,69,69,49,53,69,110,99,111,100,101,114,83,116,114,97,116,101,103,121,69,0,56,74,108,115,67,111,100,101,99,73,49,52,68,101,102,97,117,108,116,84,114,97,105,116,115,84,73,104,104,69,49,53,69,110,99,111,100,101,114,83,116,114,97,116,101,103,121,69,0,49,53,68,101,99,111,100,101,114,83,116,114,97,116,101,103,121,0,56,74,108,115,67,111,100,101,99,73,49,52,68,101,102,97,117,108,116,84,114,97,105,116,115,84,73,116,116,69,49,53,68,101,99,111,100,101,114,83,116,114,97,116,101,103,121,69,0,56,74,108,115,67,111,100,101,99,73,49,52,68,101,102,97,117,108,116,84,114,97,105,116,115,84,73,116,55,84,114,105,112,108,101,116,73,116,69,69,49,53,68,101,99,111,100,101,114,83,116,114,97,116,101,103,121,69,0,56,74,108,115,67,111,100,101,99,73,49,52,68,101,102,97,117,108,116,84,114,97,105,116,115,84,73,104,55,84,114,105,112,108,101,116,73,104,69,69,49,53,68,101,99,111,100,101,114,83,116,114,97,116,101,103,121,69,0,56,74,108,115,67,111,100,101,99,73,49,53,76,111,115,115,108,101,115,115,84,114,97,105,116,115,84,73,116,76,105,49,54,69,69,49,53,68,101,99,111,100,101,114,83,116,114,97,116,101,103,121,69,0,56,74,108,115,67,111,100,101,99,73,49,53,76,111,115,115,108,101,115,115,84,114,97,105,116,115,84,73,116,76,105,49,50,69,69,49,53,68,101,99,111,100,101,114,83,116,114,97,116,101,103,121,69,0,56,74,108,115,67,111,100,101,99,73,49,53,76,111,115,115,108,101,115,115,84,114,97,105,116,115,84,73,104,76,105,56,69,69,49,53,68,101,99,111,100,101,114,83,116,114,97,116,101,103,121,69,0,56,74,108,115,67,111,100,101,99,73,49,53,76,111,115,115,108,101,115,115,84,114,97,105,116,115,84,73,55,84,114,105,112,108,101,116,73,104,69,76,105,56,69,69,49,53,68,101,99,111,100,101,114,83,116,114,97,116,101,103,121,69,0,56,74,108,115,67,111,100,101,99,73,49,52,68,101,102,97,117,108,116,84,114,97,105,116,115,84,73,104,104,69,49,53,68,101,99,111,100,101,114,83,116,114,97,116,101,103,121,69,0,67,104,97,114,76,83,32,101,114,114,111,114,0,99,104,97,114,108,115,0,49,53,99,104,97,114,108,115,95,99,97,116,101,103,111,114,121,0,112,97,114,97,109,115,46,88,116,104,117,109,98,110,97,105,108,32,105,115,32,62,32,48,32,98,117,116,32,112,97,114,97,109,115,46,116,104,117,109,98,110,97,105,108,32,61,61,32,110,117,108,108,95,112,116,114,0,49,55,74,112,101,103,77,97,114,107,101,114,83,101,103,109,101,110,116,0,49,49,74,112,101,103,83,101,103,109,101,110,116,0,50,48,74,112,101,103,73,109,97,103,101,68,97,116,97,83,101,103,109,101,110,116,0,69,120,112,101,99,116,101,100,32,74,80,69,71,32,77,97,114,107,101,114,32,115,116,97,114,116,32,98,121,116,101,32,48,120,70,70,32,98,117,116,32,116,104,101,32,98,121,116,101,32,118,97,108,117,101,32,119,97,115,32,48,120,0,74,80,69,71,32,101,110,99,111,100,105,110,103,32,119,105,116,104,32,109,97,114,107,101,114,32,0,32,105,115,32,110,111,116,32,115,117,112,112,111,114,116,101,100,46,0,85,110,107,110,111,119,110,32,74,80,69,71,32,109,97,114,107,101,114,32,0,32,101,110,99,111,117,110,116,101,114,101,100,46,0,109,114,102,120,0,83,116,57,98,97,100,95,97,108,108,111,99,0,83,116,57,101,120,99,101,112,116,105,111,110,0,83,116,49,51,114,117,110,116,105,109,101,95,101,114,114,111,114,0,83,116,57,116,121,112,101,95,105,110,102,111,0,83,116,56,98,97,100,95,99,97,115,116,0,78,49,48,95,95,99,120,120,97,98,105,118,49,49,54,95,95,115,104,105,109,95,116,121,112,101,95,105,110,102,111,69,0,78,49,48,95,95,99,120,120,97,98,105,118,49,49,55,95,95,99,108,97,115,115,95,116,121,112,101,95,105,110,102,111,69,0,78,49,48,95,95,99,120,120,97,98,105,118,49,49,57,95,95,112,111,105,110,116,101,114,95,116,121,112,101,95,105,110,102,111,69,0,78,49,48,95,95,99,120,120,97,98,105,118,49,49,55,95,95,112,98,97,115,101,95,116,121,112,101,95,105,110,102,111,69,0,78,49,48,95,95,99,120,120,97,98,105,118,49,50,48,95,95,115,105,95,99,108,97,115,115,95,116,121,112,101,95,105,110,102,111,69,0,78,49,48,95,95,99,120,120,97,98,105,118,49,50,49,95,95,118,109,105,95,99,108,97,115,115,95,116,121,112,101,95,105,110,102,111,69,0,33,34,98,97,115,105,99,95,115,116,114,105,110,103,32,108,101,110,103,116,104,95,101,114,114,111,114,34,0,47,85,115,101,114,115,47,99,104,97,102,101,121,47,101,109,115,100,107,95,112,111,114,116,97,98,108,101,47,101,109,115,99,114,105,112,116,101,110,47,49,46,51,53,46,48,47,115,121,115,116,101,109,47,105,110,99,108,117,100,101,47,108,105,98,99,120,120,47,115,116,114,105,110,103,0,95,95,116,104,114,111,119,95,108,101,110,103,116,104,95,101,114,114,111,114,0,33,34,118,101,99,116,111,114,32,108,101,110,103,116,104,95,101,114,114,111,114,34,0,47,85,115,101,114,115,47,99,104,97,102,101,121,47,101,109,115,100,107,95,112,111,114,116,97,98,108,101,47,101,109,115,99,114,105,112,116,101,110,47,49,46,51,53,46,48,47,115,121,115,116,101,109,47,105,110,99,108,117,100,101,47,108,105,98,99,120,120,47,118,101,99,116,111,114,0,112,116,104,114,101,97,100,95,111,110,99,101,32,102,97,105,108,117,114,101,32,105,110,32,95,95,99,120,97,95,103,101,116,95,103,108,111,98,97,108,115,95,102,97,115,116,40,41,0,115,116,100,58,58,98,97,100,95,97,108,108,111,99,0,116,101,114,109,105,110,97,116,101,95,104,97,110,100,108,101,114,32,117,110,101,120,112,101,99,116,101,100,108,121,32,114,101,116,117,114,110,101,100,0,116,101,114,109,105,110,97,116,101,95,104,97,110,100,108,101,114,32,117,110,101,120,112,101,99,116,101,100,108,121,32,116,104,114,101,119,32,97,110,32,101,120,99,101,112,116,105,111,110,0,115,116,100,58,58,98,97,100,95,99,97,115,116,0,99,97,110,110,111,116,32,99,114,101,97,116,101,32,112,116,104,114,101,97,100,32,107,101,121,32,102,111,114,32,95,95,99,120,97,95,103,101,116,95,103,108,111,98,97,108,115,40,41,0,99,97,110,110,111,116,32,122,101,114,111,32,111,117,116,32,116,104,114,101,97,100,32,118,97,108,117,101,32,102,111,114,32,95,95,99,120,97,95,103,101,116,95,103,108,111,98,97,108,115,40,41,0,116,101,114,109,105,110,97,116,105,110,103,32,119,105,116,104,32,37,115,32,101,120,99,101,112,116,105,111,110,32,111,102,32,116,121,112,101,32,37,115,58,32,37,115,0,116,101,114,109,105,110,97,116,105,110,103,32,119,105,116,104,32,37,115,32,101,120,99,101,112,116,105,111,110,32,111,102,32,116,121,112,101,32,37,115,0,116,101,114,109,105,110,97,116,105,110,103,32,119,105,116,104,32,37,115,32,102,111,114,101,105,103,110,32,101,120,99,101,112,116,105,111,110,0,116,101,114,109,105,110,97,116,105,110,103,0,117,110,99,97,117,103,104,116,0,84,33,34,25,13,1,2,3,17,75,28,12,16,4,11,29,18,30,39,104,110,111,112,113,98,32,5,6,15,19,20,21,26,8,22,7,40,36,23,24,9,10,14,27,31,37,35,131,130,125,38,42,43,60,61,62,63,67,71,74,77,88,89,90,91,92,93,94,95,96,97,99,100,101,102,103,105,106,107,108,114,115,116,121,122,123,124,0,73,108,108,101,103,97,108,32,98,121,116,101,32,115,101,113,117,101,110,99,101,0,68,111,109,97,105,110,32,101,114,114,111,114,0,82,101,115,117,108,116,32,110,111,116,32,114,101,112,114,101,115,101,110,116,97,98,108,101,0,78,111,116,32,97,32,116,116,121,0,80,101,114,109,105,115,115,105,111,110,32,100,101,110,105,101,100,0,79,112,101,114,97,116,105,111,110,32,110,111,116,32,112,101,114,109,105,116,116,101,100,0,78,111,32,115,117,99,104,32,102,105,108,101,32,111,114,32,100,105,114,101,99,116,111,114,121,0,78,111,32,115,117,99,104,32,112,114,111,99,101,115,115,0,70,105,108,101,32,101,120,105,115,116,115,0,86,97,108,117,101,32,116,111,111,32,108,97,114,103,101,32,102,111,114,32,100,97,116,97,32,116,121,112,101,0,78,111,32,115,112,97,99,101,32,108,101,102,116,32,111,110,32,100,101,118,105,99,101,0,79,117,116,32,111,102,32,109,101,109,111,114,121,0,82,101,115,111,117,114,99,101,32,98,117,115,121,0,73,110,116,101,114,114,117,112,116,101,100,32,115,121,115,116,101,109,32,99,97,108,108,0,82,101,115,111,117,114,99,101,32,116,101,109,112,111,114,97,114,105,108,121,32,117,110,97,118,97,105,108,97,98,108,101,0,73,110,118,97,108,105,100,32,115,101,101,107,0,67,114,111,115,115,45,100,101,118,105,99,101,32,108,105,110,107,0,82,101,97,100,45,111,110,108,121,32,102,105,108,101,32,115,121,115,116,101,109,0,68,105,114,101,99,116,111,114,121,32,110,111,116,32,101,109,112,116,121,0,67,111,110,110,101,99,116,105,111,110,32,114,101,115,101,116,32,98,121,32,112,101,101,114,0,79,112,101,114,97,116,105,111,110,32,116,105,109,101,100,32,111,117,116,0,67,111,110,110,101,99,116,105,111,110,32,114,101,102,117,115,101,100,0,72,111,115,116,32,105,115,32,100,111,119,110,0,72,111,115,116,32,105,115,32,117,110,114,101,97,99,104,97,98,108,101,0,65,100,100,114,101,115,115,32,105,110,32,117,115,101,0,66,114,111,107,101,110,32,112,105,112,101,0,73,47,79,32,101,114,114,111,114,0,78,111,32,115,117,99,104,32,100,101,118,105,99,101,32,111,114,32,97,100,100,114,101,115,115,0,66,108,111,99,107,32,100,101,118,105,99,101,32,114,101,113,117,105,114,101,100,0,78,111,32,115,117,99,104,32,100,101,118,105,99,101,0,78,111,116],"i8",ALLOC_NONE,Runtime.GLOBAL_BASE+42396),allocate([32,97,32,100,105,114,101,99,116,111,114,121,0,73,115,32,97,32,100,105,114,101,99,116,111,114,121,0,84,101,120,116,32,102,105,108,101,32,98,117,115,121,0,69,120,101,99,32,102,111,114,109,97,116,32,101,114,114,111,114,0,73,110,118,97,108,105,100,32,97,114,103,117,109,101,110,116,0,65,114,103,117,109,101,110,116,32,108,105,115,116,32,116,111,111,32,108,111,110,103,0,83,121,109,98,111,108,105,99,32,108,105,110,107,32,108,111,111,112,0,70,105,108,101,110,97,109,101,32,116,111,111,32,108,111,110,103,0,84,111,111,32,109,97,110,121,32,111,112,101,110,32,102,105,108,101,115,32,105,110,32,115,121,115,116,101,109,0,78,111,32,102,105,108,101,32,100,101,115,99,114,105,112,116,111,114,115,32,97,118,97,105,108,97,98,108,101,0,66,97,100,32,102,105,108,101,32,100,101,115,99,114,105,112,116,111,114,0,78,111,32,99,104,105,108,100,32,112,114,111,99,101,115,115,0,66,97,100,32,97,100,100,114,101,115,115,0,70,105,108,101,32,116,111,111,32,108,97,114,103,101,0,84,111,111,32,109,97,110,121,32,108,105,110,107,115,0,78,111,32,108,111,99,107,115,32,97,118,97,105,108,97,98,108,101,0,82,101,115,111,117,114,99,101,32,100,101,97,100,108,111,99,107,32,119,111,117,108,100,32,111,99,99,117,114,0,83,116,97,116,101,32,110,111,116,32,114,101,99,111,118,101,114,97,98,108,101,0,80,114,101,118,105,111,117,115,32,111,119,110,101,114,32,100,105,101,100,0,79,112,101,114,97,116,105,111,110,32,99,97,110,99,101,108,101,100,0,70,117,110,99,116,105,111,110,32,110,111,116,32,105,109,112,108,101,109,101,110,116,101,100,0,78,111,32,109,101,115,115,97,103,101,32,111,102,32,100,101,115,105,114,101,100,32,116,121,112,101,0,73,100,101,110,116,105,102,105,101,114,32,114,101,109,111,118,101,100,0,68,101,118,105,99,101,32,110,111,116,32,97,32,115,116,114,101,97,109,0,78,111,32,100,97,116,97,32,97,118,97,105,108,97,98,108,101,0,68,101,118,105,99,101,32,116,105,109,101,111,117,116,0,79,117,116,32,111,102,32,115,116,114,101,97,109,115,32,114,101,115,111,117,114,99,101,115,0,76,105,110,107,32,104,97,115,32,98,101,101,110,32,115,101,118,101,114,101,100,0,80,114,111,116,111,99,111,108,32,101,114,114,111,114,0,66,97,100,32,109,101,115,115,97,103,101,0,70,105,108,101,32,100,101,115,99,114,105,112,116,111,114,32,105,110,32,98,97,100,32,115,116,97,116,101,0,78,111,116,32,97,32,115,111,99,107,101,116,0,68,101,115,116,105,110,97,116,105,111,110,32,97,100,100,114,101,115,115,32,114,101,113,117,105,114,101,100,0,77,101,115,115,97,103,101,32,116,111,111,32,108,97,114,103,101,0,80,114,111,116,111,99,111,108,32,119,114,111,110,103,32,116,121,112,101,32,102,111,114,32,115,111,99,107,101,116,0,80,114,111,116,111,99,111,108,32,110,111,116,32,97,118,97,105,108,97,98,108,101,0,80,114,111,116,111,99,111,108,32,110,111,116,32,115,117,112,112,111,114,116,101,100,0,83,111,99,107,101,116,32,116,121,112,101,32,110,111,116,32,115,117,112,112,111,114,116,101,100,0,78,111,116,32,115,117,112,112,111,114,116,101,100,0,80,114,111,116,111,99,111,108,32,102,97,109,105,108,121,32,110,111,116,32,115,117,112,112,111,114,116,101,100,0,65,100,100,114,101,115,115,32,102,97,109,105,108,121,32,110,111,116,32,115,117,112,112,111,114,116,101,100,32,98,121,32,112,114,111,116,111,99,111,108,0,65,100,100,114,101,115,115,32,110,111,116,32,97,118,97,105,108,97,98,108,101,0,78,101,116,119,111,114,107,32,105,115,32,100,111,119,110,0,78,101,116,119,111,114,107,32,117,110,114,101,97,99,104,97,98,108,101,0,67,111,110,110,101,99,116,105,111,110,32,114,101,115,101,116,32,98,121,32,110,101,116,119,111,114,107,0,67,111,110,110,101,99,116,105,111,110,32,97,98,111,114,116,101,100,0,78,111,32,98,117,102,102,101,114,32,115,112,97,99,101,32,97,118,97,105,108,97,98,108,101,0,83,111,99,107,101,116,32,105,115,32,99,111,110,110,101,99,116,101,100,0,83,111,99,107,101,116,32,110,111,116,32,99,111,110,110,101,99,116,101,100,0,67,97,110,110,111,116,32,115,101,110,100,32,97,102,116,101,114,32,115,111,99,107,101,116,32,115,104,117,116,100,111,119,110,0,79,112,101,114,97,116,105,111,110,32,97,108,114,101,97,100,121,32,105,110,32,112,114,111,103,114,101,115,115,0,79,112,101,114,97,116,105,111,110,32,105,110,32,112,114,111,103,114,101,115,115,0,83,116,97,108,101,32,102,105,108,101,32,104,97,110,100,108,101,0,82,101,109,111,116,101,32,73,47,79,32,101,114,114,111,114,0,81,117,111,116,97,32,101,120,99,101,101,100,101,100,0,78,111,32,109,101,100,105,117,109,32,102,111,117,110,100,0,87,114,111,110,103,32,109,101,100,105,117,109,32,116,121,112,101,0,78,111,32,101,114,114,111,114,32,105,110,102,111,114,109,97,116,105,111,110,0,0,105,110,102,105,110,105,116,121,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,1,2,3,4,5,6,7,8,9,255,255,255,255,255,255,255,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,255,255,255,255,255,255,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,1,2,4,7,3,6,5,0,80,79,83,73,88],"i8",ALLOC_NONE,Runtime.GLOBAL_BASE+52636),allocate([17,0,10,0,17,17,17,0,0,0,0,5,0,0,0,0,0,0,9,0,0,0,0,11,0,0,0,0,0,0,0,0,17,0,15,10,17,17,17,3,10,7,0,1,19,9,11,11,0,0,9,6,11,0,0,11,0,6,17,0,0,0,17,17,17,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,11,0,0,0,0,0,0,0,0,17,0,10,10,17,17,17,0,10,0,0,2,0,9,11,0,0,0,9,0,11,0,0,11,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,12,0,0,0,0,9,12,0,0,0,0,0,12,0,0,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,14,0,0,0,0,0,0,0,0,0,0,0,13,0,0,0,4,13,0,0,0,0,9,14,0,0,0,0,0,14,0,0,14,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,0,0,0,0,0,0,0,0,0,0,0,15,0,0,0,0,15,0,0,0,0,9,16,0,0,0,0,0,16,0,0,16,0,0,18,0,0,0,18,18,18,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,18,0,0,0,18,18,18,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,11,0,0,0,0,0,0,0,0,0,0,0,10,0,0,0,0,10,0,0,0,0,9,11,0,0,0,0,0,11,0,0,11,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,12,0,0,0,0,9,12,0,0,0,0,0,12,0,0,12,0,0,48,49,50,51,52,53,54,55,56,57,65,66,67,68,69,70,45,43,32,32,32,48,88,48,120,0,40,110,117,108,108,41,0,45,48,88,43,48,88,32,48,88,45,48,120,43,48,120,32,48,120,0,105,110,102,0,73,78,70,0,110,97,110,0,78,65,78,0,46,0,0,78,83,116,51,95,95,49,49,49,95,95,115,116,100,111,117,116,98,117,102,73,119,69,69,0,117,110,115,117,112,112,111,114,116,101,100,32,108,111,99,97,108,101,32,102,111,114,32,115,116,97,110,100,97,114,100,32,105,110,112,117,116,0,78,83,116,51,95,95,49,49,48,95,95,115,116,100,105,110,98,117,102,73,119,69,69,0,78,83,116,51,95,95,49,49,49,95,95,115,116,100,111,117,116,98,117,102,73,99,69,69,0,78,83,116,51,95,95,49,49,48,95,95,115,116,100,105,110,98,117,102,73,99,69,69,0,78,83,116,51,95,95,49,49,52,95,95,115,104,97,114,101,100,95,99,111,117,110,116,69,0,78,83,116,51,95,95,49,49,50,115,121,115,116,101,109,95,101,114,114,111,114,69,0,78,83,116,51,95,95,49,49,52,101,114,114,111,114,95,99,97,116,101,103,111,114,121,69,0,78,83,116,51,95,95,49,49,50,95,95,100,111,95,109,101,115,115,97,103,101,69,0,58,32,0,78,83,116,51,95,95,49,56,105,111,115,95,98,97,115,101,55,102,97,105,108,117,114,101,69,0,78,83,116,51,95,95,49,56,105,111,115,95,98,97,115,101,69,0,78,83,116,51,95,95,49,57,98,97,115,105,99,95,105,111,115,73,99,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,99,69,69,69,69,0,78,83,116,51,95,95,49,57,98,97,115,105,99,95,105,111,115,73,119,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,119,69,69,69,69,0,78,83,116,51,95,95,49,49,53,98,97,115,105,99,95,115,116,114,101,97,109,98,117,102,73,99,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,99,69,69,69,69,0,78,83,116,51,95,95,49,49,53,98,97,115,105,99,95,115,116,114,101,97,109,98,117,102,73,119,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,119,69,69,69,69,0,78,83,116,51,95,95,49,49,51,98,97,115,105,99,95,105,115,116,114,101,97,109,73,99,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,99,69,69,69,69,0,78,83,116,51,95,95,49,49,51,98,97,115,105,99,95,105,115,116,114,101,97,109,73,119,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,119,69,69,69,69,0,78,83,116,51,95,95,49,49,51,98,97,115,105,99,95,111,115,116,114,101,97,109,73,99,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,99,69,69,69,69,0,78,83,116,51,95,95,49,49,51,98,97,115,105,99,95,111,115,116,114,101,97,109,73,119,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,119,69,69,69,69,0,78,83,116,51,95,95,49,49,57,95,95,105,111,115,116,114,101,97,109,95,99,97,116,101,103,111,114,121,69,0,105,111,115,95,98,97,115,101,58,58,99,108,101,97,114,0,105,111,115,116,114,101,97,109,0,117,110,115,112,101,99,105,102,105,101,100,32,105,111,115,116,114,101,97,109,95,99,97,116,101,103,111,114,121,32,101,114,114,111,114,0,48,49,50,51,52,53,54,55,56,57,97,98,99,100,101,102,65,66,67,68,69,70,120,88,43,45,112,80,105,73,110,78,0,78,83,116,51,95,95,49,54,108,111,99,97,108,101,53,102,97,99,101,116,69,0,78,83,116,51,95,95,49,53,99,116,121,112,101,73,119,69,69,0,78,83,116,51,95,95,49,55,99,111,100,101,99,118,116,73,99,99,49,49,95,95,109,98,115,116,97,116,101,95,116,69,69,0,78,83,116,51,95,95,49,55,99,111,100,101,99,118,116,73,68,115,99,49,49,95,95,109,98,115,116,97,116,101,95,116,69,69,0,78,83,116,51,95,95,49,55,99,111,100,101,99,118,116,73,68,105,99,49,49,95,95,109,98,115,116,97,116,101,95,116,69,69,0,78,83,116,51,95,95,49,49,54,95,95,110,97,114,114,111,119,95,116,111,95,117,116,102,56,73,76,106,51,50,69,69,69,0,78,83,116,51,95,95,49,49,55,95,95,119,105,100,101,110,95,102,114,111,109,95,117,116,102,56,73,76,106,51,50,69,69,69,0,78,83,116,51,95,95,49,55,99,111,100,101,99,118,116,73,119,99,49,49,95,95,109,98,115,116,97,116,101,95,116,69,69,0,78,83,116,51,95,95,49,54,108,111,99,97,108,101,53,95,95,105,109,112,69,0,78,83,116,51,95,95,49,55,99,111,108,108,97,116,101,73,99,69,69,0,78,83,116,51,95,95,49,55,99,111,108,108,97,116,101,73,119,69,69,0,78,83,116,51,95,95,49,53,99,116,121,112,101,73,99,69,69,0,78,83,116,51,95,95,49,56,110,117,109,112,117,110,99,116,73,99,69,69,0,78,83,116,51,95,95,49,56,110,117,109,112,117,110,99,116,73,119,69,69,0,78,83,116,51,95,95,49,55,110,117,109,95,103,101,116,73,99,78,83,95,49,57,105,115,116,114,101,97,109,98,117,102,95,105,116,101,114,97,116,111,114,73,99,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,99,69,69,69,69,69,69,0,78,83,116,51,95,95,49,55,110,117,109,95,103,101,116,73,119,78,83,95,49,57,105,115,116,114,101,97,109,98,117,102,95,105,116,101,114,97,116,111,114,73,119,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,119,69,69,69,69,69,69,0,78,83,116,51,95,95,49,55,110,117,109,95,112,117,116,73,99,78,83,95,49,57,111,115,116,114,101,97,109,98,117,102,95,105,116,101,114,97,116,111,114,73,99,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,99,69,69,69,69,69,69,0,78,83,116,51,95,95,49,55,110,117,109,95,112,117,116,73,119,78,83,95,49,57,111,115,116,114,101,97,109,98,117,102,95,105,116,101,114,97,116,111,114,73,119,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,119,69,69,69,69,69,69,0,78,83,116,51,95,95,49,56,116,105,109,101,95,103,101,116,73,99,78,83,95,49,57,105,115,116,114,101,97,109,98,117,102,95,105,116,101,114,97,116,111,114,73,99,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,99,69,69,69,69,69,69,0,78,83,116,51,95,95,49,56,116,105,109,101,95,103,101,116,73,119,78,83,95,49,57,105,115,116,114,101,97,109,98,117,102,95,105,116,101,114,97,116,111,114,73,119,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,119,69,69,69,69,69,69,0,78,83,116,51,95,95,49,56,116,105,109,101,95,112,117,116,73,99,78,83,95,49,57,111,115,116,114,101,97,109,98,117,102,95,105,116,101,114,97,116,111,114,73,99,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,99,69,69,69,69,69,69,0,78,83,116,51,95,95,49,56,116,105,109,101,95,112,117,116,73,119,78,83,95,49,57,111,115,116,114,101,97,109,98,117,102,95,105,116,101,114,97,116,111,114,73,119,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,119,69,69,69,69,69,69,0,78,83,116,51,95,95,49,49,48,109,111,110,101,121,112,117,110,99,116,73,99,76,98,48,69,69,69,0,78,83,116,51,95,95,49,49,48,109,111,110,101,121,112,117,110,99,116,73,99,76,98,49,69,69,69,0,78,83,116,51,95,95,49,49,48,109,111,110,101,121,112,117,110,99,116,73,119,76,98,48,69,69,69,0,78,83,116,51,95,95,49,49,48,109,111,110,101,121,112,117,110,99,116,73,119,76,98,49,69,69,69,0,78,83,116,51,95,95,49,57,109,111,110,101,121,95,103,101,116,73,99,78,83,95,49,57,105,115,116,114,101,97,109,98,117,102,95,105,116,101,114,97,116,111,114,73,99,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,99,69,69,69,69,69,69,0,78,83,116,51,95,95,49,57,109,111,110,101,121,95,103,101,116,73,119,78,83,95,49,57,105,115,116,114,101,97,109,98,117,102,95,105,116,101,114,97,116,111,114,73,119,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,119,69,69,69,69,69,69,0,78,83,116,51,95,95,49,57,109,111,110,101,121,95,112,117,116,73,99,78,83,95,49,57,111,115,116,114,101,97,109,98,117,102,95,105,116,101,114,97,116,111,114,73,99,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,99,69,69,69,69,69,69,0,78,83,116,51,95,95,49,57,109,111,110,101,121,95,112,117,116,73,119,78,83,95,49,57,111,115,116,114,101,97,109,98,117,102,95,105,116,101,114,97,116,111,114,73,119,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,119,69,69,69,69,69,69,0,78,83,116,51,95,95,49,56,109,101,115,115,97,103,101,115,73,99,69,69,0,78,83,116,51,95,95,49,56,109,101,115,115,97,103,101,115,73,119,69,69,0,37,112,0,67,0,37,0,0,0,0,0,108,0,108,108,0,0,76,0,37,112,0,0,0,0,37,72,58,37,77,58,37,83,37,109,47,37,100,47,37,121,37,89,45,37,109,45,37,100,37,73,58,37,77,58,37,83,32,37,112,37,72,58,37,77,37,72,58,37,77,58,37,83,108,111,99,97,108,101,32,110,111,116,32,115,117,112,112,111,114,116,101,100,0,48,49,50,51,52,53,54,55,56,57,0,37,76,102,0,109,111,110,101,121,95,103,101,116,32,101,114,114,111,114,0,48,49,50,51,52,53,54,55,56,57,0,37,46,48,76,102,0,116,114,117,101,0,102,97,108,115,101,0,83,117,110,100,97,121,0,77,111,110,100,97,121,0,84,117,101,115,100,97,121,0,87,101,100,110,101,115,100,97,121,0,84,104,117,114,115,100,97,121,0,70,114,105,100,97,121,0,83,97,116,117,114,100,97,121,0,83,117,110,0,77,111,110,0,84,117,101,0,87,101,100,0,84,104,117,0,70,114,105,0,83,97,116,0,74,97,110,117,97,114,121,0,70,101,98,114,117,97,114,121,0,77,97,114,99,104,0,65,112,114,105,108,0,77,97,121,0,74,117,110,101,0,74,117,108,121,0,65,117,103,117,115,116,0,83,101,112,116,101,109,98,101,114,0,79,99,116,111,98,101,114,0,78,111,118,101,109,98,101,114,0,68,101,99,101,109,98,101,114,0,74,97,110,0,70,101,98,0,77,97,114,0,65,112,114,0,74,117,110,0,74,117,108,0,65,117,103,0,83,101,112,0,79,99,116,0,78,111,118,0,68,101,99,0,65,77,0,80,77,0,37,109,47,37,100,47,37,121,0,37,72,58,37,77,58,37,83,0,37,97,32,37,98,32,37,100,32,37,72,58,37,77,58,37,83,32,37,89,0,37,73,58,37,77,58,37,83,32,37,112,0,78,83,116,51,95,95,49,49,51,109,101,115,115,97,103,101,115,95,98,97,115,101,69,0,78,83,116,51,95,95,49,49,49,95,95,109,111,110,101,121,95,112,117,116,73,119,69,69,0,78,83,116,51,95,95,49,49,49,95,95,109,111,110,101,121,95,112,117,116,73,99,69,69,0,78,83,116,51,95,95,49,49,49,95,95,109,111,110,101,121,95,103,101,116,73,119,69,69,0,78,83,116,51,95,95,49,49,49,95,95,109,111,110,101,121,95,103,101,116,73,99,69,69,0,78,83,116,51,95,95,49,49,48,109,111,110,101,121,95,98,97,115,101,69,0,78,83,116,51,95,95,49,49,48,95,95,116,105,109,101,95,112,117,116,69,0,78,83,116,51,95,95,49,50,48,95,95,116,105,109,101,95,103,101,116,95,99,95,115,116,111,114,97,103,101,73,119,69,69,0,78,83,116,51,95,95,49,50,48,95,95,116,105,109,101,95,103,101,116,95,99,95,115,116,111,114,97,103,101,73,99,69,69,0,78,83,116,51,95,95,49,57,116,105,109,101,95,98,97,115,101,69,0,78,83,116,51,95,95,49,57,95,95,110,117,109,95,112,117,116,73,119,69,69,0,78,83,116,51,95,95,49,49,52,95,95,110,117,109,95,112,117,116,95,98,97,115,101,69,0,78,83,116,51,95,95,49,57,95,95,110,117,109,95,112,117,116,73,99,69,69,0,78,83,116,51,95,95,49,57,95,95,110,117,109,95,103,101,116,73,119,69,69,0,78,83,116,51,95,95,49,49,52,95,95,110,117,109,95,103,101,116,95,98,97,115,101,69,0,78,83,116,51,95,95,49,57,95,95,110,117,109,95,103,101,116,73,99,69,69,0,78,83,116,51,95,95,49,49,50,99,111,100,101,99,118,116,95,98,97,115,101,69,0,78,83,116,51,95,95,49,49,48,99,116,121,112,101,95,98,97,115,101,69,0],"i8",ALLOC_NONE,Runtime.GLOBAL_BASE+56215);var tempDoublePtr=Runtime.alignMemory(allocate(12,"i8",ALLOC_STATIC),8);assert(tempDoublePtr%8==0);function _atexit(a,n){__ATEXIT__.unshift({func:a,arg:n})}function ___cxa_atexit(){return _atexit.apply(null,arguments)}Module._i64Subtract=_i64Subtract;function ___assert_fail(a,n,s,u){throw ABORT=!0,"Assertion failed: "+Pointer_stringify(a)+", at: "+[n?Pointer_stringify(n):"unknown filename",s,u?Pointer_stringify(u):"unknown function"]+" at "+stackTrace()}function __ZSt18uncaught_exceptionv(){return!!__ZSt18uncaught_exceptionv.uncaught_exception}var EXCEPTIONS={last:0,caught:[],infos:{},deAdjust:function(a){if(!a||EXCEPTIONS.infos[a])return a;for(var n in EXCEPTIONS.infos){var s=EXCEPTIONS.infos[n];if(s.adjusted===a)return n}return a},addRef:function(a){if(a){var n=EXCEPTIONS.infos[a];n.refcount++}},decRef:function(a){if(a){var n=EXCEPTIONS.infos[a];assert(n.refcount>0),n.refcount--,n.refcount===0&&(n.destructor&&Runtime.dynCall("vi",n.destructor,[a]),delete EXCEPTIONS.infos[a],___cxa_free_exception(a))}},clearRef:function(a){if(a){var n=EXCEPTIONS.infos[a];n.refcount=0}}};function ___resumeException(a){throw EXCEPTIONS.last||(EXCEPTIONS.last=a),EXCEPTIONS.clearRef(EXCEPTIONS.deAdjust(a)),a}function ___cxa_find_matching_catch(){var a=EXCEPTIONS.last;if(!a)return asm.setTempRet0(0),0|0;var n=EXCEPTIONS.infos[a],s=n.type;if(!s)return asm.setTempRet0(0),a|0;var u=Array.prototype.slice.call(arguments);Module.___cxa_is_pointer_type(s),___cxa_find_matching_catch.buffer||(___cxa_find_matching_catch.buffer=_malloc(4)),HEAP32[___cxa_find_matching_catch.buffer>>2]=a,a=___cxa_find_matching_catch.buffer;for(var f=0;f>2],n.adjusted=a,asm.setTempRet0(u[f]),a|0;return a=HEAP32[a>>2],asm.setTempRet0(s),a|0}function ___cxa_throw(a,n,s){throw EXCEPTIONS.infos[a]={ptr:a,adjusted:a,type:n,destructor:s,refcount:0},EXCEPTIONS.last=a,"uncaught_exception"in __ZSt18uncaught_exceptionv?__ZSt18uncaught_exceptionv.uncaught_exception++:__ZSt18uncaught_exceptionv.uncaught_exception=1,a}Module._memset=_memset;function ___gxx_personality_v0(){}function __isLeapYear(a){return a%4===0&&(a%100!==0||a%400===0)}function __arraySum(a,n){for(var s=0,u=0;u<=n;s+=a[u++]);return s}var __MONTH_DAYS_LEAP=[31,29,31,30,31,30,31,31,30,31,30,31],__MONTH_DAYS_REGULAR=[31,28,31,30,31,30,31,31,30,31,30,31];function __addDays(a,n){for(var s=new Date(a.getTime());n>0;){var u=__isLeapYear(s.getFullYear()),f=s.getMonth(),m=(u?__MONTH_DAYS_LEAP:__MONTH_DAYS_REGULAR)[f];if(n>m-s.getDate())n-=m-s.getDate()+1,s.setDate(1),f<11?s.setMonth(f+1):(s.setMonth(0),s.setFullYear(s.getFullYear()+1));else return s.setDate(s.getDate()+n),s}return s}function _strftime(a,n,s,u){var f=HEAP32[u+40>>2],m={tm_sec:HEAP32[u>>2],tm_min:HEAP32[u+4>>2],tm_hour:HEAP32[u+8>>2],tm_mday:HEAP32[u+12>>2],tm_mon:HEAP32[u+16>>2],tm_year:HEAP32[u+20>>2],tm_wday:HEAP32[u+24>>2],tm_yday:HEAP32[u+28>>2],tm_isdst:HEAP32[u+32>>2],tm_gmtoff:HEAP32[u+36>>2],tm_zone:f?Pointer_stringify(f):""},A=Pointer_stringify(s),v={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S"};for(var y in v)A=A.replace(new RegExp(y,"g"),v[y]);var T=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],E=["January","February","March","April","May","June","July","August","September","October","November","December"];function S(B,z,b){for(var W=typeof B=="number"?B.toString():B||"";W.length0?1:0}var W;return(W=b(B.getFullYear()-z.getFullYear()))===0&&(W=b(B.getMonth()-z.getMonth()))===0&&(W=b(B.getDate()-z.getDate())),W}function F(B){switch(B.getDay()){case 0:return new Date(B.getFullYear()-1,11,29);case 1:return B;case 2:return new Date(B.getFullYear(),0,3);case 3:return new Date(B.getFullYear(),0,2);case 4:return new Date(B.getFullYear(),0,1);case 5:return new Date(B.getFullYear()-1,11,31);case 6:return new Date(B.getFullYear()-1,11,30)}}function M(B){var z=__addDays(new Date(B.tm_year+1900,0,1),B.tm_yday),b=new Date(z.getFullYear(),0,4),W=new Date(z.getFullYear()+1,0,4),q=F(b),Y=F(W);return e(q,z)<=0?e(Y,z)<=0?z.getFullYear()+1:z.getFullYear():z.getFullYear()-1}var L={"%a":function(B){return T[B.tm_wday].substring(0,3)},"%A":function(B){return T[B.tm_wday]},"%b":function(B){return E[B.tm_mon].substring(0,3)},"%B":function(B){return E[B.tm_mon]},"%C":function(B){var z=B.tm_year+1900;return I(z/100|0,2)},"%d":function(B){return I(B.tm_mday,2)},"%e":function(B){return S(B.tm_mday,2," ")},"%g":function(B){return M(B).toString().substring(2)},"%G":function(B){return M(B)},"%H":function(B){return I(B.tm_hour,2)},"%I":function(B){return I(B.tm_hour<13?B.tm_hour:B.tm_hour-12,2)},"%j":function(B){return I(B.tm_mday+__arraySum(__isLeapYear(B.tm_year+1900)?__MONTH_DAYS_LEAP:__MONTH_DAYS_REGULAR,B.tm_mon-1),3)},"%m":function(B){return I(B.tm_mon+1,2)},"%M":function(B){return I(B.tm_min,2)},"%n":function(){return` -`},"%p":function(B){return B.tm_hour>0&&B.tm_hour<13?"AM":"PM"},"%S":function(B){return I(B.tm_sec,2)},"%t":function(){return" "},"%u":function(B){var z=new Date(B.tm_year+1900,B.tm_mon+1,B.tm_mday,0,0,0,0);return z.getDay()||7},"%U":function(B){var z=new Date(B.tm_year+1900,0,1),b=z.getDay()===0?z:__addDays(z,7-z.getDay()),W=new Date(B.tm_year+1900,B.tm_mon,B.tm_mday);if(e(b,W)<0){var q=__arraySum(__isLeapYear(W.getFullYear())?__MONTH_DAYS_LEAP:__MONTH_DAYS_REGULAR,W.getMonth()-1)-31,Y=31-b.getDate(),X=Y+q+W.getDate();return I(Math.ceil(X/7),2)}return e(b,z)===0?"01":"00"},"%V":function(B){var z=new Date(B.tm_year+1900,0,4),b=new Date(B.tm_year+1901,0,4),W=F(z),q=F(b),Y=__addDays(new Date(B.tm_year+1900,0,1),B.tm_yday);if(e(Y,W)<0)return"53";if(e(q,Y)<=0)return"01";var X;return W.getFullYear()=0;return z=Math.abs(z)/60,z=z/60*100+z%60,(b?"+":"-")+("0000"+z).slice(-4)},"%Z":function(B){return B.tm_zone},"%%":function(){return"%"}};for(var y in L)A.indexOf(y)>=0&&(A=A.replace(new RegExp(y,"g"),L[y](m)));var V=intArrayFromString(A,!1);return V.length>n?0:(writeArrayToMemory(V,a),V.length-1)}function _strftime_l(a,n,s,u){return _strftime(a,n,s,u)}function _abort(){Module.abort()}function _free(){}Module._free=_free;function ___cxa_free_exception(a){try{return _free(a)}catch{}}function ___cxa_end_catch(){if(___cxa_end_catch.rethrown){___cxa_end_catch.rethrown=!1;return}asm.setThrew(0);var a=EXCEPTIONS.caught.pop();a&&(EXCEPTIONS.decRef(EXCEPTIONS.deAdjust(a)),EXCEPTIONS.last=0)}function _pthread_once(a,n){_pthread_once.seen||(_pthread_once.seen={}),!(a in _pthread_once.seen)&&(Runtime.dynCall("v",n),_pthread_once.seen[a]=1)}function ___lock(){}function ___unlock(){}var PTHREAD_SPECIFIC={};function _pthread_getspecific(a){return PTHREAD_SPECIFIC[a]||0}function ___setErrNo(a){return Module.___errno_location&&(HEAP32[Module.___errno_location()>>2]=a),a}var ERRNO_CODES={EPERM:1,ENOENT:2,ESRCH:3,EINTR:4,EIO:5,ENXIO:6,E2BIG:7,ENOEXEC:8,EBADF:9,ECHILD:10,EAGAIN:11,EWOULDBLOCK:11,ENOMEM:12,EACCES:13,EFAULT:14,ENOTBLK:15,EBUSY:16,EEXIST:17,EXDEV:18,ENODEV:19,ENOTDIR:20,EISDIR:21,EINVAL:22,ENFILE:23,EMFILE:24,ENOTTY:25,ETXTBSY:26,EFBIG:27,ENOSPC:28,ESPIPE:29,EROFS:30,EMLINK:31,EPIPE:32,EDOM:33,ERANGE:34,ENOMSG:42,EIDRM:43,ECHRNG:44,EL2NSYNC:45,EL3HLT:46,EL3RST:47,ELNRNG:48,EUNATCH:49,ENOCSI:50,EL2HLT:51,EDEADLK:35,ENOLCK:37,EBADE:52,EBADR:53,EXFULL:54,ENOANO:55,EBADRQC:56,EBADSLT:57,EDEADLOCK:35,EBFONT:59,ENOSTR:60,ENODATA:61,ETIME:62,ENOSR:63,ENONET:64,ENOPKG:65,EREMOTE:66,ENOLINK:67,EADV:68,ESRMNT:69,ECOMM:70,EPROTO:71,EMULTIHOP:72,EDOTDOT:73,EBADMSG:74,ENOTUNIQ:76,EBADFD:77,EREMCHG:78,ELIBACC:79,ELIBBAD:80,ELIBSCN:81,ELIBMAX:82,ELIBEXEC:83,ENOSYS:38,ENOTEMPTY:39,ENAMETOOLONG:36,ELOOP:40,EOPNOTSUPP:95,EPFNOSUPPORT:96,ECONNRESET:104,ENOBUFS:105,EAFNOSUPPORT:97,EPROTOTYPE:91,ENOTSOCK:88,ENOPROTOOPT:92,ESHUTDOWN:108,ECONNREFUSED:111,EADDRINUSE:98,ECONNABORTED:103,ENETUNREACH:101,ENETDOWN:100,ETIMEDOUT:110,EHOSTDOWN:112,EHOSTUNREACH:113,EINPROGRESS:115,EALREADY:114,EDESTADDRREQ:89,EMSGSIZE:90,EPROTONOSUPPORT:93,ESOCKTNOSUPPORT:94,EADDRNOTAVAIL:99,ENETRESET:102,EISCONN:106,ENOTCONN:107,ETOOMANYREFS:109,EUSERS:87,EDQUOT:122,ESTALE:116,ENOTSUP:95,ENOMEDIUM:123,EILSEQ:84,EOVERFLOW:75,ECANCELED:125,ENOTRECOVERABLE:131,EOWNERDEAD:130,ESTRPIPE:86};function _sysconf(a){switch(a){case 30:return PAGE_SIZE;case 85:return totalMemory/PAGE_SIZE;case 132:case 133:case 12:case 137:case 138:case 15:case 235:case 16:case 17:case 18:case 19:case 20:case 149:case 13:case 10:case 236:case 153:case 9:case 21:case 22:case 159:case 154:case 14:case 77:case 78:case 139:case 80:case 81:case 82:case 68:case 67:case 164:case 11:case 29:case 47:case 48:case 95:case 52:case 51:case 46:return 200809;case 79:return 0;case 27:case 246:case 127:case 128:case 23:case 24:case 160:case 161:case 181:case 182:case 242:case 183:case 184:case 243:case 244:case 245:case 165:case 178:case 179:case 49:case 50:case 168:case 169:case 175:case 170:case 171:case 172:case 97:case 76:case 32:case 173:case 35:return-1;case 176:case 177:case 7:case 155:case 8:case 157:case 125:case 126:case 92:case 93:case 129:case 130:case 131:case 94:case 91:return 1;case 74:case 60:case 69:case 70:case 4:return 1024;case 31:case 42:case 72:return 32;case 87:case 26:case 33:return 2147483647;case 34:case 1:return 47839;case 38:case 36:return 99;case 43:case 37:return 2048;case 0:return 2097152;case 3:return 65536;case 28:return 32768;case 44:return 32767;case 75:return 16384;case 39:return 1e3;case 89:return 700;case 71:return 256;case 40:return 255;case 2:return 100;case 180:return 64;case 25:return 20;case 5:return 16;case 6:return 6;case 73:return 4;case 84:return typeof navigator=="object"&&navigator.hardwareConcurrency||1}return ___setErrNo(ERRNO_CODES.EINVAL),-1}var _fabs=Math_abs,PTHREAD_SPECIFIC_NEXT_KEY=1;function _pthread_key_create(a,n){return a==0?ERRNO_CODES.EINVAL:(HEAP32[a>>2]=PTHREAD_SPECIFIC_NEXT_KEY,PTHREAD_SPECIFIC[PTHREAD_SPECIFIC_NEXT_KEY]=0,PTHREAD_SPECIFIC_NEXT_KEY++,0)}function _emscripten_set_main_loop_timing(a,n){if(Browser.mainLoop.timingMode=a,Browser.mainLoop.timingValue=n,!Browser.mainLoop.func)return 1;if(a==0)Browser.mainLoop.scheduler=function(){setTimeout(Browser.mainLoop.runner,n)},Browser.mainLoop.method="timeout";else if(a==1)Browser.mainLoop.scheduler=function(){Browser.requestAnimationFrame(Browser.mainLoop.runner)},Browser.mainLoop.method="rAF";else if(a==2){if(!window.setImmediate){let f=function(m){m.source===window&&m.data===u&&(m.stopPropagation(),s.shift()())};var s=[],u="__emcc";window.addEventListener("message",f,!0),window.setImmediate=function(A){s.push(A),window.postMessage(u,"*")}}Browser.mainLoop.scheduler=function(){window.setImmediate(Browser.mainLoop.runner)},Browser.mainLoop.method="immediate"}return 0}function _emscripten_set_main_loop(a,n,s,u,f){Module.noExitRuntime=!0,assert(!Browser.mainLoop.func,"emscripten_set_main_loop: there can only be one main loop function at once: call emscripten_cancel_main_loop to cancel the previous one before setting a new one with different parameters."),Browser.mainLoop.func=a,Browser.mainLoop.arg=u;var m=Browser.mainLoop.currentlyRunningMainloop;if(Browser.mainLoop.runner=function(){if(!ABORT){if(Browser.mainLoop.queue.length>0){var v=Date.now(),y=Browser.mainLoop.queue.shift();if(y.func(y.arg),Browser.mainLoop.remainingBlockers){var T=Browser.mainLoop.remainingBlockers,E=T%1==0?T-1:Math.floor(T);y.counted?Browser.mainLoop.remainingBlockers=E:(E=E+.5,Browser.mainLoop.remainingBlockers=(8*T+E)/9)}console.log('main loop blocker "'+y.name+'" took '+(Date.now()-v)+" ms"),Browser.mainLoop.updateStatus(),setTimeout(Browser.mainLoop.runner,0);return}if(!(m1&&Browser.mainLoop.currentFrameNumber%Browser.mainLoop.timingValue!=0){Browser.mainLoop.scheduler();return}Browser.mainLoop.method==="timeout"&&Module.ctx&&(Module.printErr("Looks like you are rendering without using requestAnimationFrame for the main loop. You should use 0 for the frame rate in emscripten_set_main_loop in order to use requestAnimationFrame, as that can greatly improve your frame rates!"),Browser.mainLoop.method=""),Browser.mainLoop.runIter(function(){typeof u<"u"?Runtime.dynCall("vi",a,[u]):Runtime.dynCall("v",a)}),!(m0?_emscripten_set_main_loop_timing(0,1e3/n):_emscripten_set_main_loop_timing(1,1),Browser.mainLoop.scheduler()),s)throw"SimulateInfiniteLoop"}var Browser={mainLoop:{scheduler:null,method:"",currentlyRunningMainloop:0,func:null,arg:0,timingMode:0,timingValue:0,currentFrameNumber:0,queue:[],pause:function(){Browser.mainLoop.scheduler=null,Browser.mainLoop.currentlyRunningMainloop++},resume:function(){Browser.mainLoop.currentlyRunningMainloop++;var a=Browser.mainLoop.timingMode,n=Browser.mainLoop.timingValue,s=Browser.mainLoop.func;Browser.mainLoop.func=null,_emscripten_set_main_loop(s,0,!1,Browser.mainLoop.arg,!0),_emscripten_set_main_loop_timing(a,n),Browser.mainLoop.scheduler()},updateStatus:function(){if(Module.setStatus){var a=Module.statusMessage||"Please wait...",n=Browser.mainLoop.remainingBlockers,s=Browser.mainLoop.expectedBlockers;n?n"u"&&(console.log("warning: Browser does not support creating object URLs. Built-in browser image decoding will not be available."),Module.noImageDecoding=!0);var a={};a.canHandle=function(m){return!Module.noImageDecoding&&/\.(jpg|jpeg|png|bmp)$/i.test(m)},a.handle=function(m,A,v,y){var T=null;if(Browser.hasBlobConstructor)try{T=new Blob([m],{type:Browser.getMimetype(A)}),T.size!==m.length&&(T=new Blob([new Uint8Array(m).buffer],{type:Browser.getMimetype(A)}))}catch(e){Runtime.warnOnce("Blob constructor present but fails: "+e+"; falling back to blob builder")}if(!T){var E=new Browser.BlobBuilder;E.append(new Uint8Array(m).buffer),T=E.getBlob()}var S=Browser.URLObject.createObjectURL(T),I=new Image;I.onload=function(){assert(I.complete,"Image "+A+" could not be decoded");var F=document.createElement("canvas");F.width=I.width,F.height=I.height;var M=F.getContext("2d");M.drawImage(I,0,0),Module.preloadedImages[A]=F,Browser.URLObject.revokeObjectURL(S),v&&v(m)},I.onerror=function(F){console.log("Image "+S+" could not be decoded"),y&&y()},I.src=S},Module.preloadPlugins.push(a);var n={};n.canHandle=function(m){return!Module.noAudioDecoding&&m.substr(-4)in{".ogg":1,".wav":1,".mp3":1}},n.handle=function(m,A,v,y){var T=!1;function E(M){T||(T=!0,Module.preloadedAudios[A]=M,v&&v(m))}function S(){T||(T=!0,Module.preloadedAudios[A]=new Audio,y&&y())}if(Browser.hasBlobConstructor){try{var I=new Blob([m],{type:Browser.getMimetype(A)})}catch{return S()}var e=Browser.URLObject.createObjectURL(I),F=new Audio;F.addEventListener("canplaythrough",function(){E(F)},!1),F.onerror=function(L){if(T)return;console.log("warning: browser could not fully decode audio "+A+", trying slower base64 approach");function V(B){for(var z="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",b="=",W="",q=0,Y=0,X=0;X=6;){var H=q>>Y-6&63;Y-=6,W+=z[H]}return Y==2?(W+=z[(q&3)<<4],W+=b+b):Y==4&&(W+=z[(q&15)<<2],W+=b),W}F.src="data:audio/x-"+A.substr(-3)+";base64,"+V(m),E(F)},F.src=e,Browser.safeSetTimeout(function(){E(F)},1e4)}else return S()},Module.preloadPlugins.push(n);var s=Module.canvas;function u(){Browser.pointerLock=document.pointerLockElement===s||document.mozPointerLockElement===s||document.webkitPointerLockElement===s||document.msPointerLockElement===s}s&&(s.requestPointerLock=s.requestPointerLock||s.mozRequestPointerLock||s.webkitRequestPointerLock||s.msRequestPointerLock||function(){},s.exitPointerLock=document.exitPointerLock||document.mozExitPointerLock||document.webkitExitPointerLock||document.msExitPointerLock||function(){},s.exitPointerLock=s.exitPointerLock.bind(document),document.addEventListener("pointerlockchange",u,!1),document.addEventListener("mozpointerlockchange",u,!1),document.addEventListener("webkitpointerlockchange",u,!1),document.addEventListener("mspointerlockchange",u,!1),Module.elementPointerLock&&s.addEventListener("click",function(f){!Browser.pointerLock&&s.requestPointerLock&&(s.requestPointerLock(),f.preventDefault())},!1))},createContext:function(a,n,s,u){if(n&&Module.ctx&&a==Module.canvas)return Module.ctx;var f,m;if(n){var A={antialias:!1,alpha:!1};if(u)for(var v in u)A[v]=u[v];m=GL.createContext(a,A),m&&(f=GL.getContext(m).GLctx),a.style.backgroundColor="black"}else f=a.getContext("2d");return f?(s&&(n||assert(typeof GLctx>"u","cannot set in module if GLctx is used, but we are a non-GL context that would replace it"),Module.ctx=f,n&&GL.makeContextCurrent(m),Module.useWebGL=n,Browser.moduleContextCreatedCallbacks.forEach(function(y){y()}),Browser.init()),f):null},destroyContext:function(a,n,s){},fullScreenHandlersInstalled:!1,lockPointer:void 0,resizeCanvas:void 0,requestFullScreen:function(a,n,s){Browser.lockPointer=a,Browser.resizeCanvas=n,Browser.vrDevice=s,typeof Browser.lockPointer>"u"&&(Browser.lockPointer=!0),typeof Browser.resizeCanvas>"u"&&(Browser.resizeCanvas=!1),typeof Browser.vrDevice>"u"&&(Browser.vrDevice=null);var u=Module.canvas;function f(){Browser.isFullScreen=!1;var A=u.parentNode;(document.webkitFullScreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.mozFullscreenElement||document.fullScreenElement||document.fullscreenElement||document.msFullScreenElement||document.msFullscreenElement||document.webkitCurrentFullScreenElement)===A?(u.cancelFullScreen=document.cancelFullScreen||document.mozCancelFullScreen||document.webkitCancelFullScreen||document.msExitFullscreen||document.exitFullscreen||function(){},u.cancelFullScreen=u.cancelFullScreen.bind(document),Browser.lockPointer&&u.requestPointerLock(),Browser.isFullScreen=!0,Browser.resizeCanvas&&Browser.setFullScreenCanvasSize()):(A.parentNode.insertBefore(u,A),A.parentNode.removeChild(A),Browser.resizeCanvas&&Browser.setWindowedCanvasSize()),Module.onFullScreen&&Module.onFullScreen(Browser.isFullScreen),Browser.updateCanvasDimensions(u)}Browser.fullScreenHandlersInstalled||(Browser.fullScreenHandlersInstalled=!0,document.addEventListener("fullscreenchange",f,!1),document.addEventListener("mozfullscreenchange",f,!1),document.addEventListener("webkitfullscreenchange",f,!1),document.addEventListener("MSFullscreenChange",f,!1));var m=document.createElement("div");u.parentNode.insertBefore(m,u),m.appendChild(u),m.requestFullScreen=m.requestFullScreen||m.mozRequestFullScreen||m.msRequestFullscreen||(m.webkitRequestFullScreen?function(){m.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT)}:null),s?m.requestFullScreen({vrDisplay:s}):m.requestFullScreen()},nextRAF:0,fakeRequestAnimationFrame:function(a){var n=Date.now();if(Browser.nextRAF===0)Browser.nextRAF=n+1e3/60;else for(;n+2>=Browser.nextRAF;)Browser.nextRAF+=1e3/60;var s=Math.max(Browser.nextRAF-n,0);setTimeout(a,s)},requestAnimationFrame:function a(n){typeof window>"u"?Browser.fakeRequestAnimationFrame(n):(window.requestAnimationFrame||(window.requestAnimationFrame=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame||window.oRequestAnimationFrame||Browser.fakeRequestAnimationFrame),window.requestAnimationFrame(n))},safeCallback:function(a){return function(){if(!ABORT)return a.apply(null,arguments)}},allowAsyncCallbacks:!0,queuedAsyncCallbacks:[],pauseAsyncCallbacks:function(){Browser.allowAsyncCallbacks=!1},resumeAsyncCallbacks:function(){if(Browser.allowAsyncCallbacks=!0,Browser.queuedAsyncCallbacks.length>0){var a=Browser.queuedAsyncCallbacks;Browser.queuedAsyncCallbacks=[],a.forEach(function(n){n()})}},safeRequestAnimationFrame:function(a){return Browser.requestAnimationFrame(function(){ABORT||(Browser.allowAsyncCallbacks?a():Browser.queuedAsyncCallbacks.push(a))})},safeSetTimeout:function(a,n){return Module.noExitRuntime=!0,setTimeout(function(){ABORT||(Browser.allowAsyncCallbacks?a():Browser.queuedAsyncCallbacks.push(a))},n)},safeSetInterval:function(a,n){return Module.noExitRuntime=!0,setInterval(function(){ABORT||Browser.allowAsyncCallbacks&&a()},n)},getMimetype:function(a){return{jpg:"image/jpeg",jpeg:"image/jpeg",png:"image/png",bmp:"image/bmp",ogg:"audio/ogg",wav:"audio/wav",mp3:"audio/mpeg"}[a.substr(a.lastIndexOf(".")+1)]},getUserMedia:function(a){window.getUserMedia||(window.getUserMedia=navigator.getUserMedia||navigator.mozGetUserMedia),window.getUserMedia(a)},getMovementX:function(a){return a.movementX||a.mozMovementX||a.webkitMovementX||0},getMovementY:function(a){return a.movementY||a.mozMovementY||a.webkitMovementY||0},getMouseWheelDelta:function(a){var n=0;switch(a.type){case"DOMMouseScroll":n=a.detail;break;case"mousewheel":n=a.wheelDelta;break;case"wheel":n=a.deltaY;break;default:throw"unrecognized mouse wheel event: "+a.type}return n},mouseX:0,mouseY:0,mouseMovementX:0,mouseMovementY:0,touches:{},lastTouches:{},calculateMouseEvent:function(a){if(Browser.pointerLock)a.type!="mousemove"&&"mozMovementX"in a?Browser.mouseMovementX=Browser.mouseMovementY=0:(Browser.mouseMovementX=Browser.getMovementX(a),Browser.mouseMovementY=Browser.getMovementY(a)),typeof SDL<"u"?(Browser.mouseX=SDL.mouseX+Browser.mouseMovementX,Browser.mouseY=SDL.mouseY+Browser.mouseMovementY):(Browser.mouseX+=Browser.mouseMovementX,Browser.mouseY+=Browser.mouseMovementY);else{var n=Module.canvas.getBoundingClientRect(),s=Module.canvas.width,u=Module.canvas.height,f=typeof window.scrollX<"u"?window.scrollX:window.pageXOffset,m=typeof window.scrollY<"u"?window.scrollY:window.pageYOffset;if(a.type==="touchstart"||a.type==="touchend"||a.type==="touchmove"){var A=a.touch;if(A===void 0)return;var v=A.pageX-(f+n.left),y=A.pageY-(m+n.top);v=v*(s/n.width),y=y*(u/n.height);var T={x:v,y};if(a.type==="touchstart")Browser.lastTouches[A.identifier]=T,Browser.touches[A.identifier]=T;else if(a.type==="touchend"||a.type==="touchmove"){var E=Browser.touches[A.identifier];E||(E=T),Browser.lastTouches[A.identifier]=E,Browser.touches[A.identifier]=T}return}var S=a.pageX-(f+n.left),I=a.pageY-(m+n.top);S=S*(s/n.width),I=I*(u/n.height),Browser.mouseMovementX=S-Browser.mouseX,Browser.mouseMovementY=I-Browser.mouseY,Browser.mouseX=S,Browser.mouseY=I}},xhrLoad:function(a,n,s){var u=new XMLHttpRequest;u.open("GET",a,!0),u.responseType="arraybuffer",u.onload=function(){u.status==200||u.status==0&&u.response?n(u.response):s()},u.onerror=s,u.send(null)},asyncLoad:function(a,n,s,u){Browser.xhrLoad(a,function(f){assert(f,'Loading data file "'+a+'" failed (no arrayBuffer).'),n(new Uint8Array(f)),u||removeRunDependency()},function(f){if(s)s();else throw'Loading data file "'+a+'" failed.'}),u||addRunDependency()},resizeListeners:[],updateResizeListeners:function(){var a=Module.canvas;Browser.resizeListeners.forEach(function(n){n(a.width,a.height)})},setCanvasSize:function(a,n,s){var u=Module.canvas;Browser.updateCanvasDimensions(u,a,n),s||Browser.updateResizeListeners()},windowedWidth:0,windowedHeight:0,setFullScreenCanvasSize:function(){if(typeof SDL<"u"){var a=HEAPU32[SDL.screen+Runtime.QUANTUM_SIZE*0>>2];a=a|8388608,HEAP32[SDL.screen+Runtime.QUANTUM_SIZE*0>>2]=a}Browser.updateResizeListeners()},setWindowedCanvasSize:function(){if(typeof SDL<"u"){var a=HEAPU32[SDL.screen+Runtime.QUANTUM_SIZE*0>>2];a=a&-8388609,HEAP32[SDL.screen+Runtime.QUANTUM_SIZE*0>>2]=a}Browser.updateResizeListeners()},updateCanvasDimensions:function(a,n,s){n&&s?(a.widthNative=n,a.heightNative=s):(n=a.widthNative,s=a.heightNative);var u=n,f=s;if(Module.forcedAspectRatio&&Module.forcedAspectRatio>0&&(u/f>2];return n},getStr:function(){var a=Pointer_stringify(SYSCALLS.get());return a},get64:function(){var a=SYSCALLS.get(),n=SYSCALLS.get();return a>=0?assert(n===0):assert(n===-1),a},getZero:function(){assert(SYSCALLS.get()===0)}};function ___syscall54(a,n){SYSCALLS.varargs=n;try{return 0}catch(s){return(typeof FS>"u"||!(s instanceof FS.ErrnoError))&&abort(s),-s.errno}}Module._i64Add=_i64Add,Module._bitshift64Lshr=_bitshift64Lshr;function ___cxa_pure_virtual(){throw ABORT=!0,"Pure virtual function called!"}function _pthread_cleanup_push(a,n){__ATEXIT__.push(function(){Runtime.dynCall("vi",a,[n])}),_pthread_cleanup_push.level=__ATEXIT__.length}function _pthread_cond_broadcast(){return 0}function ___cxa_guard_acquire(a){return HEAP8[a>>0]?0:(HEAP8[a>>0]=1,1)}function _pthread_cleanup_pop(){assert(_pthread_cleanup_push.level==__ATEXIT__.length,"cannot pop if something else added meanwhile!"),__ATEXIT__.pop(),_pthread_cleanup_push.level=__ATEXIT__.length}function ___cxa_guard_release(){}function ___cxa_begin_catch(a){return __ZSt18uncaught_exceptionv.uncaught_exception--,EXCEPTIONS.caught.push(a),EXCEPTIONS.addRef(EXCEPTIONS.deAdjust(a)),a}function _llvm_eh_typeid_for(a){return a}function _emscripten_memcpy_big(a,n,s){return HEAPU8.set(HEAPU8.subarray(n,n+s),a),a}Module._memcpy=_memcpy;function ___syscall6(a,n){SYSCALLS.varargs=n;try{var s=SYSCALLS.getStreamFromFD();return FS.close(s),0}catch(u){return(typeof FS>"u"||!(u instanceof FS.ErrnoError))&&abort(u),-u.errno}}function _pthread_mutex_lock(){}function _sbrk(a){var n=_sbrk;n.called||(DYNAMICTOP=alignMemoryPage(DYNAMICTOP),n.called=!0,assert(Runtime.dynamicAlloc),n.alloc=Runtime.dynamicAlloc,Runtime.dynamicAlloc=function(){abort("cannot dynamically allocate, sbrk now has control")});var s=DYNAMICTOP;if(a!=0){var u=n.alloc(a);if(!u)return 4294967295}return s}Module._bitshift64Shl=_bitshift64Shl;function ___cxa_guard_abort(){}Module._memmove=_memmove;function _pthread_cond_wait(){return 0}function ___cxa_rethrow(){___cxa_end_catch.rethrown=!0;var a=EXCEPTIONS.caught.pop();throw EXCEPTIONS.last=a,a}function _pthread_mutex_unlock(){}function _time(a){var n=Date.now()/1e3|0;return a&&(HEAP32[a>>2]=n),n}function _pthread_self(){return 0}function ___syscall140(a,n){SYSCALLS.varargs=n;try{var s=SYSCALLS.getStreamFromFD(),u=SYSCALLS.get(),f=SYSCALLS.get(),m=SYSCALLS.get(),A=SYSCALLS.get(),v=f;return assert(u===0),FS.llseek(s,v,A),HEAP32[m>>2]=s.position,s.getdents&&v===0&&A===0&&(s.getdents=null),0}catch(y){return(typeof FS>"u"||!(y instanceof FS.ErrnoError))&&abort(y),-y.errno}}function ___syscall146(a,n){SYSCALLS.varargs=n;try{var s=SYSCALLS.get(),u=SYSCALLS.get(),f=SYSCALLS.get(),m=0;___syscall146.buffer||(___syscall146.buffer=[]);for(var A=___syscall146.buffer,v=0;v>2],T=HEAP32[u+(v*8+4)>>2],E=0;E"u"||!(I instanceof FS.ErrnoError))&&abort(I),-I.errno}}function ___syscall145(a,n){SYSCALLS.varargs=n;try{var s=SYSCALLS.getStreamFromFD(),u=SYSCALLS.get(),f=SYSCALLS.get();return SYSCALLS.doReadv(s,u,f)}catch(m){return(typeof FS>"u"||!(m instanceof FS.ErrnoError))&&abort(m),-m.errno}}var ___dso_handle=allocate(1,"i32*",ALLOC_STATIC);Module.requestFullScreen=function a(n,s,u){Browser.requestFullScreen(n,s,u)},Module.requestAnimationFrame=function a(n){Browser.requestAnimationFrame(n)},Module.setCanvasSize=function a(n,s,u){Browser.setCanvasSize(n,s,u)},Module.pauseMainLoop=function a(){Browser.mainLoop.pause()},Module.resumeMainLoop=function a(){Browser.mainLoop.resume()},Module.getUserMedia=function a(){Browser.getUserMedia()},Module.createContext=function a(n,s,u,f){return Browser.createContext(n,s,u,f)},STACK_BASE=STACKTOP=Runtime.alignMemory(STATICTOP),staticSealed=!0,STACK_MAX=STACK_BASE+TOTAL_STACK,DYNAMIC_BASE=DYNAMICTOP=Runtime.alignMemory(STACK_MAX),assert(DYNAMIC_BASE2147483648?!1:(S=new u(t),I=new f(t),e=new m(t),F=new A(t),M=new v(t),L=new y(t),V=new T(t),B=new E(t),s=t,!0)}function na(t){t=t|0;var r=0;return r=b,b=b+t|0,b=b+15&-16,r|0}function ra(){return b|0}function sa(t){t=t|0,b=t}function oa(t,r){t=t|0,r=r|0,b=t,W=r}function aa(t,r){t=t|0,r=r|0,g||(g=t,J=r)}function hA(t){t=t|0,S[q>>0]=S[t>>0],S[q+1>>0]=S[t+1>>0],S[q+2>>0]=S[t+2>>0],S[q+3>>0]=S[t+3>>0]}function dA(t){t=t|0,S[q>>0]=S[t>>0],S[q+1>>0]=S[t+1>>0],S[q+2>>0]=S[t+2>>0],S[q+3>>0]=S[t+3>>0],S[q+4>>0]=S[t+4>>0],S[q+5>>0]=S[t+5>>0],S[q+6>>0]=S[t+6>>0],S[q+7>>0]=S[t+7>>0]}function la(t){t=t|0,ye=t}function ua(){return ye|0}function ca(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0,G=0,$=0;if($=b,b=b+128|0,N=$+44|0,U=$+8|0,C=$+4|0,k=$,R=o+4|0,_=o+8|0,g=0,$e(35,e[o>>2]|0,e[R>>2]|0,e[_>>2]|0,l|0),D=g,g=0,D&1)Q=5;else{d=N,h=d+84|0;do e[d>>2]=e[l>>2],d=d+4|0,l=l+4|0;while((d|0)<(h|0));if(l=N+12|0,!(e[l>>2]|0)&&(w=ee(((e[N+8>>2]|0)+7|0)/8|0,e[N>>2]|0)|0,e[l>>2]=w,(e[N+24>>2]|0)!=0)&&(D=ee(e[N+16>>2]|0,w)|0,e[l>>2]=D),g=0,ue(176,U|0),D=g,g=0,D&1)Q=5;else{l=N+56|0;do if(e[l>>2]|0)if(g=0,l=ge(66,l|0)|0,D=g,g=0,D&1)Q=15;else{if(e[C>>2]=l,h=U+28|0,d=e[h>>2]|0,d>>>0<(e[U+32>>2]|0)>>>0){e[d>>2]=l,e[h>>2]=d+4,e[C>>2]=0,Q=19;break}if(g=0,Ae(57,U+24|0,C|0),D=g,g=0,D&1){if(h=j(824,0)|0,l=ye,d=e[C>>2]|0,e[C>>2]=0,!d)break;Mt[e[(e[d>>2]|0)+4>>2]&255](d);break}else{if(l=e[C>>2]|0,e[C>>2]=0,!l){Q=19;break}Mt[e[(e[l>>2]|0)+4>>2]&255](l),Q=19;break}}else Q=19;while(!1);e:do if((Q|0)==19)if(d=N+4|0,w=N+8|0,C=N+16|0,g=0,l=Pe(14,e[N>>2]|0,e[d>>2]|0,e[w>>2]|0,e[C>>2]|0)|0,D=g,g=0,D&1)Q=15;else{e[k>>2]=l,D=U+28|0,h=e[D>>2]|0;do if(h>>>0>=(e[U+32>>2]|0)>>>0)if(g=0,Ae(57,U+24|0,k|0),h=g,g=0,h&1){if(h=j(824,0)|0,l=ye,d=e[k>>2]|0,e[k>>2]=0,!d)break e;Mt[e[(e[d>>2]|0)+4>>2]&255](d);break e}else{if(l=e[k>>2]|0,e[k>>2]=0,!l)break;Mt[e[(e[l>>2]|0)+4>>2]&255](l);break}else e[h>>2]=l,e[D>>2]=h+4,e[k>>2]=0;while(!1);if(l=e[N+28>>2]|0,l|0&&(g=0,Ae(58,U|0,l|0),Q=g,g=0,Q&1)){Q=15;break}t:do if(e[N+24>>2]|0){if(g=0,xe(4,U|0,o|0,N|0),Q=g,g=0,Q&1){Q=15;break e}}else if(l=ee(e[d>>2]|0,e[N>>2]|0)|0,l=ee(l,((e[w>>2]|0)+7|0)/8|0)|0,(e[C>>2]|0)>0){for(d=0;g=0,xe(4,U|0,o|0,N|0),Q=g,g=0,!(Q&1);)if(h=e[R>>2]|0,h&&(e[R>>2]=h+l,e[_>>2]=(e[_>>2]|0)-l),d=d+1|0,(d|0)>=(e[C>>2]|0))break t;h=j(824,0)|0,l=ye,Q=16;break e}while(!1);if(g=0,be(33,U|0,t|0)|0,Q=g,g=0,Q&1)Q=15;else{if(e[r>>2]=e[U+16>>2],c&&(S[c>>0]=0),d=U+24|0,l=e[d>>2]|0,l){if(h=e[D>>2]|0,(h|0)!=(l|0)){do c=h+-4|0,e[D>>2]=c,h=e[c>>2]|0,e[c>>2]=0,h&&Mt[e[(e[h>>2]|0)+4>>2]&255](h),h=e[D>>2]|0;while((h|0)!=(l|0));l=e[d>>2]|0}he(l)}return c=0,b=$,c|0}}while(!1);if((Q|0)==15&&(h=j(824,0)|0,l=ye,Q=16),D=U+24|0,d=e[D>>2]|0,d){if(C=U+28|0,w=e[C>>2]|0,(w|0)!=(d|0)){do U=w+-4|0,e[C>>2]=U,w=e[U>>2]|0,e[U>>2]=0,w&&Mt[e[(e[w>>2]|0)+4>>2]&255](w),w=e[C>>2]|0;while((w|0)!=(d|0));d=e[D>>2]|0}he(d)}}}if((Q|0)==5&&(h=j(824,0)|0,l=ye),U=(l|0)==($n(824)|0),w=K0(h|0)|0,l=(c|0)==0,!U)return l||(S[c>>0]=0),ei(),c=14,b=$,c|0;d=w+12|0;do if(l)Q=60;else if(l=e[d>>2]|0,g=0,h=Ce(1)|0,U=g,g=0,!(U&1))if((l|0)==(h|0)){Rr(c,Dt[e[(e[w>>2]|0)+8>>2]&127](w)|0)|0,Q=60;break}else{S[c>>0]=0,Q=60;break}while(!1);return(Q|0)==60&&(K=e[d>>2]|0,g=0,G=Ce(1)|0,c=g,g=0,!(c&1))?(c=(K|0)==(G|0)?e[w+8>>2]|0:13,ei(),b=$,c|0):(l=j()|0,g=0,Nt(3),$=g,g=0,$&1?($=j(0)|0,$t($)):le(l|0),0)}function fa(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0;switch(D=b,b=b+112|0,h=D+96|0,C=D+84|0,k=D+72|0,N=D+60|0,R=D+48|0,_=D+36|0,U=D+24|0,Q=D+12|0,K=D,w=(r|0)==0,(t|0)==0&w&&(c=Ct(16)|0,g=0,xe(5,h|0,48504,52),K=g,g=0,K&1?r=j()|0:(g=0,r=Ce(1)|0,K=g,g=0,!(K&1)&&(g=0,$e(36,c|0,1,r|0,h|0),K=g,g=0,!(K&1))?(g=0,xe(6,c|0,824,96),g=0,t=0):t=1,r=j()|0,de(h),t||(K=r,le(K|0))),Tt(c|0),K=r,le(K|0)),d=e[l>>2]|0,(d+-1|0)>>>0>65534&&(c=Ct(16)|0,g=0,xe(5,C|0,48557,41),K=g,g=0,K&1?r=j()|0:(g=0,r=Ce(1)|0,K=g,g=0,!(K&1)&&(g=0,$e(36,c|0,1,r|0,C|0),K=g,g=0,!(K&1))?(g=0,xe(6,c|0,824,96),g=0,t=0):t=1,r=j()|0,de(C),t||(K=r,le(K|0))),Tt(c|0),K=r,le(K|0)),h=e[l+4>>2]|0,(h+-1|0)>>>0>65534&&(c=Ct(16)|0,g=0,xe(5,k|0,48599,42),K=g,g=0,K&1?r=j()|0:(g=0,r=Ce(1)|0,K=g,g=0,!(K&1)&&(g=0,$e(36,c|0,1,r|0,k|0),K=g,g=0,!(K&1))?(g=0,xe(6,c|0,824,96),g=0,t=0):t=1,r=j()|0,de(k),t||(K=r,le(K|0))),Tt(c|0),K=r,le(K|0)),c=e[l+8>>2]|0,(c+-2|0)>>>0>14&&(c=Ct(16)|0,g=0,xe(5,N|0,48642,46),K=g,g=0,K&1?r=j()|0:(g=0,r=Ce(1)|0,K=g,g=0,!(K&1)&&(g=0,$e(36,c|0,1,r|0,N|0),K=g,g=0,!(K&1))?(g=0,xe(6,c|0,824,96),g=0,t=0):t=1,r=j()|0,de(N),t||(K=r,le(K|0))),Tt(c|0),K=r,le(K|0)),t=e[l+24>>2]|0,t>>>0>=3&&(c=Ct(16)|0,g=0,xe(5,R|0,48689,65),K=g,g=0,K&1?r=j()|0:(g=0,r=Ce(1)|0,K=g,g=0,!(K&1)&&(g=0,$e(36,c|0,1,r|0,R|0),K=g,g=0,!(K&1))?(g=0,xe(6,c|0,824,96),g=0,t=0):t=1,r=j()|0,de(R),t||(K=r,le(K|0))),Tt(c|0),K=r,le(K|0)),r=e[l+16>>2]|0,(r+-1|0)>>>0>254&&(c=Ct(16)|0,g=0,xe(5,_|0,48755,44),K=g,g=0,K&1?r=j()|0:(g=0,r=Ce(1)|0,K=g,g=0,!(K&1)&&(g=0,$e(36,c|0,1,r|0,_|0),K=g,g=0,!(K&1))?(g=0,xe(6,c|0,824,96),g=0,t=0):t=1,r=j()|0,de(_),t||(K=r,le(K|0))),Tt(c|0),K=r,le(K|0)),!w&&(_=ee(h,d)|0,(ee(ee(_,(c|0)>8?2:1)|0,r)|0)>>>0>o>>>0)&&(c=Ct(16)|0,g=0,xe(5,U|0,48800,58),K=g,g=0,K&1?r=j()|0:(g=0,r=Ce(1)|0,K=g,g=0,!(K&1)&&(g=0,$e(36,c|0,1,r|0,U|0),K=g,g=0,!(K&1))?(g=0,xe(6,c|0,824,96),g=0,t=0):t=1,r=j()|0,de(U),t||(K=r,le(K|0))),Tt(c|0),K=r,le(K|0)),r|0){case 4:{if((t|0)!=2){b=D;return}c=Ct(16)|0,g=0,xe(5,Q|0,48859,73),K=g,g=0,K&1?r=j()|0:(g=0,r=Ce(1)|0,K=g,g=0,!(K&1)&&(g=0,$e(36,c|0,1,r|0,Q|0),K=g,g=0,!(K&1))?(g=0,xe(6,c|0,824,96),g=0,t=0):t=1,r=j()|0,de(Q),t||(K=r,le(K|0))),Tt(c|0),K=r,le(K|0)}case 3:{b=D;return}default:{if(!t){b=D;return}c=Ct(16)|0,g=0,xe(5,K|0,48933,73),Q=g,g=0,Q&1?r=j()|0:(g=0,r=Ce(1)|0,Q=g,g=0,!(Q&1)&&(g=0,$e(36,c|0,1,r|0,K|0),Q=g,g=0,!(Q&1))?(g=0,xe(6,c|0,824,96),g=0,t=0):t=1,r=j()|0,de(K),t||(K=r,le(K|0))),Tt(c|0),K=r,le(K|0)}}}function $t(t){t=t|0,K0(t|0)|0,P6()}function ha(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0,D=0,k=0;if(k=b,b=b+128|0,h=k+116|0,d=k,g=0,e[h>>2]=e[r>>2],e[h+4>>2]=e[r+4>>2],e[h+8>>2]=e[r+8>>2],Ae(59,d|0,h|0),c=g,g=0,!(c&1)){if(o){c=d+16|0,r=c+84|0;do e[c>>2]=e[o>>2],c=c+4|0,o=o+4|0;while((c|0)<(r|0))}if(g=0,e[h>>2]=e[t>>2],e[h+4>>2]=e[t+4>>2],e[h+8>>2]=e[t+8>>2],Ae(60,d|0,h|0),d=g,g=0,!(d&1))return l&&(S[l>>0]=0),D=0,b=k,D|0}if(t=j(824,0)|0,d=ye,d=(d|0)==($n(824)|0),t=K0(t|0)|0,r=(l|0)==0,!d)return r||(S[l>>0]=0),ei(),D=14,b=k,D|0;c=t+12|0;do if(r)D=10;else if(r=e[c>>2]|0,g=0,o=Ce(1)|0,d=g,g=0,!(d&1))if((r|0)==(o|0)){Rr(l,Dt[e[(e[t>>2]|0)+8>>2]&127](t)|0)|0,D=10;break}else{S[l>>0]=0,D=10;break}while(!1);return(D|0)==10&&(w=e[c>>2]|0,g=0,C=Ce(1)|0,D=g,g=0,!(D&1))?(D=(w|0)==(C|0)?e[t+8>>2]|0:13,ei(),b=k,D|0):(r=j()|0,g=0,Nt(3),k=g,g=0,k&1?(k=j(0)|0,$t(k)):le(r|0),0)}function da(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0,w=0,C=0,D=0;if(C=b,b=b+128|0,c=C+116|0,l=C,g=0,e[c>>2]=e[t>>2],e[c+4>>2]=e[t+4>>2],e[c+8>>2]=e[t+8>>2],Ae(59,l|0,c|0),c=g,g=0,!(c&1)&&(g=0,ue(177,l|0),c=g,g=0,!(c&1))&&(g=0,Ae(61,l|0,1),c=g,g=0,!(c&1))){t=l+16|0,l=r+84|0;do e[r>>2]=e[t>>2],r=r+4|0,t=t+4|0;while((r|0)<(l|0));return o&&(S[o>>0]=0),o=0,b=C,o|0}if(c=j(824,0)|0,r=ye,r=(r|0)==($n(824)|0),c=K0(c|0)|0,t=(o|0)==0,!r)return t||(S[o>>0]=0),ei(),o=14,b=C,o|0;r=c+12|0;do if(t)w=13;else if(t=e[r>>2]|0,g=0,l=Ce(1)|0,D=g,g=0,!(D&1))if((t|0)==(l|0)){Rr(o,Dt[e[(e[c>>2]|0)+8>>2]&127](c)|0)|0,w=13;break}else{S[o>>0]=0,w=13;break}while(!1);return(w|0)==13&&(h=e[r>>2]|0,g=0,d=Ce(1)|0,D=g,g=0,!(D&1))?(D=(h|0)==(d|0)?e[c+8>>2]|0:13,ei(),b=C,D|0):(t=j()|0,g=0,Nt(3),D=g,g=0,D&1?(D=j(0)|0,$t(D)):le(t|0),0)}function pa(t,r,o,l,c,h,d){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0;var w=0,C=0,D=0,k=0,N=0;return N=b,b=b+48|0,C=N+36|0,w=N+24|0,D=N+12|0,k=N,(t|0)!=0&(o|0)!=0&(l|0)!=0&(h|0)!=0?(e[D>>2]=0,e[D+4>>2]=t,e[D+8>>2]=r,e[k>>2]=0,e[k+4>>2]=l,e[k+8>>2]=c,e[w>>2]=e[D>>2],e[w+4>>2]=e[D+4>>2],e[w+8>>2]=e[D+8>>2],e[C>>2]=e[k>>2],e[C+4>>2]=e[k+4>>2],e[C+8>>2]=e[k+8>>2],c=ca(w,o,C,h,d)|0,b=N,c|0):(c=1,b=N,c|0)}function ma(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0;return c=b,b=b+32|0,h=c+12|0,d=c,w=d,e[w>>2]=0,e[w+4>>2]=0,e[d+4>>2]=t,e[d+8>>2]=r,e[h>>2]=e[d>>2],e[h+4>>2]=e[d+4>>2],e[h+8>>2]=e[d+8>>2],o=da(h,o,l)|0,b=c,o|0}function ga(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0;return d=b,b=b+48|0,w=d+36|0,C=d+24|0,k=d+12|0,D=d,e[k>>2]=0,e[k+4>>2]=t,e[k+8>>2]=r,e[D>>2]=0,e[D+4>>2]=o,e[D+8>>2]=l,e[C>>2]=e[k>>2],e[C+4>>2]=e[k+4>>2],e[C+8>>2]=e[k+8>>2],e[w>>2]=e[D>>2],e[w+4>>2]=e[D+4>>2],e[w+8>>2]=e[D+8>>2],l=ha(C,w,c,h)|0,b=d,l|0}function Sa(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0;if(D=t+4|0,o=e[t>>2]|0,c=((e[D>>2]|0)-o>>2)+1|0,c>>>0>1073741823&&(pi(t),o=e[t>>2]|0),k=t+8|0,l=(e[k>>2]|0)-o|0,l>>2>>>0<536870911?(l=l>>1,l=l>>>0>>0?c:l,o=(e[D>>2]|0)-o>>2,l?w=6:(h=0,d=0)):(l=1073741823,o=(e[D>>2]|0)-o>>2,w=6),(w|0)==6&&(h=l,d=Xe(l<<2)|0),c=d+(o<<2)|0,l=c,C=d+(h<<2)|0,w=e[r>>2]|0,e[r>>2]=0,e[c>>2]=w,w=d+(o+1<<2)|0,d=e[t>>2]|0,o=e[D>>2]|0,(o|0)==(d|0))c=t,h=D;else{do o=o+-4|0,r=e[o>>2]|0,e[o>>2]=0,e[c+-4>>2]=r,c=l+-4|0,l=c;while((o|0)!=(d|0));o=l,c=t,h=D,l=o,d=e[t>>2]|0,o=e[D>>2]|0}if(e[c>>2]=l,e[h>>2]=w,e[k>>2]=C,c=d,(o|0)!=(c|0))do o=o+-4|0,l=e[o>>2]|0,e[o>>2]=0,l&&Mt[e[(e[l>>2]|0)+4>>2]&255](l);while((o|0)!=(c|0));d&&he(d)}function Aa(){return S[8]|0||!(kt(8)|0)||(Ft(72,35648,H|0)|0,bt(8)),35648}function un(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0;k=b,b=b+32|0,C=k,m0(C,(1<>2]|0,D=h+1|0,o=D<<1,e[t>>2]=0,d=t+4|0,e[d>>2]=0,e[t+8>>2]=0;e:do if(D){if((h|0)<-1&&(g=0,ue(178,t|0),w=g,g=0,w&1)||(l=4),(l|0)==4&&(g=0,c=ge(67,o|0)|0,w=g,g=0,!(w&1))){for(e[d>>2]=c,e[t>>2]=c,e[t+8>>2]=c+o,r=c;;)if(S[r>>0]=0,r=(e[d>>2]|0)+1|0,e[d>>2]=r,o=o+-1|0,!o)break e}o=j()|0,r=e[t>>2]|0,r||le(o|0),(e[d>>2]|0)!=(r|0)&&(e[d>>2]=r),he(r),le(o|0)}while(!1);if(r=~h,(h|0)<(r|0)){b=k;return}d=C+12|0,w=C+8|0,h=C+4|0,c=r;do r=e[d>>2]|0,(c|0)>(0-r|0)?(o=e[w>>2]|0,(c|0)>(0-o|0)?(l=e[h>>2]|0,(c|0)>(0-l|0)?(c|0)>=0?(c|0)>0?(l|0)<=(c|0)?(o|0)>(c|0)?r=2:r=(r|0)>(c|0)?3:4:r=1:r=0:r=-1:r=-2):r=-3):r=-4,S[(e[t>>2]|0)+(c+D)>>0]=r,c=c+1|0;while((c|0)<(D|0));b=k}function va(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0;switch(R=e[o+16>>2]|0,R|0){case 64:case 0:{g=0,t=be(34,t|0,r|0)|0,r=g,g=0,r&1?_=16:l=t;break}default:{for(c=(1<>2])+-1|0,N=e[r+20>>2]|0,k=N<<1,k=((k+c|0)/(k|1|0)|0)+1|0,t=0;(1<>2]|0,g=0,l=ge(67,4624)|0,D=g,g=0,D&1)_=16;else{h=((d|0)<8?8:d)+d<<1,w=l+4|0,C=r,D=w+84|0;do e[w>>2]=e[C>>2],w=w+4|0,C=C+4|0;while((w|0)<(D|0));w=l+88|0,D=w+40|0;do e[w>>2]=0,w=w+4|0;while((w|0)<(D|0));e[l>>2]=35660,e[l+128>>2]=c,e[l+132>>2]=k,e[l+136>>2]=N,e[l+140>>2]=t,e[l+144>>2]=d,e[l+148>>2]=h,e[l+152>>2]=R,t=l+156|0,e[t>>2]=0,e[t+4>>2]=0,e[t+8>>2]=0,e[t+12>>2]=0,e[l+172>>2]=e[r>>2],e[l+176>>2]=0,e[l+180>>2]=0,e[l+184>>2]=0,t=l+4568|0,c=l+188|0;do e[c>>2]=0,e[c+4>>2]=0,I[c+8>>1]=0,I[c+10>>1]=1,c=c+12|0;while((c|0)!=(t|0));e[t>>2]=0,e[t+4>>2]=0,I[t+8>>1]=0,S[t+10>>0]=0,r=l+4580|0,e[r>>2]=0,e[r+4>>2]=0,I[r+8>>1]=0,S[r+10>>0]=0,r=l+4592|0,e[r>>2]=0,e[r+4>>2]=0,e[r+8>>2]=0,e[r+12>>2]=0,e[r+16>>2]=0,e[r+20>>2]=0,e[r+24>>2]=0,S[r+28>>0]=0,e[l+28>>2]|0||(e[l+20>>2]=1)}}}return(_|0)==16&&(_=j()|0,le(_|0)),!l||(g=0,Ae(e[(e[l>>2]|0)+12>>2]|0,l|0,o|0),_=g,g=0,!(_&1))?l|0:(t=j()|0,l||(_=t,le(_|0)),Mt[e[(e[l>>2]|0)+4>>2]&255](l),_=t,le(_|0),0)}function xa(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0;if(o=(e[r+24>>2]|0)==2,o&&(e[r+16>>2]|0)!=3)return r=0,r|0;k=e[r+20>>2]|0,t=e[r+8>>2]|0;e:do if(!k){if(o){if((t|0)!=8)break;l=Xe(4600)|0,d=l+4|0,w=r,C=d+84|0;do e[d>>2]=e[w>>2],d=d+4|0,w=w+4|0;while((d|0)<(C|0));d=l+88|0,C=d+40|0;do e[d>>2]=0,d=d+4|0;while((d|0)<(C|0));e[l>>2]=35688,t=l+132|0,e[t>>2]=0,e[t+4>>2]=0,e[t+8>>2]=0,e[t+12>>2]=0,e[l+148>>2]=e[r>>2],e[l+152>>2]=0,e[l+156>>2]=0,e[l+160>>2]=0,t=l+4544|0,o=l+164|0;do e[o>>2]=0,e[o+4>>2]=0,I[o+8>>1]=0,I[o+10>>1]=1,o=o+12|0;while((o|0)!=(t|0));return e[t>>2]=0,e[t+4>>2]=0,I[t+8>>1]=0,S[t+10>>0]=0,r=l+4556|0,e[r>>2]=0,e[r+4>>2]=0,I[r+8>>1]=0,S[r+10>>0]=0,r=l+4568|0,e[r>>2]=0,e[r+4>>2]=0,e[r+8>>2]=0,e[r+12>>2]=0,e[r+16>>2]=0,e[r+20>>2]=0,e[r+24>>2]=0,S[r+28>>0]=0,e[l+28>>2]|0||(e[l+20>>2]=1),r=l,r|0}switch(t|0){case 8:{l=Xe(4600)|0,d=l+4|0,w=r,C=d+84|0;do e[d>>2]=e[w>>2],d=d+4|0,w=w+4|0;while((d|0)<(C|0));d=l+88|0,C=d+40|0;do e[d>>2]=0,d=d+4|0;while((d|0)<(C|0));e[l>>2]=35716,t=l+132|0,e[t>>2]=0,e[t+4>>2]=0,e[t+8>>2]=0,e[t+12>>2]=0,e[l+148>>2]=e[r>>2],e[l+152>>2]=0,e[l+156>>2]=0,e[l+160>>2]=0,t=l+4544|0,o=l+164|0;do e[o>>2]=0,e[o+4>>2]=0,I[o+8>>1]=0,I[o+10>>1]=1,o=o+12|0;while((o|0)!=(t|0));return e[t>>2]=0,e[t+4>>2]=0,I[t+8>>1]=0,S[t+10>>0]=0,r=l+4556|0,e[r>>2]=0,e[r+4>>2]=0,I[r+8>>1]=0,S[r+10>>0]=0,r=l+4568|0,e[r>>2]=0,e[r+4>>2]=0,e[r+8>>2]=0,e[r+12>>2]=0,e[r+16>>2]=0,e[r+20>>2]=0,e[r+24>>2]=0,S[r+28>>0]=0,e[l+28>>2]|0||(e[l+20>>2]=1),r=l,r|0}case 12:{l=Xe(4600)|0,d=l+4|0,w=r,C=d+84|0;do e[d>>2]=e[w>>2],d=d+4|0,w=w+4|0;while((d|0)<(C|0));d=l+88|0,C=d+40|0;do e[d>>2]=0,d=d+4|0;while((d|0)<(C|0));e[l>>2]=35744,t=l+132|0,e[t>>2]=0,e[t+4>>2]=0,e[t+8>>2]=0,e[t+12>>2]=0,e[l+148>>2]=e[r>>2],e[l+152>>2]=0,e[l+156>>2]=0,e[l+160>>2]=0,t=l+4544|0,o=l+164|0;do e[o>>2]=0,e[o+4>>2]=0,I[o+8>>1]=0,I[o+10>>1]=1,o=o+12|0;while((o|0)!=(t|0));return e[t>>2]=0,e[t+4>>2]=0,I[t+8>>1]=0,S[t+10>>0]=0,r=l+4556|0,e[r>>2]=0,e[r+4>>2]=0,I[r+8>>1]=0,S[r+10>>0]=0,r=l+4568|0,e[r>>2]=0,e[r+4>>2]=0,e[r+8>>2]=0,e[r+12>>2]=0,e[r+16>>2]=0,e[r+20>>2]=0,e[r+24>>2]=0,S[r+28>>0]=0,e[l+28>>2]|0||(e[l+20>>2]=1),r=l,r|0}case 16:{l=Xe(4600)|0,d=l+4|0,w=r,C=d+84|0;do e[d>>2]=e[w>>2],d=d+4|0,w=w+4|0;while((d|0)<(C|0));d=l+88|0,C=d+40|0;do e[d>>2]=0,d=d+4|0;while((d|0)<(C|0));e[l>>2]=35772,t=l+132|0,e[t>>2]=0,e[t+4>>2]=0,e[t+8>>2]=0,e[t+12>>2]=0,e[l+148>>2]=e[r>>2],e[l+152>>2]=0,e[l+156>>2]=0,e[l+160>>2]=0,t=l+4544|0,o=l+164|0;do e[o>>2]=0,e[o+4>>2]=0,I[o+8>>1]=0,I[o+10>>1]=1,o=o+12|0;while((o|0)!=(t|0));return e[t>>2]=0,e[t+4>>2]=0,I[t+8>>1]=0,S[t+10>>0]=0,r=l+4556|0,e[r>>2]=0,e[r+4>>2]=0,I[r+8>>1]=0,S[r+10>>0]=0,r=l+4568|0,e[r>>2]=0,e[r+4>>2]=0,e[r+8>>2]=0,e[r+12>>2]=0,e[r+16>>2]=0,e[r+20>>2]=0,e[r+24>>2]=0,S[r+28>>0]=0,e[l+28>>2]|0||(e[l+20>>2]=1),r=l,r|0}default:break e}}while(!1);if(D=(1<>2]=e[w>>2],d=d+4|0,w=w+4|0;while((d|0)<(C|0));d=c+88|0,C=d+40|0;do e[d>>2]=0,d=d+4|0;while((d|0)<(C|0));e[c>>2]=35800,e[c+128>>2]=D,e[c+132>>2]=h,e[c+136>>2]=k,e[c+140>>2]=t,e[c+144>>2]=o,e[c+148>>2]=l,e[c+152>>2]=64,t=c+156|0,e[t>>2]=0,e[t+4>>2]=0,e[t+8>>2]=0,e[t+12>>2]=0,e[c+172>>2]=e[r>>2],e[c+176>>2]=0,e[c+180>>2]=0,e[c+184>>2]=0,t=c+4568|0,o=c+188|0;do e[o>>2]=0,e[o+4>>2]=0,I[o+8>>1]=0,I[o+10>>1]=1,o=o+12|0;while((o|0)!=(t|0));return e[t>>2]=0,e[t+4>>2]=0,I[t+8>>1]=0,S[t+10>>0]=0,r=c+4580|0,e[r>>2]=0,e[r+4>>2]=0,I[r+8>>1]=0,S[r+10>>0]=0,r=c+4592|0,e[r>>2]=0,e[r+4>>2]=0,e[r+8>>2]=0,e[r+12>>2]=0,e[r+16>>2]=0,e[r+20>>2]=0,e[r+24>>2]=0,S[r+28>>0]=0,e[c+28>>2]|0||(e[c+20>>2]=1),r=c,r|0}else{for(t=0;(1<>2]=e[w>>2],d=d+4|0,w=w+4|0;while((d|0)<(C|0));d=c+88|0,C=d+40|0;do e[d>>2]=0,d=d+4|0;while((d|0)<(C|0));e[c>>2]=35660,e[c+128>>2]=D,e[c+132>>2]=h,e[c+136>>2]=k,e[c+140>>2]=t,e[c+144>>2]=o,e[c+148>>2]=l,e[c+152>>2]=64,t=c+156|0,e[t>>2]=0,e[t+4>>2]=0,e[t+8>>2]=0,e[t+12>>2]=0,e[c+172>>2]=e[r>>2],e[c+176>>2]=0,e[c+180>>2]=0,e[c+184>>2]=0,t=c+4568|0,o=c+188|0;do e[o>>2]=0,e[o+4>>2]=0,I[o+8>>1]=0,I[o+10>>1]=1,o=o+12|0;while((o|0)!=(t|0));return e[t>>2]=0,e[t+4>>2]=0,I[t+8>>1]=0,S[t+10>>0]=0,r=c+4580|0,e[r>>2]=0,e[r+4>>2]=0,I[r+8>>1]=0,S[r+10>>0]=0,r=c+4592|0,e[r>>2]=0,e[r+4>>2]=0,e[r+8>>2]=0,e[r+12>>2]=0,e[r+16>>2]=0,e[r+20>>2]=0,e[r+24>>2]=0,S[r+28>>0]=0,e[c+28>>2]|0||(e[c+20>>2]=1),r=c,r|0}if((t|0)>=17)return r=0,r|0;if(h=k<<1,h=((h+D|0)/(h|1|0)|0)+1|0,o){for(t=0;(1<>2]=e[w>>2],d=d+4|0,w=w+4|0;while((d|0)<(C|0));d=c+88|0,C=d+40|0;do e[d>>2]=0,d=d+4|0;while((d|0)<(C|0));e[c>>2]=35828,e[c+128>>2]=D,e[c+132>>2]=h,e[c+136>>2]=k,e[c+140>>2]=t,e[c+144>>2]=o,e[c+148>>2]=l,e[c+152>>2]=64,t=c+156|0,e[t>>2]=0,e[t+4>>2]=0,e[t+8>>2]=0,e[t+12>>2]=0,e[c+172>>2]=e[r>>2],e[c+176>>2]=0,e[c+180>>2]=0,e[c+184>>2]=0,t=c+4568|0,o=c+188|0;do e[o>>2]=0,e[o+4>>2]=0,I[o+8>>1]=0,I[o+10>>1]=1,o=o+12|0;while((o|0)!=(t|0));return e[t>>2]=0,e[t+4>>2]=0,I[t+8>>1]=0,S[t+10>>0]=0,r=c+4580|0,e[r>>2]=0,e[r+4>>2]=0,I[r+8>>1]=0,S[r+10>>0]=0,r=c+4592|0,e[r>>2]=0,e[r+4>>2]=0,e[r+8>>2]=0,e[r+12>>2]=0,e[r+16>>2]=0,e[r+20>>2]=0,e[r+24>>2]=0,S[r+28>>0]=0,e[c+28>>2]|0||(e[c+20>>2]=1),r=c,r|0}else{for(t=0;(1<>2]=e[w>>2],d=d+4|0,w=w+4|0;while((d|0)<(C|0));d=c+88|0,C=d+40|0;do e[d>>2]=0,d=d+4|0;while((d|0)<(C|0));e[c>>2]=35856,e[c+128>>2]=D,e[c+132>>2]=h,e[c+136>>2]=k,e[c+140>>2]=t,e[c+144>>2]=o,e[c+148>>2]=l,e[c+152>>2]=64,t=c+156|0,e[t>>2]=0,e[t+4>>2]=0,e[t+8>>2]=0,e[t+12>>2]=0,e[c+172>>2]=e[r>>2],e[c+176>>2]=0,e[c+180>>2]=0,e[c+184>>2]=0,t=c+4568|0,o=c+188|0;do e[o>>2]=0,e[o+4>>2]=0,I[o+8>>1]=0,I[o+10>>1]=1,o=o+12|0;while((o|0)!=(t|0));return e[t>>2]=0,e[t+4>>2]=0,I[t+8>>1]=0,S[t+10>>0]=0,r=c+4580|0,e[r>>2]=0,e[r+4>>2]=0,I[r+8>>1]=0,S[r+10>>0]=0,r=c+4592|0,e[r>>2]=0,e[r+4>>2]=0,e[r+8>>2]=0,e[r+12>>2]=0,e[r+16>>2]=0,e[r+20>>2]=0,e[r+24>>2]=0,S[r+28>>0]=0,e[c+28>>2]|0||(e[c+20>>2]=1),r=c,r|0}return 0}function wa(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0;switch(R=e[o+16>>2]|0,R|0){case 64:case 0:{g=0,t=be(35,t|0,r|0)|0,r=g,g=0,r&1?_=16:l=t;break}default:{for(c=(1<>2])+-1|0,N=e[r+20>>2]|0,k=N<<1,k=((k+c|0)/(k|1|0)|0)+1|0,t=0;(1<>2]|0,g=0,l=ge(67,4632)|0,D=g,g=0,D&1)_=16;else{h=((d|0)<8?8:d)+d<<1,e[l+4>>2]=0,w=l+8|0,C=r,D=w+84|0;do e[w>>2]=e[C>>2],w=w+4|0,C=C+4|0;while((w|0)<(D|0));e[l+92>>2]=0,e[l+96>>2]=0,e[l+100>>2]=32,e[l+104>>2]=0,e[l+108>>2]=0,S[l+112>>0]=0,D=l+116|0,e[D>>2]=0,e[D+4>>2]=0,e[D+8>>2]=0,e[D+12>>2]=0,e[D+16>>2]=0,e[l>>2]=35884,e[l+136>>2]=c,e[l+140>>2]=k,e[l+144>>2]=N,e[l+148>>2]=t,e[l+152>>2]=d,e[l+156>>2]=h,e[l+160>>2]=R,t=l+164|0,e[t>>2]=0,e[t+4>>2]=0,e[t+8>>2]=0,e[t+12>>2]=0,e[l+180>>2]=e[r>>2],e[l+184>>2]=0,e[l+188>>2]=0,e[l+192>>2]=0,t=l+4576|0,c=l+196|0;do e[c>>2]=0,e[c+4>>2]=0,I[c+8>>1]=0,I[c+10>>1]=1,c=c+12|0;while((c|0)!=(t|0));e[t>>2]=0,e[t+4>>2]=0,I[t+8>>1]=0,S[t+10>>0]=0,r=l+4588|0,e[r>>2]=0,e[r+4>>2]=0,I[r+8>>1]=0,S[r+10>>0]=0,r=l+4600|0,e[r>>2]=0,e[r+4>>2]=0,e[r+8>>2]=0,e[r+12>>2]=0,e[r+16>>2]=0,e[r+20>>2]=0,e[r+24>>2]=0,S[r+28>>0]=0,e[l+32>>2]|0||(e[l+24>>2]=1)}}}return(_|0)==16&&(_=j()|0,le(_|0)),!l||(g=0,Ae(e[(e[l>>2]|0)+8>>2]|0,l|0,o|0),_=g,g=0,!(_&1))?l|0:(t=j()|0,l||(_=t,le(_|0)),Mt[e[(e[l>>2]|0)+4>>2]&255](l),_=t,le(_|0),0)}function ya(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0;if(o=(e[r+24>>2]|0)==2,o&&(e[r+16>>2]|0)!=3)return r=0,r|0;k=e[r+20>>2]|0,t=e[r+8>>2]|0;e:do if(!k){if(o){if((t|0)!=8)break;l=Xe(4608)|0,e[l+4>>2]=0,d=l+8|0,w=r,C=d+84|0;do e[d>>2]=e[w>>2],d=d+4|0,w=w+4|0;while((d|0)<(C|0));e[l+92>>2]=0,e[l+96>>2]=0,e[l+100>>2]=32,e[l+104>>2]=0,e[l+108>>2]=0,S[l+112>>0]=0,t=l+116|0,e[t>>2]=0,e[t+4>>2]=0,e[t+8>>2]=0,e[t+12>>2]=0,e[t+16>>2]=0,e[l>>2]=35912,t=l+140|0,e[t>>2]=0,e[t+4>>2]=0,e[t+8>>2]=0,e[t+12>>2]=0,e[l+156>>2]=e[r>>2],e[l+160>>2]=0,e[l+164>>2]=0,e[l+168>>2]=0,t=l+4552|0,o=l+172|0;do e[o>>2]=0,e[o+4>>2]=0,I[o+8>>1]=0,I[o+10>>1]=1,o=o+12|0;while((o|0)!=(t|0));return e[t>>2]=0,e[t+4>>2]=0,I[t+8>>1]=0,S[t+10>>0]=0,r=l+4564|0,e[r>>2]=0,e[r+4>>2]=0,I[r+8>>1]=0,S[r+10>>0]=0,r=l+4576|0,e[r>>2]=0,e[r+4>>2]=0,e[r+8>>2]=0,e[r+12>>2]=0,e[r+16>>2]=0,e[r+20>>2]=0,e[r+24>>2]=0,S[r+28>>0]=0,e[l+32>>2]|0||(e[l+24>>2]=1),r=l,r|0}switch(t|0){case 8:{l=Xe(4608)|0,e[l+4>>2]=0,d=l+8|0,w=r,C=d+84|0;do e[d>>2]=e[w>>2],d=d+4|0,w=w+4|0;while((d|0)<(C|0));e[l+92>>2]=0,e[l+96>>2]=0,e[l+100>>2]=32,e[l+104>>2]=0,e[l+108>>2]=0,S[l+112>>0]=0,t=l+116|0,e[t>>2]=0,e[t+4>>2]=0,e[t+8>>2]=0,e[t+12>>2]=0,e[t+16>>2]=0,e[l>>2]=35940,t=l+140|0,e[t>>2]=0,e[t+4>>2]=0,e[t+8>>2]=0,e[t+12>>2]=0,e[l+156>>2]=e[r>>2],e[l+160>>2]=0,e[l+164>>2]=0,e[l+168>>2]=0,t=l+4552|0,o=l+172|0;do e[o>>2]=0,e[o+4>>2]=0,I[o+8>>1]=0,I[o+10>>1]=1,o=o+12|0;while((o|0)!=(t|0));return e[t>>2]=0,e[t+4>>2]=0,I[t+8>>1]=0,S[t+10>>0]=0,r=l+4564|0,e[r>>2]=0,e[r+4>>2]=0,I[r+8>>1]=0,S[r+10>>0]=0,r=l+4576|0,e[r>>2]=0,e[r+4>>2]=0,e[r+8>>2]=0,e[r+12>>2]=0,e[r+16>>2]=0,e[r+20>>2]=0,e[r+24>>2]=0,S[r+28>>0]=0,e[l+32>>2]|0||(e[l+24>>2]=1),r=l,r|0}case 12:{l=Xe(4608)|0,e[l+4>>2]=0,d=l+8|0,w=r,C=d+84|0;do e[d>>2]=e[w>>2],d=d+4|0,w=w+4|0;while((d|0)<(C|0));e[l+92>>2]=0,e[l+96>>2]=0,e[l+100>>2]=32,e[l+104>>2]=0,e[l+108>>2]=0,S[l+112>>0]=0,t=l+116|0,e[t>>2]=0,e[t+4>>2]=0,e[t+8>>2]=0,e[t+12>>2]=0,e[t+16>>2]=0,e[l>>2]=35968,t=l+140|0,e[t>>2]=0,e[t+4>>2]=0,e[t+8>>2]=0,e[t+12>>2]=0,e[l+156>>2]=e[r>>2],e[l+160>>2]=0,e[l+164>>2]=0,e[l+168>>2]=0,t=l+4552|0,o=l+172|0;do e[o>>2]=0,e[o+4>>2]=0,I[o+8>>1]=0,I[o+10>>1]=1,o=o+12|0;while((o|0)!=(t|0));return e[t>>2]=0,e[t+4>>2]=0,I[t+8>>1]=0,S[t+10>>0]=0,r=l+4564|0,e[r>>2]=0,e[r+4>>2]=0,I[r+8>>1]=0,S[r+10>>0]=0,r=l+4576|0,e[r>>2]=0,e[r+4>>2]=0,e[r+8>>2]=0,e[r+12>>2]=0,e[r+16>>2]=0,e[r+20>>2]=0,e[r+24>>2]=0,S[r+28>>0]=0,e[l+32>>2]|0||(e[l+24>>2]=1),r=l,r|0}case 16:{l=Xe(4608)|0,e[l+4>>2]=0,d=l+8|0,w=r,C=d+84|0;do e[d>>2]=e[w>>2],d=d+4|0,w=w+4|0;while((d|0)<(C|0));e[l+92>>2]=0,e[l+96>>2]=0,e[l+100>>2]=32,e[l+104>>2]=0,e[l+108>>2]=0,S[l+112>>0]=0,t=l+116|0,e[t>>2]=0,e[t+4>>2]=0,e[t+8>>2]=0,e[t+12>>2]=0,e[t+16>>2]=0,e[l>>2]=35996,t=l+140|0,e[t>>2]=0,e[t+4>>2]=0,e[t+8>>2]=0,e[t+12>>2]=0,e[l+156>>2]=e[r>>2],e[l+160>>2]=0,e[l+164>>2]=0,e[l+168>>2]=0,t=l+4552|0,o=l+172|0;do e[o>>2]=0,e[o+4>>2]=0,I[o+8>>1]=0,I[o+10>>1]=1,o=o+12|0;while((o|0)!=(t|0));return e[t>>2]=0,e[t+4>>2]=0,I[t+8>>1]=0,S[t+10>>0]=0,r=l+4564|0,e[r>>2]=0,e[r+4>>2]=0,I[r+8>>1]=0,S[r+10>>0]=0,r=l+4576|0,e[r>>2]=0,e[r+4>>2]=0,e[r+8>>2]=0,e[r+12>>2]=0,e[r+16>>2]=0,e[r+20>>2]=0,e[r+24>>2]=0,S[r+28>>0]=0,e[l+32>>2]|0||(e[l+24>>2]=1),r=l,r|0}default:break e}}while(!1);if(D=(1<>2]=0,d=c+8|0,w=r,C=d+84|0;do e[d>>2]=e[w>>2],d=d+4|0,w=w+4|0;while((d|0)<(C|0));e[c+92>>2]=0,e[c+96>>2]=0,e[c+100>>2]=32,e[c+104>>2]=0,e[c+108>>2]=0,S[c+112>>0]=0,C=c+116|0,e[C>>2]=0,e[C+4>>2]=0,e[C+8>>2]=0,e[C+12>>2]=0,e[C+16>>2]=0,e[c>>2]=36024,e[c+136>>2]=D,e[c+140>>2]=h,e[c+144>>2]=k,e[c+148>>2]=t,e[c+152>>2]=o,e[c+156>>2]=l,e[c+160>>2]=64,t=c+164|0,e[t>>2]=0,e[t+4>>2]=0,e[t+8>>2]=0,e[t+12>>2]=0,e[c+180>>2]=e[r>>2],e[c+184>>2]=0,e[c+188>>2]=0,e[c+192>>2]=0,t=c+4576|0,o=c+196|0;do e[o>>2]=0,e[o+4>>2]=0,I[o+8>>1]=0,I[o+10>>1]=1,o=o+12|0;while((o|0)!=(t|0));return e[t>>2]=0,e[t+4>>2]=0,I[t+8>>1]=0,S[t+10>>0]=0,r=c+4588|0,e[r>>2]=0,e[r+4>>2]=0,I[r+8>>1]=0,S[r+10>>0]=0,r=c+4600|0,e[r>>2]=0,e[r+4>>2]=0,e[r+8>>2]=0,e[r+12>>2]=0,e[r+16>>2]=0,e[r+20>>2]=0,e[r+24>>2]=0,S[r+28>>0]=0,e[c+32>>2]|0||(e[c+24>>2]=1),r=c,r|0}else{for(t=0;(1<>2]=0,d=c+8|0,w=r,C=d+84|0;do e[d>>2]=e[w>>2],d=d+4|0,w=w+4|0;while((d|0)<(C|0));e[c+92>>2]=0,e[c+96>>2]=0,e[c+100>>2]=32,e[c+104>>2]=0,e[c+108>>2]=0,S[c+112>>0]=0,C=c+116|0,e[C>>2]=0,e[C+4>>2]=0,e[C+8>>2]=0,e[C+12>>2]=0,e[C+16>>2]=0,e[c>>2]=35884,e[c+136>>2]=D,e[c+140>>2]=h,e[c+144>>2]=k,e[c+148>>2]=t,e[c+152>>2]=o,e[c+156>>2]=l,e[c+160>>2]=64,t=c+164|0,e[t>>2]=0,e[t+4>>2]=0,e[t+8>>2]=0,e[t+12>>2]=0,e[c+180>>2]=e[r>>2],e[c+184>>2]=0,e[c+188>>2]=0,e[c+192>>2]=0,t=c+4576|0,o=c+196|0;do e[o>>2]=0,e[o+4>>2]=0,I[o+8>>1]=0,I[o+10>>1]=1,o=o+12|0;while((o|0)!=(t|0));return e[t>>2]=0,e[t+4>>2]=0,I[t+8>>1]=0,S[t+10>>0]=0,r=c+4588|0,e[r>>2]=0,e[r+4>>2]=0,I[r+8>>1]=0,S[r+10>>0]=0,r=c+4600|0,e[r>>2]=0,e[r+4>>2]=0,e[r+8>>2]=0,e[r+12>>2]=0,e[r+16>>2]=0,e[r+20>>2]=0,e[r+24>>2]=0,S[r+28>>0]=0,e[c+32>>2]|0||(e[c+24>>2]=1),r=c,r|0}if((t|0)>=17)return r=0,r|0;if(h=k<<1,h=((h+D|0)/(h|1|0)|0)+1|0,o){for(t=0;(1<>2]=0,d=c+8|0,w=r,C=d+84|0;do e[d>>2]=e[w>>2],d=d+4|0,w=w+4|0;while((d|0)<(C|0));e[c+92>>2]=0,e[c+96>>2]=0,e[c+100>>2]=32,e[c+104>>2]=0,e[c+108>>2]=0,S[c+112>>0]=0,C=c+116|0,e[C>>2]=0,e[C+4>>2]=0,e[C+8>>2]=0,e[C+12>>2]=0,e[C+16>>2]=0,e[c>>2]=36052,e[c+136>>2]=D,e[c+140>>2]=h,e[c+144>>2]=k,e[c+148>>2]=t,e[c+152>>2]=o,e[c+156>>2]=l,e[c+160>>2]=64,t=c+164|0,e[t>>2]=0,e[t+4>>2]=0,e[t+8>>2]=0,e[t+12>>2]=0,e[c+180>>2]=e[r>>2],e[c+184>>2]=0,e[c+188>>2]=0,e[c+192>>2]=0,t=c+4576|0,o=c+196|0;do e[o>>2]=0,e[o+4>>2]=0,I[o+8>>1]=0,I[o+10>>1]=1,o=o+12|0;while((o|0)!=(t|0));return e[t>>2]=0,e[t+4>>2]=0,I[t+8>>1]=0,S[t+10>>0]=0,r=c+4588|0,e[r>>2]=0,e[r+4>>2]=0,I[r+8>>1]=0,S[r+10>>0]=0,r=c+4600|0,e[r>>2]=0,e[r+4>>2]=0,e[r+8>>2]=0,e[r+12>>2]=0,e[r+16>>2]=0,e[r+20>>2]=0,e[r+24>>2]=0,S[r+28>>0]=0,e[c+32>>2]|0||(e[c+24>>2]=1),r=c,r|0}else{for(t=0;(1<>2]=0,d=c+8|0,w=r,C=d+84|0;do e[d>>2]=e[w>>2],d=d+4|0,w=w+4|0;while((d|0)<(C|0));e[c+92>>2]=0,e[c+96>>2]=0,e[c+100>>2]=32,e[c+104>>2]=0,e[c+108>>2]=0,S[c+112>>0]=0,C=c+116|0,e[C>>2]=0,e[C+4>>2]=0,e[C+8>>2]=0,e[C+12>>2]=0,e[C+16>>2]=0,e[c>>2]=36080,e[c+136>>2]=D,e[c+140>>2]=h,e[c+144>>2]=k,e[c+148>>2]=t,e[c+152>>2]=o,e[c+156>>2]=l,e[c+160>>2]=64,t=c+164|0,e[t>>2]=0,e[t+4>>2]=0,e[t+8>>2]=0,e[t+12>>2]=0,e[c+180>>2]=e[r>>2],e[c+184>>2]=0,e[c+188>>2]=0,e[c+192>>2]=0,t=c+4576|0,o=c+196|0;do e[o>>2]=0,e[o+4>>2]=0,I[o+8>>1]=0,I[o+10>>1]=1,o=o+12|0;while((o|0)!=(t|0));return e[t>>2]=0,e[t+4>>2]=0,I[t+8>>1]=0,S[t+10>>0]=0,r=c+4588|0,e[r>>2]=0,e[r+4>>2]=0,I[r+8>>1]=0,S[r+10>>0]=0,r=c+4600|0,e[r>>2]=0,e[r+4>>2]=0,e[r+8>>2]=0,e[r+12>>2]=0,e[r+16>>2]=0,e[r+20>>2]=0,e[r+24>>2]=0,S[r+28>>0]=0,e[c+32>>2]|0||(e[c+24>>2]=1),r=c,r|0}return 0}function Ca(){var t=0,r=0,o=0,l=0,c=0,h=0,d=0;t=2832;do e[t>>2]=0,e[t+4>>2]=0,t=t+8|0;while((t|0)!=4880);Jt(2832,0,2048)|0,t=0;do d=2832+(t+128<<3)|0,e[d>>2]=0,e[d+4>>2]=1,t=t+1|0;while((t|0)!=128);t=3088,e[t>>2]=1,e[t+4>>2]=3,t=3096,e[t>>2]=1,e[t+4>>2]=3,t=3104,e[t>>2]=1,e[t+4>>2]=3,t=3112,e[t>>2]=1,e[t+4>>2]=3,t=3120,e[t>>2]=1,e[t+4>>2]=3,t=3128,e[t>>2]=1,e[t+4>>2]=3,t=3136,e[t>>2]=1,e[t+4>>2]=3,t=3144,e[t>>2]=1,e[t+4>>2]=3,t=3152,e[t>>2]=1,e[t+4>>2]=3,t=3160,e[t>>2]=1,e[t+4>>2]=3,t=3168,e[t>>2]=1,e[t+4>>2]=3,t=3176,e[t>>2]=1,e[t+4>>2]=3,t=3184,e[t>>2]=1,e[t+4>>2]=3,t=3192,e[t>>2]=1,e[t+4>>2]=3,t=3200,e[t>>2]=1,e[t+4>>2]=3,t=3208,e[t>>2]=1,e[t+4>>2]=3,t=3216,e[t>>2]=1,e[t+4>>2]=3,t=3224,e[t>>2]=1,e[t+4>>2]=3,t=3232,e[t>>2]=1,e[t+4>>2]=3,t=3240,e[t>>2]=1,e[t+4>>2]=3,t=3248,e[t>>2]=1,e[t+4>>2]=3,t=3256,e[t>>2]=1,e[t+4>>2]=3,t=3264,e[t>>2]=1,e[t+4>>2]=3,t=3272,e[t>>2]=1,e[t+4>>2]=3,t=3280,e[t>>2]=1,e[t+4>>2]=3,t=3288,e[t>>2]=1,e[t+4>>2]=3,t=3296,e[t>>2]=1,e[t+4>>2]=3,t=3304,e[t>>2]=1,e[t+4>>2]=3,t=3312,e[t>>2]=1,e[t+4>>2]=3,t=3320,e[t>>2]=1,e[t+4>>2]=3,t=3328,e[t>>2]=1,e[t+4>>2]=3,t=3336,e[t>>2]=1,e[t+4>>2]=3,t=2896,e[t>>2]=2,e[t+4>>2]=5,t=2904,e[t>>2]=2,e[t+4>>2]=5,t=2912,e[t>>2]=2,e[t+4>>2]=5,t=2920,e[t>>2]=2,e[t+4>>2]=5,t=2928,e[t>>2]=2,e[t+4>>2]=5,t=2936,e[t>>2]=2,e[t+4>>2]=5,t=2944,e[t>>2]=2,e[t+4>>2]=5,t=2952,e[t>>2]=2,e[t+4>>2]=5,t=2848,e[t>>2]=3,e[t+4>>2]=7,t=2856,e[t>>2]=3,e[t+4>>2]=7,t=0;do d=2832+(t+64<<3)|0,e[d>>2]=-1,e[d+4>>2]=2,t=t+1|0;while((t|0)!=64);t=2960,e[t>>2]=-2,e[t+4>>2]=4,t=2968,e[t>>2]=-2,e[t+4>>2]=4,t=2976,e[t>>2]=-2,e[t+4>>2]=4,t=2984,e[t>>2]=-2,e[t+4>>2]=4,t=2992,e[t>>2]=-2,e[t+4>>2]=4,t=3e3,e[t>>2]=-2,e[t+4>>2]=4,t=3008,e[t>>2]=-2,e[t+4>>2]=4,t=3016,e[t>>2]=-2,e[t+4>>2]=4,t=3024,e[t>>2]=-2,e[t+4>>2]=4,t=3032,e[t>>2]=-2,e[t+4>>2]=4,t=3040,e[t>>2]=-2,e[t+4>>2]=4,t=3048,e[t>>2]=-2,e[t+4>>2]=4,t=3056,e[t>>2]=-2,e[t+4>>2]=4,t=3064,e[t>>2]=-2,e[t+4>>2]=4,t=3072,e[t>>2]=-2,e[t+4>>2]=4,t=3080,e[t>>2]=-2,e[t+4>>2]=4,t=2864,e[t>>2]=-3,e[t+4>>2]=6,t=2872,e[t>>2]=-3,e[t+4>>2]=6,t=2880,e[t>>2]=-3,e[t+4>>2]=6,t=2888,e[t>>2]=-3,e[t+4>>2]=6,t=2840,e[t>>2]=-4,e[t+4>>2]=8,t=4880;do e[t>>2]=0,e[t+4>>2]=0,t=t+8|0;while((t|0)!=6928);for(Jt(4880,0,2048)|0,o=2,t=0,c=0,h=0;;){if(o=o<<16>>16,r=8-o|0,l=1<>2]=c,e[d+4>>2]=o,r=r+1|0;while((r|0)<(l|0))}if(r=(h<<16)+65536|0,t=r>>31^r>>15,h=h+1|0,(h|0)==7){r=2,c=1,h=-1,d=-1;break}else o=(t>>1)+2|0,c=r>>16}for(;;){if(o=r<<16>>16,t=8-o|0,l=1<>2]=h,e[c+4>>2]=o,r=r+1|0;while((r|0)<(l|0))}if(t=(d<<16)+-65536|0,c=t>>31^t>>15,r=(c>>1)+2|0,(r|0)>8){t=6928;break}else h=t>>16,d=d+-1|0}do e[t>>2]=0,e[t+4>>2]=0,t=t+8|0;while((t|0)!=8976);for(Jt(6928,0,2048)|0,c=3,t=0,l=0,h=0;;){if(r=8-c|0,o=1<>2]=l,e[d+4>>2]=c,r=r+1|0;while((r|0)<(o|0))}if(r=(h<<16)+65536|0,t=r>>31^r>>15,h=h+1|0,(h|0)==12){c=3,r=1,l=-1,h=-1;break}else c=(t>>2)+3|0,l=r>>16}for(;;){if(t=8-c|0,o=1<>2]=l,e[d+4>>2]=c,r=r+1|0;while((r|0)<(o|0))}if(t=(h<<16)+-65536|0,r=t>>31^t>>15,c=(r>>2)+3|0,(c|0)>8){t=8976;break}else l=t>>16,h=h+-1|0}do e[t>>2]=0,e[t+4>>2]=0,t=t+8|0;while((t|0)!=11024);for(Jt(8976,0,2048)|0,c=4,t=0,l=0,h=0;;){if(r=8-c|0,o=1<>2]=l,e[d+4>>2]=c,r=r+1|0;while((r|0)<(o|0))}if(r=(h<<16)+65536|0,t=r>>31^r>>15,h=h+1|0,(h|0)==20){c=4,r=1,l=-1,h=-1;break}else c=(t>>3)+4|0,l=r>>16}for(;;){if(t=8-c|0,o=1<>2]=l,e[d+4>>2]=c,r=r+1|0;while((r|0)<(o|0))}if(t=(h<<16)+-65536|0,r=t>>31^t>>15,c=(r>>3)+4|0,(c|0)>8){t=11024;break}else l=t>>16,h=h+-1|0}do e[t>>2]=0,e[t+4>>2]=0,t=t+8|0;while((t|0)!=13072);for(Jt(11024,0,2048)|0,c=5,t=0,l=0,h=0;;){if(r=8-c|0,o=1<>2]=l,e[d+4>>2]=c,r=r+1|0;while((r|0)<(o|0))}if(r=(h<<16)+65536|0,t=r>>31^r>>15,h=h+1|0,(h|0)==32){c=5,r=1,l=-1,h=-1;break}else c=(t>>4)+5|0,l=r>>16}for(;;){if(t=8-c|0,o=1<>2]=l,e[d+4>>2]=c,r=r+1|0;while((r|0)<(o|0))}if(t=(h<<16)+-65536|0,r=t>>31^t>>15,c=(r>>4)+5|0,(c|0)>8){t=13072;break}else l=t>>16,h=h+-1|0}do e[t>>2]=0,e[t+4>>2]=0,t=t+8|0;while((t|0)!=15120);for(Jt(13072,0,2048)|0,c=6,t=0,l=0,h=0;;){if(r=8-c|0,o=1<>2]=l,e[d+4>>2]=c,r=r+1|0;while((r|0)<(o|0))}if(r=(h<<16)+65536|0,t=r>>31^r>>15,h=h+1|0,(h|0)==48){c=6,r=1,l=-1,h=-1;break}else c=(t>>5)+6|0,l=r>>16}for(;;){if(t=8-c|0,o=1<>2]=l,e[d+4>>2]=c,r=r+1|0;while((r|0)<(o|0))}if(t=(h<<16)+-65536|0,r=t>>31^t>>15,c=(r>>5)+6|0,(c|0)>8){t=15120;break}else l=t>>16,h=h+-1|0}do e[t>>2]=0,e[t+4>>2]=0,t=t+8|0;while((t|0)!=17168);for(Jt(15120,0,2048)|0,c=7,t=0,l=0,h=0;;){if(r=8-c|0,o=1<>2]=l,e[d+4>>2]=c,r=r+1|0;while((r|0)<(o|0))}if(r=(h<<16)+65536|0,t=r>>31^r>>15,h=h+1|0,(h|0)==64){c=7,r=1,l=-1,h=-1;break}else c=(t>>6)+7|0,l=r>>16}for(;;){if(t=8-c|0,o=1<>2]=l,e[d+4>>2]=c,r=r+1|0;while((r|0)<(o|0))}if(t=(h<<16)+-65536|0,r=t>>31^t>>15,c=(r>>6)+7|0,(c|0)>8){t=17168;break}else l=t>>16,h=h+-1|0}do e[t>>2]=0,e[t+4>>2]=0,t=t+8|0;while((t|0)!=19216);for(Jt(17168,0,2048)|0,c=8,t=0,l=0,h=0;;){if(r=8-c|0,o=1<>2]=l,e[d+4>>2]=c,r=r+1|0;while((r|0)<(o|0))}if(r=(h<<16)+65536|0,t=r>>31^r>>15,h=h+1|0,(h|0)==64){h=8,l=1,c=-1,d=-1;break}else c=(t>>7)+8|0,l=r>>16}for(;;){if(t=8-h|0,o=1<>2]=c,e[l+4>>2]=h,r=r+1|0;while((r|0)<(o|0))}if(r=(d<<16)+-65536|0,l=r>>31^r>>15,t=l>>7,(t|0)>0){t=19216;break}else h=t+8|0,c=r>>16,d=d+-1|0}do e[t>>2]=0,e[t+4>>2]=0,t=t+8|0;while((t|0)!=21264);Jt(19216,0,2048)|0,t=21264;do e[t>>2]=0,e[t+4>>2]=0,t=t+8|0;while((t|0)!=23312);Jt(21264,0,2048)|0,t=23312;do e[t>>2]=0,e[t+4>>2]=0,t=t+8|0;while((t|0)!=25360);Jt(23312,0,2048)|0,t=25360;do e[t>>2]=0,e[t+4>>2]=0,t=t+8|0;while((t|0)!=27408);Jt(25360,0,2048)|0,t=27408;do e[t>>2]=0,e[t+4>>2]=0,t=t+8|0;while((t|0)!=29456);Jt(27408,0,2048)|0,t=29456;do e[t>>2]=0,e[t+4>>2]=0,t=t+8|0;while((t|0)!=31504);Jt(29456,0,2048)|0,t=31504;do e[t>>2]=0,e[t+4>>2]=0,t=t+8|0;while((t|0)!=33552);Jt(31504,0,2048)|0,t=33552;do e[t>>2]=0,e[t+4>>2]=0,t=t+8|0;while((t|0)!=35600);Jt(33552,0,2048)|0,un(35600,8),Ft(179,35600,H|0)|0,un(35612,10),Ft(179,35612,H|0)|0,un(35624,12),Ft(179,35624,H|0)|0,un(35636,16),Ft(179,35636,H|0)|0}function Ta(t){t=t|0;var r=0;r=e[t>>2]|0,r&&(t=t+4|0,(e[t>>2]|0)!=(r|0)&&(e[t>>2]=r),he(r))}function Ia(t){t=t|0;var r=0,o=0;e[t>>2]=36080,r=e[t+4616>>2]|0,r&&(o=t+4620|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),e[t>>2]=36612,r=e[t+120>>2]|0,r&&(o=t+124|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),o=t+92|0,r=e[o>>2]|0,e[o>>2]=0,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r),t=t+4|0,r=e[t>>2]|0,e[t>>2]=0,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r)}function Ea(t){t=t|0;var r=0,o=0;if(e[t>>2]=36080,r=e[t+4616>>2]|0,r&&(o=t+4620|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),e[t>>2]=36612,r=e[t+120>>2]|0,r&&(o=t+124|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),o=t+92|0,r=e[o>>2]|0,e[o>>2]=0,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r),o=t+4|0,r=e[o>>2]|0,e[o>>2]=0,!r){he(t);return}Mt[e[(e[r>>2]|0)+4>>2]&255](r),he(t)}function ka(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0;d=b,b=b+32|0,C=d,m0(C,e[t+136>>2]|0,e[t+144>>2]|0),w=e[r+4>>2]|0,h=e[r+8>>2]|0,h=h|0?h:e[C+8>>2]|0,c=e[r+12>>2]|0,c=c|0?c:e[C+12>>2]|0,o=e[r+16>>2]|0,l=e[C+16>>2]|0,e[t+184>>2]=w|0?w:e[C+4>>2]|0,e[t+188>>2]=h,e[t+192>>2]=c,Wl(t),c=t+140|0,r=(e[c>>2]|0)+32|0,r=(r|0)<128?2:(r|0)/64|0,h=0;do e[t+196+(h*12|0)>>2]=r,e[t+196+(h*12|0)+4>>2]=0,I[t+196+(h*12|0)+8>>1]=0,I[t+196+(h*12|0)+10>>1]=1,h=h+1|0;while((h|0)!=365);w=(e[c>>2]|0)+32|0,w=(w|0)<128?2:(w|0)/64|0,C=(o|0?o:l)&255,e[t+4576>>2]=w,e[t+4580>>2]=0,S[t+4584>>0]=C,S[t+4585>>0]=1,S[t+4586>>0]=0,e[t+4588>>2]=w,e[t+4592>>2]=1,S[t+4596>>0]=C,S[t+4597>>0]=1,S[t+4598>>0]=0,e[t+4600>>2]=0,b=d}function Da(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0,D=0,k=0;if(k=b,b=b+16|0,C=k,w=t+92|0,d=e[r>>2]|0,e[r>>2]=0,r=e[w>>2]|0,e[w>>2]=d,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r),e[C>>2]=0,e[C+4>>2]=l,w=o+8|0,e[C+8>>2]=e[w>>2],l){r=Xe(4624)|0,l=t+8|0,c=r+4|0,h=l,d=c+84|0;do e[c>>2]=e[h>>2],c=c+4|0,h=h+4|0;while((c|0)<(d|0));c=r+88|0,d=c+40|0;do e[c>>2]=0,c=c+4|0;while((c|0)<(d|0));e[r>>2]=35856,e[r+128>>2]=e[t+136>>2],e[r+132>>2]=e[t+140>>2],e[r+136>>2]=e[t+144>>2],e[r+140>>2]=e[t+148>>2],e[r+144>>2]=e[t+152>>2],e[r+148>>2]=e[t+156>>2],e[r+152>>2]=e[t+160>>2],c=r+156|0,e[c>>2]=0,e[c+4>>2]=0,e[c+8>>2]=0,e[c+12>>2]=0,e[r+172>>2]=e[l>>2],e[r+176>>2]=0,e[r+180>>2]=0,e[r+184>>2]=0,c=r+4568|0,l=r+188|0;do e[l>>2]=0,e[l+4>>2]=0,I[l+8>>1]=0,I[l+10>>1]=1,l=l+12|0;while((l|0)!=(c|0));h=t+4|0,e[c>>2]=0,e[c+4>>2]=0,I[c+8>>1]=0,S[c+10>>0]=0,d=r+4580|0,e[d>>2]=0,e[d+4>>2]=0,I[d+8>>1]=0,S[d+10>>0]=0,d=r+4592|0,e[d>>2]=0,e[d+4>>2]=0,e[d+8>>2]=0,e[d+12>>2]=0,e[d+16>>2]=0,e[d+20>>2]=0,e[d+24>>2]=0,S[d+28>>0]=0,e[r+28>>2]|0||(e[r+20>>2]=1),l=e[h>>2]|0,e[h>>2]=r,l&&(Mt[e[(e[l>>2]|0)+4>>2]&255](l),r=e[h>>2]|0),Y0(r,C)}return C=t+100|0,e[C>>2]=32,e[t+96>>2]=0,r=e[o>>2]|0,r?(e[t+132>>2]=r,c=t+120|0,w=t+124|0,l=e[w>>2]|0,r=e[c>>2]|0,h=r,d=l-h|0,d>>>0>=4e3?d>>>0>4e3&&(D=r+4e3|0,(l|0)!=(D|0))&&(e[w>>2]=D,l=D):(vi(c,4e3-d|0),r=e[c>>2]|0,h=r,l=e[w>>2]|0),e[t+108>>2]=h,e[t+104>>2]=l-r,es(t),D=t+116|0,D=e[D>>2]|0,t=e[C>>2]|0,t=t+-32|0,t=(t|0)/8|0,t=D-t|0,b=k,t|0):(e[t+108>>2]=e[o+4>>2],e[t+104>>2]=e[w>>2],es(t),D=t+116|0,D=e[D>>2]|0,t=e[C>>2]|0,t=t+-32|0,t=(t|0)/8|0,t=D-t|0,b=k,t|0)}function ba(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0,G=0,$=0,P=0,O=0;if(G=b,b=b+352|0,$=G+328|0,P=G+192|0,o=G+343|0,l=G+342|0,c=G+341|0,h=G+340|0,R=G+176|0,w=G+168|0,C=G+160|0,D=G+152|0,K=G,U=G+136|0,e[t+32>>2]|0&&(e[t+24>>2]|0)!=1){if(_=t+8|0,Q=t+36|0,d=e[Q>>2]|0,!d){if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[o>>0]|0,$e(37,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}if(t=e[t+16>>2]|0,(t|0)==16)switch(d|0){case 1:{if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[l>>0]|0,$e(38,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 2:{if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[c>>0]|0,$e(39,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 3:{if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[h>>0]|0,$e(40,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}default:{d=P+56|0,c=P+4|0,e[P>>2]=36160,e[d>>2]=36180,g=0,Ae(62,P+56|0,c|0),G=g,g=0,G&1&&(O=j()|0,tt(d),le(O|0)),e[P+128>>2]=0,e[P+132>>2]=-1,e[P>>2]=36200,e[P+56>>2]=36220,g=0,ue(180,c|0),G=g,g=0;do if(G&1)t=j()|0;else{if(e[c>>2]=36236,h=P+36|0,e[h>>2]=0,e[h+4>>2]=0,e[h+8>>2]=0,e[h+12>>2]=0,e[P+52>>2]=16,e[$>>2]=0,e[$+4>>2]=0,e[$+8>>2]=0,g=0,Ae(63,c|0,$|0),G=g,g=0,G&1){t=j()|0,de($),de(h),wt(c);break}de($),g=0,t=Ve(28,P|0,49007,21)|0,$=g,g=0;do if(!($&1)&&(g=0,k=be(36,t|0,e[Q>>2]|0)|0,$=g,g=0,!($&1))&&(g=0,Ve(28,k|0,50997,18)|0,$=g,g=0,!($&1))){if(l=Ct(16)|0,g=0,Ae(64,R|0,c|0),$=g,g=0,$&1)t=j()|0;else if(!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,H|0)|0,bt(8)),g=0,$e(36,l|0,9,35648,R|0),$=g,g=0,$&1?o=1:(g=0,xe(6,l|0,824,96),g=0,o=0),t=j()|0,de(R),!o)break;Tt(l|0)}else O=34;while(!1);(O|0)==34&&(t=j()|0),e[P>>2]=36200,e[d>>2]=36220,e[c>>2]=36236,de(h),wt(c),tt(d),O=t,le(O|0)}while(!1);O=t,tt(d),le(O|0)}}switch((t|0)<=8&&(t=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,H|0)|0,bt(8)),g=0,xe(7,t|0,8,35648),O=g,g=0,O&1||Qt(t|0,824,96),O=j()|0,Tt(t|0),le(O|0)),o=16-t|0,d|0){case 1:{if(t=Xe(60)|0,e[w>>2]=o,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],e[$>>2]=e[w>>2],e[$+4>>2]=e[w+4>>2],$e(41,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 2:{if(t=Xe(60)|0,e[C>>2]=o,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],e[$>>2]=e[C>>2],e[$+4>>2]=e[C+4>>2],$e(42,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 3:{if(t=Xe(60)|0,e[D>>2]=o,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],e[$>>2]=e[D>>2],e[$+4>>2]=e[D+4>>2],$e(43,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}default:{d=K+56|0,c=K+4|0,e[K>>2]=36160,e[d>>2]=36180,g=0,Ae(62,K+56|0,c|0),P=g,g=0,P&1&&(O=j()|0,tt(d),le(O|0)),e[K+128>>2]=0,e[K+132>>2]=-1,e[K>>2]=36200,e[K+56>>2]=36220,g=0,ue(180,c|0),P=g,g=0;do if(P&1)t=j()|0;else{if(e[c>>2]=36236,h=K+36|0,e[h>>2]=0,e[h+4>>2]=0,e[h+8>>2]=0,e[h+12>>2]=0,e[K+52>>2]=16,e[$>>2]=0,e[$+4>>2]=0,e[$+8>>2]=0,g=0,Ae(63,c|0,$|0),P=g,g=0,P&1){t=j()|0,de($),de(h),wt(c);break}de($),g=0,t=Ve(28,K|0,49007,21)|0,P=g,g=0;do if(!(P&1)&&(g=0,N=be(36,t|0,e[Q>>2]|0)|0,P=g,g=0,!(P&1))&&(g=0,Ve(28,N|0,50997,18)|0,P=g,g=0,!(P&1))){if(l=Ct(16)|0,g=0,Ae(64,U|0,c|0),P=g,g=0,P&1)t=j()|0;else if(!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,H|0)|0,bt(8)),g=0,$e(36,l|0,9,35648,U|0),P=g,g=0,P&1?o=1:(g=0,xe(6,l|0,824,96),g=0,o=0),t=j()|0,de(U),!o)break;Tt(l|0)}else O=64;while(!1);(O|0)==64&&(t=j()|0),e[K>>2]=36200,e[d>>2]=36220,e[c>>2]=36236,de(h),wt(c),tt(d),O=t,le(O|0)}while(!1);O=t,tt(d),le(O|0)}}}return o=e[r+4>>2]|0,l=Xe(16)|0,t=e[t+20>>2]|0,o?(e[l>>2]=36108,e[l+4>>2]=o,e[l+8>>2]=2,e[l+12>>2]=t,O=l,b=G,O|0):(O=e[r>>2]|0,e[l>>2]=36132,e[l+4>>2]=O,e[l+8>>2]=2,e[l+12>>2]=t,O=l,b=G,O|0)}function Na(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0;e[t>>2]=36460,e[t+4>>2]=o,N=t+8|0,h=e[o>>2]|0,D=o+16|0,l=e[D>>2]|0,d=ee(l,h)|0,e[N>>2]=0,R=t+12|0,e[R>>2]=0,e[t+16>>2]=0;do if(d){if((d|0)<0&&(g=0,ue(178,N|0),h=g,g=0,h&1)||(k=4),(k|0)==4&&(w=d<<1,g=0,C=ge(67,w|0)|0,h=g,g=0,!(h&1))){e[N>>2]=C,h=C+(d<<1)|0,e[t+16>>2]=h,Jt(C|0,0,w|0)|0,e[R>>2]=h,h=e[o>>2]|0,l=e[D>>2]|0;break}d=j()|0,c=e[N>>2]|0,l=c,c&&(h=e[R>>2]|0,(h|0)!=(c|0)&&(e[R>>2]=h+(~((h+-2-l|0)>>>1)<<1)),he(c)),R=d,le(R|0)}while(!1);if(d=t+20|0,l=ee(h<<1,l)|0,e[d>>2]=0,w=t+24|0,e[w>>2]=0,e[t+28>>2]=0,!l){R=t+36|0,e[R>>2]=e[r>>2],e[R+4>>2]=e[r+4>>2],e[R+8>>2]=e[r+8>>2];return}if((l|0)<0&&(g=0,ue(178,d|0),o=g,g=0,o&1)||(k=13),(k|0)==13&&(g=0,c=ge(67,l|0)|0,k=g,g=0,!(k&1))){e[w>>2]=c,e[d>>2]=c,e[t+28>>2]=c+l;do S[c>>0]=0,c=(e[w>>2]|0)+1|0,e[w>>2]=c,l=l+-1|0;while(l|0);R=t+36|0,e[R>>2]=e[r>>2],e[R+4>>2]=e[r+4>>2],e[R+8>>2]=e[r+8>>2];return}h=j()|0,c=e[d>>2]|0,c&&((e[w>>2]|0)!=(c|0)&&(e[w>>2]=c),he(c)),c=e[N>>2]|0,c||(R=h,le(R|0)),l=e[R>>2]|0,(l|0)!=(c|0)&&(e[R>>2]=l+(~((l+-2-c|0)>>>1)<<1)),he(c),R=h,le(R|0)}function Fa(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0;e[t>>2]=36436,e[t+4>>2]=o,N=t+8|0,h=e[o>>2]|0,D=o+16|0,l=e[D>>2]|0,d=ee(l,h)|0,e[N>>2]=0,R=t+12|0,e[R>>2]=0,e[t+16>>2]=0;do if(d){if((d|0)<0&&(g=0,ue(178,N|0),h=g,g=0,h&1)||(k=4),(k|0)==4&&(w=d<<1,g=0,C=ge(67,w|0)|0,h=g,g=0,!(h&1))){e[N>>2]=C,h=C+(d<<1)|0,e[t+16>>2]=h,Jt(C|0,0,w|0)|0,e[R>>2]=h,h=e[o>>2]|0,l=e[D>>2]|0;break}d=j()|0,c=e[N>>2]|0,l=c,c&&(h=e[R>>2]|0,(h|0)!=(c|0)&&(e[R>>2]=h+(~((h+-2-l|0)>>>1)<<1)),he(c)),R=d,le(R|0)}while(!1);if(d=t+20|0,l=ee(h<<1,l)|0,e[d>>2]=0,w=t+24|0,e[w>>2]=0,e[t+28>>2]=0,!l){R=t+36|0,e[R>>2]=e[r>>2],e[R+4>>2]=e[r+4>>2],e[R+8>>2]=e[r+8>>2];return}if((l|0)<0&&(g=0,ue(178,d|0),o=g,g=0,o&1)||(k=13),(k|0)==13&&(g=0,c=ge(67,l|0)|0,k=g,g=0,!(k&1))){e[w>>2]=c,e[d>>2]=c,e[t+28>>2]=c+l;do S[c>>0]=0,c=(e[w>>2]|0)+1|0,e[w>>2]=c,l=l+-1|0;while(l|0);R=t+36|0,e[R>>2]=e[r>>2],e[R+4>>2]=e[r+4>>2],e[R+8>>2]=e[r+8>>2];return}h=j()|0,c=e[d>>2]|0,c&&((e[w>>2]|0)!=(c|0)&&(e[w>>2]=c),he(c)),c=e[N>>2]|0,c||(R=h,le(R|0)),l=e[R>>2]|0,(l|0)!=(c|0)&&(e[R>>2]=l+(~((l+-2-c|0)>>>1)<<1)),he(c),R=h,le(R|0)}function Ra(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0;e[t>>2]=36412,e[t+4>>2]=o,N=t+8|0,h=e[o>>2]|0,D=o+16|0,l=e[D>>2]|0,d=ee(l,h)|0,e[N>>2]=0,R=t+12|0,e[R>>2]=0,e[t+16>>2]=0;do if(d){if((d|0)<0&&(g=0,ue(178,N|0),h=g,g=0,h&1)||(k=4),(k|0)==4&&(w=d<<1,g=0,C=ge(67,w|0)|0,h=g,g=0,!(h&1))){e[N>>2]=C,h=C+(d<<1)|0,e[t+16>>2]=h,Jt(C|0,0,w|0)|0,e[R>>2]=h,h=e[o>>2]|0,l=e[D>>2]|0;break}d=j()|0,c=e[N>>2]|0,l=c,c&&(h=e[R>>2]|0,(h|0)!=(c|0)&&(e[R>>2]=h+(~((h+-2-l|0)>>>1)<<1)),he(c)),R=d,le(R|0)}while(!1);if(d=t+20|0,l=ee(h<<1,l)|0,e[d>>2]=0,w=t+24|0,e[w>>2]=0,e[t+28>>2]=0,!l){R=t+36|0,e[R>>2]=e[r>>2],e[R+4>>2]=e[r+4>>2],e[R+8>>2]=e[r+8>>2];return}if((l|0)<0&&(g=0,ue(178,d|0),o=g,g=0,o&1)||(k=13),(k|0)==13&&(g=0,c=ge(67,l|0)|0,k=g,g=0,!(k&1))){e[w>>2]=c,e[d>>2]=c,e[t+28>>2]=c+l;do S[c>>0]=0,c=(e[w>>2]|0)+1|0,e[w>>2]=c,l=l+-1|0;while(l|0);R=t+36|0,e[R>>2]=e[r>>2],e[R+4>>2]=e[r+4>>2],e[R+8>>2]=e[r+8>>2];return}h=j()|0,c=e[d>>2]|0,c&&((e[w>>2]|0)!=(c|0)&&(e[w>>2]=c),he(c)),c=e[N>>2]|0,c||(R=h,le(R|0)),l=e[R>>2]|0,(l|0)!=(c|0)&&(e[R>>2]=l+(~((l+-2-c|0)>>>1)<<1)),he(c),R=h,le(R|0)}function Ma(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0;e[t>>2]=36388,e[t+4>>2]=o,N=t+8|0,h=e[o>>2]|0,D=o+16|0,l=e[D>>2]|0,d=ee(l,h)|0,e[N>>2]=0,R=t+12|0,e[R>>2]=0,e[t+16>>2]=0;do if(d){if((d|0)<0&&(g=0,ue(178,N|0),h=g,g=0,h&1)||(k=4),(k|0)==4&&(w=d<<1,g=0,C=ge(67,w|0)|0,h=g,g=0,!(h&1))){e[N>>2]=C,h=C+(d<<1)|0,e[t+16>>2]=h,Jt(C|0,0,w|0)|0,e[R>>2]=h,h=e[o>>2]|0,l=e[D>>2]|0;break}d=j()|0,c=e[N>>2]|0,l=c,c&&(h=e[R>>2]|0,(h|0)!=(c|0)&&(e[R>>2]=h+(~((h+-2-l|0)>>>1)<<1)),he(c)),R=d,le(R|0)}while(!1);if(d=t+20|0,l=ee(h<<1,l)|0,e[d>>2]=0,w=t+24|0,e[w>>2]=0,e[t+28>>2]=0,!l){R=t+36|0,e[R>>2]=e[r>>2],e[R+4>>2]=e[r+4>>2],e[R+8>>2]=e[r+8>>2];return}if((l|0)<0&&(g=0,ue(178,d|0),o=g,g=0,o&1)||(k=13),(k|0)==13&&(g=0,c=ge(67,l|0)|0,k=g,g=0,!(k&1))){e[w>>2]=c,e[d>>2]=c,e[t+28>>2]=c+l;do S[c>>0]=0,c=(e[w>>2]|0)+1|0,e[w>>2]=c,l=l+-1|0;while(l|0);R=t+36|0,e[R>>2]=e[r>>2],e[R+4>>2]=e[r+4>>2],e[R+8>>2]=e[r+8>>2];return}h=j()|0,c=e[d>>2]|0,c&&((e[w>>2]|0)!=(c|0)&&(e[w>>2]=c),he(c)),c=e[N>>2]|0,c||(R=h,le(R|0)),l=e[R>>2]|0,(l|0)!=(c|0)&&(e[R>>2]=l+(~((l+-2-c|0)>>>1)<<1)),he(c),R=h,le(R|0)}function Pa(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0;d=t+32|0,Sp(d,r)|0,h=t+44|0,e[h>>2]=0,w=t+48|0,c=e[w>>2]|0,c&8&&(r=S[d>>0]|0,r&1?(r=(e[t+40>>2]|0)+(e[t+36>>2]|0)|0,e[h>>2]=r,l=e[t+40>>2]|0,o=l):(r=((r&255)>>>1)+(d+1)|0,e[h>>2]=r,o=d+1|0,l=d+1|0),e[t+8>>2]=o,e[t+12>>2]=l,e[t+16>>2]=r),c&16&&(r=S[d>>0]|0,r&1?(c=e[t+36>>2]|0,e[h>>2]=(e[t+40>>2]|0)+c,r=(e[d>>2]&-2)+-1|0,h=c):(c=(r&255)>>>1,e[h>>2]=d+1+c,r=10,h=c),zs(d,r,0),r=S[d>>0]|0,r&1?(o=e[t+40>>2]|0,c=o,l=e[t+36>>2]|0):(c=d+1|0,l=(r&255)>>>1,o=d+1|0),r=t+24|0,e[r>>2]=o,e[t+20>>2]=o,e[t+28>>2]=c+l,e[w>>2]&3&&(e[r>>2]=o+h))}function La(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0;R=b,b=b+32|0,d=R+16|0,N=R+8|0,w=R,g=0,Ae(65,N|0,t|0),D=g,g=0;e:do if(D&1)o=j(0)|0,l=t,c=t;else{do if(S[N>>0]|0){l=e[(e[t>>2]|0)+-12>>2]|0,e[w>>2]=e[t+(l+24)>>2],C=t+l|0,D=e[t+(l+4)>>2]|0,c=r+o|0,l=t+(l+76)|0,o=e[l>>2]|0;do if((o|0)==-1)if(g=0,o=ge(68,C|0)|0,_=g,g=0,_&1)k=13;else{if(e[d>>2]=o,g=0,o=be(37,d|0,44220)|0,_=g,g=0,!(_&1)&&(g=0,h=be(e[(e[o>>2]|0)+28>>2]|0,o|0,32)|0,_=g,g=0,!(_&1))){_0(d),o=h<<24>>24,e[l>>2]=o,k=9;break}o=j(0)|0,_0(d)}else k=9;while(!1);if((k|0)==9)if(g=0,e[d>>2]=e[w>>2],o=Vt(39,d|0,r|0,((D&176|0)==32?c:r)|0,c|0,C|0,o&255|0)|0,_=g,g=0,_&1)k=13;else{if(o)break;if(_=e[(e[t>>2]|0)+-12>>2]|0,g=0,Ae(66,t+_|0,e[t+(_+16)>>2]|5|0),_=g,g=0,_&1)k=13;else break}(k|0)==13&&(o=j(0)|0),Ei(N),l=t,c=t;break e}while(!1);return Ei(N),b=R,t|0}while(!1);return K0(o|0)|0,g=0,ue(181,l+(e[(e[c>>2]|0)+-12>>2]|0)|0),_=g,g=0,_&1?(o=j()|0,g=0,Nt(3),_=g,g=0,_&1?(_=j(0)|0,$t(_)):le(o|0),0):(ei(),b=R,t|0)}function Oa(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0;if(o=e[r+48>>2]|0,o&16){if(o=r+44|0,l=e[o>>2]|0,c=e[r+24>>2]|0,l>>>0>>0?e[o>>2]=c:c=l,l=e[r+20>>2]|0,h=c-l|0,h>>>0>4294967279&&si(t),h>>>0<11?(S[t>>0]=h<<1,o=t+1|0):(r=h+16&-16,o=Xe(r)|0,e[t+8>>2]=o,e[t>>2]=r|1,e[t+4>>2]=h),(l|0)!=(c|0)){for(r=o;S[r>>0]=S[l>>0]|0,l=l+1|0,(l|0)!=(c|0);)r=r+1|0;o=o+h|0}S[o>>0]=0;return}if(!(o&8)){e[t>>2]=0,e[t+4>>2]=0,e[t+8>>2]=0;return}if(l=e[r+8>>2]|0,r=e[r+16>>2]|0,h=r-l|0,h>>>0>4294967279&&si(t),h>>>0<11?(S[t>>0]=h<<1,o=t+1|0):(c=h+16&-16,o=Xe(c)|0,e[t+8>>2]=o,e[t>>2]=c|1,e[t+4>>2]=h),(l|0)!=(r|0)){for(c=o;S[c>>0]=S[l>>0]|0,l=l+1|0,(l|0)!=(r|0);)c=c+1|0;o=o+h|0}S[o>>0]=0}function $a(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0;e[t>>2]=36364,e[t+4>>2]=o,R=t+8|0,d=e[o>>2]|0,k=o+16|0,h=e[k>>2]|0,D=ee(h,d)|0,e[R>>2]=0,_=t+12|0,e[_>>2]=0,e[t+16>>2]=0;do if(D){if((D|0)<0&&(g=0,ue(178,R|0),d=g,g=0,d&1)||(N=4),(N|0)==4&&(w=D<<1,g=0,C=ge(67,w|0)|0,d=g,g=0,!(d&1))){e[R>>2]=C,d=C+(D<<1)|0,e[t+16>>2]=d,Jt(C|0,0,w|0)|0,e[_>>2]=d,d=e[o>>2]|0,h=e[k>>2]|0;break}w=j()|0,c=e[R>>2]|0,h=c,c&&(d=e[_>>2]|0,(d|0)!=(c|0)&&(e[_>>2]=d+(~((d+-2-h|0)>>>1)<<1)),he(c)),_=w,le(_|0)}while(!1);if(w=t+20|0,h=ee(d<<1,h)|0,e[w>>2]=0,C=t+24|0,e[C>>2]=0,e[t+28>>2]=0,!h){_=t+32|0,R=l,R=e[R>>2]|0,l=l+4|0,l=e[l>>2]|0,N=_,e[N>>2]=R,_=_+4|0,e[_>>2]=l,_=t+40|0,e[_>>2]=R,_=t+48|0,e[_>>2]=e[r>>2],e[_+4>>2]=e[r+4>>2],e[_+8>>2]=e[r+8>>2];return}if((h|0)<0&&(g=0,ue(178,w|0),k=g,g=0,k&1)||(N=13),(N|0)==13&&(g=0,c=ge(67,h|0)|0,N=g,g=0,!(N&1))){e[C>>2]=c,e[w>>2]=c,e[t+28>>2]=c+h;do S[c>>0]=0,c=(e[C>>2]|0)+1|0,e[C>>2]=c,h=h+-1|0;while(h|0);_=t+32|0,R=l,R=e[R>>2]|0,l=l+4|0,l=e[l>>2]|0,N=_,e[N>>2]=R,_=_+4|0,e[_>>2]=l,_=t+40|0,e[_>>2]=R,_=t+48|0,e[_>>2]=e[r>>2],e[_+4>>2]=e[r+4>>2],e[_+8>>2]=e[r+8>>2];return}d=j()|0,c=e[w>>2]|0,c&&((e[C>>2]|0)!=(c|0)&&(e[C>>2]=c),he(c)),c=e[R>>2]|0,c||(_=d,le(_|0)),h=e[_>>2]|0,(h|0)!=(c|0)&&(e[_>>2]=h+(~((h+-2-c|0)>>>1)<<1)),he(c),_=d,le(_|0)}function Ba(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0;e[t>>2]=36340,e[t+4>>2]=o,R=t+8|0,d=e[o>>2]|0,k=o+16|0,h=e[k>>2]|0,D=ee(h,d)|0,e[R>>2]=0,_=t+12|0,e[_>>2]=0,e[t+16>>2]=0;do if(D){if((D|0)<0&&(g=0,ue(178,R|0),d=g,g=0,d&1)||(N=4),(N|0)==4&&(w=D<<1,g=0,C=ge(67,w|0)|0,d=g,g=0,!(d&1))){e[R>>2]=C,d=C+(D<<1)|0,e[t+16>>2]=d,Jt(C|0,0,w|0)|0,e[_>>2]=d,d=e[o>>2]|0,h=e[k>>2]|0;break}w=j()|0,c=e[R>>2]|0,h=c,c&&(d=e[_>>2]|0,(d|0)!=(c|0)&&(e[_>>2]=d+(~((d+-2-h|0)>>>1)<<1)),he(c)),_=w,le(_|0)}while(!1);if(w=t+20|0,h=ee(d<<1,h)|0,e[w>>2]=0,C=t+24|0,e[C>>2]=0,e[t+28>>2]=0,!h){_=t+32|0,R=l,R=e[R>>2]|0,l=l+4|0,l=e[l>>2]|0,N=_,e[N>>2]=R,_=_+4|0,e[_>>2]=l,_=t+40|0,e[_>>2]=R,_=t+48|0,e[_>>2]=e[r>>2],e[_+4>>2]=e[r+4>>2],e[_+8>>2]=e[r+8>>2];return}if((h|0)<0&&(g=0,ue(178,w|0),k=g,g=0,k&1)||(N=13),(N|0)==13&&(g=0,c=ge(67,h|0)|0,N=g,g=0,!(N&1))){e[C>>2]=c,e[w>>2]=c,e[t+28>>2]=c+h;do S[c>>0]=0,c=(e[C>>2]|0)+1|0,e[C>>2]=c,h=h+-1|0;while(h|0);_=t+32|0,R=l,R=e[R>>2]|0,l=l+4|0,l=e[l>>2]|0,N=_,e[N>>2]=R,_=_+4|0,e[_>>2]=l,_=t+40|0,e[_>>2]=R,_=t+48|0,e[_>>2]=e[r>>2],e[_+4>>2]=e[r+4>>2],e[_+8>>2]=e[r+8>>2];return}d=j()|0,c=e[w>>2]|0,c&&((e[C>>2]|0)!=(c|0)&&(e[C>>2]=c),he(c)),c=e[R>>2]|0,c||(_=d,le(_|0)),h=e[_>>2]|0,(h|0)!=(c|0)&&(e[_>>2]=h+(~((h+-2-c|0)>>>1)<<1)),he(c),_=d,le(_|0)}function Va(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0;e[t>>2]=36316,e[t+4>>2]=o,R=t+8|0,d=e[o>>2]|0,k=o+16|0,h=e[k>>2]|0,D=ee(h,d)|0,e[R>>2]=0,_=t+12|0,e[_>>2]=0,e[t+16>>2]=0;do if(D){if((D|0)<0&&(g=0,ue(178,R|0),d=g,g=0,d&1)||(N=4),(N|0)==4&&(w=D<<1,g=0,C=ge(67,w|0)|0,d=g,g=0,!(d&1))){e[R>>2]=C,d=C+(D<<1)|0,e[t+16>>2]=d,Jt(C|0,0,w|0)|0,e[_>>2]=d,d=e[o>>2]|0,h=e[k>>2]|0;break}w=j()|0,c=e[R>>2]|0,h=c,c&&(d=e[_>>2]|0,(d|0)!=(c|0)&&(e[_>>2]=d+(~((d+-2-h|0)>>>1)<<1)),he(c)),_=w,le(_|0)}while(!1);if(w=t+20|0,h=ee(d<<1,h)|0,e[w>>2]=0,C=t+24|0,e[C>>2]=0,e[t+28>>2]=0,!h){_=t+32|0,R=l,R=e[R>>2]|0,l=l+4|0,l=e[l>>2]|0,N=_,e[N>>2]=R,_=_+4|0,e[_>>2]=l,_=t+40|0,e[_>>2]=R,_=t+48|0,e[_>>2]=e[r>>2],e[_+4>>2]=e[r+4>>2],e[_+8>>2]=e[r+8>>2];return}if((h|0)<0&&(g=0,ue(178,w|0),k=g,g=0,k&1)||(N=13),(N|0)==13&&(g=0,c=ge(67,h|0)|0,N=g,g=0,!(N&1))){e[C>>2]=c,e[w>>2]=c,e[t+28>>2]=c+h;do S[c>>0]=0,c=(e[C>>2]|0)+1|0,e[C>>2]=c,h=h+-1|0;while(h|0);_=t+32|0,R=l,R=e[R>>2]|0,l=l+4|0,l=e[l>>2]|0,N=_,e[N>>2]=R,_=_+4|0,e[_>>2]=l,_=t+40|0,e[_>>2]=R,_=t+48|0,e[_>>2]=e[r>>2],e[_+4>>2]=e[r+4>>2],e[_+8>>2]=e[r+8>>2];return}d=j()|0,c=e[w>>2]|0,c&&((e[C>>2]|0)!=(c|0)&&(e[C>>2]=c),he(c)),c=e[R>>2]|0,c||(_=d,le(_|0)),h=e[_>>2]|0,(h|0)!=(c|0)&&(e[_>>2]=h+(~((h+-2-c|0)>>>1)<<1)),he(c),_=d,le(_|0)}function Ua(t){t=t|0;var r=0,o=0,l=0;e[t>>2]=36316,r=e[t+20>>2]|0,r&&(o=t+24|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),l=e[t+8>>2]|0,l&&(r=t+12|0,o=e[r>>2]|0,(o|0)!=(l|0)&&(e[r>>2]=o+(~((o+-2-l|0)>>>1)<<1)),he(l))}function za(t){t=t|0;var r=0,o=0,l=0;if(e[t>>2]=36316,r=e[t+20>>2]|0,r&&(o=t+24|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),l=e[t+8>>2]|0,!l){he(t);return}r=t+12|0,o=e[r>>2]|0,(o|0)!=(l|0)&&(e[r>>2]=o+(~((o+-2-l|0)>>>1)<<1)),he(l),he(t)}function Ga(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0;if(c=t+48|0,!(e[c>>2]|0)){w=t+52|0,Qr(t,r,e[w>>2]|0,o,l),e[w>>2]=(e[w>>2]|0)+(e[(e[t+4>>2]|0)+12>>2]|0);return}C=t+4|0,h=o<<1,d=ee(h,e[(e[C>>2]|0)+16>>2]|0)|0,w=t+20|0,Qr(t,r,e[w>>2]|0,o,l),r=e[C>>2]|0,(e[r+28>>2]|0)==536870912&&ti(e[w>>2]|0,ee(h,e[r+16>>2]|0)|0),C=e[c>>2]|0,(Yt[e[(e[C>>2]|0)+48>>2]&63](C,e[w>>2]|0,d)|0)!=(d|0)&&(r=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,H|0)|0,bt(8)),g=0,xe(7,r|0,3,35648),C=g,g=0,C&1?(C=j()|0,Tt(r|0),le(C|0)):Qt(r|0,824,96))}function qa(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0;if(c=e[t+48>>2]|0,c){Wa(t,c,r,o,l);return}else{c=t+52|0,Bn(t,e[c>>2]|0,r,o,l),e[c>>2]=(e[c>>2]|0)+(e[(e[t+4>>2]|0)+12>>2]|0);return}}function Bn(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0;C=t+4|0,h=e[C>>2]|0;do if(!(S[h+32>>0]|0))D=r;else{if(d=t+8|0,o0(e[d>>2]|0,r|0,l*6|0)|0,h=e[C>>2]|0,w=e[h+16>>2]|0,(l|0)<=0){D=e[d>>2]|0;break}for(r=e[d>>2]|0,h=r,d=0;D=h+4|0,k=I[h>>1]|0,I[h>>1]=I[D>>1]|0,I[D>>1]=k,d=d+1|0,(d|0)!=(l|0);)h=h+(w<<1)|0;D=r,h=e[C>>2]|0}while(!1);switch(e[h+16>>2]|0){case 3:if((e[h+24>>2]|0)==2){if((l|0)<=0)return;h=t+32|0,r=0;do k=e[h>>2]|0,C=M[D+(r*6|0)+2>>1]<>1]<>1]<>1]=(C+49152+((t+c|0)>>>2)&65535)>>>k,I[o+(r*6|0)+2>>1]=t>>>k,I[o+(r*6|0)+4>>1]=c>>>k,r=r+1|0;while((r|0)!=(l|0));return}else{if(d=(c|0)<(l|0)?c:l,(d|0)<=0)return;w=c<<1,h=e[t+32>>2]|0,r=0;do l=M[D+(r*6|0)+2>>1]<>1]<>1]<>1]=(l+49152+((t+k|0)>>>2)&65535)>>>h,I[o+(r+c<<1)>>1]=t>>>h,I[o+(r+w<<1)>>1]=k>>>h,r=r+1|0;while((r|0)!=(d|0));return}case 4:{if((e[h+24>>2]|0)!=1||(d=(c|0)<(l|0)?c:l,(d|0)<=0))return;w=c<<1,C=c*3|0,h=e[t+32>>2]|0,r=0;do k=I[D+(r<<3)+6>>1]|0,N=M[D+(r<<3)+2>>1]<>1]<>1]<>1]=(N+49152+((l+t|0)>>>2)&65535)>>>h,I[o+(r+c<<1)>>1]=l>>>h,I[o+(r+w<<1)>>1]=t>>>h,I[o+(r+C<<1)>>1]=k,r=r+1|0;while((r|0)!=(d|0));return}default:return}}function Wa(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0;N=b,b=b+176|0,R=N+152|0,U=N+16|0,_=N,C=t+4|0,h=e[C>>2]|0,k=l<<1,d=ee(k,e[h+16>>2]|0)|0;do if(d){for(w=t+20|0;h=Yt[e[(e[r>>2]|0)+32>>2]&63](r,e[w>>2]|0,d)|0,!!h;)if((d|0)==(h|0)){D=26;break}else d=d-h|0;if((D|0)==26){h=e[C>>2]|0;break}D=U+56|0,C=U+4|0,e[U>>2]=36160,e[D>>2]=36180,g=0,Ae(62,U+56|0,C|0),N=g,g=0,N&1&&(U=j()|0,tt(D),le(U|0)),e[U+128>>2]=0,e[U+132>>2]=-1,e[U>>2]=36200,e[U+56>>2]=36220,g=0,ue(180,C|0),N=g,g=0;do if(N&1)h=j()|0;else{if(e[C>>2]=36236,r=U+36|0,e[r>>2]=0,e[r+4>>2]=0,e[r+8>>2]=0,e[r+12>>2]=0,e[U+52>>2]=16,e[R>>2]=0,e[R+4>>2]=0,e[R+8>>2]=0,g=0,Ae(63,C|0,R|0),N=g,g=0,N&1){h=j()|0,de(R),de(r),wt(C);break}de(R),g=0,h=Ve(28,U|0,49029,57)|0,R=g,g=0,!(R&1)&&(g=0,be(36,h|0,0)|0,R=g,g=0,!(R&1))&&(w=Ct(16)|0,g=0,Ae(64,_|0,C|0),R=g,g=0,R&1?h=j()|0:(!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,H|0)|0,bt(8)),g=0,$e(36,w|0,3,35648,_|0),R=g,g=0,R&1?d=1:(g=0,xe(6,w|0,824,96),g=0,d=0),h=j()|0,de(_),d||(_=h,e[U>>2]=36200,e[D>>2]=36220,e[C>>2]=36236,de(r),wt(C),tt(D),le(_|0))),Tt(w|0),_=h,e[U>>2]=36200,e[D>>2]=36220,e[C>>2]=36236,de(r),wt(C),tt(D),le(_|0)),_=j()|0,e[U>>2]=36200,e[D>>2]=36220,e[C>>2]=36236,de(r),wt(C),tt(D),le(_|0)}while(!1);U=h,tt(D),le(U|0)}while(!1);if(d=t+20|0,(e[h+28>>2]|0)!=536870912){U=e[d>>2]|0,Bn(t,U,o,l,c),b=N;return}ti(e[d>>2]|0,ee(k,e[h+16>>2]|0)|0),U=e[d>>2]|0,Bn(t,U,o,l,c),b=N}function ti(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0;if(c=b,b=b+176|0,o=c+152|0,C=c+16|0,d=c,!(r&1)){if(o=(r|0)/4|0,(r|0)>3){l=0;do C=t+(l<<2)|0,w=e[C>>2]|0,e[C>>2]=w>>>8&16711935|w<<8&-16711936,l=l+1|0;while((l|0)<(o|0))}if(!(r&3)){b=c;return}d=t+(r+-2)|0,C=t+(r+-1)|0,w=S[d>>0]|0,S[d>>0]=S[C>>0]|0,S[C>>0]=w,b=c;return}w=C+56|0,h=C+4|0,e[C>>2]=36160,e[w>>2]=36180,g=0,Ae(62,C+56|0,h|0),c=g,g=0,c&1&&(C=j()|0,tt(w),le(C|0)),e[C+128>>2]=0,e[C+132>>2]=-1,e[C>>2]=36200,e[C+56>>2]=36220,g=0,ue(180,h|0),c=g,g=0;do if(c&1)o=j()|0;else{if(e[h>>2]=36236,c=C+36|0,e[c>>2]=0,e[c+4>>2]=0,e[c+8>>2]=0,e[c+12>>2]=0,e[C+52>>2]=16,e[o>>2]=0,e[o+4>>2]=0,e[o+8>>2]=0,g=0,Ae(63,h|0,o|0),t=g,g=0,t&1){C=j()|0,de(o),de(c),wt(h),o=C;break}de(o),g=0,o=Ve(28,C|0,49087,24)|0,t=g,g=0,!(t&1)&&(g=0,l=be(36,o|0,r|0)|0,r=g,g=0,!(r&1))&&(g=0,Ve(28,l|0,49112,20)|0,r=g,g=0,!(r&1))&&(t=Ct(16)|0,g=0,Ae(64,d|0,h|0),r=g,g=0,r&1?o=j()|0:(!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,H|0)|0,bt(8)),g=0,$e(36,t|0,1,35648,d|0),r=g,g=0,r&1?l=1:(g=0,xe(6,t|0,824,96),g=0,l=0),o=j()|0,de(d),l||(d=o,e[C>>2]=36200,e[w>>2]=36220,e[h>>2]=36236,de(c),wt(h),tt(w),le(d|0))),Tt(t|0),d=o,e[C>>2]=36200,e[w>>2]=36220,e[h>>2]=36236,de(c),wt(h),tt(w),le(d|0)),d=j()|0,e[C>>2]=36200,e[w>>2]=36220,e[h>>2]=36236,de(c),wt(h),tt(w),le(d|0)}while(!1);C=o,tt(w),le(C|0)}function Qr(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0;D=t+4|0,h=e[D>>2]|0;e:do switch(e[h+16>>2]|0){case 3:{if((e[h+24>>2]|0)==2){if((l|0)<=0)break e;h=t+40|0,t=0;do c=e[h>>2]|0,w=M[r+(t*6|0)+2>>1]<>1]<>1]<>2)+16384|0,I[o+(t*6|0)>>1]=(d+32768+C&65535)>>>c,I[o+(t*6|0)+2>>1]=(C&65535)>>>c,I[o+(t*6|0)+4>>1]=(w+32768+C&65535)>>>c,t=t+1|0;while((t|0)!=(l|0))}else{if(d=(l|0)<(c|0)?l:c,(d|0)<=0)break e;w=c<<1,h=t+40|0,t=0;do C=e[h>>2]|0,N=M[r+(t+c<<1)>>1]<>1]<>1]<>2)+16384|0,I[o+(t*6|0)>>1]=(R+32768+k&65535)>>>C,I[o+(t*6|0)+2>>1]=(k&65535)>>>C,I[o+(t*6|0)+4>>1]=(N+32768+k&65535)>>>C,t=t+1|0;while((t|0)!=(d|0))}break}case 4:{if((e[h+24>>2]|0)==1&&(C=(l|0)<(c|0)?l:c,(C|0)>0)){w=c<<1,h=t+40|0,t=c*3|0,d=0;do R=e[h>>2]|0,N=M[r+(d+c<<1)>>1]<>1]<>1]<>2)+16384|0,_=I[r+(d+t<<1)>>1]|0,Q=v0((k&65535)>>>R&65535|0,0,16)|0,N=(N+32768+k&65535)>>>R|ye,_=v0(_&65535|0,0,48)|0,_=Q|(U+32768+k&65535)>>>R&65535|_,N=N&65535|ye,R=o+(d<<3)|0,k=R,I[k>>1]=_,I[k+2>>1]=_>>>16,R=R+4|0,I[R>>1]=N,I[R+2>>1]=N>>>16,d=d+1|0;while((d|0)!=(C|0))}break}default:}while(!1);if(h=e[D>>2]|0,!!(S[h+32>>0]|0)&&(d=e[h+16>>2]|0,!((l|0)<=0)))for(h=o,t=0;Q=h+4|0,U=I[h>>1]|0,I[h>>1]=I[Q>>1]|0,I[Q>>1]=U,t=t+1|0,(t|0)!=(l|0);)h=h+(d<<1)|0}function Ha(t){t=t|0;var r=0,o=0,l=0;e[t>>2]=36340,r=e[t+20>>2]|0,r&&(o=t+24|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),l=e[t+8>>2]|0,l&&(r=t+12|0,o=e[r>>2]|0,(o|0)!=(l|0)&&(e[r>>2]=o+(~((o+-2-l|0)>>>1)<<1)),he(l))}function Qa(t){t=t|0;var r=0,o=0,l=0;if(e[t>>2]=36340,r=e[t+20>>2]|0,r&&(o=t+24|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),l=e[t+8>>2]|0,!l){he(t);return}r=t+12|0,o=e[r>>2]|0,(o|0)!=(l|0)&&(e[r>>2]=o+(~((o+-2-l|0)>>>1)<<1)),he(l),he(t)}function Ka(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0;if(c=t+48|0,!(e[c>>2]|0)){w=t+52|0,Kr(t,r,e[w>>2]|0,o,l),e[w>>2]=(e[w>>2]|0)+(e[(e[t+4>>2]|0)+12>>2]|0);return}C=t+4|0,h=o<<1,d=ee(h,e[(e[C>>2]|0)+16>>2]|0)|0,w=t+20|0,Kr(t,r,e[w>>2]|0,o,l),r=e[C>>2]|0,(e[r+28>>2]|0)==536870912&&ti(e[w>>2]|0,ee(h,e[r+16>>2]|0)|0),C=e[c>>2]|0,(Yt[e[(e[C>>2]|0)+48>>2]&63](C,e[w>>2]|0,d)|0)!=(d|0)&&(r=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,H|0)|0,bt(8)),g=0,xe(7,r|0,3,35648),C=g,g=0,C&1?(C=j()|0,Tt(r|0),le(C|0)):Qt(r|0,824,96))}function Ya(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0;if(c=e[t+48>>2]|0,c){ja(t,c,r,o,l);return}else{c=t+52|0,Vn(t,e[c>>2]|0,r,o,l),e[c>>2]=(e[c>>2]|0)+(e[(e[t+4>>2]|0)+12>>2]|0);return}}function Vn(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0;C=t+4|0,h=e[C>>2]|0;do if(!(S[h+32>>0]|0))D=r;else{if(d=t+8|0,o0(e[d>>2]|0,r|0,l*6|0)|0,h=e[C>>2]|0,w=e[h+16>>2]|0,(l|0)<=0){D=e[d>>2]|0;break}for(r=e[d>>2]|0,h=r,d=0;D=h+4|0,k=I[h>>1]|0,I[h>>1]=I[D>>1]|0,I[D>>1]=k,d=d+1|0,(d|0)!=(l|0);)h=h+(w<<1)|0;D=r,h=e[C>>2]|0}while(!1);switch(e[h+16>>2]|0){case 3:if((e[h+24>>2]|0)==2){if((l|0)<=0)return;h=t+32|0,r=0;do c=e[h>>2]|0,C=M[D+(r*6|0)>>1]<>1]<>1]<>>1)&65535)>>>c&65535,I[o+(r*6|0)>>1]=(C+32768-t&65535)>>>c,I[o+(r*6|0)+2>>1]=(t&65535)>>>c,I[o+(r*6|0)+4>>1]=k,r=r+1|0;while((r|0)!=(l|0));return}else{if(d=(c|0)<(l|0)?c:l,(d|0)<=0)return;w=c<<1,h=e[t+32>>2]|0,r=0;do l=M[D+(r*6|0)>>1]<>1]<>1]<>>1)&65535)>>>h&65535,I[o+(r<<1)>>1]=(l+32768-t&65535)>>>h,I[o+(r+c<<1)>>1]=(t&65535)>>>h,I[o+(r+w<<1)>>1]=k,r=r+1|0;while((r|0)!=(d|0));return}case 4:{if((e[h+24>>2]|0)!=1||(d=(c|0)<(l|0)?c:l,(d|0)<=0))return;w=c<<1,C=c*3|0,h=e[t+32>>2]|0,r=0;do k=I[D+(r<<3)+6>>1]|0,N=M[D+(r<<3)>>1]<>1]<>1]<>>1)&65535)>>>h&65535,I[o+(r<<1)>>1]=(N+32768-l&65535)>>>h,I[o+(r+c<<1)>>1]=(l&65535)>>>h,I[o+(r+w<<1)>>1]=t,I[o+(r+C<<1)>>1]=k,r=r+1|0;while((r|0)!=(d|0));return}default:return}}function ja(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0;N=b,b=b+176|0,R=N+152|0,U=N+16|0,_=N,C=t+4|0,h=e[C>>2]|0,k=l<<1,d=ee(k,e[h+16>>2]|0)|0;do if(d){for(w=t+20|0;h=Yt[e[(e[r>>2]|0)+32>>2]&63](r,e[w>>2]|0,d)|0,!!h;)if((d|0)==(h|0)){D=26;break}else d=d-h|0;if((D|0)==26){h=e[C>>2]|0;break}D=U+56|0,C=U+4|0,e[U>>2]=36160,e[D>>2]=36180,g=0,Ae(62,U+56|0,C|0),N=g,g=0,N&1&&(U=j()|0,tt(D),le(U|0)),e[U+128>>2]=0,e[U+132>>2]=-1,e[U>>2]=36200,e[U+56>>2]=36220,g=0,ue(180,C|0),N=g,g=0;do if(N&1)h=j()|0;else{if(e[C>>2]=36236,r=U+36|0,e[r>>2]=0,e[r+4>>2]=0,e[r+8>>2]=0,e[r+12>>2]=0,e[U+52>>2]=16,e[R>>2]=0,e[R+4>>2]=0,e[R+8>>2]=0,g=0,Ae(63,C|0,R|0),N=g,g=0,N&1){h=j()|0,de(R),de(r),wt(C);break}de(R),g=0,h=Ve(28,U|0,49029,57)|0,R=g,g=0,!(R&1)&&(g=0,be(36,h|0,0)|0,R=g,g=0,!(R&1))&&(w=Ct(16)|0,g=0,Ae(64,_|0,C|0),R=g,g=0,R&1?h=j()|0:(!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,H|0)|0,bt(8)),g=0,$e(36,w|0,3,35648,_|0),R=g,g=0,R&1?d=1:(g=0,xe(6,w|0,824,96),g=0,d=0),h=j()|0,de(_),d||(_=h,e[U>>2]=36200,e[D>>2]=36220,e[C>>2]=36236,de(r),wt(C),tt(D),le(_|0))),Tt(w|0),_=h,e[U>>2]=36200,e[D>>2]=36220,e[C>>2]=36236,de(r),wt(C),tt(D),le(_|0)),_=j()|0,e[U>>2]=36200,e[D>>2]=36220,e[C>>2]=36236,de(r),wt(C),tt(D),le(_|0)}while(!1);U=h,tt(D),le(U|0)}while(!1);if(d=t+20|0,(e[h+28>>2]|0)!=536870912){U=e[d>>2]|0,Vn(t,U,o,l,c),b=N;return}ti(e[d>>2]|0,ee(k,e[h+16>>2]|0)|0),U=e[d>>2]|0,Vn(t,U,o,l,c),b=N}function Kr(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0;D=t+4|0,h=e[D>>2]|0;e:do switch(e[h+16>>2]|0){case 3:{if((e[h+24>>2]|0)==2){if((l|0)<=0)break e;h=t+40|0,t=0;do C=e[h>>2]|0,w=M[r+(t*6|0)+2>>1]<>1]<>1]<>>1)&65535)>>>C&65535,I[o+(t*6|0)>>1]=d>>>C,I[o+(t*6|0)+2>>1]=w>>>C,I[o+(t*6|0)+4>>1]=c,t=t+1|0;while((t|0)!=(l|0))}else{if(d=(l|0)<(c|0)?l:c,(d|0)<=0)break e;w=c<<1,h=t+40|0,t=0;do k=e[h>>2]|0,N=M[r+(t+c<<1)>>1]<>1]<>1]<>>1)&65535)>>>k&65535,I[o+(t*6|0)>>1]=R>>>k,I[o+(t*6|0)+2>>1]=N>>>k,I[o+(t*6|0)+4>>1]=C,t=t+1|0;while((t|0)!=(d|0))}break}case 4:{if((e[h+24>>2]|0)==1&&(C=(l|0)<(c|0)?l:c,(C|0)>0)){w=c<<1,h=t+40|0,t=c*3|0,d=0;do k=e[h>>2]|0,R=M[r+(d+c<<1)>>1]<>1]<>1]<>>1)&65535)>>>k,_=I[r+(d+t<<1)>>1]|0,R=v0(R>>>k&65535|0,0,16)|0,N=ye|N,_=v0(_&65535|0,0,48)|0,_=U>>>k&65535|R|_,N=N&65535|ye,R=o+(d<<3)|0,k=R,I[k>>1]=_,I[k+2>>1]=_>>>16,R=R+4|0,I[R>>1]=N,I[R+2>>1]=N>>>16,d=d+1|0;while((d|0)!=(C|0))}break}default:}while(!1);if(h=e[D>>2]|0,!!(S[h+32>>0]|0)&&(d=e[h+16>>2]|0,!((l|0)<=0)))for(h=o,t=0;U=h+4|0,_=I[h>>1]|0,I[h>>1]=I[U>>1]|0,I[U>>1]=_,t=t+1|0,(t|0)!=(l|0);)h=h+(d<<1)|0}function Xa(t){t=t|0;var r=0,o=0,l=0;e[t>>2]=36364,r=e[t+20>>2]|0,r&&(o=t+24|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),l=e[t+8>>2]|0,l&&(r=t+12|0,o=e[r>>2]|0,(o|0)!=(l|0)&&(e[r>>2]=o+(~((o+-2-l|0)>>>1)<<1)),he(l))}function Za(t){t=t|0;var r=0,o=0,l=0;if(e[t>>2]=36364,r=e[t+20>>2]|0,r&&(o=t+24|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),l=e[t+8>>2]|0,!l){he(t);return}r=t+12|0,o=e[r>>2]|0,(o|0)!=(l|0)&&(e[r>>2]=o+(~((o+-2-l|0)>>>1)<<1)),he(l),he(t)}function Ja(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0;if(c=t+48|0,!(e[c>>2]|0)){w=t+52|0,Yr(t,r,e[w>>2]|0,o,l),e[w>>2]=(e[w>>2]|0)+(e[(e[t+4>>2]|0)+12>>2]|0);return}C=t+4|0,h=o<<1,d=ee(h,e[(e[C>>2]|0)+16>>2]|0)|0,w=t+20|0,Yr(t,r,e[w>>2]|0,o,l),r=e[C>>2]|0,(e[r+28>>2]|0)==536870912&&ti(e[w>>2]|0,ee(h,e[r+16>>2]|0)|0),C=e[c>>2]|0,(Yt[e[(e[C>>2]|0)+48>>2]&63](C,e[w>>2]|0,d)|0)!=(d|0)&&(r=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,H|0)|0,bt(8)),g=0,xe(7,r|0,3,35648),C=g,g=0,C&1?(C=j()|0,Tt(r|0),le(C|0)):Qt(r|0,824,96))}function el(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0;if(c=e[t+48>>2]|0,c){tl(t,c,r,o,l);return}else{c=t+52|0,Un(t,e[c>>2]|0,r,o,l),e[c>>2]=(e[c>>2]|0)+(e[(e[t+4>>2]|0)+12>>2]|0);return}}function Un(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0;C=t+4|0,h=e[C>>2]|0;do if(!(S[h+32>>0]|0))D=r;else{if(d=t+8|0,o0(e[d>>2]|0,r|0,l*6|0)|0,h=e[C>>2]|0,w=e[h+16>>2]|0,(l|0)<=0){D=e[d>>2]|0;break}for(r=e[d>>2]|0,h=r,d=0;D=h+4|0,k=I[h>>1]|0,I[h>>1]=I[D>>1]|0,I[D>>1]=k,d=d+1|0,(d|0)!=(l|0);)h=h+(w<<1)|0;D=r,h=e[C>>2]|0}while(!1);switch(e[h+16>>2]|0){case 3:if((e[h+24>>2]|0)==2){if((l|0)<=0)return;h=t+32|0,r=0;do c=e[h>>2]|0,t=M[D+(r*6|0)+2>>1]<>1]<>>c&65535,I[o+(r*6|0)>>1]=((M[D+(r*6|0)>>1]<>>c,I[o+(r*6|0)+2>>1]=(t&65535)>>>c,I[o+(r*6|0)+4>>1]=k,r=r+1|0;while((r|0)!=(l|0));return}else{if(d=(c|0)<(l|0)?c:l,(d|0)<=0)return;w=c<<1,h=e[t+32>>2]|0,r=0;do t=M[D+(r*6|0)+2>>1]<>1]<>>h&65535,I[o+(r<<1)>>1]=((M[D+(r*6|0)>>1]<>>h,I[o+(r+c<<1)>>1]=(t&65535)>>>h,I[o+(r+w<<1)>>1]=k,r=r+1|0;while((r|0)!=(d|0));return}case 4:{if((e[h+24>>2]|0)!=1||(w=(c|0)<(l|0)?c:l,(w|0)<=0))return;C=c<<1,d=c*3|0,h=e[t+32>>2]|0,r=0;do k=I[D+(r<<3)+6>>1]|0,l=M[D+(r<<3)+2>>1]<>1]<>>h&65535,I[o+(r<<1)>>1]=((M[D+(r<<3)>>1]<>>h,I[o+(r+c<<1)>>1]=(l&65535)>>>h,I[o+(r+C<<1)>>1]=t,I[o+(r+d<<1)>>1]=k,r=r+1|0;while((r|0)!=(w|0));return}default:return}}function tl(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0;N=b,b=b+176|0,R=N+152|0,U=N+16|0,_=N,C=t+4|0,h=e[C>>2]|0,k=l<<1,d=ee(k,e[h+16>>2]|0)|0;do if(d){for(w=t+20|0;h=Yt[e[(e[r>>2]|0)+32>>2]&63](r,e[w>>2]|0,d)|0,!!h;)if((d|0)==(h|0)){D=26;break}else d=d-h|0;if((D|0)==26){h=e[C>>2]|0;break}D=U+56|0,C=U+4|0,e[U>>2]=36160,e[D>>2]=36180,g=0,Ae(62,U+56|0,C|0),N=g,g=0,N&1&&(U=j()|0,tt(D),le(U|0)),e[U+128>>2]=0,e[U+132>>2]=-1,e[U>>2]=36200,e[U+56>>2]=36220,g=0,ue(180,C|0),N=g,g=0;do if(N&1)h=j()|0;else{if(e[C>>2]=36236,r=U+36|0,e[r>>2]=0,e[r+4>>2]=0,e[r+8>>2]=0,e[r+12>>2]=0,e[U+52>>2]=16,e[R>>2]=0,e[R+4>>2]=0,e[R+8>>2]=0,g=0,Ae(63,C|0,R|0),N=g,g=0,N&1){h=j()|0,de(R),de(r),wt(C);break}de(R),g=0,h=Ve(28,U|0,49029,57)|0,R=g,g=0,!(R&1)&&(g=0,be(36,h|0,0)|0,R=g,g=0,!(R&1))&&(w=Ct(16)|0,g=0,Ae(64,_|0,C|0),R=g,g=0,R&1?h=j()|0:(!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,H|0)|0,bt(8)),g=0,$e(36,w|0,3,35648,_|0),R=g,g=0,R&1?d=1:(g=0,xe(6,w|0,824,96),g=0,d=0),h=j()|0,de(_),d||(_=h,e[U>>2]=36200,e[D>>2]=36220,e[C>>2]=36236,de(r),wt(C),tt(D),le(_|0))),Tt(w|0),_=h,e[U>>2]=36200,e[D>>2]=36220,e[C>>2]=36236,de(r),wt(C),tt(D),le(_|0)),_=j()|0,e[U>>2]=36200,e[D>>2]=36220,e[C>>2]=36236,de(r),wt(C),tt(D),le(_|0)}while(!1);U=h,tt(D),le(U|0)}while(!1);if(d=t+20|0,(e[h+28>>2]|0)!=536870912){U=e[d>>2]|0,Un(t,U,o,l,c),b=N;return}ti(e[d>>2]|0,ee(k,e[h+16>>2]|0)|0),U=e[d>>2]|0,Un(t,U,o,l,c),b=N}function Yr(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0;D=t+4|0,h=e[D>>2]|0;e:do switch(e[h+16>>2]|0){case 3:{if((e[h+24>>2]|0)==2){if((l|0)<=0)break e;h=t+40|0,t=0;do C=e[h>>2]|0,w=M[r+(t*6|0)+2>>1]<>1]<>>C&65535,I[o+(t*6|0)>>1]=((M[r+(t*6|0)>>1]<>>C,I[o+(t*6|0)+2>>1]=(w&65535)>>>C,I[o+(t*6|0)+4>>1]=c,t=t+1|0;while((t|0)!=(l|0))}else{if(d=(l|0)<(c|0)?l:c,(d|0)<=0)break e;w=c<<1,h=t+40|0,t=0;do k=e[h>>2]|0,N=M[r+(t+c<<1)>>1]<>1]<>>k&65535,I[o+(t*6|0)>>1]=((M[r+(t<<1)>>1]<>>k,I[o+(t*6|0)+2>>1]=(N&65535)>>>k,I[o+(t*6|0)+4>>1]=C,t=t+1|0;while((t|0)!=(d|0))}break}case 4:{if((e[h+24>>2]|0)==1&&(C=(l|0)<(c|0)?l:c,(C|0)>0)){w=c<<1,h=t+40|0,t=c*3|0,d=0;do R=e[h>>2]|0,U=M[r+(d+c<<1)>>1]<>1]<>>R,k=(U+32768+(M[r+(d+w<<1)>>1]<>>R,_=I[r+(d+t<<1)>>1]|0,R=v0((U&65535)>>>R&65535|0,0,16)|0,k=k|ye,_=v0(_&65535|0,0,48)|0,_=R|N&65535|_,k=k&65535|ye,N=o+(d<<3)|0,R=N,I[R>>1]=_,I[R+2>>1]=_>>>16,N=N+4|0,I[N>>1]=k,I[N+2>>1]=k>>>16,d=d+1|0;while((d|0)!=(C|0))}break}default:}while(!1);if(h=e[D>>2]|0,!!(S[h+32>>0]|0)&&(d=e[h+16>>2]|0,!((l|0)<=0)))for(h=o,t=0;U=h+4|0,_=I[h>>1]|0,I[h>>1]=I[U>>1]|0,I[U>>1]=_,t=t+1|0,(t|0)!=(l|0);)h=h+(d<<1)|0}function Ui(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0,N=0,R=0;if(N=b,b=b+16|0,D=N,k=e[t>>2]|0,!k)return t=0,b=N,t|0;if(R=r,w=l-R|0,C=c+12|0,d=e[C>>2]|0,w=(d|0)>(w|0)?d-w|0:0,d=o,c=d-R|0,(c|0)>0&&(Yt[e[(e[k>>2]|0)+48>>2]&63](k,r,c)|0)!=(c|0))return e[t>>2]=0,R=0,b=N,R|0;do if((w|0)>0){if(dr(D,w,h),g=0,c=Ve(e[(e[k>>2]|0)+48>>2]|0,k|0,(S[D>>0]&1?e[D+8>>2]|0:D+1|0)|0,w|0)|0,R=g,g=0,R&1&&(R=j()|0,de(D),le(R|0)),(c|0)==(w|0)){de(D);break}return e[t>>2]=0,de(D),R=0,b=N,R|0}while(!1);return l=l-d|0,(l|0)>0&&(Yt[e[(e[k>>2]|0)+48>>2]&63](k,o,l)|0)!=(l|0)?(e[t>>2]=0,R=0,b=N,R|0):(e[C>>2]=0,R=k,b=N,R|0)}function il(t){t=t|0,e[t>>2]=36236,de(t+32|0),wt(t)}function nl(t){t=t|0,e[t>>2]=36236,de(t+32|0),wt(t),he(t)}function rl(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0;if(d=r+44|0,w=e[d>>2]|0,D=r+24|0,k=e[D>>2]|0,w>>>0>>0&&(e[d>>2]=k,w=k),C=w,d=h&24,!d){r=t,e[r>>2]=0,e[r+4>>2]=0,r=t+8|0,e[r>>2]=-1,e[r+4>>2]=-1;return}if((c|0)==1&(d|0)==24){r=t,e[r>>2]=0,e[r+4>>2]=0,r=t+8|0,e[r>>2]=-1,e[r+4>>2]=-1;return}e:do switch(c|0){case 0:{d=0,c=0;break}case 1:if(h&8){c=(e[r+12>>2]|0)-(e[r+8>>2]|0)|0,d=c,c=((c|0)<0)<<31>>31;break e}else{c=k-(e[r+20>>2]|0)|0,d=c,c=((c|0)<0)<<31>>31;break e}case 2:{d=r+32|0,S[d>>0]&1?d=e[r+40>>2]|0:d=d+1|0,c=w-d|0,d=c,c=((c|0)<0)<<31>>31;break}default:{r=t,e[r>>2]=0,e[r+4>>2]=0,r=t+8|0,e[r>>2]=-1,e[r+4>>2]=-1;return}}while(!1);if(c=$0(d|0,c|0,o|0,l|0)|0,o=ye,(o|0)>=0&&(d=r+32|0,S[d>>0]&1?d=e[r+40>>2]|0:d=d+1|0,l=w-d|0,w=((l|0)<0)<<31>>31,!((w|0)<(o|0)|(w|0)==(o|0)&l>>>0>>0))){if(d=h&8,!((c|0)==0&(o|0)==0)){if(d|0&&!(e[r+12>>2]|0)){r=t,e[r>>2]=0,e[r+4>>2]=0,r=t+8|0,e[r>>2]=-1,e[r+4>>2]=-1;return}if((h&16|0)!=0&(k|0)==0){r=t,e[r>>2]=0,e[r+4>>2]=0,r=t+8|0,e[r>>2]=-1,e[r+4>>2]=-1;return}}d&&(e[r+12>>2]=(e[r+8>>2]|0)+c,e[r+16>>2]=C),h&16&&(e[D>>2]=(e[r+20>>2]|0)+c),r=t,e[r>>2]=0,e[r+4>>2]=0,r=t+8|0,e[r>>2]=c,e[r+4>>2]=o;return}r=t,e[r>>2]=0,e[r+4>>2]=0,r=t+8|0,e[r>>2]=-1,e[r+4>>2]=-1}function sl(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0,o=o+8|0,Vi[e[(e[r>>2]|0)+16>>2]&15](t,r,e[o>>2]|0,e[o+4>>2]|0,0,l)}function ol(t){t=t|0;var r=0,o=0,l=0,c=0;return r=t+44|0,o=e[r>>2]|0,l=e[t+24>>2]|0,o>>>0>>0&&(e[r>>2]=l,o=l),!(e[t+48>>2]&8)||(c=t+16|0,r=e[c>>2]|0,l=t+12|0,r>>>0>>0?(l=e[l>>2]|0,e[c>>2]=o,r=o):l=e[l>>2]|0,l>>>0>=r>>>0)?(t=-1,t|0):(t=F[l>>0]|0,t|0)}function al(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0;if(l=t+44|0,o=e[l>>2]|0,c=e[t+24>>2]|0,o>>>0>>0&&(e[l>>2]=c,o=c),w=t+8|0,l=e[w>>2]|0,C=t+12|0,h=e[C>>2]|0,d=l,l>>>0>=h>>>0)return t=-1,t|0;if((r|0)==-1)return e[w>>2]=l,e[C>>2]=h+-1,e[t+16>>2]=o,t=0,t|0;if(e[t+48>>2]&16)c=r&255,l=h+-1|0;else if(c=r&255,l=h+-1|0,c<<24>>24!=(S[l>>0]|0))return t=-1,t|0;return e[w>>2]=d,e[C>>2]=l,e[t+16>>2]=o,S[l>>0]=c,t=r,t|0}function ll(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0;if(Q=b,b=b+16|0,k=Q,(r|0)==-1)return t=0,b=Q,t|0;N=t+12|0,R=t+8|0,_=(e[N>>2]|0)-(e[R>>2]|0)|0,U=t+24|0,o=e[U>>2]|0,D=t+28|0,l=e[D>>2]|0;do if((o|0)==(l|0)){if(w=t+48|0,!(e[w>>2]&16))return t=-1,b=Q,t|0;if(C=t+20|0,d=e[C>>2]|0,c=o-d|0,h=t+44|0,d=(e[h>>2]|0)-d|0,l=t+32|0,g=0,Ae(67,l|0,0),o=g,g=0,!(o&1)&&(S[l>>0]&1?o=(e[l>>2]&-2)+-1|0:o=10,g=0,xe(8,l|0,o|0,0),o=g,g=0,!(o&1))){o=S[l>>0]|0,o&1?(l=e[t+40>>2]|0,o=e[t+36>>2]|0):(l=l+1|0,o=(o&255)>>>1),K=l+o|0,e[C>>2]=l,e[D>>2]=K,C=l+c|0,e[U>>2]=C,o=l+d|0,e[h>>2]=o,l=K;break}return K=j(0)|0,K0(K|0)|0,ei(),K=-1,b=Q,K|0}else K=t+44|0,w=t+48|0,h=K,C=o,o=e[K>>2]|0;while(!1);return d=C+1|0,e[k>>2]=d,c=e[(d>>>0>>0?h:k)>>2]|0,e[h>>2]=c,e[w>>2]&8&&(o=t+32|0,S[o>>0]&1?o=e[t+40>>2]|0:o=o+1|0,e[R>>2]=o,e[N>>2]=o+_,e[t+16>>2]=c),(C|0)==(l|0)?(K=U0[e[(e[t>>2]|0)+52>>2]&63](t,r&255)|0,b=Q,K|0):(e[U>>2]=d,S[C>>0]=r,K=r&255,b=Q,K|0)}function ul(t){t=t|0;var r=0,o=0;e[t>>2]=36200,r=t+56|0,e[r>>2]=36220,o=t+4|0,e[o>>2]=36236,de(t+36|0),wt(o),tt(r)}function cl(t){t=t|0;var r=0,o=0;e[t>>2]=36200,r=t+56|0,e[r>>2]=36220,o=t+4|0,e[o>>2]=36236,de(t+36|0),wt(o),tt(r),he(t)}function hl(t){t=t|0;var r=0,o=0,l=0,c=0;c=e[(e[t>>2]|0)+-12>>2]|0,r=t+c|0,e[r>>2]=36200,o=t+(c+56)|0,e[o>>2]=36220,l=t+(c+4)|0,e[l>>2]=36236,de(t+(c+36)|0),wt(l),tt(o),he(r)}function dl(t){t=t|0;var r=0,o=0,l=0;e[t>>2]=36388,r=e[t+20>>2]|0,r&&(o=t+24|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),l=e[t+8>>2]|0,l&&(r=t+12|0,o=e[r>>2]|0,(o|0)!=(l|0)&&(e[r>>2]=o+(~((o+-2-l|0)>>>1)<<1)),he(l))}function pl(t){t=t|0;var r=0,o=0,l=0;if(e[t>>2]=36388,r=e[t+20>>2]|0,r&&(o=t+24|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),l=e[t+8>>2]|0,!l){he(t);return}r=t+12|0,o=e[r>>2]|0,(o|0)!=(l|0)&&(e[r>>2]=o+(~((o+-2-l|0)>>>1)<<1)),he(l),he(t)}function ml(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0;if(c=t+36|0,!(e[c>>2]|0)){w=t+40|0,jr(t,r,e[w>>2]|0,o,l),e[w>>2]=(e[w>>2]|0)+(e[(e[t+4>>2]|0)+12>>2]|0);return}C=t+4|0,h=o<<1,d=ee(h,e[(e[C>>2]|0)+16>>2]|0)|0,w=t+20|0,jr(t,r,e[w>>2]|0,o,l),r=e[C>>2]|0,(e[r+28>>2]|0)==536870912&&ti(e[w>>2]|0,ee(h,e[r+16>>2]|0)|0),C=e[c>>2]|0,(Yt[e[(e[C>>2]|0)+48>>2]&63](C,e[w>>2]|0,d)|0)!=(d|0)&&(r=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,H|0)|0,bt(8)),g=0,xe(7,r|0,3,35648),C=g,g=0,C&1?(C=j()|0,Tt(r|0),le(C|0)):Qt(r|0,824,96))}function gl(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0;if(c=e[t+36>>2]|0,c){Sl(t,c,r,o,l);return}else{c=t+40|0,zn(t,e[c>>2]|0,r,o,l),e[c>>2]=(e[c>>2]|0)+(e[(e[t+4>>2]|0)+12>>2]|0);return}}function zn(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0;w=t+4|0,h=e[w>>2]|0;do if(!(S[h+32>>0]|0))C=r;else{if(t=t+8|0,o0(e[t>>2]|0,r|0,l*6|0)|0,h=e[w>>2]|0,d=e[h+16>>2]|0,(l|0)<=0){C=e[t>>2]|0;break}for(t=e[t>>2]|0,h=t,r=0;C=h+4|0,D=I[h>>1]|0,I[h>>1]=I[C>>1]|0,I[C>>1]=D,r=r+1|0,(r|0)!=(l|0);)h=h+(d<<1)|0;C=t,h=e[w>>2]|0}while(!1);switch(e[h+16>>2]|0){case 3:{if((e[h+24>>2]|0)==2){if((l|0)>0)h=0;else return;do w=M[C+(h*6|0)+2>>1]|0,c=32768-w+(M[C+(h*6|0)+4>>1]|0)|0,D=(M[C+(h*6|0)>>1]|0)-w+32768|0,I[o+(h*6|0)>>1]=w+49152+(((c&65535)+(D&65535)|0)>>>2),I[o+(h*6|0)+2>>1]=c,I[o+(h*6|0)+4>>1]=D,h=h+1|0;while((h|0)!=(l|0));return}if(h=(c|0)<(l|0)?c:l,(h|0)<=0)return;t=c<<1,r=0;do w=M[C+(r*6|0)+2>>1]|0,l=32768-w+(M[C+(r*6|0)+4>>1]|0)|0,D=(M[C+(r*6|0)>>1]|0)-w+32768|0,I[o+(r<<1)>>1]=w+49152+(((l&65535)+(D&65535)|0)>>>2),I[o+(r+c<<1)>>1]=l,I[o+(r+t<<1)>>1]=D,r=r+1|0;while((r|0)!=(h|0));return}case 4:{if((e[h+24>>2]|0)!=1||(h=(c|0)<(l|0)?c:l,(h|0)<=0))return;t=c<<1,r=c*3|0,d=0;do D=I[C+(d<<3)+6>>1]|0,k=M[C+(d<<3)+2>>1]|0,w=32768-k+(M[C+(d<<3)+4>>1]|0)|0,l=(M[C+(d<<3)>>1]|0)-k+32768|0,I[o+(d<<1)>>1]=k+49152+(((w&65535)+(l&65535)|0)>>>2),I[o+(d+c<<1)>>1]=w,I[o+(d+t<<1)>>1]=l,I[o+(d+r<<1)>>1]=D,d=d+1|0;while((d|0)!=(h|0));return}default:return}}function Sl(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0;N=b,b=b+176|0,R=N+152|0,U=N+16|0,_=N,C=t+4|0,h=e[C>>2]|0,k=l<<1,d=ee(k,e[h+16>>2]|0)|0;do if(d){for(w=t+20|0;h=Yt[e[(e[r>>2]|0)+32>>2]&63](r,e[w>>2]|0,d)|0,!!h;)if((d|0)==(h|0)){D=26;break}else d=d-h|0;if((D|0)==26){h=e[C>>2]|0;break}D=U+56|0,C=U+4|0,e[U>>2]=36160,e[D>>2]=36180,g=0,Ae(62,U+56|0,C|0),N=g,g=0,N&1&&(U=j()|0,tt(D),le(U|0)),e[U+128>>2]=0,e[U+132>>2]=-1,e[U>>2]=36200,e[U+56>>2]=36220,g=0,ue(180,C|0),N=g,g=0;do if(N&1)h=j()|0;else{if(e[C>>2]=36236,r=U+36|0,e[r>>2]=0,e[r+4>>2]=0,e[r+8>>2]=0,e[r+12>>2]=0,e[U+52>>2]=16,e[R>>2]=0,e[R+4>>2]=0,e[R+8>>2]=0,g=0,Ae(63,C|0,R|0),N=g,g=0,N&1){h=j()|0,de(R),de(r),wt(C);break}de(R),g=0,h=Ve(28,U|0,49029,57)|0,R=g,g=0,!(R&1)&&(g=0,be(36,h|0,0)|0,R=g,g=0,!(R&1))&&(w=Ct(16)|0,g=0,Ae(64,_|0,C|0),R=g,g=0,R&1?h=j()|0:(!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,H|0)|0,bt(8)),g=0,$e(36,w|0,3,35648,_|0),R=g,g=0,R&1?d=1:(g=0,xe(6,w|0,824,96),g=0,d=0),h=j()|0,de(_),d||(_=h,e[U>>2]=36200,e[D>>2]=36220,e[C>>2]=36236,de(r),wt(C),tt(D),le(_|0))),Tt(w|0),_=h,e[U>>2]=36200,e[D>>2]=36220,e[C>>2]=36236,de(r),wt(C),tt(D),le(_|0)),_=j()|0,e[U>>2]=36200,e[D>>2]=36220,e[C>>2]=36236,de(r),wt(C),tt(D),le(_|0)}while(!1);U=h,tt(D),le(U|0)}while(!1);if(d=t+20|0,(e[h+28>>2]|0)!=536870912){U=e[d>>2]|0,zn(t,U,o,l,c),b=N;return}ti(e[d>>2]|0,ee(k,e[h+16>>2]|0)|0),U=e[d>>2]|0,zn(t,U,o,l,c),b=N}function jr(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0;C=t+4|0,t=e[C>>2]|0;e:do switch(e[t+16>>2]|0){case 3:{if((e[t+24>>2]|0)==2){if((l|0)>0)t=0;else break e;for(;;)if(w=M[r+(t*6|0)+2>>1]|0,d=M[r+(t*6|0)+4>>1]|0,c=(M[r+(t*6|0)>>1]|0)-((d+w|0)>>>2)+16384|0,I[o+(t*6|0)>>1]=d+32768+c,I[o+(t*6|0)+2>>1]=c,I[o+(t*6|0)+4>>1]=w+32768+c,t=t+1|0,(t|0)==(l|0))break e}if(t=(l|0)<(c|0)?l:c,(t|0)>0){h=c<<1,d=0;do D=M[r+(d+c<<1)>>1]|0,k=M[r+(d+h<<1)>>1]|0,w=(M[r+(d<<1)>>1]|0)-((k+D|0)>>>2)+16384|0,I[o+(d*6|0)>>1]=k+32768+w,I[o+(d*6|0)+2>>1]=w,I[o+(d*6|0)+4>>1]=D+32768+w,d=d+1|0;while((d|0)!=(t|0))}break}case 4:{if((e[t+24>>2]|0)==1&&(w=(l|0)<(c|0)?l:c,(w|0)>0)){t=c<<1,h=c*3|0,d=0;do D=M[r+(d+c<<1)>>1]|0,N=M[r+(d+t<<1)>>1]|0,k=(M[r+(d<<1)>>1]|0)-((N+D|0)>>>2)+16384|0,R=I[r+(d+h<<1)>>1]|0,_=v0(k&65535|0,0,16)|0,D=D+32768+k|ye,R=v0(R&65535|0,0,48)|0,R=_|N+32768+k&65535|R,D=D&65535|ye,k=o+(d<<3)|0,N=k,I[N>>1]=R,I[N+2>>1]=R>>>16,k=k+4|0,I[k>>1]=D,I[k+2>>1]=D>>>16,d=d+1|0;while((d|0)!=(w|0))}break}default:}while(!1);if(t=e[C>>2]|0,!!(S[t+32>>0]|0)&&(d=e[t+16>>2]|0,!((l|0)<=0)))for(t=o,h=0;_=t+4|0,R=I[t>>1]|0,I[t>>1]=I[_>>1]|0,I[_>>1]=R,h=h+1|0,(h|0)!=(l|0);)t=t+(d<<1)|0}function Al(t){t=t|0;var r=0,o=0,l=0;e[t>>2]=36412,r=e[t+20>>2]|0,r&&(o=t+24|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),l=e[t+8>>2]|0,l&&(r=t+12|0,o=e[r>>2]|0,(o|0)!=(l|0)&&(e[r>>2]=o+(~((o+-2-l|0)>>>1)<<1)),he(l))}function vl(t){t=t|0;var r=0,o=0,l=0;if(e[t>>2]=36412,r=e[t+20>>2]|0,r&&(o=t+24|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),l=e[t+8>>2]|0,!l){he(t);return}r=t+12|0,o=e[r>>2]|0,(o|0)!=(l|0)&&(e[r>>2]=o+(~((o+-2-l|0)>>>1)<<1)),he(l),he(t)}function xl(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0;if(c=t+36|0,!(e[c>>2]|0)){w=t+40|0,Xr(t,r,e[w>>2]|0,o,l),e[w>>2]=(e[w>>2]|0)+(e[(e[t+4>>2]|0)+12>>2]|0);return}C=t+4|0,h=o<<1,d=ee(h,e[(e[C>>2]|0)+16>>2]|0)|0,w=t+20|0,Xr(t,r,e[w>>2]|0,o,l),r=e[C>>2]|0,(e[r+28>>2]|0)==536870912&&ti(e[w>>2]|0,ee(h,e[r+16>>2]|0)|0),C=e[c>>2]|0,(Yt[e[(e[C>>2]|0)+48>>2]&63](C,e[w>>2]|0,d)|0)!=(d|0)&&(r=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,H|0)|0,bt(8)),g=0,xe(7,r|0,3,35648),C=g,g=0,C&1?(C=j()|0,Tt(r|0),le(C|0)):Qt(r|0,824,96))}function wl(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0;if(c=e[t+36>>2]|0,c){yl(t,c,r,o,l);return}else{c=t+40|0,Gn(t,e[c>>2]|0,r,o,l),e[c>>2]=(e[c>>2]|0)+(e[(e[t+4>>2]|0)+12>>2]|0);return}}function Gn(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0;w=t+4|0,h=e[w>>2]|0;do if(!(S[h+32>>0]|0))C=r;else{if(t=t+8|0,o0(e[t>>2]|0,r|0,l*6|0)|0,h=e[w>>2]|0,d=e[h+16>>2]|0,(l|0)<=0){C=e[t>>2]|0;break}for(t=e[t>>2]|0,h=t,r=0;C=h+4|0,D=I[h>>1]|0,I[h>>1]=I[C>>1]|0,I[C>>1]=D,r=r+1|0,(r|0)!=(l|0);)h=h+(d<<1)|0;C=t,h=e[w>>2]|0}while(!1);switch(e[h+16>>2]|0){case 3:{if((e[h+24>>2]|0)==2){if((l|0)>0)h=0;else return;do d=M[C+(h*6|0)>>1]|0,c=I[C+(h*6|0)+2>>1]|0,w=c&65535,D=(M[C+(h*6|0)+4>>1]|0)+32768-((w+d|0)>>>1)&65535,I[o+(h*6|0)>>1]=d+32768-w,I[o+(h*6|0)+2>>1]=c,I[o+(h*6|0)+4>>1]=D,h=h+1|0;while((h|0)!=(l|0));return}if(h=(c|0)<(l|0)?c:l,(h|0)<=0)return;t=c<<1,r=0;do l=I[C+(r*6|0)+2>>1]|0,d=M[C+(r*6|0)>>1]|0,w=l&65535,D=(M[C+(r*6|0)+4>>1]|0)+32768-((w+d|0)>>>1)&65535,I[o+(r<<1)>>1]=d+32768-w,I[o+(r+c<<1)>>1]=l,I[o+(r+t<<1)>>1]=D,r=r+1|0;while((r|0)!=(h|0));return}case 4:{if((e[h+24>>2]|0)!=1||(h=(c|0)<(l|0)?c:l,(h|0)<=0))return;t=c<<1,r=c*3|0,d=0;do w=I[C+(d<<3)+2>>1]|0,D=I[C+(d<<3)+6>>1]|0,N=M[C+(d<<3)>>1]|0,k=w&65535,l=(M[C+(d<<3)+4>>1]|0)+32768-((k+N|0)>>>1)&65535,I[o+(d<<1)>>1]=N+32768-k,I[o+(d+c<<1)>>1]=w,I[o+(d+t<<1)>>1]=l,I[o+(d+r<<1)>>1]=D,d=d+1|0;while((d|0)!=(h|0));return}default:return}}function yl(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0;N=b,b=b+176|0,R=N+152|0,U=N+16|0,_=N,C=t+4|0,h=e[C>>2]|0,k=l<<1,d=ee(k,e[h+16>>2]|0)|0;do if(d){for(w=t+20|0;h=Yt[e[(e[r>>2]|0)+32>>2]&63](r,e[w>>2]|0,d)|0,!!h;)if((d|0)==(h|0)){D=26;break}else d=d-h|0;if((D|0)==26){h=e[C>>2]|0;break}D=U+56|0,C=U+4|0,e[U>>2]=36160,e[D>>2]=36180,g=0,Ae(62,U+56|0,C|0),N=g,g=0,N&1&&(U=j()|0,tt(D),le(U|0)),e[U+128>>2]=0,e[U+132>>2]=-1,e[U>>2]=36200,e[U+56>>2]=36220,g=0,ue(180,C|0),N=g,g=0;do if(N&1)h=j()|0;else{if(e[C>>2]=36236,r=U+36|0,e[r>>2]=0,e[r+4>>2]=0,e[r+8>>2]=0,e[r+12>>2]=0,e[U+52>>2]=16,e[R>>2]=0,e[R+4>>2]=0,e[R+8>>2]=0,g=0,Ae(63,C|0,R|0),N=g,g=0,N&1){h=j()|0,de(R),de(r),wt(C);break}de(R),g=0,h=Ve(28,U|0,49029,57)|0,R=g,g=0,!(R&1)&&(g=0,be(36,h|0,0)|0,R=g,g=0,!(R&1))&&(w=Ct(16)|0,g=0,Ae(64,_|0,C|0),R=g,g=0,R&1?h=j()|0:(!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,H|0)|0,bt(8)),g=0,$e(36,w|0,3,35648,_|0),R=g,g=0,R&1?d=1:(g=0,xe(6,w|0,824,96),g=0,d=0),h=j()|0,de(_),d||(_=h,e[U>>2]=36200,e[D>>2]=36220,e[C>>2]=36236,de(r),wt(C),tt(D),le(_|0))),Tt(w|0),_=h,e[U>>2]=36200,e[D>>2]=36220,e[C>>2]=36236,de(r),wt(C),tt(D),le(_|0)),_=j()|0,e[U>>2]=36200,e[D>>2]=36220,e[C>>2]=36236,de(r),wt(C),tt(D),le(_|0)}while(!1);U=h,tt(D),le(U|0)}while(!1);if(d=t+20|0,(e[h+28>>2]|0)!=536870912){U=e[d>>2]|0,Gn(t,U,o,l,c),b=N;return}ti(e[d>>2]|0,ee(k,e[h+16>>2]|0)|0),U=e[d>>2]|0,Gn(t,U,o,l,c),b=N}function Xr(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0;C=t+4|0,t=e[C>>2]|0;e:do switch(e[t+16>>2]|0){case 3:{if((e[t+24>>2]|0)==2){if((l|0)>0)t=0;else break e;for(;;)if(w=I[r+(t*6|0)+2>>1]|0,c=w&65535,d=(M[r+(t*6|0)>>1]|0)+32768+c|0,c=(M[r+(t*6|0)+4>>1]|0)+32768+(((d&65535)+c|0)>>>1)&65535,I[o+(t*6|0)>>1]=d,I[o+(t*6|0)+2>>1]=w,I[o+(t*6|0)+4>>1]=c,t=t+1|0,(t|0)==(l|0))break e}if(t=(l|0)<(c|0)?l:c,(t|0)>0){h=c<<1,d=0;do D=I[r+(d+c<<1)>>1]|0,w=D&65535,k=(M[r+(d<<1)>>1]|0)+32768+w|0,w=(M[r+(d+h<<1)>>1]|0)+32768+(((k&65535)+w|0)>>>1)&65535,I[o+(d*6|0)>>1]=k,I[o+(d*6|0)+2>>1]=D,I[o+(d*6|0)+4>>1]=w,d=d+1|0;while((d|0)!=(t|0))}break}case 4:{if((e[t+24>>2]|0)==1&&(w=(l|0)<(c|0)?l:c,(w|0)>0)){t=c<<1,h=c*3|0,d=0;do k=I[r+(d+c<<1)>>1]|0,D=k&65535,N=(M[r+(d<<1)>>1]|0)+32768+D&65535,D=(M[r+(d+t<<1)>>1]|0)+32768+((N+D|0)>>>1)|0,R=I[r+(d+h<<1)>>1]|0,k=v0(k&65535|0,0,16)|0,D=ye|D,R=v0(R&65535|0,0,48)|0,R=N|k|R,D=D&65535|ye,k=o+(d<<3)|0,N=k,I[N>>1]=R,I[N+2>>1]=R>>>16,k=k+4|0,I[k>>1]=D,I[k+2>>1]=D>>>16,d=d+1|0;while((d|0)!=(w|0))}break}default:}while(!1);if(t=e[C>>2]|0,!!(S[t+32>>0]|0)&&(d=e[t+16>>2]|0,!((l|0)<=0)))for(t=o,h=0;R=t+4|0,N=I[t>>1]|0,I[t>>1]=I[R>>1]|0,I[R>>1]=N,h=h+1|0,(h|0)!=(l|0);)t=t+(d<<1)|0}function Cl(t){t=t|0;var r=0,o=0,l=0;e[t>>2]=36436,r=e[t+20>>2]|0,r&&(o=t+24|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),l=e[t+8>>2]|0,l&&(r=t+12|0,o=e[r>>2]|0,(o|0)!=(l|0)&&(e[r>>2]=o+(~((o+-2-l|0)>>>1)<<1)),he(l))}function Tl(t){t=t|0;var r=0,o=0,l=0;if(e[t>>2]=36436,r=e[t+20>>2]|0,r&&(o=t+24|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),l=e[t+8>>2]|0,!l){he(t);return}r=t+12|0,o=e[r>>2]|0,(o|0)!=(l|0)&&(e[r>>2]=o+(~((o+-2-l|0)>>>1)<<1)),he(l),he(t)}function Il(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0;if(c=t+36|0,!(e[c>>2]|0)){w=t+40|0,Zr(t,r,e[w>>2]|0,o,l),e[w>>2]=(e[w>>2]|0)+(e[(e[t+4>>2]|0)+12>>2]|0);return}C=t+4|0,h=o<<1,d=ee(h,e[(e[C>>2]|0)+16>>2]|0)|0,w=t+20|0,Zr(t,r,e[w>>2]|0,o,l),r=e[C>>2]|0,(e[r+28>>2]|0)==536870912&&ti(e[w>>2]|0,ee(h,e[r+16>>2]|0)|0),C=e[c>>2]|0,(Yt[e[(e[C>>2]|0)+48>>2]&63](C,e[w>>2]|0,d)|0)!=(d|0)&&(r=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,H|0)|0,bt(8)),g=0,xe(7,r|0,3,35648),C=g,g=0,C&1?(C=j()|0,Tt(r|0),le(C|0)):Qt(r|0,824,96))}function El(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0;if(c=e[t+36>>2]|0,c){kl(t,c,r,o,l);return}else{c=t+40|0,qn(t,e[c>>2]|0,r,o,l),e[c>>2]=(e[c>>2]|0)+(e[(e[t+4>>2]|0)+12>>2]|0);return}}function qn(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0;w=t+4|0,h=e[w>>2]|0;do if(!(S[h+32>>0]|0))C=r;else{if(t=t+8|0,o0(e[t>>2]|0,r|0,l*6|0)|0,h=e[w>>2]|0,d=e[h+16>>2]|0,(l|0)<=0){C=e[t>>2]|0;break}for(t=e[t>>2]|0,h=t,r=0;C=h+4|0,D=I[h>>1]|0,I[h>>1]=I[C>>1]|0,I[C>>1]=D,r=r+1|0,(r|0)!=(l|0);)h=h+(d<<1)|0;C=t,h=e[w>>2]|0}while(!1);switch(e[h+16>>2]|0){case 3:{if((e[h+24>>2]|0)==2){if((l|0)>0)h=0;else return;do c=I[C+(h*6|0)+2>>1]|0,w=c&65535,D=32768-w+(M[C+(h*6|0)+4>>1]|0)&65535,I[o+(h*6|0)>>1]=(M[C+(h*6|0)>>1]|0)+32768-w,I[o+(h*6|0)+2>>1]=c,I[o+(h*6|0)+4>>1]=D,h=h+1|0;while((h|0)!=(l|0));return}if(h=(c|0)<(l|0)?c:l,(h|0)<=0)return;t=c<<1,r=0;do l=I[C+(r*6|0)+2>>1]|0,w=l&65535,D=32768-w+(M[C+(r*6|0)+4>>1]|0)&65535,I[o+(r<<1)>>1]=(M[C+(r*6|0)>>1]|0)+32768-w,I[o+(r+c<<1)>>1]=l,I[o+(r+t<<1)>>1]=D,r=r+1|0;while((r|0)!=(h|0));return}case 4:{if((e[h+24>>2]|0)!=1||(h=(c|0)<(l|0)?c:l,(h|0)<=0))return;t=c<<1,r=c*3|0,d=0;do w=I[C+(d<<3)+2>>1]|0,D=I[C+(d<<3)+6>>1]|0,k=w&65535,l=32768-k+(M[C+(d<<3)+4>>1]|0)&65535,I[o+(d<<1)>>1]=(M[C+(d<<3)>>1]|0)+32768-k,I[o+(d+c<<1)>>1]=w,I[o+(d+t<<1)>>1]=l,I[o+(d+r<<1)>>1]=D,d=d+1|0;while((d|0)!=(h|0));return}default:return}}function kl(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0;N=b,b=b+176|0,R=N+152|0,U=N+16|0,_=N,C=t+4|0,h=e[C>>2]|0,k=l<<1,d=ee(k,e[h+16>>2]|0)|0;do if(d){for(w=t+20|0;h=Yt[e[(e[r>>2]|0)+32>>2]&63](r,e[w>>2]|0,d)|0,!!h;)if((d|0)==(h|0)){D=26;break}else d=d-h|0;if((D|0)==26){h=e[C>>2]|0;break}D=U+56|0,C=U+4|0,e[U>>2]=36160,e[D>>2]=36180,g=0,Ae(62,U+56|0,C|0),N=g,g=0,N&1&&(U=j()|0,tt(D),le(U|0)),e[U+128>>2]=0,e[U+132>>2]=-1,e[U>>2]=36200,e[U+56>>2]=36220,g=0,ue(180,C|0),N=g,g=0;do if(N&1)h=j()|0;else{if(e[C>>2]=36236,r=U+36|0,e[r>>2]=0,e[r+4>>2]=0,e[r+8>>2]=0,e[r+12>>2]=0,e[U+52>>2]=16,e[R>>2]=0,e[R+4>>2]=0,e[R+8>>2]=0,g=0,Ae(63,C|0,R|0),N=g,g=0,N&1){h=j()|0,de(R),de(r),wt(C);break}de(R),g=0,h=Ve(28,U|0,49029,57)|0,R=g,g=0,!(R&1)&&(g=0,be(36,h|0,0)|0,R=g,g=0,!(R&1))&&(w=Ct(16)|0,g=0,Ae(64,_|0,C|0),R=g,g=0,R&1?h=j()|0:(!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,H|0)|0,bt(8)),g=0,$e(36,w|0,3,35648,_|0),R=g,g=0,R&1?d=1:(g=0,xe(6,w|0,824,96),g=0,d=0),h=j()|0,de(_),d||(_=h,e[U>>2]=36200,e[D>>2]=36220,e[C>>2]=36236,de(r),wt(C),tt(D),le(_|0))),Tt(w|0),_=h,e[U>>2]=36200,e[D>>2]=36220,e[C>>2]=36236,de(r),wt(C),tt(D),le(_|0)),_=j()|0,e[U>>2]=36200,e[D>>2]=36220,e[C>>2]=36236,de(r),wt(C),tt(D),le(_|0)}while(!1);U=h,tt(D),le(U|0)}while(!1);if(d=t+20|0,(e[h+28>>2]|0)!=536870912){U=e[d>>2]|0,qn(t,U,o,l,c),b=N;return}ti(e[d>>2]|0,ee(k,e[h+16>>2]|0)|0),U=e[d>>2]|0,qn(t,U,o,l,c),b=N}function Zr(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0;C=t+4|0,t=e[C>>2]|0;e:do switch(e[t+16>>2]|0){case 3:{if((e[t+24>>2]|0)==2){if((l|0)>0)t=0;else break e;for(;;)if(w=I[r+(t*6|0)+2>>1]|0,d=w&65535,c=d+32768+(M[r+(t*6|0)+4>>1]|0)&65535,I[o+(t*6|0)>>1]=(M[r+(t*6|0)>>1]|0)+32768+d,I[o+(t*6|0)+2>>1]=w,I[o+(t*6|0)+4>>1]=c,t=t+1|0,(t|0)==(l|0))break e}if(t=(l|0)<(c|0)?l:c,(t|0)>0){h=c<<1,d=0;do D=I[r+(d+c<<1)>>1]|0,k=D&65535,w=k+32768+(M[r+(d+h<<1)>>1]|0)&65535,I[o+(d*6|0)>>1]=(M[r+(d<<1)>>1]|0)+32768+k,I[o+(d*6|0)+2>>1]=D,I[o+(d*6|0)+4>>1]=w,d=d+1|0;while((d|0)!=(t|0))}break}case 4:{if((e[t+24>>2]|0)==1&&(w=(l|0)<(c|0)?l:c,(w|0)>0)){t=c<<1,h=c*3|0,d=0;do k=I[r+(d+c<<1)>>1]|0,D=k&65535,N=(M[r+(d<<1)>>1]|0)+32768+D|0,D=D+32768+(M[r+(d+t<<1)>>1]|0)|0,R=I[r+(d+h<<1)>>1]|0,k=v0(k&65535|0,0,16)|0,D=ye|D,R=v0(R&65535|0,0,48)|0,R=N&65535|k|R,D=D&65535|ye,k=o+(d<<3)|0,N=k,I[N>>1]=R,I[N+2>>1]=R>>>16,k=k+4|0,I[k>>1]=D,I[k+2>>1]=D>>>16,d=d+1|0;while((d|0)!=(w|0))}break}default:}while(!1);if(t=e[C>>2]|0,!!(S[t+32>>0]|0)&&(d=e[t+16>>2]|0,!((l|0)<=0)))for(t=o,h=0;R=t+4|0,N=I[t>>1]|0,I[t>>1]=I[R>>1]|0,I[R>>1]=N,h=h+1|0,(h|0)!=(l|0);)t=t+(d<<1)|0}function Dl(t){t=t|0;var r=0,o=0,l=0;e[t>>2]=36460,r=e[t+20>>2]|0,r&&(o=t+24|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),l=e[t+8>>2]|0,l&&(r=t+12|0,o=e[r>>2]|0,(o|0)!=(l|0)&&(e[r>>2]=o+(~((o+-2-l|0)>>>1)<<1)),he(l))}function bl(t){t=t|0;var r=0,o=0,l=0;if(e[t>>2]=36460,r=e[t+20>>2]|0,r&&(o=t+24|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),l=e[t+8>>2]|0,!l){he(t);return}r=t+12|0,o=e[r>>2]|0,(o|0)!=(l|0)&&(e[r>>2]=o+(~((o+-2-l|0)>>>1)<<1)),he(l),he(t)}function Nl(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0;if(c=t+36|0,!(e[c>>2]|0)){w=t+40|0,Jr(t,r,e[w>>2]|0,o,l),e[w>>2]=(e[w>>2]|0)+(e[(e[t+4>>2]|0)+12>>2]|0);return}C=t+4|0,h=o<<1,d=ee(h,e[(e[C>>2]|0)+16>>2]|0)|0,w=t+20|0,Jr(t,r,e[w>>2]|0,o,l),r=e[C>>2]|0,(e[r+28>>2]|0)==536870912&&ti(e[w>>2]|0,ee(h,e[r+16>>2]|0)|0),C=e[c>>2]|0,(Yt[e[(e[C>>2]|0)+48>>2]&63](C,e[w>>2]|0,d)|0)!=(d|0)&&(r=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,H|0)|0,bt(8)),g=0,xe(7,r|0,3,35648),C=g,g=0,C&1?(C=j()|0,Tt(r|0),le(C|0)):Qt(r|0,824,96))}function Fl(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0;if(c=e[t+36>>2]|0,c){Rl(t,c,r,o,l);return}else{c=t+40|0,Wn(t,e[c>>2]|0,r,o,l),e[c>>2]=(e[c>>2]|0)+(e[(e[t+4>>2]|0)+12>>2]|0);return}}function Wn(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0;w=t+4|0,h=e[w>>2]|0;do if(!(S[h+32>>0]|0))C=r;else{if(t=t+8|0,o0(e[t>>2]|0,r|0,l*6|0)|0,h=e[w>>2]|0,d=e[h+16>>2]|0,(l|0)<=0){C=e[t>>2]|0;break}for(t=e[t>>2]|0,h=t,r=0;C=h+4|0,D=I[h>>1]|0,I[h>>1]=I[C>>1]|0,I[C>>1]=D,r=r+1|0,(r|0)!=(l|0);)h=h+(d<<1)|0;C=t,h=e[w>>2]|0}while(!1);switch(e[h+16>>2]|0){case 3:{if((e[h+24>>2]|0)==2){if((l|0)>0)h=0;else return;do c=I[C+(h*6|0)+2>>1]|0,D=I[C+(h*6|0)+4>>1]|0,I[o+(h*6|0)>>1]=I[C+(h*6|0)>>1]|0,I[o+(h*6|0)+2>>1]=c,I[o+(h*6|0)+4>>1]=D,h=h+1|0;while((h|0)!=(l|0));return}if(h=(c|0)<(l|0)?c:l,(h|0)<=0)return;t=c<<1,r=0;do l=I[C+(r*6|0)+2>>1]|0,D=I[C+(r*6|0)+4>>1]|0,I[o+(r<<1)>>1]=I[C+(r*6|0)>>1]|0,I[o+(r+c<<1)>>1]=l,I[o+(r+t<<1)>>1]=D,r=r+1|0;while((r|0)!=(h|0));return}case 4:{if((e[h+24>>2]|0)!=1||(h=(c|0)<(l|0)?c:l,(h|0)<=0))return;t=c<<1,r=c*3|0,d=0;do w=I[C+(d<<3)+2>>1]|0,l=I[C+(d<<3)+4>>1]|0,D=I[C+(d<<3)+6>>1]|0,I[o+(d<<1)>>1]=I[C+(d<<3)>>1]|0,I[o+(d+c<<1)>>1]=w,I[o+(d+t<<1)>>1]=l,I[o+(d+r<<1)>>1]=D,d=d+1|0;while((d|0)!=(h|0));return}default:return}}function Rl(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0;N=b,b=b+176|0,R=N+152|0,U=N+16|0,_=N,C=t+4|0,h=e[C>>2]|0,k=l<<1,d=ee(k,e[h+16>>2]|0)|0;do if(d){for(w=t+20|0;h=Yt[e[(e[r>>2]|0)+32>>2]&63](r,e[w>>2]|0,d)|0,!!h;)if((d|0)==(h|0)){D=26;break}else d=d-h|0;if((D|0)==26){h=e[C>>2]|0;break}D=U+56|0,C=U+4|0,e[U>>2]=36160,e[D>>2]=36180,g=0,Ae(62,U+56|0,C|0),N=g,g=0,N&1&&(U=j()|0,tt(D),le(U|0)),e[U+128>>2]=0,e[U+132>>2]=-1,e[U>>2]=36200,e[U+56>>2]=36220,g=0,ue(180,C|0),N=g,g=0;do if(N&1)h=j()|0;else{if(e[C>>2]=36236,r=U+36|0,e[r>>2]=0,e[r+4>>2]=0,e[r+8>>2]=0,e[r+12>>2]=0,e[U+52>>2]=16,e[R>>2]=0,e[R+4>>2]=0,e[R+8>>2]=0,g=0,Ae(63,C|0,R|0),N=g,g=0,N&1){h=j()|0,de(R),de(r),wt(C);break}de(R),g=0,h=Ve(28,U|0,49029,57)|0,R=g,g=0,!(R&1)&&(g=0,be(36,h|0,0)|0,R=g,g=0,!(R&1))&&(w=Ct(16)|0,g=0,Ae(64,_|0,C|0),R=g,g=0,R&1?h=j()|0:(!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,H|0)|0,bt(8)),g=0,$e(36,w|0,3,35648,_|0),R=g,g=0,R&1?d=1:(g=0,xe(6,w|0,824,96),g=0,d=0),h=j()|0,de(_),d||(_=h,e[U>>2]=36200,e[D>>2]=36220,e[C>>2]=36236,de(r),wt(C),tt(D),le(_|0))),Tt(w|0),_=h,e[U>>2]=36200,e[D>>2]=36220,e[C>>2]=36236,de(r),wt(C),tt(D),le(_|0)),_=j()|0,e[U>>2]=36200,e[D>>2]=36220,e[C>>2]=36236,de(r),wt(C),tt(D),le(_|0)}while(!1);U=h,tt(D),le(U|0)}while(!1);if(d=t+20|0,(e[h+28>>2]|0)!=536870912){U=e[d>>2]|0,Wn(t,U,o,l,c),b=N;return}ti(e[d>>2]|0,ee(k,e[h+16>>2]|0)|0),U=e[d>>2]|0,Wn(t,U,o,l,c),b=N}function Jr(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0;C=t+4|0,t=e[C>>2]|0;e:do switch(e[t+16>>2]|0){case 3:{if((e[t+24>>2]|0)==2){if((l|0)>0)t=0;else break e;for(;;)if(w=I[r+(t*6|0)+2>>1]|0,c=I[r+(t*6|0)+4>>1]|0,I[o+(t*6|0)>>1]=I[r+(t*6|0)>>1]|0,I[o+(t*6|0)+2>>1]=w,I[o+(t*6|0)+4>>1]=c,t=t+1|0,(t|0)==(l|0))break e}if(t=(l|0)<(c|0)?l:c,(t|0)>0){h=c<<1,d=0;do D=I[r+(d+c<<1)>>1]|0,w=I[r+(d+h<<1)>>1]|0,I[o+(d*6|0)>>1]=I[r+(d<<1)>>1]|0,I[o+(d*6|0)+2>>1]=D,I[o+(d*6|0)+4>>1]=w,d=d+1|0;while((d|0)!=(t|0))}break}case 4:{if((e[t+24>>2]|0)==1&&(w=(l|0)<(c|0)?l:c,(w|0)>0)){t=c<<1,h=c*3|0,d=0;do D=I[r+(d<<1)>>1]|0,R=I[r+(d+h<<1)>>1]|0,k=M[r+(d+t<<1)>>1]|0,N=v0(M[r+(d+c<<1)>>1]|0,0,16)|0,k=ye|k,R=v0(R&65535|0,0,48)|0,R=N|D&65535|R,k=k&65535|ye,D=o+(d<<3)|0,N=D,I[N>>1]=R,I[N+2>>1]=R>>>16,D=D+4|0,I[D>>1]=k,I[D+2>>1]=k>>>16,d=d+1|0;while((d|0)!=(w|0))}break}default:}while(!1);if(t=e[C>>2]|0,!!(S[t+32>>0]|0)&&(d=e[t+16>>2]|0,!((l|0)<=0)))for(t=o,h=0;R=t+4|0,N=I[t>>1]|0,I[t>>1]=I[R>>1]|0,I[R>>1]=N,h=h+1|0,(h|0)!=(l|0);)t=t+(d<<1)|0}function Ml(t){t=t|0}function _l(t){t=t|0,he(t)}function Pl(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0,o=ee(e[t+8>>2]|0,o)|0,t=e[t+4>>2]|0,(Yt[e[(e[t>>2]|0)+48>>2]&63](t,r,o)|0)!=(o|0)&&(l=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,H|0)|0,bt(8)),g=0,xe(7,l|0,3,35648),t=g,g=0,t&1?(t=j()|0,Tt(l|0),le(t|0)):Qt(l|0,824,96))}function Ll(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0,D=0,k=0;k=b,b=b+16|0,D=k,C=t+8|0,c=e[C>>2]|0,l=ee(c,o)|0;do if(l){for(d=t+4|0,h=l;c=e[d>>2]|0,c=Yt[e[(e[c>>2]|0)+32>>2]&63](c,r,h)|0,!!c;)if(l=h-c|0,(h|0)==(c|0)){w=11;break}else h=l;if((w|0)==11){c=e[C>>2]|0,h=l;break}l=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,H|0)|0,bt(8)),g=0,xe(7,l|0,3,35648),t=g,g=0,t&1?(t=j()|0,Tt(l|0),le(t|0)):Qt(l|0,824,96)}else h=0;while(!1);if((c|0)==2&&(ti(r,o<<1),c=e[C>>2]|0),l=e[t+12>>2]|0,(l|0)<=(ee(c,o)|0)){b=k;return}t=e[t+4>>2]|0,Vi[e[(e[t>>2]|0)+16>>2]&15](D,t,l-h|0,0,1,24),b=k}function Ol(t){t=t|0,he(t)}function $l(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0,l=t+4|0,o0(e[l>>2]|0,r|0,ee(e[t+8>>2]|0,o)|0)|0,e[l>>2]=(e[l>>2]|0)+(e[t+12>>2]|0)}function Bl(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0,l=t+4|0,o0(r|0,e[l>>2]|0,ee(e[t+8>>2]|0,o)|0)|0,e[l>>2]=(e[l>>2]|0)+(e[t+12>>2]|0)}function Y0(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0;e[t+112>>2]=0,e[t+108>>2]=0,D=e[r>>2]|0,c=D;do if(D)if(d=t+92|0,D=t+96|0,w=e[D>>2]|0,C=e[d>>2]|0,o=C,l=w-o|0,l>>>0>=4e4?(l>>>0>4e4&&(h=C+4e4|0,(w|0)!=(h|0))&&(e[D>>2]=h),h=o):(vi(d,4e4-l|0),h=e[d>>2]|0,c=e[r>>2]|0),o=t+116|0,e[o>>2]=h,w=t+124|0,e[w>>2]=h,C=t+104|0,e[C>>2]=c,l=c,c){if((e[l+12>>2]|0)==(e[l+16>>2]|0)){if(r=(Dt[e[(e[c>>2]|0)+36>>2]&127](l)|0)==-1,l=e[w>>2]|0,r)break;c=e[o>>2]|0}else l=h,c=h;if(d=l-c|0,d>>>0<=64){if(h=t+92|0,(l|0)==(c|0))l=c;else{l=c,c=0;do S[(e[h>>2]|0)+c>>0]=S[l+c>>0]|0,c=c+1|0,l=e[o>>2]|0;while(c>>>0>>0);c=e[w>>2]|0}h=e[h>>2]|0,r=h,k=r-l|0,e[o>>2]=h,l=c+k|0,e[w>>2]=l,h=t+120|0,e[h>>2]=(e[h>>2]|0)+k,C=e[C>>2]|0,l=Yt[e[(e[C>>2]|0)+32>>2]&63](C,l,(e[D>>2]|0)-(r+d)|0)|0,l=(e[w>>2]|0)+l|0,e[w>>2]=l}}else l=h;else e[t+104>>2]=0,l=e[r+4>>2]|0,o=t+116|0,e[o>>2]=l,l=l+(e[r+8>>2]|0)|0,e[t+124>>2]=l;while(!1);if(o=e[o>>2]|0,o>>>0>=l>>>0){D=o,k=t+120|0,e[k>>2]=D,P0(t);return}for(;;){if((S[o>>0]|0)==-1){l=20;break}if(o=o+1|0,o>>>0>=l>>>0){l=20;break}}if((l|0)==20){k=t+120|0,e[k>>2]=o,P0(t);return}}function vi(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0;if(C=t+8|0,c=e[C>>2]|0,D=t+4|0,o=e[D>>2]|0,l=o,(c-l|0)>>>0>=r>>>0){do S[o>>0]=0,o=(e[D>>2]|0)+1|0,e[D>>2]=o,r=r+-1|0;while(r|0);return}o=e[t>>2]|0,h=l-o+r|0,(h|0)<0&&(pi(t),c=e[C>>2]|0,o=e[t>>2]|0),l=c-o|0,l>>>0<1073741823?(l=l<<1,l=l>>>0>>0?h:l,o=(e[D>>2]|0)-o|0,l?w=8:(c=0,d=0,h=o)):(l=2147483647,o=(e[D>>2]|0)-o|0,w=8),(w|0)==8&&(c=l,d=Xe(l)|0,h=o),o=d+h|0,c=d+c|0,l=o;do S[l>>0]=0,l=o+1|0,o=l,r=r+-1|0;while(r|0);r=e[t>>2]|0,l=(e[D>>2]|0)-r|0,w=d+(h-l)|0,o0(w|0,r|0,l|0)|0,e[t>>2]=w,e[D>>2]=o,e[C>>2]=c,r&&he(r)}function es(t){t=t|0;var r=0,o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0,G=0,$=0,P=0,O=0;G=b,b=b+32|0,P=G+12|0,K=G,_=t+180|0,U=(e[_>>2]|0)+4|0,(e[t+32>>2]|0)==1?Q=e[t+24>>2]|0:Q=1,r=ee(Q<<1,U)|0,e[P>>2]=0,O=P+4|0,e[O>>2]=0,e[P+8>>2]=0;do if(r){if((r|0)<0&&(g=0,ue(178,P|0),$=g,g=0,$&1)||(d=6),(d|0)==6&&(o=r<<1,g=0,l=ge(67,o|0)|0,$=g,g=0,!($&1))){e[P>>2]=l,$=l+(r<<1)|0,e[P+8>>2]=$,Jt(l|0,0,o|0)|0,e[O>>2]=$;break}l=j()|0,r=e[P>>2]|0,r||le(l|0),o=e[O>>2]|0,(o|0)!=(r|0)&&(e[O>>2]=o+(~((o+-2-r|0)>>>1)<<1)),he(r),le(l|0)}while(!1);e[K>>2]=0,$=K+4|0,e[$>>2]=0,e[K+8>>2]=0;do if(!Q)d=18;else{if(Q>>>0>1073741823&&(g=0,ue(178,K|0),R=g,g=0,R&1)||(d=16),(d|0)==16&&(c=Q<<2,g=0,h=ge(67,c|0)|0,R=g,g=0,!(R&1))){e[K>>2]=h,d=h+(Q<<2)|0,e[K+8>>2]=d,Jt(h|0,0,c|0)|0,e[$>>2]=d,d=18;break}l=j()|0,r=e[K>>2]|0,o=r,r&&(c=e[$>>2]|0,(c|0)!=(r|0)&&(e[$>>2]=c+(~((c+-4-o|0)>>>2)<<2)),he(r))}while(!1);if((d|0)==18){h=t+12|0;e:do if((e[h>>2]|0)>0){d=t+4604|0,w=(ee(Q,U)|0)+1|0,C=t+4608|0,D=t+92|0,k=(Q|0)>0,N=t+4600|0,R=0;t:for(;;){if(o=e[P>>2]|0,r=o+2|0,e[d>>2]=r,o=o+(w<<1)|0,e[C>>2]=o,R&1?(e[d>>2]=o,e[C>>2]=r):r=o,c=e[D>>2]|0,g=0,$e(e[(e[c>>2]|0)+12>>2]|0,c|0,r|0,e[_>>2]|0,U|0),c=g,g=0,c&1){d=28;break}if(k){r=e[d>>2]|0,o=e[C>>2]|0,l=e[K>>2]|0,c=0;do{if(e[N>>2]=e[l+(c<<2)>>2],l=e[_>>2]|0,I[r+(l<<1)>>1]=I[r+(l+-1<<1)>>1]|0,I[o+-2>>1]=I[r>>1]|0,g=0,Ae(68,t|0,0),l=g,g=0,l&1){d=27;break t}l=e[K>>2]|0,e[l+(c<<2)>>2]=e[N>>2],r=(e[d>>2]|0)+(U<<1)|0,e[d>>2]=r,o=(e[C>>2]|0)+(U<<1)|0,e[C>>2]=o,c=c+1|0}while((c|0)<(Q|0))}if(R=R+1|0,(R|0)>=(e[h>>2]|0)){d=40;break e}}if((d|0)==27){l=j()|0;break}else if((d|0)==28){l=j()|0;break}}else d=40;while(!1);do if((d|0)==40){if(g=0,ue(182,t|0),t=g,g=0,t&1){l=j()|0;break}if(r=e[K>>2]|0,o=r,r&&(l=e[$>>2]|0,(l|0)!=(r|0)&&(e[$>>2]=l+(~((l+-4-o|0)>>>2)<<2)),he(r)),r=e[P>>2]|0,!r){b=G;return}o=e[O>>2]|0,(o|0)!=(r|0)&&(e[O>>2]=o+(~((o+-2-r|0)>>>1)<<1)),he(r),b=G;return}while(!1);r=e[K>>2]|0,o=r,r&&(c=e[$>>2]|0,(c|0)!=(r|0)&&(e[$>>2]=c+(~((c+-4-o|0)>>>2)<<2)),he(r))}r=e[P>>2]|0,r||le(l|0),o=e[O>>2]|0,(o|0)!=(r|0)&&(e[O>>2]=o+(~((o+-2-r|0)>>>1)<<1)),he(r),le(l|0)}function Vl(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0;if(N=t+4604|0,r=e[N>>2]|0,U=t+180|0,!((e[U>>2]|0)<=0))for(R=t+4608|0,_=t+4612|0,c=r,h=M[r+-2>>1]|0,r=M[r>>1]|0,k=0;D=e[R>>2]|0,C=M[D+(k+-1<<1)>>1]|0,l=k+1|0,o=M[c+(l<<1)>>1]|0,w=e[_>>2]|0,d=r-h|0,c=h-C|0,w=((((S[w+(o-r)>>0]|0)*9|0)+(S[w+d>>0]|0)|0)*9|0)+(S[w+c>>0]|0)|0,w?(h=r-C>>31,(h^c|0)<0?c=r:c=C+((h^d|0)<0?0:d)|0,D=zl(t,w,M[D+(k<<1)>>1]|0,c,0)|0,I[(e[R>>2]|0)+(k<<1)>>1]=D):(l=(Gl(t,k,0)|0)+k|0,o=e[N>>2]|0,r=M[o+(l+-1<<1)>>1]|0,o=M[o+(l<<1)>>1]|0),!((l|0)>=(e[U>>2]|0));)c=e[N>>2]|0,h=r,r=o,k=l}function Ul(t){t=t|0;var r=0,o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0;c=t+104|0,(e[c>>2]|0)>>>0<4&&en(t),h=t+100|0,d=t+112|0,w=t+96|0,C=t+108|0,D=t+116|0,r=e[h>>2]|0,l=0;do{if(o=S[d>>0]|0,(r|0)>31)break;r=e[w>>2]|0,o<<24>>24?(S[e[C>>2]>>0]=r>>>25,e[w>>2]=e[w>>2]<<7,r=(e[h>>2]|0)+7|0):(S[e[C>>2]>>0]=r>>>24,e[w>>2]=e[w>>2]<<8,r=(e[h>>2]|0)+8|0),e[h>>2]=r,k=e[C>>2]|0,o=(S[k>>0]|0)==-1&1,S[d>>0]=o,e[C>>2]=k+1,e[c>>2]=(e[c>>2]|0)+-1,e[D>>2]=(e[D>>2]|0)+1,l=l+1|0}while((l|0)<4);o<<24>>24?_t(t,0,(r+-1|0)%8|0):_t(t,0,(r|0)%8|0),(e[c>>2]|0)>>>0<4&&en(t),r=e[h>>2]|0,o=0;do{if((r|0)>31)break;r=e[w>>2]|0,S[d>>0]|0?(S[e[C>>2]>>0]=r>>>25,e[w>>2]=e[w>>2]<<7,r=(e[h>>2]|0)+7|0):(S[e[C>>2]>>0]=r>>>24,e[w>>2]=e[w>>2]<<8,r=(e[h>>2]|0)+8|0),e[h>>2]=r,k=e[C>>2]|0,S[d>>0]=(S[k>>0]|0)==-1&1,e[C>>2]=k+1,e[c>>2]=(e[c>>2]|0)+-1,e[D>>2]=(e[D>>2]|0)+1,o=o+1|0}while((o|0)<4);e[t+132>>2]|0&&en(t)}function en(t){t=t|0;var r=0,o=0,l=0,c=0,h=0;if(r=e[t+132>>2]|0,r||(r=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,H|0)|0,bt(8)),g=0,xe(7,r|0,4,35648),t=g,g=0,t&1||Qt(r|0,824,96),t=j()|0,Tt(r|0),le(t|0)),o=t+108|0,l=t+120|0,h=e[l>>2]|0,c=(e[o>>2]|0)-h|0,(Yt[e[(e[r>>2]|0)+48>>2]&63](r,h,c)|0)==(c|0)){h=e[l>>2]|0,e[o>>2]=h,e[t+104>>2]=(e[t+124>>2]|0)-h;return}r=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,H|0)|0,bt(8)),g=0,xe(7,r|0,4,35648),h=g,g=0,h&1||Qt(r|0,824,96),h=j()|0,Tt(r|0),le(h|0)}function _t(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0;if(D=t+100|0,o=(e[D>>2]|0)-o|0,e[D>>2]=o,(o|0)>-1){k=t+96|0,e[k>>2]=e[k>>2]|r<>2]=e[k>>2]|r>>0-o,C=t+104|0,(e[C>>2]|0)>>>0<4&&(en(t),o=e[D>>2]|0),h=t+112|0,d=t+108|0,w=t+116|0,l=0;!((o|0)>31);)if(o=e[k>>2]|0,S[h>>0]|0?(S[e[d>>2]>>0]=o>>>25,e[k>>2]=e[k>>2]<<7,o=(e[D>>2]|0)+7|0):(S[e[d>>2]>>0]=o>>>24,e[k>>2]=e[k>>2]<<8,o=(e[D>>2]|0)+8|0),e[D>>2]=o,N=e[d>>2]|0,S[h>>0]=(S[N>>0]|0)==-1&1,e[d>>2]=N+1,e[C>>2]=(e[C>>2]|0)+-1,e[w>>2]=(e[w>>2]|0)+1,l=l+1|0,(l|0)>=4){c=11;break}e:do if((c|0)==11&&(o|0)<0){e[k>>2]=e[k>>2]|r>>0-o,(e[C>>2]|0)>>>0<4&&(en(t),o=e[D>>2]|0),l=0;do{if((o|0)>31)break e;o=e[k>>2]|0,S[h>>0]|0?(S[e[d>>2]>>0]=o>>>25,e[k>>2]=e[k>>2]<<7,o=(e[D>>2]|0)+7|0):(S[e[d>>2]>>0]=o>>>24,e[k>>2]=e[k>>2]<<8,o=(e[D>>2]|0)+8|0),e[D>>2]=o,N=e[d>>2]|0,S[h>>0]=(S[N>>0]|0)==-1&1,e[d>>2]=N+1,e[C>>2]=(e[C>>2]|0)+-1,e[w>>2]=(e[w>>2]|0)+1,l=l+1|0}while((l|0)<4)}while(!1);e[k>>2]=e[k>>2]|r<>31,h=(Q^r)-Q|0,_=t+196+(h*12|0)+10|0,d=I[_>>1]|0,R=t+196+(h*12|0)|0,c=e[R>>2]|0,(d|0)<(c|0))if((d<<1|0)<(c|0))if((d<<2|0)<(c|0))if((d<<3|0)<(c|0))if((d<<4|0)<(c|0))for(r=5;(d<>1]^Q)-Q+l|0,U=t+136|0,l=e[U>>2]|0,(c&l|0)==(c|0)?D=c:D=l&~(c>>31),c=(o-D^Q)-Q|0,C=t+144|0,l=e[C>>2]|0,(c|0)>0?c=(c+l|0)/(l<<1|1|0)|0:c=(c-l|0)/(l<<1|1|0)|0,N=t+140|0,w=e[N>>2]|0,o=((c|0)<0?w:0)+c|0,w=o-((o|0)<((w+1|0)/2|0|0)?0:w)|0,h=t+196+(h*12|0)+4|0,l|r?c=0:c=(e[h>>2]<<1)+-1+d>>31,l=c^w,is(t,r,l>>30^l<<1,e[t+156>>2]|0),l=e[t+160>>2]|0,r=(e[R>>2]|0)+((w|0)>-1?w:0-w|0)|0,c=(e[h>>2]|0)+(ee(e[C>>2]<<1|1,w)|0)|0,o=I[_>>1]|0,(o|0)==(l|0)&&(r=r>>1,c=c>>1,o=l>>1),e[R>>2]=r,l=o+1|0,I[_>>1]=l,r=l+c|0,(r|0)>=1?(c|0)>0&&(c=c-l|0,_=I[k>>1]|0,I[k>>1]=(_<<16>>16<127&1)+(_&65535),c=(c|0)>0?0:c):(c=I[k>>1]|0,I[k>>1]=(c&65535)-(c<<16>>16>-128&1),c=(r|0)>(~o|0)?r:0-o|0),e[h>>2]=c,l=e[C>>2]|0,o=l<<1|1,r=(ee(o,(w^Q)-Q|0)|0)+D|0,(r|0)>=(0-l|0)?(c=e[U>>2]|0,(c+l|0)<(r|0)&&(r=r-(ee(e[N>>2]|0,o)|0)|0)):(r=(ee(e[N>>2]|0,o)|0)+r|0,c=e[U>>2]|0),(r&c|0)==(r|0)?(Q=r,Q=Q&65535,Q|0):(Q=c&~(r>>31),Q=Q&65535,Q|0)}function Gl(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0;for(C=(e[t+180>>2]|0)-r|0,D=e[t+4608>>2]|0,k=e[t+4604>>2]|0,c=I[D+(r+-1<<1)>>1]|0,w=c&65535,o=e[t+144>>2]|0,h=0;l=D+(h+r<<1)|0,d=(M[l>>1]|0)-w|0,!((((d|0)>-1?d:0-d|0)|0)>(o|0));)if(I[l>>1]=c,h=h+1|0,(h|0)==(C|0)){h=C;break}if(c=(h|0)==(C|0),d=t+4600|0,l=e[36476+(e[d>>2]<<2)>>2]|0,(1<(h|0))o=h;else{o=h;do _t(t,1,1),l=e[d>>2]|0,o=o-(1<>2])|0,l=(l|0)>30?31:l+1|0,e[d>>2]=l,l=e[36476+(l<<2)>>2]|0;while((o|0)>=(1<>1]|0,w,M[k+(C<<1)>>1]|0)|0,I[r>>1]=t,t=e[d>>2]|0,e[d>>2]=(t|0)<1?0:t+-1|0,t=h+1|0,t|0)}function ql(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0;return w=o-l|0,C=t+136|0,d=t+144|0,c=e[d>>2]|0,(((w|0)>-1?w:0-w|0)|0)>(c|0)?(h=l-o>>31|1,r=ee(h,r-l|0)|0,(r|0)>0?r=(c+r|0)/(c<<1|1|0)|0:r=(r-c|0)/(c<<1|1|0)|0,w=t+140|0,c=e[w>>2]|0,o=((r|0)<0?c:0)+r|0,c=o-((o|0)<((c+1|0)/2|0|0)?0:c)|0,ts(t,t+4576|0,c),c=ee(c,h)|0,h=e[d>>2]|0,d=h<<1|1,c=(ee(c,d)|0)+l|0,(c|0)>=(0-h|0)?(r=e[C>>2]|0,(r+h|0)<(c|0)&&(c=c-(ee(e[w>>2]|0,d)|0)|0)):(c=(ee(e[w>>2]|0,d)|0)+c|0,r=e[C>>2]|0),(c&r|0)==(c|0)?(C=c,C=C&65535,C|0):(C=r&~(c>>31),C=C&65535,C|0)):(r=r-o|0,(r|0)>0?r=(c+r|0)/(c<<1|1|0)|0:r=(r-c|0)/(c<<1|1|0)|0,w=t+140|0,c=e[w>>2]|0,h=((r|0)<0?c:0)+r|0,c=h-((h|0)<((c+1|0)/2|0|0)?0:c)|0,ts(t,t+4588|0,c),h=e[d>>2]|0,d=h<<1|1,c=(ee(d,c)|0)+o|0,(c|0)>=(0-h|0)?(r=e[C>>2]|0,(r+h|0)<(c|0)&&(c=c-(ee(e[w>>2]|0,d)|0)|0)):(c=(ee(e[w>>2]|0,d)|0)+c|0,r=e[C>>2]|0),(c&r|0)==(c|0)?(C=c,C=C&65535,C|0):(C=r&~(c>>31),C=C&65535,C|0))}function ts(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0;if(k=r+9|0,d=F[k>>0]|0,D=r+4|0,C=e[D>>2]|0,c=(ee(d>>>1,C)|0)+(e[r>>2]|0)|0,(d|0)<(c|0)){h=d,l=0;do h=h<<1,l=l+1|0;while((h|0)<(c|0));c=l}else c=0;(o|0)>0&(c|0)==0&&F[r+10>>0]<<1>>>0>>0?l=1:w=5;do if((w|0)==5){if(l=(o|0)<0,l&&F[r+10>>0]<<1>>>0>=d>>>0){l=1;break}l=l&(c|0)!=0}while(!1);if(l=(((o|0)>-1?o:0-o|0)<<1)-C+(l<<31>>31)|0,is(t,c,l,(e[t+156>>2]|0)+-1-(e[36476+(e[t+4600>>2]<<2)>>2]|0)|0),(o|0)<0&&(t=r+10|0,S[t>>0]=(F[t>>0]|0)+1),l=(l+1-(e[D>>2]|0)>>1)+(e[r>>2]|0)|0,e[r>>2]=l,c=S[k>>0]|0,c<<24>>24!=(S[r+8>>0]|0)){r=c,r=r&255,r=r+1|0,r=r&255,S[k>>0]=r;return}e[r>>2]=l>>1,t=(c&255)>>>1,S[k>>0]=t,r=r+10|0,S[r>>0]=(F[r>>0]|0)>>>1,r=t,r=r&255,r=r+1|0,r=r&255,S[k>>0]=r}function is(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0;if(c=o>>r,h=t+148|0,d=l-(e[h>>2]|0)|0,(c|0)<(d+-1|0)){(c|0)>30&&(l=(c|0)/2|0,_t(t,0,l),c=c-l|0),_t(t,1,c+1|0),_t(t,(1<31?(_t(t,0,31),_t(t,1,l+-31-(e[h>>2]|0)|0)):_t(t,1,d),r=e[h>>2]|0,_t(t,(1<>2]|0,C=t+120|0,r>>>0<((e[C>>2]|0)+-3|0)>>>0){C=t+112|0,d=e[C>>2]|0,t=t+108|0,e[t>>2]=(F[r+1>>0]<<16|F[r>>0]<<24|F[r+2>>0]<<8|F[r+3>>0])>>>d|e[t>>2],t=32-d>>3,e[w>>2]=r+t,e[C>>2]=(t<<3)+d;return}d=t+104|0,o=e[d>>2]|0;do if(o){if((e[o+12>>2]|0)==(e[o+16>>2]|0)){if((Dt[e[(e[o>>2]|0)+36>>2]&127](o)|0)==-1)break;r=e[w>>2]|0}if(c=t+124|0,o=e[c>>2]|0,h=o-r|0,h>>>0<=64){if(l=t+92|0,(o|0)==(r|0))o=r;else{o=0;do S[(e[l>>2]|0)+o>>0]=S[r+o>>0]|0,o=o+1|0,r=e[w>>2]|0;while(o>>>0>>0);o=r,r=e[c>>2]|0}k=e[l>>2]|0,l=k,D=l-o|0,e[w>>2]=k,o=r+D|0,e[c>>2]=o,e[C>>2]=(e[C>>2]|0)+D,d=e[d>>2]|0,d=Yt[e[(e[d>>2]|0)+32>>2]&63](d,o,(e[t+96>>2]|0)-(l+h)|0)|0,e[c>>2]=(e[c>>2]|0)+d}}while(!1);for(d=t+112|0,h=t+108|0,t=e[t+124>>2]|0,c=t+-1|0,r=e[w>>2]|0;;){if(r>>>0>=t>>>0){o=14;break}if(l=S[r>>0]|0,o=l&255,l=l<<24>>24==-1,l){if((r|0)==(c|0)){o=25;break}if(r=r+1|0,(S[r>>0]|0)<0){o=25;break}}else r=r+1|0;if(k=e[d>>2]|0,e[h>>2]=o<<24-k|e[h>>2],e[w>>2]=r,k=k+(l?7:8)|0,e[d>>2]=k,(k|0)>=24){o=33;break}}if((o|0)==14){if((e[d>>2]|0)>=1)return;r=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,H|0)|0,bt(8)),g=0,xe(7,r|0,5,35648),k=g,g=0,k&1||Qt(r|0,824,96),k=j()|0,Tt(r|0),le(k|0)}else if((o|0)==25){if((e[d>>2]|0)>=1)return;r=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,H|0)|0,bt(8)),g=0,xe(7,r|0,5,35648),k=g,g=0,k&1||Qt(r|0,824,96),k=j()|0,Tt(r|0),le(k|0)}else if((o|0)==33){e:do if(r>>>0>>0)do{if((S[r>>0]|0)==-1)break e;r=r+1|0}while(r>>>0>>0);while(!1);e[C>>2]=r;return}}function Wl(t){t=t|0;var r=0,o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0;R=b,b=b+32|0,l=R,N=t+144|0;e:do if(e[N>>2]|0)r=t+152|0;else if(o=e[t+136>>2]|0,r=t+152|0,(o|0)==((1<>2])+-1|0)&&(m0(l,o,0),(e[l+4>>2]|0)==(e[t+184>>2]|0))&&(e[l+8>>2]|0)==(e[t+188>>2]|0)&&(e[l+12>>2]|0)==(e[t+192>>2]|0))switch(e[r>>2]|0){case 8:{N=e[8900]|0,e[t+4612>>2]=N+(((e[8901]|0)-N|0)>>>1),b=R;return}case 10:{N=e[8903]|0,e[t+4612>>2]=N+(((e[8904]|0)-N|0)>>>1),b=R;return}case 12:{N=e[8906]|0,e[t+4612>>2]=N+(((e[8907]|0)-N|0)>>>1),b=R;return}case 16:{N=e[8909]|0,e[t+4612>>2]=N+(((e[8910]|0)-N|0)>>>1),b=R;return}default:break e}while(!1);if(k=1<>2],o=t+4616|0,l=k<<1,c=t+4620|0,h=e[c>>2]|0,r=e[o>>2]|0,d=h-r|0,l>>>0<=d>>>0?l>>>0>>0&&(w=r+l|0,(h|0)!=(w|0))&&(e[c>>2]=w):(j0(o,l-d|0),r=e[o>>2]|0),D=t+4612|0,e[D>>2]=r+k,r=0-k|0,(k|0)<=(r|0)){b=R;return}w=t+192|0,C=t+188|0,d=t+184|0,h=r;do r=e[w>>2]|0,(h|0)>(0-r|0)?(o=e[C>>2]|0,(h|0)>(0-o|0)?(l=e[d>>2]|0,(h|0)>(0-l|0)?(c=e[N>>2]|0,(h|0)>=(0-c|0)?(c|0)<(h|0)?(l|0)<=(h|0)?(o|0)>(h|0)?r=2:r=(r|0)>(h|0)?3:4:r=1:r=0:r=-1):r=-2):r=-3):r=-4,S[(e[D>>2]|0)+h>>0]=r,h=h+1|0;while((h|0)!=(k|0));b=R}function j0(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0;if(C=t+8|0,c=e[C>>2]|0,D=t+4|0,o=e[D>>2]|0,l=o,(c-l|0)>>>0>=r>>>0){do S[o>>0]=0,o=(e[D>>2]|0)+1|0,e[D>>2]=o,r=r+-1|0;while(r|0);return}o=e[t>>2]|0,h=l-o+r|0,(h|0)<0&&(pi(t),c=e[C>>2]|0,o=e[t>>2]|0),l=c-o|0,l>>>0<1073741823?(l=l<<1,l=l>>>0>>0?h:l,o=(e[D>>2]|0)-o|0,l?w=8:(c=0,d=0,h=o)):(l=2147483647,o=(e[D>>2]|0)-o|0,w=8),(w|0)==8&&(c=l,d=Xe(l)|0,h=o),o=d+h|0,c=d+c|0,l=o;do S[l>>0]=0,l=o+1|0,o=l,r=r+-1|0;while(r|0);r=e[t>>2]|0,l=(e[D>>2]|0)-r|0,w=d+(h-l)|0,o0(w|0,r|0,l|0)|0,e[t>>2]=w,e[D>>2]=o,e[C>>2]=c,r&&he(r)}function Hl(t){t=t|0;var r=0,o=0;e[t>>2]=36612,r=e[t+120>>2]|0,r&&(o=t+124|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),o=t+92|0,r=e[o>>2]|0,e[o>>2]=0,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r),t=t+4|0,r=e[t>>2]|0,e[t>>2]=0,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r)}function Ql(t){t=t|0;var r=0,o=0;if(e[t>>2]=36612,r=e[t+120>>2]|0,r&&(o=t+124|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),o=t+92|0,r=e[o>>2]|0,e[o>>2]=0,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r),o=t+4|0,r=e[o>>2]|0,e[o>>2]=0,!r){he(t);return}Mt[e[(e[r>>2]|0)+4>>2]&255](r),he(t)}function Kl(t){t=t|0;var r=0,o=0;e[t>>2]=36052,r=e[t+4616>>2]|0,r&&(o=t+4620|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),e[t>>2]=36612,r=e[t+120>>2]|0,r&&(o=t+124|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),o=t+92|0,r=e[o>>2]|0,e[o>>2]=0,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r),t=t+4|0,r=e[t>>2]|0,e[t>>2]=0,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r)}function Yl(t){t=t|0;var r=0,o=0;if(e[t>>2]=36052,r=e[t+4616>>2]|0,r&&(o=t+4620|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),e[t>>2]=36612,r=e[t+120>>2]|0,r&&(o=t+124|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),o=t+92|0,r=e[o>>2]|0,e[o>>2]=0,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r),o=t+4|0,r=e[o>>2]|0,e[o>>2]=0,!r){he(t);return}Mt[e[(e[r>>2]|0)+4>>2]&255](r),he(t)}function jl(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0;d=b,b=b+32|0,C=d,m0(C,e[t+136>>2]|0,e[t+144>>2]|0),w=e[r+4>>2]|0,h=e[r+8>>2]|0,h=h|0?h:e[C+8>>2]|0,c=e[r+12>>2]|0,c=c|0?c:e[C+12>>2]|0,o=e[r+16>>2]|0,l=e[C+16>>2]|0,e[t+184>>2]=w|0?w:e[C+4>>2]|0,e[t+188>>2]=h,e[t+192>>2]=c,i1(t),c=t+140|0,r=(e[c>>2]|0)+32|0,r=(r|0)<128?2:(r|0)/64|0,h=0;do e[t+196+(h*12|0)>>2]=r,e[t+196+(h*12|0)+4>>2]=0,I[t+196+(h*12|0)+8>>1]=0,I[t+196+(h*12|0)+10>>1]=1,h=h+1|0;while((h|0)!=365);w=(e[c>>2]|0)+32|0,w=(w|0)<128?2:(w|0)/64|0,C=(o|0?o:l)&255,e[t+4576>>2]=w,e[t+4580>>2]=0,S[t+4584>>0]=C,S[t+4585>>0]=1,S[t+4586>>0]=0,e[t+4588>>2]=w,e[t+4592>>2]=1,S[t+4596>>0]=C,S[t+4597>>0]=1,S[t+4598>>0]=0,e[t+4600>>2]=0,b=d}function Xl(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0,D=0,k=0;if(k=b,b=b+16|0,C=k,w=t+92|0,d=e[r>>2]|0,e[r>>2]=0,r=e[w>>2]|0,e[w>>2]=d,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r),e[C>>2]=0,e[C+4>>2]=l,w=o+8|0,e[C+8>>2]=e[w>>2],l){r=Xe(4624)|0,l=t+8|0,c=r+4|0,h=l,d=c+84|0;do e[c>>2]=e[h>>2],c=c+4|0,h=h+4|0;while((c|0)<(d|0));c=r+88|0,d=c+40|0;do e[c>>2]=0,c=c+4|0;while((c|0)<(d|0));e[r>>2]=35828,e[r+128>>2]=e[t+136>>2],e[r+132>>2]=e[t+140>>2],e[r+136>>2]=e[t+144>>2],e[r+140>>2]=e[t+148>>2],e[r+144>>2]=e[t+152>>2],e[r+148>>2]=e[t+156>>2],e[r+152>>2]=e[t+160>>2],c=r+156|0,e[c>>2]=0,e[c+4>>2]=0,e[c+8>>2]=0,e[c+12>>2]=0,e[r+172>>2]=e[l>>2],e[r+176>>2]=0,e[r+180>>2]=0,e[r+184>>2]=0,c=r+4568|0,l=r+188|0;do e[l>>2]=0,e[l+4>>2]=0,I[l+8>>1]=0,I[l+10>>1]=1,l=l+12|0;while((l|0)!=(c|0));h=t+4|0,e[c>>2]=0,e[c+4>>2]=0,I[c+8>>1]=0,S[c+10>>0]=0,d=r+4580|0,e[d>>2]=0,e[d+4>>2]=0,I[d+8>>1]=0,S[d+10>>0]=0,d=r+4592|0,e[d>>2]=0,e[d+4>>2]=0,e[d+8>>2]=0,e[d+12>>2]=0,e[d+16>>2]=0,e[d+20>>2]=0,e[d+24>>2]=0,S[d+28>>0]=0,e[r+28>>2]|0||(e[r+20>>2]=1),l=e[h>>2]|0,e[h>>2]=r,l&&(Mt[e[(e[l>>2]|0)+4>>2]&255](l),r=e[h>>2]|0),Y0(r,C)}return C=t+100|0,e[C>>2]=32,e[t+96>>2]=0,r=e[o>>2]|0,r?(e[t+132>>2]=r,c=t+120|0,w=t+124|0,l=e[w>>2]|0,r=e[c>>2]|0,h=r,d=l-h|0,d>>>0>=4e3?d>>>0>4e3&&(D=r+4e3|0,(l|0)!=(D|0))&&(e[w>>2]=D,l=D):(vi(c,4e3-d|0),r=e[c>>2]|0,h=r,l=e[w>>2]|0),e[t+108>>2]=h,e[t+104>>2]=l-r,ns(t),D=t+116|0,D=e[D>>2]|0,t=e[C>>2]|0,t=t+-32|0,t=(t|0)/8|0,t=D-t|0,b=k,t|0):(e[t+108>>2]=e[o+4>>2],e[t+104>>2]=e[w>>2],ns(t),D=t+116|0,D=e[D>>2]|0,t=e[C>>2]|0,t=t+-32|0,t=(t|0)/8|0,t=D-t|0,b=k,t|0)}function Zl(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0,G=0,$=0,P=0,O=0;if(G=b,b=b+352|0,$=G+328|0,P=G+192|0,o=G+343|0,l=G+342|0,c=G+341|0,h=G+340|0,R=G+176|0,w=G+168|0,C=G+160|0,D=G+152|0,K=G,U=G+136|0,e[t+32>>2]|0&&(e[t+24>>2]|0)!=1){if(_=t+8|0,Q=t+36|0,d=e[Q>>2]|0,!d){if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[o>>0]|0,$e(37,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}if(t=e[t+16>>2]|0,(t|0)==16)switch(d|0){case 1:{if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[l>>0]|0,$e(38,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 2:{if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[c>>0]|0,$e(39,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 3:{if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[h>>0]|0,$e(40,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}default:{d=P+56|0,c=P+4|0,e[P>>2]=36160,e[d>>2]=36180,g=0,Ae(62,P+56|0,c|0),G=g,g=0,G&1&&(O=j()|0,tt(d),le(O|0)),e[P+128>>2]=0,e[P+132>>2]=-1,e[P>>2]=36200,e[P+56>>2]=36220,g=0,ue(180,c|0),G=g,g=0;do if(G&1)t=j()|0;else{if(e[c>>2]=36236,h=P+36|0,e[h>>2]=0,e[h+4>>2]=0,e[h+8>>2]=0,e[h+12>>2]=0,e[P+52>>2]=16,e[$>>2]=0,e[$+4>>2]=0,e[$+8>>2]=0,g=0,Ae(63,c|0,$|0),G=g,g=0,G&1){t=j()|0,de($),de(h),wt(c);break}de($),g=0,t=Ve(28,P|0,49007,21)|0,$=g,g=0;do if(!($&1)&&(g=0,k=be(36,t|0,e[Q>>2]|0)|0,$=g,g=0,!($&1))&&(g=0,Ve(28,k|0,50997,18)|0,$=g,g=0,!($&1))){if(l=Ct(16)|0,g=0,Ae(64,R|0,c|0),$=g,g=0,$&1)t=j()|0;else if(!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,H|0)|0,bt(8)),g=0,$e(36,l|0,9,35648,R|0),$=g,g=0,$&1?o=1:(g=0,xe(6,l|0,824,96),g=0,o=0),t=j()|0,de(R),!o)break;Tt(l|0)}else O=34;while(!1);(O|0)==34&&(t=j()|0),e[P>>2]=36200,e[d>>2]=36220,e[c>>2]=36236,de(h),wt(c),tt(d),O=t,le(O|0)}while(!1);O=t,tt(d),le(O|0)}}switch((t|0)<=8&&(t=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,H|0)|0,bt(8)),g=0,xe(7,t|0,8,35648),O=g,g=0,O&1||Qt(t|0,824,96),O=j()|0,Tt(t|0),le(O|0)),o=16-t|0,d|0){case 1:{if(t=Xe(60)|0,e[w>>2]=o,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],e[$>>2]=e[w>>2],e[$+4>>2]=e[w+4>>2],$e(41,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 2:{if(t=Xe(60)|0,e[C>>2]=o,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],e[$>>2]=e[C>>2],e[$+4>>2]=e[C+4>>2],$e(42,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 3:{if(t=Xe(60)|0,e[D>>2]=o,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],e[$>>2]=e[D>>2],e[$+4>>2]=e[D+4>>2],$e(43,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}default:{d=K+56|0,c=K+4|0,e[K>>2]=36160,e[d>>2]=36180,g=0,Ae(62,K+56|0,c|0),P=g,g=0,P&1&&(O=j()|0,tt(d),le(O|0)),e[K+128>>2]=0,e[K+132>>2]=-1,e[K>>2]=36200,e[K+56>>2]=36220,g=0,ue(180,c|0),P=g,g=0;do if(P&1)t=j()|0;else{if(e[c>>2]=36236,h=K+36|0,e[h>>2]=0,e[h+4>>2]=0,e[h+8>>2]=0,e[h+12>>2]=0,e[K+52>>2]=16,e[$>>2]=0,e[$+4>>2]=0,e[$+8>>2]=0,g=0,Ae(63,c|0,$|0),P=g,g=0,P&1){t=j()|0,de($),de(h),wt(c);break}de($),g=0,t=Ve(28,K|0,49007,21)|0,P=g,g=0;do if(!(P&1)&&(g=0,N=be(36,t|0,e[Q>>2]|0)|0,P=g,g=0,!(P&1))&&(g=0,Ve(28,N|0,50997,18)|0,P=g,g=0,!(P&1))){if(l=Ct(16)|0,g=0,Ae(64,U|0,c|0),P=g,g=0,P&1)t=j()|0;else if(!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,H|0)|0,bt(8)),g=0,$e(36,l|0,9,35648,U|0),P=g,g=0,P&1?o=1:(g=0,xe(6,l|0,824,96),g=0,o=0),t=j()|0,de(U),!o)break;Tt(l|0)}else O=64;while(!1);(O|0)==64&&(t=j()|0),e[K>>2]=36200,e[d>>2]=36220,e[c>>2]=36236,de(h),wt(c),tt(d),O=t,le(O|0)}while(!1);O=t,tt(d),le(O|0)}}}return o=e[r+4>>2]|0,l=Xe(16)|0,t=e[t+20>>2]|0,o?(e[l>>2]=36108,e[l+4>>2]=o,e[l+8>>2]=6,e[l+12>>2]=t,O=l,b=G,O|0):(O=e[r>>2]|0,e[l>>2]=36132,e[l+4>>2]=O,e[l+8>>2]=6,e[l+12>>2]=t,O=l,b=G,O|0)}function ns(t){t=t|0;var r=0,o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0,G=0,$=0,P=0,O=0;K=b,b=b+32|0,$=K+12|0,Q=K,R=t+180|0,_=(e[R>>2]|0)+4|0,(e[t+32>>2]|0)==1?U=e[t+24>>2]|0:U=1,r=ee(U<<1,_)|0,e[$>>2]=0,P=$+4|0,e[P>>2]=0,e[$+8>>2]=0;do if(r){if(r>>>0>715827882&&(g=0,ue(178,$|0),G=g,g=0,G&1)||(d=6),(d|0)==6&&(g=0,o=ge(67,r*6|0)|0,G=g,g=0,!(G&1))){for(e[P>>2]=o,e[$>>2]=o,l=o+(r*6|0)|0,e[$+8>>2]=l;I[o>>1]=0,I[o+2>>1]=0,I[o+4>>1]=0,r=r+-1|0,r;)o=o+6|0;e[P>>2]=l;break}l=j()|0,r=e[$>>2]|0,r||le(l|0),o=e[P>>2]|0,(o|0)!=(r|0)&&(e[P>>2]=o+(~(((o+-6-r|0)>>>0)/6|0)*6|0)),he(r),le(l|0)}while(!1);e[Q>>2]=0,G=Q+4|0,e[G>>2]=0,e[Q+8>>2]=0;do if(!U)d=20;else{if(U>>>0>1073741823&&(g=0,ue(178,Q|0),N=g,g=0,N&1)||(d=18),(d|0)==18&&(c=U<<2,g=0,h=ge(67,c|0)|0,N=g,g=0,!(N&1))){e[Q>>2]=h,d=h+(U<<2)|0,e[Q+8>>2]=d,Jt(h|0,0,c|0)|0,e[G>>2]=d,d=20;break}l=j()|0,r=e[Q>>2]|0,o=r,r&&(c=e[G>>2]|0,(c|0)!=(r|0)&&(e[G>>2]=c+(~((c+-4-o|0)>>>2)<<2)),he(r))}while(!1);if((d|0)==20){c=t+12|0;e:do if((e[c>>2]|0)>0){h=t+4604|0,d=(ee(U,_)|0)+1|0,w=t+4608|0,C=t+92|0,D=(U|0)>0,k=t+4600|0,N=0;t:for(;;){if(o=e[$>>2]|0,r=o+6|0,e[h>>2]=r,o=o+(d*6|0)|0,e[w>>2]=o,N&1?(e[h>>2]=o,e[w>>2]=r):r=o,l=e[C>>2]|0,g=0,$e(e[(e[l>>2]|0)+12>>2]|0,l|0,r|0,e[R>>2]|0,_|0),l=g,g=0,l&1){d=30;break}if(D){r=e[Q>>2]|0,o=e[h>>2]|0,l=0;do{if(e[k>>2]=e[r+(l<<2)>>2],O=e[R>>2]|0,r=o+(O*6|0)|0,o=o+((O+-1|0)*6|0)|0,I[r>>1]=I[o>>1]|0,I[r+2>>1]=I[o+2>>1]|0,I[r+4>>1]=I[o+4>>1]|0,o=(e[w>>2]|0)+-6|0,r=e[h>>2]|0,I[o>>1]=I[r>>1]|0,I[o+2>>1]=I[r+2>>1]|0,I[o+4>>1]=I[r+4>>1]|0,g=0,Ae(69,t|0,0),o=g,g=0,o&1){d=29;break t}r=e[Q>>2]|0,e[r+(l<<2)>>2]=e[k>>2],o=(e[h>>2]|0)+(_*6|0)|0,e[h>>2]=o,e[w>>2]=(e[w>>2]|0)+(_*6|0),l=l+1|0}while((l|0)<(U|0))}if(N=N+1|0,(N|0)>=(e[c>>2]|0)){d=42;break e}}if((d|0)==29){l=j()|0;break}else if((d|0)==30){l=j()|0;break}}else d=42;while(!1);do if((d|0)==42){if(g=0,ue(182,t|0),O=g,g=0,O&1){l=j()|0;break}if(r=e[Q>>2]|0,o=r,r&&(l=e[G>>2]|0,(l|0)!=(r|0)&&(e[G>>2]=l+(~((l+-4-o|0)>>>2)<<2)),he(r)),r=e[$>>2]|0,!r){b=K;return}o=e[P>>2]|0,(o|0)!=(r|0)&&(e[P>>2]=o+(~(((o+-6-r|0)>>>0)/6|0)*6|0)),he(r),b=K;return}while(!1);r=e[Q>>2]|0,o=r,r&&(c=e[G>>2]|0,(c|0)!=(r|0)&&(e[G>>2]=c+(~((c+-4-o|0)>>>2)<<2)),he(r))}r=e[$>>2]|0,r||le(l|0),o=e[P>>2]|0,(o|0)!=(r|0)&&(e[P>>2]=o+(~(((o+-6-r|0)>>>0)/6|0)*6|0)),he(r),le(l|0)}function Jl(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0,ce=0,ke=0;if(oe=t+180|0,!((e[oe>>2]|0)<=0))for(ne=t+4608|0,ce=t+4604|0,ke=t+4612|0,ie=0;P=ie+-1|0,h=e[ne>>2]|0,d=e[ce>>2]|0,r=ie+1|0,c=M[d+(ie*6|0)>>1]|0,Z=e[ke>>2]|0,w=M[d+(P*6|0)>>1]|0,C=c-w|0,D=M[h+(P*6|0)>>1]|0,k=w-D|0,N=((((S[Z+((M[d+(r*6|0)>>1]|0)-c)>>0]|0)*9|0)+(S[Z+C>>0]|0)|0)*9|0)+(S[Z+k>>0]|0)|0,l=M[d+(ie*6|0)+2>>1]|0,R=M[d+(P*6|0)+2>>1]|0,_=l-R|0,U=M[h+(P*6|0)+2>>1]|0,Q=R-U|0,K=((((S[Z+((M[d+(r*6|0)+2>>1]|0)-l)>>0]|0)*9|0)+(S[Z+_>>0]|0)|0)*9|0)+(S[Z+Q>>0]|0)|0,o=M[d+(ie*6|0)+4>>1]|0,G=M[d+(P*6|0)+4>>1]|0,$=o-G|0,P=M[h+(P*6|0)+4>>1]|0,O=G-P|0,Z=((((S[Z+((M[d+(r*6|0)+4>>1]|0)-o)>>0]|0)*9|0)+(S[Z+$>>0]|0)|0)*9|0)+(S[Z+O>>0]|0)|0,K|N|Z?(d=M[h+(ie*6|0)>>1]|0,h=c-D>>31,(h^k|0)>=0&&((h^C|0)<0?c=D:c=D-w+c|0),d=Hn(t,N,d,c,0)|0,h=M[(e[ne>>2]|0)+(ie*6|0)+2>>1]|0,c=l-U>>31,(c^Q|0)>=0&&((c^_|0)<0?l=U:l=U-R+l|0),c=Hn(t,K,h,l,0)|0,h=M[(e[ne>>2]|0)+(ie*6|0)+4>>1]|0,l=o-P>>31,(l^O|0)>=0&&((l^$|0)<0?o=P:o=P-G+o|0),O=Hn(t,Z,h,o,0)|0,Z=e[ne>>2]|0,I[Z+(ie*6|0)>>1]=d,I[Z+(ie*6|0)+2>>1]=c,I[Z+(ie*6|0)+4>>1]=O):r=(e1(t,ie,0)|0)+ie|0,(r|0)<(e[oe>>2]|0);)ie=r}function e1(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0;for(oe=b,b=b+48|0,_=oe+30|0,R=oe+24|0,N=oe+18|0,U=oe+12|0,P=oe+6|0,O=oe,Z=(e[t+180>>2]|0)-r|0,ie=e[t+4608>>2]|0,Q=e[t+4604>>2]|0,$=r+-1|0,K=I[ie+($*6|0)>>1]|0,G=I[ie+($*6|0)+2>>1]|0,$=I[ie+($*6|0)+4>>1]|0,o=K&65535,l=t+144|0,c=G&65535,h=$&65535,k=0;C=k+r|0,d=ie+(C*6|0)|0,w=ie+(C*6|0)+2|0,C=ie+(C*6|0)+4|0,ne=(M[d>>1]|0)-o|0,D=e[l>>2]|0,!((((ne|0)>-1?ne:0-ne|0)|0)>(D|0)||(ne=(M[w>>1]|0)-c|0,(((ne|0)>-1?ne:0-ne|0)|0)>(D|0))||(ne=(M[C>>1]|0)-h|0,(((ne|0)>-1?ne:0-ne|0)|0)>(D|0)));)if(I[d>>1]=K,I[w>>1]=G,I[C>>1]=$,k=k+1|0,(k|0)==(Z|0)){k=Z;break}if(c=(k|0)==(Z|0),h=t+4600|0,l=e[36476+(e[h>>2]<<2)>>2]|0,(1<(k|0))o=k;else{o=k;do _t(t,1,1),l=e[h>>2]|0,o=o-(1<>2])|0,l=(l|0)>30?31:l+1|0,e[h>>2]=l,l=e[36476+(l<<2)>>2]|0;while((o|0)>=(1<>1]=I[ne>>1]|0,I[P+2>>1]=I[ne+2>>1]|0,I[P+4>>1]=I[ne+4>>1]|0,I[O>>1]=K,I[O+2>>1]=G,I[O+4>>1]=$,r=Q+(r*6|0)|0,I[N>>1]=I[P>>1]|0,I[N+2>>1]=I[P+2>>1]|0,I[N+4>>1]=I[P+4>>1]|0,I[R>>1]=I[O>>1]|0,I[R+2>>1]=I[O+2>>1]|0,I[R+4>>1]=I[O+4>>1]|0,I[_>>1]=I[r>>1]|0,I[_+2>>1]=I[r+2>>1]|0,I[_+4>>1]=I[r+4>>1]|0,t1(U,t,N,R,_),I[ne>>1]=I[U>>1]|0,I[ne+2>>1]=I[U+2>>1]|0,I[ne+4>>1]=I[U+4>>1]|0,ne=e[h>>2]|0,e[h>>2]=(ne|0)<1?0:ne+-1|0,ne=k+1|0,b=oe,ne|0)}function Hn(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0;if(Q=r>>31,h=(Q^r)-Q|0,_=t+196+(h*12|0)+10|0,d=I[_>>1]|0,R=t+196+(h*12|0)|0,c=e[R>>2]|0,(d|0)<(c|0))if((d<<1|0)<(c|0))if((d<<2|0)<(c|0))if((d<<3|0)<(c|0))if((d<<4|0)<(c|0))for(r=5;(d<>1]^Q)-Q+l|0,U=t+136|0,l=e[U>>2]|0,(c&l|0)==(c|0)?D=c:D=l&~(c>>31),c=(o-D^Q)-Q|0,C=t+144|0,l=e[C>>2]|0,(c|0)>0?c=(c+l|0)/(l<<1|1|0)|0:c=(c-l|0)/(l<<1|1|0)|0,N=t+140|0,w=e[N>>2]|0,o=((c|0)<0?w:0)+c|0,w=o-((o|0)<((w+1|0)/2|0|0)?0:w)|0,h=t+196+(h*12|0)+4|0,l|r?c=0:c=(e[h>>2]<<1)+-1+d>>31,l=c^w,rs(t,r,l>>30^l<<1,e[t+156>>2]|0),l=e[t+160>>2]|0,r=(e[R>>2]|0)+((w|0)>-1?w:0-w|0)|0,c=(e[h>>2]|0)+(ee(e[C>>2]<<1|1,w)|0)|0,o=I[_>>1]|0,(o|0)==(l|0)&&(r=r>>1,c=c>>1,o=l>>1),e[R>>2]=r,l=o+1|0,I[_>>1]=l,r=l+c|0,(r|0)>=1?(c|0)>0&&(c=c-l|0,_=I[k>>1]|0,I[k>>1]=(_<<16>>16<127&1)+(_&65535),c=(c|0)>0?0:c):(c=I[k>>1]|0,I[k>>1]=(c&65535)-(c<<16>>16>-128&1),c=(r|0)>(~o|0)?r:0-o|0),e[h>>2]=c,l=e[C>>2]|0,o=l<<1|1,r=(ee(o,(w^Q)-Q|0)|0)+D|0,(r|0)>=(0-l|0)?(c=e[U>>2]|0,(c+l|0)<(r|0)&&(r=r-(ee(e[N>>2]|0,o)|0)|0)):(r=(ee(e[N>>2]|0,o)|0)+r|0,c=e[U>>2]|0),(r&c|0)==(r|0)?(Q=r,Q=Q&65535,Q|0):(Q=c&~(r>>31),Q=Q&65535,Q|0)}function rs(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0;if(c=o>>r,h=t+148|0,d=l-(e[h>>2]|0)|0,(c|0)<(d+-1|0)){(c|0)>30&&(l=(c|0)/2|0,_t(t,0,l),c=c-l|0),_t(t,1,c+1|0),_t(t,(1<31?(_t(t,0,31),_t(t,1,l+-31-(e[h>>2]|0)|0)):_t(t,1,d),r=e[h>>2]|0,_t(t,(1<>1]|0,R=N-(M[l>>1]|0)>>31|1,h=ee(R,(M[o>>1]|0)-N|0)|0,D=r+144|0,d=e[D>>2]|0,(h|0)>0?h=(h+d|0)/(d<<1|1|0)|0:h=(h-d|0)/(d<<1|1|0)|0,P=r+140|0,C=e[P>>2]|0,w=((h|0)<0?C:0)+h|0,C=w-((w|0)<((C+1|0)/2|0|0)?0:C)|0,w=r+4576|0,Qn(r,w,C),K=M[c+2>>1]|0,G=K-(M[l+2>>1]|0)>>31|1,h=ee(G,(M[o+2>>1]|0)-K|0)|0,d=e[D>>2]|0,(h|0)>0?h=(h+d|0)/(d<<1|1|0)|0:h=(h-d|0)/(d<<1|1|0)|0,_=e[P>>2]|0,$=((h|0)<0?_:0)+h|0,_=$-(($|0)<((_+1|0)/2|0|0)?0:_)|0,Qn(r,w,_),$=M[c+4>>1]|0,Q=$-(M[l+4>>1]|0)>>31|1,h=ee(Q,(M[o+4>>1]|0)-$|0)|0,d=e[D>>2]|0,(h|0)>0?h=(h+d|0)/(d<<1|1|0)|0:h=(h-d|0)/(d<<1|1|0)|0,k=e[P>>2]|0,h=((h|0)<0?k:0)+h|0,k=h-((h|0)<((k+1|0)/2|0|0)?0:k)|0,Qn(r,w,k),w=e[D>>2]|0,D=w<<1|1,h=(ee(ee(D,C)|0,R)|0)+N|0,o=0-w|0,(h|0)>=(o|0)?(d=e[U>>2]|0,(d+w|0)<(h|0)&&(h=h-(ee(e[P>>2]|0,D)|0)|0),l=d):(h=(ee(e[P>>2]|0,D)|0)+h|0,l=e[U>>2]|0),(h&l|0)!=(h|0)&&(h=l&~(h>>31)),c=h&65535,h=(ee(ee(D,_)|0,G)|0)+K|0,(h|0)>=(o|0)?(l+w|0)<(h|0)&&(h=h-(ee(e[P>>2]|0,D)|0)|0):h=(ee(e[P>>2]|0,D)|0)+h|0,(h&l|0)!=(h|0)&&(h=l&~(h>>31)),d=h&65535,h=(ee(ee(D,k)|0,Q)|0)+$|0,(h|0)>=(o|0)?(l+w|0)<(h|0)&&(h=h-(ee(e[P>>2]|0,D)|0)|0):h=(ee(e[P>>2]|0,D)|0)+h|0,(h&l|0)==(h|0)){P=h,P=P&65535,I[t>>1]=c,$=t+2|0,I[$>>1]=d,t=t+4|0,I[t>>1]=P;return}P=l&~(h>>31),P=P&65535,I[t>>1]=c,$=t+2|0,I[$>>1]=d,t=t+4|0,I[t>>1]=P}function Qn(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0;if(k=r+9|0,d=F[k>>0]|0,D=r+4|0,C=e[D>>2]|0,c=(ee(d>>>1,C)|0)+(e[r>>2]|0)|0,(d|0)<(c|0)){h=d,l=0;do h=h<<1,l=l+1|0;while((h|0)<(c|0));c=l}else c=0;(o|0)>0&(c|0)==0&&F[r+10>>0]<<1>>>0>>0?l=1:w=5;do if((w|0)==5){if(l=(o|0)<0,l&&F[r+10>>0]<<1>>>0>=d>>>0){l=1;break}l=l&(c|0)!=0}while(!1);if(l=(((o|0)>-1?o:0-o|0)<<1)-C+(l<<31>>31)|0,rs(t,c,l,(e[t+156>>2]|0)+-1-(e[36476+(e[t+4600>>2]<<2)>>2]|0)|0),(o|0)<0&&(t=r+10|0,S[t>>0]=(F[t>>0]|0)+1),l=(l+1-(e[D>>2]|0)>>1)+(e[r>>2]|0)|0,e[r>>2]=l,c=S[k>>0]|0,c<<24>>24!=(S[r+8>>0]|0)){r=c,r=r&255,r=r+1|0,r=r&255,S[k>>0]=r;return}e[r>>2]=l>>1,t=(c&255)>>>1,S[k>>0]=t,r=r+10|0,S[r>>0]=(F[r>>0]|0)>>>1,r=t,r=r&255,r=r+1|0,r=r&255,S[k>>0]=r}function i1(t){t=t|0;var r=0,o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0;R=b,b=b+32|0,l=R,N=t+144|0;e:do if(e[N>>2]|0)r=t+152|0;else if(o=e[t+136>>2]|0,r=t+152|0,(o|0)==((1<>2])+-1|0)&&(m0(l,o,0),(e[l+4>>2]|0)==(e[t+184>>2]|0))&&(e[l+8>>2]|0)==(e[t+188>>2]|0)&&(e[l+12>>2]|0)==(e[t+192>>2]|0))switch(e[r>>2]|0){case 8:{N=e[8900]|0,e[t+4612>>2]=N+(((e[8901]|0)-N|0)>>>1),b=R;return}case 10:{N=e[8903]|0,e[t+4612>>2]=N+(((e[8904]|0)-N|0)>>>1),b=R;return}case 12:{N=e[8906]|0,e[t+4612>>2]=N+(((e[8907]|0)-N|0)>>>1),b=R;return}case 16:{N=e[8909]|0,e[t+4612>>2]=N+(((e[8910]|0)-N|0)>>>1),b=R;return}default:break e}while(!1);if(k=1<>2],o=t+4616|0,l=k<<1,c=t+4620|0,h=e[c>>2]|0,r=e[o>>2]|0,d=h-r|0,l>>>0<=d>>>0?l>>>0>>0&&(w=r+l|0,(h|0)!=(w|0))&&(e[c>>2]=w):(j0(o,l-d|0),r=e[o>>2]|0),D=t+4612|0,e[D>>2]=r+k,r=0-k|0,(k|0)<=(r|0)){b=R;return}w=t+192|0,C=t+188|0,d=t+184|0,h=r;do r=e[w>>2]|0,(h|0)>(0-r|0)?(o=e[C>>2]|0,(h|0)>(0-o|0)?(l=e[d>>2]|0,(h|0)>(0-l|0)?(c=e[N>>2]|0,(h|0)>=(0-c|0)?(c|0)<(h|0)?(l|0)<=(h|0)?(o|0)>(h|0)?r=2:r=(r|0)>(h|0)?3:4:r=1:r=0:r=-1):r=-2):r=-3):r=-4,S[(e[D>>2]|0)+h>>0]=r,h=h+1|0;while((h|0)!=(k|0));b=R}function n1(t){t=t|0;var r=0,o=0;e[t>>2]=36024,r=e[t+4616>>2]|0,r&&(o=t+4620|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),e[t>>2]=36612,r=e[t+120>>2]|0,r&&(o=t+124|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),o=t+92|0,r=e[o>>2]|0,e[o>>2]=0,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r),t=t+4|0,r=e[t>>2]|0,e[t>>2]=0,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r)}function r1(t){t=t|0;var r=0,o=0;if(e[t>>2]=36024,r=e[t+4616>>2]|0,r&&(o=t+4620|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),e[t>>2]=36612,r=e[t+120>>2]|0,r&&(o=t+124|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),o=t+92|0,r=e[o>>2]|0,e[o>>2]=0,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r),o=t+4|0,r=e[o>>2]|0,e[o>>2]=0,!r){he(t);return}Mt[e[(e[r>>2]|0)+4>>2]&255](r),he(t)}function s1(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0;d=b,b=b+32|0,C=d,m0(C,e[t+136>>2]|0,e[t+144>>2]|0),w=e[r+4>>2]|0,h=e[r+8>>2]|0,h=h|0?h:e[C+8>>2]|0,c=e[r+12>>2]|0,c=c|0?c:e[C+12>>2]|0,o=e[r+16>>2]|0,l=e[C+16>>2]|0,e[t+184>>2]=w|0?w:e[C+4>>2]|0,e[t+188>>2]=h,e[t+192>>2]=c,O1(t),c=t+140|0,r=(e[c>>2]|0)+32|0,r=(r|0)<128?2:(r|0)/64|0,h=0;do e[t+196+(h*12|0)>>2]=r,e[t+196+(h*12|0)+4>>2]=0,I[t+196+(h*12|0)+8>>1]=0,I[t+196+(h*12|0)+10>>1]=1,h=h+1|0;while((h|0)!=365);w=(e[c>>2]|0)+32|0,w=(w|0)<128?2:(w|0)/64|0,C=(o|0?o:l)&255,e[t+4576>>2]=w,e[t+4580>>2]=0,S[t+4584>>0]=C,S[t+4585>>0]=1,S[t+4586>>0]=0,e[t+4588>>2]=w,e[t+4592>>2]=1,S[t+4596>>0]=C,S[t+4597>>0]=1,S[t+4598>>0]=0,e[t+4600>>2]=0,b=d}function o1(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0,D=0,k=0;if(k=b,b=b+16|0,C=k,w=t+92|0,d=e[r>>2]|0,e[r>>2]=0,r=e[w>>2]|0,e[w>>2]=d,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r),e[C>>2]=0,e[C+4>>2]=l,w=o+8|0,e[C+8>>2]=e[w>>2],l){r=Xe(4624)|0,l=t+8|0,c=r+4|0,h=l,d=c+84|0;do e[c>>2]=e[h>>2],c=c+4|0,h=h+4|0;while((c|0)<(d|0));c=r+88|0,d=c+40|0;do e[c>>2]=0,c=c+4|0;while((c|0)<(d|0));e[r>>2]=35800,e[r+128>>2]=e[t+136>>2],e[r+132>>2]=e[t+140>>2],e[r+136>>2]=e[t+144>>2],e[r+140>>2]=e[t+148>>2],e[r+144>>2]=e[t+152>>2],e[r+148>>2]=e[t+156>>2],e[r+152>>2]=e[t+160>>2],c=r+156|0,e[c>>2]=0,e[c+4>>2]=0,e[c+8>>2]=0,e[c+12>>2]=0,e[r+172>>2]=e[l>>2],e[r+176>>2]=0,e[r+180>>2]=0,e[r+184>>2]=0,c=r+4568|0,l=r+188|0;do e[l>>2]=0,e[l+4>>2]=0,I[l+8>>1]=0,I[l+10>>1]=1,l=l+12|0;while((l|0)!=(c|0));h=t+4|0,e[c>>2]=0,e[c+4>>2]=0,I[c+8>>1]=0,S[c+10>>0]=0,d=r+4580|0,e[d>>2]=0,e[d+4>>2]=0,I[d+8>>1]=0,S[d+10>>0]=0,d=r+4592|0,e[d>>2]=0,e[d+4>>2]=0,e[d+8>>2]=0,e[d+12>>2]=0,e[d+16>>2]=0,e[d+20>>2]=0,e[d+24>>2]=0,S[d+28>>0]=0,e[r+28>>2]|0||(e[r+20>>2]=1),l=e[h>>2]|0,e[h>>2]=r,l&&(Mt[e[(e[l>>2]|0)+4>>2]&255](l),r=e[h>>2]|0),Y0(r,C)}return C=t+100|0,e[C>>2]=32,e[t+96>>2]=0,r=e[o>>2]|0,r?(e[t+132>>2]=r,c=t+120|0,w=t+124|0,l=e[w>>2]|0,r=e[c>>2]|0,h=r,d=l-h|0,d>>>0>=4e3?d>>>0>4e3&&(D=r+4e3|0,(l|0)!=(D|0))&&(e[w>>2]=D,l=D):(vi(c,4e3-d|0),r=e[c>>2]|0,h=r,l=e[w>>2]|0),e[t+108>>2]=h,e[t+104>>2]=l-r,us(t),D=t+116|0,D=e[D>>2]|0,t=e[C>>2]|0,t=t+-32|0,t=(t|0)/8|0,t=D-t|0,b=k,t|0):(e[t+108>>2]=e[o+4>>2],e[t+104>>2]=e[w>>2],us(t),D=t+116|0,D=e[D>>2]|0,t=e[C>>2]|0,t=t+-32|0,t=(t|0)/8|0,t=D-t|0,b=k,t|0)}function l1(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0,G=0,$=0,P=0,O=0;if(G=b,b=b+352|0,$=G+328|0,P=G+192|0,o=G+343|0,l=G+342|0,c=G+341|0,h=G+340|0,R=G+176|0,w=G+168|0,C=G+160|0,D=G+152|0,K=G,U=G+136|0,e[t+32>>2]|0&&(e[t+24>>2]|0)!=1){if(_=t+8|0,Q=t+36|0,d=e[Q>>2]|0,!d){if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[o>>0]|0,$e(44,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}if(t=e[t+16>>2]|0,(t|0)==8)switch(d|0){case 1:{if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[l>>0]|0,$e(45,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 2:{if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[c>>0]|0,$e(46,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 3:{if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[h>>0]|0,$e(47,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}default:{d=P+56|0,c=P+4|0,e[P>>2]=36160,e[d>>2]=36180,g=0,Ae(62,P+56|0,c|0),G=g,g=0,G&1&&(O=j()|0,tt(d),le(O|0)),e[P+128>>2]=0,e[P+132>>2]=-1,e[P>>2]=36200,e[P+56>>2]=36220,g=0,ue(180,c|0),G=g,g=0;do if(G&1)t=j()|0;else{if(e[c>>2]=36236,h=P+36|0,e[h>>2]=0,e[h+4>>2]=0,e[h+8>>2]=0,e[h+12>>2]=0,e[P+52>>2]=16,e[$>>2]=0,e[$+4>>2]=0,e[$+8>>2]=0,g=0,Ae(63,c|0,$|0),G=g,g=0,G&1){t=j()|0,de($),de(h),wt(c);break}de($),g=0,t=Ve(28,P|0,49007,21)|0,$=g,g=0;do if(!($&1)&&(g=0,k=be(36,t|0,e[Q>>2]|0)|0,$=g,g=0,!($&1))&&(g=0,Ve(28,k|0,50997,18)|0,$=g,g=0,!($&1))){if(l=Ct(16)|0,g=0,Ae(64,R|0,c|0),$=g,g=0,$&1)t=j()|0;else if(!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,H|0)|0,bt(8)),g=0,$e(36,l|0,9,35648,R|0),$=g,g=0,$&1?o=1:(g=0,xe(6,l|0,824,96),g=0,o=0),t=j()|0,de(R),!o)break;Tt(l|0)}else O=34;while(!1);(O|0)==34&&(t=j()|0),e[P>>2]=36200,e[d>>2]=36220,e[c>>2]=36236,de(h),wt(c),tt(d),O=t,le(O|0)}while(!1);O=t,tt(d),le(O|0)}}switch((t|0)<=8&&(t=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,H|0)|0,bt(8)),g=0,xe(7,t|0,8,35648),O=g,g=0,O&1||Qt(t|0,824,96),O=j()|0,Tt(t|0),le(O|0)),o=16-t|0,d|0){case 1:{if(t=Xe(60)|0,e[w>>2]=o,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],e[$>>2]=e[w>>2],e[$+4>>2]=e[w+4>>2],$e(41,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 2:{if(t=Xe(60)|0,e[C>>2]=o,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],e[$>>2]=e[C>>2],e[$+4>>2]=e[C+4>>2],$e(42,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 3:{if(t=Xe(60)|0,e[D>>2]=o,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],e[$>>2]=e[D>>2],e[$+4>>2]=e[D+4>>2],$e(43,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}default:{d=K+56|0,c=K+4|0,e[K>>2]=36160,e[d>>2]=36180,g=0,Ae(62,K+56|0,c|0),P=g,g=0,P&1&&(O=j()|0,tt(d),le(O|0)),e[K+128>>2]=0,e[K+132>>2]=-1,e[K>>2]=36200,e[K+56>>2]=36220,g=0,ue(180,c|0),P=g,g=0;do if(P&1)t=j()|0;else{if(e[c>>2]=36236,h=K+36|0,e[h>>2]=0,e[h+4>>2]=0,e[h+8>>2]=0,e[h+12>>2]=0,e[K+52>>2]=16,e[$>>2]=0,e[$+4>>2]=0,e[$+8>>2]=0,g=0,Ae(63,c|0,$|0),P=g,g=0,P&1){t=j()|0,de($),de(h),wt(c);break}de($),g=0,t=Ve(28,K|0,49007,21)|0,P=g,g=0;do if(!(P&1)&&(g=0,N=be(36,t|0,e[Q>>2]|0)|0,P=g,g=0,!(P&1))&&(g=0,Ve(28,N|0,50997,18)|0,P=g,g=0,!(P&1))){if(l=Ct(16)|0,g=0,Ae(64,U|0,c|0),P=g,g=0,P&1)t=j()|0;else if(!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,H|0)|0,bt(8)),g=0,$e(36,l|0,9,35648,U|0),P=g,g=0,P&1?o=1:(g=0,xe(6,l|0,824,96),g=0,o=0),t=j()|0,de(U),!o)break;Tt(l|0)}else O=64;while(!1);(O|0)==64&&(t=j()|0),e[K>>2]=36200,e[d>>2]=36220,e[c>>2]=36236,de(h),wt(c),tt(d),O=t,le(O|0)}while(!1);O=t,tt(d),le(O|0)}}}return o=e[r+4>>2]|0,l=Xe(16)|0,t=e[t+20>>2]|0,o?(e[l>>2]=36108,e[l+4>>2]=o,e[l+8>>2]=3,e[l+12>>2]=t,O=l,b=G,O|0):(O=e[r>>2]|0,e[l>>2]=36132,e[l+4>>2]=O,e[l+8>>2]=3,e[l+12>>2]=t,O=l,b=G,O|0)}function u1(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0;e[t>>2]=36712,e[t+4>>2]=o,k=t+8|0,l=e[o>>2]|0,C=o+16|0,d=e[C>>2]|0,h=ee(d,l)|0,e[k>>2]=0,N=t+12|0,e[N>>2]=0,e[t+16>>2]=0;do if(!h)h=d;else{if((h|0)<0&&(g=0,ue(178,k|0),d=g,g=0,d&1)||(D=4),(D|0)==4&&(g=0,w=ge(67,h|0)|0,d=g,g=0,!(d&1))){e[N>>2]=w,e[k>>2]=w,e[t+16>>2]=w+h,l=w;do S[l>>0]=0,l=(e[N>>2]|0)+1|0,e[N>>2]=l,h=h+-1|0;while(h|0);h=e[C>>2]|0,l=e[o>>2]|0;break}l=j()|0,c=e[k>>2]|0,c&&((e[N>>2]|0)!=(c|0)&&(e[N>>2]=c),he(c)),N=l,le(N|0)}while(!1);if(d=t+20|0,l=ee(h,l)|0,e[d>>2]=0,h=t+24|0,e[h>>2]=0,e[t+28>>2]=0,!l){N=t+36|0,e[N>>2]=e[r>>2],e[N+4>>2]=e[r+4>>2],e[N+8>>2]=e[r+8>>2];return}if((l|0)<0&&(g=0,ue(178,d|0),o=g,g=0,o&1)||(D=15),(D|0)==15&&(g=0,c=ge(67,l|0)|0,D=g,g=0,!(D&1))){e[h>>2]=c,e[d>>2]=c,e[t+28>>2]=c+l;do S[c>>0]=0,c=(e[h>>2]|0)+1|0,e[h>>2]=c,l=l+-1|0;while(l|0);N=t+36|0,e[N>>2]=e[r>>2],e[N+4>>2]=e[r+4>>2],e[N+8>>2]=e[r+8>>2];return}l=j()|0,c=e[d>>2]|0,c&&((e[h>>2]|0)!=(c|0)&&(e[h>>2]=c),he(c)),c=e[k>>2]|0,c||(N=l,le(N|0)),(e[N>>2]|0)!=(c|0)&&(e[N>>2]=c),he(c),N=l,le(N|0)}function c1(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0;e[t>>2]=36688,e[t+4>>2]=o,k=t+8|0,l=e[o>>2]|0,C=o+16|0,d=e[C>>2]|0,h=ee(d,l)|0,e[k>>2]=0,N=t+12|0,e[N>>2]=0,e[t+16>>2]=0;do if(!h)h=d;else{if((h|0)<0&&(g=0,ue(178,k|0),d=g,g=0,d&1)||(D=4),(D|0)==4&&(g=0,w=ge(67,h|0)|0,d=g,g=0,!(d&1))){e[N>>2]=w,e[k>>2]=w,e[t+16>>2]=w+h,l=w;do S[l>>0]=0,l=(e[N>>2]|0)+1|0,e[N>>2]=l,h=h+-1|0;while(h|0);h=e[C>>2]|0,l=e[o>>2]|0;break}l=j()|0,c=e[k>>2]|0,c&&((e[N>>2]|0)!=(c|0)&&(e[N>>2]=c),he(c)),N=l,le(N|0)}while(!1);if(d=t+20|0,l=ee(h,l)|0,e[d>>2]=0,h=t+24|0,e[h>>2]=0,e[t+28>>2]=0,!l){N=t+36|0,e[N>>2]=e[r>>2],e[N+4>>2]=e[r+4>>2],e[N+8>>2]=e[r+8>>2];return}if((l|0)<0&&(g=0,ue(178,d|0),o=g,g=0,o&1)||(D=15),(D|0)==15&&(g=0,c=ge(67,l|0)|0,D=g,g=0,!(D&1))){e[h>>2]=c,e[d>>2]=c,e[t+28>>2]=c+l;do S[c>>0]=0,c=(e[h>>2]|0)+1|0,e[h>>2]=c,l=l+-1|0;while(l|0);N=t+36|0,e[N>>2]=e[r>>2],e[N+4>>2]=e[r+4>>2],e[N+8>>2]=e[r+8>>2];return}l=j()|0,c=e[d>>2]|0,c&&((e[h>>2]|0)!=(c|0)&&(e[h>>2]=c),he(c)),c=e[k>>2]|0,c||(N=l,le(N|0)),(e[N>>2]|0)!=(c|0)&&(e[N>>2]=c),he(c),N=l,le(N|0)}function f1(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0;e[t>>2]=36664,e[t+4>>2]=o,k=t+8|0,l=e[o>>2]|0,C=o+16|0,d=e[C>>2]|0,h=ee(d,l)|0,e[k>>2]=0,N=t+12|0,e[N>>2]=0,e[t+16>>2]=0;do if(!h)h=d;else{if((h|0)<0&&(g=0,ue(178,k|0),d=g,g=0,d&1)||(D=4),(D|0)==4&&(g=0,w=ge(67,h|0)|0,d=g,g=0,!(d&1))){e[N>>2]=w,e[k>>2]=w,e[t+16>>2]=w+h,l=w;do S[l>>0]=0,l=(e[N>>2]|0)+1|0,e[N>>2]=l,h=h+-1|0;while(h|0);h=e[C>>2]|0,l=e[o>>2]|0;break}l=j()|0,c=e[k>>2]|0,c&&((e[N>>2]|0)!=(c|0)&&(e[N>>2]=c),he(c)),N=l,le(N|0)}while(!1);if(d=t+20|0,l=ee(h,l)|0,e[d>>2]=0,h=t+24|0,e[h>>2]=0,e[t+28>>2]=0,!l){N=t+36|0,e[N>>2]=e[r>>2],e[N+4>>2]=e[r+4>>2],e[N+8>>2]=e[r+8>>2];return}if((l|0)<0&&(g=0,ue(178,d|0),o=g,g=0,o&1)||(D=15),(D|0)==15&&(g=0,c=ge(67,l|0)|0,D=g,g=0,!(D&1))){e[h>>2]=c,e[d>>2]=c,e[t+28>>2]=c+l;do S[c>>0]=0,c=(e[h>>2]|0)+1|0,e[h>>2]=c,l=l+-1|0;while(l|0);N=t+36|0,e[N>>2]=e[r>>2],e[N+4>>2]=e[r+4>>2],e[N+8>>2]=e[r+8>>2];return}l=j()|0,c=e[d>>2]|0,c&&((e[h>>2]|0)!=(c|0)&&(e[h>>2]=c),he(c)),c=e[k>>2]|0,c||(N=l,le(N|0)),(e[N>>2]|0)!=(c|0)&&(e[N>>2]=c),he(c),N=l,le(N|0)}function h1(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0;e[t>>2]=36640,e[t+4>>2]=o,k=t+8|0,l=e[o>>2]|0,C=o+16|0,d=e[C>>2]|0,h=ee(d,l)|0,e[k>>2]=0,N=t+12|0,e[N>>2]=0,e[t+16>>2]=0;do if(!h)h=d;else{if((h|0)<0&&(g=0,ue(178,k|0),d=g,g=0,d&1)||(D=4),(D|0)==4&&(g=0,w=ge(67,h|0)|0,d=g,g=0,!(d&1))){e[N>>2]=w,e[k>>2]=w,e[t+16>>2]=w+h,l=w;do S[l>>0]=0,l=(e[N>>2]|0)+1|0,e[N>>2]=l,h=h+-1|0;while(h|0);h=e[C>>2]|0,l=e[o>>2]|0;break}l=j()|0,c=e[k>>2]|0,c&&((e[N>>2]|0)!=(c|0)&&(e[N>>2]=c),he(c)),N=l,le(N|0)}while(!1);if(d=t+20|0,l=ee(h,l)|0,e[d>>2]=0,h=t+24|0,e[h>>2]=0,e[t+28>>2]=0,!l){N=t+36|0,e[N>>2]=e[r>>2],e[N+4>>2]=e[r+4>>2],e[N+8>>2]=e[r+8>>2];return}if((l|0)<0&&(g=0,ue(178,d|0),o=g,g=0,o&1)||(D=15),(D|0)==15&&(g=0,c=ge(67,l|0)|0,D=g,g=0,!(D&1))){e[h>>2]=c,e[d>>2]=c,e[t+28>>2]=c+l;do S[c>>0]=0,c=(e[h>>2]|0)+1|0,e[h>>2]=c,l=l+-1|0;while(l|0);N=t+36|0,e[N>>2]=e[r>>2],e[N+4>>2]=e[r+4>>2],e[N+8>>2]=e[r+8>>2];return}l=j()|0,c=e[d>>2]|0,c&&((e[h>>2]|0)!=(c|0)&&(e[h>>2]=c),he(c)),c=e[k>>2]|0,c||(N=l,le(N|0)),(e[N>>2]|0)!=(c|0)&&(e[N>>2]=c),he(c),N=l,le(N|0)}function d1(t){t=t|0;var r=0,o=0;e[t>>2]=36640,r=e[t+20>>2]|0,r&&(o=t+24|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),o=e[t+8>>2]|0,o&&(r=t+12|0,(e[r>>2]|0)!=(o|0)&&(e[r>>2]=o),he(o))}function p1(t){t=t|0;var r=0,o=0;if(e[t>>2]=36640,r=e[t+20>>2]|0,r&&(o=t+24|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),r=e[t+8>>2]|0,!r){he(t);return}o=t+12|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r),he(t)}function m1(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0;if(c=t+36|0,!(e[c>>2]|0)){c=t+40|0,ss(t,r,e[c>>2]|0,o,l),e[c>>2]=(e[c>>2]|0)+(e[(e[t+4>>2]|0)+12>>2]|0);return}h=ee(e[(e[t+4>>2]|0)+16>>2]|0,o)|0,d=t+20|0,ss(t,r,e[d>>2]|0,o,l),t=e[c>>2]|0,(Yt[e[(e[t>>2]|0)+48>>2]&63](t,e[d>>2]|0,h)|0)!=(h|0)&&(c=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,H|0)|0,bt(8)),g=0,xe(7,c|0,3,35648),d=g,g=0,d&1?(d=j()|0,Tt(c|0),le(d|0)):Qt(c|0,824,96))}function g1(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0;if(c=e[t+36>>2]|0,c){S1(t,c,r,o,l);return}else{c=t+40|0,Kn(t,e[c>>2]|0,r,o,l),e[c>>2]=(e[c>>2]|0)+(e[(e[t+4>>2]|0)+12>>2]|0);return}}function Kn(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0;if(w=t+4|0,h=e[w>>2]|0,!(S[h+32>>0]|0))w=r;else{if(d=t+8|0,o0(e[d>>2]|0,r|0,l*3|0)|0,h=e[w>>2]|0,r=e[h+16>>2]|0,(l|0)>0){for(h=e[d>>2]|0,t=0;C=h+2|0,D=S[h>>0]|0,S[h>>0]=S[C>>0]|0,S[C>>0]=D,t=t+1|0,(t|0)!=(l|0);)h=h+r|0;h=e[w>>2]|0}w=e[d>>2]|0}switch(e[h+16>>2]|0){case 3:{if((e[h+24>>2]|0)==2){if((l|0)>0)h=0;else return;do d=F[w+(h*3|0)+1>>0]|0,c=128-d+(F[w+(h*3|0)+2>>0]|0)|0,C=(F[w+(h*3|0)>>0]|0)-d+128|0,D=o+(h*3|0)|0,S[D>>0]=d+192+(((c&255)+(C&255)|0)>>>2),S[D+1>>0]=c,S[D+2>>0]=C,h=h+1|0;while((h|0)!=(l|0));return}if(h=(c|0)<(l|0)?c:l,(h|0)<=0)return;t=c<<1,r=0;do l=F[w+(r*3|0)+1>>0]|0,C=128-l+(F[w+(r*3|0)+2>>0]|0)|0,D=(F[w+(r*3|0)>>0]|0)-l+128|0,S[o+r>>0]=l+192+(((C&255)+(D&255)|0)>>>2),S[o+(r+c)>>0]=C,S[o+(r+t)>>0]=D,r=r+1|0;while((r|0)!=(h|0));return}case 4:{if((e[h+24>>2]|0)!=1||(h=(c|0)<(l|0)?c:l,(h|0)<=0))return;t=c<<1,r=c*3|0,d=0;do D=S[w+(d<<2)+3>>0]|0,k=F[w+(d<<2)+1>>0]|0,l=128-k+(F[w+(d<<2)+2>>0]|0)|0,C=(F[w+(d<<2)>>0]|0)-k+128|0,S[o+d>>0]=k+192+(((l&255)+(C&255)|0)>>>2),S[o+(d+c)>>0]=l,S[o+(d+t)>>0]=C,S[o+(d+r)>>0]=D,d=d+1|0;while((d|0)!=(h|0));return}default:return}}function S1(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0;if(k=b,b=b+176|0,N=k+152|0,_=k+16|0,R=k,d=ee(e[(e[t+4>>2]|0)+16>>2]|0,l)|0,C=t+20|0,h=e[C>>2]|0,!d){_=h,Kn(t,_,o,l,c),b=k;return}for(;w=Yt[e[(e[r>>2]|0)+32>>2]&63](r,h,d)|0,!!w;)if(h=e[C>>2]|0,(d|0)==(w|0)){D=26;break}else d=d-w|0;if((D|0)==26){Kn(t,h,o,l,c),b=k;return}o=_+56|0,C=_+4|0,e[_>>2]=36160,e[o>>2]=36180,g=0,Ae(62,_+56|0,C|0),k=g,g=0,k&1&&(_=j()|0,tt(o),le(_|0)),e[_+128>>2]=0,e[_+132>>2]=-1,e[_>>2]=36200,e[_+56>>2]=36220,g=0,ue(180,C|0),k=g,g=0;do if(k&1)h=j()|0;else{if(e[C>>2]=36236,r=_+36|0,e[r>>2]=0,e[r+4>>2]=0,e[r+8>>2]=0,e[r+12>>2]=0,e[_+52>>2]=16,e[N>>2]=0,e[N+4>>2]=0,e[N+8>>2]=0,g=0,Ae(63,C|0,N|0),k=g,g=0,k&1){h=j()|0,de(N),de(r),wt(C);break}de(N),g=0,h=Ve(28,_|0,49029,57)|0,N=g,g=0,!(N&1)&&(g=0,be(36,h|0,0)|0,N=g,g=0,!(N&1))&&(w=Ct(16)|0,g=0,Ae(64,R|0,C|0),N=g,g=0,N&1?h=j()|0:(!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,H|0)|0,bt(8)),g=0,$e(36,w|0,3,35648,R|0),N=g,g=0,N&1?d=1:(g=0,xe(6,w|0,824,96),g=0,d=0),h=j()|0,de(R),d||(R=h,e[_>>2]=36200,e[o>>2]=36220,e[C>>2]=36236,de(r),wt(C),tt(o),le(R|0))),Tt(w|0),R=h,e[_>>2]=36200,e[o>>2]=36220,e[C>>2]=36236,de(r),wt(C),tt(o),le(R|0)),R=j()|0,e[_>>2]=36200,e[o>>2]=36220,e[C>>2]=36236,de(r),wt(C),tt(o),le(R|0)}while(!1);_=h,tt(o),le(_|0)}function ss(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0;C=t+4|0,t=e[C>>2]|0;e:do switch(e[t+16>>2]|0){case 3:{if((e[t+24>>2]|0)==2){if((l|0)>0)t=0;else break e;for(;;)if(d=F[r+(t*3|0)+1>>0]|0,h=F[r+(t*3|0)+2>>0]|0,w=(F[r+(t*3|0)>>0]|0)-((h+d|0)>>>2)+64|0,c=o+(t*3|0)|0,S[c>>0]=h+128+w,S[c+1>>0]=w,S[c+2>>0]=d+128+w,t=t+1|0,(t|0)==(l|0))break e}if(t=(l|0)<(c|0)?l:c,(t|0)>0){h=c<<1,d=0;do k=F[r+(d+c)>>0]|0,N=F[r+(d+h)>>0]|0,D=(F[r+d>>0]|0)-((N+k|0)>>>2)+64|0,w=o+(d*3|0)|0,S[w>>0]=N+128+D,S[w+1>>0]=D,S[w+2>>0]=k+128+D,d=d+1|0;while((d|0)!=(t|0))}break}case 4:{if((e[t+24>>2]|0)==1&&(w=(l|0)<(c|0)?l:c,(w|0)>0)){t=c<<1,h=c*3|0,d=0;do D=F[r+(d+c)>>0]|0,R=F[r+(d+t)>>0]|0,k=(F[r+d>>0]|0)-((R+D|0)>>>2)+64|0,N=o+(d<<2)|0,k=k<<8&65280|F[r+(d+h)>>0]<<24|R+128+k&255|D+128+k<<16&16711680,S[N>>0]=k,S[N+1>>0]=k>>8,S[N+2>>0]=k>>16,S[N+3>>0]=k>>24,d=d+1|0;while((d|0)!=(w|0))}break}default:}while(!1);if(t=e[C>>2]|0,!!(S[t+32>>0]|0)){if(d=e[t+16>>2]|0,(l|0)>0)t=o,h=0;else return;for(;R=t+2|0,N=S[t>>0]|0,S[t>>0]=S[R>>0]|0,S[R>>0]=N,h=h+1|0,(h|0)!=(l|0);)t=t+d|0}}function A1(t){t=t|0;var r=0,o=0;e[t>>2]=36664,r=e[t+20>>2]|0,r&&(o=t+24|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),o=e[t+8>>2]|0,o&&(r=t+12|0,(e[r>>2]|0)!=(o|0)&&(e[r>>2]=o),he(o))}function v1(t){t=t|0;var r=0,o=0;if(e[t>>2]=36664,r=e[t+20>>2]|0,r&&(o=t+24|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),r=e[t+8>>2]|0,!r){he(t);return}o=t+12|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r),he(t)}function x1(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0;if(c=t+36|0,!(e[c>>2]|0)){c=t+40|0,os(t,r,e[c>>2]|0,o,l),e[c>>2]=(e[c>>2]|0)+(e[(e[t+4>>2]|0)+12>>2]|0);return}h=ee(e[(e[t+4>>2]|0)+16>>2]|0,o)|0,d=t+20|0,os(t,r,e[d>>2]|0,o,l),t=e[c>>2]|0,(Yt[e[(e[t>>2]|0)+48>>2]&63](t,e[d>>2]|0,h)|0)!=(h|0)&&(c=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,H|0)|0,bt(8)),g=0,xe(7,c|0,3,35648),d=g,g=0,d&1?(d=j()|0,Tt(c|0),le(d|0)):Qt(c|0,824,96))}function w1(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0;if(c=e[t+36>>2]|0,c){y1(t,c,r,o,l);return}else{c=t+40|0,Yn(t,e[c>>2]|0,r,o,l),e[c>>2]=(e[c>>2]|0)+(e[(e[t+4>>2]|0)+12>>2]|0);return}}function Yn(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0;if(w=t+4|0,h=e[w>>2]|0,!(S[h+32>>0]|0))w=r;else{if(d=t+8|0,o0(e[d>>2]|0,r|0,l*3|0)|0,h=e[w>>2]|0,r=e[h+16>>2]|0,(l|0)>0){for(h=e[d>>2]|0,t=0;C=h+2|0,D=S[h>>0]|0,S[h>>0]=S[C>>0]|0,S[C>>0]=D,t=t+1|0,(t|0)!=(l|0);)h=h+r|0;h=e[w>>2]|0}w=e[d>>2]|0}switch(e[h+16>>2]|0){case 3:{if((e[h+24>>2]|0)==2){if((l|0)>0)h=0;else return;do r=F[w+(h*3|0)>>0]|0,c=S[w+(h*3|0)+1>>0]|0,d=c&255,C=(F[w+(h*3|0)+2>>0]|0)+128-((d+r|0)>>>1)&255,D=o+(h*3|0)|0,S[D>>0]=r+128-d,S[D+1>>0]=c,S[D+2>>0]=C,h=h+1|0;while((h|0)!=(l|0));return}if(h=(c|0)<(l|0)?c:l,(h|0)<=0)return;t=c<<1,r=0;do C=S[w+(r*3|0)+1>>0]|0,d=F[w+(r*3|0)>>0]|0,l=C&255,D=(F[w+(r*3|0)+2>>0]|0)+128-((l+d|0)>>>1)&255,S[o+r>>0]=d+128-l,S[o+(r+c)>>0]=C,S[o+(r+t)>>0]=D,r=r+1|0;while((r|0)!=(h|0));return}case 4:{if((e[h+24>>2]|0)!=1||(h=(c|0)<(l|0)?c:l,(h|0)<=0))return;t=c<<1,r=c*3|0,d=0;do l=S[w+(d<<2)+1>>0]|0,D=S[w+(d<<2)+3>>0]|0,N=F[w+(d<<2)>>0]|0,k=l&255,C=(F[w+(d<<2)+2>>0]|0)+128-((k+N|0)>>>1)&255,S[o+d>>0]=N+128-k,S[o+(d+c)>>0]=l,S[o+(d+t)>>0]=C,S[o+(d+r)>>0]=D,d=d+1|0;while((d|0)!=(h|0));return}default:return}}function y1(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0;if(k=b,b=b+176|0,N=k+152|0,_=k+16|0,R=k,d=ee(e[(e[t+4>>2]|0)+16>>2]|0,l)|0,C=t+20|0,h=e[C>>2]|0,!d){_=h,Yn(t,_,o,l,c),b=k;return}for(;w=Yt[e[(e[r>>2]|0)+32>>2]&63](r,h,d)|0,!!w;)if(h=e[C>>2]|0,(d|0)==(w|0)){D=26;break}else d=d-w|0;if((D|0)==26){Yn(t,h,o,l,c),b=k;return}o=_+56|0,C=_+4|0,e[_>>2]=36160,e[o>>2]=36180,g=0,Ae(62,_+56|0,C|0),k=g,g=0,k&1&&(_=j()|0,tt(o),le(_|0)),e[_+128>>2]=0,e[_+132>>2]=-1,e[_>>2]=36200,e[_+56>>2]=36220,g=0,ue(180,C|0),k=g,g=0;do if(k&1)h=j()|0;else{if(e[C>>2]=36236,r=_+36|0,e[r>>2]=0,e[r+4>>2]=0,e[r+8>>2]=0,e[r+12>>2]=0,e[_+52>>2]=16,e[N>>2]=0,e[N+4>>2]=0,e[N+8>>2]=0,g=0,Ae(63,C|0,N|0),k=g,g=0,k&1){h=j()|0,de(N),de(r),wt(C);break}de(N),g=0,h=Ve(28,_|0,49029,57)|0,N=g,g=0,!(N&1)&&(g=0,be(36,h|0,0)|0,N=g,g=0,!(N&1))&&(w=Ct(16)|0,g=0,Ae(64,R|0,C|0),N=g,g=0,N&1?h=j()|0:(!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,H|0)|0,bt(8)),g=0,$e(36,w|0,3,35648,R|0),N=g,g=0,N&1?d=1:(g=0,xe(6,w|0,824,96),g=0,d=0),h=j()|0,de(R),d||(R=h,e[_>>2]=36200,e[o>>2]=36220,e[C>>2]=36236,de(r),wt(C),tt(o),le(R|0))),Tt(w|0),R=h,e[_>>2]=36200,e[o>>2]=36220,e[C>>2]=36236,de(r),wt(C),tt(o),le(R|0)),R=j()|0,e[_>>2]=36200,e[o>>2]=36220,e[C>>2]=36236,de(r),wt(C),tt(o),le(R|0)}while(!1);_=h,tt(o),le(_|0)}function os(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0;C=t+4|0,t=e[C>>2]|0;e:do switch(e[t+16>>2]|0){case 3:{if((e[t+24>>2]|0)==2){if((l|0)>0)t=0;else break e;for(;;)if(d=S[r+(t*3|0)+1>>0]|0,w=d&255,h=(F[r+(t*3|0)>>0]|0)+128+w|0,w=(F[r+(t*3|0)+2>>0]|0)+128+(((h&255)+w|0)>>>1)&255,c=o+(t*3|0)|0,S[c>>0]=h,S[c+1>>0]=d,S[c+2>>0]=w,t=t+1|0,(t|0)==(l|0))break e}if(t=(l|0)<(c|0)?l:c,(t|0)>0){h=c<<1,d=0;do k=S[r+(d+c)>>0]|0,D=k&255,N=(F[r+d>>0]|0)+128+D|0,D=(F[r+(d+h)>>0]|0)+128+(((N&255)+D|0)>>>1)&255,w=o+(d*3|0)|0,S[w>>0]=N,S[w+1>>0]=k,S[w+2>>0]=D,d=d+1|0;while((d|0)!=(t|0))}break}case 4:{if((e[t+24>>2]|0)==1&&(w=(l|0)<(c|0)?l:c,(w|0)>0)){t=c<<1,h=c*3|0,d=0;do k=F[r+(d+c)>>0]|0,D=(F[r+d>>0]|0)+128+k&255,N=o+(d<<2)|0,k=D|k<<8|F[r+(d+h)>>0]<<24|(F[r+(d+t)>>0]|0)+128+((D+k|0)>>>1)<<16&16711680,S[N>>0]=k,S[N+1>>0]=k>>8,S[N+2>>0]=k>>16,S[N+3>>0]=k>>24,d=d+1|0;while((d|0)!=(w|0))}break}default:}while(!1);if(t=e[C>>2]|0,!!(S[t+32>>0]|0)){if(d=e[t+16>>2]|0,(l|0)>0)t=o,h=0;else return;for(;N=t+2|0,k=S[t>>0]|0,S[t>>0]=S[N>>0]|0,S[N>>0]=k,h=h+1|0,(h|0)!=(l|0);)t=t+d|0}}function C1(t){t=t|0;var r=0,o=0;e[t>>2]=36688,r=e[t+20>>2]|0,r&&(o=t+24|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),o=e[t+8>>2]|0,o&&(r=t+12|0,(e[r>>2]|0)!=(o|0)&&(e[r>>2]=o),he(o))}function T1(t){t=t|0;var r=0,o=0;if(e[t>>2]=36688,r=e[t+20>>2]|0,r&&(o=t+24|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),r=e[t+8>>2]|0,!r){he(t);return}o=t+12|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r),he(t)}function I1(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0;if(c=t+36|0,!(e[c>>2]|0)){c=t+40|0,as(t,r,e[c>>2]|0,o,l),e[c>>2]=(e[c>>2]|0)+(e[(e[t+4>>2]|0)+12>>2]|0);return}h=ee(e[(e[t+4>>2]|0)+16>>2]|0,o)|0,d=t+20|0,as(t,r,e[d>>2]|0,o,l),t=e[c>>2]|0,(Yt[e[(e[t>>2]|0)+48>>2]&63](t,e[d>>2]|0,h)|0)!=(h|0)&&(c=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,H|0)|0,bt(8)),g=0,xe(7,c|0,3,35648),d=g,g=0,d&1?(d=j()|0,Tt(c|0),le(d|0)):Qt(c|0,824,96))}function E1(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0;if(c=e[t+36>>2]|0,c){D1(t,c,r,o,l);return}else{c=t+40|0,jn(t,e[c>>2]|0,r,o,l),e[c>>2]=(e[c>>2]|0)+(e[(e[t+4>>2]|0)+12>>2]|0);return}}function jn(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0;if(w=t+4|0,h=e[w>>2]|0,!(S[h+32>>0]|0))w=r;else{if(d=t+8|0,o0(e[d>>2]|0,r|0,l*3|0)|0,h=e[w>>2]|0,r=e[h+16>>2]|0,(l|0)>0){for(h=e[d>>2]|0,t=0;C=h+2|0,D=S[h>>0]|0,S[h>>0]=S[C>>0]|0,S[C>>0]=D,t=t+1|0,(t|0)!=(l|0);)h=h+r|0;h=e[w>>2]|0}w=e[d>>2]|0}switch(e[h+16>>2]|0){case 3:{if((e[h+24>>2]|0)==2){if((l|0)>0)h=0;else return;do c=S[w+(h*3|0)+1>>0]|0,d=c&255,C=128-d+(F[w+(h*3|0)+2>>0]|0)&255,D=o+(h*3|0)|0,S[D>>0]=(F[w+(h*3|0)>>0]|0)+128-d,S[D+1>>0]=c,S[D+2>>0]=C,h=h+1|0;while((h|0)!=(l|0));return}if(h=(c|0)<(l|0)?c:l,(h|0)<=0)return;t=c<<1,r=0;do C=S[w+(r*3|0)+1>>0]|0,l=C&255,D=128-l+(F[w+(r*3|0)+2>>0]|0)&255,S[o+r>>0]=(F[w+(r*3|0)>>0]|0)+128-l,S[o+(r+c)>>0]=C,S[o+(r+t)>>0]=D,r=r+1|0;while((r|0)!=(h|0));return}case 4:{if((e[h+24>>2]|0)!=1||(h=(c|0)<(l|0)?c:l,(h|0)<=0))return;t=c<<1,r=c*3|0,d=0;do l=S[w+(d<<2)+1>>0]|0,D=S[w+(d<<2)+3>>0]|0,k=l&255,C=128-k+(F[w+(d<<2)+2>>0]|0)&255,S[o+d>>0]=(F[w+(d<<2)>>0]|0)+128-k,S[o+(d+c)>>0]=l,S[o+(d+t)>>0]=C,S[o+(d+r)>>0]=D,d=d+1|0;while((d|0)!=(h|0));return}default:return}}function D1(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0;if(k=b,b=b+176|0,N=k+152|0,_=k+16|0,R=k,d=ee(e[(e[t+4>>2]|0)+16>>2]|0,l)|0,C=t+20|0,h=e[C>>2]|0,!d){_=h,jn(t,_,o,l,c),b=k;return}for(;w=Yt[e[(e[r>>2]|0)+32>>2]&63](r,h,d)|0,!!w;)if(h=e[C>>2]|0,(d|0)==(w|0)){D=26;break}else d=d-w|0;if((D|0)==26){jn(t,h,o,l,c),b=k;return}o=_+56|0,C=_+4|0,e[_>>2]=36160,e[o>>2]=36180,g=0,Ae(62,_+56|0,C|0),k=g,g=0,k&1&&(_=j()|0,tt(o),le(_|0)),e[_+128>>2]=0,e[_+132>>2]=-1,e[_>>2]=36200,e[_+56>>2]=36220,g=0,ue(180,C|0),k=g,g=0;do if(k&1)h=j()|0;else{if(e[C>>2]=36236,r=_+36|0,e[r>>2]=0,e[r+4>>2]=0,e[r+8>>2]=0,e[r+12>>2]=0,e[_+52>>2]=16,e[N>>2]=0,e[N+4>>2]=0,e[N+8>>2]=0,g=0,Ae(63,C|0,N|0),k=g,g=0,k&1){h=j()|0,de(N),de(r),wt(C);break}de(N),g=0,h=Ve(28,_|0,49029,57)|0,N=g,g=0,!(N&1)&&(g=0,be(36,h|0,0)|0,N=g,g=0,!(N&1))&&(w=Ct(16)|0,g=0,Ae(64,R|0,C|0),N=g,g=0,N&1?h=j()|0:(!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,H|0)|0,bt(8)),g=0,$e(36,w|0,3,35648,R|0),N=g,g=0,N&1?d=1:(g=0,xe(6,w|0,824,96),g=0,d=0),h=j()|0,de(R),d||(R=h,e[_>>2]=36200,e[o>>2]=36220,e[C>>2]=36236,de(r),wt(C),tt(o),le(R|0))),Tt(w|0),R=h,e[_>>2]=36200,e[o>>2]=36220,e[C>>2]=36236,de(r),wt(C),tt(o),le(R|0)),R=j()|0,e[_>>2]=36200,e[o>>2]=36220,e[C>>2]=36236,de(r),wt(C),tt(o),le(R|0)}while(!1);_=h,tt(o),le(_|0)}function as(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0;C=t+4|0,t=e[C>>2]|0;e:do switch(e[t+16>>2]|0){case 3:{if((e[t+24>>2]|0)==2){if((l|0)>0)t=0;else break e;for(;;)if(d=S[r+(t*3|0)+1>>0]|0,h=d&255,w=h+128+(F[r+(t*3|0)+2>>0]|0)&255,c=o+(t*3|0)|0,S[c>>0]=(F[r+(t*3|0)>>0]|0)+128+h,S[c+1>>0]=d,S[c+2>>0]=w,t=t+1|0,(t|0)==(l|0))break e}if(t=(l|0)<(c|0)?l:c,(t|0)>0){h=c<<1,d=0;do k=S[r+(d+c)>>0]|0,N=k&255,D=N+128+(F[r+(d+h)>>0]|0)&255,w=o+(d*3|0)|0,S[w>>0]=(F[r+d>>0]|0)+128+N,S[w+1>>0]=k,S[w+2>>0]=D,d=d+1|0;while((d|0)!=(t|0))}break}case 4:{if((e[t+24>>2]|0)==1&&(w=(l|0)<(c|0)?l:c,(w|0)>0)){t=c<<1,h=c*3|0,d=0;do k=F[r+(d+c)>>0]|0,N=o+(d<<2)|0,k=(F[r+d>>0]|0)+128+k&255|k<<8|F[r+(d+h)>>0]<<24|k+128+(F[r+(d+t)>>0]|0)<<16&16711680,S[N>>0]=k,S[N+1>>0]=k>>8,S[N+2>>0]=k>>16,S[N+3>>0]=k>>24,d=d+1|0;while((d|0)!=(w|0))}break}default:}while(!1);if(t=e[C>>2]|0,!!(S[t+32>>0]|0)){if(d=e[t+16>>2]|0,(l|0)>0)t=o,h=0;else return;for(;N=t+2|0,k=S[t>>0]|0,S[t>>0]=S[N>>0]|0,S[N>>0]=k,h=h+1|0,(h|0)!=(l|0);)t=t+d|0}}function b1(t){t=t|0;var r=0,o=0;e[t>>2]=36712,r=e[t+20>>2]|0,r&&(o=t+24|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),o=e[t+8>>2]|0,o&&(r=t+12|0,(e[r>>2]|0)!=(o|0)&&(e[r>>2]=o),he(o))}function N1(t){t=t|0;var r=0,o=0;if(e[t>>2]=36712,r=e[t+20>>2]|0,r&&(o=t+24|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),r=e[t+8>>2]|0,!r){he(t);return}o=t+12|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r),he(t)}function F1(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0;if(c=t+36|0,!(e[c>>2]|0)){c=t+40|0,ls(t,r,e[c>>2]|0,o,l),e[c>>2]=(e[c>>2]|0)+(e[(e[t+4>>2]|0)+12>>2]|0);return}h=ee(e[(e[t+4>>2]|0)+16>>2]|0,o)|0,d=t+20|0,ls(t,r,e[d>>2]|0,o,l),t=e[c>>2]|0,(Yt[e[(e[t>>2]|0)+48>>2]&63](t,e[d>>2]|0,h)|0)!=(h|0)&&(c=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,H|0)|0,bt(8)),g=0,xe(7,c|0,3,35648),d=g,g=0,d&1?(d=j()|0,Tt(c|0),le(d|0)):Qt(c|0,824,96))}function R1(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0;if(c=e[t+36>>2]|0,c){M1(t,c,r,o,l);return}else{c=t+40|0,Xn(t,e[c>>2]|0,r,o,l),e[c>>2]=(e[c>>2]|0)+(e[(e[t+4>>2]|0)+12>>2]|0);return}}function Xn(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0;if(w=t+4|0,h=e[w>>2]|0,!(S[h+32>>0]|0))w=r;else{if(d=t+8|0,o0(e[d>>2]|0,r|0,l*3|0)|0,h=e[w>>2]|0,r=e[h+16>>2]|0,(l|0)>0){for(h=e[d>>2]|0,t=0;C=h+2|0,D=S[h>>0]|0,S[h>>0]=S[C>>0]|0,S[C>>0]=D,t=t+1|0,(t|0)!=(l|0);)h=h+r|0;h=e[w>>2]|0}w=e[d>>2]|0}switch(e[h+16>>2]|0){case 3:{if((e[h+24>>2]|0)==2){if((l|0)>0)h=0;else return;do c=S[w+(h*3|0)+1>>0]|0,C=S[w+(h*3|0)+2>>0]|0,D=o+(h*3|0)|0,S[D>>0]=S[w+(h*3|0)>>0]|0,S[D+1>>0]=c,S[D+2>>0]=C,h=h+1|0;while((h|0)!=(l|0));return}if(h=(c|0)<(l|0)?c:l,(h|0)<=0)return;t=c<<1,r=0;do C=S[w+(r*3|0)+1>>0]|0,D=S[w+(r*3|0)+2>>0]|0,S[o+r>>0]=S[w+(r*3|0)>>0]|0,S[o+(r+c)>>0]=C,S[o+(r+t)>>0]=D,r=r+1|0;while((r|0)!=(h|0));return}case 4:{if((e[h+24>>2]|0)!=1||(h=(c|0)<(l|0)?c:l,(h|0)<=0))return;t=c<<1,r=c*3|0,d=0;do l=S[w+(d<<2)+1>>0]|0,C=S[w+(d<<2)+2>>0]|0,D=S[w+(d<<2)+3>>0]|0,S[o+d>>0]=S[w+(d<<2)>>0]|0,S[o+(d+c)>>0]=l,S[o+(d+t)>>0]=C,S[o+(d+r)>>0]=D,d=d+1|0;while((d|0)!=(h|0));return}default:return}}function M1(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0;if(k=b,b=b+176|0,N=k+152|0,_=k+16|0,R=k,d=ee(e[(e[t+4>>2]|0)+16>>2]|0,l)|0,C=t+20|0,h=e[C>>2]|0,!d){_=h,Xn(t,_,o,l,c),b=k;return}for(;w=Yt[e[(e[r>>2]|0)+32>>2]&63](r,h,d)|0,!!w;)if(h=e[C>>2]|0,(d|0)==(w|0)){D=26;break}else d=d-w|0;if((D|0)==26){Xn(t,h,o,l,c),b=k;return}o=_+56|0,C=_+4|0,e[_>>2]=36160,e[o>>2]=36180,g=0,Ae(62,_+56|0,C|0),k=g,g=0,k&1&&(_=j()|0,tt(o),le(_|0)),e[_+128>>2]=0,e[_+132>>2]=-1,e[_>>2]=36200,e[_+56>>2]=36220,g=0,ue(180,C|0),k=g,g=0;do if(k&1)h=j()|0;else{if(e[C>>2]=36236,r=_+36|0,e[r>>2]=0,e[r+4>>2]=0,e[r+8>>2]=0,e[r+12>>2]=0,e[_+52>>2]=16,e[N>>2]=0,e[N+4>>2]=0,e[N+8>>2]=0,g=0,Ae(63,C|0,N|0),k=g,g=0,k&1){h=j()|0,de(N),de(r),wt(C);break}de(N),g=0,h=Ve(28,_|0,49029,57)|0,N=g,g=0,!(N&1)&&(g=0,be(36,h|0,0)|0,N=g,g=0,!(N&1))&&(w=Ct(16)|0,g=0,Ae(64,R|0,C|0),N=g,g=0,N&1?h=j()|0:(!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,H|0)|0,bt(8)),g=0,$e(36,w|0,3,35648,R|0),N=g,g=0,N&1?d=1:(g=0,xe(6,w|0,824,96),g=0,d=0),h=j()|0,de(R),d||(R=h,e[_>>2]=36200,e[o>>2]=36220,e[C>>2]=36236,de(r),wt(C),tt(o),le(R|0))),Tt(w|0),R=h,e[_>>2]=36200,e[o>>2]=36220,e[C>>2]=36236,de(r),wt(C),tt(o),le(R|0)),R=j()|0,e[_>>2]=36200,e[o>>2]=36220,e[C>>2]=36236,de(r),wt(C),tt(o),le(R|0)}while(!1);_=h,tt(o),le(_|0)}function ls(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0;C=t+4|0,t=e[C>>2]|0;e:do switch(e[t+16>>2]|0){case 3:{if((e[t+24>>2]|0)==2){if((l|0)>0)t=0;else break e;for(;;)if(d=S[r+(t*3|0)+1>>0]|0,w=S[r+(t*3|0)+2>>0]|0,c=o+(t*3|0)|0,S[c>>0]=S[r+(t*3|0)>>0]|0,S[c+1>>0]=d,S[c+2>>0]=w,t=t+1|0,(t|0)==(l|0))break e}if(t=(l|0)<(c|0)?l:c,(t|0)>0){h=c<<1,d=0;do k=S[r+(d+c)>>0]|0,D=S[r+(d+h)>>0]|0,w=o+(d*3|0)|0,S[w>>0]=S[r+d>>0]|0,S[w+1>>0]=k,S[w+2>>0]=D,d=d+1|0;while((d|0)!=(t|0))}break}case 4:{if((e[t+24>>2]|0)==1&&(w=(l|0)<(c|0)?l:c,(w|0)>0)){t=c<<1,h=c*3|0,d=0;do k=o+(d<<2)|0,D=F[r+(d+c)>>0]<<8|F[r+d>>0]|F[r+(d+t)>>0]<<16|F[r+(d+h)>>0]<<24,S[k>>0]=D,S[k+1>>0]=D>>8,S[k+2>>0]=D>>16,S[k+3>>0]=D>>24,d=d+1|0;while((d|0)!=(w|0))}break}default:}while(!1);if(t=e[C>>2]|0,!!(S[t+32>>0]|0)){if(d=e[t+16>>2]|0,(l|0)>0)t=o,h=0;else return;for(;k=t+2|0,D=S[t>>0]|0,S[t>>0]=S[k>>0]|0,S[k>>0]=D,h=h+1|0,(h|0)!=(l|0);)t=t+d|0}}function us(t){t=t|0;var r=0,o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0,G=0,$=0,P=0,O=0;K=b,b=b+32|0,$=K+12|0,Q=K,R=t+180|0,_=(e[R>>2]|0)+4|0,(e[t+32>>2]|0)==1?U=e[t+24>>2]|0:U=1,r=ee(U<<1,_)|0,e[$>>2]=0,P=$+4|0,e[P>>2]=0,e[$+8>>2]=0;e:do if(r){if(r>>>0>1431655765&&(g=0,ue(178,$|0),G=g,g=0,G&1)||(h=6),(h|0)==6&&(g=0,o=ge(67,r*3|0)|0,G=g,g=0,!(G&1))){for(e[P>>2]=o,e[$>>2]=o,e[$+8>>2]=o+(r*3|0);;)if(S[o>>0]=0,S[o+1>>0]=0,S[o+2>>0]=0,o=(e[P>>2]|0)+3|0,e[P>>2]=o,r=r+-1|0,!r)break e}l=j()|0,r=e[$>>2]|0,r||le(l|0),o=e[P>>2]|0,(o|0)!=(r|0)&&(e[P>>2]=o+(~(((o+-3-r|0)>>>0)/3|0)*3|0)),he(r),le(l|0)}while(!1);e[Q>>2]=0,G=Q+4|0,e[G>>2]=0,e[Q+8>>2]=0;do if(!U)h=19;else{if(U>>>0>1073741823&&(g=0,ue(178,Q|0),N=g,g=0,N&1)||(h=17),(h|0)==17&&(l=U<<2,g=0,c=ge(67,l|0)|0,N=g,g=0,!(N&1))){e[Q>>2]=c,h=c+(U<<2)|0,e[Q+8>>2]=h,Jt(c|0,0,l|0)|0,e[G>>2]=h,h=19;break}l=j()|0,r=e[Q>>2]|0,o=r,r&&(c=e[G>>2]|0,(c|0)!=(r|0)&&(e[G>>2]=c+(~((c+-4-o|0)>>>2)<<2)),he(r))}while(!1);if((h|0)==19){c=t+12|0;e:do if((e[c>>2]|0)>0){h=t+4604|0,d=(ee(U,_)|0)+1|0,w=t+4608|0,C=t+92|0,D=(U|0)>0,k=t+4600|0,N=0;t:for(;;){if(l=e[$>>2]|0,r=l+3|0,e[h>>2]=r,o=l+(d*3|0)|0,e[w>>2]=o,N&1?(e[h>>2]=o,e[w>>2]=r,r=1):r=d,o=e[C>>2]|0,g=0,$e(e[(e[o>>2]|0)+12>>2]|0,o|0,l+(r*3|0)|0,e[R>>2]|0,_|0),l=g,g=0,l&1){h=29;break}if(D){r=e[Q>>2]|0,o=e[h>>2]|0,l=0;do{if(e[k>>2]=e[r+(l<<2)>>2],O=e[R>>2]|0,r=o+(O*3|0)|0,o=o+((O+-1|0)*3|0)|0,S[r>>0]=S[o>>0]|0,S[r+1>>0]=S[o+1>>0]|0,S[r+2>>0]=S[o+2>>0]|0,r=e[h>>2]|0,o=(e[w>>2]|0)+-3|0,S[o>>0]=S[r>>0]|0,S[o+1>>0]=S[r+1>>0]|0,S[o+2>>0]=S[r+2>>0]|0,g=0,Ae(70,t|0,0),o=g,g=0,o&1){h=28;break t}r=e[Q>>2]|0,e[r+(l<<2)>>2]=e[k>>2],o=(e[h>>2]|0)+(_*3|0)|0,e[h>>2]=o,e[w>>2]=(e[w>>2]|0)+(_*3|0),l=l+1|0}while((l|0)<(U|0))}if(N=N+1|0,(N|0)>=(e[c>>2]|0)){h=41;break e}}if((h|0)==28){l=j()|0;break}else if((h|0)==29){l=j()|0;break}}else h=41;while(!1);do if((h|0)==41){if(g=0,ue(182,t|0),O=g,g=0,O&1){l=j()|0;break}if(r=e[Q>>2]|0,o=r,r&&(l=e[G>>2]|0,(l|0)!=(r|0)&&(e[G>>2]=l+(~((l+-4-o|0)>>>2)<<2)),he(r)),r=e[$>>2]|0,!r){b=K;return}o=e[P>>2]|0,(o|0)!=(r|0)&&(e[P>>2]=o+(~(((o+-3-r|0)>>>0)/3|0)*3|0)),he(r),b=K;return}while(!1);r=e[Q>>2]|0,o=r,r&&(c=e[G>>2]|0,(c|0)!=(r|0)&&(e[G>>2]=c+(~((c+-4-o|0)>>>2)<<2)),he(r))}r=e[$>>2]|0,r||le(l|0),o=e[P>>2]|0,(o|0)!=(r|0)&&(e[P>>2]=o+(~(((o+-3-r|0)>>>0)/3|0)*3|0)),he(r),le(l|0)}function _1(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0,ce=0,ke=0;if(oe=t+180|0,!((e[oe>>2]|0)<=0))for(ne=t+4608|0,ce=t+4604|0,ke=t+4612|0,ie=0;P=ie+-1|0,h=e[ne>>2]|0,d=e[ce>>2]|0,r=ie+1|0,c=F[d+(ie*3|0)>>0]|0,Z=e[ke>>2]|0,w=F[d+(P*3|0)>>0]|0,C=c-w|0,D=F[h+(P*3|0)>>0]|0,k=w-D|0,N=((((S[Z+((F[d+(r*3|0)>>0]|0)-c)>>0]|0)*9|0)+(S[Z+C>>0]|0)|0)*9|0)+(S[Z+k>>0]|0)|0,l=F[d+(ie*3|0)+1>>0]|0,R=F[d+(P*3|0)+1>>0]|0,_=l-R|0,U=F[h+(P*3|0)+1>>0]|0,Q=R-U|0,K=((((S[Z+((F[d+(r*3|0)+1>>0]|0)-l)>>0]|0)*9|0)+(S[Z+_>>0]|0)|0)*9|0)+(S[Z+Q>>0]|0)|0,o=F[d+(ie*3|0)+2>>0]|0,G=F[d+(P*3|0)+2>>0]|0,$=o-G|0,P=F[h+(P*3|0)+2>>0]|0,O=G-P|0,Z=((((S[Z+((F[d+(r*3|0)+2>>0]|0)-o)>>0]|0)*9|0)+(S[Z+$>>0]|0)|0)*9|0)+(S[Z+O>>0]|0)|0,K|N|Z?(d=F[h+(ie*3|0)>>0]|0,h=c-D>>31,(h^k|0)>=0&&((h^C|0)<0?c=D:c=D-w+c|0),d=Zn(t,N,d,c,0)|0,h=F[(e[ne>>2]|0)+(ie*3|0)+1>>0]|0,c=l-U>>31,(c^Q|0)>=0&&((c^_|0)<0?l=U:l=U-R+l|0),c=Zn(t,K,h,l,0)|0,h=F[(e[ne>>2]|0)+(ie*3|0)+2>>0]|0,l=o-P>>31,(l^O|0)>=0&&((l^$|0)<0?o=P:o=P-G+o|0),Z=Zn(t,Z,h,o,0)|0,ie=(e[ne>>2]|0)+(ie*3|0)|0,S[ie>>0]=d,S[ie+1>>0]=c,S[ie+2>>0]=Z):r=(P1(t,ie,0)|0)+ie|0,(r|0)<(e[oe>>2]|0);)ie=r}function P1(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0;for(oe=b,b=b+32|0,ie=oe+15|0,R=oe+12|0,N=oe+9|0,_=oe+6|0,$=oe+3|0,P=oe,O=(e[t+180>>2]|0)-r|0,Z=e[t+4608>>2]|0,U=e[t+4604>>2]|0,G=Z+((r+-1|0)*3|0)|0,Q=S[G>>0]|0,K=S[G+1>>0]|0,G=S[G+2>>0]|0,o=Q&255,l=t+144|0,c=K&255,h=G&255,k=0;d=Z+((k+r|0)*3|0)|0,w=d+1|0,C=d+2|0,ne=(F[d>>0]|0)-o|0,D=e[l>>2]|0,!((((ne|0)>-1?ne:0-ne|0)|0)>(D|0)||(ne=(F[w>>0]|0)-c|0,(((ne|0)>-1?ne:0-ne|0)|0)>(D|0))||(ne=(F[C>>0]|0)-h|0,(((ne|0)>-1?ne:0-ne|0)|0)>(D|0)));)if(S[d>>0]=Q,S[w>>0]=K,S[C>>0]=G,k=k+1|0,(k|0)==(O|0)){k=O;break}if(c=(k|0)==(O|0),h=t+4600|0,l=e[36476+(e[h>>2]<<2)>>2]|0,(1<(k|0))o=k;else{o=k;do _t(t,1,1),l=e[h>>2]|0,o=o-(1<>2])|0,l=(l|0)>30?31:l+1|0,e[h>>2]=l,l=e[36476+(l<<2)>>2]|0;while((o|0)>=(1<>0]=S[ne>>0]|0,S[$+1>>0]=S[ne+1>>0]|0,S[$+2>>0]=S[ne+2>>0]|0,S[P>>0]=Q,S[P+1>>0]=K,S[P+2>>0]=G,r=U+(r*3|0)|0,S[N>>0]=S[$>>0]|0,S[N+1>>0]=S[$+1>>0]|0,S[N+2>>0]=S[$+2>>0]|0,S[R>>0]=S[P>>0]|0,S[R+1>>0]=S[P+1>>0]|0,S[R+2>>0]=S[P+2>>0]|0,S[ie>>0]=S[r>>0]|0,S[ie+1>>0]=S[r+1>>0]|0,S[ie+2>>0]=S[r+2>>0]|0,L1(_,t,N,R,ie),S[ne>>0]=S[_>>0]|0,S[ne+1>>0]=S[_+1>>0]|0,S[ne+2>>0]=S[_+2>>0]|0,ne=e[h>>2]|0,e[h>>2]=(ne|0)<1?0:ne+-1|0,ne=k+1|0,b=oe,ne|0)}function Zn(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0;if(Q=r>>31,h=(Q^r)-Q|0,_=t+196+(h*12|0)+10|0,d=I[_>>1]|0,R=t+196+(h*12|0)|0,c=e[R>>2]|0,(d|0)<(c|0))if((d<<1|0)<(c|0))if((d<<2|0)<(c|0))if((d<<3|0)<(c|0))if((d<<4|0)<(c|0))for(r=5;(d<>1]^Q)-Q+l|0,U=t+136|0,l=e[U>>2]|0,(c&l|0)==(c|0)?D=c:D=l&~(c>>31),c=(o-D^Q)-Q|0,C=t+144|0,l=e[C>>2]|0,(c|0)>0?c=(c+l|0)/(l<<1|1|0)|0:c=(c-l|0)/(l<<1|1|0)|0,N=t+140|0,w=e[N>>2]|0,o=((c|0)<0?w:0)+c|0,w=o-((o|0)<((w+1|0)/2|0|0)?0:w)|0,h=t+196+(h*12|0)+4|0,l|r?c=0:c=(e[h>>2]<<1)+-1+d>>31,l=c^w,cs(t,r,l>>30^l<<1,e[t+156>>2]|0),l=e[t+160>>2]|0,r=(e[R>>2]|0)+((w|0)>-1?w:0-w|0)|0,c=(e[h>>2]|0)+(ee(e[C>>2]<<1|1,w)|0)|0,o=I[_>>1]|0,(o|0)==(l|0)&&(r=r>>1,c=c>>1,o=l>>1),e[R>>2]=r,l=o+1|0,I[_>>1]=l,r=l+c|0,(r|0)>=1?(c|0)>0&&(c=c-l|0,_=I[k>>1]|0,I[k>>1]=(_<<16>>16<127&1)+(_&65535),c=(c|0)>0?0:c):(c=I[k>>1]|0,I[k>>1]=(c&65535)-(c<<16>>16>-128&1),c=(r|0)>(~o|0)?r:0-o|0),e[h>>2]=c,l=e[C>>2]|0,o=l<<1|1,r=(ee(o,(w^Q)-Q|0)|0)+D|0,(r|0)>=(0-l|0)?(c=e[U>>2]|0,(c+l|0)<(r|0)&&(r=r-(ee(e[N>>2]|0,o)|0)|0)):(r=(ee(e[N>>2]|0,o)|0)+r|0,c=e[U>>2]|0),(r&c|0)==(r|0)?(Q=r,Q=Q&255,Q|0):(Q=c&~(r>>31),Q=Q&255,Q|0)}function cs(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0;if(c=o>>r,h=t+148|0,d=l-(e[h>>2]|0)|0,(c|0)<(d+-1|0)){(c|0)>30&&(l=(c|0)/2|0,_t(t,0,l),c=c-l|0),_t(t,1,c+1|0),_t(t,(1<31?(_t(t,0,31),_t(t,1,l+-31-(e[h>>2]|0)|0)):_t(t,1,d),r=e[h>>2]|0,_t(t,(1<>0]|0,R=N-(F[l>>0]|0)>>31|1,h=ee(R,(F[o>>0]|0)-N|0)|0,D=r+144|0,d=e[D>>2]|0,(h|0)>0?h=(h+d|0)/(d<<1|1|0)|0:h=(h-d|0)/(d<<1|1|0)|0,P=r+140|0,C=e[P>>2]|0,w=((h|0)<0?C:0)+h|0,C=w-((w|0)<((C+1|0)/2|0|0)?0:C)|0,w=r+4576|0,Jn(r,w,C),K=F[c+1>>0]|0,G=K-(F[l+1>>0]|0)>>31|1,h=ee(G,(F[o+1>>0]|0)-K|0)|0,d=e[D>>2]|0,(h|0)>0?h=(h+d|0)/(d<<1|1|0)|0:h=(h-d|0)/(d<<1|1|0)|0,_=e[P>>2]|0,$=((h|0)<0?_:0)+h|0,_=$-(($|0)<((_+1|0)/2|0|0)?0:_)|0,Jn(r,w,_),$=F[c+2>>0]|0,Q=$-(F[l+2>>0]|0)>>31|1,h=ee(Q,(F[o+2>>0]|0)-$|0)|0,d=e[D>>2]|0,(h|0)>0?h=(h+d|0)/(d<<1|1|0)|0:h=(h-d|0)/(d<<1|1|0)|0,k=e[P>>2]|0,h=((h|0)<0?k:0)+h|0,k=h-((h|0)<((k+1|0)/2|0|0)?0:k)|0,Jn(r,w,k),w=e[D>>2]|0,D=w<<1|1,h=(ee(ee(D,C)|0,R)|0)+N|0,o=0-w|0,(h|0)>=(o|0)?(d=e[U>>2]|0,(d+w|0)<(h|0)&&(h=h-(ee(e[P>>2]|0,D)|0)|0),l=d):(h=(ee(e[P>>2]|0,D)|0)+h|0,l=e[U>>2]|0),(h&l|0)!=(h|0)&&(h=l&~(h>>31)),c=h&255,h=(ee(ee(D,_)|0,G)|0)+K|0,(h|0)>=(o|0)?(l+w|0)<(h|0)&&(h=h-(ee(e[P>>2]|0,D)|0)|0):h=(ee(e[P>>2]|0,D)|0)+h|0,(h&l|0)!=(h|0)&&(h=l&~(h>>31)),d=h&255,h=(ee(ee(D,k)|0,Q)|0)+$|0,(h|0)>=(o|0)?(l+w|0)<(h|0)&&(h=h-(ee(e[P>>2]|0,D)|0)|0):h=(ee(e[P>>2]|0,D)|0)+h|0,(h&l|0)==(h|0)){P=h,P=P&255,S[t>>0]=c,$=t+1|0,S[$>>0]=d,t=t+2|0,S[t>>0]=P;return}P=l&~(h>>31),P=P&255,S[t>>0]=c,$=t+1|0,S[$>>0]=d,t=t+2|0,S[t>>0]=P}function Jn(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0;if(k=r+9|0,d=F[k>>0]|0,D=r+4|0,C=e[D>>2]|0,c=(ee(d>>>1,C)|0)+(e[r>>2]|0)|0,(d|0)<(c|0)){h=d,l=0;do h=h<<1,l=l+1|0;while((h|0)<(c|0));c=l}else c=0;(o|0)>0&(c|0)==0&&F[r+10>>0]<<1>>>0>>0?l=1:w=5;do if((w|0)==5){if(l=(o|0)<0,l&&F[r+10>>0]<<1>>>0>=d>>>0){l=1;break}l=l&(c|0)!=0}while(!1);if(l=(((o|0)>-1?o:0-o|0)<<1)-C+(l<<31>>31)|0,cs(t,c,l,(e[t+156>>2]|0)+-1-(e[36476+(e[t+4600>>2]<<2)>>2]|0)|0),(o|0)<0&&(t=r+10|0,S[t>>0]=(F[t>>0]|0)+1),l=(l+1-(e[D>>2]|0)>>1)+(e[r>>2]|0)|0,e[r>>2]=l,c=S[k>>0]|0,c<<24>>24!=(S[r+8>>0]|0)){r=c,r=r&255,r=r+1|0,r=r&255,S[k>>0]=r;return}e[r>>2]=l>>1,t=(c&255)>>>1,S[k>>0]=t,r=r+10|0,S[r>>0]=(F[r>>0]|0)>>>1,r=t,r=r&255,r=r+1|0,r=r&255,S[k>>0]=r}function O1(t){t=t|0;var r=0,o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0;R=b,b=b+32|0,l=R,N=t+144|0;e:do if(e[N>>2]|0)r=t+152|0;else if(o=e[t+136>>2]|0,r=t+152|0,(o|0)==((1<>2])+-1|0)&&(m0(l,o,0),(e[l+4>>2]|0)==(e[t+184>>2]|0))&&(e[l+8>>2]|0)==(e[t+188>>2]|0)&&(e[l+12>>2]|0)==(e[t+192>>2]|0))switch(e[r>>2]|0){case 8:{N=e[8900]|0,e[t+4612>>2]=N+(((e[8901]|0)-N|0)>>>1),b=R;return}case 10:{N=e[8903]|0,e[t+4612>>2]=N+(((e[8904]|0)-N|0)>>>1),b=R;return}case 12:{N=e[8906]|0,e[t+4612>>2]=N+(((e[8907]|0)-N|0)>>>1),b=R;return}case 16:{N=e[8909]|0,e[t+4612>>2]=N+(((e[8910]|0)-N|0)>>>1),b=R;return}default:break e}while(!1);if(k=1<>2],o=t+4616|0,l=k<<1,c=t+4620|0,h=e[c>>2]|0,r=e[o>>2]|0,d=h-r|0,l>>>0<=d>>>0?l>>>0>>0&&(w=r+l|0,(h|0)!=(w|0))&&(e[c>>2]=w):(j0(o,l-d|0),r=e[o>>2]|0),D=t+4612|0,e[D>>2]=r+k,r=0-k|0,(k|0)<=(r|0)){b=R;return}w=t+192|0,C=t+188|0,d=t+184|0,h=r;do r=e[w>>2]|0,(h|0)>(0-r|0)?(o=e[C>>2]|0,(h|0)>(0-o|0)?(l=e[d>>2]|0,(h|0)>(0-l|0)?(c=e[N>>2]|0,(h|0)>=(0-c|0)?(c|0)<(h|0)?(l|0)<=(h|0)?(o|0)>(h|0)?r=2:r=(r|0)>(h|0)?3:4:r=1:r=0:r=-1):r=-2):r=-3):r=-4,S[(e[D>>2]|0)+h>>0]=r,h=h+1|0;while((h|0)!=(k|0));b=R}function $1(t){t=t|0;var r=0,o=0;e[t>>2]=35996,r=e[t+4592>>2]|0,r&&(o=t+4596|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),e[t>>2]=36612,r=e[t+120>>2]|0,r&&(o=t+124|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),o=t+92|0,r=e[o>>2]|0,e[o>>2]=0,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r),t=t+4|0,r=e[t>>2]|0,e[t>>2]=0,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r)}function B1(t){t=t|0;var r=0,o=0;if(e[t>>2]=35996,r=e[t+4592>>2]|0,r&&(o=t+4596|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),e[t>>2]=36612,r=e[t+120>>2]|0,r&&(o=t+124|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),o=t+92|0,r=e[o>>2]|0,e[o>>2]=0,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r),o=t+4|0,r=e[o>>2]|0,e[o>>2]=0,!r){he(t);return}Mt[e[(e[r>>2]|0)+4>>2]&255](r),he(t)}function V1(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0;c=b,b=b+32|0,w=c,m0(w,65535,0),d=e[r+4>>2]|0,h=e[r+8>>2]|0,h=h|0?h:e[w+8>>2]|0,l=e[r+12>>2]|0,l=l|0?l:e[w+12>>2]|0,r=e[r+16>>2]|0,o=e[w+16>>2]|0,e[t+160>>2]=d|0?d:e[w+4>>2]|0,e[t+164>>2]=h,e[t+168>>2]=l,Q1(t),l=0;do e[t+172+(l*12|0)>>2]=1024,e[t+172+(l*12|0)+4>>2]=0,I[t+172+(l*12|0)+8>>1]=0,I[t+172+(l*12|0)+10>>1]=1,l=l+1|0;while((l|0)!=365);w=(r|0?r:o)&255,e[t+4552>>2]=1024,e[t+4556>>2]=0,S[t+4560>>0]=w,S[t+4561>>0]=1,S[t+4562>>0]=0,e[t+4564>>2]=1024,e[t+4568>>2]=1,S[t+4572>>0]=w,S[t+4573>>0]=1,S[t+4574>>0]=0,e[t+4576>>2]=0,b=c}function U1(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0,D=0,k=0;if(k=b,b=b+16|0,C=k,w=t+92|0,d=e[r>>2]|0,e[r>>2]=0,r=e[w>>2]|0,e[w>>2]=d,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r),e[C>>2]=0,e[C+4>>2]=l,w=o+8|0,e[C+8>>2]=e[w>>2],l){r=Xe(4600)|0,l=t+8|0,c=r+4|0,h=l,d=c+84|0;do e[c>>2]=e[h>>2],c=c+4|0,h=h+4|0;while((c|0)<(d|0));c=r+88|0,d=c+40|0;do e[c>>2]=0,c=c+4|0;while((c|0)<(d|0));e[r>>2]=35772,c=r+132|0,e[c>>2]=0,e[c+4>>2]=0,e[c+8>>2]=0,e[c+12>>2]=0,e[r+148>>2]=e[l>>2],e[r+152>>2]=0,e[r+156>>2]=0,e[r+160>>2]=0,c=r+4544|0,l=r+164|0;do e[l>>2]=0,e[l+4>>2]=0,I[l+8>>1]=0,I[l+10>>1]=1,l=l+12|0;while((l|0)!=(c|0));h=t+4|0,e[c>>2]=0,e[c+4>>2]=0,I[c+8>>1]=0,S[c+10>>0]=0,d=r+4556|0,e[d>>2]=0,e[d+4>>2]=0,I[d+8>>1]=0,S[d+10>>0]=0,d=r+4568|0,e[d>>2]=0,e[d+4>>2]=0,e[d+8>>2]=0,e[d+12>>2]=0,e[d+16>>2]=0,e[d+20>>2]=0,e[d+24>>2]=0,S[d+28>>0]=0,e[r+28>>2]|0||(e[r+20>>2]=1),l=e[h>>2]|0,e[h>>2]=r,l&&(Mt[e[(e[l>>2]|0)+4>>2]&255](l),r=e[h>>2]|0),Y0(r,C)}return C=t+100|0,e[C>>2]=32,e[t+96>>2]=0,r=e[o>>2]|0,r?(e[t+132>>2]=r,c=t+120|0,w=t+124|0,l=e[w>>2]|0,r=e[c>>2]|0,h=r,d=l-h|0,d>>>0>=4e3?d>>>0>4e3&&(D=r+4e3|0,(l|0)!=(D|0))&&(e[w>>2]=D,l=D):(vi(c,4e3-d|0),r=e[c>>2]|0,h=r,l=e[w>>2]|0),e[t+108>>2]=h,e[t+104>>2]=l-r,fs(t),D=t+116|0,D=e[D>>2]|0,t=e[C>>2]|0,t=t+-32|0,t=(t|0)/8|0,t=D-t|0,b=k,t|0):(e[t+108>>2]=e[o+4>>2],e[t+104>>2]=e[w>>2],fs(t),D=t+116|0,D=e[D>>2]|0,t=e[C>>2]|0,t=t+-32|0,t=(t|0)/8|0,t=D-t|0,b=k,t|0)}function z1(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0,G=0,$=0,P=0,O=0;if(G=b,b=b+352|0,$=G+328|0,P=G+192|0,o=G+343|0,l=G+342|0,c=G+341|0,h=G+340|0,R=G+176|0,w=G+168|0,C=G+160|0,D=G+152|0,K=G,U=G+136|0,e[t+32>>2]|0&&(e[t+24>>2]|0)!=1){if(_=t+8|0,Q=t+36|0,d=e[Q>>2]|0,!d){if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[o>>0]|0,$e(37,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}if(t=e[t+16>>2]|0,(t|0)==16)switch(d|0){case 1:{if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[l>>0]|0,$e(38,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 2:{if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[c>>0]|0,$e(39,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 3:{if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[h>>0]|0,$e(40,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}default:{d=P+56|0,c=P+4|0,e[P>>2]=36160,e[d>>2]=36180,g=0,Ae(62,P+56|0,c|0),G=g,g=0,G&1&&(O=j()|0,tt(d),le(O|0)),e[P+128>>2]=0,e[P+132>>2]=-1,e[P>>2]=36200,e[P+56>>2]=36220,g=0,ue(180,c|0),G=g,g=0;do if(G&1)t=j()|0;else{if(e[c>>2]=36236,h=P+36|0,e[h>>2]=0,e[h+4>>2]=0,e[h+8>>2]=0,e[h+12>>2]=0,e[P+52>>2]=16,e[$>>2]=0,e[$+4>>2]=0,e[$+8>>2]=0,g=0,Ae(63,c|0,$|0),G=g,g=0,G&1){t=j()|0,de($),de(h),wt(c);break}de($),g=0,t=Ve(28,P|0,49007,21)|0,$=g,g=0;do if(!($&1)&&(g=0,k=be(36,t|0,e[Q>>2]|0)|0,$=g,g=0,!($&1))&&(g=0,Ve(28,k|0,50997,18)|0,$=g,g=0,!($&1))){if(l=Ct(16)|0,g=0,Ae(64,R|0,c|0),$=g,g=0,$&1)t=j()|0;else if(!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,H|0)|0,bt(8)),g=0,$e(36,l|0,9,35648,R|0),$=g,g=0,$&1?o=1:(g=0,xe(6,l|0,824,96),g=0,o=0),t=j()|0,de(R),!o)break;Tt(l|0)}else O=34;while(!1);(O|0)==34&&(t=j()|0),e[P>>2]=36200,e[d>>2]=36220,e[c>>2]=36236,de(h),wt(c),tt(d),O=t,le(O|0)}while(!1);O=t,tt(d),le(O|0)}}switch((t|0)<=8&&(t=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,H|0)|0,bt(8)),g=0,xe(7,t|0,8,35648),O=g,g=0,O&1||Qt(t|0,824,96),O=j()|0,Tt(t|0),le(O|0)),o=16-t|0,d|0){case 1:{if(t=Xe(60)|0,e[w>>2]=o,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],e[$>>2]=e[w>>2],e[$+4>>2]=e[w+4>>2],$e(41,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 2:{if(t=Xe(60)|0,e[C>>2]=o,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],e[$>>2]=e[C>>2],e[$+4>>2]=e[C+4>>2],$e(42,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 3:{if(t=Xe(60)|0,e[D>>2]=o,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],e[$>>2]=e[D>>2],e[$+4>>2]=e[D+4>>2],$e(43,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}default:{d=K+56|0,c=K+4|0,e[K>>2]=36160,e[d>>2]=36180,g=0,Ae(62,K+56|0,c|0),P=g,g=0,P&1&&(O=j()|0,tt(d),le(O|0)),e[K+128>>2]=0,e[K+132>>2]=-1,e[K>>2]=36200,e[K+56>>2]=36220,g=0,ue(180,c|0),P=g,g=0;do if(P&1)t=j()|0;else{if(e[c>>2]=36236,h=K+36|0,e[h>>2]=0,e[h+4>>2]=0,e[h+8>>2]=0,e[h+12>>2]=0,e[K+52>>2]=16,e[$>>2]=0,e[$+4>>2]=0,e[$+8>>2]=0,g=0,Ae(63,c|0,$|0),P=g,g=0,P&1){t=j()|0,de($),de(h),wt(c);break}de($),g=0,t=Ve(28,K|0,49007,21)|0,P=g,g=0;do if(!(P&1)&&(g=0,N=be(36,t|0,e[Q>>2]|0)|0,P=g,g=0,!(P&1))&&(g=0,Ve(28,N|0,50997,18)|0,P=g,g=0,!(P&1))){if(l=Ct(16)|0,g=0,Ae(64,U|0,c|0),P=g,g=0,P&1)t=j()|0;else if(!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,H|0)|0,bt(8)),g=0,$e(36,l|0,9,35648,U|0),P=g,g=0,P&1?o=1:(g=0,xe(6,l|0,824,96),g=0,o=0),t=j()|0,de(U),!o)break;Tt(l|0)}else O=64;while(!1);(O|0)==64&&(t=j()|0),e[K>>2]=36200,e[d>>2]=36220,e[c>>2]=36236,de(h),wt(c),tt(d),O=t,le(O|0)}while(!1);O=t,tt(d),le(O|0)}}}return o=e[r+4>>2]|0,l=Xe(16)|0,t=e[t+20>>2]|0,o?(e[l>>2]=36108,e[l+4>>2]=o,e[l+8>>2]=2,e[l+12>>2]=t,O=l,b=G,O|0):(O=e[r>>2]|0,e[l>>2]=36132,e[l+4>>2]=O,e[l+8>>2]=2,e[l+12>>2]=t,O=l,b=G,O|0)}function fs(t){t=t|0;var r=0,o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0,G=0,$=0,P=0,O=0;G=b,b=b+32|0,P=G+12|0,K=G,_=t+156|0,U=(e[_>>2]|0)+4|0,(e[t+32>>2]|0)==1?Q=e[t+24>>2]|0:Q=1,r=ee(Q<<1,U)|0,e[P>>2]=0,O=P+4|0,e[O>>2]=0,e[P+8>>2]=0;do if(r){if((r|0)<0&&(g=0,ue(178,P|0),$=g,g=0,$&1)||(d=6),(d|0)==6&&(o=r<<1,g=0,l=ge(67,o|0)|0,$=g,g=0,!($&1))){e[P>>2]=l,$=l+(r<<1)|0,e[P+8>>2]=$,Jt(l|0,0,o|0)|0,e[O>>2]=$;break}l=j()|0,r=e[P>>2]|0,r||le(l|0),o=e[O>>2]|0,(o|0)!=(r|0)&&(e[O>>2]=o+(~((o+-2-r|0)>>>1)<<1)),he(r),le(l|0)}while(!1);e[K>>2]=0,$=K+4|0,e[$>>2]=0,e[K+8>>2]=0;do if(!Q)d=18;else{if(Q>>>0>1073741823&&(g=0,ue(178,K|0),R=g,g=0,R&1)||(d=16),(d|0)==16&&(c=Q<<2,g=0,h=ge(67,c|0)|0,R=g,g=0,!(R&1))){e[K>>2]=h,d=h+(Q<<2)|0,e[K+8>>2]=d,Jt(h|0,0,c|0)|0,e[$>>2]=d,d=18;break}l=j()|0,r=e[K>>2]|0,o=r,r&&(c=e[$>>2]|0,(c|0)!=(r|0)&&(e[$>>2]=c+(~((c+-4-o|0)>>>2)<<2)),he(r))}while(!1);if((d|0)==18){h=t+12|0;e:do if((e[h>>2]|0)>0){d=t+4580|0,w=(ee(Q,U)|0)+1|0,C=t+4584|0,D=t+92|0,k=(Q|0)>0,N=t+4576|0,R=0;t:for(;;){if(o=e[P>>2]|0,r=o+2|0,e[d>>2]=r,o=o+(w<<1)|0,e[C>>2]=o,R&1?(e[d>>2]=o,e[C>>2]=r):r=o,c=e[D>>2]|0,g=0,$e(e[(e[c>>2]|0)+12>>2]|0,c|0,r|0,e[_>>2]|0,U|0),c=g,g=0,c&1){d=28;break}if(k){r=e[d>>2]|0,o=e[C>>2]|0,l=e[K>>2]|0,c=0;do{if(e[N>>2]=e[l+(c<<2)>>2],l=e[_>>2]|0,I[r+(l<<1)>>1]=I[r+(l+-1<<1)>>1]|0,I[o+-2>>1]=I[r>>1]|0,g=0,Ae(71,t|0,0),l=g,g=0,l&1){d=27;break t}l=e[K>>2]|0,e[l+(c<<2)>>2]=e[N>>2],r=(e[d>>2]|0)+(U<<1)|0,e[d>>2]=r,o=(e[C>>2]|0)+(U<<1)|0,e[C>>2]=o,c=c+1|0}while((c|0)<(Q|0))}if(R=R+1|0,(R|0)>=(e[h>>2]|0)){d=40;break e}}if((d|0)==27){l=j()|0;break}else if((d|0)==28){l=j()|0;break}}else d=40;while(!1);do if((d|0)==40){if(g=0,ue(182,t|0),t=g,g=0,t&1){l=j()|0;break}if(r=e[K>>2]|0,o=r,r&&(l=e[$>>2]|0,(l|0)!=(r|0)&&(e[$>>2]=l+(~((l+-4-o|0)>>>2)<<2)),he(r)),r=e[P>>2]|0,!r){b=G;return}o=e[O>>2]|0,(o|0)!=(r|0)&&(e[O>>2]=o+(~((o+-2-r|0)>>>1)<<1)),he(r),b=G;return}while(!1);r=e[K>>2]|0,o=r,r&&(c=e[$>>2]|0,(c|0)!=(r|0)&&(e[$>>2]=c+(~((c+-4-o|0)>>>2)<<2)),he(r))}r=e[P>>2]|0,r||le(l|0),o=e[O>>2]|0,(o|0)!=(r|0)&&(e[O>>2]=o+(~((o+-2-r|0)>>>1)<<1)),he(r),le(l|0)}function G1(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0;if(N=t+4580|0,r=e[N>>2]|0,U=t+156|0,!((e[U>>2]|0)<=0))for(R=t+4584|0,_=t+4588|0,c=r,h=M[r+-2>>1]|0,r=M[r>>1]|0,k=0;D=e[R>>2]|0,C=M[D+(k+-1<<1)>>1]|0,l=k+1|0,o=M[c+(l<<1)>>1]|0,w=e[_>>2]|0,d=r-h|0,c=h-C|0,w=((((S[w+(o-r)>>0]|0)*9|0)+(S[w+d>>0]|0)|0)*9|0)+(S[w+c>>0]|0)|0,w?(h=r-C>>31,(h^c|0)<0?c=r:c=C+((h^d|0)<0?0:d)|0,D=q1(t,w,M[D+(k<<1)>>1]|0,c,0)|0,I[(e[R>>2]|0)+(k<<1)>>1]=D):(l=(W1(t,k,0)|0)+k|0,o=e[N>>2]|0,r=M[o+(l+-1<<1)>>1]|0,o=M[o+(l<<1)>>1]|0),!((l|0)>=(e[U>>2]|0));)c=e[N>>2]|0,h=r,r=o,k=l}function q1(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0;if(U=r>>31,C=(U^r)-U|0,_=t+172+(C*12|0)+10|0,d=I[_>>1]|0,R=t+172+(C*12|0)|0,c=e[R>>2]|0,(d|0)<(c|0))if((d<<1|0)<(c|0))if((d<<2|0)<(c|0))if((d<<3|0)<(c|0))if((d<<4|0)<(c|0))for(h=5;(d<>1]^U)-U+l|0,(c&65535|0)==(c|0)?k=c:k=c>>31&65535^65535,w=(o-k^U)-U<<16,D=w>>16,h?c=0:c=(e[t+172+(C*12|0)+4>>2]<<1)+-1+d>>31,l=c^D,l=l>>30^l<<1,c=l>>h,(c|0)<47?((c|0)>30&&(d=(c|0)/2|0,_t(t,0,d),c=c-d|0),_t(t,1,c+1|0),_t(t,l&(1<>1]|0,c=d<<16>>16==64,h=c&1,o=(e[l>>2]|0)+D>>h,d=c?32:d<<16>>16,e[R>>2]=(e[R>>2]|0)+((w|0)>-65536?D:0-D|0)>>h,h=d+1|0,I[_>>1]=h,c=h+o|0,(c|0)<1?(_=I[N>>1]|0,I[N>>1]=(_&65535)-(_<<16>>16>-128&1),_=(c|0)>(~d|0)?c:0-d|0,e[l>>2]=_,U=D^U,r=r>>>31,r=k+r|0,r=r+U|0,r=r&65535,r|0):(o|0)<=0?(_=o,e[l>>2]=_,U=D^U,r=r>>>31,r=k+r|0,r=r+U|0,r=r&65535,r|0):(_=o-h|0,R=I[N>>1]|0,I[N>>1]=(R<<16>>16<127&1)+(R&65535),_=(_|0)>0?0:_,e[l>>2]=_,U=D^U,r=r>>>31,r=k+r|0,r=r+U|0,r=r&65535,r|0)}function W1(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0;for(d=(e[t+156>>2]|0)-r|0,w=e[t+4584>>2]|0,D=e[t+4580>>2]|0,c=I[w+(r+-1<<1)>>1]|0,l=0;;){if(o=w+(l+r<<1)|0,(I[o>>1]|0)!=c<<16>>16){k=l;break}if(I[o>>1]=c,l=l+1|0,(l|0)==(d|0)){k=d;break}}if(h=c&65535,c=(k|0)==(d|0),C=t+4576|0,l=e[36476+(e[C>>2]<<2)>>2]|0,(1<(k|0))o=k;else{o=k;do _t(t,1,1),l=e[C>>2]|0,o=o-(1<>2])|0,l=(l|0)>30?31:l+1|0,e[C>>2]=l,l=e[36476+(l<<2)>>2]|0;while((o|0)>=(1<>1]|0,o=M[D+(o<<1)>>1]|0,D=h-o|0,(((D|0)>-1?D:0-D|0)|0)<1?(o=l-h<<16>>16,hs(t,t+4564|0,o),o=o+h|0):(D=o-h>>31|1,r=(ee(l-o<<16,D)|0)>>16,hs(t,t+4552|0,r),o=(ee(r,D)|0)+o|0),I[c>>1]=o,t=e[C>>2]|0,e[C>>2]=(t|0)<1?0:t+-1|0,t=k+1|0,t|0)}function hs(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0;if(k=r+9|0,d=F[k>>0]|0,D=r+4|0,C=e[D>>2]|0,c=(ee(d>>>1,C)|0)+(e[r>>2]|0)|0,(d|0)<(c|0)){h=d,l=0;do h=h<<1,l=l+1|0;while((h|0)<(c|0));c=l}else c=0;(o|0)>0&(c|0)==0&&F[r+10>>0]<<1>>>0>>0?l=1:w=5;do if((w|0)==5){if(l=(o|0)<0,l&&F[r+10>>0]<<1>>>0>=d>>>0){l=1;break}l=l&(c|0)!=0}while(!1);if(l=(((o|0)>-1?o:0-o|0)<<1)-C+(l<<31>>31)|0,H1(t,c,l,63-(e[36476+(e[t+4576>>2]<<2)>>2]|0)|0),(o|0)<0&&(t=r+10|0,S[t>>0]=(F[t>>0]|0)+1),l=(l+1-(e[D>>2]|0)>>1)+(e[r>>2]|0)|0,e[r>>2]=l,c=S[k>>0]|0,c<<24>>24!=(S[r+8>>0]|0)){r=c,r=r&255,r=r+1|0,r=r&255,S[k>>0]=r;return}e[r>>2]=l>>1,t=(c&255)>>>1,S[k>>0]=t,r=r+10|0,S[r>>0]=(F[r>>0]|0)>>>1,r=t,r=r&255,r=r+1|0,r=r&255,S[k>>0]=r}function H1(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0;if(c=o>>r,h=l+-16|0,(c|0)<(l+-17|0)){(c|0)>30&&(l=(c|0)/2|0,_t(t,0,l),c=c-l|0),_t(t,1,c+1|0),_t(t,(1<31?(_t(t,0,31),_t(t,1,l+-47|0)):_t(t,1,h),_t(t,o+65535&65535,16)}function Q1(t){t=t|0;var r=0,o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0;if(D=b,b=b+32|0,w=D,m0(w,65535,0),C=t+160|0,(e[w+4>>2]|0)==(e[C>>2]|0)&&(e[w+8>>2]|0)==(e[t+164>>2]|0)&&(e[w+12>>2]|0)==(e[t+168>>2]|0)){C=e[8909]|0,e[t+4588>>2]=C+(((e[8910]|0)-C|0)>>>1),b=D;return}for(o=t+4592|0,l=t+4596|0,c=e[l>>2]|0,r=e[o>>2]|0,h=c-r|0,h>>>0>=131072?h>>>0>131072&&(d=r+131072|0,(c|0)!=(d|0))&&(e[l>>2]=d):(j0(o,131072-h|0),r=e[o>>2]|0),w=t+4588|0,e[w>>2]=r+65536,d=t+168|0,c=t+164|0,h=-65536;;){if(r=e[d>>2]|0,(h|0)>(0-r|0))if(o=e[c>>2]|0,(h|0)>(0-o|0))if(l=e[C>>2]|0,(h|0)>(0-l|0))if((h|0)>=0){if((h|0)<1){S[(e[w>>2]|0)+h>>0]=0,h=1;continue}(l|0)<=(h|0)?(o|0)>(h|0)?r=2:r=(r|0)>(h|0)?3:4:r=1}else r=-1;else r=-2;else r=-3;else r=-4;if(S[(e[w>>2]|0)+h>>0]=r,h=h+1|0,(h|0)==65536)break}b=D}function K1(t){t=t|0;var r=0,o=0;e[t>>2]=35968,r=e[t+4592>>2]|0,r&&(o=t+4596|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),e[t>>2]=36612,r=e[t+120>>2]|0,r&&(o=t+124|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),o=t+92|0,r=e[o>>2]|0,e[o>>2]=0,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r),t=t+4|0,r=e[t>>2]|0,e[t>>2]=0,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r)}function Y1(t){t=t|0;var r=0,o=0;if(e[t>>2]=35968,r=e[t+4592>>2]|0,r&&(o=t+4596|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),e[t>>2]=36612,r=e[t+120>>2]|0,r&&(o=t+124|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),o=t+92|0,r=e[o>>2]|0,e[o>>2]=0,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r),o=t+4|0,r=e[o>>2]|0,e[o>>2]=0,!r){he(t);return}Mt[e[(e[r>>2]|0)+4>>2]&255](r),he(t)}function j1(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0;c=b,b=b+32|0,w=c,m0(w,4095,0),d=e[r+4>>2]|0,h=e[r+8>>2]|0,h=h|0?h:e[w+8>>2]|0,l=e[r+12>>2]|0,l=l|0?l:e[w+12>>2]|0,r=e[r+16>>2]|0,o=e[w+16>>2]|0,e[t+160>>2]=d|0?d:e[w+4>>2]|0,e[t+164>>2]=h,e[t+168>>2]=l,n2(t),l=0;do e[t+172+(l*12|0)>>2]=64,e[t+172+(l*12|0)+4>>2]=0,I[t+172+(l*12|0)+8>>1]=0,I[t+172+(l*12|0)+10>>1]=1,l=l+1|0;while((l|0)!=365);w=(r|0?r:o)&255,e[t+4552>>2]=64,e[t+4556>>2]=0,S[t+4560>>0]=w,S[t+4561>>0]=1,S[t+4562>>0]=0,e[t+4564>>2]=64,e[t+4568>>2]=1,S[t+4572>>0]=w,S[t+4573>>0]=1,S[t+4574>>0]=0,e[t+4576>>2]=0,b=c}function X1(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0,D=0,k=0;if(k=b,b=b+16|0,C=k,w=t+92|0,d=e[r>>2]|0,e[r>>2]=0,r=e[w>>2]|0,e[w>>2]=d,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r),e[C>>2]=0,e[C+4>>2]=l,w=o+8|0,e[C+8>>2]=e[w>>2],l){r=Xe(4600)|0,l=t+8|0,c=r+4|0,h=l,d=c+84|0;do e[c>>2]=e[h>>2],c=c+4|0,h=h+4|0;while((c|0)<(d|0));c=r+88|0,d=c+40|0;do e[c>>2]=0,c=c+4|0;while((c|0)<(d|0));e[r>>2]=35744,c=r+132|0,e[c>>2]=0,e[c+4>>2]=0,e[c+8>>2]=0,e[c+12>>2]=0,e[r+148>>2]=e[l>>2],e[r+152>>2]=0,e[r+156>>2]=0,e[r+160>>2]=0,c=r+4544|0,l=r+164|0;do e[l>>2]=0,e[l+4>>2]=0,I[l+8>>1]=0,I[l+10>>1]=1,l=l+12|0;while((l|0)!=(c|0));h=t+4|0,e[c>>2]=0,e[c+4>>2]=0,I[c+8>>1]=0,S[c+10>>0]=0,d=r+4556|0,e[d>>2]=0,e[d+4>>2]=0,I[d+8>>1]=0,S[d+10>>0]=0,d=r+4568|0,e[d>>2]=0,e[d+4>>2]=0,e[d+8>>2]=0,e[d+12>>2]=0,e[d+16>>2]=0,e[d+20>>2]=0,e[d+24>>2]=0,S[d+28>>0]=0,e[r+28>>2]|0||(e[r+20>>2]=1),l=e[h>>2]|0,e[h>>2]=r,l&&(Mt[e[(e[l>>2]|0)+4>>2]&255](l),r=e[h>>2]|0),Y0(r,C)}return C=t+100|0,e[C>>2]=32,e[t+96>>2]=0,r=e[o>>2]|0,r?(e[t+132>>2]=r,c=t+120|0,w=t+124|0,l=e[w>>2]|0,r=e[c>>2]|0,h=r,d=l-h|0,d>>>0>=4e3?d>>>0>4e3&&(D=r+4e3|0,(l|0)!=(D|0))&&(e[w>>2]=D,l=D):(vi(c,4e3-d|0),r=e[c>>2]|0,h=r,l=e[w>>2]|0),e[t+108>>2]=h,e[t+104>>2]=l-r,ds(t),D=t+116|0,D=e[D>>2]|0,t=e[C>>2]|0,t=t+-32|0,t=(t|0)/8|0,t=D-t|0,b=k,t|0):(e[t+108>>2]=e[o+4>>2],e[t+104>>2]=e[w>>2],ds(t),D=t+116|0,D=e[D>>2]|0,t=e[C>>2]|0,t=t+-32|0,t=(t|0)/8|0,t=D-t|0,b=k,t|0)}function Z1(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0,G=0,$=0,P=0,O=0;if(G=b,b=b+352|0,$=G+328|0,P=G+192|0,o=G+343|0,l=G+342|0,c=G+341|0,h=G+340|0,R=G+176|0,w=G+168|0,C=G+160|0,D=G+152|0,K=G,U=G+136|0,e[t+32>>2]|0&&(e[t+24>>2]|0)!=1){if(_=t+8|0,Q=t+36|0,d=e[Q>>2]|0,!d){if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[o>>0]|0,$e(37,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}if(t=e[t+16>>2]|0,(t|0)==16)switch(d|0){case 1:{if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[l>>0]|0,$e(38,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 2:{if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[c>>0]|0,$e(39,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 3:{if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[h>>0]|0,$e(40,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}default:{d=P+56|0,c=P+4|0,e[P>>2]=36160,e[d>>2]=36180,g=0,Ae(62,P+56|0,c|0),G=g,g=0,G&1&&(O=j()|0,tt(d),le(O|0)),e[P+128>>2]=0,e[P+132>>2]=-1,e[P>>2]=36200,e[P+56>>2]=36220,g=0,ue(180,c|0),G=g,g=0;do if(G&1)t=j()|0;else{if(e[c>>2]=36236,h=P+36|0,e[h>>2]=0,e[h+4>>2]=0,e[h+8>>2]=0,e[h+12>>2]=0,e[P+52>>2]=16,e[$>>2]=0,e[$+4>>2]=0,e[$+8>>2]=0,g=0,Ae(63,c|0,$|0),G=g,g=0,G&1){t=j()|0,de($),de(h),wt(c);break}de($),g=0,t=Ve(28,P|0,49007,21)|0,$=g,g=0;do if(!($&1)&&(g=0,k=be(36,t|0,e[Q>>2]|0)|0,$=g,g=0,!($&1))&&(g=0,Ve(28,k|0,50997,18)|0,$=g,g=0,!($&1))){if(l=Ct(16)|0,g=0,Ae(64,R|0,c|0),$=g,g=0,$&1)t=j()|0;else if(!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,H|0)|0,bt(8)),g=0,$e(36,l|0,9,35648,R|0),$=g,g=0,$&1?o=1:(g=0,xe(6,l|0,824,96),g=0,o=0),t=j()|0,de(R),!o)break;Tt(l|0)}else O=34;while(!1);(O|0)==34&&(t=j()|0),e[P>>2]=36200,e[d>>2]=36220,e[c>>2]=36236,de(h),wt(c),tt(d),O=t,le(O|0)}while(!1);O=t,tt(d),le(O|0)}}switch((t|0)<=8&&(t=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,H|0)|0,bt(8)),g=0,xe(7,t|0,8,35648),O=g,g=0,O&1||Qt(t|0,824,96),O=j()|0,Tt(t|0),le(O|0)),o=16-t|0,d|0){case 1:{if(t=Xe(60)|0,e[w>>2]=o,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],e[$>>2]=e[w>>2],e[$+4>>2]=e[w+4>>2],$e(41,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 2:{if(t=Xe(60)|0,e[C>>2]=o,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],e[$>>2]=e[C>>2],e[$+4>>2]=e[C+4>>2],$e(42,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 3:{if(t=Xe(60)|0,e[D>>2]=o,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],e[$>>2]=e[D>>2],e[$+4>>2]=e[D+4>>2],$e(43,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}default:{d=K+56|0,c=K+4|0,e[K>>2]=36160,e[d>>2]=36180,g=0,Ae(62,K+56|0,c|0),P=g,g=0,P&1&&(O=j()|0,tt(d),le(O|0)),e[K+128>>2]=0,e[K+132>>2]=-1,e[K>>2]=36200,e[K+56>>2]=36220,g=0,ue(180,c|0),P=g,g=0;do if(P&1)t=j()|0;else{if(e[c>>2]=36236,h=K+36|0,e[h>>2]=0,e[h+4>>2]=0,e[h+8>>2]=0,e[h+12>>2]=0,e[K+52>>2]=16,e[$>>2]=0,e[$+4>>2]=0,e[$+8>>2]=0,g=0,Ae(63,c|0,$|0),P=g,g=0,P&1){t=j()|0,de($),de(h),wt(c);break}de($),g=0,t=Ve(28,K|0,49007,21)|0,P=g,g=0;do if(!(P&1)&&(g=0,N=be(36,t|0,e[Q>>2]|0)|0,P=g,g=0,!(P&1))&&(g=0,Ve(28,N|0,50997,18)|0,P=g,g=0,!(P&1))){if(l=Ct(16)|0,g=0,Ae(64,U|0,c|0),P=g,g=0,P&1)t=j()|0;else if(!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,H|0)|0,bt(8)),g=0,$e(36,l|0,9,35648,U|0),P=g,g=0,P&1?o=1:(g=0,xe(6,l|0,824,96),g=0,o=0),t=j()|0,de(U),!o)break;Tt(l|0)}else O=64;while(!1);(O|0)==64&&(t=j()|0),e[K>>2]=36200,e[d>>2]=36220,e[c>>2]=36236,de(h),wt(c),tt(d),O=t,le(O|0)}while(!1);O=t,tt(d),le(O|0)}}}return o=e[r+4>>2]|0,l=Xe(16)|0,t=e[t+20>>2]|0,o?(e[l>>2]=36108,e[l+4>>2]=o,e[l+8>>2]=2,e[l+12>>2]=t,O=l,b=G,O|0):(O=e[r>>2]|0,e[l>>2]=36132,e[l+4>>2]=O,e[l+8>>2]=2,e[l+12>>2]=t,O=l,b=G,O|0)}function ds(t){t=t|0;var r=0,o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0,G=0,$=0,P=0,O=0;G=b,b=b+32|0,P=G+12|0,K=G,_=t+156|0,U=(e[_>>2]|0)+4|0,(e[t+32>>2]|0)==1?Q=e[t+24>>2]|0:Q=1,r=ee(Q<<1,U)|0,e[P>>2]=0,O=P+4|0,e[O>>2]=0,e[P+8>>2]=0;do if(r){if((r|0)<0&&(g=0,ue(178,P|0),$=g,g=0,$&1)||(d=6),(d|0)==6&&(o=r<<1,g=0,l=ge(67,o|0)|0,$=g,g=0,!($&1))){e[P>>2]=l,$=l+(r<<1)|0,e[P+8>>2]=$,Jt(l|0,0,o|0)|0,e[O>>2]=$;break}l=j()|0,r=e[P>>2]|0,r||le(l|0),o=e[O>>2]|0,(o|0)!=(r|0)&&(e[O>>2]=o+(~((o+-2-r|0)>>>1)<<1)),he(r),le(l|0)}while(!1);e[K>>2]=0,$=K+4|0,e[$>>2]=0,e[K+8>>2]=0;do if(!Q)d=18;else{if(Q>>>0>1073741823&&(g=0,ue(178,K|0),R=g,g=0,R&1)||(d=16),(d|0)==16&&(c=Q<<2,g=0,h=ge(67,c|0)|0,R=g,g=0,!(R&1))){e[K>>2]=h,d=h+(Q<<2)|0,e[K+8>>2]=d,Jt(h|0,0,c|0)|0,e[$>>2]=d,d=18;break}l=j()|0,r=e[K>>2]|0,o=r,r&&(c=e[$>>2]|0,(c|0)!=(r|0)&&(e[$>>2]=c+(~((c+-4-o|0)>>>2)<<2)),he(r))}while(!1);if((d|0)==18){h=t+12|0;e:do if((e[h>>2]|0)>0){d=t+4580|0,w=(ee(Q,U)|0)+1|0,C=t+4584|0,D=t+92|0,k=(Q|0)>0,N=t+4576|0,R=0;t:for(;;){if(o=e[P>>2]|0,r=o+2|0,e[d>>2]=r,o=o+(w<<1)|0,e[C>>2]=o,R&1?(e[d>>2]=o,e[C>>2]=r):r=o,c=e[D>>2]|0,g=0,$e(e[(e[c>>2]|0)+12>>2]|0,c|0,r|0,e[_>>2]|0,U|0),c=g,g=0,c&1){d=28;break}if(k){r=e[d>>2]|0,o=e[C>>2]|0,l=e[K>>2]|0,c=0;do{if(e[N>>2]=e[l+(c<<2)>>2],l=e[_>>2]|0,I[r+(l<<1)>>1]=I[r+(l+-1<<1)>>1]|0,I[o+-2>>1]=I[r>>1]|0,g=0,Ae(72,t|0,0),l=g,g=0,l&1){d=27;break t}l=e[K>>2]|0,e[l+(c<<2)>>2]=e[N>>2],r=(e[d>>2]|0)+(U<<1)|0,e[d>>2]=r,o=(e[C>>2]|0)+(U<<1)|0,e[C>>2]=o,c=c+1|0}while((c|0)<(Q|0))}if(R=R+1|0,(R|0)>=(e[h>>2]|0)){d=40;break e}}if((d|0)==27){l=j()|0;break}else if((d|0)==28){l=j()|0;break}}else d=40;while(!1);do if((d|0)==40){if(g=0,ue(182,t|0),t=g,g=0,t&1){l=j()|0;break}if(r=e[K>>2]|0,o=r,r&&(l=e[$>>2]|0,(l|0)!=(r|0)&&(e[$>>2]=l+(~((l+-4-o|0)>>>2)<<2)),he(r)),r=e[P>>2]|0,!r){b=G;return}o=e[O>>2]|0,(o|0)!=(r|0)&&(e[O>>2]=o+(~((o+-2-r|0)>>>1)<<1)),he(r),b=G;return}while(!1);r=e[K>>2]|0,o=r,r&&(c=e[$>>2]|0,(c|0)!=(r|0)&&(e[$>>2]=c+(~((c+-4-o|0)>>>2)<<2)),he(r))}r=e[P>>2]|0,r||le(l|0),o=e[O>>2]|0,(o|0)!=(r|0)&&(e[O>>2]=o+(~((o+-2-r|0)>>>1)<<1)),he(r),le(l|0)}function J1(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0;if(N=t+4580|0,r=e[N>>2]|0,U=t+156|0,!((e[U>>2]|0)<=0))for(R=t+4584|0,_=t+4588|0,c=r,h=M[r+-2>>1]|0,r=M[r>>1]|0,k=0;D=e[R>>2]|0,C=M[D+(k+-1<<1)>>1]|0,l=k+1|0,o=M[c+(l<<1)>>1]|0,w=e[_>>2]|0,d=r-h|0,c=h-C|0,w=((((S[w+(o-r)>>0]|0)*9|0)+(S[w+d>>0]|0)|0)*9|0)+(S[w+c>>0]|0)|0,w?(h=r-C>>31,(h^c|0)<0?c=r:c=C+((h^d|0)<0?0:d)|0,D=e2(t,w,M[D+(k<<1)>>1]|0,c,0)|0,I[(e[R>>2]|0)+(k<<1)>>1]=D):(l=(t2(t,k,0)|0)+k|0,o=e[N>>2]|0,r=M[o+(l+-1<<1)>>1]|0,o=M[o+(l<<1)>>1]|0),!((l|0)>=(e[U>>2]|0));)c=e[N>>2]|0,h=r,r=o,k=l}function e2(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0;if(U=r>>31,C=(U^r)-U|0,_=t+172+(C*12|0)+10|0,d=I[_>>1]|0,R=t+172+(C*12|0)|0,c=e[R>>2]|0,(d|0)<(c|0))if((d<<1|0)<(c|0))if((d<<2|0)<(c|0))if((d<<3|0)<(c|0))if((d<<4|0)<(c|0))for(h=5;(d<>1]^U)-U+l|0,(c&4095|0)==(c|0)?k=c:k=c>>31&4095^4095,w=(o-k^U)-U<<20,D=w>>20,h?c=0:c=(e[t+172+(C*12|0)+4>>2]<<1)+-1+d>>31,l=c^D,l=l>>30^l<<1,c=l>>h,(c|0)<35?((c|0)>30&&(d=(c|0)/2|0,_t(t,0,d),c=c-d|0),_t(t,1,c+1|0),_t(t,l&(1<>1]|0,c=d<<16>>16==64,h=c&1,o=(e[l>>2]|0)+D>>h,d=c?32:d<<16>>16,e[R>>2]=(e[R>>2]|0)+((w|0)>-1048576?D:0-D|0)>>h,h=d+1|0,I[_>>1]=h,c=h+o|0,(c|0)<1?(_=I[N>>1]|0,I[N>>1]=(_&65535)-(_<<16>>16>-128&1),_=(c|0)>(~d|0)?c:0-d|0,e[l>>2]=_,U=D^U,r=r>>>31,r=k+r|0,r=r+U|0,r=r&4095,r=r&65535,r|0):(o|0)<=0?(_=o,e[l>>2]=_,U=D^U,r=r>>>31,r=k+r|0,r=r+U|0,r=r&4095,r=r&65535,r|0):(_=o-h|0,R=I[N>>1]|0,I[N>>1]=(R<<16>>16<127&1)+(R&65535),_=(_|0)>0?0:_,e[l>>2]=_,U=D^U,r=r>>>31,r=k+r|0,r=r+U|0,r=r&4095,r=r&65535,r|0)}function t2(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0;for(d=(e[t+156>>2]|0)-r|0,w=e[t+4584>>2]|0,D=e[t+4580>>2]|0,c=I[w+(r+-1<<1)>>1]|0,l=0;;){if(o=w+(l+r<<1)|0,(I[o>>1]|0)!=c<<16>>16){k=l;break}if(I[o>>1]=c,l=l+1|0,(l|0)==(d|0)){k=d;break}}if(h=c&65535,c=(k|0)==(d|0),C=t+4576|0,l=e[36476+(e[C>>2]<<2)>>2]|0,(1<(k|0))o=k;else{o=k;do _t(t,1,1),l=e[C>>2]|0,o=o-(1<>2])|0,l=(l|0)>30?31:l+1|0,e[C>>2]=l,l=e[36476+(l<<2)>>2]|0;while((o|0)>=(1<>1]|0,o=M[D+(o<<1)>>1]|0,D=h-o|0,(((D|0)>-1?D:0-D|0)|0)<1?(o=l-h<<20>>20,ps(t,t+4564|0,o),o=o+h|0):(D=o-h>>31|1,r=(ee(l-o<<20,D)|0)>>20,ps(t,t+4552|0,r),o=(ee(r,D)|0)+o|0),I[c>>1]=o&4095,t=e[C>>2]|0,e[C>>2]=(t|0)<1?0:t+-1|0,t=k+1|0,t|0)}function ps(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0;if(k=r+9|0,d=F[k>>0]|0,D=r+4|0,C=e[D>>2]|0,c=(ee(d>>>1,C)|0)+(e[r>>2]|0)|0,(d|0)<(c|0)){h=d,l=0;do h=h<<1,l=l+1|0;while((h|0)<(c|0));c=l}else c=0;(o|0)>0&(c|0)==0&&F[r+10>>0]<<1>>>0>>0?l=1:w=5;do if((w|0)==5){if(l=(o|0)<0,l&&F[r+10>>0]<<1>>>0>=d>>>0){l=1;break}l=l&(c|0)!=0}while(!1);if(l=(((o|0)>-1?o:0-o|0)<<1)-C+(l<<31>>31)|0,i2(t,c,l,47-(e[36476+(e[t+4576>>2]<<2)>>2]|0)|0),(o|0)<0&&(t=r+10|0,S[t>>0]=(F[t>>0]|0)+1),l=(l+1-(e[D>>2]|0)>>1)+(e[r>>2]|0)|0,e[r>>2]=l,c=S[k>>0]|0,c<<24>>24!=(S[r+8>>0]|0)){r=c,r=r&255,r=r+1|0,r=r&255,S[k>>0]=r;return}e[r>>2]=l>>1,t=(c&255)>>>1,S[k>>0]=t,r=r+10|0,S[r>>0]=(F[r>>0]|0)>>>1,r=t,r=r&255,r=r+1|0,r=r&255,S[k>>0]=r}function i2(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0;if(c=o>>r,h=l+-12|0,(c|0)<(l+-13|0)){(c|0)>30&&(l=(c|0)/2|0,_t(t,0,l),c=c-l|0),_t(t,1,c+1|0),_t(t,(1<31?(_t(t,0,31),_t(t,1,l+-43|0)):_t(t,1,h),_t(t,o+4095&4095,12)}function n2(t){t=t|0;var r=0,o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0;if(D=b,b=b+32|0,w=D,m0(w,4095,0),C=t+160|0,(e[w+4>>2]|0)==(e[C>>2]|0)&&(e[w+8>>2]|0)==(e[t+164>>2]|0)&&(e[w+12>>2]|0)==(e[t+168>>2]|0)){C=e[8906]|0,e[t+4588>>2]=C+(((e[8907]|0)-C|0)>>>1),b=D;return}for(o=t+4592|0,l=t+4596|0,c=e[l>>2]|0,r=e[o>>2]|0,h=c-r|0,h>>>0>=8192?h>>>0>8192&&(d=r+8192|0,(c|0)!=(d|0))&&(e[l>>2]=d):(j0(o,8192-h|0),r=e[o>>2]|0),w=t+4588|0,e[w>>2]=r+4096,d=t+168|0,c=t+164|0,h=-4096;;){if(r=e[d>>2]|0,(h|0)>(0-r|0))if(o=e[c>>2]|0,(h|0)>(0-o|0))if(l=e[C>>2]|0,(h|0)>(0-l|0))if((h|0)>=0){if((h|0)<1){S[(e[w>>2]|0)+h>>0]=0,h=1;continue}(l|0)<=(h|0)?(o|0)>(h|0)?r=2:r=(r|0)>(h|0)?3:4:r=1}else r=-1;else r=-2;else r=-3;else r=-4;if(S[(e[w>>2]|0)+h>>0]=r,h=h+1|0,(h|0)==4096)break}b=D}function r2(t){t=t|0;var r=0,o=0;e[t>>2]=35940,r=e[t+4592>>2]|0,r&&(o=t+4596|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),e[t>>2]=36612,r=e[t+120>>2]|0,r&&(o=t+124|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),o=t+92|0,r=e[o>>2]|0,e[o>>2]=0,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r),t=t+4|0,r=e[t>>2]|0,e[t>>2]=0,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r)}function s2(t){t=t|0;var r=0,o=0;if(e[t>>2]=35940,r=e[t+4592>>2]|0,r&&(o=t+4596|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),e[t>>2]=36612,r=e[t+120>>2]|0,r&&(o=t+124|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),o=t+92|0,r=e[o>>2]|0,e[o>>2]=0,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r),o=t+4|0,r=e[o>>2]|0,e[o>>2]=0,!r){he(t);return}Mt[e[(e[r>>2]|0)+4>>2]&255](r),he(t)}function o2(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0;c=b,b=b+32|0,w=c,m0(w,255,0),d=e[r+4>>2]|0,h=e[r+8>>2]|0,h=h|0?h:e[w+8>>2]|0,l=e[r+12>>2]|0,l=l|0?l:e[w+12>>2]|0,r=e[r+16>>2]|0,o=e[w+16>>2]|0,e[t+160>>2]=d|0?d:e[w+4>>2]|0,e[t+164>>2]=h,e[t+168>>2]=l,p2(t),l=0;do e[t+172+(l*12|0)>>2]=4,e[t+172+(l*12|0)+4>>2]=0,I[t+172+(l*12|0)+8>>1]=0,I[t+172+(l*12|0)+10>>1]=1,l=l+1|0;while((l|0)!=365);w=(r|0?r:o)&255,e[t+4552>>2]=4,e[t+4556>>2]=0,S[t+4560>>0]=w,S[t+4561>>0]=1,S[t+4562>>0]=0,e[t+4564>>2]=4,e[t+4568>>2]=1,S[t+4572>>0]=w,S[t+4573>>0]=1,S[t+4574>>0]=0,e[t+4576>>2]=0,b=c}function l2(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0,D=0,k=0;if(k=b,b=b+16|0,C=k,w=t+92|0,d=e[r>>2]|0,e[r>>2]=0,r=e[w>>2]|0,e[w>>2]=d,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r),e[C>>2]=0,e[C+4>>2]=l,w=o+8|0,e[C+8>>2]=e[w>>2],l){r=Xe(4600)|0,l=t+8|0,c=r+4|0,h=l,d=c+84|0;do e[c>>2]=e[h>>2],c=c+4|0,h=h+4|0;while((c|0)<(d|0));c=r+88|0,d=c+40|0;do e[c>>2]=0,c=c+4|0;while((c|0)<(d|0));e[r>>2]=35716,c=r+132|0,e[c>>2]=0,e[c+4>>2]=0,e[c+8>>2]=0,e[c+12>>2]=0,e[r+148>>2]=e[l>>2],e[r+152>>2]=0,e[r+156>>2]=0,e[r+160>>2]=0,c=r+4544|0,l=r+164|0;do e[l>>2]=0,e[l+4>>2]=0,I[l+8>>1]=0,I[l+10>>1]=1,l=l+12|0;while((l|0)!=(c|0));h=t+4|0,e[c>>2]=0,e[c+4>>2]=0,I[c+8>>1]=0,S[c+10>>0]=0,d=r+4556|0,e[d>>2]=0,e[d+4>>2]=0,I[d+8>>1]=0,S[d+10>>0]=0,d=r+4568|0,e[d>>2]=0,e[d+4>>2]=0,e[d+8>>2]=0,e[d+12>>2]=0,e[d+16>>2]=0,e[d+20>>2]=0,e[d+24>>2]=0,S[d+28>>0]=0,e[r+28>>2]|0||(e[r+20>>2]=1),l=e[h>>2]|0,e[h>>2]=r,l&&(Mt[e[(e[l>>2]|0)+4>>2]&255](l),r=e[h>>2]|0),Y0(r,C)}return C=t+100|0,e[C>>2]=32,e[t+96>>2]=0,r=e[o>>2]|0,r?(e[t+132>>2]=r,c=t+120|0,w=t+124|0,l=e[w>>2]|0,r=e[c>>2]|0,h=r,d=l-h|0,d>>>0>=4e3?d>>>0>4e3&&(D=r+4e3|0,(l|0)!=(D|0))&&(e[w>>2]=D,l=D):(vi(c,4e3-d|0),r=e[c>>2]|0,h=r,l=e[w>>2]|0),e[t+108>>2]=h,e[t+104>>2]=l-r,ms(t),D=t+116|0,D=e[D>>2]|0,t=e[C>>2]|0,t=t+-32|0,t=(t|0)/8|0,t=D-t|0,b=k,t|0):(e[t+108>>2]=e[o+4>>2],e[t+104>>2]=e[w>>2],ms(t),D=t+116|0,D=e[D>>2]|0,t=e[C>>2]|0,t=t+-32|0,t=(t|0)/8|0,t=D-t|0,b=k,t|0)}function u2(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0,G=0,$=0,P=0,O=0;if(G=b,b=b+352|0,$=G+328|0,P=G+192|0,o=G+343|0,l=G+342|0,c=G+341|0,h=G+340|0,R=G+176|0,w=G+168|0,C=G+160|0,D=G+152|0,K=G,U=G+136|0,e[t+32>>2]|0&&(e[t+24>>2]|0)!=1){if(_=t+8|0,Q=t+36|0,d=e[Q>>2]|0,!d){if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[o>>0]|0,$e(44,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}if(t=e[t+16>>2]|0,(t|0)==8)switch(d|0){case 1:{if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[l>>0]|0,$e(45,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 2:{if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[c>>0]|0,$e(46,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 3:{if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[h>>0]|0,$e(47,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}default:{d=P+56|0,c=P+4|0,e[P>>2]=36160,e[d>>2]=36180,g=0,Ae(62,P+56|0,c|0),G=g,g=0,G&1&&(O=j()|0,tt(d),le(O|0)),e[P+128>>2]=0,e[P+132>>2]=-1,e[P>>2]=36200,e[P+56>>2]=36220,g=0,ue(180,c|0),G=g,g=0;do if(G&1)t=j()|0;else{if(e[c>>2]=36236,h=P+36|0,e[h>>2]=0,e[h+4>>2]=0,e[h+8>>2]=0,e[h+12>>2]=0,e[P+52>>2]=16,e[$>>2]=0,e[$+4>>2]=0,e[$+8>>2]=0,g=0,Ae(63,c|0,$|0),G=g,g=0,G&1){t=j()|0,de($),de(h),wt(c);break}de($),g=0,t=Ve(28,P|0,49007,21)|0,$=g,g=0;do if(!($&1)&&(g=0,k=be(36,t|0,e[Q>>2]|0)|0,$=g,g=0,!($&1))&&(g=0,Ve(28,k|0,50997,18)|0,$=g,g=0,!($&1))){if(l=Ct(16)|0,g=0,Ae(64,R|0,c|0),$=g,g=0,$&1)t=j()|0;else if(!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,H|0)|0,bt(8)),g=0,$e(36,l|0,9,35648,R|0),$=g,g=0,$&1?o=1:(g=0,xe(6,l|0,824,96),g=0,o=0),t=j()|0,de(R),!o)break;Tt(l|0)}else O=34;while(!1);(O|0)==34&&(t=j()|0),e[P>>2]=36200,e[d>>2]=36220,e[c>>2]=36236,de(h),wt(c),tt(d),O=t,le(O|0)}while(!1);O=t,tt(d),le(O|0)}}switch((t|0)<=8&&(t=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,H|0)|0,bt(8)),g=0,xe(7,t|0,8,35648),O=g,g=0,O&1||Qt(t|0,824,96),O=j()|0,Tt(t|0),le(O|0)),o=16-t|0,d|0){case 1:{if(t=Xe(60)|0,e[w>>2]=o,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],e[$>>2]=e[w>>2],e[$+4>>2]=e[w+4>>2],$e(41,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 2:{if(t=Xe(60)|0,e[C>>2]=o,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],e[$>>2]=e[C>>2],e[$+4>>2]=e[C+4>>2],$e(42,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 3:{if(t=Xe(60)|0,e[D>>2]=o,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],e[$>>2]=e[D>>2],e[$+4>>2]=e[D+4>>2],$e(43,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}default:{d=K+56|0,c=K+4|0,e[K>>2]=36160,e[d>>2]=36180,g=0,Ae(62,K+56|0,c|0),P=g,g=0,P&1&&(O=j()|0,tt(d),le(O|0)),e[K+128>>2]=0,e[K+132>>2]=-1,e[K>>2]=36200,e[K+56>>2]=36220,g=0,ue(180,c|0),P=g,g=0;do if(P&1)t=j()|0;else{if(e[c>>2]=36236,h=K+36|0,e[h>>2]=0,e[h+4>>2]=0,e[h+8>>2]=0,e[h+12>>2]=0,e[K+52>>2]=16,e[$>>2]=0,e[$+4>>2]=0,e[$+8>>2]=0,g=0,Ae(63,c|0,$|0),P=g,g=0,P&1){t=j()|0,de($),de(h),wt(c);break}de($),g=0,t=Ve(28,K|0,49007,21)|0,P=g,g=0;do if(!(P&1)&&(g=0,N=be(36,t|0,e[Q>>2]|0)|0,P=g,g=0,!(P&1))&&(g=0,Ve(28,N|0,50997,18)|0,P=g,g=0,!(P&1))){if(l=Ct(16)|0,g=0,Ae(64,U|0,c|0),P=g,g=0,P&1)t=j()|0;else if(!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,H|0)|0,bt(8)),g=0,$e(36,l|0,9,35648,U|0),P=g,g=0,P&1?o=1:(g=0,xe(6,l|0,824,96),g=0,o=0),t=j()|0,de(U),!o)break;Tt(l|0)}else O=64;while(!1);(O|0)==64&&(t=j()|0),e[K>>2]=36200,e[d>>2]=36220,e[c>>2]=36236,de(h),wt(c),tt(d),O=t,le(O|0)}while(!1);O=t,tt(d),le(O|0)}}}return o=e[r+4>>2]|0,l=Xe(16)|0,t=e[t+20>>2]|0,o?(e[l>>2]=36108,e[l+4>>2]=o,e[l+8>>2]=1,e[l+12>>2]=t,O=l,b=G,O|0):(O=e[r>>2]|0,e[l>>2]=36132,e[l+4>>2]=O,e[l+8>>2]=1,e[l+12>>2]=t,O=l,b=G,O|0)}function ms(t){t=t|0;var r=0,o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0,G=0,$=0,P=0;K=b,b=b+32|0,$=K+12|0,Q=K,R=t+156|0,_=(e[R>>2]|0)+4|0,(e[t+32>>2]|0)==1?U=e[t+24>>2]|0:U=1,r=ee(U<<1,_)|0,e[$>>2]=0,P=$+4|0,e[P>>2]=0,e[$+8>>2]=0;e:do if(r){if((r|0)<0&&(g=0,ue(178,$|0),G=g,g=0,G&1)||(h=6),(h|0)==6&&(g=0,o=ge(67,r|0)|0,G=g,g=0,!(G&1))){for(e[P>>2]=o,e[$>>2]=o,e[$+8>>2]=o+r;;)if(S[o>>0]=0,o=(e[P>>2]|0)+1|0,e[P>>2]=o,r=r+-1|0,!r)break e}o=j()|0,r=e[$>>2]|0,r||le(o|0),(e[P>>2]|0)!=(r|0)&&(e[P>>2]=r),he(r),le(o|0)}while(!1);e[Q>>2]=0,G=Q+4|0,e[G>>2]=0,e[Q+8>>2]=0;do if(!U)h=19;else{if(U>>>0>1073741823&&(g=0,ue(178,Q|0),N=g,g=0,N&1)||(h=17),(h|0)==17&&(l=U<<2,g=0,c=ge(67,l|0)|0,N=g,g=0,!(N&1))){e[Q>>2]=c,h=c+(U<<2)|0,e[Q+8>>2]=h,Jt(c|0,0,l|0)|0,e[G>>2]=h,h=19;break}o=j()|0,r=e[Q>>2]|0,l=r,r&&(c=e[G>>2]|0,(c|0)!=(r|0)&&(e[G>>2]=c+(~((c+-4-l|0)>>>2)<<2)),he(r))}while(!1);if((h|0)==19){c=t+12|0;e:do if((e[c>>2]|0)>0){h=t+4580|0,d=(ee(U,_)|0)+1|0,w=t+4584|0,C=t+92|0,D=(U|0)>0,k=t+4576|0,N=0;t:for(;;){if(o=e[$>>2]|0,r=o+1|0,e[h>>2]=r,o=o+d|0,e[w>>2]=o,N&1?(e[h>>2]=o,e[w>>2]=r):r=o,l=e[C>>2]|0,g=0,$e(e[(e[l>>2]|0)+12>>2]|0,l|0,r|0,e[R>>2]|0,_|0),l=g,g=0,l&1){h=29;break}if(D){r=e[h>>2]|0,o=e[Q>>2]|0,l=0;do{if(e[k>>2]=e[o+(l<<2)>>2],o=e[R>>2]|0,S[r+o>>0]=S[r+(o+-1)>>0]|0,S[(e[w>>2]|0)+-1>>0]=S[e[h>>2]>>0]|0,g=0,Ae(73,t|0,0),o=g,g=0,o&1){h=28;break t}o=e[Q>>2]|0,e[o+(l<<2)>>2]=e[k>>2],r=(e[h>>2]|0)+_|0,e[h>>2]=r,e[w>>2]=(e[w>>2]|0)+_,l=l+1|0}while((l|0)<(U|0))}if(N=N+1|0,(N|0)>=(e[c>>2]|0)){h=41;break e}}if((h|0)==28){o=j()|0;break}else if((h|0)==29){o=j()|0;break}}else h=41;while(!1);do if((h|0)==41){if(g=0,ue(182,t|0),t=g,g=0,t&1){o=j()|0;break}if(r=e[Q>>2]|0,o=r,r&&(l=e[G>>2]|0,(l|0)!=(r|0)&&(e[G>>2]=l+(~((l+-4-o|0)>>>2)<<2)),he(r)),r=e[$>>2]|0,!r){b=K;return}(e[P>>2]|0)!=(r|0)&&(e[P>>2]=r),he(r),b=K;return}while(!1);r=e[Q>>2]|0,l=r,r&&(c=e[G>>2]|0,(c|0)!=(r|0)&&(e[G>>2]=c+(~((c+-4-l|0)>>>2)<<2)),he(r))}r=e[$>>2]|0,r||le(o|0),(e[P>>2]|0)!=(r|0)&&(e[P>>2]=r),he(r),le(o|0)}function c2(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0;if(N=t+4580|0,r=e[N>>2]|0,U=t+156|0,!((e[U>>2]|0)<=0))for(R=t+4584|0,_=t+4588|0,c=r,h=F[r+-1>>0]|0,r=F[r>>0]|0,k=0;D=e[R>>2]|0,C=F[D+(k+-1)>>0]|0,l=k+1|0,o=F[c+l>>0]|0,w=e[_>>2]|0,d=r-h|0,c=h-C|0,w=((((S[w+(o-r)>>0]|0)*9|0)+(S[w+d>>0]|0)|0)*9|0)+(S[w+c>>0]|0)|0,w?(h=r-C>>31,(h^c|0)<0?c=r:c=C+((h^d|0)<0?0:d)|0,D=f2(t,w,F[D+k>>0]|0,c,0)|0,S[(e[R>>2]|0)+k>>0]=D):(l=(h2(t,k,0)|0)+k|0,o=e[N>>2]|0,r=F[o+(l+-1)>>0]|0,o=F[o+l>>0]|0),!((l|0)>=(e[U>>2]|0));)c=e[N>>2]|0,h=r,r=o,k=l}function f2(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0;if(U=r>>31,C=(U^r)-U|0,_=t+172+(C*12|0)+10|0,d=I[_>>1]|0,R=t+172+(C*12|0)|0,c=e[R>>2]|0,(d|0)<(c|0))if((d<<1|0)<(c|0))if((d<<2|0)<(c|0))if((d<<3|0)<(c|0))if((d<<4|0)<(c|0))for(h=5;(d<>1]^U)-U+l|0,(c&255|0)==(c|0)?k=c:k=c>>31&255^255,w=(o-k^U)-U<<24,D=w>>24,h?c=0:c=(e[t+172+(C*12|0)+4>>2]<<1)+-1+d>>31,c=c^D,c=c>>30^c<<1,l=c>>h,(l|0)<23?(_t(t,1,l+1|0),_t(t,c&(1<>1]|0,c=d<<16>>16==64,h=c&1,o=(e[l>>2]|0)+D>>h,d=c?32:d<<16>>16,e[R>>2]=(e[R>>2]|0)+((w|0)>-16777216?D:0-D|0)>>h,h=d+1|0,I[_>>1]=h,c=h+o|0,(c|0)<1?(_=I[N>>1]|0,I[N>>1]=(_&65535)-(_<<16>>16>-128&1),_=(c|0)>(~d|0)?c:0-d|0,e[l>>2]=_,U=D^U,r=r>>>31,r=k+r|0,r=r+U|0,r=r&255,r|0):(o|0)<=0?(_=o,e[l>>2]=_,U=D^U,r=r>>>31,r=k+r|0,r=r+U|0,r=r&255,r|0):(_=o-h|0,R=I[N>>1]|0,I[N>>1]=(R<<16>>16<127&1)+(R&65535),_=(_|0)>0?0:_,e[l>>2]=_,U=D^U,r=r>>>31,r=k+r|0,r=r+U|0,r=r&255,r|0)}function h2(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0;for(d=(e[t+156>>2]|0)-r|0,w=e[t+4584>>2]|0,D=e[t+4580>>2]|0,c=S[w+(r+-1)>>0]|0,l=0;;){if(o=w+(l+r)|0,(S[o>>0]|0)!=c<<24>>24){k=l;break}if(S[o>>0]=c,l=l+1|0,(l|0)==(d|0)){k=d;break}}if(h=c&255,c=(k|0)==(d|0),C=t+4576|0,l=e[36476+(e[C>>2]<<2)>>2]|0,(1<(k|0))o=k;else{o=k;do _t(t,1,1),l=e[C>>2]|0,o=o-(1<>2])|0,l=(l|0)>30?31:l+1|0,e[C>>2]=l,l=e[36476+(l<<2)>>2]|0;while((o|0)>=(1<>0]|0,o=F[D+o>>0]|0,D=h-o|0,(((D|0)>-1?D:0-D|0)|0)<1?(o=l-h<<24>>24,gs(t,t+4564|0,o),o=o+h|0):(D=o-h>>31|1,r=(ee(l-o<<24,D)|0)>>24,gs(t,t+4552|0,r),o=(ee(r,D)|0)+o|0),S[c>>0]=o,t=e[C>>2]|0,e[C>>2]=(t|0)<1?0:t+-1|0,t=k+1|0,t|0)}function gs(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0;if(k=r+9|0,d=F[k>>0]|0,D=r+4|0,C=e[D>>2]|0,c=(ee(d>>>1,C)|0)+(e[r>>2]|0)|0,(d|0)<(c|0)){h=d,l=0;do h=h<<1,l=l+1|0;while((h|0)<(c|0));c=l}else c=0;(o|0)>0&(c|0)==0&&F[r+10>>0]<<1>>>0>>0?l=1:w=5;do if((w|0)==5){if(l=(o|0)<0,l&&F[r+10>>0]<<1>>>0>=d>>>0){l=1;break}l=l&(c|0)!=0}while(!1);if(l=(((o|0)>-1?o:0-o|0)<<1)-C+(l<<31>>31)|0,d2(t,c,l,31-(e[36476+(e[t+4576>>2]<<2)>>2]|0)|0),(o|0)<0&&(t=r+10|0,S[t>>0]=(F[t>>0]|0)+1),l=(l+1-(e[D>>2]|0)>>1)+(e[r>>2]|0)|0,e[r>>2]=l,c=S[k>>0]|0,c<<24>>24!=(S[r+8>>0]|0)){r=c,r=r&255,r=r+1|0,r=r&255,S[k>>0]=r;return}e[r>>2]=l>>1,t=(c&255)>>>1,S[k>>0]=t,r=r+10|0,S[r>>0]=(F[r>>0]|0)>>>1,r=t,r=r&255,r=r+1|0,r=r&255,S[k>>0]=r}function d2(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0;if(c=o>>r,h=l+-8|0,(c|0)<(l+-9|0)){(c|0)>30&&(l=(c|0)/2|0,_t(t,0,l),c=c-l|0),_t(t,1,c+1|0),_t(t,(1<31?(_t(t,0,31),_t(t,1,l+-39|0)):_t(t,1,h),_t(t,o+255&255,8)}function p2(t){t=t|0;var r=0,o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0;if(D=b,b=b+32|0,w=D,m0(w,255,0),C=t+160|0,(e[w+4>>2]|0)==(e[C>>2]|0)&&(e[w+8>>2]|0)==(e[t+164>>2]|0)&&(e[w+12>>2]|0)==(e[t+168>>2]|0)){C=e[8900]|0,e[t+4588>>2]=C+(((e[8901]|0)-C|0)>>>1),b=D;return}for(o=t+4592|0,l=t+4596|0,c=e[l>>2]|0,r=e[o>>2]|0,h=c-r|0,h>>>0>=512?h>>>0>512&&(d=r+512|0,(c|0)!=(d|0))&&(e[l>>2]=d):(j0(o,512-h|0),r=e[o>>2]|0),w=t+4588|0,e[w>>2]=r+256,d=t+168|0,c=t+164|0,h=-256;;){if(r=e[d>>2]|0,(h|0)>(0-r|0))if(o=e[c>>2]|0,(h|0)>(0-o|0))if(l=e[C>>2]|0,(h|0)>(0-l|0))if((h|0)>=0){if((h|0)<1){S[(e[w>>2]|0)+h>>0]=0,h=1;continue}(l|0)<=(h|0)?(o|0)>(h|0)?r=2:r=(r|0)>(h|0)?3:4:r=1}else r=-1;else r=-2;else r=-3;else r=-4;if(S[(e[w>>2]|0)+h>>0]=r,h=h+1|0,(h|0)==256)break}b=D}function m2(t){t=t|0;var r=0,o=0;e[t>>2]=35912,r=e[t+4592>>2]|0,r&&(o=t+4596|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),e[t>>2]=36612,r=e[t+120>>2]|0,r&&(o=t+124|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),o=t+92|0,r=e[o>>2]|0,e[o>>2]=0,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r),t=t+4|0,r=e[t>>2]|0,e[t>>2]=0,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r)}function g2(t){t=t|0;var r=0,o=0;if(e[t>>2]=35912,r=e[t+4592>>2]|0,r&&(o=t+4596|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),e[t>>2]=36612,r=e[t+120>>2]|0,r&&(o=t+124|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),o=t+92|0,r=e[o>>2]|0,e[o>>2]=0,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r),o=t+4|0,r=e[o>>2]|0,e[o>>2]=0,!r){he(t);return}Mt[e[(e[r>>2]|0)+4>>2]&255](r),he(t)}function S2(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0;c=b,b=b+32|0,w=c,m0(w,255,0),d=e[r+4>>2]|0,h=e[r+8>>2]|0,h=h|0?h:e[w+8>>2]|0,l=e[r+12>>2]|0,l=l|0?l:e[w+12>>2]|0,r=e[r+16>>2]|0,o=e[w+16>>2]|0,e[t+160>>2]=d|0?d:e[w+4>>2]|0,e[t+164>>2]=h,e[t+168>>2]=l,C2(t),l=0;do e[t+172+(l*12|0)>>2]=4,e[t+172+(l*12|0)+4>>2]=0,I[t+172+(l*12|0)+8>>1]=0,I[t+172+(l*12|0)+10>>1]=1,l=l+1|0;while((l|0)!=365);w=(r|0?r:o)&255,e[t+4552>>2]=4,e[t+4556>>2]=0,S[t+4560>>0]=w,S[t+4561>>0]=1,S[t+4562>>0]=0,e[t+4564>>2]=4,e[t+4568>>2]=1,S[t+4572>>0]=w,S[t+4573>>0]=1,S[t+4574>>0]=0,e[t+4576>>2]=0,b=c}function A2(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0,D=0,k=0;if(k=b,b=b+16|0,C=k,w=t+92|0,d=e[r>>2]|0,e[r>>2]=0,r=e[w>>2]|0,e[w>>2]=d,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r),e[C>>2]=0,e[C+4>>2]=l,w=o+8|0,e[C+8>>2]=e[w>>2],l){r=Xe(4600)|0,l=t+8|0,c=r+4|0,h=l,d=c+84|0;do e[c>>2]=e[h>>2],c=c+4|0,h=h+4|0;while((c|0)<(d|0));c=r+88|0,d=c+40|0;do e[c>>2]=0,c=c+4|0;while((c|0)<(d|0));e[r>>2]=35688,c=r+132|0,e[c>>2]=0,e[c+4>>2]=0,e[c+8>>2]=0,e[c+12>>2]=0,e[r+148>>2]=e[l>>2],e[r+152>>2]=0,e[r+156>>2]=0,e[r+160>>2]=0,c=r+4544|0,l=r+164|0;do e[l>>2]=0,e[l+4>>2]=0,I[l+8>>1]=0,I[l+10>>1]=1,l=l+12|0;while((l|0)!=(c|0));h=t+4|0,e[c>>2]=0,e[c+4>>2]=0,I[c+8>>1]=0,S[c+10>>0]=0,d=r+4556|0,e[d>>2]=0,e[d+4>>2]=0,I[d+8>>1]=0,S[d+10>>0]=0,d=r+4568|0,e[d>>2]=0,e[d+4>>2]=0,e[d+8>>2]=0,e[d+12>>2]=0,e[d+16>>2]=0,e[d+20>>2]=0,e[d+24>>2]=0,S[d+28>>0]=0,e[r+28>>2]|0||(e[r+20>>2]=1),l=e[h>>2]|0,e[h>>2]=r,l&&(Mt[e[(e[l>>2]|0)+4>>2]&255](l),r=e[h>>2]|0),Y0(r,C)}return C=t+100|0,e[C>>2]=32,e[t+96>>2]=0,r=e[o>>2]|0,r?(e[t+132>>2]=r,c=t+120|0,w=t+124|0,l=e[w>>2]|0,r=e[c>>2]|0,h=r,d=l-h|0,d>>>0>=4e3?d>>>0>4e3&&(D=r+4e3|0,(l|0)!=(D|0))&&(e[w>>2]=D,l=D):(vi(c,4e3-d|0),r=e[c>>2]|0,h=r,l=e[w>>2]|0),e[t+108>>2]=h,e[t+104>>2]=l-r,Ss(t),D=t+116|0,D=e[D>>2]|0,t=e[C>>2]|0,t=t+-32|0,t=(t|0)/8|0,t=D-t|0,b=k,t|0):(e[t+108>>2]=e[o+4>>2],e[t+104>>2]=e[w>>2],Ss(t),D=t+116|0,D=e[D>>2]|0,t=e[C>>2]|0,t=t+-32|0,t=(t|0)/8|0,t=D-t|0,b=k,t|0)}function v2(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0,G=0,$=0,P=0,O=0;if(G=b,b=b+352|0,$=G+328|0,P=G+192|0,o=G+343|0,l=G+342|0,c=G+341|0,h=G+340|0,R=G+176|0,w=G+168|0,C=G+160|0,D=G+152|0,K=G,U=G+136|0,e[t+32>>2]|0&&(e[t+24>>2]|0)!=1){if(_=t+8|0,Q=t+36|0,d=e[Q>>2]|0,!d){if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[o>>0]|0,$e(44,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}if(t=e[t+16>>2]|0,(t|0)==8)switch(d|0){case 1:{if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[l>>0]|0,$e(45,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 2:{if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[c>>0]|0,$e(46,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 3:{if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[h>>0]|0,$e(47,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}default:{d=P+56|0,c=P+4|0,e[P>>2]=36160,e[d>>2]=36180,g=0,Ae(62,P+56|0,c|0),G=g,g=0,G&1&&(O=j()|0,tt(d),le(O|0)),e[P+128>>2]=0,e[P+132>>2]=-1,e[P>>2]=36200,e[P+56>>2]=36220,g=0,ue(180,c|0),G=g,g=0;do if(G&1)t=j()|0;else{if(e[c>>2]=36236,h=P+36|0,e[h>>2]=0,e[h+4>>2]=0,e[h+8>>2]=0,e[h+12>>2]=0,e[P+52>>2]=16,e[$>>2]=0,e[$+4>>2]=0,e[$+8>>2]=0,g=0,Ae(63,c|0,$|0),G=g,g=0,G&1){t=j()|0,de($),de(h),wt(c);break}de($),g=0,t=Ve(28,P|0,49007,21)|0,$=g,g=0;do if(!($&1)&&(g=0,k=be(36,t|0,e[Q>>2]|0)|0,$=g,g=0,!($&1))&&(g=0,Ve(28,k|0,50997,18)|0,$=g,g=0,!($&1))){if(l=Ct(16)|0,g=0,Ae(64,R|0,c|0),$=g,g=0,$&1)t=j()|0;else if(!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,H|0)|0,bt(8)),g=0,$e(36,l|0,9,35648,R|0),$=g,g=0,$&1?o=1:(g=0,xe(6,l|0,824,96),g=0,o=0),t=j()|0,de(R),!o)break;Tt(l|0)}else O=34;while(!1);(O|0)==34&&(t=j()|0),e[P>>2]=36200,e[d>>2]=36220,e[c>>2]=36236,de(h),wt(c),tt(d),O=t,le(O|0)}while(!1);O=t,tt(d),le(O|0)}}switch((t|0)<=8&&(t=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,H|0)|0,bt(8)),g=0,xe(7,t|0,8,35648),O=g,g=0,O&1||Qt(t|0,824,96),O=j()|0,Tt(t|0),le(O|0)),o=16-t|0,d|0){case 1:{if(t=Xe(60)|0,e[w>>2]=o,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],e[$>>2]=e[w>>2],e[$+4>>2]=e[w+4>>2],$e(41,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 2:{if(t=Xe(60)|0,e[C>>2]=o,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],e[$>>2]=e[C>>2],e[$+4>>2]=e[C+4>>2],$e(42,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 3:{if(t=Xe(60)|0,e[D>>2]=o,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],e[$>>2]=e[D>>2],e[$+4>>2]=e[D+4>>2],$e(43,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}default:{d=K+56|0,c=K+4|0,e[K>>2]=36160,e[d>>2]=36180,g=0,Ae(62,K+56|0,c|0),P=g,g=0,P&1&&(O=j()|0,tt(d),le(O|0)),e[K+128>>2]=0,e[K+132>>2]=-1,e[K>>2]=36200,e[K+56>>2]=36220,g=0,ue(180,c|0),P=g,g=0;do if(P&1)t=j()|0;else{if(e[c>>2]=36236,h=K+36|0,e[h>>2]=0,e[h+4>>2]=0,e[h+8>>2]=0,e[h+12>>2]=0,e[K+52>>2]=16,e[$>>2]=0,e[$+4>>2]=0,e[$+8>>2]=0,g=0,Ae(63,c|0,$|0),P=g,g=0,P&1){t=j()|0,de($),de(h),wt(c);break}de($),g=0,t=Ve(28,K|0,49007,21)|0,P=g,g=0;do if(!(P&1)&&(g=0,N=be(36,t|0,e[Q>>2]|0)|0,P=g,g=0,!(P&1))&&(g=0,Ve(28,N|0,50997,18)|0,P=g,g=0,!(P&1))){if(l=Ct(16)|0,g=0,Ae(64,U|0,c|0),P=g,g=0,P&1)t=j()|0;else if(!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,H|0)|0,bt(8)),g=0,$e(36,l|0,9,35648,U|0),P=g,g=0,P&1?o=1:(g=0,xe(6,l|0,824,96),g=0,o=0),t=j()|0,de(U),!o)break;Tt(l|0)}else O=64;while(!1);(O|0)==64&&(t=j()|0),e[K>>2]=36200,e[d>>2]=36220,e[c>>2]=36236,de(h),wt(c),tt(d),O=t,le(O|0)}while(!1);O=t,tt(d),le(O|0)}}}return o=e[r+4>>2]|0,l=Xe(16)|0,t=e[t+20>>2]|0,o?(e[l>>2]=36108,e[l+4>>2]=o,e[l+8>>2]=3,e[l+12>>2]=t,O=l,b=G,O|0):(O=e[r>>2]|0,e[l>>2]=36132,e[l+4>>2]=O,e[l+8>>2]=3,e[l+12>>2]=t,O=l,b=G,O|0)}function Ss(t){t=t|0;var r=0,o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0,G=0,$=0,P=0,O=0;K=b,b=b+32|0,$=K+12|0,Q=K,R=t+156|0,_=(e[R>>2]|0)+4|0,(e[t+32>>2]|0)==1?U=e[t+24>>2]|0:U=1,r=ee(U<<1,_)|0,e[$>>2]=0,P=$+4|0,e[P>>2]=0,e[$+8>>2]=0;e:do if(r){if(r>>>0>1431655765&&(g=0,ue(178,$|0),G=g,g=0,G&1)||(h=6),(h|0)==6&&(g=0,o=ge(67,r*3|0)|0,G=g,g=0,!(G&1))){for(e[P>>2]=o,e[$>>2]=o,e[$+8>>2]=o+(r*3|0);;)if(S[o>>0]=0,S[o+1>>0]=0,S[o+2>>0]=0,o=(e[P>>2]|0)+3|0,e[P>>2]=o,r=r+-1|0,!r)break e}l=j()|0,r=e[$>>2]|0,r||le(l|0),o=e[P>>2]|0,(o|0)!=(r|0)&&(e[P>>2]=o+(~(((o+-3-r|0)>>>0)/3|0)*3|0)),he(r),le(l|0)}while(!1);e[Q>>2]=0,G=Q+4|0,e[G>>2]=0,e[Q+8>>2]=0;do if(!U)h=19;else{if(U>>>0>1073741823&&(g=0,ue(178,Q|0),N=g,g=0,N&1)||(h=17),(h|0)==17&&(l=U<<2,g=0,c=ge(67,l|0)|0,N=g,g=0,!(N&1))){e[Q>>2]=c,h=c+(U<<2)|0,e[Q+8>>2]=h,Jt(c|0,0,l|0)|0,e[G>>2]=h,h=19;break}l=j()|0,r=e[Q>>2]|0,o=r,r&&(c=e[G>>2]|0,(c|0)!=(r|0)&&(e[G>>2]=c+(~((c+-4-o|0)>>>2)<<2)),he(r))}while(!1);if((h|0)==19){c=t+12|0;e:do if((e[c>>2]|0)>0){h=t+4580|0,d=(ee(U,_)|0)+1|0,w=t+4584|0,C=t+92|0,D=(U|0)>0,k=t+4576|0,N=0;t:for(;;){if(l=e[$>>2]|0,r=l+3|0,e[h>>2]=r,o=l+(d*3|0)|0,e[w>>2]=o,N&1?(e[h>>2]=o,e[w>>2]=r,r=1):r=d,o=e[C>>2]|0,g=0,$e(e[(e[o>>2]|0)+12>>2]|0,o|0,l+(r*3|0)|0,e[R>>2]|0,_|0),l=g,g=0,l&1){h=29;break}if(D){r=e[Q>>2]|0,o=e[h>>2]|0,l=0;do{if(e[k>>2]=e[r+(l<<2)>>2],O=e[R>>2]|0,r=o+(O*3|0)|0,o=o+((O+-1|0)*3|0)|0,S[r>>0]=S[o>>0]|0,S[r+1>>0]=S[o+1>>0]|0,S[r+2>>0]=S[o+2>>0]|0,r=e[h>>2]|0,o=(e[w>>2]|0)+-3|0,S[o>>0]=S[r>>0]|0,S[o+1>>0]=S[r+1>>0]|0,S[o+2>>0]=S[r+2>>0]|0,g=0,Ae(74,t|0,0),o=g,g=0,o&1){h=28;break t}r=e[Q>>2]|0,e[r+(l<<2)>>2]=e[k>>2],o=(e[h>>2]|0)+(_*3|0)|0,e[h>>2]=o,e[w>>2]=(e[w>>2]|0)+(_*3|0),l=l+1|0}while((l|0)<(U|0))}if(N=N+1|0,(N|0)>=(e[c>>2]|0)){h=41;break e}}if((h|0)==28){l=j()|0;break}else if((h|0)==29){l=j()|0;break}}else h=41;while(!1);do if((h|0)==41){if(g=0,ue(182,t|0),O=g,g=0,O&1){l=j()|0;break}if(r=e[Q>>2]|0,o=r,r&&(l=e[G>>2]|0,(l|0)!=(r|0)&&(e[G>>2]=l+(~((l+-4-o|0)>>>2)<<2)),he(r)),r=e[$>>2]|0,!r){b=K;return}o=e[P>>2]|0,(o|0)!=(r|0)&&(e[P>>2]=o+(~(((o+-3-r|0)>>>0)/3|0)*3|0)),he(r),b=K;return}while(!1);r=e[Q>>2]|0,o=r,r&&(c=e[G>>2]|0,(c|0)!=(r|0)&&(e[G>>2]=c+(~((c+-4-o|0)>>>2)<<2)),he(r))}r=e[$>>2]|0,r||le(l|0),o=e[P>>2]|0,(o|0)!=(r|0)&&(e[P>>2]=o+(~(((o+-3-r|0)>>>0)/3|0)*3|0)),he(r),le(l|0)}function x2(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0,ce=0,ke=0;if(oe=t+156|0,!((e[oe>>2]|0)<=0))for(ne=t+4584|0,ce=t+4580|0,ke=t+4588|0,ie=0;P=ie+-1|0,h=e[ne>>2]|0,d=e[ce>>2]|0,r=ie+1|0,c=F[d+(ie*3|0)>>0]|0,Z=e[ke>>2]|0,w=F[d+(P*3|0)>>0]|0,C=c-w|0,D=F[h+(P*3|0)>>0]|0,k=w-D|0,N=((((S[Z+((F[d+(r*3|0)>>0]|0)-c)>>0]|0)*9|0)+(S[Z+C>>0]|0)|0)*9|0)+(S[Z+k>>0]|0)|0,l=F[d+(ie*3|0)+1>>0]|0,R=F[d+(P*3|0)+1>>0]|0,_=l-R|0,U=F[h+(P*3|0)+1>>0]|0,Q=R-U|0,K=((((S[Z+((F[d+(r*3|0)+1>>0]|0)-l)>>0]|0)*9|0)+(S[Z+_>>0]|0)|0)*9|0)+(S[Z+Q>>0]|0)|0,o=F[d+(ie*3|0)+2>>0]|0,G=F[d+(P*3|0)+2>>0]|0,$=o-G|0,P=F[h+(P*3|0)+2>>0]|0,O=G-P|0,Z=((((S[Z+((F[d+(r*3|0)+2>>0]|0)-o)>>0]|0)*9|0)+(S[Z+$>>0]|0)|0)*9|0)+(S[Z+O>>0]|0)|0,K|N|Z?(d=F[h+(ie*3|0)>>0]|0,h=c-D>>31,(h^k|0)>=0&&((h^C|0)<0?c=D:c=D-w+c|0),d=er(t,N,d,c,0)|0,h=F[(e[ne>>2]|0)+(ie*3|0)+1>>0]|0,c=l-U>>31,(c^Q|0)>=0&&((c^_|0)<0?l=U:l=U-R+l|0),c=er(t,K,h,l,0)|0,h=F[(e[ne>>2]|0)+(ie*3|0)+2>>0]|0,l=o-P>>31,(l^O|0)>=0&&((l^$|0)<0?o=P:o=P-G+o|0),Z=er(t,Z,h,o,0)|0,ie=(e[ne>>2]|0)+(ie*3|0)|0,S[ie>>0]=d,S[ie+1>>0]=c,S[ie+2>>0]=Z):r=(w2(t,ie,0)|0)+ie|0,(r|0)<(e[oe>>2]|0);)ie=r}function w2(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0;for(D=(e[t+156>>2]|0)-r|0,k=e[t+4584>>2]|0,N=e[t+4580>>2]|0,C=k+((r+-1|0)*3|0)|0,R=S[C>>0]|0,w=S[C+1>>0]|0,C=S[C+2>>0]|0,h=0;o=k+((h+r|0)*3|0)|0,l=o+1|0,c=o+2|0,!!(((S[o>>0]|0)==R<<24>>24?(S[l>>0]|0)==w<<24>>24:0)&(S[c>>0]|0)==C<<24>>24);)if(S[o>>0]=R,S[l>>0]=w,S[c>>0]=C,h=h+1|0,(h|0)==(D|0)){h=D;break}if(c=(h|0)==(D|0),d=t+4576|0,l=e[36476+(e[d>>2]<<2)>>2]|0,(1<(h|0))o=h;else{o=h;do _t(t,1,1),l=e[d>>2]|0,o=o-(1<>2])|0,l=(l|0)>30?31:l+1|0,e[d>>2]=l,l=e[36476+(l<<2)>>2]|0;while((o|0)>=(1<>0]|0,r=D+2|0,c=S[r>>0]|0,N=N+(l*3|0)|0,l=S[N+1>>0]|0,K=S[N+2>>0]|0,N=F[N>>0]|0,_=N-(R&255)>>31|1,U=(ee((F[D>>0]|0)-N<<24,_)|0)>>24,Q=t+4552|0,tr(t,Q,U),R=l&255,l=R-(w&255)>>31|1,o=(ee((o&255)-R<<24,l)|0)>>24,tr(t,Q,o),w=K&255,C=w-(C&255)>>31|1,c=(ee((c&255)-w<<24,C)|0)>>24,tr(t,Q,c),N=(ee(U,_)|0)+N&255,R=(ee(o,l)|0)+R&255,t=(ee(c,C)|0)+w&255,S[D>>0]=N,S[k>>0]=R,S[r>>0]=t,t=e[d>>2]|0,e[d>>2]=(t|0)<1?0:t+-1|0,t=h+1|0,t|0)}function er(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0;if(U=r>>31,C=(U^r)-U|0,_=t+172+(C*12|0)+10|0,d=I[_>>1]|0,R=t+172+(C*12|0)|0,c=e[R>>2]|0,(d|0)<(c|0))if((d<<1|0)<(c|0))if((d<<2|0)<(c|0))if((d<<3|0)<(c|0))if((d<<4|0)<(c|0))for(h=5;(d<>1]^U)-U+l|0,(c&255|0)==(c|0)?k=c:k=c>>31&255^255,w=(o-k^U)-U<<24,D=w>>24,h?c=0:c=(e[t+172+(C*12|0)+4>>2]<<1)+-1+d>>31,c=c^D,c=c>>30^c<<1,l=c>>h,(l|0)<23?(_t(t,1,l+1|0),_t(t,c&(1<>1]|0,c=d<<16>>16==64,h=c&1,o=(e[l>>2]|0)+D>>h,d=c?32:d<<16>>16,e[R>>2]=(e[R>>2]|0)+((w|0)>-16777216?D:0-D|0)>>h,h=d+1|0,I[_>>1]=h,c=h+o|0,(c|0)<1?(_=I[N>>1]|0,I[N>>1]=(_&65535)-(_<<16>>16>-128&1),_=(c|0)>(~d|0)?c:0-d|0,e[l>>2]=_,U=D^U,r=r>>>31,r=k+r|0,r=r+U|0,r=r&255,r|0):(o|0)<=0?(_=o,e[l>>2]=_,U=D^U,r=r>>>31,r=k+r|0,r=r+U|0,r=r&255,r|0):(_=o-h|0,R=I[N>>1]|0,I[N>>1]=(R<<16>>16<127&1)+(R&65535),_=(_|0)>0?0:_,e[l>>2]=_,U=D^U,r=r>>>31,r=k+r|0,r=r+U|0,r=r&255,r|0)}function tr(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0;if(k=r+9|0,d=F[k>>0]|0,D=r+4|0,C=e[D>>2]|0,c=(ee(d>>>1,C)|0)+(e[r>>2]|0)|0,(d|0)<(c|0)){h=d,l=0;do h=h<<1,l=l+1|0;while((h|0)<(c|0));c=l}else c=0;(o|0)>0&(c|0)==0&&F[r+10>>0]<<1>>>0>>0?l=1:w=5;do if((w|0)==5){if(l=(o|0)<0,l&&F[r+10>>0]<<1>>>0>=d>>>0){l=1;break}l=l&(c|0)!=0}while(!1);if(l=(((o|0)>-1?o:0-o|0)<<1)-C+(l<<31>>31)|0,y2(t,c,l,31-(e[36476+(e[t+4576>>2]<<2)>>2]|0)|0),(o|0)<0&&(t=r+10|0,S[t>>0]=(F[t>>0]|0)+1),l=(l+1-(e[D>>2]|0)>>1)+(e[r>>2]|0)|0,e[r>>2]=l,c=S[k>>0]|0,c<<24>>24!=(S[r+8>>0]|0)){r=c,r=r&255,r=r+1|0,r=r&255,S[k>>0]=r;return}e[r>>2]=l>>1,t=(c&255)>>>1,S[k>>0]=t,r=r+10|0,S[r>>0]=(F[r>>0]|0)>>>1,r=t,r=r&255,r=r+1|0,r=r&255,S[k>>0]=r}function y2(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0;if(c=o>>r,h=l+-8|0,(c|0)<(l+-9|0)){(c|0)>30&&(l=(c|0)/2|0,_t(t,0,l),c=c-l|0),_t(t,1,c+1|0),_t(t,(1<31?(_t(t,0,31),_t(t,1,l+-39|0)):_t(t,1,h),_t(t,o+255&255,8)}function C2(t){t=t|0;var r=0,o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0;if(D=b,b=b+32|0,w=D,m0(w,255,0),C=t+160|0,(e[w+4>>2]|0)==(e[C>>2]|0)&&(e[w+8>>2]|0)==(e[t+164>>2]|0)&&(e[w+12>>2]|0)==(e[t+168>>2]|0)){C=e[8900]|0,e[t+4588>>2]=C+(((e[8901]|0)-C|0)>>>1),b=D;return}for(o=t+4592|0,l=t+4596|0,c=e[l>>2]|0,r=e[o>>2]|0,h=c-r|0,h>>>0>=512?h>>>0>512&&(d=r+512|0,(c|0)!=(d|0))&&(e[l>>2]=d):(j0(o,512-h|0),r=e[o>>2]|0),w=t+4588|0,e[w>>2]=r+256,d=t+168|0,c=t+164|0,h=-256;;){if(r=e[d>>2]|0,(h|0)>(0-r|0))if(o=e[c>>2]|0,(h|0)>(0-o|0))if(l=e[C>>2]|0,(h|0)>(0-l|0))if((h|0)>=0){if((h|0)<1){S[(e[w>>2]|0)+h>>0]=0,h=1;continue}(l|0)<=(h|0)?(o|0)>(h|0)?r=2:r=(r|0)>(h|0)?3:4:r=1}else r=-1;else r=-2;else r=-3;else r=-4;if(S[(e[w>>2]|0)+h>>0]=r,h=h+1|0,(h|0)==256)break}b=D}function T2(t){t=t|0;var r=0,o=0;e[t>>2]=35884,r=e[t+4616>>2]|0,r&&(o=t+4620|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),e[t>>2]=36612,r=e[t+120>>2]|0,r&&(o=t+124|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),o=t+92|0,r=e[o>>2]|0,e[o>>2]=0,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r),t=t+4|0,r=e[t>>2]|0,e[t>>2]=0,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r)}function I2(t){t=t|0;var r=0,o=0;if(e[t>>2]=35884,r=e[t+4616>>2]|0,r&&(o=t+4620|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),e[t>>2]=36612,r=e[t+120>>2]|0,r&&(o=t+124|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),o=t+92|0,r=e[o>>2]|0,e[o>>2]=0,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r),o=t+4|0,r=e[o>>2]|0,e[o>>2]=0,!r){he(t);return}Mt[e[(e[r>>2]|0)+4>>2]&255](r),he(t)}function E2(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0;d=b,b=b+32|0,C=d,m0(C,e[t+136>>2]|0,e[t+144>>2]|0),w=e[r+4>>2]|0,h=e[r+8>>2]|0,h=h|0?h:e[C+8>>2]|0,c=e[r+12>>2]|0,c=c|0?c:e[C+12>>2]|0,o=e[r+16>>2]|0,l=e[C+16>>2]|0,e[t+184>>2]=w|0?w:e[C+4>>2]|0,e[t+188>>2]=h,e[t+192>>2]=c,P2(t),c=t+140|0,r=(e[c>>2]|0)+32|0,r=(r|0)<128?2:(r|0)/64|0,h=0;do e[t+196+(h*12|0)>>2]=r,e[t+196+(h*12|0)+4>>2]=0,I[t+196+(h*12|0)+8>>1]=0,I[t+196+(h*12|0)+10>>1]=1,h=h+1|0;while((h|0)!=365);w=(e[c>>2]|0)+32|0,w=(w|0)<128?2:(w|0)/64|0,C=(o|0?o:l)&255,e[t+4576>>2]=w,e[t+4580>>2]=0,S[t+4584>>0]=C,S[t+4585>>0]=1,S[t+4586>>0]=0,e[t+4588>>2]=w,e[t+4592>>2]=1,S[t+4596>>0]=C,S[t+4597>>0]=1,S[t+4598>>0]=0,e[t+4600>>2]=0,b=d}function D2(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0,D=0,k=0;if(k=b,b=b+16|0,C=k,w=t+92|0,d=e[r>>2]|0,e[r>>2]=0,r=e[w>>2]|0,e[w>>2]=d,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r),e[C>>2]=0,e[C+4>>2]=l,w=o+8|0,e[C+8>>2]=e[w>>2],l){r=Xe(4624)|0,l=t+8|0,c=r+4|0,h=l,d=c+84|0;do e[c>>2]=e[h>>2],c=c+4|0,h=h+4|0;while((c|0)<(d|0));c=r+88|0,d=c+40|0;do e[c>>2]=0,c=c+4|0;while((c|0)<(d|0));e[r>>2]=35660,e[r+128>>2]=e[t+136>>2],e[r+132>>2]=e[t+140>>2],e[r+136>>2]=e[t+144>>2],e[r+140>>2]=e[t+148>>2],e[r+144>>2]=e[t+152>>2],e[r+148>>2]=e[t+156>>2],e[r+152>>2]=e[t+160>>2],c=r+156|0,e[c>>2]=0,e[c+4>>2]=0,e[c+8>>2]=0,e[c+12>>2]=0,e[r+172>>2]=e[l>>2],e[r+176>>2]=0,e[r+180>>2]=0,e[r+184>>2]=0,c=r+4568|0,l=r+188|0;do e[l>>2]=0,e[l+4>>2]=0,I[l+8>>1]=0,I[l+10>>1]=1,l=l+12|0;while((l|0)!=(c|0));h=t+4|0,e[c>>2]=0,e[c+4>>2]=0,I[c+8>>1]=0,S[c+10>>0]=0,d=r+4580|0,e[d>>2]=0,e[d+4>>2]=0,I[d+8>>1]=0,S[d+10>>0]=0,d=r+4592|0,e[d>>2]=0,e[d+4>>2]=0,e[d+8>>2]=0,e[d+12>>2]=0,e[d+16>>2]=0,e[d+20>>2]=0,e[d+24>>2]=0,S[d+28>>0]=0,e[r+28>>2]|0||(e[r+20>>2]=1),l=e[h>>2]|0,e[h>>2]=r,l&&(Mt[e[(e[l>>2]|0)+4>>2]&255](l),r=e[h>>2]|0),Y0(r,C)}return C=t+100|0,e[C>>2]=32,e[t+96>>2]=0,r=e[o>>2]|0,r?(e[t+132>>2]=r,c=t+120|0,w=t+124|0,l=e[w>>2]|0,r=e[c>>2]|0,h=r,d=l-h|0,d>>>0>=4e3?d>>>0>4e3&&(D=r+4e3|0,(l|0)!=(D|0))&&(e[w>>2]=D,l=D):(vi(c,4e3-d|0),r=e[c>>2]|0,h=r,l=e[w>>2]|0),e[t+108>>2]=h,e[t+104>>2]=l-r,As(t),D=t+116|0,D=e[D>>2]|0,t=e[C>>2]|0,t=t+-32|0,t=(t|0)/8|0,t=D-t|0,b=k,t|0):(e[t+108>>2]=e[o+4>>2],e[t+104>>2]=e[w>>2],As(t),D=t+116|0,D=e[D>>2]|0,t=e[C>>2]|0,t=t+-32|0,t=(t|0)/8|0,t=D-t|0,b=k,t|0)}function N2(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0,G=0,$=0,P=0,O=0;if(G=b,b=b+352|0,$=G+328|0,P=G+192|0,o=G+343|0,l=G+342|0,c=G+341|0,h=G+340|0,R=G+176|0,w=G+168|0,C=G+160|0,D=G+152|0,K=G,U=G+136|0,e[t+32>>2]|0&&(e[t+24>>2]|0)!=1){if(_=t+8|0,Q=t+36|0,d=e[Q>>2]|0,!d){if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[o>>0]|0,$e(44,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}if(t=e[t+16>>2]|0,(t|0)==8)switch(d|0){case 1:{if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[l>>0]|0,$e(45,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 2:{if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[c>>0]|0,$e(46,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 3:{if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[h>>0]|0,$e(47,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}default:{d=P+56|0,c=P+4|0,e[P>>2]=36160,e[d>>2]=36180,g=0,Ae(62,P+56|0,c|0),G=g,g=0,G&1&&(O=j()|0,tt(d),le(O|0)),e[P+128>>2]=0,e[P+132>>2]=-1,e[P>>2]=36200,e[P+56>>2]=36220,g=0,ue(180,c|0),G=g,g=0;do if(G&1)t=j()|0;else{if(e[c>>2]=36236,h=P+36|0,e[h>>2]=0,e[h+4>>2]=0,e[h+8>>2]=0,e[h+12>>2]=0,e[P+52>>2]=16,e[$>>2]=0,e[$+4>>2]=0,e[$+8>>2]=0,g=0,Ae(63,c|0,$|0),G=g,g=0,G&1){t=j()|0,de($),de(h),wt(c);break}de($),g=0,t=Ve(28,P|0,49007,21)|0,$=g,g=0;do if(!($&1)&&(g=0,k=be(36,t|0,e[Q>>2]|0)|0,$=g,g=0,!($&1))&&(g=0,Ve(28,k|0,50997,18)|0,$=g,g=0,!($&1))){if(l=Ct(16)|0,g=0,Ae(64,R|0,c|0),$=g,g=0,$&1)t=j()|0;else if(!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,H|0)|0,bt(8)),g=0,$e(36,l|0,9,35648,R|0),$=g,g=0,$&1?o=1:(g=0,xe(6,l|0,824,96),g=0,o=0),t=j()|0,de(R),!o)break;Tt(l|0)}else O=34;while(!1);(O|0)==34&&(t=j()|0),e[P>>2]=36200,e[d>>2]=36220,e[c>>2]=36236,de(h),wt(c),tt(d),O=t,le(O|0)}while(!1);O=t,tt(d),le(O|0)}}switch((t|0)<=8&&(t=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,H|0)|0,bt(8)),g=0,xe(7,t|0,8,35648),O=g,g=0,O&1||Qt(t|0,824,96),O=j()|0,Tt(t|0),le(O|0)),o=16-t|0,d|0){case 1:{if(t=Xe(60)|0,e[w>>2]=o,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],e[$>>2]=e[w>>2],e[$+4>>2]=e[w+4>>2],$e(41,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 2:{if(t=Xe(60)|0,e[C>>2]=o,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],e[$>>2]=e[C>>2],e[$+4>>2]=e[C+4>>2],$e(42,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 3:{if(t=Xe(60)|0,e[D>>2]=o,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],e[$>>2]=e[D>>2],e[$+4>>2]=e[D+4>>2],$e(43,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}default:{d=K+56|0,c=K+4|0,e[K>>2]=36160,e[d>>2]=36180,g=0,Ae(62,K+56|0,c|0),P=g,g=0,P&1&&(O=j()|0,tt(d),le(O|0)),e[K+128>>2]=0,e[K+132>>2]=-1,e[K>>2]=36200,e[K+56>>2]=36220,g=0,ue(180,c|0),P=g,g=0;do if(P&1)t=j()|0;else{if(e[c>>2]=36236,h=K+36|0,e[h>>2]=0,e[h+4>>2]=0,e[h+8>>2]=0,e[h+12>>2]=0,e[K+52>>2]=16,e[$>>2]=0,e[$+4>>2]=0,e[$+8>>2]=0,g=0,Ae(63,c|0,$|0),P=g,g=0,P&1){t=j()|0,de($),de(h),wt(c);break}de($),g=0,t=Ve(28,K|0,49007,21)|0,P=g,g=0;do if(!(P&1)&&(g=0,N=be(36,t|0,e[Q>>2]|0)|0,P=g,g=0,!(P&1))&&(g=0,Ve(28,N|0,50997,18)|0,P=g,g=0,!(P&1))){if(l=Ct(16)|0,g=0,Ae(64,U|0,c|0),P=g,g=0,P&1)t=j()|0;else if(!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,H|0)|0,bt(8)),g=0,$e(36,l|0,9,35648,U|0),P=g,g=0,P&1?o=1:(g=0,xe(6,l|0,824,96),g=0,o=0),t=j()|0,de(U),!o)break;Tt(l|0)}else O=64;while(!1);(O|0)==64&&(t=j()|0),e[K>>2]=36200,e[d>>2]=36220,e[c>>2]=36236,de(h),wt(c),tt(d),O=t,le(O|0)}while(!1);O=t,tt(d),le(O|0)}}}return o=e[r+4>>2]|0,l=Xe(16)|0,t=e[t+20>>2]|0,o?(e[l>>2]=36108,e[l+4>>2]=o,e[l+8>>2]=1,e[l+12>>2]=t,O=l,b=G,O|0):(O=e[r>>2]|0,e[l>>2]=36132,e[l+4>>2]=O,e[l+8>>2]=1,e[l+12>>2]=t,O=l,b=G,O|0)}function As(t){t=t|0;var r=0,o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0,G=0,$=0,P=0;K=b,b=b+32|0,$=K+12|0,Q=K,_=t+180|0,U=(e[_>>2]|0)+4|0,(e[t+32>>2]|0)==1?N=e[t+24>>2]|0:N=1,r=ee(N<<1,U)|0,e[$>>2]=0,P=$+4|0,e[P>>2]=0,e[$+8>>2]=0;e:do if(r){if((r|0)<0&&(g=0,ue(178,$|0),G=g,g=0,G&1)||(R=6),(R|0)==6&&(g=0,o=ge(67,r|0)|0,G=g,g=0,!(G&1))){for(e[P>>2]=o,e[$>>2]=o,e[$+8>>2]=o+r;;)if(S[o>>0]=0,o=(e[P>>2]|0)+1|0,e[P>>2]=o,r=r+-1|0,!r)break e}o=j()|0,r=e[$>>2]|0,r||le(o|0),(e[P>>2]|0)!=(r|0)&&(e[P>>2]=r),he(r),le(o|0)}while(!1);e[Q>>2]=0,G=Q+4|0,e[G>>2]=0,e[Q+8>>2]=0;do if(!N)R=19;else{if(N>>>0>1073741823&&(g=0,ue(178,Q|0),k=g,g=0,k&1)||(R=17),(R|0)==17&&(l=N<<2,g=0,c=ge(67,l|0)|0,k=g,g=0,!(k&1))){e[Q>>2]=c,R=c+(N<<2)|0,e[Q+8>>2]=R,Jt(c|0,0,l|0)|0,e[G>>2]=R,R=19;break}o=j()|0,r=e[Q>>2]|0,l=r,r&&(c=e[G>>2]|0,(c|0)!=(r|0)&&(e[G>>2]=c+(~((c+-4-l|0)>>>2)<<2)),he(r))}while(!1);if((R|0)==19){d=t+12|0;e:do if((e[d>>2]|0)>0){if(w=t+4604|0,C=(ee(N,U)|0)+1|0,D=t+4608|0,k=t+92|0,h=t+4600|0,(N|0)>0)c=0;else{for(l=0;o=e[$>>2]|0,r=o+1|0,e[w>>2]=r,o=o+C|0,e[D>>2]=o,l&1?(e[w>>2]=o,e[D>>2]=r):r=o,N=e[k>>2]|0,g=0,$e(e[(e[N>>2]|0)+12>>2]|0,N|0,r|0,e[_>>2]|0,U|0),N=g,g=0,!(N&1);)if(l=l+1|0,(l|0)>=(e[d>>2]|0)){R=45;break e}o=j()|0;break}t:for(;;){if(o=e[$>>2]|0,r=o+1|0,e[w>>2]=r,o=o+C|0,e[D>>2]=o,c&1?(e[w>>2]=o,e[D>>2]=r):r=o,R=e[k>>2]|0,g=0,$e(e[(e[R>>2]|0)+12>>2]|0,R|0,r|0,e[_>>2]|0,U|0),R=g,g=0,R&1){R=28;break}r=e[Q>>2]|0,o=e[w>>2]|0,l=0;do{if(e[h>>2]=e[r+(l<<2)>>2],R=e[_>>2]|0,S[o+R>>0]=S[o+(R+-1)>>0]|0,S[(e[D>>2]|0)+-1>>0]=S[e[w>>2]>>0]|0,g=0,Ae(75,t|0,0),R=g,g=0,R&1){R=36;break t}r=e[Q>>2]|0,e[r+(l<<2)>>2]=e[h>>2],o=(e[w>>2]|0)+U|0,e[w>>2]=o,e[D>>2]=(e[D>>2]|0)+U,l=l+1|0}while((l|0)<(N|0));if(c=c+1|0,(c|0)>=(e[d>>2]|0)){R=45;break e}}if((R|0)==28){o=j()|0;break}else if((R|0)==36){o=j()|0;break}}else R=45;while(!1);do if((R|0)==45){if(g=0,ue(182,t|0),t=g,g=0,t&1){o=j()|0;break}if(r=e[Q>>2]|0,o=r,r&&(l=e[G>>2]|0,(l|0)!=(r|0)&&(e[G>>2]=l+(~((l+-4-o|0)>>>2)<<2)),he(r)),r=e[$>>2]|0,!r){b=K;return}(e[P>>2]|0)!=(r|0)&&(e[P>>2]=r),he(r),b=K;return}while(!1);r=e[Q>>2]|0,l=r,r&&(c=e[G>>2]|0,(c|0)!=(r|0)&&(e[G>>2]=c+(~((c+-4-l|0)>>>2)<<2)),he(r))}r=e[$>>2]|0,r||le(o|0),(e[P>>2]|0)!=(r|0)&&(e[P>>2]=r),he(r),le(o|0)}function F2(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0;if(N=t+4604|0,r=e[N>>2]|0,U=t+180|0,!((e[U>>2]|0)<=0))for(R=t+4608|0,_=t+4612|0,c=r,h=F[r+-1>>0]|0,r=F[r>>0]|0,k=0;D=e[R>>2]|0,C=F[D+(k+-1)>>0]|0,l=k+1|0,o=F[c+l>>0]|0,w=e[_>>2]|0,d=r-h|0,c=h-C|0,w=((((S[w+(o-r)>>0]|0)*9|0)+(S[w+d>>0]|0)|0)*9|0)+(S[w+c>>0]|0)|0,w?(h=r-C>>31,(h^c|0)<0?c=r:c=C+((h^d|0)<0?0:d)|0,D=R2(t,w,F[D+k>>0]|0,c,0)|0,S[(e[R>>2]|0)+k>>0]=D):(l=(M2(t,k,0)|0)+k|0,o=e[N>>2]|0,r=F[o+(l+-1)>>0]|0,o=F[o+l>>0]|0),!((l|0)>=(e[U>>2]|0));)c=e[N>>2]|0,h=r,r=o,k=l}function R2(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0;if(Q=r>>31,h=(Q^r)-Q|0,_=t+196+(h*12|0)+10|0,d=I[_>>1]|0,R=t+196+(h*12|0)|0,c=e[R>>2]|0,(d|0)<(c|0))if((d<<1|0)<(c|0))if((d<<2|0)<(c|0))if((d<<3|0)<(c|0))if((d<<4|0)<(c|0))for(r=5;(d<>1]^Q)-Q+l|0,U=t+136|0,l=e[U>>2]|0,(c&l|0)==(c|0)?D=c:D=l&~(c>>31),c=(o-D^Q)-Q|0,C=t+144|0,l=e[C>>2]|0,(c|0)>0?c=(c+l|0)/(l<<1|1|0)|0:c=(c-l|0)/(l<<1|1|0)|0,N=t+140|0,w=e[N>>2]|0,o=((c|0)<0?w:0)+c|0,w=o-((o|0)<((w+1|0)/2|0|0)?0:w)|0,h=t+196+(h*12|0)+4|0,l|r?c=0:c=(e[h>>2]<<1)+-1+d>>31,l=c^w,xs(t,r,l>>30^l<<1,e[t+156>>2]|0),l=e[t+160>>2]|0,r=(e[R>>2]|0)+((w|0)>-1?w:0-w|0)|0,c=(e[h>>2]|0)+(ee(e[C>>2]<<1|1,w)|0)|0,o=I[_>>1]|0,(o|0)==(l|0)&&(r=r>>1,c=c>>1,o=l>>1),e[R>>2]=r,l=o+1|0,I[_>>1]=l,r=l+c|0,(r|0)>=1?(c|0)>0&&(c=c-l|0,_=I[k>>1]|0,I[k>>1]=(_<<16>>16<127&1)+(_&65535),c=(c|0)>0?0:c):(c=I[k>>1]|0,I[k>>1]=(c&65535)-(c<<16>>16>-128&1),c=(r|0)>(~o|0)?r:0-o|0),e[h>>2]=c,l=e[C>>2]|0,o=l<<1|1,r=(ee(o,(w^Q)-Q|0)|0)+D|0,(r|0)>=(0-l|0)?(c=e[U>>2]|0,(c+l|0)<(r|0)&&(r=r-(ee(e[N>>2]|0,o)|0)|0)):(r=(ee(e[N>>2]|0,o)|0)+r|0,c=e[U>>2]|0),(r&c|0)==(r|0)?(Q=r,Q=Q&255,Q|0):(Q=c&~(r>>31),Q=Q&255,Q|0)}function M2(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0;for(C=(e[t+180>>2]|0)-r|0,D=e[t+4608>>2]|0,k=e[t+4604>>2]|0,c=S[D+(r+-1)>>0]|0,w=c&255,o=t+144|0,h=0;l=D+(h+r)|0,d=(F[l>>0]|0)-w|0,!((((d|0)>-1?d:0-d|0)|0)>(e[o>>2]|0));)if(S[l>>0]=c,h=h+1|0,(h|0)==(C|0)){h=C;break}if(c=(h|0)==(C|0),d=t+4600|0,l=e[36476+(e[d>>2]<<2)>>2]|0,(1<(h|0))o=h;else{o=h;do _t(t,1,1),l=e[d>>2]|0,o=o-(1<>2])|0,l=(l|0)>30?31:l+1|0,e[d>>2]=l,l=e[36476+(l<<2)>>2]|0;while((o|0)>=(1<>0]|0,w,F[k+C>>0]|0)|0,S[r>>0]=t,t=e[d>>2]|0,e[d>>2]=(t|0)<1?0:t+-1|0,t=h+1|0,t|0)}function _2(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0;return w=o-l|0,C=t+136|0,d=t+144|0,c=e[d>>2]|0,(((w|0)>-1?w:0-w|0)|0)>(c|0)?(h=l-o>>31|1,r=ee(h,r-l|0)|0,(r|0)>0?r=(c+r|0)/(c<<1|1|0)|0:r=(r-c|0)/(c<<1|1|0)|0,w=t+140|0,c=e[w>>2]|0,o=((r|0)<0?c:0)+r|0,c=o-((o|0)<((c+1|0)/2|0|0)?0:c)|0,vs(t,t+4576|0,c),c=ee(c,h)|0,h=e[d>>2]|0,d=h<<1|1,c=(ee(c,d)|0)+l|0,(c|0)>=(0-h|0)?(r=e[C>>2]|0,(r+h|0)<(c|0)&&(c=c-(ee(e[w>>2]|0,d)|0)|0)):(c=(ee(e[w>>2]|0,d)|0)+c|0,r=e[C>>2]|0),(c&r|0)==(c|0)?(C=c,C=C&255,C|0):(C=r&~(c>>31),C=C&255,C|0)):(r=r-o|0,(r|0)>0?r=(c+r|0)/(c<<1|1|0)|0:r=(r-c|0)/(c<<1|1|0)|0,w=t+140|0,c=e[w>>2]|0,h=((r|0)<0?c:0)+r|0,c=h-((h|0)<((c+1|0)/2|0|0)?0:c)|0,vs(t,t+4588|0,c),h=e[d>>2]|0,d=h<<1|1,c=(ee(d,c)|0)+o|0,(c|0)>=(0-h|0)?(r=e[C>>2]|0,(r+h|0)<(c|0)&&(c=c-(ee(e[w>>2]|0,d)|0)|0)):(c=(ee(e[w>>2]|0,d)|0)+c|0,r=e[C>>2]|0),(c&r|0)==(c|0)?(C=c,C=C&255,C|0):(C=r&~(c>>31),C=C&255,C|0))}function vs(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0;if(k=r+9|0,d=F[k>>0]|0,D=r+4|0,C=e[D>>2]|0,c=(ee(d>>>1,C)|0)+(e[r>>2]|0)|0,(d|0)<(c|0)){h=d,l=0;do h=h<<1,l=l+1|0;while((h|0)<(c|0));c=l}else c=0;(o|0)>0&(c|0)==0&&F[r+10>>0]<<1>>>0>>0?l=1:w=5;do if((w|0)==5){if(l=(o|0)<0,l&&F[r+10>>0]<<1>>>0>=d>>>0){l=1;break}l=l&(c|0)!=0}while(!1);if(l=(((o|0)>-1?o:0-o|0)<<1)-C+(l<<31>>31)|0,xs(t,c,l,(e[t+156>>2]|0)+-1-(e[36476+(e[t+4600>>2]<<2)>>2]|0)|0),(o|0)<0&&(t=r+10|0,S[t>>0]=(F[t>>0]|0)+1),l=(l+1-(e[D>>2]|0)>>1)+(e[r>>2]|0)|0,e[r>>2]=l,c=S[k>>0]|0,c<<24>>24!=(S[r+8>>0]|0)){r=c,r=r&255,r=r+1|0,r=r&255,S[k>>0]=r;return}e[r>>2]=l>>1,t=(c&255)>>>1,S[k>>0]=t,r=r+10|0,S[r>>0]=(F[r>>0]|0)>>>1,r=t,r=r&255,r=r+1|0,r=r&255,S[k>>0]=r}function xs(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0;if(c=o>>r,h=t+148|0,d=l-(e[h>>2]|0)|0,(c|0)<(d+-1|0)){(c|0)>30&&(l=(c|0)/2|0,_t(t,0,l),c=c-l|0),_t(t,1,c+1|0),_t(t,(1<31?(_t(t,0,31),_t(t,1,l+-31-(e[h>>2]|0)|0)):_t(t,1,d),r=e[h>>2]|0,_t(t,(1<>2]|0)r=t+152|0;else if(o=e[t+136>>2]|0,r=t+152|0,(o|0)==((1<>2])+-1|0)&&(m0(l,o,0),(e[l+4>>2]|0)==(e[t+184>>2]|0))&&(e[l+8>>2]|0)==(e[t+188>>2]|0)&&(e[l+12>>2]|0)==(e[t+192>>2]|0))switch(e[r>>2]|0){case 8:{N=e[8900]|0,e[t+4612>>2]=N+(((e[8901]|0)-N|0)>>>1),b=R;return}case 10:{N=e[8903]|0,e[t+4612>>2]=N+(((e[8904]|0)-N|0)>>>1),b=R;return}case 12:{N=e[8906]|0,e[t+4612>>2]=N+(((e[8907]|0)-N|0)>>>1),b=R;return}case 16:{N=e[8909]|0,e[t+4612>>2]=N+(((e[8910]|0)-N|0)>>>1),b=R;return}default:break e}while(!1);if(k=1<>2],o=t+4616|0,l=k<<1,c=t+4620|0,h=e[c>>2]|0,r=e[o>>2]|0,d=h-r|0,l>>>0<=d>>>0?l>>>0>>0&&(w=r+l|0,(h|0)!=(w|0))&&(e[c>>2]=w):(j0(o,l-d|0),r=e[o>>2]|0),D=t+4612|0,e[D>>2]=r+k,r=0-k|0,(k|0)<=(r|0)){b=R;return}w=t+192|0,C=t+188|0,d=t+184|0,h=r;do r=e[w>>2]|0,(h|0)>(0-r|0)?(o=e[C>>2]|0,(h|0)>(0-o|0)?(l=e[d>>2]|0,(h|0)>(0-l|0)?(c=e[N>>2]|0,(h|0)>=(0-c|0)?(c|0)<(h|0)?(l|0)<=(h|0)?(o|0)>(h|0)?r=2:r=(r|0)>(h|0)?3:4:r=1:r=0:r=-1):r=-2):r=-3):r=-4,S[(e[D>>2]|0)+h>>0]=r,h=h+1|0;while((h|0)!=(k|0));b=R}function L2(t){t=t|0;var r=0,o=0;e[t>>2]=35856,r=e[t+4608>>2]|0,r&&(o=t+4612|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),e[t>>2]=36736,r=e[t+92>>2]|0,r&&(o=t+96|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),t=t+88|0,r=e[t>>2]|0,e[t>>2]=0,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r)}function O2(t){t=t|0;var r=0,o=0;if(e[t>>2]=35856,r=e[t+4608>>2]|0,r&&(o=t+4612|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),e[t>>2]=36736,r=e[t+92>>2]|0,r&&(o=t+96|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),o=t+88|0,r=e[o>>2]|0,e[o>>2]=0,!r){he(t);return}Mt[e[(e[r>>2]|0)+4>>2]&255](r),he(t)}function $2(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0,G=0,$=0,P=0,O=0;if(G=b,b=b+352|0,$=G+328|0,P=G+192|0,o=G+343|0,l=G+342|0,c=G+341|0,h=G+340|0,R=G+176|0,w=G+168|0,C=G+160|0,D=G+152|0,K=G,U=G+136|0,e[t+28>>2]|0&&(e[t+20>>2]|0)!=1){if(_=t+4|0,Q=t+32|0,d=e[Q>>2]|0,!d){if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[o>>0]|0,$e(37,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}if(t=e[t+12>>2]|0,(t|0)==16)switch(d|0){case 1:{if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[l>>0]|0,$e(38,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 2:{if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[c>>0]|0,$e(39,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 3:{if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[h>>0]|0,$e(40,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}default:{d=P+56|0,c=P+4|0,e[P>>2]=36160,e[d>>2]=36180,g=0,Ae(62,P+56|0,c|0),G=g,g=0,G&1&&(O=j()|0,tt(d),le(O|0)),e[P+128>>2]=0,e[P+132>>2]=-1,e[P>>2]=36200,e[P+56>>2]=36220,g=0,ue(180,c|0),G=g,g=0;do if(G&1)t=j()|0;else{if(e[c>>2]=36236,h=P+36|0,e[h>>2]=0,e[h+4>>2]=0,e[h+8>>2]=0,e[h+12>>2]=0,e[P+52>>2]=16,e[$>>2]=0,e[$+4>>2]=0,e[$+8>>2]=0,g=0,Ae(63,c|0,$|0),G=g,g=0,G&1){t=j()|0,de($),de(h),wt(c);break}de($),g=0,t=Ve(28,P|0,49007,21)|0,$=g,g=0;do if(!($&1)&&(g=0,k=be(36,t|0,e[Q>>2]|0)|0,$=g,g=0,!($&1))&&(g=0,Ve(28,k|0,50997,18)|0,$=g,g=0,!($&1))){if(l=Ct(16)|0,g=0,Ae(64,R|0,c|0),$=g,g=0,$&1)t=j()|0;else if(!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,H|0)|0,bt(8)),g=0,$e(36,l|0,9,35648,R|0),$=g,g=0,$&1?o=1:(g=0,xe(6,l|0,824,96),g=0,o=0),t=j()|0,de(R),!o)break;Tt(l|0)}else O=34;while(!1);(O|0)==34&&(t=j()|0),e[P>>2]=36200,e[d>>2]=36220,e[c>>2]=36236,de(h),wt(c),tt(d),O=t,le(O|0)}while(!1);O=t,tt(d),le(O|0)}}switch((t|0)<=8&&(t=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,H|0)|0,bt(8)),g=0,xe(7,t|0,8,35648),O=g,g=0,O&1||Qt(t|0,824,96),O=j()|0,Tt(t|0),le(O|0)),o=16-t|0,d|0){case 1:{if(t=Xe(60)|0,e[w>>2]=o,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],e[$>>2]=e[w>>2],e[$+4>>2]=e[w+4>>2],$e(41,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 2:{if(t=Xe(60)|0,e[C>>2]=o,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],e[$>>2]=e[C>>2],e[$+4>>2]=e[C+4>>2],$e(42,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 3:{if(t=Xe(60)|0,e[D>>2]=o,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],e[$>>2]=e[D>>2],e[$+4>>2]=e[D+4>>2],$e(43,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}default:{d=K+56|0,c=K+4|0,e[K>>2]=36160,e[d>>2]=36180,g=0,Ae(62,K+56|0,c|0),P=g,g=0,P&1&&(O=j()|0,tt(d),le(O|0)),e[K+128>>2]=0,e[K+132>>2]=-1,e[K>>2]=36200,e[K+56>>2]=36220,g=0,ue(180,c|0),P=g,g=0;do if(P&1)t=j()|0;else{if(e[c>>2]=36236,h=K+36|0,e[h>>2]=0,e[h+4>>2]=0,e[h+8>>2]=0,e[h+12>>2]=0,e[K+52>>2]=16,e[$>>2]=0,e[$+4>>2]=0,e[$+8>>2]=0,g=0,Ae(63,c|0,$|0),P=g,g=0,P&1){t=j()|0,de($),de(h),wt(c);break}de($),g=0,t=Ve(28,K|0,49007,21)|0,P=g,g=0;do if(!(P&1)&&(g=0,N=be(36,t|0,e[Q>>2]|0)|0,P=g,g=0,!(P&1))&&(g=0,Ve(28,N|0,50997,18)|0,P=g,g=0,!(P&1))){if(l=Ct(16)|0,g=0,Ae(64,U|0,c|0),P=g,g=0,P&1)t=j()|0;else if(!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,H|0)|0,bt(8)),g=0,$e(36,l|0,9,35648,U|0),P=g,g=0,P&1?o=1:(g=0,xe(6,l|0,824,96),g=0,o=0),t=j()|0,de(U),!o)break;Tt(l|0)}else O=64;while(!1);(O|0)==64&&(t=j()|0),e[K>>2]=36200,e[d>>2]=36220,e[c>>2]=36236,de(h),wt(c),tt(d),O=t,le(O|0)}while(!1);O=t,tt(d),le(O|0)}}}return o=e[r+4>>2]|0,l=Xe(16)|0,t=e[t+16>>2]|0,o?(e[l>>2]=36108,e[l+4>>2]=o,e[l+8>>2]=2,e[l+12>>2]=t,O=l,b=G,O|0):(O=e[r>>2]|0,e[l>>2]=36132,e[l+4>>2]=O,e[l+8>>2]=2,e[l+12>>2]=t,O=l,b=G,O|0)}function B2(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0;d=b,b=b+32|0,C=d,m0(C,e[t+128>>2]|0,e[t+136>>2]|0),w=e[r+4>>2]|0,h=e[r+8>>2]|0,h=h|0?h:e[C+8>>2]|0,c=e[r+12>>2]|0,c=c|0?c:e[C+12>>2]|0,o=e[r+16>>2]|0,l=e[C+16>>2]|0,e[t+176>>2]=w|0?w:e[C+4>>2]|0,e[t+180>>2]=h,e[t+184>>2]=c,Q2(t),c=t+132|0,r=(e[c>>2]|0)+32|0,r=(r|0)<128?2:(r|0)/64|0,h=0;do e[t+188+(h*12|0)>>2]=r,e[t+188+(h*12|0)+4>>2]=0,I[t+188+(h*12|0)+8>>1]=0,I[t+188+(h*12|0)+10>>1]=1,h=h+1|0;while((h|0)!=365);w=(e[c>>2]|0)+32|0,w=(w|0)<128?2:(w|0)/64|0,C=(o|0?o:l)&255,e[t+4568>>2]=w,e[t+4572>>2]=0,S[t+4576>>0]=C,S[t+4577>>0]=1,S[t+4578>>0]=0,e[t+4580>>2]=w,e[t+4584>>2]=1,S[t+4588>>0]=C,S[t+4589>>0]=1,S[t+4590>>0]=0,e[t+4592>>2]=0,b=d}function V2(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0;for(d=t+88|0,h=e[r>>2]|0,e[r>>2]=0,r=e[d>>2]|0,e[d>>2]=h,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r),d=l+4|0,h=e[d>>2]|0,S[t+4620>>0]=c&1,r=t+156|0,e[r>>2]=e[o>>2],e[r+4>>2]=e[o+4>>2],e[r+8>>2]=e[o+8>>2],e[r+12>>2]=e[o+12>>2],Y0(t,l),U2(t),r=e[t+116>>2]|0,t=e[t+112>>2]|0;c=r+-1|0,o=(S[c>>0]|0)==-1?7:8,!((t|0)<(o|0));)r=c,t=t-o|0;r=r-h|0,c=e[d>>2]|0,c&&(e[d>>2]=c+r,l=l+8|0,e[l>>2]=(e[l>>2]|0)-r)}function U2(t){t=t|0;var r=0,o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0,ce=0;ie=b,b=b+32|0,ne=ie+12|0,Z=ie,$=t+172|0,P=(e[$>>2]|0)+4|0,(e[t+28>>2]|0)==1?O=e[t+20>>2]|0:O=1,r=ee(O<<1,P)|0,e[ne>>2]=0,ce=ne+4|0,e[ce>>2]=0,e[ne+8>>2]=0;do if(r){if((r|0)<0&&(g=0,ue(178,ne|0),oe=g,g=0,oe&1)||(d=6),(d|0)==6&&(o=r<<1,g=0,l=ge(67,o|0)|0,oe=g,g=0,!(oe&1))){e[ne>>2]=l,oe=l+(r<<1)|0,e[ne+8>>2]=oe,Jt(l|0,0,o|0)|0,e[ce>>2]=oe;break}l=j()|0,r=e[ne>>2]|0,r||le(l|0),o=e[ce>>2]|0,(o|0)!=(r|0)&&(e[ce>>2]=o+(~((o+-2-r|0)>>>1)<<1)),he(r),le(l|0)}while(!1);e[Z>>2]=0,oe=Z+4|0,e[oe>>2]=0,e[Z+8>>2]=0;do if(!O)d=18;else{if(O>>>0>1073741823&&(g=0,ue(178,Z|0),G=g,g=0,G&1)||(d=16),(d|0)==16&&(c=O<<2,g=0,h=ge(67,c|0)|0,G=g,g=0,!(G&1))){e[Z>>2]=h,d=h+(O<<2)|0,e[Z+8>>2]=d,Jt(h|0,0,c|0)|0,e[oe>>2]=d,d=18;break}l=j()|0,r=e[Z>>2]|0,o=r,r&&(c=e[oe>>2]|0,(c|0)!=(r|0)&&(e[oe>>2]=c+(~((c+-4-o|0)>>>2)<<2)),he(r))}while(!1);if((d|0)==18){h=t+8|0;e:do if((e[h>>2]|0)>0){d=t+4596|0,w=ee(O,P)|0,C=w+1|0,D=t+4600|0,k=(O|0)>0,N=t+160|0,R=t+168|0,_=t+164|0,U=t+156|0,Q=t+88|0,K=t+4592|0,G=0;t:for(;;){if(l=e[ne>>2]|0,o=l+2|0,e[d>>2]=o,l=l+(C<<1)|0,e[D>>2]=l,G&1?(e[d>>2]=l,e[D>>2]=o,r=o,o=l):r=l,k){c=e[Z>>2]|0,l=0;do{if(e[K>>2]=e[c+(l<<2)>>2],c=e[$>>2]|0,I[o+(c<<1)>>1]=I[o+(c+-1<<1)>>1]|0,I[r+-2>>1]=I[o>>1]|0,g=0,Ae(76,t|0,0),c=g,g=0,c&1){d=29;break t}c=e[Z>>2]|0,e[c+(l<<2)>>2]=e[K>>2],o=(e[d>>2]|0)+(P<<1)|0,e[d>>2]=o,r=(e[D>>2]|0)+(P<<1)|0,e[D>>2]=r,l=l+1|0}while((l|0)<(O|0))}if(c=e[N>>2]|0,(c|0)<=(G|0)&&(G|0)<((e[R>>2]|0)+c|0)&&(c=e[Q>>2]|0,g=0,$e(e[(e[c>>2]|0)+8>>2]|0,c|0,r+((e[U>>2]|0)-w<<1)|0,e[_>>2]|0,P|0),c=g,g=0,c&1)){d=30;break}if(G=G+1|0,(G|0)>=(e[h>>2]|0)){d=42;break e}}if((d|0)==29){l=j()|0;break}else if((d|0)==30){l=j()|0;break}}else d=42;while(!1);do if((d|0)==42){if(g=0,ue(183,t|0),t=g,g=0,t&1){l=j()|0;break}if(r=e[Z>>2]|0,o=r,r&&(l=e[oe>>2]|0,(l|0)!=(r|0)&&(e[oe>>2]=l+(~((l+-4-o|0)>>>2)<<2)),he(r)),r=e[ne>>2]|0,!r){b=ie;return}o=e[ce>>2]|0,(o|0)!=(r|0)&&(e[ce>>2]=o+(~((o+-2-r|0)>>>1)<<1)),he(r),b=ie;return}while(!1);r=e[Z>>2]|0,o=r,r&&(c=e[oe>>2]|0,(c|0)!=(r|0)&&(e[oe>>2]=c+(~((c+-4-o|0)>>>2)<<2)),he(r))}r=e[ne>>2]|0,r||le(l|0),o=e[ce>>2]|0,(o|0)!=(r|0)&&(e[ce>>2]=o+(~((o+-2-r|0)>>>1)<<1)),he(r),le(l|0)}function z2(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0;if(R=t+4596|0,o=e[R>>2]|0,K=t+172|0,r=e[K>>2]|0,!((r|0)<=0))for(_=t+4600|0,U=t+4604|0,Q=t+4592|0,w=o,h=M[o+-2>>1]|0,o=M[o>>1]|0,N=0;D=e[_>>2]|0,d=I[D+(N+-1<<1)>>1]|0,k=d&65535,c=N+1|0,l=M[w+(c<<1)>>1]|0,C=e[U>>2]|0,w=o-h|0,h=h-k|0,C=((((S[C+(l-o)>>0]|0)*9|0)+(S[C+w>>0]|0)|0)*9|0)+(S[C+h>>0]|0)|0,D=D+(N<<1)|0,C?(r=o-k>>31,(r^h|0)<0?r=o:r=k+((r^w|0)<0?0:w)|0,k=q2(t,C,M[D>>1]|0,r,0)|0,I[(e[_>>2]|0)+(N<<1)>>1]=k):(r=W2(t,d,D,r-N|0)|0,o=r+N|0,(o|0)!=(e[K>>2]|0)&&(k=H2(t,k,M[(e[R>>2]|0)+(o<<1)>>1]|0)|0,I[(e[_>>2]|0)+(o<<1)>>1]=k,k=e[Q>>2]|0,e[Q>>2]=(k|0)<1?0:k+-1|0,r=r+1|0),c=r+N|0,l=e[R>>2]|0,o=M[l+(c+-1<<1)>>1]|0,l=M[l+(c<<1)>>1]|0),r=e[K>>2]|0,!((r|0)<=(c|0));)w=e[R>>2]|0,h=o,o=l,N=c}function G2(t){t=t|0;var r=0,o=0,l=0,c=0;l=t+116|0,o=e[l>>2]|0,(S[o>>0]|0)!=-1?(c=t+112|0,r=e[c>>2]|0,(r|0)<1&&(P0(t),r=e[c>>2]|0,o=e[l>>2]|0),t=t+108|0,l=e[t>>2]|0,e[c>>2]=r+-1,r=l<<1,e[t>>2]=r,(S[o>>0]|0)!=-1&&(r=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,H|0)|0,bt(8)),g=0,xe(7,r|0,6,35648),t=g,g=0,t&1||Qt(r|0,824,96),t=j()|0,Tt(r|0),le(t|0))):r=e[t+108>>2]|0,r&&(r=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,H|0)|0,bt(8)),g=0,xe(7,r|0,6,35648),t=g,g=0,t&1||Qt(r|0,824,96),t=j()|0,Tt(r|0),le(t|0))}function q2(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0;if(U=r>>31,C=(U^r)-U|0,R=t+188+(C*12|0)+10|0,o=I[R>>1]|0,N=t+188+(C*12|0)|0,c=e[N>>2]|0,(o|0)<(c|0))if((o<<1|0)<(c|0))if((o<<2|0)<(c|0))if((o<<3|0)<(c|0))if((o<<4|0)<(c|0))for(r=5;(o<>1]^U)-U+l|0,_=t+128|0,c=e[_>>2]|0,(o&c|0)==(o|0)?D=o:D=c&~(o>>31),o=t+112|0,(e[o>>2]|0)<8&&P0(t),c=t+108|0,l=e[c>>2]|0,h=l>>>24,d=e[2832+(r<<11)+(h<<3)+4>>2]|0,d?(e[o>>2]=(e[o>>2]|0)-d,e[c>>2]=l<>2]|0):(w=e[t+148>>2]|0,c=e[t+140>>2]|0,o=X0(t)|0,(o|0)<(w+-1-c|0)?r&&(o=(l0(t,r)|0)+(o<>31^o>>1,(((o|0)>-1?o:0-o|0)|0)>65535&&(o=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,H|0)|0,bt(8)),g=0,xe(7,o|0,5,35648),t=g,g=0,t&1?(t=j()|0,Tt(o|0),le(t|0)):Qt(o|0,824,96))),w=t+136|0,l=e[w>>2]|0,r?d=o:(l?c=0:c=(e[t+188+(C*12|0)+4>>2]<<1)+-1+(I[R>>1]|0)>>31,d=c^o),r=e[t+152>>2]|0,c=(e[N>>2]|0)+((d|0)>-1?d:0-d|0)|0,h=t+188+(C*12|0)+4|0,o=(e[h>>2]|0)+(ee(l<<1|1,d)|0)|0,l=I[R>>1]|0,(l|0)==(r|0)&&(c=c>>1,o=o>>1,l=r>>1),e[N>>2]=c,r=l+1|0,I[R>>1]=r,c=r+o|0,(c|0)>=1?(o|0)>0&&(o=o-r|0,R=I[k>>1]|0,I[k>>1]=(R<<16>>16<127&1)+(R&65535),o=(o|0)>0?0:o):(o=I[k>>1]|0,I[k>>1]=(o&65535)-(o<<16>>16>-128&1),o=(c|0)>(~l|0)?c:0-l|0),e[h>>2]=o,r=e[w>>2]|0,l=r<<1|1,c=(ee(l,(d^U)-U|0)|0)+D|0,(c|0)>=(0-r|0)?(o=e[_>>2]|0,(o+r|0)<(c|0)&&(c=c-(ee(e[t+132>>2]|0,l)|0)|0)):(c=(ee(e[t+132>>2]|0,l)|0)+c|0,o=e[_>>2]|0),(c&o|0)==(c|0)?(t=c,t=t&65535,t|0):(t=o&~(c>>31),t=t&65535,t|0)}function W2(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0;for(w=t+112|0,C=t+108|0,D=t+4592|0,c=e[w>>2]|0,h=0;;){if((c|0)<1&&(P0(t),c=e[w>>2]|0),d=e[C>>2]|0,c=c+-1|0,e[w>>2]=c,e[C>>2]=d<<1,(d|0)>=0){k=8;break}if(d=e[D>>2]|0,N=1<>2],R=l-h|0,R=(N|0)<(R|0)?N:R,h=R+h|0,(R|0)==(N|0)&&(e[D>>2]=(d|0)>30?31:d+1|0),(h|0)==(l|0)){c=l;break}}if((k|0)==8&&((h|0)!=(l|0)?(c=e[D>>2]|0,(c+-4|0)>>>0<28?c=l0(t,e[36476+(c<<2)>>2]|0)|0:c=0,c=c+h|0,(c|0)>(l|0)&&(c=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,H|0)|0,bt(8)),g=0,xe(7,c|0,5,35648),R=g,g=0,R&1?(R=j()|0,Tt(c|0),le(R|0)):Qt(c|0,824,96))):c=l),(c|0)>0)h=0;else return c|0;do I[o+(h<<1)>>1]=r,h=h+1|0;while((h|0)!=(c|0));return c|0}function H2(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0;return h=r-o|0,d=t+128|0,l=t+136|0,(((h|0)>-1?h:0-h|0)|0)>(e[l>>2]|0)?(r=ee(ws(t,t+4568|0)|0,o-r>>31|1)|0,c=e[l>>2]|0,h=c<<1|1,r=(ee(r,h)|0)+o|0,(r|0)>=(0-c|0)?(l=e[d>>2]|0,(l+c|0)<(r|0)&&(r=r-(ee(e[t+132>>2]|0,h)|0)|0)):(r=(ee(e[t+132>>2]|0,h)|0)+r|0,l=e[d>>2]|0),(r&l|0)==(r|0)?(t=r,t=t&65535,t|0):(t=l&~(r>>31),t=t&65535,t|0)):(o=ws(t,t+4580|0)|0,h=e[l>>2]|0,c=h<<1|1,r=(ee(c,o)|0)+r|0,(r|0)>=(0-h|0)?(l=e[d>>2]|0,(l+h|0)<(r|0)&&(r=r-(ee(e[t+132>>2]|0,c)|0)|0)):(r=(ee(e[t+132>>2]|0,c)|0)+r|0,l=e[d>>2]|0),(r&l|0)==(r|0)?(t=r,t=t&65535,t|0):(t=l&~(r>>31),t=t&65535,t|0))}function ws(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0;if(D=r+9|0,o=F[D>>0]|0,h=r+4|0,c=(ee(o>>>1,e[h>>2]|0)|0)+(e[r>>2]|0)|0,(o|0)<(c|0)){l=0;do o=o<<1,l=l+1|0;while((o|0)<(c|0))}else l=0;d=e[t+148>>2]|0,w=e[36476+(e[t+4592>>2]<<2)>>2]|0,o=e[t+140>>2]|0,c=X0(t)|0;do if((c|0)<(d+-2-w-o|0))if(l){w=(l0(t,l)|0)+(c<>2]|0,c=w+l|0,d=c&1,o=d,h=1,c=(d+c|0)/2|0;break}else{l=e[h>>2]|0,t=l+c|0,o=t&1,t=(o+t|0)/2|0,C=8;break}else c=(l0(t,o)|0)+1|0,d=e[h>>2]|0,t=c+d|0,o=t&1,t=(o+t|0)/2|0,l?(w=c,h=1,c=t,l=d):(l=d,C=8);while(!1);return(C|0)==8&&(w=c,h=F[r+10>>0]<<1>>>0>=(F[D>>0]|0)>>>0,c=t),c=(o|0)!=0^h?c:0-c|0,(c|0)<0&&(C=r+10|0,S[C>>0]=(F[C>>0]|0)+1),o=(w+1-l>>1)+(e[r>>2]|0)|0,e[r>>2]=o,l=S[D>>0]|0,l<<24>>24!=(S[r+8>>0]|0)?(r=l,r=r&255,r=r+1|0,r=r&255,S[D>>0]=r,c|0):(e[r>>2]=o>>1,C=(l&255)>>>1,S[D>>0]=C,r=r+10|0,S[r>>0]=(F[r>>0]|0)>>>1,r=C,r=r&255,r=r+1|0,r=r&255,S[D>>0]=r,c|0)}function X0(t){t=t|0;var r=0,o=0,l=0,c=0,h=0,d=0;if(h=t+112|0,(e[h>>2]|0)<16&&P0(t),d=t+108|0,o=e[d>>2]|0,(o|0)>=0){if(o&1073741824)r=1;else if(o&536870912)r=2;else if(o&268435456)r=3;else if(o&134217728)r=4;else if(o&67108864)r=5;else if(o&33554432)r=6;else if(o&16777216)r=7;else if(o&8388608)r=8;else if(o&4194304)r=9;else if(o&2097152)r=10;else if(o&1048576)r=11;else if(o&524288)r=12;else if(o&262144)r=13;else if(o&131072)r=14;else if(c=o>>>12&16,r=c+-1|0,!c){for(r=(e[h>>2]|0)+-15|0,e[h>>2]=r,l=o<<15,e[d>>2]=l,o=r,r=15;(o|0)<1?(P0(t),c=e[d>>2]|0,o=e[h>>2]|0):c=l,o=o+-1|0,e[h>>2]=o,l=c<<1,e[d>>2]=l,!((c|0)<0);)r=r+1|0;return r|0}}else r=0;return t=r+1|0,e[h>>2]=(e[h>>2]|0)-t,e[d>>2]=o<>2]|0,(o|0)<(r|0)&&(P0(t),o=e[l>>2]|0,(o|0)<(r|0)&&(o=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,H|0)|0,bt(8)),g=0,xe(7,o|0,5,35648),t=g,g=0,t&1?(t=j()|0,Tt(o|0),le(t|0)):Qt(o|0,824,96))),c=t+108|0,t=e[c>>2]|0,e[l>>2]=o-r,e[c>>2]=t<>>(32-r|0)|0}function Q2(t){t=t|0;var r=0,o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0;R=b,b=b+32|0,l=R,N=t+136|0;e:do if(e[N>>2]|0)r=t+144|0;else if(o=e[t+128>>2]|0,r=t+144|0,(o|0)==((1<>2])+-1|0)&&(m0(l,o,0),(e[l+4>>2]|0)==(e[t+176>>2]|0))&&(e[l+8>>2]|0)==(e[t+180>>2]|0)&&(e[l+12>>2]|0)==(e[t+184>>2]|0))switch(e[r>>2]|0){case 8:{N=e[8900]|0,e[t+4604>>2]=N+(((e[8901]|0)-N|0)>>>1),b=R;return}case 10:{N=e[8903]|0,e[t+4604>>2]=N+(((e[8904]|0)-N|0)>>>1),b=R;return}case 12:{N=e[8906]|0,e[t+4604>>2]=N+(((e[8907]|0)-N|0)>>>1),b=R;return}case 16:{N=e[8909]|0,e[t+4604>>2]=N+(((e[8910]|0)-N|0)>>>1),b=R;return}default:break e}while(!1);if(k=1<>2],o=t+4608|0,l=k<<1,c=t+4612|0,h=e[c>>2]|0,r=e[o>>2]|0,d=h-r|0,l>>>0<=d>>>0?l>>>0>>0&&(w=r+l|0,(h|0)!=(w|0))&&(e[c>>2]=w):(j0(o,l-d|0),r=e[o>>2]|0),D=t+4604|0,e[D>>2]=r+k,r=0-k|0,(k|0)<=(r|0)){b=R;return}w=t+184|0,C=t+180|0,d=t+176|0,h=r;do r=e[w>>2]|0,(h|0)>(0-r|0)?(o=e[C>>2]|0,(h|0)>(0-o|0)?(l=e[d>>2]|0,(h|0)>(0-l|0)?(c=e[N>>2]|0,(h|0)>=(0-c|0)?(c|0)<(h|0)?(l|0)<=(h|0)?(o|0)>(h|0)?r=2:r=(r|0)>(h|0)?3:4:r=1:r=0:r=-1):r=-2):r=-3):r=-4,S[(e[D>>2]|0)+h>>0]=r,h=h+1|0;while((h|0)!=(k|0));b=R}function K2(t){t=t|0;var r=0,o=0;e[t>>2]=36736,r=e[t+92>>2]|0,r&&(o=t+96|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),t=t+88|0,r=e[t>>2]|0,e[t>>2]=0,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r)}function Y2(t){t=t|0;var r=0,o=0;if(e[t>>2]=36736,r=e[t+92>>2]|0,r&&(o=t+96|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),o=t+88|0,r=e[o>>2]|0,e[o>>2]=0,!r){he(t);return}Mt[e[(e[r>>2]|0)+4>>2]&255](r),he(t)}function j2(t){t=t|0;var r=0,o=0;e[t>>2]=35828,r=e[t+4608>>2]|0,r&&(o=t+4612|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),e[t>>2]=36736,r=e[t+92>>2]|0,r&&(o=t+96|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),t=t+88|0,r=e[t>>2]|0,e[t>>2]=0,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r)}function X2(t){t=t|0;var r=0,o=0;if(e[t>>2]=35828,r=e[t+4608>>2]|0,r&&(o=t+4612|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),e[t>>2]=36736,r=e[t+92>>2]|0,r&&(o=t+96|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),o=t+88|0,r=e[o>>2]|0,e[o>>2]=0,!r){he(t);return}Mt[e[(e[r>>2]|0)+4>>2]&255](r),he(t)}function Z2(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0,G=0,$=0,P=0,O=0;if(G=b,b=b+352|0,$=G+328|0,P=G+192|0,o=G+343|0,l=G+342|0,c=G+341|0,h=G+340|0,R=G+176|0,w=G+168|0,C=G+160|0,D=G+152|0,K=G,U=G+136|0,e[t+28>>2]|0&&(e[t+20>>2]|0)!=1){if(_=t+4|0,Q=t+32|0,d=e[Q>>2]|0,!d){if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[o>>0]|0,$e(37,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}if(t=e[t+12>>2]|0,(t|0)==16)switch(d|0){case 1:{if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[l>>0]|0,$e(38,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 2:{if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[c>>0]|0,$e(39,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 3:{if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[h>>0]|0,$e(40,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}default:{d=P+56|0,c=P+4|0,e[P>>2]=36160,e[d>>2]=36180,g=0,Ae(62,P+56|0,c|0),G=g,g=0,G&1&&(O=j()|0,tt(d),le(O|0)),e[P+128>>2]=0,e[P+132>>2]=-1,e[P>>2]=36200,e[P+56>>2]=36220,g=0,ue(180,c|0),G=g,g=0;do if(G&1)t=j()|0;else{if(e[c>>2]=36236,h=P+36|0,e[h>>2]=0,e[h+4>>2]=0,e[h+8>>2]=0,e[h+12>>2]=0,e[P+52>>2]=16,e[$>>2]=0,e[$+4>>2]=0,e[$+8>>2]=0,g=0,Ae(63,c|0,$|0),G=g,g=0,G&1){t=j()|0,de($),de(h),wt(c);break}de($),g=0,t=Ve(28,P|0,49007,21)|0,$=g,g=0;do if(!($&1)&&(g=0,k=be(36,t|0,e[Q>>2]|0)|0,$=g,g=0,!($&1))&&(g=0,Ve(28,k|0,50997,18)|0,$=g,g=0,!($&1))){if(l=Ct(16)|0,g=0,Ae(64,R|0,c|0),$=g,g=0,$&1)t=j()|0;else if(!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,H|0)|0,bt(8)),g=0,$e(36,l|0,9,35648,R|0),$=g,g=0,$&1?o=1:(g=0,xe(6,l|0,824,96),g=0,o=0),t=j()|0,de(R),!o)break;Tt(l|0)}else O=34;while(!1);(O|0)==34&&(t=j()|0),e[P>>2]=36200,e[d>>2]=36220,e[c>>2]=36236,de(h),wt(c),tt(d),O=t,le(O|0)}while(!1);O=t,tt(d),le(O|0)}}switch((t|0)<=8&&(t=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,H|0)|0,bt(8)),g=0,xe(7,t|0,8,35648),O=g,g=0,O&1||Qt(t|0,824,96),O=j()|0,Tt(t|0),le(O|0)),o=16-t|0,d|0){case 1:{if(t=Xe(60)|0,e[w>>2]=o,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],e[$>>2]=e[w>>2],e[$+4>>2]=e[w+4>>2],$e(41,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 2:{if(t=Xe(60)|0,e[C>>2]=o,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],e[$>>2]=e[C>>2],e[$+4>>2]=e[C+4>>2],$e(42,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 3:{if(t=Xe(60)|0,e[D>>2]=o,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],e[$>>2]=e[D>>2],e[$+4>>2]=e[D+4>>2],$e(43,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}default:{d=K+56|0,c=K+4|0,e[K>>2]=36160,e[d>>2]=36180,g=0,Ae(62,K+56|0,c|0),P=g,g=0,P&1&&(O=j()|0,tt(d),le(O|0)),e[K+128>>2]=0,e[K+132>>2]=-1,e[K>>2]=36200,e[K+56>>2]=36220,g=0,ue(180,c|0),P=g,g=0;do if(P&1)t=j()|0;else{if(e[c>>2]=36236,h=K+36|0,e[h>>2]=0,e[h+4>>2]=0,e[h+8>>2]=0,e[h+12>>2]=0,e[K+52>>2]=16,e[$>>2]=0,e[$+4>>2]=0,e[$+8>>2]=0,g=0,Ae(63,c|0,$|0),P=g,g=0,P&1){t=j()|0,de($),de(h),wt(c);break}de($),g=0,t=Ve(28,K|0,49007,21)|0,P=g,g=0;do if(!(P&1)&&(g=0,N=be(36,t|0,e[Q>>2]|0)|0,P=g,g=0,!(P&1))&&(g=0,Ve(28,N|0,50997,18)|0,P=g,g=0,!(P&1))){if(l=Ct(16)|0,g=0,Ae(64,U|0,c|0),P=g,g=0,P&1)t=j()|0;else if(!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,H|0)|0,bt(8)),g=0,$e(36,l|0,9,35648,U|0),P=g,g=0,P&1?o=1:(g=0,xe(6,l|0,824,96),g=0,o=0),t=j()|0,de(U),!o)break;Tt(l|0)}else O=64;while(!1);(O|0)==64&&(t=j()|0),e[K>>2]=36200,e[d>>2]=36220,e[c>>2]=36236,de(h),wt(c),tt(d),O=t,le(O|0)}while(!1);O=t,tt(d),le(O|0)}}}return o=e[r+4>>2]|0,l=Xe(16)|0,t=e[t+16>>2]|0,o?(e[l>>2]=36108,e[l+4>>2]=o,e[l+8>>2]=6,e[l+12>>2]=t,O=l,b=G,O|0):(O=e[r>>2]|0,e[l>>2]=36132,e[l+4>>2]=O,e[l+8>>2]=6,e[l+12>>2]=t,O=l,b=G,O|0)}function J2(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0;d=b,b=b+32|0,C=d,m0(C,e[t+128>>2]|0,e[t+136>>2]|0),w=e[r+4>>2]|0,h=e[r+8>>2]|0,h=h|0?h:e[C+8>>2]|0,c=e[r+12>>2]|0,c=c|0?c:e[C+12>>2]|0,o=e[r+16>>2]|0,l=e[C+16>>2]|0,e[t+176>>2]=w|0?w:e[C+4>>2]|0,e[t+180>>2]=h,e[t+184>>2]=c,su(t),c=t+132|0,r=(e[c>>2]|0)+32|0,r=(r|0)<128?2:(r|0)/64|0,h=0;do e[t+188+(h*12|0)>>2]=r,e[t+188+(h*12|0)+4>>2]=0,I[t+188+(h*12|0)+8>>1]=0,I[t+188+(h*12|0)+10>>1]=1,h=h+1|0;while((h|0)!=365);w=(e[c>>2]|0)+32|0,w=(w|0)<128?2:(w|0)/64|0,C=(o|0?o:l)&255,e[t+4568>>2]=w,e[t+4572>>2]=0,S[t+4576>>0]=C,S[t+4577>>0]=1,S[t+4578>>0]=0,e[t+4580>>2]=w,e[t+4584>>2]=1,S[t+4588>>0]=C,S[t+4589>>0]=1,S[t+4590>>0]=0,e[t+4592>>2]=0,b=d}function eu(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0;for(d=t+88|0,h=e[r>>2]|0,e[r>>2]=0,r=e[d>>2]|0,e[d>>2]=h,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r),d=l+4|0,h=e[d>>2]|0,S[t+4620>>0]=c&1,r=t+156|0,e[r>>2]=e[o>>2],e[r+4>>2]=e[o+4>>2],e[r+8>>2]=e[o+8>>2],e[r+12>>2]=e[o+12>>2],Y0(t,l),tu(t),r=e[t+116>>2]|0,t=e[t+112>>2]|0;c=r+-1|0,o=(S[c>>0]|0)==-1?7:8,!((t|0)<(o|0));)r=c,t=t-o|0;r=r-h|0,c=e[d>>2]|0,c&&(e[d>>2]=c+r,l=l+8|0,e[l>>2]=(e[l>>2]|0)-r)}function tu(t){t=t|0;var r=0,o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0,ce=0;ie=b,b=b+32|0,ne=ie+12|0,Z=ie,$=t+172|0,P=(e[$>>2]|0)+4|0,(e[t+28>>2]|0)==1?O=e[t+20>>2]|0:O=1,r=ee(O<<1,P)|0,e[ne>>2]=0,ce=ne+4|0,e[ce>>2]=0,e[ne+8>>2]=0;do if(r){if(r>>>0>715827882&&(g=0,ue(178,ne|0),oe=g,g=0,oe&1)||(d=6),(d|0)==6&&(g=0,o=ge(67,r*6|0)|0,oe=g,g=0,!(oe&1))){for(e[ce>>2]=o,e[ne>>2]=o,l=o+(r*6|0)|0,e[ne+8>>2]=l;I[o>>1]=0,I[o+2>>1]=0,I[o+4>>1]=0,r=r+-1|0,r;)o=o+6|0;e[ce>>2]=l;break}l=j()|0,r=e[ne>>2]|0,r||le(l|0),o=e[ce>>2]|0,(o|0)!=(r|0)&&(e[ce>>2]=o+(~(((o+-6-r|0)>>>0)/6|0)*6|0)),he(r),le(l|0)}while(!1);e[Z>>2]=0,oe=Z+4|0,e[oe>>2]=0,e[Z+8>>2]=0;do if(!O)d=20;else{if(O>>>0>1073741823&&(g=0,ue(178,Z|0),G=g,g=0,G&1)||(d=18),(d|0)==18&&(c=O<<2,g=0,h=ge(67,c|0)|0,G=g,g=0,!(G&1))){e[Z>>2]=h,d=h+(O<<2)|0,e[Z+8>>2]=d,Jt(h|0,0,c|0)|0,e[oe>>2]=d,d=20;break}l=j()|0,r=e[Z>>2]|0,o=r,r&&(c=e[oe>>2]|0,(c|0)!=(r|0)&&(e[oe>>2]=c+(~((c+-4-o|0)>>>2)<<2)),he(r))}while(!1);if((d|0)==20){h=t+8|0;e:do if((e[h>>2]|0)>0){d=t+4596|0,w=ee(O,P)|0,C=w+1|0,D=t+4600|0,k=(O|0)>0,N=t+160|0,R=t+168|0,_=t+164|0,U=t+156|0,Q=t+88|0,K=t+4592|0,G=0;t:for(;;){if(l=e[ne>>2]|0,o=l+6|0,e[d>>2]=o,l=l+(C*6|0)|0,e[D>>2]=l,G&1?(e[d>>2]=l,e[D>>2]=o,r=o,o=l):r=l,k){c=e[Z>>2]|0,l=0;do{if(e[K>>2]=e[c+(l<<2)>>2],r=e[$>>2]|0,c=o+(r*6|0)|0,o=o+((r+-1|0)*6|0)|0,I[c>>1]=I[o>>1]|0,I[c+2>>1]=I[o+2>>1]|0,I[c+4>>1]=I[o+4>>1]|0,c=(e[D>>2]|0)+-6|0,o=e[d>>2]|0,I[c>>1]=I[o>>1]|0,I[c+2>>1]=I[o+2>>1]|0,I[c+4>>1]=I[o+4>>1]|0,g=0,Ae(77,t|0,0),c=g,g=0,c&1){d=31;break t}c=e[Z>>2]|0,e[c+(l<<2)>>2]=e[K>>2],o=(e[d>>2]|0)+(P*6|0)|0,e[d>>2]=o,r=(e[D>>2]|0)+(P*6|0)|0,e[D>>2]=r,l=l+1|0}while((l|0)<(O|0))}if(c=e[N>>2]|0,(c|0)<=(G|0)&&(G|0)<((e[R>>2]|0)+c|0)&&(c=e[Q>>2]|0,g=0,$e(e[(e[c>>2]|0)+8>>2]|0,c|0,r+(((e[U>>2]|0)-w|0)*6|0)|0,e[_>>2]|0,P|0),c=g,g=0,c&1)){d=32;break}if(G=G+1|0,(G|0)>=(e[h>>2]|0)){d=44;break e}}if((d|0)==31){l=j()|0;break}else if((d|0)==32){l=j()|0;break}}else d=44;while(!1);do if((d|0)==44){if(g=0,ue(183,t|0),t=g,g=0,t&1){l=j()|0;break}if(r=e[Z>>2]|0,o=r,r&&(l=e[oe>>2]|0,(l|0)!=(r|0)&&(e[oe>>2]=l+(~((l+-4-o|0)>>>2)<<2)),he(r)),r=e[ne>>2]|0,!r){b=ie;return}o=e[ce>>2]|0,(o|0)!=(r|0)&&(e[ce>>2]=o+(~(((o+-6-r|0)>>>0)/6|0)*6|0)),he(r),b=ie;return}while(!1);r=e[Z>>2]|0,o=r,r&&(c=e[oe>>2]|0,(c|0)!=(r|0)&&(e[oe>>2]=c+(~((c+-4-o|0)>>>2)<<2)),he(r))}r=e[ne>>2]|0,r||le(l|0),o=e[ce>>2]|0,(o|0)!=(r|0)&&(e[ce>>2]=o+(~(((o+-6-r|0)>>>0)/6|0)*6|0)),he(r),le(l|0)}function iu(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0,ce=0,ke=0,Ee=0,Te=0,it=0,jt=0,Gt=0,s0=0,i0=0,zt=0,gt=0;if(zt=b,b=b+32|0,ne=zt+24|0,i0=zt+18|0,s0=zt+12|0,ce=zt+6|0,ke=zt,Ee=t+172|0,r=e[Ee>>2]|0,(r|0)<=0){b=zt;return}for(Te=t+4600|0,it=t+4596|0,jt=t+4604|0,Gt=t+4592|0,oe=0;l=oe+-1|0,c=e[Te>>2]|0,gt=e[it>>2]|0,o=oe+1|0,h=M[gt+(oe*6|0)>>1]|0,ie=e[jt>>2]|0,d=M[gt+(l*6|0)>>1]|0,w=h-d|0,C=M[c+(l*6|0)>>1]|0,D=d-C|0,k=((((S[ie+((M[gt+(o*6|0)>>1]|0)-h)>>0]|0)*9|0)+(S[ie+w>>0]|0)|0)*9|0)+(S[ie+D>>0]|0)|0,N=M[gt+(oe*6|0)+2>>1]|0,R=M[gt+(l*6|0)+2>>1]|0,_=N-R|0,U=M[c+(l*6|0)+2>>1]|0,Q=R-U|0,K=((((S[ie+((M[gt+(o*6|0)+2>>1]|0)-N)>>0]|0)*9|0)+(S[ie+_>>0]|0)|0)*9|0)+(S[ie+Q>>0]|0)|0,G=M[gt+(oe*6|0)+4>>1]|0,$=M[gt+(l*6|0)+4>>1]|0,P=G-$|0,O=M[c+(l*6|0)+4>>1]|0,Z=$-O|0,ie=((((S[ie+((M[gt+(o*6|0)+4>>1]|0)-G)>>0]|0)*9|0)+(S[ie+P>>0]|0)|0)*9|0)+(S[ie+Z>>0]|0)|0,K|k|ie?(l=M[c+(oe*6|0)>>1]|0,r=h-C>>31,(r^D|0)>=0?(r^w|0)<0?r=C:r=C-d+h|0:r=h,h=ir(t,k,l,r,0)|0,l=M[(e[Te>>2]|0)+(oe*6|0)+2>>1]|0,r=N-U>>31,(r^Q|0)>=0?(r^_|0)<0?r=U:r=U-R+N|0:r=N,l=ir(t,K,l,r,0)|0,c=M[(e[Te>>2]|0)+(oe*6|0)+4>>1]|0,r=G-O>>31,(r^Z|0)>=0?(r^P|0)<0?r=O:r=O-$+G|0:r=G,ie=ir(t,ie,c,r,0)|0,gt=e[Te>>2]|0,I[gt+(oe*6|0)>>1]=h,I[gt+(oe*6|0)+2>>1]=l,I[gt+(oe*6|0)+4>>1]=ie):(o=c+(l*6|0)|0,I[s0>>1]=I[o>>1]|0,I[s0+2>>1]=I[o+2>>1]|0,I[s0+4>>1]=I[o+4>>1]|0,I[ne>>1]=I[o>>1]|0,I[ne+2>>1]=I[o+2>>1]|0,I[ne+4>>1]=I[o+4>>1]|0,r=nu(t,ne,c+(oe*6|0)|0,r-oe|0)|0,o=r+oe|0,(o|0)!=(e[Ee>>2]|0)&&(gt=(e[it>>2]|0)+(o*6|0)|0,I[ke>>1]=I[gt>>1]|0,I[ke+2>>1]=I[gt+2>>1]|0,I[ke+4>>1]=I[gt+4>>1]|0,gt=(e[Te>>2]|0)+(o*6|0)|0,I[i0>>1]=I[s0>>1]|0,I[i0+2>>1]=I[s0+2>>1]|0,I[i0+4>>1]=I[s0+4>>1]|0,I[ne>>1]=I[ke>>1]|0,I[ne+2>>1]=I[ke+2>>1]|0,I[ne+4>>1]=I[ke+4>>1]|0,ru(ce,t,i0,ne),I[gt>>1]=I[ce>>1]|0,I[gt+2>>1]=I[ce+2>>1]|0,I[gt+4>>1]=I[ce+4>>1]|0,gt=e[Gt>>2]|0,e[Gt>>2]=(gt|0)<1?0:gt+-1|0,r=r+1|0),o=r+oe|0),r=e[Ee>>2]|0,!((o|0)>=(r|0));)oe=o;b=zt}function nu(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0;for(w=t+112|0,C=t+108|0,D=t+4592|0,c=e[w>>2]|0,h=0;;){if((c|0)<1&&(P0(t),c=e[w>>2]|0),d=e[C>>2]|0,c=c+-1|0,e[w>>2]=c,e[C>>2]=d<<1,(d|0)>=0){k=8;break}if(d=e[D>>2]|0,N=1<>2],R=l-h|0,R=(N|0)<(R|0)?N:R,h=R+h|0,(R|0)==(N|0)&&(e[D>>2]=(d|0)>30?31:d+1|0),(h|0)==(l|0)){c=l;break}}if((k|0)==8&&((h|0)!=(l|0)?(c=e[D>>2]|0,(c+-4|0)>>>0<28?c=l0(t,e[36476+(c<<2)>>2]|0)|0:c=0,c=c+h|0,(c|0)>(l|0)&&(c=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,H|0)|0,bt(8)),g=0,xe(7,c|0,5,35648),R=g,g=0,R&1?(R=j()|0,Tt(c|0),le(R|0)):Qt(c|0,824,96))):c=l),(c|0)<=0)return c|0;h=0;do R=o+(h*6|0)|0,I[R>>1]=I[r>>1]|0,I[R+2>>1]=I[r+2>>1]|0,I[R+4>>1]=I[r+4>>1]|0,h=h+1|0;while((h|0)!=(c|0));return c|0}function ru(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0;if(C=r+4568|0,N=nr(r,C)|0,d=nr(r,C)|0,C=nr(r,C)|0,h=r+128|0,c=M[l>>1]|0,D=e[r+136>>2]|0,k=D<<1|1,c=(ee(ee(k,N)|0,c-(M[o>>1]|0)>>31|1)|0)+c|0,N=0-D|0,(c|0)>=(N|0)?(h=e[h>>2]|0,(h+D|0)<(c|0)&&(c=c-(ee(e[r+132>>2]|0,k)|0)|0)):(c=(ee(e[r+132>>2]|0,k)|0)+c|0,h=e[h>>2]|0),(c&h|0)!=(c|0)&&(c=h&~(c>>31)),w=c&65535,c=M[l+2>>1]|0,c=(ee(ee(k,d)|0,c-(M[o+2>>1]|0)>>31|1)|0)+c|0,(c|0)>=(N|0)?(h+D|0)<(c|0)&&(c=c-(ee(e[r+132>>2]|0,k)|0)|0):c=(ee(e[r+132>>2]|0,k)|0)+c|0,(c&h|0)!=(c|0)&&(c=h&~(c>>31)),d=c&65535,c=M[l+4>>1]|0,c=(ee(ee(k,C)|0,c-(M[o+4>>1]|0)>>31|1)|0)+c|0,(c|0)>=(N|0)?(h+D|0)<(c|0)&&(c=c-(ee(e[r+132>>2]|0,k)|0)|0):c=(ee(e[r+132>>2]|0,k)|0)+c|0,(c&h|0)==(c|0)){r=c,r=r&65535,I[t>>1]=w,N=t+2|0,I[N>>1]=d,t=t+4|0,I[t>>1]=r;return}r=h&~(c>>31),r=r&65535,I[t>>1]=w,N=t+2|0,I[N>>1]=d,t=t+4|0,I[t>>1]=r}function ir(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0;if(U=r>>31,C=(U^r)-U|0,R=t+188+(C*12|0)+10|0,o=I[R>>1]|0,N=t+188+(C*12|0)|0,c=e[N>>2]|0,(o|0)<(c|0))if((o<<1|0)<(c|0))if((o<<2|0)<(c|0))if((o<<3|0)<(c|0))if((o<<4|0)<(c|0))for(r=5;(o<>1]^U)-U+l|0,_=t+128|0,c=e[_>>2]|0,(o&c|0)==(o|0)?D=o:D=c&~(o>>31),o=t+112|0,(e[o>>2]|0)<8&&P0(t),c=t+108|0,l=e[c>>2]|0,h=l>>>24,d=e[2832+(r<<11)+(h<<3)+4>>2]|0,d?(e[o>>2]=(e[o>>2]|0)-d,e[c>>2]=l<>2]|0):(w=e[t+148>>2]|0,c=e[t+140>>2]|0,o=X0(t)|0,(o|0)<(w+-1-c|0)?r&&(o=(l0(t,r)|0)+(o<>31^o>>1,(((o|0)>-1?o:0-o|0)|0)>65535&&(o=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,H|0)|0,bt(8)),g=0,xe(7,o|0,5,35648),t=g,g=0,t&1?(t=j()|0,Tt(o|0),le(t|0)):Qt(o|0,824,96))),w=t+136|0,l=e[w>>2]|0,r?d=o:(l?c=0:c=(e[t+188+(C*12|0)+4>>2]<<1)+-1+(I[R>>1]|0)>>31,d=c^o),r=e[t+152>>2]|0,c=(e[N>>2]|0)+((d|0)>-1?d:0-d|0)|0,h=t+188+(C*12|0)+4|0,o=(e[h>>2]|0)+(ee(l<<1|1,d)|0)|0,l=I[R>>1]|0,(l|0)==(r|0)&&(c=c>>1,o=o>>1,l=r>>1),e[N>>2]=c,r=l+1|0,I[R>>1]=r,c=r+o|0,(c|0)>=1?(o|0)>0&&(o=o-r|0,R=I[k>>1]|0,I[k>>1]=(R<<16>>16<127&1)+(R&65535),o=(o|0)>0?0:o):(o=I[k>>1]|0,I[k>>1]=(o&65535)-(o<<16>>16>-128&1),o=(c|0)>(~l|0)?c:0-l|0),e[h>>2]=o,r=e[w>>2]|0,l=r<<1|1,c=(ee(l,(d^U)-U|0)|0)+D|0,(c|0)>=(0-r|0)?(o=e[_>>2]|0,(o+r|0)<(c|0)&&(c=c-(ee(e[t+132>>2]|0,l)|0)|0)):(c=(ee(e[t+132>>2]|0,l)|0)+c|0,o=e[_>>2]|0),(c&o|0)==(c|0)?(t=c,t=t&65535,t|0):(t=o&~(c>>31),t=t&65535,t|0)}function nr(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0;if(D=r+9|0,o=F[D>>0]|0,h=r+4|0,c=(ee(o>>>1,e[h>>2]|0)|0)+(e[r>>2]|0)|0,(o|0)<(c|0)){l=0;do o=o<<1,l=l+1|0;while((o|0)<(c|0))}else l=0;d=e[t+148>>2]|0,w=e[36476+(e[t+4592>>2]<<2)>>2]|0,o=e[t+140>>2]|0,c=X0(t)|0;do if((c|0)<(d+-2-w-o|0))if(l){w=(l0(t,l)|0)+(c<>2]|0,c=w+l|0,d=c&1,o=d,h=1,c=(d+c|0)/2|0;break}else{l=e[h>>2]|0,t=l+c|0,o=t&1,t=(o+t|0)/2|0,C=8;break}else c=(l0(t,o)|0)+1|0,d=e[h>>2]|0,t=c+d|0,o=t&1,t=(o+t|0)/2|0,l?(w=c,h=1,c=t,l=d):(l=d,C=8);while(!1);return(C|0)==8&&(w=c,h=F[r+10>>0]<<1>>>0>=(F[D>>0]|0)>>>0,c=t),c=(o|0)!=0^h?c:0-c|0,(c|0)<0&&(C=r+10|0,S[C>>0]=(F[C>>0]|0)+1),o=(w+1-l>>1)+(e[r>>2]|0)|0,e[r>>2]=o,l=S[D>>0]|0,l<<24>>24!=(S[r+8>>0]|0)?(r=l,r=r&255,r=r+1|0,r=r&255,S[D>>0]=r,c|0):(e[r>>2]=o>>1,C=(l&255)>>>1,S[D>>0]=C,r=r+10|0,S[r>>0]=(F[r>>0]|0)>>>1,r=C,r=r&255,r=r+1|0,r=r&255,S[D>>0]=r,c|0)}function su(t){t=t|0;var r=0,o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0;R=b,b=b+32|0,l=R,N=t+136|0;e:do if(e[N>>2]|0)r=t+144|0;else if(o=e[t+128>>2]|0,r=t+144|0,(o|0)==((1<>2])+-1|0)&&(m0(l,o,0),(e[l+4>>2]|0)==(e[t+176>>2]|0))&&(e[l+8>>2]|0)==(e[t+180>>2]|0)&&(e[l+12>>2]|0)==(e[t+184>>2]|0))switch(e[r>>2]|0){case 8:{N=e[8900]|0,e[t+4604>>2]=N+(((e[8901]|0)-N|0)>>>1),b=R;return}case 10:{N=e[8903]|0,e[t+4604>>2]=N+(((e[8904]|0)-N|0)>>>1),b=R;return}case 12:{N=e[8906]|0,e[t+4604>>2]=N+(((e[8907]|0)-N|0)>>>1),b=R;return}case 16:{N=e[8909]|0,e[t+4604>>2]=N+(((e[8910]|0)-N|0)>>>1),b=R;return}default:break e}while(!1);if(k=1<>2],o=t+4608|0,l=k<<1,c=t+4612|0,h=e[c>>2]|0,r=e[o>>2]|0,d=h-r|0,l>>>0<=d>>>0?l>>>0>>0&&(w=r+l|0,(h|0)!=(w|0))&&(e[c>>2]=w):(j0(o,l-d|0),r=e[o>>2]|0),D=t+4604|0,e[D>>2]=r+k,r=0-k|0,(k|0)<=(r|0)){b=R;return}w=t+184|0,C=t+180|0,d=t+176|0,h=r;do r=e[w>>2]|0,(h|0)>(0-r|0)?(o=e[C>>2]|0,(h|0)>(0-o|0)?(l=e[d>>2]|0,(h|0)>(0-l|0)?(c=e[N>>2]|0,(h|0)>=(0-c|0)?(c|0)<(h|0)?(l|0)<=(h|0)?(o|0)>(h|0)?r=2:r=(r|0)>(h|0)?3:4:r=1:r=0:r=-1):r=-2):r=-3):r=-4,S[(e[D>>2]|0)+h>>0]=r,h=h+1|0;while((h|0)!=(k|0));b=R}function ou(t){t=t|0;var r=0,o=0;e[t>>2]=35800,r=e[t+4608>>2]|0,r&&(o=t+4612|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),e[t>>2]=36736,r=e[t+92>>2]|0,r&&(o=t+96|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),t=t+88|0,r=e[t>>2]|0,e[t>>2]=0,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r)}function au(t){t=t|0;var r=0,o=0;if(e[t>>2]=35800,r=e[t+4608>>2]|0,r&&(o=t+4612|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),e[t>>2]=36736,r=e[t+92>>2]|0,r&&(o=t+96|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),o=t+88|0,r=e[o>>2]|0,e[o>>2]=0,!r){he(t);return}Mt[e[(e[r>>2]|0)+4>>2]&255](r),he(t)}function lu(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0,G=0,$=0,P=0,O=0;if(G=b,b=b+352|0,$=G+328|0,P=G+192|0,o=G+343|0,l=G+342|0,c=G+341|0,h=G+340|0,R=G+176|0,w=G+168|0,C=G+160|0,D=G+152|0,K=G,U=G+136|0,e[t+28>>2]|0&&(e[t+20>>2]|0)!=1){if(_=t+4|0,Q=t+32|0,d=e[Q>>2]|0,!d){if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[o>>0]|0,$e(44,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}if(t=e[t+12>>2]|0,(t|0)==8)switch(d|0){case 1:{if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[l>>0]|0,$e(45,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 2:{if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[c>>0]|0,$e(46,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 3:{if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[h>>0]|0,$e(47,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}default:{d=P+56|0,c=P+4|0,e[P>>2]=36160,e[d>>2]=36180,g=0,Ae(62,P+56|0,c|0),G=g,g=0,G&1&&(O=j()|0,tt(d),le(O|0)),e[P+128>>2]=0,e[P+132>>2]=-1,e[P>>2]=36200,e[P+56>>2]=36220,g=0,ue(180,c|0),G=g,g=0;do if(G&1)t=j()|0;else{if(e[c>>2]=36236,h=P+36|0,e[h>>2]=0,e[h+4>>2]=0,e[h+8>>2]=0,e[h+12>>2]=0,e[P+52>>2]=16,e[$>>2]=0,e[$+4>>2]=0,e[$+8>>2]=0,g=0,Ae(63,c|0,$|0),G=g,g=0,G&1){t=j()|0,de($),de(h),wt(c);break}de($),g=0,t=Ve(28,P|0,49007,21)|0,$=g,g=0;do if(!($&1)&&(g=0,k=be(36,t|0,e[Q>>2]|0)|0,$=g,g=0,!($&1))&&(g=0,Ve(28,k|0,50997,18)|0,$=g,g=0,!($&1))){if(l=Ct(16)|0,g=0,Ae(64,R|0,c|0),$=g,g=0,$&1)t=j()|0;else if(!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,H|0)|0,bt(8)),g=0,$e(36,l|0,9,35648,R|0),$=g,g=0,$&1?o=1:(g=0,xe(6,l|0,824,96),g=0,o=0),t=j()|0,de(R),!o)break;Tt(l|0)}else O=34;while(!1);(O|0)==34&&(t=j()|0),e[P>>2]=36200,e[d>>2]=36220,e[c>>2]=36236,de(h),wt(c),tt(d),O=t,le(O|0)}while(!1);O=t,tt(d),le(O|0)}}switch((t|0)<=8&&(t=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,H|0)|0,bt(8)),g=0,xe(7,t|0,8,35648),O=g,g=0,O&1||Qt(t|0,824,96),O=j()|0,Tt(t|0),le(O|0)),o=16-t|0,d|0){case 1:{if(t=Xe(60)|0,e[w>>2]=o,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],e[$>>2]=e[w>>2],e[$+4>>2]=e[w+4>>2],$e(41,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 2:{if(t=Xe(60)|0,e[C>>2]=o,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],e[$>>2]=e[C>>2],e[$+4>>2]=e[C+4>>2],$e(42,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 3:{if(t=Xe(60)|0,e[D>>2]=o,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],e[$>>2]=e[D>>2],e[$+4>>2]=e[D+4>>2],$e(43,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}default:{d=K+56|0,c=K+4|0,e[K>>2]=36160,e[d>>2]=36180,g=0,Ae(62,K+56|0,c|0),P=g,g=0,P&1&&(O=j()|0,tt(d),le(O|0)),e[K+128>>2]=0,e[K+132>>2]=-1,e[K>>2]=36200,e[K+56>>2]=36220,g=0,ue(180,c|0),P=g,g=0;do if(P&1)t=j()|0;else{if(e[c>>2]=36236,h=K+36|0,e[h>>2]=0,e[h+4>>2]=0,e[h+8>>2]=0,e[h+12>>2]=0,e[K+52>>2]=16,e[$>>2]=0,e[$+4>>2]=0,e[$+8>>2]=0,g=0,Ae(63,c|0,$|0),P=g,g=0,P&1){t=j()|0,de($),de(h),wt(c);break}de($),g=0,t=Ve(28,K|0,49007,21)|0,P=g,g=0;do if(!(P&1)&&(g=0,N=be(36,t|0,e[Q>>2]|0)|0,P=g,g=0,!(P&1))&&(g=0,Ve(28,N|0,50997,18)|0,P=g,g=0,!(P&1))){if(l=Ct(16)|0,g=0,Ae(64,U|0,c|0),P=g,g=0,P&1)t=j()|0;else if(!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,H|0)|0,bt(8)),g=0,$e(36,l|0,9,35648,U|0),P=g,g=0,P&1?o=1:(g=0,xe(6,l|0,824,96),g=0,o=0),t=j()|0,de(U),!o)break;Tt(l|0)}else O=64;while(!1);(O|0)==64&&(t=j()|0),e[K>>2]=36200,e[d>>2]=36220,e[c>>2]=36236,de(h),wt(c),tt(d),O=t,le(O|0)}while(!1);O=t,tt(d),le(O|0)}}}return o=e[r+4>>2]|0,l=Xe(16)|0,t=e[t+16>>2]|0,o?(e[l>>2]=36108,e[l+4>>2]=o,e[l+8>>2]=3,e[l+12>>2]=t,O=l,b=G,O|0):(O=e[r>>2]|0,e[l>>2]=36132,e[l+4>>2]=O,e[l+8>>2]=3,e[l+12>>2]=t,O=l,b=G,O|0)}function uu(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0;d=b,b=b+32|0,C=d,m0(C,e[t+128>>2]|0,e[t+136>>2]|0),w=e[r+4>>2]|0,h=e[r+8>>2]|0,h=h|0?h:e[C+8>>2]|0,c=e[r+12>>2]|0,c=c|0?c:e[C+12>>2]|0,o=e[r+16>>2]|0,l=e[C+16>>2]|0,e[t+176>>2]=w|0?w:e[C+4>>2]|0,e[t+180>>2]=h,e[t+184>>2]=c,mu(t),c=t+132|0,r=(e[c>>2]|0)+32|0,r=(r|0)<128?2:(r|0)/64|0,h=0;do e[t+188+(h*12|0)>>2]=r,e[t+188+(h*12|0)+4>>2]=0,I[t+188+(h*12|0)+8>>1]=0,I[t+188+(h*12|0)+10>>1]=1,h=h+1|0;while((h|0)!=365);w=(e[c>>2]|0)+32|0,w=(w|0)<128?2:(w|0)/64|0,C=(o|0?o:l)&255,e[t+4568>>2]=w,e[t+4572>>2]=0,S[t+4576>>0]=C,S[t+4577>>0]=1,S[t+4578>>0]=0,e[t+4580>>2]=w,e[t+4584>>2]=1,S[t+4588>>0]=C,S[t+4589>>0]=1,S[t+4590>>0]=0,e[t+4592>>2]=0,b=d}function cu(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0;for(d=t+88|0,h=e[r>>2]|0,e[r>>2]=0,r=e[d>>2]|0,e[d>>2]=h,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r),d=l+4|0,h=e[d>>2]|0,S[t+4620>>0]=c&1,r=t+156|0,e[r>>2]=e[o>>2],e[r+4>>2]=e[o+4>>2],e[r+8>>2]=e[o+8>>2],e[r+12>>2]=e[o+12>>2],Y0(t,l),fu(t),r=e[t+116>>2]|0,t=e[t+112>>2]|0;c=r+-1|0,o=(S[c>>0]|0)==-1?7:8,!((t|0)<(o|0));)r=c,t=t-o|0;r=r-h|0,c=e[d>>2]|0,c&&(e[d>>2]=c+r,l=l+8|0,e[l>>2]=(e[l>>2]|0)-r)}function fu(t){t=t|0;var r=0,o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0,ce=0;ie=b,b=b+32|0,ne=ie+12|0,Z=ie,$=t+172|0,P=(e[$>>2]|0)+4|0,(e[t+28>>2]|0)==1?O=e[t+20>>2]|0:O=1,r=ee(O<<1,P)|0,e[ne>>2]=0,ce=ne+4|0,e[ce>>2]=0,e[ne+8>>2]=0;e:do if(r){if(r>>>0>1431655765&&(g=0,ue(178,ne|0),oe=g,g=0,oe&1)||(h=6),(h|0)==6&&(g=0,o=ge(67,r*3|0)|0,oe=g,g=0,!(oe&1))){for(e[ce>>2]=o,e[ne>>2]=o,e[ne+8>>2]=o+(r*3|0);;)if(S[o>>0]=0,S[o+1>>0]=0,S[o+2>>0]=0,o=(e[ce>>2]|0)+3|0,e[ce>>2]=o,r=r+-1|0,!r)break e}l=j()|0,r=e[ne>>2]|0,r||le(l|0),o=e[ce>>2]|0,(o|0)!=(r|0)&&(e[ce>>2]=o+(~(((o+-3-r|0)>>>0)/3|0)*3|0)),he(r),le(l|0)}while(!1);e[Z>>2]=0,oe=Z+4|0,e[oe>>2]=0,e[Z+8>>2]=0;do if(!O)h=19;else{if(O>>>0>1073741823&&(g=0,ue(178,Z|0),G=g,g=0,G&1)||(h=17),(h|0)==17&&(l=O<<2,g=0,c=ge(67,l|0)|0,G=g,g=0,!(G&1))){e[Z>>2]=c,h=c+(O<<2)|0,e[Z+8>>2]=h,Jt(c|0,0,l|0)|0,e[oe>>2]=h,h=19;break}l=j()|0,r=e[Z>>2]|0,o=r,r&&(c=e[oe>>2]|0,(c|0)!=(r|0)&&(e[oe>>2]=c+(~((c+-4-o|0)>>>2)<<2)),he(r))}while(!1);if((h|0)==19){h=t+8|0;e:do if((e[h>>2]|0)>0){d=t+4596|0,w=ee(O,P)|0,C=w+1|0,D=t+4600|0,k=(O|0)>0,N=t+160|0,R=t+168|0,_=t+164|0,U=t+156|0,Q=t+88|0,K=t+4592|0,G=0;t:for(;;){if(l=e[ne>>2]|0,o=l+3|0,e[d>>2]=o,l=l+(C*3|0)|0,e[D>>2]=l,G&1?(e[d>>2]=l,e[D>>2]=o,r=o,o=l):r=l,k){c=e[Z>>2]|0,l=0;do{if(e[K>>2]=e[c+(l<<2)>>2],r=e[$>>2]|0,c=o+(r*3|0)|0,o=o+((r+-1|0)*3|0)|0,S[c>>0]=S[o>>0]|0,S[c+1>>0]=S[o+1>>0]|0,S[c+2>>0]=S[o+2>>0]|0,o=e[d>>2]|0,c=(e[D>>2]|0)+-3|0,S[c>>0]=S[o>>0]|0,S[c+1>>0]=S[o+1>>0]|0,S[c+2>>0]=S[o+2>>0]|0,g=0,Ae(78,t|0,0),c=g,g=0,c&1){h=30;break t}c=e[Z>>2]|0,e[c+(l<<2)>>2]=e[K>>2],o=(e[d>>2]|0)+(P*3|0)|0,e[d>>2]=o,r=(e[D>>2]|0)+(P*3|0)|0,e[D>>2]=r,l=l+1|0}while((l|0)<(O|0))}if(c=e[N>>2]|0,(c|0)<=(G|0)&&(G|0)<((e[R>>2]|0)+c|0)&&(c=e[Q>>2]|0,g=0,$e(e[(e[c>>2]|0)+8>>2]|0,c|0,r+(((e[U>>2]|0)-w|0)*3|0)|0,e[_>>2]|0,P|0),c=g,g=0,c&1)){h=31;break}if(G=G+1|0,(G|0)>=(e[h>>2]|0)){h=43;break e}}if((h|0)==30){l=j()|0;break}else if((h|0)==31){l=j()|0;break}}else h=43;while(!1);do if((h|0)==43){if(g=0,ue(183,t|0),t=g,g=0,t&1){l=j()|0;break}if(r=e[Z>>2]|0,o=r,r&&(l=e[oe>>2]|0,(l|0)!=(r|0)&&(e[oe>>2]=l+(~((l+-4-o|0)>>>2)<<2)),he(r)),r=e[ne>>2]|0,!r){b=ie;return}o=e[ce>>2]|0,(o|0)!=(r|0)&&(e[ce>>2]=o+(~(((o+-3-r|0)>>>0)/3|0)*3|0)),he(r),b=ie;return}while(!1);r=e[Z>>2]|0,o=r,r&&(c=e[oe>>2]|0,(c|0)!=(r|0)&&(e[oe>>2]=c+(~((c+-4-o|0)>>>2)<<2)),he(r))}r=e[ne>>2]|0,r||le(l|0),o=e[ce>>2]|0,(o|0)!=(r|0)&&(e[ce>>2]=o+(~(((o+-3-r|0)>>>0)/3|0)*3|0)),he(r),le(l|0)}function hu(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0,ce=0,ke=0,Ee=0,Te=0,it=0,jt=0,Gt=0,s0=0,i0=0,zt=0,gt=0;if(zt=b,b=b+16|0,ne=zt+12|0,i0=zt+9|0,s0=zt+6|0,ce=zt+3|0,ke=zt,Ee=t+172|0,r=e[Ee>>2]|0,(r|0)<=0){b=zt;return}for(Te=t+4600|0,it=t+4596|0,jt=t+4604|0,Gt=t+4592|0,oe=0;O=oe+-1|0,l=e[Te>>2]|0,c=l+(O*3|0)|0,gt=e[it>>2]|0,o=oe+1|0,h=F[gt+(oe*3|0)>>0]|0,ie=e[jt>>2]|0,d=F[gt+(O*3|0)>>0]|0,w=h-d|0,C=F[c>>0]|0,D=d-C|0,k=((((S[ie+((F[gt+(o*3|0)>>0]|0)-h)>>0]|0)*9|0)+(S[ie+w>>0]|0)|0)*9|0)+(S[ie+D>>0]|0)|0,N=F[gt+(oe*3|0)+1>>0]|0,R=F[gt+(O*3|0)+1>>0]|0,_=N-R|0,U=F[l+(O*3|0)+1>>0]|0,Q=R-U|0,K=((((S[ie+((F[gt+(o*3|0)+1>>0]|0)-N)>>0]|0)*9|0)+(S[ie+_>>0]|0)|0)*9|0)+(S[ie+Q>>0]|0)|0,G=F[gt+(oe*3|0)+2>>0]|0,$=F[gt+(O*3|0)+2>>0]|0,P=G-$|0,O=F[l+(O*3|0)+2>>0]|0,Z=$-O|0,ie=((((S[ie+((F[gt+(o*3|0)+2>>0]|0)-G)>>0]|0)*9|0)+(S[ie+P>>0]|0)|0)*9|0)+(S[ie+Z>>0]|0)|0,K|k|ie?(l=F[l+(oe*3|0)>>0]|0,r=h-C>>31,(r^D|0)>=0?(r^w|0)<0?r=C:r=C-d+h|0:r=h,h=rr(t,k,l,r,0)|0,l=F[(e[Te>>2]|0)+(oe*3|0)+1>>0]|0,r=N-U>>31,(r^Q|0)>=0?(r^_|0)<0?r=U:r=U-R+N|0:r=N,l=rr(t,K,l,r,0)|0,c=F[(e[Te>>2]|0)+(oe*3|0)+2>>0]|0,r=G-O>>31,(r^Z|0)>=0?(r^P|0)<0?r=O:r=O-$+G|0:r=G,ie=rr(t,ie,c,r,0)|0,gt=(e[Te>>2]|0)+(oe*3|0)|0,S[gt>>0]=h,S[gt+1>>0]=l,S[gt+2>>0]=ie):(S[s0>>0]=S[c>>0]|0,S[s0+1>>0]=S[c+1>>0]|0,S[s0+2>>0]=S[c+2>>0]|0,S[ne>>0]=S[c>>0]|0,S[ne+1>>0]=S[c+1>>0]|0,S[ne+2>>0]=S[c+2>>0]|0,r=du(t,ne,l+(oe*3|0)|0,r-oe|0)|0,o=r+oe|0,(o|0)!=(e[Ee>>2]|0)&&(gt=(e[it>>2]|0)+(o*3|0)|0,S[ke>>0]=S[gt>>0]|0,S[ke+1>>0]=S[gt+1>>0]|0,S[ke+2>>0]=S[gt+2>>0]|0,gt=e[Te>>2]|0,S[i0>>0]=S[s0>>0]|0,S[i0+1>>0]=S[s0+1>>0]|0,S[i0+2>>0]=S[s0+2>>0]|0,S[ne>>0]=S[ke>>0]|0,S[ne+1>>0]=S[ke+1>>0]|0,S[ne+2>>0]=S[ke+2>>0]|0,pu(ce,t,i0,ne),gt=gt+(o*3|0)|0,S[gt>>0]=S[ce>>0]|0,S[gt+1>>0]=S[ce+1>>0]|0,S[gt+2>>0]=S[ce+2>>0]|0,gt=e[Gt>>2]|0,e[Gt>>2]=(gt|0)<1?0:gt+-1|0,r=r+1|0),o=r+oe|0),r=e[Ee>>2]|0,!((o|0)>=(r|0));)oe=o;b=zt}function du(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0;for(w=t+112|0,C=t+108|0,D=t+4592|0,c=e[w>>2]|0,h=0;;){if((c|0)<1&&(P0(t),c=e[w>>2]|0),d=e[C>>2]|0,c=c+-1|0,e[w>>2]=c,e[C>>2]=d<<1,(d|0)>=0){k=8;break}if(d=e[D>>2]|0,N=1<>2],R=l-h|0,R=(N|0)<(R|0)?N:R,h=R+h|0,(R|0)==(N|0)&&(e[D>>2]=(d|0)>30?31:d+1|0),(h|0)==(l|0)){c=l;break}}if((k|0)==8&&((h|0)!=(l|0)?(c=e[D>>2]|0,(c+-4|0)>>>0<28?c=l0(t,e[36476+(c<<2)>>2]|0)|0:c=0,c=c+h|0,(c|0)>(l|0)&&(c=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,H|0)|0,bt(8)),g=0,xe(7,c|0,5,35648),R=g,g=0,R&1?(R=j()|0,Tt(c|0),le(R|0)):Qt(c|0,824,96))):c=l),(c|0)<=0)return c|0;h=0;do R=o+(h*3|0)|0,S[R>>0]=S[r>>0]|0,S[R+1>>0]=S[r+1>>0]|0,S[R+2>>0]=S[r+2>>0]|0,h=h+1|0;while((h|0)!=(c|0));return c|0}function pu(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0;if(C=r+4568|0,N=or(r,C)|0,d=or(r,C)|0,C=or(r,C)|0,h=r+128|0,c=F[l>>0]|0,D=e[r+136>>2]|0,k=D<<1|1,c=(ee(ee(k,N)|0,c-(F[o>>0]|0)>>31|1)|0)+c|0,N=0-D|0,(c|0)>=(N|0)?(h=e[h>>2]|0,(h+D|0)<(c|0)&&(c=c-(ee(e[r+132>>2]|0,k)|0)|0)):(c=(ee(e[r+132>>2]|0,k)|0)+c|0,h=e[h>>2]|0),(c&h|0)!=(c|0)&&(c=h&~(c>>31)),w=c&255,c=F[l+1>>0]|0,c=(ee(ee(k,d)|0,c-(F[o+1>>0]|0)>>31|1)|0)+c|0,(c|0)>=(N|0)?(h+D|0)<(c|0)&&(c=c-(ee(e[r+132>>2]|0,k)|0)|0):c=(ee(e[r+132>>2]|0,k)|0)+c|0,(c&h|0)!=(c|0)&&(c=h&~(c>>31)),d=c&255,c=F[l+2>>0]|0,c=(ee(ee(k,C)|0,c-(F[o+2>>0]|0)>>31|1)|0)+c|0,(c|0)>=(N|0)?(h+D|0)<(c|0)&&(c=c-(ee(e[r+132>>2]|0,k)|0)|0):c=(ee(e[r+132>>2]|0,k)|0)+c|0,(c&h|0)==(c|0)){r=c,r=r&255,S[t>>0]=w,N=t+1|0,S[N>>0]=d,t=t+2|0,S[t>>0]=r;return}r=h&~(c>>31),r=r&255,S[t>>0]=w,N=t+1|0,S[N>>0]=d,t=t+2|0,S[t>>0]=r}function rr(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0;if(U=r>>31,C=(U^r)-U|0,R=t+188+(C*12|0)+10|0,o=I[R>>1]|0,N=t+188+(C*12|0)|0,c=e[N>>2]|0,(o|0)<(c|0))if((o<<1|0)<(c|0))if((o<<2|0)<(c|0))if((o<<3|0)<(c|0))if((o<<4|0)<(c|0))for(r=5;(o<>1]^U)-U+l|0,_=t+128|0,c=e[_>>2]|0,(o&c|0)==(o|0)?D=o:D=c&~(o>>31),o=t+112|0,(e[o>>2]|0)<8&&P0(t),c=t+108|0,l=e[c>>2]|0,h=l>>>24,d=e[2832+(r<<11)+(h<<3)+4>>2]|0,d?(e[o>>2]=(e[o>>2]|0)-d,e[c>>2]=l<>2]|0):(w=e[t+148>>2]|0,c=e[t+140>>2]|0,o=X0(t)|0,(o|0)<(w+-1-c|0)?r&&(o=(l0(t,r)|0)+(o<>31^o>>1,(((o|0)>-1?o:0-o|0)|0)>65535&&(o=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,H|0)|0,bt(8)),g=0,xe(7,o|0,5,35648),t=g,g=0,t&1?(t=j()|0,Tt(o|0),le(t|0)):Qt(o|0,824,96))),w=t+136|0,l=e[w>>2]|0,r?d=o:(l?c=0:c=(e[t+188+(C*12|0)+4>>2]<<1)+-1+(I[R>>1]|0)>>31,d=c^o),r=e[t+152>>2]|0,c=(e[N>>2]|0)+((d|0)>-1?d:0-d|0)|0,h=t+188+(C*12|0)+4|0,o=(e[h>>2]|0)+(ee(l<<1|1,d)|0)|0,l=I[R>>1]|0,(l|0)==(r|0)&&(c=c>>1,o=o>>1,l=r>>1),e[N>>2]=c,r=l+1|0,I[R>>1]=r,c=r+o|0,(c|0)>=1?(o|0)>0&&(o=o-r|0,R=I[k>>1]|0,I[k>>1]=(R<<16>>16<127&1)+(R&65535),o=(o|0)>0?0:o):(o=I[k>>1]|0,I[k>>1]=(o&65535)-(o<<16>>16>-128&1),o=(c|0)>(~l|0)?c:0-l|0),e[h>>2]=o,r=e[w>>2]|0,l=r<<1|1,c=(ee(l,(d^U)-U|0)|0)+D|0,(c|0)>=(0-r|0)?(o=e[_>>2]|0,(o+r|0)<(c|0)&&(c=c-(ee(e[t+132>>2]|0,l)|0)|0)):(c=(ee(e[t+132>>2]|0,l)|0)+c|0,o=e[_>>2]|0),(c&o|0)==(c|0)?(t=c,t=t&255,t|0):(t=o&~(c>>31),t=t&255,t|0)}function or(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0;if(D=r+9|0,o=F[D>>0]|0,h=r+4|0,c=(ee(o>>>1,e[h>>2]|0)|0)+(e[r>>2]|0)|0,(o|0)<(c|0)){l=0;do o=o<<1,l=l+1|0;while((o|0)<(c|0))}else l=0;d=e[t+148>>2]|0,w=e[36476+(e[t+4592>>2]<<2)>>2]|0,o=e[t+140>>2]|0,c=X0(t)|0;do if((c|0)<(d+-2-w-o|0))if(l){w=(l0(t,l)|0)+(c<>2]|0,c=w+l|0,d=c&1,o=d,h=1,c=(d+c|0)/2|0;break}else{l=e[h>>2]|0,t=l+c|0,o=t&1,t=(o+t|0)/2|0,C=8;break}else c=(l0(t,o)|0)+1|0,d=e[h>>2]|0,t=c+d|0,o=t&1,t=(o+t|0)/2|0,l?(w=c,h=1,c=t,l=d):(l=d,C=8);while(!1);return(C|0)==8&&(w=c,h=F[r+10>>0]<<1>>>0>=(F[D>>0]|0)>>>0,c=t),c=(o|0)!=0^h?c:0-c|0,(c|0)<0&&(C=r+10|0,S[C>>0]=(F[C>>0]|0)+1),o=(w+1-l>>1)+(e[r>>2]|0)|0,e[r>>2]=o,l=S[D>>0]|0,l<<24>>24!=(S[r+8>>0]|0)?(r=l,r=r&255,r=r+1|0,r=r&255,S[D>>0]=r,c|0):(e[r>>2]=o>>1,C=(l&255)>>>1,S[D>>0]=C,r=r+10|0,S[r>>0]=(F[r>>0]|0)>>>1,r=C,r=r&255,r=r+1|0,r=r&255,S[D>>0]=r,c|0)}function mu(t){t=t|0;var r=0,o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0;R=b,b=b+32|0,l=R,N=t+136|0;e:do if(e[N>>2]|0)r=t+144|0;else if(o=e[t+128>>2]|0,r=t+144|0,(o|0)==((1<>2])+-1|0)&&(m0(l,o,0),(e[l+4>>2]|0)==(e[t+176>>2]|0))&&(e[l+8>>2]|0)==(e[t+180>>2]|0)&&(e[l+12>>2]|0)==(e[t+184>>2]|0))switch(e[r>>2]|0){case 8:{N=e[8900]|0,e[t+4604>>2]=N+(((e[8901]|0)-N|0)>>>1),b=R;return}case 10:{N=e[8903]|0,e[t+4604>>2]=N+(((e[8904]|0)-N|0)>>>1),b=R;return}case 12:{N=e[8906]|0,e[t+4604>>2]=N+(((e[8907]|0)-N|0)>>>1),b=R;return}case 16:{N=e[8909]|0,e[t+4604>>2]=N+(((e[8910]|0)-N|0)>>>1),b=R;return}default:break e}while(!1);if(k=1<>2],o=t+4608|0,l=k<<1,c=t+4612|0,h=e[c>>2]|0,r=e[o>>2]|0,d=h-r|0,l>>>0<=d>>>0?l>>>0>>0&&(w=r+l|0,(h|0)!=(w|0))&&(e[c>>2]=w):(j0(o,l-d|0),r=e[o>>2]|0),D=t+4604|0,e[D>>2]=r+k,r=0-k|0,(k|0)<=(r|0)){b=R;return}w=t+184|0,C=t+180|0,d=t+176|0,h=r;do r=e[w>>2]|0,(h|0)>(0-r|0)?(o=e[C>>2]|0,(h|0)>(0-o|0)?(l=e[d>>2]|0,(h|0)>(0-l|0)?(c=e[N>>2]|0,(h|0)>=(0-c|0)?(c|0)<(h|0)?(l|0)<=(h|0)?(o|0)>(h|0)?r=2:r=(r|0)>(h|0)?3:4:r=1:r=0:r=-1):r=-2):r=-3):r=-4,S[(e[D>>2]|0)+h>>0]=r,h=h+1|0;while((h|0)!=(k|0));b=R}function gu(t){t=t|0;var r=0,o=0;e[t>>2]=35772,r=e[t+4584>>2]|0,r&&(o=t+4588|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),e[t>>2]=36736,r=e[t+92>>2]|0,r&&(o=t+96|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),t=t+88|0,r=e[t>>2]|0,e[t>>2]=0,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r)}function Su(t){t=t|0;var r=0,o=0;if(e[t>>2]=35772,r=e[t+4584>>2]|0,r&&(o=t+4588|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),e[t>>2]=36736,r=e[t+92>>2]|0,r&&(o=t+96|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),o=t+88|0,r=e[o>>2]|0,e[o>>2]=0,!r){he(t);return}Mt[e[(e[r>>2]|0)+4>>2]&255](r),he(t)}function Au(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0,G=0,$=0,P=0,O=0;if(G=b,b=b+352|0,$=G+328|0,P=G+192|0,o=G+343|0,l=G+342|0,c=G+341|0,h=G+340|0,R=G+176|0,w=G+168|0,C=G+160|0,D=G+152|0,K=G,U=G+136|0,e[t+28>>2]|0&&(e[t+20>>2]|0)!=1){if(_=t+4|0,Q=t+32|0,d=e[Q>>2]|0,!d){if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[o>>0]|0,$e(37,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}if(t=e[t+12>>2]|0,(t|0)==16)switch(d|0){case 1:{if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[l>>0]|0,$e(38,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 2:{if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[c>>0]|0,$e(39,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 3:{if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[h>>0]|0,$e(40,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}default:{d=P+56|0,c=P+4|0,e[P>>2]=36160,e[d>>2]=36180,g=0,Ae(62,P+56|0,c|0),G=g,g=0,G&1&&(O=j()|0,tt(d),le(O|0)),e[P+128>>2]=0,e[P+132>>2]=-1,e[P>>2]=36200,e[P+56>>2]=36220,g=0,ue(180,c|0),G=g,g=0;do if(G&1)t=j()|0;else{if(e[c>>2]=36236,h=P+36|0,e[h>>2]=0,e[h+4>>2]=0,e[h+8>>2]=0,e[h+12>>2]=0,e[P+52>>2]=16,e[$>>2]=0,e[$+4>>2]=0,e[$+8>>2]=0,g=0,Ae(63,c|0,$|0),G=g,g=0,G&1){t=j()|0,de($),de(h),wt(c);break}de($),g=0,t=Ve(28,P|0,49007,21)|0,$=g,g=0;do if(!($&1)&&(g=0,k=be(36,t|0,e[Q>>2]|0)|0,$=g,g=0,!($&1))&&(g=0,Ve(28,k|0,50997,18)|0,$=g,g=0,!($&1))){if(l=Ct(16)|0,g=0,Ae(64,R|0,c|0),$=g,g=0,$&1)t=j()|0;else if(!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,H|0)|0,bt(8)),g=0,$e(36,l|0,9,35648,R|0),$=g,g=0,$&1?o=1:(g=0,xe(6,l|0,824,96),g=0,o=0),t=j()|0,de(R),!o)break;Tt(l|0)}else O=34;while(!1);(O|0)==34&&(t=j()|0),e[P>>2]=36200,e[d>>2]=36220,e[c>>2]=36236,de(h),wt(c),tt(d),O=t,le(O|0)}while(!1);O=t,tt(d),le(O|0)}}switch((t|0)<=8&&(t=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,H|0)|0,bt(8)),g=0,xe(7,t|0,8,35648),O=g,g=0,O&1||Qt(t|0,824,96),O=j()|0,Tt(t|0),le(O|0)),o=16-t|0,d|0){case 1:{if(t=Xe(60)|0,e[w>>2]=o,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],e[$>>2]=e[w>>2],e[$+4>>2]=e[w+4>>2],$e(41,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 2:{if(t=Xe(60)|0,e[C>>2]=o,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],e[$>>2]=e[C>>2],e[$+4>>2]=e[C+4>>2],$e(42,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 3:{if(t=Xe(60)|0,e[D>>2]=o,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],e[$>>2]=e[D>>2],e[$+4>>2]=e[D+4>>2],$e(43,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}default:{d=K+56|0,c=K+4|0,e[K>>2]=36160,e[d>>2]=36180,g=0,Ae(62,K+56|0,c|0),P=g,g=0,P&1&&(O=j()|0,tt(d),le(O|0)),e[K+128>>2]=0,e[K+132>>2]=-1,e[K>>2]=36200,e[K+56>>2]=36220,g=0,ue(180,c|0),P=g,g=0;do if(P&1)t=j()|0;else{if(e[c>>2]=36236,h=K+36|0,e[h>>2]=0,e[h+4>>2]=0,e[h+8>>2]=0,e[h+12>>2]=0,e[K+52>>2]=16,e[$>>2]=0,e[$+4>>2]=0,e[$+8>>2]=0,g=0,Ae(63,c|0,$|0),P=g,g=0,P&1){t=j()|0,de($),de(h),wt(c);break}de($),g=0,t=Ve(28,K|0,49007,21)|0,P=g,g=0;do if(!(P&1)&&(g=0,N=be(36,t|0,e[Q>>2]|0)|0,P=g,g=0,!(P&1))&&(g=0,Ve(28,N|0,50997,18)|0,P=g,g=0,!(P&1))){if(l=Ct(16)|0,g=0,Ae(64,U|0,c|0),P=g,g=0,P&1)t=j()|0;else if(!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,H|0)|0,bt(8)),g=0,$e(36,l|0,9,35648,U|0),P=g,g=0,P&1?o=1:(g=0,xe(6,l|0,824,96),g=0,o=0),t=j()|0,de(U),!o)break;Tt(l|0)}else O=64;while(!1);(O|0)==64&&(t=j()|0),e[K>>2]=36200,e[d>>2]=36220,e[c>>2]=36236,de(h),wt(c),tt(d),O=t,le(O|0)}while(!1);O=t,tt(d),le(O|0)}}}return o=e[r+4>>2]|0,l=Xe(16)|0,t=e[t+16>>2]|0,o?(e[l>>2]=36108,e[l+4>>2]=o,e[l+8>>2]=2,e[l+12>>2]=t,O=l,b=G,O|0):(O=e[r>>2]|0,e[l>>2]=36132,e[l+4>>2]=O,e[l+8>>2]=2,e[l+12>>2]=t,O=l,b=G,O|0)}function vu(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0;c=b,b=b+32|0,w=c,m0(w,65535,0),d=e[r+4>>2]|0,h=e[r+8>>2]|0,h=h|0?h:e[w+8>>2]|0,l=e[r+12>>2]|0,l=l|0?l:e[w+12>>2]|0,r=e[r+16>>2]|0,o=e[w+16>>2]|0,e[t+152>>2]=d|0?d:e[w+4>>2]|0,e[t+156>>2]=h,e[t+160>>2]=l,Eu(t),l=0;do e[t+164+(l*12|0)>>2]=1024,e[t+164+(l*12|0)+4>>2]=0,I[t+164+(l*12|0)+8>>1]=0,I[t+164+(l*12|0)+10>>1]=1,l=l+1|0;while((l|0)!=365);w=(r|0?r:o)&255,e[t+4544>>2]=1024,e[t+4548>>2]=0,S[t+4552>>0]=w,S[t+4553>>0]=1,S[t+4554>>0]=0,e[t+4556>>2]=1024,e[t+4560>>2]=1,S[t+4564>>0]=w,S[t+4565>>0]=1,S[t+4566>>0]=0,e[t+4568>>2]=0,b=c}function xu(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0;for(d=t+88|0,h=e[r>>2]|0,e[r>>2]=0,r=e[d>>2]|0,e[d>>2]=h,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r),d=l+4|0,h=e[d>>2]|0,S[t+4596>>0]=c&1,r=t+132|0,e[r>>2]=e[o>>2],e[r+4>>2]=e[o+4>>2],e[r+8>>2]=e[o+8>>2],e[r+12>>2]=e[o+12>>2],Y0(t,l),wu(t),r=e[t+116>>2]|0,t=e[t+112>>2]|0;c=r+-1|0,o=(S[c>>0]|0)==-1?7:8,!((t|0)<(o|0));)r=c,t=t-o|0;r=r-h|0,c=e[d>>2]|0,c&&(e[d>>2]=c+r,l=l+8|0,e[l>>2]=(e[l>>2]|0)-r)}function wu(t){t=t|0;var r=0,o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0,ce=0;ie=b,b=b+32|0,ne=ie+12|0,Z=ie,$=t+148|0,P=(e[$>>2]|0)+4|0,(e[t+28>>2]|0)==1?O=e[t+20>>2]|0:O=1,r=ee(O<<1,P)|0,e[ne>>2]=0,ce=ne+4|0,e[ce>>2]=0,e[ne+8>>2]=0;do if(r){if((r|0)<0&&(g=0,ue(178,ne|0),oe=g,g=0,oe&1)||(d=6),(d|0)==6&&(o=r<<1,g=0,l=ge(67,o|0)|0,oe=g,g=0,!(oe&1))){e[ne>>2]=l,oe=l+(r<<1)|0,e[ne+8>>2]=oe,Jt(l|0,0,o|0)|0,e[ce>>2]=oe;break}l=j()|0,r=e[ne>>2]|0,r||le(l|0),o=e[ce>>2]|0,(o|0)!=(r|0)&&(e[ce>>2]=o+(~((o+-2-r|0)>>>1)<<1)),he(r),le(l|0)}while(!1);e[Z>>2]=0,oe=Z+4|0,e[oe>>2]=0,e[Z+8>>2]=0;do if(!O)d=18;else{if(O>>>0>1073741823&&(g=0,ue(178,Z|0),G=g,g=0,G&1)||(d=16),(d|0)==16&&(c=O<<2,g=0,h=ge(67,c|0)|0,G=g,g=0,!(G&1))){e[Z>>2]=h,d=h+(O<<2)|0,e[Z+8>>2]=d,Jt(h|0,0,c|0)|0,e[oe>>2]=d,d=18;break}l=j()|0,r=e[Z>>2]|0,o=r,r&&(c=e[oe>>2]|0,(c|0)!=(r|0)&&(e[oe>>2]=c+(~((c+-4-o|0)>>>2)<<2)),he(r))}while(!1);if((d|0)==18){h=t+8|0;e:do if((e[h>>2]|0)>0){d=t+4572|0,w=ee(O,P)|0,C=w+1|0,D=t+4576|0,k=(O|0)>0,N=t+136|0,R=t+144|0,_=t+140|0,U=t+132|0,Q=t+88|0,K=t+4568|0,G=0;t:for(;;){if(l=e[ne>>2]|0,o=l+2|0,e[d>>2]=o,l=l+(C<<1)|0,e[D>>2]=l,G&1?(e[d>>2]=l,e[D>>2]=o,r=o,o=l):r=l,k){c=e[Z>>2]|0,l=0;do{if(e[K>>2]=e[c+(l<<2)>>2],c=e[$>>2]|0,I[o+(c<<1)>>1]=I[o+(c+-1<<1)>>1]|0,I[r+-2>>1]=I[o>>1]|0,g=0,Ae(79,t|0,0),c=g,g=0,c&1){d=29;break t}c=e[Z>>2]|0,e[c+(l<<2)>>2]=e[K>>2],o=(e[d>>2]|0)+(P<<1)|0,e[d>>2]=o,r=(e[D>>2]|0)+(P<<1)|0,e[D>>2]=r,l=l+1|0}while((l|0)<(O|0))}if(c=e[N>>2]|0,(c|0)<=(G|0)&&(G|0)<((e[R>>2]|0)+c|0)&&(c=e[Q>>2]|0,g=0,$e(e[(e[c>>2]|0)+8>>2]|0,c|0,r+((e[U>>2]|0)-w<<1)|0,e[_>>2]|0,P|0),c=g,g=0,c&1)){d=30;break}if(G=G+1|0,(G|0)>=(e[h>>2]|0)){d=42;break e}}if((d|0)==29){l=j()|0;break}else if((d|0)==30){l=j()|0;break}}else d=42;while(!1);do if((d|0)==42){if(g=0,ue(183,t|0),t=g,g=0,t&1){l=j()|0;break}if(r=e[Z>>2]|0,o=r,r&&(l=e[oe>>2]|0,(l|0)!=(r|0)&&(e[oe>>2]=l+(~((l+-4-o|0)>>>2)<<2)),he(r)),r=e[ne>>2]|0,!r){b=ie;return}o=e[ce>>2]|0,(o|0)!=(r|0)&&(e[ce>>2]=o+(~((o+-2-r|0)>>>1)<<1)),he(r),b=ie;return}while(!1);r=e[Z>>2]|0,o=r,r&&(c=e[oe>>2]|0,(c|0)!=(r|0)&&(e[oe>>2]=c+(~((c+-4-o|0)>>>2)<<2)),he(r))}r=e[ne>>2]|0,r||le(l|0),o=e[ce>>2]|0,(o|0)!=(r|0)&&(e[ce>>2]=o+(~((o+-2-r|0)>>>1)<<1)),he(r),le(l|0)}function yu(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0;if(N=t+4572|0,r=e[N>>2]|0,U=t+148|0,!((e[U>>2]|0)<=0))for(R=t+4576|0,_=t+4580|0,c=r,h=M[r+-2>>1]|0,r=M[r>>1]|0,k=0;D=e[R>>2]|0,C=M[D+(k+-1<<1)>>1]|0,l=k+1|0,o=M[c+(l<<1)>>1]|0,w=e[_>>2]|0,d=r-h|0,c=h-C|0,w=((((S[w+(o-r)>>0]|0)*9|0)+(S[w+d>>0]|0)|0)*9|0)+(S[w+c>>0]|0)|0,w?(h=r-C>>31,(h^c|0)<0?c=r:c=C+((h^d|0)<0?0:d)|0,D=Cu(t,w,M[D+(k<<1)>>1]|0,c,0)|0,I[(e[R>>2]|0)+(k<<1)>>1]=D):(l=(Tu(t,k,0)|0)+k|0,o=e[N>>2]|0,r=M[o+(l+-1<<1)>>1]|0,o=M[o+(l<<1)>>1]|0),!((l|0)>=(e[U>>2]|0));)c=e[N>>2]|0,h=r,r=o,k=l}function Cu(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0;if(_=r>>31,D=(_^r)-_|0,R=t+164+(D*12|0)+10|0,o=I[R>>1]|0,N=t+164+(D*12|0)|0,c=e[N>>2]|0,(o|0)<(c|0))if((o<<1|0)<(c|0))if((o<<2|0)<(c|0))if((o<<3|0)<(c|0))if((o<<4|0)<(c|0))for(h=5;(o<>1]^_)-_+l|0,(o&65535|0)!=(o|0)&&(o=o>>31&65535^65535),c=t+112|0,(e[c>>2]|0)<8&&P0(t),l=t+108|0,d=e[l>>2]|0,w=d>>>24,C=e[2832+(h<<11)+(w<<3)+4>>2]|0,C?(e[c>>2]=(e[c>>2]|0)-C,e[l>>2]=d<>2]|0):(c=X0(t)|0,(c|0)<47?h&&(c=(l0(t,h)|0)+(c<>31^c>>1,(((c|0)>-1?c:0-c|0)|0)>65535&&(o=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,H|0)|0,bt(8)),g=0,xe(7,o|0,5,35648),r=g,g=0,r&1?(r=j()|0,Tt(o|0),le(r|0)):Qt(o|0,824,96))),C=t+164+(D*12|0)+4|0,l=e[C>>2]|0,h?h=I[R>>1]|0:(t=I[R>>1]|0,h=t,c=(l<<1)+-1+(t<<16>>16)>>31^c),d=h<<16>>16==64,t=d&1,w=l+c>>t,d=d?32:h<<16>>16,e[N>>2]=((c|0)>-1?c:0-c|0)+(e[N>>2]|0)>>t,l=d+1|0,I[R>>1]=l,h=l+w|0,(h|0)<1?(R=I[k>>1]|0,I[k>>1]=(R&65535)-(R<<16>>16>-128&1),R=(h|0)>(~d|0)?h:0-d|0,e[C>>2]=R,_=c^_,r=r>>>31,r=o+r|0,r=r+_|0,r=r&65535,r|0):(w|0)<=0?(R=w,e[C>>2]=R,_=c^_,r=r>>>31,r=o+r|0,r=r+_|0,r=r&65535,r|0):(R=w-l|0,N=I[k>>1]|0,I[k>>1]=(N<<16>>16<127&1)+(N&65535),R=(R|0)>0?0:R,e[C>>2]=R,_=c^_,r=r>>>31,r=o+r|0,r=r+_|0,r=r&65535,r|0)}function Tu(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0;return h=t+4576|0,c=e[h>>2]|0,o=I[c+(r+-1<<1)>>1]|0,d=t+148|0,c=Iu(t,o,c+(r<<1)|0,(e[d>>2]|0)-r|0)|0,l=c+r|0,(l|0)==(e[d>>2]|0)?(d=c,d|0):(o=o&65535,r=M[(e[t+4572>>2]|0)+(l<<1)>>1]|0,d=o-r|0,(((d|0)>-1?d:0-d|0)|0)<1?o=(ys(t,t+4556|0)|0)+o|0:o=(ee(ys(t,t+4544|0)|0,r-o>>31|1)|0)+r|0,I[(e[h>>2]|0)+(l<<1)>>1]=o,d=t+4568|0,t=e[d>>2]|0,e[d>>2]=(t|0)<1?0:t+-1|0,d=c+1|0,d|0)}function Iu(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0;for(w=t+112|0,C=t+108|0,D=t+4568|0,c=e[w>>2]|0,h=0;;){if((c|0)<1&&(P0(t),c=e[w>>2]|0),d=e[C>>2]|0,c=c+-1|0,e[w>>2]=c,e[C>>2]=d<<1,(d|0)>=0){k=8;break}if(d=e[D>>2]|0,N=1<>2],R=l-h|0,R=(N|0)<(R|0)?N:R,h=R+h|0,(R|0)==(N|0)&&(e[D>>2]=(d|0)>30?31:d+1|0),(h|0)==(l|0)){c=l;break}}if((k|0)==8&&((h|0)!=(l|0)?(c=e[D>>2]|0,(c+-4|0)>>>0<28?c=l0(t,e[36476+(c<<2)>>2]|0)|0:c=0,c=c+h|0,(c|0)>(l|0)&&(c=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,H|0)|0,bt(8)),g=0,xe(7,c|0,5,35648),R=g,g=0,R&1?(R=j()|0,Tt(c|0),le(R|0)):Qt(c|0,824,96))):c=l),(c|0)>0)h=0;else return c|0;do I[o+(h<<1)>>1]=r,h=h+1|0;while((h|0)!=(c|0));return c|0}function ys(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0;if(w=r+9|0,o=F[w>>0]|0,h=r+4|0,c=(ee(o>>>1,e[h>>2]|0)|0)+(e[r>>2]|0)|0,(o|0)<(c|0)){l=0;do o=o<<1,l=l+1|0;while((o|0)<(c|0))}else l=0;c=e[36476+(e[t+4568>>2]<<2)>>2]|0,o=X0(t)|0;do if((o|0)<(46-c|0))if(l){o=(l0(t,l)|0)+(o<>2]|0,c=o+t|0,C=c&1,l=C,h=1,c=(C+c|0)/2|0;break}else{t=e[h>>2]|0,c=t+o|0,l=c&1,c=(l+c|0)/2|0,d=8;break}else o=(l0(t,16)|0)+1|0,t=e[h>>2]|0,c=o+t|0,h=c&1,c=(h+c|0)/2|0,l?(l=h,h=1):(l=h,d=8);while(!1);return(d|0)==8&&(h=F[r+10>>0]<<1>>>0>=(F[w>>0]|0)>>>0),c=(l|0)!=0^h?c:0-c|0,(c|0)<0&&(C=r+10|0,S[C>>0]=(F[C>>0]|0)+1),o=(o+1-t>>1)+(e[r>>2]|0)|0,e[r>>2]=o,l=S[w>>0]|0,l<<24>>24!=(S[r+8>>0]|0)?(C=l,C=C&255,C=C+1|0,C=C&255,S[w>>0]=C,c|0):(e[r>>2]=o>>1,C=(l&255)>>>1,S[w>>0]=C,r=r+10|0,S[r>>0]=(F[r>>0]|0)>>>1,C=C&255,C=C+1|0,C=C&255,S[w>>0]=C,c|0)}function Eu(t){t=t|0;var r=0,o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0;if(D=b,b=b+32|0,w=D,m0(w,65535,0),C=t+152|0,(e[w+4>>2]|0)==(e[C>>2]|0)&&(e[w+8>>2]|0)==(e[t+156>>2]|0)&&(e[w+12>>2]|0)==(e[t+160>>2]|0)){C=e[8909]|0,e[t+4580>>2]=C+(((e[8910]|0)-C|0)>>>1),b=D;return}for(o=t+4584|0,l=t+4588|0,c=e[l>>2]|0,r=e[o>>2]|0,h=c-r|0,h>>>0>=131072?h>>>0>131072&&(d=r+131072|0,(c|0)!=(d|0))&&(e[l>>2]=d):(j0(o,131072-h|0),r=e[o>>2]|0),w=t+4580|0,e[w>>2]=r+65536,d=t+160|0,c=t+156|0,h=-65536;;){if(r=e[d>>2]|0,(h|0)>(0-r|0))if(o=e[c>>2]|0,(h|0)>(0-o|0))if(l=e[C>>2]|0,(h|0)>(0-l|0))if((h|0)>=0){if((h|0)<1){S[(e[w>>2]|0)+h>>0]=0,h=1;continue}(l|0)<=(h|0)?(o|0)>(h|0)?r=2:r=(r|0)>(h|0)?3:4:r=1}else r=-1;else r=-2;else r=-3;else r=-4;if(S[(e[w>>2]|0)+h>>0]=r,h=h+1|0,(h|0)==65536)break}b=D}function ku(t){t=t|0;var r=0,o=0;e[t>>2]=35744,r=e[t+4584>>2]|0,r&&(o=t+4588|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),e[t>>2]=36736,r=e[t+92>>2]|0,r&&(o=t+96|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),t=t+88|0,r=e[t>>2]|0,e[t>>2]=0,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r)}function Du(t){t=t|0;var r=0,o=0;if(e[t>>2]=35744,r=e[t+4584>>2]|0,r&&(o=t+4588|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),e[t>>2]=36736,r=e[t+92>>2]|0,r&&(o=t+96|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),o=t+88|0,r=e[o>>2]|0,e[o>>2]=0,!r){he(t);return}Mt[e[(e[r>>2]|0)+4>>2]&255](r),he(t)}function bu(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0,G=0,$=0,P=0,O=0;if(G=b,b=b+352|0,$=G+328|0,P=G+192|0,o=G+343|0,l=G+342|0,c=G+341|0,h=G+340|0,R=G+176|0,w=G+168|0,C=G+160|0,D=G+152|0,K=G,U=G+136|0,e[t+28>>2]|0&&(e[t+20>>2]|0)!=1){if(_=t+4|0,Q=t+32|0,d=e[Q>>2]|0,!d){if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[o>>0]|0,$e(37,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}if(t=e[t+12>>2]|0,(t|0)==16)switch(d|0){case 1:{if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[l>>0]|0,$e(38,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 2:{if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[c>>0]|0,$e(39,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 3:{if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[h>>0]|0,$e(40,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}default:{d=P+56|0,c=P+4|0,e[P>>2]=36160,e[d>>2]=36180,g=0,Ae(62,P+56|0,c|0),G=g,g=0,G&1&&(O=j()|0,tt(d),le(O|0)),e[P+128>>2]=0,e[P+132>>2]=-1,e[P>>2]=36200,e[P+56>>2]=36220,g=0,ue(180,c|0),G=g,g=0;do if(G&1)t=j()|0;else{if(e[c>>2]=36236,h=P+36|0,e[h>>2]=0,e[h+4>>2]=0,e[h+8>>2]=0,e[h+12>>2]=0,e[P+52>>2]=16,e[$>>2]=0,e[$+4>>2]=0,e[$+8>>2]=0,g=0,Ae(63,c|0,$|0),G=g,g=0,G&1){t=j()|0,de($),de(h),wt(c);break}de($),g=0,t=Ve(28,P|0,49007,21)|0,$=g,g=0;do if(!($&1)&&(g=0,k=be(36,t|0,e[Q>>2]|0)|0,$=g,g=0,!($&1))&&(g=0,Ve(28,k|0,50997,18)|0,$=g,g=0,!($&1))){if(l=Ct(16)|0,g=0,Ae(64,R|0,c|0),$=g,g=0,$&1)t=j()|0;else if(!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,H|0)|0,bt(8)),g=0,$e(36,l|0,9,35648,R|0),$=g,g=0,$&1?o=1:(g=0,xe(6,l|0,824,96),g=0,o=0),t=j()|0,de(R),!o)break;Tt(l|0)}else O=34;while(!1);(O|0)==34&&(t=j()|0),e[P>>2]=36200,e[d>>2]=36220,e[c>>2]=36236,de(h),wt(c),tt(d),O=t,le(O|0)}while(!1);O=t,tt(d),le(O|0)}}switch((t|0)<=8&&(t=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,H|0)|0,bt(8)),g=0,xe(7,t|0,8,35648),O=g,g=0,O&1||Qt(t|0,824,96),O=j()|0,Tt(t|0),le(O|0)),o=16-t|0,d|0){case 1:{if(t=Xe(60)|0,e[w>>2]=o,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],e[$>>2]=e[w>>2],e[$+4>>2]=e[w+4>>2],$e(41,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 2:{if(t=Xe(60)|0,e[C>>2]=o,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],e[$>>2]=e[C>>2],e[$+4>>2]=e[C+4>>2],$e(42,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 3:{if(t=Xe(60)|0,e[D>>2]=o,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],e[$>>2]=e[D>>2],e[$+4>>2]=e[D+4>>2],$e(43,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}default:{d=K+56|0,c=K+4|0,e[K>>2]=36160,e[d>>2]=36180,g=0,Ae(62,K+56|0,c|0),P=g,g=0,P&1&&(O=j()|0,tt(d),le(O|0)),e[K+128>>2]=0,e[K+132>>2]=-1,e[K>>2]=36200,e[K+56>>2]=36220,g=0,ue(180,c|0),P=g,g=0;do if(P&1)t=j()|0;else{if(e[c>>2]=36236,h=K+36|0,e[h>>2]=0,e[h+4>>2]=0,e[h+8>>2]=0,e[h+12>>2]=0,e[K+52>>2]=16,e[$>>2]=0,e[$+4>>2]=0,e[$+8>>2]=0,g=0,Ae(63,c|0,$|0),P=g,g=0,P&1){t=j()|0,de($),de(h),wt(c);break}de($),g=0,t=Ve(28,K|0,49007,21)|0,P=g,g=0;do if(!(P&1)&&(g=0,N=be(36,t|0,e[Q>>2]|0)|0,P=g,g=0,!(P&1))&&(g=0,Ve(28,N|0,50997,18)|0,P=g,g=0,!(P&1))){if(l=Ct(16)|0,g=0,Ae(64,U|0,c|0),P=g,g=0,P&1)t=j()|0;else if(!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,H|0)|0,bt(8)),g=0,$e(36,l|0,9,35648,U|0),P=g,g=0,P&1?o=1:(g=0,xe(6,l|0,824,96),g=0,o=0),t=j()|0,de(U),!o)break;Tt(l|0)}else O=64;while(!1);(O|0)==64&&(t=j()|0),e[K>>2]=36200,e[d>>2]=36220,e[c>>2]=36236,de(h),wt(c),tt(d),O=t,le(O|0)}while(!1);O=t,tt(d),le(O|0)}}}return o=e[r+4>>2]|0,l=Xe(16)|0,t=e[t+16>>2]|0,o?(e[l>>2]=36108,e[l+4>>2]=o,e[l+8>>2]=2,e[l+12>>2]=t,O=l,b=G,O|0):(O=e[r>>2]|0,e[l>>2]=36132,e[l+4>>2]=O,e[l+8>>2]=2,e[l+12>>2]=t,O=l,b=G,O|0)}function Nu(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0;c=b,b=b+32|0,w=c,m0(w,4095,0),d=e[r+4>>2]|0,h=e[r+8>>2]|0,h=h|0?h:e[w+8>>2]|0,l=e[r+12>>2]|0,l=l|0?l:e[w+12>>2]|0,r=e[r+16>>2]|0,o=e[w+16>>2]|0,e[t+152>>2]=d|0?d:e[w+4>>2]|0,e[t+156>>2]=h,e[t+160>>2]=l,Ou(t),l=0;do e[t+164+(l*12|0)>>2]=64,e[t+164+(l*12|0)+4>>2]=0,I[t+164+(l*12|0)+8>>1]=0,I[t+164+(l*12|0)+10>>1]=1,l=l+1|0;while((l|0)!=365);w=(r|0?r:o)&255,e[t+4544>>2]=64,e[t+4548>>2]=0,S[t+4552>>0]=w,S[t+4553>>0]=1,S[t+4554>>0]=0,e[t+4556>>2]=64,e[t+4560>>2]=1,S[t+4564>>0]=w,S[t+4565>>0]=1,S[t+4566>>0]=0,e[t+4568>>2]=0,b=c}function Fu(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0;for(d=t+88|0,h=e[r>>2]|0,e[r>>2]=0,r=e[d>>2]|0,e[d>>2]=h,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r),d=l+4|0,h=e[d>>2]|0,S[t+4596>>0]=c&1,r=t+132|0,e[r>>2]=e[o>>2],e[r+4>>2]=e[o+4>>2],e[r+8>>2]=e[o+8>>2],e[r+12>>2]=e[o+12>>2],Y0(t,l),Ru(t),r=e[t+116>>2]|0,t=e[t+112>>2]|0;c=r+-1|0,o=(S[c>>0]|0)==-1?7:8,!((t|0)<(o|0));)r=c,t=t-o|0;r=r-h|0,c=e[d>>2]|0,c&&(e[d>>2]=c+r,l=l+8|0,e[l>>2]=(e[l>>2]|0)-r)}function Ru(t){t=t|0;var r=0,o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0,ce=0;ie=b,b=b+32|0,ne=ie+12|0,Z=ie,$=t+148|0,P=(e[$>>2]|0)+4|0,(e[t+28>>2]|0)==1?O=e[t+20>>2]|0:O=1,r=ee(O<<1,P)|0,e[ne>>2]=0,ce=ne+4|0,e[ce>>2]=0,e[ne+8>>2]=0;do if(r){if((r|0)<0&&(g=0,ue(178,ne|0),oe=g,g=0,oe&1)||(d=6),(d|0)==6&&(o=r<<1,g=0,l=ge(67,o|0)|0,oe=g,g=0,!(oe&1))){e[ne>>2]=l,oe=l+(r<<1)|0,e[ne+8>>2]=oe,Jt(l|0,0,o|0)|0,e[ce>>2]=oe;break}l=j()|0,r=e[ne>>2]|0,r||le(l|0),o=e[ce>>2]|0,(o|0)!=(r|0)&&(e[ce>>2]=o+(~((o+-2-r|0)>>>1)<<1)),he(r),le(l|0)}while(!1);e[Z>>2]=0,oe=Z+4|0,e[oe>>2]=0,e[Z+8>>2]=0;do if(!O)d=18;else{if(O>>>0>1073741823&&(g=0,ue(178,Z|0),G=g,g=0,G&1)||(d=16),(d|0)==16&&(c=O<<2,g=0,h=ge(67,c|0)|0,G=g,g=0,!(G&1))){e[Z>>2]=h,d=h+(O<<2)|0,e[Z+8>>2]=d,Jt(h|0,0,c|0)|0,e[oe>>2]=d,d=18;break}l=j()|0,r=e[Z>>2]|0,o=r,r&&(c=e[oe>>2]|0,(c|0)!=(r|0)&&(e[oe>>2]=c+(~((c+-4-o|0)>>>2)<<2)),he(r))}while(!1);if((d|0)==18){h=t+8|0;e:do if((e[h>>2]|0)>0){d=t+4572|0,w=ee(O,P)|0,C=w+1|0,D=t+4576|0,k=(O|0)>0,N=t+136|0,R=t+144|0,_=t+140|0,U=t+132|0,Q=t+88|0,K=t+4568|0,G=0;t:for(;;){if(l=e[ne>>2]|0,o=l+2|0,e[d>>2]=o,l=l+(C<<1)|0,e[D>>2]=l,G&1?(e[d>>2]=l,e[D>>2]=o,r=o,o=l):r=l,k){c=e[Z>>2]|0,l=0;do{if(e[K>>2]=e[c+(l<<2)>>2],c=e[$>>2]|0,I[o+(c<<1)>>1]=I[o+(c+-1<<1)>>1]|0,I[r+-2>>1]=I[o>>1]|0,g=0,Ae(80,t|0,0),c=g,g=0,c&1){d=29;break t}c=e[Z>>2]|0,e[c+(l<<2)>>2]=e[K>>2],o=(e[d>>2]|0)+(P<<1)|0,e[d>>2]=o,r=(e[D>>2]|0)+(P<<1)|0,e[D>>2]=r,l=l+1|0}while((l|0)<(O|0))}if(c=e[N>>2]|0,(c|0)<=(G|0)&&(G|0)<((e[R>>2]|0)+c|0)&&(c=e[Q>>2]|0,g=0,$e(e[(e[c>>2]|0)+8>>2]|0,c|0,r+((e[U>>2]|0)-w<<1)|0,e[_>>2]|0,P|0),c=g,g=0,c&1)){d=30;break}if(G=G+1|0,(G|0)>=(e[h>>2]|0)){d=42;break e}}if((d|0)==29){l=j()|0;break}else if((d|0)==30){l=j()|0;break}}else d=42;while(!1);do if((d|0)==42){if(g=0,ue(183,t|0),t=g,g=0,t&1){l=j()|0;break}if(r=e[Z>>2]|0,o=r,r&&(l=e[oe>>2]|0,(l|0)!=(r|0)&&(e[oe>>2]=l+(~((l+-4-o|0)>>>2)<<2)),he(r)),r=e[ne>>2]|0,!r){b=ie;return}o=e[ce>>2]|0,(o|0)!=(r|0)&&(e[ce>>2]=o+(~((o+-2-r|0)>>>1)<<1)),he(r),b=ie;return}while(!1);r=e[Z>>2]|0,o=r,r&&(c=e[oe>>2]|0,(c|0)!=(r|0)&&(e[oe>>2]=c+(~((c+-4-o|0)>>>2)<<2)),he(r))}r=e[ne>>2]|0,r||le(l|0),o=e[ce>>2]|0,(o|0)!=(r|0)&&(e[ce>>2]=o+(~((o+-2-r|0)>>>1)<<1)),he(r),le(l|0)}function Mu(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0;if(N=t+4572|0,r=e[N>>2]|0,U=t+148|0,!((e[U>>2]|0)<=0))for(R=t+4576|0,_=t+4580|0,c=r,h=M[r+-2>>1]|0,r=M[r>>1]|0,k=0;D=e[R>>2]|0,C=M[D+(k+-1<<1)>>1]|0,l=k+1|0,o=M[c+(l<<1)>>1]|0,w=e[_>>2]|0,d=r-h|0,c=h-C|0,w=((((S[w+(o-r)>>0]|0)*9|0)+(S[w+d>>0]|0)|0)*9|0)+(S[w+c>>0]|0)|0,w?(h=r-C>>31,(h^c|0)<0?c=r:c=C+((h^d|0)<0?0:d)|0,D=_u(t,w,M[D+(k<<1)>>1]|0,c,0)|0,I[(e[R>>2]|0)+(k<<1)>>1]=D):(l=(Pu(t,k,0)|0)+k|0,o=e[N>>2]|0,r=M[o+(l+-1<<1)>>1]|0,o=M[o+(l<<1)>>1]|0),!((l|0)>=(e[U>>2]|0));)c=e[N>>2]|0,h=r,r=o,k=l}function _u(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0;if(_=r>>31,D=(_^r)-_|0,R=t+164+(D*12|0)+10|0,o=I[R>>1]|0,N=t+164+(D*12|0)|0,c=e[N>>2]|0,(o|0)<(c|0))if((o<<1|0)<(c|0))if((o<<2|0)<(c|0))if((o<<3|0)<(c|0))if((o<<4|0)<(c|0))for(h=5;(o<>1]^_)-_+l|0,(o&4095|0)!=(o|0)&&(o=o>>31&4095^4095),c=t+112|0,(e[c>>2]|0)<8&&P0(t),l=t+108|0,d=e[l>>2]|0,w=d>>>24,C=e[2832+(h<<11)+(w<<3)+4>>2]|0,C?(e[c>>2]=(e[c>>2]|0)-C,e[l>>2]=d<>2]|0):(c=X0(t)|0,(c|0)<35?h&&(c=(l0(t,h)|0)+(c<>31^c>>1,(((c|0)>-1?c:0-c|0)|0)>65535&&(o=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,H|0)|0,bt(8)),g=0,xe(7,o|0,5,35648),r=g,g=0,r&1?(r=j()|0,Tt(o|0),le(r|0)):Qt(o|0,824,96))),C=t+164+(D*12|0)+4|0,l=e[C>>2]|0,h?h=I[R>>1]|0:(t=I[R>>1]|0,h=t,c=(l<<1)+-1+(t<<16>>16)>>31^c),d=h<<16>>16==64,t=d&1,w=l+c>>t,d=d?32:h<<16>>16,e[N>>2]=((c|0)>-1?c:0-c|0)+(e[N>>2]|0)>>t,l=d+1|0,I[R>>1]=l,h=l+w|0,(h|0)<1?(R=I[k>>1]|0,I[k>>1]=(R&65535)-(R<<16>>16>-128&1),R=(h|0)>(~d|0)?h:0-d|0,e[C>>2]=R,_=c^_,r=r>>>31,r=o+r|0,r=r+_|0,r=r&4095,r=r&65535,r|0):(w|0)<=0?(R=w,e[C>>2]=R,_=c^_,r=r>>>31,r=o+r|0,r=r+_|0,r=r&4095,r=r&65535,r|0):(R=w-l|0,N=I[k>>1]|0,I[k>>1]=(N<<16>>16<127&1)+(N&65535),R=(R|0)>0?0:R,e[C>>2]=R,_=c^_,r=r>>>31,r=o+r|0,r=r+_|0,r=r&4095,r=r&65535,r|0)}function Pu(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0;return h=t+4576|0,c=e[h>>2]|0,o=I[c+(r+-1<<1)>>1]|0,d=t+148|0,c=Lu(t,o,c+(r<<1)|0,(e[d>>2]|0)-r|0)|0,l=c+r|0,(l|0)==(e[d>>2]|0)?(d=c,d|0):(o=o&65535,r=M[(e[t+4572>>2]|0)+(l<<1)>>1]|0,d=o-r|0,(((d|0)>-1?d:0-d|0)|0)<1?o=(Cs(t,t+4556|0)|0)+o|0:o=(ee(Cs(t,t+4544|0)|0,r-o>>31|1)|0)+r|0,I[(e[h>>2]|0)+(l<<1)>>1]=o&4095,d=t+4568|0,t=e[d>>2]|0,e[d>>2]=(t|0)<1?0:t+-1|0,d=c+1|0,d|0)}function Lu(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0;for(w=t+112|0,C=t+108|0,D=t+4568|0,c=e[w>>2]|0,h=0;;){if((c|0)<1&&(P0(t),c=e[w>>2]|0),d=e[C>>2]|0,c=c+-1|0,e[w>>2]=c,e[C>>2]=d<<1,(d|0)>=0){k=8;break}if(d=e[D>>2]|0,N=1<>2],R=l-h|0,R=(N|0)<(R|0)?N:R,h=R+h|0,(R|0)==(N|0)&&(e[D>>2]=(d|0)>30?31:d+1|0),(h|0)==(l|0)){c=l;break}}if((k|0)==8&&((h|0)!=(l|0)?(c=e[D>>2]|0,(c+-4|0)>>>0<28?c=l0(t,e[36476+(c<<2)>>2]|0)|0:c=0,c=c+h|0,(c|0)>(l|0)&&(c=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,H|0)|0,bt(8)),g=0,xe(7,c|0,5,35648),R=g,g=0,R&1?(R=j()|0,Tt(c|0),le(R|0)):Qt(c|0,824,96))):c=l),(c|0)>0)h=0;else return c|0;do I[o+(h<<1)>>1]=r,h=h+1|0;while((h|0)!=(c|0));return c|0}function Cs(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0;if(w=r+9|0,o=F[w>>0]|0,h=r+4|0,c=(ee(o>>>1,e[h>>2]|0)|0)+(e[r>>2]|0)|0,(o|0)<(c|0)){l=0;do o=o<<1,l=l+1|0;while((o|0)<(c|0))}else l=0;c=e[36476+(e[t+4568>>2]<<2)>>2]|0,o=X0(t)|0;do if((o|0)<(34-c|0))if(l){o=(l0(t,l)|0)+(o<>2]|0,c=o+t|0,C=c&1,l=C,h=1,c=(C+c|0)/2|0;break}else{t=e[h>>2]|0,c=t+o|0,l=c&1,c=(l+c|0)/2|0,d=8;break}else o=(l0(t,12)|0)+1|0,t=e[h>>2]|0,c=o+t|0,h=c&1,c=(h+c|0)/2|0,l?(l=h,h=1):(l=h,d=8);while(!1);return(d|0)==8&&(h=F[r+10>>0]<<1>>>0>=(F[w>>0]|0)>>>0),c=(l|0)!=0^h?c:0-c|0,(c|0)<0&&(C=r+10|0,S[C>>0]=(F[C>>0]|0)+1),o=(o+1-t>>1)+(e[r>>2]|0)|0,e[r>>2]=o,l=S[w>>0]|0,l<<24>>24!=(S[r+8>>0]|0)?(C=l,C=C&255,C=C+1|0,C=C&255,S[w>>0]=C,c|0):(e[r>>2]=o>>1,C=(l&255)>>>1,S[w>>0]=C,r=r+10|0,S[r>>0]=(F[r>>0]|0)>>>1,C=C&255,C=C+1|0,C=C&255,S[w>>0]=C,c|0)}function Ou(t){t=t|0;var r=0,o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0;if(D=b,b=b+32|0,w=D,m0(w,4095,0),C=t+152|0,(e[w+4>>2]|0)==(e[C>>2]|0)&&(e[w+8>>2]|0)==(e[t+156>>2]|0)&&(e[w+12>>2]|0)==(e[t+160>>2]|0)){C=e[8906]|0,e[t+4580>>2]=C+(((e[8907]|0)-C|0)>>>1),b=D;return}for(o=t+4584|0,l=t+4588|0,c=e[l>>2]|0,r=e[o>>2]|0,h=c-r|0,h>>>0>=8192?h>>>0>8192&&(d=r+8192|0,(c|0)!=(d|0))&&(e[l>>2]=d):(j0(o,8192-h|0),r=e[o>>2]|0),w=t+4580|0,e[w>>2]=r+4096,d=t+160|0,c=t+156|0,h=-4096;;){if(r=e[d>>2]|0,(h|0)>(0-r|0))if(o=e[c>>2]|0,(h|0)>(0-o|0))if(l=e[C>>2]|0,(h|0)>(0-l|0))if((h|0)>=0){if((h|0)<1){S[(e[w>>2]|0)+h>>0]=0,h=1;continue}(l|0)<=(h|0)?(o|0)>(h|0)?r=2:r=(r|0)>(h|0)?3:4:r=1}else r=-1;else r=-2;else r=-3;else r=-4;if(S[(e[w>>2]|0)+h>>0]=r,h=h+1|0,(h|0)==4096)break}b=D}function $u(t){t=t|0;var r=0,o=0;e[t>>2]=35716,r=e[t+4584>>2]|0,r&&(o=t+4588|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),e[t>>2]=36736,r=e[t+92>>2]|0,r&&(o=t+96|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),t=t+88|0,r=e[t>>2]|0,e[t>>2]=0,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r)}function Bu(t){t=t|0;var r=0,o=0;if(e[t>>2]=35716,r=e[t+4584>>2]|0,r&&(o=t+4588|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),e[t>>2]=36736,r=e[t+92>>2]|0,r&&(o=t+96|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),o=t+88|0,r=e[o>>2]|0,e[o>>2]=0,!r){he(t);return}Mt[e[(e[r>>2]|0)+4>>2]&255](r),he(t)}function Vu(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0,G=0,$=0,P=0,O=0;if(G=b,b=b+352|0,$=G+328|0,P=G+192|0,o=G+343|0,l=G+342|0,c=G+341|0,h=G+340|0,R=G+176|0,w=G+168|0,C=G+160|0,D=G+152|0,K=G,U=G+136|0,e[t+28>>2]|0&&(e[t+20>>2]|0)!=1){if(_=t+4|0,Q=t+32|0,d=e[Q>>2]|0,!d){if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[o>>0]|0,$e(44,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}if(t=e[t+12>>2]|0,(t|0)==8)switch(d|0){case 1:{if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[l>>0]|0,$e(45,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 2:{if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[c>>0]|0,$e(46,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 3:{if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[h>>0]|0,$e(47,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}default:{d=P+56|0,c=P+4|0,e[P>>2]=36160,e[d>>2]=36180,g=0,Ae(62,P+56|0,c|0),G=g,g=0,G&1&&(O=j()|0,tt(d),le(O|0)),e[P+128>>2]=0,e[P+132>>2]=-1,e[P>>2]=36200,e[P+56>>2]=36220,g=0,ue(180,c|0),G=g,g=0;do if(G&1)t=j()|0;else{if(e[c>>2]=36236,h=P+36|0,e[h>>2]=0,e[h+4>>2]=0,e[h+8>>2]=0,e[h+12>>2]=0,e[P+52>>2]=16,e[$>>2]=0,e[$+4>>2]=0,e[$+8>>2]=0,g=0,Ae(63,c|0,$|0),G=g,g=0,G&1){t=j()|0,de($),de(h),wt(c);break}de($),g=0,t=Ve(28,P|0,49007,21)|0,$=g,g=0;do if(!($&1)&&(g=0,k=be(36,t|0,e[Q>>2]|0)|0,$=g,g=0,!($&1))&&(g=0,Ve(28,k|0,50997,18)|0,$=g,g=0,!($&1))){if(l=Ct(16)|0,g=0,Ae(64,R|0,c|0),$=g,g=0,$&1)t=j()|0;else if(!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,H|0)|0,bt(8)),g=0,$e(36,l|0,9,35648,R|0),$=g,g=0,$&1?o=1:(g=0,xe(6,l|0,824,96),g=0,o=0),t=j()|0,de(R),!o)break;Tt(l|0)}else O=34;while(!1);(O|0)==34&&(t=j()|0),e[P>>2]=36200,e[d>>2]=36220,e[c>>2]=36236,de(h),wt(c),tt(d),O=t,le(O|0)}while(!1);O=t,tt(d),le(O|0)}}switch((t|0)<=8&&(t=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,H|0)|0,bt(8)),g=0,xe(7,t|0,8,35648),O=g,g=0,O&1||Qt(t|0,824,96),O=j()|0,Tt(t|0),le(O|0)),o=16-t|0,d|0){case 1:{if(t=Xe(60)|0,e[w>>2]=o,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],e[$>>2]=e[w>>2],e[$+4>>2]=e[w+4>>2],$e(41,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 2:{if(t=Xe(60)|0,e[C>>2]=o,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],e[$>>2]=e[C>>2],e[$+4>>2]=e[C+4>>2],$e(42,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 3:{if(t=Xe(60)|0,e[D>>2]=o,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],e[$>>2]=e[D>>2],e[$+4>>2]=e[D+4>>2],$e(43,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}default:{d=K+56|0,c=K+4|0,e[K>>2]=36160,e[d>>2]=36180,g=0,Ae(62,K+56|0,c|0),P=g,g=0,P&1&&(O=j()|0,tt(d),le(O|0)),e[K+128>>2]=0,e[K+132>>2]=-1,e[K>>2]=36200,e[K+56>>2]=36220,g=0,ue(180,c|0),P=g,g=0;do if(P&1)t=j()|0;else{if(e[c>>2]=36236,h=K+36|0,e[h>>2]=0,e[h+4>>2]=0,e[h+8>>2]=0,e[h+12>>2]=0,e[K+52>>2]=16,e[$>>2]=0,e[$+4>>2]=0,e[$+8>>2]=0,g=0,Ae(63,c|0,$|0),P=g,g=0,P&1){t=j()|0,de($),de(h),wt(c);break}de($),g=0,t=Ve(28,K|0,49007,21)|0,P=g,g=0;do if(!(P&1)&&(g=0,N=be(36,t|0,e[Q>>2]|0)|0,P=g,g=0,!(P&1))&&(g=0,Ve(28,N|0,50997,18)|0,P=g,g=0,!(P&1))){if(l=Ct(16)|0,g=0,Ae(64,U|0,c|0),P=g,g=0,P&1)t=j()|0;else if(!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,H|0)|0,bt(8)),g=0,$e(36,l|0,9,35648,U|0),P=g,g=0,P&1?o=1:(g=0,xe(6,l|0,824,96),g=0,o=0),t=j()|0,de(U),!o)break;Tt(l|0)}else O=64;while(!1);(O|0)==64&&(t=j()|0),e[K>>2]=36200,e[d>>2]=36220,e[c>>2]=36236,de(h),wt(c),tt(d),O=t,le(O|0)}while(!1);O=t,tt(d),le(O|0)}}}return o=e[r+4>>2]|0,l=Xe(16)|0,t=e[t+16>>2]|0,o?(e[l>>2]=36108,e[l+4>>2]=o,e[l+8>>2]=1,e[l+12>>2]=t,O=l,b=G,O|0):(O=e[r>>2]|0,e[l>>2]=36132,e[l+4>>2]=O,e[l+8>>2]=1,e[l+12>>2]=t,O=l,b=G,O|0)}function Uu(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0;c=b,b=b+32|0,w=c,m0(w,255,0),d=e[r+4>>2]|0,h=e[r+8>>2]|0,h=h|0?h:e[w+8>>2]|0,l=e[r+12>>2]|0,l=l|0?l:e[w+12>>2]|0,r=e[r+16>>2]|0,o=e[w+16>>2]|0,e[t+152>>2]=d|0?d:e[w+4>>2]|0,e[t+156>>2]=h,e[t+160>>2]=l,Ku(t),l=0;do e[t+164+(l*12|0)>>2]=4,e[t+164+(l*12|0)+4>>2]=0,I[t+164+(l*12|0)+8>>1]=0,I[t+164+(l*12|0)+10>>1]=1,l=l+1|0;while((l|0)!=365);w=(r|0?r:o)&255,e[t+4544>>2]=4,e[t+4548>>2]=0,S[t+4552>>0]=w,S[t+4553>>0]=1,S[t+4554>>0]=0,e[t+4556>>2]=4,e[t+4560>>2]=1,S[t+4564>>0]=w,S[t+4565>>0]=1,S[t+4566>>0]=0,e[t+4568>>2]=0,b=c}function zu(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0;for(d=t+88|0,h=e[r>>2]|0,e[r>>2]=0,r=e[d>>2]|0,e[d>>2]=h,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r),d=l+4|0,h=e[d>>2]|0,S[t+4596>>0]=c&1,r=t+132|0,e[r>>2]=e[o>>2],e[r+4>>2]=e[o+4>>2],e[r+8>>2]=e[o+8>>2],e[r+12>>2]=e[o+12>>2],Y0(t,l),Gu(t),r=e[t+116>>2]|0,t=e[t+112>>2]|0;c=r+-1|0,o=(S[c>>0]|0)==-1?7:8,!((t|0)<(o|0));)r=c,t=t-o|0;r=r-h|0,c=e[d>>2]|0,c&&(e[d>>2]=c+r,l=l+8|0,e[l>>2]=(e[l>>2]|0)-r)}function Gu(t){t=t|0;var r=0,o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0,ce=0;ie=b,b=b+32|0,ne=ie+12|0,Z=ie,$=t+148|0,P=(e[$>>2]|0)+4|0,(e[t+28>>2]|0)==1?O=e[t+20>>2]|0:O=1,r=ee(O<<1,P)|0,e[ne>>2]=0,ce=ne+4|0,e[ce>>2]=0,e[ne+8>>2]=0;e:do if(r){if((r|0)<0&&(g=0,ue(178,ne|0),oe=g,g=0,oe&1)||(h=6),(h|0)==6&&(g=0,o=ge(67,r|0)|0,oe=g,g=0,!(oe&1))){for(e[ce>>2]=o,e[ne>>2]=o,e[ne+8>>2]=o+r;;)if(S[o>>0]=0,o=(e[ce>>2]|0)+1|0,e[ce>>2]=o,r=r+-1|0,!r)break e}o=j()|0,r=e[ne>>2]|0,r||le(o|0),(e[ce>>2]|0)!=(r|0)&&(e[ce>>2]=r),he(r),le(o|0)}while(!1);e[Z>>2]=0,oe=Z+4|0,e[oe>>2]=0,e[Z+8>>2]=0;do if(!O)h=19;else{if(O>>>0>1073741823&&(g=0,ue(178,Z|0),G=g,g=0,G&1)||(h=17),(h|0)==17&&(l=O<<2,g=0,c=ge(67,l|0)|0,G=g,g=0,!(G&1))){e[Z>>2]=c,h=c+(O<<2)|0,e[Z+8>>2]=h,Jt(c|0,0,l|0)|0,e[oe>>2]=h,h=19;break}o=j()|0,r=e[Z>>2]|0,l=r,r&&(c=e[oe>>2]|0,(c|0)!=(r|0)&&(e[oe>>2]=c+(~((c+-4-l|0)>>>2)<<2)),he(r))}while(!1);if((h|0)==19){h=t+8|0;e:do if((e[h>>2]|0)>0){d=t+4572|0,w=ee(O,P)|0,C=w+1|0,D=t+4576|0,k=(O|0)>0,N=t+136|0,R=t+144|0,_=t+140|0,U=t+132|0,Q=t+88|0,K=t+4568|0,G=0;t:for(;;){if(l=e[ne>>2]|0,o=l+1|0,e[d>>2]=o,l=l+C|0,e[D>>2]=l,G&1?(e[d>>2]=l,e[D>>2]=o,r=o,o=l):r=l,k){c=e[Z>>2]|0,l=0;do{if(e[K>>2]=e[c+(l<<2)>>2],c=e[$>>2]|0,S[o+c>>0]=S[o+(c+-1)>>0]|0,S[(e[D>>2]|0)+-1>>0]=S[e[d>>2]>>0]|0,g=0,Ae(81,t|0,0),c=g,g=0,c&1){h=30;break t}c=e[Z>>2]|0,e[c+(l<<2)>>2]=e[K>>2],o=(e[d>>2]|0)+P|0,e[d>>2]=o,r=(e[D>>2]|0)+P|0,e[D>>2]=r,l=l+1|0}while((l|0)<(O|0))}if(c=e[N>>2]|0,(c|0)<=(G|0)&&(G|0)<((e[R>>2]|0)+c|0)&&(c=e[Q>>2]|0,g=0,$e(e[(e[c>>2]|0)+8>>2]|0,c|0,r+((e[U>>2]|0)-w)|0,e[_>>2]|0,P|0),c=g,g=0,c&1)){h=31;break}if(G=G+1|0,(G|0)>=(e[h>>2]|0)){h=43;break e}}if((h|0)==30){o=j()|0;break}else if((h|0)==31){o=j()|0;break}}else h=43;while(!1);do if((h|0)==43){if(g=0,ue(183,t|0),t=g,g=0,t&1){o=j()|0;break}if(r=e[Z>>2]|0,o=r,r&&(l=e[oe>>2]|0,(l|0)!=(r|0)&&(e[oe>>2]=l+(~((l+-4-o|0)>>>2)<<2)),he(r)),r=e[ne>>2]|0,!r){b=ie;return}(e[ce>>2]|0)!=(r|0)&&(e[ce>>2]=r),he(r),b=ie;return}while(!1);r=e[Z>>2]|0,l=r,r&&(c=e[oe>>2]|0,(c|0)!=(r|0)&&(e[oe>>2]=c+(~((c+-4-l|0)>>>2)<<2)),he(r))}r=e[ne>>2]|0,r||le(o|0),(e[ce>>2]|0)!=(r|0)&&(e[ce>>2]=r),he(r),le(o|0)}function qu(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0;if(N=t+4572|0,r=e[N>>2]|0,U=t+148|0,!((e[U>>2]|0)<=0))for(R=t+4576|0,_=t+4580|0,c=r,h=F[r+-1>>0]|0,r=F[r>>0]|0,k=0;D=e[R>>2]|0,C=F[D+(k+-1)>>0]|0,l=k+1|0,o=F[c+l>>0]|0,w=e[_>>2]|0,d=r-h|0,c=h-C|0,w=((((S[w+(o-r)>>0]|0)*9|0)+(S[w+d>>0]|0)|0)*9|0)+(S[w+c>>0]|0)|0,w?(h=r-C>>31,(h^c|0)<0?c=r:c=C+((h^d|0)<0?0:d)|0,D=Wu(t,w,F[D+k>>0]|0,c,0)|0,S[(e[R>>2]|0)+k>>0]=D):(l=(Hu(t,k,0)|0)+k|0,o=e[N>>2]|0,r=F[o+(l+-1)>>0]|0,o=F[o+l>>0]|0),!((l|0)>=(e[U>>2]|0));)c=e[N>>2]|0,h=r,r=o,k=l}function Wu(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0;if(_=r>>31,D=(_^r)-_|0,R=t+164+(D*12|0)+10|0,o=I[R>>1]|0,N=t+164+(D*12|0)|0,c=e[N>>2]|0,(o|0)<(c|0))if((o<<1|0)<(c|0))if((o<<2|0)<(c|0))if((o<<3|0)<(c|0))if((o<<4|0)<(c|0))for(h=5;(o<>1]^_)-_+l|0,(o&255|0)!=(o|0)&&(o=o>>31&255^255),c=t+112|0,(e[c>>2]|0)<8&&P0(t),l=t+108|0,d=e[l>>2]|0,w=d>>>24,C=e[2832+(h<<11)+(w<<3)+4>>2]|0,C?(e[c>>2]=(e[c>>2]|0)-C,e[l>>2]=d<>2]|0):(c=X0(t)|0,(c|0)<23?h&&(c=(l0(t,h)|0)+(c<>31^c>>1,(((c|0)>-1?c:0-c|0)|0)>65535&&(o=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,H|0)|0,bt(8)),g=0,xe(7,o|0,5,35648),r=g,g=0,r&1?(r=j()|0,Tt(o|0),le(r|0)):Qt(o|0,824,96))),C=t+164+(D*12|0)+4|0,l=e[C>>2]|0,h?h=I[R>>1]|0:(t=I[R>>1]|0,h=t,c=(l<<1)+-1+(t<<16>>16)>>31^c),d=h<<16>>16==64,t=d&1,w=l+c>>t,d=d?32:h<<16>>16,e[N>>2]=((c|0)>-1?c:0-c|0)+(e[N>>2]|0)>>t,l=d+1|0,I[R>>1]=l,h=l+w|0,(h|0)<1?(R=I[k>>1]|0,I[k>>1]=(R&65535)-(R<<16>>16>-128&1),R=(h|0)>(~d|0)?h:0-d|0,e[C>>2]=R,_=c^_,r=r>>>31,r=o+r|0,r=r+_|0,r=r&255,r|0):(w|0)<=0?(R=w,e[C>>2]=R,_=c^_,r=r>>>31,r=o+r|0,r=r+_|0,r=r&255,r|0):(R=w-l|0,N=I[k>>1]|0,I[k>>1]=(N<<16>>16<127&1)+(N&65535),R=(R|0)>0?0:R,e[C>>2]=R,_=c^_,r=r>>>31,r=o+r|0,r=r+_|0,r=r&255,r|0)}function Hu(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0;return h=t+4576|0,c=e[h>>2]|0,o=S[c+(r+-1)>>0]|0,d=t+148|0,c=Qu(t,o,c+r|0,(e[d>>2]|0)-r|0)|0,l=c+r|0,(l|0)==(e[d>>2]|0)?(d=c,d|0):(o=o&255,r=F[(e[t+4572>>2]|0)+l>>0]|0,d=o-r|0,(((d|0)>-1?d:0-d|0)|0)<1?o=(Ts(t,t+4556|0)|0)+o|0:o=(ee(Ts(t,t+4544|0)|0,r-o>>31|1)|0)+r|0,S[(e[h>>2]|0)+l>>0]=o,d=t+4568|0,t=e[d>>2]|0,e[d>>2]=(t|0)<1?0:t+-1|0,d=c+1|0,d|0)}function Qu(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0;for(w=t+112|0,C=t+108|0,D=t+4568|0,c=e[w>>2]|0,h=0;;){if((c|0)<1&&(P0(t),c=e[w>>2]|0),d=e[C>>2]|0,c=c+-1|0,e[w>>2]=c,e[C>>2]=d<<1,(d|0)>=0){k=8;break}if(d=e[D>>2]|0,N=1<>2],R=l-h|0,R=(N|0)<(R|0)?N:R,h=R+h|0,(R|0)==(N|0)&&(e[D>>2]=(d|0)>30?31:d+1|0),(h|0)==(l|0)){c=l;break}}return(k|0)==8&&((h|0)!=(l|0)?(c=e[D>>2]|0,(c+-4|0)>>>0<28?c=l0(t,e[36476+(c<<2)>>2]|0)|0:c=0,c=c+h|0,(c|0)>(l|0)&&(c=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,H|0)|0,bt(8)),g=0,xe(7,c|0,5,35648),R=g,g=0,R&1?(R=j()|0,Tt(c|0),le(R|0)):Qt(c|0,824,96))):c=l),(c|0)<=0||Jt(o|0,r|0,c|0)|0,c|0}function Ts(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0;if(w=r+9|0,o=F[w>>0]|0,h=r+4|0,c=(ee(o>>>1,e[h>>2]|0)|0)+(e[r>>2]|0)|0,(o|0)<(c|0)){l=0;do o=o<<1,l=l+1|0;while((o|0)<(c|0))}else l=0;c=e[36476+(e[t+4568>>2]<<2)>>2]|0,o=X0(t)|0;do if((o|0)<(22-c|0))if(l){o=(l0(t,l)|0)+(o<>2]|0,c=o+t|0,C=c&1,l=C,h=1,c=(C+c|0)/2|0;break}else{t=e[h>>2]|0,c=t+o|0,l=c&1,c=(l+c|0)/2|0,d=8;break}else o=(l0(t,8)|0)+1|0,t=e[h>>2]|0,c=o+t|0,h=c&1,c=(h+c|0)/2|0,l?(l=h,h=1):(l=h,d=8);while(!1);return(d|0)==8&&(h=F[r+10>>0]<<1>>>0>=(F[w>>0]|0)>>>0),c=(l|0)!=0^h?c:0-c|0,(c|0)<0&&(C=r+10|0,S[C>>0]=(F[C>>0]|0)+1),o=(o+1-t>>1)+(e[r>>2]|0)|0,e[r>>2]=o,l=S[w>>0]|0,l<<24>>24!=(S[r+8>>0]|0)?(C=l,C=C&255,C=C+1|0,C=C&255,S[w>>0]=C,c|0):(e[r>>2]=o>>1,C=(l&255)>>>1,S[w>>0]=C,r=r+10|0,S[r>>0]=(F[r>>0]|0)>>>1,C=C&255,C=C+1|0,C=C&255,S[w>>0]=C,c|0)}function Ku(t){t=t|0;var r=0,o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0;if(D=b,b=b+32|0,w=D,m0(w,255,0),C=t+152|0,(e[w+4>>2]|0)==(e[C>>2]|0)&&(e[w+8>>2]|0)==(e[t+156>>2]|0)&&(e[w+12>>2]|0)==(e[t+160>>2]|0)){C=e[8900]|0,e[t+4580>>2]=C+(((e[8901]|0)-C|0)>>>1),b=D;return}for(o=t+4584|0,l=t+4588|0,c=e[l>>2]|0,r=e[o>>2]|0,h=c-r|0,h>>>0>=512?h>>>0>512&&(d=r+512|0,(c|0)!=(d|0))&&(e[l>>2]=d):(j0(o,512-h|0),r=e[o>>2]|0),w=t+4580|0,e[w>>2]=r+256,d=t+160|0,c=t+156|0,h=-256;;){if(r=e[d>>2]|0,(h|0)>(0-r|0))if(o=e[c>>2]|0,(h|0)>(0-o|0))if(l=e[C>>2]|0,(h|0)>(0-l|0))if((h|0)>=0){if((h|0)<1){S[(e[w>>2]|0)+h>>0]=0,h=1;continue}(l|0)<=(h|0)?(o|0)>(h|0)?r=2:r=(r|0)>(h|0)?3:4:r=1}else r=-1;else r=-2;else r=-3;else r=-4;if(S[(e[w>>2]|0)+h>>0]=r,h=h+1|0,(h|0)==256)break}b=D}function Yu(t){t=t|0;var r=0,o=0;e[t>>2]=35688,r=e[t+4584>>2]|0,r&&(o=t+4588|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),e[t>>2]=36736,r=e[t+92>>2]|0,r&&(o=t+96|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),t=t+88|0,r=e[t>>2]|0,e[t>>2]=0,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r)}function ju(t){t=t|0;var r=0,o=0;if(e[t>>2]=35688,r=e[t+4584>>2]|0,r&&(o=t+4588|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),e[t>>2]=36736,r=e[t+92>>2]|0,r&&(o=t+96|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),o=t+88|0,r=e[o>>2]|0,e[o>>2]=0,!r){he(t);return}Mt[e[(e[r>>2]|0)+4>>2]&255](r),he(t)}function Xu(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0,G=0,$=0,P=0,O=0;if(G=b,b=b+352|0,$=G+328|0,P=G+192|0,o=G+343|0,l=G+342|0,c=G+341|0,h=G+340|0,R=G+176|0,w=G+168|0,C=G+160|0,D=G+152|0,K=G,U=G+136|0,e[t+28>>2]|0&&(e[t+20>>2]|0)!=1){if(_=t+4|0,Q=t+32|0,d=e[Q>>2]|0,!d){if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[o>>0]|0,$e(44,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}if(t=e[t+12>>2]|0,(t|0)==8)switch(d|0){case 1:{if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[l>>0]|0,$e(45,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 2:{if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[c>>0]|0,$e(46,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 3:{if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[h>>0]|0,$e(47,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}default:{d=P+56|0,c=P+4|0,e[P>>2]=36160,e[d>>2]=36180,g=0,Ae(62,P+56|0,c|0),G=g,g=0,G&1&&(O=j()|0,tt(d),le(O|0)),e[P+128>>2]=0,e[P+132>>2]=-1,e[P>>2]=36200,e[P+56>>2]=36220,g=0,ue(180,c|0),G=g,g=0;do if(G&1)t=j()|0;else{if(e[c>>2]=36236,h=P+36|0,e[h>>2]=0,e[h+4>>2]=0,e[h+8>>2]=0,e[h+12>>2]=0,e[P+52>>2]=16,e[$>>2]=0,e[$+4>>2]=0,e[$+8>>2]=0,g=0,Ae(63,c|0,$|0),G=g,g=0,G&1){t=j()|0,de($),de(h),wt(c);break}de($),g=0,t=Ve(28,P|0,49007,21)|0,$=g,g=0;do if(!($&1)&&(g=0,k=be(36,t|0,e[Q>>2]|0)|0,$=g,g=0,!($&1))&&(g=0,Ve(28,k|0,50997,18)|0,$=g,g=0,!($&1))){if(l=Ct(16)|0,g=0,Ae(64,R|0,c|0),$=g,g=0,$&1)t=j()|0;else if(!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,H|0)|0,bt(8)),g=0,$e(36,l|0,9,35648,R|0),$=g,g=0,$&1?o=1:(g=0,xe(6,l|0,824,96),g=0,o=0),t=j()|0,de(R),!o)break;Tt(l|0)}else O=34;while(!1);(O|0)==34&&(t=j()|0),e[P>>2]=36200,e[d>>2]=36220,e[c>>2]=36236,de(h),wt(c),tt(d),O=t,le(O|0)}while(!1);O=t,tt(d),le(O|0)}}switch((t|0)<=8&&(t=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,H|0)|0,bt(8)),g=0,xe(7,t|0,8,35648),O=g,g=0,O&1||Qt(t|0,824,96),O=j()|0,Tt(t|0),le(O|0)),o=16-t|0,d|0){case 1:{if(t=Xe(60)|0,e[w>>2]=o,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],e[$>>2]=e[w>>2],e[$+4>>2]=e[w+4>>2],$e(41,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 2:{if(t=Xe(60)|0,e[C>>2]=o,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],e[$>>2]=e[C>>2],e[$+4>>2]=e[C+4>>2],$e(42,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 3:{if(t=Xe(60)|0,e[D>>2]=o,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],e[$>>2]=e[D>>2],e[$+4>>2]=e[D+4>>2],$e(43,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}default:{d=K+56|0,c=K+4|0,e[K>>2]=36160,e[d>>2]=36180,g=0,Ae(62,K+56|0,c|0),P=g,g=0,P&1&&(O=j()|0,tt(d),le(O|0)),e[K+128>>2]=0,e[K+132>>2]=-1,e[K>>2]=36200,e[K+56>>2]=36220,g=0,ue(180,c|0),P=g,g=0;do if(P&1)t=j()|0;else{if(e[c>>2]=36236,h=K+36|0,e[h>>2]=0,e[h+4>>2]=0,e[h+8>>2]=0,e[h+12>>2]=0,e[K+52>>2]=16,e[$>>2]=0,e[$+4>>2]=0,e[$+8>>2]=0,g=0,Ae(63,c|0,$|0),P=g,g=0,P&1){t=j()|0,de($),de(h),wt(c);break}de($),g=0,t=Ve(28,K|0,49007,21)|0,P=g,g=0;do if(!(P&1)&&(g=0,N=be(36,t|0,e[Q>>2]|0)|0,P=g,g=0,!(P&1))&&(g=0,Ve(28,N|0,50997,18)|0,P=g,g=0,!(P&1))){if(l=Ct(16)|0,g=0,Ae(64,U|0,c|0),P=g,g=0,P&1)t=j()|0;else if(!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,H|0)|0,bt(8)),g=0,$e(36,l|0,9,35648,U|0),P=g,g=0,P&1?o=1:(g=0,xe(6,l|0,824,96),g=0,o=0),t=j()|0,de(U),!o)break;Tt(l|0)}else O=64;while(!1);(O|0)==64&&(t=j()|0),e[K>>2]=36200,e[d>>2]=36220,e[c>>2]=36236,de(h),wt(c),tt(d),O=t,le(O|0)}while(!1);O=t,tt(d),le(O|0)}}}return o=e[r+4>>2]|0,l=Xe(16)|0,t=e[t+16>>2]|0,o?(e[l>>2]=36108,e[l+4>>2]=o,e[l+8>>2]=3,e[l+12>>2]=t,O=l,b=G,O|0):(O=e[r>>2]|0,e[l>>2]=36132,e[l+4>>2]=O,e[l+8>>2]=3,e[l+12>>2]=t,O=l,b=G,O|0)}function Zu(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0;c=b,b=b+32|0,w=c,m0(w,255,0),d=e[r+4>>2]|0,h=e[r+8>>2]|0,h=h|0?h:e[w+8>>2]|0,l=e[r+12>>2]|0,l=l|0?l:e[w+12>>2]|0,r=e[r+16>>2]|0,o=e[w+16>>2]|0,e[t+152>>2]=d|0?d:e[w+4>>2]|0,e[t+156>>2]=h,e[t+160>>2]=l,q5(t),l=0;do e[t+164+(l*12|0)>>2]=4,e[t+164+(l*12|0)+4>>2]=0,I[t+164+(l*12|0)+8>>1]=0,I[t+164+(l*12|0)+10>>1]=1,l=l+1|0;while((l|0)!=365);w=(r|0?r:o)&255,e[t+4544>>2]=4,e[t+4548>>2]=0,S[t+4552>>0]=w,S[t+4553>>0]=1,S[t+4554>>0]=0,e[t+4556>>2]=4,e[t+4560>>2]=1,S[t+4564>>0]=w,S[t+4565>>0]=1,S[t+4566>>0]=0,e[t+4568>>2]=0,b=c}function Ju(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0;for(d=t+88|0,h=e[r>>2]|0,e[r>>2]=0,r=e[d>>2]|0,e[d>>2]=h,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r),d=l+4|0,h=e[d>>2]|0,S[t+4596>>0]=c&1,r=t+132|0,e[r>>2]=e[o>>2],e[r+4>>2]=e[o+4>>2],e[r+8>>2]=e[o+8>>2],e[r+12>>2]=e[o+12>>2],Y0(t,l),tc(t),r=e[t+116>>2]|0,t=e[t+112>>2]|0;c=r+-1|0,o=(S[c>>0]|0)==-1?7:8,!((t|0)<(o|0));)r=c,t=t-o|0;r=r-h|0,c=e[d>>2]|0,c&&(e[d>>2]=c+r,l=l+8|0,e[l>>2]=(e[l>>2]|0)-r)}function tc(t){t=t|0;var r=0,o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0,ce=0;ie=b,b=b+32|0,ne=ie+12|0,Z=ie,$=t+148|0,P=(e[$>>2]|0)+4|0,(e[t+28>>2]|0)==1?O=e[t+20>>2]|0:O=1,r=ee(O<<1,P)|0,e[ne>>2]=0,ce=ne+4|0,e[ce>>2]=0,e[ne+8>>2]=0;e:do if(r){if(r>>>0>1431655765&&(g=0,ue(178,ne|0),oe=g,g=0,oe&1)||(h=6),(h|0)==6&&(g=0,o=ge(67,r*3|0)|0,oe=g,g=0,!(oe&1))){for(e[ce>>2]=o,e[ne>>2]=o,e[ne+8>>2]=o+(r*3|0);;)if(S[o>>0]=0,S[o+1>>0]=0,S[o+2>>0]=0,o=(e[ce>>2]|0)+3|0,e[ce>>2]=o,r=r+-1|0,!r)break e}l=j()|0,r=e[ne>>2]|0,r||le(l|0),o=e[ce>>2]|0,(o|0)!=(r|0)&&(e[ce>>2]=o+(~(((o+-3-r|0)>>>0)/3|0)*3|0)),he(r),le(l|0)}while(!1);e[Z>>2]=0,oe=Z+4|0,e[oe>>2]=0,e[Z+8>>2]=0;do if(!O)h=19;else{if(O>>>0>1073741823&&(g=0,ue(178,Z|0),G=g,g=0,G&1)||(h=17),(h|0)==17&&(l=O<<2,g=0,c=ge(67,l|0)|0,G=g,g=0,!(G&1))){e[Z>>2]=c,h=c+(O<<2)|0,e[Z+8>>2]=h,Jt(c|0,0,l|0)|0,e[oe>>2]=h,h=19;break}l=j()|0,r=e[Z>>2]|0,o=r,r&&(c=e[oe>>2]|0,(c|0)!=(r|0)&&(e[oe>>2]=c+(~((c+-4-o|0)>>>2)<<2)),he(r))}while(!1);if((h|0)==19){h=t+8|0;e:do if((e[h>>2]|0)>0){d=t+4572|0,w=ee(O,P)|0,C=w+1|0,D=t+4576|0,k=(O|0)>0,N=t+136|0,R=t+144|0,_=t+140|0,U=t+132|0,Q=t+88|0,K=t+4568|0,G=0;t:for(;;){if(l=e[ne>>2]|0,o=l+3|0,e[d>>2]=o,l=l+(C*3|0)|0,e[D>>2]=l,G&1?(e[d>>2]=l,e[D>>2]=o,r=o,o=l):r=l,k){c=e[Z>>2]|0,l=0;do{if(e[K>>2]=e[c+(l<<2)>>2],r=e[$>>2]|0,c=o+(r*3|0)|0,o=o+((r+-1|0)*3|0)|0,S[c>>0]=S[o>>0]|0,S[c+1>>0]=S[o+1>>0]|0,S[c+2>>0]=S[o+2>>0]|0,o=e[d>>2]|0,c=(e[D>>2]|0)+-3|0,S[c>>0]=S[o>>0]|0,S[c+1>>0]=S[o+1>>0]|0,S[c+2>>0]=S[o+2>>0]|0,g=0,Ae(82,t|0,0),c=g,g=0,c&1){h=30;break t}c=e[Z>>2]|0,e[c+(l<<2)>>2]=e[K>>2],o=(e[d>>2]|0)+(P*3|0)|0,e[d>>2]=o,r=(e[D>>2]|0)+(P*3|0)|0,e[D>>2]=r,l=l+1|0}while((l|0)<(O|0))}if(c=e[N>>2]|0,(c|0)<=(G|0)&&(G|0)<((e[R>>2]|0)+c|0)&&(c=e[Q>>2]|0,g=0,$e(e[(e[c>>2]|0)+8>>2]|0,c|0,r+(((e[U>>2]|0)-w|0)*3|0)|0,e[_>>2]|0,P|0),c=g,g=0,c&1)){h=31;break}if(G=G+1|0,(G|0)>=(e[h>>2]|0)){h=43;break e}}if((h|0)==30){l=j()|0;break}else if((h|0)==31){l=j()|0;break}}else h=43;while(!1);do if((h|0)==43){if(g=0,ue(183,t|0),t=g,g=0,t&1){l=j()|0;break}if(r=e[Z>>2]|0,o=r,r&&(l=e[oe>>2]|0,(l|0)!=(r|0)&&(e[oe>>2]=l+(~((l+-4-o|0)>>>2)<<2)),he(r)),r=e[ne>>2]|0,!r){b=ie;return}o=e[ce>>2]|0,(o|0)!=(r|0)&&(e[ce>>2]=o+(~(((o+-3-r|0)>>>0)/3|0)*3|0)),he(r),b=ie;return}while(!1);r=e[Z>>2]|0,o=r,r&&(c=e[oe>>2]|0,(c|0)!=(r|0)&&(e[oe>>2]=c+(~((c+-4-o|0)>>>2)<<2)),he(r))}r=e[ne>>2]|0,r||le(l|0),o=e[ce>>2]|0,(o|0)!=(r|0)&&(e[ce>>2]=o+(~(((o+-3-r|0)>>>0)/3|0)*3|0)),he(r),le(l|0)}function ic(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0,ce=0,ke=0;if(oe=t+148|0,!((e[oe>>2]|0)<=0))for(ne=t+4576|0,ce=t+4572|0,ke=t+4580|0,ie=0;P=ie+-1|0,h=e[ne>>2]|0,d=e[ce>>2]|0,r=ie+1|0,c=F[d+(ie*3|0)>>0]|0,Z=e[ke>>2]|0,w=F[d+(P*3|0)>>0]|0,C=c-w|0,D=F[h+(P*3|0)>>0]|0,k=w-D|0,N=((((S[Z+((F[d+(r*3|0)>>0]|0)-c)>>0]|0)*9|0)+(S[Z+C>>0]|0)|0)*9|0)+(S[Z+k>>0]|0)|0,l=F[d+(ie*3|0)+1>>0]|0,R=F[d+(P*3|0)+1>>0]|0,_=l-R|0,U=F[h+(P*3|0)+1>>0]|0,Q=R-U|0,K=((((S[Z+((F[d+(r*3|0)+1>>0]|0)-l)>>0]|0)*9|0)+(S[Z+_>>0]|0)|0)*9|0)+(S[Z+Q>>0]|0)|0,o=F[d+(ie*3|0)+2>>0]|0,G=F[d+(P*3|0)+2>>0]|0,$=o-G|0,P=F[h+(P*3|0)+2>>0]|0,O=G-P|0,Z=((((S[Z+((F[d+(r*3|0)+2>>0]|0)-o)>>0]|0)*9|0)+(S[Z+$>>0]|0)|0)*9|0)+(S[Z+O>>0]|0)|0,K|N|Z?(d=F[h+(ie*3|0)>>0]|0,h=c-D>>31,(h^k|0)>=0&&((h^C|0)<0?c=D:c=D-w+c|0),d=ar(t,N,d,c,0)|0,h=F[(e[ne>>2]|0)+(ie*3|0)+1>>0]|0,c=l-U>>31,(c^Q|0)>=0&&((c^_|0)<0?l=U:l=U-R+l|0),c=ar(t,K,h,l,0)|0,h=F[(e[ne>>2]|0)+(ie*3|0)+2>>0]|0,l=o-P>>31,(l^O|0)>=0&&((l^$|0)<0?o=P:o=P-G+o|0),Z=ar(t,Z,h,o,0)|0,ie=(e[ne>>2]|0)+(ie*3|0)|0,S[ie>>0]=d,S[ie+1>>0]=c,S[ie+2>>0]=Z):r=(nc(t,ie,0)|0)+ie|0,(r|0)<(e[oe>>2]|0);)ie=r}function nc(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0;return C=b,b=b+16|0,k=C+3|0,N=C,h=t+4576|0,o=e[h>>2]|0,l=o+((r+-1|0)*3|0)|0,d=S[l>>0]|0,w=S[l+1>>0]|0,l=S[l+2>>0]|0,S[N>>0]=d,S[N+1>>0]=w,S[N+2>>0]=l,D=t+148|0,c=(e[D>>2]|0)-r|0,S[k>>0]=S[N>>0]|0,S[k+1>>0]=S[N+1>>0]|0,S[k+2>>0]=S[N+2>>0]|0,c=rc(t,k,o+(r*3|0)|0,c)|0,o=c+r|0,(o|0)==(e[D>>2]|0)?(N=c,b=C,N|0):(k=(e[t+4572>>2]|0)+(o*3|0)|0,r=S[k>>0]|0,D=S[k+1>>0]|0,k=S[k+2>>0]|0,N=e[h>>2]|0,h=t+4544|0,_=lr(t,h)|0,R=lr(t,h)|0,r=r&255,r=(ee(r-(d&255)>>31|1,_)|0)+r&255,D=D&255,D=(ee(D-(w&255)>>31|1,R)|0)+D&255,k=k&255,k=(ee(k-(l&255)>>31|1,lr(t,h)|0)|0)+k&255,N=N+(o*3|0)|0,S[N>>0]=r,S[N+1>>0]=D,S[N+2>>0]=k,N=t+4568|0,k=e[N>>2]|0,e[N>>2]=(k|0)<1?0:k+-1|0,N=c+1|0,b=C,N|0)}function ar(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0;if(_=r>>31,D=(_^r)-_|0,R=t+164+(D*12|0)+10|0,o=I[R>>1]|0,N=t+164+(D*12|0)|0,c=e[N>>2]|0,(o|0)<(c|0))if((o<<1|0)<(c|0))if((o<<2|0)<(c|0))if((o<<3|0)<(c|0))if((o<<4|0)<(c|0))for(h=5;(o<>1]^_)-_+l|0,(o&255|0)!=(o|0)&&(o=o>>31&255^255),c=t+112|0,(e[c>>2]|0)<8&&P0(t),l=t+108|0,d=e[l>>2]|0,w=d>>>24,C=e[2832+(h<<11)+(w<<3)+4>>2]|0,C?(e[c>>2]=(e[c>>2]|0)-C,e[l>>2]=d<>2]|0):(c=X0(t)|0,(c|0)<23?h&&(c=(l0(t,h)|0)+(c<>31^c>>1,(((c|0)>-1?c:0-c|0)|0)>65535&&(o=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,H|0)|0,bt(8)),g=0,xe(7,o|0,5,35648),r=g,g=0,r&1?(r=j()|0,Tt(o|0),le(r|0)):Qt(o|0,824,96))),C=t+164+(D*12|0)+4|0,l=e[C>>2]|0,h?h=I[R>>1]|0:(t=I[R>>1]|0,h=t,c=(l<<1)+-1+(t<<16>>16)>>31^c),d=h<<16>>16==64,t=d&1,w=l+c>>t,d=d?32:h<<16>>16,e[N>>2]=((c|0)>-1?c:0-c|0)+(e[N>>2]|0)>>t,l=d+1|0,I[R>>1]=l,h=l+w|0,(h|0)<1?(R=I[k>>1]|0,I[k>>1]=(R&65535)-(R<<16>>16>-128&1),R=(h|0)>(~d|0)?h:0-d|0,e[C>>2]=R,_=c^_,r=r>>>31,r=o+r|0,r=r+_|0,r=r&255,r|0):(w|0)<=0?(R=w,e[C>>2]=R,_=c^_,r=r>>>31,r=o+r|0,r=r+_|0,r=r&255,r|0):(R=w-l|0,N=I[k>>1]|0,I[k>>1]=(N<<16>>16<127&1)+(N&65535),R=(R|0)>0?0:R,e[C>>2]=R,_=c^_,r=r>>>31,r=o+r|0,r=r+_|0,r=r&255,r|0)}function rc(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0;for(w=t+112|0,C=t+108|0,D=t+4568|0,c=e[w>>2]|0,h=0;;){if((c|0)<1&&(P0(t),c=e[w>>2]|0),d=e[C>>2]|0,c=c+-1|0,e[w>>2]=c,e[C>>2]=d<<1,(d|0)>=0){k=8;break}if(d=e[D>>2]|0,N=1<>2],R=l-h|0,R=(N|0)<(R|0)?N:R,h=R+h|0,(R|0)==(N|0)&&(e[D>>2]=(d|0)>30?31:d+1|0),(h|0)==(l|0)){c=l;break}}if((k|0)==8&&((h|0)!=(l|0)?(c=e[D>>2]|0,(c+-4|0)>>>0<28?c=l0(t,e[36476+(c<<2)>>2]|0)|0:c=0,c=c+h|0,(c|0)>(l|0)&&(c=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,H|0)|0,bt(8)),g=0,xe(7,c|0,5,35648),R=g,g=0,R&1?(R=j()|0,Tt(c|0),le(R|0)):Qt(c|0,824,96))):c=l),(c|0)<=0)return c|0;h=0;do R=o+(h*3|0)|0,S[R>>0]=S[r>>0]|0,S[R+1>>0]=S[r+1>>0]|0,S[R+2>>0]=S[r+2>>0]|0,h=h+1|0;while((h|0)!=(c|0));return c|0}function lr(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0;if(w=r+9|0,o=F[w>>0]|0,h=r+4|0,c=(ee(o>>>1,e[h>>2]|0)|0)+(e[r>>2]|0)|0,(o|0)<(c|0)){l=0;do o=o<<1,l=l+1|0;while((o|0)<(c|0))}else l=0;c=e[36476+(e[t+4568>>2]<<2)>>2]|0,o=X0(t)|0;do if((o|0)<(22-c|0))if(l){o=(l0(t,l)|0)+(o<>2]|0,c=o+t|0,C=c&1,l=C,h=1,c=(C+c|0)/2|0;break}else{t=e[h>>2]|0,c=t+o|0,l=c&1,c=(l+c|0)/2|0,d=8;break}else o=(l0(t,8)|0)+1|0,t=e[h>>2]|0,c=o+t|0,h=c&1,c=(h+c|0)/2|0,l?(l=h,h=1):(l=h,d=8);while(!1);return(d|0)==8&&(h=F[r+10>>0]<<1>>>0>=(F[w>>0]|0)>>>0),c=(l|0)!=0^h?c:0-c|0,(c|0)<0&&(C=r+10|0,S[C>>0]=(F[C>>0]|0)+1),o=(o+1-t>>1)+(e[r>>2]|0)|0,e[r>>2]=o,l=S[w>>0]|0,l<<24>>24!=(S[r+8>>0]|0)?(C=l,C=C&255,C=C+1|0,C=C&255,S[w>>0]=C,c|0):(e[r>>2]=o>>1,C=(l&255)>>>1,S[w>>0]=C,r=r+10|0,S[r>>0]=(F[r>>0]|0)>>>1,C=C&255,C=C+1|0,C=C&255,S[w>>0]=C,c|0)}function sc(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0;if(k=b,b=b+128|0,h=k,R=k+116|0,_=k+104|0,w=k+20|0,D=k+16|0,C=k+12|0,N=k+8|0,d=k+4|0,S[R>>0]=S[58887]|0,S[R+1>>0]=S[58888]|0,S[R+2>>0]=S[58889]|0,S[R+3>>0]=S[58890]|0,S[R+4>>0]=S[58891]|0,S[R+5>>0]=S[58892]|0,ki(R+1|0,58893,0,e[o+4>>2]|0),t=b0()|0,e[h>>2]=c,c=_+(q0(_,12,t,R,h)|0)|0,R=ri(_,c,o)|0,t=f0(o)|0,e[N>>2]=t,g=0,ht(3,_|0,R|0,c|0,w|0,D|0,C|0,N|0),c=g,g=0,c&1)_=j()|0,Bt(t)|0,le(_|0);else return Bt(t)|0,e[d>>2]=e[r>>2],R=e[D>>2]|0,_=e[C>>2]|0,e[h>>2]=e[d>>2],_=Hi(h,w,R,_,o,l)|0,b=k,_|0;return 0}function oc(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0;if(N=b,b=b+240|0,d=N+8|0,t=N,_=N+204|0,C=N+32|0,k=N+28|0,D=N+24|0,R=N+20|0,w=N+16|0,U=t,e[U>>2]=37,e[U+4>>2]=0,ki(t+1|0,58895,0,e[o+4>>2]|0),U=b0()|0,Q=d,e[Q>>2]=c,e[Q+4>>2]=h,h=_+(q0(_,23,U,t,d)|0)|0,c=ri(_,h,o)|0,t=f0(o)|0,e[R>>2]=t,g=0,ht(3,_|0,c|0,h|0,C|0,k|0,D|0,R|0),h=g,g=0,h&1)Q=j()|0,Bt(t)|0,le(Q|0);else return Bt(t)|0,e[w>>2]=e[r>>2],U=e[k>>2]|0,Q=e[D>>2]|0,e[d>>2]=e[w>>2],Q=Hi(d,C,U,Q,o,l)|0,b=N,Q|0;return 0}function ac(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=+c;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0;Z=b,b=b+352|0,K=Z+312|0,R=Z+48|0,N=Z+32|0,C=Z+24|0,h=Z+8|0,k=Z,U=Z+316|0,Q=Z+80|0,w=Z+84|0,O=Z+76|0,P=Z+72|0,G=Z+68|0,$=Z+64|0,D=k,e[D>>2]=37,e[D+4>>2]=0,D=gn(k+1|0,58898,e[o+4>>2]|0)|0,e[Q>>2]=U,t=b0()|0,D?(e[h>>2]=e[o+8>>2],B[h+8>>3]=c,h=q0(U,30,t,k,h)|0):(B[C>>3]=c,h=q0(U,30,t,k,C)|0);e:do if((h|0)>29){g=0,t=Ce(3)|0,h=g,g=0,h=h&1,D?!h&&(g=0,e[N>>2]=e[o+8>>2],B[N+8>>3]=c,d=Pe(17,Q|0,t|0,k|0,N|0)|0,_=g,g=0,!(_&1))&&(ie=12):!h&&(g=0,e[R>>2]=e[o+8>>2],B[R+8>>3]=c,_=Pe(17,Q|0,t|0,k|0,R|0)|0,R=g,g=0,!(R&1))&&(d=_,ie=12);do if((ie|0)==12){if(t=e[Q>>2]|0,t)h=t;else{if(g=0,Nt(6),_=g,g=0,_&1)break;h=e[Q>>2]|0}t=h,k=h,ie=16;break e}while(!1);t=j()|0}else t=e[Q>>2]|0,k=0,d=h,ie=16;while(!1);if((ie|0)==16){C=t+d|0,D=ri(t,C,o)|0;do if((t|0)==(U|0))t=U,h=0,ie=22;else{if(d=E0(d<<3)|0,!d){if(g=0,Nt(6),ie=g,g=0,ie&1){h=0,ie=20;break}t=e[Q>>2]|0}h=d,w=d,ie=22}while(!1);do if((ie|0)==22)if(g=0,d=ge(68,o|0)|0,Q=g,g=0,Q&1)ie=20;else{if(e[G>>2]=d,g=0,ht(4,t|0,D|0,C|0,w|0,O|0,P|0,G|0),G=g,g=0,G&1){t=j()|0,Bt(d)|0;break}if(Bt(d)|0,e[$>>2]=e[r>>2],ie=e[O>>2]|0,t=e[P>>2]|0,g=0,e[K>>2]=e[$>>2],t=Vt(40,K|0,w|0,ie|0,t|0,o|0,l|0)|0,ie=g,g=0,ie&1)ie=20;else return e[r>>2]=t,h&&n0(h),k&&n0(k),b=Z,t|0}while(!1);(ie|0)==20&&(t=j()|0),h&&n0(h),k&&n0(k)}return le(t|0),0}function uc(t,r,o,l,c,h,d){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0;var w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0;switch(O=b,b=b+16|0,Z=O,P=O0(d,44212)|0,G=O0(d,44368)|0,t0[e[(e[G>>2]|0)+20>>2]&127](Z,G),e[h>>2]=l,d=S[t>>0]|0,d<<24>>24){case 43:case 45:{g=0,d=be(e[(e[P>>2]|0)+44>>2]|0,P|0,d|0)|0,$=g,g=0,$&1?K=8:(D=e[h>>2]|0,e[h>>2]=D+4,e[D>>2]=d,D=t+1|0,K=10);break}default:D=t,K=10}e:do if((K|0)==10){$=o;t:do if(($-D|0)>1&&(S[D>>0]|0)==48){switch(w=D+1|0,S[w>>0]|0){case 88:case 120:break;default:{K=11;break t}}if(g=0,d=be(e[(e[P>>2]|0)+44>>2]|0,P|0,48)|0,Q=g,g=0,Q&1){K=8;break e}if(Q=e[h>>2]|0,e[h>>2]=Q+4,e[Q>>2]=d,D=D+2|0,g=0,d=be(e[(e[P>>2]|0)+44>>2]|0,P|0,S[w>>0]|0)|0,Q=g,g=0,Q&1){K=8;break e}if(Q=e[h>>2]|0,e[h>>2]=Q+4,e[Q>>2]=d,D>>>0>>0){for(d=D;w=S[d>>0]|0,g=0,C=Ce(3)|0,Q=g,g=0,!(Q&1||(g=0,w=be(39,w<<24>>24|0,C|0)|0,Q=g,g=0,Q&1));){if(!w){Q=D;break t}if(d=d+1|0,d>>>0>=o>>>0){Q=D;break t}}d=j()|0;break e}else Q=D,d=D}else K=11;while(!1);t:do if((K|0)==11)if(D>>>0>>0){for(d=D;w=S[d>>0]|0,g=0,C=Ce(3)|0,Q=g,g=0,!(Q&1||(g=0,w=be(40,w<<24>>24|0,C|0)|0,Q=g,g=0,Q&1));){if(!w){Q=D;break t}if(d=d+1|0,d>>>0>=o>>>0){Q=D;break t}}d=j()|0;break e}else Q=D,d=D;while(!1);if(_=S[Z>>0]|0,U=Z+4|0,(_&1?e[U>>2]|0:(_&255)>>>1)|0){if((Q|0)!=(d|0)&&(k=d+-1|0,Q>>>0>>0)){C=Q,w=k;do _=S[C>>0]|0,S[C>>0]=S[w>>0]|0,S[w>>0]=_,C=C+1|0,w=w+-1|0;while(C>>>0>>0)}if(g=0,k=ge(e[(e[G>>2]|0)+16>>2]|0,G|0)|0,_=g,g=0,_&1){K=8;break}N=Z+8|0,R=Z+1|0;t:do if(Q>>>0>>0){for(w=0,C=0,_=Q;D=S[(S[Z>>0]&1?e[N>>2]|0:R)+C>>0]|0,D<<24>>24>0&(w|0)==(D<<24>>24|0)?(w=e[h>>2]|0,e[h>>2]=w+4,e[w>>2]=k,w=S[Z>>0]|0,D=0,C=(C>>>0<((w&1?e[U>>2]|0:(w&255)>>>1)+-1|0)>>>0&1)+C|0):D=w,g=0,w=be(e[(e[P>>2]|0)+44>>2]|0,P|0,S[_>>0]|0)|0,ie=g,g=0,!(ie&1);){if(ie=e[h>>2]|0,e[h>>2]=ie+4,e[ie>>2]=w,_=_+1|0,_>>>0>=d>>>0)break t;w=D+1|0}d=j()|0;break e}while(!1);if(w=l+(Q-t<<2)|0,D=e[h>>2]|0,(w|0)!=(D|0))if(C=D+-4|0,w>>>0>>0){do ie=e[w>>2]|0,e[w>>2]=e[C>>2],e[C>>2]=ie,w=w+4|0,C=C+-4|0;while(w>>>0>>0);k=P,w=D}else k=P,w=D;else k=P}else{if(g=0,Pe(e[(e[P>>2]|0)+48>>2]|0,P|0,Q|0,d|0,e[h>>2]|0)|0,ie=g,g=0,ie&1){K=8;break}w=(e[h>>2]|0)+(d-Q<<2)|0,e[h>>2]=w,k=P}t:do if(d>>>0>>0){for(;;){if(w=S[d>>0]|0,w<<24>>24==46){C=d;break}if(g=0,C=be(e[(e[k>>2]|0)+44>>2]|0,P|0,w|0)|0,ie=g,g=0,ie&1){K=4;break}if(ie=e[h>>2]|0,w=ie+4|0,e[h>>2]=w,e[ie>>2]=C,d=d+1|0,d>>>0>=o>>>0)break t}if((K|0)==4){d=j()|0;break e}if(g=0,d=ge(e[(e[G>>2]|0)+12>>2]|0,G|0)|0,ie=g,g=0,ie&1){K=8;break e}ie=e[h>>2]|0,w=ie+4|0,e[h>>2]=w,e[ie>>2]=d,d=C+1|0}while(!1);if(g=0,Pe(e[(e[P>>2]|0)+48>>2]|0,P|0,d|0,o|0,w|0)|0,ie=g,g=0,ie&1)K=8;else{ie=(e[h>>2]|0)+($-d<<2)|0,e[h>>2]=ie,e[c>>2]=(r|0)==(o|0)?ie:l+(r-t<<2)|0,de(Z),b=O;return}}while(!1);(K|0)==8&&(d=j()|0),de(Z),le(d|0)}function cc(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=+c;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0;Z=b,b=b+352|0,K=Z+304|0,R=Z+48|0,N=Z+32|0,C=Z+24|0,h=Z+8|0,k=Z,U=Z+308|0,Q=Z+72|0,w=Z+76|0,O=Z+68|0,P=Z+64|0,G=Z+60|0,$=Z+56|0,D=k,e[D>>2]=37,e[D+4>>2]=0,D=gn(k+1|0,58899,e[o+4>>2]|0)|0,e[Q>>2]=U,t=b0()|0,D?(e[h>>2]=e[o+8>>2],B[h+8>>3]=c,h=q0(U,30,t,k,h)|0):(B[C>>3]=c,h=q0(U,30,t,k,C)|0);e:do if((h|0)>29){g=0,t=Ce(3)|0,h=g,g=0,h=h&1,D?!h&&(g=0,e[N>>2]=e[o+8>>2],B[N+8>>3]=c,d=Pe(17,Q|0,t|0,k|0,N|0)|0,_=g,g=0,!(_&1))&&(ie=12):!h&&(g=0,B[R>>3]=c,_=Pe(17,Q|0,t|0,k|0,R|0)|0,R=g,g=0,!(R&1))&&(d=_,ie=12);do if((ie|0)==12){if(t=e[Q>>2]|0,t)h=t;else{if(g=0,Nt(6),_=g,g=0,_&1)break;h=e[Q>>2]|0}t=h,k=h,ie=16;break e}while(!1);t=j()|0}else t=e[Q>>2]|0,k=0,d=h,ie=16;while(!1);if((ie|0)==16){C=t+d|0,D=ri(t,C,o)|0;do if((t|0)==(U|0))t=U,h=0,ie=22;else{if(d=E0(d<<3)|0,!d){if(g=0,Nt(6),ie=g,g=0,ie&1){h=0,ie=20;break}t=e[Q>>2]|0}h=d,w=d,ie=22}while(!1);do if((ie|0)==22)if(g=0,d=ge(68,o|0)|0,Q=g,g=0,Q&1)ie=20;else{if(e[G>>2]=d,g=0,ht(4,t|0,D|0,C|0,w|0,O|0,P|0,G|0),G=g,g=0,G&1){t=j()|0,Bt(d)|0;break}if(Bt(d)|0,e[$>>2]=e[r>>2],ie=e[O>>2]|0,t=e[P>>2]|0,g=0,e[K>>2]=e[$>>2],t=Vt(40,K|0,w|0,ie|0,t|0,o|0,l|0)|0,ie=g,g=0,ie&1)ie=20;else return e[r>>2]=t,h&&n0(h),k&&n0(k),b=Z,t|0}while(!1);(ie|0)==20&&(t=j()|0),h&&n0(h),k&&n0(k)}return le(t|0),0}function fc(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0;if(R=b,b=b+192|0,C=R,t=R+180|0,k=R+160|0,N=R+12|0,w=R+8|0,D=R+4|0,S[t>>0]=S[58901]|0,S[t+1>>0]=S[58902]|0,S[t+2>>0]=S[58903]|0,S[t+3>>0]=S[58904]|0,S[t+4>>0]=S[58905]|0,S[t+5>>0]=S[58906]|0,h=b0()|0,e[C>>2]=c,t=q0(k,20,h,t,C)|0,c=k+t|0,h=ri(k,c,o)|0,d=f0(o)|0,e[w>>2]=d,g=0,w=be(37,w|0,44212)|0,_=g,g=0,_&1)_=j()|0,Bt(d)|0,le(_|0);else return Bt(d)|0,_r[e[(e[w>>2]|0)+48>>2]&31](w,k,c,N)|0,_=N+(t<<2)|0,e[D>>2]=e[r>>2],e[C>>2]=e[D>>2],_=Hi(C,N,(h|0)==(c|0)?_:N+(h-k<<2)|0,_,o,l)|0,b=R,_|0;return 0}function xi(t,r,o,l,c,h,d,w){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0,w=w|0;var C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0;ie=b,b=b+32|0,K=ie+16|0,Q=ie+12|0,P=ie+8|0,G=ie+4|0,$=ie,C=f0(l)|0,e[P>>2]=C,g=0,P=be(37,P|0,44220)|0,U=g,g=0,U&1&&(ie=j()|0,Bt(C)|0,le(ie|0)),Bt(C)|0,e[c>>2]=0,U=P+8|0,C=e[r>>2]|0;e:do if((d|0)!=(w|0)){t:for(;;){D=C,C?(e[C+12>>2]|0)==(e[C+16>>2]|0)&&(Dt[e[(e[C>>2]|0)+36>>2]&127](C)|0)==-1&&(e[r>>2]=0,C=0,D=0):C=0,R=(C|0)==0,N=e[o>>2]|0,k=N;do if(N){if((e[N+12>>2]|0)==(e[N+16>>2]|0)&&(Dt[e[(e[N>>2]|0)+36>>2]&127](N)|0)==-1){e[o>>2]=0,k=0,Z=12;break}if(!R){Z=13;break t}}else Z=12;while(!1);if((Z|0)==12)if(Z=0,R){Z=13;break}else N=0;i:do if((Yt[e[(e[P>>2]|0)+36>>2]&63](P,S[d>>0]|0,0)|0)<<24>>24==37){if(N=d+1|0,(N|0)==(w|0)){Z=17;break t}switch(_=Yt[e[(e[P>>2]|0)+36>>2]&63](P,S[N>>0]|0,0)|0,_<<24>>24){case 48:case 69:{if(R=d+2|0,(R|0)==(w|0)){Z=20;break t}d=N,N=Yt[e[(e[P>>2]|0)+36>>2]&63](P,S[R>>0]|0,0)|0,C=_;break}default:N=_,C=0}_=e[(e[t>>2]|0)+36>>2]|0,e[G>>2]=D,e[$>>2]=k,e[Q>>2]=e[G>>2],e[K>>2]=e[$>>2],_=Ci[_&15](t,Q,K,l,c,h,N,C)|0,e[r>>2]=_,d=d+2|0}else{if(D=S[d>>0]|0,D<<24>>24>-1&&(O=e[U>>2]|0,(I[O+(D<<24>>24<<1)>>1]&8192)!=0)){do{if(d=d+1|0,(d|0)==(w|0)){d=w;break}if(D=S[d>>0]|0,D<<24>>24<=-1)break}while(I[O+(D<<24>>24<<1)>>1]&8192);for(D=N;;){C?(e[C+12>>2]|0)==(e[C+16>>2]|0)&&(Dt[e[(e[C>>2]|0)+36>>2]&127](C)|0)==-1&&(e[r>>2]=0,C=0):C=0,k=(C|0)==0;do if(N){if((e[N+12>>2]|0)!=(e[N+16>>2]|0))if(k){_=D;break}else break i;if((Dt[e[(e[N>>2]|0)+36>>2]&127](N)|0)!=-1)if(k^(D|0)==0){_=D,N=D;break}else break i;else{e[o>>2]=0,D=0,Z=39;break}}else Z=39;while(!1);if((Z|0)==39){if(Z=0,k)break i;_=D,N=0}if(k=C+12|0,D=e[k>>2]|0,R=C+16|0,(D|0)==(e[R>>2]|0)?D=Dt[e[(e[C>>2]|0)+36>>2]&127](C)|0:D=F[D>>0]|0,(D&255)<<24>>24<=-1||!(I[(e[U>>2]|0)+(D<<24>>24<<1)>>1]&8192))break i;if(D=e[k>>2]|0,(D|0)==(e[R>>2]|0)){Dt[e[(e[C>>2]|0)+40>>2]&127](C)|0,D=_;continue}else{e[k>>2]=D+1,D=_;continue}}}if(k=C+12|0,D=e[k>>2]|0,N=C+16|0,(D|0)==(e[N>>2]|0)?D=Dt[e[(e[C>>2]|0)+36>>2]&127](C)|0:D=F[D>>0]|0,_=U0[e[(e[P>>2]|0)+12>>2]&63](P,D&255)|0,_<<24>>24!=(U0[e[(e[P>>2]|0)+12>>2]&63](P,S[d>>0]|0)|0)<<24>>24){Z=57;break t}D=e[k>>2]|0,(D|0)==(e[N>>2]|0)?Dt[e[(e[C>>2]|0)+40>>2]&127](C)|0:e[k>>2]=D+1,d=d+1|0}while(!1);if(C=e[r>>2]|0,!((d|0)!=(w|0)&(e[c>>2]|0)==0))break e}if((Z|0)==13){e[c>>2]=4;break}else if((Z|0)==17){e[c>>2]=4;break}else if((Z|0)==20){e[c>>2]=4;break}else if((Z|0)==57){e[c>>2]=4,C=e[r>>2]|0;break}}while(!1);C?(e[C+12>>2]|0)==(e[C+16>>2]|0)&&(Dt[e[(e[C>>2]|0)+36>>2]&127](C)|0)==-1&&(e[r>>2]=0,C=0):C=0,d=(C|0)==0,D=e[o>>2]|0;do if(D){if((e[D+12>>2]|0)==(e[D+16>>2]|0)&&(Dt[e[(e[D>>2]|0)+36>>2]&127](D)|0)==-1){e[o>>2]=0,Z=67;break}d||(Z=68)}else Z=67;while(!1);return(Z|0)==67&&d&&(Z=68),(Z|0)==68&&(e[c>>2]=e[c>>2]|2),b=ie,C|0}function hc(t){t=t|0}function dc(t){t=t|0,he(t)}function pc(t){return t=t|0,2}function mc(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0;return d=b,b=b+16|0,w=d+12|0,C=d+8|0,k=d+4|0,D=d,e[k>>2]=e[r>>2],e[D>>2]=e[o>>2],e[C>>2]=e[k>>2],e[w>>2]=e[D>>2],t=xi(t,C,w,l,c,h,58907,58915)|0,b=d,t|0}function gc(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0,N=0,R=0;return d=b,b=b+16|0,w=d+12|0,C=d+8|0,k=d+4|0,D=d,N=t+8|0,N=Dt[e[(e[N>>2]|0)+20>>2]&127](N)|0,e[k>>2]=e[r>>2],e[D>>2]=e[o>>2],o=S[N>>0]|0,R=(o&1)==0,r=R?N+1|0:e[N+8>>2]|0,o=r+(R?(o&255)>>>1:e[N+4>>2]|0)|0,e[C>>2]=e[k>>2],e[w>>2]=e[D>>2],t=xi(t,C,w,l,c,h,r,o)|0,b=d,t|0}function Sc(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0;if(D=b,b=b+16|0,w=D+8|0,d=D+4|0,C=D,l=f0(l)|0,e[d>>2]=l,g=0,d=be(37,d|0,44220)|0,k=g,g=0,k&1)k=j()|0,Bt(l)|0,le(k|0);else return Bt(l)|0,e[C>>2]=e[o>>2],e[w>>2]=e[C>>2],Is(t,h+24|0,r,w,c,d),b=D,e[r>>2]|0;return 0}function Is(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0;d=b,b=b+16|0,w=d+4|0,C=d,t=t+8|0,t=Dt[e[e[t>>2]>>2]&127](t)|0,e[C>>2]=e[l>>2],e[w>>2]=e[C>>2],o=(Sn(o,w,t,t+168|0,h,c,0)|0)-t|0,(o|0)<168&&(e[r>>2]=((o|0)/12|0|0)%7|0),b=d}function Ac(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0;if(D=b,b=b+16|0,w=D+8|0,d=D+4|0,C=D,l=f0(l)|0,e[d>>2]=l,g=0,d=be(37,d|0,44220)|0,k=g,g=0,k&1)k=j()|0,Bt(l)|0,le(k|0);else return Bt(l)|0,e[C>>2]=e[o>>2],e[w>>2]=e[C>>2],Es(t,h+16|0,r,w,c,d),b=D,e[r>>2]|0;return 0}function Es(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0;d=b,b=b+16|0,w=d+4|0,C=d,t=t+8|0,t=Dt[e[(e[t>>2]|0)+4>>2]&127](t)|0,e[C>>2]=e[l>>2],e[w>>2]=e[C>>2],o=(Sn(o,w,t,t+288|0,h,c,0)|0)-t|0,(o|0)<288&&(e[r>>2]=((o|0)/12|0|0)%12|0),b=d}function vc(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0;if(D=b,b=b+16|0,w=D+8|0,d=D+4|0,C=D,l=f0(l)|0,e[d>>2]=l,g=0,d=be(37,d|0,44220)|0,k=g,g=0,k&1)k=j()|0,Bt(l)|0,le(k|0);else return Bt(l)|0,e[C>>2]=e[o>>2],e[w>>2]=e[C>>2],ks(t,h+20|0,r,w,c,d),b=D,e[r>>2]|0;return 0}function ks(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0;d=b,b=b+16|0,t=d+4|0,w=d,e[w>>2]=e[l>>2],e[t>>2]=e[w>>2],t=fi(o,t,c,h,4)|0,e[c>>2]&4||((t|0)<69?t=t+2e3|0:t=(t+-69|0)>>>0<31?t+1900|0:t,e[r>>2]=t+-1900),b=d}function xc(t,r,o,l,c,h,d,w){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0,w=w|0;var C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0,ce=0,ke=0,Ee=0,Te=0,it=0,jt=0,Gt=0,s0=0,i0=0,zt=0,gt=0,Kt=0,dt=0,At=0,y0=0,T0=0,g0=0,Oe=0,yt=0,qt=0;Oe=b,b=b+144|0,C=Oe+132|0,w=Oe+116|0,gt=Oe+128|0,P=Oe+124|0,jt=Oe+120|0,Kt=Oe+112|0,dt=Oe+108|0,At=Oe+104|0,y0=Oe+100|0,T0=Oe+96|0,g0=Oe+92|0,D=Oe+88|0,k=Oe+84|0,N=Oe+80|0,R=Oe+76|0,_=Oe+72|0,U=Oe+68|0,Q=Oe+64|0,K=Oe+60|0,G=Oe+56|0,$=Oe+52|0,O=Oe+48|0,Z=Oe+44|0,ie=Oe+40|0,oe=Oe+36|0,ne=Oe+32|0,ce=Oe+28|0,ke=Oe+24|0,Ee=Oe+20|0,Te=Oe+16|0,it=Oe+12|0,Gt=Oe+8|0,s0=Oe+4|0,i0=Oe,e[c>>2]=0,zt=f0(l)|0,e[gt>>2]=zt,g=0,gt=be(37,gt|0,44220)|0,qt=g,g=0,qt&1&&(qt=j()|0,Bt(zt)|0,le(qt|0)),Bt(zt)|0;do switch(d<<24>>24|0){case 65:case 97:{e[P>>2]=e[o>>2],e[C>>2]=e[P>>2],Is(t,h+24|0,r,C,c,gt),yt=28;break}case 104:case 66:case 98:{e[jt>>2]=e[o>>2],e[C>>2]=e[jt>>2],Es(t,h+16|0,r,C,c,gt),yt=28;break}case 99:{yt=t+8|0,yt=Dt[e[(e[yt>>2]|0)+12>>2]&127](yt)|0,e[Kt>>2]=e[r>>2],e[dt>>2]=e[o>>2],d=S[yt>>0]|0,o=(d&1)==0,qt=o?yt+1|0:e[yt+8>>2]|0,yt=qt+(o?(d&255)>>>1:e[yt+4>>2]|0)|0,e[w>>2]=e[Kt>>2],e[C>>2]=e[dt>>2],yt=xi(t,w,C,l,c,h,qt,yt)|0,e[r>>2]=yt,yt=28;break}case 101:case 100:{e[At>>2]=e[o>>2],e[C>>2]=e[At>>2],wc(t,h+12|0,r,C,c,gt),yt=28;break}case 68:{e[y0>>2]=e[r>>2],e[T0>>2]=e[o>>2],e[w>>2]=e[y0>>2],e[C>>2]=e[T0>>2],yt=xi(t,w,C,l,c,h,58915,58923)|0,e[r>>2]=yt,yt=28;break}case 70:{e[g0>>2]=e[r>>2],e[D>>2]=e[o>>2],e[w>>2]=e[g0>>2],e[C>>2]=e[D>>2],yt=xi(t,w,C,l,c,h,58923,58931)|0,e[r>>2]=yt,yt=28;break}case 72:{e[k>>2]=e[o>>2],e[C>>2]=e[k>>2],yc(t,h+8|0,r,C,c,gt),yt=28;break}case 73:{e[N>>2]=e[o>>2],e[C>>2]=e[N>>2],Cc(t,h+8|0,r,C,c,gt),yt=28;break}case 106:{e[R>>2]=e[o>>2],e[C>>2]=e[R>>2],Tc(t,h+28|0,r,C,c,gt),yt=28;break}case 109:{e[_>>2]=e[o>>2],e[C>>2]=e[_>>2],Ic(t,h+16|0,r,C,c,gt),yt=28;break}case 77:{e[U>>2]=e[o>>2],e[C>>2]=e[U>>2],Ec(t,h+4|0,r,C,c,gt),yt=28;break}case 116:case 110:{e[Q>>2]=e[o>>2],e[C>>2]=e[Q>>2],kc(t,r,C,c,gt),yt=28;break}case 112:{e[K>>2]=e[o>>2],e[C>>2]=e[K>>2],Dc(t,h+8|0,r,C,c,gt),yt=28;break}case 114:{e[G>>2]=e[r>>2],e[$>>2]=e[o>>2],e[w>>2]=e[G>>2],e[C>>2]=e[$>>2],yt=xi(t,w,C,l,c,h,58931,58942)|0,e[r>>2]=yt,yt=28;break}case 82:{e[O>>2]=e[r>>2],e[Z>>2]=e[o>>2],e[w>>2]=e[O>>2],e[C>>2]=e[Z>>2],yt=xi(t,w,C,l,c,h,58942,58947)|0,e[r>>2]=yt,yt=28;break}case 83:{e[ie>>2]=e[o>>2],e[C>>2]=e[ie>>2],bc(t,h,r,C,c,gt),yt=28;break}case 84:{e[oe>>2]=e[r>>2],e[ne>>2]=e[o>>2],e[w>>2]=e[oe>>2],e[C>>2]=e[ne>>2],yt=xi(t,w,C,l,c,h,58947,58955)|0,e[r>>2]=yt,yt=28;break}case 119:{e[ce>>2]=e[o>>2],e[C>>2]=e[ce>>2],Nc(t,h+24|0,r,C,c,gt),yt=28;break}case 120:{qt=e[(e[t>>2]|0)+20>>2]|0,e[ke>>2]=e[r>>2],e[Ee>>2]=e[o>>2],e[w>>2]=e[ke>>2],e[C>>2]=e[Ee>>2],w=on[qt&63](t,w,C,l,c,h)|0;break}case 88:{yt=t+8|0,yt=Dt[e[(e[yt>>2]|0)+24>>2]&127](yt)|0,e[Te>>2]=e[r>>2],e[it>>2]=e[o>>2],d=S[yt>>0]|0,o=(d&1)==0,qt=o?yt+1|0:e[yt+8>>2]|0,yt=qt+(o?(d&255)>>>1:e[yt+4>>2]|0)|0,e[w>>2]=e[Te>>2],e[C>>2]=e[it>>2],yt=xi(t,w,C,l,c,h,qt,yt)|0,e[r>>2]=yt,yt=28;break}case 121:{e[Gt>>2]=e[o>>2],e[C>>2]=e[Gt>>2],ks(t,h+20|0,r,C,c,gt),yt=28;break}case 89:{e[s0>>2]=e[o>>2],e[C>>2]=e[s0>>2],Fc(t,h+20|0,r,C,c,gt),yt=28;break}case 37:{e[i0>>2]=e[o>>2],e[C>>2]=e[i0>>2],Rc(t,r,C,c,gt),yt=28;break}default:e[c>>2]=e[c>>2]|4,yt=28}while(!1);return(yt|0)==28&&(w=e[r>>2]|0),b=Oe,w|0}function wc(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0;d=b,b=b+16|0,t=d+4|0,w=d,e[w>>2]=e[l>>2],e[t>>2]=e[w>>2],t=fi(o,t,c,h,2)|0,o=e[c>>2]|0,(t+-1|0)>>>0<31&(o&4|0)==0?e[r>>2]=t:e[c>>2]=o|4,b=d}function yc(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0;d=b,b=b+16|0,t=d+4|0,w=d,e[w>>2]=e[l>>2],e[t>>2]=e[w>>2],t=fi(o,t,c,h,2)|0,o=e[c>>2]|0,(t|0)<24&(o&4|0)==0?e[r>>2]=t:e[c>>2]=o|4,b=d}function Cc(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0;d=b,b=b+16|0,t=d+4|0,w=d,e[w>>2]=e[l>>2],e[t>>2]=e[w>>2],t=fi(o,t,c,h,2)|0,o=e[c>>2]|0,(t+-1|0)>>>0<12&(o&4|0)==0?e[r>>2]=t:e[c>>2]=o|4,b=d}function Tc(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0;d=b,b=b+16|0,t=d+4|0,w=d,e[w>>2]=e[l>>2],e[t>>2]=e[w>>2],t=fi(o,t,c,h,3)|0,o=e[c>>2]|0,(t|0)<366&(o&4|0)==0?e[r>>2]=t:e[c>>2]=o|4,b=d}function Ic(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0;d=b,b=b+16|0,t=d+4|0,w=d,e[w>>2]=e[l>>2],e[t>>2]=e[w>>2],t=fi(o,t,c,h,2)|0,o=e[c>>2]|0,(t|0)<13&(o&4|0)==0?e[r>>2]=t+-1:e[c>>2]=o|4,b=d}function Ec(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0;d=b,b=b+16|0,t=d+4|0,w=d,e[w>>2]=e[l>>2],e[t>>2]=e[w>>2],t=fi(o,t,c,h,2)|0,o=e[c>>2]|0,(t|0)<60&(o&4|0)==0?e[r>>2]=t:e[c>>2]=o|4,b=d}function kc(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0;d=c+8|0;e:for(;;){c=e[r>>2]|0;do if(c){if((e[c+12>>2]|0)==(e[c+16>>2]|0))if((Dt[e[(e[c>>2]|0)+36>>2]&127](c)|0)==-1){e[r>>2]=0,c=0;break}else{c=e[r>>2]|0;break}}else c=0;while(!1);c=(c|0)==0,t=e[o>>2]|0;do if(t){if((e[t+12>>2]|0)!=(e[t+16>>2]|0)){if(c)break;break e}if((Dt[e[(e[t>>2]|0)+36>>2]&127](t)|0)!=-1){if(c)break;break e}else{e[o>>2]=0,w=12;break}}else w=12;while(!1);if((w|0)==12)if(w=0,c){t=0;break}else t=0;if(c=e[r>>2]|0,h=e[c+12>>2]|0,(h|0)==(e[c+16>>2]|0)?c=Dt[e[(e[c>>2]|0)+36>>2]&127](c)|0:c=F[h>>0]|0,(c&255)<<24>>24<=-1||!(I[(e[d>>2]|0)+(c<<24>>24<<1)>>1]&8192))break;if(c=e[r>>2]|0,t=c+12|0,h=e[t>>2]|0,(h|0)==(e[c+16>>2]|0)){Dt[e[(e[c>>2]|0)+40>>2]&127](c)|0;continue}else{e[t>>2]=h+1;continue}}c=e[r>>2]|0;do if(c){if((e[c+12>>2]|0)==(e[c+16>>2]|0))if((Dt[e[(e[c>>2]|0)+36>>2]&127](c)|0)==-1){e[r>>2]=0,c=0;break}else{c=e[r>>2]|0;break}}else c=0;while(!1);c=(c|0)==0;do if(t){if((e[t+12>>2]|0)==(e[t+16>>2]|0)&&(Dt[e[(e[t>>2]|0)+36>>2]&127](t)|0)==-1){e[o>>2]=0,w=32;break}c||(w=33)}else w=32;while(!1);(w|0)==32&&c&&(w=33),(w|0)==33&&(e[l>>2]=e[l>>2]|2)}function Dc(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0;k=b,b=b+16|0,w=k+4|0,C=k,D=t+8|0,D=Dt[e[(e[D>>2]|0)+8>>2]&127](D)|0,t=S[D>>0]|0,t&1?d=e[D+4>>2]|0:d=(t&255)>>>1,t=S[D+12>>0]|0,t&1?t=e[D+16>>2]|0:t=(t&255)>>>1;do if((d|0)!=(0-t|0)){if(e[C>>2]=e[l>>2],e[w>>2]=e[C>>2],t=Sn(o,w,D,D+24|0,h,c,0)|0,d=e[r>>2]|0,(t|0)==(D|0)&(d|0)==12){e[r>>2]=0;break}(d|0)<12&(t-D|0)==12&&(e[r>>2]=d+12)}else e[c>>2]=e[c>>2]|4;while(!1);b=k}function bc(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0;d=b,b=b+16|0,t=d+4|0,w=d,e[w>>2]=e[l>>2],e[t>>2]=e[w>>2],t=fi(o,t,c,h,2)|0,o=e[c>>2]|0,(t|0)<61&(o&4|0)==0?e[r>>2]=t:e[c>>2]=o|4,b=d}function Nc(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0;d=b,b=b+16|0,t=d+4|0,w=d,e[w>>2]=e[l>>2],e[t>>2]=e[w>>2],t=fi(o,t,c,h,1)|0,o=e[c>>2]|0,(t|0)<7&(o&4|0)==0?e[r>>2]=t:e[c>>2]=o|4,b=d}function Fc(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0;d=b,b=b+16|0,t=d+4|0,w=d,e[w>>2]=e[l>>2],e[t>>2]=e[w>>2],t=fi(o,t,c,h,4)|0,e[c>>2]&4||(e[r>>2]=t+-1900),b=d}function Rc(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0;t=e[r>>2]|0;do if(t){if((e[t+12>>2]|0)==(e[t+16>>2]|0))if((Dt[e[(e[t>>2]|0)+36>>2]&127](t)|0)==-1){e[r>>2]=0,t=0;break}else{t=e[r>>2]|0;break}}else t=0;while(!1);h=(t|0)==0,t=e[o>>2]|0;do if(t){if((e[t+12>>2]|0)==(e[t+16>>2]|0)&&(Dt[e[(e[t>>2]|0)+36>>2]&127](t)|0)==-1){e[o>>2]=0,w=11;break}h?(d=t,w=13):w=12}else w=11;while(!1);(w|0)==11&&(h?w=12:(d=0,w=13));e:do if((w|0)==12)e[l>>2]=e[l>>2]|6;else if((w|0)==13){if(t=e[r>>2]|0,h=e[t+12>>2]|0,(h|0)==(e[t+16>>2]|0)?t=Dt[e[(e[t>>2]|0)+36>>2]&127](t)|0:t=F[h>>0]|0,(Yt[e[(e[c>>2]|0)+36>>2]&63](c,t&255,0)|0)<<24>>24!=37){e[l>>2]=e[l>>2]|4;break}t=e[r>>2]|0,h=t+12|0,c=e[h>>2]|0,(c|0)==(e[t+16>>2]|0)?(Dt[e[(e[t>>2]|0)+40>>2]&127](t)|0,t=e[r>>2]|0,t?w=21:t=0):(e[h>>2]=c+1,w=21);do if((w|0)==21&&(e[t+12>>2]|0)==(e[t+16>>2]|0))if((Dt[e[(e[t>>2]|0)+36>>2]&127](t)|0)==-1){e[r>>2]=0,t=0;break}else{t=e[r>>2]|0;break}while(!1);t=(t|0)==0;do if(d){if((e[d+12>>2]|0)==(e[d+16>>2]|0)&&(Dt[e[(e[d>>2]|0)+36>>2]&127](d)|0)==-1){e[o>>2]=0,w=30;break}if(t)break e}else w=30;while(!1);if((w|0)==30&&!t)break;e[l>>2]=e[l>>2]|2}while(!1)}function wi(t,r,o,l,c,h,d,w){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0,w=w|0;var C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0,G=0,$=0,P=0,O=0;O=b,b=b+32|0,Q=O+16|0,U=O+12|0,$=O+8|0,K=O+4|0,G=O,C=f0(l)|0,e[$>>2]=C,g=0,$=be(37,$|0,44212)|0,_=g,g=0,_&1&&(O=j()|0,Bt(C)|0,le(O|0)),Bt(C)|0,e[c>>2]=0,C=e[r>>2]|0;e:do if((d|0)!=(w|0)){t:for(;;){k=C,C?(D=e[C+12>>2]|0,(D|0)==(e[C+16>>2]|0)?D=Dt[e[(e[C>>2]|0)+36>>2]&127](C)|0:D=e[D>>2]|0,(D|0)==-1?(e[r>>2]=0,C=0,R=1,_=0):(R=0,_=k)):(C=0,R=1,_=k),N=e[o>>2]|0,D=N;do if(N)if(k=e[N+12>>2]|0,(k|0)==(e[N+16>>2]|0)?k=Dt[e[(e[N>>2]|0)+36>>2]&127](N)|0:k=e[k>>2]|0,(k|0)!=-1){if(R)break;P=17;break t}else{e[o>>2]=0,D=0,P=15;break}else P=15;while(!1);if((P|0)==15)if(P=0,R){P=17;break}else N=0;i:do if((Yt[e[(e[$>>2]|0)+52>>2]&63]($,e[d>>2]|0,0)|0)<<24>>24==37){if(k=d+4|0,(k|0)==(w|0)){P=21;break t}switch(R=Yt[e[(e[$>>2]|0)+52>>2]&63]($,e[k>>2]|0,0)|0,R<<24>>24){case 48:case 69:{if(N=d+8|0,(N|0)==(w|0)){P=24;break t}d=k,k=Yt[e[(e[$>>2]|0)+52>>2]&63]($,e[N>>2]|0,0)|0,C=R;break}default:k=R,C=0}R=e[(e[t>>2]|0)+36>>2]|0,e[K>>2]=_,e[G>>2]=D,e[U>>2]=e[K>>2],e[Q>>2]=e[G>>2],_=Ci[R&15](t,U,Q,l,c,h,k,C)|0,e[r>>2]=_,d=d+8|0}else{if(!(Yt[e[(e[$>>2]|0)+12>>2]&63]($,8192,e[d>>2]|0)|0)){if(k=C+12|0,D=e[k>>2]|0,N=C+16|0,(D|0)==(e[N>>2]|0)?D=Dt[e[(e[C>>2]|0)+36>>2]&127](C)|0:D=e[D>>2]|0,_=U0[e[(e[$>>2]|0)+28>>2]&63]($,D)|0,(_|0)!=(U0[e[(e[$>>2]|0)+28>>2]&63]($,e[d>>2]|0)|0)){P=61;break t}D=e[k>>2]|0,(D|0)==(e[N>>2]|0)?Dt[e[(e[C>>2]|0)+40>>2]&127](C)|0:e[k>>2]=D+4,d=d+4|0;break}do if(d=d+4|0,(d|0)==(w|0)){d=w;break}while(Yt[e[(e[$>>2]|0)+12>>2]&63]($,8192,e[d>>2]|0)|0);for(D=N,R=N;;){C?(k=e[C+12>>2]|0,(k|0)==(e[C+16>>2]|0)?k=Dt[e[(e[C>>2]|0)+36>>2]&127](C)|0:k=e[k>>2]|0,(k|0)==-1?(e[r>>2]=0,N=1,C=0):N=0):(N=1,C=0);do if(R)if(k=e[R+12>>2]|0,(k|0)==(e[R+16>>2]|0)?k=Dt[e[(e[R>>2]|0)+36>>2]&127](R)|0:k=e[k>>2]|0,(k|0)!=-1)if(N^(D|0)==0){_=D,R=D;break}else break i;else{e[o>>2]=0,D=0,P=44;break}else P=44;while(!1);if((P|0)==44){if(P=0,N)break i;_=D,R=0}if(k=C+12|0,D=e[k>>2]|0,N=C+16|0,(D|0)==(e[N>>2]|0)?D=Dt[e[(e[C>>2]|0)+36>>2]&127](C)|0:D=e[D>>2]|0,!(Yt[e[(e[$>>2]|0)+12>>2]&63]($,8192,D)|0))break i;if(D=e[k>>2]|0,(D|0)==(e[N>>2]|0)){Dt[e[(e[C>>2]|0)+40>>2]&127](C)|0,D=_;continue}else{e[k>>2]=D+4,D=_;continue}}}while(!1);if(C=e[r>>2]|0,!((d|0)!=(w|0)&(e[c>>2]|0)==0))break e}if((P|0)==17){e[c>>2]=4;break}else if((P|0)==21){e[c>>2]=4;break}else if((P|0)==24){e[c>>2]=4;break}else if((P|0)==61){e[c>>2]=4,C=e[r>>2]|0;break}}while(!1);C?(d=e[C+12>>2]|0,(d|0)==(e[C+16>>2]|0)?d=Dt[e[(e[C>>2]|0)+36>>2]&127](C)|0:d=e[d>>2]|0,(d|0)==-1?(e[r>>2]=0,C=0,k=1):k=0):(C=0,k=1),d=e[o>>2]|0;do if(d)if(D=e[d+12>>2]|0,(D|0)==(e[d+16>>2]|0)?d=Dt[e[(e[d>>2]|0)+36>>2]&127](d)|0:d=e[D>>2]|0,(d|0)!=-1){if(k)break;P=76;break}else{e[o>>2]=0,P=74;break}else P=74;while(!1);return(P|0)==74&&k&&(P=76),(P|0)==76&&(e[c>>2]=e[c>>2]|2),b=O,C|0}function Mc(t){t=t|0}function _c(t){t=t|0,he(t)}function Pc(t){return t=t|0,2}function Lc(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0;return d=b,b=b+16|0,w=d+12|0,C=d+8|0,k=d+4|0,D=d,e[k>>2]=e[r>>2],e[D>>2]=e[o>>2],e[C>>2]=e[k>>2],e[w>>2]=e[D>>2],t=wi(t,C,w,l,c,h,44788,44820)|0,b=d,t|0}function Oc(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0;return d=b,b=b+16|0,w=d+12|0,C=d+8|0,k=d+4|0,D=d,_=t+8|0,_=Dt[e[(e[_>>2]|0)+20>>2]&127](_)|0,e[k>>2]=e[r>>2],e[D>>2]=e[o>>2],N=S[_>>0]|0,R=(N&1)==0,o=_+4|0,r=R?o:e[_+8>>2]|0,o=r+((R?(N&255)>>>1:e[o>>2]|0)<<2)|0,e[C>>2]=e[k>>2],e[w>>2]=e[D>>2],t=wi(t,C,w,l,c,h,r,o)|0,b=d,t|0}function $c(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0;if(D=b,b=b+16|0,w=D+8|0,d=D+4|0,C=D,l=f0(l)|0,e[d>>2]=l,g=0,d=be(37,d|0,44212)|0,k=g,g=0,k&1)k=j()|0,Bt(l)|0,le(k|0);else return Bt(l)|0,e[C>>2]=e[o>>2],e[w>>2]=e[C>>2],Ds(t,h+24|0,r,w,c,d),b=D,e[r>>2]|0;return 0}function Ds(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0;d=b,b=b+16|0,w=d+4|0,C=d,t=t+8|0,t=Dt[e[e[t>>2]>>2]&127](t)|0,e[C>>2]=e[l>>2],e[w>>2]=e[C>>2],o=(An(o,w,t,t+168|0,h,c,0)|0)-t|0,(o|0)<168&&(e[r>>2]=((o|0)/12|0|0)%7|0),b=d}function Bc(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0;if(D=b,b=b+16|0,w=D+8|0,d=D+4|0,C=D,l=f0(l)|0,e[d>>2]=l,g=0,d=be(37,d|0,44212)|0,k=g,g=0,k&1)k=j()|0,Bt(l)|0,le(k|0);else return Bt(l)|0,e[C>>2]=e[o>>2],e[w>>2]=e[C>>2],bs(t,h+16|0,r,w,c,d),b=D,e[r>>2]|0;return 0}function bs(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0;d=b,b=b+16|0,w=d+4|0,C=d,t=t+8|0,t=Dt[e[(e[t>>2]|0)+4>>2]&127](t)|0,e[C>>2]=e[l>>2],e[w>>2]=e[C>>2],o=(An(o,w,t,t+288|0,h,c,0)|0)-t|0,(o|0)<288&&(e[r>>2]=((o|0)/12|0|0)%12|0),b=d}function Vc(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0;if(D=b,b=b+16|0,w=D+8|0,d=D+4|0,C=D,l=f0(l)|0,e[d>>2]=l,g=0,d=be(37,d|0,44212)|0,k=g,g=0,k&1)k=j()|0,Bt(l)|0,le(k|0);else return Bt(l)|0,e[C>>2]=e[o>>2],e[w>>2]=e[C>>2],Ns(t,h+20|0,r,w,c,d),b=D,e[r>>2]|0;return 0}function Ns(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0;d=b,b=b+16|0,t=d+4|0,w=d,e[w>>2]=e[l>>2],e[t>>2]=e[w>>2],t=hi(o,t,c,h,4)|0,e[c>>2]&4||((t|0)<69?t=t+2e3|0:t=(t+-69|0)>>>0<31?t+1900|0:t,e[r>>2]=t+-1900),b=d}function Uc(t,r,o,l,c,h,d,w){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0,w=w|0;var C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0,ce=0,ke=0,Ee=0,Te=0,it=0,jt=0,Gt=0,s0=0,i0=0,zt=0,gt=0,Kt=0,dt=0,At=0,y0=0,T0=0,g0=0,Oe=0,yt=0,qt=0;Oe=b,b=b+144|0,C=Oe+132|0,w=Oe+116|0,gt=Oe+128|0,P=Oe+124|0,jt=Oe+120|0,Kt=Oe+112|0,dt=Oe+108|0,At=Oe+104|0,y0=Oe+100|0,T0=Oe+96|0,g0=Oe+92|0,D=Oe+88|0,k=Oe+84|0,N=Oe+80|0,R=Oe+76|0,_=Oe+72|0,U=Oe+68|0,Q=Oe+64|0,K=Oe+60|0,G=Oe+56|0,$=Oe+52|0,O=Oe+48|0,Z=Oe+44|0,ie=Oe+40|0,oe=Oe+36|0,ne=Oe+32|0,ce=Oe+28|0,ke=Oe+24|0,Ee=Oe+20|0,Te=Oe+16|0,it=Oe+12|0,Gt=Oe+8|0,s0=Oe+4|0,i0=Oe,e[c>>2]=0,zt=f0(l)|0,e[gt>>2]=zt,g=0,gt=be(37,gt|0,44212)|0,qt=g,g=0,qt&1&&(qt=j()|0,Bt(zt)|0,le(qt|0)),Bt(zt)|0;do switch(d<<24>>24|0){case 65:case 97:{e[P>>2]=e[o>>2],e[C>>2]=e[P>>2],Ds(t,h+24|0,r,C,c,gt),yt=28;break}case 104:case 66:case 98:{e[jt>>2]=e[o>>2],e[C>>2]=e[jt>>2],bs(t,h+16|0,r,C,c,gt),yt=28;break}case 99:{qt=t+8|0,qt=Dt[e[(e[qt>>2]|0)+12>>2]&127](qt)|0,e[Kt>>2]=e[r>>2],e[dt>>2]=e[o>>2],d=S[qt>>0]|0,o=(d&1)==0,yt=qt+4|0,qt=o?yt:e[qt+8>>2]|0,yt=qt+((o?(d&255)>>>1:e[yt>>2]|0)<<2)|0,e[w>>2]=e[Kt>>2],e[C>>2]=e[dt>>2],yt=wi(t,w,C,l,c,h,qt,yt)|0,e[r>>2]=yt,yt=28;break}case 101:case 100:{e[At>>2]=e[o>>2],e[C>>2]=e[At>>2],zc(t,h+12|0,r,C,c,gt),yt=28;break}case 68:{e[y0>>2]=e[r>>2],e[T0>>2]=e[o>>2],e[w>>2]=e[y0>>2],e[C>>2]=e[T0>>2],yt=wi(t,w,C,l,c,h,44820,44852)|0,e[r>>2]=yt,yt=28;break}case 70:{e[g0>>2]=e[r>>2],e[D>>2]=e[o>>2],e[w>>2]=e[g0>>2],e[C>>2]=e[D>>2],yt=wi(t,w,C,l,c,h,44852,44884)|0,e[r>>2]=yt,yt=28;break}case 72:{e[k>>2]=e[o>>2],e[C>>2]=e[k>>2],Gc(t,h+8|0,r,C,c,gt),yt=28;break}case 73:{e[N>>2]=e[o>>2],e[C>>2]=e[N>>2],qc(t,h+8|0,r,C,c,gt),yt=28;break}case 106:{e[R>>2]=e[o>>2],e[C>>2]=e[R>>2],Wc(t,h+28|0,r,C,c,gt),yt=28;break}case 109:{e[_>>2]=e[o>>2],e[C>>2]=e[_>>2],Hc(t,h+16|0,r,C,c,gt),yt=28;break}case 77:{e[U>>2]=e[o>>2],e[C>>2]=e[U>>2],Qc(t,h+4|0,r,C,c,gt),yt=28;break}case 116:case 110:{e[Q>>2]=e[o>>2],e[C>>2]=e[Q>>2],Kc(t,r,C,c,gt),yt=28;break}case 112:{e[K>>2]=e[o>>2],e[C>>2]=e[K>>2],Yc(t,h+8|0,r,C,c,gt),yt=28;break}case 114:{e[G>>2]=e[r>>2],e[$>>2]=e[o>>2],e[w>>2]=e[G>>2],e[C>>2]=e[$>>2],yt=wi(t,w,C,l,c,h,44884,44928)|0,e[r>>2]=yt,yt=28;break}case 82:{e[O>>2]=e[r>>2],e[Z>>2]=e[o>>2],e[w>>2]=e[O>>2],e[C>>2]=e[Z>>2],yt=wi(t,w,C,l,c,h,44928,44948)|0,e[r>>2]=yt,yt=28;break}case 83:{e[ie>>2]=e[o>>2],e[C>>2]=e[ie>>2],jc(t,h,r,C,c,gt),yt=28;break}case 84:{e[oe>>2]=e[r>>2],e[ne>>2]=e[o>>2],e[w>>2]=e[oe>>2],e[C>>2]=e[ne>>2],yt=wi(t,w,C,l,c,h,44948,44980)|0,e[r>>2]=yt,yt=28;break}case 119:{e[ce>>2]=e[o>>2],e[C>>2]=e[ce>>2],Xc(t,h+24|0,r,C,c,gt),yt=28;break}case 120:{qt=e[(e[t>>2]|0)+20>>2]|0,e[ke>>2]=e[r>>2],e[Ee>>2]=e[o>>2],e[w>>2]=e[ke>>2],e[C>>2]=e[Ee>>2],w=on[qt&63](t,w,C,l,c,h)|0;break}case 88:{qt=t+8|0,qt=Dt[e[(e[qt>>2]|0)+24>>2]&127](qt)|0,e[Te>>2]=e[r>>2],e[it>>2]=e[o>>2],d=S[qt>>0]|0,o=(d&1)==0,yt=qt+4|0,qt=o?yt:e[qt+8>>2]|0,yt=qt+((o?(d&255)>>>1:e[yt>>2]|0)<<2)|0,e[w>>2]=e[Te>>2],e[C>>2]=e[it>>2],yt=wi(t,w,C,l,c,h,qt,yt)|0,e[r>>2]=yt,yt=28;break}case 121:{e[Gt>>2]=e[o>>2],e[C>>2]=e[Gt>>2],Ns(t,h+20|0,r,C,c,gt),yt=28;break}case 89:{e[s0>>2]=e[o>>2],e[C>>2]=e[s0>>2],Zc(t,h+20|0,r,C,c,gt),yt=28;break}case 37:{e[i0>>2]=e[o>>2],e[C>>2]=e[i0>>2],Jc(t,r,C,c,gt),yt=28;break}default:e[c>>2]=e[c>>2]|4,yt=28}while(!1);return(yt|0)==28&&(w=e[r>>2]|0),b=Oe,w|0}function zc(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0;d=b,b=b+16|0,t=d+4|0,w=d,e[w>>2]=e[l>>2],e[t>>2]=e[w>>2],t=hi(o,t,c,h,2)|0,o=e[c>>2]|0,(t+-1|0)>>>0<31&(o&4|0)==0?e[r>>2]=t:e[c>>2]=o|4,b=d}function Gc(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0;d=b,b=b+16|0,t=d+4|0,w=d,e[w>>2]=e[l>>2],e[t>>2]=e[w>>2],t=hi(o,t,c,h,2)|0,o=e[c>>2]|0,(t|0)<24&(o&4|0)==0?e[r>>2]=t:e[c>>2]=o|4,b=d}function qc(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0;d=b,b=b+16|0,t=d+4|0,w=d,e[w>>2]=e[l>>2],e[t>>2]=e[w>>2],t=hi(o,t,c,h,2)|0,o=e[c>>2]|0,(t+-1|0)>>>0<12&(o&4|0)==0?e[r>>2]=t:e[c>>2]=o|4,b=d}function Wc(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0;d=b,b=b+16|0,t=d+4|0,w=d,e[w>>2]=e[l>>2],e[t>>2]=e[w>>2],t=hi(o,t,c,h,3)|0,o=e[c>>2]|0,(t|0)<366&(o&4|0)==0?e[r>>2]=t:e[c>>2]=o|4,b=d}function Hc(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0;d=b,b=b+16|0,t=d+4|0,w=d,e[w>>2]=e[l>>2],e[t>>2]=e[w>>2],t=hi(o,t,c,h,2)|0,o=e[c>>2]|0,(t|0)<13&(o&4|0)==0?e[r>>2]=t+-1:e[c>>2]=o|4,b=d}function Qc(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0;d=b,b=b+16|0,t=d+4|0,w=d,e[w>>2]=e[l>>2],e[t>>2]=e[w>>2],t=hi(o,t,c,h,2)|0,o=e[c>>2]|0,(t|0)<60&(o&4|0)==0?e[r>>2]=t:e[c>>2]=o|4,b=d}function Kc(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0;e:for(;;){t=e[r>>2]|0;do if(t)if(h=e[t+12>>2]|0,(h|0)==(e[t+16>>2]|0)?t=Dt[e[(e[t>>2]|0)+36>>2]&127](t)|0:t=e[h>>2]|0,(t|0)==-1){e[r>>2]=0,d=1;break}else{d=(e[r>>2]|0)==0;break}else d=1;while(!1);h=e[o>>2]|0;do if(h)if(t=e[h+12>>2]|0,(t|0)==(e[h+16>>2]|0)?t=Dt[e[(e[h>>2]|0)+36>>2]&127](h)|0:t=e[t>>2]|0,(t|0)!=-1)if(d){d=h;break}else{d=h;break e}else{e[o>>2]=0,w=15;break}else w=15;while(!1);if((w|0)==15)if(w=0,d){d=0;break}else d=0;if(t=e[r>>2]|0,h=e[t+12>>2]|0,(h|0)==(e[t+16>>2]|0)?t=Dt[e[(e[t>>2]|0)+36>>2]&127](t)|0:t=e[h>>2]|0,!(Yt[e[(e[c>>2]|0)+12>>2]&63](c,8192,t)|0))break;if(t=e[r>>2]|0,h=t+12|0,d=e[h>>2]|0,(d|0)==(e[t+16>>2]|0)){Dt[e[(e[t>>2]|0)+40>>2]&127](t)|0;continue}else{e[h>>2]=d+4;continue}}t=e[r>>2]|0;do if(t)if(h=e[t+12>>2]|0,(h|0)==(e[t+16>>2]|0)?t=Dt[e[(e[t>>2]|0)+36>>2]&127](t)|0:t=e[h>>2]|0,(t|0)==-1){e[r>>2]=0,h=1;break}else{h=(e[r>>2]|0)==0;break}else h=1;while(!1);do if(d)if(t=e[d+12>>2]|0,(t|0)==(e[d+16>>2]|0)?t=Dt[e[(e[d>>2]|0)+36>>2]&127](d)|0:t=e[t>>2]|0,(t|0)!=-1){if(h)break;w=39;break}else{e[o>>2]=0,w=37;break}else w=37;while(!1);(w|0)==37&&h&&(w=39),(w|0)==39&&(e[l>>2]=e[l>>2]|2)}function Yc(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0;k=b,b=b+16|0,w=k+4|0,C=k,D=t+8|0,D=Dt[e[(e[D>>2]|0)+8>>2]&127](D)|0,t=S[D>>0]|0,t&1?d=e[D+4>>2]|0:d=(t&255)>>>1,t=S[D+12>>0]|0,t&1?t=e[D+16>>2]|0:t=(t&255)>>>1;do if((d|0)!=(0-t|0)){if(e[C>>2]=e[l>>2],e[w>>2]=e[C>>2],t=An(o,w,D,D+24|0,h,c,0)|0,d=e[r>>2]|0,(t|0)==(D|0)&(d|0)==12){e[r>>2]=0;break}(d|0)<12&(t-D|0)==12&&(e[r>>2]=d+12)}else e[c>>2]=e[c>>2]|4;while(!1);b=k}function jc(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0;d=b,b=b+16|0,t=d+4|0,w=d,e[w>>2]=e[l>>2],e[t>>2]=e[w>>2],t=hi(o,t,c,h,2)|0,o=e[c>>2]|0,(t|0)<61&(o&4|0)==0?e[r>>2]=t:e[c>>2]=o|4,b=d}function Xc(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0;d=b,b=b+16|0,t=d+4|0,w=d,e[w>>2]=e[l>>2],e[t>>2]=e[w>>2],t=hi(o,t,c,h,1)|0,o=e[c>>2]|0,(t|0)<7&(o&4|0)==0?e[r>>2]=t:e[c>>2]=o|4,b=d}function Zc(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0;d=b,b=b+16|0,t=d+4|0,w=d,e[w>>2]=e[l>>2],e[t>>2]=e[w>>2],t=hi(o,t,c,h,4)|0,e[c>>2]&4||(e[r>>2]=t+-1900),b=d}function Jc(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0;t=e[r>>2]|0;do if(t)if(h=e[t+12>>2]|0,(h|0)==(e[t+16>>2]|0)?t=Dt[e[(e[t>>2]|0)+36>>2]&127](t)|0:t=e[h>>2]|0,(t|0)==-1){e[r>>2]=0,d=1;break}else{d=(e[r>>2]|0)==0;break}else d=1;while(!1);h=e[o>>2]|0;do if(h)if(t=e[h+12>>2]|0,(t|0)==(e[h+16>>2]|0)?t=Dt[e[(e[h>>2]|0)+36>>2]&127](h)|0:t=e[t>>2]|0,(t|0)!=-1)if(d){w=h,C=17;break}else{C=16;break}else{e[o>>2]=0,C=14;break}else C=14;while(!1);(C|0)==14&&(d?C=16:(w=0,C=17));e:do if((C|0)==16)e[l>>2]=e[l>>2]|6;else if((C|0)==17){if(t=e[r>>2]|0,h=e[t+12>>2]|0,(h|0)==(e[t+16>>2]|0)?t=Dt[e[(e[t>>2]|0)+36>>2]&127](t)|0:t=e[h>>2]|0,(Yt[e[(e[c>>2]|0)+52>>2]&63](c,t,0)|0)<<24>>24!=37){e[l>>2]=e[l>>2]|4;break}t=e[r>>2]|0,h=t+12|0,d=e[h>>2]|0,(d|0)==(e[t+16>>2]|0)?(Dt[e[(e[t>>2]|0)+40>>2]&127](t)|0,t=e[r>>2]|0,t?C=25:h=1):(e[h>>2]=d+4,C=25);do if((C|0)==25)if(h=e[t+12>>2]|0,(h|0)==(e[t+16>>2]|0)?t=Dt[e[(e[t>>2]|0)+36>>2]&127](t)|0:t=e[h>>2]|0,(t|0)==-1){e[r>>2]=0,h=1;break}else{h=(e[r>>2]|0)==0;break}while(!1);do if(w)if(t=e[w+12>>2]|0,(t|0)==(e[w+16>>2]|0)?t=Dt[e[(e[w>>2]|0)+36>>2]&127](w)|0:t=e[t>>2]|0,(t|0)!=-1){if(h)break e;break}else{e[o>>2]=0,C=37;break}else C=37;while(!1);if((C|0)==37&&!h)break;e[l>>2]=e[l>>2]|2}while(!1)}function ef(t){t=t|0,cn(t+8|0)}function cn(t){t=t|0;var r=0,o=0,l=0;r=e[t>>2]|0,g=0,o=Ce(3)|0,l=g,g=0;do if(!(l&1)){if((r|0)!=(o|0)&&(g=0,ue(188,e[t>>2]|0),l=g,g=0,l&1))break;return}while(!1);l=j(0)|0,$t(l)}function tf(t){t=t|0,cn(t+8|0),he(t)}function nf(t,r,o,l,c,h,d){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0;var w=0,C=0;if(C=b,b=b+112|0,w=C+4|0,o=C,e[o>>2]=w+100,Fs(t+8|0,w,o,c,h,d),c=e[o>>2]|0,o=e[r>>2]|0,(w|0)!=(c|0))do{d=S[w>>0]|0;do if(o)if(l=o+24|0,h=e[l>>2]|0,(h|0)==(e[o+28>>2]|0)){r=(U0[e[(e[o>>2]|0)+52>>2]&63](o,d&255)|0)==-1,o=r?0:o;break}else{e[l>>2]=h+1,S[h>>0]=d;break}else o=0;while(!1);w=w+1|0}while((w|0)!=(c|0));return b=C,o|0}function Fs(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0;D=b,b=b+16|0,C=D,S[C>>0]=37,d=C+1|0,S[d>>0]=c,w=C+2|0,S[w>>0]=h,S[C+3>>0]=0,h<<24>>24&&(S[d>>0]=h,S[w>>0]=c),t=r+(Go(r|0,(e[o>>2]|0)-r|0,C|0,l|0,e[t>>2]|0)|0)|0,e[o>>2]=t,b=D}function rf(t){t=t|0,cn(t+8|0)}function sf(t){t=t|0,cn(t+8|0),he(t)}function of(t,r,o,l,c,h,d){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0;var w=0;if(w=b,b=b+416|0,l=w+8|0,o=w,e[o>>2]=l+400,af(t+8|0,l,o,c,h,d),t=e[o>>2]|0,o=e[r>>2]|0,(l|0)!=(t|0)){c=l;do l=e[c>>2]|0,o?(h=o+24|0,d=e[h>>2]|0,(d|0)==(e[o+28>>2]|0)?l=U0[e[(e[o>>2]|0)+52>>2]&63](o,l)|0:(e[h>>2]=d+4,e[d>>2]=l),o=(l|0)==-1?0:o):o=0,c=c+4|0;while((c|0)!=(t|0))}return b=w,o|0}function af(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0;if(d=b,b=b+128|0,D=d+16|0,k=d+12|0,w=d,C=d+8|0,e[k>>2]=D+100,Fs(t,D,k,l,c,h),c=w,e[c>>2]=0,e[c+4>>2]=0,e[C>>2]=D,c=(e[o>>2]|0)-r>>2,h=ai(e[t>>2]|0)|0,g=0,c=Pe(18,r|0,C|0,c|0,w|0)|0,t=g,g=0,t&1&&(c=j()|0,h|0&&(g=0,ge(75,h|0)|0,k=g,g=0,k&1)&&(k=j(0)|0,$t(k)),le(c|0)),h|0&&(g=0,ge(75,h|0)|0,k=g,g=0,k&1)&&(k=j(0)|0,$t(k)),(c|0)==-1)fn(58955);else{e[o>>2]=r+(c<<2),b=d;return}}function lf(t){t=t|0}function uf(t){t=t|0,he(t)}function cf(t){return t=t|0,127}function ff(t){return t=t|0,127}function hf(t,r){t=t|0,r=r|0,e[t>>2]=0,e[t+4>>2]=0,e[t+8>>2]=0}function df(t,r){t=t|0,r=r|0,e[t>>2]=0,e[t+4>>2]=0,e[t+8>>2]=0}function pf(t,r){t=t|0,r=r|0,e[t>>2]=0,e[t+4>>2]=0,e[t+8>>2]=0}function mf(t,r){t=t|0,r=r|0,dr(t,1,45)}function gf(t){return t=t|0,0}function Sf(t,r){t=t|0,r=r|0,S[t>>0]=2,S[t+1>>0]=3,S[t+2>>0]=0,S[t+3>>0]=4}function Af(t,r){t=t|0,r=r|0,S[t>>0]=2,S[t+1>>0]=3,S[t+2>>0]=0,S[t+3>>0]=4}function vf(t){t=t|0}function xf(t){t=t|0,he(t)}function wf(t){return t=t|0,127}function yf(t){return t=t|0,127}function Cf(t,r){t=t|0,r=r|0,e[t>>2]=0,e[t+4>>2]=0,e[t+8>>2]=0}function Tf(t,r){t=t|0,r=r|0,e[t>>2]=0,e[t+4>>2]=0,e[t+8>>2]=0}function If(t,r){t=t|0,r=r|0,e[t>>2]=0,e[t+4>>2]=0,e[t+8>>2]=0}function Ef(t,r){t=t|0,r=r|0,dr(t,1,45)}function kf(t){return t=t|0,0}function Df(t,r){t=t|0,r=r|0,S[t>>0]=2,S[t+1>>0]=3,S[t+2>>0]=0,S[t+3>>0]=4}function bf(t,r){t=t|0,r=r|0,S[t>>0]=2,S[t+1>>0]=3,S[t+2>>0]=0,S[t+3>>0]=4}function Nf(t){t=t|0}function Ff(t){t=t|0,he(t)}function Rf(t){return t=t|0,2147483647}function Mf(t){return t=t|0,2147483647}function _f(t,r){t=t|0,r=r|0,e[t>>2]=0,e[t+4>>2]=0,e[t+8>>2]=0}function Pf(t,r){t=t|0,r=r|0,e[t>>2]=0,e[t+4>>2]=0,e[t+8>>2]=0}function Lf(t,r){t=t|0,r=r|0,e[t>>2]=0,e[t+4>>2]=0,e[t+8>>2]=0}function Of(t,r){t=t|0,r=r|0,gr(t,1,45)}function $f(t){return t=t|0,0}function Bf(t,r){t=t|0,r=r|0,S[t>>0]=2,S[t+1>>0]=3,S[t+2>>0]=0,S[t+3>>0]=4}function Vf(t,r){t=t|0,r=r|0,S[t>>0]=2,S[t+1>>0]=3,S[t+2>>0]=0,S[t+3>>0]=4}function Uf(t){t=t|0}function zf(t){t=t|0,he(t)}function Gf(t){return t=t|0,2147483647}function qf(t){return t=t|0,2147483647}function Wf(t,r){t=t|0,r=r|0,e[t>>2]=0,e[t+4>>2]=0,e[t+8>>2]=0}function Hf(t,r){t=t|0,r=r|0,e[t>>2]=0,e[t+4>>2]=0,e[t+8>>2]=0}function Qf(t,r){t=t|0,r=r|0,e[t>>2]=0,e[t+4>>2]=0,e[t+8>>2]=0}function Kf(t,r){t=t|0,r=r|0,gr(t,1,45)}function Yf(t){return t=t|0,0}function jf(t,r){t=t|0,r=r|0,S[t>>0]=2,S[t+1>>0]=3,S[t+2>>0]=0,S[t+3>>0]=4}function Xf(t,r){t=t|0,r=r|0,S[t>>0]=2,S[t+1>>0]=3,S[t+2>>0]=0,S[t+3>>0]=4}function Zf(t){t=t|0}function Jf(t){t=t|0,he(t)}function eh(t,r,o,l,c,h,d){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0;var w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0,ce=0,ke=0,Ee=0,Te=0;if(oe=b,b=b+240|0,Z=oe+24|0,ie=oe,t=oe+136|0,ce=oe+16|0,O=oe+12|0,ne=oe+8|0,N=oe+134|0,C=oe+4|0,P=oe+124|0,e[ce>>2]=t,ke=ce+4|0,e[ke>>2]=189,D=t+100|0,g=0,w=ge(68,c|0)|0,$=g,g=0,$&1)C=j()|0,e[ce>>2]=0,w=189,Te=45;else{e[ne>>2]=w,g=0,t=be(37,ne|0,44220)|0,$=g,g=0;e:do if(!($&1)&&(S[N>>0]=0,e[C>>2]=e[o>>2],k=e[c+4>>2]|0,g=0,e[Z>>2]=e[C>>2],k=Ut(1,r|0,Z|0,l|0,ne|0,k|0,h|0,N|0,t|0,ce|0,O|0,D|0)|0,$=g,g=0,!($&1))){t:do if(k){if(g=0,Pe(e[(e[t>>2]|0)+32>>2]|0,t|0,58976,58986,P|0)|0,$=g,g=0,$&1){Te=10;break e}C=e[O>>2]|0,D=e[ce>>2]|0,t=C-D|0,(t|0)>98?(t=E0(t+2|0)|0,w=t,t?Te=13:(g=0,Nt(6),$=g,g=0,$&1||(t=0,Te=13))):(w=0,t=Z,Te=13);do if((Te|0)==13){if(S[N>>0]|0&&(S[t>>0]=45,t=t+1|0),G=P+10|0,$=P,D>>>0>>0){k=P+1|0,l=k+1|0,c=l+1|0,N=c+1|0,R=N+1|0,_=R+1|0,U=_+1|0,Q=U+1|0,K=Q+1|0;do{C=S[D>>0]|0;do if((S[P>>0]|0)!=C<<24>>24)if((S[k>>0]|0)!=C<<24>>24)if((S[l>>0]|0)!=C<<24>>24)if((S[c>>0]|0)!=C<<24>>24)if((S[N>>0]|0)==C<<24>>24)C=N;else{if((S[R>>0]|0)==C<<24>>24){C=R;break}if((S[_>>0]|0)==C<<24>>24){C=_;break}if((S[U>>0]|0)==C<<24>>24){C=U;break}if((S[Q>>0]|0)==C<<24>>24){C=Q;break}C=(S[K>>0]|0)==C<<24>>24?K:G}else C=c;else C=l;else C=k;else C=P;while(!1);S[t>>0]=S[58976+(C-$)>>0]|0,D=D+1|0,t=t+1|0}while(D>>>0<(e[O>>2]|0)>>>0)}if(S[t>>0]=0,e[ie>>2]=d,(_o(Z,58987,ie)|0)!=1&&(g=0,ue(190,58991),d=g,g=0,d&1))break;w&&n0(w);break t}while(!1);if(t=j()|0,!w){C=t,w=ce;break e}n0(w),C=t,w=ce;break e}while(!1);t=e[r>>2]|0;do if(t){if((e[t+12>>2]|0)==(e[t+16>>2]|0)){if(g=0,t=ge(e[(e[t>>2]|0)+36>>2]|0,t|0)|0,d=g,g=0,d&1){Te=10;break e}if((t|0)==-1){e[r>>2]=0,t=0;break}else{t=e[r>>2]|0;break}}}else t=0;while(!1);w=(t|0)==0,t=e[o>>2]|0;do if(t){if((e[t+12>>2]|0)==(e[t+16>>2]|0)){if(g=0,t=ge(e[(e[t>>2]|0)+36>>2]|0,t|0)|0,d=g,g=0,d&1){Te=10;break e}if((t|0)==-1){e[o>>2]=0,Te=37;break}}w||(Te=38)}else Te=37;while(!1);return(Te|0)==37&&w&&(Te=38),(Te|0)==38&&(e[h>>2]=e[h>>2]|2),w=e[r>>2]|0,Bt(e[ne>>2]|0)|0,t=e[ce>>2]|0,e[ce>>2]=0,t|0&&(g=0,ue(e[ke>>2]|0,t|0),Te=g,g=0,Te&1)&&(Te=j(0)|0,$t(Te)),b=oe,w|0}else Te=10;while(!1);(Te|0)==10&&(C=j()|0,w=ce),Bt(e[ne>>2]|0)|0,t=e[w>>2]|0,e[w>>2]=0,t?(w=e[ke>>2]|0,Te=45):Ee=C}return(Te|0)==45&&(g=0,ue(w|0,t|0),Te=g,g=0,Te&1?(Te=j(0)|0,$t(Te)):Ee=C),le(Ee|0),0}function th(t){t=t|0}function ih(t,r,o,l,c,h,d,w,C,D,k){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0,w=w|0,C=C|0,D=D|0,k=k|0;var N=0,R=0,_=0,U=0,Q=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0,ce=0,ke=0,Ee=0,Te=0,it=0,jt=0,Gt=0,s0=0,i0=0,zt=0,gt=0,Kt=0,dt=0,At=0,y0=0,T0=0,g0=0,Oe=0,yt=0,qt=0,c0=0,a0=0,h0=0,D0=0,A0=0,Ti=0,F0=0;A0=b,b=b+512|0,gt=A0+88|0,U=A0+96|0,F0=A0+80|0,y0=A0+72|0,At=A0+68|0,T0=A0+500|0,Kt=A0+497|0,g0=A0+496|0,qt=A0+56|0,D0=A0+44|0,a0=A0+32|0,c0=A0+20|0,h0=A0+8|0,dt=A0+4|0,yt=A0,e[gt>>2]=k,e[F0>>2]=U,Ti=F0+4|0,e[Ti>>2]=189,e[y0>>2]=U,e[At>>2]=U+400,e[qt>>2]=0,e[qt+4>>2]=0,e[qt+8>>2]=0,e[D0>>2]=0,e[D0+4>>2]=0,e[D0+8>>2]=0,e[a0>>2]=0,e[a0+4>>2]=0,e[a0+8>>2]=0,e[c0>>2]=0,e[c0+4>>2]=0,e[c0+8>>2]=0,e[h0>>2]=0,e[h0+4>>2]=0,e[h0+8>>2]=0,g=0,I0(1,o|0,l|0,T0|0,Kt|0,g0|0,qt|0,D0|0,a0|0,c0|0,dt|0),zt=g,g=0;e:do if(zt&1)w=j()|0;else{e[D>>2]=e[C>>2],Te=w+8|0,it=a0+4|0,jt=c0+4|0,Gt=c0+8|0,s0=c0+1|0,i0=a0+8|0,zt=a0+1|0,P=(c&512|0)!=0,O=D0+8|0,Z=D0+1|0,ie=D0+4|0,oe=h0+4|0,ne=h0+8|0,ce=h0+1|0,ke=T0+3|0,Ee=qt+4|0,$=0,_=0;t:for(;;){k=e[t>>2]|0;do if(k){if((e[k+12>>2]|0)==(e[k+16>>2]|0)){if(g=0,k=ge(e[(e[k>>2]|0)+36>>2]|0,k|0)|0,G=g,g=0,G&1){Oe=24;break t}if((k|0)==-1){e[t>>2]=0,k=0;break}else{k=e[t>>2]|0;break}}}else k=0;while(!1);k=(k|0)==0,w=e[r>>2]|0;do if(w){if((e[w+12>>2]|0)!=(e[w+16>>2]|0))if(k){G=w;break}else{Oe=235;break t}if(g=0,o=ge(e[(e[w>>2]|0)+36>>2]|0,w|0)|0,G=g,g=0,G&1){Oe=24;break t}if((o|0)!=-1)if(k){G=w;break}else{Oe=235;break t}else{e[r>>2]=0,Oe=15;break}}else Oe=15;while(!1);if((Oe|0)==15)if(Oe=0,k){Oe=235;break}else G=0;i:do switch(S[T0+$>>0]|0){case 1:{if(($|0)!=3){if(k=e[t>>2]|0,w=e[k+12>>2]|0,(w|0)==(e[k+16>>2]|0)){if(g=0,k=ge(e[(e[k>>2]|0)+36>>2]|0,k|0)|0,Oe=g,g=0,Oe&1){Oe=24;break t}}else k=F[w>>0]|0;if((k&255)<<24>>24<=-1){Oe=40;break t}if(!(I[(e[Te>>2]|0)+(k<<24>>24<<1)>>1]&8192)){Oe=40;break t}if(k=e[t>>2]|0,w=k+12|0,o=e[w>>2]|0,(o|0)==(e[k+16>>2]|0)){if(g=0,k=ge(e[(e[k>>2]|0)+40>>2]|0,k|0)|0,Oe=g,g=0,Oe&1){Oe=24;break t}}else e[w>>2]=o+1,k=F[o>>0]|0;if(g=0,Ae(67,h0|0,k&255|0),Oe=g,g=0,Oe&1){Oe=24;break t}else k=G,l=G,Oe=42}break}case 0:{($|0)!=3&&(k=G,l=G,Oe=42);break}case 3:{if(w=S[a0>>0]|0,k=w&1?e[it>>2]|0:(w&255)>>>1,o=S[c0>>0]|0,l=o&1?e[jt>>2]|0:(o&255)>>>1,(k|0)!=(0-l|0)){if(!k){if(k=e[t>>2]|0,w=e[k+12>>2]|0,(w|0)==(e[k+16>>2]|0)){if(g=0,k=ge(e[(e[k>>2]|0)+36>>2]|0,k|0)|0,G=g,g=0,G&1){Oe=24;break t}w=S[c0>>0]|0}else k=F[w>>0]|0,w=o;if((k&255)<<24>>24!=(S[(w&1?e[Gt>>2]|0:s0)>>0]|0))break i;if(k=e[t>>2]|0,w=k+12|0,o=e[w>>2]|0,(o|0)==(e[k+16>>2]|0)){if(g=0,ge(e[(e[k>>2]|0)+40>>2]|0,k|0)|0,G=g,g=0,G&1){Oe=24;break t}}else e[w>>2]=o+1;S[d>>0]=1,G=S[c0>>0]|0,_=(G&1?e[jt>>2]|0:(G&255)>>>1)>>>0>1?c0:_;break i}if(c=e[t>>2]|0,N=e[c+12>>2]|0,o=e[c+16>>2]|0,k=(N|0)==(o|0),!l){if(k){if(g=0,k=ge(e[(e[c>>2]|0)+36>>2]|0,c|0)|0,G=g,g=0,G&1){Oe=24;break t}w=S[a0>>0]|0}else k=F[N>>0]|0;if((k&255)<<24>>24!=(S[(w&1?e[i0>>2]|0:zt)>>0]|0)){S[d>>0]=1;break i}if(k=e[t>>2]|0,w=k+12|0,o=e[w>>2]|0,(o|0)==(e[k+16>>2]|0)){if(g=0,ge(e[(e[k>>2]|0)+40>>2]|0,k|0)|0,G=g,g=0,G&1){Oe=24;break t}}else e[w>>2]=o+1;G=S[a0>>0]|0,_=(G&1?e[it>>2]|0:(G&255)>>>1)>>>0>1?a0:_;break i}if(k){if(g=0,k=ge(e[(e[c>>2]|0)+36>>2]|0,c|0)|0,G=g,g=0,G&1){Oe=24;break t}o=e[t>>2]|0,w=S[a0>>0]|0,c=o,N=e[o+12>>2]|0,o=e[o+16>>2]|0}else k=F[N>>0]|0;if(l=c+12|0,o=(N|0)==(o|0),(k&255)<<24>>24==(S[(w&1?e[i0>>2]|0:zt)>>0]|0)){if(o){if(g=0,ge(e[(e[c>>2]|0)+40>>2]|0,c|0)|0,G=g,g=0,G&1){Oe=24;break t}}else e[l>>2]=N+1;G=S[a0>>0]|0,_=(G&1?e[it>>2]|0:(G&255)>>>1)>>>0>1?a0:_;break i}if(o){if(g=0,k=ge(e[(e[c>>2]|0)+36>>2]|0,c|0)|0,G=g,g=0,G&1){Oe=24;break t}}else k=F[N>>0]|0;if((k&255)<<24>>24!=(S[(S[c0>>0]&1?e[Gt>>2]|0:s0)>>0]|0)){Oe=104;break t}if(k=e[t>>2]|0,w=k+12|0,o=e[w>>2]|0,(o|0)==(e[k+16>>2]|0)){if(g=0,ge(e[(e[k>>2]|0)+40>>2]|0,k|0)|0,G=g,g=0,G&1){Oe=24;break t}}else e[w>>2]=o+1;S[d>>0]=1,G=S[c0>>0]|0,_=(G&1?e[jt>>2]|0:(G&255)>>>1)>>>0>1?c0:_}break}case 2:{if(!($>>>0<2|(_|0)!=0)&&!(P|($|0)==2&(S[ke>>0]|0)!=0)){_=0;break i}Q=S[D0>>0]|0,k=(Q&1)==0,K=e[O>>2]|0,o=k?Z:K,R=o;n:do if($|0&&(F[T0+($+-1)>>0]|0)<2){N=k?(Q&255)>>>1:e[ie>>2]|0,l=o+N|0,c=e[Te>>2]|0;r:do if(!N)w=R;else{N=o,w=R;do{if(k=S[N>>0]|0,k<<24>>24<=-1||!(I[c+(k<<24>>24<<1)>>1]&8192))break r;N=N+1|0,w=N}while((N|0)!=(l|0))}while(!1);if(l=w-R|0,c=S[h0>>0]|0,k=(c&1)==0,c=k?(c&255)>>>1:e[oe>>2]|0,c>>>0>=l>>>0){if(k=k?ce:e[ne>>2]|0,N=k+c|0,(w|0)!=(R|0))for(k=k+(c-l)|0;;){if((S[k>>0]|0)!=(S[o>>0]|0)){w=R;break n}if(k=k+1|0,(k|0)==(N|0))break;o=o+1|0}}else w=R}else w=R;while(!1);k=(Q&1)==0,k=(k?Z:K)+(k?(Q&255)>>>1:e[ie>>2]|0)|0;n:do if((w|0)!=(k|0))for(c=G,l=G,k=w;;){w=e[t>>2]|0;do if(w){if((e[w+12>>2]|0)==(e[w+16>>2]|0)){if(g=0,w=ge(e[(e[w>>2]|0)+36>>2]|0,w|0)|0,G=g,g=0,G&1){Oe=21;break t}if((w|0)==-1){e[t>>2]=0,w=0;break}else{w=e[t>>2]|0;break}}}else w=0;while(!1);o=(w|0)==0;do if(l){if((e[l+12>>2]|0)!=(e[l+16>>2]|0))if(o){w=c,N=l;break}else break n;if(g=0,w=ge(e[(e[l>>2]|0)+36>>2]|0,l|0)|0,G=g,g=0,G&1){Oe=21;break t}if((w|0)!=-1)if(o^(c|0)==0){w=c,N=c;break}else break n;else{e[r>>2]=0,w=0,Oe=131;break}}else w=c,Oe=131;while(!1);if((Oe|0)==131){if(Oe=0,o)break n;N=0}if(o=e[t>>2]|0,l=e[o+12>>2]|0,(l|0)==(e[o+16>>2]|0)){if(g=0,o=ge(e[(e[o>>2]|0)+36>>2]|0,o|0)|0,G=g,g=0,G&1){Oe=21;break t}}else o=F[l>>0]|0;if((o&255)<<24>>24!=(S[k>>0]|0))break n;if(o=e[t>>2]|0,l=o+12|0,c=e[l>>2]|0,(c|0)==(e[o+16>>2]|0)){if(g=0,ge(e[(e[o>>2]|0)+40>>2]|0,o|0)|0,G=g,g=0,G&1){Oe=21;break t}}else e[l>>2]=c+1;if(k=k+1|0,o=S[D0>>0]|0,G=(o&1)==0,o=(G?Z:e[O>>2]|0)+(G?(o&255)>>>1:e[ie>>2]|0)|0,(k|0)==(o|0)){k=o;break}else c=w,l=N}while(!1);if(P&&(G=S[D0>>0]|0,K=(G&1)==0,(k|0)!=((K?Z:e[O>>2]|0)+(K?(G&255)>>>1:e[ie>>2]|0)|0))){Oe=143;break t}break}case 4:{R=S[g0>>0]|0,w=G,c=G,k=0;n:for(;;){o=e[t>>2]|0;do if(o){if((e[o+12>>2]|0)==(e[o+16>>2]|0)){if(g=0,o=ge(e[(e[o>>2]|0)+36>>2]|0,o|0)|0,G=g,g=0,G&1){Oe=23;break t}if((o|0)==-1){e[t>>2]=0,o=0;break}else{o=e[t>>2]|0;break}}}else o=0;while(!1);l=(o|0)==0;do if(c){if((e[c+12>>2]|0)!=(e[c+16>>2]|0))if(l){N=w;break}else{l=w;break n}if(g=0,o=ge(e[(e[c>>2]|0)+36>>2]|0,c|0)|0,G=g,g=0,G&1){Oe=23;break t}if((o|0)!=-1)if(l^(w|0)==0){N=w,c=w;break}else{l=w;break n}else{e[r>>2]=0,w=0,Oe=156;break}}else Oe=156;while(!1);if((Oe|0)==156)if(Oe=0,l){l=w;break}else N=w,c=0;if(w=e[t>>2]|0,o=e[w+12>>2]|0,(o|0)==(e[w+16>>2]|0)){if(g=0,w=ge(e[(e[w>>2]|0)+36>>2]|0,w|0)|0,G=g,g=0,G&1){Oe=23;break t}}else w=F[o>>0]|0;if(o=w&255,o<<24>>24>-1&&I[(e[Te>>2]|0)+(w<<24>>24<<1)>>1]&2048){if(w=e[D>>2]|0,(w|0)==(e[gt>>2]|0)){if(g=0,xe(12,C|0,D|0,gt|0),G=g,g=0,G&1){Oe=23;break t}w=e[D>>2]|0}e[D>>2]=w+1,S[w>>0]=o,k=k+1|0}else{if(G=S[qt>>0]|0,!(o<<24>>24==R<<24>>24&(k|0?((G&1?e[Ee>>2]|0:(G&255)>>>1)|0)!=0:0))){l=N;break}if((U|0)==(e[At>>2]|0)){if(g=0,xe(13,F0|0,y0|0,At|0),G=g,g=0,G&1){Oe=23;break t}U=e[y0>>2]|0}G=U+4|0,e[y0>>2]=G,e[U>>2]=k,U=G,k=0}if(w=e[t>>2]|0,o=w+12|0,l=e[o>>2]|0,(l|0)==(e[w+16>>2]|0))if(g=0,ge(e[(e[w>>2]|0)+40>>2]|0,w|0)|0,G=g,g=0,G&1){Oe=23;break t}else{w=N;continue}else{e[o>>2]=l+1,w=N;continue}}if(k|0&&(e[F0>>2]|0)!=(U|0)){if((U|0)==(e[At>>2]|0)){if(g=0,xe(13,F0|0,y0|0,At|0),G=g,g=0,G&1){Oe=24;break t}U=e[y0>>2]|0}G=U+4|0,e[y0>>2]=G,e[U>>2]=k,U=G}if(N=e[dt>>2]|0,(N|0)>0){k=e[t>>2]|0;do if(k){if((e[k+12>>2]|0)==(e[k+16>>2]|0)){if(g=0,k=ge(e[(e[k>>2]|0)+36>>2]|0,k|0)|0,G=g,g=0,G&1){Oe=24;break t}if((k|0)==-1){e[t>>2]=0,k=0;break}else{k=e[t>>2]|0;break}}}else k=0;while(!1);k=(k|0)==0;do if(l){if((e[l+12>>2]|0)==(e[l+16>>2]|0)){if(g=0,w=ge(e[(e[l>>2]|0)+36>>2]|0,l|0)|0,G=g,g=0,G&1){Oe=24;break t}if((w|0)==-1){e[r>>2]=0,Oe=193;break}}if(!k){Oe=198;break t}}else Oe=193;while(!1);if((Oe|0)==193)if(Oe=0,k){Oe=198;break t}else l=0;if(k=e[t>>2]|0,w=e[k+12>>2]|0,(w|0)==(e[k+16>>2]|0)){if(g=0,k=ge(e[(e[k>>2]|0)+36>>2]|0,k|0)|0,G=g,g=0,G&1){Oe=24;break t}}else k=F[w>>0]|0;if((k&255)<<24>>24!=(S[Kt>>0]|0)){Oe=198;break t}if(k=e[t>>2]|0,w=k+12|0,o=e[w>>2]|0,(o|0)==(e[k+16>>2]|0)){if(g=0,ge(e[(e[k>>2]|0)+40>>2]|0,k|0)|0,G=g,g=0,G&1){Oe=24;break t}}else e[w>>2]=o+1;if((N|0)>0)for(c=l,o=l,R=N;;){k=e[t>>2]|0;do if(k){if((e[k+12>>2]|0)==(e[k+16>>2]|0)){if(g=0,k=ge(e[(e[k>>2]|0)+36>>2]|0,k|0)|0,G=g,g=0,G&1){Oe=22;break t}if((k|0)==-1){e[t>>2]=0,k=0;break}else{k=e[t>>2]|0;break}}}else k=0;while(!1);w=(k|0)==0;do if(o){if((e[o+12>>2]|0)!=(e[o+16>>2]|0))if(w){k=c,N=o;break}else{Oe=222;break t}if(g=0,k=ge(e[(e[o>>2]|0)+36>>2]|0,o|0)|0,G=g,g=0,G&1){Oe=22;break t}if((k|0)!=-1)if(w^(c|0)==0){k=c,N=c;break}else{Oe=222;break t}else{e[r>>2]=0,k=0,Oe=215;break}}else k=c,Oe=215;while(!1);if((Oe|0)==215)if(Oe=0,w){Oe=222;break t}else N=0;if(w=e[t>>2]|0,o=e[w+12>>2]|0,(o|0)==(e[w+16>>2]|0)){if(g=0,w=ge(e[(e[w>>2]|0)+36>>2]|0,w|0)|0,G=g,g=0,G&1){Oe=22;break t}}else w=F[o>>0]|0;if((w&255)<<24>>24<=-1){Oe=222;break t}if(!(I[(e[Te>>2]|0)+(w<<24>>24<<1)>>1]&2048)){Oe=222;break t}if((e[D>>2]|0)==(e[gt>>2]|0)&&(g=0,xe(12,C|0,D|0,gt|0),G=g,g=0,G&1)){Oe=22;break t}if(w=e[t>>2]|0,o=e[w+12>>2]|0,(o|0)==(e[w+16>>2]|0)){if(g=0,w=ge(e[(e[w>>2]|0)+36>>2]|0,w|0)|0,G=g,g=0,G&1){Oe=22;break t}}else w=F[o>>0]|0;if(o=e[D>>2]|0,e[D>>2]=o+1,S[o>>0]=w,w=R,R=R+-1|0,e[dt>>2]=R,o=e[t>>2]|0,l=o+12|0,c=e[l>>2]|0,(c|0)==(e[o+16>>2]|0)){if(g=0,ge(e[(e[o>>2]|0)+40>>2]|0,o|0)|0,G=g,g=0,G&1){Oe=22;break t}}else e[l>>2]=c+1;if((w|0)<=1)break;c=k,o=N}}if((e[D>>2]|0)==(e[C>>2]|0)){Oe=233;break t}break}default:}while(!1);i:do if((Oe|0)==42)for(;;){Oe=0,w=e[t>>2]|0;do if(w){if((e[w+12>>2]|0)==(e[w+16>>2]|0)){if(g=0,w=ge(e[(e[w>>2]|0)+36>>2]|0,w|0)|0,G=g,g=0,G&1){Oe=20;break t}if((w|0)==-1){e[t>>2]=0,w=0;break}else{w=e[t>>2]|0;break}}}else w=0;while(!1);o=(w|0)==0;do if(l){if((e[l+12>>2]|0)!=(e[l+16>>2]|0))if(o){c=k;break}else break i;if(g=0,w=ge(e[(e[l>>2]|0)+36>>2]|0,l|0)|0,G=g,g=0,G&1){Oe=20;break t}if((w|0)!=-1)if(o^(k|0)==0){c=k,l=k;break}else break i;else{e[r>>2]=0,k=0,Oe=54;break}}else Oe=54;while(!1);if((Oe|0)==54){if(Oe=0,o)break i;c=k,l=0}if(k=e[t>>2]|0,w=e[k+12>>2]|0,(w|0)==(e[k+16>>2]|0)){if(g=0,k=ge(e[(e[k>>2]|0)+36>>2]|0,k|0)|0,G=g,g=0,G&1){Oe=20;break t}}else k=F[w>>0]|0;if((k&255)<<24>>24<=-1||!(I[(e[Te>>2]|0)+(k<<24>>24<<1)>>1]&8192))break i;if(k=e[t>>2]|0,w=k+12|0,o=e[w>>2]|0,(o|0)==(e[k+16>>2]|0)){if(g=0,k=ge(e[(e[k>>2]|0)+40>>2]|0,k|0)|0,Oe=g,g=0,Oe&1){Oe=20;break t}}else e[w>>2]=o+1,k=F[o>>0]|0;if(g=0,Ae(67,h0|0,k&255|0),Oe=g,g=0,Oe&1){Oe=20;break t}else k=c,Oe=42}while(!1);if($=$+1|0,$>>>0>=4){Oe=235;break}}t:switch(Oe|0){case 20:{w=j()|0;break e}case 21:{w=j()|0;break e}case 22:{w=j()|0;break e}case 23:{w=j()|0;break e}case 24:{w=j()|0;break e}case 40:{e[h>>2]=e[h>>2]|4,w=0;break}case 104:{e[h>>2]=e[h>>2]|4,w=0;break}case 143:{e[h>>2]=e[h>>2]|4,w=0;break}case 198:{e[h>>2]=e[h>>2]|4,w=0;break}case 222:{e[h>>2]=e[h>>2]|4,w=0;break}case 233:{e[h>>2]=e[h>>2]|4,w=0;break}case 235:{i:do if(_){c=_+1|0,N=_+8|0,R=_+4|0,o=1;n:for(;;){if(k=S[_>>0]|0,k&1?k=e[R>>2]|0:k=(k&255)>>>1,o>>>0>=k>>>0)break i;k=e[t>>2]|0;do if(k){if((e[k+12>>2]|0)==(e[k+16>>2]|0)){if(g=0,k=ge(e[(e[k>>2]|0)+36>>2]|0,k|0)|0,D=g,g=0,D&1){Oe=19;break n}if((k|0)==-1){e[t>>2]=0,k=0;break}else{k=e[t>>2]|0;break}}}else k=0;while(!1);w=(k|0)==0,k=e[r>>2]|0;do if(k){if((e[k+12>>2]|0)==(e[k+16>>2]|0)){if(g=0,k=ge(e[(e[k>>2]|0)+36>>2]|0,k|0)|0,D=g,g=0,D&1){Oe=19;break n}if((k|0)==-1){e[r>>2]=0,Oe=253;break}}if(!w){Oe=260;break n}}else Oe=253;while(!1);if((Oe|0)==253&&(Oe=0,w)){Oe=260;break}if(k=e[t>>2]|0,w=e[k+12>>2]|0,(w|0)==(e[k+16>>2]|0)){if(g=0,k=ge(e[(e[k>>2]|0)+36>>2]|0,k|0)|0,D=g,g=0,D&1){Oe=19;break}}else k=F[w>>0]|0;if(S[_>>0]&1?w=e[N>>2]|0:w=c,(k&255)<<24>>24!=(S[w+o>>0]|0)){Oe=260;break}if(k=o+1|0,w=e[t>>2]|0,o=w+12|0,l=e[o>>2]|0,(l|0)==(e[w+16>>2]|0))if(g=0,ge(e[(e[w>>2]|0)+40>>2]|0,w|0)|0,D=g,g=0,D&1){Oe=19;break}else{o=k;continue}else{e[o>>2]=l+1,o=k;continue}}if((Oe|0)==19){w=j()|0;break e}else if((Oe|0)==260){e[h>>2]=e[h>>2]|4,w=0;break t}}while(!1);k=e[F0>>2]|0,(k|0)!=(U|0)&&(e[yt>>2]=0,V0(qt,k,U,yt),(e[yt>>2]|0)!=0)?(e[h>>2]=e[h>>2]|4,w=0):w=1;break}}return de(h0),de(c0),de(a0),de(D0),de(qt),k=e[F0>>2]|0,e[F0>>2]=0,k|0&&(g=0,ue(e[Ti>>2]|0,k|0),F0=g,g=0,F0&1)&&(F0=j(0)|0,$t(F0)),b=A0,w|0}while(!1);return de(h0),de(c0),de(a0),de(D0),de(qt),k=e[F0>>2]|0,e[F0>>2]=0,k|0&&(g=0,ue(e[Ti>>2]|0,k|0),F0=g,g=0,F0&1)&&(F0=j(0)|0,$t(F0)),le(w|0),0}function fn(t){t=t|0;var r=0;r=Ct(8)|0,g=0,Ae(90,r|0,t|0),t=g,g=0,t&1?(t=j()|0,Tt(r|0),le(t|0)):Qt(r|0,616,80)}function nh(t,r,o,l,c,h,d){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0;var w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0;if($=b,b=b+144|0,w=$+24|0,t=$+32|0,P=$+16|0,U=$+8|0,N=$+4|0,R=$+28|0,C=$,e[P>>2]=t,ie=P+4|0,e[ie>>2]=189,D=t+100|0,g=0,G=ge(68,c|0)|0,k=g,g=0,k&1)w=j()|0,e[P>>2]=0,Z=36;else{e[N>>2]=G,g=0,k=be(37,N|0,44220)|0,t=g,g=0;e:do if(!(t&1)&&(S[R>>0]=0,Q=e[o>>2]|0,e[C>>2]=Q,_=e[c+4>>2]|0,K=Q,g=0,e[w>>2]=e[C>>2],_=Ut(1,r|0,w|0,l|0,N|0,_|0,h|0,R|0,k|0,P|0,U|0,D|0)|0,c=g,g=0,!(c&1))){if(_){if(S[d>>0]&1?(S[e[d+8>>2]>>0]=0,e[d+4>>2]=0):(S[d+1>>0]=0,S[d>>0]=0),S[R>>0]|0&&(g=0,t=be(e[(e[k>>2]|0)+28>>2]|0,k|0,45)|0,c=g,g=0,c&1||(g=0,Ae(67,d|0,t|0),c=g,g=0,c&1))||(g=0,C=be(e[(e[k>>2]|0)+28>>2]|0,k|0,48)|0,c=g,g=0,c&1))break;t=e[P>>2]|0,D=e[U>>2]|0,w=D+-1|0;t:do if(t>>>0>>0)do{if((S[t>>0]|0)!=C<<24>>24)break t;t=t+1|0}while(t>>>0>>0);while(!1);if(g=0,Ve(32,d|0,t|0,D|0)|0,d=g,g=0,d&1)break}t=e[r>>2]|0;do if(t){if((e[t+12>>2]|0)==(e[t+16>>2]|0)){if(g=0,t=ge(e[(e[t>>2]|0)+36>>2]|0,t|0)|0,d=g,g=0,d&1)break e;if((t|0)==-1){e[r>>2]=0,t=0;break}else{t=e[r>>2]|0;break}}}else t=0;while(!1);w=(t|0)==0;do if(Q){if((e[K+12>>2]|0)==(e[K+16>>2]|0)){if(g=0,t=ge(e[(e[Q>>2]|0)+36>>2]|0,K|0)|0,K=g,g=0,K&1)break e;if((t|0)==-1){e[o>>2]=0,Z=29;break}}w||(Z=30)}else Z=29;while(!1);return(Z|0)==29&&w&&(Z=30),(Z|0)==30&&(e[h>>2]=e[h>>2]|2),w=e[r>>2]|0,Bt(G)|0,t=e[P>>2]|0,e[P>>2]=0,t|0&&(g=0,ue(e[ie>>2]|0,t|0),ie=g,g=0,ie&1)&&(ie=j(0)|0,$t(ie)),b=$,w|0}while(!1);w=j()|0,Bt(G)|0,t=e[P>>2]|0,e[P>>2]=0,t?Z=36:O=w}return(Z|0)==36&&(g=0,ue(e[ie>>2]|0,t|0),ie=g,g=0,ie&1?(ie=j(0)|0,$t(ie)):O=w),le(O|0),0}function rh(t,r,o,l,c,h,d,w,C,D){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0,w=w|0,C=C|0,D=D|0;var k=0,N=0,R=0,_=0,U=0,Q=0,K=0,G=0,$=0,P=0,O=0,Z=0;Z=b,b=b+112|0,k=Z+100|0,N=Z+88|0,R=Z+76|0,_=Z+64|0,U=Z+52|0,Q=Z+48|0,K=Z+36|0,G=Z+24|0,$=Z+12|0,P=Z;do if(t)if(t=O0(r,43828)|0,t0[e[(e[t>>2]|0)+44>>2]&127](k,t),P=e[k>>2]|0,S[o>>0]=P,S[o+1>>0]=P>>8,S[o+2>>0]=P>>16,S[o+3>>0]=P>>24,t0[e[(e[t>>2]|0)+32>>2]&127](N,t),S[C>>0]&1?(S[e[C+8>>2]>>0]=0,e[C+4>>2]=0):(S[C+1>>0]=0,S[C>>0]=0),g=0,Ae(91,C|0,0),o=g,g=0,o&1&&(o=j(0)|0,$t(o)),e[C>>2]=e[N>>2],e[C+4>>2]=e[N+4>>2],e[C+8>>2]=e[N+8>>2],e[N>>2]=0,e[N+4>>2]=0,e[N+8>>2]=0,de(N),t0[e[(e[t>>2]|0)+28>>2]&127](R,t),S[w>>0]&1?(S[e[w+8>>2]>>0]=0,e[w+4>>2]=0):(S[w+1>>0]=0,S[w>>0]=0),g=0,Ae(91,w|0,0),o=g,g=0,o&1&&(o=j(0)|0,$t(o)),e[w>>2]=e[R>>2],e[w+4>>2]=e[R+4>>2],e[w+8>>2]=e[R+8>>2],e[R>>2]=0,e[R+4>>2]=0,e[R+8>>2]=0,de(R),w=Dt[e[(e[t>>2]|0)+12>>2]&127](t)|0,S[l>>0]=w,w=Dt[e[(e[t>>2]|0)+16>>2]&127](t)|0,S[c>>0]=w,t0[e[(e[t>>2]|0)+20>>2]&127](_,t),S[h>>0]&1?(S[e[h+8>>2]>>0]=0,e[h+4>>2]=0):(S[h+1>>0]=0,S[h>>0]=0),g=0,Ae(91,h|0,0),c=g,g=0,c&1&&(c=j(0)|0,$t(c)),e[h>>2]=e[_>>2],e[h+4>>2]=e[_+4>>2],e[h+8>>2]=e[_+8>>2],e[_>>2]=0,e[_+4>>2]=0,e[_+8>>2]=0,de(_),t0[e[(e[t>>2]|0)+24>>2]&127](U,t),S[d>>0]&1?(S[e[d+8>>2]>>0]=0,e[d+4>>2]=0):(S[d+1>>0]=0,S[d>>0]=0),g=0,Ae(91,d|0,0),c=g,g=0,c&1)c=j(0)|0,$t(c);else{e[d>>2]=e[U>>2],e[d+4>>2]=e[U+4>>2],e[d+8>>2]=e[U+8>>2],e[U>>2]=0,e[U+4>>2]=0,e[U+8>>2]=0,de(U),O=Dt[e[(e[t>>2]|0)+36>>2]&127](t)|0;break}else if(t=O0(r,43764)|0,t0[e[(e[t>>2]|0)+44>>2]&127](Q,t),Q=e[Q>>2]|0,S[o>>0]=Q,S[o+1>>0]=Q>>8,S[o+2>>0]=Q>>16,S[o+3>>0]=Q>>24,t0[e[(e[t>>2]|0)+32>>2]&127](K,t),S[C>>0]&1?(S[e[C+8>>2]>>0]=0,e[C+4>>2]=0):(S[C+1>>0]=0,S[C>>0]=0),g=0,Ae(91,C|0,0),o=g,g=0,o&1&&(o=j(0)|0,$t(o)),e[C>>2]=e[K>>2],e[C+4>>2]=e[K+4>>2],e[C+8>>2]=e[K+8>>2],e[K>>2]=0,e[K+4>>2]=0,e[K+8>>2]=0,de(K),t0[e[(e[t>>2]|0)+28>>2]&127](G,t),S[w>>0]&1?(S[e[w+8>>2]>>0]=0,e[w+4>>2]=0):(S[w+1>>0]=0,S[w>>0]=0),g=0,Ae(91,w|0,0),o=g,g=0,o&1&&(o=j(0)|0,$t(o)),e[w>>2]=e[G>>2],e[w+4>>2]=e[G+4>>2],e[w+8>>2]=e[G+8>>2],e[G>>2]=0,e[G+4>>2]=0,e[G+8>>2]=0,de(G),w=Dt[e[(e[t>>2]|0)+12>>2]&127](t)|0,S[l>>0]=w,w=Dt[e[(e[t>>2]|0)+16>>2]&127](t)|0,S[c>>0]=w,t0[e[(e[t>>2]|0)+20>>2]&127]($,t),S[h>>0]&1?(S[e[h+8>>2]>>0]=0,e[h+4>>2]=0):(S[h+1>>0]=0,S[h>>0]=0),g=0,Ae(91,h|0,0),c=g,g=0,c&1&&(c=j(0)|0,$t(c)),e[h>>2]=e[$>>2],e[h+4>>2]=e[$+4>>2],e[h+8>>2]=e[$+8>>2],e[$>>2]=0,e[$+4>>2]=0,e[$+8>>2]=0,de($),t0[e[(e[t>>2]|0)+24>>2]&127](P,t),S[d>>0]&1?(S[e[d+8>>2]>>0]=0,e[d+4>>2]=0):(S[d+1>>0]=0,S[d>>0]=0),g=0,Ae(91,d|0,0),c=g,g=0,c&1)c=j(0)|0,$t(c);else{e[d>>2]=e[P>>2],e[d+4>>2]=e[P+4>>2],e[d+8>>2]=e[P+8>>2],e[P>>2]=0,e[P+4>>2]=0,e[P+8>>2]=0,de(P),O=Dt[e[(e[t>>2]|0)+36>>2]&127](t)|0;break}while(!1);e[D>>2]=O,b=Z}function V0(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0;c=S[t>>0]|0,d=t+4|0,h=e[d>>2]|0;e:do if((c&1?h:(c&255)>>>1)|0){if((r|0)!=(o|0)){if(c=o+-4|0,c>>>0>r>>>0){h=r;do w=e[h>>2]|0,e[h>>2]=e[c>>2],e[c>>2]=w,h=h+4|0,c=c+-4|0;while(h>>>0>>0)}c=S[t>>0]|0,h=e[d>>2]|0}w=(c&1)==0,d=w?t+1|0:e[t+8>>2]|0,o=o+-4|0,t=d+(w?(c&255)>>>1:h)|0,h=S[d>>0]|0,c=h<<24>>24<1|h<<24>>24==127;t:do if(o>>>0>r>>>0){for(;!(!c&&(h<<24>>24|0)!=(e[r>>2]|0));)if(d=(t-d|0)>1?d+1|0:d,r=r+4|0,h=S[d>>0]|0,c=h<<24>>24<1|h<<24>>24==127,r>>>0>=o>>>0)break t;e[l>>2]=4;break e}while(!1);!c&&((e[o>>2]|0)+-1|0)>>>0>=h<<24>>24>>>0&&(e[l>>2]=4)}while(!1)}function sh(t){t=t|0}function oh(t){t=t|0,he(t)}function ah(t,r,o,l,c,h,d){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0;var w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0,ce=0,ke=0,Ee=0,Te=0;if(oe=b,b=b+576|0,P=oe+424|0,ie=oe,t=oe+24|0,ce=oe+16|0,O=oe+12|0,ne=oe+8|0,N=oe+464|0,C=oe+4|0,Z=oe+468|0,e[ce>>2]=t,Ee=ce+4|0,e[Ee>>2]=189,D=t+400|0,g=0,w=ge(68,c|0)|0,$=g,g=0,$&1)C=j()|0,e[ce>>2]=0,w=189,Te=47;else{e[ne>>2]=w,g=0,t=be(37,ne|0,44212)|0,$=g,g=0;e:do if(!($&1)&&(S[N>>0]=0,e[C>>2]=e[o>>2],k=e[c+4>>2]|0,g=0,e[P>>2]=e[C>>2],k=Ut(2,r|0,P|0,l|0,ne|0,k|0,h|0,N|0,t|0,ce|0,O|0,D|0)|0,$=g,g=0,!($&1))){t:do if(k){if(g=0,Pe(e[(e[t>>2]|0)+48>>2]|0,t|0,59007,59017,P|0)|0,$=g,g=0,$&1){Te=10;break e}C=e[O>>2]|0,D=e[ce>>2]|0,t=C-D|0,(t|0)>392?(t=E0((t>>2)+2|0)|0,w=t,t?Te=13:(g=0,Nt(6),$=g,g=0,$&1||(t=0,Te=13))):(w=0,t=Z,Te=13);do if((Te|0)==13){if(S[N>>0]|0&&(S[t>>0]=45,t=t+1|0),G=P+40|0,$=P,D>>>0>>0){k=P+4|0,l=k+4|0,c=l+4|0,N=c+4|0,R=N+4|0,_=R+4|0,U=_+4|0,Q=U+4|0,K=Q+4|0;do{C=e[D>>2]|0;do if((e[P>>2]|0)!=(C|0))if((e[k>>2]|0)!=(C|0))if((e[l>>2]|0)!=(C|0))if((e[c>>2]|0)!=(C|0))if((e[N>>2]|0)==(C|0))C=N;else{if((e[R>>2]|0)==(C|0)){C=R;break}if((e[_>>2]|0)==(C|0)){C=_;break}if((e[U>>2]|0)==(C|0)){C=U;break}if((e[Q>>2]|0)==(C|0)){C=Q;break}C=(e[K>>2]|0)==(C|0)?K:G}else C=c;else C=l;else C=k;else C=P;while(!1);S[t>>0]=S[59007+(C-$>>2)>>0]|0,D=D+4|0,t=t+1|0}while(D>>>0<(e[O>>2]|0)>>>0)}if(S[t>>0]=0,e[ie>>2]=d,(_o(Z,58987,ie)|0)!=1&&(g=0,ue(190,58991),d=g,g=0,d&1))break;w&&n0(w);break t}while(!1);if(t=j()|0,!w){C=t,w=ce;break e}n0(w),C=t,w=ce;break e}while(!1);t=e[r>>2]|0;do if(t){if(w=e[t+12>>2]|0,(w|0)==(e[t+16>>2]|0)){if(g=0,t=ge(e[(e[t>>2]|0)+36>>2]|0,t|0)|0,d=g,g=0,d&1){Te=10;break e}}else t=e[w>>2]|0;if((t|0)==-1){e[r>>2]=0,C=1;break}else{C=(e[r>>2]|0)==0;break}}else C=1;while(!1);t=e[o>>2]|0;do if(t){if(w=e[t+12>>2]|0,(w|0)==(e[t+16>>2]|0)){if(g=0,t=ge(e[(e[t>>2]|0)+36>>2]|0,t|0)|0,d=g,g=0,d&1){Te=10;break e}}else t=e[w>>2]|0;if((t|0)!=-1){if(C)break;Te=40;break}else{e[o>>2]=0,Te=38;break}}else Te=38;while(!1);return(Te|0)==38&&C&&(Te=40),(Te|0)==40&&(e[h>>2]=e[h>>2]|2),w=e[r>>2]|0,Bt(e[ne>>2]|0)|0,t=e[ce>>2]|0,e[ce>>2]=0,t|0&&(g=0,ue(e[Ee>>2]|0,t|0),Te=g,g=0,Te&1)&&(Te=j(0)|0,$t(Te)),b=oe,w|0}else Te=10;while(!1);(Te|0)==10&&(C=j()|0,w=ce),Bt(e[ne>>2]|0)|0,t=e[w>>2]|0,e[w>>2]=0,t?(w=e[Ee>>2]|0,Te=47):ke=C}return(Te|0)==47&&(g=0,ue(w|0,t|0),Te=g,g=0,Te&1?(Te=j(0)|0,$t(Te)):ke=C),le(ke|0),0}function lh(t,r,o,l,c,h,d,w,C,D,k){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0,w=w|0,C=C|0,D=D|0,k=k|0;var N=0,R=0,_=0,U=0,Q=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0,ce=0,ke=0,Ee=0,Te=0,it=0,jt=0,Gt=0,s0=0,i0=0,zt=0,gt=0,Kt=0,dt=0,At=0,y0=0,T0=0,g0=0,Oe=0,yt=0,qt=0,c0=0,a0=0,h0=0;c0=b,b=b+512|0,Gt=c0+96|0,N=c0+104|0,h0=c0+88|0,gt=c0+80|0,zt=c0+76|0,Kt=c0+504|0,s0=c0+72|0,dt=c0+68|0,T0=c0+56|0,qt=c0+44|0,Oe=c0+32|0,g0=c0+20|0,yt=c0+8|0,i0=c0+4|0,y0=c0,e[Gt>>2]=k,e[h0>>2]=N,a0=h0+4|0,e[a0>>2]=189,e[gt>>2]=N,e[zt>>2]=N+400,e[T0>>2]=0,e[T0+4>>2]=0,e[T0+8>>2]=0,e[qt>>2]=0,e[qt+4>>2]=0,e[qt+8>>2]=0,e[Oe>>2]=0,e[Oe+4>>2]=0,e[Oe+8>>2]=0,e[g0>>2]=0,e[g0+4>>2]=0,e[g0+8>>2]=0,e[yt>>2]=0,e[yt+4>>2]=0,e[yt+8>>2]=0,g=0,I0(2,o|0,l|0,Kt|0,s0|0,dt|0,T0|0,qt|0,Oe|0,g0|0,i0|0),jt=g,g=0;e:do if(jt&1)o=j()|0;else{e[D>>2]=e[C>>2],Ee=Oe+4|0,Te=g0+4|0,it=g0+8|0,jt=Oe+8|0,O=(c&512|0)!=0,Z=qt+8|0,ie=qt+4|0,oe=yt+4|0,ne=yt+8|0,ce=Kt+3|0,ke=T0+4|0,P=0,_=0;t:for(;;){k=e[t>>2]|0;do if(k){if(o=e[k+12>>2]|0,(o|0)==(e[k+16>>2]|0)){if(g=0,k=ge(e[(e[k>>2]|0)+36>>2]|0,k|0)|0,$=g,g=0,$&1){At=26;break t}}else k=e[o>>2]|0;if((k|0)==-1){e[t>>2]=0,l=1;break}else{l=(e[t>>2]|0)==0;break}}else l=1;while(!1);o=e[r>>2]|0;do if(o){if(k=e[o+12>>2]|0,(k|0)==(e[o+16>>2]|0)){if(g=0,k=ge(e[(e[o>>2]|0)+36>>2]|0,o|0)|0,$=g,g=0,$&1){At=26;break t}}else k=e[k>>2]|0;if((k|0)!=-1)if(l){$=o;break}else{U=N,At=244;break t}else{e[r>>2]=0,At=16;break}}else At=16;while(!1);if((At|0)==16)if(At=0,l){U=N,At=244;break}else $=0;i:do switch(S[Kt+P>>0]|0){case 1:{if((P|0)!=3){if(k=e[t>>2]|0,o=e[k+12>>2]|0,(o|0)==(e[k+16>>2]|0)){if(g=0,k=ge(e[(e[k>>2]|0)+36>>2]|0,k|0)|0,At=g,g=0,At&1){At=26;break t}}else k=e[o>>2]|0;if(g=0,k=Ve(e[(e[w>>2]|0)+12>>2]|0,w|0,8192,k|0)|0,At=g,g=0,At&1){At=26;break t}if(!k){At=42;break t}if(k=e[t>>2]|0,o=k+12|0,l=e[o>>2]|0,(l|0)==(e[k+16>>2]|0)){if(g=0,k=ge(e[(e[k>>2]|0)+40>>2]|0,k|0)|0,At=g,g=0,At&1){At=26;break t}}else e[o>>2]=l+4,k=e[l>>2]|0;if(g=0,Ae(92,yt|0,k|0),At=g,g=0,At&1){At=26;break t}else k=$,c=$,At=44}else k=N;break}case 0:{(P|0)==3?k=N:(k=$,c=$,At=44);break}case 3:{if(o=S[Oe>>0]|0,k=o&1?e[Ee>>2]|0:(o&255)>>>1,l=S[g0>>0]|0,c=l&1?e[Te>>2]|0:(l&255)>>>1,(k|0)==(0-c|0))k=N;else{if(!k){if(k=e[t>>2]|0,o=e[k+12>>2]|0,(o|0)==(e[k+16>>2]|0)){if(g=0,k=ge(e[(e[k>>2]|0)+36>>2]|0,k|0)|0,$=g,g=0,$&1){At=26;break t}o=S[g0>>0]|0}else k=e[o>>2]|0,o=l;if((k|0)!=(e[(o&1?e[it>>2]|0:Te)>>2]|0)){k=N;break i}if(k=e[t>>2]|0,o=k+12|0,l=e[o>>2]|0,(l|0)==(e[k+16>>2]|0)){if(g=0,ge(e[(e[k>>2]|0)+40>>2]|0,k|0)|0,$=g,g=0,$&1){At=26;break t}}else e[o>>2]=l+4;S[d>>0]=1,$=S[g0>>0]|0,k=N,_=($&1?e[Te>>2]|0:($&255)>>>1)>>>0>1?g0:_;break i}if(R=e[t>>2]|0,U=e[R+12>>2]|0,l=e[R+16>>2]|0,k=(U|0)==(l|0),!c){if(k){if(g=0,k=ge(e[(e[R>>2]|0)+36>>2]|0,R|0)|0,$=g,g=0,$&1){At=26;break t}o=S[Oe>>0]|0}else k=e[U>>2]|0;if((k|0)!=(e[(o&1?e[jt>>2]|0:Ee)>>2]|0)){S[d>>0]=1,k=N;break i}if(k=e[t>>2]|0,o=k+12|0,l=e[o>>2]|0,(l|0)==(e[k+16>>2]|0)){if(g=0,ge(e[(e[k>>2]|0)+40>>2]|0,k|0)|0,$=g,g=0,$&1){At=26;break t}}else e[o>>2]=l+4;$=S[Oe>>0]|0,k=N,_=($&1?e[Ee>>2]|0:($&255)>>>1)>>>0>1?Oe:_;break i}if(k){if(g=0,k=ge(e[(e[R>>2]|0)+36>>2]|0,R|0)|0,$=g,g=0,$&1){At=26;break t}l=e[t>>2]|0,o=S[Oe>>0]|0,R=l,U=e[l+12>>2]|0,l=e[l+16>>2]|0}else k=e[U>>2]|0;if(c=R+12|0,l=(U|0)==(l|0),(k|0)==(e[(o&1?e[jt>>2]|0:Ee)>>2]|0)){if(l){if(g=0,ge(e[(e[R>>2]|0)+40>>2]|0,R|0)|0,$=g,g=0,$&1){At=26;break t}}else e[c>>2]=U+4;$=S[Oe>>0]|0,k=N,_=($&1?e[Ee>>2]|0:($&255)>>>1)>>>0>1?Oe:_;break i}if(l){if(g=0,k=ge(e[(e[R>>2]|0)+36>>2]|0,R|0)|0,$=g,g=0,$&1){At=26;break t}}else k=e[U>>2]|0;if((k|0)!=(e[(S[g0>>0]&1?e[it>>2]|0:Te)>>2]|0)){At=107;break t}if(k=e[t>>2]|0,o=k+12|0,l=e[o>>2]|0,(l|0)==(e[k+16>>2]|0)){if(g=0,ge(e[(e[k>>2]|0)+40>>2]|0,k|0)|0,$=g,g=0,$&1){At=26;break t}}else e[o>>2]=l+4;S[d>>0]=1,$=S[g0>>0]|0,k=N,_=($&1?e[Te>>2]|0:($&255)>>>1)>>>0>1?g0:_}break}case 2:{if(!(P>>>0<2|(_|0)!=0)&&!(O|(P|0)==2&(S[ce>>0]|0)!=0)){k=N,_=0;break i}c=S[qt>>0]|0,l=e[Z>>2]|0,o=c&1?l:ie,k=o;n:do if(P|0&&(F[Kt+(P+-1)>>0]|0)<2){G=(c&1)==0;r:do if((o|0)!=((G?ie:l)+((G?(c&255)>>>1:e[ie>>2]|0)<<2)|0)){for(c=o;;){if(g=0,o=Ve(e[(e[w>>2]|0)+12>>2]|0,w|0,8192,e[c>>2]|0)|0,G=g,g=0,G&1){At=23;break t}if(!o)break;if(c=c+4|0,k=c,o=S[qt>>0]|0,l=e[Z>>2]|0,G=(o&1)==0,(c|0)==((G?ie:l)+((G?(o&255)>>>1:e[ie>>2]|0)<<2)|0)){c=o;break r}}c=S[qt>>0]|0,l=e[Z>>2]|0}while(!1);if(U=c&1?l:ie,o=U,Q=k-o>>2,K=S[yt>>0]|0,R=(K&1)==0,K=R?(K&255)>>>1:e[oe>>2]|0,K>>>0>=Q>>>0)if(R=R?oe:e[ne>>2]|0,G=R+(K<<2)|0,!Q)o=k;else for(R=R+(K-Q<<2)|0;;){if((e[R>>2]|0)!=(e[U>>2]|0))break n;if(R=R+4|0,(R|0)==(G|0)){o=k;break}else U=U+4|0}}else o=k;while(!1);k=(c&1)==0,k=(k?ie:l)+((k?(c&255)>>>1:e[ie>>2]|0)<<2)|0;n:do if((o|0)!=(k|0))for(R=$,c=$,k=o;;){o=e[t>>2]|0;do if(o){if(l=e[o+12>>2]|0,(l|0)==(e[o+16>>2]|0)){if(g=0,o=ge(e[(e[o>>2]|0)+36>>2]|0,o|0)|0,$=g,g=0,$&1){At=22;break t}}else o=e[l>>2]|0;if((o|0)==-1){e[t>>2]=0,l=1;break}else{l=(e[t>>2]|0)==0;break}}else l=1;while(!1);do if(c){if(o=e[c+12>>2]|0,(o|0)==(e[c+16>>2]|0)){if(g=0,o=ge(e[(e[c>>2]|0)+36>>2]|0,c|0)|0,$=g,g=0,$&1){At=22;break t}}else o=e[o>>2]|0;if((o|0)!=-1)if(l^(R|0)==0){o=R,U=R;break}else break n;else{e[r>>2]=0,o=0,At=136;break}}else o=R,At=136;while(!1);if((At|0)==136){if(At=0,l)break n;U=0}if(l=e[t>>2]|0,c=e[l+12>>2]|0,(c|0)==(e[l+16>>2]|0)){if(g=0,l=ge(e[(e[l>>2]|0)+36>>2]|0,l|0)|0,$=g,g=0,$&1){At=22;break t}}else l=e[c>>2]|0;if((l|0)!=(e[k>>2]|0))break n;if(l=e[t>>2]|0,c=l+12|0,R=e[c>>2]|0,(R|0)==(e[l+16>>2]|0)){if(g=0,ge(e[(e[l>>2]|0)+40>>2]|0,l|0)|0,$=g,g=0,$&1){At=22;break t}}else e[c>>2]=R+4;if(k=k+4|0,l=S[qt>>0]|0,$=(l&1)==0,l=($?ie:e[Z>>2]|0)+(($?(l&255)>>>1:e[ie>>2]|0)<<2)|0,(k|0)==(l|0)){k=l;break}else R=o,c=U}while(!1);if(O&&($=S[qt>>0]|0,G=($&1)==0,(k|0)!=((G?ie:e[Z>>2]|0)+((G?($&255)>>>1:e[ie>>2]|0)<<2)|0))){At=148;break t}else k=N;break}case 4:{K=e[dt>>2]|0,Q=$,R=$,k=N,o=0;n:for(;;){l=e[t>>2]|0;do if(l){if(c=e[l+12>>2]|0,(c|0)==(e[l+16>>2]|0)){if(g=0,l=ge(e[(e[l>>2]|0)+36>>2]|0,l|0)|0,$=g,g=0,$&1){At=25;break t}}else l=e[c>>2]|0;if((l|0)==-1){e[t>>2]=0,c=1;break}else{c=(e[t>>2]|0)==0;break}}else c=1;while(!1);do if(R){if(l=e[R+12>>2]|0,(l|0)==(e[R+16>>2]|0)){if(g=0,l=ge(e[(e[R>>2]|0)+36>>2]|0,R|0)|0,$=g,g=0,$&1){At=25;break t}}else l=e[l>>2]|0;if((l|0)!=-1)if(c^(Q|0)==0){l=Q,U=Q;break}else{N=Q;break n}else{e[r>>2]=0,l=0,At=162;break}}else l=Q,At=162;while(!1);if((At|0)==162)if(At=0,c){N=l;break}else U=0;if(c=e[t>>2]|0,N=e[c+12>>2]|0,(N|0)==(e[c+16>>2]|0)){if(g=0,c=ge(e[(e[c>>2]|0)+36>>2]|0,c|0)|0,$=g,g=0,$&1){At=25;break t}}else c=e[N>>2]|0;if(g=0,N=Ve(e[(e[w>>2]|0)+12>>2]|0,w|0,2048,c|0)|0,$=g,g=0,$&1){At=25;break t}if(N){if(N=e[D>>2]|0,(N|0)==(e[Gt>>2]|0)){if(g=0,xe(14,C|0,D|0,Gt|0),$=g,g=0,$&1){At=25;break t}N=e[D>>2]|0}e[D>>2]=N+4,e[N>>2]=c,o=o+1|0}else{if($=S[T0>>0]|0,!((c|0)==(K|0)&(o|0?(($&1?e[ke>>2]|0:($&255)>>>1)|0)!=0:0))){N=l;break}if((k|0)==(e[zt>>2]|0)){if(g=0,xe(13,h0|0,gt|0,zt|0),$=g,g=0,$&1){At=25;break t}k=e[gt>>2]|0}$=k+4|0,e[gt>>2]=$,e[k>>2]=o,k=$,o=0}if(c=e[t>>2]|0,N=c+12|0,R=e[N>>2]|0,(R|0)==(e[c+16>>2]|0))if(g=0,ge(e[(e[c>>2]|0)+40>>2]|0,c|0)|0,$=g,g=0,$&1){At=25;break t}else{Q=l,R=U;continue}else{e[N>>2]=R+4,Q=l,R=U;continue}}if(o|0&&(e[h0>>2]|0)!=(k|0)){if((k|0)==(e[zt>>2]|0)){if(g=0,xe(13,h0|0,gt|0,zt|0),$=g,g=0,$&1){At=26;break t}k=e[gt>>2]|0}$=k+4|0,e[gt>>2]=$,e[k>>2]=o,k=$}if(U=e[i0>>2]|0,(U|0)>0){o=e[t>>2]|0;do if(o){if(l=e[o+12>>2]|0,(l|0)==(e[o+16>>2]|0)){if(g=0,o=ge(e[(e[o>>2]|0)+36>>2]|0,o|0)|0,$=g,g=0,$&1){At=26;break t}}else o=e[l>>2]|0;if((o|0)==-1){e[t>>2]=0,l=1;break}else{l=(e[t>>2]|0)==0;break}}else l=1;while(!1);do if(N){if(o=e[N+12>>2]|0,(o|0)==(e[N+16>>2]|0)){if(g=0,o=ge(e[(e[N>>2]|0)+36>>2]|0,N|0)|0,$=g,g=0,$&1){At=26;break t}}else o=e[o>>2]|0;if((o|0)!=-1){if(l)break;At=206;break t}else{e[r>>2]=0,At=200;break}}else At=200;while(!1);if((At|0)==200)if(At=0,l){At=206;break t}else N=0;if(o=e[t>>2]|0,l=e[o+12>>2]|0,(l|0)==(e[o+16>>2]|0)){if(g=0,o=ge(e[(e[o>>2]|0)+36>>2]|0,o|0)|0,$=g,g=0,$&1){At=26;break t}}else o=e[l>>2]|0;if((o|0)!=(e[s0>>2]|0)){At=206;break t}if(o=e[t>>2]|0,l=o+12|0,c=e[l>>2]|0,(c|0)==(e[o+16>>2]|0)){if(g=0,ge(e[(e[o>>2]|0)+40>>2]|0,o|0)|0,$=g,g=0,$&1){At=26;break t}}else e[l>>2]=c+4;if((U|0)>0)for(R=N,c=N,Q=U;;){o=e[t>>2]|0;do if(o){if(l=e[o+12>>2]|0,(l|0)==(e[o+16>>2]|0)){if(g=0,o=ge(e[(e[o>>2]|0)+36>>2]|0,o|0)|0,$=g,g=0,$&1){At=24;break t}}else o=e[l>>2]|0;if((o|0)==-1){e[t>>2]=0,l=1;break}else{l=(e[t>>2]|0)==0;break}}else l=1;while(!1);do if(c){if(o=e[c+12>>2]|0,(o|0)==(e[c+16>>2]|0)){if(g=0,o=ge(e[(e[c>>2]|0)+36>>2]|0,c|0)|0,$=g,g=0,$&1){At=24;break t}}else o=e[o>>2]|0;if((o|0)!=-1)if(l^(R|0)==0){o=R,U=R;break}else{At=231;break t}else{e[r>>2]=0,o=0,At=224;break}}else o=R,At=224;while(!1);if((At|0)==224)if(At=0,l){At=231;break t}else U=0;if(l=e[t>>2]|0,c=e[l+12>>2]|0,(c|0)==(e[l+16>>2]|0)){if(g=0,l=ge(e[(e[l>>2]|0)+36>>2]|0,l|0)|0,$=g,g=0,$&1){At=24;break t}}else l=e[c>>2]|0;if(g=0,l=Ve(e[(e[w>>2]|0)+12>>2]|0,w|0,2048,l|0)|0,$=g,g=0,$&1){At=24;break t}if(!l){At=231;break t}if((e[D>>2]|0)==(e[Gt>>2]|0)&&(g=0,xe(14,C|0,D|0,Gt|0),$=g,g=0,$&1)){At=24;break t}if(l=e[t>>2]|0,c=e[l+12>>2]|0,(c|0)==(e[l+16>>2]|0)){if(g=0,l=ge(e[(e[l>>2]|0)+36>>2]|0,l|0)|0,$=g,g=0,$&1){At=24;break t}}else l=e[c>>2]|0;if(c=e[D>>2]|0,e[D>>2]=c+4,e[c>>2]=l,l=Q,Q=Q+-1|0,e[i0>>2]=Q,c=e[t>>2]|0,N=c+12|0,R=e[N>>2]|0,(R|0)==(e[c+16>>2]|0)){if(g=0,ge(e[(e[c>>2]|0)+40>>2]|0,c|0)|0,$=g,g=0,$&1){At=24;break t}}else e[N>>2]=R+4;if((l|0)<=1)break;R=o,c=U}}if((e[D>>2]|0)==(e[C>>2]|0)){At=242;break t}break}default:k=N}while(!1);i:do if((At|0)==44)for(;;){At=0,o=e[t>>2]|0;do if(o){if(l=e[o+12>>2]|0,(l|0)==(e[o+16>>2]|0)){if(g=0,o=ge(e[(e[o>>2]|0)+36>>2]|0,o|0)|0,$=g,g=0,$&1){At=21;break t}}else o=e[l>>2]|0;if((o|0)==-1){e[t>>2]=0,l=1;break}else{l=(e[t>>2]|0)==0;break}}else l=1;while(!1);do if(c){if(o=e[c+12>>2]|0,(o|0)==(e[c+16>>2]|0)){if(g=0,o=ge(e[(e[c>>2]|0)+36>>2]|0,c|0)|0,$=g,g=0,$&1){At=21;break t}}else o=e[o>>2]|0;if((o|0)!=-1)if(l^(k|0)==0){R=k,c=k;break}else{k=N;break i}else{e[r>>2]=0,k=0,At=57;break}}else At=57;while(!1);if((At|0)==57)if(At=0,l){k=N;break i}else R=k,c=0;if(k=e[t>>2]|0,o=e[k+12>>2]|0,(o|0)==(e[k+16>>2]|0)){if(g=0,k=ge(e[(e[k>>2]|0)+36>>2]|0,k|0)|0,$=g,g=0,$&1){At=21;break t}}else k=e[o>>2]|0;if(g=0,k=Ve(e[(e[w>>2]|0)+12>>2]|0,w|0,8192,k|0)|0,$=g,g=0,$&1){At=21;break t}if(!k){k=N;break i}if(k=e[t>>2]|0,o=k+12|0,l=e[o>>2]|0,(l|0)==(e[k+16>>2]|0)){if(g=0,k=ge(e[(e[k>>2]|0)+40>>2]|0,k|0)|0,At=g,g=0,At&1){At=21;break t}}else e[o>>2]=l+4,k=e[l>>2]|0;if(g=0,Ae(92,yt|0,k|0),At=g,g=0,At&1){At=21;break t}else k=R,At=44}while(!1);if(P=P+1|0,P>>>0>=4){U=k,At=244;break}else N=k}t:switch(At|0){case 21:{o=j()|0;break e}case 22:{o=j()|0;break e}case 23:{o=j()|0;break e}case 24:{o=j()|0;break e}case 25:{o=j()|0;break e}case 26:{o=j()|0;break e}case 42:{e[h>>2]=e[h>>2]|4,o=0;break}case 107:{e[h>>2]=e[h>>2]|4,o=0;break}case 148:{e[h>>2]=e[h>>2]|4,o=0;break}case 206:{e[h>>2]=e[h>>2]|4,o=0;break}case 231:{e[h>>2]=e[h>>2]|4,o=0;break}case 242:{e[h>>2]=e[h>>2]|4,o=0;break}case 244:{i:do if(_){N=_+4|0,R=_+8|0,c=1;n:for(;;){if(k=S[_>>0]|0,k&1?k=e[N>>2]|0:k=(k&255)>>>1,c>>>0>=k>>>0)break i;k=e[t>>2]|0;do if(k){if(o=e[k+12>>2]|0,(o|0)==(e[k+16>>2]|0)){if(g=0,k=ge(e[(e[k>>2]|0)+36>>2]|0,k|0)|0,D=g,g=0,D&1){At=20;break n}}else k=e[o>>2]|0;if((k|0)==-1){e[t>>2]=0,l=1;break}else{l=(e[t>>2]|0)==0;break}}else l=1;while(!1);k=e[r>>2]|0;do if(k){if(o=e[k+12>>2]|0,(o|0)==(e[k+16>>2]|0)){if(g=0,k=ge(e[(e[k>>2]|0)+36>>2]|0,k|0)|0,D=g,g=0,D&1){At=20;break n}}else k=e[o>>2]|0;if((k|0)!=-1){if(l)break;At=271;break n}else{e[r>>2]=0,At=263;break}}else At=263;while(!1);if((At|0)==263&&(At=0,l)){At=271;break}if(k=e[t>>2]|0,o=e[k+12>>2]|0,(o|0)==(e[k+16>>2]|0)){if(g=0,k=ge(e[(e[k>>2]|0)+36>>2]|0,k|0)|0,D=g,g=0,D&1){At=20;break}}else k=e[o>>2]|0;if(S[_>>0]&1?o=e[R>>2]|0:o=N,(k|0)!=(e[o+(c<<2)>>2]|0)){At=271;break}if(k=c+1|0,o=e[t>>2]|0,l=o+12|0,c=e[l>>2]|0,(c|0)==(e[o+16>>2]|0))if(g=0,ge(e[(e[o>>2]|0)+40>>2]|0,o|0)|0,D=g,g=0,D&1){At=20;break}else{c=k;continue}else{e[l>>2]=c+4,c=k;continue}}if((At|0)==20){o=j()|0;break e}else if((At|0)==271){e[h>>2]=e[h>>2]|4,o=0;break t}}while(!1);k=e[h0>>2]|0,(k|0)!=(U|0)&&(e[y0>>2]=0,V0(T0,k,U,y0),(e[y0>>2]|0)!=0)?(e[h>>2]=e[h>>2]|4,o=0):o=1;break}}return Pt(yt),Pt(g0),Pt(Oe),Pt(qt),de(T0),k=e[h0>>2]|0,e[h0>>2]=0,k|0&&(g=0,ue(e[a0>>2]|0,k|0),h0=g,g=0,h0&1)&&(h0=j(0)|0,$t(h0)),b=c0,o|0}while(!1);return Pt(yt),Pt(g0),Pt(Oe),Pt(qt),de(T0),k=e[h0>>2]|0,e[h0>>2]=0,k|0&&(g=0,ue(e[a0>>2]|0,k|0),h0=g,g=0,h0&1)&&(h0=j(0)|0,$t(h0)),le(o|0),0}function uh(t,r,o,l,c,h,d){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0;var w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0;if($=b,b=b+432|0,w=$+424|0,t=$+24|0,O=$+16|0,U=$+8|0,N=$+4|0,R=$+428|0,C=$,e[O>>2]=t,ie=O+4|0,e[ie>>2]=189,D=t+400|0,g=0,G=ge(68,c|0)|0,k=g,g=0,k&1)w=j()|0,e[O>>2]=0,Z=38;else{e[N>>2]=G,g=0,k=be(37,N|0,44212)|0,t=g,g=0;e:do if(!(t&1)&&(S[R>>0]=0,Q=e[o>>2]|0,e[C>>2]=Q,_=e[c+4>>2]|0,K=Q,g=0,e[w>>2]=e[C>>2],_=Ut(2,r|0,w|0,l|0,N|0,_|0,h|0,R|0,k|0,O|0,U|0,D|0)|0,c=g,g=0,!(c&1))){if(_){if(S[d>>0]&1?e[e[d+8>>2]>>2]=0:S[d>>0]=0,e[d+4>>2]=0,S[R>>0]|0&&(g=0,t=be(e[(e[k>>2]|0)+44>>2]|0,k|0,45)|0,c=g,g=0,c&1||(g=0,Ae(92,d|0,t|0),c=g,g=0,c&1))||(g=0,C=be(e[(e[k>>2]|0)+44>>2]|0,k|0,48)|0,c=g,g=0,c&1))break;t=e[O>>2]|0,D=e[U>>2]|0,w=D+-4|0;t:do if(t>>>0>>0)do{if((e[t>>2]|0)!=(C|0))break t;t=t+4|0}while(t>>>0>>0);while(!1);if(g=0,Ve(33,d|0,t|0,D|0)|0,d=g,g=0,d&1)break}t=e[r>>2]|0;do if(t){if(w=e[t+12>>2]|0,(w|0)==(e[t+16>>2]|0)){if(g=0,t=ge(e[(e[t>>2]|0)+36>>2]|0,t|0)|0,d=g,g=0,d&1)break e}else t=e[w>>2]|0;if((t|0)==-1){e[r>>2]=0,w=1;break}else{w=(e[r>>2]|0)==0;break}}else w=1;while(!1);do if(Q){if(t=e[K+12>>2]|0,(t|0)==(e[K+16>>2]|0)){if(g=0,t=ge(e[(e[Q>>2]|0)+36>>2]|0,K|0)|0,K=g,g=0,K&1)break e}else t=e[t>>2]|0;if((t|0)!=-1){if(w)break;Z=32;break}else{e[o>>2]=0,Z=30;break}}else Z=30;while(!1);return(Z|0)==30&&w&&(Z=32),(Z|0)==32&&(e[h>>2]=e[h>>2]|2),w=e[r>>2]|0,Bt(G)|0,t=e[O>>2]|0,e[O>>2]=0,t|0&&(g=0,ue(e[ie>>2]|0,t|0),ie=g,g=0,ie&1)&&(ie=j(0)|0,$t(ie)),b=$,w|0}while(!1);w=j()|0,Bt(G)|0,t=e[O>>2]|0,e[O>>2]=0,t?Z=38:P=w}return(Z|0)==38&&(g=0,ue(e[ie>>2]|0,t|0),ie=g,g=0,ie&1?(ie=j(0)|0,$t(ie)):P=w),le(P|0),0}function fh(t,r,o,l,c,h,d,w,C,D){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0,w=w|0,C=C|0,D=D|0;var k=0,N=0,R=0,_=0,U=0,Q=0,K=0,G=0,$=0,P=0,O=0,Z=0;Z=b,b=b+112|0,k=Z+100|0,N=Z+88|0,R=Z+76|0,_=Z+64|0,U=Z+52|0,Q=Z+48|0,K=Z+36|0,G=Z+24|0,$=Z+12|0,P=Z;do if(t)if(t=O0(r,43956)|0,t0[e[(e[t>>2]|0)+44>>2]&127](k,t),P=e[k>>2]|0,S[o>>0]=P,S[o+1>>0]=P>>8,S[o+2>>0]=P>>16,S[o+3>>0]=P>>24,t0[e[(e[t>>2]|0)+32>>2]&127](N,t),S[C>>0]&1?e[e[C+8>>2]>>2]=0:S[C>>0]=0,e[C+4>>2]=0,g=0,Ae(93,C|0,0),o=g,g=0,o&1&&(o=j(0)|0,$t(o)),e[C>>2]=e[N>>2],e[C+4>>2]=e[N+4>>2],e[C+8>>2]=e[N+8>>2],e[N>>2]=0,e[N+4>>2]=0,e[N+8>>2]=0,Pt(N),t0[e[(e[t>>2]|0)+28>>2]&127](R,t),S[w>>0]&1?e[e[w+8>>2]>>2]=0:S[w>>0]=0,e[w+4>>2]=0,g=0,Ae(93,w|0,0),o=g,g=0,o&1&&(o=j(0)|0,$t(o)),e[w>>2]=e[R>>2],e[w+4>>2]=e[R+4>>2],e[w+8>>2]=e[R+8>>2],e[R>>2]=0,e[R+4>>2]=0,e[R+8>>2]=0,Pt(R),w=Dt[e[(e[t>>2]|0)+12>>2]&127](t)|0,e[l>>2]=w,w=Dt[e[(e[t>>2]|0)+16>>2]&127](t)|0,e[c>>2]=w,t0[e[(e[t>>2]|0)+20>>2]&127](_,t),S[h>>0]&1?(S[e[h+8>>2]>>0]=0,e[h+4>>2]=0):(S[h+1>>0]=0,S[h>>0]=0),g=0,Ae(91,h|0,0),c=g,g=0,c&1&&(c=j(0)|0,$t(c)),e[h>>2]=e[_>>2],e[h+4>>2]=e[_+4>>2],e[h+8>>2]=e[_+8>>2],e[_>>2]=0,e[_+4>>2]=0,e[_+8>>2]=0,de(_),t0[e[(e[t>>2]|0)+24>>2]&127](U,t),S[d>>0]&1?e[e[d+8>>2]>>2]=0:S[d>>0]=0,e[d+4>>2]=0,g=0,Ae(93,d|0,0),c=g,g=0,c&1)c=j(0)|0,$t(c);else{e[d>>2]=e[U>>2],e[d+4>>2]=e[U+4>>2],e[d+8>>2]=e[U+8>>2],e[U>>2]=0,e[U+4>>2]=0,e[U+8>>2]=0,Pt(U),O=Dt[e[(e[t>>2]|0)+36>>2]&127](t)|0;break}else if(t=O0(r,43892)|0,t0[e[(e[t>>2]|0)+44>>2]&127](Q,t),Q=e[Q>>2]|0,S[o>>0]=Q,S[o+1>>0]=Q>>8,S[o+2>>0]=Q>>16,S[o+3>>0]=Q>>24,t0[e[(e[t>>2]|0)+32>>2]&127](K,t),S[C>>0]&1?e[e[C+8>>2]>>2]=0:S[C>>0]=0,e[C+4>>2]=0,g=0,Ae(93,C|0,0),o=g,g=0,o&1&&(o=j(0)|0,$t(o)),e[C>>2]=e[K>>2],e[C+4>>2]=e[K+4>>2],e[C+8>>2]=e[K+8>>2],e[K>>2]=0,e[K+4>>2]=0,e[K+8>>2]=0,Pt(K),t0[e[(e[t>>2]|0)+28>>2]&127](G,t),S[w>>0]&1?e[e[w+8>>2]>>2]=0:S[w>>0]=0,e[w+4>>2]=0,g=0,Ae(93,w|0,0),o=g,g=0,o&1&&(o=j(0)|0,$t(o)),e[w>>2]=e[G>>2],e[w+4>>2]=e[G+4>>2],e[w+8>>2]=e[G+8>>2],e[G>>2]=0,e[G+4>>2]=0,e[G+8>>2]=0,Pt(G),w=Dt[e[(e[t>>2]|0)+12>>2]&127](t)|0,e[l>>2]=w,w=Dt[e[(e[t>>2]|0)+16>>2]&127](t)|0,e[c>>2]=w,t0[e[(e[t>>2]|0)+20>>2]&127]($,t),S[h>>0]&1?(S[e[h+8>>2]>>0]=0,e[h+4>>2]=0):(S[h+1>>0]=0,S[h>>0]=0),g=0,Ae(91,h|0,0),c=g,g=0,c&1&&(c=j(0)|0,$t(c)),e[h>>2]=e[$>>2],e[h+4>>2]=e[$+4>>2],e[h+8>>2]=e[$+8>>2],e[$>>2]=0,e[$+4>>2]=0,e[$+8>>2]=0,de($),t0[e[(e[t>>2]|0)+24>>2]&127](P,t),S[d>>0]&1?e[e[d+8>>2]>>2]=0:S[d>>0]=0,e[d+4>>2]=0,g=0,Ae(93,d|0,0),c=g,g=0,c&1)c=j(0)|0,$t(c);else{e[d>>2]=e[P>>2],e[d+4>>2]=e[P+4>>2],e[d+8>>2]=e[P+8>>2],e[P>>2]=0,e[P+4>>2]=0,e[P+8>>2]=0,Pt(P),O=Dt[e[(e[t>>2]|0)+36>>2]&127](t)|0;break}while(!1);e[D>>2]=O,b=Z}function hh(t){t=t|0}function dh(t){t=t|0,he(t)}function ph(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=+h;var d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0,ce=0,ke=0,Ee=0,Te=0,it=0;ne=b,b=b+384|0,K=ne+8|0,d=ne,C=ne+284|0,D=ne+72|0,w=ne+184|0,ke=ne+68|0,Z=ne+80|0,$=ne+77|0,ie=ne+76|0,Ee=ne+56|0,it=ne+44|0,Te=ne+32|0,k=ne+28|0,Q=ne+84|0,O=ne+24|0,P=ne+20|0,G=ne+16|0,e[D>>2]=C,B[K>>3]=h,C=Mo(C,100,59018,K)|0;do if(C>>>0>99)if(g=0,t=Ce(3)|0,oe=g,g=0,!(oe&1)&&(g=0,B[d>>3]=h,_=Pe(17,D|0,t|0,59018,d|0)|0,oe=g,g=0,!(oe&1))){if(t=e[D>>2]|0,!t){if(g=0,Nt(6),oe=g,g=0,oe&1){t=0,d=0,oe=7;break}t=e[D>>2]|0}w=E0(_)|0,d=w,w?(U=w,oe=10):(g=0,Nt(6),oe=g,g=0,oe&1?oe=7:(U=0,oe=10))}else t=0,d=0,oe=7;else d=0,t=0,U=w,_=C,oe=10;while(!1);if((oe|0)==10)if(g=0,w=ge(68,l|0)|0,R=g,g=0,R&1)oe=7;else{if(e[ke>>2]=w,g=0,R=be(37,ke|0,44220)|0,N=g,g=0,!(N&1)&&(N=e[D>>2]|0,g=0,Pe(e[(e[R>>2]|0)+32>>2]|0,R|0,N|0,N+_|0,U|0)|0,N=g,g=0,!(N&1))){if(_?N=(S[e[D>>2]>>0]|0)==45:N=0,e[Ee>>2]=0,e[Ee+4>>2]=0,e[Ee+8>>2]=0,e[it>>2]=0,e[it+4>>2]=0,e[it+8>>2]=0,e[Te>>2]=0,e[Te+4>>2]=0,e[Te+8>>2]=0,g=0,I0(3,o|0,N|0,ke|0,Z|0,$|0,ie|0,Ee|0,it|0,Te|0,k|0),o=g,g=0,o&1)C=j()|0;else{if(k=e[k>>2]|0,(_|0)>(k|0)?(o=S[Te>>0]|0,C=S[it>>0]|0,C=(_-k<<1|1)+k+(o&1?e[Te+4>>2]|0:(o&255)>>>1)+(C&1?e[it+4>>2]|0:(C&255)>>>1)|0):(o=S[Te>>0]|0,C=S[it>>0]|0,C=k+2+(o&1?e[Te+4>>2]|0:(o&255)>>>1)+(C&1?e[it+4>>2]|0:(C&255)>>>1)|0),C>>>0>100?(C=E0(C)|0,D=C,C?oe=26:(g=0,Nt(6),Q=g,g=0,Q&1||(C=0,oe=26))):(D=0,C=Q,oe=26),(oe|0)==26&&(g=0,Zt(1,C|0,O|0,P|0,e[l+4>>2]|0,U|0,U+_|0,R|0,N|0,Z|0,S[$>>0]|0,S[ie>>0]|0,Ee|0,it|0,Te|0,k|0),ie=g,g=0,!(ie&1)&&(e[G>>2]=e[r>>2],r=e[O>>2]|0,ce=e[P>>2]|0,g=0,e[K>>2]=e[G>>2],ce=Vt(39,K|0,C|0,r|0,ce|0,l|0,c|0)|0,r=g,g=0,!(r&1))))return D&&(n0(D),w=e[ke>>2]|0),de(Te),de(it),de(Ee),Bt(w)|0,d&&n0(d),t&&n0(t),b=ne,ce|0;C=j()|0,D&&(n0(D),w=e[ke>>2]|0)}de(Te),de(it),de(Ee)}else C=j()|0;Bt(w)|0}return(oe|0)==7&&(C=j()|0),d&&n0(d),t&&n0(t),le(C|0),0}function mh(t,r,o,l,c,h,d,w,C,D){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0,w=w|0,C=C|0,D=D|0;var k=0,N=0,R=0,_=0,U=0,Q=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0,ce=0;ce=b,b=b+112|0,R=ce+108|0,_=ce+96|0,K=ce+92|0,G=ce+80|0,$=ce+68|0,P=ce+56|0,O=ce+52|0,Z=ce+40|0,ie=ce+36|0,oe=ce+24|0,U=ce+12|0,Q=ce;do if(t){t=O0(o,43828)|0,o=e[t>>2]|0;do if(r)if(t0[e[o+44>>2]&127](R,t),r=e[R>>2]|0,S[l>>0]=r,S[l+1>>0]=r>>8,S[l+2>>0]=r>>16,S[l+3>>0]=r>>24,t0[e[(e[t>>2]|0)+32>>2]&127](_,t),S[C>>0]&1?(S[e[C+8>>2]>>0]=0,e[C+4>>2]=0):(S[C+1>>0]=0,S[C>>0]=0),g=0,Ae(91,C|0,0),l=g,g=0,l&1)C=j(0)|0,$t(C);else{e[C>>2]=e[_>>2],e[C+4>>2]=e[_+4>>2],e[C+8>>2]=e[_+8>>2],e[_>>2]=0,e[_+4>>2]=0,e[_+8>>2]=0,de(_),N=t;break}else if(t0[e[o+40>>2]&127](K,t),r=e[K>>2]|0,S[l>>0]=r,S[l+1>>0]=r>>8,S[l+2>>0]=r>>16,S[l+3>>0]=r>>24,t0[e[(e[t>>2]|0)+28>>2]&127](G,t),S[C>>0]&1?(S[e[C+8>>2]>>0]=0,e[C+4>>2]=0):(S[C+1>>0]=0,S[C>>0]=0),g=0,Ae(91,C|0,0),l=g,g=0,l&1)C=j(0)|0,$t(C);else{e[C>>2]=e[G>>2],e[C+4>>2]=e[G+4>>2],e[C+8>>2]=e[G+8>>2],e[G>>2]=0,e[G+4>>2]=0,e[G+8>>2]=0,de(G),N=t;break}while(!1);if(C=Dt[e[(e[t>>2]|0)+12>>2]&127](t)|0,S[c>>0]=C,C=Dt[e[(e[t>>2]|0)+16>>2]&127](t)|0,S[h>>0]=C,t0[e[(e[N>>2]|0)+20>>2]&127]($,t),S[d>>0]&1?(S[e[d+8>>2]>>0]=0,e[d+4>>2]=0):(S[d+1>>0]=0,S[d>>0]=0),g=0,Ae(91,d|0,0),h=g,g=0,h&1&&(h=j(0)|0,$t(h)),e[d>>2]=e[$>>2],e[d+4>>2]=e[$+4>>2],e[d+8>>2]=e[$+8>>2],e[$>>2]=0,e[$+4>>2]=0,e[$+8>>2]=0,de($),t0[e[(e[N>>2]|0)+24>>2]&127](P,t),S[w>>0]&1?(S[e[w+8>>2]>>0]=0,e[w+4>>2]=0):(S[w+1>>0]=0,S[w>>0]=0),g=0,Ae(91,w|0,0),h=g,g=0,h&1)h=j(0)|0,$t(h);else{e[w>>2]=e[P>>2],e[w+4>>2]=e[P+4>>2],e[w+8>>2]=e[P+8>>2],e[P>>2]=0,e[P+4>>2]=0,e[P+8>>2]=0,de(P),ne=Dt[e[(e[t>>2]|0)+36>>2]&127](t)|0;break}}else{t=O0(o,43764)|0,o=e[t>>2]|0;do if(r)if(t0[e[o+44>>2]&127](O,t),r=e[O>>2]|0,S[l>>0]=r,S[l+1>>0]=r>>8,S[l+2>>0]=r>>16,S[l+3>>0]=r>>24,t0[e[(e[t>>2]|0)+32>>2]&127](Z,t),S[C>>0]&1?(S[e[C+8>>2]>>0]=0,e[C+4>>2]=0):(S[C+1>>0]=0,S[C>>0]=0),g=0,Ae(91,C|0,0),l=g,g=0,l&1)C=j(0)|0,$t(C);else{e[C>>2]=e[Z>>2],e[C+4>>2]=e[Z+4>>2],e[C+8>>2]=e[Z+8>>2],e[Z>>2]=0,e[Z+4>>2]=0,e[Z+8>>2]=0,de(Z),k=t;break}else if(t0[e[o+40>>2]&127](ie,t),r=e[ie>>2]|0,S[l>>0]=r,S[l+1>>0]=r>>8,S[l+2>>0]=r>>16,S[l+3>>0]=r>>24,t0[e[(e[t>>2]|0)+28>>2]&127](oe,t),S[C>>0]&1?(S[e[C+8>>2]>>0]=0,e[C+4>>2]=0):(S[C+1>>0]=0,S[C>>0]=0),g=0,Ae(91,C|0,0),l=g,g=0,l&1)C=j(0)|0,$t(C);else{e[C>>2]=e[oe>>2],e[C+4>>2]=e[oe+4>>2],e[C+8>>2]=e[oe+8>>2],e[oe>>2]=0,e[oe+4>>2]=0,e[oe+8>>2]=0,de(oe),k=t;break}while(!1);if(C=Dt[e[(e[t>>2]|0)+12>>2]&127](t)|0,S[c>>0]=C,C=Dt[e[(e[t>>2]|0)+16>>2]&127](t)|0,S[h>>0]=C,t0[e[(e[k>>2]|0)+20>>2]&127](U,t),S[d>>0]&1?(S[e[d+8>>2]>>0]=0,e[d+4>>2]=0):(S[d+1>>0]=0,S[d>>0]=0),g=0,Ae(91,d|0,0),h=g,g=0,h&1&&(h=j(0)|0,$t(h)),e[d>>2]=e[U>>2],e[d+4>>2]=e[U+4>>2],e[d+8>>2]=e[U+8>>2],e[U>>2]=0,e[U+4>>2]=0,e[U+8>>2]=0,de(U),t0[e[(e[k>>2]|0)+24>>2]&127](Q,t),S[w>>0]&1?(S[e[w+8>>2]>>0]=0,e[w+4>>2]=0):(S[w+1>>0]=0,S[w>>0]=0),g=0,Ae(91,w|0,0),h=g,g=0,h&1)h=j(0)|0,$t(h);else{e[w>>2]=e[Q>>2],e[w+4>>2]=e[Q+4>>2],e[w+8>>2]=e[Q+8>>2],e[Q>>2]=0,e[Q+4>>2]=0,e[Q+8>>2]=0,de(Q),ne=Dt[e[(e[t>>2]|0)+36>>2]&127](t)|0;break}}while(!1);e[D>>2]=ne,b=ce}function gh(t,r,o,l,c,h,d,w,C,D,k,N,R,_,U){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0,w=w|0,C=C|0,D=D|0,k=k|0,N=N|0,R=R|0,_=_|0,U=U|0;var Q=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0,ce=0,ke=0,Ee=0,Te=0,it=0,jt=0,Gt=0,s0=0,i0=0,zt=0,gt=0,Kt=0,dt=0,At=0;e[o>>2]=t,Kt=_+4|0,dt=_+8|0,At=_+1|0,jt=R+4|0,Gt=(l&512|0)==0,s0=R+8|0,i0=R+1|0,zt=d+8|0,gt=(U|0)>0,oe=N+4|0,ne=N+8|0,ce=N+1|0,ke=U+1|0,Te=-2-U-((U|0)<0?~U:-1)|0,it=(U|0)>0,ie=0;do{switch(S[C+ie>>0]|0){case 0:{e[r>>2]=e[o>>2];break}case 1:{e[r>>2]=e[o>>2],O=U0[e[(e[d>>2]|0)+28>>2]&63](d,32)|0,Z=e[o>>2]|0,e[o>>2]=Z+1,S[Z>>0]=O;break}case 3:{Z=S[_>>0]|0,Q=(Z&1)==0,(Q?(Z&255)>>>1:e[Kt>>2]|0)|0&&(O=S[(Q?At:e[dt>>2]|0)>>0]|0,Z=e[o>>2]|0,e[o>>2]=Z+1,S[Z>>0]=O);break}case 2:{if(G=S[R>>0]|0,Q=(G&1)==0,G=Q?(G&255)>>>1:e[jt>>2]|0,!(Gt|(G|0)==0)){if(K=Q?i0:e[s0>>2]|0,$=K+G|0,Q=e[o>>2]|0,G)do S[Q>>0]=S[K>>0]|0,K=K+1|0,Q=Q+1|0;while((K|0)!=($|0));e[o>>2]=Q}break}case 4:{Q=e[o>>2]|0,c=w?c+1|0:c,P=c,$=e[zt>>2]|0;e:do if(c>>>0>>0){K=c;do{if(G=S[K>>0]|0,G<<24>>24<=-1||!(I[$+(G<<24>>24<<1)>>1]&2048))break e;K=K+1|0}while(K>>>0>>0)}else K=c;while(!1);if(G=K,gt){if(O=-2-G-~(G>>>0>P>>>0?P:G)|0,O=Te>>>0>O>>>0?Te:O,K>>>0>c>>>0&it)for(G=K,P=U;G=G+-1|0,Z=S[G>>0]|0,$=e[o>>2]|0,e[o>>2]=$+1,S[$>>0]=Z,$=(P|0)>1,G>>>0>c>>>0&$;)P=P+-1|0;else $=it;if(Z=ke+O|0,G=K+(O+1)|0,$?P=U0[e[(e[d>>2]|0)+28>>2]&63](d,48)|0:P=0,K=e[o>>2]|0,e[o>>2]=K+1,(Z|0)>0)for($=Z;S[K>>0]=P,K=e[o>>2]|0,e[o>>2]=K+1,($|0)>1;)$=$+-1|0;S[K>>0]=D}else G=K;if((G|0)!=(c|0)){if(Z=S[N>>0]|0,K=(Z&1)==0,(K?(Z&255)>>>1:e[oe>>2]|0)|0?K=S[(K?ce:e[ne>>2]|0)>>0]|0:K=-1,(G|0)!=(c|0))for($=0,P=0;(P|0)==(K|0)&&(Z=e[o>>2]|0,e[o>>2]=Z+1,S[Z>>0]=k,$=$+1|0,Z=S[N>>0]|0,K=(Z&1)==0,$>>>0<(K?(Z&255)>>>1:e[oe>>2]|0)>>>0?(K=S[(K?ce:e[ne>>2]|0)+$>>0]|0,K=K<<24>>24==127?-1:K<<24>>24,P=0):(K=P,P=0)),G=G+-1|0,O=S[G>>0]|0,Z=e[o>>2]|0,e[o>>2]=Z+1,S[Z>>0]=O,(G|0)!=(c|0);)P=P+1|0}else O=U0[e[(e[d>>2]|0)+28>>2]&63](d,48)|0,Z=e[o>>2]|0,e[o>>2]=Z+1,S[Z>>0]=O;if(K=e[o>>2]|0,(Q|0)!=(K|0)&&(Ee=K+-1|0,Q>>>0>>0)){K=Ee;do Z=S[Q>>0]|0,S[Q>>0]=S[K>>0]|0,S[K>>0]=Z,Q=Q+1|0,K=K+-1|0;while(Q>>>0>>0)}break}default:}ie=ie+1|0}while((ie|0)!=4);if(K=S[_>>0]|0,c=(K&1)==0,K=c?(K&255)>>>1:e[Kt>>2]|0,K>>>0>1){if(Q=c?At:e[dt>>2]|0,G=Q+K|0,c=e[o>>2]|0,(K|0)!=1){Q=Q+1|0;do S[c>>0]=S[Q>>0]|0,c=c+1|0,Q=Q+1|0;while((Q|0)!=(G|0))}e[o>>2]=c}switch(l&176|0){case 32:{e[r>>2]=e[o>>2];break}case 16:break;default:e[r>>2]=t}}function Sh(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0,ce=0,ke=0,Ee=0,Te=0;Z=b,b=b+176|0,_=Z+56|0,oe=Z+52|0,P=Z+64|0,K=Z+61|0,O=Z+60|0,ne=Z+40|0,ke=Z+28|0,ce=Z+16|0,D=Z+12|0,R=Z+68|0,$=Z+8|0,G=Z+4|0,U=Z,t=f0(l)|0,e[oe>>2]=t,g=0,Q=be(37,oe|0,44220)|0,N=g,g=0;do if(N&1)Ee=13;else{if(k=S[h>>0]|0,d=(k&1)==0,N=h+4|0,!((d?(k&255)>>>1:e[N>>2]|0)|0))k=0;else{if(d=S[(d?h+1|0:e[h+8>>2]|0)>>0]|0,g=0,w=be(e[(e[Q>>2]|0)+28>>2]|0,Q|0,45)|0,k=g,g=0,k&1){Ee=13;break}k=d<<24>>24==w<<24>>24}if(e[ne>>2]=0,e[ne+4>>2]=0,e[ne+8>>2]=0,e[ke>>2]=0,e[ke+4>>2]=0,e[ke+8>>2]=0,e[ce>>2]=0,e[ce+4>>2]=0,e[ce+8>>2]=0,g=0,I0(3,o|0,k|0,oe|0,P|0,K|0,O|0,ne|0,ke|0,ce|0,D|0),C=g,g=0,C&1)d=j()|0;else{if(C=S[h>>0]|0,o=e[N>>2]|0,d=C&1?o:(C&255)>>>1,D=e[D>>2]|0,(d|0)>(D|0)?(Te=S[ce>>0]|0,w=S[ke>>0]|0,d=(d-D<<1|1)+D+(Te&1?e[ce+4>>2]|0:(Te&255)>>>1)+(w&1?e[ke+4>>2]|0:(w&255)>>>1)|0):(Te=S[ce>>0]|0,d=S[ke>>0]|0,d=D+2+(Te&1?e[ce+4>>2]|0:(Te&255)>>>1)+(d&1?e[ke+4>>2]|0:(d&255)>>>1)|0),d>>>0>100?(d=E0(d)|0,w=d,d?Ee=17:(g=0,Nt(6),Te=g,g=0,Te&1||(C=S[h>>0]|0,o=e[N>>2]|0,d=0,Ee=17))):(w=0,d=R,Ee=17),(Ee|0)==17&&(Te=(C&1)==0,h=Te?h+1|0:e[h+8>>2]|0,g=0,Zt(1,d|0,$|0,G|0,e[l+4>>2]|0,h|0,h+(Te?(C&255)>>>1:o)|0,Q|0,k|0,P|0,S[K>>0]|0,S[O>>0]|0,ne|0,ke|0,ce|0,D|0),Te=g,g=0,!(Te&1)&&(e[U>>2]=e[r>>2],Te=e[$>>2]|0,ie=e[G>>2]|0,g=0,e[_>>2]=e[U>>2],ie=Vt(39,_|0,d|0,Te|0,ie|0,l|0,c|0)|0,Te=g,g=0,!(Te&1))))return w&&(n0(w),t=e[oe>>2]|0),de(ce),de(ke),de(ne),Bt(t)|0,b=Z,ie|0;d=j()|0,w&&(n0(w),t=e[oe>>2]|0)}de(ce),de(ke),de(ne)}while(!1);return(Ee|0)==13&&(d=j()|0),Bt(t)|0,le(d|0),0}function Ah(t){t=t|0}function vh(t){t=t|0,he(t)}function xh(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=+h;var d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0,ce=0,ke=0,Ee=0,Te=0,it=0;ne=b,b=b+992|0,K=ne+8|0,d=ne,C=ne+888|0,D=ne+880|0,w=ne+480|0,ke=ne+76|0,Z=ne+884|0,$=ne+72|0,ie=ne+68|0,Ee=ne+56|0,it=ne+44|0,Te=ne+32|0,k=ne+28|0,Q=ne+80|0,O=ne+24|0,P=ne+20|0,G=ne+16|0,e[D>>2]=C,B[K>>3]=h,C=Mo(C,100,59018,K)|0;do if(C>>>0>99)if(g=0,t=Ce(3)|0,oe=g,g=0,!(oe&1)&&(g=0,B[d>>3]=h,_=Pe(17,D|0,t|0,59018,d|0)|0,oe=g,g=0,!(oe&1))){if(t=e[D>>2]|0,!t){if(g=0,Nt(6),oe=g,g=0,oe&1){t=0,d=0,oe=7;break}t=e[D>>2]|0}w=E0(_<<2)|0,d=w,w?(U=w,oe=10):(g=0,Nt(6),oe=g,g=0,oe&1?oe=7:(U=0,oe=10))}else t=0,d=0,oe=7;else d=0,t=0,U=w,_=C,oe=10;while(!1);if((oe|0)==10)if(g=0,w=ge(68,l|0)|0,R=g,g=0,R&1)oe=7;else{if(e[ke>>2]=w,g=0,R=be(37,ke|0,44212)|0,N=g,g=0,!(N&1)&&(N=e[D>>2]|0,g=0,Pe(e[(e[R>>2]|0)+48>>2]|0,R|0,N|0,N+_|0,U|0)|0,N=g,g=0,!(N&1))){if(_?N=(S[e[D>>2]>>0]|0)==45:N=0,e[Ee>>2]=0,e[Ee+4>>2]=0,e[Ee+8>>2]=0,e[it>>2]=0,e[it+4>>2]=0,e[it+8>>2]=0,e[Te>>2]=0,e[Te+4>>2]=0,e[Te+8>>2]=0,g=0,I0(4,o|0,N|0,ke|0,Z|0,$|0,ie|0,Ee|0,it|0,Te|0,k|0),o=g,g=0,o&1)C=j()|0;else{if(k=e[k>>2]|0,(_|0)>(k|0)?(o=S[Te>>0]|0,C=S[it>>0]|0,C=(_-k<<1|1)+k+(o&1?e[Te+4>>2]|0:(o&255)>>>1)+(C&1?e[it+4>>2]|0:(C&255)>>>1)|0):(o=S[Te>>0]|0,C=S[it>>0]|0,C=k+2+(o&1?e[Te+4>>2]|0:(o&255)>>>1)+(C&1?e[it+4>>2]|0:(C&255)>>>1)|0),C>>>0>100?(C=E0(C<<2)|0,D=C,C?oe=26:(g=0,Nt(6),Q=g,g=0,Q&1||(C=0,oe=26))):(D=0,C=Q,oe=26),(oe|0)==26&&(g=0,Zt(2,C|0,O|0,P|0,e[l+4>>2]|0,U|0,U+(_<<2)|0,R|0,N|0,Z|0,e[$>>2]|0,e[ie>>2]|0,Ee|0,it|0,Te|0,k|0),ie=g,g=0,!(ie&1)&&(e[G>>2]=e[r>>2],r=e[O>>2]|0,ce=e[P>>2]|0,g=0,e[K>>2]=e[G>>2],ce=Vt(40,K|0,C|0,r|0,ce|0,l|0,c|0)|0,r=g,g=0,!(r&1))))return D&&(n0(D),w=e[ke>>2]|0),Pt(Te),Pt(it),de(Ee),Bt(w)|0,d&&n0(d),t&&n0(t),b=ne,ce|0;C=j()|0,D&&(n0(D),w=e[ke>>2]|0)}Pt(Te),Pt(it),de(Ee)}else C=j()|0;Bt(w)|0}return(oe|0)==7&&(C=j()|0),d&&n0(d),t&&n0(t),le(C|0),0}function wh(t,r,o,l,c,h,d,w,C,D){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0,w=w|0,C=C|0,D=D|0;var k=0,N=0,R=0,_=0,U=0,Q=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0;oe=b,b=b+112|0,k=oe+108|0,N=oe+96|0,U=oe+92|0,Q=oe+80|0,K=oe+68|0,G=oe+56|0,$=oe+52|0,P=oe+40|0,O=oe+36|0,Z=oe+24|0,R=oe+12|0,_=oe;do if(t){t=O0(o,43956)|0,o=e[t>>2]|0;do if(r)if(t0[e[o+44>>2]&127](k,t),r=e[k>>2]|0,S[l>>0]=r,S[l+1>>0]=r>>8,S[l+2>>0]=r>>16,S[l+3>>0]=r>>24,t0[e[(e[t>>2]|0)+32>>2]&127](N,t),S[C>>0]&1?e[e[C+8>>2]>>2]=0:S[C>>0]=0,e[C+4>>2]=0,g=0,Ae(93,C|0,0),l=g,g=0,l&1)C=j(0)|0,$t(C);else{e[C>>2]=e[N>>2],e[C+4>>2]=e[N+4>>2],e[C+8>>2]=e[N+8>>2],e[N>>2]=0,e[N+4>>2]=0,e[N+8>>2]=0,Pt(N);break}else if(t0[e[o+40>>2]&127](U,t),r=e[U>>2]|0,S[l>>0]=r,S[l+1>>0]=r>>8,S[l+2>>0]=r>>16,S[l+3>>0]=r>>24,t0[e[(e[t>>2]|0)+28>>2]&127](Q,t),S[C>>0]&1?e[e[C+8>>2]>>2]=0:S[C>>0]=0,e[C+4>>2]=0,g=0,Ae(93,C|0,0),l=g,g=0,l&1)C=j(0)|0,$t(C);else{e[C>>2]=e[Q>>2],e[C+4>>2]=e[Q+4>>2],e[C+8>>2]=e[Q+8>>2],e[Q>>2]=0,e[Q+4>>2]=0,e[Q+8>>2]=0,Pt(Q);break}while(!1);if(C=Dt[e[(e[t>>2]|0)+12>>2]&127](t)|0,e[c>>2]=C,C=Dt[e[(e[t>>2]|0)+16>>2]&127](t)|0,e[h>>2]=C,t0[e[(e[t>>2]|0)+20>>2]&127](K,t),S[d>>0]&1?(S[e[d+8>>2]>>0]=0,e[d+4>>2]=0):(S[d+1>>0]=0,S[d>>0]=0),g=0,Ae(91,d|0,0),h=g,g=0,h&1&&(h=j(0)|0,$t(h)),e[d>>2]=e[K>>2],e[d+4>>2]=e[K+4>>2],e[d+8>>2]=e[K+8>>2],e[K>>2]=0,e[K+4>>2]=0,e[K+8>>2]=0,de(K),t0[e[(e[t>>2]|0)+24>>2]&127](G,t),S[w>>0]&1?e[e[w+8>>2]>>2]=0:S[w>>0]=0,e[w+4>>2]=0,g=0,Ae(93,w|0,0),h=g,g=0,h&1)h=j(0)|0,$t(h);else{e[w>>2]=e[G>>2],e[w+4>>2]=e[G+4>>2],e[w+8>>2]=e[G+8>>2],e[G>>2]=0,e[G+4>>2]=0,e[G+8>>2]=0,Pt(G),ie=Dt[e[(e[t>>2]|0)+36>>2]&127](t)|0;break}}else{t=O0(o,43892)|0,o=e[t>>2]|0;do if(r)if(t0[e[o+44>>2]&127]($,t),r=e[$>>2]|0,S[l>>0]=r,S[l+1>>0]=r>>8,S[l+2>>0]=r>>16,S[l+3>>0]=r>>24,t0[e[(e[t>>2]|0)+32>>2]&127](P,t),S[C>>0]&1?e[e[C+8>>2]>>2]=0:S[C>>0]=0,e[C+4>>2]=0,g=0,Ae(93,C|0,0),l=g,g=0,l&1)C=j(0)|0,$t(C);else{e[C>>2]=e[P>>2],e[C+4>>2]=e[P+4>>2],e[C+8>>2]=e[P+8>>2],e[P>>2]=0,e[P+4>>2]=0,e[P+8>>2]=0,Pt(P);break}else if(t0[e[o+40>>2]&127](O,t),r=e[O>>2]|0,S[l>>0]=r,S[l+1>>0]=r>>8,S[l+2>>0]=r>>16,S[l+3>>0]=r>>24,t0[e[(e[t>>2]|0)+28>>2]&127](Z,t),S[C>>0]&1?e[e[C+8>>2]>>2]=0:S[C>>0]=0,e[C+4>>2]=0,g=0,Ae(93,C|0,0),l=g,g=0,l&1)C=j(0)|0,$t(C);else{e[C>>2]=e[Z>>2],e[C+4>>2]=e[Z+4>>2],e[C+8>>2]=e[Z+8>>2],e[Z>>2]=0,e[Z+4>>2]=0,e[Z+8>>2]=0,Pt(Z);break}while(!1);if(C=Dt[e[(e[t>>2]|0)+12>>2]&127](t)|0,e[c>>2]=C,C=Dt[e[(e[t>>2]|0)+16>>2]&127](t)|0,e[h>>2]=C,t0[e[(e[t>>2]|0)+20>>2]&127](R,t),S[d>>0]&1?(S[e[d+8>>2]>>0]=0,e[d+4>>2]=0):(S[d+1>>0]=0,S[d>>0]=0),g=0,Ae(91,d|0,0),h=g,g=0,h&1&&(h=j(0)|0,$t(h)),e[d>>2]=e[R>>2],e[d+4>>2]=e[R+4>>2],e[d+8>>2]=e[R+8>>2],e[R>>2]=0,e[R+4>>2]=0,e[R+8>>2]=0,de(R),t0[e[(e[t>>2]|0)+24>>2]&127](_,t),S[w>>0]&1?e[e[w+8>>2]>>2]=0:S[w>>0]=0,e[w+4>>2]=0,g=0,Ae(93,w|0,0),h=g,g=0,h&1)h=j(0)|0,$t(h);else{e[w>>2]=e[_>>2],e[w+4>>2]=e[_+4>>2],e[w+8>>2]=e[_+8>>2],e[_>>2]=0,e[_+4>>2]=0,e[_+8>>2]=0,Pt(_),ie=Dt[e[(e[t>>2]|0)+36>>2]&127](t)|0;break}}while(!1);e[D>>2]=ie,b=oe}function yh(t,r,o,l,c,h,d,w,C,D,k,N,R,_,U){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0,w=w|0,C=C|0,D=D|0,k=k|0,N=N|0,R=R|0,_=_|0,U=U|0;var Q=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0,ce=0,ke=0,Ee=0,Te=0,it=0,jt=0,Gt=0,s0=0,i0=0,zt=0;e[o>>2]=t,i0=_+4|0,zt=_+8|0,ke=R+4|0,Ee=(l&512|0)==0,Te=R+8|0,it=(U|0)>0,jt=N+4|0,Gt=N+8|0,s0=N+1|0,ne=(U|0)>0,oe=0;do{switch(S[C+oe>>0]|0){case 0:{e[r>>2]=e[o>>2];break}case 1:{e[r>>2]=e[o>>2],Z=U0[e[(e[d>>2]|0)+44>>2]&63](d,32)|0,ie=e[o>>2]|0,e[o>>2]=ie+4,e[ie>>2]=Z;break}case 3:{ie=S[_>>0]|0,Q=(ie&1)==0,(Q?(ie&255)>>>1:e[i0>>2]|0)|0&&(Z=e[(Q?i0:e[zt>>2]|0)>>2]|0,ie=e[o>>2]|0,e[o>>2]=ie+4,e[ie>>2]=Z);break}case 2:{if(P=S[R>>0]|0,Q=(P&1)==0,P=Q?(P&255)>>>1:e[ke>>2]|0,!(Ee|(P|0)==0)){if(Q=Q?ke:e[Te>>2]|0,G=Q+(P<<2)|0,$=e[o>>2]|0,P)for(K=$;e[K>>2]=e[Q>>2],Q=Q+4|0,(Q|0)!=(G|0);)K=K+4|0;e[o>>2]=$+(P<<2)}break}case 4:{Q=e[o>>2]|0,c=w?c+4|0:c;e:do if(c>>>0>>0){K=c;do{if(!(Yt[e[(e[d>>2]|0)+12>>2]&63](d,2048,e[K>>2]|0)|0))break e;K=K+4|0}while(K>>>0>>0)}else K=c;while(!1);if(it){if(K>>>0>c>>>0&ne){for(P=e[o>>2]|0,$=U;;)if(K=K+-4|0,G=P+4|0,e[P>>2]=e[K>>2],O=$+-1|0,$=($|0)>1,K>>>0>c>>>0&$)P=G,$=O;else{P=O;break}e[o>>2]=G,G=P}else $=ne,G=U;if($?O=U0[e[(e[d>>2]|0)+44>>2]&63](d,48)|0:O=0,Z=e[o>>2]|0,$=G+((G|0)<0?~G:-1)|0,(G|0)>0)for(P=Z;e[P>>2]=O,(G|0)>1;)P=P+4|0,G=G+-1|0;e[o>>2]=Z+($+2<<2),e[Z+($+1<<2)>>2]=D}if((K|0)==(c|0))Z=U0[e[(e[d>>2]|0)+44>>2]&63](d,48)|0,ie=e[o>>2]|0,K=ie+4|0,e[o>>2]=K,e[ie>>2]=Z;else{if(Z=S[N>>0]|0,G=(Z&1)==0,ie=e[jt>>2]|0,(G?(Z&255)>>>1:ie)|0?G=S[(G?s0:e[Gt>>2]|0)>>0]|0:G=-1,(K|0)!=(c|0))for(O=0,Z=0;$=e[o>>2]|0,(Z|0)==(G|0)?(P=$+4|0,e[o>>2]=P,e[$>>2]=k,O=O+1|0,$=S[N>>0]|0,G=($&1)==0,O>>>0<(G?($&255)>>>1:ie)>>>0?(G=S[(G?s0:e[Gt>>2]|0)+O>>0]|0,$=P,G=G<<24>>24==127?-1:G<<24>>24,P=0):($=P,G=Z,P=0)):P=Z,K=K+-4|0,Z=e[K>>2]|0,e[o>>2]=$+4,e[$>>2]=Z,(K|0)!=(c|0);)Z=P+1|0;K=e[o>>2]|0}if((Q|0)!=(K|0)&&(ce=K+-4|0,Q>>>0>>0)){K=ce;do ie=e[Q>>2]|0,e[Q>>2]=e[K>>2],e[K>>2]=ie,Q=Q+4|0,K=K+-4|0;while(Q>>>0>>0)}break}default:}oe=oe+1|0}while((oe|0)!=4);if(Q=S[_>>0]|0,c=(Q&1)==0,Q=c?(Q&255)>>>1:e[i0>>2]|0,Q>>>0>1){if(K=c?i0:e[zt>>2]|0,c=K+4|0,K=K+(Q<<2)|0,G=e[o>>2]|0,$=K-c|0,(Q|0)!=1)for(Q=G;e[Q>>2]=e[c>>2],c=c+4|0,(c|0)!=(K|0);)Q=Q+4|0;e[o>>2]=G+($>>>2<<2)}switch(l&176|0){case 32:{e[r>>2]=e[o>>2];break}case 16:break;default:e[r>>2]=t}}function Ch(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0,ce=0,ke=0,Ee=0,Te=0;Z=b,b=b+480|0,R=Z+468|0,oe=Z+464|0,P=Z+472|0,K=Z+56|0,O=Z+52|0,ne=Z+40|0,ke=Z+28|0,ce=Z+16|0,D=Z+12|0,N=Z+64|0,$=Z+8|0,G=Z+4|0,_=Z,t=f0(l)|0,e[oe>>2]=t,g=0,U=be(37,oe|0,44212)|0,Q=g,g=0;do if(Q&1)Ee=13;else{if(k=S[h>>0]|0,d=(k&1)==0,Q=h+4|0,!((d?(k&255)>>>1:e[Q>>2]|0)|0))k=0;else{if(d=e[(d?Q:e[h+8>>2]|0)>>2]|0,g=0,w=be(e[(e[U>>2]|0)+44>>2]|0,U|0,45)|0,k=g,g=0,k&1){Ee=13;break}k=(d|0)==(w|0)}if(e[ne>>2]=0,e[ne+4>>2]=0,e[ne+8>>2]=0,e[ke>>2]=0,e[ke+4>>2]=0,e[ke+8>>2]=0,e[ce>>2]=0,e[ce+4>>2]=0,e[ce+8>>2]=0,g=0,I0(4,o|0,k|0,oe|0,P|0,K|0,O|0,ne|0,ke|0,ce|0,D|0),C=g,g=0,C&1)d=j()|0;else{if(C=S[h>>0]|0,o=e[Q>>2]|0,d=C&1?o:(C&255)>>>1,D=e[D>>2]|0,(d|0)>(D|0)?(Te=S[ce>>0]|0,w=S[ke>>0]|0,d=(d-D<<1|1)+D+(Te&1?e[ce+4>>2]|0:(Te&255)>>>1)+(w&1?e[ke+4>>2]|0:(w&255)>>>1)|0):(Te=S[ce>>0]|0,d=S[ke>>0]|0,d=D+2+(Te&1?e[ce+4>>2]|0:(Te&255)>>>1)+(d&1?e[ke+4>>2]|0:(d&255)>>>1)|0),d>>>0>100?(d=E0(d<<2)|0,w=d,d?Ee=17:(g=0,Nt(6),Te=g,g=0,Te&1||(C=S[h>>0]|0,o=e[Q>>2]|0,d=0,Ee=17))):(w=0,d=N,Ee=17),(Ee|0)==17&&(Te=(C&1)==0,h=Te?Q:e[h+8>>2]|0,g=0,Zt(2,d|0,$|0,G|0,e[l+4>>2]|0,h|0,h+((Te?(C&255)>>>1:o)<<2)|0,U|0,k|0,P|0,e[K>>2]|0,e[O>>2]|0,ne|0,ke|0,ce|0,D|0),Te=g,g=0,!(Te&1)&&(e[_>>2]=e[r>>2],Te=e[$>>2]|0,ie=e[G>>2]|0,g=0,e[R>>2]=e[_>>2],ie=Vt(40,R|0,d|0,Te|0,ie|0,l|0,c|0)|0,Te=g,g=0,!(Te&1))))return w&&(n0(w),t=e[oe>>2]|0),Pt(ce),Pt(ke),de(ne),Bt(t)|0,b=Z,ie|0;d=j()|0,w&&(n0(w),t=e[oe>>2]|0)}Pt(ce),Pt(ke),de(ne)}while(!1);return(Ee|0)==13&&(d=j()|0),Bt(t)|0,le(d|0),0}function Th(t){t=t|0}function Ih(t){t=t|0,he(t)}function Eh(t,r,o){return t=t|0,r=r|0,o=o|0,t=yo(S[r>>0]&1?e[r+8>>2]|0:r+1|0,1)|0,t>>>((t|0)!=-1&1)|0}function kh(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0;w=b,b=b+16|0,C=w,e[C>>2]=0,e[C+4>>2]=0,e[C+8>>2]=0,d=S[h>>0]|0,D=(d&1)==0,r=D?h+1|0:e[h+8>>2]|0,d=D?(d&255)>>>1:e[h+4>>2]|0,h=r+d|0;e:do if((d|0)>0){for(;g=0,Ae(67,C|0,S[r>>0]|0),D=g,g=0,!(D&1);)if(r=r+1|0,r>>>0>=h>>>0){d=4;break e}r=j()|0,d=7}else d=4;while(!1);e:do if((d|0)==4){if(g=0,r=Pe(19,((o|0)==-1?-1:o<<1)|0,l|0,c|0,(S[C>>0]&1?e[C+8>>2]|0:C+1|0)|0)|0,D=g,g=0,D&1){r=j()|0,d=7;break}e[t>>2]=0,e[t+4>>2]=0,e[t+8>>2]=0,D=$i(r)|0,h=r+D|0;t:do if((D|0)>0){for(;g=0,Ae(67,t|0,S[r>>0]|0),D=g,g=0,!(D&1);)if(r=r+1|0,r>>>0>=h>>>0)break t;r=j()|0,de(t);break e}while(!1);de(C),b=w;return}while(!1);de(C),le(r|0)}function Dh(t,r){t=t|0,r=r|0}function bh(t){t=t|0}function Nh(t){t=t|0,he(t)}function Fh(t,r,o){return t=t|0,r=r|0,o=o|0,t=yo(S[r>>0]&1?e[r+8>>2]|0:r+1|0,1)|0,t>>>((t|0)!=-1&1)|0}function Rh(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0,G=0,$=0,P=0,O=0;$=b,b=b+224|0,N=$+184|0,k=$+192|0,D=$+180|0,R=$+176|0,K=$+168|0,Q=$+40|0,U=$+32|0,G=$+28|0,P=$+16|0,C=$+8|0,_=$,e[P>>2]=0,e[P+4>>2]=0,e[P+8>>2]=0,e[C+4>>2]=0,e[C>>2]=44696,w=S[h>>0]|0,O=(w&1)==0,d=h+4|0,r=O?d:e[h+8>>2]|0,h=O?(w&255)>>>1:e[d>>2]|0,d=r+(h<<2)|0,w=k+32|0;e:do if((h|0)>0){t:for(;;){if(e[R>>2]=r,g=0,h=Xt(e[(e[C>>2]|0)+12>>2]|0,C|0,N|0,r|0,d|0,R|0,k|0,w|0,D|0)|0,O=g,g=0,O&1){h=12;break}if((h|0)==2||(e[R>>2]|0)==(r|0)){h=5;break}if(k>>>0<(e[D>>2]|0)>>>0){r=k;do{if(g=0,Ae(67,P|0,S[r>>0]|0),O=g,g=0,O&1){h=11;break t}r=r+1|0}while(r>>>0<(e[D>>2]|0)>>>0)}if(r=e[R>>2]|0,!((h|0)!=2&r>>>0>>0)){h=9;break e}}(h|0)==5?(g=0,ue(190,58955),g=0,r=j()|0):((h|0)==11||(h|0)==12)&&(r=j()|0)}else h=9;while(!1);e:do if((h|0)==9){if(g=0,r=Pe(19,((o|0)==-1?-1:o<<1)|0,l|0,c|0,(S[P>>0]&1?e[P+8>>2]|0:P+1|0)|0)|0,O=g,g=0,O&1){r=j()|0;break}e[t>>2]=0,e[t+4>>2]=0,e[t+8>>2]=0,e[_+4>>2]=0,e[_>>2]=44744,O=$i(r)|0,d=r+O|0,w=d,C=Q+128|0;t:do if((O|0)>0){i:for(;;){if(e[G>>2]=r,g=0,h=Xt(e[(e[_>>2]|0)+16>>2]|0,_|0,K|0,r|0,((w-r|0)>32?r+32|0:d)|0,G|0,Q|0,C|0,U|0)|0,O=g,g=0,O&1){h=24;break}if((h|0)==2||(e[G>>2]|0)==(r|0)){h=18;break}if(Q>>>0<(e[U>>2]|0)>>>0){r=Q;do{if(g=0,Ae(92,t|0,e[r>>2]|0),O=g,g=0,O&1){h=23;break i}r=r+4|0}while(r>>>0<(e[U>>2]|0)>>>0)}if(r=e[G>>2]|0,!((h|0)!=2&r>>>0>>0))break t}(h|0)==18?(g=0,ue(190,58955),g=0,r=j()|0):((h|0)==23||(h|0)==24)&&(r=j()|0),Pt(t);break e}while(!1);de(P),b=$;return}while(!1);de(P),le(r|0)}function Mh(t,r){t=t|0,r=r|0}function _h(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0;if(e[t+4>>2]=r+-1,e[t>>2]=44196,h=t+8|0,g=0,Ae(94,h|0,28),c=g,g=0,c&1)r=j()|0;else{if(c=t+144|0,g=0,xe(5,c|0,58885,1),l=g,g=0,l&1)r=j()|0;else{if(o=e[h>>2]|0,l=t+12|0,r=e[l>>2]|0,(r|0)!=(o|0)){do r=r+-4|0;while((r|0)!=(o|0));e[l>>2]=r}e[495]=0,e[494]=43124,g=0,Ae(95,t|0,1976),l=g,g=0;do if(!(l&1)&&(e[497]=0,e[496]=43164,g=0,Ae(96,t|0,1984),l=g,g=0,!(l&1))&&(e[499]=0,e[498]=44236,e[500]=0,S[2004]=0,l=nn()|0,e[500]=l,g=0,Ae(97,t|0,1992),l=g,g=0,!(l&1))&&(e[503]=0,e[502]=44484,g=0,Ae(98,t|0,2008),l=g,g=0,!(l&1))&&(e[505]=0,e[504]=44552,g=0,Ae(99,t|0,2016),l=g,g=0,!(l&1))&&(g=0,Ae(100,2024,1),l=g,g=0,!(l&1))&&(g=0,Ae(101,t|0,2024),l=g,g=0,!(l&1))&&(e[511]=0,e[510]=44600,g=0,Ae(102,t|0,2040),l=g,g=0,!(l&1))&&(e[513]=0,e[512]=44648,g=0,Ae(103,t|0,2048),l=g,g=0,!(l&1))&&(i4(2056,1),g=0,Ae(104,t|0,2056),l=g,g=0,!(l&1))&&(n4(2080,1),g=0,Ae(105,t|0,2080),l=g,g=0,!(l&1))&&(e[529]=0,e[528]=43204,g=0,Ae(106,t|0,2112),l=g,g=0,!(l&1))&&(e[531]=0,e[530]=43276,g=0,Ae(107,t|0,2120),l=g,g=0,!(l&1))&&(e[533]=0,e[532]=43348,g=0,Ae(108,t|0,2128),l=g,g=0,!(l&1))){if(e[535]=0,e[534]=43408,g=0,Ae(109,t|0,2136),l=g,g=0,l&1){d=42;break}if(e[537]=0,e[536]=43716,g=0,Ae(110,t|0,2144),l=g,g=0,l&1){d=42;break}if(e[539]=0,e[538]=43780,g=0,Ae(111,t|0,2152),l=g,g=0,l&1){d=42;break}if(e[541]=0,e[540]=43844,g=0,Ae(112,t|0,2160),l=g,g=0,l&1){d=42;break}if(e[543]=0,e[542]=43908,g=0,Ae(113,t|0,2168),l=g,g=0,l&1){d=42;break}if(e[545]=0,e[544]=43972,g=0,Ae(114,t|0,2176),l=g,g=0,l&1){d=42;break}if(e[547]=0,e[546]=44008,g=0,Ae(115,t|0,2184),l=g,g=0,l&1){d=42;break}if(e[549]=0,e[548]=44044,g=0,Ae(116,t|0,2192),l=g,g=0,l&1){d=42;break}if(e[551]=0,e[550]=44080,g=0,Ae(117,t|0,2200),l=g,g=0,l&1){d=42;break}if(e[553]=0,e[552]=43468,e[554]=43516,g=0,Ae(118,t|0,2208),l=g,g=0,l&1){d=42;break}if(e[557]=0,e[556]=43560,e[558]=43608,g=0,Ae(119,t|0,2224),l=g,g=0,l&1){d=42;break}if(e[561]=0,e[560]=44464,g=0,r=Ce(3)|0,l=g,g=0,l&1){r=j()|0;break}if(e[562]=r,e[560]=43652,g=0,Ae(120,t|0,2240),l=g,g=0,l&1){d=42;break}if(e[565]=0,e[564]=44464,g=0,r=Ce(3)|0,l=g,g=0,l&1){r=j()|0;break}if(e[566]=r,e[564]=43684,g=0,Ae(121,t|0,2256),d=g,g=0,d&1){d=42;break}if(e[569]=0,e[568]=44116,g=0,Ae(122,t|0,2272),d=g,g=0,d&1){d=42;break}if(e[571]=0,e[570]=44156,g=0,Ae(123,t|0,2280),d=g,g=0,d&1){d=42;break}return}else d=42;while(!1);(d|0)==42&&(r=j()|0),de(c)}yr(h)}le(r|0)}function Ph(){var t=0;do if(!(S[2288]|0)&&kt(2288)|0)if(g=0,Ce(4)|0,t=g,g=0,t&1)t=j()|0,W0(2288),le(t|0);else{e[11246]=44980,bt(2288);break}while(!1);return e[11246]|0}function w0(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0;pn(r),c=t+8|0,l=e[c>>2]|0;do if((e[t+12>>2]|0)-l>>2>>>0<=o>>>0){if(g=0,Ae(124,c|0,o+1|0),t=g,g=0,!(t&1)){l=e[c>>2]|0;break}l=j()|0,r&&Bt(r)|0,le(l|0)}while(!1);t=e[l+(o<<2)>>2]|0,t&&(Bt(t)|0,l=e[c>>2]|0),e[l+(o<<2)>>2]=r}function Rs(t){t=t|0;var r=0,o=0,l=0,c=0;if(e[t>>2]=44196,l=t+8|0,c=t+12|0,r=e[l>>2]|0,(e[c>>2]|0)!=(r|0)){o=0;do r=e[r+(o<<2)>>2]|0,r&&Bt(r)|0,o=o+1|0,r=e[l>>2]|0;while(o>>>0<(e[c>>2]|0)-r>>2>>>0)}de(t+144|0),yr(l)}function Lh(t){t=t|0,Rs(t),he(t)}function Oh(t,r){return t=t|0,r=r|0,P3(t,r)|0?e[(e[t+8>>2]|0)+(r<<2)>>2]|0:(t=Ct(4)|0,B6(t),Qt(t|0,640,82),0)}function $h(){return _h(2296,1),e[11245]=2296,44980}function Bh(){var t=0;return t=Ph()|0,t=e[t>>2]|0,e[11247]=t,pn(t),44988}function Vh(){var t=0;do if(!(S[2456]|0)&&kt(2456)|0)if(g=0,Ce(5)|0,t=g,g=0,t&1)t=j()|0,W0(2456),le(t|0);else{e[11248]=44988,bt(2456);break}while(!1);return e[11248]|0}function ur(t){t=t|0;var r=0,o=0;if(g=0,r=Ce(6)|0,o=g,g=0,o&1)o=j(0)|0,$t(o);else{o=e[r>>2]|0,e[t>>2]=o,pn(o);return}}function tn(t,r){t=t|0,r=r|0,r=e[r>>2]|0,e[t>>2]=r,pn(r)}function _0(t){t=t|0,Bt(e[t>>2]|0)|0}function x0(t){t=t|0;var r=0,o=0;return o=b,b=b+16|0,r=o,(e[t>>2]|0)!=-1&&(e[r>>2]=t,e[r+4>>2]=191,e[r+8>>2]=0,gp(t,r,192)),b=o,(e[t+4>>2]|0)+-1|0}function O0(t,r){return t=t|0,r=r|0,t=e[t>>2]|0,Oh(t,x0(r)|0)|0}function Uh(t){t=t|0,he(t)}function Gh(t){t=t|0,t&&Mt[e[(e[t>>2]|0)+4>>2]&255](t)}function qh(t){t=t|0;var r=0;r=e[11052]|0,e[11052]=r+1,e[t+4>>2]=r+1}function Wh(t){t=t|0,he(t)}function Hh(t,r,o){return t=t|0,r=r|0,o=o|0,o>>>0<128?(o=(nn()|0)+(o<<1)|0,o=(I[o>>1]&r)<<16>>16!=0):o=0,o|0}function nn(){var t=0,r=0;if(g=0,t=Ce(7)|0,r=g,g=0,r&1)r=j(0)|0,$t(r);else return e[t>>2]|0;return 0}function Qh(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0;if(h=(o-r|0)>>>2,(r|0)!=(o|0))for(c=r;t=e[c>>2]|0,t>>>0<128?(t=(nn()|0)+(t<<1)|0,t=M[t>>1]|0):t=0,I[l>>1]=t,c=c+4|0,(c|0)!=(o|0);)l=l+2|0;return r+(h<<2)|0}function Kh(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;e:do if((o|0)==(l|0))o=l;else for(;;){if(t=e[o>>2]|0,t>>>0<128&&(t=(nn()|0)+(t<<1)|0,(I[t>>1]&r)<<16>>16!=0))break e;if(o=o+4|0,(o|0)==(l|0)){o=l;break}}while(!1);return o|0}function Yh(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;e:do if((o|0)==(l|0))o=l;else for(;;){if(t=e[o>>2]|0,t>>>0>=128||(t=(nn()|0)+(t<<1)|0,!((I[t>>1]&r)<<16>>16)))break e;if(o=o+4|0,(o|0)==(l|0)){o=l;break}}while(!1);return o|0}function jh(t,r){return t=t|0,r=r|0,r>>>0<128&&(r=(hn()|0)+(r<<2)|0,r=e[r>>2]|0),r|0}function hn(){var t=0,r=0;if(g=0,t=Ce(8)|0,r=g,g=0,r&1)r=j(0)|0,$t(r);else return e[t>>2]|0;return 0}function Xh(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0;if(c=(o-r|0)>>>2,(r|0)!=(o|0)){l=r;do t=e[l>>2]|0,t>>>0<128&&(t=(hn()|0)+(t<<2)|0,t=e[t>>2]|0),e[l>>2]=t,l=l+4|0;while((l|0)!=(o|0))}return r+(c<<2)|0}function Zh(t,r){return t=t|0,r=r|0,r>>>0<128&&(r=(dn()|0)+(r<<2)|0,r=e[r>>2]|0),r|0}function dn(){var t=0,r=0;if(g=0,t=Ce(9)|0,r=g,g=0,r&1)r=j(0)|0,$t(r);else return e[t>>2]|0;return 0}function Jh(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0;if(c=(o-r|0)>>>2,(r|0)!=(o|0)){l=r;do t=e[l>>2]|0,t>>>0<128&&(t=(dn()|0)+(t<<2)|0,t=e[t>>2]|0),e[l>>2]=t,l=l+4|0;while((l|0)!=(o|0))}return r+(c<<2)|0}function ed(t,r){return t=t|0,r=r|0,r<<24>>24|0}function id(t,r,o,l){if(t=t|0,r=r|0,o=o|0,l=l|0,(r|0)!=(o|0))for(;e[l>>2]=S[r>>0],r=r+1|0,(r|0)!=(o|0);)l=l+4|0;return o|0}function nd(t,r,o){return t=t|0,r=r|0,o=o|0,(r>>>0<128?r&255:o)|0}function rd(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0;if(d=(o-r|0)>>>2,(r|0)!=(o|0))for(h=r,t=c;c=e[h>>2]|0,S[t>>0]=c>>>0<128?c&255:l,h=h+4|0,(h|0)!=(o|0);)t=t+1|0;return r+(d<<2)|0}function Ms(t){t=t|0;var r=0;e[t>>2]=44236,r=e[t+8>>2]|0,r|0&&S[t+12>>0]|0&&N6(r)}function sd(t){t=t|0,Ms(t),he(t)}function od(t,r){return t=t|0,r=r|0,r<<24>>24>-1&&(r=(hn()|0)+((r&255)<<2)|0,r=e[r>>2]&255),r|0}function ad(t,r,o){if(t=t|0,r=r|0,o=o|0,(r|0)!=(o|0)){t=r;do r=S[t>>0]|0,r<<24>>24>-1&&(r=(hn()|0)+(r<<24>>24<<2)|0,r=e[r>>2]&255),S[t>>0]=r,t=t+1|0;while((t|0)!=(o|0))}return o|0}function ld(t,r){return t=t|0,r=r|0,r<<24>>24>-1&&(r=(dn()|0)+(r<<24>>24<<2)|0,r=e[r>>2]&255),r|0}function ud(t,r,o){if(t=t|0,r=r|0,o=o|0,(r|0)!=(o|0)){t=r;do r=S[t>>0]|0,r<<24>>24>-1&&(r=(dn()|0)+(r<<24>>24<<2)|0,r=e[r>>2]&255),S[t>>0]=r,t=t+1|0;while((t|0)!=(o|0))}return o|0}function cd(t,r){return t=t|0,r=r|0,r|0}function hd(t,r,o,l){if(t=t|0,r=r|0,o=o|0,l=l|0,(r|0)!=(o|0))for(;S[l>>0]=S[r>>0]|0,r=r+1|0,(r|0)!=(o|0);)l=l+1|0;return o|0}function dd(t,r,o){return t=t|0,r=r|0,o=o|0,(r<<24>>24>-1?r:o)|0}function pd(t,r,o,l,c){if(t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,(r|0)!=(o|0))for(;t=S[r>>0]|0,S[c>>0]=t<<24>>24>-1?t:l,r=r+1|0,(r|0)!=(o|0);)c=c+1|0;return o|0}function md(t){t=t|0,he(t)}function gd(t,r,o,l,c,h,d,w){return t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0,w=w|0,e[c>>2]=o,e[w>>2]=h,3}function Sd(t,r,o,l,c,h,d,w){return t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0,w=w|0,e[c>>2]=o,e[w>>2]=h,3}function Ad(t,r,o,l,c){return t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,e[c>>2]=o,3}function vd(t){return t=t|0,1}function xd(t){return t=t|0,1}function wd(t,r,o,l,c){return t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,t=l-o|0,(t>>>0>>0?t:c)|0}function yd(t){return t=t|0,1}function Cd(t,r){t=t|0,r=r|0;var o=0;if(e[t+4>>2]=r+-1,e[t>>2]=44304,g=0,r=Ce(3)|0,o=g,g=0,o&1)o=j()|0,le(o|0);else{e[t+8>>2]=r;return}}function Td(t){t=t|0,io(t),he(t)}function cr(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0,ce=0,ke=0,Ee=0,Te=0,it=0,jt=0,Gt=0,s0=0,i0=0,zt=0,gt=0,Kt=0,dt=0,At=0,y0=0,T0=0,g0=0,Oe=0,yt=0,qt=0,c0=0,a0=0,h0=0,D0=0,A0=0,Ti=0,F0=0,Si=0;Si=b,b=b+624|0,h0=Si+24|0,A0=Si+16|0,D0=Si+588|0,Oe=Si+576|0,a0=Si,y0=Si+536|0,F0=Si+8|0,Ti=Si+528|0,jt=(t|0)!=0,Gt=y0+40|0,At=Gt,y0=y0+39|0,T0=F0+4|0,g0=Oe+12|0,Oe=Oe+11|0,yt=D0,qt=g0,c0=qt-yt|0,s0=-2-yt|0,i0=qt+2|0,zt=h0+288|0,gt=D0+9|0,Kt=gt,dt=D0+8|0,h=0,Q=r,d=0,r=0;e:for(;;){do if((h|0)>-1)if((d|0)>(2147483647-h|0)){h=S0()|0,e[h>>2]=75,h=-1;break}else{h=d+h|0;break}while(!1);if(d=S[Q>>0]|0,d<<24>>24)w=Q;else{it=245;break}t:for(;;){switch(d<<24>>24){case 37:{d=w,it=9;break t}case 0:{d=w;break t}default:}Te=w+1|0,d=S[Te>>0]|0,w=Te}t:do if((it|0)==9)for(;;){if(it=0,(S[d+1>>0]|0)!=37)break t;if(w=w+1|0,d=d+2|0,(S[d>>0]|0)==37)it=9;else break}while(!1);if(G=w-Q|0,jt&&!(e[t>>2]&32|0)&&B0(Q,G,t)|0,(w|0)!=(Q|0)){Q=d,d=G;continue}k=d+1|0,w=S[k>>0]|0,C=(w<<24>>24)+-48|0,C>>>0<10?(Te=(S[d+2>>0]|0)==36,k=Te?d+3|0:k,w=S[k>>0]|0,_=Te?C:-1,r=Te?1:r):_=-1,d=w<<24>>24;t:do if((d&-32|0)==32)for(C=0;;){if(!(1<>24)+-32|C,k=k+1|0,w=S[k>>0]|0,d=w<<24>>24,(d&-32|0)!=32){N=C,d=k;break}}else N=0,d=k;while(!1);do if(w<<24>>24==42){if(C=d+1|0,w=(S[C>>0]|0)+-48|0,w>>>0<10&&(S[d+2>>0]|0)==36)e[c+(w<<2)>>2]=10,r=1,d=d+3|0,w=e[l+((S[C>>0]|0)+-48<<3)>>2]|0;else{if(r){h=-1;break e}if(!jt){K=N,d=C,r=0,Te=0;break}r=(e[o>>2]|0)+3&-4,w=e[r>>2]|0,e[o>>2]=r+4,r=0,d=C}(w|0)<0?(K=N|8192,Te=0-w|0):(K=N,Te=w)}else if(C=(w<<24>>24)+-48|0,C>>>0<10){w=0;do w=(w*10|0)+C|0,d=d+1|0,C=(S[d>>0]|0)+-48|0;while(C>>>0<10);if((w|0)<0){h=-1;break e}else K=N,Te=w}else K=N,Te=0;while(!1);t:do if((S[d>>0]|0)==46){if(C=d+1|0,w=S[C>>0]|0,w<<24>>24!=42){if(k=(w<<24>>24)+-48|0,k>>>0<10)d=C,w=0;else{d=C,k=0;break}for(;;)if(w=(w*10|0)+k|0,d=d+1|0,k=(S[d>>0]|0)+-48|0,k>>>0>=10){k=w;break t}}if(C=d+2|0,w=(S[C>>0]|0)+-48|0,w>>>0<10&&(S[d+3>>0]|0)==36){e[c+(w<<2)>>2]=10,d=d+4|0,k=e[l+((S[C>>0]|0)+-48<<3)>>2]|0;break}if(r){h=-1;break e}jt?(d=(e[o>>2]|0)+3&-4,k=e[d>>2]|0,e[o>>2]=d+4,d=C):(d=C,k=0)}else k=-1;while(!1);for(R=0;;){if(w=(S[d>>0]|0)+-65|0,w>>>0>57){h=-1;break e}if(C=d+1|0,w=S[56223+(R*58|0)+w>>0]|0,N=w&255,(N+-1|0)>>>0<8)d=C,R=N;else{Ee=C;break}}if(!(w<<24>>24)){h=-1;break}C=(_|0)>-1;do if(w<<24>>24==19)if(C){h=-1;break e}else it=52;else{if(C){e[c+(_<<2)>>2]=N,ce=l+(_<<3)|0,ke=e[ce+4>>2]|0,it=a0,e[it>>2]=e[ce>>2],e[it+4>>2]=ke,it=52;break}if(!jt){h=0;break e}Ps(a0,N,o)}while(!1);if((it|0)==52&&(it=0,!jt)){Q=Ee,d=G;continue}_=S[d>>0]|0,_=(R|0)!=0&(_&15|0)==3?_&-33:_,C=K&-65537,ke=K&8192|0?C:K;t:do switch(_|0){case 110:switch(R|0){case 0:{e[e[a0>>2]>>2]=h,Q=Ee,d=G;continue e}case 1:{e[e[a0>>2]>>2]=h,Q=Ee,d=G;continue e}case 2:{Q=e[a0>>2]|0,e[Q>>2]=h,e[Q+4>>2]=((h|0)<0)<<31>>31,Q=Ee,d=G;continue e}case 3:{I[e[a0>>2]>>1]=h,Q=Ee,d=G;continue e}case 4:{S[e[a0>>2]>>0]=h,Q=Ee,d=G;continue e}case 6:{e[e[a0>>2]>>2]=h,Q=Ee,d=G;continue e}case 7:{Q=e[a0>>2]|0,e[Q>>2]=h,e[Q+4>>2]=((h|0)<0)<<31>>31,Q=Ee,d=G;continue e}default:{Q=Ee,d=G;continue e}}case 112:{R=ke|8,k=k>>>0>8?k:8,_=120,it=64;break}case 88:case 120:{R=ke,it=64;break}case 111:{if(C=a0,w=e[C>>2]|0,C=e[C+4>>2]|0,(w|0)==0&(C|0)==0)d=Gt;else{d=Gt;do d=d+-1|0,S[d>>0]=w&7|48,w=Di(w|0,C|0,3)|0,C=ye;while(!((w|0)==0&(C|0)==0))}ke&8?(R=At-d+1|0,w=ke,k=(k|0)<(R|0)?R:k,R=0,N=56703,it=77):(w=ke,R=0,N=56703,it=77);break}case 105:case 100:{if(w=a0,d=e[w>>2]|0,w=e[w+4>>2]|0,(w|0)<0){d=ii(0,0,d|0,w|0)|0,w=ye,C=a0,e[C>>2]=d,e[C+4>>2]=w,C=1,N=56703,it=76;break t}ke&2048?(C=1,N=56704,it=76):(N=ke&1,C=N,N=N|0?56705:56703,it=76);break}case 117:{w=a0,d=e[w>>2]|0,w=e[w+4>>2]|0,C=0,N=56703,it=76;break}case 99:{S[y0>>0]=e[a0>>2],Q=y0,w=1,R=0,_=56703,d=Gt;break}case 109:{d=S0()|0,d=vo(e[d>>2]|0)|0,it=82;break}case 115:{d=e[a0>>2]|0,d=d|0?d:56713,it=82;break}case 67:{e[F0>>2]=e[a0>>2],e[T0>>2]=0,e[a0>>2]=F0,k=-1,it=86;break}case 83:{k?it=86:(z0(t,32,Te,0,ke),d=0,it=98);break}case 65:case 71:case 70:case 69:case 97:case 103:case 102:case 101:{D=+B[a0>>3],e[A0>>2]=0,B[q>>3]=D,(e[q+4>>2]|0)>=0?ke&2048?(ne=1,ce=56723):(ce=ke&1,ne=ce,ce=ce|0?56726:56721):(D=-D,ne=1,ce=56720),B[q>>3]=D,oe=e[q+4>>2]&2146435072;do if(oe>>>0<2146435072|(oe|0)==2146435072&!1){if(U=+yS(D,A0)*2,w=U!=0,w&&(e[A0>>2]=(e[A0>>2]|0)+-1),Z=_|32,(Z|0)==97){Q=_&32,G=Q|0?ce+9|0:ce,K=ne|2,d=12-k|0;do if(k>>>0>11|(d|0)==0)D=U;else{D=8;do d=d+-1|0,D=D*16;while(d|0);if((S[G>>0]|0)==45){D=-(D+(-U-D));break}else{D=U+D-D;break}}while(!1);for(w=e[A0>>2]|0,d=(w|0)<0?0-w|0:w,d=zi(d,((d|0)<0)<<31>>31,g0)|0,(d|0)==(g0|0)&&(S[Oe>>0]=48,d=Oe),S[d+-1>>0]=(w>>31&2)+43,R=d+-2|0,S[R>>0]=_+15,N=(k|0)<1,C=(ke&8|0)==0,w=D0;;){ce=~~D,d=w+1|0,S[w>>0]=F[56687+ce>>0]|Q,D=(D-+(ce|0))*16;do if((d-yt|0)==1){if(C&(N&D==0))break;S[d>>0]=46,d=w+2|0}while(!1);if(D==0)break;w=d}k=(k|0)!=0&(s0+d|0)<(k|0)?i0+k-R|0:c0-R+d|0,C=k+K|0,z0(t,32,Te,C,ke),e[t>>2]&32||B0(G,K,t)|0,z0(t,48,Te,C,ke^65536),d=d-yt|0,e[t>>2]&32||B0(D0,d,t)|0,w=qt-R|0,z0(t,48,k-(d+w)|0,0,0),e[t>>2]&32||B0(R,w,t)|0,z0(t,32,Te,C,ke^8192),d=(C|0)<(Te|0)?Te:C;break}d=(k|0)<0?6:k,w?(w=(e[A0>>2]|0)+-28|0,e[A0>>2]=w,D=U*268435456):(D=U,w=e[A0>>2]|0),oe=(w|0)<0?h0:zt,ie=oe,w=oe;do O=~~D>>>0,e[w>>2]=O,w=w+4|0,D=(D-+(O>>>0))*1e9;while(D!=0);if(C=w,w=e[A0>>2]|0,(w|0)>0)for(N=oe;;){R=(w|0)>29?29:w,k=C+-4|0;do if(k>>>0>>0)k=N;else{w=0;do O=v0(e[k>>2]|0,0,R|0)|0,O=$0(O|0,ye|0,w|0,0)|0,w=ye,P=Cr(O|0,w|0,1e9,0)|0,e[k>>2]=P,w=xn(O|0,w|0,1e9,0)|0,k=k+-4|0;while(k>>>0>=N>>>0);if(!w){k=N;break}k=N+-4|0,e[k>>2]=w}while(!1);for(;!(C>>>0<=k>>>0);)if(w=C+-4|0,!(e[w>>2]|0))C=w;else break;if(w=(e[A0>>2]|0)-R|0,e[A0>>2]=w,(w|0)>0)N=k;else break}else k=oe;if((w|0)<0)for(G=((d+25|0)/9|0)+1|0,$=(Z|0)==102,Q=k;;){K=0-w|0,K=(K|0)>9?9:K;do if(Q>>>0>>0){w=(1<>>K,k=0,R=Q;do O=e[R>>2]|0,e[R>>2]=(O>>>K)+k,k=ee(O&w,N)|0,R=R+4|0;while(R>>>0>>0);if(w=e[Q>>2]|0?Q:Q+4|0,!k){k=w;break}e[C>>2]=k,k=w,C=C+4|0}else k=e[Q>>2]|0?Q:Q+4|0;while(!1);if(w=$?oe:k,C=(C-w>>2|0)>(G|0)?w+(G<<2)|0:C,w=(e[A0>>2]|0)+K|0,e[A0>>2]=w,(w|0)>=0){Q=k;break}else Q=k}else Q=k;do if(Q>>>0>>0){if(w=(ie-Q>>2)*9|0,N=e[Q>>2]|0,N>>>0<10)break;k=10;do k=k*10|0,w=w+1|0;while(N>>>0>=k>>>0)}else w=0;while(!1);if(P=(Z|0)==103,O=(d|0)!=0,k=d-((Z|0)!=102?w:0)+((O&P)<<31>>31)|0,(k|0)<(((C-ie>>2)*9|0)+-9|0)){if(R=k+9216|0,$=(R|0)/9|0,k=oe+($+-1023<<2)|0,R=((R|0)%9|0)+1|0,(R|0)<9){N=10;do N=N*10|0,R=R+1|0;while((R|0)!=9)}else N=10;K=e[k>>2]|0,G=(K>>>0)%(N>>>0)|0,!(G|0)&&(oe+($+-1022<<2)|0)==(C|0)?N=Q:it=163;do if((it|0)==163){it=0,U=((K>>>0)/(N>>>0)|0)&1|0?9007199254740994:9007199254740992,R=(N|0)/2|0;do if(G>>>0>>0)D=.5;else{if((G|0)==(R|0)&&(oe+($+-1022<<2)|0)==(C|0)){D=1;break}D=1.5}while(!1);do if(ne){if((S[ce>>0]|0)!=45)break;U=-U,D=-D}while(!1);if(R=K-G|0,e[k>>2]=R,U+D==U){N=Q;break}if(Z=R+N|0,e[k>>2]=Z,Z>>>0>999999999)for(w=Q;;)if(N=k+-4|0,e[k>>2]=0,N>>>0>>0&&(w=w+-4|0,e[w>>2]=0),Z=(e[N>>2]|0)+1|0,e[N>>2]=Z,Z>>>0>999999999)k=N;else{Q=w,k=N;break}if(w=(ie-Q>>2)*9|0,R=e[Q>>2]|0,R>>>0<10){N=Q;break}else N=10;do N=N*10|0,w=w+1|0;while(R>>>0>=N>>>0);N=Q}while(!1);Z=k+4|0,Q=N,C=C>>>0>Z>>>0?Z:C}for(G=0-w|0;;){if(C>>>0<=Q>>>0){$=0,Z=C;break}if(k=C+-4|0,!(e[k>>2]|0))C=k;else{$=1,Z=C;break}}do if(P){if(d=(O&1^1)+d|0,(d|0)>(w|0)&(w|0)>-5?(_=_+-1|0,d=d+-1-w|0):(_=_+-2|0,d=d+-1|0),C=ke&8,C)break;do if($){if(C=e[Z+-4>>2]|0,!C){k=9;break}if(!((C>>>0)%10|0))N=10,k=0;else{k=0;break}do N=N*10|0,k=k+1|0;while(!((C>>>0)%(N>>>0)|0|0))}else k=9;while(!1);if(C=((Z-ie>>2)*9|0)+-9|0,(_|32|0)==102){C=C-k|0,C=(C|0)<0?0:C,d=(d|0)<(C|0)?d:C,C=0;break}else{C=C+w-k|0,C=(C|0)<0?0:C,d=(d|0)<(C|0)?d:C,C=0;break}}else C=ke&8;while(!1);if(K=d|C,N=(K|0)!=0&1,R=(_|32|0)==102,R)w=(w|0)>0?w:0,_=0;else{if(k=(w|0)<0?G:w,k=zi(k,((k|0)<0)<<31>>31,g0)|0,(qt-k|0)<2)do k=k+-1|0,S[k>>0]=48;while((qt-k|0)<2);S[k+-1>>0]=(w>>31&2)+43,ie=k+-2|0,S[ie>>0]=_,w=qt-ie|0,_=ie}G=ne+1+d+N+w|0,z0(t,32,Te,G,ke),e[t>>2]&32||B0(ce,ne,t)|0,z0(t,48,Te,G,ke^65536);do if(R){k=Q>>>0>oe>>>0?oe:Q,w=k;do{C=zi(e[w>>2]|0,0,gt)|0;do if((w|0)==(k|0)){if((C|0)!=(gt|0))break;S[dt>>0]=48,C=dt}else{if(C>>>0<=D0>>>0)break;do C=C+-1|0,S[C>>0]=48;while(C>>>0>D0>>>0)}while(!1);e[t>>2]&32||B0(C,Kt-C|0,t)|0,w=w+4|0}while(w>>>0<=oe>>>0);do if(K){if(e[t>>2]&32)break;B0(56755,1,t)|0}while(!1);if((d|0)>0&w>>>0>>0)for(C=w;;){if(w=zi(e[C>>2]|0,0,gt)|0,w>>>0>D0>>>0)do w=w+-1|0,S[w>>0]=48;while(w>>>0>D0>>>0);if(e[t>>2]&32||B0(w,(d|0)>9?9:d,t)|0,C=C+4|0,w=d+-9|0,(d|0)>9&C>>>0>>0)d=w;else{d=w;break}}z0(t,48,d+9|0,9,0)}else{if(R=$?Z:Q+4|0,(d|0)>-1){N=(C|0)==0,k=Q;do{w=zi(e[k>>2]|0,0,gt)|0,(w|0)==(gt|0)&&(S[dt>>0]=48,w=dt);do if((k|0)==(Q|0)){if(C=w+1|0,e[t>>2]&32||B0(w,1,t)|0,N&(d|0)<1){w=C;break}if(e[t>>2]&32){w=C;break}B0(56755,1,t)|0,w=C}else{if(w>>>0<=D0>>>0)break;do w=w+-1|0,S[w>>0]=48;while(w>>>0>D0>>>0)}while(!1);C=Kt-w|0,e[t>>2]&32||B0(w,(d|0)>(C|0)?C:d,t)|0,d=d-C|0,k=k+4|0}while(k>>>0>>0&(d|0)>-1)}if(z0(t,48,d+18|0,18,0),e[t>>2]&32)break;B0(_,qt-_|0,t)|0}while(!1);z0(t,32,Te,G,ke^8192),d=(G|0)<(Te|0)?Te:G}else R=(_&32|0)!=0,N=D!=D|!1,w=N?0:ne,k=w+3|0,z0(t,32,Te,k,C),d=e[t>>2]|0,d&32||(B0(ce,w,t)|0,d=e[t>>2]|0),d&32||B0(N?R?56747:56751:R?56739:56743,3,t)|0,z0(t,32,Te,k,ke^8192),d=(k|0)<(Te|0)?Te:k;while(!1);Q=Ee;continue e}default:C=ke,w=k,R=0,_=56703,d=Gt}while(!1);t:do if((it|0)==64)if(C=a0,w=e[C>>2]|0,C=e[C+4>>2]|0,N=_&32,(w|0)==0&(C|0)==0)d=Gt,w=R,R=0,N=56703,it=77;else{d=Gt;do d=d+-1|0,S[d>>0]=F[56687+(w&15)>>0]|N,w=Di(w|0,C|0,4)|0,C=ye;while(!((w|0)==0&(C|0)==0));it=a0,(R&8|0)==0|(e[it>>2]|0)==0&(e[it+4>>2]|0)==0?(w=R,R=0,N=56703,it=77):(w=R,R=2,N=56703+(_>>4)|0,it=77)}else if((it|0)==76)d=zi(d,w,Gt)|0,w=ke,R=C,it=77;else if((it|0)==82)it=0,ke=Oo(d,0,k)|0,ce=(ke|0)==0,Q=d,w=ce?k:ke-d|0,R=0,_=56703,d=ce?d+k|0:ke;else if((it|0)==86){for(it=0,w=0,d=0,N=e[a0>>2]|0;C=e[N>>2]|0,!(!C||(d=Do(Ti,C)|0,(d|0)<0|d>>>0>(k-w|0)>>>0));)if(w=d+w|0,k>>>0>w>>>0)N=N+4|0;else break;if((d|0)<0){h=-1;break e}if(z0(t,32,Te,w,ke),!w)d=0,it=98;else for(C=0,k=e[a0>>2]|0;;){if(d=e[k>>2]|0,!d){d=w,it=98;break t}if(d=Do(Ti,d)|0,C=d+C|0,(C|0)>(w|0)){d=w,it=98;break t}if(e[t>>2]&32||B0(Ti,d,t)|0,C>>>0>=w>>>0){d=w,it=98;break}else k=k+4|0}}while(!1);if((it|0)==98){it=0,z0(t,32,Te,d,ke^8192),Q=Ee,d=(Te|0)>(d|0)?Te:d;continue}(it|0)==77&&(it=0,C=(k|0)>-1?w&-65537:w,w=a0,w=(e[w>>2]|0)!=0|(e[w+4>>2]|0)!=0,(k|0)!=0|w?(w=(w&1^1)+(At-d)|0,Q=d,w=(k|0)>(w|0)?k:w,_=N,d=Gt):(Q=Gt,w=0,_=N,d=Gt)),N=d-Q|0,w=(w|0)<(N|0)?N:w,k=R+w|0,d=(Te|0)<(k|0)?k:Te,z0(t,32,d,k,C),e[t>>2]&32||B0(_,R,t)|0,z0(t,48,d,k,C^65536),z0(t,48,w,N,0),e[t>>2]&32||B0(Q,N,t)|0,z0(t,32,d,k,C^8192),Q=Ee}e:do if((it|0)==245&&!t)if(r){for(h=1;r=e[c+(h<<2)>>2]|0,!!r;)if(Ps(l+(h<<3)|0,r,o),h=h+1|0,(h|0)>=10){h=1;break e}if((h|0)<10)for(;;){if(e[c+(h<<2)>>2]|0){h=-1;break e}if(h=h+1|0,(h|0)>=10){h=1;break}}else h=1}else h=0;while(!1);return b=Si,h|0}function Id(t,r,o){return t=t|0,r=r|0,o=o|0,_S(t,r,o)|0}function Ed(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0,w=0;w=b,b=b+112|0,d=w,c=d,h=c+112|0;do e[c>>2]=0,c=c+4|0;while((c|0)<(h|0));return c=d+4|0,e[c>>2]=t,h=d+8|0,e[h>>2]=-1,e[d+44>>2]=t,e[d+76>>2]=-1,oi(d,0),l=+xo(d,o,1),o=(e[c>>2]|0)-(e[h>>2]|0)+(e[d+108>>2]|0)|0,r&&(e[r>>2]=o|0?t+o|0:t),b=w,+l}function _s(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0;return C=b,b=b+112|0,w=C,e[w>>2]=0,h=w+4|0,e[h>>2]=t,e[w+44>>2]=t,d=w+8|0,e[d>>2]=(t|0)<0?-1:t+2147483647|0,e[w+76>>2]=-1,oi(w,0),l=wo(w,o,1,l,c)|0,r&&(e[r>>2]=t+((e[h>>2]|0)+(e[w+108>>2]|0)-(e[d>>2]|0))),b=C,l|0}function kd(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0;return l=t+20|0,c=e[l>>2]|0,t=(e[t+16>>2]|0)-c|0,t=t>>>0>o>>>0?o:t,o0(c|0,r|0,t|0)|0,e[l>>2]=(e[l>>2]|0)+t,o|0}function Ps(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0;e:do if(r>>>0<=20)do switch(r|0){case 9:{l=(e[o>>2]|0)+3&-4,r=e[l>>2]|0,e[o>>2]=l+4,e[t>>2]=r;break e}case 10:{l=(e[o>>2]|0)+3&-4,r=e[l>>2]|0,e[o>>2]=l+4,l=t,e[l>>2]=r,e[l+4>>2]=((r|0)<0)<<31>>31;break e}case 11:{l=(e[o>>2]|0)+3&-4,r=e[l>>2]|0,e[o>>2]=l+4,l=t,e[l>>2]=r,e[l+4>>2]=0;break e}case 12:{l=(e[o>>2]|0)+7&-8,r=l,c=e[r>>2]|0,r=e[r+4>>2]|0,e[o>>2]=l+8,l=t,e[l>>2]=c,e[l+4>>2]=r;break e}case 13:{c=(e[o>>2]|0)+3&-4,l=e[c>>2]|0,e[o>>2]=c+4,l=(l&65535)<<16>>16,c=t,e[c>>2]=l,e[c+4>>2]=((l|0)<0)<<31>>31;break e}case 14:{c=(e[o>>2]|0)+3&-4,l=e[c>>2]|0,e[o>>2]=c+4,c=t,e[c>>2]=l&65535,e[c+4>>2]=0;break e}case 15:{c=(e[o>>2]|0)+3&-4,l=e[c>>2]|0,e[o>>2]=c+4,l=(l&255)<<24>>24,c=t,e[c>>2]=l,e[c+4>>2]=((l|0)<0)<<31>>31;break e}case 16:{c=(e[o>>2]|0)+3&-4,l=e[c>>2]|0,e[o>>2]=c+4,c=t,e[c>>2]=l&255,e[c+4>>2]=0;break e}case 17:{c=(e[o>>2]|0)+7&-8,h=+B[c>>3],e[o>>2]=c+8,B[t>>3]=h;break e}case 18:{c=(e[o>>2]|0)+7&-8,h=+B[c>>3],e[o>>2]=c+8,B[t>>3]=h;break e}default:break e}while(!1);while(!1)}function zi(t,r,o){t=t|0,r=r|0,o=o|0;var l=0;if(r>>>0>0|(r|0)==0&t>>>0>4294967295)for(;;)if(l=Cr(t|0,r|0,10,0)|0,o=o+-1|0,S[o>>0]=l|48,l=xn(t|0,r|0,10,0)|0,r>>>0>9|(r|0)==9&t>>>0>4294967295)t=l,r=ye;else{t=l;break}if(t)for(;o=o+-1|0,S[o>>0]=(t>>>0)%10|0|48,!(t>>>0<10);)t=(t>>>0)/10|0;return o|0}function z0(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0;w=b,b=b+256|0,d=w;do if((o|0)>(l|0)&(c&73728|0)==0){if(c=o-l|0,Jt(d|0,r|0,(c>>>0>256?256:c)|0)|0,r=e[t>>2]|0,h=(r&32|0)==0,c>>>0>255){l=o-l|0;do h&&(B0(d,256,t)|0,r=e[t>>2]|0),c=c+-256|0,h=(r&32|0)==0;while(c>>>0>255);if(h)c=l&255;else break}else if(!h)break;B0(d,c,t)|0}while(!1);b=w}function E0(t){t=t|0;var r=0,o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0,ce=0,ke=0,Ee=0,Te=0,it=0,jt=0,Gt=0,s0=0,i0=0,zt=0,gt=0,Kt=0,dt=0;do if(t>>>0<245){if(_=t>>>0<11?16:t+11&-8,t=_>>>3,w=e[10218]|0,o=w>>>t,o&3){t=(o&1^1)+t|0,l=t<<1,o=40912+(l<<2)|0,l=40912+(l+2<<2)|0,c=e[l>>2]|0,h=c+8|0,d=e[h>>2]|0;do if((o|0)!=(d|0))if(d>>>0<(e[10222]|0)>>>0&&St(),r=d+12|0,(e[r>>2]|0)==(c|0)){e[r>>2]=o,e[l>>2]=d;break}else St();else e[10218]=w&~(1<>2]=dt|3,dt=c+(dt|4)|0,e[dt>>2]=e[dt>>2]|1,dt=h,dt|0}if(d=e[10220]|0,_>>>0>d>>>0){if(o){l=2<>>12&16,l=l>>>C,c=l>>>5&8,l=l>>>c,h=l>>>2&4,l=l>>>h,o=l>>>1&2,l=l>>>o,t=l>>>1&1,t=(c|C|h|o|t)+(l>>>t)|0,l=t<<1,o=40912+(l<<2)|0,l=40912+(l+2<<2)|0,h=e[l>>2]|0,C=h+8|0,c=e[C>>2]|0;do if((o|0)!=(c|0))if(c>>>0<(e[10222]|0)>>>0&&St(),r=c+12|0,(e[r>>2]|0)==(h|0)){e[r>>2]=o,e[l>>2]=c,D=e[10220]|0;break}else St();else e[10218]=w&~(1<>2]=_|3,w=h+_|0,e[h+(_|4)>>2]=d|1,e[h+dt>>2]=d,D&&(c=e[10223]|0,o=D>>>3,r=o<<1,l=40912+(r<<2)|0,t=e[10218]|0,o=1<>2]|0,r>>>0<(e[10222]|0)>>>0?St():(k=t,N=r)):(e[10218]=t|o,k=40912+(r+2<<2)|0,N=l),e[k>>2]=c,e[N+12>>2]=c,e[c+8>>2]=N,e[c+12>>2]=l),e[10220]=d,e[10223]=w,dt=C,dt|0}if(t=e[10219]|0,t){for(o=(t&0-t)+-1|0,Kt=o>>>12&16,o=o>>>Kt,gt=o>>>5&8,o=o>>>gt,dt=o>>>2&4,o=o>>>dt,t=o>>>1&2,o=o>>>t,l=o>>>1&1,l=e[41176+((gt|Kt|dt|t|l)+(o>>>l)<<2)>>2]|0,o=(e[l+4>>2]&-8)-_|0,t=l;;){if(r=e[t+16>>2]|0,!r&&(r=e[t+20>>2]|0,!r)){C=o;break}t=(e[r+4>>2]&-8)-_|0,dt=t>>>0>>0,o=dt?t:o,t=r,l=dt?r:l}h=e[10222]|0,l>>>0>>0&&St(),w=l+_|0,l>>>0>=w>>>0&&St(),d=e[l+24>>2]|0,o=e[l+12>>2]|0;do if((o|0)==(l|0)){if(t=l+20|0,r=e[t>>2]|0,!r&&(t=l+16|0,r=e[t>>2]|0,!r)){R=0;break}for(;;){if(o=r+20|0,c=e[o>>2]|0,c){r=c,t=o;continue}if(o=r+16|0,c=e[o>>2]|0,c)r=c,t=o;else break}if(t>>>0>>0)St();else{e[t>>2]=0,R=r;break}}else if(c=e[l+8>>2]|0,c>>>0>>0&&St(),r=c+12|0,(e[r>>2]|0)!=(l|0)&&St(),t=o+8|0,(e[t>>2]|0)==(l|0)){e[r>>2]=o,e[t>>2]=c,R=o;break}else St();while(!1);do if(d){if(r=e[l+28>>2]|0,t=41176+(r<<2)|0,(l|0)==(e[t>>2]|0)){if(e[t>>2]=R,!R){e[10219]=e[10219]&~(1<>>0<(e[10222]|0)>>>0&&St(),r=d+16|0,(e[r>>2]|0)==(l|0)?e[r>>2]=R:e[d+20>>2]=R,!R)break;t=e[10222]|0,R>>>0>>0&&St(),e[R+24>>2]=d,r=e[l+16>>2]|0;do if(r)if(r>>>0>>0)St();else{e[R+16>>2]=r,e[r+24>>2]=R;break}while(!1);if(r=e[l+20>>2]|0,r)if(r>>>0<(e[10222]|0)>>>0)St();else{e[R+20>>2]=r,e[r+24>>2]=R;break}}while(!1);return C>>>0<16?(dt=C+_|0,e[l+4>>2]=dt|3,dt=l+(dt+4)|0,e[dt>>2]=e[dt>>2]|1):(e[l+4>>2]=_|3,e[l+(_|4)>>2]=C|1,e[l+(C+_)>>2]=C,r=e[10220]|0,r&&(h=e[10223]|0,o=r>>>3,r=o<<1,c=40912+(r<<2)|0,t=e[10218]|0,o=1<>2]|0,t>>>0<(e[10222]|0)>>>0?St():(U=r,Q=t)):(e[10218]=t|o,U=40912+(r+2<<2)|0,Q=c),e[U>>2]=h,e[Q+12>>2]=h,e[h+8>>2]=Q,e[h+12>>2]=c),e[10220]=C,e[10223]=w),dt=l+8|0,dt|0}else Q=_}else Q=_}else if(t>>>0<=4294967231)if(t=t+11|0,N=t&-8,k=e[10219]|0,k){o=0-N|0,t=t>>>8,t?N>>>0>16777215?D=31:(Q=(t+1048320|0)>>>16&8,O=t<>>16&4,O=O<>>16&2,D=14-(U|Q|D)+(O<>>15)|0,D=N>>>(D+7|0)&1|D<<1):D=0,t=e[41176+(D<<2)>>2]|0;e:do if(!t)c=0,t=0,O=86;else for(d=o,c=0,w=N<<((D|0)==31?0:25-(D>>>1)|0),C=t,t=0;;){if(h=e[C+4>>2]&-8,o=h-N|0,o>>>0>>0)if((h|0)==(N|0)){h=C,t=C,O=90;break e}else t=C;else o=d;if(O=e[C+20>>2]|0,C=e[C+16+(w>>>31<<2)>>2]|0,c=(O|0)==0|(O|0)==(C|0)?c:O,C)d=o,w=w<<1;else{O=86;break}}while(!1);if((O|0)==86){if((c|0)==0&(t|0)==0){if(t=2<>>12&16,t=t>>>R,k=t>>>5&8,t=t>>>k,U=t>>>2&4,t=t>>>U,Q=t>>>1&2,t=t>>>Q,c=t>>>1&1,c=e[41176+((k|R|U|Q|c)+(t>>>c)<<2)>>2]|0,t=0}c?(h=c,O=90):(w=o,C=t)}if((O|0)==90)for(;;){if(O=0,Q=(e[h+4>>2]&-8)-N|0,c=Q>>>0>>0,o=c?Q:o,t=c?h:t,c=e[h+16>>2]|0,c){h=c,O=90;continue}if(h=e[h+20>>2]|0,h)O=90;else{w=o,C=t;break}}if(C|0&&w>>>0<((e[10220]|0)-N|0)>>>0){c=e[10222]|0,C>>>0>>0&&St(),d=C+N|0,C>>>0>=d>>>0&&St(),h=e[C+24>>2]|0,o=e[C+12>>2]|0;do if((o|0)==(C|0)){if(t=C+20|0,r=e[t>>2]|0,!r&&(t=C+16|0,r=e[t>>2]|0,!r)){_=0;break}for(;;){if(o=r+20|0,l=e[o>>2]|0,l){r=l,t=o;continue}if(o=r+16|0,l=e[o>>2]|0,l)r=l,t=o;else break}if(t>>>0>>0)St();else{e[t>>2]=0,_=r;break}}else if(l=e[C+8>>2]|0,l>>>0>>0&&St(),r=l+12|0,(e[r>>2]|0)!=(C|0)&&St(),t=o+8|0,(e[t>>2]|0)==(C|0)){e[r>>2]=o,e[t>>2]=l,_=o;break}else St();while(!1);do if(h){if(r=e[C+28>>2]|0,t=41176+(r<<2)|0,(C|0)==(e[t>>2]|0)){if(e[t>>2]=_,!_){e[10219]=e[10219]&~(1<>>0<(e[10222]|0)>>>0&&St(),r=h+16|0,(e[r>>2]|0)==(C|0)?e[r>>2]=_:e[h+20>>2]=_,!_)break;t=e[10222]|0,_>>>0>>0&&St(),e[_+24>>2]=h,r=e[C+16>>2]|0;do if(r)if(r>>>0>>0)St();else{e[_+16>>2]=r,e[r+24>>2]=_;break}while(!1);if(r=e[C+20>>2]|0,r)if(r>>>0<(e[10222]|0)>>>0)St();else{e[_+20>>2]=r,e[r+24>>2]=_;break}}while(!1);e:do if(w>>>0>=16){if(e[C+4>>2]=N|3,e[C+(N|4)>>2]=w|1,e[C+(w+N)>>2]=w,r=w>>>3,w>>>0<256){t=r<<1,l=40912+(t<<2)|0,o=e[10218]|0,r=1<>2]|0,t>>>0<(e[10222]|0)>>>0?St():(G=r,$=t)):(e[10218]=o|r,G=40912+(t+2<<2)|0,$=l),e[G>>2]=d,e[$+12>>2]=d,e[C+(N+8)>>2]=$,e[C+(N+12)>>2]=l;break}if(r=w>>>8,r?w>>>0>16777215?l=31:(Kt=(r+1048320|0)>>>16&8,dt=r<>>16&4,dt=dt<>>16&2,l=14-(gt|Kt|l)+(dt<>>15)|0,l=w>>>(l+7|0)&1|l<<1):l=0,r=41176+(l<<2)|0,e[C+(N+28)>>2]=l,e[C+(N+20)>>2]=0,e[C+(N+16)>>2]=0,t=e[10219]|0,o=1<>2]=d,e[C+(N+24)>>2]=r,e[C+(N+12)>>2]=d,e[C+(N+8)>>2]=d;break}r=e[r>>2]|0;t:do if((e[r+4>>2]&-8|0)!=(w|0)){for(l=w<<((l|0)==31?0:25-(l>>>1)|0);t=r+16+(l>>>31<<2)|0,o=e[t>>2]|0,!!o;)if((e[o+4>>2]&-8|0)==(w|0)){oe=o;break t}else l=l<<1,r=o;if(t>>>0<(e[10222]|0)>>>0)St();else{e[t>>2]=d,e[C+(N+24)>>2]=r,e[C+(N+12)>>2]=d,e[C+(N+8)>>2]=d;break e}}else oe=r;while(!1);if(r=oe+8|0,t=e[r>>2]|0,dt=e[10222]|0,t>>>0>=dt>>>0&oe>>>0>=dt>>>0){e[t+12>>2]=d,e[r>>2]=d,e[C+(N+8)>>2]=t,e[C+(N+12)>>2]=oe,e[C+(N+24)>>2]=0;break}else St()}else dt=w+N|0,e[C+4>>2]=dt|3,dt=C+(dt+4)|0,e[dt>>2]=e[dt>>2]|1;while(!1);return dt=C+8|0,dt|0}else Q=N}else Q=N;else Q=-1;while(!1);if(o=e[10220]|0,o>>>0>=Q>>>0)return r=o-Q|0,t=e[10223]|0,r>>>0>15?(e[10223]=t+Q,e[10220]=r,e[t+(Q+4)>>2]=r|1,e[t+o>>2]=r,e[t+4>>2]=Q|3):(e[10220]=0,e[10223]=0,e[t+4>>2]=o|3,dt=t+(o+4)|0,e[dt>>2]=e[dt>>2]|1),dt=t+8|0,dt|0;if(t=e[10221]|0,t>>>0>Q>>>0)return Kt=t-Q|0,e[10221]=Kt,dt=e[10224]|0,e[10224]=dt+Q,e[dt+(Q+4)>>2]=Kt|1,e[dt+4>>2]=Q|3,dt=dt+8|0,dt|0;do if(!(e[10336]|0))if(t=Wo(30)|0,t+-1&t)St();else{e[10338]=t,e[10337]=t,e[10339]=-1,e[10340]=-1,e[10341]=0,e[10329]=0,oe=(ea(0)|0)&-16^1431655768,e[10336]=oe;break}while(!1);if(C=Q+48|0,w=e[10338]|0,D=Q+47|0,d=w+D|0,w=0-w|0,k=d&w,k>>>0<=Q>>>0||(t=e[10328]|0,t|0&&($=e[10326]|0,oe=$+k|0,oe>>>0<=$>>>0|oe>>>0>t>>>0)))return dt=0,dt|0;e:do if(e[10329]&4)t=0,O=191;else{t=e[10224]|0;t:do if(t){for(c=41320;;){if(o=e[c>>2]|0,o>>>0<=t>>>0&&(K=c+4|0,(o+(e[K>>2]|0)|0)>>>0>t>>>0)){h=c,t=K;break}if(c=e[c+8>>2]|0,!c){O=174;break t}}if(o=d-(e[10221]|0)&w,o>>>0<2147483647)if(c=Mi(o|0)|0,oe=(c|0)==((e[h>>2]|0)+(e[t>>2]|0)|0),t=oe?o:0,oe){if((c|0)!=-1){Z=c,U=t,O=194;break e}}else O=184;else t=0}else O=174;while(!1);do if((O|0)==174)if(h=Mi(0)|0,(h|0)!=-1)if(t=h,o=e[10337]|0,c=o+-1|0,c&t?o=k-t+(c+t&0-o)|0:o=k,t=e[10326]|0,c=t+o|0,o>>>0>Q>>>0&o>>>0<2147483647){if(oe=e[10328]|0,oe|0&&c>>>0<=t>>>0|c>>>0>oe>>>0){t=0;break}if(c=Mi(o|0)|0,oe=(c|0)==(h|0),t=oe?o:0,oe){Z=h,U=t,O=194;break e}else O=184}else t=0;else t=0;while(!1);t:do if((O|0)==184){h=0-o|0;do if(C>>>0>o>>>0&(o>>>0<2147483647&(c|0)!=-1)&&(P=e[10338]|0,P=D-o+P&0-P,P>>>0<2147483647))if((Mi(P|0)|0)==-1){Mi(h|0)|0;break t}else{o=P+o|0;break}while(!1);if((c|0)!=-1){Z=c,U=o,O=194;break e}}while(!1);e[10329]=e[10329]|4,O=191}while(!1);if((O|0)==191&&k>>>0<2147483647&&(Z=Mi(k|0)|0,ie=Mi(0)|0,Z>>>0>>0&((Z|0)!=-1&(ie|0)!=-1))&&(ne=ie-Z|0,ce=ne>>>0>(Q+40|0)>>>0,ce)&&(U=ce?ne:t,O=194),(O|0)==194){t=(e[10326]|0)+U|0,e[10326]=t,t>>>0>(e[10327]|0)>>>0&&(e[10327]=t),d=e[10224]|0;e:do if(d){h=41320;do{if(t=e[h>>2]|0,o=h+4|0,c=e[o>>2]|0,(Z|0)==(t+c|0)){ke=t,Ee=o,Te=c,it=h,O=204;break}h=e[h+8>>2]|0}while(h|0);if((O|0)==204&&!(e[it+12>>2]&8|0)&&d>>>0>>0&d>>>0>=ke>>>0){e[Ee>>2]=Te+U,dt=(e[10221]|0)+U|0,Kt=d+8|0,Kt=Kt&7|0?0-Kt&7:0,gt=dt-Kt|0,e[10224]=d+Kt,e[10221]=gt,e[d+(Kt+4)>>2]=gt|1,e[d+(dt+4)>>2]=40,e[10225]=e[10340];break}for(t=e[10222]|0,Z>>>0>>0&&(e[10222]=Z,t=Z),o=Z+U|0,h=41320;;){if((e[h>>2]|0)==(o|0)){c=h,o=h,O=212;break}if(h=e[h+8>>2]|0,!h){o=41320;break}}if((O|0)==212)if(e[o+12>>2]&8)o=41320;else{e[c>>2]=Z,R=o+4|0,e[R>>2]=(e[R>>2]|0)+U,R=Z+8|0,R=R&7|0?0-R&7:0,D=Z+(U+8)|0,D=D&7|0?0-D&7:0,r=Z+(D+U)|0,N=R+Q|0,_=Z+N|0,k=r-(Z+R)-Q|0,e[Z+(R+4)>>2]=Q|3;t:do if((r|0)!=(d|0)){if((r|0)==(e[10223]|0)){dt=(e[10220]|0)+k|0,e[10220]=dt,e[10223]=_,e[Z+(N+4)>>2]=dt|1,e[Z+(dt+N)>>2]=dt;break}if(w=U+4|0,o=e[Z+(w+D)>>2]|0,(o&3|0)==1){C=o&-8,h=o>>>3;i:do if(o>>>0>=256){d=e[Z+((D|24)+U)>>2]|0,l=e[Z+(U+12+D)>>2]|0;do if((l|0)==(r|0)){if(c=D|16,l=Z+(w+c)|0,o=e[l>>2]|0,!o&&(l=Z+(c+U)|0,o=e[l>>2]|0,!o)){zt=0;break}for(;;){if(c=o+20|0,h=e[c>>2]|0,h){o=h,l=c;continue}if(c=o+16|0,h=e[c>>2]|0,h)o=h,l=c;else break}if(l>>>0>>0)St();else{e[l>>2]=0,zt=o;break}}else if(c=e[Z+((D|8)+U)>>2]|0,c>>>0>>0&&St(),t=c+12|0,(e[t>>2]|0)!=(r|0)&&St(),o=l+8|0,(e[o>>2]|0)==(r|0)){e[t>>2]=l,e[o>>2]=c,zt=l;break}else St();while(!1);if(!d)break;t=e[Z+(U+28+D)>>2]|0,o=41176+(t<<2)|0;do if((r|0)!=(e[o>>2]|0)){if(d>>>0<(e[10222]|0)>>>0&&St(),t=d+16|0,(e[t>>2]|0)==(r|0)?e[t>>2]=zt:e[d+20>>2]=zt,!zt)break i}else{if(e[o>>2]=zt,zt)break;e[10219]=e[10219]&~(1<>>0>>0&&St(),e[zt+24>>2]=d,r=D|16,t=e[Z+(r+U)>>2]|0;do if(t)if(t>>>0>>0)St();else{e[zt+16>>2]=t,e[t+24>>2]=zt;break}while(!1);if(r=e[Z+(w+r)>>2]|0,!r)break;if(r>>>0<(e[10222]|0)>>>0)St();else{e[zt+20>>2]=r,e[r+24>>2]=zt;break}}else{l=e[Z+((D|8)+U)>>2]|0,c=e[Z+(U+12+D)>>2]|0,o=40912+(h<<1<<2)|0;do if((l|0)!=(o|0)){if(l>>>0>>0&&St(),(e[l+12>>2]|0)==(r|0))break;St()}while(!1);if((c|0)==(l|0)){e[10218]=e[10218]&~(1<>>0>>0&&St(),t=c+8|0,(e[t>>2]|0)==(r|0)){jt=t;break}St()}while(!1);e[l+12>>2]=c,e[jt>>2]=l}while(!1);r=Z+((C|D)+U)|0,c=C+k|0}else c=k;if(r=r+4|0,e[r>>2]=e[r>>2]&-2,e[Z+(N+4)>>2]=c|1,e[Z+(c+N)>>2]=c,r=c>>>3,c>>>0<256){t=r<<1,l=40912+(t<<2)|0,o=e[10218]|0,r=1<>2]|0,t>>>0>=(e[10222]|0)>>>0){gt=r,Kt=t;break}St()}while(!1);e[gt>>2]=_,e[Kt+12>>2]=_,e[Z+(N+8)>>2]=Kt,e[Z+(N+12)>>2]=l;break}r=c>>>8;do if(!r)l=0;else{if(c>>>0>16777215){l=31;break}gt=(r+1048320|0)>>>16&8,Kt=r<>>16&4,Kt=Kt<>>16&2,l=14-(zt|gt|l)+(Kt<>>15)|0,l=c>>>(l+7|0)&1|l<<1}while(!1);if(r=41176+(l<<2)|0,e[Z+(N+28)>>2]=l,e[Z+(N+20)>>2]=0,e[Z+(N+16)>>2]=0,t=e[10219]|0,o=1<>2]=_,e[Z+(N+24)>>2]=r,e[Z+(N+12)>>2]=_,e[Z+(N+8)>>2]=_;break}r=e[r>>2]|0;i:do if((e[r+4>>2]&-8|0)!=(c|0)){for(l=c<<((l|0)==31?0:25-(l>>>1)|0);t=r+16+(l>>>31<<2)|0,o=e[t>>2]|0,!!o;)if((e[o+4>>2]&-8|0)==(c|0)){dt=o;break i}else l=l<<1,r=o;if(t>>>0<(e[10222]|0)>>>0)St();else{e[t>>2]=_,e[Z+(N+24)>>2]=r,e[Z+(N+12)>>2]=_,e[Z+(N+8)>>2]=_;break t}}else dt=r;while(!1);if(r=dt+8|0,t=e[r>>2]|0,Kt=e[10222]|0,t>>>0>=Kt>>>0&dt>>>0>=Kt>>>0){e[t+12>>2]=_,e[r>>2]=_,e[Z+(N+8)>>2]=t,e[Z+(N+12)>>2]=dt,e[Z+(N+24)>>2]=0;break}else St()}else dt=(e[10221]|0)+k|0,e[10221]=dt,e[10224]=_,e[Z+(N+4)>>2]=dt|1;while(!1);return dt=Z+(R|8)|0,dt|0}for(;t=e[o>>2]|0,!(t>>>0<=d>>>0&&(r=e[o+4>>2]|0,l=t+r|0,l>>>0>d>>>0));)o=e[o+8>>2]|0;if(c=t+(r+-39)|0,t=t+(r+-47+(c&7|0?0-c&7:0))|0,c=d+16|0,t=t>>>0>>0?d:t,r=t+8|0,o=Z+8|0,o=o&7|0?0-o&7:0,dt=U+-40-o|0,e[10224]=Z+o,e[10221]=dt,e[Z+(o+4)>>2]=dt|1,e[Z+(U+-36)>>2]=40,e[10225]=e[10340],o=t+4|0,e[o>>2]=27,e[r>>2]=e[10330],e[r+4>>2]=e[10331],e[r+8>>2]=e[10332],e[r+12>>2]=e[10333],e[10330]=Z,e[10331]=U,e[10333]=0,e[10332]=r,r=t+28|0,e[r>>2]=7,(t+32|0)>>>0>>0)do dt=r,r=r+4|0,e[r>>2]=7;while((dt+8|0)>>>0>>0);if((t|0)!=(d|0)){if(h=t-d|0,e[o>>2]=e[o>>2]&-2,e[d+4>>2]=h|1,e[t>>2]=h,r=h>>>3,h>>>0<256){t=r<<1,l=40912+(t<<2)|0,o=e[10218]|0,r=1<>2]|0,t>>>0<(e[10222]|0)>>>0?St():(Gt=r,s0=t)):(e[10218]=o|r,Gt=40912+(t+2<<2)|0,s0=l),e[Gt>>2]=d,e[s0+12>>2]=d,e[d+8>>2]=s0,e[d+12>>2]=l;break}if(r=h>>>8,r?h>>>0>16777215?l=31:(Kt=(r+1048320|0)>>>16&8,dt=r<>>16&4,dt=dt<>>16&2,l=14-(gt|Kt|l)+(dt<>>15)|0,l=h>>>(l+7|0)&1|l<<1):l=0,o=41176+(l<<2)|0,e[d+28>>2]=l,e[d+20>>2]=0,e[c>>2]=0,r=e[10219]|0,t=1<>2]=d,e[d+24>>2]=o,e[d+12>>2]=d,e[d+8>>2]=d;break}r=e[o>>2]|0;t:do if((e[r+4>>2]&-8|0)!=(h|0)){for(l=h<<((l|0)==31?0:25-(l>>>1)|0);t=r+16+(l>>>31<<2)|0,o=e[t>>2]|0,!!o;)if((e[o+4>>2]&-8|0)==(h|0)){i0=o;break t}else l=l<<1,r=o;if(t>>>0<(e[10222]|0)>>>0)St();else{e[t>>2]=d,e[d+24>>2]=r,e[d+12>>2]=d,e[d+8>>2]=d;break e}}else i0=r;while(!1);if(r=i0+8|0,t=e[r>>2]|0,dt=e[10222]|0,t>>>0>=dt>>>0&i0>>>0>=dt>>>0){e[t+12>>2]=d,e[r>>2]=d,e[d+8>>2]=t,e[d+12>>2]=i0,e[d+24>>2]=0;break}else St()}}else{dt=e[10222]|0,(dt|0)==0|Z>>>0
>>0&&(e[10222]=Z),e[10330]=Z,e[10331]=U,e[10333]=0,e[10227]=e[10336],e[10226]=-1,r=0;do dt=r<<1,Kt=40912+(dt<<2)|0,e[40912+(dt+3<<2)>>2]=Kt,e[40912+(dt+2<<2)>>2]=Kt,r=r+1|0;while((r|0)!=32);dt=Z+8|0,dt=dt&7|0?0-dt&7:0,Kt=U+-40-dt|0,e[10224]=Z+dt,e[10221]=Kt,e[Z+(dt+4)>>2]=Kt|1,e[Z+(U+-36)>>2]=40,e[10225]=e[10340]}while(!1);if(r=e[10221]|0,r>>>0>Q>>>0)return Kt=r-Q|0,e[10221]=Kt,dt=e[10224]|0,e[10224]=dt+Q,e[dt+(Q+4)>>2]=Kt|1,e[dt+4>>2]=Q|3,dt=dt+8|0,dt|0}return dt=S0()|0,e[dt>>2]=12,dt=0,dt|0}function n0(t){t=t|0;var r=0,o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0,G=0,$=0,P=0;if(t){r=t+-8|0,w=e[10222]|0,r>>>0>>0&&St(),o=e[t+-4>>2]|0,l=o&3,(l|0)==1&&St(),_=o&-8,Q=t+(_+-8)|0;do if(o&1)P=r,h=_;else{if(r=e[r>>2]|0,!l)return;if(C=-8-r|0,k=t+C|0,N=r+_|0,k>>>0>>0&&St(),(k|0)==(e[10223]|0)){if(r=t+(_+-4)|0,o=e[r>>2]|0,(o&3|0)!=3){P=k,h=N;break}e[10220]=N,e[r>>2]=o&-2,e[t+(C+4)>>2]=N|1,e[Q>>2]=N;return}if(c=r>>>3,r>>>0<256){if(l=e[t+(C+8)>>2]|0,o=e[t+(C+12)>>2]|0,r=40912+(c<<1<<2)|0,(l|0)!=(r|0)&&(l>>>0>>0&&St(),(e[l+12>>2]|0)!=(k|0)&&St()),(o|0)==(l|0)){e[10218]=e[10218]&~(1<>>0>>0&&St(),r=o+8|0,(e[r>>2]|0)==(k|0)?d=r:St()):d=o+8|0,e[l+12>>2]=o,e[d>>2]=l,P=k,h=N;break}d=e[t+(C+24)>>2]|0,l=e[t+(C+12)>>2]|0;do if((l|0)==(k|0)){if(o=t+(C+20)|0,r=e[o>>2]|0,!r&&(o=t+(C+16)|0,r=e[o>>2]|0,!r)){D=0;break}for(;;){if(l=r+20|0,c=e[l>>2]|0,c){r=c,o=l;continue}if(l=r+16|0,c=e[l>>2]|0,c)r=c,o=l;else break}if(o>>>0>>0)St();else{e[o>>2]=0,D=r;break}}else if(c=e[t+(C+8)>>2]|0,c>>>0>>0&&St(),r=c+12|0,(e[r>>2]|0)!=(k|0)&&St(),o=l+8|0,(e[o>>2]|0)==(k|0)){e[r>>2]=l,e[o>>2]=c,D=l;break}else St();while(!1);if(d){if(r=e[t+(C+28)>>2]|0,o=41176+(r<<2)|0,(k|0)==(e[o>>2]|0)){if(e[o>>2]=D,!D){e[10219]=e[10219]&~(1<>>0<(e[10222]|0)>>>0&&St(),r=d+16|0,(e[r>>2]|0)==(k|0)?e[r>>2]=D:e[d+20>>2]=D,!D){P=k,h=N;break}o=e[10222]|0,D>>>0>>0&&St(),e[D+24>>2]=d,r=e[t+(C+16)>>2]|0;do if(r)if(r>>>0>>0)St();else{e[D+16>>2]=r,e[r+24>>2]=D;break}while(!1);if(r=e[t+(C+20)>>2]|0,r)if(r>>>0<(e[10222]|0)>>>0)St();else{e[D+20>>2]=r,e[r+24>>2]=D,P=k,h=N;break}else P=k,h=N}else P=k,h=N}while(!1);if(P>>>0>=Q>>>0&&St(),r=t+(_+-4)|0,o=e[r>>2]|0,o&1||St(),o&2)e[r>>2]=o&-2,e[P+4>>2]=h|1,e[P+h>>2]=h;else{if((Q|0)==(e[10224]|0)){if($=(e[10221]|0)+h|0,e[10221]=$,e[10224]=P,e[P+4>>2]=$|1,(P|0)!=(e[10223]|0))return;e[10223]=0,e[10220]=0;return}if((Q|0)==(e[10223]|0)){$=(e[10220]|0)+h|0,e[10220]=$,e[10223]=P,e[P+4>>2]=$|1,e[P+$>>2]=$;return}h=(o&-8)+h|0,c=o>>>3;do if(o>>>0>=256){d=e[t+(_+16)>>2]|0,r=e[t+(_|4)>>2]|0;do if((r|0)==(Q|0)){if(o=t+(_+12)|0,r=e[o>>2]|0,!r&&(o=t+(_+8)|0,r=e[o>>2]|0,!r)){U=0;break}for(;;){if(l=r+20|0,c=e[l>>2]|0,c){r=c,o=l;continue}if(l=r+16|0,c=e[l>>2]|0,c)r=c,o=l;else break}if(o>>>0<(e[10222]|0)>>>0)St();else{e[o>>2]=0,U=r;break}}else if(o=e[t+_>>2]|0,o>>>0<(e[10222]|0)>>>0&&St(),l=o+12|0,(e[l>>2]|0)!=(Q|0)&&St(),c=r+8|0,(e[c>>2]|0)==(Q|0)){e[l>>2]=r,e[c>>2]=o,U=r;break}else St();while(!1);if(d){if(r=e[t+(_+20)>>2]|0,o=41176+(r<<2)|0,(Q|0)==(e[o>>2]|0)){if(e[o>>2]=U,!U){e[10219]=e[10219]&~(1<>>0<(e[10222]|0)>>>0&&St(),r=d+16|0,(e[r>>2]|0)==(Q|0)?e[r>>2]=U:e[d+20>>2]=U,!U)break;o=e[10222]|0,U>>>0>>0&&St(),e[U+24>>2]=d,r=e[t+(_+8)>>2]|0;do if(r)if(r>>>0>>0)St();else{e[U+16>>2]=r,e[r+24>>2]=U;break}while(!1);if(r=e[t+(_+12)>>2]|0,r)if(r>>>0<(e[10222]|0)>>>0)St();else{e[U+20>>2]=r,e[r+24>>2]=U;break}}}else{if(l=e[t+_>>2]|0,o=e[t+(_|4)>>2]|0,r=40912+(c<<1<<2)|0,(l|0)!=(r|0)&&(l>>>0<(e[10222]|0)>>>0&&St(),(e[l+12>>2]|0)!=(Q|0)&&St()),(o|0)==(l|0)){e[10218]=e[10218]&~(1<>>0<(e[10222]|0)>>>0&&St(),r=o+8|0,(e[r>>2]|0)==(Q|0)?R=r:St()):R=o+8|0,e[l+12>>2]=o,e[R>>2]=l}while(!1);if(e[P+4>>2]=h|1,e[P+h>>2]=h,(P|0)==(e[10223]|0)){e[10220]=h;return}}if(r=h>>>3,h>>>0<256){o=r<<1,c=40912+(o<<2)|0,l=e[10218]|0,r=1<>2]|0,o>>>0<(e[10222]|0)>>>0?St():(K=r,G=o)):(e[10218]=l|r,K=40912+(o+2<<2)|0,G=c),e[K>>2]=P,e[G+12>>2]=P,e[P+8>>2]=G,e[P+12>>2]=c;return}r=h>>>8,r?h>>>0>16777215?c=31:(K=(r+1048320|0)>>>16&8,G=r<>>16&4,G=G<>>16&2,c=14-(Q|K|c)+(G<>>15)|0,c=h>>>(c+7|0)&1|c<<1):c=0,r=41176+(c<<2)|0,e[P+28>>2]=c,e[P+20>>2]=0,e[P+16>>2]=0,o=e[10219]|0,l=1<>2]|0;t:do if((e[r+4>>2]&-8|0)!=(h|0)){for(c=h<<((c|0)==31?0:25-(c>>>1)|0);o=r+16+(c>>>31<<2)|0,l=e[o>>2]|0,!!l;)if((e[l+4>>2]&-8|0)==(h|0)){$=l;break t}else c=c<<1,r=l;if(o>>>0<(e[10222]|0)>>>0)St();else{e[o>>2]=P,e[P+24>>2]=r,e[P+12>>2]=P,e[P+8>>2]=P;break e}}else $=r;while(!1);if(r=$+8|0,o=e[r>>2]|0,G=e[10222]|0,o>>>0>=G>>>0&$>>>0>=G>>>0){e[o+12>>2]=P,e[r>>2]=P,e[P+8>>2]=o,e[P+12>>2]=$,e[P+24>>2]=0;break}else St()}else e[10219]=o|l,e[r>>2]=P,e[P+24>>2]=r,e[P+12>>2]=P,e[P+8>>2]=P;while(!1);if(P=(e[10226]|0)+-1|0,e[10226]=P,!P)r=41328;else return;for(;r=e[r>>2]|0,r;)r=r+8|0;e[10226]=-1}}function Dd(t,r){t=t|0,r=r|0;var o=0;return t?(o=ee(r,t)|0,(r|t)>>>0>65535&&(o=((o>>>0)/(t>>>0)|0|0)==(r|0)?o:-1)):o=0,r=E0(o)|0,!r||!(e[r+-4>>2]&3)||Jt(r|0,0,o|0)|0,r|0}function Gi(t,r){t=t|0,r=r|0;var o=0,l=0;return t?r>>>0>4294967231?(t=S0()|0,e[t>>2]=12,t=0,t|0):(o=bd(t+-8|0,r>>>0<11?16:r+11&-8)|0,o?(t=o+8|0,t|0):(o=E0(r)|0,o?(l=e[t+-4>>2]|0,l=(l&-8)-(l&3|0?4:8)|0,o0(o|0,t|0,(l>>>0>>0?l:r)|0)|0,n0(t),t=o,t|0):(t=0,t|0))):(t=E0(r)|0,t|0)}function bd(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0;if(_=t+4|0,U=e[_>>2]|0,C=U&-8,k=t+C|0,w=e[10222]|0,o=U&3,(o|0)!=1&t>>>0>=w>>>0&t>>>0>>0||St(),l=t+(C|4)|0,c=e[l>>2]|0,c&1||St(),!o)return r>>>0<256?(t=0,t|0):(C>>>0>=(r+4|0)>>>0&&(C-r|0)>>>0<=e[10338]<<1>>>0||(t=0),t|0);if(C>>>0>=r>>>0)return o=C-r|0,o>>>0<=15||(e[_>>2]=U&1|r|2,e[t+(r+4)>>2]=o|3,e[l>>2]=e[l>>2]|1,Ls(t+r|0,o)),t|0;if((k|0)==(e[10224]|0))return o=(e[10221]|0)+C|0,o>>>0<=r>>>0?(t=0,t|0):(R=o-r|0,e[_>>2]=U&1|r|2,e[t+(r+4)>>2]=R|1,e[10224]=t+r,e[10221]=R,t|0);if((k|0)==(e[10223]|0))return l=(e[10220]|0)+C|0,l>>>0>>0?(t=0,t|0):(o=l-r|0,o>>>0>15?(e[_>>2]=U&1|r|2,e[t+(r+4)>>2]=o|1,e[t+l>>2]=o,l=t+(l+4)|0,e[l>>2]=e[l>>2]&-2,l=t+r|0):(e[_>>2]=U&1|l|2,l=t+(l+4)|0,e[l>>2]=e[l>>2]|1,l=0,o=0),e[10220]=o,e[10223]=l,t|0);if(c&2||(N=(c&-8)+C|0,N>>>0>>0))return t=0,t|0;R=N-r|0,h=c>>>3;do if(c>>>0>=256){d=e[t+(C+24)>>2]|0,h=e[t+(C+12)>>2]|0;do if((h|0)==(k|0)){if(l=t+(C+20)|0,o=e[l>>2]|0,!o&&(l=t+(C+16)|0,o=e[l>>2]|0,!o)){D=0;break}for(;;){if(c=o+20|0,h=e[c>>2]|0,h){o=h,l=c;continue}if(c=o+16|0,h=e[c>>2]|0,h)o=h,l=c;else break}if(l>>>0>>0)St();else{e[l>>2]=0,D=o;break}}else if(c=e[t+(C+8)>>2]|0,c>>>0>>0&&St(),o=c+12|0,(e[o>>2]|0)!=(k|0)&&St(),l=h+8|0,(e[l>>2]|0)==(k|0)){e[o>>2]=h,e[l>>2]=c,D=h;break}else St();while(!1);if(d){if(o=e[t+(C+28)>>2]|0,l=41176+(o<<2)|0,(k|0)==(e[l>>2]|0)){if(e[l>>2]=D,!D){e[10219]=e[10219]&~(1<>>0<(e[10222]|0)>>>0&&St(),o=d+16|0,(e[o>>2]|0)==(k|0)?e[o>>2]=D:e[d+20>>2]=D,!D)break;l=e[10222]|0,D>>>0>>0&&St(),e[D+24>>2]=d,o=e[t+(C+16)>>2]|0;do if(o)if(o>>>0>>0)St();else{e[D+16>>2]=o,e[o+24>>2]=D;break}while(!1);if(o=e[t+(C+20)>>2]|0,o)if(o>>>0<(e[10222]|0)>>>0)St();else{e[D+20>>2]=o,e[o+24>>2]=D;break}}}else{if(c=e[t+(C+8)>>2]|0,l=e[t+(C+12)>>2]|0,o=40912+(h<<1<<2)|0,(c|0)!=(o|0)&&(c>>>0>>0&&St(),(e[c+12>>2]|0)!=(k|0)&&St()),(l|0)==(c|0)){e[10218]=e[10218]&~(1<>>0>>0&&St(),o=l+8|0,(e[o>>2]|0)==(k|0)?d=o:St()):d=l+8|0,e[c+12>>2]=l,e[d>>2]=c}while(!1);return R>>>0<16?(e[_>>2]=N|U&1|2,r=t+(N|4)|0,e[r>>2]=e[r>>2]|1,t|0):(e[_>>2]=U&1|r|2,e[t+(r+4)>>2]=R|3,U=t+(N|4)|0,e[U>>2]=e[U>>2]|1,Ls(t+r|0,R),t|0)}function Ls(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0,G=0,$=0;Q=t+r|0,o=e[t+4>>2]|0;do if(o&1)$=t,d=r;else{if(D=e[t>>2]|0,!(o&3))return;if(R=t+(0-D)|0,N=D+r|0,C=e[10222]|0,R>>>0>>0&&St(),(R|0)==(e[10223]|0)){if(l=t+(r+4)|0,o=e[l>>2]|0,(o&3|0)!=3){$=R,d=N;break}e[10220]=N,e[l>>2]=o&-2,e[t+(4-D)>>2]=N|1,e[Q>>2]=N;return}if(h=D>>>3,D>>>0<256){if(c=e[t+(8-D)>>2]|0,l=e[t+(12-D)>>2]|0,o=40912+(h<<1<<2)|0,(c|0)!=(o|0)&&(c>>>0>>0&&St(),(e[c+12>>2]|0)!=(R|0)&&St()),(l|0)==(c|0)){e[10218]=e[10218]&~(1<>>0>>0&&St(),o=l+8|0,(e[o>>2]|0)==(R|0)?w=o:St()):w=l+8|0,e[c+12>>2]=l,e[w>>2]=c,$=R,d=N;break}w=e[t+(24-D)>>2]|0,c=e[t+(12-D)>>2]|0;do if((c|0)==(R|0)){if(c=16-D|0,l=t+(c+4)|0,o=e[l>>2]|0,!o&&(l=t+c|0,o=e[l>>2]|0,!o)){k=0;break}for(;;){if(c=o+20|0,h=e[c>>2]|0,h){o=h,l=c;continue}if(c=o+16|0,h=e[c>>2]|0,h)o=h,l=c;else break}if(l>>>0>>0)St();else{e[l>>2]=0,k=o;break}}else if(h=e[t+(8-D)>>2]|0,h>>>0>>0&&St(),o=h+12|0,(e[o>>2]|0)!=(R|0)&&St(),l=c+8|0,(e[l>>2]|0)==(R|0)){e[o>>2]=c,e[l>>2]=h,k=c;break}else St();while(!1);if(w){if(o=e[t+(28-D)>>2]|0,l=41176+(o<<2)|0,(R|0)==(e[l>>2]|0)){if(e[l>>2]=k,!k){e[10219]=e[10219]&~(1<>>0<(e[10222]|0)>>>0&&St(),o=w+16|0,(e[o>>2]|0)==(R|0)?e[o>>2]=k:e[w+20>>2]=k,!k){$=R,d=N;break}c=e[10222]|0,k>>>0>>0&&St(),e[k+24>>2]=w,o=16-D|0,l=e[t+o>>2]|0;do if(l)if(l>>>0>>0)St();else{e[k+16>>2]=l,e[l+24>>2]=k;break}while(!1);if(o=e[t+(o+4)>>2]|0,o)if(o>>>0<(e[10222]|0)>>>0)St();else{e[k+20>>2]=o,e[o+24>>2]=k,$=R,d=N;break}else $=R,d=N}else $=R,d=N}while(!1);if(C=e[10222]|0,Q>>>0>>0&&St(),o=t+(r+4)|0,l=e[o>>2]|0,l&2)e[o>>2]=l&-2,e[$+4>>2]=d|1,e[$+d>>2]=d;else{if((Q|0)==(e[10224]|0)){if(G=(e[10221]|0)+d|0,e[10221]=G,e[10224]=$,e[$+4>>2]=G|1,($|0)!=(e[10223]|0))return;e[10223]=0,e[10220]=0;return}if((Q|0)==(e[10223]|0)){G=(e[10220]|0)+d|0,e[10220]=G,e[10223]=$,e[$+4>>2]=G|1,e[$+G>>2]=G;return}d=(l&-8)+d|0,h=l>>>3;do if(l>>>0>=256){w=e[t+(r+24)>>2]|0,c=e[t+(r+12)>>2]|0;do if((c|0)==(Q|0)){if(l=t+(r+20)|0,o=e[l>>2]|0,!o&&(l=t+(r+16)|0,o=e[l>>2]|0,!o)){U=0;break}for(;;){if(c=o+20|0,h=e[c>>2]|0,h){o=h,l=c;continue}if(c=o+16|0,h=e[c>>2]|0,h)o=h,l=c;else break}if(l>>>0>>0)St();else{e[l>>2]=0,U=o;break}}else if(h=e[t+(r+8)>>2]|0,h>>>0>>0&&St(),o=h+12|0,(e[o>>2]|0)!=(Q|0)&&St(),l=c+8|0,(e[l>>2]|0)==(Q|0)){e[o>>2]=c,e[l>>2]=h,U=c;break}else St();while(!1);if(w){if(o=e[t+(r+28)>>2]|0,l=41176+(o<<2)|0,(Q|0)==(e[l>>2]|0)){if(e[l>>2]=U,!U){e[10219]=e[10219]&~(1<>>0<(e[10222]|0)>>>0&&St(),o=w+16|0,(e[o>>2]|0)==(Q|0)?e[o>>2]=U:e[w+20>>2]=U,!U)break;l=e[10222]|0,U>>>0>>0&&St(),e[U+24>>2]=w,o=e[t+(r+16)>>2]|0;do if(o)if(o>>>0>>0)St();else{e[U+16>>2]=o,e[o+24>>2]=U;break}while(!1);if(o=e[t+(r+20)>>2]|0,o)if(o>>>0<(e[10222]|0)>>>0)St();else{e[U+20>>2]=o,e[o+24>>2]=U;break}}}else{if(c=e[t+(r+8)>>2]|0,l=e[t+(r+12)>>2]|0,o=40912+(h<<1<<2)|0,(c|0)!=(o|0)&&(c>>>0>>0&&St(),(e[c+12>>2]|0)!=(Q|0)&&St()),(l|0)==(c|0)){e[10218]=e[10218]&~(1<>>0>>0&&St(),o=l+8|0,(e[o>>2]|0)==(Q|0)?_=o:St()):_=l+8|0,e[c+12>>2]=l,e[_>>2]=c}while(!1);if(e[$+4>>2]=d|1,e[$+d>>2]=d,($|0)==(e[10223]|0)){e[10220]=d;return}}if(o=d>>>3,d>>>0<256){l=o<<1,h=40912+(l<<2)|0,c=e[10218]|0,o=1<>2]|0,l>>>0<(e[10222]|0)>>>0?St():(K=o,G=l)):(e[10218]=c|o,K=40912+(l+2<<2)|0,G=h),e[K>>2]=$,e[G+12>>2]=$,e[$+8>>2]=G,e[$+12>>2]=h;return}if(o=d>>>8,o?d>>>0>16777215?h=31:(K=(o+1048320|0)>>>16&8,G=o<>>16&4,G=G<>>16&2,h=14-(Q|K|h)+(G<>>15)|0,h=d>>>(h+7|0)&1|h<<1):h=0,o=41176+(h<<2)|0,e[$+28>>2]=h,e[$+20>>2]=0,e[$+16>>2]=0,l=e[10219]|0,c=1<>2]=$,e[$+24>>2]=o,e[$+12>>2]=$,e[$+8>>2]=$;return}o=e[o>>2]|0;e:do if((e[o+4>>2]&-8|0)!=(d|0)){for(h=d<<((h|0)==31?0:25-(h>>>1)|0);l=o+16+(h>>>31<<2)|0,c=e[l>>2]|0,!!c;)if((e[c+4>>2]&-8|0)==(d|0)){o=c;break e}else h=h<<1,o=c;l>>>0<(e[10222]|0)>>>0&&St(),e[l>>2]=$,e[$+24>>2]=o,e[$+12>>2]=$,e[$+8>>2]=$;return}while(!1);l=o+8|0,c=e[l>>2]|0,G=e[10222]|0,c>>>0>=G>>>0&o>>>0>=G>>>0||St(),e[c+12>>2]=$,e[l>>2]=$,e[$+8>>2]=c,e[$+12>>2]=o,e[$+24>>2]=0}function Nd(t){t=t|0;var r=0,o=0,l=0,c=0,h=0,d=0;if(l=e[9321]|0,_d(42048,l,42104),e[10342]=42892,e[10344]=42912,e[10343]=0,t=e[10720]|0,g=0,Ae(62,41368+t|0,42048),h=g,g=0,h&1&&(h=j()|0,tt(41376),le(h|0)),e[41368+(t+72)>>2]=0,e[41368+(t+76)>>2]=-1,c=e[9322]|0,Os(42152,c,42112),e[10364]=42972,e[10365]=42992,o=e[10740]|0,g=0,Ae(62,41456+o|0,42152),h=g,g=0,h&1&&(h=j()|0,tt(41460),le(h|0)),t=o+72|0,e[41456+t>>2]=0,r=o+76|0,e[41456+r>>2]=-1,h=e[9320]|0,Os(42200,h,42120),e[10385]=42972,e[10386]=42992,g=0,Ae(62,41540+o|0,42200),d=g,g=0,d&1&&(d=j()|0,tt(41544),le(d|0)),e[41540+t>>2]=0,e[41540+r>>2]=-1,d=e[41540+((e[(e[10385]|0)+-12>>2]|0)+24)>>2]|0,e[10406]=42972,e[10407]=42992,g=0,Ae(62,41624+o|0,d|0),d=g,g=0,d&1&&(d=j()|0,tt(41628),le(d|0)),e[41624+t>>2]=0,e[41624+r>>2]=-1,e[41368+((e[(e[10342]|0)+-12>>2]|0)+72)>>2]=41456,t=41540+((e[(e[10385]|0)+-12>>2]|0)+4)|0,e[t>>2]=e[t>>2]|8192,e[41540+((e[(e[10385]|0)+-12>>2]|0)+72)>>2]=41456,Pd(42248,l,42128),e[10427]=42932,e[10429]=42952,e[10428]=0,t=e[10730]|0,g=0,Ae(62,41708+t|0,42248),d=g,g=0,d&1&&(d=j()|0,mn(41716),le(d|0)),e[41708+(t+72)>>2]=0,e[41708+(t+76)>>2]=-1,$s(42304,c,42136),e[10449]=43012,e[10450]=43032,o=e[10750]|0,g=0,Ae(62,41796+o|0,42304),d=g,g=0,d&1&&(d=j()|0,mn(41800),le(d|0)),t=o+72|0,e[41796+t>>2]=0,r=o+76|0,e[41796+r>>2]=-1,$s(42352,h,42144),e[10470]=43012,e[10471]=43032,g=0,Ae(62,41880+o|0,42352),d=g,g=0,d&1&&(d=j()|0,mn(41884),le(d|0)),e[41880+t>>2]=0,e[41880+r>>2]=-1,d=e[41880+((e[(e[10470]|0)+-12>>2]|0)+24)>>2]|0,e[10491]=43012,e[10492]=43032,g=0,Ae(62,41964+o|0,d|0),d=g,g=0,d&1)d=j()|0,mn(41968),le(d|0);else{e[41964+t>>2]=0,e[41964+r>>2]=-1,e[41708+((e[(e[10427]|0)+-12>>2]|0)+72)>>2]=41796,d=41880+((e[(e[10470]|0)+-12>>2]|0)+4)|0,e[d>>2]=e[d>>2]|8192,e[41880+((e[(e[10470]|0)+-12>>2]|0)+72)>>2]=41796;return}}function Fd(t){t=t|0,g=0,ge(70,41456)|0,t=g,g=0,!(!(t&1)&&(g=0,ge(70,41624)|0,t=g,g=0,!(t&1))&&(g=0,ge(71,41796)|0,t=g,g=0,!(t&1))&&(g=0,ge(71,41964)|0,t=g,g=0,!(t&1)))&&(t=j(0)|0,$t(t))}function Rd(){Nd(0),Ft(187,56757,H|0)|0}function Md(){}function _d(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0;if(c=b,b=b+16|0,h=c+4|0,l=c,Sr(t),e[t>>2]=42600,e[t+32>>2]=r,e[t+40>>2]=o,e[t+48>>2]=-1,S[t+52>>0]=0,tn(h,t+4|0),e[l>>2]=e[h>>2],g=0,Ae(23,t|0,l|0),o=g,g=0,o&1)h=j()|0,_0(l),wt(t),le(h|0);else{_0(l),b=c;return}}function Os(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0;if(c=b,b=b+16|0,h=c+4|0,l=c,Sr(t),e[t>>2]=42536,e[t+32>>2]=r,tn(h,t+4|0),e[l>>2]=e[h>>2],g=0,r=be(37,l|0,44280)|0,h=g,g=0,h&1)h=j()|0,_0(l),wt(t),le(h|0);else{_0(l),e[t+36>>2]=r,e[t+40>>2]=o,h=(Dt[e[(e[r>>2]|0)+28>>2]&127](r)|0)&1,S[t+44>>0]=h,b=c;return}}function Pd(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0;if(c=b,b=b+16|0,h=c+4|0,l=c,Hs(t),e[t>>2]=42472,e[t+32>>2]=r,e[t+40>>2]=o,e[t+48>>2]=-1,S[t+52>>0]=0,tn(h,t+4|0),e[l>>2]=e[h>>2],g=0,Ae(21,t|0,l|0),o=g,g=0,o&1)h=j()|0,_0(l),rn(t),le(h|0);else{_0(l),b=c;return}}function $s(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0;if(c=b,b=b+16|0,h=c+4|0,l=c,Hs(t),e[t>>2]=42408,e[t+32>>2]=r,tn(h,t+4|0),e[l>>2]=e[h>>2],g=0,r=be(37,l|0,44288)|0,h=g,g=0,h&1)h=j()|0,_0(l),rn(t),le(h|0);else{_0(l),e[t+36>>2]=r,e[t+40>>2]=o,h=(Dt[e[(e[r>>2]|0)+28>>2]&127](r)|0)&1,S[t+44>>0]=h,b=c;return}}function Ld(t){t=t|0,rn(t),he(t)}function Od(t,r){t=t|0,r=r|0,Dt[e[(e[t>>2]|0)+24>>2]&127](t)|0,r=O0(r,44288)|0,e[t+36>>2]=r,r=(Dt[e[(e[r>>2]|0)+28>>2]&127](r)|0)&1,S[t+44>>0]=r}function $d(t){t=t|0;var r=0,o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0;D=b,b=b+16|0,w=D+8|0,d=D,o=t+36|0,l=t+40|0,c=w+8|0,h=w,r=t+32|0;e:for(;;){if(t=e[o>>2]|0,t=an[e[(e[t>>2]|0)+20>>2]&31](t,e[l>>2]|0,w,c,d)|0,k=(e[d>>2]|0)-h|0,(gi(w,1,k,e[r>>2]|0)|0)!=(k|0)){t=-1;break}switch(t|0){case 1:break;case 2:{t=-1;break e}default:{C=4;break e}}}return(C|0)==4&&(t=((Nr(e[r>>2]|0)|0)!=0)<<31>>31),b=D,t|0}function Bd(t,r,o){t=t|0,r=r|0,o=o|0;var l=0;e:do if(S[t+44>>0]|0)r=gi(r,4,o,e[t+32>>2]|0)|0;else if((o|0)>0)for(l=r,r=0;;){if((U0[e[(e[t>>2]|0)+52>>2]&63](t,e[l>>2]|0)|0)==-1)break e;if(r=r+1|0,(r|0)<(o|0))l=l+4|0;else break}else r=0;while(!1);return r|0}function Vd(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0;Q=b,b=b+32|0,R=Q+16|0,o=Q+8|0,N=Q+4|0,k=Q,_=(r|0)==-1;e:do if(_)U=11;else{if(e[o>>2]=r,S[t+44>>0]|0)if((gi(o,4,1,e[t+32>>2]|0)|0)==1){U=11;break}else{o=-1;break}for(e[N>>2]=R,C=o+4|0,D=t+36|0,c=t+40|0,h=R+8|0,d=R,w=t+32|0;;){if(t=e[D>>2]|0,t=Ci[e[(e[t>>2]|0)+12>>2]&15](t,e[c>>2]|0,o,C,k,R,h,N)|0,(e[k>>2]|0)==(o|0)){o=-1;break e}if((t|0)==3)break;if(l=(t|0)==1,t>>>0>=2){o=-1;break e}if(t=(e[N>>2]|0)-d|0,(gi(R,1,t,e[w>>2]|0)|0)!=(t|0)){o=-1;break e}if(l)o=l?e[k>>2]|0:o;else{U=11;break e}}(gi(o,1,1,e[w>>2]|0)|0)!=1?o=-1:U=11}while(!1);return(U|0)==11&&(o=_?0:r),b=Q,o|0}function Ud(t,r){t=t|0,r=r|0;var o=0,l=0;l=O0(r,44288)|0,o=t+36|0,e[o>>2]=l,l=Dt[e[(e[l>>2]|0)+24>>2]&127](l)|0,r=t+44|0,e[r>>2]=l,o=e[o>>2]|0,o=(Dt[e[(e[o>>2]|0)+28>>2]&127](o)|0)&1,S[t+53>>0]=o,(e[r>>2]|0)>8&&fn(56783)}function zd(t){t=t|0,rn(t),he(t)}function Gd(t){return t=t|0,Bs(t,0)|0}function qd(t){return t=t|0,Bs(t,1)|0}function Wd(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0;D=b,b=b+32|0,C=D+16|0,w=D+8|0,l=D+4|0,c=D,h=t+52|0,o=(S[h>>0]|0)!=0;e:do if((r|0)==-1)o?r=-1:(r=e[t+48>>2]|0,S[h>>0]=(r|0)!=-1&1);else{d=t+48|0;t:do if(o){switch(e[l>>2]=e[d>>2],o=e[t+36>>2]|0,Ci[e[(e[o>>2]|0)+12>>2]&15](o,e[t+40>>2]|0,l,l+4|0,c,C,C+8|0,w)|0){case 1:case 2:{r=-1;break e}case 3:{S[C>>0]=e[d>>2],e[w>>2]=C+1;break}default:}for(o=t+32|0;;){if(l=e[w>>2]|0,l>>>0<=C>>>0)break t;if(t=l+-1|0,e[w>>2]=t,(Rn(S[t>>0]|0,e[o>>2]|0)|0)==-1){r=-1;break e}}}while(!1);e[d>>2]=r,S[h>>0]=1}while(!1);return b=D,r|0}function Bs(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0;U=b,b=b+32|0,_=U+16|0,R=U+8|0,D=U+4|0,k=U,c=t+52|0;e:do if(S[c>>0]|0)l=t+48|0,o=e[l>>2]|0,r&&(e[l>>2]=-1,S[c>>0]=0);else{if(o=e[t+44>>2]|0,o=(o|0)>1?o:1,N=t+32|0,(o|0)>0){c=0;do{if(l=Fn(e[N>>2]|0)|0,(l|0)==-1){o=-1;break e}S[_+c>>0]=l,c=c+1|0}while((c|0)<(o|0))}t:do if(S[t+53>>0]|0)e[R>>2]=S[_>>0];else{d=t+40|0,w=t+36|0,C=R+4|0;i:for(;;){switch(Q=e[d>>2]|0,c=Q,l=e[c>>2]|0,c=e[c+4>>2]|0,K=e[w>>2]|0,h=_+o|0,Ci[e[(e[K>>2]|0)+16>>2]&15](K,Q,_,h,D,R,C,k)|0){case 2:{o=-1;break e}case 3:break i;case 1:break;default:break t}if(K=e[d>>2]|0,e[K>>2]=l,e[K+4>>2]=c,(o|0)==8){o=-1;break e}if(l=Fn(e[N>>2]|0)|0,(l|0)==-1){o=-1;break e}S[h>>0]=l,o=o+1|0}e[R>>2]=S[_>>0]}while(!1);if(r){o=e[R>>2]|0,e[t+48>>2]=o;break}for(;!((o|0)<=0);)if(o=o+-1|0,(Rn(S[_+o>>0]|0,e[N>>2]|0)|0)==-1){o=-1;break e}o=e[R>>2]|0}while(!1);return b=U,o|0}function Hd(t){t=t|0,wt(t),he(t)}function Qd(t,r){t=t|0,r=r|0,Dt[e[(e[t>>2]|0)+24>>2]&127](t)|0,r=O0(r,44280)|0,e[t+36>>2]=r,r=(Dt[e[(e[r>>2]|0)+28>>2]&127](r)|0)&1,S[t+44>>0]=r}function Kd(t){t=t|0;var r=0,o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0;D=b,b=b+16|0,w=D+8|0,d=D,o=t+36|0,l=t+40|0,c=w+8|0,h=w,r=t+32|0;e:for(;;){if(t=e[o>>2]|0,t=an[e[(e[t>>2]|0)+20>>2]&31](t,e[l>>2]|0,w,c,d)|0,k=(e[d>>2]|0)-h|0,(gi(w,1,k,e[r>>2]|0)|0)!=(k|0)){t=-1;break}switch(t|0){case 1:break;case 2:{t=-1;break e}default:{C=4;break e}}}return(C|0)==4&&(t=((Nr(e[r>>2]|0)|0)!=0)<<31>>31),b=D,t|0}function Yd(t,r,o){t=t|0,r=r|0,o=o|0;var l=0;e:do if(S[t+44>>0]|0)r=gi(r,1,o,e[t+32>>2]|0)|0;else if((o|0)>0)for(l=r,r=0;;){if((U0[e[(e[t>>2]|0)+52>>2]&63](t,F[l>>0]|0)|0)==-1)break e;if(r=r+1|0,(r|0)<(o|0))l=l+1|0;else break}else r=0;while(!1);return r|0}function jd(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0;Q=b,b=b+32|0,R=Q+16|0,o=Q+8|0,N=Q+4|0,k=Q,_=(r|0)==-1;e:do if(_)U=11;else{if(S[o>>0]=r,S[t+44>>0]|0)if((gi(o,1,1,e[t+32>>2]|0)|0)==1){U=11;break}else{o=-1;break}for(e[N>>2]=R,D=o+1|0,c=t+36|0,h=t+40|0,d=R+8|0,w=R,C=t+32|0;;){if(t=e[c>>2]|0,t=Ci[e[(e[t>>2]|0)+12>>2]&15](t,e[h>>2]|0,o,D,k,R,d,N)|0,(e[k>>2]|0)==(o|0)){o=-1;break e}if((t|0)==3)break;if(l=(t|0)==1,t>>>0>=2){o=-1;break e}if(t=(e[N>>2]|0)-w|0,(gi(R,1,t,e[C>>2]|0)|0)!=(t|0)){o=-1;break e}if(l)o=l?e[k>>2]|0:o;else{U=11;break e}}(gi(o,1,1,e[C>>2]|0)|0)!=1?o=-1:U=11}while(!1);return(U|0)==11&&(o=_?0:r),b=Q,o|0}function Xd(t,r){t=t|0,r=r|0;var o=0,l=0;l=O0(r,44280)|0,o=t+36|0,e[o>>2]=l,l=Dt[e[(e[l>>2]|0)+24>>2]&127](l)|0,r=t+44|0,e[r>>2]=l,o=e[o>>2]|0,o=(Dt[e[(e[o>>2]|0)+28>>2]&127](o)|0)&1,S[t+53>>0]=o,(e[r>>2]|0)>8&&fn(56783)}function Zd(t){t=t|0,wt(t),he(t)}function Jd(t){return t=t|0,Vs(t,0)|0}function ep(t){return t=t|0,Vs(t,1)|0}function tp(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0;D=b,b=b+32|0,C=D+16|0,w=D+4|0,l=D+8|0,c=D,h=t+52|0,o=(S[h>>0]|0)!=0;e:do if((r|0)==-1)o?r=-1:(r=e[t+48>>2]|0,S[h>>0]=(r|0)!=-1&1);else{d=t+48|0;t:do if(o){switch(S[l>>0]=e[d>>2],o=e[t+36>>2]|0,Ci[e[(e[o>>2]|0)+12>>2]&15](o,e[t+40>>2]|0,l,l+1|0,c,C,C+8|0,w)|0){case 1:case 2:{r=-1;break e}case 3:{S[C>>0]=e[d>>2],e[w>>2]=C+1;break}default:}for(o=t+32|0;;){if(l=e[w>>2]|0,l>>>0<=C>>>0)break t;if(t=l+-1|0,e[w>>2]=t,(Rn(S[t>>0]|0,e[o>>2]|0)|0)==-1){r=-1;break e}}}while(!1);e[d>>2]=r,S[h>>0]=1}while(!1);return b=D,r|0}function Vs(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0;U=b,b=b+32|0,_=U+16|0,R=U+8|0,D=U+4|0,k=U,c=t+52|0;e:do if(S[c>>0]|0)l=t+48|0,o=e[l>>2]|0,r&&(e[l>>2]=-1,S[c>>0]=0);else{if(o=e[t+44>>2]|0,o=(o|0)>1?o:1,N=t+32|0,(o|0)>0){c=0;do{if(l=Fn(e[N>>2]|0)|0,(l|0)==-1){o=-1;break e}S[_+c>>0]=l,c=c+1|0}while((c|0)<(o|0))}t:do if(S[t+53>>0]|0)S[R>>0]=S[_>>0]|0;else{d=t+40|0,w=t+36|0,C=R+1|0;i:for(;;){switch(Q=e[d>>2]|0,c=Q,l=e[c>>2]|0,c=e[c+4>>2]|0,K=e[w>>2]|0,h=_+o|0,Ci[e[(e[K>>2]|0)+16>>2]&15](K,Q,_,h,D,R,C,k)|0){case 2:{o=-1;break e}case 3:break i;case 1:break;default:break t}if(K=e[d>>2]|0,e[K>>2]=l,e[K+4>>2]=c,(o|0)==8){o=-1;break e}if(l=Fn(e[N>>2]|0)|0,(l|0)==-1){o=-1;break e}S[h>>0]=l,o=o+1|0}S[R>>0]=S[_>>0]|0}while(!1);if(r)o=S[R>>0]|0,e[t+48>>2]=o&255;else{for(;!((o|0)<=0);)if(o=o+-1|0,(Rn(F[_+o>>0]|0,e[N>>2]|0)|0)==-1){o=-1;break e}o=S[R>>0]|0}o=o&255}while(!1);return b=U,o|0}function pA(t){t=t|0}function pn(t){t=t|0,t=t+4|0,e[t>>2]=(e[t>>2]|0)+1}function Bt(t){t=t|0;var r=0,o=0;return o=t+4|0,r=e[o>>2]|0,e[o>>2]=r+-1,r?t=0:(Mt[e[(e[t>>2]|0)+8>>2]&255](t),t=1),t|0}function ip(t,r){if(t=t|0,r=r|0,e[t>>2]=36868,g=0,Ae(86,t+4|0,(S[r>>0]&1?e[r+8>>2]|0:r+1|0)|0),t=g,g=0,t&1)t=j()|0,le(t|0);else return}function np(t,r){if(t=t|0,r=r|0,e[t>>2]=36868,g=0,Ae(86,t+4|0,r|0),t=g,g=0,t&1)t=j()|0,le(t|0);else return}function rp(t,r){t=t|0,r=r|0;var o=0,l=0;l=$i(r)|0,o=Xe(l+13|0)|0,e[o>>2]=l,e[o+4>>2]=l,e[o+8>>2]=0,o=o+12|0,o0(o|0,r|0,l+1|0)|0,e[t>>2]=o}function sp(t,r,o){t=t|0,r=r|0,o=o|0,e[t>>2]=o,e[t+4>>2]=r}function ap(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0;return c=b,b=b+16|0,l=c,Ln[e[(e[t>>2]|0)+12>>2]&15](l,t,r),(e[l+4>>2]|0)==(e[o+4>>2]|0)?l=(e[l>>2]|0)==(e[o>>2]|0):l=0,b=c,l|0}function lp(t,r,o){return t=t|0,r=r|0,o=o|0,((e[r>>2]|0)==(o|0)?(e[r+4>>2]|0)==(t|0):0)|0}function up(t,r,o){t=t|0,r=r|0,o=o|0,r=vo(o)|0,yi(t,r,$i(r)|0)}function cp(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0;d=b,b=b+16|0,h=d,l=e[r>>2]|0;do if(l)if(c=S[o>>0]|0,c&1?c=e[o+4>>2]|0:c=(c&255)>>>1,c&&(wp(o,56990)|0,l=e[r>>2]|0),r=e[r+4>>2]|0,Ln[e[(e[r>>2]|0)+24>>2]&15](h,r,l),r=S[h>>0]|0,c=(r&1)==0,g=0,Ve(30,o|0,(c?h+1|0:e[h+8>>2]|0)|0,(c?(r&255)>>>1:e[h+4>>2]|0)|0)|0,r=g,g=0,r&1)d=j()|0,de(h),le(d|0);else{de(h);break}while(!1);e[t>>2]=e[o>>2],e[t+4>>2]=e[o+4>>2],e[t+8>>2]=e[o+8>>2],e[o>>2]=0,e[o+4>>2]=0,e[o+8>>2]=0,b=d}function fp(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0;c=b,b=b+32|0,l=c+12|0,h=c,yi(h,o,$i(o)|0),g=0,xe(10,l|0,r|0,h|0),o=g,g=0;do if(o&1)l=j()|0;else if(g=0,Ae(87,t|0,l|0),o=g,g=0,o&1){c=j()|0,de(l),l=c;break}else{de(l),de(h),e[t>>2]=42664,o=e[r+4>>2]|0,h=t+8|0,e[h>>2]=e[r>>2],e[h+4>>2]=o,b=c;return}while(!1);de(h),le(l|0)}function hp(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0;h=b,b=b+48|0,c=h+24|0,w=h+16|0,d=h,e[w>>2]=r,e[w+4>>2]=o,hr(d,l),g=0,xe(10,c|0,w|0,d|0),l=g,g=0;do if(l&1)c=j()|0;else if(g=0,Ae(87,t|0,c|0),w=g,g=0,w&1){w=j()|0,de(c),c=w;break}else{de(c),de(d),e[t>>2]=42664,e[t+8>>2]=r,e[t+12>>2]=o,b=h;return}while(!1);de(d),le(c|0)}function dp(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0;c=b,b=b+48|0,l=c+24|0,d=c+16|0,h=c,e[d>>2]=r,e[d+4>>2]=o,yi(h,58898,0),g=0,xe(10,l|0,d|0,h|0),d=g,g=0;do if(d&1)l=j()|0;else if(g=0,Ae(87,t|0,l|0),d=g,g=0,d&1){d=j()|0,de(l),l=d;break}else{de(l),de(h),e[t>>2]=42664,e[t+8>>2]=r,e[t+12>>2]=o,b=c;return}while(!1);de(h),le(l|0)}function fr(t){t=t|0,In(t)}function pp(t){t=t|0,In(t),he(t)}function mp(t){t=t|0}function gp(t,r,o){t=t|0,r=r|0,o=o|0;var l=0;if(Gr(42676)|0,(e[t>>2]|0)==1)do Q0(42704,42676)|0;while((e[t>>2]|0)==1);do if(e[t>>2]|0)Br(42676)|0;else{if(e[t>>2]=1,g=0,ge(72,42676)|0,l=g,g=0,!(l&1)&&(g=0,ue(o|0,r|0),l=g,g=0,!(l&1))&&(g=0,ge(73,42676)|0,l=g,g=0,!(l&1))&&(e[t>>2]=-1,g=0,ge(72,42676)|0,l=g,g=0,!(l&1))&&(g=0,ge(74,42704)|0,l=g,g=0,!(l&1)))break;l=j(0)|0,K0(l|0)|0,g=0,ge(73,42676)|0,l=g,g=0,!(l&1)&&(e[t>>2]=0,g=0,ge(72,42676)|0,l=g,g=0,!(l&1))&&(g=0,ge(74,42704)|0,l=g,g=0,!(l&1))&&(g=0,Nt(5),g=0),r=j()|0,g=0,Nt(3),l=g,g=0,l&1?(l=j(0)|0,$t(l)):le(r|0)}while(!1)}function hr(t,r){t=t|0,r=r|0,S[r>>0]&1?yi(t,e[r+8>>2]|0,e[r+4>>2]|0):(e[t>>2]=e[r>>2],e[t+4>>2]=e[r+4>>2],e[t+8>>2]=e[r+8>>2])}function yi(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0;o>>>0>4294967279&&si(t),o>>>0<11?(S[t>>0]=o<<1,t=t+1|0):(c=o+16&-16,l=Xe(c)|0,e[t+8>>2]=l,e[t>>2]=c|1,e[t+4>>2]=o,t=l),o0(t|0,r|0,o|0)|0,S[t+o>>0]=0}function dr(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0;r>>>0>4294967279&&si(t),r>>>0<11?(S[t>>0]=r<<1,t=t+1|0):(c=r+16&-16,l=Xe(c)|0,e[t+8>>2]=l,e[t>>2]=c|1,e[t+4>>2]=r,t=l),Jt(t|0,o|0,r|0)|0,S[t+r>>0]=0}function de(t){t=t|0,S[t>>0]&1&&he(e[t+8>>2]|0)}function Sp(t,r){t=t|0,r=r|0;var o=0,l=0;return(t|0)!=(r|0)&&(o=S[r>>0]|0,l=(o&1)==0,Us(t,l?r+1|0:e[r+8>>2]|0,l?(o&255)>>>1:e[r+4>>2]|0)|0),t|0}function Ap(t,r){return t=t|0,r=r|0,Us(t,r,$i(r)|0)|0}function Us(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0;l=S[t>>0]|0,l&1?(l=e[t>>2]|0,h=(l&-2)+-1|0,l=l&255):h=10,c=(l&1)==0;do if(h>>>0>=o>>>0)if(c?l=t+1|0:l=e[t+8>>2]|0,vn(l|0,r|0,o|0)|0,S[l+o>>0]=0,S[t>>0]&1){e[t+4>>2]=o;break}else{S[t>>0]=o<<1;break}else c?l=(l&255)>>>1:l=e[t+4>>2]|0,qs(t,h,o-h|0,l,0,l,o,r);while(!1);return t|0}function zs(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0;l=S[t>>0]|0,c=(l&1)==0,c?l=(l&255)>>>1:l=e[t+4>>2]|0;do if(l>>>0>=r>>>0)if(c){S[t+1+r>>0]=0,S[t>>0]=r<<1;break}else{S[(e[t+8>>2]|0)+r>>0]=0,e[t+4>>2]=r;break}else vp(t,r-l|0,o)|0;while(!1)}function vp(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0;return r&&(l=S[t>>0]|0,l&1?(l=e[t>>2]|0,c=(l&-2)+-1|0,l=l&255):c=10,l&1?h=e[t+4>>2]|0:h=(l&255)>>>1,(c-h|0)>>>0>>0&&(pr(t,c,r-c+h|0,h,h,0,0),l=S[t>>0]|0),l&1?c=e[t+8>>2]|0:c=t+1|0,Jt(c+h|0,o|0,r|0)|0,l=h+r|0,S[t>>0]&1?e[t+4>>2]=l:S[t>>0]=l<<1,S[c+l>>0]=0),t|0}function xp(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0;r>>>0>4294967279&&si(t),o=S[t>>0]|0,o&1?(o=e[t>>2]|0,l=(o&-2)+-1|0,o=o&255):l=10,o&1?w=e[t+4>>2]|0:w=(o&255)>>>1,r=w>>>0>r>>>0?w:r,r>>>0<11?d=10:d=(r+16&-16)+-1|0;e:do if((d|0)!=(l|0)){do if((d|0)!=10){if(r=d+1|0,d>>>0<=l>>>0){if(g=0,r=ge(67,r|0)|0,h=g,g=0,h&1){t=j(0)|0,K0(t|0)|0,ei();break e}}else r=Xe(r)|0;if(o&1){l=1,c=e[t+8>>2]|0,h=1;break}else{l=1,c=t+1|0,h=0;break}}else r=t+1|0,l=0,c=e[t+8>>2]|0,h=1;while(!1);if(o&1?o=e[t+4>>2]|0:o=(o&255)>>>1,o0(r|0,c|0,o+1|0)|0,h&&he(c),l){e[t>>2]=d+1|1,e[t+4>>2]=w,e[t+8>>2]=r;break}else{S[t>>0]=w<<1;break}}while(!1)}function wp(t,r){return t=t|0,r=r|0,Gs(t,r,$i(r)|0)|0}function yp(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0;o=S[t>>0]|0,l=(o&1)!=0,l?(c=(e[t>>2]&-2)+-1|0,h=e[t+4>>2]|0):(c=10,h=(o&255)>>>1),(h|0)==(c|0)?(pr(t,c,1,c,c,0,0),S[t>>0]&1?c=8:c=7):l?c=8:c=7,(c|0)==7?(S[t>>0]=(h<<1)+2,o=t+1|0,l=h+1|0):(c|0)==8&&(o=e[t+8>>2]|0,l=h+1|0,e[t+4>>2]=l),S[o+h>>0]=r,S[o+l>>0]=0}function Gs(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0;return l=S[t>>0]|0,l&1?(l=e[t>>2]|0,c=(l&-2)+-1|0,l=l&255):c=10,l&1?h=e[t+4>>2]|0:h=(l&255)>>>1,(c-h|0)>>>0>=o>>>0?o&&(l&1?c=e[t+8>>2]|0:c=t+1|0,o0(c+h|0,r|0,o|0)|0,l=h+o|0,S[t>>0]&1?e[t+4>>2]=l:S[t>>0]=l<<1,S[c+l>>0]=0):qs(t,c,o-c+h|0,h,h,0,o,r),t|0}function qs(t,r,o,l,c,h,d,w){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0,w=w|0;var C=0,D=0,k=0;(-18-r|0)>>>0>>0&&si(t),S[t>>0]&1?k=e[t+8>>2]|0:k=t+1|0,r>>>0<2147483623?(C=o+r|0,D=r<<1,C=C>>>0>>0?D:C,C=C>>>0<11?11:C+16&-16):C=-17,D=Xe(C)|0,c&&o0(D|0,k|0,c|0)|0,d&&o0(D+c|0,w|0,d|0)|0,o=l-h|0,(o|0)!=(c|0)&&o0(D+(d+c)|0,k+(h+c)|0,o-c|0)|0,(r|0)!=10&&he(k),e[t+8>>2]=D,e[t>>2]=C|1,r=o+d|0,e[t+4>>2]=r,S[D+r>>0]=0}function pr(t,r,o,l,c,h,d){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0;var w=0,C=0,D=0;(-17-r|0)>>>0>>0&&si(t),S[t>>0]&1?D=e[t+8>>2]|0:D=t+1|0,r>>>0<2147483623?(w=o+r|0,C=r<<1,w=w>>>0>>0?C:w,w=w>>>0<11?11:w+16&-16):w=-17,C=Xe(w)|0,c&&o0(C|0,D|0,c|0)|0,o=l-h|0,(o|0)!=(c|0)&&o0(C+(d+c)|0,D+(h+c)|0,o-c|0)|0,(r|0)!=10&&he(D),e[t+8>>2]=C,e[t>>2]=w|1}function mr(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0;o>>>0>1073741807&&si(t),o>>>0<2?(S[t>>0]=o<<1,t=t+4|0):(c=o+4&-4,l=Xe(c<<2)|0,e[t+8>>2]=l,e[t>>2]=c|1,e[t+4>>2]=o,t=l),Bi(t,r,o)|0,e[t+(o<<2)>>2]=0}function gr(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0;r>>>0>1073741807&&si(t),r>>>0<2?(S[t>>0]=r<<1,t=t+4|0):(c=r+4&-4,l=Xe(c<<2)|0,e[t+8>>2]=l,e[t>>2]=c|1,e[t+4>>2]=r,t=l),GS(t,o,r)|0,e[t+(r<<2)>>2]=0}function Pt(t){t=t|0,S[t>>0]&1&&he(e[t+8>>2]|0)}function Cp(t,r){return t=t|0,r=r|0,Tp(t,r,_n(r)|0)|0}function Tp(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0;l=S[t>>0]|0,l&1?(l=e[t>>2]|0,h=(l&-2)+-1|0,l=l&255):h=1,c=(l&1)==0;do if(h>>>0>=o>>>0)if(c?l=t+4|0:l=e[t+8>>2]|0,zS(l,r,o)|0,e[l+(o<<2)>>2]=0,S[t>>0]&1){e[t+4>>2]=o;break}else{S[t>>0]=o<<1;break}else c?l=(l&255)>>>1:l=e[t+4>>2]|0,kp(t,h,o-h|0,l,0,l,o,r);while(!1);return t|0}function Ip(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0;r>>>0>1073741807&&si(t),o=S[t>>0]|0,o&1?(o=e[t>>2]|0,l=(o&-2)+-1|0,o=o&255):l=1,o&1?w=e[t+4>>2]|0:w=(o&255)>>>1,r=w>>>0>r>>>0?w:r,r>>>0<2?d=1:d=(r+4&-4)+-1|0;e:do if((d|0)!=(l|0)){do if((d|0)!=1){if(r=(d<<2)+4|0,d>>>0<=l>>>0){if(g=0,r=ge(67,r|0)|0,h=g,g=0,h&1){t=j(0)|0,K0(t|0)|0,ei();break e}}else r=Xe(r)|0;if(o&1){l=1,c=e[t+8>>2]|0,h=1;break}else{l=1,c=t+4|0,h=0;break}}else r=t+4|0,l=0,c=e[t+8>>2]|0,h=1;while(!1);if(o&1?o=e[t+4>>2]|0:o=(o&255)>>>1,Bi(r,c,o+1|0)|0,h&&he(c),l){e[t>>2]=d+1|1,e[t+4>>2]=w,e[t+8>>2]=r;break}else{S[t>>0]=w<<1;break}}while(!1)}function Ep(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0;o=S[t>>0]|0,l=(o&1)!=0,l?(c=(e[t>>2]&-2)+-1|0,h=e[t+4>>2]|0):(c=1,h=(o&255)>>>1),(h|0)==(c|0)?(Ws(t,c,1,c,c,0,0),S[t>>0]&1?c=8:c=7):l?c=8:c=7,(c|0)==7?(S[t>>0]=(h<<1)+2,o=t+4|0,l=h+1|0):(c|0)==8&&(o=e[t+8>>2]|0,l=h+1|0,e[t+4>>2]=l),e[o+(h<<2)>>2]=r,e[o+(l<<2)>>2]=0}function kp(t,r,o,l,c,h,d,w){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0,w=w|0;var C=0,D=0,k=0;(1073741806-r|0)>>>0>>0&&si(t),S[t>>0]&1?k=e[t+8>>2]|0:k=t+4|0,r>>>0<536870887?(C=o+r|0,D=r<<1,C=C>>>0>>0?D:C,C=C>>>0<2?2:C+4&-4):C=1073741807,D=Xe(C<<2)|0,c&&Bi(D,k,c)|0,d&&Bi(D+(c<<2)|0,w,d)|0,o=l-h|0,(o|0)!=(c|0)&&Bi(D+(d+c<<2)|0,k+(h+c<<2)|0,o-c|0)|0,(r|0)!=1&&he(k),e[t+8>>2]=D,e[t>>2]=C|1,r=o+d|0,e[t+4>>2]=r,e[D+(r<<2)>>2]=0}function Ws(t,r,o,l,c,h,d){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0;var w=0,C=0,D=0;(1073741807-r|0)>>>0>>0&&si(t),S[t>>0]&1?D=e[t+8>>2]|0:D=t+4|0,r>>>0<536870887?(w=o+r|0,C=r<<1,w=w>>>0>>0?C:w,w=w>>>0<2?2:w+4&-4):w=1073741807,C=Xe(w<<2)|0,c&&Bi(C,D,c)|0,o=l-h|0,(o|0)!=(c|0)&&Bi(C+(d+c<<2)|0,D+(h+c<<2)|0,o-c|0)|0,(r|0)!=1&&he(D),e[t+8>>2]=C,e[t>>2]=w|1}function Dp(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0;if(c=r,l=o-c|0,l>>>0>4294967279&&si(t),l>>>0<11?(S[t>>0]=l<<1,h=t+1|0):(d=l+16&-16,h=Xe(d)|0,e[t+8>>2]=h,e[t>>2]=d|1,e[t+4>>2]=l),t=o-c|0,(r|0)!=(o|0))for(l=h;S[l>>0]=S[r>>0]|0,r=r+1|0,(r|0)!=(o|0);)l=l+1|0;S[h+t>>0]=0}function bp(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0;if(h=r,l=o-h|0,c=l>>2,c>>>0>1073741807&&si(t),c>>>0<2?(S[t>>0]=l>>>1,t=t+4|0):(d=c+4&-4,l=Xe(d<<2)|0,e[t+8>>2]=l,e[t>>2]=d|1,e[t+4>>2]=c,t=l),c=(o-h|0)>>>2,(r|0)!=(o|0))for(l=t;e[l>>2]=e[r>>2],r=r+4|0,(r|0)!=(o|0);)l=l+4|0;e[t+(c<<2)>>2]=0}function Np(t,r){t=t|0,r=r|0;var o=0,l=0,c=0;if(o=b,b=b+16|0,l=o,c=(e[t+24>>2]|0)==0,e[t+16>>2]=c&1|r,!((c&1|r)&e[t+20>>2])){b=o;return}r=Ct(16)|0,Tm()|0,e[l>>2]=1,e[l+4>>2]=43112,g=0,xe(11,r|0,57437,l|0),c=g,g=0,c&1?(c=j()|0,Tt(r|0),le(c|0)):Qt(r|0,864,112)}function G0(t){t=t|0;var r=0;if(e[t>>2]=43068,g=0,Ae(88,t|0,0),r=g,g=0,r&1)r=j(0)|0,$t(r);else{_0(t+28|0),n0(e[t+32>>2]|0),n0(e[t+36>>2]|0),n0(e[t+48>>2]|0),n0(e[t+60>>2]|0);return}}function tt(t){t=t|0,G0(t)}function mA(t){t=t|0,G0(t),he(t)}function Fp(t,r){t=t|0,r=r|0;var o=0,l=0,c=0;if(o=e[t+40>>2]|0,l=t+32|0,c=t+36|0,o)do o=o+-1|0,Ln[e[(e[l>>2]|0)+(o<<2)>>2]&15](r,t,e[(e[c>>2]|0)+(o<<2)>>2]|0);while(o|0)}function f0(t){t=t|0;var r=0,o=0;return o=b,b=b+16|0,r=o,tn(r,t+28|0),b=o,e[r>>2]|0}function Rp(t,r){t=t|0,r=r|0;var o=0;e[t+24>>2]=r,e[t+16>>2]=(r|0)==0&1,e[t+20>>2]=0,e[t+4>>2]=4098,e[t+12>>2]=0,e[t+8>>2]=6,o=t+28|0,r=t+32|0,t=r+40|0;do e[r>>2]=0,r=r+4|0;while((r|0)<(t|0));ur(o)}function mn(t){t=t|0,G0(t)}function gA(t){t=t|0,G0(t),he(t)}function wt(t){t=t|0,e[t>>2]=42760,_0(t+4|0)}function Mp(t){t=t|0,e[t>>2]=42760,_0(t+4|0),he(t)}function Sr(t){t=t|0,e[t>>2]=42760,ur(t+4|0),t=t+8|0,e[t>>2]=0,e[t+4>>2]=0,e[t+8>>2]=0,e[t+12>>2]=0,e[t+16>>2]=0,e[t+20>>2]=0}function _p(t,r){t=t|0,r=r|0}function Pp(t,r,o){return t=t|0,r=r|0,o=o|0,t|0}function Lp(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,r=t,e[r>>2]=0,e[r+4>>2]=0,r=t+8|0,e[r>>2]=-1,e[r+4>>2]=-1}function Op(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0,r=t,e[r>>2]=0,e[r+4>>2]=0,r=t+8|0,e[r>>2]=-1,e[r+4>>2]=-1}function $p(t){return t=t|0,0}function Bp(t){return t=t|0,0}function Vp(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0;h=t+12|0,d=t+16|0;e:do if((o|0)>0)for(c=r,r=0;;){if(l=e[h>>2]|0,l>>>0<(e[d>>2]|0)>>>0)e[h>>2]=l+1,l=S[l>>0]|0;else{if(l=Dt[e[(e[t>>2]|0)+40>>2]&127](t)|0,(l|0)==-1)break e;l=l&255}if(S[c>>0]=l,r=r+1|0,(r|0)<(o|0))c=c+1|0;else break}else r=0;while(!1);return r|0}function Up(t){return t=t|0,-1}function zp(t){t=t|0;var r=0;return(Dt[e[(e[t>>2]|0)+36>>2]&127](t)|0)==-1?t=-1:(r=t+12|0,t=e[r>>2]|0,e[r>>2]=t+1,t=F[t>>0]|0),t|0}function Gp(t,r){return t=t|0,r=r|0,-1}function qp(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0,w=0;h=t+24|0,d=t+28|0;e:do if((o|0)>0)for(c=r,r=0;;){if(l=e[h>>2]|0,l>>>0>=(e[d>>2]|0)>>>0){if((U0[e[(e[t>>2]|0)+52>>2]&63](t,F[c>>0]|0)|0)==-1)break e}else w=S[c>>0]|0,e[h>>2]=l+1,S[l>>0]=w;if(r=r+1|0,(r|0)<(o|0))c=c+1|0;else break}else r=0;while(!1);return r|0}function Wp(t,r){return t=t|0,r=r|0,-1}function rn(t){t=t|0,e[t>>2]=42824,_0(t+4|0)}function Hp(t){t=t|0,e[t>>2]=42824,_0(t+4|0),he(t)}function Hs(t){t=t|0,e[t>>2]=42824,ur(t+4|0),t=t+8|0,e[t>>2]=0,e[t+4>>2]=0,e[t+8>>2]=0,e[t+12>>2]=0,e[t+16>>2]=0,e[t+20>>2]=0}function Qp(t,r){t=t|0,r=r|0}function Kp(t,r,o){return t=t|0,r=r|0,o=o|0,t|0}function Yp(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,r=t,e[r>>2]=0,e[r+4>>2]=0,r=t+8|0,e[r>>2]=-1,e[r+4>>2]=-1}function jp(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0,r=t,e[r>>2]=0,e[r+4>>2]=0,r=t+8|0,e[r>>2]=-1,e[r+4>>2]=-1}function Xp(t){return t=t|0,0}function Zp(t){return t=t|0,0}function Jp(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0;h=t+12|0,d=t+16|0;e:do if((o|0)>0)for(c=r,r=0;;){if(l=e[h>>2]|0,l>>>0>=(e[d>>2]|0)>>>0){if(l=Dt[e[(e[t>>2]|0)+40>>2]&127](t)|0,(l|0)==-1)break e}else e[h>>2]=l+4,l=e[l>>2]|0;if(e[c>>2]=l,r=r+1|0,(r|0)<(o|0))c=c+4|0;else break}else r=0;while(!1);return r|0}function em(t){return t=t|0,-1}function tm(t){t=t|0;var r=0;return(Dt[e[(e[t>>2]|0)+36>>2]&127](t)|0)==-1?t=-1:(r=t+12|0,t=e[r>>2]|0,e[r>>2]=t+4,t=e[t>>2]|0),t|0}function im(t,r){return t=t|0,r=r|0,-1}function nm(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0,w=0;h=t+24|0,d=t+28|0;e:do if((o|0)>0)for(c=r,r=0;;){if(l=e[h>>2]|0,l>>>0>=(e[d>>2]|0)>>>0){if((U0[e[(e[t>>2]|0)+52>>2]&63](t,e[c>>2]|0)|0)==-1)break e}else w=e[c>>2]|0,e[h>>2]=l+4,e[l>>2]=w;if(r=r+1|0,(r|0)<(o|0))c=c+4|0;else break}else r=0;while(!1);return r|0}function rm(t,r){return t=t|0,r=r|0,-1}function sm(t){t=t|0,G0(t+8|0)}function om(t){t=t|0,G0(t+((e[(e[t>>2]|0)+-12>>2]|0)+8)|0)}function Qs(t){t=t|0,G0(t+8|0),he(t)}function am(t){t=t|0,Qs(t+(e[(e[t>>2]|0)+-12>>2]|0)|0)}function Ks(t){t=t|0;var r=0,o=0,l=0,c=0;l=b,b=b+16|0,o=l;e:do if(e[t+((e[(e[t>>2]|0)+-12>>2]|0)+24)>>2]|0){g=0,Ae(65,o|0,t|0),r=g,g=0;t:do if(r&1)r=j(0)|0;else{do if(S[o>>0]|0){if(r=e[t+((e[(e[t>>2]|0)+-12>>2]|0)+24)>>2]|0,g=0,r=ge(e[(e[r>>2]|0)+24>>2]|0,r|0)|0,c=g,g=0,!(c&1)&&((r|0)!=-1||(c=e[(e[t>>2]|0)+-12>>2]|0,g=0,Ae(66,t+c|0,e[t+(c+16)>>2]|1|0),c=g,g=0,!(c&1))))break;r=j(0)|0,Ei(o);break t}while(!1);Ei(o);break e}while(!1);if(K0(r|0)|0,g=0,ue(181,t+(e[(e[t>>2]|0)+-12>>2]|0)|0),c=g,g=0,!(c&1)){ei();break}r=j()|0,g=0,Nt(3),c=g,g=0,c&1?(c=j(0)|0,$t(c)):le(r|0)}while(!1);return b=l,t|0}function lm(t){t=t|0;var r=0;if(r=t+16|0,e[r>>2]=e[r>>2]|1,e[t+20>>2]&1)Ur();else return}function um(t){t=t|0,G0(t+8|0)}function cm(t){t=t|0,G0(t+((e[(e[t>>2]|0)+-12>>2]|0)+8)|0)}function Ys(t){t=t|0,G0(t+8|0),he(t)}function fm(t){t=t|0,Ys(t+(e[(e[t>>2]|0)+-12>>2]|0)|0)}function js(t){t=t|0;var r=0,o=0,l=0,c=0;l=b,b=b+16|0,o=l;e:do if(e[t+((e[(e[t>>2]|0)+-12>>2]|0)+24)>>2]|0){g=0,Ae(89,o|0,t|0),r=g,g=0;t:do if(r&1)r=j(0)|0;else{do if(S[o>>0]|0){if(r=e[t+((e[(e[t>>2]|0)+-12>>2]|0)+24)>>2]|0,g=0,r=ge(e[(e[r>>2]|0)+24>>2]|0,r|0)|0,c=g,g=0,!(c&1)&&((r|0)!=-1||(c=e[(e[t>>2]|0)+-12>>2]|0,g=0,Ae(66,t+c|0,e[t+(c+16)>>2]|1|0),c=g,g=0,!(c&1))))break;r=j(0)|0,Js(o);break t}while(!1);Js(o);break e}while(!1);if(K0(r|0)|0,g=0,ue(181,t+(e[(e[t>>2]|0)+-12>>2]|0)|0),c=g,g=0,!(c&1)){ei();break}r=j()|0,g=0,Nt(3),c=g,g=0,c&1?(c=j(0)|0,$t(c)):le(r|0)}while(!1);return b=l,t|0}function SA(t,r){t=t|0,r=r|0}function hm(t){t=t|0,G0(t+4|0)}function dm(t){t=t|0,G0(t+((e[(e[t>>2]|0)+-12>>2]|0)+4)|0)}function Xs(t){t=t|0,G0(t+4|0),he(t)}function pm(t){t=t|0,Xs(t+(e[(e[t>>2]|0)+-12>>2]|0)|0)}function mm(t,r){t=t|0,r=r|0;var o=0;S[t>>0]=0,e[t+4>>2]=r,o=e[(e[r>>2]|0)+-12>>2]|0,e[r+(o+16)>>2]|0||(o=e[r+(o+72)>>2]|0,o&&Ks(o)|0,S[t>>0]=1)}function Ei(t){t=t|0;var r=0,o=0;t=t+4|0,o=e[t>>2]|0,r=e[(e[o>>2]|0)+-12>>2]|0;do if(e[o+(r+24)>>2]|0&&!(e[o+(r+16)>>2]|0)&&e[o+(r+4)>>2]&8192|0&&!(Or()|0)){if(r=e[t>>2]|0,r=e[r+((e[(e[r>>2]|0)+-12>>2]|0)+24)>>2]|0,g=0,r=ge(e[(e[r>>2]|0)+24>>2]|0,r|0)|0,o=g,g=0,!(o&1)&&((r|0)!=-1||(r=e[t>>2]|0,o=e[(e[r>>2]|0)+-12>>2]|0,g=0,Ae(66,r+o|0,e[r+(o+16)>>2]|1|0),o=g,g=0,!(o&1))))break;o=j(0)|0,K0(o|0)|0,g=0,Nt(3),o=g,g=0,o&1&&(o=j(0)|0,$t(o))}while(!1)}function gm(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0;R=b,b=b+32|0,w=R+20|0,C=R+16|0,k=R+8|0,o=R,g=0,Ae(65,k|0,t|0),D=g,g=0;e:do if(D&1)o=j(0)|0,l=t,c=t,N=19;else{do if(S[k>>0]|0){if(D=f0(t+(e[(e[t>>2]|0)+-12>>2]|0)|0)|0,e[o>>2]=D,g=0,D=be(37,o|0,43392)|0,d=g,g=0,d&1)N=j(0)|0,_0(o),o=N;else{_0(o),c=e[(e[t>>2]|0)+-12>>2]|0,d=e[t+(c+24)>>2]|0,l=t+c|0,c=t+(c+76)|0,o=e[c>>2]|0;do if((o|0)==-1){if(o=f0(l)|0,e[w>>2]=o,g=0,o=be(37,w|0,44220)|0,_=g,g=0,!(_&1)&&(g=0,h=be(e[(e[o>>2]|0)+28>>2]|0,o|0,32)|0,_=g,g=0,!(_&1))){_0(w),o=h<<24>>24,e[c>>2]=o,N=10;break}o=j(0)|0,_0(w)}else N=10;while(!1);if((N|0)==10){if(_=e[(e[D>>2]|0)+16>>2]|0,e[C>>2]=d,g=0,e[w>>2]=e[C>>2],o=se(_|0,D|0,w|0,l|0,o&255|0,r|0)|0,_=g,g=0,!(_&1)&&(o||(_=e[(e[t>>2]|0)+-12>>2]|0,g=0,Ae(66,t+_|0,e[t+(_+16)>>2]|5|0),_=g,g=0,!(_&1))))break;o=j(0)|0}}Ei(k),l=t,c=t,N=19;break e}while(!1);Ei(k)}while(!1);do if((N|0)==19){if(K0(o|0)|0,g=0,ue(181,l+(e[(e[c>>2]|0)+-12>>2]|0)|0),_=g,g=0,!(_&1)){ei();break}o=j()|0,g=0,Nt(3),_=g,g=0,_&1?(_=j(0)|0,$t(_)):le(o|0)}while(!1);return b=R,t|0}function Sm(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0;R=b,b=b+32|0,w=R+20|0,C=R+16|0,k=R+8|0,o=R,g=0,Ae(65,k|0,t|0),D=g,g=0;e:do if(D&1)o=j(0)|0,l=t,c=t,N=19;else{do if(S[k>>0]|0){if(D=f0(t+(e[(e[t>>2]|0)+-12>>2]|0)|0)|0,e[o>>2]=D,g=0,D=be(37,o|0,43392)|0,d=g,g=0,d&1)N=j(0)|0,_0(o),o=N;else{_0(o),c=e[(e[t>>2]|0)+-12>>2]|0,d=e[t+(c+24)>>2]|0,l=t+c|0,c=t+(c+76)|0,o=e[c>>2]|0;do if((o|0)==-1){if(o=f0(l)|0,e[w>>2]=o,g=0,o=be(37,w|0,44220)|0,_=g,g=0,!(_&1)&&(g=0,h=be(e[(e[o>>2]|0)+28>>2]|0,o|0,32)|0,_=g,g=0,!(_&1))){_0(w),o=h<<24>>24,e[c>>2]=o,N=10;break}o=j(0)|0,_0(w)}else N=10;while(!1);if((N|0)==10){if(_=e[(e[D>>2]|0)+24>>2]|0,e[C>>2]=d,g=0,e[w>>2]=e[C>>2],o=se(_|0,D|0,w|0,l|0,o&255|0,r|0)|0,_=g,g=0,!(_&1)&&(o||(_=e[(e[t>>2]|0)+-12>>2]|0,g=0,Ae(66,t+_|0,e[t+(_+16)>>2]|5|0),_=g,g=0,!(_&1))))break;o=j(0)|0}}Ei(k),l=t,c=t,N=19;break e}while(!1);Ei(k)}while(!1);do if((N|0)==19){if(K0(o|0)|0,g=0,ue(181,l+(e[(e[c>>2]|0)+-12>>2]|0)|0),_=g,g=0,!(_&1)){ei();break}o=j()|0,g=0,Nt(3),_=g,g=0,_&1?(_=j(0)|0,$t(_)):le(o|0)}while(!1);return b=R,t|0}function Am(t){t=t|0,G0(t+4|0)}function vm(t){t=t|0,G0(t+((e[(e[t>>2]|0)+-12>>2]|0)+4)|0)}function Zs(t){t=t|0,G0(t+4|0),he(t)}function xm(t){t=t|0,Zs(t+(e[(e[t>>2]|0)+-12>>2]|0)|0)}function wm(t,r){t=t|0,r=r|0;var o=0;S[t>>0]=0,e[t+4>>2]=r,o=e[(e[r>>2]|0)+-12>>2]|0,e[r+(o+16)>>2]|0||(o=e[r+(o+72)>>2]|0,o&&js(o)|0,S[t>>0]=1)}function Js(t){t=t|0;var r=0,o=0;t=t+4|0,o=e[t>>2]|0,r=e[(e[o>>2]|0)+-12>>2]|0;do if(e[o+(r+24)>>2]|0&&!(e[o+(r+16)>>2]|0)&&e[o+(r+4)>>2]&8192|0&&!(Or()|0)){if(r=e[t>>2]|0,r=e[r+((e[(e[r>>2]|0)+-12>>2]|0)+24)>>2]|0,g=0,r=ge(e[(e[r>>2]|0)+24>>2]|0,r|0)|0,o=g,g=0,!(o&1)&&((r|0)!=-1||(r=e[t>>2]|0,o=e[(e[r>>2]|0)+-12>>2]|0,g=0,Ae(66,r+o|0,e[r+(o+16)>>2]|1|0),o=g,g=0,!(o&1))))break;o=j(0)|0,K0(o|0)|0,g=0,Nt(3),o=g,g=0,o&1&&(o=j(0)|0,$t(o))}while(!1)}function ym(t){return t=t|0,57453}function Cm(t,r,o){t=t|0,r=r|0,o=o|0,(o|0)!=1&(o|0)<257?up(t,r,o):yi(t,57462,35)}function Tm(){return!(S[1048]|0)&&kt(1048)|0&&(e[10778]=43084,Ft(72,43112,H|0)|0,bt(1048)),43112}function Im(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0,w=0;l=b,b=b+16|0,c=l+8|0,h=l,w=o,d=e[w+4>>2]|0,o=h,e[o>>2]=e[w>>2],e[o+4>>2]=d,e[c>>2]=e[h>>2],e[c+4>>2]=e[h+4>>2],fp(t,c,r),e[t>>2]=43048,b=l}function Em(t){t=t|0,fr(t)}function km(t){t=t|0,fr(t),he(t)}function Dm(t){t=t|0,G0(t),he(t)}function bm(t){t=t|0,he(t)}function Nm(t){t=t|0}function Fm(t){t=t|0}function Rm(t){t=t|0,he(t)}function Mm(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0;e:do if((l|0)==(c|0))d=6;else for(;;){if((r|0)==(o|0)){r=-1;break e}if(t=S[r>>0]|0,h=S[l>>0]|0,t<<24>>24>24){r=-1;break e}if(h<<24>>24>24){r=1;break e}if(r=r+1|0,l=l+1|0,(l|0)==(c|0)){d=6;break}}while(!1);return(d|0)==6&&(r=(r|0)!=(o|0)&1),r|0}function _m(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0,Dp(t,o,l)}function Pm(t,r,o){t=t|0,r=r|0,o=o|0;var l=0;if((r|0)==(o|0))t=0;else{t=0;do t=(S[r>>0]|0)+(t<<4)|0,l=t&-268435456,t=(l>>>24|l)^t,r=r+1|0;while((r|0)!=(o|0))}return t|0}function Lm(t){t=t|0}function Om(t){t=t|0,he(t)}function $m(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0;e:do if((l|0)==(c|0))d=6;else for(;;){if((r|0)==(o|0)){r=-1;break e}if(t=e[r>>2]|0,h=e[l>>2]|0,(t|0)<(h|0)){r=-1;break e}if((h|0)<(t|0)){r=1;break e}if(r=r+4|0,l=l+4|0,(l|0)==(c|0)){d=6;break}}while(!1);return(d|0)==6&&(r=(r|0)!=(o|0)&1),r|0}function Bm(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0,bp(t,o,l)}function Vm(t,r,o){t=t|0,r=r|0,o=o|0;var l=0;if((r|0)==(o|0))t=0;else{t=0;do t=(e[r>>2]|0)+(t<<4)|0,l=t&-268435456,t=(l>>>24|l)^t,r=r+4|0;while((r|0)!=(o|0))}return t|0}function Um(t){t=t|0}function zm(t){t=t|0,he(t)}function Gm(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0;U=b,b=b+64|0,R=U+56|0,d=U+52|0,k=U+48|0,w=U+44|0,C=U+40|0,D=U+36|0,N=U+32|0,Q=U+8|0,_=U;e:do if(e[l+4>>2]&1){d=f0(l)|0,e[D>>2]=d,g=0,t=be(37,D|0,44220)|0,k=g,g=0;do if(k&1)Q=j()|0,Bt(d)|0,d=Q;else{if(Bt(d)|0,d=f0(l)|0,e[N>>2]=d,g=0,C=be(37,N|0,44360)|0,N=g,g=0,N&1){Q=j()|0,Bt(d)|0,d=Q;break}if(Bt(d)|0,g=0,Ae(e[(e[C>>2]|0)+24>>2]|0,Q|0,C|0),N=g,g=0,N&1)w=Q;else if(w=Q+12|0,g=0,Ae(e[(e[C>>2]|0)+28>>2]|0,w|0,C|0),N=g,g=0,!(N&1))if(e[_>>2]=e[o>>2],g=0,e[R>>2]=e[_>>2],d=vt(7,r|0,R|0,Q|0,Q+24|0,t|0,c|0,1)|0,c=g,g=0,c&1){d=j()|0,de(Q+12|0),de(Q);break}else{S[h>>0]=(d|0)==(Q|0)&1,d=e[r>>2]|0,de(Q+12|0),de(Q);break e}if(d=j()|0,C=ye,(Q|0)!=(w|0))do w=w+-12|0,de(w);while((w|0)!=(Q|0))}while(!1);le(d|0)}else switch(e[k>>2]=-1,Q=e[(e[t>>2]|0)+16>>2]|0,e[w>>2]=e[r>>2],e[C>>2]=e[o>>2],e[d>>2]=e[w>>2],e[R>>2]=e[C>>2],d=on[Q&63](t,d,R,l,c,k)|0,e[r>>2]=d,e[k>>2]|0){case 0:{S[h>>0]=0;break e}case 1:{S[h>>0]=1;break e}default:{S[h>>0]=1,e[c>>2]=4;break e}}while(!1);return b=U,d|0}function qm(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0;return d=b,b=b+16|0,w=d+12|0,C=d+8|0,k=d+4|0,D=d,e[k>>2]=e[r>>2],e[D>>2]=e[o>>2],e[C>>2]=e[k>>2],e[w>>2]=e[D>>2],t=M4(t,C,w,l,c,h)|0,b=d,t|0}function Wm(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0;return d=b,b=b+16|0,w=d+12|0,C=d+8|0,k=d+4|0,D=d,e[k>>2]=e[r>>2],e[D>>2]=e[o>>2],e[C>>2]=e[k>>2],e[w>>2]=e[D>>2],t=_4(t,C,w,l,c,h)|0,b=d,t|0}function Hm(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0;return d=b,b=b+16|0,w=d+12|0,C=d+8|0,k=d+4|0,D=d,e[k>>2]=e[r>>2],e[D>>2]=e[o>>2],e[C>>2]=e[k>>2],e[w>>2]=e[D>>2],t=P4(t,C,w,l,c,h)|0,b=d,t|0}function Qm(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0;return d=b,b=b+16|0,w=d+12|0,C=d+8|0,k=d+4|0,D=d,e[k>>2]=e[r>>2],e[D>>2]=e[o>>2],e[C>>2]=e[k>>2],e[w>>2]=e[D>>2],t=L4(t,C,w,l,c,h)|0,b=d,t|0}function Km(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0;return d=b,b=b+16|0,w=d+12|0,C=d+8|0,k=d+4|0,D=d,e[k>>2]=e[r>>2],e[D>>2]=e[o>>2],e[C>>2]=e[k>>2],e[w>>2]=e[D>>2],t=O4(t,C,w,l,c,h)|0,b=d,t|0}function Ym(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0;return d=b,b=b+16|0,w=d+12|0,C=d+8|0,k=d+4|0,D=d,e[k>>2]=e[r>>2],e[D>>2]=e[o>>2],e[C>>2]=e[k>>2],e[w>>2]=e[D>>2],t=$4(t,C,w,l,c,h)|0,b=d,t|0}function jm(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0;return d=b,b=b+16|0,w=d+12|0,C=d+8|0,k=d+4|0,D=d,e[k>>2]=e[r>>2],e[D>>2]=e[o>>2],e[C>>2]=e[k>>2],e[w>>2]=e[D>>2],t=B4(t,C,w,l,c,h)|0,b=d,t|0}function Xm(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0;return d=b,b=b+16|0,w=d+12|0,C=d+8|0,k=d+4|0,D=d,e[k>>2]=e[r>>2],e[D>>2]=e[o>>2],e[C>>2]=e[k>>2],e[w>>2]=e[D>>2],t=V4(t,C,w,l,c,h)|0,b=d,t|0}function Zm(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0;return d=b,b=b+16|0,w=d+12|0,C=d+8|0,k=d+4|0,D=d,e[k>>2]=e[r>>2],e[D>>2]=e[o>>2],e[C>>2]=e[k>>2],e[w>>2]=e[D>>2],t=U4(t,C,w,l,c,h)|0,b=d,t|0}function Jm(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0,ce=0,ke=0,Ee=0;oe=b,b=b+240|0,$=oe,_=oe+208|0,ce=oe+32|0,t=oe+28|0,ne=oe+16|0,G=oe+12|0,Q=oe+48|0,K=oe+8|0,U=oe+4|0,e[ce>>2]=0,e[ce+4>>2]=0,e[ce+8>>2]=0,g=0,l=ge(68,l|0)|0,R=g,g=0;do if(R&1)t=j()|0;else{if(e[t>>2]=l,g=0,t=be(37,t|0,44220)|0,R=g,g=0,!(R&1)&&(g=0,Pe(e[(e[t>>2]|0)+32>>2]|0,t|0,57498,57524,_|0)|0,R=g,g=0,!(R&1))){Bt(l)|0,e[ne>>2]=0,e[ne+4>>2]=0,e[ne+8>>2]=0,S[ne>>0]&1?t=(e[ne>>2]&-2)+-1|0:t=10,g=0,xe(8,ne|0,t|0,0),R=g,g=0;e:do if(R&1)ke=30;else{N=ne+8|0,R=ne+1|0,l=S[ne>>0]&1?e[N>>2]|0:R,e[G>>2]=l,e[K>>2]=Q,e[U>>2]=0,k=ne+4|0,t=e[r>>2]|0;t:for(;;){if(t){if((e[t+12>>2]|0)==(e[t+16>>2]|0)){if(g=0,d=ge(e[(e[t>>2]|0)+36>>2]|0,t|0)|0,D=g,g=0,D&1){ke=29;break}(d|0)==-1&&(e[r>>2]=0,t=0)}}else t=0;w=(t|0)==0,d=e[o>>2]|0;do if(d){if((e[d+12>>2]|0)!=(e[d+16>>2]|0)){if(w)break;break t}if(g=0,C=ge(e[(e[d>>2]|0)+36>>2]|0,d|0)|0,D=g,g=0,D&1){ke=29;break t}if((C|0)!=-1){if(w)break;break t}else{e[o>>2]=0,ke=19;break}}else ke=19;while(!1);if((ke|0)==19)if(ke=0,w){d=0;break}else d=0;if(w=S[ne>>0]|0,w=w&1?e[k>>2]|0:(w&255)>>>1,(e[G>>2]|0)==(l+w|0)){if(g=0,xe(8,ne|0,w<<1|0,0),D=g,g=0,D&1){ke=29;break}if(S[ne>>0]&1?l=(e[ne>>2]&-2)+-1|0:l=10,g=0,xe(8,ne|0,l|0,0),D=g,g=0,D&1){ke=29;break}l=S[ne>>0]&1?e[N>>2]|0:R,e[G>>2]=l+w}if(C=t+12|0,w=e[C>>2]|0,D=t+16|0,(w|0)==(e[D>>2]|0)){if(g=0,w=ge(e[(e[t>>2]|0)+36>>2]|0,t|0)|0,Ee=g,g=0,Ee&1){ke=29;break}}else w=F[w>>0]|0;if(_i(w&255,16,l,G,U,0,ce,Q,K,_)|0)break;if(d=e[C>>2]|0,(d|0)==(e[D>>2]|0))if(g=0,ge(e[(e[t>>2]|0)+40>>2]|0,t|0)|0,Ee=g,g=0,Ee&1){ke=29;break}else continue;else{e[C>>2]=d+1;continue}}if((ke|0)==29){t=j()|0;break}if(g=0,xe(8,ne|0,(e[G>>2]|0)-l|0,0),Ee=g,g=0,!(Ee&1)&&(P=S[ne>>0]|0,O=e[N>>2]|0,g=0,Z=Ce(3)|0,Ee=g,g=0,!(Ee&1))&&(g=0,e[$>>2]=h,ie=Pe(16,(P&1?O:R)|0,Z|0,58882,$|0)|0,Ee=g,g=0,!(Ee&1))){if((ie|0)!=1&&(e[c>>2]=4),t){if((e[t+12>>2]|0)==(e[t+16>>2]|0)){if(g=0,l=ge(e[(e[t>>2]|0)+36>>2]|0,t|0)|0,Ee=g,g=0,Ee&1){ke=30;break}(l|0)==-1&&(e[r>>2]=0,t=0)}}else t=0;l=(t|0)==0;do if(d){if((e[d+12>>2]|0)==(e[d+16>>2]|0)){if(g=0,t=ge(e[(e[d>>2]|0)+36>>2]|0,d|0)|0,Ee=g,g=0,Ee&1){ke=30;break e}if((t|0)==-1){e[o>>2]=0,ke=55;break}}l||(ke=56)}else ke=55;while(!1);return(ke|0)==55&&l&&(ke=56),(ke|0)==56&&(e[c>>2]=e[c>>2]|2),Ee=e[r>>2]|0,de(ne),de(ce),b=oe,Ee|0}else ke=30}while(!1);(ke|0)==30&&(t=j()|0),de(ne);break}t=j()|0,Bt(l)|0}while(!1);return de(ce),le(t|0),0}function _i(t,r,o,l,c,h,d,w,C,D){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0,w=w|0,C=C|0,D=D|0;var k=0,N=0,R=0,_=0;R=e[l>>2]|0,_=(R|0)==(o|0);do if(_){if(k=(S[D+24>>0]|0)==t<<24>>24,!k&&(S[D+25>>0]|0)!=t<<24>>24){N=5;break}e[l>>2]=o+1,S[o>>0]=k?43:45,e[c>>2]=0,k=0}else N=5;while(!1);e:do if((N|0)==5){if(N=S[d>>0]|0,t<<24>>24==h<<24>>24&&(N&1?e[d+4>>2]|0:(N&255)>>>1)|0){if(k=e[C>>2]|0,(k-w|0)>=160){k=0;break}r=e[c>>2]|0,e[C>>2]=k+4,e[k>>2]=r,e[c>>2]=0,k=0;break}for(d=D+26|0,k=D;(S[k>>0]|0)!=t<<24>>24;)if(k=k+1|0,(k|0)==(d|0)){k=d;break}if(k=k-D|0,(k|0)>23)k=-1;else{switch(r|0){case 10:case 8:{if((k|0)>=(r|0)){k=-1;break e}break}case 16:{if((k|0)>=22){if(_){k=-1;break e}if((R-o|0)>=3){k=-1;break e}if((S[R+-1>>0]|0)!=48){k=-1;break e}e[c>>2]=0,k=S[57498+k>>0]|0,e[l>>2]=R+1,S[R>>0]=k,k=0;break e}break}default:}k=S[57498+k>>0]|0,e[l>>2]=R+1,S[R>>0]=k,e[c>>2]=(e[c>>2]|0)+1,k=0}}while(!1);return k|0}function b0(){var t=0,r=0;do if(!(S[1968]|0)&&kt(1968)|0)if(g=0,t=Ve(31,2147483647,58885,0)|0,r=g,g=0,r&1)r=j()|0,W0(1968),le(r|0);else{e[11196]=t,bt(1968);break}while(!1);return e[11196]|0}function eg(t){t=t|0}function tg(t){t=t|0,he(t)}function ig(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0;U=b,b=b+64|0,R=U+56|0,d=U+52|0,k=U+48|0,w=U+44|0,C=U+40|0,D=U+36|0,N=U+32|0,Q=U+8|0,_=U;e:do if(e[l+4>>2]&1){d=f0(l)|0,e[D>>2]=d,g=0,t=be(37,D|0,44212)|0,k=g,g=0;do if(k&1)Q=j()|0,Bt(d)|0,d=Q;else{if(Bt(d)|0,d=f0(l)|0,e[N>>2]=d,g=0,C=be(37,N|0,44368)|0,N=g,g=0,N&1){Q=j()|0,Bt(d)|0,d=Q;break}if(Bt(d)|0,g=0,Ae(e[(e[C>>2]|0)+24>>2]|0,Q|0,C|0),N=g,g=0,N&1)w=Q;else if(w=Q+12|0,g=0,Ae(e[(e[C>>2]|0)+28>>2]|0,w|0,C|0),N=g,g=0,!(N&1))if(e[_>>2]=e[o>>2],g=0,e[R>>2]=e[_>>2],d=vt(8,r|0,R|0,Q|0,Q+24|0,t|0,c|0,1)|0,c=g,g=0,c&1){d=j()|0,Pt(Q+12|0),Pt(Q);break}else{S[h>>0]=(d|0)==(Q|0)&1,d=e[r>>2]|0,Pt(Q+12|0),Pt(Q);break e}if(d=j()|0,C=ye,(Q|0)!=(w|0))do w=w+-12|0,Pt(w);while((w|0)!=(Q|0))}while(!1);le(d|0)}else switch(e[k>>2]=-1,Q=e[(e[t>>2]|0)+16>>2]|0,e[w>>2]=e[r>>2],e[C>>2]=e[o>>2],e[d>>2]=e[w>>2],e[R>>2]=e[C>>2],d=on[Q&63](t,d,R,l,c,k)|0,e[r>>2]=d,e[k>>2]|0){case 0:{S[h>>0]=0;break e}case 1:{S[h>>0]=1;break e}default:{S[h>>0]=1,e[c>>2]=4;break e}}while(!1);return b=U,d|0}function ng(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0;return d=b,b=b+16|0,w=d+12|0,C=d+8|0,k=d+4|0,D=d,e[k>>2]=e[r>>2],e[D>>2]=e[o>>2],e[C>>2]=e[k>>2],e[w>>2]=e[D>>2],t=G4(t,C,w,l,c,h)|0,b=d,t|0}function rg(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0;return d=b,b=b+16|0,w=d+12|0,C=d+8|0,k=d+4|0,D=d,e[k>>2]=e[r>>2],e[D>>2]=e[o>>2],e[C>>2]=e[k>>2],e[w>>2]=e[D>>2],t=q4(t,C,w,l,c,h)|0,b=d,t|0}function sg(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0;return d=b,b=b+16|0,w=d+12|0,C=d+8|0,k=d+4|0,D=d,e[k>>2]=e[r>>2],e[D>>2]=e[o>>2],e[C>>2]=e[k>>2],e[w>>2]=e[D>>2],t=W4(t,C,w,l,c,h)|0,b=d,t|0}function og(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0;return d=b,b=b+16|0,w=d+12|0,C=d+8|0,k=d+4|0,D=d,e[k>>2]=e[r>>2],e[D>>2]=e[o>>2],e[C>>2]=e[k>>2],e[w>>2]=e[D>>2],t=H4(t,C,w,l,c,h)|0,b=d,t|0}function ag(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0;return d=b,b=b+16|0,w=d+12|0,C=d+8|0,k=d+4|0,D=d,e[k>>2]=e[r>>2],e[D>>2]=e[o>>2],e[C>>2]=e[k>>2],e[w>>2]=e[D>>2],t=Q4(t,C,w,l,c,h)|0,b=d,t|0}function lg(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0;return d=b,b=b+16|0,w=d+12|0,C=d+8|0,k=d+4|0,D=d,e[k>>2]=e[r>>2],e[D>>2]=e[o>>2],e[C>>2]=e[k>>2],e[w>>2]=e[D>>2],t=K4(t,C,w,l,c,h)|0,b=d,t|0}function ug(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0;return d=b,b=b+16|0,w=d+12|0,C=d+8|0,k=d+4|0,D=d,e[k>>2]=e[r>>2],e[D>>2]=e[o>>2],e[C>>2]=e[k>>2],e[w>>2]=e[D>>2],t=Y4(t,C,w,l,c,h)|0,b=d,t|0}function cg(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0;return d=b,b=b+16|0,w=d+12|0,C=d+8|0,k=d+4|0,D=d,e[k>>2]=e[r>>2],e[D>>2]=e[o>>2],e[C>>2]=e[k>>2],e[w>>2]=e[D>>2],t=j4(t,C,w,l,c,h)|0,b=d,t|0}function fg(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0;return d=b,b=b+16|0,w=d+12|0,C=d+8|0,k=d+4|0,D=d,e[k>>2]=e[r>>2],e[D>>2]=e[o>>2],e[C>>2]=e[k>>2],e[w>>2]=e[D>>2],t=X4(t,C,w,l,c,h)|0,b=d,t|0}function hg(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0,ce=0,ke=0,Ee=0;oe=b,b=b+320|0,$=oe,_=oe+208|0,ce=oe+32|0,t=oe+28|0,ne=oe+16|0,G=oe+12|0,Q=oe+48|0,K=oe+8|0,U=oe+4|0,e[ce>>2]=0,e[ce+4>>2]=0,e[ce+8>>2]=0,g=0,l=ge(68,l|0)|0,R=g,g=0;do if(R&1)t=j()|0;else{if(e[t>>2]=l,g=0,t=be(37,t|0,44212)|0,R=g,g=0,!(R&1)&&(g=0,Pe(e[(e[t>>2]|0)+48>>2]|0,t|0,57498,57524,_|0)|0,R=g,g=0,!(R&1))){Bt(l)|0,e[ne>>2]=0,e[ne+4>>2]=0,e[ne+8>>2]=0,S[ne>>0]&1?t=(e[ne>>2]&-2)+-1|0:t=10,g=0,xe(8,ne|0,t|0,0),R=g,g=0;e:do if(R&1)ke=31;else{N=ne+8|0,R=ne+1|0,t=S[ne>>0]&1?e[N>>2]|0:R,e[G>>2]=t,e[K>>2]=Q,e[U>>2]=0,k=ne+4|0,d=e[r>>2]|0;t:for(;;){if(d){if(l=e[d+12>>2]|0,(l|0)==(e[d+16>>2]|0)){if(g=0,l=ge(e[(e[d>>2]|0)+36>>2]|0,d|0)|0,D=g,g=0,D&1){ke=30;break}}else l=e[l>>2]|0;(l|0)==-1?(e[r>>2]=0,l=0,w=1):(l=d,w=0)}else l=0,w=1;C=e[o>>2]|0;do if(C){if(d=e[C+12>>2]|0,(d|0)==(e[C+16>>2]|0)){if(g=0,d=ge(e[(e[C>>2]|0)+36>>2]|0,C|0)|0,D=g,g=0,D&1){ke=30;break t}}else d=e[d>>2]|0;if((d|0)!=-1)if(w){d=C;break}else{d=C;break t}else{e[o>>2]=0,ke=20;break}}else ke=20;while(!1);if((ke|0)==20)if(ke=0,w){d=0;break}else d=0;if(w=S[ne>>0]|0,w=w&1?e[k>>2]|0:(w&255)>>>1,(e[G>>2]|0)==(t+w|0)){if(g=0,xe(8,ne|0,w<<1|0,0),D=g,g=0,D&1){ke=30;break}if(S[ne>>0]&1?t=(e[ne>>2]&-2)+-1|0:t=10,g=0,xe(8,ne|0,t|0,0),D=g,g=0,D&1){ke=30;break}t=S[ne>>0]&1?e[N>>2]|0:R,e[G>>2]=t+w}if(C=l+12|0,w=e[C>>2]|0,D=l+16|0,(w|0)==(e[D>>2]|0)){if(g=0,w=ge(e[(e[l>>2]|0)+36>>2]|0,l|0)|0,Ee=g,g=0,Ee&1){ke=30;break}}else w=e[w>>2]|0;if(Pi(w,16,t,G,U,0,ce,Q,K,_)|0)break;if(d=e[C>>2]|0,(d|0)==(e[D>>2]|0))if(g=0,ge(e[(e[l>>2]|0)+40>>2]|0,l|0)|0,Ee=g,g=0,Ee&1){ke=30;break}else{d=l;continue}else{e[C>>2]=d+4,d=l;continue}}if((ke|0)==30){t=j()|0;break}if(g=0,xe(8,ne|0,(e[G>>2]|0)-t|0,0),Ee=g,g=0,!(Ee&1)&&(P=S[ne>>0]|0,O=e[N>>2]|0,g=0,Z=Ce(3)|0,Ee=g,g=0,!(Ee&1))&&(g=0,e[$>>2]=h,ie=Pe(16,(P&1?O:R)|0,Z|0,58882,$|0)|0,Ee=g,g=0,!(Ee&1))){if((ie|0)!=1&&(e[c>>2]=4),l){if(t=e[l+12>>2]|0,(t|0)==(e[l+16>>2]|0)){if(g=0,t=ge(e[(e[l>>2]|0)+36>>2]|0,l|0)|0,Ee=g,g=0,Ee&1){ke=31;break}}else t=e[t>>2]|0;(t|0)==-1?(e[r>>2]=0,l=1):l=0}else l=1;do if(d){if(t=e[d+12>>2]|0,(t|0)==(e[d+16>>2]|0)){if(g=0,t=ge(e[(e[d>>2]|0)+36>>2]|0,d|0)|0,Ee=g,g=0,Ee&1){ke=31;break e}}else t=e[t>>2]|0;if((t|0)!=-1){if(l)break;ke=59;break}else{e[o>>2]=0,ke=57;break}}else ke=57;while(!1);return(ke|0)==57&&l&&(ke=59),(ke|0)==59&&(e[c>>2]=e[c>>2]|2),Ee=e[r>>2]|0,de(ne),de(ce),b=oe,Ee|0}else ke=31}while(!1);(ke|0)==31&&(t=j()|0),de(ne);break}t=j()|0,Bt(l)|0}while(!1);return de(ce),le(t|0),0}function Pi(t,r,o,l,c,h,d,w,C,D){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0,w=w|0,C=C|0,D=D|0;var k=0,N=0,R=0,_=0;R=e[l>>2]|0,_=(R|0)==(o|0);do if(_){if(k=(e[D+96>>2]|0)==(t|0),!k&&(e[D+100>>2]|0)!=(t|0)){N=5;break}e[l>>2]=o+1,S[o>>0]=k?43:45,e[c>>2]=0,k=0}else N=5;while(!1);e:do if((N|0)==5){if(N=S[d>>0]|0,(t|0)==(h|0)&&(N&1?e[d+4>>2]|0:(N&255)>>>1)|0){if(k=e[C>>2]|0,(k-w|0)>=160){k=0;break}r=e[c>>2]|0,e[C>>2]=k+4,e[k>>2]=r,e[c>>2]=0,k=0;break}for(d=D+104|0,k=D;(e[k>>2]|0)!=(t|0);)if(k=k+4|0,(k|0)==(d|0)){k=d;break}if(k=k-D|0,d=k>>2,(k|0)>92)k=-1;else{switch(r|0){case 10:case 8:{if((d|0)>=(r|0)){k=-1;break e}break}case 16:{if((k|0)>=88){if(_){k=-1;break e}if((R-o|0)>=3){k=-1;break e}if((S[R+-1>>0]|0)!=48){k=-1;break e}e[c>>2]=0,k=S[57498+d>>0]|0,e[l>>2]=R+1,S[R>>0]=k,k=0;break e}break}default:}k=S[57498+d>>0]|0,e[l>>2]=R+1,S[R>>0]=k,e[c>>2]=(e[c>>2]|0)+1,k=0}}while(!1);return k|0}function qi(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0,D=0;if(C=b,b=b+16|0,w=C,r=f0(r)|0,e[w>>2]=r,g=0,c=be(37,w|0,44220)|0,D=g,g=0,!(D&1)&&(g=0,Pe(e[(e[c>>2]|0)+32>>2]|0,c|0,57498,57524,o|0)|0,D=g,g=0,!(D&1))&&(g=0,d=be(37,w|0,44360)|0,D=g,g=0,!(D&1))&&(g=0,h=ge(e[(e[d>>2]|0)+16>>2]|0,d|0)|0,D=g,g=0,!(D&1))&&(S[l>>0]=h,g=0,Ae(e[(e[d>>2]|0)+20>>2]|0,t|0,d|0),D=g,g=0,!(D&1))){Bt(r)|0,b=C;return}D=j()|0,Bt(r)|0,le(D|0)}function Ar(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0;if(k=b,b=b+16|0,D=k,r=f0(r)|0,e[D>>2]=r,g=0,h=be(37,D|0,44220)|0,N=g,g=0,!(N&1)&&(g=0,Pe(e[(e[h>>2]|0)+32>>2]|0,h|0,57498,57530,o|0)|0,N=g,g=0,!(N&1))&&(g=0,C=be(37,D|0,44360)|0,N=g,g=0,!(N&1))&&(g=0,d=ge(e[(e[C>>2]|0)+12>>2]|0,C|0)|0,N=g,g=0,!(N&1))&&(S[l>>0]=d,g=0,w=ge(e[(e[C>>2]|0)+16>>2]|0,C|0)|0,N=g,g=0,!(N&1))&&(S[c>>0]=w,g=0,Ae(e[(e[C>>2]|0)+20>>2]|0,t|0,C|0),N=g,g=0,!(N&1))){Bt(r)|0,b=k;return}N=j()|0,Bt(r)|0,le(N|0)}function vr(t,r,o,l,c,h,d,w,C,D,k,N){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0,w=w|0,C=C|0,D=D|0,k=k|0,N=N|0;var R=0,_=0;e:do if(t<<24>>24==h<<24>>24)S[r>>0]|0?(S[r>>0]=0,o=e[c>>2]|0,e[c>>2]=o+1,S[o>>0]=46,o=S[w>>0]|0,(o&1?e[w+4>>2]|0:(o&255)>>>1)|0&&(R=e[D>>2]|0,(R-C|0)<160)&&(C=e[k>>2]|0,e[D>>2]=R+4,e[R>>2]=C),R=0):R=-1;else{if(t<<24>>24==d<<24>>24&&(d=S[w>>0]|0,((d&1?e[w+4>>2]|0:(d&255)>>>1)|0)!=0)){if(!(S[r>>0]|0)){R=-1;break}if(R=e[D>>2]|0,(R-C|0)>=160){R=0;break}C=e[k>>2]|0,e[D>>2]=R+4,e[R>>2]=C,e[k>>2]=0,R=0;break}for(h=N+32|0,R=N;(S[R>>0]|0)!=t<<24>>24;)if(R=R+1|0,(R|0)==(h|0)){R=h;break}if(h=R-N|0,(h|0)>31)R=-1;else switch(d=S[57498+h>>0]|0,h|0){case 24:case 25:{if(R=e[c>>2]|0,(R|0)!=(l|0)&&(F[R+-1>>0]&95|0)!=(F[o>>0]&127|0)){R=-1;break e}e[c>>2]=R+1,S[R>>0]=d,R=0;break e}case 23:case 22:{S[o>>0]=80,R=e[c>>2]|0,e[c>>2]=R+1,S[R>>0]=d,R=0;break e}default:{if(R=d&95,(R|0)==(S[o>>0]|0)&&(S[o>>0]=R|128,(S[r>>0]|0)!=0)&&(S[r>>0]=0,o=S[w>>0]|0,((o&1?e[w+4>>2]|0:(o&255)>>>1)|0)!=0)&&(_=e[D>>2]|0,(_-C|0)<160)&&(C=e[k>>2]|0,e[D>>2]=_+4,e[_>>2]=C),D=e[c>>2]|0,e[c>>2]=D+1,S[D>>0]=d,(h|0)>21){R=0;break e}e[k>>2]=(e[k>>2]|0)+1,R=0;break e}}}while(!1);return R|0}function Wi(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0,D=0;if(C=b,b=b+16|0,w=C,r=f0(r)|0,e[w>>2]=r,g=0,c=be(37,w|0,44212)|0,D=g,g=0,!(D&1)&&(g=0,Pe(e[(e[c>>2]|0)+48>>2]|0,c|0,57498,57524,o|0)|0,D=g,g=0,!(D&1))&&(g=0,d=be(37,w|0,44368)|0,D=g,g=0,!(D&1))&&(g=0,h=ge(e[(e[d>>2]|0)+16>>2]|0,d|0)|0,D=g,g=0,!(D&1))&&(e[l>>2]=h,g=0,Ae(e[(e[d>>2]|0)+20>>2]|0,t|0,d|0),D=g,g=0,!(D&1))){Bt(r)|0,b=C;return}D=j()|0,Bt(r)|0,le(D|0)}function xr(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0;if(k=b,b=b+16|0,D=k,r=f0(r)|0,e[D>>2]=r,g=0,h=be(37,D|0,44212)|0,N=g,g=0,!(N&1)&&(g=0,Pe(e[(e[h>>2]|0)+48>>2]|0,h|0,57498,57530,o|0)|0,N=g,g=0,!(N&1))&&(g=0,C=be(37,D|0,44368)|0,N=g,g=0,!(N&1))&&(g=0,d=ge(e[(e[C>>2]|0)+12>>2]|0,C|0)|0,N=g,g=0,!(N&1))&&(e[l>>2]=d,g=0,w=ge(e[(e[C>>2]|0)+16>>2]|0,C|0)|0,N=g,g=0,!(N&1))&&(e[c>>2]=w,g=0,Ae(e[(e[C>>2]|0)+20>>2]|0,t|0,C|0),N=g,g=0,!(N&1))){Bt(r)|0,b=k;return}N=j()|0,Bt(r)|0,le(N|0)}function wr(t,r,o,l,c,h,d,w,C,D,k,N){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0,w=w|0,C=C|0,D=D|0,k=k|0,N=N|0;var R=0,_=0;e:do if((t|0)==(h|0))S[r>>0]|0?(S[r>>0]=0,o=e[c>>2]|0,e[c>>2]=o+1,S[o>>0]=46,o=S[w>>0]|0,(o&1?e[w+4>>2]|0:(o&255)>>>1)|0&&(R=e[D>>2]|0,(R-C|0)<160)&&(C=e[k>>2]|0,e[D>>2]=R+4,e[R>>2]=C),R=0):R=-1;else{if((t|0)==(d|0)&&(d=S[w>>0]|0,((d&1?e[w+4>>2]|0:(d&255)>>>1)|0)!=0)){if(!(S[r>>0]|0)){R=-1;break}if(R=e[D>>2]|0,(R-C|0)>=160){R=0;break}C=e[k>>2]|0,e[D>>2]=R+4,e[R>>2]=C,e[k>>2]=0,R=0;break}for(h=N+128|0,R=N;(e[R>>2]|0)!=(t|0);)if(R=R+4|0,(R|0)==(h|0)){R=h;break}if(h=R-N|0,R=h>>2,(h|0)<=124){switch(d=S[57498+R>>0]|0,R|0){case 24:case 25:{if(R=e[c>>2]|0,(R|0)!=(l|0)&&(F[R+-1>>0]&95|0)!=(F[o>>0]&127|0)){R=-1;break e}e[c>>2]=R+1,S[R>>0]=d,R=0;break e}case 23:case 22:{S[o>>0]=80;break}default:R=d&95,(R|0)==(S[o>>0]|0)&&(S[o>>0]=R|128,(S[r>>0]|0)!=0)&&(S[r>>0]=0,o=S[w>>0]|0,((o&1?e[w+4>>2]|0:(o&255)>>>1)|0)!=0)&&(_=e[D>>2]|0,(_-C|0)<160)&&(C=e[k>>2]|0,e[D>>2]=_+4,e[_>>2]=C)}D=e[c>>2]|0,e[c>>2]=D+1,S[D>>0]=d,(h|0)>84||(e[k>>2]=(e[k>>2]|0)+1),R=0}else R=-1}while(!1);return R|0}function dg(t){t=t|0}function pg(t){t=t|0,he(t)}function mg(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0;k=b,b=b+32|0,h=k+20|0,d=k+16|0,w=k+12|0,D=k;e:do if(!(e[o+4>>2]&1))D=e[(e[t>>2]|0)+24>>2]|0,e[d>>2]=e[r>>2],e[h>>2]=e[d>>2],h=an[D&31](t,h,o,l,c&1)|0;else{h=f0(o)|0,e[w>>2]=h,g=0,d=be(37,w|0,44360)|0,C=g,g=0;t:do if(C&1)k=j()|0,Bt(h)|0,h=k;else{Bt(h)|0,h=e[d>>2]|0,c?t0[e[h+24>>2]&127](D,d):t0[e[h+28>>2]&127](D,d),t=S[D>>0]|0,C=(t&1)==0,h=D+1|0,c=D+8|0,w=C?h:D+1|0,h=C?h:e[D+8>>2]|0,C=D+4|0,o=(t&1)==0;i:do if((h|0)!=((o?w:e[c>>2]|0)+(o?(t&255)>>>1:e[C>>2]|0)|0)){n:for(;;){d=S[h>>0]|0,l=e[r>>2]|0;do if(l){if(o=l+24|0,t=e[o>>2]|0,(t|0)!=(e[l+28>>2]|0)){e[o>>2]=t+1,S[t>>0]=d;break}if(g=0,d=be(e[(e[l>>2]|0)+52>>2]|0,l|0,d&255|0)|0,t=g,g=0,t&1)break n;(d|0)==-1&&(e[r>>2]=0)}while(!1);if(h=h+1|0,t=S[D>>0]|0,o=(t&1)==0,(h|0)==((o?w:e[c>>2]|0)+(o?(t&255)>>>1:e[C>>2]|0)|0))break i}h=j()|0,de(D);break t}while(!1);h=e[r>>2]|0,de(D);break e}while(!1);le(h|0)}while(!1);return b=k,h|0}function gg(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0;if(k=b,b=b+64|0,h=k,R=k+56|0,_=k+44|0,w=k+20|0,D=k+16|0,C=k+12|0,N=k+8|0,d=k+4|0,S[R>>0]=S[58887]|0,S[R+1>>0]=S[58888]|0,S[R+2>>0]=S[58889]|0,S[R+3>>0]=S[58890]|0,S[R+4>>0]=S[58891]|0,S[R+5>>0]=S[58892]|0,ki(R+1|0,58893,1,e[o+4>>2]|0),t=b0()|0,e[h>>2]=c,c=_+(q0(_,12,t,R,h)|0)|0,R=ri(_,c,o)|0,t=f0(o)|0,e[N>>2]=t,g=0,ht(1,_|0,R|0,c|0,w|0,D|0,C|0,N|0),c=g,g=0,c&1)_=j()|0,Bt(t)|0,le(_|0);else return Bt(t)|0,e[d>>2]=e[r>>2],R=e[D>>2]|0,_=e[C>>2]|0,e[h>>2]=e[d>>2],_=Ui(h,w,R,_,o,l)|0,b=k,_|0;return 0}function ki(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0;if(l&2048&&(S[t>>0]=43,t=t+1|0),l&512&&(S[t>>0]=35,t=t+1|0),c=S[r>>0]|0,c<<24>>24)for(h=r;;)if(h=h+1|0,r=t+1|0,S[t>>0]=c,c=S[h>>0]|0,c<<24>>24)t=r;else{t=r;break}e:do switch(l&74|0){case 64:{S[t>>0]=111;break}case 8:if(l&16384){S[t>>0]=88;break e}else{S[t>>0]=120;break e}default:if(o){S[t>>0]=100;break e}else{S[t>>0]=117;break e}}while(!1)}function ri(t,r,o){t=t|0,r=r|0,o=o|0;var l=0;e:do switch(e[o+4>>2]&176|0){case 16:{switch(o=S[t>>0]|0,o<<24>>24){case 43:case 45:{t=t+1|0;break e}default:}if((r-t|0)>1&o<<24>>24==48){switch(S[t+1>>0]|0){case 88:case 120:break;default:{l=7;break e}}t=t+2|0}else l=7;break}case 32:{t=r;break}default:l=7}while(!1);return t|0}function Sg(t,r,o,l,c,h,d){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0;var w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0,G=0,$=0,P=0;G=b,b=b+16|0,$=G,Q=O0(d,44220)|0,D=O0(d,44360)|0,t0[e[(e[D>>2]|0)+20>>2]&127]($,D),_=S[$>>0]|0,U=$+4|0;e:do if(!((_&1?e[U>>2]|0:(_&255)>>>1)|0))g=0,Pe(e[(e[Q>>2]|0)+32>>2]|0,Q|0,t|0,o|0,l|0)|0,K=g,g=0,K&1?K=5:(d=l+(o-t)|0,e[h>>2]=d,K=29);else{switch(e[h>>2]=l,d=S[t>>0]|0,d<<24>>24){case 43:case 45:{if(g=0,d=be(e[(e[Q>>2]|0)+28>>2]|0,Q|0,d|0)|0,_=g,g=0,_&1){K=5;break e}C=e[h>>2]|0,e[h>>2]=C+1,S[C>>0]=d,C=t+1|0;break}default:C=t}t:do if((o-C|0)>1&&(S[C>>0]|0)==48){switch(d=C+1|0,S[d>>0]|0){case 88:case 120:break;default:break t}if(g=0,w=be(e[(e[Q>>2]|0)+28>>2]|0,Q|0,48)|0,_=g,g=0,_&1){K=5;break e}if(_=e[h>>2]|0,e[h>>2]=_+1,S[_>>0]=w,g=0,d=be(e[(e[Q>>2]|0)+28>>2]|0,Q|0,S[d>>0]|0)|0,_=g,g=0,_&1){K=5;break e}_=e[h>>2]|0,e[h>>2]=_+1,S[_>>0]=d,C=C+2|0}while(!1);if((C|0)!=(o|0)&&(k=o+-1|0,C>>>0>>0)){w=C,d=k;do _=S[w>>0]|0,S[w>>0]=S[d>>0]|0,S[d>>0]=_,w=w+1|0,d=d+-1|0;while(w>>>0>>0)}if(g=0,k=ge(e[(e[D>>2]|0)+16>>2]|0,D|0)|0,_=g,g=0,_&1)K=5;else{N=$+8|0,R=$+1|0;t:do if(C>>>0>>0){for(d=0,w=0,_=C;D=S[(S[$>>0]&1?e[N>>2]|0:R)+w>>0]|0,D<<24>>24!=0&(d|0)==(D<<24>>24|0)?(d=e[h>>2]|0,e[h>>2]=d+1,S[d>>0]=k,d=S[$>>0]|0,D=0,w=(w>>>0<((d&1?e[U>>2]|0:(d&255)>>>1)+-1|0)>>>0&1)+w|0):D=d,g=0,d=be(e[(e[Q>>2]|0)+28>>2]|0,Q|0,S[_>>0]|0)|0,P=g,g=0,!(P&1);){if(P=e[h>>2]|0,e[h>>2]=P+1,S[P>>0]=d,_=_+1|0,_>>>0>=o>>>0)break t;d=D+1|0}d=j()|0;break e}while(!1);if(w=t,d=l+(C-w)|0,t=e[h>>2]|0,(d|0)==(t|0))t=w,K=29;else{if(t=t+-1|0,d>>>0>>0)do P=S[d>>0]|0,S[d>>0]=S[t>>0]|0,S[t>>0]=P,d=d+1|0,t=t+-1|0;while(d>>>0>>0);t=w,d=e[h>>2]|0,K=29}}}while(!1);if((K|0)==5)d=j()|0;else if((K|0)==29){e[c>>2]=(r|0)==(o|0)?d:l+(r-t)|0,de($),b=G;return}de($),le(d|0)}function Ag(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0;if(N=b,b=b+96|0,d=N+8|0,t=N,_=N+74|0,C=N+32|0,k=N+28|0,D=N+24|0,R=N+20|0,w=N+16|0,U=t,e[U>>2]=37,e[U+4>>2]=0,ki(t+1|0,58895,1,e[o+4>>2]|0),U=b0()|0,Q=d,e[Q>>2]=c,e[Q+4>>2]=h,h=_+(q0(_,22,U,t,d)|0)|0,c=ri(_,h,o)|0,t=f0(o)|0,e[R>>2]=t,g=0,ht(1,_|0,c|0,h|0,C|0,k|0,D|0,R|0),h=g,g=0,h&1)Q=j()|0,Bt(t)|0,le(Q|0);else return Bt(t)|0,e[w>>2]=e[r>>2],U=e[k>>2]|0,Q=e[D>>2]|0,e[d>>2]=e[w>>2],Q=Ui(d,C,U,Q,o,l)|0,b=N,Q|0;return 0}function vg(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0;if(k=b,b=b+64|0,h=k,R=k+56|0,_=k+44|0,w=k+20|0,D=k+16|0,C=k+12|0,N=k+8|0,d=k+4|0,S[R>>0]=S[58887]|0,S[R+1>>0]=S[58888]|0,S[R+2>>0]=S[58889]|0,S[R+3>>0]=S[58890]|0,S[R+4>>0]=S[58891]|0,S[R+5>>0]=S[58892]|0,ki(R+1|0,58893,0,e[o+4>>2]|0),t=b0()|0,e[h>>2]=c,c=_+(q0(_,12,t,R,h)|0)|0,R=ri(_,c,o)|0,t=f0(o)|0,e[N>>2]=t,g=0,ht(1,_|0,R|0,c|0,w|0,D|0,C|0,N|0),c=g,g=0,c&1)_=j()|0,Bt(t)|0,le(_|0);else return Bt(t)|0,e[d>>2]=e[r>>2],R=e[D>>2]|0,_=e[C>>2]|0,e[h>>2]=e[d>>2],_=Ui(h,w,R,_,o,l)|0,b=k,_|0;return 0}function xg(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0;if(N=b,b=b+112|0,d=N+8|0,t=N,_=N+75|0,C=N+32|0,k=N+28|0,D=N+24|0,R=N+20|0,w=N+16|0,U=t,e[U>>2]=37,e[U+4>>2]=0,ki(t+1|0,58895,0,e[o+4>>2]|0),U=b0()|0,Q=d,e[Q>>2]=c,e[Q+4>>2]=h,h=_+(q0(_,23,U,t,d)|0)|0,c=ri(_,h,o)|0,t=f0(o)|0,e[R>>2]=t,g=0,ht(1,_|0,c|0,h|0,C|0,k|0,D|0,R|0),h=g,g=0,h&1)Q=j()|0,Bt(t)|0,le(Q|0);else return Bt(t)|0,e[w>>2]=e[r>>2],U=e[k>>2]|0,Q=e[D>>2]|0,e[d>>2]=e[w>>2],Q=Ui(d,C,U,Q,o,l)|0,b=N,Q|0;return 0}function wg(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=+c;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0;Z=b,b=b+176|0,K=Z+84|0,R=Z+48|0,N=Z+32|0,C=Z+24|0,h=Z+8|0,k=Z,U=Z+88|0,Q=Z+80|0,w=Z+118|0,O=Z+76|0,P=Z+72|0,G=Z+68|0,$=Z+64|0,D=k,e[D>>2]=37,e[D+4>>2]=0,D=gn(k+1|0,58898,e[o+4>>2]|0)|0,e[Q>>2]=U,t=b0()|0,D?(e[h>>2]=e[o+8>>2],B[h+8>>3]=c,h=q0(U,30,t,k,h)|0):(B[C>>3]=c,h=q0(U,30,t,k,C)|0);e:do if((h|0)>29){g=0,t=Ce(3)|0,h=g,g=0,h=h&1,D?!h&&(g=0,e[N>>2]=e[o+8>>2],B[N+8>>3]=c,d=Pe(17,Q|0,t|0,k|0,N|0)|0,_=g,g=0,!(_&1))&&(ie=12):!h&&(g=0,e[R>>2]=e[o+8>>2],B[R+8>>3]=c,_=Pe(17,Q|0,t|0,k|0,R|0)|0,R=g,g=0,!(R&1))&&(d=_,ie=12);do if((ie|0)==12){if(t=e[Q>>2]|0,t)h=t;else{if(g=0,Nt(6),_=g,g=0,_&1)break;h=e[Q>>2]|0}t=h,k=h,ie=16;break e}while(!1);t=j()|0}else t=e[Q>>2]|0,k=0,d=h,ie=16;while(!1);if((ie|0)==16){C=t+d|0,D=ri(t,C,o)|0;do if((t|0)==(U|0))t=U,h=0,ie=22;else{if(d=E0(d<<1)|0,!d){if(g=0,Nt(6),ie=g,g=0,ie&1){h=0,ie=20;break}t=e[Q>>2]|0}h=d,w=d,ie=22}while(!1);do if((ie|0)==22)if(g=0,d=ge(68,o|0)|0,Q=g,g=0,Q&1)ie=20;else{if(e[G>>2]=d,g=0,ht(2,t|0,D|0,C|0,w|0,O|0,P|0,G|0),G=g,g=0,G&1){t=j()|0,Bt(d)|0;break}if(Bt(d)|0,e[$>>2]=e[r>>2],ie=e[O>>2]|0,t=e[P>>2]|0,g=0,e[K>>2]=e[$>>2],t=Vt(39,K|0,w|0,ie|0,t|0,o|0,l|0)|0,ie=g,g=0,ie&1)ie=20;else return e[r>>2]=t,h&&n0(h),k&&n0(k),b=Z,t|0}while(!1);(ie|0)==20&&(t=j()|0),h&&n0(h),k&&n0(k)}return le(t|0),0}function gn(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0,w=0;if(o&2048&&(S[t>>0]=43,t=t+1|0),o&1024&&(S[t>>0]=35,t=t+1|0),d=o&260,c=o>>>14,w=(d|0)==260,w?h=0:(S[t>>0]=46,S[t+1>>0]=42,t=t+2|0,h=1),o=S[r>>0]|0,o<<24>>24)for(l=t;r=r+1|0,t=l+1|0,S[l>>0]=o,o=S[r>>0]|0,o<<24>>24;)l=t;e:do switch(d|0){case 4:if(c&1){S[t>>0]=70;break e}else{S[t>>0]=102;break e}case 256:if(c&1){S[t>>0]=69;break e}else{S[t>>0]=101;break e}default:if(o=(c&1|0)!=0,w)if(o){S[t>>0]=65;break e}else{S[t>>0]=97;break e}else if(o){S[t>>0]=71;break e}else{S[t>>0]=103;break e}}while(!1);return h|0}function yg(t,r,o,l,c,h,d){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0;var w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0;switch(Z=b,b=b+16|0,ie=Z,O=O0(d,44220)|0,$=O0(d,44360)|0,t0[e[(e[$>>2]|0)+20>>2]&127](ie,$),e[h>>2]=l,d=S[t>>0]|0,d<<24>>24){case 43:case 45:{g=0,d=be(e[(e[O>>2]|0)+28>>2]|0,O|0,d|0)|0,P=g,g=0,P&1?G=8:(k=e[h>>2]|0,e[h>>2]=k+1,S[k>>0]=d,k=t+1|0,G=10);break}default:k=t,G=10}e:do if((G|0)==10){P=o;t:do if((P-k|0)>1&&(S[k>>0]|0)==48){switch(C=k+1|0,S[C>>0]|0){case 88:case 120:break;default:{G=11;break t}}if(g=0,d=be(e[(e[O>>2]|0)+28>>2]|0,O|0,48)|0,K=g,g=0,K&1){G=8;break e}if(K=e[h>>2]|0,e[h>>2]=K+1,S[K>>0]=d,k=k+2|0,g=0,d=be(e[(e[O>>2]|0)+28>>2]|0,O|0,S[C>>0]|0)|0,K=g,g=0,K&1){G=8;break e}if(K=e[h>>2]|0,e[h>>2]=K+1,S[K>>0]=d,k>>>0>>0){for(d=k;C=S[d>>0]|0,g=0,D=Ce(3)|0,K=g,g=0,!(K&1||(g=0,C=be(39,C<<24>>24|0,D|0)|0,K=g,g=0,K&1));){if(!C){K=k;break t}if(d=d+1|0,d>>>0>=o>>>0){K=k;break t}}d=j()|0;break e}else K=k,d=k}else G=11;while(!1);t:do if((G|0)==11)if(k>>>0>>0){for(d=k;C=S[d>>0]|0,g=0,D=Ce(3)|0,K=g,g=0,!(K&1||(g=0,C=be(40,C<<24>>24|0,D|0)|0,K=g,g=0,K&1));){if(!C){K=k;break t}if(d=d+1|0,d>>>0>=o>>>0){K=k;break t}}d=j()|0;break e}else K=k,d=k;while(!1);if(U=S[ie>>0]|0,Q=ie+4|0,(U&1?e[Q>>2]|0:(U&255)>>>1)|0){if((K|0)!=(d|0)&&(N=d+-1|0,K>>>0>>0)){D=K,C=N;do U=S[D>>0]|0,S[D>>0]=S[C>>0]|0,S[C>>0]=U,D=D+1|0,C=C+-1|0;while(D>>>0>>0)}if(g=0,N=ge(e[(e[$>>2]|0)+16>>2]|0,$|0)|0,U=g,g=0,U&1){G=8;break}R=ie+8|0,_=ie+1|0;t:do if(K>>>0>>0){for(C=0,D=0,U=K;k=S[(S[ie>>0]&1?e[R>>2]|0:_)+D>>0]|0,k<<24>>24>0&(C|0)==(k<<24>>24|0)?(C=e[h>>2]|0,e[h>>2]=C+1,S[C>>0]=N,C=S[ie>>0]|0,k=0,D=(D>>>0<((C&1?e[Q>>2]|0:(C&255)>>>1)+-1|0)>>>0&1)+D|0):k=C,g=0,C=be(e[(e[O>>2]|0)+28>>2]|0,O|0,S[U>>0]|0)|0,oe=g,g=0,!(oe&1);){if(oe=e[h>>2]|0,e[h>>2]=oe+1,S[oe>>0]=C,U=U+1|0,U>>>0>=d>>>0)break t;C=k+1|0}d=j()|0;break e}while(!1);if(C=l+(K-t)|0,D=e[h>>2]|0,(C|0)!=(D|0)&&(w=D+-1|0,C>>>0>>0)){do oe=S[C>>0]|0,S[C>>0]=S[w>>0]|0,S[w>>0]=oe,C=C+1|0,w=w+-1|0;while(C>>>0>>0);C=O}else C=O}else{if(g=0,Pe(e[(e[O>>2]|0)+32>>2]|0,O|0,K|0,d|0,e[h>>2]|0)|0,oe=g,g=0,oe&1){G=8;break}e[h>>2]=(e[h>>2]|0)+(d-K),C=O}t:do if(d>>>0>>0){for(;w=S[d>>0]|0,w<<24>>24!=46;){if(g=0,w=be(e[(e[C>>2]|0)+28>>2]|0,O|0,w|0)|0,oe=g,g=0,oe&1){G=4;break}if(oe=e[h>>2]|0,e[h>>2]=oe+1,S[oe>>0]=w,d=d+1|0,d>>>0>=o>>>0)break t}if((G|0)==4){d=j()|0;break e}if(g=0,w=ge(e[(e[$>>2]|0)+12>>2]|0,$|0)|0,oe=g,g=0,oe&1){G=8;break e}oe=e[h>>2]|0,e[h>>2]=oe+1,S[oe>>0]=w,d=d+1|0}while(!1);if(g=0,Pe(e[(e[O>>2]|0)+32>>2]|0,O|0,d|0,o|0,e[h>>2]|0)|0,oe=g,g=0,oe&1)G=8;else{oe=(e[h>>2]|0)+(P-d)|0,e[h>>2]=oe,e[c>>2]=(r|0)==(o|0)?oe:l+(r-t)|0,de(ie),b=Z;return}}while(!1);(G|0)==8&&(d=j()|0),de(ie),le(d|0)}function Cg(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=+c;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0;Z=b,b=b+176|0,K=Z+76|0,R=Z+48|0,N=Z+32|0,C=Z+24|0,h=Z+8|0,k=Z,U=Z+80|0,Q=Z+72|0,w=Z+110|0,O=Z+68|0,P=Z+64|0,G=Z+60|0,$=Z+56|0,D=k,e[D>>2]=37,e[D+4>>2]=0,D=gn(k+1|0,58899,e[o+4>>2]|0)|0,e[Q>>2]=U,t=b0()|0,D?(e[h>>2]=e[o+8>>2],B[h+8>>3]=c,h=q0(U,30,t,k,h)|0):(B[C>>3]=c,h=q0(U,30,t,k,C)|0);e:do if((h|0)>29){g=0,t=Ce(3)|0,h=g,g=0,h=h&1,D?!h&&(g=0,e[N>>2]=e[o+8>>2],B[N+8>>3]=c,d=Pe(17,Q|0,t|0,k|0,N|0)|0,_=g,g=0,!(_&1))&&(ie=12):!h&&(g=0,B[R>>3]=c,_=Pe(17,Q|0,t|0,k|0,R|0)|0,R=g,g=0,!(R&1))&&(d=_,ie=12);do if((ie|0)==12){if(t=e[Q>>2]|0,t)h=t;else{if(g=0,Nt(6),_=g,g=0,_&1)break;h=e[Q>>2]|0}t=h,k=h,ie=16;break e}while(!1);t=j()|0}else t=e[Q>>2]|0,k=0,d=h,ie=16;while(!1);if((ie|0)==16){C=t+d|0,D=ri(t,C,o)|0;do if((t|0)==(U|0))t=U,h=0,ie=22;else{if(d=E0(d<<1)|0,!d){if(g=0,Nt(6),ie=g,g=0,ie&1){h=0,ie=20;break}t=e[Q>>2]|0}h=d,w=d,ie=22}while(!1);do if((ie|0)==22)if(g=0,d=ge(68,o|0)|0,Q=g,g=0,Q&1)ie=20;else{if(e[G>>2]=d,g=0,ht(2,t|0,D|0,C|0,w|0,O|0,P|0,G|0),G=g,g=0,G&1){t=j()|0,Bt(d)|0;break}if(Bt(d)|0,e[$>>2]=e[r>>2],ie=e[O>>2]|0,t=e[P>>2]|0,g=0,e[K>>2]=e[$>>2],t=Vt(39,K|0,w|0,ie|0,t|0,o|0,l|0)|0,ie=g,g=0,ie&1)ie=20;else return e[r>>2]=t,h&&n0(h),k&&n0(k),b=Z,t|0}while(!1);(ie|0)==20&&(t=j()|0),h&&n0(h),k&&n0(k)}return le(t|0),0}function Tg(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0;if(R=b,b=b+80|0,C=R,t=R+70|0,k=R+12|0,N=R+32|0,w=R+8|0,D=R+4|0,S[t>>0]=S[58901]|0,S[t+1>>0]=S[58902]|0,S[t+2>>0]=S[58903]|0,S[t+3>>0]=S[58904]|0,S[t+4>>0]=S[58905]|0,S[t+5>>0]=S[58906]|0,h=b0()|0,e[C>>2]=c,t=q0(k,20,h,t,C)|0,c=k+t|0,h=ri(k,c,o)|0,d=f0(o)|0,e[w>>2]=d,g=0,w=be(37,w|0,44220)|0,_=g,g=0,_&1)_=j()|0,Bt(d)|0,le(_|0);else return Bt(d)|0,_r[e[(e[w>>2]|0)+32>>2]&31](w,k,c,N)|0,_=N+t|0,e[D>>2]=e[r>>2],e[C>>2]=e[D>>2],_=Ui(C,N,(h|0)==(c|0)?_:N+(h-k)|0,_,o,l)|0,b=R,_|0;return 0}function Ig(t){t=t|0}function Eg(t){t=t|0,he(t)}function kg(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0;D=b,b=b+32|0,h=D+20|0,d=D+16|0,w=D+12|0,C=D;e:do if(!(e[o+4>>2]&1))C=e[(e[t>>2]|0)+24>>2]|0,e[d>>2]=e[r>>2],e[h>>2]=e[d>>2],h=an[C&31](t,h,o,l,c&1)|0;else{h=f0(o)|0,e[w>>2]=h,g=0,d=be(37,w|0,44368)|0,w=g,g=0;t:do if(w&1)D=j()|0,Bt(h)|0,h=D;else{Bt(h)|0,h=e[d>>2]|0,c?t0[e[h+24>>2]&127](C,d):t0[e[h+28>>2]&127](C,d),t=S[C>>0]|0,o=(t&1)==0,h=C+4|0,c=C+8|0,w=o?h:C+4|0,h=o?h:e[C+8>>2]|0,o=(t&1)==0;i:do if((h|0)!=((o?w:e[c>>2]|0)+((o?(t&255)>>>1:e[w>>2]|0)<<2)|0)){for(;;){if(d=e[h>>2]|0,l=e[r>>2]|0,l){if(o=l+24|0,t=e[o>>2]|0,(t|0)==(e[l+28>>2]|0)){if(g=0,d=be(e[(e[l>>2]|0)+52>>2]|0,l|0,d|0)|0,t=g,g=0,t&1)break}else e[o>>2]=t+4,e[t>>2]=d;(d|0)==-1&&(e[r>>2]=0)}if(h=h+4|0,t=S[C>>0]|0,o=(t&1)==0,(h|0)==((o?w:e[c>>2]|0)+((o?(t&255)>>>1:e[w>>2]|0)<<2)|0))break i}h=j()|0,Pt(C);break t}while(!1);h=e[r>>2]|0,Pt(C);break e}while(!1);le(h|0)}while(!1);return b=D,h|0}function Dg(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0;if(k=b,b=b+128|0,h=k,R=k+116|0,_=k+104|0,w=k+20|0,D=k+16|0,C=k+12|0,N=k+8|0,d=k+4|0,S[R>>0]=S[58887]|0,S[R+1>>0]=S[58888]|0,S[R+2>>0]=S[58889]|0,S[R+3>>0]=S[58890]|0,S[R+4>>0]=S[58891]|0,S[R+5>>0]=S[58892]|0,ki(R+1|0,58893,1,e[o+4>>2]|0),t=b0()|0,e[h>>2]=c,c=_+(q0(_,12,t,R,h)|0)|0,R=ri(_,c,o)|0,t=f0(o)|0,e[N>>2]=t,g=0,ht(3,_|0,R|0,c|0,w|0,D|0,C|0,N|0),c=g,g=0,c&1)_=j()|0,Bt(t)|0,le(_|0);else return Bt(t)|0,e[d>>2]=e[r>>2],R=e[D>>2]|0,_=e[C>>2]|0,e[h>>2]=e[d>>2],_=Hi(h,w,R,_,o,l)|0,b=k,_|0;return 0}function bg(t,r,o,l,c,h,d){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0;var w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0,G=0,$=0,P=0;G=b,b=b+16|0,$=G,Q=O0(d,44212)|0,D=O0(d,44368)|0,t0[e[(e[D>>2]|0)+20>>2]&127]($,D),_=S[$>>0]|0,U=$+4|0;e:do if(!((_&1?e[U>>2]|0:(_&255)>>>1)|0))g=0,Pe(e[(e[Q>>2]|0)+48>>2]|0,Q|0,t|0,o|0,l|0)|0,K=g,g=0,K&1?K=5:(d=l+(o-t<<2)|0,e[h>>2]=d,K=28);else{switch(e[h>>2]=l,d=S[t>>0]|0,d<<24>>24){case 43:case 45:{if(g=0,d=be(e[(e[Q>>2]|0)+44>>2]|0,Q|0,d|0)|0,_=g,g=0,_&1){K=5;break e}C=e[h>>2]|0,e[h>>2]=C+4,e[C>>2]=d,C=t+1|0;break}default:C=t}t:do if((o-C|0)>1&&(S[C>>0]|0)==48){switch(d=C+1|0,S[d>>0]|0){case 88:case 120:break;default:{_=C;break t}}if(g=0,w=be(e[(e[Q>>2]|0)+44>>2]|0,Q|0,48)|0,_=g,g=0,_&1){K=5;break e}if(_=e[h>>2]|0,e[h>>2]=_+4,e[_>>2]=w,g=0,d=be(e[(e[Q>>2]|0)+44>>2]|0,Q|0,S[d>>0]|0)|0,_=g,g=0,_&1){K=5;break e}_=e[h>>2]|0,e[h>>2]=_+4,e[_>>2]=d,_=C+2|0}else _=C;while(!1);if((_|0)!=(o|0)&&(k=o+-1|0,_>>>0>>0)){w=_,d=k;do R=S[w>>0]|0,S[w>>0]=S[d>>0]|0,S[d>>0]=R,w=w+1|0,d=d+-1|0;while(w>>>0>>0)}if(g=0,D=ge(e[(e[D>>2]|0)+16>>2]|0,D|0)|0,R=g,g=0,R&1)K=5;else{k=$+8|0,N=$+1|0;t:do if(_>>>0>>0){for(d=0,w=0,R=_;C=S[(S[$>>0]&1?e[k>>2]|0:N)+w>>0]|0,C<<24>>24!=0&(d|0)==(C<<24>>24|0)?(d=e[h>>2]|0,e[h>>2]=d+4,e[d>>2]=D,d=S[$>>0]|0,C=0,w=(w>>>0<((d&1?e[U>>2]|0:(d&255)>>>1)+-1|0)>>>0&1)+w|0):C=d,g=0,d=be(e[(e[Q>>2]|0)+44>>2]|0,Q|0,S[R>>0]|0)|0,P=g,g=0,!(P&1);){if(P=e[h>>2]|0,e[h>>2]=P+4,e[P>>2]=d,R=R+1|0,R>>>0>=o>>>0)break t;d=C+1|0}d=j()|0;break e}while(!1);if(C=t,d=l+(_-C<<2)|0,w=e[h>>2]|0,(d|0)!=(w|0))if(t=w+-4|0,d>>>0>>0){do P=e[d>>2]|0,e[d>>2]=e[t>>2],e[t>>2]=P,d=d+4|0,t=t+-4|0;while(d>>>0>>0);t=C,d=w,K=28}else t=C,d=w,K=28;else t=C,K=28}}while(!1);if((K|0)==5)d=j()|0;else if((K|0)==28){e[c>>2]=(r|0)==(o|0)?d:l+(r-t<<2)|0,de($),b=G;return}de($),le(d|0)}function Ng(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0;if(N=b,b=b+224|0,d=N+8|0,t=N,_=N+196|0,C=N+32|0,k=N+28|0,D=N+24|0,R=N+20|0,w=N+16|0,U=t,e[U>>2]=37,e[U+4>>2]=0,ki(t+1|0,58895,1,e[o+4>>2]|0),U=b0()|0,Q=d,e[Q>>2]=c,e[Q+4>>2]=h,h=_+(q0(_,22,U,t,d)|0)|0,c=ri(_,h,o)|0,t=f0(o)|0,e[R>>2]=t,g=0,ht(3,_|0,c|0,h|0,C|0,k|0,D|0,R|0),h=g,g=0,h&1)Q=j()|0,Bt(t)|0,le(Q|0);else return Bt(t)|0,e[w>>2]=e[r>>2],U=e[k>>2]|0,Q=e[D>>2]|0,e[d>>2]=e[w>>2],Q=Hi(d,C,U,Q,o,l)|0,b=N,Q|0;return 0}function Fg(t,r,o,l,c,h,d,w){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0,w=w|0;var C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0,G=0,$=0;K=b,b=b+16|0,U=K,R=K+8|0;e:do if((o|0)==(l|0))C=l;else for(C=o;;){if(!(e[C>>2]|0))break e;if(C=C+4|0,(C|0)==(l|0)){C=l;break}}while(!1);e[w>>2]=h,e[c>>2]=o,k=d,_=t+8|0;e:do if((h|0)==(d|0)|(o|0)==(l|0))G=47;else{t=h,D=C;t:for(;;){if($=r,h=e[$+4>>2]|0,C=U,e[C>>2]=e[$>>2],e[C+4>>2]=h,C=ai(e[_>>2]|0)|0,g=0,h=se(21,t|0,c|0,D-o>>2|0,k-t|0,r|0)|0,$=g,g=0,$&1){G=9;break}if(C|0&&(g=0,ge(75,C|0)|0,$=g,g=0,$&1)){G=8;break}switch(h|0){case 0:{N=1;break e}case-1:{C=t,G=14;break t}default:}if(C=(e[w>>2]|0)+h|0,e[w>>2]=C,(C|0)==(d|0)){G=27;break}if((D|0)==(l|0))o=e[c>>2]|0,t=C,C=l;else{if(C=ai(e[_>>2]|0)|0,g=0,o=Ve(34,R|0,0,r|0)|0,$=g,g=0,$&1){G=35;break}if(C|0&&(g=0,ge(75,C|0)|0,$=g,g=0,$&1)){G=34;break}if((o|0)==-1){N=2;break e}if(o>>>0>(k-(e[w>>2]|0)|0)>>>0){N=1;break e}if(o)for(C=R;D=S[C>>0]|0,$=e[w>>2]|0,e[w>>2]=$+1,S[$>>0]=D,o=o+-1|0,o;)C=C+1|0;o=(e[c>>2]|0)+4|0,e[c>>2]=o;i:do if((o|0)==(l|0))C=l;else for(C=o;;){if(!(e[C>>2]|0))break i;if(C=C+4|0,(C|0)==(l|0)){C=l;break}}while(!1);t=e[w>>2]|0}if((t|0)==(d|0)|(o|0)==(l|0)){G=47;break e}else D=C}if((G|0)==8)$=j(0)|0,$t($);else if((G|0)==9)o=j()|0,C|0&&(g=0,ge(75,C|0)|0,$=g,g=0,$&1)&&($=j(0)|0,$t($)),le(o|0);else if((G|0)==14){e[w>>2]=C;t:do if((o|0)!=(e[c>>2]|0)){for(;;){if($=e[o>>2]|0,t=ai(e[_>>2]|0)|0,g=0,C=Ve(34,C|0,$|0,U|0)|0,$=g,g=0,$&1){Q=t;break}if(t|0&&(g=0,ge(75,t|0)|0,$=g,g=0,$&1)){G=18;break}if((C|0)==-1||(C=(e[w>>2]|0)+C|0,e[w>>2]=C,o=o+4|0,(o|0)==(e[c>>2]|0)))break t}(G|0)==18&&($=j(0)|0,$t($)),o=j()|0,Q|0&&(g=0,ge(75,Q|0)|0,$=g,g=0,$&1)&&($=j(0)|0,$t($)),le(o|0)}while(!1);e[c>>2]=o,N=2;break}else if((G|0)==27){o=e[c>>2]|0,G=47;break}else(G|0)==34?($=j(0)|0,$t($)):(G|0)==35&&(o=j()|0,C|0&&(g=0,ge(75,C|0)|0,$=g,g=0,$&1)&&($=j(0)|0,$t($)),le(o|0))}while(!1);return(G|0)==47&&(N=(o|0)!=(l|0)&1),b=K,N|0}function Rg(t,r,o,l,c,h,d,w){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0,w=w|0;var C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0,G=0,$=0;K=b,b=b+16|0,Q=K;e:do if((o|0)==(l|0))C=l;else for(C=o;;){if(!(S[C>>0]|0))break e;if(C=C+1|0,(C|0)==(l|0)){C=l;break}}while(!1);e[w>>2]=h,e[c>>2]=o,N=d,_=t+8|0;e:do if((h|0)==(d|0)|(o|0)==(l|0))G=47;else{t=h,k=C;t:for(;;){if(D=r,C=e[D+4>>2]|0,h=Q,e[h>>2]=e[D>>2],e[h+4>>2]=C,h=k,C=ai(e[_>>2]|0)|0,g=0,D=se(22,t|0,c|0,h-o|0,N-t>>2|0,r|0)|0,$=g,g=0,$&1){G=9;break}if(C|0&&(g=0,ge(75,C|0)|0,$=g,g=0,$&1)){G=8;break}switch(D|0){case 0:{R=2;break e}case-1:{C=t,G=14;break t}default:}if(t=(e[w>>2]|0)+(D<<2)|0,e[w>>2]=t,(t|0)==(d|0)){G=31;break}if(o=e[c>>2]|0,(k|0)==(l|0))C=l;else{if(C=ai(e[_>>2]|0)|0,g=0,o=Pe(20,t|0,o|0,1,r|0)|0,$=g,g=0,$&1){G=38;break}if(C|0&&(g=0,ge(75,C|0)|0,$=g,g=0,$&1)){G=37;break}if(o){R=2;break e}e[w>>2]=(e[w>>2]|0)+4,o=(e[c>>2]|0)+1|0,e[c>>2]=o;i:do if((o|0)==(l|0))C=l;else for(C=o;;){if(!(S[C>>0]|0))break i;if(C=C+1|0,(C|0)==(l|0)){C=l;break}}while(!1);t=e[w>>2]|0}if((t|0)==(d|0)|(o|0)==(l|0)){G=47;break e}else k=C}if((G|0)==8)$=j(0)|0,$t($);else if((G|0)==9)o=j()|0,C|0&&(g=0,ge(75,C|0)|0,$=g,g=0,$&1)&&($=j(0)|0,$t($)),le(o|0);else if((G|0)==14){e[w>>2]=C;t:do if((o|0)!=(e[c>>2]|0)){t=C;i:for(;;){if(C=ai(e[_>>2]|0)|0,g=0,t=Pe(20,t|0,o|0,h-o|0,Q|0)|0,$=g,g=0,$&1){G=19;break}if(C|0&&(g=0,ge(75,C|0)|0,$=g,g=0,$&1)){G=18;break}switch(t|0){case-1:{G=25;break i}case-2:{G=26;break i}case 0:{o=o+1|0;break}default:o=o+t|0}if(t=(e[w>>2]|0)+4|0,e[w>>2]=t,(o|0)==(e[c>>2]|0)){U=o;break t}}if((G|0)==18)$=j(0)|0,$t($);else if((G|0)==19)o=j()|0,C|0&&(g=0,ge(75,C|0)|0,$=g,g=0,$&1)&&($=j(0)|0,$t($)),le(o|0);else if((G|0)==25){e[c>>2]=o,R=2;break e}else if((G|0)==26){e[c>>2]=o,R=1;break e}}else U=o;while(!1);e[c>>2]=U,R=(U|0)!=(l|0)&1;break}else if((G|0)==31){o=e[c>>2]|0,G=47;break}else(G|0)==37?($=j(0)|0,$t($)):(G|0)==38&&(o=j()|0,C|0&&(g=0,ge(75,C|0)|0,$=g,g=0,$&1)&&($=j(0)|0,$t($)),le(o|0))}while(!1);return(G|0)==47&&(R=(o|0)!=(l|0)&1),b=K,R|0}function Mg(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0;switch(d=b,b=b+16|0,h=d,e[c>>2]=o,o=ai(e[t+8>>2]|0)|0,g=0,t=Ve(34,h|0,0,r|0)|0,r=g,g=0,r&1&&(h=j()|0,o|0&&(g=0,ge(75,o|0)|0,d=g,g=0,d&1)&&(d=j(0)|0,$t(d)),le(h|0)),o|0&&(g=0,ge(75,o|0)|0,r=g,g=0,r&1)&&(r=j(0)|0,$t(r)),t|0){case 0:case-1:{h=2;break}default:if(t=t+-1|0,t>>>0<=(l-(e[c>>2]|0)|0)>>>0)if(!t)h=0;else for(;;)if(r=S[h>>0]|0,l=e[c>>2]|0,e[c>>2]=l+1,S[l>>0]=r,t=t+-1|0,t)h=h+1|0;else{h=0;break}else h=1}return b=d,h|0}function _g(t){t=t|0;var r=0,o=0,l=0,c=0,h=0,d=0;r=t+8|0,g=0,o=ge(75,e[r>>2]|0)|0,l=g,g=0;do if(l&1)c=16;else{if(g=0,l=Ve(35,0,0,4)|0,t=g,g=0,t&1){if(t=j(0)|0,!o||(g=0,ge(75,o|0)|0,d=g,g=0,!(d&1)))break;d=j(0)|0,$t(d)}if(o|0&&(g=0,ge(75,o|0)|0,d=g,g=0,d&1)&&(d=j(0)|0,$t(d)),l)h=-1;else if(t=e[r>>2]|0,t){if(g=0,t=ge(75,t|0)|0,d=g,g=0,d&1){c=16;break}t|0&&(g=0,ge(75,t|0)|0,d=g,g=0,d&1)?(d=j(0)|0,$t(d)):h=0}else h=1;return h|0}while(!1);return(c|0)==16&&(t=j(0)|0),$t(t),0}function Pg(t){return t=t|0,0}function Lg(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0;D=l,C=t+8|0;e:do if((o|0)==(l|0)|(c|0)==0)t=0;else{for(t=0,w=0;;){if(d=ai(e[C>>2]|0)|0,g=0,h=Ve(36,o|0,D-o|0,r|0)|0,R=g,g=0,R&1){N=d;break}if(d|0&&(g=0,ge(75,d|0)|0,R=g,g=0,R&1)){k=5;break}switch(h|0){case-2:case-1:break e;case 0:{o=o+1|0,h=1;break}default:o=o+h|0}if(t=h+t|0,w=w+1|0,(o|0)==(l|0)|w>>>0>=c>>>0)break e}(k|0)==5&&(R=j(0)|0,$t(R)),t=j()|0,N|0&&(g=0,ge(75,N|0)|0,R=g,g=0,R&1)&&(R=j(0)|0,$t(R)),le(t|0)}while(!1);return t|0}function Og(t){t=t|0;var r=0,o=0;return t=e[t+8>>2]|0,t?(g=0,t=ge(75,t|0)|0,o=g,g=0,o&1&&(o=j(0)|0,$t(o)),t|0&&(g=0,ge(75,t|0)|0,o=g,g=0,o&1)?(o=j(0)|0,$t(o)):r=4):r=1,r|0}function $g(t){t=t|0,he(t)}function Bg(t,r,o,l,c,h,d,w){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0,w=w|0;var C=0;return t=b,b=b+16|0,C=t+4|0,r=t,e[C>>2]=o,e[r>>2]=h,d=O3(o,l,C,h,d,r,1114111,0)|0,e[c>>2]=e[C>>2],e[w>>2]=e[r>>2],b=t,d|0}function Vg(t,r,o,l,c,h,d,w){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0,w=w|0;var C=0;return t=b,b=b+16|0,C=t+4|0,r=t,e[C>>2]=o,e[r>>2]=h,d=$3(o,l,C,h,d,r,1114111,0)|0,e[c>>2]=e[C>>2],e[w>>2]=e[r>>2],b=t,d|0}function Ug(t,r,o,l,c){return t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,e[c>>2]=o,3}function zg(t){return t=t|0,0}function Gg(t){return t=t|0,0}function qg(t,r,o,l,c){return t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,B3(o,l,c,1114111,0)|0}function Wg(t){return t=t|0,4}function Hg(t){t=t|0,he(t)}function Qg(t,r,o,l,c,h,d,w){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0,w=w|0;var C=0;return t=b,b=b+16|0,C=t+4|0,r=t,e[C>>2]=o,e[r>>2]=h,d=V3(o,l,C,h,d,r,1114111,0)|0,e[c>>2]=e[C>>2],e[w>>2]=e[r>>2],b=t,d|0}function Kg(t,r,o,l,c,h,d,w){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0,w=w|0;var C=0;return t=b,b=b+16|0,C=t+4|0,r=t,e[C>>2]=o,e[r>>2]=h,d=U3(o,l,C,h,d,r,1114111,0)|0,e[c>>2]=e[C>>2],e[w>>2]=e[r>>2],b=t,d|0}function Yg(t,r,o,l,c){return t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,e[c>>2]=o,3}function jg(t){return t=t|0,0}function Xg(t){return t=t|0,0}function Zg(t,r,o,l,c){return t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,z3(o,l,c,1114111,0)|0}function Jg(t){return t=t|0,4}function e4(t){t=t|0,he(t)}function t4(t){t=t|0,he(t)}function i4(t,r){t=t|0,r=r|0,e[t+4>>2]=r+-1,e[t>>2]=44384,S[t+8>>0]=46,S[t+9>>0]=44,t=t+12|0,e[t>>2]=0,e[t+4>>2]=0,e[t+8>>2]=0}function n4(t,r){t=t|0,r=r|0,e[t+4>>2]=r+-1,e[t>>2]=44424,e[t+8>>2]=46,e[t+12>>2]=44,t=t+16|0,e[t>>2]=0,e[t+4>>2]=0,e[t+8>>2]=0}function eo(t){t=t|0,e[t>>2]=44384,de(t+12|0)}function r4(t){t=t|0,eo(t),he(t)}function to(t){t=t|0,e[t>>2]=44424,de(t+16|0)}function s4(t){t=t|0,to(t),he(t)}function o4(t){return t=t|0,S[t+8>>0]|0}function l4(t){return t=t|0,e[t+8>>2]|0}function u4(t){return t=t|0,S[t+9>>0]|0}function c4(t){return t=t|0,e[t+12>>2]|0}function f4(t,r){t=t|0,r=r|0,hr(t,r+12|0)}function h4(t,r){t=t|0,r=r|0,hr(t,r+16|0)}function d4(t,r){t=t|0,r=r|0,yi(t,59024,4)}function p4(t,r){t=t|0,r=r|0,mr(t,44996,_n(44996)|0)}function m4(t,r){t=t|0,r=r|0,yi(t,59029,5)}function g4(t,r){t=t|0,r=r|0,mr(t,45016,_n(45016)|0)}function li(t){switch(t=t|0,e[t+4>>2]&74|0){case 64:{t=8;break}case 8:{t=16;break}case 0:{t=0;break}default:t=10}return t|0}function S4(t){t=t|0;do if(!(S[2464]|0)&&kt(2464)|0){if(!(S[2472]|0)&&kt(2472)|0){t=45040;do e[t>>2]=0,e[t+4>>2]=0,e[t+8>>2]=0,t=t+12|0;while((t|0)!=45208);Ft(193,0,H|0)|0,bt(2472)}if(g=0,be(41,45040,59035)|0,t=g,g=0,!(t&1)&&(g=0,be(41,45052,59042)|0,t=g,g=0,!(t&1))&&(g=0,be(41,45064,59049)|0,t=g,g=0,!(t&1))&&(g=0,be(41,45076,59057)|0,t=g,g=0,!(t&1))&&(g=0,be(41,45088,59067)|0,t=g,g=0,!(t&1))&&(g=0,be(41,45100,59076)|0,t=g,g=0,!(t&1))&&(g=0,be(41,45112,59083)|0,t=g,g=0,!(t&1))&&(g=0,be(41,45124,59092)|0,t=g,g=0,!(t&1))&&(g=0,be(41,45136,59096)|0,t=g,g=0,!(t&1))&&(g=0,be(41,45148,59100)|0,t=g,g=0,!(t&1))&&(g=0,be(41,45160,59104)|0,t=g,g=0,!(t&1))&&(g=0,be(41,45172,59108)|0,t=g,g=0,!(t&1))&&(g=0,be(41,45184,59112)|0,t=g,g=0,!(t&1))&&(g=0,be(41,45196,59116)|0,t=g,g=0,!(t&1))){e[11302]=45040,bt(2464);break}t=j()|0,W0(2464),le(t|0)}while(!1);return e[11302]|0}function A4(t){t=t|0;do if(!(S[2480]|0)&&kt(2480)|0){if(!(S[2488]|0)&&kt(2488)|0){t=45212;do e[t>>2]=0,e[t+4>>2]=0,e[t+8>>2]=0,t=t+12|0;while((t|0)!=45380);Ft(194,0,H|0)|0,bt(2488)}if(g=0,be(42,45212,45380)|0,t=g,g=0,!(t&1)&&(g=0,be(42,45224,45408)|0,t=g,g=0,!(t&1))&&(g=0,be(42,45236,45436)|0,t=g,g=0,!(t&1))&&(g=0,be(42,45248,45468)|0,t=g,g=0,!(t&1))&&(g=0,be(42,45260,45508)|0,t=g,g=0,!(t&1))&&(g=0,be(42,45272,45544)|0,t=g,g=0,!(t&1))&&(g=0,be(42,45284,45572)|0,t=g,g=0,!(t&1))&&(g=0,be(42,45296,45608)|0,t=g,g=0,!(t&1))&&(g=0,be(42,45308,45624)|0,t=g,g=0,!(t&1))&&(g=0,be(42,45320,45640)|0,t=g,g=0,!(t&1))&&(g=0,be(42,45332,45656)|0,t=g,g=0,!(t&1))&&(g=0,be(42,45344,45672)|0,t=g,g=0,!(t&1))&&(g=0,be(42,45356,45688)|0,t=g,g=0,!(t&1))&&(g=0,be(42,45368,45704)|0,t=g,g=0,!(t&1))){e[11430]=45212,bt(2480);break}t=j()|0,W0(2480),le(t|0)}while(!1);return e[11430]|0}function x4(t){t=t|0;e:do if(!(S[2496]|0)&&kt(2496)|0){if(!(S[2504]|0)&&kt(2504)|0){t=45724;do e[t>>2]=0,e[t+4>>2]=0,e[t+8>>2]=0,t=t+12|0;while((t|0)!=46012);Ft(195,0,H|0)|0,bt(2504)}g=0,be(41,45724,59120)|0,t=g,g=0;do if(!(t&1)&&(g=0,be(41,45736,59128)|0,t=g,g=0,!(t&1))&&(g=0,be(41,45748,59137)|0,t=g,g=0,!(t&1))&&(g=0,be(41,45760,59143)|0,t=g,g=0,!(t&1))&&(g=0,be(41,45772,59149)|0,t=g,g=0,!(t&1))&&(g=0,be(41,45784,59153)|0,t=g,g=0,!(t&1))&&(g=0,be(41,45796,59158)|0,t=g,g=0,!(t&1))&&(g=0,be(41,45808,59163)|0,t=g,g=0,!(t&1))&&(g=0,be(41,45820,59170)|0,t=g,g=0,!(t&1))&&(g=0,be(41,45832,59180)|0,t=g,g=0,!(t&1))&&(g=0,be(41,45844,59188)|0,t=g,g=0,!(t&1))&&(g=0,be(41,45856,59197)|0,t=g,g=0,!(t&1))&&(g=0,be(41,45868,59206)|0,t=g,g=0,!(t&1))&&(g=0,be(41,45880,59210)|0,t=g,g=0,!(t&1))&&(g=0,be(41,45892,59214)|0,t=g,g=0,!(t&1))){if(g=0,be(41,45904,59218)|0,t=g,g=0,t&1||(g=0,be(41,45916,59149)|0,t=g,g=0,t&1)||(g=0,be(41,45928,59222)|0,t=g,g=0,t&1)||(g=0,be(41,45940,59226)|0,t=g,g=0,t&1)||(g=0,be(41,45952,59230)|0,t=g,g=0,t&1)||(g=0,be(41,45964,59234)|0,t=g,g=0,t&1)||(g=0,be(41,45976,59238)|0,t=g,g=0,t&1)||(g=0,be(41,45988,59242)|0,t=g,g=0,t&1)||(g=0,be(41,46e3,59246)|0,t=g,g=0,t&1))break;e[11503]=45724,bt(2496);break e}while(!1);t=j()|0,W0(2496),le(t|0)}while(!1);return e[11503]|0}function w4(t){t=t|0;e:do if(!(S[2512]|0)&&kt(2512)|0){if(!(S[2520]|0)&&kt(2520)|0){t=46016;do e[t>>2]=0,e[t+4>>2]=0,e[t+8>>2]=0,t=t+12|0;while((t|0)!=46304);Ft(196,0,H|0)|0,bt(2520)}g=0,be(42,46016,46304)|0,t=g,g=0;do if(!(t&1)&&(g=0,be(42,46028,46336)|0,t=g,g=0,!(t&1))&&(g=0,be(42,46040,46372)|0,t=g,g=0,!(t&1))&&(g=0,be(42,46052,46396)|0,t=g,g=0,!(t&1))&&(g=0,be(42,46064,46420)|0,t=g,g=0,!(t&1))&&(g=0,be(42,46076,46436)|0,t=g,g=0,!(t&1))&&(g=0,be(42,46088,46456)|0,t=g,g=0,!(t&1))&&(g=0,be(42,46100,46476)|0,t=g,g=0,!(t&1))&&(g=0,be(42,46112,46504)|0,t=g,g=0,!(t&1))&&(g=0,be(42,46124,46544)|0,t=g,g=0,!(t&1))&&(g=0,be(42,46136,46576)|0,t=g,g=0,!(t&1))&&(g=0,be(42,46148,46612)|0,t=g,g=0,!(t&1))&&(g=0,be(42,46160,46648)|0,t=g,g=0,!(t&1))&&(g=0,be(42,46172,46664)|0,t=g,g=0,!(t&1))&&(g=0,be(42,46184,46680)|0,t=g,g=0,!(t&1))){if(g=0,be(42,46196,46696)|0,t=g,g=0,t&1||(g=0,be(42,46208,46420)|0,t=g,g=0,t&1)||(g=0,be(42,46220,46712)|0,t=g,g=0,t&1)||(g=0,be(42,46232,46728)|0,t=g,g=0,t&1)||(g=0,be(42,46244,46744)|0,t=g,g=0,t&1)||(g=0,be(42,46256,46760)|0,t=g,g=0,t&1)||(g=0,be(42,46268,46776)|0,t=g,g=0,t&1)||(g=0,be(42,46280,46792)|0,t=g,g=0,t&1)||(g=0,be(42,46292,46808)|0,t=g,g=0,t&1))break;e[11706]=46016,bt(2512);break e}while(!1);t=j()|0,W0(2512),le(t|0)}while(!1);return e[11706]|0}function y4(t){t=t|0;do if(!(S[2528]|0)&&kt(2528)|0){if(!(S[2536]|0)&&kt(2536)|0){t=46828;do e[t>>2]=0,e[t+4>>2]=0,e[t+8>>2]=0,t=t+12|0;while((t|0)!=47116);Ft(197,0,H|0)|0,bt(2536)}if(g=0,be(41,46828,59250)|0,t=g,g=0,!(t&1)&&(g=0,be(41,46840,59253)|0,t=g,g=0,!(t&1))){e[11779]=46828,bt(2528);break}t=j()|0,W0(2528),le(t|0)}while(!1);return e[11779]|0}function C4(t){t=t|0;do if(!(S[2544]|0)&&kt(2544)|0){if(!(S[2552]|0)&&kt(2552)|0){t=47120;do e[t>>2]=0,e[t+4>>2]=0,e[t+8>>2]=0,t=t+12|0;while((t|0)!=47408);Ft(198,0,H|0)|0,bt(2552)}if(g=0,be(42,47120,47408)|0,t=g,g=0,!(t&1)&&(g=0,be(42,47132,47420)|0,t=g,g=0,!(t&1))){e[11858]=47120,bt(2544);break}t=j()|0,W0(2544),le(t|0)}while(!1);return e[11858]|0}function T4(t){t=t|0;do if(!(S[2560]|0)&&kt(2560)|0)if(g=0,xe(5,47436,59256,8),t=g,g=0,t&1)t=j()|0,W0(2560),le(t|0);else{Ft(199,47436,H|0)|0,bt(2560);break}while(!1);return 47436}function I4(t){t=t|0;var r=0;do if(!(S[2568]|0)&&kt(2568)|0){if(g=0,t=ge(76,47448)|0,r=g,g=0,!(r&1)&&(g=0,xe(15,47484,47448,t|0),r=g,g=0,!(r&1))){Ft(200,47484,H|0)|0,bt(2568);break}r=j()|0,W0(2568),le(r|0)}while(!1);return 47484}function E4(t){t=t|0;do if(!(S[2576]|0)&&kt(2576)|0)if(g=0,xe(5,47496,59265,8),t=g,g=0,t&1)t=j()|0,W0(2576),le(t|0);else{Ft(199,47496,H|0)|0,bt(2576);break}while(!1);return 47496}function k4(t){t=t|0;var r=0;do if(!(S[2584]|0)&&kt(2584)|0){if(g=0,t=ge(76,47508)|0,r=g,g=0,!(r&1)&&(g=0,xe(15,47544,47508,t|0),r=g,g=0,!(r&1))){Ft(200,47544,H|0)|0,bt(2584);break}r=j()|0,W0(2584),le(r|0)}while(!1);return 47544}function D4(t){t=t|0;do if(!(S[2592]|0)&&kt(2592)|0)if(g=0,xe(5,47556,59274,20),t=g,g=0,t&1)t=j()|0,W0(2592),le(t|0);else{Ft(199,47556,H|0)|0,bt(2592);break}while(!1);return 47556}function N4(t){t=t|0;var r=0;do if(!(S[2600]|0)&&kt(2600)|0){if(g=0,t=ge(76,47568)|0,r=g,g=0,!(r&1)&&(g=0,xe(15,47652,47568,t|0),r=g,g=0,!(r&1))){Ft(200,47652,H|0)|0,bt(2600);break}r=j()|0,W0(2600),le(r|0)}while(!1);return 47652}function F4(t){t=t|0;do if(!(S[2608]|0)&&kt(2608)|0)if(g=0,xe(5,47664,59295,11),t=g,g=0,t&1)t=j()|0,W0(2608),le(t|0);else{Ft(199,47664,H|0)|0,bt(2608);break}while(!1);return 47664}function R4(t){t=t|0;var r=0;do if(!(S[2616]|0)&&kt(2616)|0){if(g=0,t=ge(76,47676)|0,r=g,g=0,!(r&1)&&(g=0,xe(15,47724,47676,t|0),r=g,g=0,!(r&1))){Ft(200,47724,H|0)|0,bt(2616);break}r=j()|0,W0(2616),le(r|0)}while(!1);return 47724}function io(t){t=t|0;var r=0,o=0,l=0;e[t>>2]=44304,t=t+8|0,r=e[t>>2]|0,g=0,o=Ce(3)|0,l=g,g=0;do if(!(l&1)){if((r|0)!=(o|0)&&(g=0,ue(188,e[t>>2]|0),l=g,g=0,l&1))break;return}while(!1);l=j(0)|0,$t(l)}function Sn(t,r,o,l,c,h,d){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0;var w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0,G=0,$=0,P=0,O=0,Z=0;O=b,b=b+112|0,C=O,k=(l-o|0)/12|0;do if(k>>>0>100){if(C=E0(k)|0,!(C|0)&&(g=0,Nt(6),P=g,g=0,P&1)){w=0,_=6;break}w=C,_=11}else w=0,_=11;while(!1);e:do if((_|0)==11){if((o|0)==(l|0))D=0;else for(_=o,N=0,R=C;D=S[_>>0]|0,D&1?D=e[_+4>>2]|0:D=(D&255)>>>1,D?(S[R>>0]=1,D=N):(S[R>>0]=2,D=N+1|0,k=k+-1|0),_=_+12|0,(_|0)!=(l|0);)N=D,R=R+1|0;$=(o|0)==(l|0),P=(o|0)==(l|0),G=0,U=D;t:for(;;){D=e[t>>2]|0;do if(D){if((e[D+12>>2]|0)==(e[D+16>>2]|0)){if(g=0,D=ge(e[(e[D>>2]|0)+36>>2]|0,D|0)|0,K=g,g=0,K&1){_=5;break t}if((D|0)==-1){e[t>>2]=0,D=0;break}else{D=e[t>>2]|0;break}}}else D=0;while(!1);if(_=(D|0)==0,N=e[r>>2]|0,N){if((e[N+12>>2]|0)==(e[N+16>>2]|0)){if(g=0,D=ge(e[(e[N>>2]|0)+36>>2]|0,N|0)|0,K=g,g=0,K&1){_=5;break}(D|0)==-1&&(e[r>>2]=0,N=0)}}else N=0;if(R=(N|0)==0,D=e[t>>2]|0,!((k|0)!=0&(_^R))){_=64;break}if(N=e[D+12>>2]|0,(N|0)==(e[D+16>>2]|0)){if(g=0,D=ge(e[(e[D>>2]|0)+36>>2]|0,D|0)|0,K=g,g=0,K&1){_=5;break}}else D=F[N>>0]|0;if(D=D&255,!d&&(g=0,D=be(e[(e[c>>2]|0)+12>>2]|0,c|0,D|0)|0,K=g,g=0,K&1)){_=5;break}if(K=G+1|0,$)D=0,_=U;else for(R=0,Q=o,_=U,U=C;;){do if((S[U>>0]|0)==1){if(S[Q>>0]&1?N=e[Q+8>>2]|0:N=Q+1|0,N=S[N+G>>0]|0,!d&&(g=0,N=be(e[(e[c>>2]|0)+12>>2]|0,c|0,N|0)|0,Z=g,g=0,Z&1)){_=4;break t}if(D<<24>>24!=N<<24>>24){S[U>>0]=0,N=R,k=k+-1|0;break}N=S[Q>>0]|0,N&1?N=e[Q+4>>2]|0:N=(N&255)>>>1,(N|0)==(K|0)?(S[U>>0]=2,N=1,_=_+1|0,k=k+-1|0):N=1}else N=R;while(!1);if(Q=Q+12|0,(Q|0)==(l|0)){D=N;break}else R=N,U=U+1|0}if(!D){G=K,U=_;continue}if(D=e[t>>2]|0,N=D+12|0,R=e[N>>2]|0,(R|0)==(e[D+16>>2]|0)){if(g=0,ge(e[(e[D>>2]|0)+40>>2]|0,D|0)|0,Z=g,g=0,Z&1){_=5;break}}else e[N>>2]=R+1;if((_+k|0)>>>0<2|P){G=K,U=_;continue}else D=o,R=_,_=C;for(;;)if((S[_>>0]|0)==2&&(N=S[D>>0]|0,N&1?N=e[D+4>>2]|0:N=(N&255)>>>1,(N|0)!=(K|0)&&(S[_>>0]=0,R=R+-1|0)),D=D+12|0,(D|0)==(l|0)){G=K,U=R;continue t}else _=_+1|0}if((_|0)==4){o=j()|0;break}else if((_|0)==5){o=j()|0;break}else if((_|0)==64){do if(D){if((e[D+12>>2]|0)==(e[D+16>>2]|0)){if(g=0,D=ge(e[(e[D>>2]|0)+36>>2]|0,D|0)|0,Z=g,g=0,Z&1){_=6;break e}if((D|0)==-1){e[t>>2]=0,D=0;break}else{D=e[t>>2]|0;break}}}else D=0;while(!1);k=(D|0)==0;do if(R)_=76;else{if((e[N+12>>2]|0)==(e[N+16>>2]|0)){if(g=0,D=ge(e[(e[N>>2]|0)+36>>2]|0,N|0)|0,Z=g,g=0,Z&1){_=6;break e}if((D|0)==-1){e[r>>2]=0,_=76;break}}k||(_=77)}while(!1);(_|0)==76&&k&&(_=77),(_|0)==77&&(e[h>>2]=e[h>>2]|2);t:do if((o|0)==(l|0))_=81;else for(;;){if((S[C>>0]|0)==2)break t;if(o=o+12|0,(o|0)==(l|0)){_=81;break}else C=C+1|0}while(!1);return(_|0)==81&&(e[h>>2]=e[h>>2]|4,o=l),w&&n0(w),b=O,o|0}}while(!1);return(_|0)==6&&(o=j()|0),w&&n0(w),le(o|0),0}function M4(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0,ce=0;Z=b,b=b+240|0,U=Z+202|0,d=Z+200|0,oe=Z+24|0,ie=Z+12|0,K=Z+8|0,P=Z+40|0,O=Z+4|0,G=Z,Q=li(l)|0,qi(oe,l,U,d),e[ie>>2]=0,e[ie+4>>2]=0,e[ie+8>>2]=0,S[ie>>0]&1?t=(e[ie>>2]&-2)+-1|0:t=10,g=0,xe(8,ie|0,t|0,0),_=g,g=0;e:do if(_&1)ne=25;else{N=ie+8|0,R=ie+1|0,l=S[ie>>0]&1?e[N>>2]|0:R,e[K>>2]=l,e[O>>2]=P,e[G>>2]=0,_=ie+4|0,k=S[d>>0]|0,t=e[r>>2]|0;t:for(;;){if(t){if((e[t+12>>2]|0)==(e[t+16>>2]|0)){if(g=0,d=ge(e[(e[t>>2]|0)+36>>2]|0,t|0)|0,D=g,g=0,D&1){ne=24;break}(d|0)==-1&&(e[r>>2]=0,t=0)}}else t=0;w=(t|0)==0,d=e[o>>2]|0;do if(d){if((e[d+12>>2]|0)!=(e[d+16>>2]|0)){if(w)break;break t}if(g=0,C=ge(e[(e[d>>2]|0)+36>>2]|0,d|0)|0,D=g,g=0,D&1){ne=24;break t}if((C|0)!=-1){if(w)break;break t}else{e[o>>2]=0,ne=16;break}}else ne=16;while(!1);if((ne|0)==16)if(ne=0,w){d=0;break}else d=0;if(w=S[ie>>0]|0,w=w&1?e[_>>2]|0:(w&255)>>>1,(e[K>>2]|0)==(l+w|0)){if(g=0,xe(8,ie|0,w<<1|0,0),D=g,g=0,D&1){ne=24;break}if(S[ie>>0]&1?l=(e[ie>>2]&-2)+-1|0:l=10,g=0,xe(8,ie|0,l|0,0),D=g,g=0,D&1){ne=24;break}l=S[ie>>0]&1?e[N>>2]|0:R,e[K>>2]=l+w}if(C=t+12|0,w=e[C>>2]|0,D=t+16|0,(w|0)==(e[D>>2]|0)){if(g=0,w=ge(e[(e[t>>2]|0)+36>>2]|0,t|0)|0,ce=g,g=0,ce&1){ne=24;break}}else w=F[w>>0]|0;if(_i(w&255,Q,l,K,G,k,oe,P,O,U)|0)break;if(d=e[C>>2]|0,(d|0)==(e[D>>2]|0))if(g=0,ge(e[(e[t>>2]|0)+40>>2]|0,t|0)|0,ce=g,g=0,ce&1){ne=24;break}else continue;else{e[C>>2]=d+1;continue}}if((ne|0)==24){t=j()|0;break}if(ce=S[oe>>0]|0,(ce&1?e[oe+4>>2]|0:(ce&255)>>>1)|0&&($=e[O>>2]|0,($-P|0)<160)&&(ce=e[G>>2]|0,e[O>>2]=$+4,e[$>>2]=ce),g=0,l=Pe(21,l|0,e[K>>2]|0,c|0,Q|0)|0,ce=g,g=0,ce&1)ne=25;else{if(e[h>>2]=l,V0(oe,P,e[O>>2]|0,c),t){if((e[t+12>>2]|0)==(e[t+16>>2]|0)){if(g=0,l=ge(e[(e[t>>2]|0)+36>>2]|0,t|0)|0,ce=g,g=0,ce&1){ne=25;break}(l|0)==-1&&(e[r>>2]=0,t=0)}}else t=0;l=(t|0)==0;do if(d){if((e[d+12>>2]|0)==(e[d+16>>2]|0)){if(g=0,t=ge(e[(e[d>>2]|0)+36>>2]|0,d|0)|0,ce=g,g=0,ce&1){ne=25;break e}if((t|0)==-1){e[o>>2]=0,ne=49;break}}l||(ne=50)}else ne=49;while(!1);return(ne|0)==49&&l&&(ne=50),(ne|0)==50&&(e[c>>2]=e[c>>2]|2),ce=e[r>>2]|0,de(ie),de(oe),b=Z,ce|0}}while(!1);return(ne|0)==25&&(t=j()|0),de(ie),de(oe),le(t|0),0}function _4(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0,ce=0;Z=b,b=b+240|0,U=Z+202|0,d=Z+200|0,oe=Z+24|0,ie=Z+12|0,K=Z+8|0,P=Z+40|0,O=Z+4|0,G=Z,Q=li(l)|0,qi(oe,l,U,d),e[ie>>2]=0,e[ie+4>>2]=0,e[ie+8>>2]=0,S[ie>>0]&1?t=(e[ie>>2]&-2)+-1|0:t=10,g=0,xe(8,ie|0,t|0,0),_=g,g=0;e:do if(_&1)ne=25;else{N=ie+8|0,R=ie+1|0,l=S[ie>>0]&1?e[N>>2]|0:R,e[K>>2]=l,e[O>>2]=P,e[G>>2]=0,_=ie+4|0,k=S[d>>0]|0,t=e[r>>2]|0;t:for(;;){if(t){if((e[t+12>>2]|0)==(e[t+16>>2]|0)){if(g=0,d=ge(e[(e[t>>2]|0)+36>>2]|0,t|0)|0,D=g,g=0,D&1){ne=24;break}(d|0)==-1&&(e[r>>2]=0,t=0)}}else t=0;d=(t|0)==0,w=e[o>>2]|0;do if(w){if((e[w+12>>2]|0)!=(e[w+16>>2]|0)){if(d)break;break t}if(g=0,C=ge(e[(e[w>>2]|0)+36>>2]|0,w|0)|0,D=g,g=0,D&1){ne=24;break t}if((C|0)!=-1){if(d)break;break t}else{e[o>>2]=0,ne=16;break}}else ne=16;while(!1);if((ne|0)==16)if(ne=0,d){w=0;break}else w=0;if(d=S[ie>>0]|0,d=d&1?e[_>>2]|0:(d&255)>>>1,(e[K>>2]|0)==(l+d|0)){if(g=0,xe(8,ie|0,d<<1|0,0),D=g,g=0,D&1){ne=24;break}if(S[ie>>0]&1?l=(e[ie>>2]&-2)+-1|0:l=10,g=0,xe(8,ie|0,l|0,0),D=g,g=0,D&1){ne=24;break}l=S[ie>>0]&1?e[N>>2]|0:R,e[K>>2]=l+d}if(C=t+12|0,d=e[C>>2]|0,D=t+16|0,(d|0)==(e[D>>2]|0)){if(g=0,d=ge(e[(e[t>>2]|0)+36>>2]|0,t|0)|0,ce=g,g=0,ce&1){ne=24;break}}else d=F[d>>0]|0;if(_i(d&255,Q,l,K,G,k,oe,P,O,U)|0)break;if(d=e[C>>2]|0,(d|0)==(e[D>>2]|0))if(g=0,ge(e[(e[t>>2]|0)+40>>2]|0,t|0)|0,ce=g,g=0,ce&1){ne=24;break}else continue;else{e[C>>2]=d+1;continue}}if((ne|0)==24){t=j()|0;break}if(ce=S[oe>>0]|0,(ce&1?e[oe+4>>2]|0:(ce&255)>>>1)|0&&($=e[O>>2]|0,($-P|0)<160)&&(ce=e[G>>2]|0,e[O>>2]=$+4,e[$>>2]=ce),g=0,l=Pe(22,l|0,e[K>>2]|0,c|0,Q|0)|0,d=ye,ce=g,g=0,ce&1)ne=25;else{if(ce=h,e[ce>>2]=l,e[ce+4>>2]=d,V0(oe,P,e[O>>2]|0,c),t){if((e[t+12>>2]|0)==(e[t+16>>2]|0)){if(g=0,l=ge(e[(e[t>>2]|0)+36>>2]|0,t|0)|0,ce=g,g=0,ce&1){ne=25;break}(l|0)==-1&&(e[r>>2]=0,t=0)}}else t=0;l=(t|0)==0;do if(w){if((e[w+12>>2]|0)==(e[w+16>>2]|0)){if(g=0,t=ge(e[(e[w>>2]|0)+36>>2]|0,w|0)|0,ce=g,g=0,ce&1){ne=25;break e}if((t|0)==-1){e[o>>2]=0,ne=49;break}}l||(ne=50)}else ne=49;while(!1);return(ne|0)==49&&l&&(ne=50),(ne|0)==50&&(e[c>>2]=e[c>>2]|2),ce=e[r>>2]|0,de(ie),de(oe),b=Z,ce|0}}while(!1);return(ne|0)==25&&(t=j()|0),de(ie),de(oe),le(t|0),0}function P4(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0,ce=0;Z=b,b=b+240|0,U=Z+202|0,d=Z+200|0,oe=Z+24|0,ie=Z+12|0,K=Z+8|0,P=Z+40|0,O=Z+4|0,G=Z,Q=li(l)|0,qi(oe,l,U,d),e[ie>>2]=0,e[ie+4>>2]=0,e[ie+8>>2]=0,S[ie>>0]&1?t=(e[ie>>2]&-2)+-1|0:t=10,g=0,xe(8,ie|0,t|0,0),_=g,g=0;e:do if(_&1)ne=25;else{N=ie+8|0,R=ie+1|0,l=S[ie>>0]&1?e[N>>2]|0:R,e[K>>2]=l,e[O>>2]=P,e[G>>2]=0,_=ie+4|0,k=S[d>>0]|0,t=e[r>>2]|0;t:for(;;){if(t){if((e[t+12>>2]|0)==(e[t+16>>2]|0)){if(g=0,d=ge(e[(e[t>>2]|0)+36>>2]|0,t|0)|0,D=g,g=0,D&1){ne=24;break}(d|0)==-1&&(e[r>>2]=0,t=0)}}else t=0;w=(t|0)==0,d=e[o>>2]|0;do if(d){if((e[d+12>>2]|0)!=(e[d+16>>2]|0)){if(w)break;break t}if(g=0,C=ge(e[(e[d>>2]|0)+36>>2]|0,d|0)|0,D=g,g=0,D&1){ne=24;break t}if((C|0)!=-1){if(w)break;break t}else{e[o>>2]=0,ne=16;break}}else ne=16;while(!1);if((ne|0)==16)if(ne=0,w){d=0;break}else d=0;if(w=S[ie>>0]|0,w=w&1?e[_>>2]|0:(w&255)>>>1,(e[K>>2]|0)==(l+w|0)){if(g=0,xe(8,ie|0,w<<1|0,0),D=g,g=0,D&1){ne=24;break}if(S[ie>>0]&1?l=(e[ie>>2]&-2)+-1|0:l=10,g=0,xe(8,ie|0,l|0,0),D=g,g=0,D&1){ne=24;break}l=S[ie>>0]&1?e[N>>2]|0:R,e[K>>2]=l+w}if(C=t+12|0,w=e[C>>2]|0,D=t+16|0,(w|0)==(e[D>>2]|0)){if(g=0,w=ge(e[(e[t>>2]|0)+36>>2]|0,t|0)|0,ce=g,g=0,ce&1){ne=24;break}}else w=F[w>>0]|0;if(_i(w&255,Q,l,K,G,k,oe,P,O,U)|0)break;if(d=e[C>>2]|0,(d|0)==(e[D>>2]|0))if(g=0,ge(e[(e[t>>2]|0)+40>>2]|0,t|0)|0,ce=g,g=0,ce&1){ne=24;break}else continue;else{e[C>>2]=d+1;continue}}if((ne|0)==24){t=j()|0;break}if(ce=S[oe>>0]|0,(ce&1?e[oe+4>>2]|0:(ce&255)>>>1)|0&&($=e[O>>2]|0,($-P|0)<160)&&(ce=e[G>>2]|0,e[O>>2]=$+4,e[$>>2]=ce),g=0,l=Pe(23,l|0,e[K>>2]|0,c|0,Q|0)|0,ce=g,g=0,ce&1)ne=25;else{if(I[h>>1]=l,V0(oe,P,e[O>>2]|0,c),t){if((e[t+12>>2]|0)==(e[t+16>>2]|0)){if(g=0,l=ge(e[(e[t>>2]|0)+36>>2]|0,t|0)|0,ce=g,g=0,ce&1){ne=25;break}(l|0)==-1&&(e[r>>2]=0,t=0)}}else t=0;l=(t|0)==0;do if(d){if((e[d+12>>2]|0)==(e[d+16>>2]|0)){if(g=0,t=ge(e[(e[d>>2]|0)+36>>2]|0,d|0)|0,ce=g,g=0,ce&1){ne=25;break e}if((t|0)==-1){e[o>>2]=0,ne=49;break}}l||(ne=50)}else ne=49;while(!1);return(ne|0)==49&&l&&(ne=50),(ne|0)==50&&(e[c>>2]=e[c>>2]|2),ce=e[r>>2]|0,de(ie),de(oe),b=Z,ce|0}}while(!1);return(ne|0)==25&&(t=j()|0),de(ie),de(oe),le(t|0),0}function L4(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0,ce=0;Z=b,b=b+240|0,U=Z+202|0,d=Z+200|0,oe=Z+24|0,ie=Z+12|0,K=Z+8|0,P=Z+40|0,O=Z+4|0,G=Z,Q=li(l)|0,qi(oe,l,U,d),e[ie>>2]=0,e[ie+4>>2]=0,e[ie+8>>2]=0,S[ie>>0]&1?t=(e[ie>>2]&-2)+-1|0:t=10,g=0,xe(8,ie|0,t|0,0),_=g,g=0;e:do if(_&1)ne=25;else{N=ie+8|0,R=ie+1|0,l=S[ie>>0]&1?e[N>>2]|0:R,e[K>>2]=l,e[O>>2]=P,e[G>>2]=0,_=ie+4|0,k=S[d>>0]|0,t=e[r>>2]|0;t:for(;;){if(t){if((e[t+12>>2]|0)==(e[t+16>>2]|0)){if(g=0,d=ge(e[(e[t>>2]|0)+36>>2]|0,t|0)|0,D=g,g=0,D&1){ne=24;break}(d|0)==-1&&(e[r>>2]=0,t=0)}}else t=0;w=(t|0)==0,d=e[o>>2]|0;do if(d){if((e[d+12>>2]|0)!=(e[d+16>>2]|0)){if(w)break;break t}if(g=0,C=ge(e[(e[d>>2]|0)+36>>2]|0,d|0)|0,D=g,g=0,D&1){ne=24;break t}if((C|0)!=-1){if(w)break;break t}else{e[o>>2]=0,ne=16;break}}else ne=16;while(!1);if((ne|0)==16)if(ne=0,w){d=0;break}else d=0;if(w=S[ie>>0]|0,w=w&1?e[_>>2]|0:(w&255)>>>1,(e[K>>2]|0)==(l+w|0)){if(g=0,xe(8,ie|0,w<<1|0,0),D=g,g=0,D&1){ne=24;break}if(S[ie>>0]&1?l=(e[ie>>2]&-2)+-1|0:l=10,g=0,xe(8,ie|0,l|0,0),D=g,g=0,D&1){ne=24;break}l=S[ie>>0]&1?e[N>>2]|0:R,e[K>>2]=l+w}if(C=t+12|0,w=e[C>>2]|0,D=t+16|0,(w|0)==(e[D>>2]|0)){if(g=0,w=ge(e[(e[t>>2]|0)+36>>2]|0,t|0)|0,ce=g,g=0,ce&1){ne=24;break}}else w=F[w>>0]|0;if(_i(w&255,Q,l,K,G,k,oe,P,O,U)|0)break;if(d=e[C>>2]|0,(d|0)==(e[D>>2]|0))if(g=0,ge(e[(e[t>>2]|0)+40>>2]|0,t|0)|0,ce=g,g=0,ce&1){ne=24;break}else continue;else{e[C>>2]=d+1;continue}}if((ne|0)==24){t=j()|0;break}if(ce=S[oe>>0]|0,(ce&1?e[oe+4>>2]|0:(ce&255)>>>1)|0&&($=e[O>>2]|0,($-P|0)<160)&&(ce=e[G>>2]|0,e[O>>2]=$+4,e[$>>2]=ce),g=0,l=Pe(24,l|0,e[K>>2]|0,c|0,Q|0)|0,ce=g,g=0,ce&1)ne=25;else{if(e[h>>2]=l,V0(oe,P,e[O>>2]|0,c),t){if((e[t+12>>2]|0)==(e[t+16>>2]|0)){if(g=0,l=ge(e[(e[t>>2]|0)+36>>2]|0,t|0)|0,ce=g,g=0,ce&1){ne=25;break}(l|0)==-1&&(e[r>>2]=0,t=0)}}else t=0;l=(t|0)==0;do if(d){if((e[d+12>>2]|0)==(e[d+16>>2]|0)){if(g=0,t=ge(e[(e[d>>2]|0)+36>>2]|0,d|0)|0,ce=g,g=0,ce&1){ne=25;break e}if((t|0)==-1){e[o>>2]=0,ne=49;break}}l||(ne=50)}else ne=49;while(!1);return(ne|0)==49&&l&&(ne=50),(ne|0)==50&&(e[c>>2]=e[c>>2]|2),ce=e[r>>2]|0,de(ie),de(oe),b=Z,ce|0}}while(!1);return(ne|0)==25&&(t=j()|0),de(ie),de(oe),le(t|0),0}function O4(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0,ce=0;Z=b,b=b+240|0,U=Z+202|0,d=Z+200|0,oe=Z+24|0,ie=Z+12|0,K=Z+8|0,P=Z+40|0,O=Z+4|0,G=Z,Q=li(l)|0,qi(oe,l,U,d),e[ie>>2]=0,e[ie+4>>2]=0,e[ie+8>>2]=0,S[ie>>0]&1?t=(e[ie>>2]&-2)+-1|0:t=10,g=0,xe(8,ie|0,t|0,0),_=g,g=0;e:do if(_&1)ne=25;else{N=ie+8|0,R=ie+1|0,l=S[ie>>0]&1?e[N>>2]|0:R,e[K>>2]=l,e[O>>2]=P,e[G>>2]=0,_=ie+4|0,k=S[d>>0]|0,t=e[r>>2]|0;t:for(;;){if(t){if((e[t+12>>2]|0)==(e[t+16>>2]|0)){if(g=0,d=ge(e[(e[t>>2]|0)+36>>2]|0,t|0)|0,D=g,g=0,D&1){ne=24;break}(d|0)==-1&&(e[r>>2]=0,t=0)}}else t=0;w=(t|0)==0,d=e[o>>2]|0;do if(d){if((e[d+12>>2]|0)!=(e[d+16>>2]|0)){if(w)break;break t}if(g=0,C=ge(e[(e[d>>2]|0)+36>>2]|0,d|0)|0,D=g,g=0,D&1){ne=24;break t}if((C|0)!=-1){if(w)break;break t}else{e[o>>2]=0,ne=16;break}}else ne=16;while(!1);if((ne|0)==16)if(ne=0,w){d=0;break}else d=0;if(w=S[ie>>0]|0,w=w&1?e[_>>2]|0:(w&255)>>>1,(e[K>>2]|0)==(l+w|0)){if(g=0,xe(8,ie|0,w<<1|0,0),D=g,g=0,D&1){ne=24;break}if(S[ie>>0]&1?l=(e[ie>>2]&-2)+-1|0:l=10,g=0,xe(8,ie|0,l|0,0),D=g,g=0,D&1){ne=24;break}l=S[ie>>0]&1?e[N>>2]|0:R,e[K>>2]=l+w}if(C=t+12|0,w=e[C>>2]|0,D=t+16|0,(w|0)==(e[D>>2]|0)){if(g=0,w=ge(e[(e[t>>2]|0)+36>>2]|0,t|0)|0,ce=g,g=0,ce&1){ne=24;break}}else w=F[w>>0]|0;if(_i(w&255,Q,l,K,G,k,oe,P,O,U)|0)break;if(d=e[C>>2]|0,(d|0)==(e[D>>2]|0))if(g=0,ge(e[(e[t>>2]|0)+40>>2]|0,t|0)|0,ce=g,g=0,ce&1){ne=24;break}else continue;else{e[C>>2]=d+1;continue}}if((ne|0)==24){t=j()|0;break}if(ce=S[oe>>0]|0,(ce&1?e[oe+4>>2]|0:(ce&255)>>>1)|0&&($=e[O>>2]|0,($-P|0)<160)&&(ce=e[G>>2]|0,e[O>>2]=$+4,e[$>>2]=ce),g=0,l=Pe(25,l|0,e[K>>2]|0,c|0,Q|0)|0,ce=g,g=0,ce&1)ne=25;else{if(e[h>>2]=l,V0(oe,P,e[O>>2]|0,c),t){if((e[t+12>>2]|0)==(e[t+16>>2]|0)){if(g=0,l=ge(e[(e[t>>2]|0)+36>>2]|0,t|0)|0,ce=g,g=0,ce&1){ne=25;break}(l|0)==-1&&(e[r>>2]=0,t=0)}}else t=0;l=(t|0)==0;do if(d){if((e[d+12>>2]|0)==(e[d+16>>2]|0)){if(g=0,t=ge(e[(e[d>>2]|0)+36>>2]|0,d|0)|0,ce=g,g=0,ce&1){ne=25;break e}if((t|0)==-1){e[o>>2]=0,ne=49;break}}l||(ne=50)}else ne=49;while(!1);return(ne|0)==49&&l&&(ne=50),(ne|0)==50&&(e[c>>2]=e[c>>2]|2),ce=e[r>>2]|0,de(ie),de(oe),b=Z,ce|0}}while(!1);return(ne|0)==25&&(t=j()|0),de(ie),de(oe),le(t|0),0}function $4(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0,ce=0;Z=b,b=b+240|0,U=Z+202|0,d=Z+200|0,oe=Z+24|0,ie=Z+12|0,K=Z+8|0,P=Z+40|0,O=Z+4|0,G=Z,Q=li(l)|0,qi(oe,l,U,d),e[ie>>2]=0,e[ie+4>>2]=0,e[ie+8>>2]=0,S[ie>>0]&1?t=(e[ie>>2]&-2)+-1|0:t=10,g=0,xe(8,ie|0,t|0,0),_=g,g=0;e:do if(_&1)ne=25;else{N=ie+8|0,R=ie+1|0,l=S[ie>>0]&1?e[N>>2]|0:R,e[K>>2]=l,e[O>>2]=P,e[G>>2]=0,_=ie+4|0,k=S[d>>0]|0,t=e[r>>2]|0;t:for(;;){if(t){if((e[t+12>>2]|0)==(e[t+16>>2]|0)){if(g=0,d=ge(e[(e[t>>2]|0)+36>>2]|0,t|0)|0,D=g,g=0,D&1){ne=24;break}(d|0)==-1&&(e[r>>2]=0,t=0)}}else t=0;d=(t|0)==0,w=e[o>>2]|0;do if(w){if((e[w+12>>2]|0)!=(e[w+16>>2]|0)){if(d)break;break t}if(g=0,C=ge(e[(e[w>>2]|0)+36>>2]|0,w|0)|0,D=g,g=0,D&1){ne=24;break t}if((C|0)!=-1){if(d)break;break t}else{e[o>>2]=0,ne=16;break}}else ne=16;while(!1);if((ne|0)==16)if(ne=0,d){w=0;break}else w=0;if(d=S[ie>>0]|0,d=d&1?e[_>>2]|0:(d&255)>>>1,(e[K>>2]|0)==(l+d|0)){if(g=0,xe(8,ie|0,d<<1|0,0),D=g,g=0,D&1){ne=24;break}if(S[ie>>0]&1?l=(e[ie>>2]&-2)+-1|0:l=10,g=0,xe(8,ie|0,l|0,0),D=g,g=0,D&1){ne=24;break}l=S[ie>>0]&1?e[N>>2]|0:R,e[K>>2]=l+d}if(C=t+12|0,d=e[C>>2]|0,D=t+16|0,(d|0)==(e[D>>2]|0)){if(g=0,d=ge(e[(e[t>>2]|0)+36>>2]|0,t|0)|0,ce=g,g=0,ce&1){ne=24;break}}else d=F[d>>0]|0;if(_i(d&255,Q,l,K,G,k,oe,P,O,U)|0)break;if(d=e[C>>2]|0,(d|0)==(e[D>>2]|0))if(g=0,ge(e[(e[t>>2]|0)+40>>2]|0,t|0)|0,ce=g,g=0,ce&1){ne=24;break}else continue;else{e[C>>2]=d+1;continue}}if((ne|0)==24){t=j()|0;break}if(ce=S[oe>>0]|0,(ce&1?e[oe+4>>2]|0:(ce&255)>>>1)|0&&($=e[O>>2]|0,($-P|0)<160)&&(ce=e[G>>2]|0,e[O>>2]=$+4,e[$>>2]=ce),g=0,l=Pe(26,l|0,e[K>>2]|0,c|0,Q|0)|0,d=ye,ce=g,g=0,ce&1)ne=25;else{if(ce=h,e[ce>>2]=l,e[ce+4>>2]=d,V0(oe,P,e[O>>2]|0,c),t){if((e[t+12>>2]|0)==(e[t+16>>2]|0)){if(g=0,l=ge(e[(e[t>>2]|0)+36>>2]|0,t|0)|0,ce=g,g=0,ce&1){ne=25;break}(l|0)==-1&&(e[r>>2]=0,t=0)}}else t=0;l=(t|0)==0;do if(w){if((e[w+12>>2]|0)==(e[w+16>>2]|0)){if(g=0,t=ge(e[(e[w>>2]|0)+36>>2]|0,w|0)|0,ce=g,g=0,ce&1){ne=25;break e}if((t|0)==-1){e[o>>2]=0,ne=49;break}}l||(ne=50)}else ne=49;while(!1);return(ne|0)==49&&l&&(ne=50),(ne|0)==50&&(e[c>>2]=e[c>>2]|2),ce=e[r>>2]|0,de(ie),de(oe),b=Z,ce|0}}while(!1);return(ne|0)==25&&(t=j()|0),de(ie),de(oe),le(t|0),0}function B4(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0,ce=0,ke=0,Ee=0,Te=0;ne=b,b=b+240|0,K=ne+208|0,w=ne+203|0,C=ne+202|0,ke=ne+24|0,ce=ne+12|0,$=ne+8|0,ie=ne+40|0,oe=ne+4|0,P=ne,O=ne+201|0,G=ne+200|0,Ar(ke,l,K,w,C),e[ce>>2]=0,e[ce+4>>2]=0,e[ce+8>>2]=0,S[ce>>0]&1?t=(e[ce>>2]&-2)+-1|0:t=10,g=0,xe(8,ce|0,t|0,0),Q=g,g=0;e:do if(Q&1)Ee=25;else{_=ce+8|0,U=ce+1|0,l=S[ce>>0]&1?e[_>>2]|0:U,e[$>>2]=l,e[oe>>2]=ie,e[P>>2]=0,S[O>>0]=1,S[G>>0]=69,Q=ce+4|0,R=S[w>>0]|0,N=S[C>>0]|0,t=e[r>>2]|0;t:for(;;){if(t){if((e[t+12>>2]|0)==(e[t+16>>2]|0)){if(g=0,w=ge(e[(e[t>>2]|0)+36>>2]|0,t|0)|0,k=g,g=0,k&1){Ee=24;break}(w|0)==-1&&(e[r>>2]=0,t=0)}}else t=0;C=(t|0)==0,w=e[o>>2]|0;do if(w){if((e[w+12>>2]|0)!=(e[w+16>>2]|0)){if(C)break;break t}if(g=0,D=ge(e[(e[w>>2]|0)+36>>2]|0,w|0)|0,k=g,g=0,k&1){Ee=24;break t}if((D|0)!=-1){if(C)break;break t}else{e[o>>2]=0,Ee=16;break}}else Ee=16;while(!1);if((Ee|0)==16)if(Ee=0,C){w=0;break}else w=0;if(C=S[ce>>0]|0,C=C&1?e[Q>>2]|0:(C&255)>>>1,(e[$>>2]|0)==(l+C|0)){if(g=0,xe(8,ce|0,C<<1|0,0),k=g,g=0,k&1){Ee=24;break}if(S[ce>>0]&1?l=(e[ce>>2]&-2)+-1|0:l=10,g=0,xe(8,ce|0,l|0,0),k=g,g=0,k&1){Ee=24;break}l=S[ce>>0]&1?e[_>>2]|0:U,e[$>>2]=l+C}if(D=t+12|0,C=e[D>>2]|0,k=t+16|0,(C|0)==(e[k>>2]|0)){if(g=0,C=ge(e[(e[t>>2]|0)+36>>2]|0,t|0)|0,Te=g,g=0,Te&1){Ee=24;break}}else C=F[C>>0]|0;if(vr(C&255,O,G,l,$,R,N,ke,ie,oe,P,K)|0)break;if(w=e[D>>2]|0,(w|0)==(e[k>>2]|0))if(g=0,ge(e[(e[t>>2]|0)+40>>2]|0,t|0)|0,Te=g,g=0,Te&1){Ee=24;break}else continue;else{e[D>>2]=w+1;continue}}if((Ee|0)==24){t=j()|0;break}if(Te=S[ke>>0]|0,!(!(S[O>>0]|0)||!((Te&1?e[ke+4>>2]|0:(Te&255)>>>1)|0))&&(Z=e[oe>>2]|0,(Z-ie|0)<160)&&(Te=e[P>>2]|0,e[oe>>2]=Z+4,e[Z>>2]=Te),g=0,d=+lt(1,l|0,e[$>>2]|0,c|0),Te=g,g=0,Te&1)Ee=25;else{if(V[h>>2]=d,V0(ke,ie,e[oe>>2]|0,c),t){if((e[t+12>>2]|0)==(e[t+16>>2]|0)){if(g=0,l=ge(e[(e[t>>2]|0)+36>>2]|0,t|0)|0,Te=g,g=0,Te&1){Ee=25;break}(l|0)==-1&&(e[r>>2]=0,t=0)}}else t=0;l=(t|0)==0;do if(w){if((e[w+12>>2]|0)==(e[w+16>>2]|0)){if(g=0,t=ge(e[(e[w>>2]|0)+36>>2]|0,w|0)|0,Te=g,g=0,Te&1){Ee=25;break e}if((t|0)==-1){e[o>>2]=0,Ee=49;break}}l||(Ee=50)}else Ee=49;while(!1);return(Ee|0)==49&&l&&(Ee=50),(Ee|0)==50&&(e[c>>2]=e[c>>2]|2),Te=e[r>>2]|0,de(ce),de(ke),b=ne,Te|0}}while(!1);return(Ee|0)==25&&(t=j()|0),de(ce),de(ke),le(t|0),0}function V4(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0,ce=0,ke=0,Ee=0,Te=0;ne=b,b=b+240|0,K=ne+208|0,w=ne+203|0,C=ne+202|0,ke=ne+24|0,ce=ne+12|0,$=ne+8|0,ie=ne+40|0,oe=ne+4|0,P=ne,O=ne+201|0,G=ne+200|0,Ar(ke,l,K,w,C),e[ce>>2]=0,e[ce+4>>2]=0,e[ce+8>>2]=0,S[ce>>0]&1?t=(e[ce>>2]&-2)+-1|0:t=10,g=0,xe(8,ce|0,t|0,0),Q=g,g=0;e:do if(Q&1)Ee=25;else{_=ce+8|0,U=ce+1|0,l=S[ce>>0]&1?e[_>>2]|0:U,e[$>>2]=l,e[oe>>2]=ie,e[P>>2]=0,S[O>>0]=1,S[G>>0]=69,Q=ce+4|0,R=S[w>>0]|0,N=S[C>>0]|0,t=e[r>>2]|0;t:for(;;){if(t){if((e[t+12>>2]|0)==(e[t+16>>2]|0)){if(g=0,w=ge(e[(e[t>>2]|0)+36>>2]|0,t|0)|0,k=g,g=0,k&1){Ee=24;break}(w|0)==-1&&(e[r>>2]=0,t=0)}}else t=0;C=(t|0)==0,w=e[o>>2]|0;do if(w){if((e[w+12>>2]|0)!=(e[w+16>>2]|0)){if(C)break;break t}if(g=0,D=ge(e[(e[w>>2]|0)+36>>2]|0,w|0)|0,k=g,g=0,k&1){Ee=24;break t}if((D|0)!=-1){if(C)break;break t}else{e[o>>2]=0,Ee=16;break}}else Ee=16;while(!1);if((Ee|0)==16)if(Ee=0,C){w=0;break}else w=0;if(C=S[ce>>0]|0,C=C&1?e[Q>>2]|0:(C&255)>>>1,(e[$>>2]|0)==(l+C|0)){if(g=0,xe(8,ce|0,C<<1|0,0),k=g,g=0,k&1){Ee=24;break}if(S[ce>>0]&1?l=(e[ce>>2]&-2)+-1|0:l=10,g=0,xe(8,ce|0,l|0,0),k=g,g=0,k&1){Ee=24;break}l=S[ce>>0]&1?e[_>>2]|0:U,e[$>>2]=l+C}if(D=t+12|0,C=e[D>>2]|0,k=t+16|0,(C|0)==(e[k>>2]|0)){if(g=0,C=ge(e[(e[t>>2]|0)+36>>2]|0,t|0)|0,Te=g,g=0,Te&1){Ee=24;break}}else C=F[C>>0]|0;if(vr(C&255,O,G,l,$,R,N,ke,ie,oe,P,K)|0)break;if(w=e[D>>2]|0,(w|0)==(e[k>>2]|0))if(g=0,ge(e[(e[t>>2]|0)+40>>2]|0,t|0)|0,Te=g,g=0,Te&1){Ee=24;break}else continue;else{e[D>>2]=w+1;continue}}if((Ee|0)==24){t=j()|0;break}if(Te=S[ke>>0]|0,!(!(S[O>>0]|0)||!((Te&1?e[ke+4>>2]|0:(Te&255)>>>1)|0))&&(Z=e[oe>>2]|0,(Z-ie|0)<160)&&(Te=e[P>>2]|0,e[oe>>2]=Z+4,e[Z>>2]=Te),g=0,d=+lt(2,l|0,e[$>>2]|0,c|0),Te=g,g=0,Te&1)Ee=25;else{if(B[h>>3]=d,V0(ke,ie,e[oe>>2]|0,c),t){if((e[t+12>>2]|0)==(e[t+16>>2]|0)){if(g=0,l=ge(e[(e[t>>2]|0)+36>>2]|0,t|0)|0,Te=g,g=0,Te&1){Ee=25;break}(l|0)==-1&&(e[r>>2]=0,t=0)}}else t=0;l=(t|0)==0;do if(w){if((e[w+12>>2]|0)==(e[w+16>>2]|0)){if(g=0,t=ge(e[(e[w>>2]|0)+36>>2]|0,w|0)|0,Te=g,g=0,Te&1){Ee=25;break e}if((t|0)==-1){e[o>>2]=0,Ee=49;break}}l||(Ee=50)}else Ee=49;while(!1);return(Ee|0)==49&&l&&(Ee=50),(Ee|0)==50&&(e[c>>2]=e[c>>2]|2),Te=e[r>>2]|0,de(ce),de(ke),b=ne,Te|0}}while(!1);return(Ee|0)==25&&(t=j()|0),de(ce),de(ke),le(t|0),0}function U4(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0,ce=0,ke=0,Ee=0,Te=0;ne=b,b=b+240|0,K=ne+208|0,w=ne+203|0,C=ne+202|0,ke=ne+24|0,ce=ne+12|0,$=ne+8|0,ie=ne+40|0,oe=ne+4|0,P=ne,O=ne+201|0,G=ne+200|0,Ar(ke,l,K,w,C),e[ce>>2]=0,e[ce+4>>2]=0,e[ce+8>>2]=0,S[ce>>0]&1?t=(e[ce>>2]&-2)+-1|0:t=10,g=0,xe(8,ce|0,t|0,0),Q=g,g=0;e:do if(Q&1)Ee=25;else{_=ce+8|0,U=ce+1|0,l=S[ce>>0]&1?e[_>>2]|0:U,e[$>>2]=l,e[oe>>2]=ie,e[P>>2]=0,S[O>>0]=1,S[G>>0]=69,Q=ce+4|0,R=S[w>>0]|0,N=S[C>>0]|0,t=e[r>>2]|0;t:for(;;){if(t){if((e[t+12>>2]|0)==(e[t+16>>2]|0)){if(g=0,w=ge(e[(e[t>>2]|0)+36>>2]|0,t|0)|0,k=g,g=0,k&1){Ee=24;break}(w|0)==-1&&(e[r>>2]=0,t=0)}}else t=0;C=(t|0)==0,w=e[o>>2]|0;do if(w){if((e[w+12>>2]|0)!=(e[w+16>>2]|0)){if(C)break;break t}if(g=0,D=ge(e[(e[w>>2]|0)+36>>2]|0,w|0)|0,k=g,g=0,k&1){Ee=24;break t}if((D|0)!=-1){if(C)break;break t}else{e[o>>2]=0,Ee=16;break}}else Ee=16;while(!1);if((Ee|0)==16)if(Ee=0,C){w=0;break}else w=0;if(C=S[ce>>0]|0,C=C&1?e[Q>>2]|0:(C&255)>>>1,(e[$>>2]|0)==(l+C|0)){if(g=0,xe(8,ce|0,C<<1|0,0),k=g,g=0,k&1){Ee=24;break}if(S[ce>>0]&1?l=(e[ce>>2]&-2)+-1|0:l=10,g=0,xe(8,ce|0,l|0,0),k=g,g=0,k&1){Ee=24;break}l=S[ce>>0]&1?e[_>>2]|0:U,e[$>>2]=l+C}if(D=t+12|0,C=e[D>>2]|0,k=t+16|0,(C|0)==(e[k>>2]|0)){if(g=0,C=ge(e[(e[t>>2]|0)+36>>2]|0,t|0)|0,Te=g,g=0,Te&1){Ee=24;break}}else C=F[C>>0]|0;if(vr(C&255,O,G,l,$,R,N,ke,ie,oe,P,K)|0)break;if(w=e[D>>2]|0,(w|0)==(e[k>>2]|0))if(g=0,ge(e[(e[t>>2]|0)+40>>2]|0,t|0)|0,Te=g,g=0,Te&1){Ee=24;break}else continue;else{e[D>>2]=w+1;continue}}if((Ee|0)==24){t=j()|0;break}if(Te=S[ke>>0]|0,!(!(S[O>>0]|0)||!((Te&1?e[ke+4>>2]|0:(Te&255)>>>1)|0))&&(Z=e[oe>>2]|0,(Z-ie|0)<160)&&(Te=e[P>>2]|0,e[oe>>2]=Z+4,e[Z>>2]=Te),g=0,d=+lt(3,l|0,e[$>>2]|0,c|0),Te=g,g=0,Te&1)Ee=25;else{if(B[h>>3]=d,V0(ke,ie,e[oe>>2]|0,c),t){if((e[t+12>>2]|0)==(e[t+16>>2]|0)){if(g=0,l=ge(e[(e[t>>2]|0)+36>>2]|0,t|0)|0,Te=g,g=0,Te&1){Ee=25;break}(l|0)==-1&&(e[r>>2]=0,t=0)}}else t=0;l=(t|0)==0;do if(w){if((e[w+12>>2]|0)==(e[w+16>>2]|0)){if(g=0,t=ge(e[(e[w>>2]|0)+36>>2]|0,w|0)|0,Te=g,g=0,Te&1){Ee=25;break e}if((t|0)==-1){e[o>>2]=0,Ee=49;break}}l||(Ee=50)}else Ee=49;while(!1);return(Ee|0)==49&&l&&(Ee=50),(Ee|0)==50&&(e[c>>2]=e[c>>2]|2),Te=e[r>>2]|0,de(ce),de(ke),b=ne,Te|0}}while(!1);return(Ee|0)==25&&(t=j()|0),de(ce),de(ke),le(t|0),0}function z4(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0;return c=b,b=b+16|0,h=c,e[h>>2]=l,l=ai(r)|0,r=Lo(t,o,h)|0,l|0&&(g=0,ge(75,l|0)|0,h=g,g=0,h&1)&&(h=j(0)|0,$t(h)),b=c,r|0}function An(t,r,o,l,c,h,d){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0;var w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0,G=0,$=0,P=0,O=0,Z=0;O=b,b=b+112|0,C=O,k=(l-o|0)/12|0;do if(k>>>0>100){if(C=E0(k)|0,!(C|0)&&(g=0,Nt(6),P=g,g=0,P&1)){w=0,R=6;break}w=C,R=11}else w=0,R=11;while(!1);e:do if((R|0)==11){if((o|0)==(l|0))D=0;else for(_=o,N=0,R=C;D=S[_>>0]|0,D&1?D=e[_+4>>2]|0:D=(D&255)>>>1,D?(S[R>>0]=1,D=N):(S[R>>0]=2,D=N+1|0,k=k+-1|0),_=_+12|0,(_|0)!=(l|0);)N=D,R=R+1|0;$=(o|0)==(l|0),P=(o|0)==(l|0),G=0,U=k;t:for(;;){k=e[t>>2]|0;do if(k){if(N=e[k+12>>2]|0,(N|0)==(e[k+16>>2]|0)){if(g=0,k=ge(e[(e[k>>2]|0)+36>>2]|0,k|0)|0,K=g,g=0,K&1){R=5;break t}}else k=e[N>>2]|0;if((k|0)==-1){e[t>>2]=0,_=1;break}else{_=(e[t>>2]|0)==0;break}}else _=1;while(!1);if(N=e[r>>2]|0,N){if(k=e[N+12>>2]|0,(k|0)==(e[N+16>>2]|0)){if(g=0,k=ge(e[(e[N>>2]|0)+36>>2]|0,N|0)|0,K=g,g=0,K&1){R=5;break}}else k=e[k>>2]|0;(k|0)==-1?(e[r>>2]=0,N=0,R=1):R=0}else N=0,R=1;if(k=e[t>>2]|0,!((U|0)!=0&(_^R))){R=66;break}if(N=e[k+12>>2]|0,(N|0)==(e[k+16>>2]|0)){if(g=0,k=ge(e[(e[k>>2]|0)+36>>2]|0,k|0)|0,K=g,g=0,K&1){R=5;break}}else k=e[N>>2]|0;if(!d&&(g=0,k=be(e[(e[c>>2]|0)+28>>2]|0,c|0,k|0)|0,K=g,g=0,K&1)){R=5;break}if(K=G+1|0,$)k=0,_=U;else for(_=0,Q=o,R=U,U=C;;){do if((S[U>>0]|0)==1){if(S[Q>>0]&1?N=e[Q+8>>2]|0:N=Q+4|0,N=e[N+(G<<2)>>2]|0,!d&&(g=0,N=be(e[(e[c>>2]|0)+28>>2]|0,c|0,N|0)|0,Z=g,g=0,Z&1)){R=4;break t}if((k|0)!=(N|0)){S[U>>0]=0,N=_,R=R+-1|0;break}N=S[Q>>0]|0,N&1?N=e[Q+4>>2]|0:N=(N&255)>>>1,(N|0)==(K|0)?(S[U>>0]=2,N=1,D=D+1|0,R=R+-1|0):N=1}else N=_;while(!1);if(Q=Q+12|0,(Q|0)==(l|0)){k=N,_=R;break}else _=N,U=U+1|0}if(!k){G=K,U=_;continue}if(k=e[t>>2]|0,N=k+12|0,R=e[N>>2]|0,(R|0)==(e[k+16>>2]|0)){if(g=0,ge(e[(e[k>>2]|0)+40>>2]|0,k|0)|0,Z=g,g=0,Z&1){R=5;break}}else e[N>>2]=R+4;if((D+_|0)>>>0<2|P){G=K,U=_;continue}else k=o,R=C;for(;;)if((S[R>>0]|0)==2&&(N=S[k>>0]|0,N&1?N=e[k+4>>2]|0:N=(N&255)>>>1,(N|0)!=(K|0)&&(S[R>>0]=0,D=D+-1|0)),k=k+12|0,(k|0)==(l|0)){G=K,U=_;continue t}else R=R+1|0}if((R|0)==4){o=j()|0;break}else if((R|0)==5){o=j()|0;break}else if((R|0)==66){do if(k){if(D=e[k+12>>2]|0,(D|0)==(e[k+16>>2]|0)){if(g=0,D=ge(e[(e[k>>2]|0)+36>>2]|0,k|0)|0,Z=g,g=0,Z&1){R=6;break e}}else D=e[D>>2]|0;if((D|0)==-1){e[t>>2]=0,k=1;break}else{k=(e[t>>2]|0)==0;break}}else k=1;while(!1);do if(N){if(D=e[N+12>>2]|0,(D|0)==(e[N+16>>2]|0)){if(g=0,D=ge(e[(e[N>>2]|0)+36>>2]|0,N|0)|0,Z=g,g=0,Z&1){R=6;break e}}else D=e[D>>2]|0;if((D|0)!=-1){if(k)break;R=81;break}else{e[r>>2]=0,R=79;break}}else R=79;while(!1);(R|0)==79&&k&&(R=81),(R|0)==81&&(e[h>>2]=e[h>>2]|2);t:do if((o|0)==(l|0))R=85;else for(;;){if((S[C>>0]|0)==2)break t;if(o=o+12|0,(o|0)==(l|0)){R=85;break}else C=C+1|0}while(!1);return(R|0)==85&&(e[h>>2]=e[h>>2]|4,o=l),w&&n0(w),b=O,o|0}}while(!1);return(R|0)==6&&(o=j()|0),w&&n0(w),le(o|0),0}function G4(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0,ce=0;Z=b,b=b+320|0,U=Z+208|0,d=Z+200|0,oe=Z+24|0,ie=Z+12|0,K=Z+8|0,P=Z+40|0,O=Z+4|0,G=Z,Q=li(l)|0,Wi(oe,l,U,d),e[ie>>2]=0,e[ie+4>>2]=0,e[ie+8>>2]=0,S[ie>>0]&1?t=(e[ie>>2]&-2)+-1|0:t=10,g=0,xe(8,ie|0,t|0,0),_=g,g=0;e:do if(_&1)ne=26;else{N=ie+8|0,R=ie+1|0,t=S[ie>>0]&1?e[N>>2]|0:R,e[K>>2]=t,e[O>>2]=P,e[G>>2]=0,_=ie+4|0,k=e[d>>2]|0,d=e[r>>2]|0;t:for(;;){if(d){if(l=e[d+12>>2]|0,(l|0)==(e[d+16>>2]|0)){if(g=0,l=ge(e[(e[d>>2]|0)+36>>2]|0,d|0)|0,D=g,g=0,D&1){ne=25;break}}else l=e[l>>2]|0;(l|0)==-1?(e[r>>2]=0,l=0,w=1):(l=d,w=0)}else l=0,w=1;C=e[o>>2]|0;do if(C){if(d=e[C+12>>2]|0,(d|0)==(e[C+16>>2]|0)){if(g=0,d=ge(e[(e[C>>2]|0)+36>>2]|0,C|0)|0,D=g,g=0,D&1){ne=25;break t}}else d=e[d>>2]|0;if((d|0)!=-1){if(w)break;d=C;break t}else{e[o>>2]=0,ne=17;break}}else ne=17;while(!1);if((ne|0)==17)if(ne=0,w){d=0;break}else C=0;if(d=S[ie>>0]|0,d=d&1?e[_>>2]|0:(d&255)>>>1,(e[K>>2]|0)==(t+d|0)){if(g=0,xe(8,ie|0,d<<1|0,0),D=g,g=0,D&1){ne=25;break}if(S[ie>>0]&1?t=(e[ie>>2]&-2)+-1|0:t=10,g=0,xe(8,ie|0,t|0,0),D=g,g=0,D&1){ne=25;break}t=S[ie>>0]&1?e[N>>2]|0:R,e[K>>2]=t+d}if(w=l+12|0,d=e[w>>2]|0,D=l+16|0,(d|0)==(e[D>>2]|0)){if(g=0,d=ge(e[(e[l>>2]|0)+36>>2]|0,l|0)|0,ce=g,g=0,ce&1){ne=25;break}}else d=e[d>>2]|0;if(Pi(d,Q,t,K,G,k,oe,P,O,U)|0){d=C;break}if(d=e[w>>2]|0,(d|0)==(e[D>>2]|0))if(g=0,ge(e[(e[l>>2]|0)+40>>2]|0,l|0)|0,ce=g,g=0,ce&1){ne=25;break}else{d=l;continue}else{e[w>>2]=d+4,d=l;continue}}if((ne|0)==25){t=j()|0;break}if(ce=S[oe>>0]|0,(ce&1?e[oe+4>>2]|0:(ce&255)>>>1)|0&&($=e[O>>2]|0,($-P|0)<160)&&(ce=e[G>>2]|0,e[O>>2]=$+4,e[$>>2]=ce),g=0,t=Pe(21,t|0,e[K>>2]|0,c|0,Q|0)|0,ce=g,g=0,ce&1)ne=26;else{if(e[h>>2]=t,V0(oe,P,e[O>>2]|0,c),l){if(t=e[l+12>>2]|0,(t|0)==(e[l+16>>2]|0)){if(g=0,t=ge(e[(e[l>>2]|0)+36>>2]|0,l|0)|0,ce=g,g=0,ce&1){ne=26;break}}else t=e[t>>2]|0;(t|0)==-1?(e[r>>2]=0,l=1):l=0}else l=1;do if(d){if(t=e[d+12>>2]|0,(t|0)==(e[d+16>>2]|0)){if(g=0,t=ge(e[(e[d>>2]|0)+36>>2]|0,d|0)|0,ce=g,g=0,ce&1){ne=26;break e}}else t=e[t>>2]|0;if((t|0)!=-1){if(l)break;ne=53;break}else{e[o>>2]=0,ne=51;break}}else ne=51;while(!1);return(ne|0)==51&&l&&(ne=53),(ne|0)==53&&(e[c>>2]=e[c>>2]|2),ce=e[r>>2]|0,de(ie),de(oe),b=Z,ce|0}}while(!1);return(ne|0)==26&&(t=j()|0),de(ie),de(oe),le(t|0),0}function q4(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0,ce=0;Z=b,b=b+320|0,U=Z+208|0,d=Z+200|0,oe=Z+24|0,ie=Z+12|0,K=Z+8|0,P=Z+40|0,O=Z+4|0,G=Z,Q=li(l)|0,Wi(oe,l,U,d),e[ie>>2]=0,e[ie+4>>2]=0,e[ie+8>>2]=0,S[ie>>0]&1?t=(e[ie>>2]&-2)+-1|0:t=10,g=0,xe(8,ie|0,t|0,0),_=g,g=0;e:do if(_&1)ne=26;else{N=ie+8|0,R=ie+1|0,t=S[ie>>0]&1?e[N>>2]|0:R,e[K>>2]=t,e[O>>2]=P,e[G>>2]=0,_=ie+4|0,k=e[d>>2]|0,d=e[r>>2]|0;t:for(;;){if(d){if(l=e[d+12>>2]|0,(l|0)==(e[d+16>>2]|0)){if(g=0,l=ge(e[(e[d>>2]|0)+36>>2]|0,d|0)|0,D=g,g=0,D&1){ne=25;break}}else l=e[l>>2]|0;(l|0)==-1?(e[r>>2]=0,d=0,C=1):C=0}else d=0,C=1;w=e[o>>2]|0;do if(w){if(l=e[w+12>>2]|0,(l|0)==(e[w+16>>2]|0)){if(g=0,l=ge(e[(e[w>>2]|0)+36>>2]|0,w|0)|0,D=g,g=0,D&1){ne=25;break t}}else l=e[l>>2]|0;if((l|0)!=-1){if(C)break;break t}else{e[o>>2]=0,ne=17;break}}else ne=17;while(!1);if((ne|0)==17)if(ne=0,C){w=0;break}else w=0;if(l=S[ie>>0]|0,l=l&1?e[_>>2]|0:(l&255)>>>1,(e[K>>2]|0)==(t+l|0)){if(g=0,xe(8,ie|0,l<<1|0,0),D=g,g=0,D&1){ne=25;break}if(S[ie>>0]&1?t=(e[ie>>2]&-2)+-1|0:t=10,g=0,xe(8,ie|0,t|0,0),D=g,g=0,D&1){ne=25;break}t=S[ie>>0]&1?e[N>>2]|0:R,e[K>>2]=t+l}if(C=d+12|0,l=e[C>>2]|0,D=d+16|0,(l|0)==(e[D>>2]|0)){if(g=0,l=ge(e[(e[d>>2]|0)+36>>2]|0,d|0)|0,ce=g,g=0,ce&1){ne=25;break}}else l=e[l>>2]|0;if(Pi(l,Q,t,K,G,k,oe,P,O,U)|0)break;if(l=e[C>>2]|0,(l|0)==(e[D>>2]|0))if(g=0,ge(e[(e[d>>2]|0)+40>>2]|0,d|0)|0,ce=g,g=0,ce&1){ne=25;break}else continue;else{e[C>>2]=l+4;continue}}if((ne|0)==25){t=j()|0;break}if(ce=S[oe>>0]|0,(ce&1?e[oe+4>>2]|0:(ce&255)>>>1)|0&&($=e[O>>2]|0,($-P|0)<160)&&(ce=e[G>>2]|0,e[O>>2]=$+4,e[$>>2]=ce),g=0,t=Pe(22,t|0,e[K>>2]|0,c|0,Q|0)|0,l=ye,ce=g,g=0,ce&1)ne=26;else{if(ce=h,e[ce>>2]=t,e[ce+4>>2]=l,V0(oe,P,e[O>>2]|0,c),d){if(t=e[d+12>>2]|0,(t|0)==(e[d+16>>2]|0)){if(g=0,t=ge(e[(e[d>>2]|0)+36>>2]|0,d|0)|0,ce=g,g=0,ce&1){ne=26;break}}else t=e[t>>2]|0;(t|0)==-1?(e[r>>2]=0,l=1):l=0}else l=1;do if(w){if(t=e[w+12>>2]|0,(t|0)==(e[w+16>>2]|0)){if(g=0,t=ge(e[(e[w>>2]|0)+36>>2]|0,w|0)|0,ce=g,g=0,ce&1){ne=26;break e}}else t=e[t>>2]|0;if((t|0)!=-1){if(l)break;ne=53;break}else{e[o>>2]=0,ne=51;break}}else ne=51;while(!1);return(ne|0)==51&&l&&(ne=53),(ne|0)==53&&(e[c>>2]=e[c>>2]|2),ce=e[r>>2]|0,de(ie),de(oe),b=Z,ce|0}}while(!1);return(ne|0)==26&&(t=j()|0),de(ie),de(oe),le(t|0),0}function W4(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0,ce=0;Z=b,b=b+320|0,U=Z+208|0,d=Z+200|0,oe=Z+24|0,ie=Z+12|0,K=Z+8|0,P=Z+40|0,O=Z+4|0,G=Z,Q=li(l)|0,Wi(oe,l,U,d),e[ie>>2]=0,e[ie+4>>2]=0,e[ie+8>>2]=0,S[ie>>0]&1?t=(e[ie>>2]&-2)+-1|0:t=10,g=0,xe(8,ie|0,t|0,0),_=g,g=0;e:do if(_&1)ne=26;else{N=ie+8|0,R=ie+1|0,t=S[ie>>0]&1?e[N>>2]|0:R,e[K>>2]=t,e[O>>2]=P,e[G>>2]=0,_=ie+4|0,k=e[d>>2]|0,d=e[r>>2]|0;t:for(;;){if(d){if(l=e[d+12>>2]|0,(l|0)==(e[d+16>>2]|0)){if(g=0,l=ge(e[(e[d>>2]|0)+36>>2]|0,d|0)|0,D=g,g=0,D&1){ne=25;break}}else l=e[l>>2]|0;(l|0)==-1?(e[r>>2]=0,l=0,w=1):(l=d,w=0)}else l=0,w=1;C=e[o>>2]|0;do if(C){if(d=e[C+12>>2]|0,(d|0)==(e[C+16>>2]|0)){if(g=0,d=ge(e[(e[C>>2]|0)+36>>2]|0,C|0)|0,D=g,g=0,D&1){ne=25;break t}}else d=e[d>>2]|0;if((d|0)!=-1){if(w)break;d=C;break t}else{e[o>>2]=0,ne=17;break}}else ne=17;while(!1);if((ne|0)==17)if(ne=0,w){d=0;break}else C=0;if(d=S[ie>>0]|0,d=d&1?e[_>>2]|0:(d&255)>>>1,(e[K>>2]|0)==(t+d|0)){if(g=0,xe(8,ie|0,d<<1|0,0),D=g,g=0,D&1){ne=25;break}if(S[ie>>0]&1?t=(e[ie>>2]&-2)+-1|0:t=10,g=0,xe(8,ie|0,t|0,0),D=g,g=0,D&1){ne=25;break}t=S[ie>>0]&1?e[N>>2]|0:R,e[K>>2]=t+d}if(w=l+12|0,d=e[w>>2]|0,D=l+16|0,(d|0)==(e[D>>2]|0)){if(g=0,d=ge(e[(e[l>>2]|0)+36>>2]|0,l|0)|0,ce=g,g=0,ce&1){ne=25;break}}else d=e[d>>2]|0;if(Pi(d,Q,t,K,G,k,oe,P,O,U)|0){d=C;break}if(d=e[w>>2]|0,(d|0)==(e[D>>2]|0))if(g=0,ge(e[(e[l>>2]|0)+40>>2]|0,l|0)|0,ce=g,g=0,ce&1){ne=25;break}else{d=l;continue}else{e[w>>2]=d+4,d=l;continue}}if((ne|0)==25){t=j()|0;break}if(ce=S[oe>>0]|0,(ce&1?e[oe+4>>2]|0:(ce&255)>>>1)|0&&($=e[O>>2]|0,($-P|0)<160)&&(ce=e[G>>2]|0,e[O>>2]=$+4,e[$>>2]=ce),g=0,t=Pe(23,t|0,e[K>>2]|0,c|0,Q|0)|0,ce=g,g=0,ce&1)ne=26;else{if(I[h>>1]=t,V0(oe,P,e[O>>2]|0,c),l){if(t=e[l+12>>2]|0,(t|0)==(e[l+16>>2]|0)){if(g=0,t=ge(e[(e[l>>2]|0)+36>>2]|0,l|0)|0,ce=g,g=0,ce&1){ne=26;break}}else t=e[t>>2]|0;(t|0)==-1?(e[r>>2]=0,l=1):l=0}else l=1;do if(d){if(t=e[d+12>>2]|0,(t|0)==(e[d+16>>2]|0)){if(g=0,t=ge(e[(e[d>>2]|0)+36>>2]|0,d|0)|0,ce=g,g=0,ce&1){ne=26;break e}}else t=e[t>>2]|0;if((t|0)!=-1){if(l)break;ne=53;break}else{e[o>>2]=0,ne=51;break}}else ne=51;while(!1);return(ne|0)==51&&l&&(ne=53),(ne|0)==53&&(e[c>>2]=e[c>>2]|2),ce=e[r>>2]|0,de(ie),de(oe),b=Z,ce|0}}while(!1);return(ne|0)==26&&(t=j()|0),de(ie),de(oe),le(t|0),0}function H4(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0,ce=0;Z=b,b=b+320|0,U=Z+208|0,d=Z+200|0,oe=Z+24|0,ie=Z+12|0,K=Z+8|0,P=Z+40|0,O=Z+4|0,G=Z,Q=li(l)|0,Wi(oe,l,U,d),e[ie>>2]=0,e[ie+4>>2]=0,e[ie+8>>2]=0,S[ie>>0]&1?t=(e[ie>>2]&-2)+-1|0:t=10,g=0,xe(8,ie|0,t|0,0),_=g,g=0;e:do if(_&1)ne=26;else{N=ie+8|0,R=ie+1|0,t=S[ie>>0]&1?e[N>>2]|0:R,e[K>>2]=t,e[O>>2]=P,e[G>>2]=0,_=ie+4|0,k=e[d>>2]|0,d=e[r>>2]|0;t:for(;;){if(d){if(l=e[d+12>>2]|0,(l|0)==(e[d+16>>2]|0)){if(g=0,l=ge(e[(e[d>>2]|0)+36>>2]|0,d|0)|0,D=g,g=0,D&1){ne=25;break}}else l=e[l>>2]|0;(l|0)==-1?(e[r>>2]=0,l=0,w=1):(l=d,w=0)}else l=0,w=1;C=e[o>>2]|0;do if(C){if(d=e[C+12>>2]|0,(d|0)==(e[C+16>>2]|0)){if(g=0,d=ge(e[(e[C>>2]|0)+36>>2]|0,C|0)|0,D=g,g=0,D&1){ne=25;break t}}else d=e[d>>2]|0;if((d|0)!=-1){if(w)break;d=C;break t}else{e[o>>2]=0,ne=17;break}}else ne=17;while(!1);if((ne|0)==17)if(ne=0,w){d=0;break}else C=0;if(d=S[ie>>0]|0,d=d&1?e[_>>2]|0:(d&255)>>>1,(e[K>>2]|0)==(t+d|0)){if(g=0,xe(8,ie|0,d<<1|0,0),D=g,g=0,D&1){ne=25;break}if(S[ie>>0]&1?t=(e[ie>>2]&-2)+-1|0:t=10,g=0,xe(8,ie|0,t|0,0),D=g,g=0,D&1){ne=25;break}t=S[ie>>0]&1?e[N>>2]|0:R,e[K>>2]=t+d}if(w=l+12|0,d=e[w>>2]|0,D=l+16|0,(d|0)==(e[D>>2]|0)){if(g=0,d=ge(e[(e[l>>2]|0)+36>>2]|0,l|0)|0,ce=g,g=0,ce&1){ne=25;break}}else d=e[d>>2]|0;if(Pi(d,Q,t,K,G,k,oe,P,O,U)|0){d=C;break}if(d=e[w>>2]|0,(d|0)==(e[D>>2]|0))if(g=0,ge(e[(e[l>>2]|0)+40>>2]|0,l|0)|0,ce=g,g=0,ce&1){ne=25;break}else{d=l;continue}else{e[w>>2]=d+4,d=l;continue}}if((ne|0)==25){t=j()|0;break}if(ce=S[oe>>0]|0,(ce&1?e[oe+4>>2]|0:(ce&255)>>>1)|0&&($=e[O>>2]|0,($-P|0)<160)&&(ce=e[G>>2]|0,e[O>>2]=$+4,e[$>>2]=ce),g=0,t=Pe(24,t|0,e[K>>2]|0,c|0,Q|0)|0,ce=g,g=0,ce&1)ne=26;else{if(e[h>>2]=t,V0(oe,P,e[O>>2]|0,c),l){if(t=e[l+12>>2]|0,(t|0)==(e[l+16>>2]|0)){if(g=0,t=ge(e[(e[l>>2]|0)+36>>2]|0,l|0)|0,ce=g,g=0,ce&1){ne=26;break}}else t=e[t>>2]|0;(t|0)==-1?(e[r>>2]=0,l=1):l=0}else l=1;do if(d){if(t=e[d+12>>2]|0,(t|0)==(e[d+16>>2]|0)){if(g=0,t=ge(e[(e[d>>2]|0)+36>>2]|0,d|0)|0,ce=g,g=0,ce&1){ne=26;break e}}else t=e[t>>2]|0;if((t|0)!=-1){if(l)break;ne=53;break}else{e[o>>2]=0,ne=51;break}}else ne=51;while(!1);return(ne|0)==51&&l&&(ne=53),(ne|0)==53&&(e[c>>2]=e[c>>2]|2),ce=e[r>>2]|0,de(ie),de(oe),b=Z,ce|0}}while(!1);return(ne|0)==26&&(t=j()|0),de(ie),de(oe),le(t|0),0}function Q4(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0,ce=0;Z=b,b=b+320|0,U=Z+208|0,d=Z+200|0,oe=Z+24|0,ie=Z+12|0,K=Z+8|0,P=Z+40|0,O=Z+4|0,G=Z,Q=li(l)|0,Wi(oe,l,U,d),e[ie>>2]=0,e[ie+4>>2]=0,e[ie+8>>2]=0,S[ie>>0]&1?t=(e[ie>>2]&-2)+-1|0:t=10,g=0,xe(8,ie|0,t|0,0),_=g,g=0;e:do if(_&1)ne=26;else{N=ie+8|0,R=ie+1|0,t=S[ie>>0]&1?e[N>>2]|0:R,e[K>>2]=t,e[O>>2]=P,e[G>>2]=0,_=ie+4|0,k=e[d>>2]|0,d=e[r>>2]|0;t:for(;;){if(d){if(l=e[d+12>>2]|0,(l|0)==(e[d+16>>2]|0)){if(g=0,l=ge(e[(e[d>>2]|0)+36>>2]|0,d|0)|0,D=g,g=0,D&1){ne=25;break}}else l=e[l>>2]|0;(l|0)==-1?(e[r>>2]=0,l=0,w=1):(l=d,w=0)}else l=0,w=1;C=e[o>>2]|0;do if(C){if(d=e[C+12>>2]|0,(d|0)==(e[C+16>>2]|0)){if(g=0,d=ge(e[(e[C>>2]|0)+36>>2]|0,C|0)|0,D=g,g=0,D&1){ne=25;break t}}else d=e[d>>2]|0;if((d|0)!=-1){if(w)break;d=C;break t}else{e[o>>2]=0,ne=17;break}}else ne=17;while(!1);if((ne|0)==17)if(ne=0,w){d=0;break}else C=0;if(d=S[ie>>0]|0,d=d&1?e[_>>2]|0:(d&255)>>>1,(e[K>>2]|0)==(t+d|0)){if(g=0,xe(8,ie|0,d<<1|0,0),D=g,g=0,D&1){ne=25;break}if(S[ie>>0]&1?t=(e[ie>>2]&-2)+-1|0:t=10,g=0,xe(8,ie|0,t|0,0),D=g,g=0,D&1){ne=25;break}t=S[ie>>0]&1?e[N>>2]|0:R,e[K>>2]=t+d}if(w=l+12|0,d=e[w>>2]|0,D=l+16|0,(d|0)==(e[D>>2]|0)){if(g=0,d=ge(e[(e[l>>2]|0)+36>>2]|0,l|0)|0,ce=g,g=0,ce&1){ne=25;break}}else d=e[d>>2]|0;if(Pi(d,Q,t,K,G,k,oe,P,O,U)|0){d=C;break}if(d=e[w>>2]|0,(d|0)==(e[D>>2]|0))if(g=0,ge(e[(e[l>>2]|0)+40>>2]|0,l|0)|0,ce=g,g=0,ce&1){ne=25;break}else{d=l;continue}else{e[w>>2]=d+4,d=l;continue}}if((ne|0)==25){t=j()|0;break}if(ce=S[oe>>0]|0,(ce&1?e[oe+4>>2]|0:(ce&255)>>>1)|0&&($=e[O>>2]|0,($-P|0)<160)&&(ce=e[G>>2]|0,e[O>>2]=$+4,e[$>>2]=ce),g=0,t=Pe(25,t|0,e[K>>2]|0,c|0,Q|0)|0,ce=g,g=0,ce&1)ne=26;else{if(e[h>>2]=t,V0(oe,P,e[O>>2]|0,c),l){if(t=e[l+12>>2]|0,(t|0)==(e[l+16>>2]|0)){if(g=0,t=ge(e[(e[l>>2]|0)+36>>2]|0,l|0)|0,ce=g,g=0,ce&1){ne=26;break}}else t=e[t>>2]|0;(t|0)==-1?(e[r>>2]=0,l=1):l=0}else l=1;do if(d){if(t=e[d+12>>2]|0,(t|0)==(e[d+16>>2]|0)){if(g=0,t=ge(e[(e[d>>2]|0)+36>>2]|0,d|0)|0,ce=g,g=0,ce&1){ne=26;break e}}else t=e[t>>2]|0;if((t|0)!=-1){if(l)break;ne=53;break}else{e[o>>2]=0,ne=51;break}}else ne=51;while(!1);return(ne|0)==51&&l&&(ne=53),(ne|0)==53&&(e[c>>2]=e[c>>2]|2),ce=e[r>>2]|0,de(ie),de(oe),b=Z,ce|0}}while(!1);return(ne|0)==26&&(t=j()|0),de(ie),de(oe),le(t|0),0}function K4(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0,ce=0;Z=b,b=b+320|0,U=Z+208|0,d=Z+200|0,oe=Z+24|0,ie=Z+12|0,K=Z+8|0,P=Z+40|0,O=Z+4|0,G=Z,Q=li(l)|0,Wi(oe,l,U,d),e[ie>>2]=0,e[ie+4>>2]=0,e[ie+8>>2]=0,S[ie>>0]&1?t=(e[ie>>2]&-2)+-1|0:t=10,g=0,xe(8,ie|0,t|0,0),_=g,g=0;e:do if(_&1)ne=26;else{N=ie+8|0,R=ie+1|0,t=S[ie>>0]&1?e[N>>2]|0:R,e[K>>2]=t,e[O>>2]=P,e[G>>2]=0,_=ie+4|0,k=e[d>>2]|0,d=e[r>>2]|0;t:for(;;){if(d){if(l=e[d+12>>2]|0,(l|0)==(e[d+16>>2]|0)){if(g=0,l=ge(e[(e[d>>2]|0)+36>>2]|0,d|0)|0,D=g,g=0,D&1){ne=25;break}}else l=e[l>>2]|0;(l|0)==-1?(e[r>>2]=0,d=0,C=1):C=0}else d=0,C=1;w=e[o>>2]|0;do if(w){if(l=e[w+12>>2]|0,(l|0)==(e[w+16>>2]|0)){if(g=0,l=ge(e[(e[w>>2]|0)+36>>2]|0,w|0)|0,D=g,g=0,D&1){ne=25;break t}}else l=e[l>>2]|0;if((l|0)!=-1){if(C)break;break t}else{e[o>>2]=0,ne=17;break}}else ne=17;while(!1);if((ne|0)==17)if(ne=0,C){w=0;break}else w=0;if(l=S[ie>>0]|0,l=l&1?e[_>>2]|0:(l&255)>>>1,(e[K>>2]|0)==(t+l|0)){if(g=0,xe(8,ie|0,l<<1|0,0),D=g,g=0,D&1){ne=25;break}if(S[ie>>0]&1?t=(e[ie>>2]&-2)+-1|0:t=10,g=0,xe(8,ie|0,t|0,0),D=g,g=0,D&1){ne=25;break}t=S[ie>>0]&1?e[N>>2]|0:R,e[K>>2]=t+l}if(C=d+12|0,l=e[C>>2]|0,D=d+16|0,(l|0)==(e[D>>2]|0)){if(g=0,l=ge(e[(e[d>>2]|0)+36>>2]|0,d|0)|0,ce=g,g=0,ce&1){ne=25;break}}else l=e[l>>2]|0;if(Pi(l,Q,t,K,G,k,oe,P,O,U)|0)break;if(l=e[C>>2]|0,(l|0)==(e[D>>2]|0))if(g=0,ge(e[(e[d>>2]|0)+40>>2]|0,d|0)|0,ce=g,g=0,ce&1){ne=25;break}else continue;else{e[C>>2]=l+4;continue}}if((ne|0)==25){t=j()|0;break}if(ce=S[oe>>0]|0,(ce&1?e[oe+4>>2]|0:(ce&255)>>>1)|0&&($=e[O>>2]|0,($-P|0)<160)&&(ce=e[G>>2]|0,e[O>>2]=$+4,e[$>>2]=ce),g=0,t=Pe(26,t|0,e[K>>2]|0,c|0,Q|0)|0,l=ye,ce=g,g=0,ce&1)ne=26;else{if(ce=h,e[ce>>2]=t,e[ce+4>>2]=l,V0(oe,P,e[O>>2]|0,c),d){if(t=e[d+12>>2]|0,(t|0)==(e[d+16>>2]|0)){if(g=0,t=ge(e[(e[d>>2]|0)+36>>2]|0,d|0)|0,ce=g,g=0,ce&1){ne=26;break}}else t=e[t>>2]|0;(t|0)==-1?(e[r>>2]=0,l=1):l=0}else l=1;do if(w){if(t=e[w+12>>2]|0,(t|0)==(e[w+16>>2]|0)){if(g=0,t=ge(e[(e[w>>2]|0)+36>>2]|0,w|0)|0,ce=g,g=0,ce&1){ne=26;break e}}else t=e[t>>2]|0;if((t|0)!=-1){if(l)break;ne=53;break}else{e[o>>2]=0,ne=51;break}}else ne=51;while(!1);return(ne|0)==51&&l&&(ne=53),(ne|0)==53&&(e[c>>2]=e[c>>2]|2),ce=e[r>>2]|0,de(ie),de(oe),b=Z,ce|0}}while(!1);return(ne|0)==26&&(t=j()|0),de(ie),de(oe),le(t|0),0}function Y4(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0,ce=0,ke=0,Ee=0,Te=0;ne=b,b=b+352|0,K=ne+208|0,w=ne+40|0,C=ne+36|0,ke=ne+24|0,ce=ne+12|0,$=ne+8|0,ie=ne+48|0,oe=ne+4|0,P=ne,O=ne+337|0,G=ne+336|0,xr(ke,l,K,w,C),e[ce>>2]=0,e[ce+4>>2]=0,e[ce+8>>2]=0,S[ce>>0]&1?t=(e[ce>>2]&-2)+-1|0:t=10,g=0,xe(8,ce|0,t|0,0),Q=g,g=0;e:do if(Q&1)Ee=26;else{_=ce+8|0,U=ce+1|0,t=S[ce>>0]&1?e[_>>2]|0:U,e[$>>2]=t,e[oe>>2]=ie,e[P>>2]=0,S[O>>0]=1,S[G>>0]=69,Q=ce+4|0,R=e[w>>2]|0,N=e[C>>2]|0,l=e[r>>2]|0;t:for(;;){if(l){if(w=e[l+12>>2]|0,(w|0)==(e[l+16>>2]|0)){if(g=0,w=ge(e[(e[l>>2]|0)+36>>2]|0,l|0)|0,k=g,g=0,k&1){Ee=25;break}}else w=e[w>>2]|0;(w|0)==-1?(e[r>>2]=0,l=0,D=1):D=0}else l=0,D=1;w=e[o>>2]|0;do if(w){if(C=e[w+12>>2]|0,(C|0)==(e[w+16>>2]|0)){if(g=0,C=ge(e[(e[w>>2]|0)+36>>2]|0,w|0)|0,k=g,g=0,k&1){Ee=25;break t}}else C=e[C>>2]|0;if((C|0)!=-1){if(D)break;break t}else{e[o>>2]=0,Ee=17;break}}else Ee=17;while(!1);if((Ee|0)==17)if(Ee=0,D){w=0;break}else w=0;if(C=S[ce>>0]|0,C=C&1?e[Q>>2]|0:(C&255)>>>1,(e[$>>2]|0)==(t+C|0)){if(g=0,xe(8,ce|0,C<<1|0,0),k=g,g=0,k&1){Ee=25;break}if(S[ce>>0]&1?t=(e[ce>>2]&-2)+-1|0:t=10,g=0,xe(8,ce|0,t|0,0),k=g,g=0,k&1){Ee=25;break}t=S[ce>>0]&1?e[_>>2]|0:U,e[$>>2]=t+C}if(D=l+12|0,C=e[D>>2]|0,k=l+16|0,(C|0)==(e[k>>2]|0)){if(g=0,C=ge(e[(e[l>>2]|0)+36>>2]|0,l|0)|0,Te=g,g=0,Te&1){Ee=25;break}}else C=e[C>>2]|0;if(wr(C,O,G,t,$,R,N,ke,ie,oe,P,K)|0)break;if(w=e[D>>2]|0,(w|0)==(e[k>>2]|0))if(g=0,ge(e[(e[l>>2]|0)+40>>2]|0,l|0)|0,Te=g,g=0,Te&1){Ee=25;break}else continue;else{e[D>>2]=w+4;continue}}if((Ee|0)==25){t=j()|0;break}if(Te=S[ke>>0]|0,!(!(S[O>>0]|0)||!((Te&1?e[ke+4>>2]|0:(Te&255)>>>1)|0))&&(Z=e[oe>>2]|0,(Z-ie|0)<160)&&(Te=e[P>>2]|0,e[oe>>2]=Z+4,e[Z>>2]=Te),g=0,d=+lt(1,t|0,e[$>>2]|0,c|0),Te=g,g=0,Te&1)Ee=26;else{if(V[h>>2]=d,V0(ke,ie,e[oe>>2]|0,c),l){if(t=e[l+12>>2]|0,(t|0)==(e[l+16>>2]|0)){if(g=0,t=ge(e[(e[l>>2]|0)+36>>2]|0,l|0)|0,Te=g,g=0,Te&1){Ee=26;break}}else t=e[t>>2]|0;(t|0)==-1?(e[r>>2]=0,l=1):l=0}else l=1;do if(w){if(t=e[w+12>>2]|0,(t|0)==(e[w+16>>2]|0)){if(g=0,t=ge(e[(e[w>>2]|0)+36>>2]|0,w|0)|0,Te=g,g=0,Te&1){Ee=26;break e}}else t=e[t>>2]|0;if((t|0)!=-1){if(l)break;Ee=53;break}else{e[o>>2]=0,Ee=51;break}}else Ee=51;while(!1);return(Ee|0)==51&&l&&(Ee=53),(Ee|0)==53&&(e[c>>2]=e[c>>2]|2),Te=e[r>>2]|0,de(ce),de(ke),b=ne,Te|0}}while(!1);return(Ee|0)==26&&(t=j()|0),de(ce),de(ke),le(t|0),0}function j4(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0,ce=0,ke=0,Ee=0,Te=0;ne=b,b=b+352|0,K=ne+208|0,w=ne+40|0,C=ne+36|0,ke=ne+24|0,ce=ne+12|0,$=ne+8|0,ie=ne+48|0,oe=ne+4|0,P=ne,O=ne+337|0,G=ne+336|0,xr(ke,l,K,w,C),e[ce>>2]=0,e[ce+4>>2]=0,e[ce+8>>2]=0,S[ce>>0]&1?t=(e[ce>>2]&-2)+-1|0:t=10,g=0,xe(8,ce|0,t|0,0),Q=g,g=0;e:do if(Q&1)Ee=26;else{_=ce+8|0,U=ce+1|0,t=S[ce>>0]&1?e[_>>2]|0:U,e[$>>2]=t,e[oe>>2]=ie,e[P>>2]=0,S[O>>0]=1,S[G>>0]=69,Q=ce+4|0,R=e[w>>2]|0,N=e[C>>2]|0,l=e[r>>2]|0;t:for(;;){if(l){if(w=e[l+12>>2]|0,(w|0)==(e[l+16>>2]|0)){if(g=0,w=ge(e[(e[l>>2]|0)+36>>2]|0,l|0)|0,k=g,g=0,k&1){Ee=25;break}}else w=e[w>>2]|0;(w|0)==-1?(e[r>>2]=0,l=0,D=1):D=0}else l=0,D=1;w=e[o>>2]|0;do if(w){if(C=e[w+12>>2]|0,(C|0)==(e[w+16>>2]|0)){if(g=0,C=ge(e[(e[w>>2]|0)+36>>2]|0,w|0)|0,k=g,g=0,k&1){Ee=25;break t}}else C=e[C>>2]|0;if((C|0)!=-1){if(D)break;break t}else{e[o>>2]=0,Ee=17;break}}else Ee=17;while(!1);if((Ee|0)==17)if(Ee=0,D){w=0;break}else w=0;if(C=S[ce>>0]|0,C=C&1?e[Q>>2]|0:(C&255)>>>1,(e[$>>2]|0)==(t+C|0)){if(g=0,xe(8,ce|0,C<<1|0,0),k=g,g=0,k&1){Ee=25;break}if(S[ce>>0]&1?t=(e[ce>>2]&-2)+-1|0:t=10,g=0,xe(8,ce|0,t|0,0),k=g,g=0,k&1){Ee=25;break}t=S[ce>>0]&1?e[_>>2]|0:U,e[$>>2]=t+C}if(D=l+12|0,C=e[D>>2]|0,k=l+16|0,(C|0)==(e[k>>2]|0)){if(g=0,C=ge(e[(e[l>>2]|0)+36>>2]|0,l|0)|0,Te=g,g=0,Te&1){Ee=25;break}}else C=e[C>>2]|0;if(wr(C,O,G,t,$,R,N,ke,ie,oe,P,K)|0)break;if(w=e[D>>2]|0,(w|0)==(e[k>>2]|0))if(g=0,ge(e[(e[l>>2]|0)+40>>2]|0,l|0)|0,Te=g,g=0,Te&1){Ee=25;break}else continue;else{e[D>>2]=w+4;continue}}if((Ee|0)==25){t=j()|0;break}if(Te=S[ke>>0]|0,!(!(S[O>>0]|0)||!((Te&1?e[ke+4>>2]|0:(Te&255)>>>1)|0))&&(Z=e[oe>>2]|0,(Z-ie|0)<160)&&(Te=e[P>>2]|0,e[oe>>2]=Z+4,e[Z>>2]=Te),g=0,d=+lt(2,t|0,e[$>>2]|0,c|0),Te=g,g=0,Te&1)Ee=26;else{if(B[h>>3]=d,V0(ke,ie,e[oe>>2]|0,c),l){if(t=e[l+12>>2]|0,(t|0)==(e[l+16>>2]|0)){if(g=0,t=ge(e[(e[l>>2]|0)+36>>2]|0,l|0)|0,Te=g,g=0,Te&1){Ee=26;break}}else t=e[t>>2]|0;(t|0)==-1?(e[r>>2]=0,l=1):l=0}else l=1;do if(w){if(t=e[w+12>>2]|0,(t|0)==(e[w+16>>2]|0)){if(g=0,t=ge(e[(e[w>>2]|0)+36>>2]|0,w|0)|0,Te=g,g=0,Te&1){Ee=26;break e}}else t=e[t>>2]|0;if((t|0)!=-1){if(l)break;Ee=53;break}else{e[o>>2]=0,Ee=51;break}}else Ee=51;while(!1);return(Ee|0)==51&&l&&(Ee=53),(Ee|0)==53&&(e[c>>2]=e[c>>2]|2),Te=e[r>>2]|0,de(ce),de(ke),b=ne,Te|0}}while(!1);return(Ee|0)==26&&(t=j()|0),de(ce),de(ke),le(t|0),0}function X4(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0,ce=0,ke=0,Ee=0,Te=0;ne=b,b=b+352|0,K=ne+208|0,w=ne+40|0,C=ne+36|0,ke=ne+24|0,ce=ne+12|0,$=ne+8|0,ie=ne+48|0,oe=ne+4|0,P=ne,O=ne+337|0,G=ne+336|0,xr(ke,l,K,w,C),e[ce>>2]=0,e[ce+4>>2]=0,e[ce+8>>2]=0,S[ce>>0]&1?t=(e[ce>>2]&-2)+-1|0:t=10,g=0,xe(8,ce|0,t|0,0),Q=g,g=0;e:do if(Q&1)Ee=26;else{_=ce+8|0,U=ce+1|0,t=S[ce>>0]&1?e[_>>2]|0:U,e[$>>2]=t,e[oe>>2]=ie,e[P>>2]=0,S[O>>0]=1,S[G>>0]=69,Q=ce+4|0,R=e[w>>2]|0,N=e[C>>2]|0,l=e[r>>2]|0;t:for(;;){if(l){if(w=e[l+12>>2]|0,(w|0)==(e[l+16>>2]|0)){if(g=0,w=ge(e[(e[l>>2]|0)+36>>2]|0,l|0)|0,k=g,g=0,k&1){Ee=25;break}}else w=e[w>>2]|0;(w|0)==-1?(e[r>>2]=0,l=0,D=1):D=0}else l=0,D=1;w=e[o>>2]|0;do if(w){if(C=e[w+12>>2]|0,(C|0)==(e[w+16>>2]|0)){if(g=0,C=ge(e[(e[w>>2]|0)+36>>2]|0,w|0)|0,k=g,g=0,k&1){Ee=25;break t}}else C=e[C>>2]|0;if((C|0)!=-1){if(D)break;break t}else{e[o>>2]=0,Ee=17;break}}else Ee=17;while(!1);if((Ee|0)==17)if(Ee=0,D){w=0;break}else w=0;if(C=S[ce>>0]|0,C=C&1?e[Q>>2]|0:(C&255)>>>1,(e[$>>2]|0)==(t+C|0)){if(g=0,xe(8,ce|0,C<<1|0,0),k=g,g=0,k&1){Ee=25;break}if(S[ce>>0]&1?t=(e[ce>>2]&-2)+-1|0:t=10,g=0,xe(8,ce|0,t|0,0),k=g,g=0,k&1){Ee=25;break}t=S[ce>>0]&1?e[_>>2]|0:U,e[$>>2]=t+C}if(D=l+12|0,C=e[D>>2]|0,k=l+16|0,(C|0)==(e[k>>2]|0)){if(g=0,C=ge(e[(e[l>>2]|0)+36>>2]|0,l|0)|0,Te=g,g=0,Te&1){Ee=25;break}}else C=e[C>>2]|0;if(wr(C,O,G,t,$,R,N,ke,ie,oe,P,K)|0)break;if(w=e[D>>2]|0,(w|0)==(e[k>>2]|0))if(g=0,ge(e[(e[l>>2]|0)+40>>2]|0,l|0)|0,Te=g,g=0,Te&1){Ee=25;break}else continue;else{e[D>>2]=w+4;continue}}if((Ee|0)==25){t=j()|0;break}if(Te=S[ke>>0]|0,!(!(S[O>>0]|0)||!((Te&1?e[ke+4>>2]|0:(Te&255)>>>1)|0))&&(Z=e[oe>>2]|0,(Z-ie|0)<160)&&(Te=e[P>>2]|0,e[oe>>2]=Z+4,e[Z>>2]=Te),g=0,d=+lt(3,t|0,e[$>>2]|0,c|0),Te=g,g=0,Te&1)Ee=26;else{if(B[h>>3]=d,V0(ke,ie,e[oe>>2]|0,c),l){if(t=e[l+12>>2]|0,(t|0)==(e[l+16>>2]|0)){if(g=0,t=ge(e[(e[l>>2]|0)+36>>2]|0,l|0)|0,Te=g,g=0,Te&1){Ee=26;break}}else t=e[t>>2]|0;(t|0)==-1?(e[r>>2]=0,l=1):l=0}else l=1;do if(w){if(t=e[w+12>>2]|0,(t|0)==(e[w+16>>2]|0)){if(g=0,t=ge(e[(e[w>>2]|0)+36>>2]|0,w|0)|0,Te=g,g=0,Te&1){Ee=26;break e}}else t=e[t>>2]|0;if((t|0)!=-1){if(l)break;Ee=53;break}else{e[o>>2]=0,Ee=51;break}}else Ee=51;while(!1);return(Ee|0)==51&&l&&(Ee=53),(Ee|0)==53&&(e[c>>2]=e[c>>2]|2),Te=e[r>>2]|0,de(ce),de(ke),b=ne,Te|0}}while(!1);return(Ee|0)==26&&(t=j()|0),de(ce),de(ke),le(t|0),0}function q0(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0;return h=b,b=b+16|0,d=h,e[d>>2]=c,c=ai(o)|0,o=Mn(t,r,l,d)|0,c|0&&(g=0,ge(75,c|0)|0,d=g,g=0,d&1)&&(d=j(0)|0,$t(d)),b=h,o|0}function Z4(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0;if(c=b,b=b+16|0,h=c,e[h>>2]=l,l=ai(r)|0,g=0,r=Ve(37,t|0,o|0,h|0)|0,t=g,g=0,t&1)r=j()|0,l|0&&(g=0,ge(75,l|0)|0,h=g,g=0,h&1)&&(h=j(0)|0,$t(h)),le(r|0);else return l|0&&(g=0,ge(75,l|0)|0,h=g,g=0,h&1)&&(h=j(0)|0,$t(h)),b=c,r|0;return 0}function Hi(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0,N=0,R=0;N=b,b=b+16|0,k=N,d=e[t>>2]|0;e:do if(!d)d=0;else{if(R=r,C=l-R>>2,D=c+12|0,w=e[D>>2]|0,C=(w|0)>(C|0)?w-C|0:0,w=o,R=w-R|0,c=R>>2,(R|0)>0&&(Yt[e[(e[d>>2]|0)+48>>2]&63](d,r,c)|0)!=(c|0)){e[t>>2]=0,d=0;break}do if((C|0)>0)if(gr(k,C,h),g=0,c=Ve(e[(e[d>>2]|0)+48>>2]|0,d|0,(S[k>>0]&1?e[k+8>>2]|0:k+4|0)|0,C|0)|0,R=g,g=0,R&1&&(R=j()|0,Pt(k),le(R|0)),(c|0)==(C|0)){Pt(k);break}else{e[t>>2]=0,Pt(k),d=0;break e}while(!1);if(R=l-w|0,l=R>>2,(R|0)>0&&(Yt[e[(e[d>>2]|0)+48>>2]&63](d,o,l)|0)!=(l|0)){e[t>>2]=0,d=0;break}e[D>>2]=0}while(!1);return b=N,d|0}function fi(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0;h=e[t>>2]|0;do if(h){if((e[h+12>>2]|0)==(e[h+16>>2]|0))if((Dt[e[(e[h>>2]|0)+36>>2]&127](h)|0)==-1){e[t>>2]=0,h=0;break}else{h=e[t>>2]|0;break}}else h=0;while(!1);d=(h|0)==0,h=e[r>>2]|0;do if(h){if((e[h+12>>2]|0)==(e[h+16>>2]|0)&&(Dt[e[(e[h>>2]|0)+36>>2]&127](h)|0)==-1){e[r>>2]=0,U=11;break}d?U=13:U=12}else U=11;while(!1);(U|0)==11&&(d?U=12:(h=0,U=13));e:do if((U|0)==12)e[o>>2]=e[o>>2]|6,h=0;else if((U|0)==13){if(d=e[t>>2]|0,w=e[d+12>>2]|0,(w|0)==(e[d+16>>2]|0)?d=Dt[e[(e[d>>2]|0)+36>>2]&127](d)|0:d=F[w>>0]|0,w=d&255,w<<24>>24>-1&&(_=l+8|0,(I[(e[_>>2]|0)+(d<<24>>24<<1)>>1]&2048)!=0)){for(D=(Yt[e[(e[l>>2]|0)+36>>2]&63](l,w,0)|0)<<24>>24,d=e[t>>2]|0,w=d+12|0,C=e[w>>2]|0,(C|0)==(e[d+16>>2]|0)?(Dt[e[(e[d>>2]|0)+40>>2]&127](d)|0,N=c,k=h,c=h,h=D):(e[w>>2]=C+1,N=c,k=h,c=h,h=D);;){h=h+-48|0,R=N+-1|0,d=e[t>>2]|0;do if(d){if((e[d+12>>2]|0)==(e[d+16>>2]|0))if((Dt[e[(e[d>>2]|0)+36>>2]&127](d)|0)==-1){e[t>>2]=0,d=0;break}else{d=e[t>>2]|0;break}}else d=0;while(!1);if(C=(d|0)==0,c?(e[c+12>>2]|0)==(e[c+16>>2]|0)?(Dt[e[(e[c>>2]|0)+36>>2]&127](c)|0)==-1?(e[r>>2]=0,w=0,c=0):(w=k,c=k):w=k:(w=k,c=0),d=e[t>>2]|0,!((N|0)>1&(C^(c|0)==0)))break;if(C=e[d+12>>2]|0,(C|0)==(e[d+16>>2]|0)?d=Dt[e[(e[d>>2]|0)+36>>2]&127](d)|0:d=F[C>>0]|0,C=d&255,C<<24>>24<=-1||!(I[(e[_>>2]|0)+(d<<24>>24<<1)>>1]&2048))break e;if(h=((Yt[e[(e[l>>2]|0)+36>>2]&63](l,C,0)|0)<<24>>24)+(h*10|0)|0,d=e[t>>2]|0,C=d+12|0,D=e[C>>2]|0,(D|0)==(e[d+16>>2]|0)){Dt[e[(e[d>>2]|0)+40>>2]&127](d)|0,N=R,k=w;continue}else{e[C>>2]=D+1,N=R,k=w;continue}}do if(d){if((e[d+12>>2]|0)==(e[d+16>>2]|0))if((Dt[e[(e[d>>2]|0)+36>>2]&127](d)|0)==-1){e[t>>2]=0,d=0;break}else{d=e[t>>2]|0;break}}else d=0;while(!1);d=(d|0)==0;do if(w){if((e[w+12>>2]|0)==(e[w+16>>2]|0)&&(Dt[e[(e[w>>2]|0)+36>>2]&127](w)|0)==-1){e[r>>2]=0,U=50;break}if(d)break e}else U=50;while(!1);if((U|0)==50&&!d)break;e[o>>2]=e[o>>2]|2;break}e[o>>2]=e[o>>2]|4,h=0}while(!1);return h|0}function hi(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0;h=e[t>>2]|0;do if(h)if(d=e[h+12>>2]|0,(d|0)==(e[h+16>>2]|0)?h=Dt[e[(e[h>>2]|0)+36>>2]&127](h)|0:h=e[d>>2]|0,(h|0)==-1){e[t>>2]=0,w=1;break}else{w=(e[t>>2]|0)==0;break}else w=1;while(!1);d=e[r>>2]|0;do if(d)if(h=e[d+12>>2]|0,(h|0)==(e[d+16>>2]|0)?h=Dt[e[(e[d>>2]|0)+36>>2]&127](d)|0:h=e[h>>2]|0,(h|0)!=-1)if(w){_=17;break}else{_=16;break}else{e[r>>2]=0,_=14;break}else _=14;while(!1);(_|0)==14&&(w?_=16:(d=0,_=17));e:do if((_|0)==16)e[o>>2]=e[o>>2]|6,h=0;else if((_|0)==17){if(h=e[t>>2]|0,w=e[h+12>>2]|0,(w|0)==(e[h+16>>2]|0)?h=Dt[e[(e[h>>2]|0)+36>>2]&127](h)|0:h=e[w>>2]|0,!(Yt[e[(e[l>>2]|0)+12>>2]&63](l,2048,h)|0)){e[o>>2]=e[o>>2]|4,h=0;break}for(h=(Yt[e[(e[l>>2]|0)+52>>2]&63](l,h,0)|0)<<24>>24,w=e[t>>2]|0,C=w+12|0,D=e[C>>2]|0,(D|0)==(e[w+16>>2]|0)?(Dt[e[(e[w>>2]|0)+40>>2]&127](w)|0,N=c,k=d,C=d):(e[C>>2]=D+4,N=c,k=d,C=d);;){h=h+-48|0,R=N+-1|0,d=e[t>>2]|0;do if(d)if(w=e[d+12>>2]|0,(w|0)==(e[d+16>>2]|0)?d=Dt[e[(e[d>>2]|0)+36>>2]&127](d)|0:d=e[w>>2]|0,(d|0)==-1){e[t>>2]=0,D=1;break}else{D=(e[t>>2]|0)==0;break}else D=1;while(!1);do if(C)if(d=e[C+12>>2]|0,(d|0)==(e[C+16>>2]|0)?d=Dt[e[(e[C>>2]|0)+36>>2]&127](C)|0:d=e[d>>2]|0,(d|0)==-1){e[r>>2]=0,C=0,c=0,d=1;break}else{C=k,c=k,d=(k|0)==0;break}else C=k,c=0,d=1;while(!1);if(w=e[t>>2]|0,!((N|0)>1&(D^d)))break;if(d=e[w+12>>2]|0,(d|0)==(e[w+16>>2]|0)?d=Dt[e[(e[w>>2]|0)+36>>2]&127](w)|0:d=e[d>>2]|0,!(Yt[e[(e[l>>2]|0)+12>>2]&63](l,2048,d)|0))break e;if(h=((Yt[e[(e[l>>2]|0)+52>>2]&63](l,d,0)|0)<<24>>24)+(h*10|0)|0,d=e[t>>2]|0,w=d+12|0,D=e[w>>2]|0,(D|0)==(e[d+16>>2]|0)){Dt[e[(e[d>>2]|0)+40>>2]&127](d)|0,N=R,k=C,C=c;continue}else{e[w>>2]=D+4,N=R,k=C,C=c;continue}}do if(w)if(d=e[w+12>>2]|0,(d|0)==(e[w+16>>2]|0)?d=Dt[e[(e[w>>2]|0)+36>>2]&127](w)|0:d=e[d>>2]|0,(d|0)==-1){e[t>>2]=0,w=1;break}else{w=(e[t>>2]|0)==0;break}else w=1;while(!1);do if(C)if(d=e[C+12>>2]|0,(d|0)==(e[C+16>>2]|0)?d=Dt[e[(e[C>>2]|0)+36>>2]&127](C)|0:d=e[d>>2]|0,(d|0)!=-1){if(w)break e;break}else{e[r>>2]=0,_=60;break}else _=60;while(!1);if((_|0)==60&&!w)break;e[o>>2]=e[o>>2]|2}while(!1);return h|0}function J4(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0,w=0,C=0;h=t+4|0,l=(e[h>>2]|0)!=189,w=e[t>>2]|0,d=w,c=(e[o>>2]|0)-d|0,c=c>>>0<2147483647?c<<1:-1,d=(e[r>>2]|0)-d|0,w=Gi(l?w:0,c)|0,w||kn();do if(l)e[t>>2]=w,C=w;else if(l=e[t>>2]|0,e[t>>2]=w,l)if(g=0,ue(e[h>>2]|0,l|0),w=g,g=0,w&1)w=j(0)|0,$t(w);else{C=e[t>>2]|0;break}else C=w;while(!1);e[h>>2]=201,e[r>>2]=C+d,e[o>>2]=(e[t>>2]|0)+c}function e3(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0,w=0,C=0;h=t+4|0,l=(e[h>>2]|0)!=189,w=e[t>>2]|0,d=w,c=(e[o>>2]|0)-d|0,c=c>>>0<2147483647?c<<1:-1,d=(e[r>>2]|0)-d>>2,w=Gi(l?w:0,c)|0,w||kn();do if(l)e[t>>2]=w,C=w;else if(l=e[t>>2]|0,e[t>>2]=w,l)if(g=0,ue(e[h>>2]|0,l|0),w=g,g=0,w&1)w=j(0)|0,$t(w);else{C=e[t>>2]|0;break}else C=w;while(!1);e[h>>2]=201,e[r>>2]=C+(d<<2),e[o>>2]=(e[t>>2]|0)+(c>>>2<<2)}function t3(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0,w=0,C=0;h=r,l=S[t>>0]|0,l&1?(l=e[t>>2]|0,c=(l&-2)+-1|0,C=e[t+4>>2]|0,l=l&255):(c=10,C=(l&255)>>>1),w=o-h|0;do if((o|0)!=(r|0)){if((c-C|0)>>>0>>0&&(pr(t,c,C+w-c|0,C,C,0,0),l=S[t>>0]|0),l&1?d=e[t+8>>2]|0:d=t+1|0,h=o+(C-h)|0,(r|0)!=(o|0))for(l=r,c=d+C|0;S[c>>0]=S[l>>0]|0,l=l+1|0,(l|0)!=(o|0);)c=c+1|0;if(S[d+h>>0]=0,l=C+w|0,S[t>>0]&1){e[t+4>>2]=l;break}else{S[t>>0]=l<<1;break}}while(!1);return t|0}function i3(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0,w=0,C=0;h=t+4|0,l=(e[h>>2]|0)!=189,w=e[t>>2]|0,d=w,c=(e[o>>2]|0)-d|0,c=c>>>0<2147483647?c<<1:-1,d=(e[r>>2]|0)-d>>2,w=Gi(l?w:0,c)|0,w||kn();do if(l)e[t>>2]=w,C=w;else if(l=e[t>>2]|0,e[t>>2]=w,l)if(g=0,ue(e[h>>2]|0,l|0),w=g,g=0,w&1)w=j(0)|0,$t(w);else{C=e[t>>2]|0;break}else C=w;while(!1);e[h>>2]=201,e[r>>2]=C+(d<<2),e[o>>2]=(e[t>>2]|0)+(c>>>2<<2)}function n3(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0,w=0,C=0;h=r,l=S[t>>0]|0,l&1?(l=e[t>>2]|0,c=(l&-2)+-1|0,C=e[t+4>>2]|0,l=l&255):(c=1,C=(l&255)>>>1),w=o-h>>2;do if(w){if((c-C|0)>>>0>>0&&(Ws(t,c,C+w-c|0,C,C,0,0),l=S[t>>0]|0),l&1?d=e[t+8>>2]|0:d=t+4|0,h=C+((o-h|0)>>>2)|0,(r|0)!=(o|0))for(l=r,c=d+(C<<2)|0;e[c>>2]=e[l>>2],l=l+4|0,(l|0)!=(o|0);)c=c+4|0;if(e[d+(h<<2)>>2]=0,l=C+w|0,S[t>>0]&1){e[t+4>>2]=l;break}else{S[t>>0]=l<<1;break}}while(!1);return t|0}function r3(t,r){t=t|0,r=r|0;var o=0;e[t>>2]=0,e[t+4>>2]=0,e[t+8>>2]=0,S[t+128>>0]=0;do if(r)if(g=0,Ae(125,t|0,r|0),o=g,g=0,o&1)o=j()|0,yr(t),le(o|0);else{no(t,r);break}while(!1)}function s3(t,r){t=t|0,r=r|0,w0(t,r,x0(43148)|0)}function o3(t,r){t=t|0,r=r|0,w0(t,r,x0(43188)|0)}function l3(t,r){t=t|0,r=r|0,w0(t,r,x0(44220)|0)}function u3(t,r){t=t|0,r=r|0,w0(t,r,x0(44212)|0)}function c3(t,r){t=t|0,r=r|0,w0(t,r,x0(44280)|0)}function f3(t,r){t=t|0,r=r|0,w0(t,r,x0(44288)|0)}function h3(t,r){t=t|0,r=r|0,w0(t,r,x0(44344)|0)}function d3(t,r){t=t|0,r=r|0,w0(t,r,x0(44352)|0)}function p3(t,r){t=t|0,r=r|0,w0(t,r,x0(44360)|0)}function m3(t,r){t=t|0,r=r|0,w0(t,r,x0(44368)|0)}function g3(t,r){t=t|0,r=r|0,w0(t,r,x0(43260)|0)}function S3(t,r){t=t|0,r=r|0,w0(t,r,x0(43332)|0)}function A3(t,r){t=t|0,r=r|0,w0(t,r,x0(43392)|0)}function v3(t,r){t=t|0,r=r|0,w0(t,r,x0(43452)|0)}function x3(t,r){t=t|0,r=r|0,w0(t,r,x0(43764)|0)}function w3(t,r){t=t|0,r=r|0,w0(t,r,x0(43828)|0)}function y3(t,r){t=t|0,r=r|0,w0(t,r,x0(43892)|0)}function C3(t,r){t=t|0,r=r|0,w0(t,r,x0(43956)|0)}function T3(t,r){t=t|0,r=r|0,w0(t,r,x0(43992)|0)}function I3(t,r){t=t|0,r=r|0,w0(t,r,x0(44028)|0)}function E3(t,r){t=t|0,r=r|0,w0(t,r,x0(44064)|0)}function k3(t,r){t=t|0,r=r|0,w0(t,r,x0(44100)|0)}function D3(t,r){t=t|0,r=r|0,w0(t,r,x0(43544)|0)}function b3(t,r){t=t|0,r=r|0,w0(t,r,x0(43636)|0)}function N3(t,r){t=t|0,r=r|0,w0(t,r,x0(43668)|0)}function F3(t,r){t=t|0,r=r|0,w0(t,r,x0(43700)|0)}function R3(t,r){t=t|0,r=r|0,w0(t,r,x0(44140)|0)}function M3(t,r){t=t|0,r=r|0,w0(t,r,x0(44180)|0)}function yr(t){t=t|0;var r=0,o=0,l=0;o=e[t>>2]|0;do if(o){if(l=t+4|0,r=e[l>>2]|0,(r|0)!=(o|0)){do r=r+-4|0;while((r|0)!=(o|0));e[l>>2]=r}if((t+16|0)==(o|0)){S[t+128>>0]=0;break}else{he(o);break}}while(!1)}function _3(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0;if(d=t+4|0,o=e[d>>2]|0,l=e[t>>2]|0,c=o-l>>2,c>>>0>=r>>>0){if(c>>>0>r>>>0&&(h=l+(r<<2)|0,(o|0)!=(h|0))){do o=o+-4|0;while((o|0)!=(h|0));e[d>>2]=o}}else Y3(t,r-c|0)}function P3(t,r){t=t|0,r=r|0;var o=0;return o=e[t+8>>2]|0,(e[t+12>>2]|0)-o>>2>>>0>r>>>0?o=(e[o+(r<<2)>>2]|0)!=0:o=0,o|0}function L3(t){t=t|0;var r=0,o=0;o=t+4|0,r=e[o>>2]|0,o=e[o+4>>2]|0,t=(e[t>>2]|0)+(o>>1)|0,o&1&&(r=e[(e[t>>2]|0)+r>>2]|0),Mt[r&255](t)}function O3(t,r,o,l,c,h,d,w){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0,w=w|0;var C=0,D=0;e[o>>2]=t,e[h>>2]=l,w&2?(c-l|0)<3?t=1:(e[h>>2]=l+1,S[l>>0]=-17,C=e[h>>2]|0,e[h>>2]=C+1,S[C>>0]=-69,C=e[h>>2]|0,e[h>>2]=C+1,S[C>>0]=-65,C=4):C=4;e:do if((C|0)==4)if(D=r,t=e[o>>2]|0,t>>>0>>0)for(;;){if(w=I[t>>1]|0,C=w&65535,C>>>0>d>>>0){t=2;break e}do if((w&65535)<128){if(t=e[h>>2]|0,(c-t|0)<1){t=1;break e}e[h>>2]=t+1,S[t>>0]=w}else{if((w&65535)<2048){if(t=e[h>>2]|0,(c-t|0)<2){t=1;break e}e[h>>2]=t+1,S[t>>0]=C>>>6|192,l=e[h>>2]|0,e[h>>2]=l+1,S[l>>0]=C&63|128;break}if((w&65535)<55296){if(t=e[h>>2]|0,(c-t|0)<3){t=1;break e}e[h>>2]=t+1,S[t>>0]=C>>>12|224,l=e[h>>2]|0,e[h>>2]=l+1,S[l>>0]=C>>>6&63|128,l=e[h>>2]|0,e[h>>2]=l+1,S[l>>0]=C&63|128;break}if((w&65535)>=56320){if((w&65535)<57344){t=2;break e}if(t=e[h>>2]|0,(c-t|0)<3){t=1;break e}e[h>>2]=t+1,S[t>>0]=C>>>12|224,l=e[h>>2]|0,e[h>>2]=l+1,S[l>>0]=C>>>6&63|128,l=e[h>>2]|0,e[h>>2]=l+1,S[l>>0]=C&63|128;break}if((D-t|0)<4){t=1;break e}if(t=t+2|0,w=M[t>>1]|0,(w&64512|0)!=56320){t=2;break e}if((c-(e[h>>2]|0)|0)<4){t=1;break e}if(l=C&960,((l<<10)+65536|C<<10&64512|w&1023)>>>0>d>>>0){t=2;break e}e[o>>2]=t,t=(l>>>6)+1|0,l=e[h>>2]|0,e[h>>2]=l+1,S[l>>0]=t>>>2|240,l=e[h>>2]|0,e[h>>2]=l+1,S[l>>0]=C>>>2&15|t<<4&48|128,l=e[h>>2]|0,e[h>>2]=l+1,S[l>>0]=C<<4&48|w>>>6&15|128,C=e[h>>2]|0,e[h>>2]=C+1,S[C>>0]=w&63|128}while(!1);if(t=(e[o>>2]|0)+2|0,e[o>>2]=t,t>>>0>=r>>>0){t=0;break}}else t=0;while(!1);return t|0}function $3(t,r,o,l,c,h,d,w){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0,w=w|0;var C=0,D=0,k=0,N=0,R=0,_=0;e[o>>2]=t,e[h>>2]=l,w&4?(t=e[o>>2]|0,w=r,(w-t|0)>2&&(S[t>>0]|0)==-17&&(S[t+1>>0]|0)==-69&&(S[t+2>>0]|0)==-65?(e[o>>2]=t+3,C=e[h>>2]|0):C=l):(C=l,w=r),R=c,l=e[o>>2]|0,t=l>>>0>>0;e:do if(t&C>>>0>>0)for(;;){if(t=S[l>>0]|0,k=t&255,k>>>0>d>>>0){t=2;break e}do if(t<<24>>24>-1)I[C>>1]=t&255,e[o>>2]=l+1;else{if((t&255)<194){t=2;break e}if((t&255)<224){if((w-l|0)<2){t=1;break e}if(t=F[l+1>>0]|0,(t&192|0)!=128){t=2;break e}if(t=t&63|k<<6&1984,t>>>0>d>>>0){t=2;break e}I[C>>1]=t,e[o>>2]=l+2;break}if((t&255)<240){if((w-l|0)<3){t=1;break e}switch(D=S[l+1>>0]|0,t=S[l+2>>0]|0,k|0){case 224:{if((D&-32)<<24>>24!=-96){t=2;break e}break}case 237:{if((D&-32)<<24>>24!=-128){t=2;break e}break}default:if((D&-64)<<24>>24!=-128){t=2;break e}}if(t=t&255,(t&192|0)!=128){t=2;break e}if(t=(D&255)<<6&4032|k<<12|t&63,(t&65535)>>>0>d>>>0){t=2;break e}I[C>>1]=t,e[o>>2]=l+3;break}if((t&255)>=245){t=2;break e}if((w-l|0)<4){t=1;break e}switch(D=S[l+1>>0]|0,t=S[l+2>>0]|0,l=S[l+3>>0]|0,k|0){case 240:{if((D+112&255)>=48){t=2;break e}break}case 244:{if((D&-16)<<24>>24!=-128){t=2;break e}break}default:if((D&-64)<<24>>24!=-128){t=2;break e}}if(N=t&255,(N&192|0)!=128){t=2;break e}if(t=l&255,(t&192|0)!=128){t=2;break e}if((R-C|0)<4){t=1;break e}if(k=k&7,l=D&255,D=N<<6,t=t&63,(l<<12&258048|k<<18|D&4032|t)>>>0>d>>>0){t=2;break e}I[C>>1]=l<<2&60|N>>>4&3|((l>>>4&3|k<<2)<<6)+16320|55296,N=C+2|0,e[h>>2]=N,I[N>>1]=t|D&960|56320,e[o>>2]=(e[o>>2]|0)+4}while(!1);if(C=(e[h>>2]|0)+2|0,e[h>>2]=C,l=e[o>>2]|0,t=l>>>0>>0,!(t&C>>>0>>0)){_=39;break}}else _=39;while(!1);return(_|0)==39&&(t=t&1),t|0}function B3(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0;N=r,c&4|0&&(N-t|0)>2&&(S[t>>0]|0)==-17&&(S[t+1>>0]|0)==-69?c=(S[t+2>>0]|0)==-65?t+3|0:t:c=t;e:do if((o|0)!=0&c>>>0>>0){k=c,h=0;t:for(;;){if(c=S[k>>0]|0,D=c&255,D>>>0>l>>>0){c=k,h=42;break e}do if(c<<24>>24>-1)c=k+1|0;else{if((c&255)<194){c=k,h=42;break e}if((c&255)<224){if((N-k|0)<2){c=k,h=42;break e}if(c=F[k+1>>0]|0,(c&192|0)!=128){c=k,h=42;break e}if((c&63|D<<6&1984)>>>0>l>>>0){c=k,h=42;break e}c=k+2|0;break}if((c&255)<240){if(c=k,(N-c|0)<3){c=k,h=42;break e}switch(w=S[k+1>>0]|0,d=S[k+2>>0]|0,D|0){case 224:{if((w&-32)<<24>>24!=-96){h=20;break t}break}case 237:{if((w&-32)<<24>>24!=-128){h=22;break t}break}default:if((w&-64)<<24>>24!=-128){h=24;break t}}if(c=d&255,(c&192|0)!=128){c=k,h=42;break e}if(((w&255)<<6&4032|D<<12&61440|c&63)>>>0>l>>>0){c=k,h=42;break e}c=k+3|0;break}if((c&255)>=245){c=k,h=42;break e}if(c=k,(o-h|0)>>>0<2|(N-c|0)<4){c=k,h=42;break e}switch(C=S[k+1>>0]|0,d=S[k+2>>0]|0,w=S[k+3>>0]|0,D|0){case 240:{if((C+112&255)>=48){h=32;break t}break}case 244:{if((C&-16)<<24>>24!=-128){h=34;break t}break}default:if((C&-64)<<24>>24!=-128){h=36;break t}}if(d=d&255,(d&192|0)!=128){c=k,h=42;break e}if(c=w&255,(c&192|0)!=128){c=k,h=42;break e}if(((C&255)<<12&258048|D<<18&1835008|d<<6&4032|c&63)>>>0>l>>>0){c=k,h=42;break e}c=k+4|0,h=h+1|0}while(!1);if(h=h+1|0,h>>>0>>0&c>>>0>>0)k=c;else{h=42;break e}}if((h|0)==20){c=c-t|0;break}else if((h|0)==22){c=c-t|0;break}else if((h|0)==24){c=c-t|0;break}else if((h|0)==32){c=c-t|0;break}else if((h|0)==34){c=c-t|0;break}else if((h|0)==36){c=c-t|0;break}}else h=42;while(!1);return(h|0)==42&&(c=c-t|0),c|0}function V3(t,r,o,l,c,h,d,w){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0,w=w|0;var C=0,D=0;e[o>>2]=t,e[h>>2]=l,D=c,w&2?(D-l|0)<3?t=1:(e[h>>2]=l+1,S[l>>0]=-17,C=e[h>>2]|0,e[h>>2]=C+1,S[C>>0]=-69,C=e[h>>2]|0,e[h>>2]=C+1,S[C>>0]=-65,C=4):C=4;e:do if((C|0)==4)if(t=e[o>>2]|0,t>>>0>>0)for(;;){if(w=e[t>>2]|0,w>>>0>d>>>0|(w&-2048|0)==55296){t=2;break e}do if(w>>>0>=128){if(w>>>0<2048){if(t=e[h>>2]|0,(D-t|0)<2){t=1;break e}e[h>>2]=t+1,S[t>>0]=w>>>6|192,C=e[h>>2]|0,e[h>>2]=C+1,S[C>>0]=w&63|128;break}if(t=e[h>>2]|0,c=D-t|0,w>>>0<65536){if((c|0)<3){t=1;break e}e[h>>2]=t+1,S[t>>0]=w>>>12|224,C=e[h>>2]|0,e[h>>2]=C+1,S[C>>0]=w>>>6&63|128,C=e[h>>2]|0,e[h>>2]=C+1,S[C>>0]=w&63|128;break}else{if((c|0)<4){t=1;break e}e[h>>2]=t+1,S[t>>0]=w>>>18|240,C=e[h>>2]|0,e[h>>2]=C+1,S[C>>0]=w>>>12&63|128,C=e[h>>2]|0,e[h>>2]=C+1,S[C>>0]=w>>>6&63|128,C=e[h>>2]|0,e[h>>2]=C+1,S[C>>0]=w&63|128;break}}else{if(t=e[h>>2]|0,(D-t|0)<1){t=1;break e}e[h>>2]=t+1,S[t>>0]=w}while(!1);if(t=(e[o>>2]|0)+4|0,e[o>>2]=t,t>>>0>=r>>>0){t=0;break}}else t=0;while(!1);return t|0}function U3(t,r,o,l,c,h,d,w){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0,w=w|0;var C=0,D=0,k=0,N=0,R=0,_=0;e[o>>2]=t,e[h>>2]=l,w&4?(t=e[o>>2]|0,w=r,(w-t|0)>2&&(S[t>>0]|0)==-17&&(S[t+1>>0]|0)==-69&&(S[t+2>>0]|0)==-65&&(e[o>>2]=t+3,l=e[h>>2]|0),R=w):R=r,w=e[o>>2]|0,t=w>>>0>>0;e:do if(t&l>>>0>>0)for(;;){t=S[w>>0]|0,N=t&255;do if(t<<24>>24>-1){if(N>>>0>d>>>0){t=2;break e}e[l>>2]=N,e[o>>2]=w+1}else{if((t&255)<194){t=2;break e}if((t&255)<224){if((R-w|0)<2){t=1;break e}if(t=F[w+1>>0]|0,(t&192|0)!=128){t=2;break e}if(t=t&63|N<<6&1984,t>>>0>d>>>0){t=2;break e}e[l>>2]=t,e[o>>2]=w+2;break}if((t&255)<240){if((R-w|0)<3){t=1;break e}switch(C=S[w+1>>0]|0,t=S[w+2>>0]|0,N|0){case 224:{if((C&-32)<<24>>24!=-96){t=2;break e}break}case 237:{if((C&-32)<<24>>24!=-128){t=2;break e}break}default:if((C&-64)<<24>>24!=-128){t=2;break e}}if(t=t&255,(t&192|0)!=128){t=2;break e}if(t=(C&255)<<6&4032|N<<12&61440|t&63,t>>>0>d>>>0){t=2;break e}e[l>>2]=t,e[o>>2]=w+3;break}if((t&255)>=245){t=2;break e}if((R-w|0)<4){t=1;break e}switch(k=S[w+1>>0]|0,t=S[w+2>>0]|0,C=S[w+3>>0]|0,N|0){case 240:{if((k+112&255)>=48){t=2;break e}break}case 244:{if((k&-16)<<24>>24!=-128){t=2;break e}break}default:if((k&-64)<<24>>24!=-128){t=2;break e}}if(D=t&255,(D&192|0)!=128){t=2;break e}if(t=C&255,(t&192|0)!=128){t=2;break e}if(t=(k&255)<<12&258048|N<<18&1835008|D<<6&4032|t&63,t>>>0>d>>>0){t=2;break e}e[l>>2]=t,e[o>>2]=w+4}while(!1);if(l=(e[h>>2]|0)+4|0,e[h>>2]=l,w=e[o>>2]|0,t=w>>>0>>0,!(t&l>>>0>>0)){_=38;break}}else _=38;while(!1);return(_|0)==38&&(t=t&1),t|0}function z3(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0;N=r,c&4|0&&(N-t|0)>2&&(S[t>>0]|0)==-17&&(S[t+1>>0]|0)==-69?c=(S[t+2>>0]|0)==-65?t+3|0:t:c=t;e:do if((o|0)!=0&c>>>0>>0){D=c,k=0;t:for(;;){c=S[D>>0]|0,C=c&255;do if(c<<24>>24>-1){if(C>>>0>l>>>0){c=D,h=42;break e}c=D+1|0}else{if((c&255)<194){c=D,h=42;break e}if((c&255)<224){if((N-D|0)<2){c=D,h=42;break e}if(c=F[D+1>>0]|0,(c&192|0)!=128){c=D,h=42;break e}if((c&63|C<<6&1984)>>>0>l>>>0){c=D,h=42;break e}c=D+2|0;break}if((c&255)<240){if(c=D,(N-c|0)<3){c=D,h=42;break e}switch(d=S[D+1>>0]|0,h=S[D+2>>0]|0,C|0){case 224:{if((d&-32)<<24>>24!=-96){h=20;break t}break}case 237:{if((d&-32)<<24>>24!=-128){h=22;break t}break}default:if((d&-64)<<24>>24!=-128){h=24;break t}}if(c=h&255,(c&192|0)!=128){c=D,h=42;break e}if(((d&255)<<6&4032|C<<12&61440|c&63)>>>0>l>>>0){c=D,h=42;break e}c=D+3|0;break}if((c&255)>=245){c=D,h=42;break e}if(c=D,(N-c|0)<4){c=D,h=42;break e}switch(w=S[D+1>>0]|0,h=S[D+2>>0]|0,d=S[D+3>>0]|0,C|0){case 240:{if((w+112&255)>=48){h=32;break t}break}case 244:{if((w&-16)<<24>>24!=-128){h=34;break t}break}default:if((w&-64)<<24>>24!=-128){h=36;break t}}if(h=h&255,(h&192|0)!=128){c=D,h=42;break e}if(c=d&255,(c&192|0)!=128){c=D,h=42;break e}if(((w&255)<<12&258048|C<<18&1835008|h<<6&4032|c&63)>>>0>l>>>0){c=D,h=42;break e}c=D+4|0}while(!1);if(k=k+1|0,k>>>0>>0&c>>>0>>0)D=c;else{h=42;break e}}if((h|0)==20){c=c-t|0;break}else if((h|0)==22){c=c-t|0;break}else if((h|0)==24){c=c-t|0;break}else if((h|0)==32){c=c-t|0;break}else if((h|0)==34){c=c-t|0;break}else if((h|0)==36){c=c-t|0;break}}else h=42;while(!1);return(h|0)==42&&(c=c-t|0),c|0}function G3(t){t=t|0,de(45196),de(45184),de(45172),de(45160),de(45148),de(45136),de(45124),de(45112),de(45100),de(45088),de(45076),de(45064),de(45052),de(45040)}function q3(t){t=t|0,Pt(45368),Pt(45356),Pt(45344),Pt(45332),Pt(45320),Pt(45308),Pt(45296),Pt(45284),Pt(45272),Pt(45260),Pt(45248),Pt(45236),Pt(45224),Pt(45212)}function W3(t){t=t|0,de(46e3),de(45988),de(45976),de(45964),de(45952),de(45940),de(45928),de(45916),de(45904),de(45892),de(45880),de(45868),de(45856),de(45844),de(45832),de(45820),de(45808),de(45796),de(45784),de(45772),de(45760),de(45748),de(45736),de(45724)}function H3(t){t=t|0,Pt(46292),Pt(46280),Pt(46268),Pt(46256),Pt(46244),Pt(46232),Pt(46220),Pt(46208),Pt(46196),Pt(46184),Pt(46172),Pt(46160),Pt(46148),Pt(46136),Pt(46124),Pt(46112),Pt(46100),Pt(46088),Pt(46076),Pt(46064),Pt(46052),Pt(46040),Pt(46028),Pt(46016)}function Q3(t){t=t|0,de(47104),de(47092),de(47080),de(47068),de(47056),de(47044),de(47032),de(47020),de(47008),de(46996),de(46984),de(46972),de(46960),de(46948),de(46936),de(46924),de(46912),de(46900),de(46888),de(46876),de(46864),de(46852),de(46840),de(46828)}function K3(t){t=t|0,Pt(47396),Pt(47384),Pt(47372),Pt(47360),Pt(47348),Pt(47336),Pt(47324),Pt(47312),Pt(47300),Pt(47288),Pt(47276),Pt(47264),Pt(47252),Pt(47240),Pt(47228),Pt(47216),Pt(47204),Pt(47192),Pt(47180),Pt(47168),Pt(47156),Pt(47144),Pt(47132),Pt(47120)}function Y3(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0;C=b,b=b+32|0,w=C,h=e[t+8>>2]|0,o=e[t+4>>2]|0,h-o>>2>>>0>>0?(l=e[t>>2]|0,d=o-l>>2,c=d+r|0,c>>>0>1073741823&&pi(t),o=h-l|0,o>>2>>>0<536870911?(o=o>>1,o=o>>>0>>0?c:o):o=1073741823,j3(w,o,d,t+16|0),d=w+8|0,h=e[d>>2]|0,Jt(h|0,0,r<<2|0)|0,e[d>>2]=h+(r<<2),X3(t,w),Z3(w)):no(t,r),b=C}function no(t,r){t=t|0,r=r|0;var o=0;o=t+4|0,t=r,r=e[o>>2]|0;do e[r>>2]=0,r=(e[o>>2]|0)+4|0,e[o>>2]=r,t=t+-1|0;while(t|0)}function j3(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0;e[t+12>>2]=0,e[t+16>>2]=l;do if(r)if(c=l+112|0,r>>>0<29&(S[c>>0]|0)==0){S[c>>0]=1;break}else{l=Xe(r<<2)|0;break}else l=0;while(!1);e[t>>2]=l,o=l+(o<<2)|0,e[t+8>>2]=o,e[t+4>>2]=o,e[t+12>>2]=l+(r<<2)}function X3(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0;l=e[t>>2]|0,h=t+4|0,o=r+4|0,c=(e[h>>2]|0)-l|0,d=(e[o>>2]|0)+(0-(c>>2)<<2)|0,e[o>>2]=d,o0(d|0,l|0,c|0)|0,c=e[t>>2]|0,e[t>>2]=e[o>>2],e[o>>2]=c,c=r+8|0,l=e[h>>2]|0,e[h>>2]=e[c>>2],e[c>>2]=l,c=t+8|0,t=r+12|0,l=e[c>>2]|0,e[c>>2]=e[t>>2],e[t>>2]=l,e[r>>2]=e[o>>2]}function Z3(t){t=t|0;var r=0,o=0,l=0;if(o=e[t+4>>2]|0,l=t+8|0,r=e[l>>2]|0,(r|0)!=(o|0)){do r=r+-4|0;while((r|0)!=(o|0));e[l>>2]=r}o=e[t>>2]|0;do if(o)if(r=e[t+16>>2]|0,(r|0)==(o|0)){S[r+112>>0]=0;break}else{he(o);break}while(!1)}function J3(t,r){t=t|0,r=r|0;var o=0;r>>>0>1073741823&&pi(t),o=t+128|0,r>>>0<29&(S[o>>0]|0)==0?(S[o>>0]=1,o=t+16|0):o=Xe(r<<2)|0,e[t+4>>2]=o,e[t>>2]=o,e[t+8>>2]=o+(r<<2)}function e5(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0,w=0;w=b,b=b+16|0,d=w;do if((t|0)!=(r|0)){if(c=S0()|0,h=e[c>>2]|0,e[c>>2]=0,l=+Fr(t,d,b0()|0),t=e[c>>2]|0,t||(e[c>>2]=h),(e[d>>2]|0)!=(r|0)){e[o>>2]=4,l=0;break}(t|0)==34&&(e[o>>2]=4)}else e[o>>2]=4,l=0;while(!1);return b=w,+l}function t5(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0,w=0;w=b,b=b+16|0,d=w;do if((t|0)!=(r|0)){if(c=S0()|0,h=e[c>>2]|0,e[c>>2]=0,l=+Fr(t,d,b0()|0),t=e[c>>2]|0,t||(e[c>>2]=h),(e[d>>2]|0)!=(r|0)){e[o>>2]=4,l=0;break}(t|0)==34&&(e[o>>2]=4)}else e[o>>2]=4,l=0;while(!1);return b=w,+l}function i5(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0,w=0;w=b,b=b+16|0,d=w;do if((t|0)==(r|0))e[o>>2]=4,l=0;else{if(c=S0()|0,h=e[c>>2]|0,e[c>>2]=0,l=+Fr(t,d,b0()|0),t=e[c>>2]|0,t||(e[c>>2]=h),(e[d>>2]|0)!=(r|0)){e[o>>2]=4,l=0;break}(t|0)==34&&(e[o>>2]=4)}while(!1);return b=w,+l}function n5(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0;w=b,b=b+16|0,d=w;do if((t|0)!=(r|0)){if((S[t>>0]|0)==45){e[o>>2]=4,l=0,t=0;break}if(c=S0()|0,h=e[c>>2]|0,e[c>>2]=0,t=Dn(t,d,l,b0()|0)|0,l=e[c>>2]|0,l||(e[c>>2]=h),(e[d>>2]|0)!=(r|0)){e[o>>2]=4,l=0,t=0;break}(l|0)==34?(e[o>>2]=4,l=-1,t=-1):l=ye}else e[o>>2]=4,l=0,t=0;while(!1);return ye=l,b=w,t|0}function r5(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0;C=b,b=b+16|0,w=C;do if((t|0)!=(r|0)){if((S[t>>0]|0)==45){e[o>>2]=4,t=0;break}if(h=S0()|0,d=e[h>>2]|0,e[h>>2]=0,t=Dn(t,w,l,b0()|0)|0,l=ye,c=e[h>>2]|0,c||(e[h>>2]=d),(e[w>>2]|0)!=(r|0)){e[o>>2]=4,t=0;break}if(l>>>0>0|(l|0)==0&t>>>0>4294967295|(c|0)==34){e[o>>2]=4,t=-1;break}else break}else e[o>>2]=4,t=0;while(!1);return b=C,t|0}function s5(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0;C=b,b=b+16|0,w=C;do if((t|0)!=(r|0)){if((S[t>>0]|0)==45){e[o>>2]=4,t=0;break}if(h=S0()|0,d=e[h>>2]|0,e[h>>2]=0,t=Dn(t,w,l,b0()|0)|0,l=ye,c=e[h>>2]|0,c||(e[h>>2]=d),(e[w>>2]|0)!=(r|0)){e[o>>2]=4,t=0;break}if(l>>>0>0|(l|0)==0&t>>>0>4294967295|(c|0)==34){e[o>>2]=4,t=-1;break}else break}else e[o>>2]=4,t=0;while(!1);return b=C,t|0}function o5(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0;C=b,b=b+16|0,w=C;do if((t|0)!=(r|0)){if((S[t>>0]|0)==45){e[o>>2]=4,t=0;break}if(h=S0()|0,d=e[h>>2]|0,e[h>>2]=0,t=Dn(t,w,l,b0()|0)|0,l=ye,c=e[h>>2]|0,c||(e[h>>2]=d),(e[w>>2]|0)!=(r|0)){e[o>>2]=4,t=0;break}if(l>>>0>0|(l|0)==0&t>>>0>65535|(c|0)==34){e[o>>2]=4,t=-1;break}else{t=t&65535;break}}else e[o>>2]=4,t=0;while(!1);return b=C,t|0}function l5(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0;C=b,b=b+16|0,w=C;do if((t|0)!=(r|0)){if(h=S0()|0,d=e[h>>2]|0,e[h>>2]=0,t=Ao(t,w,l,b0()|0)|0,l=ye,c=e[h>>2]|0,c||(e[h>>2]=d),(e[w>>2]|0)!=(r|0)){e[o>>2]=4,l=0,t=0;break}if((c|0)==34)return e[o>>2]=4,w=(l|0)>0|(l|0)==0&t>>>0>0,ye=w?2147483647:-2147483648,b=C,(w?-1:0)|0}else e[o>>2]=4,l=0,t=0;while(!1);return ye=l,b=C,t|0}function u5(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0;C=b,b=b+16|0,w=C;e:do if((t|0)==(r|0))e[o>>2]=4,t=0;else{if(h=S0()|0,d=e[h>>2]|0,e[h>>2]=0,t=Ao(t,w,l,b0()|0)|0,l=ye,c=e[h>>2]|0,c||(e[h>>2]=d),(e[w>>2]|0)!=(r|0)){e[o>>2]=4,t=0;break}do if((c|0)==34){if(e[o>>2]=4,(l|0)>0|(l|0)==0&t>>>0>0){t=2147483647;break e}}else{if((l|0)<-1|(l|0)==-1&t>>>0<2147483648){e[o>>2]=4;break}if((l|0)>0|(l|0)==0&t>>>0>2147483647){e[o>>2]=4,t=2147483647;break e}else break e}while(!1);t=-2147483648}while(!1);return b=C,t|0}function c5(){}function ii(t,r,o,l){return t=t|0,r=r|0,o=o|0,l=l|0,l=r-l-(o>>>0>t>>>0|0)>>>0,ye=l,t-o>>>0|0|0}function Jt(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0;if(l=t+o|0,(o|0)>=20){if(r=r&255,h=t&3,d=r|r<<8|r<<16|r<<24,c=l&-4,h)for(h=t+4-h|0;(t|0)<(h|0);)S[t>>0]=r,t=t+1|0;for(;(t|0)<(c|0);)e[t>>2]=d,t=t+4|0}for(;(t|0)<(l|0);)S[t>>0]=r,t=t+1|0;return t-o|0}function $0(t,r,o,l){return t=t|0,r=r|0,o=o|0,l=l|0,o=t+o>>>0,ye=r+l+(o>>>0>>0|0)>>>0,o|0|0}function Di(t,r,o){return t=t|0,r=r|0,o=o|0,(o|0)<32?(ye=r>>>o,t>>>o|(r&(1<>>o-32|0)}function o0(t,r,o){t=t|0,r=r|0,o=o|0;var l=0;if((o|0)>=4096)return qo(t|0,r|0,o|0)|0;if(l=t|0,(t&3)==(r&3)){for(;t&3;){if(!o)return l|0;S[t>>0]=S[r>>0]|0,t=t+1|0,r=r+1|0,o=o-1|0}for(;(o|0)>=4;)e[t>>2]=e[r>>2],t=t+4|0,r=r+4|0,o=o-4|0}for(;(o|0)>0;)S[t>>0]=S[r>>0]|0,t=t+1|0,r=r+1|0,o=o-1|0;return l|0}function v0(t,r,o){return t=t|0,r=r|0,o=o|0,(o|0)<32?(ye=r<>>32-o,t<0;)t=t-1|0,r=r-1|0,o=o-1|0,S[t>>0]=S[r>>0]|0;t=l}else o0(t,r,o)|0;return t|0}function AA(t,r,o){return t=t|0,r=r|0,o=o|0,(o|0)<32?(ye=r>>o,t>>>o|(r&(1<>o-32|0)}function ro(t){t=t|0;var r=0;return r=S[X+(t&255)>>0]|0,(r|0)<8?r|0:(r=S[X+(t>>8&255)>>0]|0,(r|0)<8?r+8|0:(r=S[X+(t>>16&255)>>0]|0,(r|0)<8?r+16|0:(S[X+(t>>>24)>>0]|0)+24|0))}function f5(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0;return h=t&65535,c=r&65535,o=ee(c,h)|0,l=t>>>16,t=(o>>>16)+(ee(c,l)|0)|0,c=r>>>16,r=ee(c,h)|0,ye=(t>>>16)+(ee(c,l)|0)+(((t&65535)+r|0)>>>16)|0,t+r<<16|o&65535|0|0}function vA(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0,D=0;return D=r>>31|((r|0)<0?-1:0)<<1,C=((r|0)<0?-1:0)>>31|((r|0)<0?-1:0)<<1,h=l>>31|((l|0)<0?-1:0)<<1,c=((l|0)<0?-1:0)>>31|((l|0)<0?-1:0)<<1,w=ii(D^t,C^r,D,C)|0,d=ye,t=h^D,r=c^C,ii((wn(w,d,ii(h^o,c^l,h,c)|0,ye,0)|0)^t,ye^r,t,r)|0}function xA(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0,D=0;return c=b,b=b+16|0,w=c|0,d=r>>31|((r|0)<0?-1:0)<<1,h=((r|0)<0?-1:0)>>31|((r|0)<0?-1:0)<<1,D=l>>31|((l|0)<0?-1:0)<<1,C=((l|0)<0?-1:0)>>31|((l|0)<0?-1:0)<<1,t=ii(d^t,h^r,d,h)|0,r=ye,wn(t,r,ii(D^o,C^l,D,C)|0,ye,w)|0,l=ii(e[w>>2]^d,e[w+4>>2]^h,d,h)|0,o=ye,b=c,ye=o,l|0}function Qi(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0;return c=t,h=o,o=f5(c,h)|0,t=ye,ye=(ee(r,h)|0)+(ee(l,c)|0)+t|t&0,o|0|0|0}function xn(t,r,o,l){return t=t|0,r=r|0,o=o|0,l=l|0,wn(t,r,o,l,0)|0}function Cr(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0;return h=b,b=b+16|0,c=h|0,wn(t,r,o,l,c)|0,b=h,ye=e[c+4>>2]|0,e[c>>2]|0|0}function wn(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0;if(k=t,C=r,D=C,d=o,R=l,w=R,!D)return h=(c|0)!=0,w?h?(e[c>>2]=t|0,e[c+4>>2]=r&0,R=0,c=0,ye=R,c|0):(R=0,c=0,ye=R,c|0):(h&&(e[c>>2]=(k>>>0)%(d>>>0),e[c+4>>2]=0),R=0,c=(k>>>0)/(d>>>0)>>>0,ye=R,c|0);h=(w|0)==0;do if(d){if(!h){if(h=(st(w|0)|0)-(st(D|0)|0)|0,h>>>0<=31){N=h+1|0,w=31-h|0,r=h-31>>31,d=N,t=k>>>(N>>>0)&r|D<>>(N>>>0)&r,h=0,w=k<>2]=t|0,e[c+4>>2]=C|r&0,R=0,c=0,ye=R,c|0):(R=0,c=0,ye=R,c|0)}if(h=d-1|0,h&d){w=(st(d|0)|0)+33-(st(D|0)|0)|0,U=64-w|0,N=32-w|0,C=N>>31,_=w-32|0,r=_>>31,d=w,t=N-1>>31&D>>>(_>>>0)|(D<>>(w>>>0))&r,r=r&D>>>(w>>>0),h=k<>>(_>>>0))&C|k<>31;break}return c&&(e[c>>2]=h&k,e[c+4>>2]=0),(d|0)==1?(_=C|r&0,U=t|0|0,ye=_,U|0):(U=ro(d|0)|0,_=D>>>(U>>>0)|0,U=D<<32-U|k>>>(U>>>0)|0,ye=_,U|0)}else{if(h)return c&&(e[c>>2]=(D>>>0)%(d>>>0),e[c+4>>2]=0),_=0,U=(D>>>0)/(d>>>0)>>>0,ye=_,U|0;if(!k)return c&&(e[c>>2]=0,e[c+4>>2]=(D>>>0)%(w>>>0)),_=0,U=(D>>>0)/(w>>>0)>>>0,ye=_,U|0;if(h=w-1|0,!(h&w))return c&&(e[c>>2]=t|0,e[c+4>>2]=h&D|r&0),_=0,U=D>>>((ro(w|0)|0)>>>0),ye=_,U|0;if(h=(st(w|0)|0)-(st(D|0)|0)|0,h>>>0<=30){r=h+1|0,w=31-h|0,d=r,t=D<>>(r>>>0),r=D>>>(r>>>0),h=0,w=k<>2]=t|0,e[c+4>>2]=C|r&0,_=0,U=0,ye=_,U|0):(_=0,U=0,ye=_,U|0)}while(!1);if(!d)D=w,C=0,w=0;else{N=o|0|0,k=R|l&0,D=$0(N|0,k|0,-1,-1)|0,o=ye,C=w,w=0;do l=C,C=h>>>31|C<<1,h=w|h<<1,l=t<<1|l>>>31|0,R=t>>>31|r<<1|0,ii(D,o,l,R)|0,U=ye,_=U>>31|((U|0)<0?-1:0)<<1,w=_&1,t=ii(l,R,_&N,(((U|0)<0?-1:0)>>31|((U|0)<0?-1:0)<<1)&k)|0,r=ye,d=d-1|0;while(d|0);D=C,C=0}return d=0,c&&(e[c>>2]=t,e[c+4>>2]=r),_=(h|0)>>>31|(D|d)<<1|(d<<1|h>>>31)&0|C,U=(h<<1|0)&-2|w,ye=_,U|0}function h5(t,r,o,l,c,h,d,w){return t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0,w=w|0,HS[t&15](r|0,o|0,l|0,c|0,h|0,d|0,w|0)|0}function d5(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,Pn[t&15](r|0,o|0,l|0,c|0,h|0)}function p5(t,r,o,l,c,h,d){return t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=+d,QS[t&3](r|0,o|0,l|0,c|0,h|0,+d)|0}function m5(t,r){t=t|0,r=r|0,Mt[t&255](r|0)}function g5(t,r,o){t=t|0,r=r|0,o=o|0,t0[t&127](r|0,o|0)}function S5(t,r,o,l,c,h,d){return t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0,on[t&63](r|0,o|0,l|0,c|0,h|0,d|0)|0}function A5(t,r){return t=t|0,r=r|0,Dt[t&127](r|0)|0}function v5(t,r,o,l,c,h,d,w,C,D,k,N){return t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0,w=w|0,C=C|0,D=D|0,k=k|0,N=N|0,KS[t&3](r|0,o|0,l|0,c|0,h|0,d|0,w|0,C|0,D|0,k|0,N|0)|0}function x5(t,r,o,l){return t=t|0,r=r|0,o=o|0,l=l|0,Yt[t&63](r|0,o|0,l|0)|0}function w5(t,r,o,l,c,h,d,w,C,D,k,N,R,_,U,Q){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0,w=w|0,C=C|0,D=D|0,k=k|0,N=N|0,R=R|0,_=_|0,U=U|0,Q=Q|0,YS[t&3](r|0,o|0,l|0,c|0,h|0,d|0,w|0,C|0,D|0,k|0,N|0,R|0,_|0,U|0,Q|0)}function y5(t,r,o,l,c,h,d){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0,Vi[t&15](r|0,o|0,l|0,c|0,h|0,d|0)}function C5(t,r,o,l,c,h,d,w){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0,w=w|0,jS[t&7](r|0,o|0,l|0,c|0,h|0,d|0,w|0)}function T5(t,r,o,l,c,h,d,w,C,D,k){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0,w=w|0,C=C|0,D=D|0,k=k|0,XS[t&7](r|0,o|0,l|0,c|0,h|0,d|0,w|0,C|0,D|0,k|0)}function I5(t,r,o){return t=t|0,r=r|0,o=o|0,U0[t&63](r|0,o|0)|0}function E5(t,r,o,l,c,h){return t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,an[t&31](r|0,o|0,l|0,c|0,h|0)|0}function k5(t,r,o,l){return t=t|0,r=r|0,o=o|0,l=l|0,+ZS[t&3](r|0,o|0,l|0)}function D5(t){return t=t|0,JS[t&15]()|0}function b5(t,r,o,l,c){return t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,_r[t&31](r|0,o|0,l|0,c|0)|0}function N5(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0,Ln[t&15](r|0,o|0,l|0)}function F5(t){t=t|0,Vo[t&7]()}function R5(t,r,o,l,c,h,d,w,C){return t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0,w=w|0,C=C|0,Ci[t&15](r|0,o|0,l|0,c|0,h|0,d|0,w|0,C|0)|0}function M5(t,r,o,l,c,h){return t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=+h,eA[t&7](r|0,o|0,l|0,c|0,+h)|0}function _5(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,On[t&63](r|0,o|0,l|0,c|0)}function bi(t,r,o,l,c,h,d){return t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0,Ke(0),0}function sn(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,Ke(1)}function so(t,r,o,l,c,h){return t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=+h,Ke(2),0}function e0(t){t=t|0,Ke(3)}function Tr(t,r){t=t|0,r=r|0,Ke(4)}function N0(t,r,o,l,c,h){return t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,Ke(5),0}function r0(t){return t=t|0,Ke(6),0}function P5(t){return t=t|0,Br(t|0)|0}function L5(t){return t=t|0,Gr(t|0)|0}function O5(t){return t=t|0,jo(t|0)|0}function oo(t,r,o,l,c,h,d,w,C,D,k){return t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0,w=w|0,C=C|0,D=D|0,k=k|0,Ke(7),0}function C0(t,r,o){return t=t|0,r=r|0,o=o|0,Ke(8),0}function ao(t,r,o,l,c,h,d,w,C,D,k,N,R,_,U){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0,w=w|0,C=C|0,D=D|0,k=k|0,N=N|0,R=R|0,_=_|0,U=U|0,Ke(9)}function Ni(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,Ke(10)}function yn(t,r,o,l,c,h,d){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0,Ke(11)}function Cn(t,r,o,l,c,h,d,w,C,D){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0,w=w|0,C=C|0,D=D|0,Ke(12)}function L0(t,r){return t=t|0,r=r|0,Ke(13),0}function di(t,r,o,l,c){return t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,Ke(14),0}function $5(t,r,o){return t=t|0,r=r|0,o=o|0,Ke(15),0}function Li(){return Ke(16),0}function Ki(t,r,o,l){return t=t|0,r=r|0,o=o|0,l=l|0,Ke(17),0}function B5(t,r,o){t=t|0,r=r|0,o=o|0,Ke(18)}function V5(t,r,o){t=t|0,r=r|0,o=o|0,Qt(t|0,r|0,o|0)}function lo(){Ke(19)}function U5(){Jo()}function z5(){ei()}function G5(){Ur()}function Yi(t,r,o,l,c,h,d,w){return t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0,w=w|0,Ke(20),0}function Tn(t,r,o,l,c){return t=t|0,r=r|0,o=o|0,l=l|0,c=+c,Ke(21),0}function H0(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0,Ke(22)}function q5(t){t=t|0;var r=0,o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0;if(D=b,b=b+32|0,w=D,m0(w,255,0),C=t+152|0,(e[w+4>>2]|0)==(e[C>>2]|0)&&(e[w+8>>2]|0)==(e[t+156>>2]|0)&&(e[w+12>>2]|0)==(e[t+160>>2]|0)){C=e[8900]|0,e[t+4580>>2]=C+(((e[8901]|0)-C|0)>>>1),b=D;return}for(o=t+4584|0,l=t+4588|0,c=e[l>>2]|0,r=e[o>>2]|0,h=c-r|0,h>>>0>=512?h>>>0>512&&(d=r+512|0,(c|0)!=(d|0))&&(e[l>>2]=d):(j0(o,512-h|0),r=e[o>>2]|0),w=t+4580|0,e[w>>2]=r+256,d=t+160|0,c=t+156|0,h=-256;;){if(r=e[d>>2]|0,(h|0)>(0-r|0))if(o=e[c>>2]|0,(h|0)>(0-o|0))if(l=e[C>>2]|0,(h|0)>(0-l|0))if((h|0)>=0){if((h|0)<1){S[(e[w>>2]|0)+h>>0]=0,h=1;continue}(l|0)<=(h|0)?(o|0)>(h|0)?r=2:r=(r|0)>(h|0)?3:4:r=1}else r=-1;else r=-2;else r=-3;else r=-4;if(S[(e[w>>2]|0)+h>>0]=r,h=h+1|0,(h|0)==256)break}b=D}function W5(t){t=t|0;var r=0,o=0;e[t>>2]=35660,r=e[t+4608>>2]|0,r&&(o=t+4612|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),e[t>>2]=36736,r=e[t+92>>2]|0,r&&(o=t+96|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),t=t+88|0,r=e[t>>2]|0,e[t>>2]=0,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r)}function H5(t){t=t|0;var r=0,o=0;if(e[t>>2]=35660,r=e[t+4608>>2]|0,r&&(o=t+4612|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),e[t>>2]=36736,r=e[t+92>>2]|0,r&&(o=t+96|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),o=t+88|0,r=e[o>>2]|0,e[o>>2]=0,!r){he(t);return}Mt[e[(e[r>>2]|0)+4>>2]&255](r),he(t)}function Q5(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0,G=0,$=0,P=0,O=0;if(G=b,b=b+352|0,$=G+328|0,P=G+192|0,o=G+343|0,l=G+342|0,c=G+341|0,h=G+340|0,R=G+176|0,w=G+168|0,C=G+160|0,D=G+152|0,K=G,U=G+136|0,e[t+28>>2]|0&&(e[t+20>>2]|0)!=1){if(_=t+4|0,Q=t+32|0,d=e[Q>>2]|0,!d){if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[o>>0]|0,$e(44,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}if(t=e[t+12>>2]|0,(t|0)==8)switch(d|0){case 1:{if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[l>>0]|0,$e(45,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 2:{if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[c>>0]|0,$e(46,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 3:{if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[h>>0]|0,$e(47,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}default:{d=P+56|0,c=P+4|0,e[P>>2]=36160,e[d>>2]=36180,g=0,Ae(62,P+56|0,c|0),G=g,g=0,G&1&&(O=j()|0,tt(d),le(O|0)),e[P+128>>2]=0,e[P+132>>2]=-1,e[P>>2]=36200,e[P+56>>2]=36220,g=0,ue(180,c|0),G=g,g=0;do if(G&1)t=j()|0;else{if(e[c>>2]=36236,h=P+36|0,e[h>>2]=0,e[h+4>>2]=0,e[h+8>>2]=0,e[h+12>>2]=0,e[P+52>>2]=16,e[$>>2]=0,e[$+4>>2]=0,e[$+8>>2]=0,g=0,Ae(63,c|0,$|0),G=g,g=0,G&1){t=j()|0,de($),de(h),wt(c);break}de($),g=0,t=Ve(28,P|0,49007,21)|0,$=g,g=0;do if(!($&1)&&(g=0,k=be(36,t|0,e[Q>>2]|0)|0,$=g,g=0,!($&1))&&(g=0,Ve(28,k|0,50997,18)|0,$=g,g=0,!($&1))){if(l=Ct(16)|0,g=0,Ae(64,R|0,c|0),$=g,g=0,$&1)t=j()|0;else if(!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,H|0)|0,bt(8)),g=0,$e(36,l|0,9,35648,R|0),$=g,g=0,$&1?o=1:(g=0,xe(6,l|0,824,96),g=0,o=0),t=j()|0,de(R),!o)break;Tt(l|0)}else O=34;while(!1);(O|0)==34&&(t=j()|0),e[P>>2]=36200,e[d>>2]=36220,e[c>>2]=36236,de(h),wt(c),tt(d),O=t,le(O|0)}while(!1);O=t,tt(d),le(O|0)}}switch((t|0)<=8&&(t=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,H|0)|0,bt(8)),g=0,xe(7,t|0,8,35648),O=g,g=0,O&1||Qt(t|0,824,96),O=j()|0,Tt(t|0),le(O|0)),o=16-t|0,d|0){case 1:{if(t=Xe(60)|0,e[w>>2]=o,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],e[$>>2]=e[w>>2],e[$+4>>2]=e[w+4>>2],$e(41,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 2:{if(t=Xe(60)|0,e[C>>2]=o,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],e[$>>2]=e[C>>2],e[$+4>>2]=e[C+4>>2],$e(42,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 3:{if(t=Xe(60)|0,e[D>>2]=o,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],e[$>>2]=e[D>>2],e[$+4>>2]=e[D+4>>2],$e(43,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}default:{d=K+56|0,c=K+4|0,e[K>>2]=36160,e[d>>2]=36180,g=0,Ae(62,K+56|0,c|0),P=g,g=0,P&1&&(O=j()|0,tt(d),le(O|0)),e[K+128>>2]=0,e[K+132>>2]=-1,e[K>>2]=36200,e[K+56>>2]=36220,g=0,ue(180,c|0),P=g,g=0;do if(P&1)t=j()|0;else{if(e[c>>2]=36236,h=K+36|0,e[h>>2]=0,e[h+4>>2]=0,e[h+8>>2]=0,e[h+12>>2]=0,e[K+52>>2]=16,e[$>>2]=0,e[$+4>>2]=0,e[$+8>>2]=0,g=0,Ae(63,c|0,$|0),P=g,g=0,P&1){t=j()|0,de($),de(h),wt(c);break}de($),g=0,t=Ve(28,K|0,49007,21)|0,P=g,g=0;do if(!(P&1)&&(g=0,N=be(36,t|0,e[Q>>2]|0)|0,P=g,g=0,!(P&1))&&(g=0,Ve(28,N|0,50997,18)|0,P=g,g=0,!(P&1))){if(l=Ct(16)|0,g=0,Ae(64,U|0,c|0),P=g,g=0,P&1)t=j()|0;else if(!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,H|0)|0,bt(8)),g=0,$e(36,l|0,9,35648,U|0),P=g,g=0,P&1?o=1:(g=0,xe(6,l|0,824,96),g=0,o=0),t=j()|0,de(U),!o)break;Tt(l|0)}else O=64;while(!1);(O|0)==64&&(t=j()|0),e[K>>2]=36200,e[d>>2]=36220,e[c>>2]=36236,de(h),wt(c),tt(d),O=t,le(O|0)}while(!1);O=t,tt(d),le(O|0)}}}return o=e[r+4>>2]|0,l=Xe(16)|0,t=e[t+16>>2]|0,o?(e[l>>2]=36108,e[l+4>>2]=o,e[l+8>>2]=1,e[l+12>>2]=t,O=l,b=G,O|0):(O=e[r>>2]|0,e[l>>2]=36132,e[l+4>>2]=O,e[l+8>>2]=1,e[l+12>>2]=t,O=l,b=G,O|0)}function K5(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0;d=b,b=b+32|0,C=d,m0(C,e[t+128>>2]|0,e[t+136>>2]|0),w=e[r+4>>2]|0,h=e[r+8>>2]|0,h=h|0?h:e[C+8>>2]|0,c=e[r+12>>2]|0,c=c|0?c:e[C+12>>2]|0,o=e[r+16>>2]|0,l=e[C+16>>2]|0,e[t+176>>2]=w|0?w:e[C+4>>2]|0,e[t+180>>2]=h,e[t+184>>2]=c,t6(t),c=t+132|0,r=(e[c>>2]|0)+32|0,r=(r|0)<128?2:(r|0)/64|0,h=0;do e[t+188+(h*12|0)>>2]=r,e[t+188+(h*12|0)+4>>2]=0,I[t+188+(h*12|0)+8>>1]=0,I[t+188+(h*12|0)+10>>1]=1,h=h+1|0;while((h|0)!=365);w=(e[c>>2]|0)+32|0,w=(w|0)<128?2:(w|0)/64|0,C=(o|0?o:l)&255,e[t+4568>>2]=w,e[t+4572>>2]=0,S[t+4576>>0]=C,S[t+4577>>0]=1,S[t+4578>>0]=0,e[t+4580>>2]=w,e[t+4584>>2]=1,S[t+4588>>0]=C,S[t+4589>>0]=1,S[t+4590>>0]=0,e[t+4592>>2]=0,b=d}function Y5(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0;for(d=t+88|0,h=e[r>>2]|0,e[r>>2]=0,r=e[d>>2]|0,e[d>>2]=h,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r),d=l+4|0,h=e[d>>2]|0,S[t+4620>>0]=c&1,r=t+156|0,e[r>>2]=e[o>>2],e[r+4>>2]=e[o+4>>2],e[r+8>>2]=e[o+8>>2],e[r+12>>2]=e[o+12>>2],Y0(t,l),j5(t),r=e[t+116>>2]|0,t=e[t+112>>2]|0;c=r+-1|0,o=(S[c>>0]|0)==-1?7:8,!((t|0)<(o|0));)r=c,t=t-o|0;r=r-h|0,c=e[d>>2]|0,c&&(e[d>>2]=c+r,l=l+8|0,e[l>>2]=(e[l>>2]|0)-r)}function j5(t){t=t|0;var r=0,o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0,ce=0;ie=b,b=b+32|0,ne=ie+12|0,Z=ie,w=t+172|0,O=(e[w>>2]|0)+4|0,(e[t+28>>2]|0)==1?C=e[t+20>>2]|0:C=1,r=ee(C<<1,O)|0,e[ne>>2]=0,ce=ne+4|0,e[ce>>2]=0,e[ne+8>>2]=0;e:do if(r){if((r|0)<0&&(g=0,ue(178,ne|0),oe=g,g=0,oe&1)||(P=6),(P|0)==6&&(g=0,o=ge(67,r|0)|0,oe=g,g=0,!(oe&1))){for(e[ce>>2]=o,e[ne>>2]=o,e[ne+8>>2]=o+r;;)if(S[o>>0]=0,o=(e[ce>>2]|0)+1|0,e[ce>>2]=o,r=r+-1|0,!r)break e}o=j()|0,r=e[ne>>2]|0,r||le(o|0),(e[ce>>2]|0)!=(r|0)&&(e[ce>>2]=r),he(r),le(o|0)}while(!1);e[Z>>2]=0,oe=Z+4|0,e[oe>>2]=0,e[Z+8>>2]=0;do if(!C)P=19;else{if(C>>>0>1073741823&&(g=0,ue(178,Z|0),$=g,g=0,$&1)||(P=17),(P|0)==17&&(l=C<<2,g=0,c=ge(67,l|0)|0,$=g,g=0,!($&1))){e[Z>>2]=c,P=c+(C<<2)|0,e[Z+8>>2]=P,Jt(c|0,0,l|0)|0,e[oe>>2]=P,P=19;break}o=j()|0,r=e[Z>>2]|0,l=r,r&&(c=e[oe>>2]|0,(c|0)!=(r|0)&&(e[oe>>2]=c+(~((c+-4-l|0)>>>2)<<2)),he(r))}while(!1);if((P|0)==19){D=t+8|0,r=e[D>>2]|0;e:do if((r|0)>0){if(k=t+4596|0,N=ee(C,O)|0,R=N+1|0,_=t+4600|0,U=t+160|0,Q=t+168|0,K=t+164|0,G=t+156|0,$=t+88|0,d=t+4592|0,(C|0)>0)h=0;else{for(h=0;;){if(c=e[ne>>2]|0,o=c+1|0,e[k>>2]=o,l=c+R|0,e[_>>2]=l,h&1?(e[k>>2]=l,e[_>>2]=o,o=1):o=R,C=e[U>>2]|0,(C|0)<=(h|0)&&(h|0)<((e[Q>>2]|0)+C|0)){if(C=e[$>>2]|0,g=0,$e(e[(e[C>>2]|0)+8>>2]|0,C|0,c+(o+((e[G>>2]|0)-N))|0,e[K>>2]|0,O|0),C=g,g=0,C&1)break;r=e[D>>2]|0}if(h=h+1|0,(h|0)>=(r|0)){P=50;break e}}o=j()|0;break}t:for(;;){o=e[ne>>2]|0,r=o+1|0,e[k>>2]=r,o=o+R|0,e[_>>2]=o,h&1&&(e[k>>2]=o,e[_>>2]=r,r=o),c=e[Z>>2]|0,o=r,l=0;do{if(e[d>>2]=e[c+(l<<2)>>2],P=e[w>>2]|0,S[o+P>>0]=S[o+(P+-1)>>0]|0,S[(e[_>>2]|0)+-1>>0]=S[e[k>>2]>>0]|0,g=0,Ae(83,t|0,0),P=g,g=0,P&1){P=38;break t}c=e[Z>>2]|0,e[c+(l<<2)>>2]=e[d>>2],o=(e[k>>2]|0)+O|0,e[k>>2]=o,r=e[_>>2]|0,e[_>>2]=r+O,l=l+1|0}while((l|0)<(C|0));if(P=e[U>>2]|0,(P|0)<=(h|0)&&(h|0)<((e[Q>>2]|0)+P|0)&&(P=e[$>>2]|0,g=0,$e(e[(e[P>>2]|0)+8>>2]|0,P|0,r+(O+((e[G>>2]|0)-N))|0,e[K>>2]|0,O|0),P=g,g=0,P&1)){P=30;break}if(h=h+1|0,(h|0)>=(e[D>>2]|0)){P=50;break e}}if((P|0)==30){o=j()|0;break}else if((P|0)==38){o=j()|0;break}}else P=50;while(!1);do if((P|0)==50){if(g=0,ue(183,t|0),t=g,g=0,t&1){o=j()|0;break}if(r=e[Z>>2]|0,o=r,r&&(l=e[oe>>2]|0,(l|0)!=(r|0)&&(e[oe>>2]=l+(~((l+-4-o|0)>>>2)<<2)),he(r)),r=e[ne>>2]|0,!r){b=ie;return}(e[ce>>2]|0)!=(r|0)&&(e[ce>>2]=r),he(r),b=ie;return}while(!1);r=e[Z>>2]|0,l=r,r&&(c=e[oe>>2]|0,(c|0)!=(r|0)&&(e[oe>>2]=c+(~((c+-4-l|0)>>>2)<<2)),he(r))}r=e[ne>>2]|0,r||le(o|0),(e[ce>>2]|0)!=(r|0)&&(e[ce>>2]=r),he(r),le(o|0)}function X5(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0;if(R=t+4596|0,o=e[R>>2]|0,K=t+172|0,r=e[K>>2]|0,!((r|0)<=0))for(_=t+4600|0,U=t+4604|0,Q=t+4592|0,w=o,h=F[o+-1>>0]|0,o=F[o>>0]|0,N=0;D=e[_>>2]|0,d=S[D+(N+-1)>>0]|0,k=d&255,c=N+1|0,l=F[w+c>>0]|0,C=e[U>>2]|0,w=o-h|0,h=h-k|0,C=((((S[C+(l-o)>>0]|0)*9|0)+(S[C+w>>0]|0)|0)*9|0)+(S[C+h>>0]|0)|0,D=D+N|0,C?(r=o-k>>31,(r^h|0)<0?r=o:r=k+((r^w|0)<0?0:w)|0,k=Z5(t,C,F[D>>0]|0,r,0)|0,S[(e[_>>2]|0)+N>>0]=k):(r=J5(t,d,D,r-N|0)|0,o=r+N|0,(o|0)!=(e[K>>2]|0)&&(k=e6(t,k,F[(e[R>>2]|0)+o>>0]|0)|0,S[(e[_>>2]|0)+o>>0]=k,k=e[Q>>2]|0,e[Q>>2]=(k|0)<1?0:k+-1|0,r=r+1|0),c=r+N|0,l=e[R>>2]|0,o=F[l+(c+-1)>>0]|0,l=F[l+c>>0]|0),r=e[K>>2]|0,!((r|0)<=(c|0));)w=e[R>>2]|0,h=o,o=l,N=c}function Z5(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0;if(U=r>>31,C=(U^r)-U|0,R=t+188+(C*12|0)+10|0,o=I[R>>1]|0,N=t+188+(C*12|0)|0,c=e[N>>2]|0,(o|0)<(c|0))if((o<<1|0)<(c|0))if((o<<2|0)<(c|0))if((o<<3|0)<(c|0))if((o<<4|0)<(c|0))for(r=5;(o<>1]^U)-U+l|0,_=t+128|0,c=e[_>>2]|0,(o&c|0)==(o|0)?D=o:D=c&~(o>>31),o=t+112|0,(e[o>>2]|0)<8&&P0(t),c=t+108|0,l=e[c>>2]|0,h=l>>>24,d=e[2832+(r<<11)+(h<<3)+4>>2]|0,d?(e[o>>2]=(e[o>>2]|0)-d,e[c>>2]=l<>2]|0):(w=e[t+148>>2]|0,c=e[t+140>>2]|0,o=X0(t)|0,(o|0)<(w+-1-c|0)?r&&(o=(l0(t,r)|0)+(o<>31^o>>1,(((o|0)>-1?o:0-o|0)|0)>65535&&(o=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,H|0)|0,bt(8)),g=0,xe(7,o|0,5,35648),t=g,g=0,t&1?(t=j()|0,Tt(o|0),le(t|0)):Qt(o|0,824,96))),w=t+136|0,l=e[w>>2]|0,r?d=o:(l?c=0:c=(e[t+188+(C*12|0)+4>>2]<<1)+-1+(I[R>>1]|0)>>31,d=c^o),r=e[t+152>>2]|0,c=(e[N>>2]|0)+((d|0)>-1?d:0-d|0)|0,h=t+188+(C*12|0)+4|0,o=(e[h>>2]|0)+(ee(l<<1|1,d)|0)|0,l=I[R>>1]|0,(l|0)==(r|0)&&(c=c>>1,o=o>>1,l=r>>1),e[N>>2]=c,r=l+1|0,I[R>>1]=r,c=r+o|0,(c|0)>=1?(o|0)>0&&(o=o-r|0,R=I[k>>1]|0,I[k>>1]=(R<<16>>16<127&1)+(R&65535),o=(o|0)>0?0:o):(o=I[k>>1]|0,I[k>>1]=(o&65535)-(o<<16>>16>-128&1),o=(c|0)>(~l|0)?c:0-l|0),e[h>>2]=o,r=e[w>>2]|0,l=r<<1|1,c=(ee(l,(d^U)-U|0)|0)+D|0,(c|0)>=(0-r|0)?(o=e[_>>2]|0,(o+r|0)<(c|0)&&(c=c-(ee(e[t+132>>2]|0,l)|0)|0)):(c=(ee(e[t+132>>2]|0,l)|0)+c|0,o=e[_>>2]|0),(c&o|0)==(c|0)?(t=c,t=t&255,t|0):(t=o&~(c>>31),t=t&255,t|0)}function J5(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0;for(w=t+112|0,C=t+108|0,D=t+4592|0,c=e[w>>2]|0,h=0;;){if((c|0)<1&&(P0(t),c=e[w>>2]|0),d=e[C>>2]|0,c=c+-1|0,e[w>>2]=c,e[C>>2]=d<<1,(d|0)>=0){k=8;break}if(d=e[D>>2]|0,N=1<>2],R=l-h|0,R=(N|0)<(R|0)?N:R,h=R+h|0,(R|0)==(N|0)&&(e[D>>2]=(d|0)>30?31:d+1|0),(h|0)==(l|0)){c=l;break}}return(k|0)==8&&((h|0)!=(l|0)?(c=e[D>>2]|0,(c+-4|0)>>>0<28?c=l0(t,e[36476+(c<<2)>>2]|0)|0:c=0,c=c+h|0,(c|0)>(l|0)&&(c=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,H|0)|0,bt(8)),g=0,xe(7,c|0,5,35648),R=g,g=0,R&1?(R=j()|0,Tt(c|0),le(R|0)):Qt(c|0,824,96))):c=l),(c|0)<=0||Jt(o|0,r|0,c|0)|0,c|0}function e6(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0;return h=r-o|0,d=t+128|0,l=t+136|0,(((h|0)>-1?h:0-h|0)|0)>(e[l>>2]|0)?(r=ee(uo(t,t+4568|0)|0,o-r>>31|1)|0,c=e[l>>2]|0,h=c<<1|1,r=(ee(r,h)|0)+o|0,(r|0)>=(0-c|0)?(l=e[d>>2]|0,(l+c|0)<(r|0)&&(r=r-(ee(e[t+132>>2]|0,h)|0)|0)):(r=(ee(e[t+132>>2]|0,h)|0)+r|0,l=e[d>>2]|0),(r&l|0)==(r|0)?(t=r,t=t&255,t|0):(t=l&~(r>>31),t=t&255,t|0)):(o=uo(t,t+4580|0)|0,h=e[l>>2]|0,c=h<<1|1,r=(ee(c,o)|0)+r|0,(r|0)>=(0-h|0)?(l=e[d>>2]|0,(l+h|0)<(r|0)&&(r=r-(ee(e[t+132>>2]|0,c)|0)|0)):(r=(ee(e[t+132>>2]|0,c)|0)+r|0,l=e[d>>2]|0),(r&l|0)==(r|0)?(t=r,t=t&255,t|0):(t=l&~(r>>31),t=t&255,t|0))}function uo(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0;if(D=r+9|0,o=F[D>>0]|0,h=r+4|0,c=(ee(o>>>1,e[h>>2]|0)|0)+(e[r>>2]|0)|0,(o|0)<(c|0)){l=0;do o=o<<1,l=l+1|0;while((o|0)<(c|0))}else l=0;d=e[t+148>>2]|0,w=e[36476+(e[t+4592>>2]<<2)>>2]|0,o=e[t+140>>2]|0,c=X0(t)|0;do if((c|0)<(d+-2-w-o|0))if(l){w=(l0(t,l)|0)+(c<>2]|0,c=w+l|0,d=c&1,o=d,h=1,c=(d+c|0)/2|0;break}else{l=e[h>>2]|0,t=l+c|0,o=t&1,t=(o+t|0)/2|0,C=8;break}else c=(l0(t,o)|0)+1|0,d=e[h>>2]|0,t=c+d|0,o=t&1,t=(o+t|0)/2|0,l?(w=c,h=1,c=t,l=d):(l=d,C=8);while(!1);return(C|0)==8&&(w=c,h=F[r+10>>0]<<1>>>0>=(F[D>>0]|0)>>>0,c=t),c=(o|0)!=0^h?c:0-c|0,(c|0)<0&&(C=r+10|0,S[C>>0]=(F[C>>0]|0)+1),o=(w+1-l>>1)+(e[r>>2]|0)|0,e[r>>2]=o,l=S[D>>0]|0,l<<24>>24!=(S[r+8>>0]|0)?(r=l,r=r&255,r=r+1|0,r=r&255,S[D>>0]=r,c|0):(e[r>>2]=o>>1,C=(l&255)>>>1,S[D>>0]=C,r=r+10|0,S[r>>0]=(F[r>>0]|0)>>>1,r=C,r=r&255,r=r+1|0,r=r&255,S[D>>0]=r,c|0)}function t6(t){t=t|0;var r=0,o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0;R=b,b=b+32|0,l=R,N=t+136|0;e:do if(e[N>>2]|0)r=t+144|0;else if(o=e[t+128>>2]|0,r=t+144|0,(o|0)==((1<>2])+-1|0)&&(m0(l,o,0),(e[l+4>>2]|0)==(e[t+176>>2]|0))&&(e[l+8>>2]|0)==(e[t+180>>2]|0)&&(e[l+12>>2]|0)==(e[t+184>>2]|0))switch(e[r>>2]|0){case 8:{N=e[8900]|0,e[t+4604>>2]=N+(((e[8901]|0)-N|0)>>>1),b=R;return}case 10:{N=e[8903]|0,e[t+4604>>2]=N+(((e[8904]|0)-N|0)>>>1),b=R;return}case 12:{N=e[8906]|0,e[t+4604>>2]=N+(((e[8907]|0)-N|0)>>>1),b=R;return}case 16:{N=e[8909]|0,e[t+4604>>2]=N+(((e[8910]|0)-N|0)>>>1),b=R;return}default:break e}while(!1);if(k=1<>2],o=t+4608|0,l=k<<1,c=t+4612|0,h=e[c>>2]|0,r=e[o>>2]|0,d=h-r|0,l>>>0<=d>>>0?l>>>0>>0&&(w=r+l|0,(h|0)!=(w|0))&&(e[c>>2]=w):(j0(o,l-d|0),r=e[o>>2]|0),D=t+4604|0,e[D>>2]=r+k,r=0-k|0,(k|0)<=(r|0)){b=R;return}w=t+184|0,C=t+180|0,d=t+176|0,h=r;do r=e[w>>2]|0,(h|0)>(0-r|0)?(o=e[C>>2]|0,(h|0)>(0-o|0)?(l=e[d>>2]|0,(h|0)>(0-l|0)?(c=e[N>>2]|0,(h|0)>=(0-c|0)?(c|0)<(h|0)?(l|0)<=(h|0)?(o|0)>(h|0)?r=2:r=(r|0)>(h|0)?3:4:r=1:r=0:r=-1):r=-2):r=-3):r=-4,S[(e[D>>2]|0)+h>>0]=r,h=h+1|0;while((h|0)!=(k|0));b=R}function i6(t){t=t|0,he(t)}function n6(t){return t=t|0,50767}function r6(t,r,o){t=t|0,r=r|0,o=o|0,yi(t,50754,12)}function s6(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0;U=b,b=b+16|0,Q=U,e[Q>>2]=0,K=Q+4|0,e[K>>2]=0,e[Q+8>>2]=0,R=Q+8|0,g=0,c=ge(67,1)|0,N=g,g=0;e:do if(!(N&1)&&(N=c+1|0,S[c>>0]=o,e[Q>>2]=c,e[K>>2]=N,e[R>>2]=N,g=0,Ae(84,Q|0,r&65535|0),N=g,g=0,!(N&1))&&(g=0,Ae(84,Q|0,t&65535|0),N=g,g=0,!(N&1))){if(D=l&255,c=e[K>>2]|0,o=e[R>>2]|0,c>>>0>=o>>>0){if(r=e[Q>>2]|0,t=r,d=c-t+1|0,(d|0)<0){if(g=0,ue(178,Q|0),N=g,g=0,N&1){_=52;break}t=e[Q>>2]|0,o=e[R>>2]|0,r=t}if(C=r,c=o-C|0,c>>>0<1073741823?(c=c<<1,c=c>>>0>>0?d:c,o=e[K>>2]|0,w=o-C|0,c?_=12:(c=0,d=0)):(w=e[K>>2]|0,c=2147483647,o=w,w=w-C|0,_=12),(_|0)==12&&(g=0,d=ge(67,c|0)|0,N=g,g=0,N&1)){_=52;break}S[d+w>>0]=D,k=o-C|0,N=d+(w-k)|0,o0(N|0,r|0,k|0)|0,e[Q>>2]=N,e[K>>2]=d+(w+1),e[R>>2]=d+c,t&&he(t)}else S[c>>0]=D,e[K>>2]=(e[K>>2]|0)+1;t:do if((l|0)>0){for(N=0;;){if(N=N+1|0,k=N&255,c=e[K>>2]|0,r=e[R>>2]|0,c>>>0>=r>>>0){if(t=e[Q>>2]|0,o=t,d=c-o+1|0,(d|0)<0){if(g=0,ue(178,Q|0),D=g,g=0,D&1)break;t=e[Q>>2]|0,o=t,r=e[R>>2]|0}if(D=t,c=r-D|0,c>>>0<1073741823?(c=c<<1,c=c>>>0>>0?d:c,r=e[K>>2]|0,w=r-D|0,c?_=25:(C=0,d=0)):(w=e[K>>2]|0,c=2147483647,r=w,w=w-D|0,_=25),(_|0)==25){if(_=0,g=0,d=ge(67,c|0)|0,C=g,g=0,C&1)break;C=c}S[d+w>>0]=k,c=d+(w+1)|0,D=r-D|0,k=d+(w-D)|0,o0(k|0,t|0,D|0)|0,e[Q>>2]=k,e[K>>2]=c,e[R>>2]=d+C,o&&(he(o),c=e[K>>2]|0)}else S[c>>0]=k,c=(e[K>>2]|0)+1|0,e[K>>2]=c;if(o=e[R>>2]|0,c>>>0>=o>>>0){if(r=e[Q>>2]|0,t=r,d=c-t+1|0,(d|0)<0){if(g=0,ue(178,Q|0),k=g,g=0,k&1)break;t=e[Q>>2]|0,o=e[R>>2]|0,r=t}if(D=r,c=o-D|0,c>>>0<1073741823?(c=c<<1,c=c>>>0>>0?d:c,d=e[K>>2]|0,w=d-D|0,c?_=36:(C=0,o=0)):(w=e[K>>2]|0,c=2147483647,d=w,w=w-D|0,_=36),(_|0)==36){if(_=0,g=0,o=ge(67,c|0)|0,k=g,g=0,k&1)break;C=c}S[o+w>>0]=17,c=o+(w+1)|0,D=d-D|0,k=o+(w-D)|0,o0(k|0,r|0,D|0)|0,e[Q>>2]=k,e[K>>2]=c,e[R>>2]=o+C,t&&(he(t),c=e[K>>2]|0)}else S[c>>0]=17,c=(e[K>>2]|0)+1|0,e[K>>2]=c;if(o=e[R>>2]|0,c>>>0>=o>>>0){if(r=e[Q>>2]|0,t=r,d=c-t+1|0,(d|0)<0){if(g=0,ue(178,Q|0),k=g,g=0,k&1)break;t=e[Q>>2]|0,o=e[R>>2]|0,r=t}if(C=r,c=o-C|0,c>>>0<1073741823?(c=c<<1,c=c>>>0>>0?d:c,o=e[K>>2]|0,w=o-C|0,c?_=48:(c=0,d=0)):(w=e[K>>2]|0,c=2147483647,o=w,w=w-C|0,_=48),(_|0)==48&&(_=0,g=0,d=ge(67,c|0)|0,k=g,g=0,k&1))break;S[d+w>>0]=0,D=o-C|0,k=d+(w-D)|0,o0(k|0,r|0,D|0)|0,e[Q>>2]=k,e[K>>2]=d+(w+1),e[R>>2]=d+c,t&&he(t)}else S[c>>0]=0,e[K>>2]=(e[K>>2]|0)+1;if((N|0)>=(l|0))break t}h=j()|0;break e}while(!1);if(g=0,w=ge(67,20)|0,l=g,g=0,l&1)_=52;else{e[w>>2]=36800,S[w+4>>0]=-9,t=w+8|0,e[t>>2]=0,d=w+12|0,e[d>>2]=0,o=w+16|0,e[o>>2]=0,c=e[K>>2]|0,l=e[Q>>2]|0,r=c-l|0;do if((c|0)!=(l|0)){if((r|0)<0&&(g=0,ue(178,t|0),l=g,g=0,l&1)||(_=62),(_|0)==62&&(g=0,h=ge(67,r|0)|0,l=g,g=0,!(l&1))){if(e[d>>2]=h,e[t>>2]=h,e[o>>2]=h+r,c=e[Q>>2]|0,o=e[K>>2]|0,(c|0)==(o|0))break;do S[h>>0]=S[c>>0]|0,h=(e[d>>2]|0)+1|0,e[d>>2]=h,c=c+1|0;while((c|0)!=(o|0));c=e[Q>>2]|0;break}h=j()|0,c=e[t>>2]|0,c&&((e[d>>2]|0)!=(c|0)&&(e[d>>2]=c),he(c)),he(w);break e}while(!1);return c?((e[K>>2]|0)!=(c|0)&&(e[K>>2]=c),he(c),b=U,w|0):(b=U,w|0)}}else _=52;while(!1);return(_|0)==52&&(h=j()|0),c=e[Q>>2]|0,c||le(h|0),(e[K>>2]|0)!=(c|0)&&(e[K>>2]=c),he(c),le(h|0),0}function o6(t){t=t|0;var r=0,o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0,G=0,$=0,P=0,O=0;K=b,b=b+32|0,_=K+28|0,$=K+16|0,Q=K+4|0,U=K,e[$>>2]=0,P=$+4|0,e[P>>2]=0,e[$+8>>2]=0,N=Xe(5)|0,e[$>>2]=N,R=$+8|0,e[R>>2]=N+5,S[N>>0]=74,S[N+1>>0]=70,S[N+2>>0]=73,S[N+3>>0]=70,S[N+4>>0]=0,e[P>>2]=N+5,g=0,Ae(84,$|0,e[t>>2]&65535|0),N=g,g=0;e:do if(N&1)G=43;else{if(D=e[t+4>>2]&255,r=e[P>>2]|0,l=e[R>>2]|0,r>>>0>=l>>>0){if(c=e[$>>2]|0,h=c,d=r-h+1|0,(d|0)<0){if(g=0,ue(178,$|0),N=g,g=0,N&1){G=43;break}h=e[$>>2]|0,l=e[R>>2]|0,c=h}if(C=c,r=l-C|0,r>>>0<1073741823?(r=r<<1,r=r>>>0>>0?d:r,l=e[P>>2]|0,w=l-C|0,r?G=10:(r=0,d=0)):(w=e[P>>2]|0,r=2147483647,l=w,w=w-C|0,G=10),(G|0)==10&&(g=0,d=ge(67,r|0)|0,N=g,g=0,N&1)){G=43;break}S[d+w>>0]=D,k=l-C|0,N=d+(w-k)|0,o0(N|0,c|0,k|0)|0,e[$>>2]=N,e[P>>2]=d+(w+1),e[R>>2]=d+r,h&&he(h)}else S[r>>0]=D,e[P>>2]=(e[P>>2]|0)+1;if(g=0,Ae(84,$|0,e[t+8>>2]&65535|0),N=g,g=0,!(N&1)&&(g=0,Ae(84,$|0,e[t+12>>2]&65535|0),N=g,g=0,!(N&1))){if(N=t+16|0,k=e[N>>2]&255,r=e[P>>2]|0,c=e[R>>2]|0,r>>>0>=c>>>0){if(h=e[$>>2]|0,l=h,d=r-l+1|0,(d|0)<0){if(g=0,ue(178,$|0),D=g,g=0,D&1){G=43;break}h=e[$>>2]|0,l=h,c=e[R>>2]|0}if(D=h,r=c-D|0,r>>>0<1073741823?(r=r<<1,r=r>>>0>>0?d:r,d=e[P>>2]|0,w=d-D|0,r?G=23:(C=0,c=0)):(w=e[P>>2]|0,r=2147483647,d=w,w=w-D|0,G=23),(G|0)==23)if(g=0,c=ge(67,r|0)|0,C=g,g=0,C&1){G=43;break}else C=r;S[c+w>>0]=k,r=c+(w+1)|0,D=d-D|0,k=c+(w-D)|0,o0(k|0,h|0,D|0)|0,e[$>>2]=k,e[P>>2]=r,e[R>>2]=c+C,l&&(he(l),r=e[P>>2]|0)}else S[r>>0]=k,r=(e[P>>2]|0)+1|0,e[P>>2]=r;if(k=t+20|0,D=e[k>>2]&255,l=e[R>>2]|0,r>>>0>=l>>>0){if(c=e[$>>2]|0,h=c,d=r-h+1|0,(d|0)<0){if(g=0,ue(178,$|0),C=g,g=0,C&1){G=43;break}h=e[$>>2]|0,l=e[R>>2]|0,c=h}if(C=c,r=l-C|0,r>>>0<1073741823?(r=r<<1,r=r>>>0>>0?d:r,l=e[P>>2]|0,w=l-C|0,r?G=34:(r=0,d=0)):(w=e[P>>2]|0,r=2147483647,l=w,w=w-C|0,G=34),(G|0)==34&&(g=0,d=ge(67,r|0)|0,O=g,g=0,O&1)){G=43;break}S[d+w>>0]=D,D=l-C|0,O=d+(w-D)|0,o0(O|0,c|0,D|0)|0,e[$>>2]=O,e[P>>2]=d+(w+1),e[R>>2]=d+r,h&&he(h)}else S[r>>0]=D,e[P>>2]=(e[P>>2]|0)+1;r=e[N>>2]|0;do if((r|0)>0){if(!(e[t+24>>2]|0))if(e[U>>2]=e[P>>2],O=0+(ee(r*3|0,e[k>>2]|0)|0)|0,g=0,e[_>>2]=e[U>>2],Pe(15,$|0,_|0,0,O|0)|0,O=g,g=0,O&1){G=43;break e}else break;if(l=Ct(16)|0,g=0,xe(5,Q|0,50792,57),O=g,g=0,O&1)r=j()|0;else if(g=0,r=Ce(1)|0,O=g,g=0,!(O&1)&&(g=0,$e(36,l|0,1,r|0,Q|0),O=g,g=0,!(O&1))?(g=0,xe(6,l|0,824,96),g=0,o=0):o=1,r=j()|0,de(Q),!o){o=r;break e}Tt(l|0),o=r;break e}while(!1);if(g=0,w=ge(67,20)|0,O=g,g=0,O&1)G=43;else{e[w>>2]=36800,S[w+4>>0]=-32,h=w+8|0,e[h>>2]=0,d=w+12|0,e[d>>2]=0,l=w+16|0,e[l>>2]=0,r=e[P>>2]|0,O=e[$>>2]|0,c=r-O|0;do if((r|0)!=(O|0)){if((c|0)<0&&(g=0,ue(178,h|0),O=g,g=0,O&1)||(G=53),(G|0)==53&&(g=0,o=ge(67,c|0)|0,O=g,g=0,!(O&1))){if(e[d>>2]=o,e[h>>2]=o,e[l>>2]=o+c,r=e[$>>2]|0,l=e[P>>2]|0,(r|0)==(l|0))break;do S[o>>0]=S[r>>0]|0,o=(e[d>>2]|0)+1|0,e[d>>2]=o,r=r+1|0;while((r|0)!=(l|0));r=e[$>>2]|0;break}r=j()|0,o=e[h>>2]|0,o&&((e[d>>2]|0)!=(o|0)&&(e[d>>2]=o),he(o)),he(w),G=44;break e}while(!1);return r?((e[P>>2]|0)!=(r|0)&&(e[P>>2]=r),he(r),b=K,w|0):(b=K,w|0)}}else G=43}while(!1);return(G|0)==43&&(r=j()|0,G=44),(G|0)==44&&(o=r),r=e[$>>2]|0,r||le(o|0),(e[P>>2]|0)!=(r|0)&&(e[P>>2]=r),he(r),le(o|0),0}function co(t){t=t|0;var r=0,o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0;w=b,b=b+16|0,D=w,e[D>>2]=0,k=D+4|0,e[k>>2]=0,e[D+8>>2]=0,g=0,r=ge(67,1)|0,d=g,g=0;e:do if(!(d&1)&&(d=r+1|0,S[r>>0]=1,e[D>>2]=r,e[k>>2]=d,e[D+8>>2]=d,g=0,Ae(84,D|0,e[t>>2]&65535|0),d=g,g=0,!(d&1))&&(g=0,Ae(84,D|0,e[t+4>>2]&65535|0),d=g,g=0,!(d&1))&&(g=0,Ae(84,D|0,e[t+8>>2]&65535|0),d=g,g=0,!(d&1))&&(g=0,Ae(84,D|0,e[t+12>>2]&65535|0),d=g,g=0,!(d&1))&&(g=0,Ae(84,D|0,e[t+16>>2]&65535|0),d=g,g=0,!(d&1))&&(g=0,C=ge(67,20)|0,d=g,g=0,!(d&1))){e[C>>2]=36800,S[C+4>>0]=-8,c=C+8|0,e[c>>2]=0,d=C+12|0,e[d>>2]=0,t=C+16|0,e[t>>2]=0,r=e[k>>2]|0,N=e[D>>2]|0,l=r-N|0;do if((r|0)!=(N|0)){if((l|0)<0&&(g=0,ue(178,c|0),N=g,g=0,N&1)||(h=11),(h|0)==11&&(g=0,o=ge(67,l|0)|0,N=g,g=0,!(N&1))){if(e[d>>2]=o,e[c>>2]=o,e[t>>2]=o+l,r=e[D>>2]|0,t=e[k>>2]|0,(r|0)==(t|0))break;do S[o>>0]=S[r>>0]|0,o=(e[d>>2]|0)+1|0,e[d>>2]=o,r=r+1|0;while((r|0)!=(t|0));r=e[D>>2]|0;break}o=j()|0,r=e[c>>2]|0,r&&((e[d>>2]|0)!=(r|0)&&(e[d>>2]=r),he(r)),he(C);break e}while(!1);return r?((e[k>>2]|0)!=(r|0)&&(e[k>>2]=r),he(r),b=w,C|0):(b=w,C|0)}else h=25;while(!1);return(h|0)==25&&(o=j()|0),r=e[D>>2]|0,r||le(o|0),(e[k>>2]|0)!=(r|0)&&(e[k>>2]=r),he(r),le(o|0),0}function a6(t){t=t|0;var r=0,o=0,l=0,c=0,h=0,d=0;return h=Xe(5)|0,S[h>>0]=109,S[h+1>>0]=114,S[h+2>>0]=102,S[h+3>>0]=120,S[h+4>>0]=t,g=0,c=ge(67,20)|0,l=g,g=0,l&1&&(c=j()|0,he(h),le(c|0)),e[c>>2]=36800,S[c+4>>0]=-24,t=c+8|0,e[t>>2]=0,r=c+12|0,e[r>>2]=0,o=c+16|0,e[o>>2]=0,g=0,l=ge(67,5)|0,d=g,g=0,d&1?(d=j()|0,he(c),he(h),le(d|0),0):(e[r>>2]=l,e[t>>2]=l,e[o>>2]=l+5,S[l>>0]=109,d=(e[r>>2]|0)+1|0,e[r>>2]=d,l=h+1|0,S[d>>0]=S[l>>0]|0,d=(e[r>>2]|0)+1|0,e[r>>2]=d,l=l+1|0,S[d>>0]=S[l>>0]|0,d=(e[r>>2]|0)+1|0,e[r>>2]=d,l=l+1|0,S[d>>0]=S[l>>0]|0,d=(e[r>>2]|0)+1|0,e[r>>2]=d,S[d>>0]=S[l+1>>0]|0,e[r>>2]=(e[r>>2]|0)+1,he(h),c|0)}function l6(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0,G=0,$=0,P=0;G=b,b=b+16|0,$=G,e[$>>2]=0,P=$+4|0,e[P>>2]=0,e[$+8>>2]=0,Q=$+8|0,g=0,c=ge(67,1)|0,U=g,g=0;e:do if(U&1)K=29;else{if(w=c+1|0,U=w,S[c>>0]=r,e[$>>2]=c,e[P>>2]=U,e[Q>>2]=U,(r|0)>0){d=w,U=0;do{if(_=U+t&255,d>>>0>=w>>>0){if(c=e[$>>2]|0,C=c,d=d-C+1|0,(d|0)<0){if(g=0,ue(178,$|0),R=g,g=0,R&1){K=28;break}C=e[$>>2]|0,w=e[Q>>2]|0,R=C}else R=c;if(N=R,c=w-N|0,c>>>0<1073741823?(c=c<<1,c=c>>>0>>0?d:c,w=e[P>>2]|0,D=w-N|0,c?K=13:(k=0,d=0)):(D=e[P>>2]|0,c=2147483647,w=D,D=D-N|0,K=13),(K|0)==13)if(K=0,g=0,d=ge(67,c|0)|0,k=g,g=0,k&1){K=28;break}else k=c;S[d+D>>0]=_,c=d+(D+1)|0,N=w-N|0,_=d+(D-N)|0,o0(_|0,R|0,N|0)|0,e[$>>2]=_,e[P>>2]=c,e[Q>>2]=d+k,C&&(he(C),c=e[P>>2]|0)}else S[d>>0]=_,c=(e[P>>2]|0)+1|0,e[P>>2]=c;if(w=e[Q>>2]|0,c>>>0>=w>>>0){if(C=e[$>>2]|0,d=C,D=c-d+1|0,(D|0)<0){if(g=0,ue(178,$|0),_=g,g=0,_&1){K=28;break}C=e[$>>2]|0,d=C,w=e[Q>>2]|0}if(N=C,c=w-N|0,c>>>0<1073741823?(c=c<<1,c=c>>>0>>0?D:c,D=e[P>>2]|0,w=D-N|0,c?K=24:(c=0,k=0)):(w=e[P>>2]|0,c=2147483647,D=w,w=w-N|0,K=24),(K|0)==24&&(K=0,g=0,k=ge(67,c|0)|0,_=g,g=0,_&1)){K=28;break}S[k+w>>0]=0,R=D-N|0,_=k+(w-R)|0,o0(_|0,C|0,R|0)|0,e[$>>2]=_,e[P>>2]=k+(w+1),e[Q>>2]=k+c,d&&he(d)}else S[c>>0]=0,e[P>>2]=(e[P>>2]|0)+1;U=U+1|0,d=e[P>>2]|0,w=e[Q>>2]|0}while((U|0)<(r|0));if((K|0)==28){h=j()|0;break}c=o&255,d>>>0>>0?(S[d>>0]=c,d=(e[P>>2]|0)+1|0,e[P>>2]=d):K=37}else d=w,c=o&255,K=37;if((K|0)==37){if(C=e[$>>2]|0,D=C,k=d-D+1|0,(k|0)<0){if(g=0,ue(178,$|0),o=g,g=0,o&1){K=29;break}D=e[$>>2]|0,w=e[Q>>2]|0,C=D}if(_=C,d=w-_|0,d>>>0<1073741823?(d=d<<1,d=d>>>0>>0?k:d,k=e[P>>2]|0,N=k-_|0,d?K=43:(R=0,w=0)):(N=e[P>>2]|0,d=2147483647,k=N,N=N-_|0,K=43),(K|0)==43)if(g=0,w=ge(67,d|0)|0,o=g,g=0,o&1){K=29;break}else R=d;S[w+N>>0]=c,d=w+(N+1)|0,t=k-_|0,o=w+(N-t)|0,o0(o|0,C|0,t|0)|0,e[$>>2]=o,e[P>>2]=d,e[Q>>2]=w+R,D&&(he(D),d=e[P>>2]|0)}if(_=l&255,c=e[Q>>2]|0,d>>>0>=c>>>0){if(w=e[$>>2]|0,C=w,d=d-C+1|0,(d|0)<0){if(g=0,ue(178,$|0),l=g,g=0,l&1){K=29;break}C=e[$>>2]|0,c=e[Q>>2]|0,w=C}if(R=w,c=c-R|0,c>>>0<1073741823?(c=c<<1,c=c>>>0>>0?d:c,D=e[P>>2]|0,k=D-R|0,c?K=54:(N=0,d=0)):(k=e[P>>2]|0,c=2147483647,D=k,k=k-R|0,K=54),(K|0)==54)if(g=0,d=ge(67,c|0)|0,l=g,g=0,l&1){K=29;break}else N=c;S[d+k>>0]=_,c=d+(k+1)|0,o=D-R|0,l=d+(k-o)|0,o0(l|0,w|0,o|0)|0,e[$>>2]=l,e[P>>2]=c,e[Q>>2]=d+N,C&&(he(C),c=e[P>>2]|0)}else S[d>>0]=_,c=(e[P>>2]|0)+1|0,e[P>>2]=c;if(d=e[Q>>2]|0,c>>>0>=d>>>0){if(w=e[$>>2]|0,C=w,D=c-C+1|0,(D|0)<0){if(g=0,ue(178,$|0),l=g,g=0,l&1){K=29;break}C=e[$>>2]|0,d=e[Q>>2]|0,w=C}if(N=w,c=d-N|0,c>>>0<1073741823?(c=c<<1,c=c>>>0>>0?D:c,d=e[P>>2]|0,k=d-N|0,c?K=65:(c=0,D=0)):(k=e[P>>2]|0,c=2147483647,d=k,k=k-N|0,K=65),(K|0)==65&&(g=0,D=ge(67,c|0)|0,l=g,g=0,l&1)){K=29;break}S[D+k>>0]=0,o=d-N|0,l=D+(k-o)|0,o0(l|0,w|0,o|0)|0,e[$>>2]=l,e[P>>2]=D+(k+1),e[Q>>2]=D+c,C&&he(C)}else S[c>>0]=0,e[P>>2]=(e[P>>2]|0)+1;if(g=0,k=ge(67,20)|0,Q=g,g=0,Q&1)K=29;else{e[k>>2]=36800,S[k+4>>0]=-38,C=k+8|0,e[C>>2]=0,D=k+12|0,e[D>>2]=0,d=k+16|0,e[d>>2]=0,c=e[P>>2]|0,Q=e[$>>2]|0,w=c-Q|0;do if((c|0)!=(Q|0)){if((w|0)<0&&(g=0,ue(178,C|0),Q=g,g=0,Q&1)||(K=72),(K|0)==72&&(g=0,h=ge(67,w|0)|0,Q=g,g=0,!(Q&1))){if(e[D>>2]=h,e[C>>2]=h,e[d>>2]=h+w,c=e[$>>2]|0,d=e[P>>2]|0,(c|0)==(d|0))break;do S[h>>0]=S[c>>0]|0,h=(e[D>>2]|0)+1|0,e[D>>2]=h,c=c+1|0;while((c|0)!=(d|0));c=e[$>>2]|0;break}h=j()|0,c=e[C>>2]|0,c&&((e[D>>2]|0)!=(c|0)&&(e[D>>2]=c),he(c)),he(k);break e}while(!1);return c?((e[P>>2]|0)!=(c|0)&&(e[P>>2]=c),he(c),b=G,k|0):(b=G,k|0)}}while(!1);return(K|0)==29&&(h=j()|0),c=e[$>>2]|0,c||le(h|0),(e[P>>2]|0)!=(c|0)&&(e[P>>2]=c),he(c),le(h|0),0}function u6(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0;if(N=(r&65535)>>>8&255,R=t+4|0,o=e[R>>2]|0,_=t+8|0,l=e[_>>2]|0,o>>>0>=l>>>0?(c=e[t>>2]|0,h=c,d=o-h+1|0,(d|0)<0&&(pi(t),h=e[t>>2]|0,l=e[_>>2]|0,c=h),k=c,o=l-k|0,o>>>0<1073741823?(o=o<<1,o=o>>>0>>0?d:o,d=e[R>>2]|0,l=d-k|0,o?U=8:(D=0,C=0,w=l,o=d)):(l=e[R>>2]|0,o=2147483647,d=l,l=l-k|0,U=8),(U|0)==8&&(D=o,C=Xe(o)|0,w=l,o=d),S[C+w>>0]=N,l=C+(w+1)|0,k=o-k|0,N=C+(w-k)|0,o0(N|0,c|0,k|0)|0,e[t>>2]=N,e[R>>2]=l,e[_>>2]=C+D,h&&(he(h),l=e[R>>2]|0)):(S[o>>0]=N,l=(e[R>>2]|0)+1|0,e[R>>2]=l),k=r&255,o=e[_>>2]|0,l>>>0>>0){S[l>>0]=k,e[R>>2]=(e[R>>2]|0)+1;return}c=e[t>>2]|0,h=c,l=l-h+1|0,(l|0)<0&&(pi(t),h=e[t>>2]|0,o=e[_>>2]|0,c=h),D=c,o=o-D|0,o>>>0<1073741823?(o=o<<1,o=o>>>0>>0?l:o,d=e[R>>2]|0,l=d-D|0,o?U=18:(C=0,w=0,o=d)):(l=e[R>>2]|0,o=2147483647,d=l,l=l-D|0,U=18),(U|0)==18&&(C=o,w=Xe(o)|0,o=d),S[w+l>>0]=k,r=o-D|0,U=w+(l-r)|0,o0(U|0,c|0,r|0)|0,e[t>>2]=U,e[R>>2]=w+(l+1),e[_>>2]=w+C,h&&he(h)}function c6(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0;if(c=e[t>>2]|0,U=e[r>>2]|0,_=U,C=c,N=o,D=l-N|0,(D|0)<=0)return Q=U,Q|0;if(R=t+8|0,r=e[R>>2]|0,Q=t+4|0,k=e[Q>>2]|0,h=k,(D|0)<=(r-h|0)){if(w=h-_|0,(D|0)>(w|0)){if(d=o+w|0,(d|0)==(l|0))r=k;else{h=d,r=k;do S[r>>0]=S[h>>0]|0,r=(e[Q>>2]|0)+1|0,e[Q>>2]=r,h=h+1|0;while((h|0)!=(l|0))}if((w|0)>0)w=r;else return Q=U,Q|0}else w=k,d=l;if(c=w-(c+(D-C+_))|0,r=U+c|0,r>>>0>>0){h=w;do S[h>>0]=S[r>>0]|0,r=r+1|0,h=(e[Q>>2]|0)+1|0,e[Q>>2]=h;while((r|0)!=(k|0))}return vn(w+(0-c)|0,U|0,c|0)|0,vn(U|0,o|0,d-N|0)|0,Q=U,Q|0}if(h=h-C+D|0,(h|0)<0&&(pi(t),r=e[R>>2]|0,c=e[t>>2]|0),d=c,r=r-d|0,r>>>0<1073741823?(r=r<<1,r=r>>>0>>0?h:r,h=_-d|0,r?w=15:(d=0,D=0)):(r=2147483647,h=_-d|0,w=15),(w|0)==15&&(d=r,D=Xe(r)|0),C=D+h|0,r=C,w=D+d|0,(o|0)!=(l|0)){c=o,d=C;do S[d>>0]=S[c>>0]|0,d=r+1|0,r=d,c=c+1|0;while((c|0)!=(l|0));c=e[t>>2]|0}return o=_-c|0,l=D+(h-o)|0,o0(l|0,c|0,o|0)|0,_=(e[Q>>2]|0)-_|0,o=r,o0(o|0,U|0,_|0)|0,r=e[t>>2]|0,e[t>>2]=l,e[Q>>2]=o+_,e[R>>2]=w,r?(he(r),Q=C,Q|0):(Q=C,Q|0)}function f6(t){t=t|0;var r=0;e[t>>2]=36800,r=e[t+8>>2]|0,r&&(t=t+12|0,(e[t>>2]|0)!=(r|0)&&(e[t>>2]=r),he(r))}function h6(t){t=t|0;var r=0,o=0;if(e[t>>2]=36800,r=e[t+8>>2]|0,!r){he(t);return}o=t+12|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r),he(t)}function d6(t,r){t=t|0,r=r|0;var o=0,l=0,c=0;if(ui(r,-1),ui(r,S[t+4>>0]|0),c=t+12|0,l=t+8|0,t=(e[c>>2]|0)-(e[l>>2]|0)+2|0,ui(r,(t&65535)>>>8&255),ui(r,t&255),t=e[l>>2]|0,(e[c>>2]|0)!=(t|0)){o=0;do ui(r,S[t+o>>0]|0),o=o+1|0,t=e[l>>2]|0;while(o>>>0<((e[c>>2]|0)-t|0)>>>0)}}function ui(t,r){t=t|0,r=r|0;var o=0,l=0,c=0;if(c=e[t+4>>2]|0,c)if(o=c+24|0,l=e[o>>2]|0,(l|0)==(e[c+28>>2]|0)){U0[e[(e[c>>2]|0)+52>>2]&63](c,r&255)|0;return}else{e[o>>2]=l+1,S[l>>0]=r;return}if(o=t+16|0,l=e[o>>2]|0,l>>>0<(e[t+12>>2]|0)>>>0){e[o>>2]=l+1,S[(e[t+8>>2]|0)+l>>0]=r;return}o=Ct(16)|0,g=0,l=Ce(1)|0,r=g,g=0,r&1&&(r=j()|0,Tt(o|0),le(r|0)),g=0,xe(7,o|0,4,l|0),r=g,g=0,r&1?(r=j()|0,Tt(o|0),le(r|0)):Qt(o|0,824,96)}function m0(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0;e[t>>2]=0,e[t+4>>2]=0,e[t+8>>2]=0,e[t+12>>2]=0,c=(r|0)<4095?(r+128|0)/256|0:16,h=(o*3|0)+2+c|0,l=o+1|0,h=(h|0)<(l|0)|(h|0)>(r|0)?l:h,e[t+4>>2]=h,l=(c<<2|3)+(o*5|0)|0,l=(l|0)>(r|0)|(l|0)<(h|0)?h:l,e[t+8>>2]=l,o=(o*7|0)+4+(c*17|0)|0,e[t+12>>2]=(o|0)>(r|0)|(o|0)<(l|0)?l:o,e[t>>2]=r,e[t+16>>2]=64}function p6(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0;D=b,b=b+128|0,w=D+100|0,l=D+16|0,o=D+112|0,C=D+4|0,k=D,c=l,h=t+20|0,d=c+84|0;do e[c>>2]=e[h>>2],c=c+4|0,h=h+4|0;while((c|0)<(d|0));e[l+16>>2]=e[t+4>>2],h=wa(o,l,t+56|0)|0,o=e[(e[h>>2]|0)+16>>2]|0,t=t+8|0,g=0,e[w>>2]=e[t>>2],e[w+4>>2]=e[t+4>>2],e[w+8>>2]=e[t+8>>2],o=be(o|0,h|0,w|0)|0,t=g,g=0;do if(t&1)o=j()|0;else{if(c=r+4|0,e[C>>2]=e[c>>2],e[C+4>>2]=e[c+4>>2],e[C+8>>2]=e[c+8>>2],c=r+16|0,t=e[c>>2]|0,w=C+8|0,e[w>>2]=(e[w>>2]|0)-t,w=C+4|0,e[w>>2]=(e[w>>2]|0)+t,w=e[(e[h>>2]|0)+12>>2]|0,e[k>>2]=o,g=0,o=Pe(w|0,h|0,k|0,C|0,(S[r>>0]|0?(e[r+8>>2]|0)+t|0:0)|0)|0,C=g,g=0,C&1){if(o=j()|0,l=e[k>>2]|0,e[k>>2]=0,!l)break;Mt[e[(e[l>>2]|0)+4>>2]&255](l);break}if(l=e[k>>2]|0,e[k>>2]=0,l&&Mt[e[(e[l>>2]|0)+4>>2]&255](l),e[r+4>>2]|0||(e[c>>2]=(e[c>>2]|0)+o),!h){b=D;return}Mt[e[(e[h>>2]|0)+4>>2]&255](h),b=D;return}while(!1);h||le(o|0),Mt[e[(e[h>>2]|0)+4>>2]&255](h),le(o|0)}function m6(t,r){t=t|0,r=r|0,e[t>>2]=e[r>>2],e[t+4>>2]=e[r+4>>2],e[t+8>>2]=e[r+8>>2],S[t+12>>0]=0,r=t+16|0,t=r+100|0;do e[r>>2]=0,r=r+4|0;while((r|0)<(t|0))}function g6(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0,G=0,$=0,P=0;G=b,b=b+32|0,K=G+4|0,R=G+16|0,$=G,fo(t),_=t+16|0,c=e[t+24>>2]|0;e:do if((c+-2|0)>>>0<=14)if(U=t+40|0,o=e[U>>2]|0,o>>>0>2)o=5;else{switch(Q=t+32|0,h=e[Q>>2]|0,h|0){case 0:{o=1;break e}case 4:{if((o|0)==2){o=2;break e}break}case 3:break;default:if(o){o=2;break e}}if(N=t+100|0,o=t+108|0,l=e[o>>2]|0,(l|0)<1?(l=e[_>>2]|0,e[o>>2]=l,o=e[t+20>>2]|0,e[t+112>>2]=o):o=e[t+112>>2]|0,C=Qi(o|0,((o|0)<0)<<31>>31|0,l|0,((l|0)<0)<<31>>31|0)|0,w=(c+7|0)/8|0,w=Qi(C|0,ye|0,w|0,((w|0)<0)<<31>>31|0)|0,C=r+4|0,o=e[C>>2]|0,d=r+8|0,o|0&&(D=e[d>>2]|0,k=Qi(h|0,((h|0)<0)<<31>>31|0,w|0,ye|0)|0,c=ye,0<(c|0)|(c|0)==0&D>>>0>>0)&&(o=Ct(16)|0,g=0,l=Ce(1)|0,$=g,g=0,!($&1)&&(g=0,xe(7,o|0,3,l|0),$=g,g=0,!($&1))&&Qt(o|0,824,96),$=j()|0,Tt(o|0),le($|0)),D=t+52|0,k=t+12|0,(h|0)>0)h=0;else{b=G;return}for(;;){if(ho(t,(h|0)==0),l=va(R,_,D)|0,c=e[(e[l>>2]|0)+8>>2]|0,g=0,e[K>>2]=e[r>>2],e[K+4>>2]=e[r+4>>2],e[K+8>>2]=e[r+8>>2],c=be(c|0,l|0,K|0)|0,P=g,g=0,P&1){c=32;break}if(P=e[(e[l>>2]|0)+16>>2]|0,e[$>>2]=c,g=0,Re(P|0,l|0,$|0,N|0,t|0,(S[k>>0]|0)!=0|0),P=g,g=0,P&1){c=30;break}if(c=e[$>>2]|0,e[$>>2]=0,c&&Mt[e[(e[c>>2]|0)+4>>2]&255](c),o?(o=o+w|0,e[C>>2]=o,e[d>>2]=(e[d>>2]|0)-w):o=0,c=(e[U>>2]|0)==0,h=(c&1)+h|0,l&&Mt[e[(e[l>>2]|0)+4>>2]&255](l),!c){c=34;break}if((h|0)>=(e[Q>>2]|0)){c=34;break}}if((c|0)==30)o=j()|0,c=e[$>>2]|0,e[$>>2]=0,c&&Mt[e[(e[c>>2]|0)+4>>2]&255](c);else if((c|0)==32)o=j()|0,l||(P=o,le(P|0));else if((c|0)==34){b=G;return}Mt[e[(e[l>>2]|0)+4>>2]&255](l),P=o,le(P|0)}else o=2;while(!1);l=Ct(16)|0,g=0,c=Ce(1)|0,P=g,g=0,!(P&1)&&(g=0,xe(7,l|0,o|0,c|0),P=g,g=0,!(P&1))&&Qt(l|0,824,96),P=j()|0,Tt(l|0),le(P|0)}function fo(t){t=t|0;var r=0,o=0,l=0,c=0;if((Ir(t)|0)<<24>>24!=-40&&(r=Ct(16)|0,g=0,o=Ce(1)|0,c=g,g=0,!(c&1)&&(g=0,xe(7,r|0,5,o|0),c=g,g=0,!(c&1))&&Qt(r|0,824,96),c=j()|0,Tt(r|0),le(c|0)),r=Ir(t)|0,r<<24>>24!=-38){for(;l=((d0(t)|0)&255)<<8,l=l|(d0(t)|0)&255,r=A6(t,r)|0,o=-2-r+l|0,!((o|0)<0);){if((o|0)>0){r=l+-2-r|0,o=0;do d0(t)|0,o=o+1|0;while((o|0)!=(r|0))}if(r=Ir(t)|0,r<<24>>24==-38){c=8;break}}(c|0)!=8&&(r=Ct(16)|0,g=0,o=Ce(1)|0,c=g,g=0,!(c&1)&&(g=0,xe(7,r|0,5,o|0),c=g,g=0,!(c&1))&&Qt(r|0,824,96),c=j()|0,Tt(r|0),le(c|0))}}function ho(t,r){t=t|0,r=r|0;var o=0,l=0,c=0;r||((d0(t)|0)<<24>>24!=-1&&(r=Ct(16)|0,g=0,o=Ce(1)|0,t=g,g=0,!(t&1)&&(g=0,xe(7,r|0,12,o|0),t=g,g=0,!(t&1))&&Qt(r|0,824,96),t=j()|0,Tt(r|0),le(t|0)),(d0(t)|0)<<24>>24!=-38&&(r=Ct(16)|0,g=0,o=Ce(1)|0,t=g,g=0,!(t&1)&&(g=0,xe(7,r|0,5,o|0),t=g,g=0,!(t&1))&&Qt(r|0,824,96),t=j()|0,Tt(r|0),le(t|0))),d0(t)|0,d0(t)|0,o=d0(t)|0,l=o&255;do if(o<<24>>24==1)d0(t)|0,o=0,c=20;else{if((l|0)==(e[t+32>>2]|0))if(r=d0(t)|0,o<<24>>24){o=0,c=20;break}else break;r=Ct(16)|0,g=0,o=Ce(1)|0,t=g,g=0,!(t&1)&&(g=0,xe(7,r|0,2,o|0),t=g,g=0,!(t&1))&&Qt(r|0,824,96),t=j()|0,Tt(r|0),le(t|0)}while(!1);if((c|0)==20)for(;d0(t)|0,o=o+1|0,r=d0(t)|0,(o|0)!=(l|0);)c=20;e[t+36>>2]=r&255,c=d0(t)|0,o=t+40|0,e[o>>2]=c&255,(c&255)>=3&&(r=Ct(16)|0,g=0,o=Ce(1)|0,t=g,g=0,!(t&1)&&(g=0,xe(7,r|0,5,o|0),t=g,g=0,!(t&1))&&Qt(r|0,824,96),t=j()|0,Tt(r|0),le(t|0)),(d0(t)|0)<<24>>24&&(r=Ct(16)|0,g=0,o=Ce(1)|0,t=g,g=0,!(t&1)&&(g=0,xe(7,r|0,5,o|0),t=g,g=0,!(t&1))&&Qt(r|0,824,96),t=j()|0,Tt(r|0),le(t|0)),l=t+28|0,!(e[l>>2]|0)&&(r=e[t+108>>2]|0,r||(r=e[t+16>>2]|0),e[o>>2]|0?o=e[t+32>>2]|0:o=1,c=ee(o,r)|0,t=ee(c,((e[t+24>>2]|0)+7|0)/8|0)|0,e[l>>2]=t)}function S6(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0;if(!((o|0)<=0)){N=r+4|0,R=r+8|0,U=0;do _=d0(t)|0,l=e[N>>2]|0,c=e[R>>2]|0,l>>>0>=c>>>0?(h=e[r>>2]|0,d=h,w=l-d+1|0,(w|0)<0&&(pi(r),d=e[r>>2]|0,c=e[R>>2]|0,h=d),k=h,l=c-k|0,l>>>0<1073741823?(l=l<<1,l=l>>>0>>0?w:l,w=e[N>>2]|0,c=w-k|0,l?Q=10:(D=0,C=0,l=w)):(c=e[N>>2]|0,l=2147483647,w=c,c=c-k|0,Q=10),(Q|0)==10&&(Q=0,D=l,C=Xe(l)|0,l=w),S[C+c>>0]=_,k=l-k|0,_=C+(c-k)|0,o0(_|0,h|0,k|0)|0,e[r>>2]=_,e[N>>2]=C+(c+1),e[R>>2]=C+D,d&&he(d)):(S[l>>0]=_,e[N>>2]=(e[N>>2]|0)+1),U=U+1|0;while((U|0)!=(o|0))}}function d0(t){t=t|0;var r=0,o=0,l=0,c=0;return o=e[t>>2]|0,o?(t=o+12|0,r=e[t>>2]|0,(r|0)==(e[o+16>>2]|0)?t=Dt[e[(e[o>>2]|0)+40>>2]&127](o)|0:(e[t>>2]=r+1,t=F[r>>0]|0),c=t&255,c|0):(l=t+8|0,c=e[l>>2]|0,c?(t=t+4|0,r=e[t>>2]|0,o=S[r>>0]|0,r?(e[t>>2]=r+1,e[l>>2]=c+-1,c=o,c|0):(c=o,c|0)):(t=Ct(16)|0,g=0,r=Ce(1)|0,c=g,g=0,c&1&&(c=j()|0,Tt(t|0),le(c|0)),g=0,xe(7,t|0,4,r|0),c=g,g=0,c&1?(c=j()|0,Tt(t|0),le(c|0)):Qt(t|0,824,96),0))}function Ir(t){t=t|0;var r=0,o=0,l=0,c=0,h=0,d=0,w=0,C=0;if(o=b,b=b+176|0,r=o+152|0,C=o+16|0,d=o,w=d0(t)|0,l=w&255,w<<24>>24==-1){do r=d0(t)|0;while(r<<24>>24==-1);return b=o,r|0}w=C+56|0,h=C+4|0,e[C>>2]=36160,e[w>>2]=36180,g=0,Ae(62,C+56|0,h|0),c=g,g=0,c&1&&(C=j()|0,tt(w),le(C|0)),e[C+128>>2]=0,e[C+132>>2]=-1,e[C>>2]=36200,e[C+56>>2]=36220,g=0,ue(180,h|0),c=g,g=0;do if(c&1)r=j()|0;else{if(e[h>>2]=36236,c=C+36|0,e[c>>2]=0,e[c+4>>2]=0,e[c+8>>2]=0,e[c+12>>2]=0,e[C+52>>2]=16,e[r>>2]=0,e[r+4>>2]=0,e[r+8>>2]=0,g=0,Ae(63,h|0,r|0),o=g,g=0,o&1){C=j()|0,de(r),de(c),wt(h),r=C;break}de(r),e[C+((e[(e[C>>2]|0)+-12>>2]|0)+76)>>2]=48,g=0,r=Ve(28,C|0,50907,62)|0,o=g,g=0,!(o&1)&&(o=r+((e[(e[r>>2]|0)+-12>>2]|0)+4)|0,e[o>>2]=e[o>>2]&-75|8,o=r+((e[(e[r>>2]|0)+-12>>2]|0)+4)|0,e[o>>2]=e[o>>2]|16384,e[r+((e[(e[r>>2]|0)+-12>>2]|0)+12)>>2]=2,g=0,be(38,r|0,l|0)|0,l=g,g=0,!(l&1))&&(o=Ct(16)|0,g=0,Ae(64,d|0,h|0),l=g,g=0,l&1?r=j()|0:(g=0,r=Ce(1)|0,l=g,g=0,!(l&1)&&(g=0,$e(36,o|0,12,r|0,d|0),l=g,g=0,!(l&1))?(g=0,xe(6,o|0,824,96),g=0,t=0):t=1,r=j()|0,de(d),t||(d=r,e[C>>2]=36200,e[w>>2]=36220,e[h>>2]=36236,de(c),wt(h),tt(w),le(d|0))),Tt(o|0),d=r,e[C>>2]=36200,e[w>>2]=36220,e[h>>2]=36236,de(c),wt(h),tt(w),le(d|0)),d=j()|0,e[C>>2]=36200,e[w>>2]=36220,e[h>>2]=36236,de(c),wt(h),tt(w),le(d|0)}while(!1);return C=r,tt(w),le(C|0),0}function A6(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0;switch(o=b,b=b+320|0,w=o+300|0,k=o+152|0,C=o+288|0,N=o+16|0,D=o,r<<24>>24){case-9:return R=(d0(t)|0)&255,e[t+24>>2]=R,R=((d0(t)|0)&255)<<8|(d0(t)|0)&255,N=((d0(t)|0)&255)<<8|(d0(t)|0)&255,e[t+16>>2]=N,e[t+20>>2]=R,R=(d0(t)|0)&255,e[t+32>>2]=R,R=6,b=o,R|0;case-8:return R=v6(t)|0,b=o,R|0;case-24:return R=x6(t)|0,b=o,R|0;case-53:case-54:case-55:case-57:case-58:case-59:case-61:case-62:case-63:case-64:{d=k+56|0,c=k+4|0,e[k>>2]=36160,e[d>>2]=36180,g=0,Ae(62,k+56|0,c|0),N=g,g=0,N&1&&(R=j()|0,tt(d),le(R|0)),e[k+128>>2]=0,e[k+132>>2]=-1,e[k>>2]=36200,e[k+56>>2]=36220,g=0,ue(180,c|0),N=g,g=0;do if(N&1)t=j()|0;else{if(e[c>>2]=36236,h=k+36|0,e[h>>2]=0,e[h+4>>2]=0,e[h+8>>2]=0,e[h+12>>2]=0,e[k+52>>2]=16,e[w>>2]=0,e[w+4>>2]=0,e[w+8>>2]=0,g=0,Ae(63,c|0,w|0),N=g,g=0,N&1){t=j()|0,de(w),de(h),wt(c);break}de(w),g=0,t=Ve(28,k|0,50970,26)|0,N=g,g=0;do if(!(N&1)&&(g=0,l=be(38,t|0,r&255|0)|0,N=g,g=0,!(N&1))&&(g=0,Ve(28,l|0,50997,18)|0,N=g,g=0,!(N&1))){if(l=Ct(16)|0,g=0,Ae(64,C|0,c|0),N=g,g=0,N&1)t=j()|0;else if(g=0,t=Ce(1)|0,N=g,g=0,!(N&1)&&(g=0,$e(36,l|0,10,t|0,C|0),N=g,g=0,!(N&1))?(g=0,xe(6,l|0,824,96),g=0,o=0):o=1,t=j()|0,de(C),!o)break;Tt(l|0)}else R=20;while(!1);(R|0)==20&&(t=j()|0),e[k>>2]=36200,e[d>>2]=36220,e[c>>2]=36236,de(h),wt(c),tt(d),R=t,le(R|0)}while(!1);R=t,tt(d),le(R|0)}case-25:case-32:case-2:return R=0,b=o,R|0;default:{C=N+56|0,h=N+4|0,e[N>>2]=36160,e[C>>2]=36180,g=0,Ae(62,N+56|0,h|0),k=g,g=0,k&1&&(R=j()|0,tt(C),le(R|0)),e[N+128>>2]=0,e[N+132>>2]=-1,e[N>>2]=36200,e[N+56>>2]=36220,g=0,ue(180,h|0),k=g,g=0;do if(k&1)t=j()|0;else{if(e[h>>2]=36236,d=N+36|0,e[d>>2]=0,e[d+4>>2]=0,e[d+8>>2]=0,e[d+12>>2]=0,e[N+52>>2]=16,e[w>>2]=0,e[w+4>>2]=0,e[w+8>>2]=0,g=0,Ae(63,h|0,w|0),k=g,g=0,k&1){t=j()|0,de(w),de(d),wt(h);break}de(w),g=0,t=Ve(28,N|0,51016,20)|0,k=g,g=0;do if(!(k&1)&&(g=0,c=be(38,t|0,r&255|0)|0,k=g,g=0,!(k&1))&&(g=0,Ve(28,c|0,51037,13)|0,k=g,g=0,!(k&1))){if(l=Ct(16)|0,g=0,Ae(64,D|0,h|0),k=g,g=0,k&1)t=j()|0;else if(g=0,t=Ce(1)|0,k=g,g=0,!(k&1)&&(g=0,$e(36,l|0,11,t|0,D|0),k=g,g=0,!(k&1))?(g=0,xe(6,l|0,824,96),g=0,o=0):o=1,t=j()|0,de(D),!o)break;Tt(l|0)}else R=40;while(!1);(R|0)==40&&(t=j()|0),e[N>>2]=36200,e[C>>2]=36220,e[h>>2]=36236,de(d),wt(h),tt(C),R=t,le(R|0)}while(!1);R=t,tt(C),le(R|0)}}return 0}function v6(t){t=t|0;var r=0;return(d0(t)|0)<<24>>24!=1?(t=1,t|0):(r=((d0(t)|0)&255)<<8,r=r|(d0(t)|0)&255,e[t+52>>2]=r,r=((d0(t)|0)&255)<<8,r=r|(d0(t)|0)&255,e[t+56>>2]=r,r=((d0(t)|0)&255)<<8,r=r|(d0(t)|0)&255,e[t+60>>2]=r,r=((d0(t)|0)&255)<<8,r=r|(d0(t)|0)&255,e[t+64>>2]=r,r=((d0(t)|0)&255)<<8,r=r|(d0(t)|0)&255,e[t+68>>2]=r,t=11,t|0)}function x6(t){t=t|0;var r=0,o=0,l=0,c=0,h=0,d=0;o=b,b=b+16|0,c=o,e[c>>2]=0,h=c+4|0,e[h>>2]=0,e[c+8>>2]=0,g=0,xe(9,t|0,c|0,4),r=g,g=0;e:do if(r&1)l=3;else{r=e[c>>2]|0;t:do if(US(r,51051,4)|0)t=4;else{if(g=0,r=ge(69,t|0)|0,d=g,g=0,d&1){l=3;break e}switch(r=r&255,r|0){case 3:case 2:case 1:case 0:{e[t+44>>2]=r,t=5,r=e[c>>2]|0;break t}case 5:case 4:{if(r=Ct(16)|0,g=0,t=Ce(1)|0,d=g,g=0,!(d&1)&&(g=0,xe(7,r|0,7,t|0),d=g,g=0,!(d&1))){g=0,xe(6,r|0,824,96),g=0,l=3;break e}t=j()|0,Tt(r|0);break e}default:{if(r=Ct(16)|0,g=0,t=Ce(1)|0,d=g,g=0,!(d&1)&&(g=0,xe(7,r|0,5,t|0),d=g,g=0,!(d&1))){g=0,xe(6,r|0,824,96),g=0,l=3;break e}t=j()|0,Tt(r|0);break e}}}while(!1);return r?((e[h>>2]|0)!=(r|0)&&(e[h>>2]=r),he(r),b=o,t|0):(b=o,t|0)}while(!1);return(l|0)==3&&(t=j()|0),r=e[c>>2]|0,r||le(t|0),(e[h>>2]|0)!=(r|0)&&(e[h>>2]=r),he(r),le(t|0),0}function w6(t){t=t|0;var r=0,o=0,l=0;l=e[(e[t>>2]|0)+-12>>2]|0,e[t+l>>2]=36200,r=t+(l+56)|0,e[r>>2]=36220,o=t+(l+4)|0,e[o>>2]=36236,de(t+(l+36)|0),wt(o),tt(r)}function y6(t){t=t|0}function C6(t){t=t|0,he(t)}function T6(t){t=t|0,S[t>>0]=0,t=t+4|0,e[t>>2]=0,e[t+4>>2]=0,e[t+8>>2]=0,e[t+12>>2]=0,e[t+16>>2]=0,e[t+20>>2]=0,e[t+24>>2]=0,e[t+28>>2]=0}function I6(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0;if(c=b,b=b+16|0,h=c,r=a6(r)|0,e[h>>2]=r,o=t+28|0,l=e[o>>2]|0,l>>>0<(e[t+32>>2]|0)>>>0){e[l>>2]=r,e[o>>2]=l+4,e[h>>2]=0,b=c;return}if(g=0,Ae(57,t+24|0,h|0),t=g,g=0,t&1)r=j()|0,o=e[h>>2]|0,e[h>>2]=0,o||le(r|0),Mt[e[(e[o>>2]|0)+4>>2]&255](o),le(r|0);else{if(r=e[h>>2]|0,e[h>>2]=0,!r){b=c;return}Mt[e[(e[r>>2]|0)+4>>2]&255](r),b=c;return}}function E6(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0;if(l=t+4|0,e[l>>2]=e[r>>2],e[l+4>>2]=e[r+4>>2],e[l+8>>2]=e[r+8>>2],ui(t,-1),ui(t,-40),l=t+28|0,c=t+24|0,r=e[c>>2]|0,(e[l>>2]|0)==(r|0))return ui(t,-1),ui(t,-39),t=t+16|0,t=e[t>>2]|0,t|0;o=0;do h=e[r+(o<<2)>>2]|0,t0[e[(e[h>>2]|0)+8>>2]&127](h,t),o=o+1|0,r=e[c>>2]|0;while(o>>>0<(e[l>>2]|0)-r>>2>>>0);return ui(t,-1),ui(t,-39),h=t+16|0,h=e[h>>2]|0,h|0}function k6(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0;N=b,b=b+48|0,w=N+32|0,c=N+12|0,C=N+8|0,k=N+4|0,R=N,l=o+36|0;do if(!(e[l>>2]|0)&&!(e[o+40>>2]|0)&&!(e[o+44>>2]|0)&&!(e[o+48>>2]|0)&&!(e[o+52>>2]|0)){if(l=e[o+8>>2]|0,(l|0)<=12){h=t+28|0,d=t+32|0;break}if(m0(c,(1<>2]|0),l=co(c)|0,e[C>>2]=l,h=t+28|0,c=e[h>>2]|0,d=t+32|0,c>>>0<(e[d>>2]|0)>>>0){e[c>>2]=l,e[h>>2]=c+4,e[C>>2]=0;break}if(g=0,Ae(57,t+24|0,C|0),w=g,g=0,!(w&1)){if(l=e[C>>2]|0,e[C>>2]=0,!l)break;Mt[e[(e[l>>2]|0)+4>>2]&255](l);break}o=j()|0,l=e[C>>2]|0,e[C>>2]=0,l||(R=o,le(R|0)),Mt[e[(e[l>>2]|0)+4>>2]&255](l),R=o,le(R|0)}else D=6;while(!1);do if((D|0)==6){if(l=co(l)|0,e[w>>2]=l,h=t+28|0,c=e[h>>2]|0,d=t+32|0,c>>>0<(e[d>>2]|0)>>>0){e[c>>2]=l,e[h>>2]=c+4,e[w>>2]=0;break}if(g=0,Ae(57,t+24|0,w|0),D=g,g=0,!(D&1)){if(l=e[w>>2]|0,e[w>>2]=0,!l)break;Mt[e[(e[l>>2]|0)+4>>2]&255](l);break}o=j()|0,l=e[w>>2]|0,e[w>>2]=0,l||(R=o,le(R|0)),Mt[e[(e[l>>2]|0)+4>>2]&255](l),R=o,le(R|0)}while(!1);l=t+20|0,c=(e[l>>2]|0)+1|0,e[l>>2]=c,l=e[o+24>>2]|0,w=l|0?e[o+16>>2]|0:1,l=l6(c,w,e[o+20>>2]|0,l)|0,e[k>>2]=l,c=e[h>>2]|0;do if(c>>>0<(e[d>>2]|0)>>>0)e[c>>2]=l,e[h>>2]=c+4,e[k>>2]=0;else{if(g=0,Ae(57,t+24|0,k|0),D=g,g=0,!(D&1)){if(l=e[k>>2]|0,e[k>>2]=0,!l)break;Mt[e[(e[l>>2]|0)+4>>2]&255](l);break}o=j()|0,l=e[k>>2]|0,e[k>>2]=0,l||(R=o,le(R|0)),Mt[e[(e[l>>2]|0)+4>>2]&255](l),R=o,le(R|0)}while(!1);C=Xe(104)|0,e[C>>2]=36820,e[C+4>>2]=w,c=C+8|0,e[c>>2]=e[r>>2],e[c+4>>2]=e[r+4>>2],e[c+8>>2]=e[r+8>>2],c=C+20|0,l=c+84|0;do e[c>>2]=e[o>>2],c=c+4|0,o=o+4|0;while((c|0)<(l|0));if(e[R>>2]=C,o=e[h>>2]|0,o>>>0<(e[d>>2]|0)>>>0){e[o>>2]=C,e[h>>2]=o+4,e[R>>2]=0,b=N;return}if(g=0,Ae(57,t+24|0,R|0),t=g,g=0,t&1)o=j()|0,l=e[R>>2]|0,e[R>>2]=0,l||(R=o,le(R|0)),Mt[e[(e[l>>2]|0)+4>>2]&255](l),R=o,le(R|0);else{if(o=e[R>>2]|0,e[R>>2]=0,!o){b=N;return}Mt[e[(e[o>>2]|0)+4>>2]&255](o),b=N;return}}function D6(t,r,o,l,c,h,d,w,C,D,k){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0,w=w|0,C=C|0,D=D|0,k=k|0;var N=0,R=0,_=0,U=0,Q=0,K=0,G=0;return _=b,b=b+96|0,R=_,N=ma(t,r,R,0)|0,N?(c=N,b=_,c|0):(S[R+32>>0]=0,Q=e[R+8>>2]|0,G=e[R>>2]|0,K=e[R+4>>2]|0,N=ee(K,G)|0,U=e[R+16>>2]|0,N=ee(ee(N,(Q|0)<9?1:2)|0,U)|0,e[l>>2]=N,N=E0(N)|0,e[o>>2]=N,e[c>>2]=G,e[h>>2]=K,e[d>>2]=Q,e[w>>2]=e[R+12>>2],e[C>>2]=U,e[D>>2]=e[R+20>>2],e[k>>2]=e[R+24>>2],c=ga(N,e[l>>2]|0,t,r,0,0)|0,b=_,c|0)}function b6(t,r,o,l,c,h,d,w,C){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0,w=w|0,C=C|0;var D=0,k=0,N=0,R=0;N=b,b=b+96|0,D=N+4|0,d=N,k=D,R=k+84|0;do e[k>>2]=0,k=k+4|0;while((k|0)<(R|0));return e[D+16>>2]=h,e[D+8>>2]=c,e[D>>2]=o,e[D+4>>2]=l,o=E0(r)|0,e[w>>2]=o,e[d>>2]=0,o=pa(w,r,d,t,r,D,0)|0,e[C>>2]=e[d>>2],b=N,o|0}function Fi(t,r){t=t|0,r=r|0;var o=0;o=b,b=b+16|0,e[o>>2]=r,r=e[9320]|0,Po(r,t,o)|0,PS(10,r)|0,St()}function si(t){t=t|0,Lr(51337,51366,1164,51442)}function pi(t){t=t|0,Lr(51463,51486,303,51442)}function po(){var t=0,r=0;if(t=b,b=b+16|0,Qo(37024,4)|0)Fi(51562,t);else return r=Ho(e[9255]|0)|0,b=t,r|0;return 0}function Xe(t){t=t|0;var r=0;r=t|0?t:1,t=E0(r)|0;e:do if(!t){for(;t=L6()|0,!!t;)if(Vo[t&7](),t=E0(r)|0,t)break e;r=Ct(4)|0,e[r>>2]=36844,Qt(r|0,592,78)}while(!1);return t|0}function he(t){t=t|0,n0(t)}function N6(t){t=t|0,he(t)}function F6(t){t=t|0,e[t>>2]=36844}function R6(t){t=t|0}function M6(t){t=t|0,he(t)}function _6(t){return t=t|0,51611}function mo(t){t=t|0;var r=0;r=b,b=b+16|0,g=0,Nt(t|0),t=g,g=0,t&1||(g=0,Ae(85,51626,r|0),g=0),t=j(0)|0,K0(t|0)|0,g=0,Ae(85,51666,r+8|0),g=0,t=j(0)|0,g=0,Nt(3),r=g,g=0,r&1?(r=j(0)|0,$t(r)):$t(t)}function P6(){var t=0,r=0,o=0;g=0,t=Ce(2)|0,o=g,g=0,o&1&&(o=j(0)|0,$t(o)),t|0&&(r=e[t>>2]|0,(r|0)!=0)&&(o=r+48|0,(e[o>>2]&-256|0)==1126902528?(e[o+4>>2]|0)==1129074247:0)&&mo(e[r+12>>2]|0),o=e[9208]|0,e[9208]=o+0,mo(o)}function L6(){var t=0;return t=e[9214]|0,e[9214]=t+0,t|0}function wA(t){t=t|0}function In(t){t=t|0,e[t>>2]=36868,uS(t+4|0)}function O6(t){t=t|0,In(t),he(t)}function $6(t){return t=t|0,e[t+4>>2]|0}function yA(t){t=t|0}function B6(t){t=t|0,e[t>>2]=36888}function V6(t){t=t|0}function U6(t){t=t|0,he(t)}function z6(t){return t=t|0,51716}function G6(t){t=t|0}function q6(t){t=t|0}function W6(t){t=t|0}function H6(t){t=t|0,he(t)}function Q6(t){t=t|0,he(t)}function K6(t){t=t|0,he(t)}function Y6(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0;if(d=b,b=b+64|0,h=d,(t|0)!=(r|0))if(r|0&&(c=So(r,656,672,0)|0,(c|0)!=0)){r=h,l=r+56|0;do e[r>>2]=0,r=r+4|0;while((r|0)<(l|0));e[h>>2]=c,e[h+8>>2]=t,e[h+12>>2]=-1,e[h+48>>2]=1,On[e[(e[c>>2]|0)+28>>2]&63](c,h,e[o>>2]|0,1),(e[h+24>>2]|0)==1?(e[o>>2]=e[h+16>>2],r=1):r=0}else r=0;else r=1;return b=d,r|0}function Er(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0;t=r+16|0,c=e[t>>2]|0;do if(c){if((c|0)!=(o|0)){l=r+36|0,e[l>>2]=(e[l>>2]|0)+1,e[r+24>>2]=2,S[r+54>>0]=1;break}t=r+24|0,(e[t>>2]|0)==2&&(e[t>>2]=l)}else e[t>>2]=o,e[r+24>>2]=l,e[r+36>>2]=1;while(!1)}function j6(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0,(t|0)==(e[r+8>>2]|0)&&Er(0,r,o,l)}function X6(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0,(t|0)==(e[r+8>>2]|0)?Er(0,r,o,l):(t=e[t+8>>2]|0,On[e[(e[t>>2]|0)+28>>2]&63](t,r,o,l))}function go(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0;h=e[t+4>>2]|0,c=h>>8,h&1&&(c=e[(e[o>>2]|0)+c>>2]|0),t=e[t>>2]|0,On[e[(e[t>>2]|0)+28>>2]&63](t,r,o+c|0,h&2|0?l:2)}function Z6(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0;e:do if((t|0)!=(e[r+8>>2]|0)){if(h=e[t+12>>2]|0,c=t+16+(h<<3)|0,go(t+16|0,r,o,l),(h|0)>1){h=r+54|0,t=t+24|0;do{if(go(t,r,o,l),S[h>>0]|0)break e;t=t+8|0}while(t>>>0>>0)}}else Er(0,r,o,l);while(!1)}function So(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0;_=b,b=b+64|0,R=_,N=e[t>>2]|0,k=t+(e[N+-8>>2]|0)|0,N=e[N+-4>>2]|0,e[R>>2]=o,e[R+4>>2]=t,e[R+8>>2]=r,e[R+12>>2]=l,l=R+16|0,t=R+20|0,r=R+24|0,c=R+28|0,h=R+32|0,d=R+40|0,w=(N|0)==(o|0),C=l,D=C+36|0;do e[C>>2]=0,C=C+4|0;while((C|0)<(D|0));I[l+36>>1]=0,S[l+38>>0]=0;e:do if(w)e[R+48>>2]=1,Vi[e[(e[o>>2]|0)+20>>2]&15](o,R,k,k,1,0),l=(e[r>>2]|0)==1?k:0;else{switch(Pn[e[(e[N>>2]|0)+24>>2]&15](N,R,k,1,0),e[R+36>>2]|0){case 0:{l=(e[d>>2]|0)==1&(e[c>>2]|0)==1&(e[h>>2]|0)==1?e[t>>2]|0:0;break e}case 1:break;default:{l=0;break e}}if((e[r>>2]|0)!=1&&!((e[d>>2]|0)==0&(e[c>>2]|0)==1&(e[h>>2]|0)==1)){l=0;break}l=e[l>>2]|0}while(!1);return b=_,l|0}function kr(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,S[r+53>>0]=1;do if((e[r+4>>2]|0)==(l|0)){if(S[r+52>>0]=1,l=r+16|0,t=e[l>>2]|0,!t){if(e[l>>2]=o,e[r+24>>2]=c,e[r+36>>2]=1,!((c|0)==1&&(e[r+48>>2]|0)==1))break;S[r+54>>0]=1;break}if((t|0)!=(o|0)){c=r+36|0,e[c>>2]=(e[c>>2]|0)+1,S[r+54>>0]=1;break}t=r+24|0,l=e[t>>2]|0,(l|0)==2&&(e[t>>2]=c,l=c),(l|0)==1&&(e[r+48>>2]|0)==1&&(S[r+54>>0]=1)}while(!1)}function J6(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0;e:do if((t|0)==(e[r+8>>2]|0))(e[r+4>>2]|0)==(o|0)&&(h=r+28|0,(e[h>>2]|0)!=1)&&(e[h>>2]=l);else{if((t|0)!=(e[r>>2]|0)){if(U=e[t+12>>2]|0,w=t+16+(U<<3)|0,En(t+16|0,r,o,l,c),h=t+24|0,(U|0)<=1)break;if(d=e[t+8>>2]|0,!(d&2|0)&&(C=r+36|0,(e[C>>2]|0)!=1)){if(!(d&1)){for(d=r+54|0;;)if(S[d>>0]|0||(e[C>>2]|0)==1||(En(h,r,o,l,c),h=h+8|0,h>>>0>=w>>>0))break e}for(d=r+24|0,t=r+54|0;;)if(S[t>>0]|0||(e[C>>2]|0)==1&&(e[d>>2]|0)==1||(En(h,r,o,l,c),h=h+8|0,h>>>0>=w>>>0))break e}for(d=r+54|0;;)if(S[d>>0]|0||(En(h,r,o,l,c),h=h+8|0,h>>>0>=w>>>0))break e}if((e[r+16>>2]|0)!=(o|0)&&(_=r+20|0,(e[_>>2]|0)!=(o|0))){if(e[r+32>>2]=l,k=r+44|0,(e[k>>2]|0)==4)break;d=e[t+12>>2]|0,w=t+16+(d<<3)|0,C=r+52|0,l=r+53|0,N=r+54|0,D=t+8|0,R=r+24|0;t:do if((d|0)>0)for(d=0,h=0,t=t+16|0;;){if(S[C>>0]=0,S[l>>0]=0,Dr(t,r,o,o,1,c),S[N>>0]|0){U=20;break t}do if(S[l>>0]|0){if(!(S[C>>0]|0))if(e[D>>2]&1){h=1;break}else{h=1,U=20;break t}if((e[R>>2]|0)==1)break t;if(e[D>>2]&2)d=1,h=1;else break t}while(!1);if(t=t+8|0,t>>>0>=w>>>0){U=20;break}}else d=0,h=0,U=20;while(!1);do if((U|0)==20){if(!d&&(e[_>>2]=o,o=r+40|0,e[o>>2]=(e[o>>2]|0)+1,(e[r+36>>2]|0)==1)&&(e[R>>2]|0)==2){if(S[N>>0]=1,h)break}else U=24;if((U|0)==24&&h)break;e[k>>2]=4;break e}while(!1);e[k>>2]=3;break}(l|0)==1&&(e[r+32>>2]=1)}while(!1)}function Dr(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0;w=e[t+4>>2]|0,d=w>>8,w&1&&(d=e[(e[l>>2]|0)+d>>2]|0),t=e[t>>2]|0,Vi[e[(e[t>>2]|0)+20>>2]&15](t,r,o,l+d|0,w&2|0?c:2,h)}function En(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0;d=e[t+4>>2]|0,h=d>>8,d&1&&(h=e[(e[o>>2]|0)+h>>2]|0),t=e[t>>2]|0,Pn[e[(e[t>>2]|0)+24>>2]&15](t,r,o+h|0,d&2|0?l:2,c)}function eS(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0;e:do if((t|0)==(e[r+8>>2]|0))(e[r+4>>2]|0)==(o|0)&&(h=r+28|0,(e[h>>2]|0)!=1)&&(e[h>>2]=l);else{if((t|0)!=(e[r>>2]|0)){w=e[t+8>>2]|0,Pn[e[(e[w>>2]|0)+24>>2]&15](w,r,o,l,c);break}if((e[r+16>>2]|0)!=(o|0)&&(d=r+20|0,(e[d>>2]|0)!=(o|0))){if(e[r+32>>2]=l,l=r+44|0,(e[l>>2]|0)==4)break;h=r+52|0,S[h>>0]=0,C=r+53|0,S[C>>0]=0,t=e[t+8>>2]|0,Vi[e[(e[t>>2]|0)+20>>2]&15](t,r,o,o,1,c),S[C>>0]|0?S[h>>0]|0||(h=1,w=13):(h=0,w=13);do if((w|0)==13){if(e[d>>2]=o,C=r+40|0,e[C>>2]=(e[C>>2]|0)+1,(e[r+36>>2]|0)==1&&(e[r+24>>2]|0)==2){if(S[r+54>>0]=1,h)break}else w=16;if((w|0)==16&&h)break;e[l>>2]=4;break e}while(!1);e[l>>2]=3;break}(l|0)==1&&(e[r+32>>2]=1)}while(!1)}function tS(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0;do if((t|0)==(e[r+8>>2]|0))(e[r+4>>2]|0)==(o|0)&&(d=r+28|0,(e[d>>2]|0)!=1)&&(e[d>>2]=l);else if((t|0)==(e[r>>2]|0)){if((e[r+16>>2]|0)!=(o|0)&&(h=r+20|0,(e[h>>2]|0)!=(o|0))){e[r+32>>2]=l,e[h>>2]=o,c=r+40|0,e[c>>2]=(e[c>>2]|0)+1,(e[r+36>>2]|0)==1&&(e[r+24>>2]|0)==2&&(S[r+54>>0]=1),e[r+44>>2]=4;break}(l|0)==1&&(e[r+32>>2]=1)}while(!1)}function iS(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0;if((t|0)==(e[r+8>>2]|0))kr(0,r,o,l,c);else{k=r+52|0,N=S[k>>0]|0,R=r+53|0,_=S[R>>0]|0,D=e[t+12>>2]|0,d=t+16+(D<<3)|0,S[k>>0]=0,S[R>>0]=0,Dr(t+16|0,r,o,l,c,h);e:do if((D|0)>1){w=r+24|0,C=t+8|0,D=r+54|0,t=t+24|0;do{if(S[D>>0]|0)break e;if(S[k>>0]|0){if((e[w>>2]|0)==1||!(e[C>>2]&2))break e}else if(S[R>>0]|0&&!(e[C>>2]&1|0))break e;S[k>>0]=0,S[R>>0]=0,Dr(t,r,o,l,c,h),t=t+8|0}while(t>>>0>>0)}while(!1);S[k>>0]=N,S[R>>0]=_}}function nS(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,(t|0)==(e[r+8>>2]|0)?kr(0,r,o,l,c):(t=e[t+8>>2]|0,Vi[e[(e[t>>2]|0)+20>>2]&15](t,r,o,l,c,h))}function rS(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,(t|0)==(e[r+8>>2]|0)&&kr(0,r,o,l,c)}function sS(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0;return c=b,b=b+16|0,l=c,e[l>>2]=e[o>>2],t=Yt[e[(e[t>>2]|0)+16>>2]&63](t,r,l)|0,t&&(e[o>>2]=e[l>>2]),b=c,t&1|0}function oS(t){return t=t|0,t?t=(So(t,656,704,0)|0)!=0:t=0,t&1|0}function kn(){var t=0;t=Ct(4)|0,F6(t),Qt(t|0,592,78)}function aS(){var t=0,r=0,o=0,l=0,c=0,h=0,d=0,w=0;c=b,b=b+48|0,d=c+32|0,o=c+24|0,w=c+16|0,h=c,c=c+36|0,t=po()|0,t|0&&(l=e[t>>2]|0,(l|0)!=0)&&(t=l+48|0,r=e[t>>2]|0,t=e[t+4>>2]|0,(r&-256|0)==1126902528&(t|0)==1129074247||(e[o>>2]=e[9257],Fi(51919,o)),(r|0)==1126902529&(t|0)==1129074247?t=e[l+44>>2]|0:t=l+80|0,e[c>>2]=t,l=e[l>>2]|0,t=e[l+4>>2]|0,Yt[e[(e[152]|0)+16>>2]&63](608,l,c)|0?(w=e[c>>2]|0,c=e[9257]|0,w=Dt[e[(e[w>>2]|0)+8>>2]&127](w)|0,e[h>>2]=c,e[h+4>>2]=t,e[h+8>>2]=w,Fi(51833,h)):(e[w>>2]=e[9257],e[w+4>>2]=t,Fi(51878,w))),Fi(51957,d)}function lS(){var t=0;if(t=b,b=b+16|0,ni(37020,184)|0)Fi(51730,t);else{b=t;return}}function uS(t){t=t|0;var r=0,o=0;o=(e[t>>2]|0)+-4|0,r=e[o>>2]|0,e[o>>2]=r+-1,(r+-1|0)<0&&he((e[t>>2]|0)+-12|0)}function cS(t){t=t|0;var r=0;if(r=b,b=b+16|0,n0(t),Xo(e[9255]|0,0)|0)Fi(51780,r);else{b=r;return}}function Dn(t,r,o,l){return t=t|0,r=r|0,o=o|0,l=l|0,t=$S(t,r,o)|0,t|0}function Ao(t,r,o,l){return t=t|0,r=r|0,o=o|0,l=l|0,t=BS(t,r,o)|0,t|0}function fS(){return 37296}function hS(){return 37300}function dS(){return 37304}function ji(t){return t=t|0,((t|0)==32|(t+-9|0)>>>0<5)&1|0}function pS(t){return t=t|0,(t+-48|0)>>>0<10?t=1:t=((t|32)+-97|0)>>>0<6,t&1|0}function S0(){var t=0;return e[9258]|0?(t=($r()|0)+60|0,t=e[t>>2]|0):t=37308,t|0}function vo(t){t=t|0;var r=0,o=0;for(r=0;;){if((F[51978+r>>0]|0)==(t|0)){o=2;break}if(r=r+1|0,(r|0)==87){r=87,t=52066,o=5;break}}if((o|0)==2&&(r?(t=52066,o=5):t=52066),(o|0)==5)for(;;){for(o=t;t=o+1|0,S[o>>0]|0;)o=t;if(r=r+-1|0,r)o=5;else break}return t|0}function xo(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0,ce=0,ke=0,Ee=0,Te=0,it=0,jt=0,Gt=0;switch(jt=b,b=b+512|0,ke=jt,r|0){case 0:{it=24,Te=-149,O=4;break}case 1:{it=53,Te=-1074,O=4;break}case 2:{it=53,Te=-1074,O=4;break}default:l=0}e:do if((O|0)==4){oe=t+4|0,ie=t+100|0;do r=e[oe>>2]|0,r>>>0<(e[ie>>2]|0)>>>0?(e[oe>>2]=r+1,r=F[r>>0]|0):r=u0(t)|0;while(ji(r)|0);t:do switch(r|0){case 43:case 45:if(c=1-(((r|0)==45&1)<<1)|0,r=e[oe>>2]|0,r>>>0<(e[ie>>2]|0)>>>0){e[oe>>2]=r+1,r=F[r>>0]|0,Ee=c;break t}else{r=u0(t)|0,Ee=c;break t}default:Ee=1}while(!1);c=r,r=0;do{if((c|32|0)!=(S[53870+r>>0]|0))break;do if(r>>>0<7)if(c=e[oe>>2]|0,c>>>0<(e[ie>>2]|0)>>>0){e[oe>>2]=c+1,c=F[c>>0]|0;break}else{c=u0(t)|0;break}while(!1);r=r+1|0}while(r>>>0<8);t:do switch(r|0){case 8:break;case 3:{O=23;break}default:{if(d=(o|0)!=0,d&r>>>0>3){if((r|0)==8)break t;O=23;break t}i:do if(!r){r=0;do{if((c|32|0)!=(S[56747+r>>0]|0))break i;do if(r>>>0<2)if(c=e[oe>>2]|0,c>>>0<(e[ie>>2]|0)>>>0){e[oe>>2]=c+1,c=F[c>>0]|0;break}else{c=u0(t)|0;break}while(!1);r=r+1|0}while(r>>>0<3)}while(!1);switch(r|0){case 3:{if(r=e[oe>>2]|0,r>>>0<(e[ie>>2]|0)>>>0?(e[oe>>2]=r+1,r=F[r>>0]|0):r=u0(t)|0,(r|0)==40)r=1;else{if(!(e[ie>>2]|0)){l=fe;break e}e[oe>>2]=(e[oe>>2]|0)+-1,l=fe;break e}for(;c=e[oe>>2]|0,c>>>0<(e[ie>>2]|0)>>>0?(e[oe>>2]=c+1,c=F[c>>0]|0):c=u0(t)|0,!(!((c+-48|0)>>>0<10|(c+-65|0)>>>0<26)&&!((c|0)==95|(c+-97|0)>>>0<26));)r=r+1|0;if((c|0)==41){l=fe;break e}if(c=(e[ie>>2]|0)==0,c||(e[oe>>2]=(e[oe>>2]|0)+-1),!d){it=S0()|0,e[it>>2]=22,oi(t,0),l=0;break e}if(!r){l=fe;break e}for(;;)if(r=r+-1|0,c||(e[oe>>2]=(e[oe>>2]|0)+-1),!r){l=fe;break e}}case 0:{do if((c|0)==48){if(r=e[oe>>2]|0,r>>>0<(e[ie>>2]|0)>>>0?(e[oe>>2]=r+1,r=F[r>>0]|0):r=u0(t)|0,(r|32|0)!=120){if(!(e[ie>>2]|0)){r=48;break}e[oe>>2]=(e[oe>>2]|0)+-1,r=48;break}r=e[oe>>2]|0,r>>>0<(e[ie>>2]|0)>>>0?(e[oe>>2]=r+1,r=F[r>>0]|0,d=0):(r=u0(t)|0,d=0);i:for(;;){switch(r|0){case 46:{O=74;break i}case 48:break;default:{$=0,w=0,G=0,c=0,D=d,k=0,K=0,C=1,d=0,l=0;break i}}if(r=e[oe>>2]|0,r>>>0<(e[ie>>2]|0)>>>0){e[oe>>2]=r+1,r=F[r>>0]|0,d=1;continue}else{r=u0(t)|0,d=1;continue}}if((O|0)==74)if(r=e[oe>>2]|0,r>>>0<(e[ie>>2]|0)>>>0?(e[oe>>2]=r+1,r=F[r>>0]|0):r=u0(t)|0,(r|0)==48){d=0,c=0;do r=e[oe>>2]|0,r>>>0<(e[ie>>2]|0)>>>0?(e[oe>>2]=r+1,r=F[r>>0]|0):r=u0(t)|0,d=$0(d|0,c|0,-1,-1)|0,c=ye;while((r|0)==48);$=0,w=0,G=d,D=1,k=1,K=0,C=1,d=0,l=0}else $=0,w=0,G=0,c=0,D=d,k=1,K=0,C=1,d=0,l=0;for(;;){if(U=r+-48|0,N=r|32,U>>>0>=10){if(Q=(r|0)==46,!(Q|(N+-97|0)>>>0<6)){N=G,U=$;break}if(Q)if(!k)Q=w,c=$,U=$,k=1,N=K,h=C;else{N=G,U=$,r=46;break}else O=86}else O=86;if((O|0)==86){O=0,r=(r|0)>57?N+-87|0:U;do if(($|0)<0|($|0)==0&w>>>0<8)N=K,h=C,d=r+(d<<4)|0;else{if(($|0)<0|($|0)==0&w>>>0<14){_=C*.0625,N=K,h=_,l=l+_*+(r|0);break}(K|0)!=0|(r|0)==0?(N=K,h=C):(N=1,h=C,l=l+C*.5)}while(!1);w=$0(w|0,$|0,1,0)|0,Q=G,U=ye,D=1}if(r=e[oe>>2]|0,r>>>0<(e[ie>>2]|0)>>>0){e[oe>>2]=r+1,$=U,G=Q,r=F[r>>0]|0,K=N,C=h;continue}else{$=U,G=Q,r=u0(t)|0,K=N,C=h;continue}}if(!D){r=(e[ie>>2]|0)==0,r||(e[oe>>2]=(e[oe>>2]|0)+-1),o?!r&&(P=e[oe>>2]|0,e[oe>>2]=P+-1,(k|0)!=0)&&(e[oe>>2]=P+-2):oi(t,0),l=+(Ee|0)*0;break e}if(D=(k|0)==0,k=D?w:N,D=D?U:c,(U|0)<0|(U|0)==0&w>>>0<8){c=U;do d=d<<4,w=$0(w|0,c|0,1,0)|0,c=ye;while((c|0)<0|(c|0)==0&w>>>0<8)}if((r|32|0)==112){if(c=Bo(t,o)|0,r=ye,(c|0)==0&(r|0)==-2147483648){if(!o){oi(t,0),l=0;break e}e[ie>>2]|0?(e[oe>>2]=(e[oe>>2]|0)+-1,c=0,r=0):(c=0,r=0)}}else e[ie>>2]|0?(e[oe>>2]=(e[oe>>2]|0)+-1,c=0,r=0):(c=0,r=0);if(ke=v0(k|0,D|0,2)|0,ke=$0(ke|0,ye|0,-32,-1)|0,r=$0(ke|0,ye|0,c|0,r|0)|0,c=ye,!d){l=+(Ee|0)*0;break e}if((c|0)>0|(c|0)==0&r>>>0>(0-Te|0)>>>0){it=S0()|0,e[it>>2]=34,l=+(Ee|0)*17976931348623157e292*17976931348623157e292;break e}if(ke=Te+-106|0,ce=((ke|0)<0)<<31>>31,(c|0)<(ce|0)|(c|0)==(ce|0)&r>>>0>>0){it=S0()|0,e[it>>2]=34,l=+(Ee|0)*22250738585072014e-324*22250738585072014e-324;break e}if((d|0)>-1){do ce=!(l>=.5),ke=ce&1|d<<1,d=ke^1,l=l+(ce?l:l+-1),r=$0(r|0,c|0,-1,-1)|0,c=ye;while((ke|0)>-1);w=r,C=l}else w=r,C=l;r=ii(32,0,Te|0,((Te|0)<0)<<31>>31|0)|0,r=$0(w|0,c|0,r|0,ye|0)|0,Te=ye,0>(Te|0)|(Te|0)==0&it>>>0>r>>>0?(r|0)<0?(r=0,O=127):O=125:(r=it,O=125),(O|0)==125&&((r|0)<53?O=127:(c=r,h=+(Ee|0),l=0)),(O|0)==127&&(l=+(Ee|0),c=r,h=l,l=+Co(+bn(1,84-r|0),l)),it=(d&1|0)==0&(C!=0&(c|0)<32),l=h*(it?0:C)+(l+h*+(((it&1)+d|0)>>>0))-l,l==0&&(it=S0()|0,e[it>>2]=34),l=+Eo(l,w);break e}else r=c;while(!1);ne=Te+it|0,ce=0-ne|0,d=0;i:for(;;){switch(r|0){case 46:{O=138;break i}case 48:break;default:{c=0,N=0,k=0;break i}}if(r=e[oe>>2]|0,r>>>0<(e[ie>>2]|0)>>>0){e[oe>>2]=r+1,r=F[r>>0]|0,d=1;continue}else{r=u0(t)|0,d=1;continue}}if((O|0)==138)if(r=e[oe>>2]|0,r>>>0<(e[ie>>2]|0)>>>0?(e[oe>>2]=r+1,r=F[r>>0]|0):r=u0(t)|0,(r|0)==48)for(c=0,r=0;;)if(c=$0(c|0,r|0,-1,-1)|0,d=ye,r=e[oe>>2]|0,r>>>0<(e[ie>>2]|0)>>>0?(e[oe>>2]=r+1,r=F[r>>0]|0):r=u0(t)|0,(r|0)==48)r=d;else{N=d,d=1,k=1;break}else c=0,N=0,k=1;e[ke>>2]=0,D=r+-48|0,w=(r|0)==46;i:do if(w|D>>>0<10){Z=ke+496|0,$=0,Q=0,K=w,O=N,U=d,P=k,d=0,w=0,k=0;n:for(;;){do if(K)if(!P)c=$,N=Q,P=1;else{N=O,r=$,D=Q;break n}else{if(K=$0($|0,Q|0,1,0)|0,Q=ye,G=(r|0)!=48,(w|0)>=125){if(!G){N=O,$=K;break}e[Z>>2]=e[Z>>2]|1,N=O,$=K;break}N=ke+(w<<2)|0,d&&(D=r+-48+((e[N>>2]|0)*10|0)|0),e[N>>2]=D,d=d+1|0,D=(d|0)==9,N=O,$=K,U=1,d=D?0:d,w=(D&1)+w|0,k=G?K:k}while(!1);if(r=e[oe>>2]|0,r>>>0<(e[ie>>2]|0)>>>0?(e[oe>>2]=r+1,r=F[r>>0]|0):r=u0(t)|0,D=r+-48|0,K=(r|0)==46,K|D>>>0<10)O=N;else{D=P,O=161;break i}}U=(U|0)!=0,O=169}else $=0,Q=0,U=d,D=k,d=0,w=0,k=0,O=161;while(!1);do if((O|0)==161){if(Z=(D|0)==0,c=Z?$:c,N=Z?Q:N,U=(U|0)!=0,!((r|32|0)==101&U))if((r|0)>-1){r=$,D=Q,O=169;break}else{r=$,D=Q,O=171;break}if(D=Bo(t,o)|0,r=ye,(D|0)==0&(r|0)==-2147483648){if(!o){oi(t,0),l=0;break}e[ie>>2]|0?(e[oe>>2]=(e[oe>>2]|0)+-1,D=0,r=0):(D=0,r=0)}c=$0(D|0,r|0,c|0,N|0)|0,U=$,N=ye,D=Q,O=173}while(!1);(O|0)==169&&(e[ie>>2]|0?(e[oe>>2]=(e[oe>>2]|0)+-1,U?(U=r,O=173):O=172):O=171),(O|0)==171&&(U?(U=r,O=173):O=172);do if((O|0)==172)it=S0()|0,e[it>>2]=22,oi(t,0),l=0;else if((O|0)==173){if(r=e[ke>>2]|0,!r){l=+(Ee|0)*0;break}if(((D|0)<0|(D|0)==0&U>>>0<10)&((c|0)==(U|0)&(N|0)==(D|0))&&it>>>0>30|(r>>>it|0)==0){l=+(Ee|0)*+(r>>>0);break}if(t=(Te|0)/-2|0,oe=((t|0)<0)<<31>>31,(N|0)>(oe|0)|(N|0)==(oe|0)&c>>>0>t>>>0){it=S0()|0,e[it>>2]=34,l=+(Ee|0)*17976931348623157e292*17976931348623157e292;break}if(t=Te+-106|0,oe=((t|0)<0)<<31>>31,(N|0)<(oe|0)|(N|0)==(oe|0)&c>>>0>>0){it=S0()|0,e[it>>2]=34,l=+(Ee|0)*22250738585072014e-324*22250738585072014e-324;break}if(d){if((d|0)<9){D=ke+(w<<2)|0,r=e[D>>2]|0;do r=r*10|0,d=d+1|0;while((d|0)!=9);e[D>>2]=r}w=w+1|0}if((k|0)<9&&(k|0)<=(c|0)&(c|0)<18){if((c|0)==9){l=+(Ee|0)*+((e[ke>>2]|0)>>>0);break}if((c|0)<9){l=+(Ee|0)*+((e[ke>>2]|0)>>>0)/+(e[37312+(8-c<<2)>>2]|0);break}if(t=it+27+(ee(c,-3)|0)|0,r=e[ke>>2]|0,(t|0)>30|(r>>>t|0)==0){l=+(Ee|0)*+(r>>>0)*+(e[37312+(c+-10<<2)>>2]|0);break}}if(r=(c|0)%9|0,!r)d=0,r=0;else{if(U=(c|0)>-1?r:r+9|0,D=e[37312+(8-U<<2)>>2]|0,w){k=1e9/(D|0)|0,d=0,r=0,N=0;do ie=ke+(N<<2)|0,oe=e[ie>>2]|0,t=((oe>>>0)/(D>>>0)|0)+r|0,e[ie>>2]=t,r=ee((oe>>>0)%(D>>>0)|0,k)|0,t=(N|0)==(d|0)&(t|0)==0,N=N+1|0,c=t?c+-9|0:c,d=t?N&127:d;while((N|0)!=(w|0));r&&(e[ke+(w<<2)>>2]=r,w=w+1|0)}else d=0,w=0;r=0,c=9-U+c|0}i:for(;;){Q=(c|0)<18,K=(c|0)==18,G=ke+(d<<2)|0;do{if(!Q){if(!K)break i;if((e[G>>2]|0)>>>0>=9007199){c=18;break i}}for(D=0,k=w+127|0;U=k&127,N=ke+(U<<2)|0,k=v0(e[N>>2]|0,0,29)|0,k=$0(k|0,ye|0,D|0,0)|0,D=ye,D>>>0>0|(D|0)==0&k>>>0>1e9?(t=xn(k|0,D|0,1e9,0)|0,k=Cr(k|0,D|0,1e9,0)|0,D=t):D=0,e[N>>2]=k,t=(U|0)==(d|0),w=(U|0)!=(w+127&127|0)|t||k|0?w:U,!t;)k=U+-1|0;r=r+-29|0}while(!(D|0));d=d+127&127,(d|0)==(w|0)&&(t=w+127&127,w=ke+((w+126&127)<<2)|0,e[w>>2]=e[w>>2]|e[ke+(t<<2)>>2],w=t),e[ke+(d<<2)>>2]=D,c=c+9|0}i:for(;;){for($=w+1&127,G=ke+((w+127&127)<<2)|0;;){for(Q=(c|0)==18,K=(c|0)>27?9:1,U=Q^1;;){k=d&127,N=(k|0)==(w|0);do if(N)O=219;else{if(D=e[ke+(k<<2)>>2]|0,D>>>0<9007199){O=219;break}if(D>>>0>9007199)break;if(D=d+1&127,(D|0)==(w|0)){O=219;break}if(D=e[ke+(D<<2)>>2]|0,D>>>0<254740991){O=219;break}if(!(D>>>0>254740991|U)){c=k;break i}}while(!1);if((O|0)==219&&(O=0,Q)){O=220;break i}if(r=r+K|0,(d|0)==(w|0))d=w;else break}for(U=(1<>>K,k=d,D=0,N=d;oe=ke+(N<<2)|0,t=e[oe>>2]|0,d=(t>>>K)+D|0,e[oe>>2]=d,D=ee(t&U,Q)|0,d=(N|0)==(k|0)&(d|0)==0,N=N+1&127,c=d?c+-9|0:c,d=d?N:k,(N|0)!=(w|0);)k=d;if(D){if(($|0)!=(d|0))break;e[G>>2]=e[G>>2]|1}}e[ke+(w<<2)>>2]=D,w=$}(O|0)==220&&(N?(e[ke+($+-1<<2)>>2]=0,c=w,w=$):c=k),l=+((e[ke+(c<<2)>>2]|0)>>>0),c=d+1&127,(c|0)==(w|0)&&(w=d+2&127,e[ke+(w+-1<<2)>>2]=0),_=+(Ee|0),h=_*(l*1e9+ +((e[ke+(c<<2)>>2]|0)>>>0)),Q=r+53|0,N=Q-Te|0,U=(N|0)<(it|0),c=U&1,k=U?(N|0)<0?0:N:it,(k|0)<53?(Gt=+Co(+bn(1,105-k|0),h),C=+To(h,+bn(1,53-k|0)),R=Gt,l=C,C=Gt+(h-C)):(R=0,l=0,C=h),D=d+2&127;do if((D|0)==(w|0))h=l;else{D=e[ke+(D<<2)>>2]|0;do if(D>>>0>=5e8){if(D>>>0>5e8){l=_*.75+l;break}if((d+3&127|0)==(w|0)){l=_*.5+l;break}else{l=_*.75+l;break}}else{if(!(D|0)&&(d+3&127|0)==(w|0))break;l=_*.25+l}while(!1);if((53-k|0)<=1){h=l;break}if(+To(l,1)!=0){h=l;break}h=l+1}while(!1);l=C+h-R;do if((Q&2147483647|0)>(-2-ne|0)){if(+Ie(+l)>=9007199254740992&&(c=U&(k|0)==(N|0)?0:c,r=r+1|0,l=l*.5),(r+50|0)<=(ce|0)&&!(h!=0&(c|0)!=0))break;it=S0()|0,e[it>>2]=34}while(!1);l=+Eo(l,r)}while(!1);break e}default:{e[ie>>2]|0&&(e[oe>>2]=(e[oe>>2]|0)+-1),it=S0()|0,e[it>>2]=22,oi(t,0),l=0;break e}}}}while(!1);if((O|0)==23&&(c=(e[ie>>2]|0)==0,c||(e[oe>>2]=(e[oe>>2]|0)+-1),(o|0)!=0&r>>>0>3))do c||(e[oe>>2]=(e[oe>>2]|0)+-1),r=r+-1|0;while(r>>>0>3);l=+(Ee|0)*pe}while(!1);return b=jt,+l}function wo(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0;e:do if(r>>>0>36)c=S0()|0,e[c>>2]=22,c=0,l=0;else{U=t+4|0,_=t+100|0;do h=e[U>>2]|0,h>>>0<(e[_>>2]|0)>>>0?(e[U>>2]=h+1,h=F[h>>0]|0):h=u0(t)|0;while(ji(h)|0);t:do switch(h|0){case 43:case 45:if(d=((h|0)==45)<<31>>31,h=e[U>>2]|0,h>>>0<(e[_>>2]|0)>>>0){e[U>>2]=h+1,h=F[h>>0]|0,R=d;break t}else{h=u0(t)|0,R=d;break t}default:R=0}while(!1);d=(r|0)==0;do if((r&-17|0)==0&(h|0)==48){if(h=e[U>>2]|0,h>>>0<(e[_>>2]|0)>>>0?(e[U>>2]=h+1,h=F[h>>0]|0):h=u0(t)|0,(h|32|0)!=120)if(d){r=8,k=46;break}else{k=32;break}if(r=e[U>>2]|0,r>>>0<(e[_>>2]|0)>>>0?(e[U>>2]=r+1,h=F[r>>0]|0):h=u0(t)|0,(F[53879+(h+1)>>0]|0)>15){if(l=(e[_>>2]|0)==0,l||(e[U>>2]=(e[U>>2]|0)+-1),!o){oi(t,0),c=0,l=0;break e}if(l){c=0,l=0;break e}e[U>>2]=(e[U>>2]|0)+-1,c=0,l=0;break e}else r=16,k=46}else if(r=d?10:r,(F[53879+(h+1)>>0]|0)>>>0>>0)k=32;else{e[_>>2]|0&&(e[U>>2]=(e[U>>2]|0)+-1),oi(t,0),c=S0()|0,e[c>>2]=22,c=0,l=0;break e}while(!1);if((k|0)==32)if((r|0)==10){if(r=h+-48|0,r>>>0<10){for(h=0;;)if(d=(h*10|0)+r|0,r=e[U>>2]|0,r>>>0<(e[_>>2]|0)>>>0?(e[U>>2]=r+1,h=F[r>>0]|0):h=u0(t)|0,r=h+-48|0,r>>>0<10&d>>>0<429496729)h=d;else{r=d;break}d=0}else r=0,d=0;if(o=h+-48|0,o>>>0<10){for(;;){if(w=Qi(r|0,d|0,10,0)|0,C=ye,D=((o|0)<0)<<31>>31,N=~D,C>>>0>N>>>0|(C|0)==(N|0)&w>>>0>~o>>>0){w=r;break}if(r=$0(w|0,C|0,o|0,D|0)|0,d=ye,h=e[U>>2]|0,h>>>0<(e[_>>2]|0)>>>0?(e[U>>2]=h+1,h=F[h>>0]|0):h=u0(t)|0,o=h+-48|0,!(o>>>0<10&(d>>>0<429496729|(d|0)==429496729&r>>>0<2576980378))){w=r;break}}o>>>0>9?(h=w,r=R):(r=10,k=72)}else h=r,r=R}else k=46;t:do if((k|0)==46){if(!(r+-1&r)){if(k=S[54136+((r*23|0)>>>5&7)>>0]|0,d=S[53879+(h+1)>>0]|0,o=d&255,o>>>0>>0){for(h=0;w=o|h<>2]|0,h>>>0<(e[_>>2]|0)>>>0?(e[U>>2]=h+1,h=F[h>>0]|0):h=u0(t)|0,d=S[53879+(h+1)>>0]|0,o=d&255,w>>>0<134217728&o>>>0>>0;)h=w;o=0}else o=0,w=0;if(C=Di(-1,-1,k|0)|0,D=ye,(d&255)>>>0>=r>>>0|(o>>>0>D>>>0|(o|0)==(D|0)&w>>>0>C>>>0)){d=o,k=72;break}else h=o;for(;;)if(w=v0(w|0,h|0,k|0)|0,o=ye,w=d&255|w,h=e[U>>2]|0,h>>>0<(e[_>>2]|0)>>>0?(e[U>>2]=h+1,h=F[h>>0]|0):h=u0(t)|0,d=S[53879+(h+1)>>0]|0,(d&255)>>>0>=r>>>0|(o>>>0>D>>>0|(o|0)==(D|0)&w>>>0>C>>>0)){d=o,k=72;break t}else h=o}if(d=S[53879+(h+1)>>0]|0,o=d&255,o>>>0>>0){for(h=0;w=o+(ee(h,r)|0)|0,h=e[U>>2]|0,h>>>0<(e[_>>2]|0)>>>0?(e[U>>2]=h+1,h=F[h>>0]|0):h=u0(t)|0,d=S[53879+(h+1)>>0]|0,o=d&255,w>>>0<119304647&o>>>0>>0;)h=w;o=0}else w=0,o=0;if((d&255)>>>0>>0)for(k=xn(-1,-1,r|0,0)|0,N=ye,D=o;;){if(D>>>0>N>>>0|(D|0)==(N|0)&w>>>0>k>>>0){d=D,k=72;break t}if(o=Qi(w|0,D|0,r|0,0)|0,C=ye,d=d&255,C>>>0>4294967295|(C|0)==-1&o>>>0>~d>>>0){d=D,k=72;break t}if(w=$0(d|0,0,o|0,C|0)|0,o=ye,h=e[U>>2]|0,h>>>0<(e[_>>2]|0)>>>0?(e[U>>2]=h+1,h=F[h>>0]|0):h=u0(t)|0,d=S[53879+(h+1)>>0]|0,(d&255)>>>0>=r>>>0){d=o,k=72;break}else D=o}else d=o,k=72}while(!1);if((k|0)==72)if((F[53879+(h+1)>>0]|0)>>>0>>0){do h=e[U>>2]|0,h>>>0<(e[_>>2]|0)>>>0?(e[U>>2]=h+1,h=F[h>>0]|0):h=u0(t)|0;while((F[53879+(h+1)>>0]|0)>>>0>>0);d=S0()|0,e[d>>2]=34,d=c,h=l,r=(l&1|0)==0&!0?R:0}else h=w,r=R;if(e[_>>2]|0&&(e[U>>2]=(e[U>>2]|0)+-1),!(d>>>0>>0|(d|0)==(c|0)&h>>>0>>0)){if(!((l&1|0)!=0|!1|(r|0)!=0)){U=S0()|0,e[U>>2]=34,l=$0(l|0,c|0,-1,-1)|0,c=ye;break}if(d>>>0>c>>>0|(d|0)==(c|0)&h>>>0>l>>>0){U=S0()|0,e[U>>2]=34;break}}l=((r|0)<0)<<31>>31,l=ii(h^r|0,d^l|0,r|0,l|0)|0,c=ye}while(!1);return ye=c,l|0}function oi(t,r){t=t|0,r=r|0;var o=0,l=0,c=0;e[t+104>>2]=r,o=e[t+4>>2]|0,l=e[t+8>>2]|0,c=l-o|0,e[t+108>>2]=c,(r|0)!=0&(c|0)>(r|0)?e[t+100>>2]=o+r:e[t+100>>2]=l}function u0(t){t=t|0;var r=0,o=0,l=0,c=0,h=0,d=0;return o=t+104|0,h=e[o>>2]|0,h|0&&(e[t+108>>2]|0)>=(h|0)?d=4:(r=br(t)|0,(r|0)>=0?(c=e[o>>2]|0,o=t+8|0,c?(l=e[o>>2]|0,h=e[t+4>>2]|0,o=l,c=c-(e[t+108>>2]|0)+-1|0,(o-h|0)>(c|0)?e[t+100>>2]=h+c:d=9):(l=e[o>>2]|0,o=l,d=9),(d|0)==9&&(e[t+100>>2]=o),o=e[t+4>>2]|0,l&&(t=t+108|0,e[t>>2]=l+1-o+(e[t>>2]|0)),o=o+-1|0,(F[o>>0]|0|0)!=(r|0)&&(S[o>>0]=r)):d=4),(d|0)==4&&(e[t+100>>2]=0,r=-1),r|0}function Xi(t){t=t|0;var r=0;return t>>>0>4294963200&&(r=S0()|0,e[r>>2]=0-t,t=-1),t|0}function CA(t){return t=t|0,0}function mS(t,r,o,l){return t=t|0,r=r|0,o=o|0,l=l|0,l|0}function yo(t,r){return t=t|0,r=r|0,-1}function gS(t){t=t|0,n0(t)}function SS(t,r){return t=t|0,r=r|0,(t+-48|0)>>>0<10|0}function AS(t,r){return t=t|0,r=r|0,pS(t)|0}function vS(t,r,o){return t=t|0,r=r|0,o=o|0,S[r>>0]|0&&$o(r,58885)|0&&$o(r,54145)|0?o=0:o||(o=Dd(1,4)|0),o|0}function ai(t){t=t|0;var r=0,o=0;return r=($r()|0)+176|0,o=e[r>>2]|0,t&&(e[r>>2]=t),o|0}function xS(t,r){t=+t,r=+r;var o=0,l=0;return B[q>>3]=t,l=e[q>>2]|0,o=e[q+4>>2]|0,B[q>>3]=r,o=e[q+4>>2]&-2147483648|o&2147483647,e[q>>2]=l,e[q+4>>2]=o,+ +B[q>>3]}function Co(t,r){return t=+t,r=+r,+ +xS(t,r)}function wS(t,r){t=+t,r=+r;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0;B[q>>3]=t,o=e[q>>2]|0,D=e[q+4>>2]|0,B[q>>3]=r,k=e[q>>2]|0,N=e[q+4>>2]|0,l=Di(o|0,D|0,52)|0,l=l&2047,w=Di(k|0,N|0,52)|0,w=w&2047,R=D&-2147483648,d=v0(k|0,N|0,1)|0,C=ye;e:do if(!((d|0)==0&(C|0)==0)&&(h=N&2147483647,!(h>>>0>2146435072|(h|0)==2146435072&k>>>0>0|(l|0)==2047))){if(c=v0(o|0,D|0,1)|0,h=ye,!(h>>>0>C>>>0|(h|0)==(C|0)&c>>>0>d>>>0))return+((c|0)==(d|0)&(h|0)==(C|0)?t*0:t);if(l)c=D&1048575|1048576;else{if(l=v0(o|0,D|0,12)|0,c=ye,(c|0)>-1|(c|0)==-1&l>>>0>4294967295){h=l,l=0;do l=l+-1|0,h=v0(h|0,c|0,1)|0,c=ye;while((c|0)>-1|(c|0)==-1&h>>>0>4294967295)}else l=0;o=v0(o|0,D|0,1-l|0)|0,c=ye}if(w)D=N&1048575|1048576;else{if(h=v0(k|0,N|0,12)|0,d=ye,(d|0)>-1|(d|0)==-1&h>>>0>4294967295){w=0;do w=w+-1|0,h=v0(h|0,d|0,1)|0,d=ye;while((d|0)>-1|(d|0)==-1&h>>>0>4294967295)}else w=0;k=v0(k|0,N|0,1-w|0)|0,D=ye}C=ii(o|0,c|0,k|0,D|0)|0,d=ye,h=(d|0)>-1|(d|0)==-1&C>>>0>4294967295;t:do if((l|0)>(w|0)){for(;;){if(h){if((o|0)==(k|0)&(c|0)==(D|0))break;o=C,c=d}if(o=v0(o|0,c|0,1)|0,c=ye,l=l+-1|0,C=ii(o|0,c|0,k|0,D|0)|0,d=ye,h=(d|0)>-1|(d|0)==-1&C>>>0>4294967295,(l|0)<=(w|0))break t}r=t*0;break e}while(!1);if(h)if((o|0)==(k|0)&(c|0)==(D|0)){r=t*0;break}else c=d,o=C;if(c>>>0<1048576|(c|0)==1048576&o>>>0<0)do o=v0(o|0,c|0,1)|0,c=ye,l=l+-1|0;while(c>>>0<1048576|(c|0)==1048576&o>>>0<0);(l|0)>0?(N=$0(o|0,c|0,0,-1048576)|0,o=ye,l=v0(l|0,0,52)|0,o=o|ye,l=N|l):(l=Di(o|0,c|0,1-l|0)|0,o=ye),e[q>>2]=l,e[q+4>>2]=o|R,r=+B[q>>3]}else _=3;while(!1);return(_|0)==3&&(r=t*r,r=r/r),+r}function To(t,r){return t=+t,r=+r,+ +wS(t,r)}function Io(t,r){t=+t,r=r|0;var o=0,l=0,c=0;switch(B[q>>3]=t,o=e[q>>2]|0,l=e[q+4>>2]|0,c=Di(o|0,l|0,52)|0,c=c&2047,c|0){case 0:{t!=0?(t=+Io(t*18446744073709552e3,r),o=(e[r>>2]|0)+-64|0):o=0,e[r>>2]=o;break}case 2047:break;default:e[r>>2]=c+-1022,e[q>>2]=o,e[q+4>>2]=l&-2146435073|1071644672,t=+B[q>>3]}return+t}function yS(t,r){return t=+t,r=r|0,+ +Io(t,r)}function bn(t,r){t=+t,r=r|0;var o=0;return(r|0)>1023?(t=t*898846567431158e293,o=r+-1023|0,(o|0)>1023&&(o=r+-2046|0,o=(o|0)>1023?1023:o,t=t*898846567431158e293)):(r|0)<-1022?(t=t*22250738585072014e-324,o=r+1022|0,(o|0)<-1022&&(o=r+2044|0,o=(o|0)<-1022?-1022:o,t=t*22250738585072014e-324)):o=r,o=v0(o+1023|0,0,52)|0,r=ye,e[q>>2]=o,e[q+4>>2]=r,+(t*+B[q>>3])}function Eo(t,r){return t=+t,r=r|0,+ +bn(t,r)}function CS(t,r,o){return t=t|0,r=r|0,o=o|0,Nn(0,t,r,o|0?o:37344)|0}function Nn(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0,D=0;C=b,b=b+16|0,c=C,d=l|0?l:37348,l=e[d>>2]|0;e:do if(!r)l?w=15:l=0;else if(h=t|0?t:c,!o)l=-2;else{if(l)c=o,w=9;else{if(l=S[r>>0]|0,c=l&255,l<<24>>24>-1){e[h>>2]=c,l=l<<24>>24!=0&1;break}if(l=c+-194|0,l>>>0>50){w=15;break}l=e[37076+(l<<2)>>2]|0,c=o+-1|0,c&&(r=r+1|0,w=9)}t:do if((w|0)==9){if(t=S[r>>0]|0,D=(t&255)>>>3,(D+-16|D+(l>>26))>>>0>7){w=15;break e}for(;r=r+1|0,l=(t&255)+-128|l<<6,c=c+-1|0,!((l|0)>=0);){if(!c)break t;if(t=S[r>>0]|0,(t&-64)<<24>>24!=-128){w=15;break e}}e[d>>2]=0,e[h>>2]=l,l=o-c|0;break e}while(!1);e[d>>2]=l,l=-2}while(!1);return(w|0)==15&&(e[d>>2]=0,l=S0()|0,e[l>>2]=84,l=-1),b=C,l|0}function TS(t){return t=t|0,t?t=(e[t>>2]|0)==0:t=1,t&1|0}function IS(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0;R=b,b=b+1040|0,D=R+8|0,N=R,C=e[r>>2]|0,e[N>>2]=C,k=(t|0)!=0,l=k?l:256,t=k?t:D,h=C;e:do if((l|0)!=0&(C|0)!=0){for(w=l,C=h,l=0;;){if(h=o>>>2,d=h>>>0>=w>>>0,!(o>>>0>131|d)){h=C;break e}if(h=d?w:h,o=o-h|0,h=ko(t,N,h,c)|0,(h|0)==-1){l=o;break}if(_=(t|0)==(D|0),C=_?0:h,d=w-C|0,t=_?t:t+(h<<2)|0,l=h+l|0,h=e[N>>2]|0,(w|0)!=(C|0)&(h|0)!=0)w=d,C=h;else{w=d;break e}}o=l,w=0,h=e[N>>2]|0,l=-1}else w=l,l=0;while(!1);e:do if(h|0&&(w|0)!=0&(o|0)!=0){for(d=h,h=t;t=Nn(h,d,o,c)|0,!((t+2|0)>>>0<3);)if(d=(e[N>>2]|0)+t|0,e[N>>2]=d,w=w+-1|0,l=l+1|0,(w|0)!=0&(o|0)!=(t|0))o=o-t|0,h=h+4|0;else break e;switch(t|0){case-1:{l=-1;break e}case 0:{e[N>>2]=0;break e}default:{e[c>>2]=0;break e}}}while(!1);return k&&(e[r>>2]=e[N>>2]),b=R,l|0}function ko(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0,D=0;c=e[r>>2]|0,l|0&&(h=e[l>>2]|0,(h|0)!=0)?t?(e[l>>2]=0,C=t,l=o,w=h,D=37):(l=o,d=c,D=16):t?(h=t,l=o,D=6):(l=o,D=7);e:for(;;)if((D|0)==6){if(l)t=h;else{D=26;break}for(;;){h=S[c>>0]|0;do if(((h&255)+-1|0)>>>0<127&&l>>>0>4&(c&3|0)==0){for(d=c;;){if(c=e[d>>2]|0,(c+-16843009|c)&-2139062144){h=c,c=d,D=32;break}if(e[t>>2]=c&255,e[t+4>>2]=F[d+1>>0],e[t+8>>2]=F[d+2>>0],c=d+4|0,h=t+16|0,e[t+12>>2]=F[d+3>>0],l=l+-4|0,l>>>0>4)t=h,d=c;else{D=31;break}}if((D|0)==31){t=h,h=S[c>>0]|0;break}else if((D|0)==32){h=h&255;break}}while(!1);if(h=h&255,(h+-1|0)>>>0>=127)break;if(c=c+1|0,e[t>>2]=h,l=l+-1|0,l)t=t+4|0;else{D=26;break e}}if(h=h+-194|0,h>>>0>50){D=48;break}C=t,w=e[37076+(h<<2)>>2]|0,c=c+1|0,D=37;continue}else if((D|0)==7){if(h=S[c>>0]|0,((h&255)+-1|0)>>>0<127&&!(c&3|0)){if(h=e[c>>2]|0,!((h+-16843009|h)&-2139062144))do c=c+4|0,l=l+-4|0,h=e[c>>2]|0;while(!((h+-16843009|h)&-2139062144|0));h=h&255}if(h=h&255,(h+-1|0)>>>0<127){l=l+-1|0,c=c+1|0,D=7;continue}if(h=h+-194|0,h>>>0>50){D=48;break}h=e[37076+(h<<2)>>2]|0,d=c+1|0,D=16;continue}else if((D|0)==16){if(D=(F[d>>0]|0)>>>3,(D+-16|D+(h>>26))>>>0>7){D=17;break}if(c=d+1|0,h&33554432){if((S[c>>0]&-64)<<24>>24!=-128){D=20;break}if(c=d+2|0,h&524288){if((S[c>>0]&-64)<<24>>24!=-128){D=23;break}c=d+3|0}}l=l+-1|0,D=7;continue}else if((D|0)==37){if(h=F[c>>0]|0,D=h>>>3,(D+-16|D+(w>>26))>>>0>7){D=38;break}if(d=c+1|0,t=h+-128|w<<6,(t|0)<0){if(h=F[d>>0]|0,(h&192|0)!=128){D=41;break}if(d=c+2|0,t=h+-128|t<<6,(t|0)<0){if(h=F[d>>0]|0,(h&192|0)!=128){D=44;break}t=h+-128|t<<6,c=c+3|0}else c=d}else c=d;e[C>>2]=t,h=C+4|0,l=l+-1|0,D=6;continue}return(D|0)==17||(D|0)==20||(D|0)==23?(c=d+-1|0,D=47):(D|0)==26?e[r>>2]=c:(D|0)==38?(t=C,h=w,c=c+-1|0,D=47):((D|0)==41||(D|0)==44)&&(l=C,o=c+-1|0,D=52),(D|0)==47&&(h?(l=t,o=c,D=52):D=48),(D|0)==48&&(S[c>>0]|0?(l=t,o=c,D=52):(t&&(e[t>>2]=0,e[r>>2]=0),o=o-l|0)),(D|0)==52&&(D=S0()|0,e[D>>2]=84,l&&(e[r>>2]=o),o=-1),o|0}function ES(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0;d=b,b=b+16|0,l=d;e:do if(!r)l=0;else{do if(o){if(h=t|0?t:l,l=S[r>>0]|0,t=l&255,l<<24>>24>-1){e[h>>2]=t,l=l<<24>>24!=0&1;break e}if(l=t+-194|0,l>>>0<=50){if(t=r+1|0,c=e[37076+(l<<2)>>2]|0,o>>>0<4&&c&-2147483648>>>((o*6|0)+-6|0)|0)break;if(l=F[t>>0]|0,o=l>>>3,(o+-16|o+(c>>26))>>>0<=7){if(l=l+-128|c<<6,(l|0)>=0){e[h>>2]=l,l=2;break e}if(t=F[r+2>>0]|0,(t&192|0)==128){if(t=t+-128|l<<6,(t|0)>=0){e[h>>2]=t,l=3;break e}if(l=F[r+3>>0]|0,(l&192|0)==128){e[h>>2]=l+-128|t<<6,l=4;break e}}}}}while(!1);l=S0()|0,e[l>>2]=84,l=-1}while(!1);return b=d,l|0}function Oi(t,r,o){t=t|0,r=r|0,o=o|0;do if(t){if(r>>>0<128){S[t>>0]=r,t=1;break}if(r>>>0<2048){S[t>>0]=r>>>6|192,S[t+1>>0]=r&63|128,t=2;break}if(r>>>0<55296|(r&-8192|0)==57344){S[t>>0]=r>>>12|224,S[t+1>>0]=r>>>6&63|128,S[t+2>>0]=r&63|128,t=3;break}if((r+-65536|0)>>>0<1048576){S[t>>0]=r>>>18|240,S[t+1>>0]=r>>>12&63|128,S[t+2>>0]=r>>>6&63|128,S[t+3>>0]=r&63|128,t=4;break}else{t=S0()|0,e[t>>2]=84,t=-1;break}}else t=1;while(!1);return t|0}function kS(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0;k=b,b=b+272|0,w=k+8|0,D=k,d=e[r>>2]|0,e[D>>2]=d,C=(t|0)!=0,c=C?l:256,l=C?t:w,t=d;e:do if((c|0)!=0&(d|0)!=0){for(d=c,h=t,c=0;;){if(t=o>>>0>=d>>>0,!(t|o>>>0>32)){t=h;break e}if(t=t?d:o,o=o-t|0,t=DS(l,D,t,0)|0,(t|0)==-1){c=o;break}if(R=(l|0)==(w|0),N=R?0:t,h=d-N|0,l=R?l:l+t|0,c=t+c|0,t=e[D>>2]|0,(d|0)!=(N|0)&(t|0)!=0)d=h,h=t;else{d=h;break e}}o=c,d=0,t=e[D>>2]|0,c=-1}else d=c,c=0;while(!1);e:do if(t|0&&(d|0)!=0&(o|0)!=0){for(h=t,t=l;l=Oi(t,e[h>>2]|0,0)|0,!((l+1|0)>>>0<2);)if(h=(e[D>>2]|0)+4|0,e[D>>2]=h,o=o+-1|0,c=c+1|0,(d|0)!=(l|0)&(o|0)!=0)d=d-l|0,t=t+l|0;else break e;l?c=-1:e[D>>2]=0}while(!1);return C&&(e[r>>2]=e[D>>2]),b=k,c|0}function DS(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0;w=b,b=b+16|0,d=w;e:do if(t){t:do if(o>>>0>3){for(l=o,c=e[r>>2]|0;;){if(h=e[c>>2]|0,(h+-1|0)>>>0>126){if(!h)break;if(h=Oi(t,h,0)|0,(h|0)==-1){o=-1;break e}t=t+h|0,l=l-h|0}else S[t>>0]=h,t=t+1|0,l=l+-1|0,c=e[r>>2]|0;if(c=c+4|0,e[r>>2]=c,l>>>0<=3)break t}S[t>>0]=0,e[r>>2]=0,o=o-l|0;break e}else l=o;while(!1);if(l){for(c=e[r>>2]|0;;){if(h=e[c>>2]|0,(h+-1|0)>>>0>126){if(!h){c=19;break}if(h=Oi(d,h,0)|0,(h|0)==-1){o=-1;break e}if(l>>>0>>0){c=22;break}Oi(t,e[c>>2]|0,0)|0,t=t+h|0,l=l-h|0}else S[t>>0]=h,t=t+1|0,l=l+-1|0,c=e[r>>2]|0;if(c=c+4|0,e[r>>2]=c,!l)break e}if((c|0)==19){S[t>>0]=0,e[r>>2]=0,o=o-l|0;break}else if((c|0)==22){o=o-l|0;break}}}else if(t=e[r>>2]|0,l=e[t>>2]|0,!l)o=0;else{o=0;do{if(l>>>0>127){if(l=Oi(d,l,0)|0,(l|0)==-1){o=-1;break e}}else l=1;o=l+o|0,t=t+4|0,l=e[t>>2]|0}while(l|0)}while(!1);return b=w,o|0}function Do(t,r){return t=t|0,r=r|0,t?t=Oi(t,r,0)|0:t=0,t|0}function Ri(t){return t=t|0,0}function mi(t){t=t|0}function bo(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0;C=b,b=b+16|0,w=C,d=r&255,S[w>>0]=d,l=t+16|0,c=e[l>>2]|0,c?h=4:Ro(t)|0?o=-1:(c=e[l>>2]|0,h=4);do if((h|0)==4){if(l=t+20|0,h=e[l>>2]|0,h>>>0>>0&&(o=r&255,(o|0)!=(S[t+75>>0]|0))){e[l>>2]=h+1,S[h>>0]=d;break}(Yt[e[t+36>>2]&63](t,w,1)|0)==1?o=F[w>>0]|0:o=-1}while(!1);return b=C,o|0}function bS(t){t=t|0;var r=0,o=0;return r=b,b=b+16|0,o=r,e[o>>2]=e[t+60>>2],t=Xi(Zo(6,o|0)|0)|0,b=r,t|0}function NS(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0;return D=b,b=b+48|0,h=D+16|0,c=D,l=D+32|0,e[l>>2]=r,d=l+4|0,C=t+48|0,k=e[C>>2]|0,e[d>>2]=o-((k|0)!=0&1),w=t+44|0,e[l+8>>2]=e[w>>2],e[l+12>>2]=k,e[9258]|0?(zr(185,t|0),e[c>>2]=e[t+60>>2],e[c+4>>2]=l,e[c+8>>2]=2,l=Xi(Wr(145,c|0)|0)|0,Vr(0)):(e[h>>2]=e[t+60>>2],e[h+4>>2]=l,e[h+8>>2]=2,l=Xi(Wr(145,h|0)|0)|0),(l|0)>=1?(d=e[d>>2]|0,l>>>0>d>>>0&&(h=e[w>>2]|0,c=t+4|0,e[c>>2]=h,e[t+8>>2]=h+(l-d),e[C>>2]|0&&(e[c>>2]=h+1,S[r+(o+-1)>>0]=S[h>>0]|0),l=o)):(e[t>>2]=e[t>>2]|l&48^16,e[t+8>>2]=0,e[t+4>>2]=0),b=D,l|0}function RS(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0;return c=b,b=b+32|0,h=c,l=c+20|0,e[h>>2]=e[t+60>>2],e[h+4>>2]=0,e[h+8>>2]=r,e[h+12>>2]=l,e[h+16>>2]=o,(Xi(ta(140,h|0)|0)|0)<0?(e[l>>2]=-1,t=-1):t=e[l>>2]|0,b=c,t|0}function No(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0;for(U=b,b=b+48|0,N=U+16|0,k=U,l=U+32|0,R=t+28|0,c=e[R>>2]|0,e[l>>2]=c,_=t+20|0,c=(e[_>>2]|0)-c|0,e[l+4>>2]=c,e[l+8>>2]=r,e[l+12>>2]=o,C=t+60|0,D=t+44|0,r=2,c=c+o|0;;){if(e[9258]|0?(zr(186,t|0),e[k>>2]=e[C>>2],e[k+4>>2]=l,e[k+8>>2]=r,d=Xi(Hr(146,k|0)|0)|0,Vr(0)):(e[N>>2]=e[C>>2],e[N+4>>2]=l,e[N+8>>2]=r,d=Xi(Hr(146,N|0)|0)|0),(c|0)==(d|0)){c=6;break}if((d|0)<0){c=8;break}c=c-d|0,h=e[l+4>>2]|0,d>>>0<=h>>>0?(r|0)==2?(e[R>>2]=(e[R>>2]|0)+d,w=h,r=2):w=h:(w=e[D>>2]|0,e[R>>2]=w,e[_>>2]=w,w=e[l+12>>2]|0,d=d-h|0,l=l+8|0,r=r+-1|0),e[l>>2]=(e[l>>2]|0)+d,e[l+4>>2]=w-d}return(c|0)==6?(N=e[D>>2]|0,e[t+16>>2]=N+(e[t+48>>2]|0),t=N,e[R>>2]=t,e[_>>2]=t):(c|0)==8&&(e[t+16>>2]=0,e[R>>2]=0,e[_>>2]=0,e[t>>2]=e[t>>2]|32,(r|0)==2?o=0:o=o-(e[l+4>>2]|0)|0),b=U,o|0}function MS(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0;return c=b,b=b+80|0,l=c,e[t+36>>2]=8,!(e[t>>2]&64|0)&&(e[l>>2]=e[t+60>>2],e[l+4>>2]=21505,e[l+8>>2]=c+12,(Ko(54,l|0)|0)!=0)&&(S[t+75>>0]=-1),l=No(t,r,o)|0,b=c,l|0}function _S(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0;return l=t+84|0,h=e[l>>2]|0,d=o+256|0,c=Oo(h,0,d)|0,c=c|0?c-h|0:d,o=c>>>0>>0?c:o,o0(r|0,h|0,o|0)|0,e[t+4>>2]=h+o,r=h+c|0,e[t+8>>2]=r,e[l>>2]=r,o|0}function Fo(t){t=t|0;var r=0,o=0;return r=t+74|0,o=S[r>>0]|0,S[r>>0]=o+255|o,r=t+20|0,o=t+44|0,(e[r>>2]|0)>>>0>(e[o>>2]|0)>>>0&&Yt[e[t+36>>2]&63](t,0,0)|0,e[t+16>>2]=0,e[t+28>>2]=0,e[r>>2]=0,r=e[t>>2]|0,r&20?(r&4&&(e[t>>2]=r|32),r=-1):(r=e[o>>2]|0,e[t+8>>2]=r,e[t+4>>2]=r,r=0),r|0}function Ro(t){t=t|0;var r=0,o=0;return r=t+74|0,o=S[r>>0]|0,S[r>>0]=o+255|o,r=e[t>>2]|0,r&8?(e[t>>2]=r|32,r=-1):(e[t+8>>2]=0,e[t+4>>2]=0,r=e[t+44>>2]|0,e[t+28>>2]=r,e[t+20>>2]=r,e[t+16>>2]=r+(e[t+48>>2]|0),r=0),r|0}function br(t){t=t|0;var r=0,o=0;return o=b,b=b+16|0,r=o,!(e[t+8>>2]|0)&&Fo(t)|0?r=-1:(Yt[e[t+32>>2]&63](t,r,1)|0)==1?r=F[r>>0]|0:r=-1,b=o,r|0}function Nr(t){t=t|0;var r=0,o=0;do if(t){if((e[t+76>>2]|0)<=-1){r=Mr(t)|0;break}o=(Ri(t)|0)==0,r=Mr(t)|0,o||mi(t)}else{if(e[9323]|0?r=Nr(e[9323]|0)|0:r=0,M0(37060),t=e[9264]|0,t)do(e[t+76>>2]|0)>-1?o=Ri(t)|0:o=0,(e[t+20>>2]|0)>>>0>(e[t+28>>2]|0)>>>0&&(r=Mr(t)|0|r),o&&mi(t),t=e[t+56>>2]|0;while(t|0);Yo(37060)}while(!1);return r|0}function PS(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0;(e[r+76>>2]|0)>=0&&Ri(r)|0?((S[r+75>>0]|0)!=(t|0)&&(l=r+20|0,c=e[l>>2]|0,c>>>0<(e[r+16>>2]|0)>>>0)?(e[l>>2]=c+1,S[c>>0]=t,o=t&255):o=bo(r,t)|0,mi(r)):d=3;do if((d|0)==3){if((S[r+75>>0]|0)!=(t|0)&&(h=r+20|0,o=e[h>>2]|0,o>>>0<(e[r+16>>2]|0)>>>0)){e[h>>2]=o+1,S[o>>0]=t,o=t&255;break}o=bo(r,t)|0}while(!1);return o|0}function B0(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0;l=o+16|0,c=e[l>>2]|0,c?h=4:Ro(o)|0?l=0:(c=e[l>>2]|0,h=4);e:do if((h|0)==4){if(d=o+20|0,h=e[d>>2]|0,(c-h|0)>>>0>>0){l=Yt[e[o+36>>2]&63](o,t,r)|0;break}t:do if((S[o+75>>0]|0)>-1){for(l=r;;){if(!l){c=h,l=0;break t}if(c=l+-1|0,(S[t+c>>0]|0)==10)break;l=c}if((Yt[e[o+36>>2]&63](o,t,l)|0)>>>0>>0)break e;r=r-l|0,t=t+l|0,c=e[d>>2]|0}else c=h,l=0;while(!1);o0(c|0,t|0,r|0)|0,e[d>>2]=(e[d>>2]|0)+r,l=l+r|0}while(!1);return l|0}function gi(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0;return c=ee(o,r)|0,(e[l+76>>2]|0)>-1?(h=(Ri(l)|0)==0,t=B0(t,c,l)|0,h||mi(l)):t=B0(t,c,l)|0,(t|0)!=(c|0)&&(o=(t>>>0)/(r>>>0)|0),o|0}function Fn(t){t=t|0;var r=0,o=0,l=0;(e[t+76>>2]|0)>=0&&Ri(t)|0?(r=t+4|0,o=e[r>>2]|0,o>>>0<(e[t+8>>2]|0)>>>0?(e[r>>2]=o+1,r=F[o>>0]|0):r=br(t)|0):l=3;do if((l|0)==3)if(r=t+4|0,o=e[r>>2]|0,o>>>0<(e[t+8>>2]|0)>>>0){e[r>>2]=o+1,r=F[o>>0]|0;break}else{r=br(t)|0;break}while(!1);return r|0}function Mo(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0;return c=b,b=b+16|0,h=c,e[h>>2]=l,l=Mn(t,r,o,h)|0,b=c,l|0}function _o(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0;return l=b,b=b+16|0,c=l,e[c>>2]=o,o=Lo(t,r,c)|0,b=l,o|0}function Rn(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0;do if((t|0)!=-1){if((e[r+76>>2]|0)>-1?c=Ri(r)|0:c=0,!(e[r+8>>2]|0)&&Fo(r)|0||(h=6),(h|0)==6&&(o=r+4|0,l=e[o>>2]|0,l>>>0>((e[r+44>>2]|0)+-8|0)>>>0)){if(h=l+-1|0,e[o>>2]=h,S[h>>0]=t,e[r>>2]=e[r>>2]&-17,!c)break;mi(r);break}c&&mi(r),t=-1}else t=-1;while(!1);return t|0}function LS(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0,w=0;w=b,b=b+16|0,l=w,c=E0(240)|0;do if(c){if(e[l>>2]=e[o>>2],l=Mn(c,240,r,l)|0,l>>>0<240){r=Gi(c,l+1|0)|0,e[t>>2]=r|0?r:c;break}n0(c),(l|0)>=0&&(d=l+1|0,h=E0(d)|0,e[t>>2]=h,(h|0)!=0)?l=Mn(h,d,r,o)|0:l=-1}else l=-1;while(!1);return b=w,l|0}function Po(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0;Q=b,b=b+224|0,N=Q+80|0,U=Q+96|0,_=Q,R=Q+136|0,l=U,c=l+40|0;do e[l>>2]=0,l=l+4|0;while((l|0)<(c|0));return e[N>>2]=e[o>>2],(cr(0,r,N,_,U)|0)<0?o=-1:((e[t+76>>2]|0)>-1?D=Ri(t)|0:D=0,o=e[t>>2]|0,k=o&32,(S[t+74>>0]|0)<1&&(e[t>>2]=o&-33),o=t+48|0,e[o>>2]|0?l=cr(t,r,N,_,U)|0:(c=t+44|0,h=e[c>>2]|0,e[c>>2]=R,d=t+28|0,e[d>>2]=R,w=t+20|0,e[w>>2]=R,e[o>>2]=80,C=t+16|0,e[C>>2]=R+80,l=cr(t,r,N,_,U)|0,h&&(Yt[e[t+36>>2]&63](t,0,0)|0,l=e[w>>2]|0?l:-1,e[c>>2]=h,e[o>>2]=0,e[C>>2]=0,e[d>>2]=0,e[w>>2]=0)),o=e[t>>2]|0,e[t>>2]=o|k,D&&mi(t),o=o&32|0?-1:l),b=Q,o|0}function OS(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,Q=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0,ce=0,ke=0,Ee=0,Te=0,it=0,jt=0,Gt=0,s0=0,i0=0,zt=0;i0=b,b=b+304|0,ce=i0+16|0,Ee=i0+8|0,ke=i0+33|0,Te=i0,G=i0+32|0,(e[t+76>>2]|0)>-1?s0=Ri(t)|0:s0=0,l=S[r>>0]|0;e:do if(l<<24>>24){it=t+4|0,jt=t+100|0,ne=t+108|0,$=t+8|0,P=ke+10|0,O=ke+33|0,Z=Ee+4|0,ie=ke+46|0,oe=ke+94|0,h=l,l=0,d=r,N=0,c=0,r=0;t:for(;;){i:do if(ji(h&255)|0){for(;h=d+1|0,ji(F[h>>0]|0)|0;)d=h;oi(t,0);do h=e[it>>2]|0,h>>>0<(e[jt>>2]|0)>>>0?(e[it>>2]=h+1,h=F[h>>0]|0):h=u0(t)|0;while(ji(h)|0);h=e[it>>2]|0,e[jt>>2]|0&&(h=h+-1|0,e[it>>2]=h),w=(e[ne>>2]|0)+N+h-(e[$>>2]|0)|0}else{h=(S[d>>0]|0)==37;n:do if(h){D=d+1|0,w=S[D>>0]|0;r:do switch(w<<24>>24){case 37:break n;case 42:{K=0,w=d+2|0;break}default:{if(w=(w&255)+-48|0,w>>>0<10&&(S[d+2>>0]|0)==36){for(e[ce>>2]=e[o>>2];K=(e[ce>>2]|0)+3&-4,h=e[K>>2]|0,e[ce>>2]=K+4,w>>>0>1;)w=w+-1|0;K=h,w=d+3|0;break r}w=(e[o>>2]|0)+3&-4,K=e[w>>2]|0,e[o>>2]=w+4,w=D}}while(!1);if(h=S[w>>0]|0,d=h&255,(d+-48|0)>>>0<10)for(h=0;D=(h*10|0)+-48+d|0,w=w+1|0,h=S[w>>0]|0,d=h&255,!((d+-48|0)>>>0>=10);)h=D;else D=0;switch(h<<24>>24==109?(w=w+1|0,k=S[w>>0]|0,h=(K|0)!=0&1,c=0,r=0):(k=h,h=0),d=w+1|0,k&255|0){case 104:{Q=(S[d>>0]|0)==104,d=Q?w+2|0:d,w=Q?-2:-1;break}case 108:{Q=(S[d>>0]|0)==108,d=Q?w+2|0:d,w=Q?3:1;break}case 106:{w=3;break}case 116:case 122:{w=1;break}case 76:{w=2;break}case 110:case 112:case 67:case 83:case 91:case 99:case 115:case 88:case 71:case 70:case 69:case 65:case 103:case 102:case 101:case 97:case 120:case 117:case 111:case 105:case 100:{d=w,w=0;break}default:{Gt=152;break t}}switch(k=F[d>>0]|0,R=(k&47|0)==3,k=R?k|32:k,R=R?1:w,k|0){case 99:{Q=N,U=(D|0)<1?1:D;break}case 91:{Q=N,U=D;break}case 110:{if(!K){w=N;break i}switch(R|0){case-2:{S[K>>0]=N,w=N;break i}case-1:{I[K>>1]=N,w=N;break i}case 0:{e[K>>2]=N,w=N;break i}case 1:{e[K>>2]=N,w=N;break i}case 3:{w=K,e[w>>2]=N,e[w+4>>2]=((N|0)<0)<<31>>31,w=N;break i}default:{w=N;break i}}}default:{oi(t,0);do w=e[it>>2]|0,w>>>0<(e[jt>>2]|0)>>>0?(e[it>>2]=w+1,w=F[w>>0]|0):w=u0(t)|0;while(ji(w)|0);w=e[it>>2]|0,e[jt>>2]|0&&(w=w+-1|0,e[it>>2]=w),Q=(e[ne>>2]|0)+N+w-(e[$>>2]|0)|0,U=D}}if(oi(t,U),w=e[it>>2]|0,D=e[jt>>2]|0,w>>>0>>0)e[it>>2]=w+1;else{if((u0(t)|0)<0){Gt=152;break t}D=e[jt>>2]|0}D&&(e[it>>2]=(e[it>>2]|0)+-1);r:do switch(k|0){case 91:case 99:case 115:{_=(k|0)==99;s:do if((k&239|0)==99)Jt(ke|0,-1,257)|0,S[ke>>0]=0,(k|0)==115&&(S[O>>0]=0,S[P>>0]=0,S[P+1>>0]=0,S[P+2>>0]=0,S[P+3>>0]=0,S[P+4>>0]=0);else{switch(zt=d+1|0,N=(S[zt>>0]|0)==94,w=N&1,k=N?zt:d,d=N?d+2|0:zt,Jt(ke|0,N&1|0,257)|0,S[ke>>0]=0,S[d>>0]|0){case 45:{N=(w^1)&255,S[ie>>0]=N,d=k+2|0;break}case 93:{N=(w^1)&255,S[oe>>0]=N,d=k+2|0;break}default:N=(w^1)&255}for(;;){w=S[d>>0]|0;o:do switch(w<<24>>24){case 0:{Gt=152;break t}case 93:break s;case 45:{switch(k=d+1|0,w=S[k>>0]|0,w<<24>>24){case 93:case 0:{w=45;break o}default:}if(d=S[d+-1>>0]|0,(d&255)<(w&255)){d=d&255;do d=d+1|0,S[ke+d>>0]=N,w=S[k>>0]|0;while((d|0)<(w&255|0));d=k}else d=k;break}default:}while(!1);S[ke+((w&255)+1)>>0]=N,d=d+1|0}}while(!1);k=_?U+1|0:31,N=(R|0)==1,R=(h|0)!=0;s:do if(N){if(R){if(r=E0(k<<2)|0,!r){c=0,Gt=152;break t}}else r=K;e[Ee>>2]=0,e[Z>>2]=0,c=0;o:for(;;){D=(r|0)==0;do{a:for(;;){if(w=e[it>>2]|0,w>>>0<(e[jt>>2]|0)>>>0?(e[it>>2]=w+1,w=F[w>>0]|0):w=u0(t)|0,!(S[ke+(w+1)>>0]|0))break o;switch(S[G>>0]=w,Nn(Te,G,1,Ee)|0){case-1:{c=0,Gt=152;break t}case-2:break;default:break a}}D||(e[r+(c<<2)>>2]=e[Te>>2],c=c+1|0)}while(!(R&(c|0)==(k|0)));if(c=k<<1|1,w=Gi(r,c<<2)|0,!w){c=0,Gt=152;break t}zt=k,k=c,r=w,c=zt}if(TS(Ee)|0)D=c,c=0;else{c=0,Gt=152;break t}}else{if(R){if(c=E0(k)|0,c)w=0;else{c=0,r=0,Gt=152;break t}for(;;){do{if(r=e[it>>2]|0,r>>>0<(e[jt>>2]|0)>>>0?(e[it>>2]=r+1,r=F[r>>0]|0):r=u0(t)|0,!(S[ke+(r+1)>>0]|0)){D=w,r=0;break s}S[c+w>>0]=r,w=w+1|0}while((w|0)!=(k|0));if(r=k<<1|1,w=Gi(c,r)|0,w)zt=k,k=r,c=w,w=zt;else{r=0,Gt=152;break t}}}if(K)for(c=0;;){if(r=e[it>>2]|0,r>>>0>>0?(e[it>>2]=r+1,r=F[r>>0]|0):r=u0(t)|0,!(S[ke+(r+1)>>0]|0)){D=c,c=K,r=0;break s}S[K+c>>0]=r,D=e[jt>>2]|0,c=c+1|0}else for(c=D;;){if(r=e[it>>2]|0,r>>>0>>0?(e[it>>2]=r+1,r=F[r>>0]|0):r=u0(t)|0,!(S[ke+(r+1)>>0]|0)){D=0,c=0,r=0;break s}c=e[jt>>2]|0}}while(!1);if(w=e[it>>2]|0,e[jt>>2]|0&&(w=w+-1|0,e[it>>2]=w),w=w-(e[$>>2]|0)+(e[ne>>2]|0)|0,!w||!((w|0)==(U|0)|_^1))break t;do if(R)if(N){e[K>>2]=r;break}else{e[K>>2]=c;break}while(!1);if(!_){if(r&&(e[r+(D<<2)>>2]=0),!c){c=0;break r}S[c+D>>0]=0}break}case 120:case 88:case 112:{w=16,Gt=134;break}case 111:{w=8,Gt=134;break}case 117:case 100:{w=10,Gt=134;break}case 105:{w=0,Gt=134;break}case 71:case 103:case 70:case 102:case 69:case 101:case 65:case 97:{if(C=+xo(t,R,0),(e[ne>>2]|0)==((e[$>>2]|0)-(e[it>>2]|0)|0))break t;if(K)switch(R|0){case 0:{V[K>>2]=C;break r}case 1:{B[K>>3]=C;break r}case 2:{B[K>>3]=C;break r}default:break r}break}default:}while(!1);r:do if((Gt|0)==134){if(Gt=0,w=wo(t,w,0,-1,-1)|0,(e[ne>>2]|0)==((e[$>>2]|0)-(e[it>>2]|0)|0))break t;if((K|0)!=0&(k|0)==112){e[K>>2]=w;break}if(K)switch(R|0){case-2:{S[K>>0]=w;break r}case-1:{I[K>>1]=w;break r}case 0:{e[K>>2]=w;break r}case 1:{e[K>>2]=w;break r}case 3:{zt=K,e[zt>>2]=w,e[zt+4>>2]=ye;break r}default:break r}}while(!1);l=((K|0)!=0&1)+l|0,w=(e[ne>>2]|0)+Q+(e[it>>2]|0)-(e[$>>2]|0)|0;break i}while(!1);if(d=d+(h&1)|0,oi(t,0),h=e[it>>2]|0,h>>>0<(e[jt>>2]|0)>>>0?(e[it>>2]=h+1,h=F[h>>0]|0):h=u0(t)|0,(h|0)!=(F[d>>0]|0)){Gt=21;break t}w=N+1|0}while(!1);if(d=d+1|0,h=S[d>>0]|0,h<<24>>24)N=w;else break e}if((Gt|0)==21){if(e[jt>>2]|0&&(e[it>>2]=(e[it>>2]|0)+-1),(l|0)!=0|(h|0)>-1)break;l=0,Gt=153}else(Gt|0)==152&&(l||(l=h,Gt=153));(Gt|0)==153&&(h=l,l=-1),h&&(n0(c),n0(r))}else l=0;while(!1);return s0&&mi(t),b=i0,l|0}function Mn(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0,D=0,k=0;k=b,b=b+128|0,c=k+112|0,D=k,h=D,d=37352,w=h+112|0;do e[h>>2]=e[d>>2],h=h+4|0,d=d+4|0;while((h|0)<(w|0));return(r+-1|0)>>>0>2147483646?r?(r=S0()|0,e[r>>2]=75,r=-1):(r=1,C=4):(c=t,C=4),(C|0)==4&&(C=-2-c|0,C=r>>>0>C>>>0?C:r,e[D+48>>2]=C,t=D+20|0,e[t>>2]=c,e[D+44>>2]=c,r=c+C|0,c=D+16|0,e[c>>2]=r,e[D+28>>2]=r,r=Po(D,o,l)|0,C&&(o=e[t>>2]|0,S[o+(((o|0)==(e[c>>2]|0))<<31>>31)>>0]=0)),b=k,r|0}function Lo(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0;h=b,b=b+112|0,l=h,c=l,d=c+112|0;do e[c>>2]=0,c=c+4|0;while((c|0)<(d|0));return e[l+32>>2]=29,e[l+44>>2]=t,e[l+76>>2]=-1,e[l+84>>2]=t,d=OS(l,r,o)|0,b=h,d|0}function Fr(t,r,o){return t=t|0,r=r|0,o=o|0,+ +Ed(t,r,2)}function $S(t,r,o){return t=t|0,r=r|0,o=o|0,t=_s(t,r,o,-1,-1)|0,t|0}function BS(t,r,o){return t=t|0,r=r|0,o=o|0,t=_s(t,r,o,0,-2147483648)|0,t|0}function Oo(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0;h=r&255,l=(o|0)!=0;e:do if(l&(t&3|0)!=0)for(c=r&255;;){if((S[t>>0]|0)==c<<24>>24){d=6;break e}if(t=t+1|0,o=o+-1|0,l=(o|0)!=0,!(l&(t&3|0)!=0)){d=5;break}}else d=5;while(!1);(d|0)==5&&(l?d=6:o=0);e:do if((d|0)==6&&(c=r&255,(S[t>>0]|0)!=c<<24>>24)){l=ee(h,16843009)|0;t:do if(o>>>0>3){for(;h=e[t>>2]^l,!((h&-2139062144^-2139062144)&h+-16843009);)if(t=t+4|0,o=o+-4|0,o>>>0<=3){d=11;break t}}else d=11;while(!1);if((d|0)==11&&!o){o=0;break}for(;;){if((S[t>>0]|0)==c<<24>>24)break e;if(t=t+1|0,o=o+-1|0,!o){o=0;break}}}while(!1);return(o|0?t:0)|0}function VS(t,r){t=t|0,r=r|0;var o=0,l=0;o=r;e:do if((o^t)&3)l=8;else{if(o&3)do{if(o=S[r>>0]|0,S[t>>0]=o,!(o<<24>>24))break e;r=r+1|0,t=t+1|0}while(r&3|0);if(o=e[r>>2]|0,!((o&-2139062144^-2139062144)&o+-16843009))for(l=t;r=r+4|0,t=l+4|0,e[l>>2]=o,o=e[r>>2]|0,!((o&-2139062144^-2139062144)&o+-16843009);)l=t;l=8}while(!1);if((l|0)==8&&(l=S[r>>0]|0,S[t>>0]=l,l<<24>>24))do r=r+1|0,t=t+1|0,l=S[r>>0]|0,S[t>>0]=l;while(l<<24>>24);return t|0}function $o(t,r){t=t|0,r=r|0;var o=0,l=0;if(l=S[t>>0]|0,o=S[r>>0]|0,!(l<<24>>24)||l<<24>>24!=o<<24>>24)r=l;else{do t=t+1|0,r=r+1|0,l=S[t>>0]|0,o=S[r>>0]|0;while(!(!(l<<24>>24)||l<<24>>24!=o<<24>>24));r=l}return(r&255)-(o&255)|0}function Rr(t,r){return t=t|0,r=r|0,VS(t,r)|0,t|0}function $i(t){t=t|0;var r=0,o=0,l=0;l=t;e:do if(!(l&3))o=4;else for(r=t,t=l;;){if(!(S[r>>0]|0))break e;if(r=r+1|0,t=r,!(t&3)){t=r,o=4;break}}while(!1);if((o|0)==4){for(;r=e[t>>2]|0,!((r&-2139062144^-2139062144)&r+-16843009);)t=t+4|0;if((r&255)<<24>>24)do t=t+1|0;while(S[t>>0]|0)}return t-l|0}function US(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0;if(!o)r=0;else{l=S[t>>0]|0;e:do if(!(l<<24>>24))l=0;else for(;;){if(o=o+-1|0,c=S[r>>0]|0,!(l<<24>>24==c<<24>>24&((o|0)!=0&c<<24>>24!=0)))break e;if(t=t+1|0,r=r+1|0,l=S[t>>0]|0,!(l<<24>>24)){l=0;break}}while(!1);r=(l&255)-(F[r>>0]|0)|0}return r|0}function _n(t){t=t|0;var r=0;for(r=t;e[r>>2]|0;)r=r+4|0;return r-t>>2|0}function Bi(t,r,o){t=t|0,r=r|0,o=o|0;var l=0;if(o)for(l=t;o=o+-1|0,e[l>>2]=e[r>>2],o;)r=r+4|0,l=l+4|0;return t|0}function zS(t,r,o){t=t|0,r=r|0,o=o|0;var l=0;if(l=(o|0)==0,t-r>>2>>>0>>0){if(!l)do o=o+-1|0,e[t+(o<<2)>>2]=e[r+(o<<2)>>2];while(o|0)}else if(!l)for(l=r,r=t;o=o+-1|0,e[r>>2]=e[l>>2],o;)l=l+4|0,r=r+4|0;return t|0}function GS(t,r,o){t=t|0,r=r|0,o=o|0;var l=0;if(o)for(l=t;o=o+-1|0,e[l>>2]=r,o;)l=l+4|0;return t|0}function Bo(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0;switch(d=t+4|0,o=e[d>>2]|0,w=t+100|0,o>>>0<(e[w>>2]|0)>>>0?(e[d>>2]=o+1,o=F[o>>0]|0):o=u0(t)|0,o|0){case 43:case 45:{l=(o|0)==45&1,o=e[d>>2]|0,o>>>0<(e[w>>2]|0)>>>0?(e[d>>2]=o+1,o=F[o>>0]|0):o=u0(t)|0,(r|0)!=0&(o+-48|0)>>>0>9&&e[w>>2]|0&&(e[d>>2]=(e[d>>2]|0)+-1),h=l;break}default:h=0}if((o+-48|0)>>>0>9)e[w>>2]|0?(e[d>>2]=(e[d>>2]|0)+-1,l=-2147483648,o=0):(l=-2147483648,o=0);else{l=0;do l=o+-48+(l*10|0)|0,o=e[d>>2]|0,o>>>0<(e[w>>2]|0)>>>0?(e[d>>2]=o+1,o=F[o>>0]|0):o=u0(t)|0;while((o+-48|0)>>>0<10&(l|0)<214748364);if(r=((l|0)<0)<<31>>31,(o+-48|0)>>>0<10){do r=Qi(l|0,r|0,10,0)|0,l=ye,o=$0(o|0,((o|0)<0)<<31>>31|0,-48,-1)|0,l=$0(o|0,ye|0,r|0,l|0)|0,r=ye,o=e[d>>2]|0,o>>>0<(e[w>>2]|0)>>>0?(e[d>>2]=o+1,o=F[o>>0]|0):o=u0(t)|0;while((o+-48|0)>>>0<10&((r|0)<21474836|(r|0)==21474836&l>>>0<2061584302));c=l}else c=l;if((o+-48|0)>>>0<10)do o=e[d>>2]|0,o>>>0<(e[w>>2]|0)>>>0?(e[d>>2]=o+1,o=F[o>>0]|0):o=u0(t)|0;while((o+-48|0)>>>0<10);e[w>>2]|0&&(e[d>>2]=(e[d>>2]|0)+-1),t=(h|0)!=0,o=ii(0,0,c|0,r|0)|0,l=t?ye:r,o=t?o:c}return ye=l,o|0}function qS(t){t=t|0,e[t+68>>2]|0||mi(t)}function WS(t){t=t|0,e[t+68>>2]|0||mi(t)}function Mr(t){t=t|0;var r=0,o=0,l=0,c=0,h=0,d=0;return r=t+20|0,h=t+28|0,(e[r>>2]|0)>>>0>(e[h>>2]|0)>>>0&&(Yt[e[t+36>>2]&63](t,0,0)|0,(e[r>>2]|0)==0)?r=-1:(d=t+4|0,o=e[d>>2]|0,l=t+8|0,c=e[l>>2]|0,o>>>0>>0&&Yt[e[t+40>>2]&63](t,o-c|0,1)|0,e[t+16>>2]=0,e[h>>2]=0,e[r>>2]=0,e[l>>2]=0,e[d>>2]=0,r=0),r|0}var HS=[bi,nf,of,eh,nh,ah,uh,Sn,An,bi,bi,bi,bi,bi,bi,bi],Pn=[sn,Y5,Ju,zu,Fu,xu,cu,eu,V2,tS,eS,J6,sn,sn,sn,sn],QS=[so,ph,xh,so],Mt=[e0,W5,H5,Yu,ju,$u,Bu,ku,Du,gu,Su,ou,au,j2,X2,L2,O2,T2,I2,m2,g2,r2,s2,K1,Y1,$1,B1,n1,r1,Kl,Yl,Ia,Ea,Ml,Ol,_l,hm,Xs,dm,pm,ul,cl,w6,hl,il,nl,Ua,za,Ha,Qa,Xa,Za,dl,pl,Al,vl,Cl,Tl,Dl,bl,Hl,Ql,d1,p1,A1,v1,C1,T1,b1,N1,K2,Y2,mp,i6,f6,h6,y6,C6,R6,M6,In,O6,V6,U6,G6,H6,q6,W6,Q6,K6,rn,Ld,zd,wt,Hd,Zd,fr,pp,Mp,Hp,sm,Qs,om,am,um,Ys,cm,fm,Am,Zs,vm,xm,Em,km,G0,Dm,bm,Nm,Rm,Gh,Lm,Om,Um,zm,eg,tg,dg,pg,Ig,Eg,hc,dc,Mc,_c,ef,tf,rf,sf,lf,uf,vf,xf,Nf,Ff,Uf,zf,Zf,Jf,sh,oh,hh,dh,Ah,vh,Th,Ih,bh,Nh,Rs,Lh,Ms,sd,io,Td,eo,r4,to,s4,Fm,Uh,Wh,md,$g,Hg,e4,t4,T6,fo,pi,Ta,Sr,lm,Ul,G2,cS,qS,WS,Fd,gS,th,fn,qh,L3,G3,q3,W3,H3,Q3,K3,de,Pt,n0,e0,e0,e0,e0,e0,e0,e0,e0,e0,e0,e0,e0,e0,e0,e0,e0,e0,e0,e0,e0,e0,e0,e0,e0,e0,e0,e0,e0,e0,e0,e0,e0,e0,e0,e0,e0,e0,e0,e0,e0,e0,e0,e0,e0,e0,e0,e0,e0,e0,e0,e0,e0,e0,e0],t0=[Tr,K5,Zu,Uu,Nu,vu,uu,J2,B2,E2,S2,o2,j1,V1,s1,jl,ka,_p,d6,p6,Od,Ud,Qd,Xd,Qp,hf,df,pf,mf,Sf,Af,Cf,Tf,If,Ef,Df,bf,_f,Pf,Lf,Of,Bf,Vf,Wf,Hf,Qf,Kf,jf,Xf,Dh,Mh,f4,d4,m4,h4,p4,g4,Sa,I6,m6,g6,ho,Rp,Pa,Oa,mm,Np,yp,Vl,Jl,_1,G1,J1,c2,x2,F2,z2,iu,hu,yu,Mu,qu,ic,X5,u6,Fi,rp,ip,Fp,wm,np,xp,Ep,Ip,r3,s3,o3,l3,u3,c3,Cd,f3,h3,d3,p3,m3,g3,S3,A3,v3,x3,w3,y3,C3,T3,I3,E3,k3,D3,b3,N3,F3,R3,M3,_3,J3,Tr,Tr],on=[N0,Gm,qm,Wm,Hm,Qm,Km,Ym,jm,Xm,Zm,Jm,ig,ng,rg,sg,og,ag,lg,ug,cg,fg,hg,Ag,xg,Ng,oc,mc,gc,Sc,Ac,vc,Lc,Oc,$c,Bc,Vc,Sh,Ch,Ui,Hi,N0,N0,N0,N0,N0,N0,N0,N0,N0,N0,N0,N0,N0,N0,N0,N0,N0,N0,N0,N0,N0,N0,N0],Dt=[r0,$p,Bp,ol,zp,n6,_6,$6,z6,bS,$d,Zp,em,tm,Xp,Gd,qd,Kd,Up,Jd,ep,ym,pc,S4,x4,y4,D4,F4,T4,E4,Pc,A4,w4,C4,N4,R4,I4,k4,cf,ff,gf,wf,yf,kf,Rf,Mf,$f,Gf,qf,Yf,_g,Pg,Og,o4,u4,l4,c4,vd,xd,yd,zg,Gg,Wg,jg,Xg,Jg,o6,Xe,f0,d0,Ks,js,P5,L5,O5,ai,_n,r0,r0,r0,r0,r0,r0,r0,r0,r0,r0,r0,r0,r0,r0,r0,r0,r0,r0,r0,r0,r0,r0,r0,r0,r0,r0,r0,r0,r0,r0,r0,r0,r0,r0,r0,r0,r0,r0,r0,r0,r0,r0,r0,r0,r0,r0,r0,r0,r0,r0,r0],KS=[oo,ih,lh,oo],Yt=[C0,Pp,Vp,qp,ap,lp,Y6,kd,No,RS,NS,MS,Kp,Jp,Bd,nm,Yd,Pm,Vm,Eh,Fh,ad,ud,dd,Hh,Xh,Jh,nd,La,Id,Gs,vS,t3,n3,Oi,ES,CS,LS,C0,C0,C0,C0,C0,C0,C0,C0,C0,C0,C0,C0,C0,C0,C0,C0,C0,C0,C0,C0,C0,C0,C0,C0,C0,C0],YS=[ao,gh,yh,ao],Vi=[Ni,rl,rS,nS,iS,Yp,Lp,kh,Rh,Ni,Ni,Ni,Ni,Ni,Ni,Ni],jS=[yn,Sg,yg,bg,uc,yn,yn,yn],XS=[Cn,rh,fh,mh,wh,Cn,Cn,Cn],U0=[L0,Q5,Xu,Vu,bu,Au,lu,Z2,$2,N2,v2,u2,Z1,z1,l1,Zl,ba,al,ll,im,Vd,Wd,rm,Gp,jd,tp,Wp,od,ld,cd,jh,Zh,ed,E6,xa,ya,gm,O0,Sm,AS,SS,Ap,Cp,L0,L0,L0,L0,L0,L0,L0,L0,L0,L0,L0,L0,L0,L0,L0,L0,L0,L0,L0,L0,L0],an=[di,Mm,$m,mg,gg,vg,Tg,kg,Dg,sc,fc,pd,Mg,Lg,rd,Ad,wd,Ug,qg,Yg,Zg,kS,IS,di,di,di,di,di,di,di,di,di],ZS=[$5,i5,t5,e5],JS=[Li,Aa,po,b0,$h,Bh,Vh,fS,dS,hS,Li,Li,Li,Li,Li,Li],_r=[Ki,D2,A2,l2,X1,U1,o1,Xl,Da,hd,Qh,Kh,Yh,id,s6,c6,z4,Z4,ko,mS,Nn,u5,l5,o5,s5,r5,n5,Ki,Ki,Ki,Ki,Ki],Ln=[B5,sp,r6,Cm,k6,yi,V5,dp,zs,S6,cp,Im,J4,e3,i3,mr],Vo=[lo,U5,aS,z5,lS,G5,kn,lo],Ci=[Yi,xc,Uc,Fg,Rg,gd,Sd,Bg,Vg,Qg,Kg,Yi,Yi,Yi,Yi,Yi],eA=[Tn,wg,Cg,ac,cc,Tn,Tn,Tn],On=[H0,$l,Bl,Pl,Ll,sl,Ga,qa,Ka,Ya,Ja,el,ml,gl,xl,wl,Il,El,Nl,Fl,m1,g1,x1,w1,I1,E1,F1,R1,j6,X6,Z6,jp,Op,_m,Bm,fa,hp,Na,Fa,Ra,Ma,$a,Ba,Va,u1,c1,f1,h1,H0,H0,H0,H0,H0,H0,H0,H0,H0,H0,H0,H0,H0,H0,H0,H0];return{_jpegls_encode:b6,___cxa_can_catch:sS,_free:n0,_jpegls_decode:D6,___cxa_is_pointer_type:oS,_i64Add:$0,_memmove:vn,_i64Subtract:ii,_memset:Jt,_malloc:E0,_memcpy:o0,_bitshift64Lshr:Di,_bitshift64Shl:v0,__GLOBAL__I_000101:Rd,__GLOBAL__sub_I_jpegls_cpp:Ca,__GLOBAL__sub_I_iostream_cpp:Md,runPostSets:c5,_emscripten_replace_memory:ia,stackAlloc:na,stackSave:ra,stackRestore:sa,establishStackSpace:oa,setThrew:aa,setTempRet0:la,getTempRet0:ua,dynCall_iiiiiiii:h5,dynCall_viiiii:d5,dynCall_iiiiiid:p5,dynCall_vi:m5,dynCall_vii:g5,dynCall_iiiiiii:S5,dynCall_ii:A5,dynCall_iiiiiiiiiiii:v5,dynCall_iiii:x5,dynCall_viiiiiiiiiiiiiii:w5,dynCall_viiiiii:y5,dynCall_viiiiiii:C5,dynCall_viiiiiiiiii:T5,dynCall_iii:I5,dynCall_iiiiii:E5,dynCall_diii:k5,dynCall_i:D5,dynCall_iiiii:b5,dynCall_viii:N5,dynCall_v:F5,dynCall_iiiiiiiii:R5,dynCall_iiiiid:M5,dynCall_viiii:_5}}(Module.asmGlobalArg,Module.asmLibraryArg,buffer);Module._jpegls_encode=asm._jpegls_encode,Module.___cxa_can_catch=asm.___cxa_can_catch;var _free=Module._free=asm._free;Module._jpegls_decode=asm._jpegls_decode,Module.___cxa_is_pointer_type=asm.___cxa_is_pointer_type;var _i64Add=Module._i64Add=asm._i64Add,_memmove=Module._memmove=asm._memmove,_i64Subtract=Module._i64Subtract=asm._i64Subtract,_memset=Module._memset=asm._memset,_malloc=Module._malloc=asm._malloc,_memcpy=Module._memcpy=asm._memcpy,_emscripten_replace_memory=Module._emscripten_replace_memory=asm._emscripten_replace_memory;Module.runPostSets=asm.runPostSets,Module.__GLOBAL__sub_I_iostream_cpp=asm.__GLOBAL__sub_I_iostream_cpp;var _bitshift64Lshr=Module._bitshift64Lshr=asm._bitshift64Lshr,__GLOBAL__sub_I_jpegls_cpp=Module.__GLOBAL__sub_I_jpegls_cpp=asm.__GLOBAL__sub_I_jpegls_cpp,__GLOBAL__I_000101=Module.__GLOBAL__I_000101=asm.__GLOBAL__I_000101,_bitshift64Shl=Module._bitshift64Shl=asm._bitshift64Shl;Module.dynCall_iiiiiiii=asm.dynCall_iiiiiiii,Module.dynCall_viiiii=asm.dynCall_viiiii,Module.dynCall_iiiiiid=asm.dynCall_iiiiiid,Module.dynCall_vi=asm.dynCall_vi,Module.dynCall_vii=asm.dynCall_vii,Module.dynCall_iiiiiii=asm.dynCall_iiiiiii,Module.dynCall_ii=asm.dynCall_ii,Module.dynCall_iiiiiiiiiiii=asm.dynCall_iiiiiiiiiiii,Module.dynCall_iiii=asm.dynCall_iiii,Module.dynCall_viiiiiiiiiiiiiii=asm.dynCall_viiiiiiiiiiiiiii,Module.dynCall_viiiiii=asm.dynCall_viiiiii,Module.dynCall_viiiiiii=asm.dynCall_viiiiiii,Module.dynCall_viiiiiiiiii=asm.dynCall_viiiiiiiiii,Module.dynCall_iii=asm.dynCall_iii,Module.dynCall_iiiiii=asm.dynCall_iiiiii,Module.dynCall_diii=asm.dynCall_diii,Module.dynCall_i=asm.dynCall_i,Module.dynCall_iiiii=asm.dynCall_iiiii,Module.dynCall_viii=asm.dynCall_viii,Module.dynCall_v=asm.dynCall_v,Module.dynCall_iiiiiiiii=asm.dynCall_iiiiiiiii,Module.dynCall_iiiiid=asm.dynCall_iiiiid,Module.dynCall_viiii=asm.dynCall_viiii,Runtime.stackAlloc=asm.stackAlloc,Runtime.stackSave=asm.stackSave,Runtime.stackRestore=asm.stackRestore,Runtime.establishStackSpace=asm.establishStackSpace,Runtime.setTempRet0=asm.setTempRet0,Runtime.getTempRet0=asm.getTempRet0;function ExitStatus(a){this.name="ExitStatus",this.message="Program terminated with exit("+a+")",this.status=a}ExitStatus.prototype=new Error,ExitStatus.prototype.constructor=ExitStatus;var initialStackTop;dependenciesFulfilled=function a(){Module.calledRun||run(),Module.calledRun||(dependenciesFulfilled=a)},Module.callMain=Module.callMain=function a(n){assert(runDependencies==0,"cannot call main when async dependencies remain! (listen on __ATMAIN__)"),assert(__ATPRERUN__.length==0,"cannot call main when preRun functions remain to be called"),n=n||[],ensureInitRuntime();var s=n.length+1;function u(){for(var v=0;v<3;v++)f.push(0)}var f=[allocate(intArrayFromString(Module.thisProgram),"i8",ALLOC_NORMAL)];u();for(var m=0;m0||(preRun(),runDependencies>0)||Module.calledRun)return;function n(){Module.calledRun||(Module.calledRun=!0,!ABORT&&(ensureInitRuntime(),preMain(),Module.onRuntimeInitialized&&Module.onRuntimeInitialized(),Module._main&&shouldRunNow&&Module.callMain(a),postRun()))}Module.setStatus?(Module.setStatus("Running..."),setTimeout(function(){setTimeout(function(){Module.setStatus("")},1),n()},1)):n()}Module.run=Module.run=run;function exit(a,n){if(!(n&&Module.noExitRuntime))throw Module.noExitRuntime||(ABORT=!0,STACKTOP=initialStackTop,exitRuntime(),Module.onExit&&Module.onExit(a)),ENVIRONMENT_IS_NODE?(process.stdout.once("drain",function(){process.exit(a)}),console.log(" "),setTimeout(function(){process.exit(a)},500)):ENVIRONMENT_IS_SHELL&&typeof quit=="function"&&quit(a),new ExitStatus(a)}Module.exit=Module.exit=exit;var abortDecorators=[];function abort(a){a!==void 0?(Module.print(a),Module.printErr(a),a=JSON.stringify(a)):a="",ABORT=!0;var n=` -If this abort() is unexpected, build with -s ASSERTIONS=1 which can give more information.`,s="abort("+a+") at "+stackTrace()+n;throw abortDecorators&&abortDecorators.forEach(function(u){s=u(s,a)}),s}if(Module.abort=Module.abort=abort,Module.preInit)for(typeof Module.preInit=="function"&&(Module.preInit=[Module.preInit]);Module.preInit.length>0;)Module.preInit.pop()();var shouldRunNow=!0;return Module.noInitialRun&&(shouldRunNow=!1),run(),Module};module.exports&&(module.exports=CharLS)}(charLSDynamicMemoryBrowser)),charLSDynamicMemoryBrowser.exports}var hasRequiredJpegLs;function requireJpegLs(){return hasRequiredJpegLs||(hasRequiredJpegLs=1,function(a){var n=n||(typeof commonjsRequire<"u"?requireCharLSDynamicMemoryBrowser():null),s=function(){var u;function f(){}f.prototype={decodeJPEGLS:function(y,T){return v(y,T)}};function m(y,T){var E=u._malloc(y.length);u.writeArrayToMemory(y,E);var S=u._malloc(4),I=u._malloc(4),e=u._malloc(4),F=u._malloc(4),M=u._malloc(4),L=u._malloc(4),V=u._malloc(4),B=u._malloc(4),z=u._malloc(4),b=u.ccall("jpegls_decode","number",["number","number","number","number","number","number","number","number","number","number","number"],[E,y.length,S,I,e,F,M,L,B,V,z]),W={result:b,width:u.getValue(e,"i32"),height:u.getValue(F,"i32"),bitsPerSample:u.getValue(M,"i32"),stride:u.getValue(L,"i32"),components:u.getValue(B,"i32"),allowedLossyError:u.getValue(V,"i32"),interleaveMode:u.getValue(z,"i32"),pixelData:void 0},q=u.getValue(S,"*");return W.bitsPerSample<=8?(W.pixelData=new Uint8Array(W.width*W.height*W.components),W.pixelData.set(new Uint8Array(u.HEAP8.buffer,q,W.pixelData.length))):T?(W.pixelData=new Int16Array(W.width*W.height*W.components),W.pixelData.set(new Int16Array(u.HEAP16.buffer,q,W.pixelData.length))):(W.pixelData=new Uint16Array(W.width*W.height*W.components),W.pixelData.set(new Uint16Array(u.HEAP16.buffer,q,W.pixelData.length))),u._free(E),u._free(q),u._free(S),u._free(I),u._free(e),u._free(F),u._free(M),u._free(L),u._free(B),u._free(z),W}function A(){if(typeof n>"u")throw"No JPEG-LS decoder loaded";if(!u&&(u=n(),!u||!u._jpegls_decode))throw"JPEG-LS failed to initialize"}function v(y,T){A();var E=m(y,T);if(E.result!==0&&E.result!==6)throw"JPEG-LS decoder failed to decode frame (error code "+E.result+")";var S={};return S.columns=E.width,S.rows=E.height,S.pixelData=E.pixelData,S}return f}();a.exports&&(a.exports=s)}(jpegLs)),jpegLs.exports}var parser={exports:{}},pako={},deflate$1={},deflate={},trees={},hasRequiredTrees;function requireTrees(){if(hasRequiredTrees)return trees;hasRequiredTrees=1;const a=4,n=0,s=1,u=2;function f(ee){let Be=ee.length;for(;--Be>=0;)ee[Be]=0}const m=0,A=1,v=2,y=3,T=258,E=29,S=256,I=S+1+E,e=30,F=19,M=2*I+1,L=15,V=16,B=7,z=256,b=16,W=17,q=18,Y=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),X=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),H=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),g=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),J=512,re=new Array((I+2)*2);f(re);const ae=new Array(e*2);f(ae);const fe=new Array(J);f(fe);const pe=new Array(T-y+1);f(pe);const me=new Array(E);f(me);const Se=new Array(e);f(Se);function ve(ee,Be,st,Ke,ft){this.static_tree=ee,this.extra_bits=Be,this.extra_base=st,this.elems=Ke,this.max_length=ft,this.has_stree=ee&&ee.length}let we,Ne,De;function je(ee,Be){this.dyn_tree=ee,this.max_code=0,this.stat_desc=Be}const nt=ee=>ee<256?fe[ee]:fe[256+(ee>>>7)],Ue=(ee,Be)=>{ee.pending_buf[ee.pending++]=Be&255,ee.pending_buf[ee.pending++]=Be>>>8&255},ye=(ee,Be,st)=>{ee.bi_valid>V-st?(ee.bi_buf|=Be<>V-ee.bi_valid,ee.bi_valid+=st-V):(ee.bi_buf|=Be<{ye(ee,st[Be*2],st[Be*2+1])},pt=(ee,Be)=>{let st=0;do st|=ee&1,ee>>>=1,st<<=1;while(--Be>0);return st>>>1},It=ee=>{ee.bi_valid===16?(Ue(ee,ee.bi_buf),ee.bi_buf=0,ee.bi_valid=0):ee.bi_valid>=8&&(ee.pending_buf[ee.pending++]=ee.bi_buf&255,ee.bi_buf>>=8,ee.bi_valid-=8)},Lt=(ee,Be)=>{const st=Be.dyn_tree,Ke=Be.max_code,ft=Be.stat_desc.static_tree,vt=Be.stat_desc.has_stree,Re=Be.stat_desc.extra_bits,Ye=Be.stat_desc.extra_base,ue=Be.stat_desc.max_length;let Ae,Vt,ge,Ut,Ve,Zt,ot=0;for(Ut=0;Ut<=L;Ut++)ee.bl_count[Ut]=0;for(st[ee.heap[ee.heap_max]*2+1]=0,Ae=ee.heap_max+1;Aeue&&(Ut=ue,ot++),st[Vt*2+1]=Ut,!(Vt>Ke)&&(ee.bl_count[Ut]++,Ve=0,Vt>=Ye&&(Ve=Re[Vt-Ye]),Zt=st[Vt*2],ee.opt_len+=Zt*(Ut+Ve),vt&&(ee.static_len+=Zt*(ft[Vt*2+1]+Ve)));if(ot!==0){do{for(Ut=ue-1;ee.bl_count[Ut]===0;)Ut--;ee.bl_count[Ut]--,ee.bl_count[Ut+1]+=2,ee.bl_count[ue]--,ot-=2}while(ot>0);for(Ut=ue;Ut!==0;Ut--)for(Vt=ee.bl_count[Ut];Vt!==0;)ge=ee.heap[--Ae],!(ge>Ke)&&(st[ge*2+1]!==Ut&&(ee.opt_len+=(Ut-st[ge*2+1])*st[ge*2],st[ge*2+1]=Ut),Vt--)}},Ot=(ee,Be,st)=>{const Ke=new Array(L+1);let ft=0,vt,Re;for(vt=1;vt<=L;vt++)ft=ft+st[vt-1]<<1,Ke[vt]=ft;for(Re=0;Re<=Be;Re++){let Ye=ee[Re*2+1];Ye!==0&&(ee[Re*2]=pt(Ke[Ye]++,Ye))}},Et=()=>{let ee,Be,st,Ke,ft;const vt=new Array(L+1);for(st=0,Ke=0;Ke>=7;Ke{let Be;for(Be=0;Be{ee.bi_valid>8?Ue(ee,ee.bi_buf):ee.bi_valid>0&&(ee.pending_buf[ee.pending++]=ee.bi_buf),ee.bi_buf=0,ee.bi_valid=0},Me=(ee,Be,st,Ke)=>{const ft=Be*2,vt=st*2;return ee[ft]{const Ke=ee.heap[st];let ft=st<<1;for(;ft<=ee.heap_len&&(ft{let Ke,ft,vt=0,Re,Ye;if(ee.sym_next!==0)do Ke=ee.pending_buf[ee.sym_buf+vt++]&255,Ke+=(ee.pending_buf[ee.sym_buf+vt++]&255)<<8,ft=ee.pending_buf[ee.sym_buf+vt++],Ke===0?ut(ee,ft,Be):(Re=pe[ft],ut(ee,Re+S+1,Be),Ye=Y[Re],Ye!==0&&(ft-=me[Re],ye(ee,ft,Ye)),Ke--,Re=nt(Ke),ut(ee,Re,st),Ye=X[Re],Ye!==0&&(Ke-=Se[Re],ye(ee,Ke,Ye)));while(vt{const st=Be.dyn_tree,Ke=Be.stat_desc.static_tree,ft=Be.stat_desc.has_stree,vt=Be.stat_desc.elems;let Re,Ye,ue=-1,Ae;for(ee.heap_len=0,ee.heap_max=M,Re=0;Re>1;Re>=1;Re--)Qe(ee,st,Re);Ae=vt;do Re=ee.heap[1],ee.heap[1]=ee.heap[ee.heap_len--],Qe(ee,st,1),Ye=ee.heap[1],ee.heap[--ee.heap_max]=Re,ee.heap[--ee.heap_max]=Ye,st[Ae*2]=st[Re*2]+st[Ye*2],ee.depth[Ae]=(ee.depth[Re]>=ee.depth[Ye]?ee.depth[Re]:ee.depth[Ye])+1,st[Re*2+1]=st[Ye*2+1]=Ae,ee.heap[1]=Ae++,Qe(ee,st,1);while(ee.heap_len>=2);ee.heap[--ee.heap_max]=ee.heap[1],Lt(ee,Be),Ot(st,ue,ee.bl_count)},at=(ee,Be,st)=>{let Ke,ft=-1,vt,Re=Be[0*2+1],Ye=0,ue=7,Ae=4;for(Re===0&&(ue=138,Ae=3),Be[(st+1)*2+1]=65535,Ke=0;Ke<=st;Ke++)vt=Re,Re=Be[(Ke+1)*2+1],!(++Ye{let Ke,ft=-1,vt,Re=Be[0*2+1],Ye=0,ue=7,Ae=4;for(Re===0&&(ue=138,Ae=3),Ke=0;Ke<=st;Ke++)if(vt=Re,Re=Be[(Ke+1)*2+1],!(++Ye{let Be;for(at(ee,ee.dyn_ltree,ee.l_desc.max_code),at(ee,ee.dyn_dtree,ee.d_desc.max_code),Fe(ee,ee.bl_desc),Be=F-1;Be>=3&&ee.bl_tree[g[Be]*2+1]===0;Be--);return ee.opt_len+=3*(Be+1)+5+5+4,Be},qe=(ee,Be,st,Ke)=>{let ft;for(ye(ee,Be-257,5),ye(ee,st-1,5),ye(ee,Ke-4,4),ft=0;ft{let Be=4093624447,st;for(st=0;st<=31;st++,Be>>>=1)if(Be&1&&ee.dyn_ltree[st*2]!==0)return n;if(ee.dyn_ltree[9*2]!==0||ee.dyn_ltree[10*2]!==0||ee.dyn_ltree[13*2]!==0)return s;for(st=32;st{Je||(Et(),Je=!0),ee.l_desc=new je(ee.dyn_ltree,we),ee.d_desc=new je(ee.dyn_dtree,Ne),ee.bl_desc=new je(ee.bl_tree,De),ee.bi_buf=0,ee.bi_valid=0,Rt(ee)},Ge=(ee,Be,st,Ke)=>{ye(ee,(m<<1)+(Ke?1:0),3),Ze(ee),Ue(ee,st),Ue(ee,~st),st&&ee.pending_buf.set(ee.window.subarray(Be,Be+st),ee.pending),ee.pending+=st},xt=ee=>{ye(ee,A<<1,3),ut(ee,z,re),It(ee)},He=(ee,Be,st,Ke)=>{let ft,vt,Re=0;ee.level>0?(ee.strm.data_type===u&&(ee.strm.data_type=_e(ee)),Fe(ee,ee.l_desc),Fe(ee,ee.d_desc),Re=Le(ee),ft=ee.opt_len+3+7>>>3,vt=ee.static_len+3+7>>>3,vt<=ft&&(ft=vt)):ft=vt=st+5,st+4<=ft&&Be!==-1?Ge(ee,Be,st,Ke):ee.strategy===a||vt===ft?(ye(ee,(A<<1)+(Ke?1:0),3),Ie(ee,re,ae)):(ye(ee,(v<<1)+(Ke?1:0),3),qe(ee,ee.l_desc.max_code+1,ee.d_desc.max_code+1,Re+1),Ie(ee,ee.dyn_ltree,ee.dyn_dtree)),Rt(ee),Ke&&Ze(ee)},rt=(ee,Be,st)=>(ee.pending_buf[ee.sym_buf+ee.sym_next++]=Be,ee.pending_buf[ee.sym_buf+ee.sym_next++]=Be>>8,ee.pending_buf[ee.sym_buf+ee.sym_next++]=st,Be===0?ee.dyn_ltree[st*2]++:(ee.matches++,Be--,ee.dyn_ltree[(pe[st]+S+1)*2]++,ee.dyn_dtree[nt(Be)*2]++),ee.sym_next===ee.sym_end);return trees._tr_init=We,trees._tr_stored_block=Ge,trees._tr_flush_block=He,trees._tr_tally=rt,trees._tr_align=xt,trees}var adler32_1,hasRequiredAdler32;function requireAdler32(){return hasRequiredAdler32||(hasRequiredAdler32=1,adler32_1=(n,s,u,f)=>{let m=n&65535|0,A=n>>>16&65535|0,v=0;for(;u!==0;){v=u>2e3?2e3:u,u-=v;do m=m+s[f++]|0,A=A+m|0;while(--v);m%=65521,A%=65521}return m|A<<16|0}),adler32_1}var crc32_1,hasRequiredCrc32;function requireCrc32(){if(hasRequiredCrc32)return crc32_1;hasRequiredCrc32=1;const a=()=>{let u,f=[];for(var m=0;m<256;m++){u=m;for(var A=0;A<8;A++)u=u&1?3988292384^u>>>1:u>>>1;f[m]=u}return f},n=new Uint32Array(a());return crc32_1=(u,f,m,A)=>{const v=n,y=A+m;u^=-1;for(let T=A;T>>8^v[(u^f[T])&255];return u^-1},crc32_1}var messages,hasRequiredMessages;function requireMessages(){return hasRequiredMessages||(hasRequiredMessages=1,messages={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}),messages}var constants,hasRequiredConstants;function requireConstants(){return hasRequiredConstants||(hasRequiredConstants=1,constants={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}),constants}var hasRequiredDeflate$1;function requireDeflate$1(){if(hasRequiredDeflate$1)return deflate;hasRequiredDeflate$1=1;const{_tr_init:a,_tr_stored_block:n,_tr_flush_block:s,_tr_tally:u,_tr_align:f}=requireTrees(),m=requireAdler32(),A=requireCrc32(),v=requireMessages(),{Z_NO_FLUSH:y,Z_PARTIAL_FLUSH:T,Z_FULL_FLUSH:E,Z_FINISH:S,Z_BLOCK:I,Z_OK:e,Z_STREAM_END:F,Z_STREAM_ERROR:M,Z_DATA_ERROR:L,Z_BUF_ERROR:V,Z_DEFAULT_COMPRESSION:B,Z_FILTERED:z,Z_HUFFMAN_ONLY:b,Z_RLE:W,Z_FIXED:q,Z_DEFAULT_STRATEGY:Y,Z_UNKNOWN:X,Z_DEFLATED:H}=requireConstants(),g=9,J=15,re=8,pe=256+1+29,me=30,Se=19,ve=2*pe+1,we=15,Ne=3,De=258,je=De+Ne+1,nt=32,Ue=42,ye=57,ut=69,pt=73,It=91,Lt=103,Ot=113,Et=666,Rt=1,Ze=2,Me=3,Qe=4,Ie=3,Fe=(se,lt)=>(se.msg=v[lt],lt),at=se=>se*2-(se>4?9:0),ze=se=>{let lt=se.length;for(;--lt>=0;)se[lt]=0},Le=se=>{let lt,Ce,Pe,xe=se.w_size;lt=se.hash_size,Pe=lt;do Ce=se.head[--Pe],se.head[Pe]=Ce>=xe?Ce-xe:0;while(--lt);lt=xe,Pe=lt;do Ce=se.prev[--Pe],se.prev[Pe]=Ce>=xe?Ce-xe:0;while(--lt)};let _e=(se,lt,Ce)=>(lt<{const lt=se.state;let Ce=lt.pending;Ce>se.avail_out&&(Ce=se.avail_out),Ce!==0&&(se.output.set(lt.pending_buf.subarray(lt.pending_out,lt.pending_out+Ce),se.next_out),se.next_out+=Ce,lt.pending_out+=Ce,se.total_out+=Ce,se.avail_out-=Ce,lt.pending-=Ce,lt.pending===0&&(lt.pending_out=0))},We=(se,lt)=>{s(se,se.block_start>=0?se.block_start:-1,se.strstart-se.block_start,lt),se.block_start=se.strstart,Je(se.strm)},Ge=(se,lt)=>{se.pending_buf[se.pending++]=lt},xt=(se,lt)=>{se.pending_buf[se.pending++]=lt>>>8&255,se.pending_buf[se.pending++]=lt&255},He=(se,lt,Ce,Pe)=>{let xe=se.avail_in;return xe>Pe&&(xe=Pe),xe===0?0:(se.avail_in-=xe,lt.set(se.input.subarray(se.next_in,se.next_in+xe),Ce),se.state.wrap===1?se.adler=m(se.adler,lt,xe,Ce):se.state.wrap===2&&(se.adler=A(se.adler,lt,xe,Ce)),se.next_in+=xe,se.total_in+=xe,xe)},rt=(se,lt)=>{let Ce=se.max_chain_length,Pe=se.strstart,xe,Nt,Xt=se.prev_length,Wt=se.nice_match;const $e=se.strstart>se.w_size-je?se.strstart-(se.w_size-je):0,p0=se.window,R0=se.w_mask,Q0=se.prev,M0=se.strstart+De;let ni=p0[Pe+Xt-1],St=p0[Pe+Xt];se.prev_length>=se.good_match&&(Ce>>=2),Wt>se.lookahead&&(Wt=se.lookahead);do if(xe=lt,!(p0[xe+Xt]!==St||p0[xe+Xt-1]!==ni||p0[xe]!==p0[Pe]||p0[++xe]!==p0[Pe+1])){Pe+=2,xe++;do;while(p0[++Pe]===p0[++xe]&&p0[++Pe]===p0[++xe]&&p0[++Pe]===p0[++xe]&&p0[++Pe]===p0[++xe]&&p0[++Pe]===p0[++xe]&&p0[++Pe]===p0[++xe]&&p0[++Pe]===p0[++xe]&&p0[++Pe]===p0[++xe]&&PeXt){if(se.match_start=lt,Xt=Nt,Nt>=Wt)break;ni=p0[Pe+Xt-1],St=p0[Pe+Xt]}}while((lt=Q0[lt&R0])>$e&&--Ce!==0);return Xt<=se.lookahead?Xt:se.lookahead},ee=se=>{const lt=se.w_size;let Ce,Pe,xe;do{if(Pe=se.window_size-se.lookahead-se.strstart,se.strstart>=lt+(lt-je)&&(se.window.set(se.window.subarray(lt,lt+lt-Pe),0),se.match_start-=lt,se.strstart-=lt,se.block_start-=lt,se.insert>se.strstart&&(se.insert=se.strstart),Le(se),Pe+=lt),se.strm.avail_in===0)break;if(Ce=He(se.strm,se.window,se.strstart+se.lookahead,Pe),se.lookahead+=Ce,se.lookahead+se.insert>=Ne)for(xe=se.strstart-se.insert,se.ins_h=se.window[xe],se.ins_h=_e(se,se.ins_h,se.window[xe+1]);se.insert&&(se.ins_h=_e(se,se.ins_h,se.window[xe+Ne-1]),se.prev[xe&se.w_mask]=se.head[se.ins_h],se.head[se.ins_h]=xe,xe++,se.insert--,!(se.lookahead+se.insert{let Ce=se.pending_buf_size-5>se.w_size?se.w_size:se.pending_buf_size-5,Pe,xe,Nt,Xt=0,Wt=se.strm.avail_in;do{if(Pe=65535,Nt=se.bi_valid+42>>3,se.strm.avail_outxe+se.strm.avail_in&&(Pe=xe+se.strm.avail_in),Pe>Nt&&(Pe=Nt),Pe>8,se.pending_buf[se.pending-2]=~Pe,se.pending_buf[se.pending-1]=~Pe>>8,Je(se.strm),xe&&(xe>Pe&&(xe=Pe),se.strm.output.set(se.window.subarray(se.block_start,se.block_start+xe),se.strm.next_out),se.strm.next_out+=xe,se.strm.avail_out-=xe,se.strm.total_out+=xe,se.block_start+=xe,Pe-=xe),Pe&&(He(se.strm,se.strm.output,se.strm.next_out,Pe),se.strm.next_out+=Pe,se.strm.avail_out-=Pe,se.strm.total_out+=Pe)}while(Xt===0);return Wt-=se.strm.avail_in,Wt&&(Wt>=se.w_size?(se.matches=2,se.window.set(se.strm.input.subarray(se.strm.next_in-se.w_size,se.strm.next_in),0),se.strstart=se.w_size,se.insert=se.strstart):(se.window_size-se.strstart<=Wt&&(se.strstart-=se.w_size,se.window.set(se.window.subarray(se.w_size,se.w_size+se.strstart),0),se.matches<2&&se.matches++,se.insert>se.strstart&&(se.insert=se.strstart)),se.window.set(se.strm.input.subarray(se.strm.next_in-Wt,se.strm.next_in),se.strstart),se.strstart+=Wt,se.insert+=Wt>se.w_size-se.insert?se.w_size-se.insert:Wt),se.block_start=se.strstart),se.high_waterNt&&se.block_start>=se.w_size&&(se.block_start-=se.w_size,se.strstart-=se.w_size,se.window.set(se.window.subarray(se.w_size,se.w_size+se.strstart),0),se.matches<2&&se.matches++,Nt+=se.w_size,se.insert>se.strstart&&(se.insert=se.strstart)),Nt>se.strm.avail_in&&(Nt=se.strm.avail_in),Nt&&(He(se.strm,se.window,se.strstart,Nt),se.strstart+=Nt,se.insert+=Nt>se.w_size-se.insert?se.w_size-se.insert:Nt),se.high_water>3,Nt=se.pending_buf_size-Nt>65535?65535:se.pending_buf_size-Nt,Ce=Nt>se.w_size?se.w_size:Nt,xe=se.strstart-se.block_start,(xe>=Ce||(xe||lt===S)&<!==y&&se.strm.avail_in===0&&xe<=Nt)&&(Pe=xe>Nt?Nt:xe,Xt=lt===S&&se.strm.avail_in===0&&Pe===xe?1:0,n(se,se.block_start,Pe,Xt),se.block_start+=Pe,Je(se.strm)),Xt?Me:Rt)},st=(se,lt)=>{let Ce,Pe;for(;;){if(se.lookahead=Ne&&(se.ins_h=_e(se,se.ins_h,se.window[se.strstart+Ne-1]),Ce=se.prev[se.strstart&se.w_mask]=se.head[se.ins_h],se.head[se.ins_h]=se.strstart),Ce!==0&&se.strstart-Ce<=se.w_size-je&&(se.match_length=rt(se,Ce)),se.match_length>=Ne)if(Pe=u(se,se.strstart-se.match_start,se.match_length-Ne),se.lookahead-=se.match_length,se.match_length<=se.max_lazy_match&&se.lookahead>=Ne){se.match_length--;do se.strstart++,se.ins_h=_e(se,se.ins_h,se.window[se.strstart+Ne-1]),Ce=se.prev[se.strstart&se.w_mask]=se.head[se.ins_h],se.head[se.ins_h]=se.strstart;while(--se.match_length!==0);se.strstart++}else se.strstart+=se.match_length,se.match_length=0,se.ins_h=se.window[se.strstart],se.ins_h=_e(se,se.ins_h,se.window[se.strstart+1]);else Pe=u(se,0,se.window[se.strstart]),se.lookahead--,se.strstart++;if(Pe&&(We(se,!1),se.strm.avail_out===0))return Rt}return se.insert=se.strstart{let Ce,Pe,xe;for(;;){if(se.lookahead=Ne&&(se.ins_h=_e(se,se.ins_h,se.window[se.strstart+Ne-1]),Ce=se.prev[se.strstart&se.w_mask]=se.head[se.ins_h],se.head[se.ins_h]=se.strstart),se.prev_length=se.match_length,se.prev_match=se.match_start,se.match_length=Ne-1,Ce!==0&&se.prev_length4096)&&(se.match_length=Ne-1)),se.prev_length>=Ne&&se.match_length<=se.prev_length){xe=se.strstart+se.lookahead-Ne,Pe=u(se,se.strstart-1-se.prev_match,se.prev_length-Ne),se.lookahead-=se.prev_length-1,se.prev_length-=2;do++se.strstart<=xe&&(se.ins_h=_e(se,se.ins_h,se.window[se.strstart+Ne-1]),Ce=se.prev[se.strstart&se.w_mask]=se.head[se.ins_h],se.head[se.ins_h]=se.strstart);while(--se.prev_length!==0);if(se.match_available=0,se.match_length=Ne-1,se.strstart++,Pe&&(We(se,!1),se.strm.avail_out===0))return Rt}else if(se.match_available){if(Pe=u(se,0,se.window[se.strstart-1]),Pe&&We(se,!1),se.strstart++,se.lookahead--,se.strm.avail_out===0)return Rt}else se.match_available=1,se.strstart++,se.lookahead--}return se.match_available&&(Pe=u(se,0,se.window[se.strstart-1]),se.match_available=0),se.insert=se.strstart{let Ce,Pe,xe,Nt;const Xt=se.window;for(;;){if(se.lookahead<=De){if(ee(se),se.lookahead<=De&<===y)return Rt;if(se.lookahead===0)break}if(se.match_length=0,se.lookahead>=Ne&&se.strstart>0&&(xe=se.strstart-1,Pe=Xt[xe],Pe===Xt[++xe]&&Pe===Xt[++xe]&&Pe===Xt[++xe])){Nt=se.strstart+De;do;while(Pe===Xt[++xe]&&Pe===Xt[++xe]&&Pe===Xt[++xe]&&Pe===Xt[++xe]&&Pe===Xt[++xe]&&Pe===Xt[++xe]&&Pe===Xt[++xe]&&Pe===Xt[++xe]&&xese.lookahead&&(se.match_length=se.lookahead)}if(se.match_length>=Ne?(Ce=u(se,1,se.match_length-Ne),se.lookahead-=se.match_length,se.strstart+=se.match_length,se.match_length=0):(Ce=u(se,0,se.window[se.strstart]),se.lookahead--,se.strstart++),Ce&&(We(se,!1),se.strm.avail_out===0))return Rt}return se.insert=0,lt===S?(We(se,!0),se.strm.avail_out===0?Me:Qe):se.sym_next&&(We(se,!1),se.strm.avail_out===0)?Rt:Ze},vt=(se,lt)=>{let Ce;for(;;){if(se.lookahead===0&&(ee(se),se.lookahead===0)){if(lt===y)return Rt;break}if(se.match_length=0,Ce=u(se,0,se.window[se.strstart]),se.lookahead--,se.strstart++,Ce&&(We(se,!1),se.strm.avail_out===0))return Rt}return se.insert=0,lt===S?(We(se,!0),se.strm.avail_out===0?Me:Qe):se.sym_next&&(We(se,!1),se.strm.avail_out===0)?Rt:Ze};function Re(se,lt,Ce,Pe,xe){this.good_length=se,this.max_lazy=lt,this.nice_length=Ce,this.max_chain=Pe,this.func=xe}const Ye=[new Re(0,0,0,0,Be),new Re(4,4,8,4,st),new Re(4,5,16,8,st),new Re(4,6,32,32,st),new Re(4,4,16,16,Ke),new Re(8,16,32,32,Ke),new Re(8,16,128,128,Ke),new Re(8,32,128,256,Ke),new Re(32,128,258,1024,Ke),new Re(32,258,258,4096,Ke)],ue=se=>{se.window_size=2*se.w_size,ze(se.head),se.max_lazy_match=Ye[se.level].max_lazy,se.good_match=Ye[se.level].good_length,se.nice_match=Ye[se.level].nice_length,se.max_chain_length=Ye[se.level].max_chain,se.strstart=0,se.block_start=0,se.lookahead=0,se.insert=0,se.match_length=se.prev_length=Ne-1,se.match_available=0,se.ins_h=0};function Ae(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=H,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(ve*2),this.dyn_dtree=new Uint16Array((2*me+1)*2),this.bl_tree=new Uint16Array((2*Se+1)*2),ze(this.dyn_ltree),ze(this.dyn_dtree),ze(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(we+1),this.heap=new Uint16Array(2*pe+1),ze(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*pe+1),ze(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const Vt=se=>{if(!se)return 1;const lt=se.state;return!lt||lt.strm!==se||lt.status!==Ue&<.status!==ye&<.status!==ut&<.status!==pt&<.status!==It&<.status!==Lt&<.status!==Ot&<.status!==Et?1:0},ge=se=>{if(Vt(se))return Fe(se,M);se.total_in=se.total_out=0,se.data_type=X;const lt=se.state;return lt.pending=0,lt.pending_out=0,lt.wrap<0&&(lt.wrap=-lt.wrap),lt.status=lt.wrap===2?ye:lt.wrap?Ue:Ot,se.adler=lt.wrap===2?0:1,lt.last_flush=-2,a(lt),e},Ut=se=>{const lt=ge(se);return lt===e&&ue(se.state),lt},Ve=(se,lt)=>Vt(se)||se.state.wrap!==2?M:(se.state.gzhead=lt,e),Zt=(se,lt,Ce,Pe,xe,Nt)=>{if(!se)return M;let Xt=1;if(lt===B&&(lt=6),Pe<0?(Xt=0,Pe=-Pe):Pe>15&&(Xt=2,Pe-=16),xe<1||xe>g||Ce!==H||Pe<8||Pe>15||lt<0||lt>9||Nt<0||Nt>q||Pe===8&&Xt!==1)return Fe(se,M);Pe===8&&(Pe=9);const Wt=new Ae;return se.state=Wt,Wt.strm=se,Wt.status=Ue,Wt.wrap=Xt,Wt.gzhead=null,Wt.w_bits=Pe,Wt.w_size=1<Zt(se,lt,H,J,re,Y),ht=(se,lt)=>{if(Vt(se)||lt>I||lt<0)return se?Fe(se,M):M;const Ce=se.state;if(!se.output||se.avail_in!==0&&!se.input||Ce.status===Et&<!==S)return Fe(se,se.avail_out===0?V:M);const Pe=Ce.last_flush;if(Ce.last_flush=lt,Ce.pending!==0){if(Je(se),se.avail_out===0)return Ce.last_flush=-1,e}else if(se.avail_in===0&&at(lt)<=at(Pe)&<!==S)return Fe(se,V);if(Ce.status===Et&&se.avail_in!==0)return Fe(se,V);if(Ce.status===Ue&&Ce.wrap===0&&(Ce.status=Ot),Ce.status===Ue){let xe=H+(Ce.w_bits-8<<4)<<8,Nt=-1;if(Ce.strategy>=b||Ce.level<2?Nt=0:Ce.level<6?Nt=1:Ce.level===6?Nt=2:Nt=3,xe|=Nt<<6,Ce.strstart!==0&&(xe|=nt),xe+=31-xe%31,xt(Ce,xe),Ce.strstart!==0&&(xt(Ce,se.adler>>>16),xt(Ce,se.adler&65535)),se.adler=1,Ce.status=Ot,Je(se),Ce.pending!==0)return Ce.last_flush=-1,e}if(Ce.status===ye){if(se.adler=0,Ge(Ce,31),Ge(Ce,139),Ge(Ce,8),Ce.gzhead)Ge(Ce,(Ce.gzhead.text?1:0)+(Ce.gzhead.hcrc?2:0)+(Ce.gzhead.extra?4:0)+(Ce.gzhead.name?8:0)+(Ce.gzhead.comment?16:0)),Ge(Ce,Ce.gzhead.time&255),Ge(Ce,Ce.gzhead.time>>8&255),Ge(Ce,Ce.gzhead.time>>16&255),Ge(Ce,Ce.gzhead.time>>24&255),Ge(Ce,Ce.level===9?2:Ce.strategy>=b||Ce.level<2?4:0),Ge(Ce,Ce.gzhead.os&255),Ce.gzhead.extra&&Ce.gzhead.extra.length&&(Ge(Ce,Ce.gzhead.extra.length&255),Ge(Ce,Ce.gzhead.extra.length>>8&255)),Ce.gzhead.hcrc&&(se.adler=A(se.adler,Ce.pending_buf,Ce.pending,0)),Ce.gzindex=0,Ce.status=ut;else if(Ge(Ce,0),Ge(Ce,0),Ge(Ce,0),Ge(Ce,0),Ge(Ce,0),Ge(Ce,Ce.level===9?2:Ce.strategy>=b||Ce.level<2?4:0),Ge(Ce,Ie),Ce.status=Ot,Je(se),Ce.pending!==0)return Ce.last_flush=-1,e}if(Ce.status===ut){if(Ce.gzhead.extra){let xe=Ce.pending,Nt=(Ce.gzhead.extra.length&65535)-Ce.gzindex;for(;Ce.pending+Nt>Ce.pending_buf_size;){let Wt=Ce.pending_buf_size-Ce.pending;if(Ce.pending_buf.set(Ce.gzhead.extra.subarray(Ce.gzindex,Ce.gzindex+Wt),Ce.pending),Ce.pending=Ce.pending_buf_size,Ce.gzhead.hcrc&&Ce.pending>xe&&(se.adler=A(se.adler,Ce.pending_buf,Ce.pending-xe,xe)),Ce.gzindex+=Wt,Je(se),Ce.pending!==0)return Ce.last_flush=-1,e;xe=0,Nt-=Wt}let Xt=new Uint8Array(Ce.gzhead.extra);Ce.pending_buf.set(Xt.subarray(Ce.gzindex,Ce.gzindex+Nt),Ce.pending),Ce.pending+=Nt,Ce.gzhead.hcrc&&Ce.pending>xe&&(se.adler=A(se.adler,Ce.pending_buf,Ce.pending-xe,xe)),Ce.gzindex=0}Ce.status=pt}if(Ce.status===pt){if(Ce.gzhead.name){let xe=Ce.pending,Nt;do{if(Ce.pending===Ce.pending_buf_size){if(Ce.gzhead.hcrc&&Ce.pending>xe&&(se.adler=A(se.adler,Ce.pending_buf,Ce.pending-xe,xe)),Je(se),Ce.pending!==0)return Ce.last_flush=-1,e;xe=0}Ce.gzindexxe&&(se.adler=A(se.adler,Ce.pending_buf,Ce.pending-xe,xe)),Ce.gzindex=0}Ce.status=It}if(Ce.status===It){if(Ce.gzhead.comment){let xe=Ce.pending,Nt;do{if(Ce.pending===Ce.pending_buf_size){if(Ce.gzhead.hcrc&&Ce.pending>xe&&(se.adler=A(se.adler,Ce.pending_buf,Ce.pending-xe,xe)),Je(se),Ce.pending!==0)return Ce.last_flush=-1,e;xe=0}Ce.gzindexxe&&(se.adler=A(se.adler,Ce.pending_buf,Ce.pending-xe,xe))}Ce.status=Lt}if(Ce.status===Lt){if(Ce.gzhead.hcrc){if(Ce.pending+2>Ce.pending_buf_size&&(Je(se),Ce.pending!==0))return Ce.last_flush=-1,e;Ge(Ce,se.adler&255),Ge(Ce,se.adler>>8&255),se.adler=0}if(Ce.status=Ot,Je(se),Ce.pending!==0)return Ce.last_flush=-1,e}if(se.avail_in!==0||Ce.lookahead!==0||lt!==y&&Ce.status!==Et){let xe=Ce.level===0?Be(Ce,lt):Ce.strategy===b?vt(Ce,lt):Ce.strategy===W?ft(Ce,lt):Ye[Ce.level].func(Ce,lt);if((xe===Me||xe===Qe)&&(Ce.status=Et),xe===Rt||xe===Me)return se.avail_out===0&&(Ce.last_flush=-1),e;if(xe===Ze&&(lt===T?f(Ce):lt!==I&&(n(Ce,0,0,!1),lt===E&&(ze(Ce.head),Ce.lookahead===0&&(Ce.strstart=0,Ce.block_start=0,Ce.insert=0))),Je(se),se.avail_out===0))return Ce.last_flush=-1,e}return lt!==S?e:Ce.wrap<=0?F:(Ce.wrap===2?(Ge(Ce,se.adler&255),Ge(Ce,se.adler>>8&255),Ge(Ce,se.adler>>16&255),Ge(Ce,se.adler>>24&255),Ge(Ce,se.total_in&255),Ge(Ce,se.total_in>>8&255),Ge(Ce,se.total_in>>16&255),Ge(Ce,se.total_in>>24&255)):(xt(Ce,se.adler>>>16),xt(Ce,se.adler&65535)),Je(se),Ce.wrap>0&&(Ce.wrap=-Ce.wrap),Ce.pending!==0?e:F)},I0=se=>{if(Vt(se))return M;const lt=se.state.status;return se.state=null,lt===Ot?Fe(se,L):e},be=(se,lt)=>{let Ce=lt.length;if(Vt(se))return M;const Pe=se.state,xe=Pe.wrap;if(xe===2||xe===1&&Pe.status!==Ue||Pe.lookahead)return M;if(xe===1&&(se.adler=m(se.adler,lt,Ce,0)),Pe.wrap=0,Ce>=Pe.w_size){xe===0&&(ze(Pe.head),Pe.strstart=0,Pe.block_start=0,Pe.insert=0);let $e=new Uint8Array(Pe.w_size);$e.set(lt.subarray(Ce-Pe.w_size,Ce),0),lt=$e,Ce=Pe.w_size}const Nt=se.avail_in,Xt=se.next_in,Wt=se.input;for(se.avail_in=Ce,se.next_in=0,se.input=lt,ee(Pe);Pe.lookahead>=Ne;){let $e=Pe.strstart,p0=Pe.lookahead-(Ne-1);do Pe.ins_h=_e(Pe,Pe.ins_h,Pe.window[$e+Ne-1]),Pe.prev[$e&Pe.w_mask]=Pe.head[Pe.ins_h],Pe.head[Pe.ins_h]=$e,$e++;while(--p0);Pe.strstart=$e,Pe.lookahead=Ne-1,ee(Pe)}return Pe.strstart+=Pe.lookahead,Pe.block_start=Pe.strstart,Pe.insert=Pe.lookahead,Pe.lookahead=0,Pe.match_length=Pe.prev_length=Ne-1,Pe.match_available=0,se.next_in=Xt,se.input=Wt,se.avail_in=Nt,Pe.wrap=xe,e};return deflate.deflateInit=ot,deflate.deflateInit2=Zt,deflate.deflateReset=Ut,deflate.deflateResetKeep=ge,deflate.deflateSetHeader=Ve,deflate.deflate=ht,deflate.deflateEnd=I0,deflate.deflateSetDictionary=be,deflate.deflateInfo="pako deflate (from Nodeca project)",deflate}var common={},hasRequiredCommon;function requireCommon(){if(hasRequiredCommon)return common;hasRequiredCommon=1;const a=(n,s)=>Object.prototype.hasOwnProperty.call(n,s);return common.assign=function(n){const s=Array.prototype.slice.call(arguments,1);for(;s.length;){const u=s.shift();if(u){if(typeof u!="object")throw new TypeError(u+"must be non-object");for(const f in u)a(u,f)&&(n[f]=u[f])}}return n},common.flattenChunks=n=>{let s=0;for(let f=0,m=n.length;f=252?6:u>=248?5:u>=240?4:u>=224?3:u>=192?2:1;n[254]=n[254]=1,strings.string2buf=u=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(u);let f,m,A,v,y,T=u.length,E=0;for(v=0;v>>6,f[y++]=128|m&63):m<65536?(f[y++]=224|m>>>12,f[y++]=128|m>>>6&63,f[y++]=128|m&63):(f[y++]=240|m>>>18,f[y++]=128|m>>>12&63,f[y++]=128|m>>>6&63,f[y++]=128|m&63);return f};const s=(u,f)=>{if(f<65534&&u.subarray&&a)return String.fromCharCode.apply(null,u.length===f?u:u.subarray(0,f));let m="";for(let A=0;A{const m=f||u.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(u.subarray(0,f));let A,v;const y=new Array(m*2);for(v=0,A=0;A4){y[v++]=65533,A+=E-1;continue}for(T&=E===2?31:E===3?15:7;E>1&&A1){y[v++]=65533;continue}T<65536?y[v++]=T:(T-=65536,y[v++]=55296|T>>10&1023,y[v++]=56320|T&1023)}return s(y,v)},strings.utf8border=(u,f)=>{f=f||u.length,f>u.length&&(f=u.length);let m=f-1;for(;m>=0&&(u[m]&192)===128;)m--;return m<0||m===0?f:m+n[u[m]]>f?m:f},strings}var zstream,hasRequiredZstream;function requireZstream(){if(hasRequiredZstream)return zstream;hasRequiredZstream=1;function a(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}return zstream=a,zstream}var hasRequiredDeflate;function requireDeflate(){if(hasRequiredDeflate)return deflate$1;hasRequiredDeflate=1;const a=requireDeflate$1(),n=requireCommon(),s=requireStrings(),u=requireMessages(),f=requireZstream(),m=Object.prototype.toString,{Z_NO_FLUSH:A,Z_SYNC_FLUSH:v,Z_FULL_FLUSH:y,Z_FINISH:T,Z_OK:E,Z_STREAM_END:S,Z_DEFAULT_COMPRESSION:I,Z_DEFAULT_STRATEGY:e,Z_DEFLATED:F}=requireConstants();function M(z){this.options=n.assign({level:I,method:F,chunkSize:16384,windowBits:15,memLevel:8,strategy:e},z||{});let b=this.options;b.raw&&b.windowBits>0?b.windowBits=-b.windowBits:b.gzip&&b.windowBits>0&&b.windowBits<16&&(b.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new f,this.strm.avail_out=0;let W=a.deflateInit2(this.strm,b.level,b.method,b.windowBits,b.memLevel,b.strategy);if(W!==E)throw new Error(u[W]);if(b.header&&a.deflateSetHeader(this.strm,b.header),b.dictionary){let q;if(typeof b.dictionary=="string"?q=s.string2buf(b.dictionary):m.call(b.dictionary)==="[object ArrayBuffer]"?q=new Uint8Array(b.dictionary):q=b.dictionary,W=a.deflateSetDictionary(this.strm,q),W!==E)throw new Error(u[W]);this._dict_set=!0}}M.prototype.push=function(z,b){const W=this.strm,q=this.options.chunkSize;let Y,X;if(this.ended)return!1;for(b===~~b?X=b:X=b===!0?T:A,typeof z=="string"?W.input=s.string2buf(z):m.call(z)==="[object ArrayBuffer]"?W.input=new Uint8Array(z):W.input=z,W.next_in=0,W.avail_in=W.input.length;;){if(W.avail_out===0&&(W.output=new Uint8Array(q),W.next_out=0,W.avail_out=q),(X===v||X===y)&&W.avail_out<=6){this.onData(W.output.subarray(0,W.next_out)),W.avail_out=0;continue}if(Y=a.deflate(W,X),Y===S)return W.next_out>0&&this.onData(W.output.subarray(0,W.next_out)),Y=a.deflateEnd(this.strm),this.onEnd(Y),this.ended=!0,Y===E;if(W.avail_out===0){this.onData(W.output);continue}if(X>0&&W.next_out>0){this.onData(W.output.subarray(0,W.next_out)),W.avail_out=0;continue}if(W.avail_in===0)break}return!0},M.prototype.onData=function(z){this.chunks.push(z)},M.prototype.onEnd=function(z){z===E&&(this.result=n.flattenChunks(this.chunks)),this.chunks=[],this.err=z,this.msg=this.strm.msg};function L(z,b){const W=new M(b);if(W.push(z,!0),W.err)throw W.msg||u[W.err];return W.result}function V(z,b){return b=b||{},b.raw=!0,L(z,b)}function B(z,b){return b=b||{},b.gzip=!0,L(z,b)}return deflate$1.Deflate=M,deflate$1.deflate=L,deflate$1.deflateRaw=V,deflate$1.gzip=B,deflate$1.constants=requireConstants(),deflate$1}var inflate$1={},inflate={},inffast,hasRequiredInffast;function requireInffast(){if(hasRequiredInffast)return inffast;hasRequiredInffast=1;const a=16209,n=16191;return inffast=function(u,f){let m,A,v,y,T,E,S,I,e,F,M,L,V,B,z,b,W,q,Y,X,H,g,J,re;const ae=u.state;m=u.next_in,J=u.input,A=m+(u.avail_in-5),v=u.next_out,re=u.output,y=v-(f-u.avail_out),T=v+(u.avail_out-257),E=ae.dmax,S=ae.wsize,I=ae.whave,e=ae.wnext,F=ae.window,M=ae.hold,L=ae.bits,V=ae.lencode,B=ae.distcode,z=(1<>>24,M>>>=q,L-=q,q=W>>>16&255,q===0)re[v++]=W&65535;else if(q&16){Y=W&65535,q&=15,q&&(L>>=q,L-=q),L<15&&(M+=J[m++]<>>24,M>>>=q,L-=q,q=W>>>16&255,q&16){if(X=W&65535,q&=15,LE){u.msg="invalid distance too far back",ae.mode=a;break e}if(M>>>=q,L-=q,q=v-y,X>q){if(q=X-q,q>I&&ae.sane){u.msg="invalid distance too far back",ae.mode=a;break e}if(H=0,g=F,e===0){if(H+=S-q,q2;)re[v++]=g[H++],re[v++]=g[H++],re[v++]=g[H++],Y-=3;Y&&(re[v++]=g[H++],Y>1&&(re[v++]=g[H++]))}else{H=v-X;do re[v++]=re[H++],re[v++]=re[H++],re[v++]=re[H++],Y-=3;while(Y>2);Y&&(re[v++]=re[H++],Y>1&&(re[v++]=re[H++]))}}else if(q&64){u.msg="invalid distance code",ae.mode=a;break e}else{W=B[(W&65535)+(M&(1<>3,m-=Y,L-=Y<<3,M&=(1<{const z=B.bits;let b=0,W=0,q=0,Y=0,X=0,H=0,g=0,J=0,re=0,ae=0,fe,pe,me,Se,ve,we=null,Ne;const De=new Uint16Array(a+1),je=new Uint16Array(a+1);let nt=null,Ue,ye,ut;for(b=0;b<=a;b++)De[b]=0;for(W=0;W=1&&De[Y]===0;Y--);if(X>Y&&(X=Y),Y===0)return M[L++]=1<<24|64<<16|0,M[L++]=1<<24|64<<16|0,B.bits=1,0;for(q=1;q0&&(S===u||Y!==1))return-1;for(je[1]=0,b=1;bn||S===m&&re>s)return 1;for(;;){Ue=b-g,V[W]+1=Ne?(ye=nt[V[W]-Ne],ut=we[V[W]-Ne]):(ye=96,ut=0),fe=1<>g)+pe]=Ue<<24|ye<<16|ut|0;while(pe!==0);for(fe=1<>=1;if(fe!==0?(ae&=fe-1,ae+=fe):ae=0,W++,--De[b]===0){if(b===Y)break;b=I[e+V[W]]}if(b>X&&(ae&Se)!==me){for(g===0&&(g=X),ve+=q,H=b-g,J=1<n||S===m&&re>s)return 1;me=ae&Se,M[me]=X<<24|H<<16|ve-L|0}}return ae!==0&&(M[ve+ae]=b-g<<24|64<<16|0),B.bits=X,0},inftrees}var hasRequiredInflate$1;function requireInflate$1(){if(hasRequiredInflate$1)return inflate;hasRequiredInflate$1=1;const a=requireAdler32(),n=requireCrc32(),s=requireInffast(),u=requireInftrees(),f=0,m=1,A=2,{Z_FINISH:v,Z_BLOCK:y,Z_TREES:T,Z_OK:E,Z_STREAM_END:S,Z_NEED_DICT:I,Z_STREAM_ERROR:e,Z_DATA_ERROR:F,Z_MEM_ERROR:M,Z_BUF_ERROR:L,Z_DEFLATED:V}=requireConstants(),B=16180,z=16181,b=16182,W=16183,q=16184,Y=16185,X=16186,H=16187,g=16188,J=16189,re=16190,ae=16191,fe=16192,pe=16193,me=16194,Se=16195,ve=16196,we=16197,Ne=16198,De=16199,je=16200,nt=16201,Ue=16202,ye=16203,ut=16204,pt=16205,It=16206,Lt=16207,Ot=16208,Et=16209,Rt=16210,Ze=16211,Me=852,Qe=592,Fe=15,at=Re=>(Re>>>24&255)+(Re>>>8&65280)+((Re&65280)<<8)+((Re&255)<<24);function ze(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const Le=Re=>{if(!Re)return 1;const Ye=Re.state;return!Ye||Ye.strm!==Re||Ye.modeZe?1:0},qe=Re=>{if(Le(Re))return e;const Ye=Re.state;return Re.total_in=Re.total_out=Ye.total=0,Re.msg="",Ye.wrap&&(Re.adler=Ye.wrap&1),Ye.mode=B,Ye.last=0,Ye.havedict=0,Ye.flags=-1,Ye.dmax=32768,Ye.head=null,Ye.hold=0,Ye.bits=0,Ye.lencode=Ye.lendyn=new Int32Array(Me),Ye.distcode=Ye.distdyn=new Int32Array(Qe),Ye.sane=1,Ye.back=-1,E},_e=Re=>{if(Le(Re))return e;const Ye=Re.state;return Ye.wsize=0,Ye.whave=0,Ye.wnext=0,qe(Re)},Je=(Re,Ye)=>{let ue;if(Le(Re))return e;const Ae=Re.state;return Ye<0?(ue=0,Ye=-Ye):(ue=(Ye>>4)+5,Ye<48&&(Ye&=15)),Ye&&(Ye<8||Ye>15)?e:(Ae.window!==null&&Ae.wbits!==Ye&&(Ae.window=null),Ae.wrap=ue,Ae.wbits=Ye,_e(Re))},We=(Re,Ye)=>{if(!Re)return e;const ue=new ze;Re.state=ue,ue.strm=Re,ue.window=null,ue.mode=B;const Ae=Je(Re,Ye);return Ae!==E&&(Re.state=null),Ae},Ge=Re=>We(Re,Fe);let xt=!0,He,rt;const ee=Re=>{if(xt){He=new Int32Array(512),rt=new Int32Array(32);let Ye=0;for(;Ye<144;)Re.lens[Ye++]=8;for(;Ye<256;)Re.lens[Ye++]=9;for(;Ye<280;)Re.lens[Ye++]=7;for(;Ye<288;)Re.lens[Ye++]=8;for(u(m,Re.lens,0,288,He,0,Re.work,{bits:9}),Ye=0;Ye<32;)Re.lens[Ye++]=5;u(A,Re.lens,0,32,rt,0,Re.work,{bits:5}),xt=!1}Re.lencode=He,Re.lenbits=9,Re.distcode=rt,Re.distbits=5},Be=(Re,Ye,ue,Ae)=>{let Vt;const ge=Re.state;return ge.window===null&&(ge.wsize=1<=ge.wsize?(ge.window.set(Ye.subarray(ue-ge.wsize,ue),0),ge.wnext=0,ge.whave=ge.wsize):(Vt=ge.wsize-ge.wnext,Vt>Ae&&(Vt=Ae),ge.window.set(Ye.subarray(ue-Ae,ue-Ae+Vt),ge.wnext),Ae-=Vt,Ae?(ge.window.set(Ye.subarray(ue-Ae,ue),0),ge.wnext=Ae,ge.whave=ge.wsize):(ge.wnext+=Vt,ge.wnext===ge.wsize&&(ge.wnext=0),ge.whave{let ue,Ae,Vt,ge,Ut,Ve,Zt,ot,ht,I0,be,se,lt,Ce,Pe=0,xe,Nt,Xt,Wt,$e,p0,R0,Q0;const M0=new Uint8Array(4);let ni,St;const kt=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(Le(Re)||!Re.output||!Re.input&&Re.avail_in!==0)return e;ue=Re.state,ue.mode===ae&&(ue.mode=fe),Ut=Re.next_out,Vt=Re.output,Zt=Re.avail_out,ge=Re.next_in,Ae=Re.input,Ve=Re.avail_in,ot=ue.hold,ht=ue.bits,I0=Ve,be=Zt,Q0=E;e:for(;;)switch(ue.mode){case B:if(ue.wrap===0){ue.mode=fe;break}for(;ht<16;){if(Ve===0)break e;Ve--,ot+=Ae[ge++]<>>8&255,ue.check=n(ue.check,M0,2,0),ot=0,ht=0,ue.mode=z;break}if(ue.head&&(ue.head.done=!1),!(ue.wrap&1)||(((ot&255)<<8)+(ot>>8))%31){Re.msg="incorrect header check",ue.mode=Et;break}if((ot&15)!==V){Re.msg="unknown compression method",ue.mode=Et;break}if(ot>>>=4,ht-=4,R0=(ot&15)+8,ue.wbits===0&&(ue.wbits=R0),R0>15||R0>ue.wbits){Re.msg="invalid window size",ue.mode=Et;break}ue.dmax=1<>8&1),ue.flags&512&&ue.wrap&4&&(M0[0]=ot&255,M0[1]=ot>>>8&255,ue.check=n(ue.check,M0,2,0)),ot=0,ht=0,ue.mode=b;case b:for(;ht<32;){if(Ve===0)break e;Ve--,ot+=Ae[ge++]<>>8&255,M0[2]=ot>>>16&255,M0[3]=ot>>>24&255,ue.check=n(ue.check,M0,4,0)),ot=0,ht=0,ue.mode=W;case W:for(;ht<16;){if(Ve===0)break e;Ve--,ot+=Ae[ge++]<>8),ue.flags&512&&ue.wrap&4&&(M0[0]=ot&255,M0[1]=ot>>>8&255,ue.check=n(ue.check,M0,2,0)),ot=0,ht=0,ue.mode=q;case q:if(ue.flags&1024){for(;ht<16;){if(Ve===0)break e;Ve--,ot+=Ae[ge++]<>>8&255,ue.check=n(ue.check,M0,2,0)),ot=0,ht=0}else ue.head&&(ue.head.extra=null);ue.mode=Y;case Y:if(ue.flags&1024&&(se=ue.length,se>Ve&&(se=Ve),se&&(ue.head&&(R0=ue.head.extra_len-ue.length,ue.head.extra||(ue.head.extra=new Uint8Array(ue.head.extra_len)),ue.head.extra.set(Ae.subarray(ge,ge+se),R0)),ue.flags&512&&ue.wrap&4&&(ue.check=n(ue.check,Ae,se,ge)),Ve-=se,ge+=se,ue.length-=se),ue.length))break e;ue.length=0,ue.mode=X;case X:if(ue.flags&2048){if(Ve===0)break e;se=0;do R0=Ae[ge+se++],ue.head&&R0&&ue.length<65536&&(ue.head.name+=String.fromCharCode(R0));while(R0&&se>9&1,ue.head.done=!0),Re.adler=ue.check=0,ue.mode=ae;break;case J:for(;ht<32;){if(Ve===0)break e;Ve--,ot+=Ae[ge++]<>>=ht&7,ht-=ht&7,ue.mode=It;break}for(;ht<3;){if(Ve===0)break e;Ve--,ot+=Ae[ge++]<>>=1,ht-=1,ot&3){case 0:ue.mode=pe;break;case 1:if(ee(ue),ue.mode=De,Ye===T){ot>>>=2,ht-=2;break e}break;case 2:ue.mode=ve;break;case 3:Re.msg="invalid block type",ue.mode=Et}ot>>>=2,ht-=2;break;case pe:for(ot>>>=ht&7,ht-=ht&7;ht<32;){if(Ve===0)break e;Ve--,ot+=Ae[ge++]<>>16^65535)){Re.msg="invalid stored block lengths",ue.mode=Et;break}if(ue.length=ot&65535,ot=0,ht=0,ue.mode=me,Ye===T)break e;case me:ue.mode=Se;case Se:if(se=ue.length,se){if(se>Ve&&(se=Ve),se>Zt&&(se=Zt),se===0)break e;Vt.set(Ae.subarray(ge,ge+se),Ut),Ve-=se,ge+=se,Zt-=se,Ut+=se,ue.length-=se;break}ue.mode=ae;break;case ve:for(;ht<14;){if(Ve===0)break e;Ve--,ot+=Ae[ge++]<>>=5,ht-=5,ue.ndist=(ot&31)+1,ot>>>=5,ht-=5,ue.ncode=(ot&15)+4,ot>>>=4,ht-=4,ue.nlen>286||ue.ndist>30){Re.msg="too many length or distance symbols",ue.mode=Et;break}ue.have=0,ue.mode=we;case we:for(;ue.have>>=3,ht-=3}for(;ue.have<19;)ue.lens[kt[ue.have++]]=0;if(ue.lencode=ue.lendyn,ue.lenbits=7,ni={bits:ue.lenbits},Q0=u(f,ue.lens,0,19,ue.lencode,0,ue.work,ni),ue.lenbits=ni.bits,Q0){Re.msg="invalid code lengths set",ue.mode=Et;break}ue.have=0,ue.mode=Ne;case Ne:for(;ue.have>>24,Nt=Pe>>>16&255,Xt=Pe&65535,!(xe<=ht);){if(Ve===0)break e;Ve--,ot+=Ae[ge++]<>>=xe,ht-=xe,ue.lens[ue.have++]=Xt;else{if(Xt===16){for(St=xe+2;ht>>=xe,ht-=xe,ue.have===0){Re.msg="invalid bit length repeat",ue.mode=Et;break}R0=ue.lens[ue.have-1],se=3+(ot&3),ot>>>=2,ht-=2}else if(Xt===17){for(St=xe+3;ht>>=xe,ht-=xe,R0=0,se=3+(ot&7),ot>>>=3,ht-=3}else{for(St=xe+7;ht>>=xe,ht-=xe,R0=0,se=11+(ot&127),ot>>>=7,ht-=7}if(ue.have+se>ue.nlen+ue.ndist){Re.msg="invalid bit length repeat",ue.mode=Et;break}for(;se--;)ue.lens[ue.have++]=R0}}if(ue.mode===Et)break;if(ue.lens[256]===0){Re.msg="invalid code -- missing end-of-block",ue.mode=Et;break}if(ue.lenbits=9,ni={bits:ue.lenbits},Q0=u(m,ue.lens,0,ue.nlen,ue.lencode,0,ue.work,ni),ue.lenbits=ni.bits,Q0){Re.msg="invalid literal/lengths set",ue.mode=Et;break}if(ue.distbits=6,ue.distcode=ue.distdyn,ni={bits:ue.distbits},Q0=u(A,ue.lens,ue.nlen,ue.ndist,ue.distcode,0,ue.work,ni),ue.distbits=ni.bits,Q0){Re.msg="invalid distances set",ue.mode=Et;break}if(ue.mode=De,Ye===T)break e;case De:ue.mode=je;case je:if(Ve>=6&&Zt>=258){Re.next_out=Ut,Re.avail_out=Zt,Re.next_in=ge,Re.avail_in=Ve,ue.hold=ot,ue.bits=ht,s(Re,be),Ut=Re.next_out,Vt=Re.output,Zt=Re.avail_out,ge=Re.next_in,Ae=Re.input,Ve=Re.avail_in,ot=ue.hold,ht=ue.bits,ue.mode===ae&&(ue.back=-1);break}for(ue.back=0;Pe=ue.lencode[ot&(1<>>24,Nt=Pe>>>16&255,Xt=Pe&65535,!(xe<=ht);){if(Ve===0)break e;Ve--,ot+=Ae[ge++]<>Wt)],xe=Pe>>>24,Nt=Pe>>>16&255,Xt=Pe&65535,!(Wt+xe<=ht);){if(Ve===0)break e;Ve--,ot+=Ae[ge++]<>>=Wt,ht-=Wt,ue.back+=Wt}if(ot>>>=xe,ht-=xe,ue.back+=xe,ue.length=Xt,Nt===0){ue.mode=pt;break}if(Nt&32){ue.back=-1,ue.mode=ae;break}if(Nt&64){Re.msg="invalid literal/length code",ue.mode=Et;break}ue.extra=Nt&15,ue.mode=nt;case nt:if(ue.extra){for(St=ue.extra;ht>>=ue.extra,ht-=ue.extra,ue.back+=ue.extra}ue.was=ue.length,ue.mode=Ue;case Ue:for(;Pe=ue.distcode[ot&(1<>>24,Nt=Pe>>>16&255,Xt=Pe&65535,!(xe<=ht);){if(Ve===0)break e;Ve--,ot+=Ae[ge++]<>Wt)],xe=Pe>>>24,Nt=Pe>>>16&255,Xt=Pe&65535,!(Wt+xe<=ht);){if(Ve===0)break e;Ve--,ot+=Ae[ge++]<>>=Wt,ht-=Wt,ue.back+=Wt}if(ot>>>=xe,ht-=xe,ue.back+=xe,Nt&64){Re.msg="invalid distance code",ue.mode=Et;break}ue.offset=Xt,ue.extra=Nt&15,ue.mode=ye;case ye:if(ue.extra){for(St=ue.extra;ht>>=ue.extra,ht-=ue.extra,ue.back+=ue.extra}if(ue.offset>ue.dmax){Re.msg="invalid distance too far back",ue.mode=Et;break}ue.mode=ut;case ut:if(Zt===0)break e;if(se=be-Zt,ue.offset>se){if(se=ue.offset-se,se>ue.whave&&ue.sane){Re.msg="invalid distance too far back",ue.mode=Et;break}se>ue.wnext?(se-=ue.wnext,lt=ue.wsize-se):lt=ue.wnext-se,se>ue.length&&(se=ue.length),Ce=ue.window}else Ce=Vt,lt=Ut-ue.offset,se=ue.length;se>Zt&&(se=Zt),Zt-=se,ue.length-=se;do Vt[Ut++]=Ce[lt++];while(--se);ue.length===0&&(ue.mode=je);break;case pt:if(Zt===0)break e;Vt[Ut++]=ue.length,Zt--,ue.mode=je;break;case It:if(ue.wrap){for(;ht<32;){if(Ve===0)break e;Ve--,ot|=Ae[ge++]<{if(Le(Re))return e;let Ye=Re.state;return Ye.window&&(Ye.window=null),Re.state=null,E},ft=(Re,Ye)=>{if(Le(Re))return e;const ue=Re.state;return ue.wrap&2?(ue.head=Ye,Ye.done=!1,E):e},vt=(Re,Ye)=>{const ue=Ye.length;let Ae,Vt,ge;return Le(Re)||(Ae=Re.state,Ae.wrap!==0&&Ae.mode!==re)?e:Ae.mode===re&&(Vt=1,Vt=a(Vt,Ye,ue,0),Vt!==Ae.check)?F:(ge=Be(Re,Ye,ue,ue),ge?(Ae.mode=Rt,M):(Ae.havedict=1,E))};return inflate.inflateReset=_e,inflate.inflateReset2=Je,inflate.inflateResetKeep=qe,inflate.inflateInit=Ge,inflate.inflateInit2=We,inflate.inflate=st,inflate.inflateEnd=Ke,inflate.inflateGetHeader=ft,inflate.inflateSetDictionary=vt,inflate.inflateInfo="pako inflate (from Nodeca project)",inflate}var gzheader,hasRequiredGzheader;function requireGzheader(){if(hasRequiredGzheader)return gzheader;hasRequiredGzheader=1;function a(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}return gzheader=a,gzheader}var hasRequiredInflate;function requireInflate(){if(hasRequiredInflate)return inflate$1;hasRequiredInflate=1;const a=requireInflate$1(),n=requireCommon(),s=requireStrings(),u=requireMessages(),f=requireZstream(),m=requireGzheader(),A=Object.prototype.toString,{Z_NO_FLUSH:v,Z_FINISH:y,Z_OK:T,Z_STREAM_END:E,Z_NEED_DICT:S,Z_STREAM_ERROR:I,Z_DATA_ERROR:e,Z_MEM_ERROR:F}=requireConstants();function M(B){this.options=n.assign({chunkSize:1024*64,windowBits:15,to:""},B||{});const z=this.options;z.raw&&z.windowBits>=0&&z.windowBits<16&&(z.windowBits=-z.windowBits,z.windowBits===0&&(z.windowBits=-15)),z.windowBits>=0&&z.windowBits<16&&!(B&&B.windowBits)&&(z.windowBits+=32),z.windowBits>15&&z.windowBits<48&&(z.windowBits&15||(z.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new f,this.strm.avail_out=0;let b=a.inflateInit2(this.strm,z.windowBits);if(b!==T)throw new Error(u[b]);if(this.header=new m,a.inflateGetHeader(this.strm,this.header),z.dictionary&&(typeof z.dictionary=="string"?z.dictionary=s.string2buf(z.dictionary):A.call(z.dictionary)==="[object ArrayBuffer]"&&(z.dictionary=new Uint8Array(z.dictionary)),z.raw&&(b=a.inflateSetDictionary(this.strm,z.dictionary),b!==T)))throw new Error(u[b])}M.prototype.push=function(B,z){const b=this.strm,W=this.options.chunkSize,q=this.options.dictionary;let Y,X,H;if(this.ended)return!1;for(z===~~z?X=z:X=z===!0?y:v,A.call(B)==="[object ArrayBuffer]"?b.input=new Uint8Array(B):b.input=B,b.next_in=0,b.avail_in=b.input.length;;){for(b.avail_out===0&&(b.output=new Uint8Array(W),b.next_out=0,b.avail_out=W),Y=a.inflate(b,X),Y===S&&q&&(Y=a.inflateSetDictionary(b,q),Y===T?Y=a.inflate(b,X):Y===e&&(Y=S));b.avail_in>0&&Y===E&&b.state.wrap>0&&B[b.next_in]!==0;)a.inflateReset(b),Y=a.inflate(b,X);switch(Y){case I:case e:case S:case F:return this.onEnd(Y),this.ended=!0,!1}if(H=b.avail_out,b.next_out&&(b.avail_out===0||Y===E))if(this.options.to==="string"){let g=s.utf8border(b.output,b.next_out),J=b.next_out-g,re=s.buf2string(b.output,g);b.next_out=J,b.avail_out=W-J,J&&b.output.set(b.output.subarray(g,g+J),0),this.onData(re)}else this.onData(b.output.length===b.next_out?b.output:b.output.subarray(0,b.next_out));if(!(Y===T&&H===0)){if(Y===E)return Y=a.inflateEnd(this.strm),this.onEnd(Y),this.ended=!0,!0;if(b.avail_in===0)break}}return!0},M.prototype.onData=function(B){this.chunks.push(B)},M.prototype.onEnd=function(B){B===T&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=n.flattenChunks(this.chunks)),this.chunks=[],this.err=B,this.msg=this.strm.msg};function L(B,z){const b=new M(z);if(b.push(B),b.err)throw b.msg||u[b.err];return b.result}function V(B,z){return z=z||{},z.raw=!0,L(B,z)}return inflate$1.Inflate=M,inflate$1.inflate=L,inflate$1.inflateRaw=V,inflate$1.ungzip=L,inflate$1.constants=requireConstants(),inflate$1}var hasRequiredPako;function requirePako(){if(hasRequiredPako)return pako;hasRequiredPako=1;const{Deflate:a,deflate:n,deflateRaw:s,gzip:u}=requireDeflate(),{Inflate:f,inflate:m,inflateRaw:A,ungzip:v}=requireInflate(),y=requireConstants();return pako.Deflate=a,pako.deflate=n,pako.deflateRaw=s,pako.gzip=u,pako.Inflate=f,pako.inflate=m,pako.inflateRaw=A,pako.ungzip=v,pako.constants=y,pako}var hasRequiredParser;function requireParser(){return hasRequiredParser||(hasRequiredParser=1,function(a){var n=n||{};n.Tag=n.Tag||(typeof commonjsRequire<"u"?requireTag():null),n.Utils=n.Utils||(typeof commonjsRequire<"u"?requireUtilities():null),n.Dictionary=n.Dictionary||(typeof commonjsRequire<"u"?requireDictionary():null),n.Image=n.Image||(typeof commonjsRequire<"u"?requireImage():null);var s=s||(typeof commonjsRequire<"u"?requirePako():null);n.Parser=n.Parser||function(){this.littleEndian=!0,this.explicit=!0,this.metaFound=!1,this.metaFinished=!1,this.metaFinishedOffset=-1,this.needsDeflate=!1,this.inflated=null,this.encapsulation=!1,this.level=0,this.error=null},n.Parser.verbose=!1,n.Parser.MAGIC_COOKIE_OFFSET=128,n.Parser.MAGIC_COOKIE=[68,73,67,77],n.Parser.VRS=["AE","AS","AT","CS","DA","DS","DT","FL","FD","IS","LO","LT","OB","OD","OF","OW","PN","SH","SL","SS","ST","TM","UI","UL","UN","US","UT","UC"],n.Parser.DATA_VRS=["OB","OW","OF","SQ","UT","UN","UC"],n.Parser.RAW_DATA_VRS=["OB","OD","OF","OW","UN"],n.Parser.TRANSFER_SYNTAX_IMPLICIT_LITTLE="1.2.840.10008.1.2",n.Parser.TRANSFER_SYNTAX_EXPLICIT_LITTLE="1.2.840.10008.1.2.1",n.Parser.TRANSFER_SYNTAX_EXPLICIT_BIG="1.2.840.10008.1.2.2",n.Parser.TRANSFER_SYNTAX_COMPRESSION_JPEG="1.2.840.10008.1.2.4",n.Parser.TRANSFER_SYNTAX_COMPRESSION_JPEG_LOSSLESS="1.2.840.10008.1.2.4.57",n.Parser.TRANSFER_SYNTAX_COMPRESSION_JPEG_LOSSLESS_SEL1="1.2.840.10008.1.2.4.70",n.Parser.TRANSFER_SYNTAX_COMPRESSION_JPEG_BASELINE_8BIT="1.2.840.10008.1.2.4.50",n.Parser.TRANSFER_SYNTAX_COMPRESSION_JPEG_BASELINE_12BIT="1.2.840.10008.1.2.4.51",n.Parser.TRANSFER_SYNTAX_COMPRESSION_JPEG_LS_LOSSLESS="1.2.840.10008.1.2.4.80",n.Parser.TRANSFER_SYNTAX_COMPRESSION_JPEG_LS="1.2.840.10008.1.2.4.81",n.Parser.TRANSFER_SYNTAX_COMPRESSION_JPEG_2000_LOSSLESS="1.2.840.10008.1.2.4.90",n.Parser.TRANSFER_SYNTAX_COMPRESSION_JPEG_2000="1.2.840.10008.1.2.4.91",n.Parser.TRANSFER_SYNTAX_COMPRESSION_RLE="1.2.840.10008.1.2.5",n.Parser.TRANSFER_SYNTAX_COMPRESSION_DEFLATE="1.2.840.10008.1.2.1.99",n.Parser.UNDEFINED_LENGTH=4294967295,n.Parser.isMagicCookieFound=function(u){var f=n.Parser.MAGIC_COOKIE_OFFSET,m=n.Parser.MAGIC_COOKIE.length,A;for(A=0;A=this.metaFinishedOffset&&(this.needsDeflate=!1,v=u.buffer.slice(0,A.offsetEnd),y=u.buffer.slice(A.offsetEnd),this.inflated=n.Utils.concatArrayBuffers(v,s.inflateRaw(y)),u=new DataView(this.inflated)),A=this.getNextTag(u,A.offsetEnd)}catch(T){this.error=T}return f!==null&&(f.littleEndian=this.littleEndian),f},n.Parser.prototype.parseEncapsulated=function(u){var f=0,m,A=[];this.encapsulation=!0;try{for(m=this.getNextTag(u,f);m!==null;)m.isSublistItem()&&A.push(m),n.Parser.verbose&&console.log(m.toString()),m=this.getNextTag(u,m.offsetEnd)}catch(v){this.error=v}return A},n.Parser.prototype.testForValidTag=function(u){var f,m=null;try{f=this.findFirstTagOffset(u),m=this.getNextTag(u,f,!1)}catch(A){this.error=A}return m},n.Parser.prototype.getNextTag=function(u,f,m){var A=0,v,y=null,T=f,E,S=0,I=!0,e=null,F;if(f>=u.byteLength)return null;this.metaFinished?(I=this.littleEndian,A=u.getUint16(f,I)):(A=u.getUint16(f,!0),this.metaFinishedOffset!==-1&&f>=this.metaFinishedOffset||A!==2?(this.metaFinished=!0,I=this.littleEndian,A=u.getUint16(f,I)):I=!0),!this.metaFound&&A===2&&(this.metaFound=!0),f+=2,v=u.getUint16(f,I),f+=2,this.explicit||!this.metaFinished?(e=n.Utils.getStringAt(u,f,2),!this.metaFound&&this.metaFinished&&n.Parser.VRS.indexOf(e)===-1?(e=n.Dictionary.getVR(A,v),S=u.getUint32(f,I),f+=4,this.explicit=!1):(f+=2,n.Parser.DATA_VRS.indexOf(e)!==-1?(f+=2,S=u.getUint32(f,I),f+=4):(S=u.getUint16(f,I),f+=2))):(e=n.Dictionary.getVR(A,v),S=u.getUint32(f,I),S===n.Parser.UNDEFINED_LENGTH&&(e="SQ"),f+=4),E=f;var M=A===n.Tag.TAG_PIXEL_DATA[0]&&v===n.Tag.TAG_PIXEL_DATA[1],L=A===40&&v>=4609&&v<4864;if(e==="SQ"||!L&&!M&&!this.encapsulation&&n.Parser.DATA_VRS.indexOf(e)!==-1&&e!=="UC"?(y=this.parseSublist(u,f,S,e!=="SQ"),S===n.Parser.UNDEFINED_LENGTH&&(S=y[y.length-1].offsetEnd-f)):S>0&&!m&&(S===n.Parser.UNDEFINED_LENGTH&&M&&(S=u.byteLength-f),y=u.buffer.slice(f,f+S)),f+=S,F=new n.Tag(A,v,e,y,T,E,f,this.littleEndian,this.charset),F.value){if(F.isTransformSyntax())this.transformSyntaxAlreadyExist=!0,F.value[0]===n.Parser.TRANSFER_SYNTAX_IMPLICIT_LITTLE?(this.explicit=!1,this.littleEndian=!0):F.value[0]===n.Parser.TRANSFER_SYNTAX_EXPLICIT_BIG?(this.explicit=!0,this.littleEndian=!1):F.value[0]===n.Parser.TRANSFER_SYNTAX_COMPRESSION_DEFLATE?(this.needsDeflate=!0,this.explicit=!0,this.littleEndian=!0):(this.explicit=!0,this.littleEndian=!0);else if(F.isMetaLength())this.metaFinishedOffset=F.value[0]+f;else if(F.isCharset()){var V=F.value;V.length==2?V=(V[0]||"ISO 2022 IR 6")+"\\"+V[1]:V.length==1&&(V=V[0]),this.charset=V}}return F},n.Parser.prototype.parseSublist=function(u,f,m,A){var v,y=f+m,T=[];if(this.level++,m===n.Parser.UNDEFINED_LENGTH){for(v=this.parseSublistItem(u,f,A);!v.isSequenceDelim();)T.push(v),f=v.offsetEnd,v=this.parseSublistItem(u,f,A);T.push(v)}else for(;fn.Image.OBLIQUITY_THRESHOLD_COSINE_VALUE&&e>F&&e>M?T=E:F>n.Image.OBLIQUITY_THRESHOLD_COSINE_VALUE&&F>e&&F>M?T=S:M>n.Image.OBLIQUITY_THRESHOLD_COSINE_VALUE&&M>e&&M>F?T=I:T=null,T},n.Image.prototype.getCols=function(){return n.Image.getSingleValueSafely(this.getTag(n.Tag.TAG_COLS[0],n.Tag.TAG_COLS[1]),0)},n.Image.prototype.getRows=function(){return n.Image.getSingleValueSafely(this.getTag(n.Tag.TAG_ROWS[0],n.Tag.TAG_ROWS[1]),0)},n.Image.prototype.getSeriesDescription=function(){return n.Image.getSingleValueSafely(this.getTag(n.Tag.TAG_SERIES_DESCRIPTION[0],n.Tag.TAG_SERIES_DESCRIPTION[1]),0)},n.Image.prototype.getSeriesInstanceUID=function(){return n.Image.getSingleValueSafely(this.getTag(n.Tag.TAG_SERIES_INSTANCE_UID[0],n.Tag.TAG_SERIES_INSTANCE_UID[1]),0)},n.Image.prototype.getSeriesNumber=function(){return n.Image.getSingleValueSafely(this.getTag(n.Tag.TAG_SERIES_NUMBER[0],n.Tag.TAG_SERIES_NUMBER[1]),0)},n.Image.prototype.getEchoNumber=function(){return n.Image.getSingleValueSafely(this.getTag(n.Tag.TAG_ECHO_NUMBER[0],n.Tag.TAG_ECHO_NUMBER[1]),0)},n.Image.prototype.getImagePosition=function(){return n.Image.getValueSafely(this.getTag(n.Tag.TAG_IMAGE_POSITION[0],n.Tag.TAG_IMAGE_POSITION[1]))},n.Image.prototype.getImageDirections=function(){return n.Image.getValueSafely(this.getTag(n.Tag.TAG_IMAGE_ORIENTATION[0],n.Tag.TAG_IMAGE_ORIENTATION[1]))},n.Image.prototype.getImagePositionSliceDir=function(A){var v=n.Image.getValueSafely(this.getTag(n.Tag.TAG_IMAGE_POSITION[0],n.Tag.TAG_IMAGE_POSITION[1]));return v&&A>=0?v[A]:0},n.Image.prototype.getModality=function(){return n.Image.getSingleValueSafely(this.getTag(n.Tag.TAG_MODALITY[0],n.Tag.TAG_MODALITY[1]),0)},n.Image.prototype.getSliceLocation=function(){return n.Image.getSingleValueSafely(this.getTag(n.Tag.TAG_SLICE_LOCATION[0],n.Tag.TAG_SLICE_LOCATION[1]),0)},n.Image.prototype.getSliceLocationVector=function(){return n.Image.getValueSafely(this.getTag(n.Tag.TAG_SLICE_LOCATION_VECTOR[0],n.Tag.TAG_SLICE_LOCATION_VECTOR[1]))},n.Image.prototype.getImageNumber=function(){return n.Image.getSingleValueSafely(this.getTag(n.Tag.TAG_IMAGE_NUM[0],n.Tag.TAG_IMAGE_NUM[1]),0)},n.Image.prototype.getTemporalPosition=function(){return n.Image.getSingleValueSafely(this.getTag(n.Tag.TAG_TEMPORAL_POSITION[0],n.Tag.TAG_TEMPORAL_POSITION[1]),0)},n.Image.prototype.getTemporalNumber=function(){return n.Image.getSingleValueSafely(this.getTag(n.Tag.TAG_NUMBER_TEMPORAL_POSITIONS[0],n.Tag.TAG_NUMBER_TEMPORAL_POSITIONS[1]),0)},n.Image.prototype.getSliceGap=function(){return n.Image.getSingleValueSafely(this.getTag(n.Tag.TAG_SLICE_GAP[0],n.Tag.TAG_SLICE_GAP[1]),0)},n.Image.prototype.getSliceThickness=function(){return n.Image.getSingleValueSafely(this.getTag(n.Tag.TAG_SLICE_THICKNESS[0],n.Tag.TAG_SLICE_THICKNESS[1]),0)},n.Image.prototype.getImageMax=function(){return n.Image.getSingleValueSafely(this.getTag(n.Tag.TAG_IMAGE_MAX[0],n.Tag.TAG_IMAGE_MAX[1]),0)},n.Image.prototype.getImageMin=function(){return n.Image.getSingleValueSafely(this.getTag(n.Tag.TAG_IMAGE_MIN[0],n.Tag.TAG_IMAGE_MIN[1]),0)},n.Image.prototype.getDataScaleSlope=function(){return n.Image.getSingleValueSafely(this.getTag(n.Tag.TAG_DATA_SCALE_SLOPE[0],n.Tag.TAG_DATA_SCALE_SLOPE[1]),0)},n.Image.prototype.getDataScaleIntercept=function(){return n.Image.getSingleValueSafely(this.getTag(n.Tag.TAG_DATA_SCALE_INTERCEPT[0],n.Tag.TAG_DATA_SCALE_INTERCEPT[1]),0)},n.Image.prototype.getDataScaleElscint=function(){var A=n.Image.getSingleValueSafely(this.getTag(n.Tag.TAG_DATA_SCALE_ELSCINT[0],n.Tag.TAG_DATA_SCALE_ELSCINT[1]),0);A||(A=1);var v=this.getPixelBandwidth();return A=Math.sqrt(v)/(10*A),A<=0&&(A=1),A},n.Image.prototype.getWindowWidth=function(){return n.Image.getSingleValueSafely(this.getTag(n.Tag.TAG_WINDOW_WIDTH[0],n.Tag.TAG_WINDOW_WIDTH[1]),0)},n.Image.prototype.getWindowCenter=function(){return n.Image.getSingleValueSafely(this.getTag(n.Tag.TAG_WINDOW_CENTER[0],n.Tag.TAG_WINDOW_CENTER[1]),0)},n.Image.prototype.getPixelBandwidth=function(){return n.Image.getSingleValueSafely(this.getTag(n.Tag.TAG_PIXEL_BANDWIDTH[0],n.Tag.TAG_PIXEL_BANDWIDTH[1]),0)},n.Image.prototype.getSeriesId=function(){var A=this.getSeriesDescription(),v=this.getSeriesInstanceUID(),y=this.getSeriesNumber(),T=this.getEchoNumber(),E=this.getOrientation(),S=this.getCols(),I=this.getRows(),e="";return A!==null&&(e+=" "+A),v!==null&&(e+=" "+v),y!==null&&(e+=" "+y),T!==null&&(e+=" "+T),E!==null&&(e+=" "+E),e+=" ("+S+" x "+I+")",e},n.Image.prototype.getPixelSpacing=function(){return n.Image.getValueSafely(this.getTag(n.Tag.TAG_PIXEL_SPACING[0],n.Tag.TAG_PIXEL_SPACING[1]))},n.Image.prototype.getImageType=function(){return n.Image.getValueSafely(this.getTag(n.Tag.TAG_IMAGE_TYPE[0],n.Tag.TAG_IMAGE_TYPE[1]))},n.Image.prototype.getBitsStored=function(){return n.Image.getSingleValueSafely(this.getTag(n.Tag.TAG_BITS_STORED[0],n.Tag.TAG_BITS_STORED[1]),0)},n.Image.prototype.getBitsAllocated=function(){return n.Image.getSingleValueSafely(this.getTag(n.Tag.TAG_BITS_ALLOCATED[0],n.Tag.TAG_BITS_ALLOCATED[1]),0)},n.Image.prototype.getFrameTime=function(){return n.Image.getSingleValueSafely(this.getTag(n.Tag.TAG_FRAME_TIME[0],n.Tag.TAG_FRAME_TIME[1]),0)},n.Image.prototype.getAcquisitionMatrix=function(){var A,v,y,T,E;return A=[0,0],A[0]=n.Image.getSingleValueSafely(this.getTag(n.Tag.TAG_ACQUISITION_MATRIX[0],n.Tag.TAG_ACQUISITION_MATRIX[1]),0),this.privateDataAll===null&&(this.privateDataAll=this.getAllInterpretedPrivateData()),this.privateDataAll!==null&&this.privateDataAll.length>0&&(y=this.privateDataAll.indexOf("AcquisitionMatrixText"),y!==-1&&(T=this.privateDataAll.indexOf(` -`,y),T!==-1&&(E=this.privateDataAll.substring(y,T),v=E.match(/\d+/g),v!==null&&v.length===2?(A[0]=v[0],A[1]=v[1]):v!==null&&v.length===1&&(A[0]=v[0])))),A[1]===0&&(A[1]=A[0]),A},n.Image.prototype.getTR=function(){return n.Image.getSingleValueSafely(this.getTag(n.Tag.TAG_TR,n.Tag.TAG_TR[1]),0)},n.Image.prototype.putTag=function(A){this.tags[A.id]&&this.tags[A.id].value[0]!==A.value[0]||(this.tags[A.id]=A,this.putFlattenedTag(this.tagsFlat,A))},n.Image.prototype.putFlattenedTag=function(A,v){var y;if(v.sublist)for(y=0;yz&&(z=b,q=fe);return v?{data:e,min:B,minIndex:W,max:z,maxIndex:q,numCols:this.getCols(),numRows:this.getRows()}:e},n.Image.prototype.convertPalette=function(){var A,v,y,T,E,S,I,e,F,M,L,V;if(A=this.tags[n.Tag.createId(n.Tag.TAG_PIXEL_DATA[0],n.Tag.TAG_PIXEL_DATA[1])].value,v=this.getPalleteValues(n.Tag.TAG_PALETTE_RED),y=this.getPalleteValues(n.Tag.TAG_PALETTE_GREEN),T=this.getPalleteValues(n.Tag.TAG_PALETTE_BLUE),v!==null&&v.length>0&&y!==null&&y.length>0&&T!==null&&T.length>0&&!this.convertedPalette){if(E=new DataView(new ArrayBuffer(this.getRows()*this.getCols()*this.getNumberOfFrames()*3)),S=parseInt(Math.ceil(this.getBitsAllocated()/8)),I=A.byteLength/S,S===1)for(e=0;eF&&(F=Math.abs(v[y]),I=y);for(F=0;y<6;y+=1)Math.abs(v[y])>F&&(F=Math.abs(v[y]),e=y);switch(I){case 0:M+="X",e===4?M+="YZ":M+="ZY";break;case 1:M+="Y",e===3?M+="XZ":M+="ZX";break;case 2:M+="Z",e===3?M+="XY":M+="YX";break}switch(I){case 0:v[I]>0?M+="-":M+="+",e===4?v[e]>0?M+="-":M+="+":v[e]>0?M+="+":M+="-";break;case 1:v[I]>0?M+="-":M+="+",e===3?v[e]>0?M+="-":M+="+":v[e]>0?M+="+":M+="-";break;case 2:v[I]>0?M+="+":M+="-",v[e]>0?M+="-":M+="+";break}if(E===0)M+="+",A=M;else{if(S)switch(M.charAt(2)){case"X":E>0?M+="-":M+="+";break;case"Y":case"Z":E>0?M+="+":M+="-";break}else switch(M.charAt(2)){case"X":E>0?M+="+":M+="-";break;case"Y":case"Z":E>0?M+="-":M+="+";break}A=M}return A},n.Image.prototype.isMosaic=function(){var A,v=!1,y,T,E;if(A=this.getImageType(),A!==null){for(T=0;T0&&(E[0]1?S[y]=n.Utils.concatArrayBuffers2(E[y]):S[y]=E[y][0],E[y]=null;return S},n.Image.prototype.getRLE=function(){var A,v,y,T=[];if(A=this.getEncapsulatedData(),A)for(v=A.length,y=1;y");return T=T.replace(/\n\s*\n/g,` +`},"%p":function(B){return B.tm_hour>0&&B.tm_hour<13?"AM":"PM"},"%S":function(B){return I(B.tm_sec,2)},"%t":function(){return" "},"%u":function(B){var z=new Date(B.tm_year+1900,B.tm_mon+1,B.tm_mday,0,0,0,0);return z.getDay()||7},"%U":function(B){var z=new Date(B.tm_year+1900,0,1),b=z.getDay()===0?z:__addDays(z,7-z.getDay()),W=new Date(B.tm_year+1900,B.tm_mon,B.tm_mday);if(e(b,W)<0){var q=__arraySum(__isLeapYear(W.getFullYear())?__MONTH_DAYS_LEAP:__MONTH_DAYS_REGULAR,W.getMonth()-1)-31,Y=31-b.getDate(),X=Y+q+W.getDate();return I(Math.ceil(X/7),2)}return e(b,z)===0?"01":"00"},"%V":function(B){var z=new Date(B.tm_year+1900,0,4),b=new Date(B.tm_year+1901,0,4),W=F(z),q=F(b),Y=__addDays(new Date(B.tm_year+1900,0,1),B.tm_yday);if(e(Y,W)<0)return"53";if(e(q,Y)<=0)return"01";var X;return W.getFullYear()=0;return z=Math.abs(z)/60,z=z/60*100+z%60,(b?"+":"-")+("0000"+z).slice(-4)},"%Z":function(B){return B.tm_zone},"%%":function(){return"%"}};for(var y in L)A.indexOf(y)>=0&&(A=A.replace(new RegExp(y,"g"),L[y](m)));var V=intArrayFromString(A,!1);return V.length>n?0:(writeArrayToMemory(V,a),V.length-1)}function _strftime_l(a,n,s,u){return _strftime(a,n,s,u)}function _abort(){Module.abort()}function _free(){}Module._free=_free;function ___cxa_free_exception(a){try{return _free(a)}catch{}}function ___cxa_end_catch(){if(___cxa_end_catch.rethrown){___cxa_end_catch.rethrown=!1;return}asm.setThrew(0);var a=EXCEPTIONS.caught.pop();a&&(EXCEPTIONS.decRef(EXCEPTIONS.deAdjust(a)),EXCEPTIONS.last=0)}function _pthread_once(a,n){_pthread_once.seen||(_pthread_once.seen={}),!(a in _pthread_once.seen)&&(Runtime.dynCall("v",n),_pthread_once.seen[a]=1)}function ___lock(){}function ___unlock(){}var PTHREAD_SPECIFIC={};function _pthread_getspecific(a){return PTHREAD_SPECIFIC[a]||0}function ___setErrNo(a){return Module.___errno_location&&(HEAP32[Module.___errno_location()>>2]=a),a}var ERRNO_CODES={EPERM:1,ENOENT:2,ESRCH:3,EINTR:4,EIO:5,ENXIO:6,E2BIG:7,ENOEXEC:8,EBADF:9,ECHILD:10,EAGAIN:11,EWOULDBLOCK:11,ENOMEM:12,EACCES:13,EFAULT:14,ENOTBLK:15,EBUSY:16,EEXIST:17,EXDEV:18,ENODEV:19,ENOTDIR:20,EISDIR:21,EINVAL:22,ENFILE:23,EMFILE:24,ENOTTY:25,ETXTBSY:26,EFBIG:27,ENOSPC:28,ESPIPE:29,EROFS:30,EMLINK:31,EPIPE:32,EDOM:33,ERANGE:34,ENOMSG:42,EIDRM:43,ECHRNG:44,EL2NSYNC:45,EL3HLT:46,EL3RST:47,ELNRNG:48,EUNATCH:49,ENOCSI:50,EL2HLT:51,EDEADLK:35,ENOLCK:37,EBADE:52,EBADR:53,EXFULL:54,ENOANO:55,EBADRQC:56,EBADSLT:57,EDEADLOCK:35,EBFONT:59,ENOSTR:60,ENODATA:61,ETIME:62,ENOSR:63,ENONET:64,ENOPKG:65,EREMOTE:66,ENOLINK:67,EADV:68,ESRMNT:69,ECOMM:70,EPROTO:71,EMULTIHOP:72,EDOTDOT:73,EBADMSG:74,ENOTUNIQ:76,EBADFD:77,EREMCHG:78,ELIBACC:79,ELIBBAD:80,ELIBSCN:81,ELIBMAX:82,ELIBEXEC:83,ENOSYS:38,ENOTEMPTY:39,ENAMETOOLONG:36,ELOOP:40,EOPNOTSUPP:95,EPFNOSUPPORT:96,ECONNRESET:104,ENOBUFS:105,EAFNOSUPPORT:97,EPROTOTYPE:91,ENOTSOCK:88,ENOPROTOOPT:92,ESHUTDOWN:108,ECONNREFUSED:111,EADDRINUSE:98,ECONNABORTED:103,ENETUNREACH:101,ENETDOWN:100,ETIMEDOUT:110,EHOSTDOWN:112,EHOSTUNREACH:113,EINPROGRESS:115,EALREADY:114,EDESTADDRREQ:89,EMSGSIZE:90,EPROTONOSUPPORT:93,ESOCKTNOSUPPORT:94,EADDRNOTAVAIL:99,ENETRESET:102,EISCONN:106,ENOTCONN:107,ETOOMANYREFS:109,EUSERS:87,EDQUOT:122,ESTALE:116,ENOTSUP:95,ENOMEDIUM:123,EILSEQ:84,EOVERFLOW:75,ECANCELED:125,ENOTRECOVERABLE:131,EOWNERDEAD:130,ESTRPIPE:86};function _sysconf(a){switch(a){case 30:return PAGE_SIZE;case 85:return totalMemory/PAGE_SIZE;case 132:case 133:case 12:case 137:case 138:case 15:case 235:case 16:case 17:case 18:case 19:case 20:case 149:case 13:case 10:case 236:case 153:case 9:case 21:case 22:case 159:case 154:case 14:case 77:case 78:case 139:case 80:case 81:case 82:case 68:case 67:case 164:case 11:case 29:case 47:case 48:case 95:case 52:case 51:case 46:return 200809;case 79:return 0;case 27:case 246:case 127:case 128:case 23:case 24:case 160:case 161:case 181:case 182:case 242:case 183:case 184:case 243:case 244:case 245:case 165:case 178:case 179:case 49:case 50:case 168:case 169:case 175:case 170:case 171:case 172:case 97:case 76:case 32:case 173:case 35:return-1;case 176:case 177:case 7:case 155:case 8:case 157:case 125:case 126:case 92:case 93:case 129:case 130:case 131:case 94:case 91:return 1;case 74:case 60:case 69:case 70:case 4:return 1024;case 31:case 42:case 72:return 32;case 87:case 26:case 33:return 2147483647;case 34:case 1:return 47839;case 38:case 36:return 99;case 43:case 37:return 2048;case 0:return 2097152;case 3:return 65536;case 28:return 32768;case 44:return 32767;case 75:return 16384;case 39:return 1e3;case 89:return 700;case 71:return 256;case 40:return 255;case 2:return 100;case 180:return 64;case 25:return 20;case 5:return 16;case 6:return 6;case 73:return 4;case 84:return typeof navigator=="object"&&navigator.hardwareConcurrency||1}return ___setErrNo(ERRNO_CODES.EINVAL),-1}var _fabs=Math_abs,PTHREAD_SPECIFIC_NEXT_KEY=1;function _pthread_key_create(a,n){return a==0?ERRNO_CODES.EINVAL:(HEAP32[a>>2]=PTHREAD_SPECIFIC_NEXT_KEY,PTHREAD_SPECIFIC[PTHREAD_SPECIFIC_NEXT_KEY]=0,PTHREAD_SPECIFIC_NEXT_KEY++,0)}function _emscripten_set_main_loop_timing(a,n){if(Browser.mainLoop.timingMode=a,Browser.mainLoop.timingValue=n,!Browser.mainLoop.func)return 1;if(a==0)Browser.mainLoop.scheduler=function(){setTimeout(Browser.mainLoop.runner,n)},Browser.mainLoop.method="timeout";else if(a==1)Browser.mainLoop.scheduler=function(){Browser.requestAnimationFrame(Browser.mainLoop.runner)},Browser.mainLoop.method="rAF";else if(a==2){if(!window.setImmediate){let f=function(m){m.source===window&&m.data===u&&(m.stopPropagation(),s.shift()())};var s=[],u="__emcc";window.addEventListener("message",f,!0),window.setImmediate=function(A){s.push(A),window.postMessage(u,"*")}}Browser.mainLoop.scheduler=function(){window.setImmediate(Browser.mainLoop.runner)},Browser.mainLoop.method="immediate"}return 0}function _emscripten_set_main_loop(a,n,s,u,f){Module.noExitRuntime=!0,assert(!Browser.mainLoop.func,"emscripten_set_main_loop: there can only be one main loop function at once: call emscripten_cancel_main_loop to cancel the previous one before setting a new one with different parameters."),Browser.mainLoop.func=a,Browser.mainLoop.arg=u;var m=Browser.mainLoop.currentlyRunningMainloop;if(Browser.mainLoop.runner=function(){if(!ABORT){if(Browser.mainLoop.queue.length>0){var v=Date.now(),y=Browser.mainLoop.queue.shift();if(y.func(y.arg),Browser.mainLoop.remainingBlockers){var T=Browser.mainLoop.remainingBlockers,E=T%1==0?T-1:Math.floor(T);y.counted?Browser.mainLoop.remainingBlockers=E:(E=E+.5,Browser.mainLoop.remainingBlockers=(8*T+E)/9)}console.log('main loop blocker "'+y.name+'" took '+(Date.now()-v)+" ms"),Browser.mainLoop.updateStatus(),setTimeout(Browser.mainLoop.runner,0);return}if(!(m1&&Browser.mainLoop.currentFrameNumber%Browser.mainLoop.timingValue!=0){Browser.mainLoop.scheduler();return}Browser.mainLoop.method==="timeout"&&Module.ctx&&(Module.printErr("Looks like you are rendering without using requestAnimationFrame for the main loop. You should use 0 for the frame rate in emscripten_set_main_loop in order to use requestAnimationFrame, as that can greatly improve your frame rates!"),Browser.mainLoop.method=""),Browser.mainLoop.runIter(function(){typeof u<"u"?Runtime.dynCall("vi",a,[u]):Runtime.dynCall("v",a)}),!(m0?_emscripten_set_main_loop_timing(0,1e3/n):_emscripten_set_main_loop_timing(1,1),Browser.mainLoop.scheduler()),s)throw"SimulateInfiniteLoop"}var Browser={mainLoop:{scheduler:null,method:"",currentlyRunningMainloop:0,func:null,arg:0,timingMode:0,timingValue:0,currentFrameNumber:0,queue:[],pause:function(){Browser.mainLoop.scheduler=null,Browser.mainLoop.currentlyRunningMainloop++},resume:function(){Browser.mainLoop.currentlyRunningMainloop++;var a=Browser.mainLoop.timingMode,n=Browser.mainLoop.timingValue,s=Browser.mainLoop.func;Browser.mainLoop.func=null,_emscripten_set_main_loop(s,0,!1,Browser.mainLoop.arg,!0),_emscripten_set_main_loop_timing(a,n),Browser.mainLoop.scheduler()},updateStatus:function(){if(Module.setStatus){var a=Module.statusMessage||"Please wait...",n=Browser.mainLoop.remainingBlockers,s=Browser.mainLoop.expectedBlockers;n?n"u"&&(console.log("warning: Browser does not support creating object URLs. Built-in browser image decoding will not be available."),Module.noImageDecoding=!0);var a={};a.canHandle=function(m){return!Module.noImageDecoding&&/\.(jpg|jpeg|png|bmp)$/i.test(m)},a.handle=function(m,A,v,y){var T=null;if(Browser.hasBlobConstructor)try{T=new Blob([m],{type:Browser.getMimetype(A)}),T.size!==m.length&&(T=new Blob([new Uint8Array(m).buffer],{type:Browser.getMimetype(A)}))}catch(e){Runtime.warnOnce("Blob constructor present but fails: "+e+"; falling back to blob builder")}if(!T){var E=new Browser.BlobBuilder;E.append(new Uint8Array(m).buffer),T=E.getBlob()}var S=Browser.URLObject.createObjectURL(T),I=new Image;I.onload=function(){assert(I.complete,"Image "+A+" could not be decoded");var F=document.createElement("canvas");F.width=I.width,F.height=I.height;var M=F.getContext("2d");M.drawImage(I,0,0),Module.preloadedImages[A]=F,Browser.URLObject.revokeObjectURL(S),v&&v(m)},I.onerror=function(F){console.log("Image "+S+" could not be decoded"),y&&y()},I.src=S},Module.preloadPlugins.push(a);var n={};n.canHandle=function(m){return!Module.noAudioDecoding&&m.substr(-4)in{".ogg":1,".wav":1,".mp3":1}},n.handle=function(m,A,v,y){var T=!1;function E(M){T||(T=!0,Module.preloadedAudios[A]=M,v&&v(m))}function S(){T||(T=!0,Module.preloadedAudios[A]=new Audio,y&&y())}if(Browser.hasBlobConstructor){try{var I=new Blob([m],{type:Browser.getMimetype(A)})}catch{return S()}var e=Browser.URLObject.createObjectURL(I),F=new Audio;F.addEventListener("canplaythrough",function(){E(F)},!1),F.onerror=function(L){if(T)return;console.log("warning: browser could not fully decode audio "+A+", trying slower base64 approach");function V(B){for(var z="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",b="=",W="",q=0,Y=0,X=0;X=6;){var Q=q>>Y-6&63;Y-=6,W+=z[Q]}return Y==2?(W+=z[(q&3)<<4],W+=b+b):Y==4&&(W+=z[(q&15)<<2],W+=b),W}F.src="data:audio/x-"+A.substr(-3)+";base64,"+V(m),E(F)},F.src=e,Browser.safeSetTimeout(function(){E(F)},1e4)}else return S()},Module.preloadPlugins.push(n);var s=Module.canvas;function u(){Browser.pointerLock=document.pointerLockElement===s||document.mozPointerLockElement===s||document.webkitPointerLockElement===s||document.msPointerLockElement===s}s&&(s.requestPointerLock=s.requestPointerLock||s.mozRequestPointerLock||s.webkitRequestPointerLock||s.msRequestPointerLock||function(){},s.exitPointerLock=document.exitPointerLock||document.mozExitPointerLock||document.webkitExitPointerLock||document.msExitPointerLock||function(){},s.exitPointerLock=s.exitPointerLock.bind(document),document.addEventListener("pointerlockchange",u,!1),document.addEventListener("mozpointerlockchange",u,!1),document.addEventListener("webkitpointerlockchange",u,!1),document.addEventListener("mspointerlockchange",u,!1),Module.elementPointerLock&&s.addEventListener("click",function(f){!Browser.pointerLock&&s.requestPointerLock&&(s.requestPointerLock(),f.preventDefault())},!1))},createContext:function(a,n,s,u){if(n&&Module.ctx&&a==Module.canvas)return Module.ctx;var f,m;if(n){var A={antialias:!1,alpha:!1};if(u)for(var v in u)A[v]=u[v];m=GL.createContext(a,A),m&&(f=GL.getContext(m).GLctx),a.style.backgroundColor="black"}else f=a.getContext("2d");return f?(s&&(n||assert(typeof GLctx>"u","cannot set in module if GLctx is used, but we are a non-GL context that would replace it"),Module.ctx=f,n&&GL.makeContextCurrent(m),Module.useWebGL=n,Browser.moduleContextCreatedCallbacks.forEach(function(y){y()}),Browser.init()),f):null},destroyContext:function(a,n,s){},fullScreenHandlersInstalled:!1,lockPointer:void 0,resizeCanvas:void 0,requestFullScreen:function(a,n,s){Browser.lockPointer=a,Browser.resizeCanvas=n,Browser.vrDevice=s,typeof Browser.lockPointer>"u"&&(Browser.lockPointer=!0),typeof Browser.resizeCanvas>"u"&&(Browser.resizeCanvas=!1),typeof Browser.vrDevice>"u"&&(Browser.vrDevice=null);var u=Module.canvas;function f(){Browser.isFullScreen=!1;var A=u.parentNode;(document.webkitFullScreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.mozFullscreenElement||document.fullScreenElement||document.fullscreenElement||document.msFullScreenElement||document.msFullscreenElement||document.webkitCurrentFullScreenElement)===A?(u.cancelFullScreen=document.cancelFullScreen||document.mozCancelFullScreen||document.webkitCancelFullScreen||document.msExitFullscreen||document.exitFullscreen||function(){},u.cancelFullScreen=u.cancelFullScreen.bind(document),Browser.lockPointer&&u.requestPointerLock(),Browser.isFullScreen=!0,Browser.resizeCanvas&&Browser.setFullScreenCanvasSize()):(A.parentNode.insertBefore(u,A),A.parentNode.removeChild(A),Browser.resizeCanvas&&Browser.setWindowedCanvasSize()),Module.onFullScreen&&Module.onFullScreen(Browser.isFullScreen),Browser.updateCanvasDimensions(u)}Browser.fullScreenHandlersInstalled||(Browser.fullScreenHandlersInstalled=!0,document.addEventListener("fullscreenchange",f,!1),document.addEventListener("mozfullscreenchange",f,!1),document.addEventListener("webkitfullscreenchange",f,!1),document.addEventListener("MSFullscreenChange",f,!1));var m=document.createElement("div");u.parentNode.insertBefore(m,u),m.appendChild(u),m.requestFullScreen=m.requestFullScreen||m.mozRequestFullScreen||m.msRequestFullscreen||(m.webkitRequestFullScreen?function(){m.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT)}:null),s?m.requestFullScreen({vrDisplay:s}):m.requestFullScreen()},nextRAF:0,fakeRequestAnimationFrame:function(a){var n=Date.now();if(Browser.nextRAF===0)Browser.nextRAF=n+1e3/60;else for(;n+2>=Browser.nextRAF;)Browser.nextRAF+=1e3/60;var s=Math.max(Browser.nextRAF-n,0);setTimeout(a,s)},requestAnimationFrame:function a(n){typeof window>"u"?Browser.fakeRequestAnimationFrame(n):(window.requestAnimationFrame||(window.requestAnimationFrame=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame||window.oRequestAnimationFrame||Browser.fakeRequestAnimationFrame),window.requestAnimationFrame(n))},safeCallback:function(a){return function(){if(!ABORT)return a.apply(null,arguments)}},allowAsyncCallbacks:!0,queuedAsyncCallbacks:[],pauseAsyncCallbacks:function(){Browser.allowAsyncCallbacks=!1},resumeAsyncCallbacks:function(){if(Browser.allowAsyncCallbacks=!0,Browser.queuedAsyncCallbacks.length>0){var a=Browser.queuedAsyncCallbacks;Browser.queuedAsyncCallbacks=[],a.forEach(function(n){n()})}},safeRequestAnimationFrame:function(a){return Browser.requestAnimationFrame(function(){ABORT||(Browser.allowAsyncCallbacks?a():Browser.queuedAsyncCallbacks.push(a))})},safeSetTimeout:function(a,n){return Module.noExitRuntime=!0,setTimeout(function(){ABORT||(Browser.allowAsyncCallbacks?a():Browser.queuedAsyncCallbacks.push(a))},n)},safeSetInterval:function(a,n){return Module.noExitRuntime=!0,setInterval(function(){ABORT||Browser.allowAsyncCallbacks&&a()},n)},getMimetype:function(a){return{jpg:"image/jpeg",jpeg:"image/jpeg",png:"image/png",bmp:"image/bmp",ogg:"audio/ogg",wav:"audio/wav",mp3:"audio/mpeg"}[a.substr(a.lastIndexOf(".")+1)]},getUserMedia:function(a){window.getUserMedia||(window.getUserMedia=navigator.getUserMedia||navigator.mozGetUserMedia),window.getUserMedia(a)},getMovementX:function(a){return a.movementX||a.mozMovementX||a.webkitMovementX||0},getMovementY:function(a){return a.movementY||a.mozMovementY||a.webkitMovementY||0},getMouseWheelDelta:function(a){var n=0;switch(a.type){case"DOMMouseScroll":n=a.detail;break;case"mousewheel":n=a.wheelDelta;break;case"wheel":n=a.deltaY;break;default:throw"unrecognized mouse wheel event: "+a.type}return n},mouseX:0,mouseY:0,mouseMovementX:0,mouseMovementY:0,touches:{},lastTouches:{},calculateMouseEvent:function(a){if(Browser.pointerLock)a.type!="mousemove"&&"mozMovementX"in a?Browser.mouseMovementX=Browser.mouseMovementY=0:(Browser.mouseMovementX=Browser.getMovementX(a),Browser.mouseMovementY=Browser.getMovementY(a)),typeof SDL<"u"?(Browser.mouseX=SDL.mouseX+Browser.mouseMovementX,Browser.mouseY=SDL.mouseY+Browser.mouseMovementY):(Browser.mouseX+=Browser.mouseMovementX,Browser.mouseY+=Browser.mouseMovementY);else{var n=Module.canvas.getBoundingClientRect(),s=Module.canvas.width,u=Module.canvas.height,f=typeof window.scrollX<"u"?window.scrollX:window.pageXOffset,m=typeof window.scrollY<"u"?window.scrollY:window.pageYOffset;if(a.type==="touchstart"||a.type==="touchend"||a.type==="touchmove"){var A=a.touch;if(A===void 0)return;var v=A.pageX-(f+n.left),y=A.pageY-(m+n.top);v=v*(s/n.width),y=y*(u/n.height);var T={x:v,y};if(a.type==="touchstart")Browser.lastTouches[A.identifier]=T,Browser.touches[A.identifier]=T;else if(a.type==="touchend"||a.type==="touchmove"){var E=Browser.touches[A.identifier];E||(E=T),Browser.lastTouches[A.identifier]=E,Browser.touches[A.identifier]=T}return}var S=a.pageX-(f+n.left),I=a.pageY-(m+n.top);S=S*(s/n.width),I=I*(u/n.height),Browser.mouseMovementX=S-Browser.mouseX,Browser.mouseMovementY=I-Browser.mouseY,Browser.mouseX=S,Browser.mouseY=I}},xhrLoad:function(a,n,s){var u=new XMLHttpRequest;u.open("GET",a,!0),u.responseType="arraybuffer",u.onload=function(){u.status==200||u.status==0&&u.response?n(u.response):s()},u.onerror=s,u.send(null)},asyncLoad:function(a,n,s,u){Browser.xhrLoad(a,function(f){assert(f,'Loading data file "'+a+'" failed (no arrayBuffer).'),n(new Uint8Array(f)),u||removeRunDependency()},function(f){if(s)s();else throw'Loading data file "'+a+'" failed.'}),u||addRunDependency()},resizeListeners:[],updateResizeListeners:function(){var a=Module.canvas;Browser.resizeListeners.forEach(function(n){n(a.width,a.height)})},setCanvasSize:function(a,n,s){var u=Module.canvas;Browser.updateCanvasDimensions(u,a,n),s||Browser.updateResizeListeners()},windowedWidth:0,windowedHeight:0,setFullScreenCanvasSize:function(){if(typeof SDL<"u"){var a=HEAPU32[SDL.screen+Runtime.QUANTUM_SIZE*0>>2];a=a|8388608,HEAP32[SDL.screen+Runtime.QUANTUM_SIZE*0>>2]=a}Browser.updateResizeListeners()},setWindowedCanvasSize:function(){if(typeof SDL<"u"){var a=HEAPU32[SDL.screen+Runtime.QUANTUM_SIZE*0>>2];a=a&-8388609,HEAP32[SDL.screen+Runtime.QUANTUM_SIZE*0>>2]=a}Browser.updateResizeListeners()},updateCanvasDimensions:function(a,n,s){n&&s?(a.widthNative=n,a.heightNative=s):(n=a.widthNative,s=a.heightNative);var u=n,f=s;if(Module.forcedAspectRatio&&Module.forcedAspectRatio>0&&(u/f>2];return n},getStr:function(){var a=Pointer_stringify(SYSCALLS.get());return a},get64:function(){var a=SYSCALLS.get(),n=SYSCALLS.get();return a>=0?assert(n===0):assert(n===-1),a},getZero:function(){assert(SYSCALLS.get()===0)}};function ___syscall54(a,n){SYSCALLS.varargs=n;try{return 0}catch(s){return(typeof FS>"u"||!(s instanceof FS.ErrnoError))&&abort(s),-s.errno}}Module._i64Add=_i64Add,Module._bitshift64Lshr=_bitshift64Lshr;function ___cxa_pure_virtual(){throw ABORT=!0,"Pure virtual function called!"}function _pthread_cleanup_push(a,n){__ATEXIT__.push(function(){Runtime.dynCall("vi",a,[n])}),_pthread_cleanup_push.level=__ATEXIT__.length}function _pthread_cond_broadcast(){return 0}function ___cxa_guard_acquire(a){return HEAP8[a>>0]?0:(HEAP8[a>>0]=1,1)}function _pthread_cleanup_pop(){assert(_pthread_cleanup_push.level==__ATEXIT__.length,"cannot pop if something else added meanwhile!"),__ATEXIT__.pop(),_pthread_cleanup_push.level=__ATEXIT__.length}function ___cxa_guard_release(){}function ___cxa_begin_catch(a){return __ZSt18uncaught_exceptionv.uncaught_exception--,EXCEPTIONS.caught.push(a),EXCEPTIONS.addRef(EXCEPTIONS.deAdjust(a)),a}function _llvm_eh_typeid_for(a){return a}function _emscripten_memcpy_big(a,n,s){return HEAPU8.set(HEAPU8.subarray(n,n+s),a),a}Module._memcpy=_memcpy;function ___syscall6(a,n){SYSCALLS.varargs=n;try{var s=SYSCALLS.getStreamFromFD();return FS.close(s),0}catch(u){return(typeof FS>"u"||!(u instanceof FS.ErrnoError))&&abort(u),-u.errno}}function _pthread_mutex_lock(){}function _sbrk(a){var n=_sbrk;n.called||(DYNAMICTOP=alignMemoryPage(DYNAMICTOP),n.called=!0,assert(Runtime.dynamicAlloc),n.alloc=Runtime.dynamicAlloc,Runtime.dynamicAlloc=function(){abort("cannot dynamically allocate, sbrk now has control")});var s=DYNAMICTOP;if(a!=0){var u=n.alloc(a);if(!u)return 4294967295}return s}Module._bitshift64Shl=_bitshift64Shl;function ___cxa_guard_abort(){}Module._memmove=_memmove;function _pthread_cond_wait(){return 0}function ___cxa_rethrow(){___cxa_end_catch.rethrown=!0;var a=EXCEPTIONS.caught.pop();throw EXCEPTIONS.last=a,a}function _pthread_mutex_unlock(){}function _time(a){var n=Date.now()/1e3|0;return a&&(HEAP32[a>>2]=n),n}function _pthread_self(){return 0}function ___syscall140(a,n){SYSCALLS.varargs=n;try{var s=SYSCALLS.getStreamFromFD(),u=SYSCALLS.get(),f=SYSCALLS.get(),m=SYSCALLS.get(),A=SYSCALLS.get(),v=f;return assert(u===0),FS.llseek(s,v,A),HEAP32[m>>2]=s.position,s.getdents&&v===0&&A===0&&(s.getdents=null),0}catch(y){return(typeof FS>"u"||!(y instanceof FS.ErrnoError))&&abort(y),-y.errno}}function ___syscall146(a,n){SYSCALLS.varargs=n;try{var s=SYSCALLS.get(),u=SYSCALLS.get(),f=SYSCALLS.get(),m=0;___syscall146.buffer||(___syscall146.buffer=[]);for(var A=___syscall146.buffer,v=0;v>2],T=HEAP32[u+(v*8+4)>>2],E=0;E"u"||!(I instanceof FS.ErrnoError))&&abort(I),-I.errno}}function ___syscall145(a,n){SYSCALLS.varargs=n;try{var s=SYSCALLS.getStreamFromFD(),u=SYSCALLS.get(),f=SYSCALLS.get();return SYSCALLS.doReadv(s,u,f)}catch(m){return(typeof FS>"u"||!(m instanceof FS.ErrnoError))&&abort(m),-m.errno}}var ___dso_handle=allocate(1,"i32*",ALLOC_STATIC);Module.requestFullScreen=function a(n,s,u){Browser.requestFullScreen(n,s,u)},Module.requestAnimationFrame=function a(n){Browser.requestAnimationFrame(n)},Module.setCanvasSize=function a(n,s,u){Browser.setCanvasSize(n,s,u)},Module.pauseMainLoop=function a(){Browser.mainLoop.pause()},Module.resumeMainLoop=function a(){Browser.mainLoop.resume()},Module.getUserMedia=function a(){Browser.getUserMedia()},Module.createContext=function a(n,s,u,f){return Browser.createContext(n,s,u,f)},STACK_BASE=STACKTOP=Runtime.alignMemory(STATICTOP),staticSealed=!0,STACK_MAX=STACK_BASE+TOTAL_STACK,DYNAMIC_BASE=DYNAMICTOP=Runtime.alignMemory(STACK_MAX),assert(DYNAMIC_BASE2147483648?!1:(S=new u(t),I=new f(t),e=new m(t),F=new A(t),M=new v(t),L=new y(t),V=new T(t),B=new E(t),s=t,!0)}function na(t){t=t|0;var r=0;return r=b,b=b+t|0,b=b+15&-16,r|0}function ra(){return b|0}function sa(t){t=t|0,b=t}function oa(t,r){t=t|0,r=r|0,b=t,W=r}function aa(t,r){t=t|0,r=r|0,g||(g=t,J=r)}function hA(t){t=t|0,S[q>>0]=S[t>>0],S[q+1>>0]=S[t+1>>0],S[q+2>>0]=S[t+2>>0],S[q+3>>0]=S[t+3>>0]}function dA(t){t=t|0,S[q>>0]=S[t>>0],S[q+1>>0]=S[t+1>>0],S[q+2>>0]=S[t+2>>0],S[q+3>>0]=S[t+3>>0],S[q+4>>0]=S[t+4>>0],S[q+5>>0]=S[t+5>>0],S[q+6>>0]=S[t+6>>0],S[q+7>>0]=S[t+7>>0]}function la(t){t=t|0,ye=t}function ua(){return ye|0}function ca(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0,G=0,$=0;if($=b,b=b+128|0,N=$+44|0,U=$+8|0,C=$+4|0,k=$,R=o+4|0,_=o+8|0,g=0,$e(35,e[o>>2]|0,e[R>>2]|0,e[_>>2]|0,l|0),D=g,g=0,D&1)H=5;else{d=N,h=d+84|0;do e[d>>2]=e[l>>2],d=d+4|0,l=l+4|0;while((d|0)<(h|0));if(l=N+12|0,!(e[l>>2]|0)&&(w=ee(((e[N+8>>2]|0)+7|0)/8|0,e[N>>2]|0)|0,e[l>>2]=w,(e[N+24>>2]|0)!=0)&&(D=ee(e[N+16>>2]|0,w)|0,e[l>>2]=D),g=0,ue(176,U|0),D=g,g=0,D&1)H=5;else{l=N+56|0;do if(e[l>>2]|0)if(g=0,l=ge(66,l|0)|0,D=g,g=0,D&1)H=15;else{if(e[C>>2]=l,h=U+28|0,d=e[h>>2]|0,d>>>0<(e[U+32>>2]|0)>>>0){e[d>>2]=l,e[h>>2]=d+4,e[C>>2]=0,H=19;break}if(g=0,Ae(57,U+24|0,C|0),D=g,g=0,D&1){if(h=j(824,0)|0,l=ye,d=e[C>>2]|0,e[C>>2]=0,!d)break;Mt[e[(e[d>>2]|0)+4>>2]&255](d);break}else{if(l=e[C>>2]|0,e[C>>2]=0,!l){H=19;break}Mt[e[(e[l>>2]|0)+4>>2]&255](l),H=19;break}}else H=19;while(!1);e:do if((H|0)==19)if(d=N+4|0,w=N+8|0,C=N+16|0,g=0,l=Pe(14,e[N>>2]|0,e[d>>2]|0,e[w>>2]|0,e[C>>2]|0)|0,D=g,g=0,D&1)H=15;else{e[k>>2]=l,D=U+28|0,h=e[D>>2]|0;do if(h>>>0>=(e[U+32>>2]|0)>>>0)if(g=0,Ae(57,U+24|0,k|0),h=g,g=0,h&1){if(h=j(824,0)|0,l=ye,d=e[k>>2]|0,e[k>>2]=0,!d)break e;Mt[e[(e[d>>2]|0)+4>>2]&255](d);break e}else{if(l=e[k>>2]|0,e[k>>2]=0,!l)break;Mt[e[(e[l>>2]|0)+4>>2]&255](l);break}else e[h>>2]=l,e[D>>2]=h+4,e[k>>2]=0;while(!1);if(l=e[N+28>>2]|0,l|0&&(g=0,Ae(58,U|0,l|0),H=g,g=0,H&1)){H=15;break}t:do if(e[N+24>>2]|0){if(g=0,xe(4,U|0,o|0,N|0),H=g,g=0,H&1){H=15;break e}}else if(l=ee(e[d>>2]|0,e[N>>2]|0)|0,l=ee(l,((e[w>>2]|0)+7|0)/8|0)|0,(e[C>>2]|0)>0){for(d=0;g=0,xe(4,U|0,o|0,N|0),H=g,g=0,!(H&1);)if(h=e[R>>2]|0,h&&(e[R>>2]=h+l,e[_>>2]=(e[_>>2]|0)-l),d=d+1|0,(d|0)>=(e[C>>2]|0))break t;h=j(824,0)|0,l=ye,H=16;break e}while(!1);if(g=0,be(33,U|0,t|0)|0,H=g,g=0,H&1)H=15;else{if(e[r>>2]=e[U+16>>2],c&&(S[c>>0]=0),d=U+24|0,l=e[d>>2]|0,l){if(h=e[D>>2]|0,(h|0)!=(l|0)){do c=h+-4|0,e[D>>2]=c,h=e[c>>2]|0,e[c>>2]=0,h&&Mt[e[(e[h>>2]|0)+4>>2]&255](h),h=e[D>>2]|0;while((h|0)!=(l|0));l=e[d>>2]|0}he(l)}return c=0,b=$,c|0}}while(!1);if((H|0)==15&&(h=j(824,0)|0,l=ye,H=16),D=U+24|0,d=e[D>>2]|0,d){if(C=U+28|0,w=e[C>>2]|0,(w|0)!=(d|0)){do U=w+-4|0,e[C>>2]=U,w=e[U>>2]|0,e[U>>2]=0,w&&Mt[e[(e[w>>2]|0)+4>>2]&255](w),w=e[C>>2]|0;while((w|0)!=(d|0));d=e[D>>2]|0}he(d)}}}if((H|0)==5&&(h=j(824,0)|0,l=ye),U=(l|0)==($n(824)|0),w=K0(h|0)|0,l=(c|0)==0,!U)return l||(S[c>>0]=0),ei(),c=14,b=$,c|0;d=w+12|0;do if(l)H=60;else if(l=e[d>>2]|0,g=0,h=Ce(1)|0,U=g,g=0,!(U&1))if((l|0)==(h|0)){Rr(c,Dt[e[(e[w>>2]|0)+8>>2]&127](w)|0)|0,H=60;break}else{S[c>>0]=0,H=60;break}while(!1);return(H|0)==60&&(K=e[d>>2]|0,g=0,G=Ce(1)|0,c=g,g=0,!(c&1))?(c=(K|0)==(G|0)?e[w+8>>2]|0:13,ei(),b=$,c|0):(l=j()|0,g=0,Nt(3),$=g,g=0,$&1?($=j(0)|0,$t($)):le(l|0),0)}function fa(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0;switch(D=b,b=b+112|0,h=D+96|0,C=D+84|0,k=D+72|0,N=D+60|0,R=D+48|0,_=D+36|0,U=D+24|0,H=D+12|0,K=D,w=(r|0)==0,(t|0)==0&w&&(c=Ct(16)|0,g=0,xe(5,h|0,48504,52),K=g,g=0,K&1?r=j()|0:(g=0,r=Ce(1)|0,K=g,g=0,!(K&1)&&(g=0,$e(36,c|0,1,r|0,h|0),K=g,g=0,!(K&1))?(g=0,xe(6,c|0,824,96),g=0,t=0):t=1,r=j()|0,de(h),t||(K=r,le(K|0))),Tt(c|0),K=r,le(K|0)),d=e[l>>2]|0,(d+-1|0)>>>0>65534&&(c=Ct(16)|0,g=0,xe(5,C|0,48557,41),K=g,g=0,K&1?r=j()|0:(g=0,r=Ce(1)|0,K=g,g=0,!(K&1)&&(g=0,$e(36,c|0,1,r|0,C|0),K=g,g=0,!(K&1))?(g=0,xe(6,c|0,824,96),g=0,t=0):t=1,r=j()|0,de(C),t||(K=r,le(K|0))),Tt(c|0),K=r,le(K|0)),h=e[l+4>>2]|0,(h+-1|0)>>>0>65534&&(c=Ct(16)|0,g=0,xe(5,k|0,48599,42),K=g,g=0,K&1?r=j()|0:(g=0,r=Ce(1)|0,K=g,g=0,!(K&1)&&(g=0,$e(36,c|0,1,r|0,k|0),K=g,g=0,!(K&1))?(g=0,xe(6,c|0,824,96),g=0,t=0):t=1,r=j()|0,de(k),t||(K=r,le(K|0))),Tt(c|0),K=r,le(K|0)),c=e[l+8>>2]|0,(c+-2|0)>>>0>14&&(c=Ct(16)|0,g=0,xe(5,N|0,48642,46),K=g,g=0,K&1?r=j()|0:(g=0,r=Ce(1)|0,K=g,g=0,!(K&1)&&(g=0,$e(36,c|0,1,r|0,N|0),K=g,g=0,!(K&1))?(g=0,xe(6,c|0,824,96),g=0,t=0):t=1,r=j()|0,de(N),t||(K=r,le(K|0))),Tt(c|0),K=r,le(K|0)),t=e[l+24>>2]|0,t>>>0>=3&&(c=Ct(16)|0,g=0,xe(5,R|0,48689,65),K=g,g=0,K&1?r=j()|0:(g=0,r=Ce(1)|0,K=g,g=0,!(K&1)&&(g=0,$e(36,c|0,1,r|0,R|0),K=g,g=0,!(K&1))?(g=0,xe(6,c|0,824,96),g=0,t=0):t=1,r=j()|0,de(R),t||(K=r,le(K|0))),Tt(c|0),K=r,le(K|0)),r=e[l+16>>2]|0,(r+-1|0)>>>0>254&&(c=Ct(16)|0,g=0,xe(5,_|0,48755,44),K=g,g=0,K&1?r=j()|0:(g=0,r=Ce(1)|0,K=g,g=0,!(K&1)&&(g=0,$e(36,c|0,1,r|0,_|0),K=g,g=0,!(K&1))?(g=0,xe(6,c|0,824,96),g=0,t=0):t=1,r=j()|0,de(_),t||(K=r,le(K|0))),Tt(c|0),K=r,le(K|0)),!w&&(_=ee(h,d)|0,(ee(ee(_,(c|0)>8?2:1)|0,r)|0)>>>0>o>>>0)&&(c=Ct(16)|0,g=0,xe(5,U|0,48800,58),K=g,g=0,K&1?r=j()|0:(g=0,r=Ce(1)|0,K=g,g=0,!(K&1)&&(g=0,$e(36,c|0,1,r|0,U|0),K=g,g=0,!(K&1))?(g=0,xe(6,c|0,824,96),g=0,t=0):t=1,r=j()|0,de(U),t||(K=r,le(K|0))),Tt(c|0),K=r,le(K|0)),r|0){case 4:{if((t|0)!=2){b=D;return}c=Ct(16)|0,g=0,xe(5,H|0,48859,73),K=g,g=0,K&1?r=j()|0:(g=0,r=Ce(1)|0,K=g,g=0,!(K&1)&&(g=0,$e(36,c|0,1,r|0,H|0),K=g,g=0,!(K&1))?(g=0,xe(6,c|0,824,96),g=0,t=0):t=1,r=j()|0,de(H),t||(K=r,le(K|0))),Tt(c|0),K=r,le(K|0)}case 3:{b=D;return}default:{if(!t){b=D;return}c=Ct(16)|0,g=0,xe(5,K|0,48933,73),H=g,g=0,H&1?r=j()|0:(g=0,r=Ce(1)|0,H=g,g=0,!(H&1)&&(g=0,$e(36,c|0,1,r|0,K|0),H=g,g=0,!(H&1))?(g=0,xe(6,c|0,824,96),g=0,t=0):t=1,r=j()|0,de(K),t||(K=r,le(K|0))),Tt(c|0),K=r,le(K|0)}}}function $t(t){t=t|0,K0(t|0)|0,P6()}function ha(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0,D=0,k=0;if(k=b,b=b+128|0,h=k+116|0,d=k,g=0,e[h>>2]=e[r>>2],e[h+4>>2]=e[r+4>>2],e[h+8>>2]=e[r+8>>2],Ae(59,d|0,h|0),c=g,g=0,!(c&1)){if(o){c=d+16|0,r=c+84|0;do e[c>>2]=e[o>>2],c=c+4|0,o=o+4|0;while((c|0)<(r|0))}if(g=0,e[h>>2]=e[t>>2],e[h+4>>2]=e[t+4>>2],e[h+8>>2]=e[t+8>>2],Ae(60,d|0,h|0),d=g,g=0,!(d&1))return l&&(S[l>>0]=0),D=0,b=k,D|0}if(t=j(824,0)|0,d=ye,d=(d|0)==($n(824)|0),t=K0(t|0)|0,r=(l|0)==0,!d)return r||(S[l>>0]=0),ei(),D=14,b=k,D|0;c=t+12|0;do if(r)D=10;else if(r=e[c>>2]|0,g=0,o=Ce(1)|0,d=g,g=0,!(d&1))if((r|0)==(o|0)){Rr(l,Dt[e[(e[t>>2]|0)+8>>2]&127](t)|0)|0,D=10;break}else{S[l>>0]=0,D=10;break}while(!1);return(D|0)==10&&(w=e[c>>2]|0,g=0,C=Ce(1)|0,D=g,g=0,!(D&1))?(D=(w|0)==(C|0)?e[t+8>>2]|0:13,ei(),b=k,D|0):(r=j()|0,g=0,Nt(3),k=g,g=0,k&1?(k=j(0)|0,$t(k)):le(r|0),0)}function da(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0,w=0,C=0,D=0;if(C=b,b=b+128|0,c=C+116|0,l=C,g=0,e[c>>2]=e[t>>2],e[c+4>>2]=e[t+4>>2],e[c+8>>2]=e[t+8>>2],Ae(59,l|0,c|0),c=g,g=0,!(c&1)&&(g=0,ue(177,l|0),c=g,g=0,!(c&1))&&(g=0,Ae(61,l|0,1),c=g,g=0,!(c&1))){t=l+16|0,l=r+84|0;do e[r>>2]=e[t>>2],r=r+4|0,t=t+4|0;while((r|0)<(l|0));return o&&(S[o>>0]=0),o=0,b=C,o|0}if(c=j(824,0)|0,r=ye,r=(r|0)==($n(824)|0),c=K0(c|0)|0,t=(o|0)==0,!r)return t||(S[o>>0]=0),ei(),o=14,b=C,o|0;r=c+12|0;do if(t)w=13;else if(t=e[r>>2]|0,g=0,l=Ce(1)|0,D=g,g=0,!(D&1))if((t|0)==(l|0)){Rr(o,Dt[e[(e[c>>2]|0)+8>>2]&127](c)|0)|0,w=13;break}else{S[o>>0]=0,w=13;break}while(!1);return(w|0)==13&&(h=e[r>>2]|0,g=0,d=Ce(1)|0,D=g,g=0,!(D&1))?(D=(h|0)==(d|0)?e[c+8>>2]|0:13,ei(),b=C,D|0):(t=j()|0,g=0,Nt(3),D=g,g=0,D&1?(D=j(0)|0,$t(D)):le(t|0),0)}function pa(t,r,o,l,c,h,d){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0;var w=0,C=0,D=0,k=0,N=0;return N=b,b=b+48|0,C=N+36|0,w=N+24|0,D=N+12|0,k=N,(t|0)!=0&(o|0)!=0&(l|0)!=0&(h|0)!=0?(e[D>>2]=0,e[D+4>>2]=t,e[D+8>>2]=r,e[k>>2]=0,e[k+4>>2]=l,e[k+8>>2]=c,e[w>>2]=e[D>>2],e[w+4>>2]=e[D+4>>2],e[w+8>>2]=e[D+8>>2],e[C>>2]=e[k>>2],e[C+4>>2]=e[k+4>>2],e[C+8>>2]=e[k+8>>2],c=ca(w,o,C,h,d)|0,b=N,c|0):(c=1,b=N,c|0)}function ma(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0;return c=b,b=b+32|0,h=c+12|0,d=c,w=d,e[w>>2]=0,e[w+4>>2]=0,e[d+4>>2]=t,e[d+8>>2]=r,e[h>>2]=e[d>>2],e[h+4>>2]=e[d+4>>2],e[h+8>>2]=e[d+8>>2],o=da(h,o,l)|0,b=c,o|0}function ga(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0;return d=b,b=b+48|0,w=d+36|0,C=d+24|0,k=d+12|0,D=d,e[k>>2]=0,e[k+4>>2]=t,e[k+8>>2]=r,e[D>>2]=0,e[D+4>>2]=o,e[D+8>>2]=l,e[C>>2]=e[k>>2],e[C+4>>2]=e[k+4>>2],e[C+8>>2]=e[k+8>>2],e[w>>2]=e[D>>2],e[w+4>>2]=e[D+4>>2],e[w+8>>2]=e[D+8>>2],l=ha(C,w,c,h)|0,b=d,l|0}function Sa(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0;if(D=t+4|0,o=e[t>>2]|0,c=((e[D>>2]|0)-o>>2)+1|0,c>>>0>1073741823&&(pi(t),o=e[t>>2]|0),k=t+8|0,l=(e[k>>2]|0)-o|0,l>>2>>>0<536870911?(l=l>>1,l=l>>>0>>0?c:l,o=(e[D>>2]|0)-o>>2,l?w=6:(h=0,d=0)):(l=1073741823,o=(e[D>>2]|0)-o>>2,w=6),(w|0)==6&&(h=l,d=Xe(l<<2)|0),c=d+(o<<2)|0,l=c,C=d+(h<<2)|0,w=e[r>>2]|0,e[r>>2]=0,e[c>>2]=w,w=d+(o+1<<2)|0,d=e[t>>2]|0,o=e[D>>2]|0,(o|0)==(d|0))c=t,h=D;else{do o=o+-4|0,r=e[o>>2]|0,e[o>>2]=0,e[c+-4>>2]=r,c=l+-4|0,l=c;while((o|0)!=(d|0));o=l,c=t,h=D,l=o,d=e[t>>2]|0,o=e[D>>2]|0}if(e[c>>2]=l,e[h>>2]=w,e[k>>2]=C,c=d,(o|0)!=(c|0))do o=o+-4|0,l=e[o>>2]|0,e[o>>2]=0,l&&Mt[e[(e[l>>2]|0)+4>>2]&255](l);while((o|0)!=(c|0));d&&he(d)}function Aa(){return S[8]|0||!(kt(8)|0)||(Ft(72,35648,Q|0)|0,bt(8)),35648}function un(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0;k=b,b=b+32|0,C=k,m0(C,(1<>2]|0,D=h+1|0,o=D<<1,e[t>>2]=0,d=t+4|0,e[d>>2]=0,e[t+8>>2]=0;e:do if(D){if((h|0)<-1&&(g=0,ue(178,t|0),w=g,g=0,w&1)||(l=4),(l|0)==4&&(g=0,c=ge(67,o|0)|0,w=g,g=0,!(w&1))){for(e[d>>2]=c,e[t>>2]=c,e[t+8>>2]=c+o,r=c;;)if(S[r>>0]=0,r=(e[d>>2]|0)+1|0,e[d>>2]=r,o=o+-1|0,!o)break e}o=j()|0,r=e[t>>2]|0,r||le(o|0),(e[d>>2]|0)!=(r|0)&&(e[d>>2]=r),he(r),le(o|0)}while(!1);if(r=~h,(h|0)<(r|0)){b=k;return}d=C+12|0,w=C+8|0,h=C+4|0,c=r;do r=e[d>>2]|0,(c|0)>(0-r|0)?(o=e[w>>2]|0,(c|0)>(0-o|0)?(l=e[h>>2]|0,(c|0)>(0-l|0)?(c|0)>=0?(c|0)>0?(l|0)<=(c|0)?(o|0)>(c|0)?r=2:r=(r|0)>(c|0)?3:4:r=1:r=0:r=-1:r=-2):r=-3):r=-4,S[(e[t>>2]|0)+(c+D)>>0]=r,c=c+1|0;while((c|0)<(D|0));b=k}function va(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0;switch(R=e[o+16>>2]|0,R|0){case 64:case 0:{g=0,t=be(34,t|0,r|0)|0,r=g,g=0,r&1?_=16:l=t;break}default:{for(c=(1<>2])+-1|0,N=e[r+20>>2]|0,k=N<<1,k=((k+c|0)/(k|1|0)|0)+1|0,t=0;(1<>2]|0,g=0,l=ge(67,4624)|0,D=g,g=0,D&1)_=16;else{h=((d|0)<8?8:d)+d<<1,w=l+4|0,C=r,D=w+84|0;do e[w>>2]=e[C>>2],w=w+4|0,C=C+4|0;while((w|0)<(D|0));w=l+88|0,D=w+40|0;do e[w>>2]=0,w=w+4|0;while((w|0)<(D|0));e[l>>2]=35660,e[l+128>>2]=c,e[l+132>>2]=k,e[l+136>>2]=N,e[l+140>>2]=t,e[l+144>>2]=d,e[l+148>>2]=h,e[l+152>>2]=R,t=l+156|0,e[t>>2]=0,e[t+4>>2]=0,e[t+8>>2]=0,e[t+12>>2]=0,e[l+172>>2]=e[r>>2],e[l+176>>2]=0,e[l+180>>2]=0,e[l+184>>2]=0,t=l+4568|0,c=l+188|0;do e[c>>2]=0,e[c+4>>2]=0,I[c+8>>1]=0,I[c+10>>1]=1,c=c+12|0;while((c|0)!=(t|0));e[t>>2]=0,e[t+4>>2]=0,I[t+8>>1]=0,S[t+10>>0]=0,r=l+4580|0,e[r>>2]=0,e[r+4>>2]=0,I[r+8>>1]=0,S[r+10>>0]=0,r=l+4592|0,e[r>>2]=0,e[r+4>>2]=0,e[r+8>>2]=0,e[r+12>>2]=0,e[r+16>>2]=0,e[r+20>>2]=0,e[r+24>>2]=0,S[r+28>>0]=0,e[l+28>>2]|0||(e[l+20>>2]=1)}}}return(_|0)==16&&(_=j()|0,le(_|0)),!l||(g=0,Ae(e[(e[l>>2]|0)+12>>2]|0,l|0,o|0),_=g,g=0,!(_&1))?l|0:(t=j()|0,l||(_=t,le(_|0)),Mt[e[(e[l>>2]|0)+4>>2]&255](l),_=t,le(_|0),0)}function xa(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0;if(o=(e[r+24>>2]|0)==2,o&&(e[r+16>>2]|0)!=3)return r=0,r|0;k=e[r+20>>2]|0,t=e[r+8>>2]|0;e:do if(!k){if(o){if((t|0)!=8)break;l=Xe(4600)|0,d=l+4|0,w=r,C=d+84|0;do e[d>>2]=e[w>>2],d=d+4|0,w=w+4|0;while((d|0)<(C|0));d=l+88|0,C=d+40|0;do e[d>>2]=0,d=d+4|0;while((d|0)<(C|0));e[l>>2]=35688,t=l+132|0,e[t>>2]=0,e[t+4>>2]=0,e[t+8>>2]=0,e[t+12>>2]=0,e[l+148>>2]=e[r>>2],e[l+152>>2]=0,e[l+156>>2]=0,e[l+160>>2]=0,t=l+4544|0,o=l+164|0;do e[o>>2]=0,e[o+4>>2]=0,I[o+8>>1]=0,I[o+10>>1]=1,o=o+12|0;while((o|0)!=(t|0));return e[t>>2]=0,e[t+4>>2]=0,I[t+8>>1]=0,S[t+10>>0]=0,r=l+4556|0,e[r>>2]=0,e[r+4>>2]=0,I[r+8>>1]=0,S[r+10>>0]=0,r=l+4568|0,e[r>>2]=0,e[r+4>>2]=0,e[r+8>>2]=0,e[r+12>>2]=0,e[r+16>>2]=0,e[r+20>>2]=0,e[r+24>>2]=0,S[r+28>>0]=0,e[l+28>>2]|0||(e[l+20>>2]=1),r=l,r|0}switch(t|0){case 8:{l=Xe(4600)|0,d=l+4|0,w=r,C=d+84|0;do e[d>>2]=e[w>>2],d=d+4|0,w=w+4|0;while((d|0)<(C|0));d=l+88|0,C=d+40|0;do e[d>>2]=0,d=d+4|0;while((d|0)<(C|0));e[l>>2]=35716,t=l+132|0,e[t>>2]=0,e[t+4>>2]=0,e[t+8>>2]=0,e[t+12>>2]=0,e[l+148>>2]=e[r>>2],e[l+152>>2]=0,e[l+156>>2]=0,e[l+160>>2]=0,t=l+4544|0,o=l+164|0;do e[o>>2]=0,e[o+4>>2]=0,I[o+8>>1]=0,I[o+10>>1]=1,o=o+12|0;while((o|0)!=(t|0));return e[t>>2]=0,e[t+4>>2]=0,I[t+8>>1]=0,S[t+10>>0]=0,r=l+4556|0,e[r>>2]=0,e[r+4>>2]=0,I[r+8>>1]=0,S[r+10>>0]=0,r=l+4568|0,e[r>>2]=0,e[r+4>>2]=0,e[r+8>>2]=0,e[r+12>>2]=0,e[r+16>>2]=0,e[r+20>>2]=0,e[r+24>>2]=0,S[r+28>>0]=0,e[l+28>>2]|0||(e[l+20>>2]=1),r=l,r|0}case 12:{l=Xe(4600)|0,d=l+4|0,w=r,C=d+84|0;do e[d>>2]=e[w>>2],d=d+4|0,w=w+4|0;while((d|0)<(C|0));d=l+88|0,C=d+40|0;do e[d>>2]=0,d=d+4|0;while((d|0)<(C|0));e[l>>2]=35744,t=l+132|0,e[t>>2]=0,e[t+4>>2]=0,e[t+8>>2]=0,e[t+12>>2]=0,e[l+148>>2]=e[r>>2],e[l+152>>2]=0,e[l+156>>2]=0,e[l+160>>2]=0,t=l+4544|0,o=l+164|0;do e[o>>2]=0,e[o+4>>2]=0,I[o+8>>1]=0,I[o+10>>1]=1,o=o+12|0;while((o|0)!=(t|0));return e[t>>2]=0,e[t+4>>2]=0,I[t+8>>1]=0,S[t+10>>0]=0,r=l+4556|0,e[r>>2]=0,e[r+4>>2]=0,I[r+8>>1]=0,S[r+10>>0]=0,r=l+4568|0,e[r>>2]=0,e[r+4>>2]=0,e[r+8>>2]=0,e[r+12>>2]=0,e[r+16>>2]=0,e[r+20>>2]=0,e[r+24>>2]=0,S[r+28>>0]=0,e[l+28>>2]|0||(e[l+20>>2]=1),r=l,r|0}case 16:{l=Xe(4600)|0,d=l+4|0,w=r,C=d+84|0;do e[d>>2]=e[w>>2],d=d+4|0,w=w+4|0;while((d|0)<(C|0));d=l+88|0,C=d+40|0;do e[d>>2]=0,d=d+4|0;while((d|0)<(C|0));e[l>>2]=35772,t=l+132|0,e[t>>2]=0,e[t+4>>2]=0,e[t+8>>2]=0,e[t+12>>2]=0,e[l+148>>2]=e[r>>2],e[l+152>>2]=0,e[l+156>>2]=0,e[l+160>>2]=0,t=l+4544|0,o=l+164|0;do e[o>>2]=0,e[o+4>>2]=0,I[o+8>>1]=0,I[o+10>>1]=1,o=o+12|0;while((o|0)!=(t|0));return e[t>>2]=0,e[t+4>>2]=0,I[t+8>>1]=0,S[t+10>>0]=0,r=l+4556|0,e[r>>2]=0,e[r+4>>2]=0,I[r+8>>1]=0,S[r+10>>0]=0,r=l+4568|0,e[r>>2]=0,e[r+4>>2]=0,e[r+8>>2]=0,e[r+12>>2]=0,e[r+16>>2]=0,e[r+20>>2]=0,e[r+24>>2]=0,S[r+28>>0]=0,e[l+28>>2]|0||(e[l+20>>2]=1),r=l,r|0}default:break e}}while(!1);if(D=(1<>2]=e[w>>2],d=d+4|0,w=w+4|0;while((d|0)<(C|0));d=c+88|0,C=d+40|0;do e[d>>2]=0,d=d+4|0;while((d|0)<(C|0));e[c>>2]=35800,e[c+128>>2]=D,e[c+132>>2]=h,e[c+136>>2]=k,e[c+140>>2]=t,e[c+144>>2]=o,e[c+148>>2]=l,e[c+152>>2]=64,t=c+156|0,e[t>>2]=0,e[t+4>>2]=0,e[t+8>>2]=0,e[t+12>>2]=0,e[c+172>>2]=e[r>>2],e[c+176>>2]=0,e[c+180>>2]=0,e[c+184>>2]=0,t=c+4568|0,o=c+188|0;do e[o>>2]=0,e[o+4>>2]=0,I[o+8>>1]=0,I[o+10>>1]=1,o=o+12|0;while((o|0)!=(t|0));return e[t>>2]=0,e[t+4>>2]=0,I[t+8>>1]=0,S[t+10>>0]=0,r=c+4580|0,e[r>>2]=0,e[r+4>>2]=0,I[r+8>>1]=0,S[r+10>>0]=0,r=c+4592|0,e[r>>2]=0,e[r+4>>2]=0,e[r+8>>2]=0,e[r+12>>2]=0,e[r+16>>2]=0,e[r+20>>2]=0,e[r+24>>2]=0,S[r+28>>0]=0,e[c+28>>2]|0||(e[c+20>>2]=1),r=c,r|0}else{for(t=0;(1<>2]=e[w>>2],d=d+4|0,w=w+4|0;while((d|0)<(C|0));d=c+88|0,C=d+40|0;do e[d>>2]=0,d=d+4|0;while((d|0)<(C|0));e[c>>2]=35660,e[c+128>>2]=D,e[c+132>>2]=h,e[c+136>>2]=k,e[c+140>>2]=t,e[c+144>>2]=o,e[c+148>>2]=l,e[c+152>>2]=64,t=c+156|0,e[t>>2]=0,e[t+4>>2]=0,e[t+8>>2]=0,e[t+12>>2]=0,e[c+172>>2]=e[r>>2],e[c+176>>2]=0,e[c+180>>2]=0,e[c+184>>2]=0,t=c+4568|0,o=c+188|0;do e[o>>2]=0,e[o+4>>2]=0,I[o+8>>1]=0,I[o+10>>1]=1,o=o+12|0;while((o|0)!=(t|0));return e[t>>2]=0,e[t+4>>2]=0,I[t+8>>1]=0,S[t+10>>0]=0,r=c+4580|0,e[r>>2]=0,e[r+4>>2]=0,I[r+8>>1]=0,S[r+10>>0]=0,r=c+4592|0,e[r>>2]=0,e[r+4>>2]=0,e[r+8>>2]=0,e[r+12>>2]=0,e[r+16>>2]=0,e[r+20>>2]=0,e[r+24>>2]=0,S[r+28>>0]=0,e[c+28>>2]|0||(e[c+20>>2]=1),r=c,r|0}if((t|0)>=17)return r=0,r|0;if(h=k<<1,h=((h+D|0)/(h|1|0)|0)+1|0,o){for(t=0;(1<>2]=e[w>>2],d=d+4|0,w=w+4|0;while((d|0)<(C|0));d=c+88|0,C=d+40|0;do e[d>>2]=0,d=d+4|0;while((d|0)<(C|0));e[c>>2]=35828,e[c+128>>2]=D,e[c+132>>2]=h,e[c+136>>2]=k,e[c+140>>2]=t,e[c+144>>2]=o,e[c+148>>2]=l,e[c+152>>2]=64,t=c+156|0,e[t>>2]=0,e[t+4>>2]=0,e[t+8>>2]=0,e[t+12>>2]=0,e[c+172>>2]=e[r>>2],e[c+176>>2]=0,e[c+180>>2]=0,e[c+184>>2]=0,t=c+4568|0,o=c+188|0;do e[o>>2]=0,e[o+4>>2]=0,I[o+8>>1]=0,I[o+10>>1]=1,o=o+12|0;while((o|0)!=(t|0));return e[t>>2]=0,e[t+4>>2]=0,I[t+8>>1]=0,S[t+10>>0]=0,r=c+4580|0,e[r>>2]=0,e[r+4>>2]=0,I[r+8>>1]=0,S[r+10>>0]=0,r=c+4592|0,e[r>>2]=0,e[r+4>>2]=0,e[r+8>>2]=0,e[r+12>>2]=0,e[r+16>>2]=0,e[r+20>>2]=0,e[r+24>>2]=0,S[r+28>>0]=0,e[c+28>>2]|0||(e[c+20>>2]=1),r=c,r|0}else{for(t=0;(1<>2]=e[w>>2],d=d+4|0,w=w+4|0;while((d|0)<(C|0));d=c+88|0,C=d+40|0;do e[d>>2]=0,d=d+4|0;while((d|0)<(C|0));e[c>>2]=35856,e[c+128>>2]=D,e[c+132>>2]=h,e[c+136>>2]=k,e[c+140>>2]=t,e[c+144>>2]=o,e[c+148>>2]=l,e[c+152>>2]=64,t=c+156|0,e[t>>2]=0,e[t+4>>2]=0,e[t+8>>2]=0,e[t+12>>2]=0,e[c+172>>2]=e[r>>2],e[c+176>>2]=0,e[c+180>>2]=0,e[c+184>>2]=0,t=c+4568|0,o=c+188|0;do e[o>>2]=0,e[o+4>>2]=0,I[o+8>>1]=0,I[o+10>>1]=1,o=o+12|0;while((o|0)!=(t|0));return e[t>>2]=0,e[t+4>>2]=0,I[t+8>>1]=0,S[t+10>>0]=0,r=c+4580|0,e[r>>2]=0,e[r+4>>2]=0,I[r+8>>1]=0,S[r+10>>0]=0,r=c+4592|0,e[r>>2]=0,e[r+4>>2]=0,e[r+8>>2]=0,e[r+12>>2]=0,e[r+16>>2]=0,e[r+20>>2]=0,e[r+24>>2]=0,S[r+28>>0]=0,e[c+28>>2]|0||(e[c+20>>2]=1),r=c,r|0}return 0}function wa(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0;switch(R=e[o+16>>2]|0,R|0){case 64:case 0:{g=0,t=be(35,t|0,r|0)|0,r=g,g=0,r&1?_=16:l=t;break}default:{for(c=(1<>2])+-1|0,N=e[r+20>>2]|0,k=N<<1,k=((k+c|0)/(k|1|0)|0)+1|0,t=0;(1<>2]|0,g=0,l=ge(67,4632)|0,D=g,g=0,D&1)_=16;else{h=((d|0)<8?8:d)+d<<1,e[l+4>>2]=0,w=l+8|0,C=r,D=w+84|0;do e[w>>2]=e[C>>2],w=w+4|0,C=C+4|0;while((w|0)<(D|0));e[l+92>>2]=0,e[l+96>>2]=0,e[l+100>>2]=32,e[l+104>>2]=0,e[l+108>>2]=0,S[l+112>>0]=0,D=l+116|0,e[D>>2]=0,e[D+4>>2]=0,e[D+8>>2]=0,e[D+12>>2]=0,e[D+16>>2]=0,e[l>>2]=35884,e[l+136>>2]=c,e[l+140>>2]=k,e[l+144>>2]=N,e[l+148>>2]=t,e[l+152>>2]=d,e[l+156>>2]=h,e[l+160>>2]=R,t=l+164|0,e[t>>2]=0,e[t+4>>2]=0,e[t+8>>2]=0,e[t+12>>2]=0,e[l+180>>2]=e[r>>2],e[l+184>>2]=0,e[l+188>>2]=0,e[l+192>>2]=0,t=l+4576|0,c=l+196|0;do e[c>>2]=0,e[c+4>>2]=0,I[c+8>>1]=0,I[c+10>>1]=1,c=c+12|0;while((c|0)!=(t|0));e[t>>2]=0,e[t+4>>2]=0,I[t+8>>1]=0,S[t+10>>0]=0,r=l+4588|0,e[r>>2]=0,e[r+4>>2]=0,I[r+8>>1]=0,S[r+10>>0]=0,r=l+4600|0,e[r>>2]=0,e[r+4>>2]=0,e[r+8>>2]=0,e[r+12>>2]=0,e[r+16>>2]=0,e[r+20>>2]=0,e[r+24>>2]=0,S[r+28>>0]=0,e[l+32>>2]|0||(e[l+24>>2]=1)}}}return(_|0)==16&&(_=j()|0,le(_|0)),!l||(g=0,Ae(e[(e[l>>2]|0)+8>>2]|0,l|0,o|0),_=g,g=0,!(_&1))?l|0:(t=j()|0,l||(_=t,le(_|0)),Mt[e[(e[l>>2]|0)+4>>2]&255](l),_=t,le(_|0),0)}function ya(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0;if(o=(e[r+24>>2]|0)==2,o&&(e[r+16>>2]|0)!=3)return r=0,r|0;k=e[r+20>>2]|0,t=e[r+8>>2]|0;e:do if(!k){if(o){if((t|0)!=8)break;l=Xe(4608)|0,e[l+4>>2]=0,d=l+8|0,w=r,C=d+84|0;do e[d>>2]=e[w>>2],d=d+4|0,w=w+4|0;while((d|0)<(C|0));e[l+92>>2]=0,e[l+96>>2]=0,e[l+100>>2]=32,e[l+104>>2]=0,e[l+108>>2]=0,S[l+112>>0]=0,t=l+116|0,e[t>>2]=0,e[t+4>>2]=0,e[t+8>>2]=0,e[t+12>>2]=0,e[t+16>>2]=0,e[l>>2]=35912,t=l+140|0,e[t>>2]=0,e[t+4>>2]=0,e[t+8>>2]=0,e[t+12>>2]=0,e[l+156>>2]=e[r>>2],e[l+160>>2]=0,e[l+164>>2]=0,e[l+168>>2]=0,t=l+4552|0,o=l+172|0;do e[o>>2]=0,e[o+4>>2]=0,I[o+8>>1]=0,I[o+10>>1]=1,o=o+12|0;while((o|0)!=(t|0));return e[t>>2]=0,e[t+4>>2]=0,I[t+8>>1]=0,S[t+10>>0]=0,r=l+4564|0,e[r>>2]=0,e[r+4>>2]=0,I[r+8>>1]=0,S[r+10>>0]=0,r=l+4576|0,e[r>>2]=0,e[r+4>>2]=0,e[r+8>>2]=0,e[r+12>>2]=0,e[r+16>>2]=0,e[r+20>>2]=0,e[r+24>>2]=0,S[r+28>>0]=0,e[l+32>>2]|0||(e[l+24>>2]=1),r=l,r|0}switch(t|0){case 8:{l=Xe(4608)|0,e[l+4>>2]=0,d=l+8|0,w=r,C=d+84|0;do e[d>>2]=e[w>>2],d=d+4|0,w=w+4|0;while((d|0)<(C|0));e[l+92>>2]=0,e[l+96>>2]=0,e[l+100>>2]=32,e[l+104>>2]=0,e[l+108>>2]=0,S[l+112>>0]=0,t=l+116|0,e[t>>2]=0,e[t+4>>2]=0,e[t+8>>2]=0,e[t+12>>2]=0,e[t+16>>2]=0,e[l>>2]=35940,t=l+140|0,e[t>>2]=0,e[t+4>>2]=0,e[t+8>>2]=0,e[t+12>>2]=0,e[l+156>>2]=e[r>>2],e[l+160>>2]=0,e[l+164>>2]=0,e[l+168>>2]=0,t=l+4552|0,o=l+172|0;do e[o>>2]=0,e[o+4>>2]=0,I[o+8>>1]=0,I[o+10>>1]=1,o=o+12|0;while((o|0)!=(t|0));return e[t>>2]=0,e[t+4>>2]=0,I[t+8>>1]=0,S[t+10>>0]=0,r=l+4564|0,e[r>>2]=0,e[r+4>>2]=0,I[r+8>>1]=0,S[r+10>>0]=0,r=l+4576|0,e[r>>2]=0,e[r+4>>2]=0,e[r+8>>2]=0,e[r+12>>2]=0,e[r+16>>2]=0,e[r+20>>2]=0,e[r+24>>2]=0,S[r+28>>0]=0,e[l+32>>2]|0||(e[l+24>>2]=1),r=l,r|0}case 12:{l=Xe(4608)|0,e[l+4>>2]=0,d=l+8|0,w=r,C=d+84|0;do e[d>>2]=e[w>>2],d=d+4|0,w=w+4|0;while((d|0)<(C|0));e[l+92>>2]=0,e[l+96>>2]=0,e[l+100>>2]=32,e[l+104>>2]=0,e[l+108>>2]=0,S[l+112>>0]=0,t=l+116|0,e[t>>2]=0,e[t+4>>2]=0,e[t+8>>2]=0,e[t+12>>2]=0,e[t+16>>2]=0,e[l>>2]=35968,t=l+140|0,e[t>>2]=0,e[t+4>>2]=0,e[t+8>>2]=0,e[t+12>>2]=0,e[l+156>>2]=e[r>>2],e[l+160>>2]=0,e[l+164>>2]=0,e[l+168>>2]=0,t=l+4552|0,o=l+172|0;do e[o>>2]=0,e[o+4>>2]=0,I[o+8>>1]=0,I[o+10>>1]=1,o=o+12|0;while((o|0)!=(t|0));return e[t>>2]=0,e[t+4>>2]=0,I[t+8>>1]=0,S[t+10>>0]=0,r=l+4564|0,e[r>>2]=0,e[r+4>>2]=0,I[r+8>>1]=0,S[r+10>>0]=0,r=l+4576|0,e[r>>2]=0,e[r+4>>2]=0,e[r+8>>2]=0,e[r+12>>2]=0,e[r+16>>2]=0,e[r+20>>2]=0,e[r+24>>2]=0,S[r+28>>0]=0,e[l+32>>2]|0||(e[l+24>>2]=1),r=l,r|0}case 16:{l=Xe(4608)|0,e[l+4>>2]=0,d=l+8|0,w=r,C=d+84|0;do e[d>>2]=e[w>>2],d=d+4|0,w=w+4|0;while((d|0)<(C|0));e[l+92>>2]=0,e[l+96>>2]=0,e[l+100>>2]=32,e[l+104>>2]=0,e[l+108>>2]=0,S[l+112>>0]=0,t=l+116|0,e[t>>2]=0,e[t+4>>2]=0,e[t+8>>2]=0,e[t+12>>2]=0,e[t+16>>2]=0,e[l>>2]=35996,t=l+140|0,e[t>>2]=0,e[t+4>>2]=0,e[t+8>>2]=0,e[t+12>>2]=0,e[l+156>>2]=e[r>>2],e[l+160>>2]=0,e[l+164>>2]=0,e[l+168>>2]=0,t=l+4552|0,o=l+172|0;do e[o>>2]=0,e[o+4>>2]=0,I[o+8>>1]=0,I[o+10>>1]=1,o=o+12|0;while((o|0)!=(t|0));return e[t>>2]=0,e[t+4>>2]=0,I[t+8>>1]=0,S[t+10>>0]=0,r=l+4564|0,e[r>>2]=0,e[r+4>>2]=0,I[r+8>>1]=0,S[r+10>>0]=0,r=l+4576|0,e[r>>2]=0,e[r+4>>2]=0,e[r+8>>2]=0,e[r+12>>2]=0,e[r+16>>2]=0,e[r+20>>2]=0,e[r+24>>2]=0,S[r+28>>0]=0,e[l+32>>2]|0||(e[l+24>>2]=1),r=l,r|0}default:break e}}while(!1);if(D=(1<>2]=0,d=c+8|0,w=r,C=d+84|0;do e[d>>2]=e[w>>2],d=d+4|0,w=w+4|0;while((d|0)<(C|0));e[c+92>>2]=0,e[c+96>>2]=0,e[c+100>>2]=32,e[c+104>>2]=0,e[c+108>>2]=0,S[c+112>>0]=0,C=c+116|0,e[C>>2]=0,e[C+4>>2]=0,e[C+8>>2]=0,e[C+12>>2]=0,e[C+16>>2]=0,e[c>>2]=36024,e[c+136>>2]=D,e[c+140>>2]=h,e[c+144>>2]=k,e[c+148>>2]=t,e[c+152>>2]=o,e[c+156>>2]=l,e[c+160>>2]=64,t=c+164|0,e[t>>2]=0,e[t+4>>2]=0,e[t+8>>2]=0,e[t+12>>2]=0,e[c+180>>2]=e[r>>2],e[c+184>>2]=0,e[c+188>>2]=0,e[c+192>>2]=0,t=c+4576|0,o=c+196|0;do e[o>>2]=0,e[o+4>>2]=0,I[o+8>>1]=0,I[o+10>>1]=1,o=o+12|0;while((o|0)!=(t|0));return e[t>>2]=0,e[t+4>>2]=0,I[t+8>>1]=0,S[t+10>>0]=0,r=c+4588|0,e[r>>2]=0,e[r+4>>2]=0,I[r+8>>1]=0,S[r+10>>0]=0,r=c+4600|0,e[r>>2]=0,e[r+4>>2]=0,e[r+8>>2]=0,e[r+12>>2]=0,e[r+16>>2]=0,e[r+20>>2]=0,e[r+24>>2]=0,S[r+28>>0]=0,e[c+32>>2]|0||(e[c+24>>2]=1),r=c,r|0}else{for(t=0;(1<>2]=0,d=c+8|0,w=r,C=d+84|0;do e[d>>2]=e[w>>2],d=d+4|0,w=w+4|0;while((d|0)<(C|0));e[c+92>>2]=0,e[c+96>>2]=0,e[c+100>>2]=32,e[c+104>>2]=0,e[c+108>>2]=0,S[c+112>>0]=0,C=c+116|0,e[C>>2]=0,e[C+4>>2]=0,e[C+8>>2]=0,e[C+12>>2]=0,e[C+16>>2]=0,e[c>>2]=35884,e[c+136>>2]=D,e[c+140>>2]=h,e[c+144>>2]=k,e[c+148>>2]=t,e[c+152>>2]=o,e[c+156>>2]=l,e[c+160>>2]=64,t=c+164|0,e[t>>2]=0,e[t+4>>2]=0,e[t+8>>2]=0,e[t+12>>2]=0,e[c+180>>2]=e[r>>2],e[c+184>>2]=0,e[c+188>>2]=0,e[c+192>>2]=0,t=c+4576|0,o=c+196|0;do e[o>>2]=0,e[o+4>>2]=0,I[o+8>>1]=0,I[o+10>>1]=1,o=o+12|0;while((o|0)!=(t|0));return e[t>>2]=0,e[t+4>>2]=0,I[t+8>>1]=0,S[t+10>>0]=0,r=c+4588|0,e[r>>2]=0,e[r+4>>2]=0,I[r+8>>1]=0,S[r+10>>0]=0,r=c+4600|0,e[r>>2]=0,e[r+4>>2]=0,e[r+8>>2]=0,e[r+12>>2]=0,e[r+16>>2]=0,e[r+20>>2]=0,e[r+24>>2]=0,S[r+28>>0]=0,e[c+32>>2]|0||(e[c+24>>2]=1),r=c,r|0}if((t|0)>=17)return r=0,r|0;if(h=k<<1,h=((h+D|0)/(h|1|0)|0)+1|0,o){for(t=0;(1<>2]=0,d=c+8|0,w=r,C=d+84|0;do e[d>>2]=e[w>>2],d=d+4|0,w=w+4|0;while((d|0)<(C|0));e[c+92>>2]=0,e[c+96>>2]=0,e[c+100>>2]=32,e[c+104>>2]=0,e[c+108>>2]=0,S[c+112>>0]=0,C=c+116|0,e[C>>2]=0,e[C+4>>2]=0,e[C+8>>2]=0,e[C+12>>2]=0,e[C+16>>2]=0,e[c>>2]=36052,e[c+136>>2]=D,e[c+140>>2]=h,e[c+144>>2]=k,e[c+148>>2]=t,e[c+152>>2]=o,e[c+156>>2]=l,e[c+160>>2]=64,t=c+164|0,e[t>>2]=0,e[t+4>>2]=0,e[t+8>>2]=0,e[t+12>>2]=0,e[c+180>>2]=e[r>>2],e[c+184>>2]=0,e[c+188>>2]=0,e[c+192>>2]=0,t=c+4576|0,o=c+196|0;do e[o>>2]=0,e[o+4>>2]=0,I[o+8>>1]=0,I[o+10>>1]=1,o=o+12|0;while((o|0)!=(t|0));return e[t>>2]=0,e[t+4>>2]=0,I[t+8>>1]=0,S[t+10>>0]=0,r=c+4588|0,e[r>>2]=0,e[r+4>>2]=0,I[r+8>>1]=0,S[r+10>>0]=0,r=c+4600|0,e[r>>2]=0,e[r+4>>2]=0,e[r+8>>2]=0,e[r+12>>2]=0,e[r+16>>2]=0,e[r+20>>2]=0,e[r+24>>2]=0,S[r+28>>0]=0,e[c+32>>2]|0||(e[c+24>>2]=1),r=c,r|0}else{for(t=0;(1<>2]=0,d=c+8|0,w=r,C=d+84|0;do e[d>>2]=e[w>>2],d=d+4|0,w=w+4|0;while((d|0)<(C|0));e[c+92>>2]=0,e[c+96>>2]=0,e[c+100>>2]=32,e[c+104>>2]=0,e[c+108>>2]=0,S[c+112>>0]=0,C=c+116|0,e[C>>2]=0,e[C+4>>2]=0,e[C+8>>2]=0,e[C+12>>2]=0,e[C+16>>2]=0,e[c>>2]=36080,e[c+136>>2]=D,e[c+140>>2]=h,e[c+144>>2]=k,e[c+148>>2]=t,e[c+152>>2]=o,e[c+156>>2]=l,e[c+160>>2]=64,t=c+164|0,e[t>>2]=0,e[t+4>>2]=0,e[t+8>>2]=0,e[t+12>>2]=0,e[c+180>>2]=e[r>>2],e[c+184>>2]=0,e[c+188>>2]=0,e[c+192>>2]=0,t=c+4576|0,o=c+196|0;do e[o>>2]=0,e[o+4>>2]=0,I[o+8>>1]=0,I[o+10>>1]=1,o=o+12|0;while((o|0)!=(t|0));return e[t>>2]=0,e[t+4>>2]=0,I[t+8>>1]=0,S[t+10>>0]=0,r=c+4588|0,e[r>>2]=0,e[r+4>>2]=0,I[r+8>>1]=0,S[r+10>>0]=0,r=c+4600|0,e[r>>2]=0,e[r+4>>2]=0,e[r+8>>2]=0,e[r+12>>2]=0,e[r+16>>2]=0,e[r+20>>2]=0,e[r+24>>2]=0,S[r+28>>0]=0,e[c+32>>2]|0||(e[c+24>>2]=1),r=c,r|0}return 0}function Ca(){var t=0,r=0,o=0,l=0,c=0,h=0,d=0;t=2832;do e[t>>2]=0,e[t+4>>2]=0,t=t+8|0;while((t|0)!=4880);Jt(2832,0,2048)|0,t=0;do d=2832+(t+128<<3)|0,e[d>>2]=0,e[d+4>>2]=1,t=t+1|0;while((t|0)!=128);t=3088,e[t>>2]=1,e[t+4>>2]=3,t=3096,e[t>>2]=1,e[t+4>>2]=3,t=3104,e[t>>2]=1,e[t+4>>2]=3,t=3112,e[t>>2]=1,e[t+4>>2]=3,t=3120,e[t>>2]=1,e[t+4>>2]=3,t=3128,e[t>>2]=1,e[t+4>>2]=3,t=3136,e[t>>2]=1,e[t+4>>2]=3,t=3144,e[t>>2]=1,e[t+4>>2]=3,t=3152,e[t>>2]=1,e[t+4>>2]=3,t=3160,e[t>>2]=1,e[t+4>>2]=3,t=3168,e[t>>2]=1,e[t+4>>2]=3,t=3176,e[t>>2]=1,e[t+4>>2]=3,t=3184,e[t>>2]=1,e[t+4>>2]=3,t=3192,e[t>>2]=1,e[t+4>>2]=3,t=3200,e[t>>2]=1,e[t+4>>2]=3,t=3208,e[t>>2]=1,e[t+4>>2]=3,t=3216,e[t>>2]=1,e[t+4>>2]=3,t=3224,e[t>>2]=1,e[t+4>>2]=3,t=3232,e[t>>2]=1,e[t+4>>2]=3,t=3240,e[t>>2]=1,e[t+4>>2]=3,t=3248,e[t>>2]=1,e[t+4>>2]=3,t=3256,e[t>>2]=1,e[t+4>>2]=3,t=3264,e[t>>2]=1,e[t+4>>2]=3,t=3272,e[t>>2]=1,e[t+4>>2]=3,t=3280,e[t>>2]=1,e[t+4>>2]=3,t=3288,e[t>>2]=1,e[t+4>>2]=3,t=3296,e[t>>2]=1,e[t+4>>2]=3,t=3304,e[t>>2]=1,e[t+4>>2]=3,t=3312,e[t>>2]=1,e[t+4>>2]=3,t=3320,e[t>>2]=1,e[t+4>>2]=3,t=3328,e[t>>2]=1,e[t+4>>2]=3,t=3336,e[t>>2]=1,e[t+4>>2]=3,t=2896,e[t>>2]=2,e[t+4>>2]=5,t=2904,e[t>>2]=2,e[t+4>>2]=5,t=2912,e[t>>2]=2,e[t+4>>2]=5,t=2920,e[t>>2]=2,e[t+4>>2]=5,t=2928,e[t>>2]=2,e[t+4>>2]=5,t=2936,e[t>>2]=2,e[t+4>>2]=5,t=2944,e[t>>2]=2,e[t+4>>2]=5,t=2952,e[t>>2]=2,e[t+4>>2]=5,t=2848,e[t>>2]=3,e[t+4>>2]=7,t=2856,e[t>>2]=3,e[t+4>>2]=7,t=0;do d=2832+(t+64<<3)|0,e[d>>2]=-1,e[d+4>>2]=2,t=t+1|0;while((t|0)!=64);t=2960,e[t>>2]=-2,e[t+4>>2]=4,t=2968,e[t>>2]=-2,e[t+4>>2]=4,t=2976,e[t>>2]=-2,e[t+4>>2]=4,t=2984,e[t>>2]=-2,e[t+4>>2]=4,t=2992,e[t>>2]=-2,e[t+4>>2]=4,t=3e3,e[t>>2]=-2,e[t+4>>2]=4,t=3008,e[t>>2]=-2,e[t+4>>2]=4,t=3016,e[t>>2]=-2,e[t+4>>2]=4,t=3024,e[t>>2]=-2,e[t+4>>2]=4,t=3032,e[t>>2]=-2,e[t+4>>2]=4,t=3040,e[t>>2]=-2,e[t+4>>2]=4,t=3048,e[t>>2]=-2,e[t+4>>2]=4,t=3056,e[t>>2]=-2,e[t+4>>2]=4,t=3064,e[t>>2]=-2,e[t+4>>2]=4,t=3072,e[t>>2]=-2,e[t+4>>2]=4,t=3080,e[t>>2]=-2,e[t+4>>2]=4,t=2864,e[t>>2]=-3,e[t+4>>2]=6,t=2872,e[t>>2]=-3,e[t+4>>2]=6,t=2880,e[t>>2]=-3,e[t+4>>2]=6,t=2888,e[t>>2]=-3,e[t+4>>2]=6,t=2840,e[t>>2]=-4,e[t+4>>2]=8,t=4880;do e[t>>2]=0,e[t+4>>2]=0,t=t+8|0;while((t|0)!=6928);for(Jt(4880,0,2048)|0,o=2,t=0,c=0,h=0;;){if(o=o<<16>>16,r=8-o|0,l=1<>2]=c,e[d+4>>2]=o,r=r+1|0;while((r|0)<(l|0))}if(r=(h<<16)+65536|0,t=r>>31^r>>15,h=h+1|0,(h|0)==7){r=2,c=1,h=-1,d=-1;break}else o=(t>>1)+2|0,c=r>>16}for(;;){if(o=r<<16>>16,t=8-o|0,l=1<>2]=h,e[c+4>>2]=o,r=r+1|0;while((r|0)<(l|0))}if(t=(d<<16)+-65536|0,c=t>>31^t>>15,r=(c>>1)+2|0,(r|0)>8){t=6928;break}else h=t>>16,d=d+-1|0}do e[t>>2]=0,e[t+4>>2]=0,t=t+8|0;while((t|0)!=8976);for(Jt(6928,0,2048)|0,c=3,t=0,l=0,h=0;;){if(r=8-c|0,o=1<>2]=l,e[d+4>>2]=c,r=r+1|0;while((r|0)<(o|0))}if(r=(h<<16)+65536|0,t=r>>31^r>>15,h=h+1|0,(h|0)==12){c=3,r=1,l=-1,h=-1;break}else c=(t>>2)+3|0,l=r>>16}for(;;){if(t=8-c|0,o=1<>2]=l,e[d+4>>2]=c,r=r+1|0;while((r|0)<(o|0))}if(t=(h<<16)+-65536|0,r=t>>31^t>>15,c=(r>>2)+3|0,(c|0)>8){t=8976;break}else l=t>>16,h=h+-1|0}do e[t>>2]=0,e[t+4>>2]=0,t=t+8|0;while((t|0)!=11024);for(Jt(8976,0,2048)|0,c=4,t=0,l=0,h=0;;){if(r=8-c|0,o=1<>2]=l,e[d+4>>2]=c,r=r+1|0;while((r|0)<(o|0))}if(r=(h<<16)+65536|0,t=r>>31^r>>15,h=h+1|0,(h|0)==20){c=4,r=1,l=-1,h=-1;break}else c=(t>>3)+4|0,l=r>>16}for(;;){if(t=8-c|0,o=1<>2]=l,e[d+4>>2]=c,r=r+1|0;while((r|0)<(o|0))}if(t=(h<<16)+-65536|0,r=t>>31^t>>15,c=(r>>3)+4|0,(c|0)>8){t=11024;break}else l=t>>16,h=h+-1|0}do e[t>>2]=0,e[t+4>>2]=0,t=t+8|0;while((t|0)!=13072);for(Jt(11024,0,2048)|0,c=5,t=0,l=0,h=0;;){if(r=8-c|0,o=1<>2]=l,e[d+4>>2]=c,r=r+1|0;while((r|0)<(o|0))}if(r=(h<<16)+65536|0,t=r>>31^r>>15,h=h+1|0,(h|0)==32){c=5,r=1,l=-1,h=-1;break}else c=(t>>4)+5|0,l=r>>16}for(;;){if(t=8-c|0,o=1<>2]=l,e[d+4>>2]=c,r=r+1|0;while((r|0)<(o|0))}if(t=(h<<16)+-65536|0,r=t>>31^t>>15,c=(r>>4)+5|0,(c|0)>8){t=13072;break}else l=t>>16,h=h+-1|0}do e[t>>2]=0,e[t+4>>2]=0,t=t+8|0;while((t|0)!=15120);for(Jt(13072,0,2048)|0,c=6,t=0,l=0,h=0;;){if(r=8-c|0,o=1<>2]=l,e[d+4>>2]=c,r=r+1|0;while((r|0)<(o|0))}if(r=(h<<16)+65536|0,t=r>>31^r>>15,h=h+1|0,(h|0)==48){c=6,r=1,l=-1,h=-1;break}else c=(t>>5)+6|0,l=r>>16}for(;;){if(t=8-c|0,o=1<>2]=l,e[d+4>>2]=c,r=r+1|0;while((r|0)<(o|0))}if(t=(h<<16)+-65536|0,r=t>>31^t>>15,c=(r>>5)+6|0,(c|0)>8){t=15120;break}else l=t>>16,h=h+-1|0}do e[t>>2]=0,e[t+4>>2]=0,t=t+8|0;while((t|0)!=17168);for(Jt(15120,0,2048)|0,c=7,t=0,l=0,h=0;;){if(r=8-c|0,o=1<>2]=l,e[d+4>>2]=c,r=r+1|0;while((r|0)<(o|0))}if(r=(h<<16)+65536|0,t=r>>31^r>>15,h=h+1|0,(h|0)==64){c=7,r=1,l=-1,h=-1;break}else c=(t>>6)+7|0,l=r>>16}for(;;){if(t=8-c|0,o=1<>2]=l,e[d+4>>2]=c,r=r+1|0;while((r|0)<(o|0))}if(t=(h<<16)+-65536|0,r=t>>31^t>>15,c=(r>>6)+7|0,(c|0)>8){t=17168;break}else l=t>>16,h=h+-1|0}do e[t>>2]=0,e[t+4>>2]=0,t=t+8|0;while((t|0)!=19216);for(Jt(17168,0,2048)|0,c=8,t=0,l=0,h=0;;){if(r=8-c|0,o=1<>2]=l,e[d+4>>2]=c,r=r+1|0;while((r|0)<(o|0))}if(r=(h<<16)+65536|0,t=r>>31^r>>15,h=h+1|0,(h|0)==64){h=8,l=1,c=-1,d=-1;break}else c=(t>>7)+8|0,l=r>>16}for(;;){if(t=8-h|0,o=1<>2]=c,e[l+4>>2]=h,r=r+1|0;while((r|0)<(o|0))}if(r=(d<<16)+-65536|0,l=r>>31^r>>15,t=l>>7,(t|0)>0){t=19216;break}else h=t+8|0,c=r>>16,d=d+-1|0}do e[t>>2]=0,e[t+4>>2]=0,t=t+8|0;while((t|0)!=21264);Jt(19216,0,2048)|0,t=21264;do e[t>>2]=0,e[t+4>>2]=0,t=t+8|0;while((t|0)!=23312);Jt(21264,0,2048)|0,t=23312;do e[t>>2]=0,e[t+4>>2]=0,t=t+8|0;while((t|0)!=25360);Jt(23312,0,2048)|0,t=25360;do e[t>>2]=0,e[t+4>>2]=0,t=t+8|0;while((t|0)!=27408);Jt(25360,0,2048)|0,t=27408;do e[t>>2]=0,e[t+4>>2]=0,t=t+8|0;while((t|0)!=29456);Jt(27408,0,2048)|0,t=29456;do e[t>>2]=0,e[t+4>>2]=0,t=t+8|0;while((t|0)!=31504);Jt(29456,0,2048)|0,t=31504;do e[t>>2]=0,e[t+4>>2]=0,t=t+8|0;while((t|0)!=33552);Jt(31504,0,2048)|0,t=33552;do e[t>>2]=0,e[t+4>>2]=0,t=t+8|0;while((t|0)!=35600);Jt(33552,0,2048)|0,un(35600,8),Ft(179,35600,Q|0)|0,un(35612,10),Ft(179,35612,Q|0)|0,un(35624,12),Ft(179,35624,Q|0)|0,un(35636,16),Ft(179,35636,Q|0)|0}function Ta(t){t=t|0;var r=0;r=e[t>>2]|0,r&&(t=t+4|0,(e[t>>2]|0)!=(r|0)&&(e[t>>2]=r),he(r))}function Ia(t){t=t|0;var r=0,o=0;e[t>>2]=36080,r=e[t+4616>>2]|0,r&&(o=t+4620|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),e[t>>2]=36612,r=e[t+120>>2]|0,r&&(o=t+124|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),o=t+92|0,r=e[o>>2]|0,e[o>>2]=0,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r),t=t+4|0,r=e[t>>2]|0,e[t>>2]=0,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r)}function Ea(t){t=t|0;var r=0,o=0;if(e[t>>2]=36080,r=e[t+4616>>2]|0,r&&(o=t+4620|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),e[t>>2]=36612,r=e[t+120>>2]|0,r&&(o=t+124|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),o=t+92|0,r=e[o>>2]|0,e[o>>2]=0,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r),o=t+4|0,r=e[o>>2]|0,e[o>>2]=0,!r){he(t);return}Mt[e[(e[r>>2]|0)+4>>2]&255](r),he(t)}function ka(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0;d=b,b=b+32|0,C=d,m0(C,e[t+136>>2]|0,e[t+144>>2]|0),w=e[r+4>>2]|0,h=e[r+8>>2]|0,h=h|0?h:e[C+8>>2]|0,c=e[r+12>>2]|0,c=c|0?c:e[C+12>>2]|0,o=e[r+16>>2]|0,l=e[C+16>>2]|0,e[t+184>>2]=w|0?w:e[C+4>>2]|0,e[t+188>>2]=h,e[t+192>>2]=c,Wl(t),c=t+140|0,r=(e[c>>2]|0)+32|0,r=(r|0)<128?2:(r|0)/64|0,h=0;do e[t+196+(h*12|0)>>2]=r,e[t+196+(h*12|0)+4>>2]=0,I[t+196+(h*12|0)+8>>1]=0,I[t+196+(h*12|0)+10>>1]=1,h=h+1|0;while((h|0)!=365);w=(e[c>>2]|0)+32|0,w=(w|0)<128?2:(w|0)/64|0,C=(o|0?o:l)&255,e[t+4576>>2]=w,e[t+4580>>2]=0,S[t+4584>>0]=C,S[t+4585>>0]=1,S[t+4586>>0]=0,e[t+4588>>2]=w,e[t+4592>>2]=1,S[t+4596>>0]=C,S[t+4597>>0]=1,S[t+4598>>0]=0,e[t+4600>>2]=0,b=d}function Da(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0,D=0,k=0;if(k=b,b=b+16|0,C=k,w=t+92|0,d=e[r>>2]|0,e[r>>2]=0,r=e[w>>2]|0,e[w>>2]=d,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r),e[C>>2]=0,e[C+4>>2]=l,w=o+8|0,e[C+8>>2]=e[w>>2],l){r=Xe(4624)|0,l=t+8|0,c=r+4|0,h=l,d=c+84|0;do e[c>>2]=e[h>>2],c=c+4|0,h=h+4|0;while((c|0)<(d|0));c=r+88|0,d=c+40|0;do e[c>>2]=0,c=c+4|0;while((c|0)<(d|0));e[r>>2]=35856,e[r+128>>2]=e[t+136>>2],e[r+132>>2]=e[t+140>>2],e[r+136>>2]=e[t+144>>2],e[r+140>>2]=e[t+148>>2],e[r+144>>2]=e[t+152>>2],e[r+148>>2]=e[t+156>>2],e[r+152>>2]=e[t+160>>2],c=r+156|0,e[c>>2]=0,e[c+4>>2]=0,e[c+8>>2]=0,e[c+12>>2]=0,e[r+172>>2]=e[l>>2],e[r+176>>2]=0,e[r+180>>2]=0,e[r+184>>2]=0,c=r+4568|0,l=r+188|0;do e[l>>2]=0,e[l+4>>2]=0,I[l+8>>1]=0,I[l+10>>1]=1,l=l+12|0;while((l|0)!=(c|0));h=t+4|0,e[c>>2]=0,e[c+4>>2]=0,I[c+8>>1]=0,S[c+10>>0]=0,d=r+4580|0,e[d>>2]=0,e[d+4>>2]=0,I[d+8>>1]=0,S[d+10>>0]=0,d=r+4592|0,e[d>>2]=0,e[d+4>>2]=0,e[d+8>>2]=0,e[d+12>>2]=0,e[d+16>>2]=0,e[d+20>>2]=0,e[d+24>>2]=0,S[d+28>>0]=0,e[r+28>>2]|0||(e[r+20>>2]=1),l=e[h>>2]|0,e[h>>2]=r,l&&(Mt[e[(e[l>>2]|0)+4>>2]&255](l),r=e[h>>2]|0),Y0(r,C)}return C=t+100|0,e[C>>2]=32,e[t+96>>2]=0,r=e[o>>2]|0,r?(e[t+132>>2]=r,c=t+120|0,w=t+124|0,l=e[w>>2]|0,r=e[c>>2]|0,h=r,d=l-h|0,d>>>0>=4e3?d>>>0>4e3&&(D=r+4e3|0,(l|0)!=(D|0))&&(e[w>>2]=D,l=D):(vi(c,4e3-d|0),r=e[c>>2]|0,h=r,l=e[w>>2]|0),e[t+108>>2]=h,e[t+104>>2]=l-r,es(t),D=t+116|0,D=e[D>>2]|0,t=e[C>>2]|0,t=t+-32|0,t=(t|0)/8|0,t=D-t|0,b=k,t|0):(e[t+108>>2]=e[o+4>>2],e[t+104>>2]=e[w>>2],es(t),D=t+116|0,D=e[D>>2]|0,t=e[C>>2]|0,t=t+-32|0,t=(t|0)/8|0,t=D-t|0,b=k,t|0)}function ba(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0,G=0,$=0,P=0,O=0;if(G=b,b=b+352|0,$=G+328|0,P=G+192|0,o=G+343|0,l=G+342|0,c=G+341|0,h=G+340|0,R=G+176|0,w=G+168|0,C=G+160|0,D=G+152|0,K=G,U=G+136|0,e[t+32>>2]|0&&(e[t+24>>2]|0)!=1){if(_=t+8|0,H=t+36|0,d=e[H>>2]|0,!d){if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[o>>0]|0,$e(37,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}if(t=e[t+16>>2]|0,(t|0)==16)switch(d|0){case 1:{if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[l>>0]|0,$e(38,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 2:{if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[c>>0]|0,$e(39,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 3:{if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[h>>0]|0,$e(40,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}default:{d=P+56|0,c=P+4|0,e[P>>2]=36160,e[d>>2]=36180,g=0,Ae(62,P+56|0,c|0),G=g,g=0,G&1&&(O=j()|0,tt(d),le(O|0)),e[P+128>>2]=0,e[P+132>>2]=-1,e[P>>2]=36200,e[P+56>>2]=36220,g=0,ue(180,c|0),G=g,g=0;do if(G&1)t=j()|0;else{if(e[c>>2]=36236,h=P+36|0,e[h>>2]=0,e[h+4>>2]=0,e[h+8>>2]=0,e[h+12>>2]=0,e[P+52>>2]=16,e[$>>2]=0,e[$+4>>2]=0,e[$+8>>2]=0,g=0,Ae(63,c|0,$|0),G=g,g=0,G&1){t=j()|0,de($),de(h),wt(c);break}de($),g=0,t=Ve(28,P|0,49007,21)|0,$=g,g=0;do if(!($&1)&&(g=0,k=be(36,t|0,e[H>>2]|0)|0,$=g,g=0,!($&1))&&(g=0,Ve(28,k|0,50997,18)|0,$=g,g=0,!($&1))){if(l=Ct(16)|0,g=0,Ae(64,R|0,c|0),$=g,g=0,$&1)t=j()|0;else if(!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,Q|0)|0,bt(8)),g=0,$e(36,l|0,9,35648,R|0),$=g,g=0,$&1?o=1:(g=0,xe(6,l|0,824,96),g=0,o=0),t=j()|0,de(R),!o)break;Tt(l|0)}else O=34;while(!1);(O|0)==34&&(t=j()|0),e[P>>2]=36200,e[d>>2]=36220,e[c>>2]=36236,de(h),wt(c),tt(d),O=t,le(O|0)}while(!1);O=t,tt(d),le(O|0)}}switch((t|0)<=8&&(t=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,Q|0)|0,bt(8)),g=0,xe(7,t|0,8,35648),O=g,g=0,O&1||Qt(t|0,824,96),O=j()|0,Tt(t|0),le(O|0)),o=16-t|0,d|0){case 1:{if(t=Xe(60)|0,e[w>>2]=o,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],e[$>>2]=e[w>>2],e[$+4>>2]=e[w+4>>2],$e(41,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 2:{if(t=Xe(60)|0,e[C>>2]=o,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],e[$>>2]=e[C>>2],e[$+4>>2]=e[C+4>>2],$e(42,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 3:{if(t=Xe(60)|0,e[D>>2]=o,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],e[$>>2]=e[D>>2],e[$+4>>2]=e[D+4>>2],$e(43,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}default:{d=K+56|0,c=K+4|0,e[K>>2]=36160,e[d>>2]=36180,g=0,Ae(62,K+56|0,c|0),P=g,g=0,P&1&&(O=j()|0,tt(d),le(O|0)),e[K+128>>2]=0,e[K+132>>2]=-1,e[K>>2]=36200,e[K+56>>2]=36220,g=0,ue(180,c|0),P=g,g=0;do if(P&1)t=j()|0;else{if(e[c>>2]=36236,h=K+36|0,e[h>>2]=0,e[h+4>>2]=0,e[h+8>>2]=0,e[h+12>>2]=0,e[K+52>>2]=16,e[$>>2]=0,e[$+4>>2]=0,e[$+8>>2]=0,g=0,Ae(63,c|0,$|0),P=g,g=0,P&1){t=j()|0,de($),de(h),wt(c);break}de($),g=0,t=Ve(28,K|0,49007,21)|0,P=g,g=0;do if(!(P&1)&&(g=0,N=be(36,t|0,e[H>>2]|0)|0,P=g,g=0,!(P&1))&&(g=0,Ve(28,N|0,50997,18)|0,P=g,g=0,!(P&1))){if(l=Ct(16)|0,g=0,Ae(64,U|0,c|0),P=g,g=0,P&1)t=j()|0;else if(!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,Q|0)|0,bt(8)),g=0,$e(36,l|0,9,35648,U|0),P=g,g=0,P&1?o=1:(g=0,xe(6,l|0,824,96),g=0,o=0),t=j()|0,de(U),!o)break;Tt(l|0)}else O=64;while(!1);(O|0)==64&&(t=j()|0),e[K>>2]=36200,e[d>>2]=36220,e[c>>2]=36236,de(h),wt(c),tt(d),O=t,le(O|0)}while(!1);O=t,tt(d),le(O|0)}}}return o=e[r+4>>2]|0,l=Xe(16)|0,t=e[t+20>>2]|0,o?(e[l>>2]=36108,e[l+4>>2]=o,e[l+8>>2]=2,e[l+12>>2]=t,O=l,b=G,O|0):(O=e[r>>2]|0,e[l>>2]=36132,e[l+4>>2]=O,e[l+8>>2]=2,e[l+12>>2]=t,O=l,b=G,O|0)}function Na(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0;e[t>>2]=36460,e[t+4>>2]=o,N=t+8|0,h=e[o>>2]|0,D=o+16|0,l=e[D>>2]|0,d=ee(l,h)|0,e[N>>2]=0,R=t+12|0,e[R>>2]=0,e[t+16>>2]=0;do if(d){if((d|0)<0&&(g=0,ue(178,N|0),h=g,g=0,h&1)||(k=4),(k|0)==4&&(w=d<<1,g=0,C=ge(67,w|0)|0,h=g,g=0,!(h&1))){e[N>>2]=C,h=C+(d<<1)|0,e[t+16>>2]=h,Jt(C|0,0,w|0)|0,e[R>>2]=h,h=e[o>>2]|0,l=e[D>>2]|0;break}d=j()|0,c=e[N>>2]|0,l=c,c&&(h=e[R>>2]|0,(h|0)!=(c|0)&&(e[R>>2]=h+(~((h+-2-l|0)>>>1)<<1)),he(c)),R=d,le(R|0)}while(!1);if(d=t+20|0,l=ee(h<<1,l)|0,e[d>>2]=0,w=t+24|0,e[w>>2]=0,e[t+28>>2]=0,!l){R=t+36|0,e[R>>2]=e[r>>2],e[R+4>>2]=e[r+4>>2],e[R+8>>2]=e[r+8>>2];return}if((l|0)<0&&(g=0,ue(178,d|0),o=g,g=0,o&1)||(k=13),(k|0)==13&&(g=0,c=ge(67,l|0)|0,k=g,g=0,!(k&1))){e[w>>2]=c,e[d>>2]=c,e[t+28>>2]=c+l;do S[c>>0]=0,c=(e[w>>2]|0)+1|0,e[w>>2]=c,l=l+-1|0;while(l|0);R=t+36|0,e[R>>2]=e[r>>2],e[R+4>>2]=e[r+4>>2],e[R+8>>2]=e[r+8>>2];return}h=j()|0,c=e[d>>2]|0,c&&((e[w>>2]|0)!=(c|0)&&(e[w>>2]=c),he(c)),c=e[N>>2]|0,c||(R=h,le(R|0)),l=e[R>>2]|0,(l|0)!=(c|0)&&(e[R>>2]=l+(~((l+-2-c|0)>>>1)<<1)),he(c),R=h,le(R|0)}function Fa(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0;e[t>>2]=36436,e[t+4>>2]=o,N=t+8|0,h=e[o>>2]|0,D=o+16|0,l=e[D>>2]|0,d=ee(l,h)|0,e[N>>2]=0,R=t+12|0,e[R>>2]=0,e[t+16>>2]=0;do if(d){if((d|0)<0&&(g=0,ue(178,N|0),h=g,g=0,h&1)||(k=4),(k|0)==4&&(w=d<<1,g=0,C=ge(67,w|0)|0,h=g,g=0,!(h&1))){e[N>>2]=C,h=C+(d<<1)|0,e[t+16>>2]=h,Jt(C|0,0,w|0)|0,e[R>>2]=h,h=e[o>>2]|0,l=e[D>>2]|0;break}d=j()|0,c=e[N>>2]|0,l=c,c&&(h=e[R>>2]|0,(h|0)!=(c|0)&&(e[R>>2]=h+(~((h+-2-l|0)>>>1)<<1)),he(c)),R=d,le(R|0)}while(!1);if(d=t+20|0,l=ee(h<<1,l)|0,e[d>>2]=0,w=t+24|0,e[w>>2]=0,e[t+28>>2]=0,!l){R=t+36|0,e[R>>2]=e[r>>2],e[R+4>>2]=e[r+4>>2],e[R+8>>2]=e[r+8>>2];return}if((l|0)<0&&(g=0,ue(178,d|0),o=g,g=0,o&1)||(k=13),(k|0)==13&&(g=0,c=ge(67,l|0)|0,k=g,g=0,!(k&1))){e[w>>2]=c,e[d>>2]=c,e[t+28>>2]=c+l;do S[c>>0]=0,c=(e[w>>2]|0)+1|0,e[w>>2]=c,l=l+-1|0;while(l|0);R=t+36|0,e[R>>2]=e[r>>2],e[R+4>>2]=e[r+4>>2],e[R+8>>2]=e[r+8>>2];return}h=j()|0,c=e[d>>2]|0,c&&((e[w>>2]|0)!=(c|0)&&(e[w>>2]=c),he(c)),c=e[N>>2]|0,c||(R=h,le(R|0)),l=e[R>>2]|0,(l|0)!=(c|0)&&(e[R>>2]=l+(~((l+-2-c|0)>>>1)<<1)),he(c),R=h,le(R|0)}function Ra(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0;e[t>>2]=36412,e[t+4>>2]=o,N=t+8|0,h=e[o>>2]|0,D=o+16|0,l=e[D>>2]|0,d=ee(l,h)|0,e[N>>2]=0,R=t+12|0,e[R>>2]=0,e[t+16>>2]=0;do if(d){if((d|0)<0&&(g=0,ue(178,N|0),h=g,g=0,h&1)||(k=4),(k|0)==4&&(w=d<<1,g=0,C=ge(67,w|0)|0,h=g,g=0,!(h&1))){e[N>>2]=C,h=C+(d<<1)|0,e[t+16>>2]=h,Jt(C|0,0,w|0)|0,e[R>>2]=h,h=e[o>>2]|0,l=e[D>>2]|0;break}d=j()|0,c=e[N>>2]|0,l=c,c&&(h=e[R>>2]|0,(h|0)!=(c|0)&&(e[R>>2]=h+(~((h+-2-l|0)>>>1)<<1)),he(c)),R=d,le(R|0)}while(!1);if(d=t+20|0,l=ee(h<<1,l)|0,e[d>>2]=0,w=t+24|0,e[w>>2]=0,e[t+28>>2]=0,!l){R=t+36|0,e[R>>2]=e[r>>2],e[R+4>>2]=e[r+4>>2],e[R+8>>2]=e[r+8>>2];return}if((l|0)<0&&(g=0,ue(178,d|0),o=g,g=0,o&1)||(k=13),(k|0)==13&&(g=0,c=ge(67,l|0)|0,k=g,g=0,!(k&1))){e[w>>2]=c,e[d>>2]=c,e[t+28>>2]=c+l;do S[c>>0]=0,c=(e[w>>2]|0)+1|0,e[w>>2]=c,l=l+-1|0;while(l|0);R=t+36|0,e[R>>2]=e[r>>2],e[R+4>>2]=e[r+4>>2],e[R+8>>2]=e[r+8>>2];return}h=j()|0,c=e[d>>2]|0,c&&((e[w>>2]|0)!=(c|0)&&(e[w>>2]=c),he(c)),c=e[N>>2]|0,c||(R=h,le(R|0)),l=e[R>>2]|0,(l|0)!=(c|0)&&(e[R>>2]=l+(~((l+-2-c|0)>>>1)<<1)),he(c),R=h,le(R|0)}function Ma(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0;e[t>>2]=36388,e[t+4>>2]=o,N=t+8|0,h=e[o>>2]|0,D=o+16|0,l=e[D>>2]|0,d=ee(l,h)|0,e[N>>2]=0,R=t+12|0,e[R>>2]=0,e[t+16>>2]=0;do if(d){if((d|0)<0&&(g=0,ue(178,N|0),h=g,g=0,h&1)||(k=4),(k|0)==4&&(w=d<<1,g=0,C=ge(67,w|0)|0,h=g,g=0,!(h&1))){e[N>>2]=C,h=C+(d<<1)|0,e[t+16>>2]=h,Jt(C|0,0,w|0)|0,e[R>>2]=h,h=e[o>>2]|0,l=e[D>>2]|0;break}d=j()|0,c=e[N>>2]|0,l=c,c&&(h=e[R>>2]|0,(h|0)!=(c|0)&&(e[R>>2]=h+(~((h+-2-l|0)>>>1)<<1)),he(c)),R=d,le(R|0)}while(!1);if(d=t+20|0,l=ee(h<<1,l)|0,e[d>>2]=0,w=t+24|0,e[w>>2]=0,e[t+28>>2]=0,!l){R=t+36|0,e[R>>2]=e[r>>2],e[R+4>>2]=e[r+4>>2],e[R+8>>2]=e[r+8>>2];return}if((l|0)<0&&(g=0,ue(178,d|0),o=g,g=0,o&1)||(k=13),(k|0)==13&&(g=0,c=ge(67,l|0)|0,k=g,g=0,!(k&1))){e[w>>2]=c,e[d>>2]=c,e[t+28>>2]=c+l;do S[c>>0]=0,c=(e[w>>2]|0)+1|0,e[w>>2]=c,l=l+-1|0;while(l|0);R=t+36|0,e[R>>2]=e[r>>2],e[R+4>>2]=e[r+4>>2],e[R+8>>2]=e[r+8>>2];return}h=j()|0,c=e[d>>2]|0,c&&((e[w>>2]|0)!=(c|0)&&(e[w>>2]=c),he(c)),c=e[N>>2]|0,c||(R=h,le(R|0)),l=e[R>>2]|0,(l|0)!=(c|0)&&(e[R>>2]=l+(~((l+-2-c|0)>>>1)<<1)),he(c),R=h,le(R|0)}function Pa(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0;d=t+32|0,Sp(d,r)|0,h=t+44|0,e[h>>2]=0,w=t+48|0,c=e[w>>2]|0,c&8&&(r=S[d>>0]|0,r&1?(r=(e[t+40>>2]|0)+(e[t+36>>2]|0)|0,e[h>>2]=r,l=e[t+40>>2]|0,o=l):(r=((r&255)>>>1)+(d+1)|0,e[h>>2]=r,o=d+1|0,l=d+1|0),e[t+8>>2]=o,e[t+12>>2]=l,e[t+16>>2]=r),c&16&&(r=S[d>>0]|0,r&1?(c=e[t+36>>2]|0,e[h>>2]=(e[t+40>>2]|0)+c,r=(e[d>>2]&-2)+-1|0,h=c):(c=(r&255)>>>1,e[h>>2]=d+1+c,r=10,h=c),zs(d,r,0),r=S[d>>0]|0,r&1?(o=e[t+40>>2]|0,c=o,l=e[t+36>>2]|0):(c=d+1|0,l=(r&255)>>>1,o=d+1|0),r=t+24|0,e[r>>2]=o,e[t+20>>2]=o,e[t+28>>2]=c+l,e[w>>2]&3&&(e[r>>2]=o+h))}function La(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0;R=b,b=b+32|0,d=R+16|0,N=R+8|0,w=R,g=0,Ae(65,N|0,t|0),D=g,g=0;e:do if(D&1)o=j(0)|0,l=t,c=t;else{do if(S[N>>0]|0){l=e[(e[t>>2]|0)+-12>>2]|0,e[w>>2]=e[t+(l+24)>>2],C=t+l|0,D=e[t+(l+4)>>2]|0,c=r+o|0,l=t+(l+76)|0,o=e[l>>2]|0;do if((o|0)==-1)if(g=0,o=ge(68,C|0)|0,_=g,g=0,_&1)k=13;else{if(e[d>>2]=o,g=0,o=be(37,d|0,44220)|0,_=g,g=0,!(_&1)&&(g=0,h=be(e[(e[o>>2]|0)+28>>2]|0,o|0,32)|0,_=g,g=0,!(_&1))){_0(d),o=h<<24>>24,e[l>>2]=o,k=9;break}o=j(0)|0,_0(d)}else k=9;while(!1);if((k|0)==9)if(g=0,e[d>>2]=e[w>>2],o=Vt(39,d|0,r|0,((D&176|0)==32?c:r)|0,c|0,C|0,o&255|0)|0,_=g,g=0,_&1)k=13;else{if(o)break;if(_=e[(e[t>>2]|0)+-12>>2]|0,g=0,Ae(66,t+_|0,e[t+(_+16)>>2]|5|0),_=g,g=0,_&1)k=13;else break}(k|0)==13&&(o=j(0)|0),Ei(N),l=t,c=t;break e}while(!1);return Ei(N),b=R,t|0}while(!1);return K0(o|0)|0,g=0,ue(181,l+(e[(e[c>>2]|0)+-12>>2]|0)|0),_=g,g=0,_&1?(o=j()|0,g=0,Nt(3),_=g,g=0,_&1?(_=j(0)|0,$t(_)):le(o|0),0):(ei(),b=R,t|0)}function Oa(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0;if(o=e[r+48>>2]|0,o&16){if(o=r+44|0,l=e[o>>2]|0,c=e[r+24>>2]|0,l>>>0>>0?e[o>>2]=c:c=l,l=e[r+20>>2]|0,h=c-l|0,h>>>0>4294967279&&si(t),h>>>0<11?(S[t>>0]=h<<1,o=t+1|0):(r=h+16&-16,o=Xe(r)|0,e[t+8>>2]=o,e[t>>2]=r|1,e[t+4>>2]=h),(l|0)!=(c|0)){for(r=o;S[r>>0]=S[l>>0]|0,l=l+1|0,(l|0)!=(c|0);)r=r+1|0;o=o+h|0}S[o>>0]=0;return}if(!(o&8)){e[t>>2]=0,e[t+4>>2]=0,e[t+8>>2]=0;return}if(l=e[r+8>>2]|0,r=e[r+16>>2]|0,h=r-l|0,h>>>0>4294967279&&si(t),h>>>0<11?(S[t>>0]=h<<1,o=t+1|0):(c=h+16&-16,o=Xe(c)|0,e[t+8>>2]=o,e[t>>2]=c|1,e[t+4>>2]=h),(l|0)!=(r|0)){for(c=o;S[c>>0]=S[l>>0]|0,l=l+1|0,(l|0)!=(r|0);)c=c+1|0;o=o+h|0}S[o>>0]=0}function $a(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0;e[t>>2]=36364,e[t+4>>2]=o,R=t+8|0,d=e[o>>2]|0,k=o+16|0,h=e[k>>2]|0,D=ee(h,d)|0,e[R>>2]=0,_=t+12|0,e[_>>2]=0,e[t+16>>2]=0;do if(D){if((D|0)<0&&(g=0,ue(178,R|0),d=g,g=0,d&1)||(N=4),(N|0)==4&&(w=D<<1,g=0,C=ge(67,w|0)|0,d=g,g=0,!(d&1))){e[R>>2]=C,d=C+(D<<1)|0,e[t+16>>2]=d,Jt(C|0,0,w|0)|0,e[_>>2]=d,d=e[o>>2]|0,h=e[k>>2]|0;break}w=j()|0,c=e[R>>2]|0,h=c,c&&(d=e[_>>2]|0,(d|0)!=(c|0)&&(e[_>>2]=d+(~((d+-2-h|0)>>>1)<<1)),he(c)),_=w,le(_|0)}while(!1);if(w=t+20|0,h=ee(d<<1,h)|0,e[w>>2]=0,C=t+24|0,e[C>>2]=0,e[t+28>>2]=0,!h){_=t+32|0,R=l,R=e[R>>2]|0,l=l+4|0,l=e[l>>2]|0,N=_,e[N>>2]=R,_=_+4|0,e[_>>2]=l,_=t+40|0,e[_>>2]=R,_=t+48|0,e[_>>2]=e[r>>2],e[_+4>>2]=e[r+4>>2],e[_+8>>2]=e[r+8>>2];return}if((h|0)<0&&(g=0,ue(178,w|0),k=g,g=0,k&1)||(N=13),(N|0)==13&&(g=0,c=ge(67,h|0)|0,N=g,g=0,!(N&1))){e[C>>2]=c,e[w>>2]=c,e[t+28>>2]=c+h;do S[c>>0]=0,c=(e[C>>2]|0)+1|0,e[C>>2]=c,h=h+-1|0;while(h|0);_=t+32|0,R=l,R=e[R>>2]|0,l=l+4|0,l=e[l>>2]|0,N=_,e[N>>2]=R,_=_+4|0,e[_>>2]=l,_=t+40|0,e[_>>2]=R,_=t+48|0,e[_>>2]=e[r>>2],e[_+4>>2]=e[r+4>>2],e[_+8>>2]=e[r+8>>2];return}d=j()|0,c=e[w>>2]|0,c&&((e[C>>2]|0)!=(c|0)&&(e[C>>2]=c),he(c)),c=e[R>>2]|0,c||(_=d,le(_|0)),h=e[_>>2]|0,(h|0)!=(c|0)&&(e[_>>2]=h+(~((h+-2-c|0)>>>1)<<1)),he(c),_=d,le(_|0)}function Ba(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0;e[t>>2]=36340,e[t+4>>2]=o,R=t+8|0,d=e[o>>2]|0,k=o+16|0,h=e[k>>2]|0,D=ee(h,d)|0,e[R>>2]=0,_=t+12|0,e[_>>2]=0,e[t+16>>2]=0;do if(D){if((D|0)<0&&(g=0,ue(178,R|0),d=g,g=0,d&1)||(N=4),(N|0)==4&&(w=D<<1,g=0,C=ge(67,w|0)|0,d=g,g=0,!(d&1))){e[R>>2]=C,d=C+(D<<1)|0,e[t+16>>2]=d,Jt(C|0,0,w|0)|0,e[_>>2]=d,d=e[o>>2]|0,h=e[k>>2]|0;break}w=j()|0,c=e[R>>2]|0,h=c,c&&(d=e[_>>2]|0,(d|0)!=(c|0)&&(e[_>>2]=d+(~((d+-2-h|0)>>>1)<<1)),he(c)),_=w,le(_|0)}while(!1);if(w=t+20|0,h=ee(d<<1,h)|0,e[w>>2]=0,C=t+24|0,e[C>>2]=0,e[t+28>>2]=0,!h){_=t+32|0,R=l,R=e[R>>2]|0,l=l+4|0,l=e[l>>2]|0,N=_,e[N>>2]=R,_=_+4|0,e[_>>2]=l,_=t+40|0,e[_>>2]=R,_=t+48|0,e[_>>2]=e[r>>2],e[_+4>>2]=e[r+4>>2],e[_+8>>2]=e[r+8>>2];return}if((h|0)<0&&(g=0,ue(178,w|0),k=g,g=0,k&1)||(N=13),(N|0)==13&&(g=0,c=ge(67,h|0)|0,N=g,g=0,!(N&1))){e[C>>2]=c,e[w>>2]=c,e[t+28>>2]=c+h;do S[c>>0]=0,c=(e[C>>2]|0)+1|0,e[C>>2]=c,h=h+-1|0;while(h|0);_=t+32|0,R=l,R=e[R>>2]|0,l=l+4|0,l=e[l>>2]|0,N=_,e[N>>2]=R,_=_+4|0,e[_>>2]=l,_=t+40|0,e[_>>2]=R,_=t+48|0,e[_>>2]=e[r>>2],e[_+4>>2]=e[r+4>>2],e[_+8>>2]=e[r+8>>2];return}d=j()|0,c=e[w>>2]|0,c&&((e[C>>2]|0)!=(c|0)&&(e[C>>2]=c),he(c)),c=e[R>>2]|0,c||(_=d,le(_|0)),h=e[_>>2]|0,(h|0)!=(c|0)&&(e[_>>2]=h+(~((h+-2-c|0)>>>1)<<1)),he(c),_=d,le(_|0)}function Va(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0;e[t>>2]=36316,e[t+4>>2]=o,R=t+8|0,d=e[o>>2]|0,k=o+16|0,h=e[k>>2]|0,D=ee(h,d)|0,e[R>>2]=0,_=t+12|0,e[_>>2]=0,e[t+16>>2]=0;do if(D){if((D|0)<0&&(g=0,ue(178,R|0),d=g,g=0,d&1)||(N=4),(N|0)==4&&(w=D<<1,g=0,C=ge(67,w|0)|0,d=g,g=0,!(d&1))){e[R>>2]=C,d=C+(D<<1)|0,e[t+16>>2]=d,Jt(C|0,0,w|0)|0,e[_>>2]=d,d=e[o>>2]|0,h=e[k>>2]|0;break}w=j()|0,c=e[R>>2]|0,h=c,c&&(d=e[_>>2]|0,(d|0)!=(c|0)&&(e[_>>2]=d+(~((d+-2-h|0)>>>1)<<1)),he(c)),_=w,le(_|0)}while(!1);if(w=t+20|0,h=ee(d<<1,h)|0,e[w>>2]=0,C=t+24|0,e[C>>2]=0,e[t+28>>2]=0,!h){_=t+32|0,R=l,R=e[R>>2]|0,l=l+4|0,l=e[l>>2]|0,N=_,e[N>>2]=R,_=_+4|0,e[_>>2]=l,_=t+40|0,e[_>>2]=R,_=t+48|0,e[_>>2]=e[r>>2],e[_+4>>2]=e[r+4>>2],e[_+8>>2]=e[r+8>>2];return}if((h|0)<0&&(g=0,ue(178,w|0),k=g,g=0,k&1)||(N=13),(N|0)==13&&(g=0,c=ge(67,h|0)|0,N=g,g=0,!(N&1))){e[C>>2]=c,e[w>>2]=c,e[t+28>>2]=c+h;do S[c>>0]=0,c=(e[C>>2]|0)+1|0,e[C>>2]=c,h=h+-1|0;while(h|0);_=t+32|0,R=l,R=e[R>>2]|0,l=l+4|0,l=e[l>>2]|0,N=_,e[N>>2]=R,_=_+4|0,e[_>>2]=l,_=t+40|0,e[_>>2]=R,_=t+48|0,e[_>>2]=e[r>>2],e[_+4>>2]=e[r+4>>2],e[_+8>>2]=e[r+8>>2];return}d=j()|0,c=e[w>>2]|0,c&&((e[C>>2]|0)!=(c|0)&&(e[C>>2]=c),he(c)),c=e[R>>2]|0,c||(_=d,le(_|0)),h=e[_>>2]|0,(h|0)!=(c|0)&&(e[_>>2]=h+(~((h+-2-c|0)>>>1)<<1)),he(c),_=d,le(_|0)}function Ua(t){t=t|0;var r=0,o=0,l=0;e[t>>2]=36316,r=e[t+20>>2]|0,r&&(o=t+24|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),l=e[t+8>>2]|0,l&&(r=t+12|0,o=e[r>>2]|0,(o|0)!=(l|0)&&(e[r>>2]=o+(~((o+-2-l|0)>>>1)<<1)),he(l))}function za(t){t=t|0;var r=0,o=0,l=0;if(e[t>>2]=36316,r=e[t+20>>2]|0,r&&(o=t+24|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),l=e[t+8>>2]|0,!l){he(t);return}r=t+12|0,o=e[r>>2]|0,(o|0)!=(l|0)&&(e[r>>2]=o+(~((o+-2-l|0)>>>1)<<1)),he(l),he(t)}function Ga(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0;if(c=t+48|0,!(e[c>>2]|0)){w=t+52|0,Qr(t,r,e[w>>2]|0,o,l),e[w>>2]=(e[w>>2]|0)+(e[(e[t+4>>2]|0)+12>>2]|0);return}C=t+4|0,h=o<<1,d=ee(h,e[(e[C>>2]|0)+16>>2]|0)|0,w=t+20|0,Qr(t,r,e[w>>2]|0,o,l),r=e[C>>2]|0,(e[r+28>>2]|0)==536870912&&ti(e[w>>2]|0,ee(h,e[r+16>>2]|0)|0),C=e[c>>2]|0,(Yt[e[(e[C>>2]|0)+48>>2]&63](C,e[w>>2]|0,d)|0)!=(d|0)&&(r=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,Q|0)|0,bt(8)),g=0,xe(7,r|0,3,35648),C=g,g=0,C&1?(C=j()|0,Tt(r|0),le(C|0)):Qt(r|0,824,96))}function qa(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0;if(c=e[t+48>>2]|0,c){Wa(t,c,r,o,l);return}else{c=t+52|0,Bn(t,e[c>>2]|0,r,o,l),e[c>>2]=(e[c>>2]|0)+(e[(e[t+4>>2]|0)+12>>2]|0);return}}function Bn(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0;C=t+4|0,h=e[C>>2]|0;do if(!(S[h+32>>0]|0))D=r;else{if(d=t+8|0,o0(e[d>>2]|0,r|0,l*6|0)|0,h=e[C>>2]|0,w=e[h+16>>2]|0,(l|0)<=0){D=e[d>>2]|0;break}for(r=e[d>>2]|0,h=r,d=0;D=h+4|0,k=I[h>>1]|0,I[h>>1]=I[D>>1]|0,I[D>>1]=k,d=d+1|0,(d|0)!=(l|0);)h=h+(w<<1)|0;D=r,h=e[C>>2]|0}while(!1);switch(e[h+16>>2]|0){case 3:if((e[h+24>>2]|0)==2){if((l|0)<=0)return;h=t+32|0,r=0;do k=e[h>>2]|0,C=M[D+(r*6|0)+2>>1]<>1]<>1]<>1]=(C+49152+((t+c|0)>>>2)&65535)>>>k,I[o+(r*6|0)+2>>1]=t>>>k,I[o+(r*6|0)+4>>1]=c>>>k,r=r+1|0;while((r|0)!=(l|0));return}else{if(d=(c|0)<(l|0)?c:l,(d|0)<=0)return;w=c<<1,h=e[t+32>>2]|0,r=0;do l=M[D+(r*6|0)+2>>1]<>1]<>1]<>1]=(l+49152+((t+k|0)>>>2)&65535)>>>h,I[o+(r+c<<1)>>1]=t>>>h,I[o+(r+w<<1)>>1]=k>>>h,r=r+1|0;while((r|0)!=(d|0));return}case 4:{if((e[h+24>>2]|0)!=1||(d=(c|0)<(l|0)?c:l,(d|0)<=0))return;w=c<<1,C=c*3|0,h=e[t+32>>2]|0,r=0;do k=I[D+(r<<3)+6>>1]|0,N=M[D+(r<<3)+2>>1]<>1]<>1]<>1]=(N+49152+((l+t|0)>>>2)&65535)>>>h,I[o+(r+c<<1)>>1]=l>>>h,I[o+(r+w<<1)>>1]=t>>>h,I[o+(r+C<<1)>>1]=k,r=r+1|0;while((r|0)!=(d|0));return}default:return}}function Wa(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0;N=b,b=b+176|0,R=N+152|0,U=N+16|0,_=N,C=t+4|0,h=e[C>>2]|0,k=l<<1,d=ee(k,e[h+16>>2]|0)|0;do if(d){for(w=t+20|0;h=Yt[e[(e[r>>2]|0)+32>>2]&63](r,e[w>>2]|0,d)|0,!!h;)if((d|0)==(h|0)){D=26;break}else d=d-h|0;if((D|0)==26){h=e[C>>2]|0;break}D=U+56|0,C=U+4|0,e[U>>2]=36160,e[D>>2]=36180,g=0,Ae(62,U+56|0,C|0),N=g,g=0,N&1&&(U=j()|0,tt(D),le(U|0)),e[U+128>>2]=0,e[U+132>>2]=-1,e[U>>2]=36200,e[U+56>>2]=36220,g=0,ue(180,C|0),N=g,g=0;do if(N&1)h=j()|0;else{if(e[C>>2]=36236,r=U+36|0,e[r>>2]=0,e[r+4>>2]=0,e[r+8>>2]=0,e[r+12>>2]=0,e[U+52>>2]=16,e[R>>2]=0,e[R+4>>2]=0,e[R+8>>2]=0,g=0,Ae(63,C|0,R|0),N=g,g=0,N&1){h=j()|0,de(R),de(r),wt(C);break}de(R),g=0,h=Ve(28,U|0,49029,57)|0,R=g,g=0,!(R&1)&&(g=0,be(36,h|0,0)|0,R=g,g=0,!(R&1))&&(w=Ct(16)|0,g=0,Ae(64,_|0,C|0),R=g,g=0,R&1?h=j()|0:(!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,Q|0)|0,bt(8)),g=0,$e(36,w|0,3,35648,_|0),R=g,g=0,R&1?d=1:(g=0,xe(6,w|0,824,96),g=0,d=0),h=j()|0,de(_),d||(_=h,e[U>>2]=36200,e[D>>2]=36220,e[C>>2]=36236,de(r),wt(C),tt(D),le(_|0))),Tt(w|0),_=h,e[U>>2]=36200,e[D>>2]=36220,e[C>>2]=36236,de(r),wt(C),tt(D),le(_|0)),_=j()|0,e[U>>2]=36200,e[D>>2]=36220,e[C>>2]=36236,de(r),wt(C),tt(D),le(_|0)}while(!1);U=h,tt(D),le(U|0)}while(!1);if(d=t+20|0,(e[h+28>>2]|0)!=536870912){U=e[d>>2]|0,Bn(t,U,o,l,c),b=N;return}ti(e[d>>2]|0,ee(k,e[h+16>>2]|0)|0),U=e[d>>2]|0,Bn(t,U,o,l,c),b=N}function ti(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0;if(c=b,b=b+176|0,o=c+152|0,C=c+16|0,d=c,!(r&1)){if(o=(r|0)/4|0,(r|0)>3){l=0;do C=t+(l<<2)|0,w=e[C>>2]|0,e[C>>2]=w>>>8&16711935|w<<8&-16711936,l=l+1|0;while((l|0)<(o|0))}if(!(r&3)){b=c;return}d=t+(r+-2)|0,C=t+(r+-1)|0,w=S[d>>0]|0,S[d>>0]=S[C>>0]|0,S[C>>0]=w,b=c;return}w=C+56|0,h=C+4|0,e[C>>2]=36160,e[w>>2]=36180,g=0,Ae(62,C+56|0,h|0),c=g,g=0,c&1&&(C=j()|0,tt(w),le(C|0)),e[C+128>>2]=0,e[C+132>>2]=-1,e[C>>2]=36200,e[C+56>>2]=36220,g=0,ue(180,h|0),c=g,g=0;do if(c&1)o=j()|0;else{if(e[h>>2]=36236,c=C+36|0,e[c>>2]=0,e[c+4>>2]=0,e[c+8>>2]=0,e[c+12>>2]=0,e[C+52>>2]=16,e[o>>2]=0,e[o+4>>2]=0,e[o+8>>2]=0,g=0,Ae(63,h|0,o|0),t=g,g=0,t&1){C=j()|0,de(o),de(c),wt(h),o=C;break}de(o),g=0,o=Ve(28,C|0,49087,24)|0,t=g,g=0,!(t&1)&&(g=0,l=be(36,o|0,r|0)|0,r=g,g=0,!(r&1))&&(g=0,Ve(28,l|0,49112,20)|0,r=g,g=0,!(r&1))&&(t=Ct(16)|0,g=0,Ae(64,d|0,h|0),r=g,g=0,r&1?o=j()|0:(!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,Q|0)|0,bt(8)),g=0,$e(36,t|0,1,35648,d|0),r=g,g=0,r&1?l=1:(g=0,xe(6,t|0,824,96),g=0,l=0),o=j()|0,de(d),l||(d=o,e[C>>2]=36200,e[w>>2]=36220,e[h>>2]=36236,de(c),wt(h),tt(w),le(d|0))),Tt(t|0),d=o,e[C>>2]=36200,e[w>>2]=36220,e[h>>2]=36236,de(c),wt(h),tt(w),le(d|0)),d=j()|0,e[C>>2]=36200,e[w>>2]=36220,e[h>>2]=36236,de(c),wt(h),tt(w),le(d|0)}while(!1);C=o,tt(w),le(C|0)}function Qr(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0;D=t+4|0,h=e[D>>2]|0;e:do switch(e[h+16>>2]|0){case 3:{if((e[h+24>>2]|0)==2){if((l|0)<=0)break e;h=t+40|0,t=0;do c=e[h>>2]|0,w=M[r+(t*6|0)+2>>1]<>1]<>1]<>2)+16384|0,I[o+(t*6|0)>>1]=(d+32768+C&65535)>>>c,I[o+(t*6|0)+2>>1]=(C&65535)>>>c,I[o+(t*6|0)+4>>1]=(w+32768+C&65535)>>>c,t=t+1|0;while((t|0)!=(l|0))}else{if(d=(l|0)<(c|0)?l:c,(d|0)<=0)break e;w=c<<1,h=t+40|0,t=0;do C=e[h>>2]|0,N=M[r+(t+c<<1)>>1]<>1]<>1]<>2)+16384|0,I[o+(t*6|0)>>1]=(R+32768+k&65535)>>>C,I[o+(t*6|0)+2>>1]=(k&65535)>>>C,I[o+(t*6|0)+4>>1]=(N+32768+k&65535)>>>C,t=t+1|0;while((t|0)!=(d|0))}break}case 4:{if((e[h+24>>2]|0)==1&&(C=(l|0)<(c|0)?l:c,(C|0)>0)){w=c<<1,h=t+40|0,t=c*3|0,d=0;do R=e[h>>2]|0,N=M[r+(d+c<<1)>>1]<>1]<>1]<>2)+16384|0,_=I[r+(d+t<<1)>>1]|0,H=v0((k&65535)>>>R&65535|0,0,16)|0,N=(N+32768+k&65535)>>>R|ye,_=v0(_&65535|0,0,48)|0,_=H|(U+32768+k&65535)>>>R&65535|_,N=N&65535|ye,R=o+(d<<3)|0,k=R,I[k>>1]=_,I[k+2>>1]=_>>>16,R=R+4|0,I[R>>1]=N,I[R+2>>1]=N>>>16,d=d+1|0;while((d|0)!=(C|0))}break}default:}while(!1);if(h=e[D>>2]|0,!!(S[h+32>>0]|0)&&(d=e[h+16>>2]|0,!((l|0)<=0)))for(h=o,t=0;H=h+4|0,U=I[h>>1]|0,I[h>>1]=I[H>>1]|0,I[H>>1]=U,t=t+1|0,(t|0)!=(l|0);)h=h+(d<<1)|0}function Ha(t){t=t|0;var r=0,o=0,l=0;e[t>>2]=36340,r=e[t+20>>2]|0,r&&(o=t+24|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),l=e[t+8>>2]|0,l&&(r=t+12|0,o=e[r>>2]|0,(o|0)!=(l|0)&&(e[r>>2]=o+(~((o+-2-l|0)>>>1)<<1)),he(l))}function Qa(t){t=t|0;var r=0,o=0,l=0;if(e[t>>2]=36340,r=e[t+20>>2]|0,r&&(o=t+24|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),l=e[t+8>>2]|0,!l){he(t);return}r=t+12|0,o=e[r>>2]|0,(o|0)!=(l|0)&&(e[r>>2]=o+(~((o+-2-l|0)>>>1)<<1)),he(l),he(t)}function Ka(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0;if(c=t+48|0,!(e[c>>2]|0)){w=t+52|0,Kr(t,r,e[w>>2]|0,o,l),e[w>>2]=(e[w>>2]|0)+(e[(e[t+4>>2]|0)+12>>2]|0);return}C=t+4|0,h=o<<1,d=ee(h,e[(e[C>>2]|0)+16>>2]|0)|0,w=t+20|0,Kr(t,r,e[w>>2]|0,o,l),r=e[C>>2]|0,(e[r+28>>2]|0)==536870912&&ti(e[w>>2]|0,ee(h,e[r+16>>2]|0)|0),C=e[c>>2]|0,(Yt[e[(e[C>>2]|0)+48>>2]&63](C,e[w>>2]|0,d)|0)!=(d|0)&&(r=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,Q|0)|0,bt(8)),g=0,xe(7,r|0,3,35648),C=g,g=0,C&1?(C=j()|0,Tt(r|0),le(C|0)):Qt(r|0,824,96))}function Ya(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0;if(c=e[t+48>>2]|0,c){ja(t,c,r,o,l);return}else{c=t+52|0,Vn(t,e[c>>2]|0,r,o,l),e[c>>2]=(e[c>>2]|0)+(e[(e[t+4>>2]|0)+12>>2]|0);return}}function Vn(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0;C=t+4|0,h=e[C>>2]|0;do if(!(S[h+32>>0]|0))D=r;else{if(d=t+8|0,o0(e[d>>2]|0,r|0,l*6|0)|0,h=e[C>>2]|0,w=e[h+16>>2]|0,(l|0)<=0){D=e[d>>2]|0;break}for(r=e[d>>2]|0,h=r,d=0;D=h+4|0,k=I[h>>1]|0,I[h>>1]=I[D>>1]|0,I[D>>1]=k,d=d+1|0,(d|0)!=(l|0);)h=h+(w<<1)|0;D=r,h=e[C>>2]|0}while(!1);switch(e[h+16>>2]|0){case 3:if((e[h+24>>2]|0)==2){if((l|0)<=0)return;h=t+32|0,r=0;do c=e[h>>2]|0,C=M[D+(r*6|0)>>1]<>1]<>1]<>>1)&65535)>>>c&65535,I[o+(r*6|0)>>1]=(C+32768-t&65535)>>>c,I[o+(r*6|0)+2>>1]=(t&65535)>>>c,I[o+(r*6|0)+4>>1]=k,r=r+1|0;while((r|0)!=(l|0));return}else{if(d=(c|0)<(l|0)?c:l,(d|0)<=0)return;w=c<<1,h=e[t+32>>2]|0,r=0;do l=M[D+(r*6|0)>>1]<>1]<>1]<>>1)&65535)>>>h&65535,I[o+(r<<1)>>1]=(l+32768-t&65535)>>>h,I[o+(r+c<<1)>>1]=(t&65535)>>>h,I[o+(r+w<<1)>>1]=k,r=r+1|0;while((r|0)!=(d|0));return}case 4:{if((e[h+24>>2]|0)!=1||(d=(c|0)<(l|0)?c:l,(d|0)<=0))return;w=c<<1,C=c*3|0,h=e[t+32>>2]|0,r=0;do k=I[D+(r<<3)+6>>1]|0,N=M[D+(r<<3)>>1]<>1]<>1]<>>1)&65535)>>>h&65535,I[o+(r<<1)>>1]=(N+32768-l&65535)>>>h,I[o+(r+c<<1)>>1]=(l&65535)>>>h,I[o+(r+w<<1)>>1]=t,I[o+(r+C<<1)>>1]=k,r=r+1|0;while((r|0)!=(d|0));return}default:return}}function ja(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0;N=b,b=b+176|0,R=N+152|0,U=N+16|0,_=N,C=t+4|0,h=e[C>>2]|0,k=l<<1,d=ee(k,e[h+16>>2]|0)|0;do if(d){for(w=t+20|0;h=Yt[e[(e[r>>2]|0)+32>>2]&63](r,e[w>>2]|0,d)|0,!!h;)if((d|0)==(h|0)){D=26;break}else d=d-h|0;if((D|0)==26){h=e[C>>2]|0;break}D=U+56|0,C=U+4|0,e[U>>2]=36160,e[D>>2]=36180,g=0,Ae(62,U+56|0,C|0),N=g,g=0,N&1&&(U=j()|0,tt(D),le(U|0)),e[U+128>>2]=0,e[U+132>>2]=-1,e[U>>2]=36200,e[U+56>>2]=36220,g=0,ue(180,C|0),N=g,g=0;do if(N&1)h=j()|0;else{if(e[C>>2]=36236,r=U+36|0,e[r>>2]=0,e[r+4>>2]=0,e[r+8>>2]=0,e[r+12>>2]=0,e[U+52>>2]=16,e[R>>2]=0,e[R+4>>2]=0,e[R+8>>2]=0,g=0,Ae(63,C|0,R|0),N=g,g=0,N&1){h=j()|0,de(R),de(r),wt(C);break}de(R),g=0,h=Ve(28,U|0,49029,57)|0,R=g,g=0,!(R&1)&&(g=0,be(36,h|0,0)|0,R=g,g=0,!(R&1))&&(w=Ct(16)|0,g=0,Ae(64,_|0,C|0),R=g,g=0,R&1?h=j()|0:(!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,Q|0)|0,bt(8)),g=0,$e(36,w|0,3,35648,_|0),R=g,g=0,R&1?d=1:(g=0,xe(6,w|0,824,96),g=0,d=0),h=j()|0,de(_),d||(_=h,e[U>>2]=36200,e[D>>2]=36220,e[C>>2]=36236,de(r),wt(C),tt(D),le(_|0))),Tt(w|0),_=h,e[U>>2]=36200,e[D>>2]=36220,e[C>>2]=36236,de(r),wt(C),tt(D),le(_|0)),_=j()|0,e[U>>2]=36200,e[D>>2]=36220,e[C>>2]=36236,de(r),wt(C),tt(D),le(_|0)}while(!1);U=h,tt(D),le(U|0)}while(!1);if(d=t+20|0,(e[h+28>>2]|0)!=536870912){U=e[d>>2]|0,Vn(t,U,o,l,c),b=N;return}ti(e[d>>2]|0,ee(k,e[h+16>>2]|0)|0),U=e[d>>2]|0,Vn(t,U,o,l,c),b=N}function Kr(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0;D=t+4|0,h=e[D>>2]|0;e:do switch(e[h+16>>2]|0){case 3:{if((e[h+24>>2]|0)==2){if((l|0)<=0)break e;h=t+40|0,t=0;do C=e[h>>2]|0,w=M[r+(t*6|0)+2>>1]<>1]<>1]<>>1)&65535)>>>C&65535,I[o+(t*6|0)>>1]=d>>>C,I[o+(t*6|0)+2>>1]=w>>>C,I[o+(t*6|0)+4>>1]=c,t=t+1|0;while((t|0)!=(l|0))}else{if(d=(l|0)<(c|0)?l:c,(d|0)<=0)break e;w=c<<1,h=t+40|0,t=0;do k=e[h>>2]|0,N=M[r+(t+c<<1)>>1]<>1]<>1]<>>1)&65535)>>>k&65535,I[o+(t*6|0)>>1]=R>>>k,I[o+(t*6|0)+2>>1]=N>>>k,I[o+(t*6|0)+4>>1]=C,t=t+1|0;while((t|0)!=(d|0))}break}case 4:{if((e[h+24>>2]|0)==1&&(C=(l|0)<(c|0)?l:c,(C|0)>0)){w=c<<1,h=t+40|0,t=c*3|0,d=0;do k=e[h>>2]|0,R=M[r+(d+c<<1)>>1]<>1]<>1]<>>1)&65535)>>>k,_=I[r+(d+t<<1)>>1]|0,R=v0(R>>>k&65535|0,0,16)|0,N=ye|N,_=v0(_&65535|0,0,48)|0,_=U>>>k&65535|R|_,N=N&65535|ye,R=o+(d<<3)|0,k=R,I[k>>1]=_,I[k+2>>1]=_>>>16,R=R+4|0,I[R>>1]=N,I[R+2>>1]=N>>>16,d=d+1|0;while((d|0)!=(C|0))}break}default:}while(!1);if(h=e[D>>2]|0,!!(S[h+32>>0]|0)&&(d=e[h+16>>2]|0,!((l|0)<=0)))for(h=o,t=0;U=h+4|0,_=I[h>>1]|0,I[h>>1]=I[U>>1]|0,I[U>>1]=_,t=t+1|0,(t|0)!=(l|0);)h=h+(d<<1)|0}function Xa(t){t=t|0;var r=0,o=0,l=0;e[t>>2]=36364,r=e[t+20>>2]|0,r&&(o=t+24|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),l=e[t+8>>2]|0,l&&(r=t+12|0,o=e[r>>2]|0,(o|0)!=(l|0)&&(e[r>>2]=o+(~((o+-2-l|0)>>>1)<<1)),he(l))}function Za(t){t=t|0;var r=0,o=0,l=0;if(e[t>>2]=36364,r=e[t+20>>2]|0,r&&(o=t+24|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),l=e[t+8>>2]|0,!l){he(t);return}r=t+12|0,o=e[r>>2]|0,(o|0)!=(l|0)&&(e[r>>2]=o+(~((o+-2-l|0)>>>1)<<1)),he(l),he(t)}function Ja(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0;if(c=t+48|0,!(e[c>>2]|0)){w=t+52|0,Yr(t,r,e[w>>2]|0,o,l),e[w>>2]=(e[w>>2]|0)+(e[(e[t+4>>2]|0)+12>>2]|0);return}C=t+4|0,h=o<<1,d=ee(h,e[(e[C>>2]|0)+16>>2]|0)|0,w=t+20|0,Yr(t,r,e[w>>2]|0,o,l),r=e[C>>2]|0,(e[r+28>>2]|0)==536870912&&ti(e[w>>2]|0,ee(h,e[r+16>>2]|0)|0),C=e[c>>2]|0,(Yt[e[(e[C>>2]|0)+48>>2]&63](C,e[w>>2]|0,d)|0)!=(d|0)&&(r=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,Q|0)|0,bt(8)),g=0,xe(7,r|0,3,35648),C=g,g=0,C&1?(C=j()|0,Tt(r|0),le(C|0)):Qt(r|0,824,96))}function el(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0;if(c=e[t+48>>2]|0,c){tl(t,c,r,o,l);return}else{c=t+52|0,Un(t,e[c>>2]|0,r,o,l),e[c>>2]=(e[c>>2]|0)+(e[(e[t+4>>2]|0)+12>>2]|0);return}}function Un(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0;C=t+4|0,h=e[C>>2]|0;do if(!(S[h+32>>0]|0))D=r;else{if(d=t+8|0,o0(e[d>>2]|0,r|0,l*6|0)|0,h=e[C>>2]|0,w=e[h+16>>2]|0,(l|0)<=0){D=e[d>>2]|0;break}for(r=e[d>>2]|0,h=r,d=0;D=h+4|0,k=I[h>>1]|0,I[h>>1]=I[D>>1]|0,I[D>>1]=k,d=d+1|0,(d|0)!=(l|0);)h=h+(w<<1)|0;D=r,h=e[C>>2]|0}while(!1);switch(e[h+16>>2]|0){case 3:if((e[h+24>>2]|0)==2){if((l|0)<=0)return;h=t+32|0,r=0;do c=e[h>>2]|0,t=M[D+(r*6|0)+2>>1]<>1]<>>c&65535,I[o+(r*6|0)>>1]=((M[D+(r*6|0)>>1]<>>c,I[o+(r*6|0)+2>>1]=(t&65535)>>>c,I[o+(r*6|0)+4>>1]=k,r=r+1|0;while((r|0)!=(l|0));return}else{if(d=(c|0)<(l|0)?c:l,(d|0)<=0)return;w=c<<1,h=e[t+32>>2]|0,r=0;do t=M[D+(r*6|0)+2>>1]<>1]<>>h&65535,I[o+(r<<1)>>1]=((M[D+(r*6|0)>>1]<>>h,I[o+(r+c<<1)>>1]=(t&65535)>>>h,I[o+(r+w<<1)>>1]=k,r=r+1|0;while((r|0)!=(d|0));return}case 4:{if((e[h+24>>2]|0)!=1||(w=(c|0)<(l|0)?c:l,(w|0)<=0))return;C=c<<1,d=c*3|0,h=e[t+32>>2]|0,r=0;do k=I[D+(r<<3)+6>>1]|0,l=M[D+(r<<3)+2>>1]<>1]<>>h&65535,I[o+(r<<1)>>1]=((M[D+(r<<3)>>1]<>>h,I[o+(r+c<<1)>>1]=(l&65535)>>>h,I[o+(r+C<<1)>>1]=t,I[o+(r+d<<1)>>1]=k,r=r+1|0;while((r|0)!=(w|0));return}default:return}}function tl(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0;N=b,b=b+176|0,R=N+152|0,U=N+16|0,_=N,C=t+4|0,h=e[C>>2]|0,k=l<<1,d=ee(k,e[h+16>>2]|0)|0;do if(d){for(w=t+20|0;h=Yt[e[(e[r>>2]|0)+32>>2]&63](r,e[w>>2]|0,d)|0,!!h;)if((d|0)==(h|0)){D=26;break}else d=d-h|0;if((D|0)==26){h=e[C>>2]|0;break}D=U+56|0,C=U+4|0,e[U>>2]=36160,e[D>>2]=36180,g=0,Ae(62,U+56|0,C|0),N=g,g=0,N&1&&(U=j()|0,tt(D),le(U|0)),e[U+128>>2]=0,e[U+132>>2]=-1,e[U>>2]=36200,e[U+56>>2]=36220,g=0,ue(180,C|0),N=g,g=0;do if(N&1)h=j()|0;else{if(e[C>>2]=36236,r=U+36|0,e[r>>2]=0,e[r+4>>2]=0,e[r+8>>2]=0,e[r+12>>2]=0,e[U+52>>2]=16,e[R>>2]=0,e[R+4>>2]=0,e[R+8>>2]=0,g=0,Ae(63,C|0,R|0),N=g,g=0,N&1){h=j()|0,de(R),de(r),wt(C);break}de(R),g=0,h=Ve(28,U|0,49029,57)|0,R=g,g=0,!(R&1)&&(g=0,be(36,h|0,0)|0,R=g,g=0,!(R&1))&&(w=Ct(16)|0,g=0,Ae(64,_|0,C|0),R=g,g=0,R&1?h=j()|0:(!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,Q|0)|0,bt(8)),g=0,$e(36,w|0,3,35648,_|0),R=g,g=0,R&1?d=1:(g=0,xe(6,w|0,824,96),g=0,d=0),h=j()|0,de(_),d||(_=h,e[U>>2]=36200,e[D>>2]=36220,e[C>>2]=36236,de(r),wt(C),tt(D),le(_|0))),Tt(w|0),_=h,e[U>>2]=36200,e[D>>2]=36220,e[C>>2]=36236,de(r),wt(C),tt(D),le(_|0)),_=j()|0,e[U>>2]=36200,e[D>>2]=36220,e[C>>2]=36236,de(r),wt(C),tt(D),le(_|0)}while(!1);U=h,tt(D),le(U|0)}while(!1);if(d=t+20|0,(e[h+28>>2]|0)!=536870912){U=e[d>>2]|0,Un(t,U,o,l,c),b=N;return}ti(e[d>>2]|0,ee(k,e[h+16>>2]|0)|0),U=e[d>>2]|0,Un(t,U,o,l,c),b=N}function Yr(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0;D=t+4|0,h=e[D>>2]|0;e:do switch(e[h+16>>2]|0){case 3:{if((e[h+24>>2]|0)==2){if((l|0)<=0)break e;h=t+40|0,t=0;do C=e[h>>2]|0,w=M[r+(t*6|0)+2>>1]<>1]<>>C&65535,I[o+(t*6|0)>>1]=((M[r+(t*6|0)>>1]<>>C,I[o+(t*6|0)+2>>1]=(w&65535)>>>C,I[o+(t*6|0)+4>>1]=c,t=t+1|0;while((t|0)!=(l|0))}else{if(d=(l|0)<(c|0)?l:c,(d|0)<=0)break e;w=c<<1,h=t+40|0,t=0;do k=e[h>>2]|0,N=M[r+(t+c<<1)>>1]<>1]<>>k&65535,I[o+(t*6|0)>>1]=((M[r+(t<<1)>>1]<>>k,I[o+(t*6|0)+2>>1]=(N&65535)>>>k,I[o+(t*6|0)+4>>1]=C,t=t+1|0;while((t|0)!=(d|0))}break}case 4:{if((e[h+24>>2]|0)==1&&(C=(l|0)<(c|0)?l:c,(C|0)>0)){w=c<<1,h=t+40|0,t=c*3|0,d=0;do R=e[h>>2]|0,U=M[r+(d+c<<1)>>1]<>1]<>>R,k=(U+32768+(M[r+(d+w<<1)>>1]<>>R,_=I[r+(d+t<<1)>>1]|0,R=v0((U&65535)>>>R&65535|0,0,16)|0,k=k|ye,_=v0(_&65535|0,0,48)|0,_=R|N&65535|_,k=k&65535|ye,N=o+(d<<3)|0,R=N,I[R>>1]=_,I[R+2>>1]=_>>>16,N=N+4|0,I[N>>1]=k,I[N+2>>1]=k>>>16,d=d+1|0;while((d|0)!=(C|0))}break}default:}while(!1);if(h=e[D>>2]|0,!!(S[h+32>>0]|0)&&(d=e[h+16>>2]|0,!((l|0)<=0)))for(h=o,t=0;U=h+4|0,_=I[h>>1]|0,I[h>>1]=I[U>>1]|0,I[U>>1]=_,t=t+1|0,(t|0)!=(l|0);)h=h+(d<<1)|0}function Ui(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0,N=0,R=0;if(N=b,b=b+16|0,D=N,k=e[t>>2]|0,!k)return t=0,b=N,t|0;if(R=r,w=l-R|0,C=c+12|0,d=e[C>>2]|0,w=(d|0)>(w|0)?d-w|0:0,d=o,c=d-R|0,(c|0)>0&&(Yt[e[(e[k>>2]|0)+48>>2]&63](k,r,c)|0)!=(c|0))return e[t>>2]=0,R=0,b=N,R|0;do if((w|0)>0){if(dr(D,w,h),g=0,c=Ve(e[(e[k>>2]|0)+48>>2]|0,k|0,(S[D>>0]&1?e[D+8>>2]|0:D+1|0)|0,w|0)|0,R=g,g=0,R&1&&(R=j()|0,de(D),le(R|0)),(c|0)==(w|0)){de(D);break}return e[t>>2]=0,de(D),R=0,b=N,R|0}while(!1);return l=l-d|0,(l|0)>0&&(Yt[e[(e[k>>2]|0)+48>>2]&63](k,o,l)|0)!=(l|0)?(e[t>>2]=0,R=0,b=N,R|0):(e[C>>2]=0,R=k,b=N,R|0)}function il(t){t=t|0,e[t>>2]=36236,de(t+32|0),wt(t)}function nl(t){t=t|0,e[t>>2]=36236,de(t+32|0),wt(t),he(t)}function rl(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0;if(d=r+44|0,w=e[d>>2]|0,D=r+24|0,k=e[D>>2]|0,w>>>0>>0&&(e[d>>2]=k,w=k),C=w,d=h&24,!d){r=t,e[r>>2]=0,e[r+4>>2]=0,r=t+8|0,e[r>>2]=-1,e[r+4>>2]=-1;return}if((c|0)==1&(d|0)==24){r=t,e[r>>2]=0,e[r+4>>2]=0,r=t+8|0,e[r>>2]=-1,e[r+4>>2]=-1;return}e:do switch(c|0){case 0:{d=0,c=0;break}case 1:if(h&8){c=(e[r+12>>2]|0)-(e[r+8>>2]|0)|0,d=c,c=((c|0)<0)<<31>>31;break e}else{c=k-(e[r+20>>2]|0)|0,d=c,c=((c|0)<0)<<31>>31;break e}case 2:{d=r+32|0,S[d>>0]&1?d=e[r+40>>2]|0:d=d+1|0,c=w-d|0,d=c,c=((c|0)<0)<<31>>31;break}default:{r=t,e[r>>2]=0,e[r+4>>2]=0,r=t+8|0,e[r>>2]=-1,e[r+4>>2]=-1;return}}while(!1);if(c=$0(d|0,c|0,o|0,l|0)|0,o=ye,(o|0)>=0&&(d=r+32|0,S[d>>0]&1?d=e[r+40>>2]|0:d=d+1|0,l=w-d|0,w=((l|0)<0)<<31>>31,!((w|0)<(o|0)|(w|0)==(o|0)&l>>>0>>0))){if(d=h&8,!((c|0)==0&(o|0)==0)){if(d|0&&!(e[r+12>>2]|0)){r=t,e[r>>2]=0,e[r+4>>2]=0,r=t+8|0,e[r>>2]=-1,e[r+4>>2]=-1;return}if((h&16|0)!=0&(k|0)==0){r=t,e[r>>2]=0,e[r+4>>2]=0,r=t+8|0,e[r>>2]=-1,e[r+4>>2]=-1;return}}d&&(e[r+12>>2]=(e[r+8>>2]|0)+c,e[r+16>>2]=C),h&16&&(e[D>>2]=(e[r+20>>2]|0)+c),r=t,e[r>>2]=0,e[r+4>>2]=0,r=t+8|0,e[r>>2]=c,e[r+4>>2]=o;return}r=t,e[r>>2]=0,e[r+4>>2]=0,r=t+8|0,e[r>>2]=-1,e[r+4>>2]=-1}function sl(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0,o=o+8|0,Vi[e[(e[r>>2]|0)+16>>2]&15](t,r,e[o>>2]|0,e[o+4>>2]|0,0,l)}function ol(t){t=t|0;var r=0,o=0,l=0,c=0;return r=t+44|0,o=e[r>>2]|0,l=e[t+24>>2]|0,o>>>0>>0&&(e[r>>2]=l,o=l),!(e[t+48>>2]&8)||(c=t+16|0,r=e[c>>2]|0,l=t+12|0,r>>>0>>0?(l=e[l>>2]|0,e[c>>2]=o,r=o):l=e[l>>2]|0,l>>>0>=r>>>0)?(t=-1,t|0):(t=F[l>>0]|0,t|0)}function al(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0;if(l=t+44|0,o=e[l>>2]|0,c=e[t+24>>2]|0,o>>>0>>0&&(e[l>>2]=c,o=c),w=t+8|0,l=e[w>>2]|0,C=t+12|0,h=e[C>>2]|0,d=l,l>>>0>=h>>>0)return t=-1,t|0;if((r|0)==-1)return e[w>>2]=l,e[C>>2]=h+-1,e[t+16>>2]=o,t=0,t|0;if(e[t+48>>2]&16)c=r&255,l=h+-1|0;else if(c=r&255,l=h+-1|0,c<<24>>24!=(S[l>>0]|0))return t=-1,t|0;return e[w>>2]=d,e[C>>2]=l,e[t+16>>2]=o,S[l>>0]=c,t=r,t|0}function ll(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0;if(H=b,b=b+16|0,k=H,(r|0)==-1)return t=0,b=H,t|0;N=t+12|0,R=t+8|0,_=(e[N>>2]|0)-(e[R>>2]|0)|0,U=t+24|0,o=e[U>>2]|0,D=t+28|0,l=e[D>>2]|0;do if((o|0)==(l|0)){if(w=t+48|0,!(e[w>>2]&16))return t=-1,b=H,t|0;if(C=t+20|0,d=e[C>>2]|0,c=o-d|0,h=t+44|0,d=(e[h>>2]|0)-d|0,l=t+32|0,g=0,Ae(67,l|0,0),o=g,g=0,!(o&1)&&(S[l>>0]&1?o=(e[l>>2]&-2)+-1|0:o=10,g=0,xe(8,l|0,o|0,0),o=g,g=0,!(o&1))){o=S[l>>0]|0,o&1?(l=e[t+40>>2]|0,o=e[t+36>>2]|0):(l=l+1|0,o=(o&255)>>>1),K=l+o|0,e[C>>2]=l,e[D>>2]=K,C=l+c|0,e[U>>2]=C,o=l+d|0,e[h>>2]=o,l=K;break}return K=j(0)|0,K0(K|0)|0,ei(),K=-1,b=H,K|0}else K=t+44|0,w=t+48|0,h=K,C=o,o=e[K>>2]|0;while(!1);return d=C+1|0,e[k>>2]=d,c=e[(d>>>0>>0?h:k)>>2]|0,e[h>>2]=c,e[w>>2]&8&&(o=t+32|0,S[o>>0]&1?o=e[t+40>>2]|0:o=o+1|0,e[R>>2]=o,e[N>>2]=o+_,e[t+16>>2]=c),(C|0)==(l|0)?(K=U0[e[(e[t>>2]|0)+52>>2]&63](t,r&255)|0,b=H,K|0):(e[U>>2]=d,S[C>>0]=r,K=r&255,b=H,K|0)}function ul(t){t=t|0;var r=0,o=0;e[t>>2]=36200,r=t+56|0,e[r>>2]=36220,o=t+4|0,e[o>>2]=36236,de(t+36|0),wt(o),tt(r)}function cl(t){t=t|0;var r=0,o=0;e[t>>2]=36200,r=t+56|0,e[r>>2]=36220,o=t+4|0,e[o>>2]=36236,de(t+36|0),wt(o),tt(r),he(t)}function hl(t){t=t|0;var r=0,o=0,l=0,c=0;c=e[(e[t>>2]|0)+-12>>2]|0,r=t+c|0,e[r>>2]=36200,o=t+(c+56)|0,e[o>>2]=36220,l=t+(c+4)|0,e[l>>2]=36236,de(t+(c+36)|0),wt(l),tt(o),he(r)}function dl(t){t=t|0;var r=0,o=0,l=0;e[t>>2]=36388,r=e[t+20>>2]|0,r&&(o=t+24|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),l=e[t+8>>2]|0,l&&(r=t+12|0,o=e[r>>2]|0,(o|0)!=(l|0)&&(e[r>>2]=o+(~((o+-2-l|0)>>>1)<<1)),he(l))}function pl(t){t=t|0;var r=0,o=0,l=0;if(e[t>>2]=36388,r=e[t+20>>2]|0,r&&(o=t+24|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),l=e[t+8>>2]|0,!l){he(t);return}r=t+12|0,o=e[r>>2]|0,(o|0)!=(l|0)&&(e[r>>2]=o+(~((o+-2-l|0)>>>1)<<1)),he(l),he(t)}function ml(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0;if(c=t+36|0,!(e[c>>2]|0)){w=t+40|0,jr(t,r,e[w>>2]|0,o,l),e[w>>2]=(e[w>>2]|0)+(e[(e[t+4>>2]|0)+12>>2]|0);return}C=t+4|0,h=o<<1,d=ee(h,e[(e[C>>2]|0)+16>>2]|0)|0,w=t+20|0,jr(t,r,e[w>>2]|0,o,l),r=e[C>>2]|0,(e[r+28>>2]|0)==536870912&&ti(e[w>>2]|0,ee(h,e[r+16>>2]|0)|0),C=e[c>>2]|0,(Yt[e[(e[C>>2]|0)+48>>2]&63](C,e[w>>2]|0,d)|0)!=(d|0)&&(r=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,Q|0)|0,bt(8)),g=0,xe(7,r|0,3,35648),C=g,g=0,C&1?(C=j()|0,Tt(r|0),le(C|0)):Qt(r|0,824,96))}function gl(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0;if(c=e[t+36>>2]|0,c){Sl(t,c,r,o,l);return}else{c=t+40|0,zn(t,e[c>>2]|0,r,o,l),e[c>>2]=(e[c>>2]|0)+(e[(e[t+4>>2]|0)+12>>2]|0);return}}function zn(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0;w=t+4|0,h=e[w>>2]|0;do if(!(S[h+32>>0]|0))C=r;else{if(t=t+8|0,o0(e[t>>2]|0,r|0,l*6|0)|0,h=e[w>>2]|0,d=e[h+16>>2]|0,(l|0)<=0){C=e[t>>2]|0;break}for(t=e[t>>2]|0,h=t,r=0;C=h+4|0,D=I[h>>1]|0,I[h>>1]=I[C>>1]|0,I[C>>1]=D,r=r+1|0,(r|0)!=(l|0);)h=h+(d<<1)|0;C=t,h=e[w>>2]|0}while(!1);switch(e[h+16>>2]|0){case 3:{if((e[h+24>>2]|0)==2){if((l|0)>0)h=0;else return;do w=M[C+(h*6|0)+2>>1]|0,c=32768-w+(M[C+(h*6|0)+4>>1]|0)|0,D=(M[C+(h*6|0)>>1]|0)-w+32768|0,I[o+(h*6|0)>>1]=w+49152+(((c&65535)+(D&65535)|0)>>>2),I[o+(h*6|0)+2>>1]=c,I[o+(h*6|0)+4>>1]=D,h=h+1|0;while((h|0)!=(l|0));return}if(h=(c|0)<(l|0)?c:l,(h|0)<=0)return;t=c<<1,r=0;do w=M[C+(r*6|0)+2>>1]|0,l=32768-w+(M[C+(r*6|0)+4>>1]|0)|0,D=(M[C+(r*6|0)>>1]|0)-w+32768|0,I[o+(r<<1)>>1]=w+49152+(((l&65535)+(D&65535)|0)>>>2),I[o+(r+c<<1)>>1]=l,I[o+(r+t<<1)>>1]=D,r=r+1|0;while((r|0)!=(h|0));return}case 4:{if((e[h+24>>2]|0)!=1||(h=(c|0)<(l|0)?c:l,(h|0)<=0))return;t=c<<1,r=c*3|0,d=0;do D=I[C+(d<<3)+6>>1]|0,k=M[C+(d<<3)+2>>1]|0,w=32768-k+(M[C+(d<<3)+4>>1]|0)|0,l=(M[C+(d<<3)>>1]|0)-k+32768|0,I[o+(d<<1)>>1]=k+49152+(((w&65535)+(l&65535)|0)>>>2),I[o+(d+c<<1)>>1]=w,I[o+(d+t<<1)>>1]=l,I[o+(d+r<<1)>>1]=D,d=d+1|0;while((d|0)!=(h|0));return}default:return}}function Sl(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0;N=b,b=b+176|0,R=N+152|0,U=N+16|0,_=N,C=t+4|0,h=e[C>>2]|0,k=l<<1,d=ee(k,e[h+16>>2]|0)|0;do if(d){for(w=t+20|0;h=Yt[e[(e[r>>2]|0)+32>>2]&63](r,e[w>>2]|0,d)|0,!!h;)if((d|0)==(h|0)){D=26;break}else d=d-h|0;if((D|0)==26){h=e[C>>2]|0;break}D=U+56|0,C=U+4|0,e[U>>2]=36160,e[D>>2]=36180,g=0,Ae(62,U+56|0,C|0),N=g,g=0,N&1&&(U=j()|0,tt(D),le(U|0)),e[U+128>>2]=0,e[U+132>>2]=-1,e[U>>2]=36200,e[U+56>>2]=36220,g=0,ue(180,C|0),N=g,g=0;do if(N&1)h=j()|0;else{if(e[C>>2]=36236,r=U+36|0,e[r>>2]=0,e[r+4>>2]=0,e[r+8>>2]=0,e[r+12>>2]=0,e[U+52>>2]=16,e[R>>2]=0,e[R+4>>2]=0,e[R+8>>2]=0,g=0,Ae(63,C|0,R|0),N=g,g=0,N&1){h=j()|0,de(R),de(r),wt(C);break}de(R),g=0,h=Ve(28,U|0,49029,57)|0,R=g,g=0,!(R&1)&&(g=0,be(36,h|0,0)|0,R=g,g=0,!(R&1))&&(w=Ct(16)|0,g=0,Ae(64,_|0,C|0),R=g,g=0,R&1?h=j()|0:(!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,Q|0)|0,bt(8)),g=0,$e(36,w|0,3,35648,_|0),R=g,g=0,R&1?d=1:(g=0,xe(6,w|0,824,96),g=0,d=0),h=j()|0,de(_),d||(_=h,e[U>>2]=36200,e[D>>2]=36220,e[C>>2]=36236,de(r),wt(C),tt(D),le(_|0))),Tt(w|0),_=h,e[U>>2]=36200,e[D>>2]=36220,e[C>>2]=36236,de(r),wt(C),tt(D),le(_|0)),_=j()|0,e[U>>2]=36200,e[D>>2]=36220,e[C>>2]=36236,de(r),wt(C),tt(D),le(_|0)}while(!1);U=h,tt(D),le(U|0)}while(!1);if(d=t+20|0,(e[h+28>>2]|0)!=536870912){U=e[d>>2]|0,zn(t,U,o,l,c),b=N;return}ti(e[d>>2]|0,ee(k,e[h+16>>2]|0)|0),U=e[d>>2]|0,zn(t,U,o,l,c),b=N}function jr(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0;C=t+4|0,t=e[C>>2]|0;e:do switch(e[t+16>>2]|0){case 3:{if((e[t+24>>2]|0)==2){if((l|0)>0)t=0;else break e;for(;;)if(w=M[r+(t*6|0)+2>>1]|0,d=M[r+(t*6|0)+4>>1]|0,c=(M[r+(t*6|0)>>1]|0)-((d+w|0)>>>2)+16384|0,I[o+(t*6|0)>>1]=d+32768+c,I[o+(t*6|0)+2>>1]=c,I[o+(t*6|0)+4>>1]=w+32768+c,t=t+1|0,(t|0)==(l|0))break e}if(t=(l|0)<(c|0)?l:c,(t|0)>0){h=c<<1,d=0;do D=M[r+(d+c<<1)>>1]|0,k=M[r+(d+h<<1)>>1]|0,w=(M[r+(d<<1)>>1]|0)-((k+D|0)>>>2)+16384|0,I[o+(d*6|0)>>1]=k+32768+w,I[o+(d*6|0)+2>>1]=w,I[o+(d*6|0)+4>>1]=D+32768+w,d=d+1|0;while((d|0)!=(t|0))}break}case 4:{if((e[t+24>>2]|0)==1&&(w=(l|0)<(c|0)?l:c,(w|0)>0)){t=c<<1,h=c*3|0,d=0;do D=M[r+(d+c<<1)>>1]|0,N=M[r+(d+t<<1)>>1]|0,k=(M[r+(d<<1)>>1]|0)-((N+D|0)>>>2)+16384|0,R=I[r+(d+h<<1)>>1]|0,_=v0(k&65535|0,0,16)|0,D=D+32768+k|ye,R=v0(R&65535|0,0,48)|0,R=_|N+32768+k&65535|R,D=D&65535|ye,k=o+(d<<3)|0,N=k,I[N>>1]=R,I[N+2>>1]=R>>>16,k=k+4|0,I[k>>1]=D,I[k+2>>1]=D>>>16,d=d+1|0;while((d|0)!=(w|0))}break}default:}while(!1);if(t=e[C>>2]|0,!!(S[t+32>>0]|0)&&(d=e[t+16>>2]|0,!((l|0)<=0)))for(t=o,h=0;_=t+4|0,R=I[t>>1]|0,I[t>>1]=I[_>>1]|0,I[_>>1]=R,h=h+1|0,(h|0)!=(l|0);)t=t+(d<<1)|0}function Al(t){t=t|0;var r=0,o=0,l=0;e[t>>2]=36412,r=e[t+20>>2]|0,r&&(o=t+24|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),l=e[t+8>>2]|0,l&&(r=t+12|0,o=e[r>>2]|0,(o|0)!=(l|0)&&(e[r>>2]=o+(~((o+-2-l|0)>>>1)<<1)),he(l))}function vl(t){t=t|0;var r=0,o=0,l=0;if(e[t>>2]=36412,r=e[t+20>>2]|0,r&&(o=t+24|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),l=e[t+8>>2]|0,!l){he(t);return}r=t+12|0,o=e[r>>2]|0,(o|0)!=(l|0)&&(e[r>>2]=o+(~((o+-2-l|0)>>>1)<<1)),he(l),he(t)}function xl(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0;if(c=t+36|0,!(e[c>>2]|0)){w=t+40|0,Xr(t,r,e[w>>2]|0,o,l),e[w>>2]=(e[w>>2]|0)+(e[(e[t+4>>2]|0)+12>>2]|0);return}C=t+4|0,h=o<<1,d=ee(h,e[(e[C>>2]|0)+16>>2]|0)|0,w=t+20|0,Xr(t,r,e[w>>2]|0,o,l),r=e[C>>2]|0,(e[r+28>>2]|0)==536870912&&ti(e[w>>2]|0,ee(h,e[r+16>>2]|0)|0),C=e[c>>2]|0,(Yt[e[(e[C>>2]|0)+48>>2]&63](C,e[w>>2]|0,d)|0)!=(d|0)&&(r=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,Q|0)|0,bt(8)),g=0,xe(7,r|0,3,35648),C=g,g=0,C&1?(C=j()|0,Tt(r|0),le(C|0)):Qt(r|0,824,96))}function wl(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0;if(c=e[t+36>>2]|0,c){yl(t,c,r,o,l);return}else{c=t+40|0,Gn(t,e[c>>2]|0,r,o,l),e[c>>2]=(e[c>>2]|0)+(e[(e[t+4>>2]|0)+12>>2]|0);return}}function Gn(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0;w=t+4|0,h=e[w>>2]|0;do if(!(S[h+32>>0]|0))C=r;else{if(t=t+8|0,o0(e[t>>2]|0,r|0,l*6|0)|0,h=e[w>>2]|0,d=e[h+16>>2]|0,(l|0)<=0){C=e[t>>2]|0;break}for(t=e[t>>2]|0,h=t,r=0;C=h+4|0,D=I[h>>1]|0,I[h>>1]=I[C>>1]|0,I[C>>1]=D,r=r+1|0,(r|0)!=(l|0);)h=h+(d<<1)|0;C=t,h=e[w>>2]|0}while(!1);switch(e[h+16>>2]|0){case 3:{if((e[h+24>>2]|0)==2){if((l|0)>0)h=0;else return;do d=M[C+(h*6|0)>>1]|0,c=I[C+(h*6|0)+2>>1]|0,w=c&65535,D=(M[C+(h*6|0)+4>>1]|0)+32768-((w+d|0)>>>1)&65535,I[o+(h*6|0)>>1]=d+32768-w,I[o+(h*6|0)+2>>1]=c,I[o+(h*6|0)+4>>1]=D,h=h+1|0;while((h|0)!=(l|0));return}if(h=(c|0)<(l|0)?c:l,(h|0)<=0)return;t=c<<1,r=0;do l=I[C+(r*6|0)+2>>1]|0,d=M[C+(r*6|0)>>1]|0,w=l&65535,D=(M[C+(r*6|0)+4>>1]|0)+32768-((w+d|0)>>>1)&65535,I[o+(r<<1)>>1]=d+32768-w,I[o+(r+c<<1)>>1]=l,I[o+(r+t<<1)>>1]=D,r=r+1|0;while((r|0)!=(h|0));return}case 4:{if((e[h+24>>2]|0)!=1||(h=(c|0)<(l|0)?c:l,(h|0)<=0))return;t=c<<1,r=c*3|0,d=0;do w=I[C+(d<<3)+2>>1]|0,D=I[C+(d<<3)+6>>1]|0,N=M[C+(d<<3)>>1]|0,k=w&65535,l=(M[C+(d<<3)+4>>1]|0)+32768-((k+N|0)>>>1)&65535,I[o+(d<<1)>>1]=N+32768-k,I[o+(d+c<<1)>>1]=w,I[o+(d+t<<1)>>1]=l,I[o+(d+r<<1)>>1]=D,d=d+1|0;while((d|0)!=(h|0));return}default:return}}function yl(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0;N=b,b=b+176|0,R=N+152|0,U=N+16|0,_=N,C=t+4|0,h=e[C>>2]|0,k=l<<1,d=ee(k,e[h+16>>2]|0)|0;do if(d){for(w=t+20|0;h=Yt[e[(e[r>>2]|0)+32>>2]&63](r,e[w>>2]|0,d)|0,!!h;)if((d|0)==(h|0)){D=26;break}else d=d-h|0;if((D|0)==26){h=e[C>>2]|0;break}D=U+56|0,C=U+4|0,e[U>>2]=36160,e[D>>2]=36180,g=0,Ae(62,U+56|0,C|0),N=g,g=0,N&1&&(U=j()|0,tt(D),le(U|0)),e[U+128>>2]=0,e[U+132>>2]=-1,e[U>>2]=36200,e[U+56>>2]=36220,g=0,ue(180,C|0),N=g,g=0;do if(N&1)h=j()|0;else{if(e[C>>2]=36236,r=U+36|0,e[r>>2]=0,e[r+4>>2]=0,e[r+8>>2]=0,e[r+12>>2]=0,e[U+52>>2]=16,e[R>>2]=0,e[R+4>>2]=0,e[R+8>>2]=0,g=0,Ae(63,C|0,R|0),N=g,g=0,N&1){h=j()|0,de(R),de(r),wt(C);break}de(R),g=0,h=Ve(28,U|0,49029,57)|0,R=g,g=0,!(R&1)&&(g=0,be(36,h|0,0)|0,R=g,g=0,!(R&1))&&(w=Ct(16)|0,g=0,Ae(64,_|0,C|0),R=g,g=0,R&1?h=j()|0:(!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,Q|0)|0,bt(8)),g=0,$e(36,w|0,3,35648,_|0),R=g,g=0,R&1?d=1:(g=0,xe(6,w|0,824,96),g=0,d=0),h=j()|0,de(_),d||(_=h,e[U>>2]=36200,e[D>>2]=36220,e[C>>2]=36236,de(r),wt(C),tt(D),le(_|0))),Tt(w|0),_=h,e[U>>2]=36200,e[D>>2]=36220,e[C>>2]=36236,de(r),wt(C),tt(D),le(_|0)),_=j()|0,e[U>>2]=36200,e[D>>2]=36220,e[C>>2]=36236,de(r),wt(C),tt(D),le(_|0)}while(!1);U=h,tt(D),le(U|0)}while(!1);if(d=t+20|0,(e[h+28>>2]|0)!=536870912){U=e[d>>2]|0,Gn(t,U,o,l,c),b=N;return}ti(e[d>>2]|0,ee(k,e[h+16>>2]|0)|0),U=e[d>>2]|0,Gn(t,U,o,l,c),b=N}function Xr(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0;C=t+4|0,t=e[C>>2]|0;e:do switch(e[t+16>>2]|0){case 3:{if((e[t+24>>2]|0)==2){if((l|0)>0)t=0;else break e;for(;;)if(w=I[r+(t*6|0)+2>>1]|0,c=w&65535,d=(M[r+(t*6|0)>>1]|0)+32768+c|0,c=(M[r+(t*6|0)+4>>1]|0)+32768+(((d&65535)+c|0)>>>1)&65535,I[o+(t*6|0)>>1]=d,I[o+(t*6|0)+2>>1]=w,I[o+(t*6|0)+4>>1]=c,t=t+1|0,(t|0)==(l|0))break e}if(t=(l|0)<(c|0)?l:c,(t|0)>0){h=c<<1,d=0;do D=I[r+(d+c<<1)>>1]|0,w=D&65535,k=(M[r+(d<<1)>>1]|0)+32768+w|0,w=(M[r+(d+h<<1)>>1]|0)+32768+(((k&65535)+w|0)>>>1)&65535,I[o+(d*6|0)>>1]=k,I[o+(d*6|0)+2>>1]=D,I[o+(d*6|0)+4>>1]=w,d=d+1|0;while((d|0)!=(t|0))}break}case 4:{if((e[t+24>>2]|0)==1&&(w=(l|0)<(c|0)?l:c,(w|0)>0)){t=c<<1,h=c*3|0,d=0;do k=I[r+(d+c<<1)>>1]|0,D=k&65535,N=(M[r+(d<<1)>>1]|0)+32768+D&65535,D=(M[r+(d+t<<1)>>1]|0)+32768+((N+D|0)>>>1)|0,R=I[r+(d+h<<1)>>1]|0,k=v0(k&65535|0,0,16)|0,D=ye|D,R=v0(R&65535|0,0,48)|0,R=N|k|R,D=D&65535|ye,k=o+(d<<3)|0,N=k,I[N>>1]=R,I[N+2>>1]=R>>>16,k=k+4|0,I[k>>1]=D,I[k+2>>1]=D>>>16,d=d+1|0;while((d|0)!=(w|0))}break}default:}while(!1);if(t=e[C>>2]|0,!!(S[t+32>>0]|0)&&(d=e[t+16>>2]|0,!((l|0)<=0)))for(t=o,h=0;R=t+4|0,N=I[t>>1]|0,I[t>>1]=I[R>>1]|0,I[R>>1]=N,h=h+1|0,(h|0)!=(l|0);)t=t+(d<<1)|0}function Cl(t){t=t|0;var r=0,o=0,l=0;e[t>>2]=36436,r=e[t+20>>2]|0,r&&(o=t+24|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),l=e[t+8>>2]|0,l&&(r=t+12|0,o=e[r>>2]|0,(o|0)!=(l|0)&&(e[r>>2]=o+(~((o+-2-l|0)>>>1)<<1)),he(l))}function Tl(t){t=t|0;var r=0,o=0,l=0;if(e[t>>2]=36436,r=e[t+20>>2]|0,r&&(o=t+24|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),l=e[t+8>>2]|0,!l){he(t);return}r=t+12|0,o=e[r>>2]|0,(o|0)!=(l|0)&&(e[r>>2]=o+(~((o+-2-l|0)>>>1)<<1)),he(l),he(t)}function Il(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0;if(c=t+36|0,!(e[c>>2]|0)){w=t+40|0,Zr(t,r,e[w>>2]|0,o,l),e[w>>2]=(e[w>>2]|0)+(e[(e[t+4>>2]|0)+12>>2]|0);return}C=t+4|0,h=o<<1,d=ee(h,e[(e[C>>2]|0)+16>>2]|0)|0,w=t+20|0,Zr(t,r,e[w>>2]|0,o,l),r=e[C>>2]|0,(e[r+28>>2]|0)==536870912&&ti(e[w>>2]|0,ee(h,e[r+16>>2]|0)|0),C=e[c>>2]|0,(Yt[e[(e[C>>2]|0)+48>>2]&63](C,e[w>>2]|0,d)|0)!=(d|0)&&(r=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,Q|0)|0,bt(8)),g=0,xe(7,r|0,3,35648),C=g,g=0,C&1?(C=j()|0,Tt(r|0),le(C|0)):Qt(r|0,824,96))}function El(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0;if(c=e[t+36>>2]|0,c){kl(t,c,r,o,l);return}else{c=t+40|0,qn(t,e[c>>2]|0,r,o,l),e[c>>2]=(e[c>>2]|0)+(e[(e[t+4>>2]|0)+12>>2]|0);return}}function qn(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0;w=t+4|0,h=e[w>>2]|0;do if(!(S[h+32>>0]|0))C=r;else{if(t=t+8|0,o0(e[t>>2]|0,r|0,l*6|0)|0,h=e[w>>2]|0,d=e[h+16>>2]|0,(l|0)<=0){C=e[t>>2]|0;break}for(t=e[t>>2]|0,h=t,r=0;C=h+4|0,D=I[h>>1]|0,I[h>>1]=I[C>>1]|0,I[C>>1]=D,r=r+1|0,(r|0)!=(l|0);)h=h+(d<<1)|0;C=t,h=e[w>>2]|0}while(!1);switch(e[h+16>>2]|0){case 3:{if((e[h+24>>2]|0)==2){if((l|0)>0)h=0;else return;do c=I[C+(h*6|0)+2>>1]|0,w=c&65535,D=32768-w+(M[C+(h*6|0)+4>>1]|0)&65535,I[o+(h*6|0)>>1]=(M[C+(h*6|0)>>1]|0)+32768-w,I[o+(h*6|0)+2>>1]=c,I[o+(h*6|0)+4>>1]=D,h=h+1|0;while((h|0)!=(l|0));return}if(h=(c|0)<(l|0)?c:l,(h|0)<=0)return;t=c<<1,r=0;do l=I[C+(r*6|0)+2>>1]|0,w=l&65535,D=32768-w+(M[C+(r*6|0)+4>>1]|0)&65535,I[o+(r<<1)>>1]=(M[C+(r*6|0)>>1]|0)+32768-w,I[o+(r+c<<1)>>1]=l,I[o+(r+t<<1)>>1]=D,r=r+1|0;while((r|0)!=(h|0));return}case 4:{if((e[h+24>>2]|0)!=1||(h=(c|0)<(l|0)?c:l,(h|0)<=0))return;t=c<<1,r=c*3|0,d=0;do w=I[C+(d<<3)+2>>1]|0,D=I[C+(d<<3)+6>>1]|0,k=w&65535,l=32768-k+(M[C+(d<<3)+4>>1]|0)&65535,I[o+(d<<1)>>1]=(M[C+(d<<3)>>1]|0)+32768-k,I[o+(d+c<<1)>>1]=w,I[o+(d+t<<1)>>1]=l,I[o+(d+r<<1)>>1]=D,d=d+1|0;while((d|0)!=(h|0));return}default:return}}function kl(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0;N=b,b=b+176|0,R=N+152|0,U=N+16|0,_=N,C=t+4|0,h=e[C>>2]|0,k=l<<1,d=ee(k,e[h+16>>2]|0)|0;do if(d){for(w=t+20|0;h=Yt[e[(e[r>>2]|0)+32>>2]&63](r,e[w>>2]|0,d)|0,!!h;)if((d|0)==(h|0)){D=26;break}else d=d-h|0;if((D|0)==26){h=e[C>>2]|0;break}D=U+56|0,C=U+4|0,e[U>>2]=36160,e[D>>2]=36180,g=0,Ae(62,U+56|0,C|0),N=g,g=0,N&1&&(U=j()|0,tt(D),le(U|0)),e[U+128>>2]=0,e[U+132>>2]=-1,e[U>>2]=36200,e[U+56>>2]=36220,g=0,ue(180,C|0),N=g,g=0;do if(N&1)h=j()|0;else{if(e[C>>2]=36236,r=U+36|0,e[r>>2]=0,e[r+4>>2]=0,e[r+8>>2]=0,e[r+12>>2]=0,e[U+52>>2]=16,e[R>>2]=0,e[R+4>>2]=0,e[R+8>>2]=0,g=0,Ae(63,C|0,R|0),N=g,g=0,N&1){h=j()|0,de(R),de(r),wt(C);break}de(R),g=0,h=Ve(28,U|0,49029,57)|0,R=g,g=0,!(R&1)&&(g=0,be(36,h|0,0)|0,R=g,g=0,!(R&1))&&(w=Ct(16)|0,g=0,Ae(64,_|0,C|0),R=g,g=0,R&1?h=j()|0:(!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,Q|0)|0,bt(8)),g=0,$e(36,w|0,3,35648,_|0),R=g,g=0,R&1?d=1:(g=0,xe(6,w|0,824,96),g=0,d=0),h=j()|0,de(_),d||(_=h,e[U>>2]=36200,e[D>>2]=36220,e[C>>2]=36236,de(r),wt(C),tt(D),le(_|0))),Tt(w|0),_=h,e[U>>2]=36200,e[D>>2]=36220,e[C>>2]=36236,de(r),wt(C),tt(D),le(_|0)),_=j()|0,e[U>>2]=36200,e[D>>2]=36220,e[C>>2]=36236,de(r),wt(C),tt(D),le(_|0)}while(!1);U=h,tt(D),le(U|0)}while(!1);if(d=t+20|0,(e[h+28>>2]|0)!=536870912){U=e[d>>2]|0,qn(t,U,o,l,c),b=N;return}ti(e[d>>2]|0,ee(k,e[h+16>>2]|0)|0),U=e[d>>2]|0,qn(t,U,o,l,c),b=N}function Zr(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0;C=t+4|0,t=e[C>>2]|0;e:do switch(e[t+16>>2]|0){case 3:{if((e[t+24>>2]|0)==2){if((l|0)>0)t=0;else break e;for(;;)if(w=I[r+(t*6|0)+2>>1]|0,d=w&65535,c=d+32768+(M[r+(t*6|0)+4>>1]|0)&65535,I[o+(t*6|0)>>1]=(M[r+(t*6|0)>>1]|0)+32768+d,I[o+(t*6|0)+2>>1]=w,I[o+(t*6|0)+4>>1]=c,t=t+1|0,(t|0)==(l|0))break e}if(t=(l|0)<(c|0)?l:c,(t|0)>0){h=c<<1,d=0;do D=I[r+(d+c<<1)>>1]|0,k=D&65535,w=k+32768+(M[r+(d+h<<1)>>1]|0)&65535,I[o+(d*6|0)>>1]=(M[r+(d<<1)>>1]|0)+32768+k,I[o+(d*6|0)+2>>1]=D,I[o+(d*6|0)+4>>1]=w,d=d+1|0;while((d|0)!=(t|0))}break}case 4:{if((e[t+24>>2]|0)==1&&(w=(l|0)<(c|0)?l:c,(w|0)>0)){t=c<<1,h=c*3|0,d=0;do k=I[r+(d+c<<1)>>1]|0,D=k&65535,N=(M[r+(d<<1)>>1]|0)+32768+D|0,D=D+32768+(M[r+(d+t<<1)>>1]|0)|0,R=I[r+(d+h<<1)>>1]|0,k=v0(k&65535|0,0,16)|0,D=ye|D,R=v0(R&65535|0,0,48)|0,R=N&65535|k|R,D=D&65535|ye,k=o+(d<<3)|0,N=k,I[N>>1]=R,I[N+2>>1]=R>>>16,k=k+4|0,I[k>>1]=D,I[k+2>>1]=D>>>16,d=d+1|0;while((d|0)!=(w|0))}break}default:}while(!1);if(t=e[C>>2]|0,!!(S[t+32>>0]|0)&&(d=e[t+16>>2]|0,!((l|0)<=0)))for(t=o,h=0;R=t+4|0,N=I[t>>1]|0,I[t>>1]=I[R>>1]|0,I[R>>1]=N,h=h+1|0,(h|0)!=(l|0);)t=t+(d<<1)|0}function Dl(t){t=t|0;var r=0,o=0,l=0;e[t>>2]=36460,r=e[t+20>>2]|0,r&&(o=t+24|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),l=e[t+8>>2]|0,l&&(r=t+12|0,o=e[r>>2]|0,(o|0)!=(l|0)&&(e[r>>2]=o+(~((o+-2-l|0)>>>1)<<1)),he(l))}function bl(t){t=t|0;var r=0,o=0,l=0;if(e[t>>2]=36460,r=e[t+20>>2]|0,r&&(o=t+24|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),l=e[t+8>>2]|0,!l){he(t);return}r=t+12|0,o=e[r>>2]|0,(o|0)!=(l|0)&&(e[r>>2]=o+(~((o+-2-l|0)>>>1)<<1)),he(l),he(t)}function Nl(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0;if(c=t+36|0,!(e[c>>2]|0)){w=t+40|0,Jr(t,r,e[w>>2]|0,o,l),e[w>>2]=(e[w>>2]|0)+(e[(e[t+4>>2]|0)+12>>2]|0);return}C=t+4|0,h=o<<1,d=ee(h,e[(e[C>>2]|0)+16>>2]|0)|0,w=t+20|0,Jr(t,r,e[w>>2]|0,o,l),r=e[C>>2]|0,(e[r+28>>2]|0)==536870912&&ti(e[w>>2]|0,ee(h,e[r+16>>2]|0)|0),C=e[c>>2]|0,(Yt[e[(e[C>>2]|0)+48>>2]&63](C,e[w>>2]|0,d)|0)!=(d|0)&&(r=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,Q|0)|0,bt(8)),g=0,xe(7,r|0,3,35648),C=g,g=0,C&1?(C=j()|0,Tt(r|0),le(C|0)):Qt(r|0,824,96))}function Fl(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0;if(c=e[t+36>>2]|0,c){Rl(t,c,r,o,l);return}else{c=t+40|0,Wn(t,e[c>>2]|0,r,o,l),e[c>>2]=(e[c>>2]|0)+(e[(e[t+4>>2]|0)+12>>2]|0);return}}function Wn(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0;w=t+4|0,h=e[w>>2]|0;do if(!(S[h+32>>0]|0))C=r;else{if(t=t+8|0,o0(e[t>>2]|0,r|0,l*6|0)|0,h=e[w>>2]|0,d=e[h+16>>2]|0,(l|0)<=0){C=e[t>>2]|0;break}for(t=e[t>>2]|0,h=t,r=0;C=h+4|0,D=I[h>>1]|0,I[h>>1]=I[C>>1]|0,I[C>>1]=D,r=r+1|0,(r|0)!=(l|0);)h=h+(d<<1)|0;C=t,h=e[w>>2]|0}while(!1);switch(e[h+16>>2]|0){case 3:{if((e[h+24>>2]|0)==2){if((l|0)>0)h=0;else return;do c=I[C+(h*6|0)+2>>1]|0,D=I[C+(h*6|0)+4>>1]|0,I[o+(h*6|0)>>1]=I[C+(h*6|0)>>1]|0,I[o+(h*6|0)+2>>1]=c,I[o+(h*6|0)+4>>1]=D,h=h+1|0;while((h|0)!=(l|0));return}if(h=(c|0)<(l|0)?c:l,(h|0)<=0)return;t=c<<1,r=0;do l=I[C+(r*6|0)+2>>1]|0,D=I[C+(r*6|0)+4>>1]|0,I[o+(r<<1)>>1]=I[C+(r*6|0)>>1]|0,I[o+(r+c<<1)>>1]=l,I[o+(r+t<<1)>>1]=D,r=r+1|0;while((r|0)!=(h|0));return}case 4:{if((e[h+24>>2]|0)!=1||(h=(c|0)<(l|0)?c:l,(h|0)<=0))return;t=c<<1,r=c*3|0,d=0;do w=I[C+(d<<3)+2>>1]|0,l=I[C+(d<<3)+4>>1]|0,D=I[C+(d<<3)+6>>1]|0,I[o+(d<<1)>>1]=I[C+(d<<3)>>1]|0,I[o+(d+c<<1)>>1]=w,I[o+(d+t<<1)>>1]=l,I[o+(d+r<<1)>>1]=D,d=d+1|0;while((d|0)!=(h|0));return}default:return}}function Rl(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0;N=b,b=b+176|0,R=N+152|0,U=N+16|0,_=N,C=t+4|0,h=e[C>>2]|0,k=l<<1,d=ee(k,e[h+16>>2]|0)|0;do if(d){for(w=t+20|0;h=Yt[e[(e[r>>2]|0)+32>>2]&63](r,e[w>>2]|0,d)|0,!!h;)if((d|0)==(h|0)){D=26;break}else d=d-h|0;if((D|0)==26){h=e[C>>2]|0;break}D=U+56|0,C=U+4|0,e[U>>2]=36160,e[D>>2]=36180,g=0,Ae(62,U+56|0,C|0),N=g,g=0,N&1&&(U=j()|0,tt(D),le(U|0)),e[U+128>>2]=0,e[U+132>>2]=-1,e[U>>2]=36200,e[U+56>>2]=36220,g=0,ue(180,C|0),N=g,g=0;do if(N&1)h=j()|0;else{if(e[C>>2]=36236,r=U+36|0,e[r>>2]=0,e[r+4>>2]=0,e[r+8>>2]=0,e[r+12>>2]=0,e[U+52>>2]=16,e[R>>2]=0,e[R+4>>2]=0,e[R+8>>2]=0,g=0,Ae(63,C|0,R|0),N=g,g=0,N&1){h=j()|0,de(R),de(r),wt(C);break}de(R),g=0,h=Ve(28,U|0,49029,57)|0,R=g,g=0,!(R&1)&&(g=0,be(36,h|0,0)|0,R=g,g=0,!(R&1))&&(w=Ct(16)|0,g=0,Ae(64,_|0,C|0),R=g,g=0,R&1?h=j()|0:(!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,Q|0)|0,bt(8)),g=0,$e(36,w|0,3,35648,_|0),R=g,g=0,R&1?d=1:(g=0,xe(6,w|0,824,96),g=0,d=0),h=j()|0,de(_),d||(_=h,e[U>>2]=36200,e[D>>2]=36220,e[C>>2]=36236,de(r),wt(C),tt(D),le(_|0))),Tt(w|0),_=h,e[U>>2]=36200,e[D>>2]=36220,e[C>>2]=36236,de(r),wt(C),tt(D),le(_|0)),_=j()|0,e[U>>2]=36200,e[D>>2]=36220,e[C>>2]=36236,de(r),wt(C),tt(D),le(_|0)}while(!1);U=h,tt(D),le(U|0)}while(!1);if(d=t+20|0,(e[h+28>>2]|0)!=536870912){U=e[d>>2]|0,Wn(t,U,o,l,c),b=N;return}ti(e[d>>2]|0,ee(k,e[h+16>>2]|0)|0),U=e[d>>2]|0,Wn(t,U,o,l,c),b=N}function Jr(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0;C=t+4|0,t=e[C>>2]|0;e:do switch(e[t+16>>2]|0){case 3:{if((e[t+24>>2]|0)==2){if((l|0)>0)t=0;else break e;for(;;)if(w=I[r+(t*6|0)+2>>1]|0,c=I[r+(t*6|0)+4>>1]|0,I[o+(t*6|0)>>1]=I[r+(t*6|0)>>1]|0,I[o+(t*6|0)+2>>1]=w,I[o+(t*6|0)+4>>1]=c,t=t+1|0,(t|0)==(l|0))break e}if(t=(l|0)<(c|0)?l:c,(t|0)>0){h=c<<1,d=0;do D=I[r+(d+c<<1)>>1]|0,w=I[r+(d+h<<1)>>1]|0,I[o+(d*6|0)>>1]=I[r+(d<<1)>>1]|0,I[o+(d*6|0)+2>>1]=D,I[o+(d*6|0)+4>>1]=w,d=d+1|0;while((d|0)!=(t|0))}break}case 4:{if((e[t+24>>2]|0)==1&&(w=(l|0)<(c|0)?l:c,(w|0)>0)){t=c<<1,h=c*3|0,d=0;do D=I[r+(d<<1)>>1]|0,R=I[r+(d+h<<1)>>1]|0,k=M[r+(d+t<<1)>>1]|0,N=v0(M[r+(d+c<<1)>>1]|0,0,16)|0,k=ye|k,R=v0(R&65535|0,0,48)|0,R=N|D&65535|R,k=k&65535|ye,D=o+(d<<3)|0,N=D,I[N>>1]=R,I[N+2>>1]=R>>>16,D=D+4|0,I[D>>1]=k,I[D+2>>1]=k>>>16,d=d+1|0;while((d|0)!=(w|0))}break}default:}while(!1);if(t=e[C>>2]|0,!!(S[t+32>>0]|0)&&(d=e[t+16>>2]|0,!((l|0)<=0)))for(t=o,h=0;R=t+4|0,N=I[t>>1]|0,I[t>>1]=I[R>>1]|0,I[R>>1]=N,h=h+1|0,(h|0)!=(l|0);)t=t+(d<<1)|0}function Ml(t){t=t|0}function _l(t){t=t|0,he(t)}function Pl(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0,o=ee(e[t+8>>2]|0,o)|0,t=e[t+4>>2]|0,(Yt[e[(e[t>>2]|0)+48>>2]&63](t,r,o)|0)!=(o|0)&&(l=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,Q|0)|0,bt(8)),g=0,xe(7,l|0,3,35648),t=g,g=0,t&1?(t=j()|0,Tt(l|0),le(t|0)):Qt(l|0,824,96))}function Ll(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0,D=0,k=0;k=b,b=b+16|0,D=k,C=t+8|0,c=e[C>>2]|0,l=ee(c,o)|0;do if(l){for(d=t+4|0,h=l;c=e[d>>2]|0,c=Yt[e[(e[c>>2]|0)+32>>2]&63](c,r,h)|0,!!c;)if(l=h-c|0,(h|0)==(c|0)){w=11;break}else h=l;if((w|0)==11){c=e[C>>2]|0,h=l;break}l=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,Q|0)|0,bt(8)),g=0,xe(7,l|0,3,35648),t=g,g=0,t&1?(t=j()|0,Tt(l|0),le(t|0)):Qt(l|0,824,96)}else h=0;while(!1);if((c|0)==2&&(ti(r,o<<1),c=e[C>>2]|0),l=e[t+12>>2]|0,(l|0)<=(ee(c,o)|0)){b=k;return}t=e[t+4>>2]|0,Vi[e[(e[t>>2]|0)+16>>2]&15](D,t,l-h|0,0,1,24),b=k}function Ol(t){t=t|0,he(t)}function $l(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0,l=t+4|0,o0(e[l>>2]|0,r|0,ee(e[t+8>>2]|0,o)|0)|0,e[l>>2]=(e[l>>2]|0)+(e[t+12>>2]|0)}function Bl(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0,l=t+4|0,o0(r|0,e[l>>2]|0,ee(e[t+8>>2]|0,o)|0)|0,e[l>>2]=(e[l>>2]|0)+(e[t+12>>2]|0)}function Y0(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0;e[t+112>>2]=0,e[t+108>>2]=0,D=e[r>>2]|0,c=D;do if(D)if(d=t+92|0,D=t+96|0,w=e[D>>2]|0,C=e[d>>2]|0,o=C,l=w-o|0,l>>>0>=4e4?(l>>>0>4e4&&(h=C+4e4|0,(w|0)!=(h|0))&&(e[D>>2]=h),h=o):(vi(d,4e4-l|0),h=e[d>>2]|0,c=e[r>>2]|0),o=t+116|0,e[o>>2]=h,w=t+124|0,e[w>>2]=h,C=t+104|0,e[C>>2]=c,l=c,c){if((e[l+12>>2]|0)==(e[l+16>>2]|0)){if(r=(Dt[e[(e[c>>2]|0)+36>>2]&127](l)|0)==-1,l=e[w>>2]|0,r)break;c=e[o>>2]|0}else l=h,c=h;if(d=l-c|0,d>>>0<=64){if(h=t+92|0,(l|0)==(c|0))l=c;else{l=c,c=0;do S[(e[h>>2]|0)+c>>0]=S[l+c>>0]|0,c=c+1|0,l=e[o>>2]|0;while(c>>>0>>0);c=e[w>>2]|0}h=e[h>>2]|0,r=h,k=r-l|0,e[o>>2]=h,l=c+k|0,e[w>>2]=l,h=t+120|0,e[h>>2]=(e[h>>2]|0)+k,C=e[C>>2]|0,l=Yt[e[(e[C>>2]|0)+32>>2]&63](C,l,(e[D>>2]|0)-(r+d)|0)|0,l=(e[w>>2]|0)+l|0,e[w>>2]=l}}else l=h;else e[t+104>>2]=0,l=e[r+4>>2]|0,o=t+116|0,e[o>>2]=l,l=l+(e[r+8>>2]|0)|0,e[t+124>>2]=l;while(!1);if(o=e[o>>2]|0,o>>>0>=l>>>0){D=o,k=t+120|0,e[k>>2]=D,P0(t);return}for(;;){if((S[o>>0]|0)==-1){l=20;break}if(o=o+1|0,o>>>0>=l>>>0){l=20;break}}if((l|0)==20){k=t+120|0,e[k>>2]=o,P0(t);return}}function vi(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0;if(C=t+8|0,c=e[C>>2]|0,D=t+4|0,o=e[D>>2]|0,l=o,(c-l|0)>>>0>=r>>>0){do S[o>>0]=0,o=(e[D>>2]|0)+1|0,e[D>>2]=o,r=r+-1|0;while(r|0);return}o=e[t>>2]|0,h=l-o+r|0,(h|0)<0&&(pi(t),c=e[C>>2]|0,o=e[t>>2]|0),l=c-o|0,l>>>0<1073741823?(l=l<<1,l=l>>>0>>0?h:l,o=(e[D>>2]|0)-o|0,l?w=8:(c=0,d=0,h=o)):(l=2147483647,o=(e[D>>2]|0)-o|0,w=8),(w|0)==8&&(c=l,d=Xe(l)|0,h=o),o=d+h|0,c=d+c|0,l=o;do S[l>>0]=0,l=o+1|0,o=l,r=r+-1|0;while(r|0);r=e[t>>2]|0,l=(e[D>>2]|0)-r|0,w=d+(h-l)|0,o0(w|0,r|0,l|0)|0,e[t>>2]=w,e[D>>2]=o,e[C>>2]=c,r&&he(r)}function es(t){t=t|0;var r=0,o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0,G=0,$=0,P=0,O=0;G=b,b=b+32|0,P=G+12|0,K=G,_=t+180|0,U=(e[_>>2]|0)+4|0,(e[t+32>>2]|0)==1?H=e[t+24>>2]|0:H=1,r=ee(H<<1,U)|0,e[P>>2]=0,O=P+4|0,e[O>>2]=0,e[P+8>>2]=0;do if(r){if((r|0)<0&&(g=0,ue(178,P|0),$=g,g=0,$&1)||(d=6),(d|0)==6&&(o=r<<1,g=0,l=ge(67,o|0)|0,$=g,g=0,!($&1))){e[P>>2]=l,$=l+(r<<1)|0,e[P+8>>2]=$,Jt(l|0,0,o|0)|0,e[O>>2]=$;break}l=j()|0,r=e[P>>2]|0,r||le(l|0),o=e[O>>2]|0,(o|0)!=(r|0)&&(e[O>>2]=o+(~((o+-2-r|0)>>>1)<<1)),he(r),le(l|0)}while(!1);e[K>>2]=0,$=K+4|0,e[$>>2]=0,e[K+8>>2]=0;do if(!H)d=18;else{if(H>>>0>1073741823&&(g=0,ue(178,K|0),R=g,g=0,R&1)||(d=16),(d|0)==16&&(c=H<<2,g=0,h=ge(67,c|0)|0,R=g,g=0,!(R&1))){e[K>>2]=h,d=h+(H<<2)|0,e[K+8>>2]=d,Jt(h|0,0,c|0)|0,e[$>>2]=d,d=18;break}l=j()|0,r=e[K>>2]|0,o=r,r&&(c=e[$>>2]|0,(c|0)!=(r|0)&&(e[$>>2]=c+(~((c+-4-o|0)>>>2)<<2)),he(r))}while(!1);if((d|0)==18){h=t+12|0;e:do if((e[h>>2]|0)>0){d=t+4604|0,w=(ee(H,U)|0)+1|0,C=t+4608|0,D=t+92|0,k=(H|0)>0,N=t+4600|0,R=0;t:for(;;){if(o=e[P>>2]|0,r=o+2|0,e[d>>2]=r,o=o+(w<<1)|0,e[C>>2]=o,R&1?(e[d>>2]=o,e[C>>2]=r):r=o,c=e[D>>2]|0,g=0,$e(e[(e[c>>2]|0)+12>>2]|0,c|0,r|0,e[_>>2]|0,U|0),c=g,g=0,c&1){d=28;break}if(k){r=e[d>>2]|0,o=e[C>>2]|0,l=e[K>>2]|0,c=0;do{if(e[N>>2]=e[l+(c<<2)>>2],l=e[_>>2]|0,I[r+(l<<1)>>1]=I[r+(l+-1<<1)>>1]|0,I[o+-2>>1]=I[r>>1]|0,g=0,Ae(68,t|0,0),l=g,g=0,l&1){d=27;break t}l=e[K>>2]|0,e[l+(c<<2)>>2]=e[N>>2],r=(e[d>>2]|0)+(U<<1)|0,e[d>>2]=r,o=(e[C>>2]|0)+(U<<1)|0,e[C>>2]=o,c=c+1|0}while((c|0)<(H|0))}if(R=R+1|0,(R|0)>=(e[h>>2]|0)){d=40;break e}}if((d|0)==27){l=j()|0;break}else if((d|0)==28){l=j()|0;break}}else d=40;while(!1);do if((d|0)==40){if(g=0,ue(182,t|0),t=g,g=0,t&1){l=j()|0;break}if(r=e[K>>2]|0,o=r,r&&(l=e[$>>2]|0,(l|0)!=(r|0)&&(e[$>>2]=l+(~((l+-4-o|0)>>>2)<<2)),he(r)),r=e[P>>2]|0,!r){b=G;return}o=e[O>>2]|0,(o|0)!=(r|0)&&(e[O>>2]=o+(~((o+-2-r|0)>>>1)<<1)),he(r),b=G;return}while(!1);r=e[K>>2]|0,o=r,r&&(c=e[$>>2]|0,(c|0)!=(r|0)&&(e[$>>2]=c+(~((c+-4-o|0)>>>2)<<2)),he(r))}r=e[P>>2]|0,r||le(l|0),o=e[O>>2]|0,(o|0)!=(r|0)&&(e[O>>2]=o+(~((o+-2-r|0)>>>1)<<1)),he(r),le(l|0)}function Vl(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0;if(N=t+4604|0,r=e[N>>2]|0,U=t+180|0,!((e[U>>2]|0)<=0))for(R=t+4608|0,_=t+4612|0,c=r,h=M[r+-2>>1]|0,r=M[r>>1]|0,k=0;D=e[R>>2]|0,C=M[D+(k+-1<<1)>>1]|0,l=k+1|0,o=M[c+(l<<1)>>1]|0,w=e[_>>2]|0,d=r-h|0,c=h-C|0,w=((((S[w+(o-r)>>0]|0)*9|0)+(S[w+d>>0]|0)|0)*9|0)+(S[w+c>>0]|0)|0,w?(h=r-C>>31,(h^c|0)<0?c=r:c=C+((h^d|0)<0?0:d)|0,D=zl(t,w,M[D+(k<<1)>>1]|0,c,0)|0,I[(e[R>>2]|0)+(k<<1)>>1]=D):(l=(Gl(t,k,0)|0)+k|0,o=e[N>>2]|0,r=M[o+(l+-1<<1)>>1]|0,o=M[o+(l<<1)>>1]|0),!((l|0)>=(e[U>>2]|0));)c=e[N>>2]|0,h=r,r=o,k=l}function Ul(t){t=t|0;var r=0,o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0;c=t+104|0,(e[c>>2]|0)>>>0<4&&en(t),h=t+100|0,d=t+112|0,w=t+96|0,C=t+108|0,D=t+116|0,r=e[h>>2]|0,l=0;do{if(o=S[d>>0]|0,(r|0)>31)break;r=e[w>>2]|0,o<<24>>24?(S[e[C>>2]>>0]=r>>>25,e[w>>2]=e[w>>2]<<7,r=(e[h>>2]|0)+7|0):(S[e[C>>2]>>0]=r>>>24,e[w>>2]=e[w>>2]<<8,r=(e[h>>2]|0)+8|0),e[h>>2]=r,k=e[C>>2]|0,o=(S[k>>0]|0)==-1&1,S[d>>0]=o,e[C>>2]=k+1,e[c>>2]=(e[c>>2]|0)+-1,e[D>>2]=(e[D>>2]|0)+1,l=l+1|0}while((l|0)<4);o<<24>>24?_t(t,0,(r+-1|0)%8|0):_t(t,0,(r|0)%8|0),(e[c>>2]|0)>>>0<4&&en(t),r=e[h>>2]|0,o=0;do{if((r|0)>31)break;r=e[w>>2]|0,S[d>>0]|0?(S[e[C>>2]>>0]=r>>>25,e[w>>2]=e[w>>2]<<7,r=(e[h>>2]|0)+7|0):(S[e[C>>2]>>0]=r>>>24,e[w>>2]=e[w>>2]<<8,r=(e[h>>2]|0)+8|0),e[h>>2]=r,k=e[C>>2]|0,S[d>>0]=(S[k>>0]|0)==-1&1,e[C>>2]=k+1,e[c>>2]=(e[c>>2]|0)+-1,e[D>>2]=(e[D>>2]|0)+1,o=o+1|0}while((o|0)<4);e[t+132>>2]|0&&en(t)}function en(t){t=t|0;var r=0,o=0,l=0,c=0,h=0;if(r=e[t+132>>2]|0,r||(r=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,Q|0)|0,bt(8)),g=0,xe(7,r|0,4,35648),t=g,g=0,t&1||Qt(r|0,824,96),t=j()|0,Tt(r|0),le(t|0)),o=t+108|0,l=t+120|0,h=e[l>>2]|0,c=(e[o>>2]|0)-h|0,(Yt[e[(e[r>>2]|0)+48>>2]&63](r,h,c)|0)==(c|0)){h=e[l>>2]|0,e[o>>2]=h,e[t+104>>2]=(e[t+124>>2]|0)-h;return}r=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,Q|0)|0,bt(8)),g=0,xe(7,r|0,4,35648),h=g,g=0,h&1||Qt(r|0,824,96),h=j()|0,Tt(r|0),le(h|0)}function _t(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0;if(D=t+100|0,o=(e[D>>2]|0)-o|0,e[D>>2]=o,(o|0)>-1){k=t+96|0,e[k>>2]=e[k>>2]|r<>2]=e[k>>2]|r>>0-o,C=t+104|0,(e[C>>2]|0)>>>0<4&&(en(t),o=e[D>>2]|0),h=t+112|0,d=t+108|0,w=t+116|0,l=0;!((o|0)>31);)if(o=e[k>>2]|0,S[h>>0]|0?(S[e[d>>2]>>0]=o>>>25,e[k>>2]=e[k>>2]<<7,o=(e[D>>2]|0)+7|0):(S[e[d>>2]>>0]=o>>>24,e[k>>2]=e[k>>2]<<8,o=(e[D>>2]|0)+8|0),e[D>>2]=o,N=e[d>>2]|0,S[h>>0]=(S[N>>0]|0)==-1&1,e[d>>2]=N+1,e[C>>2]=(e[C>>2]|0)+-1,e[w>>2]=(e[w>>2]|0)+1,l=l+1|0,(l|0)>=4){c=11;break}e:do if((c|0)==11&&(o|0)<0){e[k>>2]=e[k>>2]|r>>0-o,(e[C>>2]|0)>>>0<4&&(en(t),o=e[D>>2]|0),l=0;do{if((o|0)>31)break e;o=e[k>>2]|0,S[h>>0]|0?(S[e[d>>2]>>0]=o>>>25,e[k>>2]=e[k>>2]<<7,o=(e[D>>2]|0)+7|0):(S[e[d>>2]>>0]=o>>>24,e[k>>2]=e[k>>2]<<8,o=(e[D>>2]|0)+8|0),e[D>>2]=o,N=e[d>>2]|0,S[h>>0]=(S[N>>0]|0)==-1&1,e[d>>2]=N+1,e[C>>2]=(e[C>>2]|0)+-1,e[w>>2]=(e[w>>2]|0)+1,l=l+1|0}while((l|0)<4)}while(!1);e[k>>2]=e[k>>2]|r<>31,h=(H^r)-H|0,_=t+196+(h*12|0)+10|0,d=I[_>>1]|0,R=t+196+(h*12|0)|0,c=e[R>>2]|0,(d|0)<(c|0))if((d<<1|0)<(c|0))if((d<<2|0)<(c|0))if((d<<3|0)<(c|0))if((d<<4|0)<(c|0))for(r=5;(d<>1]^H)-H+l|0,U=t+136|0,l=e[U>>2]|0,(c&l|0)==(c|0)?D=c:D=l&~(c>>31),c=(o-D^H)-H|0,C=t+144|0,l=e[C>>2]|0,(c|0)>0?c=(c+l|0)/(l<<1|1|0)|0:c=(c-l|0)/(l<<1|1|0)|0,N=t+140|0,w=e[N>>2]|0,o=((c|0)<0?w:0)+c|0,w=o-((o|0)<((w+1|0)/2|0|0)?0:w)|0,h=t+196+(h*12|0)+4|0,l|r?c=0:c=(e[h>>2]<<1)+-1+d>>31,l=c^w,is(t,r,l>>30^l<<1,e[t+156>>2]|0),l=e[t+160>>2]|0,r=(e[R>>2]|0)+((w|0)>-1?w:0-w|0)|0,c=(e[h>>2]|0)+(ee(e[C>>2]<<1|1,w)|0)|0,o=I[_>>1]|0,(o|0)==(l|0)&&(r=r>>1,c=c>>1,o=l>>1),e[R>>2]=r,l=o+1|0,I[_>>1]=l,r=l+c|0,(r|0)>=1?(c|0)>0&&(c=c-l|0,_=I[k>>1]|0,I[k>>1]=(_<<16>>16<127&1)+(_&65535),c=(c|0)>0?0:c):(c=I[k>>1]|0,I[k>>1]=(c&65535)-(c<<16>>16>-128&1),c=(r|0)>(~o|0)?r:0-o|0),e[h>>2]=c,l=e[C>>2]|0,o=l<<1|1,r=(ee(o,(w^H)-H|0)|0)+D|0,(r|0)>=(0-l|0)?(c=e[U>>2]|0,(c+l|0)<(r|0)&&(r=r-(ee(e[N>>2]|0,o)|0)|0)):(r=(ee(e[N>>2]|0,o)|0)+r|0,c=e[U>>2]|0),(r&c|0)==(r|0)?(H=r,H=H&65535,H|0):(H=c&~(r>>31),H=H&65535,H|0)}function Gl(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0;for(C=(e[t+180>>2]|0)-r|0,D=e[t+4608>>2]|0,k=e[t+4604>>2]|0,c=I[D+(r+-1<<1)>>1]|0,w=c&65535,o=e[t+144>>2]|0,h=0;l=D+(h+r<<1)|0,d=(M[l>>1]|0)-w|0,!((((d|0)>-1?d:0-d|0)|0)>(o|0));)if(I[l>>1]=c,h=h+1|0,(h|0)==(C|0)){h=C;break}if(c=(h|0)==(C|0),d=t+4600|0,l=e[36476+(e[d>>2]<<2)>>2]|0,(1<(h|0))o=h;else{o=h;do _t(t,1,1),l=e[d>>2]|0,o=o-(1<>2])|0,l=(l|0)>30?31:l+1|0,e[d>>2]=l,l=e[36476+(l<<2)>>2]|0;while((o|0)>=(1<>1]|0,w,M[k+(C<<1)>>1]|0)|0,I[r>>1]=t,t=e[d>>2]|0,e[d>>2]=(t|0)<1?0:t+-1|0,t=h+1|0,t|0)}function ql(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0;return w=o-l|0,C=t+136|0,d=t+144|0,c=e[d>>2]|0,(((w|0)>-1?w:0-w|0)|0)>(c|0)?(h=l-o>>31|1,r=ee(h,r-l|0)|0,(r|0)>0?r=(c+r|0)/(c<<1|1|0)|0:r=(r-c|0)/(c<<1|1|0)|0,w=t+140|0,c=e[w>>2]|0,o=((r|0)<0?c:0)+r|0,c=o-((o|0)<((c+1|0)/2|0|0)?0:c)|0,ts(t,t+4576|0,c),c=ee(c,h)|0,h=e[d>>2]|0,d=h<<1|1,c=(ee(c,d)|0)+l|0,(c|0)>=(0-h|0)?(r=e[C>>2]|0,(r+h|0)<(c|0)&&(c=c-(ee(e[w>>2]|0,d)|0)|0)):(c=(ee(e[w>>2]|0,d)|0)+c|0,r=e[C>>2]|0),(c&r|0)==(c|0)?(C=c,C=C&65535,C|0):(C=r&~(c>>31),C=C&65535,C|0)):(r=r-o|0,(r|0)>0?r=(c+r|0)/(c<<1|1|0)|0:r=(r-c|0)/(c<<1|1|0)|0,w=t+140|0,c=e[w>>2]|0,h=((r|0)<0?c:0)+r|0,c=h-((h|0)<((c+1|0)/2|0|0)?0:c)|0,ts(t,t+4588|0,c),h=e[d>>2]|0,d=h<<1|1,c=(ee(d,c)|0)+o|0,(c|0)>=(0-h|0)?(r=e[C>>2]|0,(r+h|0)<(c|0)&&(c=c-(ee(e[w>>2]|0,d)|0)|0)):(c=(ee(e[w>>2]|0,d)|0)+c|0,r=e[C>>2]|0),(c&r|0)==(c|0)?(C=c,C=C&65535,C|0):(C=r&~(c>>31),C=C&65535,C|0))}function ts(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0;if(k=r+9|0,d=F[k>>0]|0,D=r+4|0,C=e[D>>2]|0,c=(ee(d>>>1,C)|0)+(e[r>>2]|0)|0,(d|0)<(c|0)){h=d,l=0;do h=h<<1,l=l+1|0;while((h|0)<(c|0));c=l}else c=0;(o|0)>0&(c|0)==0&&F[r+10>>0]<<1>>>0>>0?l=1:w=5;do if((w|0)==5){if(l=(o|0)<0,l&&F[r+10>>0]<<1>>>0>=d>>>0){l=1;break}l=l&(c|0)!=0}while(!1);if(l=(((o|0)>-1?o:0-o|0)<<1)-C+(l<<31>>31)|0,is(t,c,l,(e[t+156>>2]|0)+-1-(e[36476+(e[t+4600>>2]<<2)>>2]|0)|0),(o|0)<0&&(t=r+10|0,S[t>>0]=(F[t>>0]|0)+1),l=(l+1-(e[D>>2]|0)>>1)+(e[r>>2]|0)|0,e[r>>2]=l,c=S[k>>0]|0,c<<24>>24!=(S[r+8>>0]|0)){r=c,r=r&255,r=r+1|0,r=r&255,S[k>>0]=r;return}e[r>>2]=l>>1,t=(c&255)>>>1,S[k>>0]=t,r=r+10|0,S[r>>0]=(F[r>>0]|0)>>>1,r=t,r=r&255,r=r+1|0,r=r&255,S[k>>0]=r}function is(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0;if(c=o>>r,h=t+148|0,d=l-(e[h>>2]|0)|0,(c|0)<(d+-1|0)){(c|0)>30&&(l=(c|0)/2|0,_t(t,0,l),c=c-l|0),_t(t,1,c+1|0),_t(t,(1<31?(_t(t,0,31),_t(t,1,l+-31-(e[h>>2]|0)|0)):_t(t,1,d),r=e[h>>2]|0,_t(t,(1<>2]|0,C=t+120|0,r>>>0<((e[C>>2]|0)+-3|0)>>>0){C=t+112|0,d=e[C>>2]|0,t=t+108|0,e[t>>2]=(F[r+1>>0]<<16|F[r>>0]<<24|F[r+2>>0]<<8|F[r+3>>0])>>>d|e[t>>2],t=32-d>>3,e[w>>2]=r+t,e[C>>2]=(t<<3)+d;return}d=t+104|0,o=e[d>>2]|0;do if(o){if((e[o+12>>2]|0)==(e[o+16>>2]|0)){if((Dt[e[(e[o>>2]|0)+36>>2]&127](o)|0)==-1)break;r=e[w>>2]|0}if(c=t+124|0,o=e[c>>2]|0,h=o-r|0,h>>>0<=64){if(l=t+92|0,(o|0)==(r|0))o=r;else{o=0;do S[(e[l>>2]|0)+o>>0]=S[r+o>>0]|0,o=o+1|0,r=e[w>>2]|0;while(o>>>0>>0);o=r,r=e[c>>2]|0}k=e[l>>2]|0,l=k,D=l-o|0,e[w>>2]=k,o=r+D|0,e[c>>2]=o,e[C>>2]=(e[C>>2]|0)+D,d=e[d>>2]|0,d=Yt[e[(e[d>>2]|0)+32>>2]&63](d,o,(e[t+96>>2]|0)-(l+h)|0)|0,e[c>>2]=(e[c>>2]|0)+d}}while(!1);for(d=t+112|0,h=t+108|0,t=e[t+124>>2]|0,c=t+-1|0,r=e[w>>2]|0;;){if(r>>>0>=t>>>0){o=14;break}if(l=S[r>>0]|0,o=l&255,l=l<<24>>24==-1,l){if((r|0)==(c|0)){o=25;break}if(r=r+1|0,(S[r>>0]|0)<0){o=25;break}}else r=r+1|0;if(k=e[d>>2]|0,e[h>>2]=o<<24-k|e[h>>2],e[w>>2]=r,k=k+(l?7:8)|0,e[d>>2]=k,(k|0)>=24){o=33;break}}if((o|0)==14){if((e[d>>2]|0)>=1)return;r=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,Q|0)|0,bt(8)),g=0,xe(7,r|0,5,35648),k=g,g=0,k&1||Qt(r|0,824,96),k=j()|0,Tt(r|0),le(k|0)}else if((o|0)==25){if((e[d>>2]|0)>=1)return;r=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,Q|0)|0,bt(8)),g=0,xe(7,r|0,5,35648),k=g,g=0,k&1||Qt(r|0,824,96),k=j()|0,Tt(r|0),le(k|0)}else if((o|0)==33){e:do if(r>>>0>>0)do{if((S[r>>0]|0)==-1)break e;r=r+1|0}while(r>>>0>>0);while(!1);e[C>>2]=r;return}}function Wl(t){t=t|0;var r=0,o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0;R=b,b=b+32|0,l=R,N=t+144|0;e:do if(e[N>>2]|0)r=t+152|0;else if(o=e[t+136>>2]|0,r=t+152|0,(o|0)==((1<>2])+-1|0)&&(m0(l,o,0),(e[l+4>>2]|0)==(e[t+184>>2]|0))&&(e[l+8>>2]|0)==(e[t+188>>2]|0)&&(e[l+12>>2]|0)==(e[t+192>>2]|0))switch(e[r>>2]|0){case 8:{N=e[8900]|0,e[t+4612>>2]=N+(((e[8901]|0)-N|0)>>>1),b=R;return}case 10:{N=e[8903]|0,e[t+4612>>2]=N+(((e[8904]|0)-N|0)>>>1),b=R;return}case 12:{N=e[8906]|0,e[t+4612>>2]=N+(((e[8907]|0)-N|0)>>>1),b=R;return}case 16:{N=e[8909]|0,e[t+4612>>2]=N+(((e[8910]|0)-N|0)>>>1),b=R;return}default:break e}while(!1);if(k=1<>2],o=t+4616|0,l=k<<1,c=t+4620|0,h=e[c>>2]|0,r=e[o>>2]|0,d=h-r|0,l>>>0<=d>>>0?l>>>0>>0&&(w=r+l|0,(h|0)!=(w|0))&&(e[c>>2]=w):(j0(o,l-d|0),r=e[o>>2]|0),D=t+4612|0,e[D>>2]=r+k,r=0-k|0,(k|0)<=(r|0)){b=R;return}w=t+192|0,C=t+188|0,d=t+184|0,h=r;do r=e[w>>2]|0,(h|0)>(0-r|0)?(o=e[C>>2]|0,(h|0)>(0-o|0)?(l=e[d>>2]|0,(h|0)>(0-l|0)?(c=e[N>>2]|0,(h|0)>=(0-c|0)?(c|0)<(h|0)?(l|0)<=(h|0)?(o|0)>(h|0)?r=2:r=(r|0)>(h|0)?3:4:r=1:r=0:r=-1):r=-2):r=-3):r=-4,S[(e[D>>2]|0)+h>>0]=r,h=h+1|0;while((h|0)!=(k|0));b=R}function j0(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0;if(C=t+8|0,c=e[C>>2]|0,D=t+4|0,o=e[D>>2]|0,l=o,(c-l|0)>>>0>=r>>>0){do S[o>>0]=0,o=(e[D>>2]|0)+1|0,e[D>>2]=o,r=r+-1|0;while(r|0);return}o=e[t>>2]|0,h=l-o+r|0,(h|0)<0&&(pi(t),c=e[C>>2]|0,o=e[t>>2]|0),l=c-o|0,l>>>0<1073741823?(l=l<<1,l=l>>>0>>0?h:l,o=(e[D>>2]|0)-o|0,l?w=8:(c=0,d=0,h=o)):(l=2147483647,o=(e[D>>2]|0)-o|0,w=8),(w|0)==8&&(c=l,d=Xe(l)|0,h=o),o=d+h|0,c=d+c|0,l=o;do S[l>>0]=0,l=o+1|0,o=l,r=r+-1|0;while(r|0);r=e[t>>2]|0,l=(e[D>>2]|0)-r|0,w=d+(h-l)|0,o0(w|0,r|0,l|0)|0,e[t>>2]=w,e[D>>2]=o,e[C>>2]=c,r&&he(r)}function Hl(t){t=t|0;var r=0,o=0;e[t>>2]=36612,r=e[t+120>>2]|0,r&&(o=t+124|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),o=t+92|0,r=e[o>>2]|0,e[o>>2]=0,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r),t=t+4|0,r=e[t>>2]|0,e[t>>2]=0,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r)}function Ql(t){t=t|0;var r=0,o=0;if(e[t>>2]=36612,r=e[t+120>>2]|0,r&&(o=t+124|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),o=t+92|0,r=e[o>>2]|0,e[o>>2]=0,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r),o=t+4|0,r=e[o>>2]|0,e[o>>2]=0,!r){he(t);return}Mt[e[(e[r>>2]|0)+4>>2]&255](r),he(t)}function Kl(t){t=t|0;var r=0,o=0;e[t>>2]=36052,r=e[t+4616>>2]|0,r&&(o=t+4620|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),e[t>>2]=36612,r=e[t+120>>2]|0,r&&(o=t+124|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),o=t+92|0,r=e[o>>2]|0,e[o>>2]=0,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r),t=t+4|0,r=e[t>>2]|0,e[t>>2]=0,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r)}function Yl(t){t=t|0;var r=0,o=0;if(e[t>>2]=36052,r=e[t+4616>>2]|0,r&&(o=t+4620|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),e[t>>2]=36612,r=e[t+120>>2]|0,r&&(o=t+124|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),o=t+92|0,r=e[o>>2]|0,e[o>>2]=0,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r),o=t+4|0,r=e[o>>2]|0,e[o>>2]=0,!r){he(t);return}Mt[e[(e[r>>2]|0)+4>>2]&255](r),he(t)}function jl(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0;d=b,b=b+32|0,C=d,m0(C,e[t+136>>2]|0,e[t+144>>2]|0),w=e[r+4>>2]|0,h=e[r+8>>2]|0,h=h|0?h:e[C+8>>2]|0,c=e[r+12>>2]|0,c=c|0?c:e[C+12>>2]|0,o=e[r+16>>2]|0,l=e[C+16>>2]|0,e[t+184>>2]=w|0?w:e[C+4>>2]|0,e[t+188>>2]=h,e[t+192>>2]=c,i1(t),c=t+140|0,r=(e[c>>2]|0)+32|0,r=(r|0)<128?2:(r|0)/64|0,h=0;do e[t+196+(h*12|0)>>2]=r,e[t+196+(h*12|0)+4>>2]=0,I[t+196+(h*12|0)+8>>1]=0,I[t+196+(h*12|0)+10>>1]=1,h=h+1|0;while((h|0)!=365);w=(e[c>>2]|0)+32|0,w=(w|0)<128?2:(w|0)/64|0,C=(o|0?o:l)&255,e[t+4576>>2]=w,e[t+4580>>2]=0,S[t+4584>>0]=C,S[t+4585>>0]=1,S[t+4586>>0]=0,e[t+4588>>2]=w,e[t+4592>>2]=1,S[t+4596>>0]=C,S[t+4597>>0]=1,S[t+4598>>0]=0,e[t+4600>>2]=0,b=d}function Xl(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0,D=0,k=0;if(k=b,b=b+16|0,C=k,w=t+92|0,d=e[r>>2]|0,e[r>>2]=0,r=e[w>>2]|0,e[w>>2]=d,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r),e[C>>2]=0,e[C+4>>2]=l,w=o+8|0,e[C+8>>2]=e[w>>2],l){r=Xe(4624)|0,l=t+8|0,c=r+4|0,h=l,d=c+84|0;do e[c>>2]=e[h>>2],c=c+4|0,h=h+4|0;while((c|0)<(d|0));c=r+88|0,d=c+40|0;do e[c>>2]=0,c=c+4|0;while((c|0)<(d|0));e[r>>2]=35828,e[r+128>>2]=e[t+136>>2],e[r+132>>2]=e[t+140>>2],e[r+136>>2]=e[t+144>>2],e[r+140>>2]=e[t+148>>2],e[r+144>>2]=e[t+152>>2],e[r+148>>2]=e[t+156>>2],e[r+152>>2]=e[t+160>>2],c=r+156|0,e[c>>2]=0,e[c+4>>2]=0,e[c+8>>2]=0,e[c+12>>2]=0,e[r+172>>2]=e[l>>2],e[r+176>>2]=0,e[r+180>>2]=0,e[r+184>>2]=0,c=r+4568|0,l=r+188|0;do e[l>>2]=0,e[l+4>>2]=0,I[l+8>>1]=0,I[l+10>>1]=1,l=l+12|0;while((l|0)!=(c|0));h=t+4|0,e[c>>2]=0,e[c+4>>2]=0,I[c+8>>1]=0,S[c+10>>0]=0,d=r+4580|0,e[d>>2]=0,e[d+4>>2]=0,I[d+8>>1]=0,S[d+10>>0]=0,d=r+4592|0,e[d>>2]=0,e[d+4>>2]=0,e[d+8>>2]=0,e[d+12>>2]=0,e[d+16>>2]=0,e[d+20>>2]=0,e[d+24>>2]=0,S[d+28>>0]=0,e[r+28>>2]|0||(e[r+20>>2]=1),l=e[h>>2]|0,e[h>>2]=r,l&&(Mt[e[(e[l>>2]|0)+4>>2]&255](l),r=e[h>>2]|0),Y0(r,C)}return C=t+100|0,e[C>>2]=32,e[t+96>>2]=0,r=e[o>>2]|0,r?(e[t+132>>2]=r,c=t+120|0,w=t+124|0,l=e[w>>2]|0,r=e[c>>2]|0,h=r,d=l-h|0,d>>>0>=4e3?d>>>0>4e3&&(D=r+4e3|0,(l|0)!=(D|0))&&(e[w>>2]=D,l=D):(vi(c,4e3-d|0),r=e[c>>2]|0,h=r,l=e[w>>2]|0),e[t+108>>2]=h,e[t+104>>2]=l-r,ns(t),D=t+116|0,D=e[D>>2]|0,t=e[C>>2]|0,t=t+-32|0,t=(t|0)/8|0,t=D-t|0,b=k,t|0):(e[t+108>>2]=e[o+4>>2],e[t+104>>2]=e[w>>2],ns(t),D=t+116|0,D=e[D>>2]|0,t=e[C>>2]|0,t=t+-32|0,t=(t|0)/8|0,t=D-t|0,b=k,t|0)}function Zl(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0,G=0,$=0,P=0,O=0;if(G=b,b=b+352|0,$=G+328|0,P=G+192|0,o=G+343|0,l=G+342|0,c=G+341|0,h=G+340|0,R=G+176|0,w=G+168|0,C=G+160|0,D=G+152|0,K=G,U=G+136|0,e[t+32>>2]|0&&(e[t+24>>2]|0)!=1){if(_=t+8|0,H=t+36|0,d=e[H>>2]|0,!d){if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[o>>0]|0,$e(37,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}if(t=e[t+16>>2]|0,(t|0)==16)switch(d|0){case 1:{if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[l>>0]|0,$e(38,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 2:{if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[c>>0]|0,$e(39,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 3:{if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[h>>0]|0,$e(40,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}default:{d=P+56|0,c=P+4|0,e[P>>2]=36160,e[d>>2]=36180,g=0,Ae(62,P+56|0,c|0),G=g,g=0,G&1&&(O=j()|0,tt(d),le(O|0)),e[P+128>>2]=0,e[P+132>>2]=-1,e[P>>2]=36200,e[P+56>>2]=36220,g=0,ue(180,c|0),G=g,g=0;do if(G&1)t=j()|0;else{if(e[c>>2]=36236,h=P+36|0,e[h>>2]=0,e[h+4>>2]=0,e[h+8>>2]=0,e[h+12>>2]=0,e[P+52>>2]=16,e[$>>2]=0,e[$+4>>2]=0,e[$+8>>2]=0,g=0,Ae(63,c|0,$|0),G=g,g=0,G&1){t=j()|0,de($),de(h),wt(c);break}de($),g=0,t=Ve(28,P|0,49007,21)|0,$=g,g=0;do if(!($&1)&&(g=0,k=be(36,t|0,e[H>>2]|0)|0,$=g,g=0,!($&1))&&(g=0,Ve(28,k|0,50997,18)|0,$=g,g=0,!($&1))){if(l=Ct(16)|0,g=0,Ae(64,R|0,c|0),$=g,g=0,$&1)t=j()|0;else if(!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,Q|0)|0,bt(8)),g=0,$e(36,l|0,9,35648,R|0),$=g,g=0,$&1?o=1:(g=0,xe(6,l|0,824,96),g=0,o=0),t=j()|0,de(R),!o)break;Tt(l|0)}else O=34;while(!1);(O|0)==34&&(t=j()|0),e[P>>2]=36200,e[d>>2]=36220,e[c>>2]=36236,de(h),wt(c),tt(d),O=t,le(O|0)}while(!1);O=t,tt(d),le(O|0)}}switch((t|0)<=8&&(t=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,Q|0)|0,bt(8)),g=0,xe(7,t|0,8,35648),O=g,g=0,O&1||Qt(t|0,824,96),O=j()|0,Tt(t|0),le(O|0)),o=16-t|0,d|0){case 1:{if(t=Xe(60)|0,e[w>>2]=o,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],e[$>>2]=e[w>>2],e[$+4>>2]=e[w+4>>2],$e(41,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 2:{if(t=Xe(60)|0,e[C>>2]=o,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],e[$>>2]=e[C>>2],e[$+4>>2]=e[C+4>>2],$e(42,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 3:{if(t=Xe(60)|0,e[D>>2]=o,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],e[$>>2]=e[D>>2],e[$+4>>2]=e[D+4>>2],$e(43,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}default:{d=K+56|0,c=K+4|0,e[K>>2]=36160,e[d>>2]=36180,g=0,Ae(62,K+56|0,c|0),P=g,g=0,P&1&&(O=j()|0,tt(d),le(O|0)),e[K+128>>2]=0,e[K+132>>2]=-1,e[K>>2]=36200,e[K+56>>2]=36220,g=0,ue(180,c|0),P=g,g=0;do if(P&1)t=j()|0;else{if(e[c>>2]=36236,h=K+36|0,e[h>>2]=0,e[h+4>>2]=0,e[h+8>>2]=0,e[h+12>>2]=0,e[K+52>>2]=16,e[$>>2]=0,e[$+4>>2]=0,e[$+8>>2]=0,g=0,Ae(63,c|0,$|0),P=g,g=0,P&1){t=j()|0,de($),de(h),wt(c);break}de($),g=0,t=Ve(28,K|0,49007,21)|0,P=g,g=0;do if(!(P&1)&&(g=0,N=be(36,t|0,e[H>>2]|0)|0,P=g,g=0,!(P&1))&&(g=0,Ve(28,N|0,50997,18)|0,P=g,g=0,!(P&1))){if(l=Ct(16)|0,g=0,Ae(64,U|0,c|0),P=g,g=0,P&1)t=j()|0;else if(!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,Q|0)|0,bt(8)),g=0,$e(36,l|0,9,35648,U|0),P=g,g=0,P&1?o=1:(g=0,xe(6,l|0,824,96),g=0,o=0),t=j()|0,de(U),!o)break;Tt(l|0)}else O=64;while(!1);(O|0)==64&&(t=j()|0),e[K>>2]=36200,e[d>>2]=36220,e[c>>2]=36236,de(h),wt(c),tt(d),O=t,le(O|0)}while(!1);O=t,tt(d),le(O|0)}}}return o=e[r+4>>2]|0,l=Xe(16)|0,t=e[t+20>>2]|0,o?(e[l>>2]=36108,e[l+4>>2]=o,e[l+8>>2]=6,e[l+12>>2]=t,O=l,b=G,O|0):(O=e[r>>2]|0,e[l>>2]=36132,e[l+4>>2]=O,e[l+8>>2]=6,e[l+12>>2]=t,O=l,b=G,O|0)}function ns(t){t=t|0;var r=0,o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0,G=0,$=0,P=0,O=0;K=b,b=b+32|0,$=K+12|0,H=K,R=t+180|0,_=(e[R>>2]|0)+4|0,(e[t+32>>2]|0)==1?U=e[t+24>>2]|0:U=1,r=ee(U<<1,_)|0,e[$>>2]=0,P=$+4|0,e[P>>2]=0,e[$+8>>2]=0;do if(r){if(r>>>0>715827882&&(g=0,ue(178,$|0),G=g,g=0,G&1)||(d=6),(d|0)==6&&(g=0,o=ge(67,r*6|0)|0,G=g,g=0,!(G&1))){for(e[P>>2]=o,e[$>>2]=o,l=o+(r*6|0)|0,e[$+8>>2]=l;I[o>>1]=0,I[o+2>>1]=0,I[o+4>>1]=0,r=r+-1|0,r;)o=o+6|0;e[P>>2]=l;break}l=j()|0,r=e[$>>2]|0,r||le(l|0),o=e[P>>2]|0,(o|0)!=(r|0)&&(e[P>>2]=o+(~(((o+-6-r|0)>>>0)/6|0)*6|0)),he(r),le(l|0)}while(!1);e[H>>2]=0,G=H+4|0,e[G>>2]=0,e[H+8>>2]=0;do if(!U)d=20;else{if(U>>>0>1073741823&&(g=0,ue(178,H|0),N=g,g=0,N&1)||(d=18),(d|0)==18&&(c=U<<2,g=0,h=ge(67,c|0)|0,N=g,g=0,!(N&1))){e[H>>2]=h,d=h+(U<<2)|0,e[H+8>>2]=d,Jt(h|0,0,c|0)|0,e[G>>2]=d,d=20;break}l=j()|0,r=e[H>>2]|0,o=r,r&&(c=e[G>>2]|0,(c|0)!=(r|0)&&(e[G>>2]=c+(~((c+-4-o|0)>>>2)<<2)),he(r))}while(!1);if((d|0)==20){c=t+12|0;e:do if((e[c>>2]|0)>0){h=t+4604|0,d=(ee(U,_)|0)+1|0,w=t+4608|0,C=t+92|0,D=(U|0)>0,k=t+4600|0,N=0;t:for(;;){if(o=e[$>>2]|0,r=o+6|0,e[h>>2]=r,o=o+(d*6|0)|0,e[w>>2]=o,N&1?(e[h>>2]=o,e[w>>2]=r):r=o,l=e[C>>2]|0,g=0,$e(e[(e[l>>2]|0)+12>>2]|0,l|0,r|0,e[R>>2]|0,_|0),l=g,g=0,l&1){d=30;break}if(D){r=e[H>>2]|0,o=e[h>>2]|0,l=0;do{if(e[k>>2]=e[r+(l<<2)>>2],O=e[R>>2]|0,r=o+(O*6|0)|0,o=o+((O+-1|0)*6|0)|0,I[r>>1]=I[o>>1]|0,I[r+2>>1]=I[o+2>>1]|0,I[r+4>>1]=I[o+4>>1]|0,o=(e[w>>2]|0)+-6|0,r=e[h>>2]|0,I[o>>1]=I[r>>1]|0,I[o+2>>1]=I[r+2>>1]|0,I[o+4>>1]=I[r+4>>1]|0,g=0,Ae(69,t|0,0),o=g,g=0,o&1){d=29;break t}r=e[H>>2]|0,e[r+(l<<2)>>2]=e[k>>2],o=(e[h>>2]|0)+(_*6|0)|0,e[h>>2]=o,e[w>>2]=(e[w>>2]|0)+(_*6|0),l=l+1|0}while((l|0)<(U|0))}if(N=N+1|0,(N|0)>=(e[c>>2]|0)){d=42;break e}}if((d|0)==29){l=j()|0;break}else if((d|0)==30){l=j()|0;break}}else d=42;while(!1);do if((d|0)==42){if(g=0,ue(182,t|0),O=g,g=0,O&1){l=j()|0;break}if(r=e[H>>2]|0,o=r,r&&(l=e[G>>2]|0,(l|0)!=(r|0)&&(e[G>>2]=l+(~((l+-4-o|0)>>>2)<<2)),he(r)),r=e[$>>2]|0,!r){b=K;return}o=e[P>>2]|0,(o|0)!=(r|0)&&(e[P>>2]=o+(~(((o+-6-r|0)>>>0)/6|0)*6|0)),he(r),b=K;return}while(!1);r=e[H>>2]|0,o=r,r&&(c=e[G>>2]|0,(c|0)!=(r|0)&&(e[G>>2]=c+(~((c+-4-o|0)>>>2)<<2)),he(r))}r=e[$>>2]|0,r||le(l|0),o=e[P>>2]|0,(o|0)!=(r|0)&&(e[P>>2]=o+(~(((o+-6-r|0)>>>0)/6|0)*6|0)),he(r),le(l|0)}function Jl(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0,ce=0,ke=0;if(oe=t+180|0,!((e[oe>>2]|0)<=0))for(ne=t+4608|0,ce=t+4604|0,ke=t+4612|0,ie=0;P=ie+-1|0,h=e[ne>>2]|0,d=e[ce>>2]|0,r=ie+1|0,c=M[d+(ie*6|0)>>1]|0,Z=e[ke>>2]|0,w=M[d+(P*6|0)>>1]|0,C=c-w|0,D=M[h+(P*6|0)>>1]|0,k=w-D|0,N=((((S[Z+((M[d+(r*6|0)>>1]|0)-c)>>0]|0)*9|0)+(S[Z+C>>0]|0)|0)*9|0)+(S[Z+k>>0]|0)|0,l=M[d+(ie*6|0)+2>>1]|0,R=M[d+(P*6|0)+2>>1]|0,_=l-R|0,U=M[h+(P*6|0)+2>>1]|0,H=R-U|0,K=((((S[Z+((M[d+(r*6|0)+2>>1]|0)-l)>>0]|0)*9|0)+(S[Z+_>>0]|0)|0)*9|0)+(S[Z+H>>0]|0)|0,o=M[d+(ie*6|0)+4>>1]|0,G=M[d+(P*6|0)+4>>1]|0,$=o-G|0,P=M[h+(P*6|0)+4>>1]|0,O=G-P|0,Z=((((S[Z+((M[d+(r*6|0)+4>>1]|0)-o)>>0]|0)*9|0)+(S[Z+$>>0]|0)|0)*9|0)+(S[Z+O>>0]|0)|0,K|N|Z?(d=M[h+(ie*6|0)>>1]|0,h=c-D>>31,(h^k|0)>=0&&((h^C|0)<0?c=D:c=D-w+c|0),d=Hn(t,N,d,c,0)|0,h=M[(e[ne>>2]|0)+(ie*6|0)+2>>1]|0,c=l-U>>31,(c^H|0)>=0&&((c^_|0)<0?l=U:l=U-R+l|0),c=Hn(t,K,h,l,0)|0,h=M[(e[ne>>2]|0)+(ie*6|0)+4>>1]|0,l=o-P>>31,(l^O|0)>=0&&((l^$|0)<0?o=P:o=P-G+o|0),O=Hn(t,Z,h,o,0)|0,Z=e[ne>>2]|0,I[Z+(ie*6|0)>>1]=d,I[Z+(ie*6|0)+2>>1]=c,I[Z+(ie*6|0)+4>>1]=O):r=(e1(t,ie,0)|0)+ie|0,(r|0)<(e[oe>>2]|0);)ie=r}function e1(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0;for(oe=b,b=b+48|0,_=oe+30|0,R=oe+24|0,N=oe+18|0,U=oe+12|0,P=oe+6|0,O=oe,Z=(e[t+180>>2]|0)-r|0,ie=e[t+4608>>2]|0,H=e[t+4604>>2]|0,$=r+-1|0,K=I[ie+($*6|0)>>1]|0,G=I[ie+($*6|0)+2>>1]|0,$=I[ie+($*6|0)+4>>1]|0,o=K&65535,l=t+144|0,c=G&65535,h=$&65535,k=0;C=k+r|0,d=ie+(C*6|0)|0,w=ie+(C*6|0)+2|0,C=ie+(C*6|0)+4|0,ne=(M[d>>1]|0)-o|0,D=e[l>>2]|0,!((((ne|0)>-1?ne:0-ne|0)|0)>(D|0)||(ne=(M[w>>1]|0)-c|0,(((ne|0)>-1?ne:0-ne|0)|0)>(D|0))||(ne=(M[C>>1]|0)-h|0,(((ne|0)>-1?ne:0-ne|0)|0)>(D|0)));)if(I[d>>1]=K,I[w>>1]=G,I[C>>1]=$,k=k+1|0,(k|0)==(Z|0)){k=Z;break}if(c=(k|0)==(Z|0),h=t+4600|0,l=e[36476+(e[h>>2]<<2)>>2]|0,(1<(k|0))o=k;else{o=k;do _t(t,1,1),l=e[h>>2]|0,o=o-(1<>2])|0,l=(l|0)>30?31:l+1|0,e[h>>2]=l,l=e[36476+(l<<2)>>2]|0;while((o|0)>=(1<>1]=I[ne>>1]|0,I[P+2>>1]=I[ne+2>>1]|0,I[P+4>>1]=I[ne+4>>1]|0,I[O>>1]=K,I[O+2>>1]=G,I[O+4>>1]=$,r=H+(r*6|0)|0,I[N>>1]=I[P>>1]|0,I[N+2>>1]=I[P+2>>1]|0,I[N+4>>1]=I[P+4>>1]|0,I[R>>1]=I[O>>1]|0,I[R+2>>1]=I[O+2>>1]|0,I[R+4>>1]=I[O+4>>1]|0,I[_>>1]=I[r>>1]|0,I[_+2>>1]=I[r+2>>1]|0,I[_+4>>1]=I[r+4>>1]|0,t1(U,t,N,R,_),I[ne>>1]=I[U>>1]|0,I[ne+2>>1]=I[U+2>>1]|0,I[ne+4>>1]=I[U+4>>1]|0,ne=e[h>>2]|0,e[h>>2]=(ne|0)<1?0:ne+-1|0,ne=k+1|0,b=oe,ne|0)}function Hn(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0;if(H=r>>31,h=(H^r)-H|0,_=t+196+(h*12|0)+10|0,d=I[_>>1]|0,R=t+196+(h*12|0)|0,c=e[R>>2]|0,(d|0)<(c|0))if((d<<1|0)<(c|0))if((d<<2|0)<(c|0))if((d<<3|0)<(c|0))if((d<<4|0)<(c|0))for(r=5;(d<>1]^H)-H+l|0,U=t+136|0,l=e[U>>2]|0,(c&l|0)==(c|0)?D=c:D=l&~(c>>31),c=(o-D^H)-H|0,C=t+144|0,l=e[C>>2]|0,(c|0)>0?c=(c+l|0)/(l<<1|1|0)|0:c=(c-l|0)/(l<<1|1|0)|0,N=t+140|0,w=e[N>>2]|0,o=((c|0)<0?w:0)+c|0,w=o-((o|0)<((w+1|0)/2|0|0)?0:w)|0,h=t+196+(h*12|0)+4|0,l|r?c=0:c=(e[h>>2]<<1)+-1+d>>31,l=c^w,rs(t,r,l>>30^l<<1,e[t+156>>2]|0),l=e[t+160>>2]|0,r=(e[R>>2]|0)+((w|0)>-1?w:0-w|0)|0,c=(e[h>>2]|0)+(ee(e[C>>2]<<1|1,w)|0)|0,o=I[_>>1]|0,(o|0)==(l|0)&&(r=r>>1,c=c>>1,o=l>>1),e[R>>2]=r,l=o+1|0,I[_>>1]=l,r=l+c|0,(r|0)>=1?(c|0)>0&&(c=c-l|0,_=I[k>>1]|0,I[k>>1]=(_<<16>>16<127&1)+(_&65535),c=(c|0)>0?0:c):(c=I[k>>1]|0,I[k>>1]=(c&65535)-(c<<16>>16>-128&1),c=(r|0)>(~o|0)?r:0-o|0),e[h>>2]=c,l=e[C>>2]|0,o=l<<1|1,r=(ee(o,(w^H)-H|0)|0)+D|0,(r|0)>=(0-l|0)?(c=e[U>>2]|0,(c+l|0)<(r|0)&&(r=r-(ee(e[N>>2]|0,o)|0)|0)):(r=(ee(e[N>>2]|0,o)|0)+r|0,c=e[U>>2]|0),(r&c|0)==(r|0)?(H=r,H=H&65535,H|0):(H=c&~(r>>31),H=H&65535,H|0)}function rs(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0;if(c=o>>r,h=t+148|0,d=l-(e[h>>2]|0)|0,(c|0)<(d+-1|0)){(c|0)>30&&(l=(c|0)/2|0,_t(t,0,l),c=c-l|0),_t(t,1,c+1|0),_t(t,(1<31?(_t(t,0,31),_t(t,1,l+-31-(e[h>>2]|0)|0)):_t(t,1,d),r=e[h>>2]|0,_t(t,(1<>1]|0,R=N-(M[l>>1]|0)>>31|1,h=ee(R,(M[o>>1]|0)-N|0)|0,D=r+144|0,d=e[D>>2]|0,(h|0)>0?h=(h+d|0)/(d<<1|1|0)|0:h=(h-d|0)/(d<<1|1|0)|0,P=r+140|0,C=e[P>>2]|0,w=((h|0)<0?C:0)+h|0,C=w-((w|0)<((C+1|0)/2|0|0)?0:C)|0,w=r+4576|0,Qn(r,w,C),K=M[c+2>>1]|0,G=K-(M[l+2>>1]|0)>>31|1,h=ee(G,(M[o+2>>1]|0)-K|0)|0,d=e[D>>2]|0,(h|0)>0?h=(h+d|0)/(d<<1|1|0)|0:h=(h-d|0)/(d<<1|1|0)|0,_=e[P>>2]|0,$=((h|0)<0?_:0)+h|0,_=$-(($|0)<((_+1|0)/2|0|0)?0:_)|0,Qn(r,w,_),$=M[c+4>>1]|0,H=$-(M[l+4>>1]|0)>>31|1,h=ee(H,(M[o+4>>1]|0)-$|0)|0,d=e[D>>2]|0,(h|0)>0?h=(h+d|0)/(d<<1|1|0)|0:h=(h-d|0)/(d<<1|1|0)|0,k=e[P>>2]|0,h=((h|0)<0?k:0)+h|0,k=h-((h|0)<((k+1|0)/2|0|0)?0:k)|0,Qn(r,w,k),w=e[D>>2]|0,D=w<<1|1,h=(ee(ee(D,C)|0,R)|0)+N|0,o=0-w|0,(h|0)>=(o|0)?(d=e[U>>2]|0,(d+w|0)<(h|0)&&(h=h-(ee(e[P>>2]|0,D)|0)|0),l=d):(h=(ee(e[P>>2]|0,D)|0)+h|0,l=e[U>>2]|0),(h&l|0)!=(h|0)&&(h=l&~(h>>31)),c=h&65535,h=(ee(ee(D,_)|0,G)|0)+K|0,(h|0)>=(o|0)?(l+w|0)<(h|0)&&(h=h-(ee(e[P>>2]|0,D)|0)|0):h=(ee(e[P>>2]|0,D)|0)+h|0,(h&l|0)!=(h|0)&&(h=l&~(h>>31)),d=h&65535,h=(ee(ee(D,k)|0,H)|0)+$|0,(h|0)>=(o|0)?(l+w|0)<(h|0)&&(h=h-(ee(e[P>>2]|0,D)|0)|0):h=(ee(e[P>>2]|0,D)|0)+h|0,(h&l|0)==(h|0)){P=h,P=P&65535,I[t>>1]=c,$=t+2|0,I[$>>1]=d,t=t+4|0,I[t>>1]=P;return}P=l&~(h>>31),P=P&65535,I[t>>1]=c,$=t+2|0,I[$>>1]=d,t=t+4|0,I[t>>1]=P}function Qn(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0;if(k=r+9|0,d=F[k>>0]|0,D=r+4|0,C=e[D>>2]|0,c=(ee(d>>>1,C)|0)+(e[r>>2]|0)|0,(d|0)<(c|0)){h=d,l=0;do h=h<<1,l=l+1|0;while((h|0)<(c|0));c=l}else c=0;(o|0)>0&(c|0)==0&&F[r+10>>0]<<1>>>0>>0?l=1:w=5;do if((w|0)==5){if(l=(o|0)<0,l&&F[r+10>>0]<<1>>>0>=d>>>0){l=1;break}l=l&(c|0)!=0}while(!1);if(l=(((o|0)>-1?o:0-o|0)<<1)-C+(l<<31>>31)|0,rs(t,c,l,(e[t+156>>2]|0)+-1-(e[36476+(e[t+4600>>2]<<2)>>2]|0)|0),(o|0)<0&&(t=r+10|0,S[t>>0]=(F[t>>0]|0)+1),l=(l+1-(e[D>>2]|0)>>1)+(e[r>>2]|0)|0,e[r>>2]=l,c=S[k>>0]|0,c<<24>>24!=(S[r+8>>0]|0)){r=c,r=r&255,r=r+1|0,r=r&255,S[k>>0]=r;return}e[r>>2]=l>>1,t=(c&255)>>>1,S[k>>0]=t,r=r+10|0,S[r>>0]=(F[r>>0]|0)>>>1,r=t,r=r&255,r=r+1|0,r=r&255,S[k>>0]=r}function i1(t){t=t|0;var r=0,o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0;R=b,b=b+32|0,l=R,N=t+144|0;e:do if(e[N>>2]|0)r=t+152|0;else if(o=e[t+136>>2]|0,r=t+152|0,(o|0)==((1<>2])+-1|0)&&(m0(l,o,0),(e[l+4>>2]|0)==(e[t+184>>2]|0))&&(e[l+8>>2]|0)==(e[t+188>>2]|0)&&(e[l+12>>2]|0)==(e[t+192>>2]|0))switch(e[r>>2]|0){case 8:{N=e[8900]|0,e[t+4612>>2]=N+(((e[8901]|0)-N|0)>>>1),b=R;return}case 10:{N=e[8903]|0,e[t+4612>>2]=N+(((e[8904]|0)-N|0)>>>1),b=R;return}case 12:{N=e[8906]|0,e[t+4612>>2]=N+(((e[8907]|0)-N|0)>>>1),b=R;return}case 16:{N=e[8909]|0,e[t+4612>>2]=N+(((e[8910]|0)-N|0)>>>1),b=R;return}default:break e}while(!1);if(k=1<>2],o=t+4616|0,l=k<<1,c=t+4620|0,h=e[c>>2]|0,r=e[o>>2]|0,d=h-r|0,l>>>0<=d>>>0?l>>>0>>0&&(w=r+l|0,(h|0)!=(w|0))&&(e[c>>2]=w):(j0(o,l-d|0),r=e[o>>2]|0),D=t+4612|0,e[D>>2]=r+k,r=0-k|0,(k|0)<=(r|0)){b=R;return}w=t+192|0,C=t+188|0,d=t+184|0,h=r;do r=e[w>>2]|0,(h|0)>(0-r|0)?(o=e[C>>2]|0,(h|0)>(0-o|0)?(l=e[d>>2]|0,(h|0)>(0-l|0)?(c=e[N>>2]|0,(h|0)>=(0-c|0)?(c|0)<(h|0)?(l|0)<=(h|0)?(o|0)>(h|0)?r=2:r=(r|0)>(h|0)?3:4:r=1:r=0:r=-1):r=-2):r=-3):r=-4,S[(e[D>>2]|0)+h>>0]=r,h=h+1|0;while((h|0)!=(k|0));b=R}function n1(t){t=t|0;var r=0,o=0;e[t>>2]=36024,r=e[t+4616>>2]|0,r&&(o=t+4620|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),e[t>>2]=36612,r=e[t+120>>2]|0,r&&(o=t+124|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),o=t+92|0,r=e[o>>2]|0,e[o>>2]=0,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r),t=t+4|0,r=e[t>>2]|0,e[t>>2]=0,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r)}function r1(t){t=t|0;var r=0,o=0;if(e[t>>2]=36024,r=e[t+4616>>2]|0,r&&(o=t+4620|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),e[t>>2]=36612,r=e[t+120>>2]|0,r&&(o=t+124|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),o=t+92|0,r=e[o>>2]|0,e[o>>2]=0,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r),o=t+4|0,r=e[o>>2]|0,e[o>>2]=0,!r){he(t);return}Mt[e[(e[r>>2]|0)+4>>2]&255](r),he(t)}function s1(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0;d=b,b=b+32|0,C=d,m0(C,e[t+136>>2]|0,e[t+144>>2]|0),w=e[r+4>>2]|0,h=e[r+8>>2]|0,h=h|0?h:e[C+8>>2]|0,c=e[r+12>>2]|0,c=c|0?c:e[C+12>>2]|0,o=e[r+16>>2]|0,l=e[C+16>>2]|0,e[t+184>>2]=w|0?w:e[C+4>>2]|0,e[t+188>>2]=h,e[t+192>>2]=c,O1(t),c=t+140|0,r=(e[c>>2]|0)+32|0,r=(r|0)<128?2:(r|0)/64|0,h=0;do e[t+196+(h*12|0)>>2]=r,e[t+196+(h*12|0)+4>>2]=0,I[t+196+(h*12|0)+8>>1]=0,I[t+196+(h*12|0)+10>>1]=1,h=h+1|0;while((h|0)!=365);w=(e[c>>2]|0)+32|0,w=(w|0)<128?2:(w|0)/64|0,C=(o|0?o:l)&255,e[t+4576>>2]=w,e[t+4580>>2]=0,S[t+4584>>0]=C,S[t+4585>>0]=1,S[t+4586>>0]=0,e[t+4588>>2]=w,e[t+4592>>2]=1,S[t+4596>>0]=C,S[t+4597>>0]=1,S[t+4598>>0]=0,e[t+4600>>2]=0,b=d}function o1(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0,D=0,k=0;if(k=b,b=b+16|0,C=k,w=t+92|0,d=e[r>>2]|0,e[r>>2]=0,r=e[w>>2]|0,e[w>>2]=d,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r),e[C>>2]=0,e[C+4>>2]=l,w=o+8|0,e[C+8>>2]=e[w>>2],l){r=Xe(4624)|0,l=t+8|0,c=r+4|0,h=l,d=c+84|0;do e[c>>2]=e[h>>2],c=c+4|0,h=h+4|0;while((c|0)<(d|0));c=r+88|0,d=c+40|0;do e[c>>2]=0,c=c+4|0;while((c|0)<(d|0));e[r>>2]=35800,e[r+128>>2]=e[t+136>>2],e[r+132>>2]=e[t+140>>2],e[r+136>>2]=e[t+144>>2],e[r+140>>2]=e[t+148>>2],e[r+144>>2]=e[t+152>>2],e[r+148>>2]=e[t+156>>2],e[r+152>>2]=e[t+160>>2],c=r+156|0,e[c>>2]=0,e[c+4>>2]=0,e[c+8>>2]=0,e[c+12>>2]=0,e[r+172>>2]=e[l>>2],e[r+176>>2]=0,e[r+180>>2]=0,e[r+184>>2]=0,c=r+4568|0,l=r+188|0;do e[l>>2]=0,e[l+4>>2]=0,I[l+8>>1]=0,I[l+10>>1]=1,l=l+12|0;while((l|0)!=(c|0));h=t+4|0,e[c>>2]=0,e[c+4>>2]=0,I[c+8>>1]=0,S[c+10>>0]=0,d=r+4580|0,e[d>>2]=0,e[d+4>>2]=0,I[d+8>>1]=0,S[d+10>>0]=0,d=r+4592|0,e[d>>2]=0,e[d+4>>2]=0,e[d+8>>2]=0,e[d+12>>2]=0,e[d+16>>2]=0,e[d+20>>2]=0,e[d+24>>2]=0,S[d+28>>0]=0,e[r+28>>2]|0||(e[r+20>>2]=1),l=e[h>>2]|0,e[h>>2]=r,l&&(Mt[e[(e[l>>2]|0)+4>>2]&255](l),r=e[h>>2]|0),Y0(r,C)}return C=t+100|0,e[C>>2]=32,e[t+96>>2]=0,r=e[o>>2]|0,r?(e[t+132>>2]=r,c=t+120|0,w=t+124|0,l=e[w>>2]|0,r=e[c>>2]|0,h=r,d=l-h|0,d>>>0>=4e3?d>>>0>4e3&&(D=r+4e3|0,(l|0)!=(D|0))&&(e[w>>2]=D,l=D):(vi(c,4e3-d|0),r=e[c>>2]|0,h=r,l=e[w>>2]|0),e[t+108>>2]=h,e[t+104>>2]=l-r,us(t),D=t+116|0,D=e[D>>2]|0,t=e[C>>2]|0,t=t+-32|0,t=(t|0)/8|0,t=D-t|0,b=k,t|0):(e[t+108>>2]=e[o+4>>2],e[t+104>>2]=e[w>>2],us(t),D=t+116|0,D=e[D>>2]|0,t=e[C>>2]|0,t=t+-32|0,t=(t|0)/8|0,t=D-t|0,b=k,t|0)}function l1(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0,G=0,$=0,P=0,O=0;if(G=b,b=b+352|0,$=G+328|0,P=G+192|0,o=G+343|0,l=G+342|0,c=G+341|0,h=G+340|0,R=G+176|0,w=G+168|0,C=G+160|0,D=G+152|0,K=G,U=G+136|0,e[t+32>>2]|0&&(e[t+24>>2]|0)!=1){if(_=t+8|0,H=t+36|0,d=e[H>>2]|0,!d){if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[o>>0]|0,$e(44,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}if(t=e[t+16>>2]|0,(t|0)==8)switch(d|0){case 1:{if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[l>>0]|0,$e(45,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 2:{if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[c>>0]|0,$e(46,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 3:{if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[h>>0]|0,$e(47,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}default:{d=P+56|0,c=P+4|0,e[P>>2]=36160,e[d>>2]=36180,g=0,Ae(62,P+56|0,c|0),G=g,g=0,G&1&&(O=j()|0,tt(d),le(O|0)),e[P+128>>2]=0,e[P+132>>2]=-1,e[P>>2]=36200,e[P+56>>2]=36220,g=0,ue(180,c|0),G=g,g=0;do if(G&1)t=j()|0;else{if(e[c>>2]=36236,h=P+36|0,e[h>>2]=0,e[h+4>>2]=0,e[h+8>>2]=0,e[h+12>>2]=0,e[P+52>>2]=16,e[$>>2]=0,e[$+4>>2]=0,e[$+8>>2]=0,g=0,Ae(63,c|0,$|0),G=g,g=0,G&1){t=j()|0,de($),de(h),wt(c);break}de($),g=0,t=Ve(28,P|0,49007,21)|0,$=g,g=0;do if(!($&1)&&(g=0,k=be(36,t|0,e[H>>2]|0)|0,$=g,g=0,!($&1))&&(g=0,Ve(28,k|0,50997,18)|0,$=g,g=0,!($&1))){if(l=Ct(16)|0,g=0,Ae(64,R|0,c|0),$=g,g=0,$&1)t=j()|0;else if(!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,Q|0)|0,bt(8)),g=0,$e(36,l|0,9,35648,R|0),$=g,g=0,$&1?o=1:(g=0,xe(6,l|0,824,96),g=0,o=0),t=j()|0,de(R),!o)break;Tt(l|0)}else O=34;while(!1);(O|0)==34&&(t=j()|0),e[P>>2]=36200,e[d>>2]=36220,e[c>>2]=36236,de(h),wt(c),tt(d),O=t,le(O|0)}while(!1);O=t,tt(d),le(O|0)}}switch((t|0)<=8&&(t=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,Q|0)|0,bt(8)),g=0,xe(7,t|0,8,35648),O=g,g=0,O&1||Qt(t|0,824,96),O=j()|0,Tt(t|0),le(O|0)),o=16-t|0,d|0){case 1:{if(t=Xe(60)|0,e[w>>2]=o,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],e[$>>2]=e[w>>2],e[$+4>>2]=e[w+4>>2],$e(41,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 2:{if(t=Xe(60)|0,e[C>>2]=o,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],e[$>>2]=e[C>>2],e[$+4>>2]=e[C+4>>2],$e(42,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 3:{if(t=Xe(60)|0,e[D>>2]=o,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],e[$>>2]=e[D>>2],e[$+4>>2]=e[D+4>>2],$e(43,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}default:{d=K+56|0,c=K+4|0,e[K>>2]=36160,e[d>>2]=36180,g=0,Ae(62,K+56|0,c|0),P=g,g=0,P&1&&(O=j()|0,tt(d),le(O|0)),e[K+128>>2]=0,e[K+132>>2]=-1,e[K>>2]=36200,e[K+56>>2]=36220,g=0,ue(180,c|0),P=g,g=0;do if(P&1)t=j()|0;else{if(e[c>>2]=36236,h=K+36|0,e[h>>2]=0,e[h+4>>2]=0,e[h+8>>2]=0,e[h+12>>2]=0,e[K+52>>2]=16,e[$>>2]=0,e[$+4>>2]=0,e[$+8>>2]=0,g=0,Ae(63,c|0,$|0),P=g,g=0,P&1){t=j()|0,de($),de(h),wt(c);break}de($),g=0,t=Ve(28,K|0,49007,21)|0,P=g,g=0;do if(!(P&1)&&(g=0,N=be(36,t|0,e[H>>2]|0)|0,P=g,g=0,!(P&1))&&(g=0,Ve(28,N|0,50997,18)|0,P=g,g=0,!(P&1))){if(l=Ct(16)|0,g=0,Ae(64,U|0,c|0),P=g,g=0,P&1)t=j()|0;else if(!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,Q|0)|0,bt(8)),g=0,$e(36,l|0,9,35648,U|0),P=g,g=0,P&1?o=1:(g=0,xe(6,l|0,824,96),g=0,o=0),t=j()|0,de(U),!o)break;Tt(l|0)}else O=64;while(!1);(O|0)==64&&(t=j()|0),e[K>>2]=36200,e[d>>2]=36220,e[c>>2]=36236,de(h),wt(c),tt(d),O=t,le(O|0)}while(!1);O=t,tt(d),le(O|0)}}}return o=e[r+4>>2]|0,l=Xe(16)|0,t=e[t+20>>2]|0,o?(e[l>>2]=36108,e[l+4>>2]=o,e[l+8>>2]=3,e[l+12>>2]=t,O=l,b=G,O|0):(O=e[r>>2]|0,e[l>>2]=36132,e[l+4>>2]=O,e[l+8>>2]=3,e[l+12>>2]=t,O=l,b=G,O|0)}function u1(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0;e[t>>2]=36712,e[t+4>>2]=o,k=t+8|0,l=e[o>>2]|0,C=o+16|0,d=e[C>>2]|0,h=ee(d,l)|0,e[k>>2]=0,N=t+12|0,e[N>>2]=0,e[t+16>>2]=0;do if(!h)h=d;else{if((h|0)<0&&(g=0,ue(178,k|0),d=g,g=0,d&1)||(D=4),(D|0)==4&&(g=0,w=ge(67,h|0)|0,d=g,g=0,!(d&1))){e[N>>2]=w,e[k>>2]=w,e[t+16>>2]=w+h,l=w;do S[l>>0]=0,l=(e[N>>2]|0)+1|0,e[N>>2]=l,h=h+-1|0;while(h|0);h=e[C>>2]|0,l=e[o>>2]|0;break}l=j()|0,c=e[k>>2]|0,c&&((e[N>>2]|0)!=(c|0)&&(e[N>>2]=c),he(c)),N=l,le(N|0)}while(!1);if(d=t+20|0,l=ee(h,l)|0,e[d>>2]=0,h=t+24|0,e[h>>2]=0,e[t+28>>2]=0,!l){N=t+36|0,e[N>>2]=e[r>>2],e[N+4>>2]=e[r+4>>2],e[N+8>>2]=e[r+8>>2];return}if((l|0)<0&&(g=0,ue(178,d|0),o=g,g=0,o&1)||(D=15),(D|0)==15&&(g=0,c=ge(67,l|0)|0,D=g,g=0,!(D&1))){e[h>>2]=c,e[d>>2]=c,e[t+28>>2]=c+l;do S[c>>0]=0,c=(e[h>>2]|0)+1|0,e[h>>2]=c,l=l+-1|0;while(l|0);N=t+36|0,e[N>>2]=e[r>>2],e[N+4>>2]=e[r+4>>2],e[N+8>>2]=e[r+8>>2];return}l=j()|0,c=e[d>>2]|0,c&&((e[h>>2]|0)!=(c|0)&&(e[h>>2]=c),he(c)),c=e[k>>2]|0,c||(N=l,le(N|0)),(e[N>>2]|0)!=(c|0)&&(e[N>>2]=c),he(c),N=l,le(N|0)}function c1(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0;e[t>>2]=36688,e[t+4>>2]=o,k=t+8|0,l=e[o>>2]|0,C=o+16|0,d=e[C>>2]|0,h=ee(d,l)|0,e[k>>2]=0,N=t+12|0,e[N>>2]=0,e[t+16>>2]=0;do if(!h)h=d;else{if((h|0)<0&&(g=0,ue(178,k|0),d=g,g=0,d&1)||(D=4),(D|0)==4&&(g=0,w=ge(67,h|0)|0,d=g,g=0,!(d&1))){e[N>>2]=w,e[k>>2]=w,e[t+16>>2]=w+h,l=w;do S[l>>0]=0,l=(e[N>>2]|0)+1|0,e[N>>2]=l,h=h+-1|0;while(h|0);h=e[C>>2]|0,l=e[o>>2]|0;break}l=j()|0,c=e[k>>2]|0,c&&((e[N>>2]|0)!=(c|0)&&(e[N>>2]=c),he(c)),N=l,le(N|0)}while(!1);if(d=t+20|0,l=ee(h,l)|0,e[d>>2]=0,h=t+24|0,e[h>>2]=0,e[t+28>>2]=0,!l){N=t+36|0,e[N>>2]=e[r>>2],e[N+4>>2]=e[r+4>>2],e[N+8>>2]=e[r+8>>2];return}if((l|0)<0&&(g=0,ue(178,d|0),o=g,g=0,o&1)||(D=15),(D|0)==15&&(g=0,c=ge(67,l|0)|0,D=g,g=0,!(D&1))){e[h>>2]=c,e[d>>2]=c,e[t+28>>2]=c+l;do S[c>>0]=0,c=(e[h>>2]|0)+1|0,e[h>>2]=c,l=l+-1|0;while(l|0);N=t+36|0,e[N>>2]=e[r>>2],e[N+4>>2]=e[r+4>>2],e[N+8>>2]=e[r+8>>2];return}l=j()|0,c=e[d>>2]|0,c&&((e[h>>2]|0)!=(c|0)&&(e[h>>2]=c),he(c)),c=e[k>>2]|0,c||(N=l,le(N|0)),(e[N>>2]|0)!=(c|0)&&(e[N>>2]=c),he(c),N=l,le(N|0)}function f1(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0;e[t>>2]=36664,e[t+4>>2]=o,k=t+8|0,l=e[o>>2]|0,C=o+16|0,d=e[C>>2]|0,h=ee(d,l)|0,e[k>>2]=0,N=t+12|0,e[N>>2]=0,e[t+16>>2]=0;do if(!h)h=d;else{if((h|0)<0&&(g=0,ue(178,k|0),d=g,g=0,d&1)||(D=4),(D|0)==4&&(g=0,w=ge(67,h|0)|0,d=g,g=0,!(d&1))){e[N>>2]=w,e[k>>2]=w,e[t+16>>2]=w+h,l=w;do S[l>>0]=0,l=(e[N>>2]|0)+1|0,e[N>>2]=l,h=h+-1|0;while(h|0);h=e[C>>2]|0,l=e[o>>2]|0;break}l=j()|0,c=e[k>>2]|0,c&&((e[N>>2]|0)!=(c|0)&&(e[N>>2]=c),he(c)),N=l,le(N|0)}while(!1);if(d=t+20|0,l=ee(h,l)|0,e[d>>2]=0,h=t+24|0,e[h>>2]=0,e[t+28>>2]=0,!l){N=t+36|0,e[N>>2]=e[r>>2],e[N+4>>2]=e[r+4>>2],e[N+8>>2]=e[r+8>>2];return}if((l|0)<0&&(g=0,ue(178,d|0),o=g,g=0,o&1)||(D=15),(D|0)==15&&(g=0,c=ge(67,l|0)|0,D=g,g=0,!(D&1))){e[h>>2]=c,e[d>>2]=c,e[t+28>>2]=c+l;do S[c>>0]=0,c=(e[h>>2]|0)+1|0,e[h>>2]=c,l=l+-1|0;while(l|0);N=t+36|0,e[N>>2]=e[r>>2],e[N+4>>2]=e[r+4>>2],e[N+8>>2]=e[r+8>>2];return}l=j()|0,c=e[d>>2]|0,c&&((e[h>>2]|0)!=(c|0)&&(e[h>>2]=c),he(c)),c=e[k>>2]|0,c||(N=l,le(N|0)),(e[N>>2]|0)!=(c|0)&&(e[N>>2]=c),he(c),N=l,le(N|0)}function h1(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0;e[t>>2]=36640,e[t+4>>2]=o,k=t+8|0,l=e[o>>2]|0,C=o+16|0,d=e[C>>2]|0,h=ee(d,l)|0,e[k>>2]=0,N=t+12|0,e[N>>2]=0,e[t+16>>2]=0;do if(!h)h=d;else{if((h|0)<0&&(g=0,ue(178,k|0),d=g,g=0,d&1)||(D=4),(D|0)==4&&(g=0,w=ge(67,h|0)|0,d=g,g=0,!(d&1))){e[N>>2]=w,e[k>>2]=w,e[t+16>>2]=w+h,l=w;do S[l>>0]=0,l=(e[N>>2]|0)+1|0,e[N>>2]=l,h=h+-1|0;while(h|0);h=e[C>>2]|0,l=e[o>>2]|0;break}l=j()|0,c=e[k>>2]|0,c&&((e[N>>2]|0)!=(c|0)&&(e[N>>2]=c),he(c)),N=l,le(N|0)}while(!1);if(d=t+20|0,l=ee(h,l)|0,e[d>>2]=0,h=t+24|0,e[h>>2]=0,e[t+28>>2]=0,!l){N=t+36|0,e[N>>2]=e[r>>2],e[N+4>>2]=e[r+4>>2],e[N+8>>2]=e[r+8>>2];return}if((l|0)<0&&(g=0,ue(178,d|0),o=g,g=0,o&1)||(D=15),(D|0)==15&&(g=0,c=ge(67,l|0)|0,D=g,g=0,!(D&1))){e[h>>2]=c,e[d>>2]=c,e[t+28>>2]=c+l;do S[c>>0]=0,c=(e[h>>2]|0)+1|0,e[h>>2]=c,l=l+-1|0;while(l|0);N=t+36|0,e[N>>2]=e[r>>2],e[N+4>>2]=e[r+4>>2],e[N+8>>2]=e[r+8>>2];return}l=j()|0,c=e[d>>2]|0,c&&((e[h>>2]|0)!=(c|0)&&(e[h>>2]=c),he(c)),c=e[k>>2]|0,c||(N=l,le(N|0)),(e[N>>2]|0)!=(c|0)&&(e[N>>2]=c),he(c),N=l,le(N|0)}function d1(t){t=t|0;var r=0,o=0;e[t>>2]=36640,r=e[t+20>>2]|0,r&&(o=t+24|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),o=e[t+8>>2]|0,o&&(r=t+12|0,(e[r>>2]|0)!=(o|0)&&(e[r>>2]=o),he(o))}function p1(t){t=t|0;var r=0,o=0;if(e[t>>2]=36640,r=e[t+20>>2]|0,r&&(o=t+24|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),r=e[t+8>>2]|0,!r){he(t);return}o=t+12|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r),he(t)}function m1(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0;if(c=t+36|0,!(e[c>>2]|0)){c=t+40|0,ss(t,r,e[c>>2]|0,o,l),e[c>>2]=(e[c>>2]|0)+(e[(e[t+4>>2]|0)+12>>2]|0);return}h=ee(e[(e[t+4>>2]|0)+16>>2]|0,o)|0,d=t+20|0,ss(t,r,e[d>>2]|0,o,l),t=e[c>>2]|0,(Yt[e[(e[t>>2]|0)+48>>2]&63](t,e[d>>2]|0,h)|0)!=(h|0)&&(c=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,Q|0)|0,bt(8)),g=0,xe(7,c|0,3,35648),d=g,g=0,d&1?(d=j()|0,Tt(c|0),le(d|0)):Qt(c|0,824,96))}function g1(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0;if(c=e[t+36>>2]|0,c){S1(t,c,r,o,l);return}else{c=t+40|0,Kn(t,e[c>>2]|0,r,o,l),e[c>>2]=(e[c>>2]|0)+(e[(e[t+4>>2]|0)+12>>2]|0);return}}function Kn(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0;if(w=t+4|0,h=e[w>>2]|0,!(S[h+32>>0]|0))w=r;else{if(d=t+8|0,o0(e[d>>2]|0,r|0,l*3|0)|0,h=e[w>>2]|0,r=e[h+16>>2]|0,(l|0)>0){for(h=e[d>>2]|0,t=0;C=h+2|0,D=S[h>>0]|0,S[h>>0]=S[C>>0]|0,S[C>>0]=D,t=t+1|0,(t|0)!=(l|0);)h=h+r|0;h=e[w>>2]|0}w=e[d>>2]|0}switch(e[h+16>>2]|0){case 3:{if((e[h+24>>2]|0)==2){if((l|0)>0)h=0;else return;do d=F[w+(h*3|0)+1>>0]|0,c=128-d+(F[w+(h*3|0)+2>>0]|0)|0,C=(F[w+(h*3|0)>>0]|0)-d+128|0,D=o+(h*3|0)|0,S[D>>0]=d+192+(((c&255)+(C&255)|0)>>>2),S[D+1>>0]=c,S[D+2>>0]=C,h=h+1|0;while((h|0)!=(l|0));return}if(h=(c|0)<(l|0)?c:l,(h|0)<=0)return;t=c<<1,r=0;do l=F[w+(r*3|0)+1>>0]|0,C=128-l+(F[w+(r*3|0)+2>>0]|0)|0,D=(F[w+(r*3|0)>>0]|0)-l+128|0,S[o+r>>0]=l+192+(((C&255)+(D&255)|0)>>>2),S[o+(r+c)>>0]=C,S[o+(r+t)>>0]=D,r=r+1|0;while((r|0)!=(h|0));return}case 4:{if((e[h+24>>2]|0)!=1||(h=(c|0)<(l|0)?c:l,(h|0)<=0))return;t=c<<1,r=c*3|0,d=0;do D=S[w+(d<<2)+3>>0]|0,k=F[w+(d<<2)+1>>0]|0,l=128-k+(F[w+(d<<2)+2>>0]|0)|0,C=(F[w+(d<<2)>>0]|0)-k+128|0,S[o+d>>0]=k+192+(((l&255)+(C&255)|0)>>>2),S[o+(d+c)>>0]=l,S[o+(d+t)>>0]=C,S[o+(d+r)>>0]=D,d=d+1|0;while((d|0)!=(h|0));return}default:return}}function S1(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0;if(k=b,b=b+176|0,N=k+152|0,_=k+16|0,R=k,d=ee(e[(e[t+4>>2]|0)+16>>2]|0,l)|0,C=t+20|0,h=e[C>>2]|0,!d){_=h,Kn(t,_,o,l,c),b=k;return}for(;w=Yt[e[(e[r>>2]|0)+32>>2]&63](r,h,d)|0,!!w;)if(h=e[C>>2]|0,(d|0)==(w|0)){D=26;break}else d=d-w|0;if((D|0)==26){Kn(t,h,o,l,c),b=k;return}o=_+56|0,C=_+4|0,e[_>>2]=36160,e[o>>2]=36180,g=0,Ae(62,_+56|0,C|0),k=g,g=0,k&1&&(_=j()|0,tt(o),le(_|0)),e[_+128>>2]=0,e[_+132>>2]=-1,e[_>>2]=36200,e[_+56>>2]=36220,g=0,ue(180,C|0),k=g,g=0;do if(k&1)h=j()|0;else{if(e[C>>2]=36236,r=_+36|0,e[r>>2]=0,e[r+4>>2]=0,e[r+8>>2]=0,e[r+12>>2]=0,e[_+52>>2]=16,e[N>>2]=0,e[N+4>>2]=0,e[N+8>>2]=0,g=0,Ae(63,C|0,N|0),k=g,g=0,k&1){h=j()|0,de(N),de(r),wt(C);break}de(N),g=0,h=Ve(28,_|0,49029,57)|0,N=g,g=0,!(N&1)&&(g=0,be(36,h|0,0)|0,N=g,g=0,!(N&1))&&(w=Ct(16)|0,g=0,Ae(64,R|0,C|0),N=g,g=0,N&1?h=j()|0:(!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,Q|0)|0,bt(8)),g=0,$e(36,w|0,3,35648,R|0),N=g,g=0,N&1?d=1:(g=0,xe(6,w|0,824,96),g=0,d=0),h=j()|0,de(R),d||(R=h,e[_>>2]=36200,e[o>>2]=36220,e[C>>2]=36236,de(r),wt(C),tt(o),le(R|0))),Tt(w|0),R=h,e[_>>2]=36200,e[o>>2]=36220,e[C>>2]=36236,de(r),wt(C),tt(o),le(R|0)),R=j()|0,e[_>>2]=36200,e[o>>2]=36220,e[C>>2]=36236,de(r),wt(C),tt(o),le(R|0)}while(!1);_=h,tt(o),le(_|0)}function ss(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0;C=t+4|0,t=e[C>>2]|0;e:do switch(e[t+16>>2]|0){case 3:{if((e[t+24>>2]|0)==2){if((l|0)>0)t=0;else break e;for(;;)if(d=F[r+(t*3|0)+1>>0]|0,h=F[r+(t*3|0)+2>>0]|0,w=(F[r+(t*3|0)>>0]|0)-((h+d|0)>>>2)+64|0,c=o+(t*3|0)|0,S[c>>0]=h+128+w,S[c+1>>0]=w,S[c+2>>0]=d+128+w,t=t+1|0,(t|0)==(l|0))break e}if(t=(l|0)<(c|0)?l:c,(t|0)>0){h=c<<1,d=0;do k=F[r+(d+c)>>0]|0,N=F[r+(d+h)>>0]|0,D=(F[r+d>>0]|0)-((N+k|0)>>>2)+64|0,w=o+(d*3|0)|0,S[w>>0]=N+128+D,S[w+1>>0]=D,S[w+2>>0]=k+128+D,d=d+1|0;while((d|0)!=(t|0))}break}case 4:{if((e[t+24>>2]|0)==1&&(w=(l|0)<(c|0)?l:c,(w|0)>0)){t=c<<1,h=c*3|0,d=0;do D=F[r+(d+c)>>0]|0,R=F[r+(d+t)>>0]|0,k=(F[r+d>>0]|0)-((R+D|0)>>>2)+64|0,N=o+(d<<2)|0,k=k<<8&65280|F[r+(d+h)>>0]<<24|R+128+k&255|D+128+k<<16&16711680,S[N>>0]=k,S[N+1>>0]=k>>8,S[N+2>>0]=k>>16,S[N+3>>0]=k>>24,d=d+1|0;while((d|0)!=(w|0))}break}default:}while(!1);if(t=e[C>>2]|0,!!(S[t+32>>0]|0)){if(d=e[t+16>>2]|0,(l|0)>0)t=o,h=0;else return;for(;R=t+2|0,N=S[t>>0]|0,S[t>>0]=S[R>>0]|0,S[R>>0]=N,h=h+1|0,(h|0)!=(l|0);)t=t+d|0}}function A1(t){t=t|0;var r=0,o=0;e[t>>2]=36664,r=e[t+20>>2]|0,r&&(o=t+24|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),o=e[t+8>>2]|0,o&&(r=t+12|0,(e[r>>2]|0)!=(o|0)&&(e[r>>2]=o),he(o))}function v1(t){t=t|0;var r=0,o=0;if(e[t>>2]=36664,r=e[t+20>>2]|0,r&&(o=t+24|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),r=e[t+8>>2]|0,!r){he(t);return}o=t+12|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r),he(t)}function x1(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0;if(c=t+36|0,!(e[c>>2]|0)){c=t+40|0,os(t,r,e[c>>2]|0,o,l),e[c>>2]=(e[c>>2]|0)+(e[(e[t+4>>2]|0)+12>>2]|0);return}h=ee(e[(e[t+4>>2]|0)+16>>2]|0,o)|0,d=t+20|0,os(t,r,e[d>>2]|0,o,l),t=e[c>>2]|0,(Yt[e[(e[t>>2]|0)+48>>2]&63](t,e[d>>2]|0,h)|0)!=(h|0)&&(c=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,Q|0)|0,bt(8)),g=0,xe(7,c|0,3,35648),d=g,g=0,d&1?(d=j()|0,Tt(c|0),le(d|0)):Qt(c|0,824,96))}function w1(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0;if(c=e[t+36>>2]|0,c){y1(t,c,r,o,l);return}else{c=t+40|0,Yn(t,e[c>>2]|0,r,o,l),e[c>>2]=(e[c>>2]|0)+(e[(e[t+4>>2]|0)+12>>2]|0);return}}function Yn(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0;if(w=t+4|0,h=e[w>>2]|0,!(S[h+32>>0]|0))w=r;else{if(d=t+8|0,o0(e[d>>2]|0,r|0,l*3|0)|0,h=e[w>>2]|0,r=e[h+16>>2]|0,(l|0)>0){for(h=e[d>>2]|0,t=0;C=h+2|0,D=S[h>>0]|0,S[h>>0]=S[C>>0]|0,S[C>>0]=D,t=t+1|0,(t|0)!=(l|0);)h=h+r|0;h=e[w>>2]|0}w=e[d>>2]|0}switch(e[h+16>>2]|0){case 3:{if((e[h+24>>2]|0)==2){if((l|0)>0)h=0;else return;do r=F[w+(h*3|0)>>0]|0,c=S[w+(h*3|0)+1>>0]|0,d=c&255,C=(F[w+(h*3|0)+2>>0]|0)+128-((d+r|0)>>>1)&255,D=o+(h*3|0)|0,S[D>>0]=r+128-d,S[D+1>>0]=c,S[D+2>>0]=C,h=h+1|0;while((h|0)!=(l|0));return}if(h=(c|0)<(l|0)?c:l,(h|0)<=0)return;t=c<<1,r=0;do C=S[w+(r*3|0)+1>>0]|0,d=F[w+(r*3|0)>>0]|0,l=C&255,D=(F[w+(r*3|0)+2>>0]|0)+128-((l+d|0)>>>1)&255,S[o+r>>0]=d+128-l,S[o+(r+c)>>0]=C,S[o+(r+t)>>0]=D,r=r+1|0;while((r|0)!=(h|0));return}case 4:{if((e[h+24>>2]|0)!=1||(h=(c|0)<(l|0)?c:l,(h|0)<=0))return;t=c<<1,r=c*3|0,d=0;do l=S[w+(d<<2)+1>>0]|0,D=S[w+(d<<2)+3>>0]|0,N=F[w+(d<<2)>>0]|0,k=l&255,C=(F[w+(d<<2)+2>>0]|0)+128-((k+N|0)>>>1)&255,S[o+d>>0]=N+128-k,S[o+(d+c)>>0]=l,S[o+(d+t)>>0]=C,S[o+(d+r)>>0]=D,d=d+1|0;while((d|0)!=(h|0));return}default:return}}function y1(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0;if(k=b,b=b+176|0,N=k+152|0,_=k+16|0,R=k,d=ee(e[(e[t+4>>2]|0)+16>>2]|0,l)|0,C=t+20|0,h=e[C>>2]|0,!d){_=h,Yn(t,_,o,l,c),b=k;return}for(;w=Yt[e[(e[r>>2]|0)+32>>2]&63](r,h,d)|0,!!w;)if(h=e[C>>2]|0,(d|0)==(w|0)){D=26;break}else d=d-w|0;if((D|0)==26){Yn(t,h,o,l,c),b=k;return}o=_+56|0,C=_+4|0,e[_>>2]=36160,e[o>>2]=36180,g=0,Ae(62,_+56|0,C|0),k=g,g=0,k&1&&(_=j()|0,tt(o),le(_|0)),e[_+128>>2]=0,e[_+132>>2]=-1,e[_>>2]=36200,e[_+56>>2]=36220,g=0,ue(180,C|0),k=g,g=0;do if(k&1)h=j()|0;else{if(e[C>>2]=36236,r=_+36|0,e[r>>2]=0,e[r+4>>2]=0,e[r+8>>2]=0,e[r+12>>2]=0,e[_+52>>2]=16,e[N>>2]=0,e[N+4>>2]=0,e[N+8>>2]=0,g=0,Ae(63,C|0,N|0),k=g,g=0,k&1){h=j()|0,de(N),de(r),wt(C);break}de(N),g=0,h=Ve(28,_|0,49029,57)|0,N=g,g=0,!(N&1)&&(g=0,be(36,h|0,0)|0,N=g,g=0,!(N&1))&&(w=Ct(16)|0,g=0,Ae(64,R|0,C|0),N=g,g=0,N&1?h=j()|0:(!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,Q|0)|0,bt(8)),g=0,$e(36,w|0,3,35648,R|0),N=g,g=0,N&1?d=1:(g=0,xe(6,w|0,824,96),g=0,d=0),h=j()|0,de(R),d||(R=h,e[_>>2]=36200,e[o>>2]=36220,e[C>>2]=36236,de(r),wt(C),tt(o),le(R|0))),Tt(w|0),R=h,e[_>>2]=36200,e[o>>2]=36220,e[C>>2]=36236,de(r),wt(C),tt(o),le(R|0)),R=j()|0,e[_>>2]=36200,e[o>>2]=36220,e[C>>2]=36236,de(r),wt(C),tt(o),le(R|0)}while(!1);_=h,tt(o),le(_|0)}function os(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0;C=t+4|0,t=e[C>>2]|0;e:do switch(e[t+16>>2]|0){case 3:{if((e[t+24>>2]|0)==2){if((l|0)>0)t=0;else break e;for(;;)if(d=S[r+(t*3|0)+1>>0]|0,w=d&255,h=(F[r+(t*3|0)>>0]|0)+128+w|0,w=(F[r+(t*3|0)+2>>0]|0)+128+(((h&255)+w|0)>>>1)&255,c=o+(t*3|0)|0,S[c>>0]=h,S[c+1>>0]=d,S[c+2>>0]=w,t=t+1|0,(t|0)==(l|0))break e}if(t=(l|0)<(c|0)?l:c,(t|0)>0){h=c<<1,d=0;do k=S[r+(d+c)>>0]|0,D=k&255,N=(F[r+d>>0]|0)+128+D|0,D=(F[r+(d+h)>>0]|0)+128+(((N&255)+D|0)>>>1)&255,w=o+(d*3|0)|0,S[w>>0]=N,S[w+1>>0]=k,S[w+2>>0]=D,d=d+1|0;while((d|0)!=(t|0))}break}case 4:{if((e[t+24>>2]|0)==1&&(w=(l|0)<(c|0)?l:c,(w|0)>0)){t=c<<1,h=c*3|0,d=0;do k=F[r+(d+c)>>0]|0,D=(F[r+d>>0]|0)+128+k&255,N=o+(d<<2)|0,k=D|k<<8|F[r+(d+h)>>0]<<24|(F[r+(d+t)>>0]|0)+128+((D+k|0)>>>1)<<16&16711680,S[N>>0]=k,S[N+1>>0]=k>>8,S[N+2>>0]=k>>16,S[N+3>>0]=k>>24,d=d+1|0;while((d|0)!=(w|0))}break}default:}while(!1);if(t=e[C>>2]|0,!!(S[t+32>>0]|0)){if(d=e[t+16>>2]|0,(l|0)>0)t=o,h=0;else return;for(;N=t+2|0,k=S[t>>0]|0,S[t>>0]=S[N>>0]|0,S[N>>0]=k,h=h+1|0,(h|0)!=(l|0);)t=t+d|0}}function C1(t){t=t|0;var r=0,o=0;e[t>>2]=36688,r=e[t+20>>2]|0,r&&(o=t+24|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),o=e[t+8>>2]|0,o&&(r=t+12|0,(e[r>>2]|0)!=(o|0)&&(e[r>>2]=o),he(o))}function T1(t){t=t|0;var r=0,o=0;if(e[t>>2]=36688,r=e[t+20>>2]|0,r&&(o=t+24|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),r=e[t+8>>2]|0,!r){he(t);return}o=t+12|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r),he(t)}function I1(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0;if(c=t+36|0,!(e[c>>2]|0)){c=t+40|0,as(t,r,e[c>>2]|0,o,l),e[c>>2]=(e[c>>2]|0)+(e[(e[t+4>>2]|0)+12>>2]|0);return}h=ee(e[(e[t+4>>2]|0)+16>>2]|0,o)|0,d=t+20|0,as(t,r,e[d>>2]|0,o,l),t=e[c>>2]|0,(Yt[e[(e[t>>2]|0)+48>>2]&63](t,e[d>>2]|0,h)|0)!=(h|0)&&(c=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,Q|0)|0,bt(8)),g=0,xe(7,c|0,3,35648),d=g,g=0,d&1?(d=j()|0,Tt(c|0),le(d|0)):Qt(c|0,824,96))}function E1(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0;if(c=e[t+36>>2]|0,c){D1(t,c,r,o,l);return}else{c=t+40|0,jn(t,e[c>>2]|0,r,o,l),e[c>>2]=(e[c>>2]|0)+(e[(e[t+4>>2]|0)+12>>2]|0);return}}function jn(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0;if(w=t+4|0,h=e[w>>2]|0,!(S[h+32>>0]|0))w=r;else{if(d=t+8|0,o0(e[d>>2]|0,r|0,l*3|0)|0,h=e[w>>2]|0,r=e[h+16>>2]|0,(l|0)>0){for(h=e[d>>2]|0,t=0;C=h+2|0,D=S[h>>0]|0,S[h>>0]=S[C>>0]|0,S[C>>0]=D,t=t+1|0,(t|0)!=(l|0);)h=h+r|0;h=e[w>>2]|0}w=e[d>>2]|0}switch(e[h+16>>2]|0){case 3:{if((e[h+24>>2]|0)==2){if((l|0)>0)h=0;else return;do c=S[w+(h*3|0)+1>>0]|0,d=c&255,C=128-d+(F[w+(h*3|0)+2>>0]|0)&255,D=o+(h*3|0)|0,S[D>>0]=(F[w+(h*3|0)>>0]|0)+128-d,S[D+1>>0]=c,S[D+2>>0]=C,h=h+1|0;while((h|0)!=(l|0));return}if(h=(c|0)<(l|0)?c:l,(h|0)<=0)return;t=c<<1,r=0;do C=S[w+(r*3|0)+1>>0]|0,l=C&255,D=128-l+(F[w+(r*3|0)+2>>0]|0)&255,S[o+r>>0]=(F[w+(r*3|0)>>0]|0)+128-l,S[o+(r+c)>>0]=C,S[o+(r+t)>>0]=D,r=r+1|0;while((r|0)!=(h|0));return}case 4:{if((e[h+24>>2]|0)!=1||(h=(c|0)<(l|0)?c:l,(h|0)<=0))return;t=c<<1,r=c*3|0,d=0;do l=S[w+(d<<2)+1>>0]|0,D=S[w+(d<<2)+3>>0]|0,k=l&255,C=128-k+(F[w+(d<<2)+2>>0]|0)&255,S[o+d>>0]=(F[w+(d<<2)>>0]|0)+128-k,S[o+(d+c)>>0]=l,S[o+(d+t)>>0]=C,S[o+(d+r)>>0]=D,d=d+1|0;while((d|0)!=(h|0));return}default:return}}function D1(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0;if(k=b,b=b+176|0,N=k+152|0,_=k+16|0,R=k,d=ee(e[(e[t+4>>2]|0)+16>>2]|0,l)|0,C=t+20|0,h=e[C>>2]|0,!d){_=h,jn(t,_,o,l,c),b=k;return}for(;w=Yt[e[(e[r>>2]|0)+32>>2]&63](r,h,d)|0,!!w;)if(h=e[C>>2]|0,(d|0)==(w|0)){D=26;break}else d=d-w|0;if((D|0)==26){jn(t,h,o,l,c),b=k;return}o=_+56|0,C=_+4|0,e[_>>2]=36160,e[o>>2]=36180,g=0,Ae(62,_+56|0,C|0),k=g,g=0,k&1&&(_=j()|0,tt(o),le(_|0)),e[_+128>>2]=0,e[_+132>>2]=-1,e[_>>2]=36200,e[_+56>>2]=36220,g=0,ue(180,C|0),k=g,g=0;do if(k&1)h=j()|0;else{if(e[C>>2]=36236,r=_+36|0,e[r>>2]=0,e[r+4>>2]=0,e[r+8>>2]=0,e[r+12>>2]=0,e[_+52>>2]=16,e[N>>2]=0,e[N+4>>2]=0,e[N+8>>2]=0,g=0,Ae(63,C|0,N|0),k=g,g=0,k&1){h=j()|0,de(N),de(r),wt(C);break}de(N),g=0,h=Ve(28,_|0,49029,57)|0,N=g,g=0,!(N&1)&&(g=0,be(36,h|0,0)|0,N=g,g=0,!(N&1))&&(w=Ct(16)|0,g=0,Ae(64,R|0,C|0),N=g,g=0,N&1?h=j()|0:(!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,Q|0)|0,bt(8)),g=0,$e(36,w|0,3,35648,R|0),N=g,g=0,N&1?d=1:(g=0,xe(6,w|0,824,96),g=0,d=0),h=j()|0,de(R),d||(R=h,e[_>>2]=36200,e[o>>2]=36220,e[C>>2]=36236,de(r),wt(C),tt(o),le(R|0))),Tt(w|0),R=h,e[_>>2]=36200,e[o>>2]=36220,e[C>>2]=36236,de(r),wt(C),tt(o),le(R|0)),R=j()|0,e[_>>2]=36200,e[o>>2]=36220,e[C>>2]=36236,de(r),wt(C),tt(o),le(R|0)}while(!1);_=h,tt(o),le(_|0)}function as(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0;C=t+4|0,t=e[C>>2]|0;e:do switch(e[t+16>>2]|0){case 3:{if((e[t+24>>2]|0)==2){if((l|0)>0)t=0;else break e;for(;;)if(d=S[r+(t*3|0)+1>>0]|0,h=d&255,w=h+128+(F[r+(t*3|0)+2>>0]|0)&255,c=o+(t*3|0)|0,S[c>>0]=(F[r+(t*3|0)>>0]|0)+128+h,S[c+1>>0]=d,S[c+2>>0]=w,t=t+1|0,(t|0)==(l|0))break e}if(t=(l|0)<(c|0)?l:c,(t|0)>0){h=c<<1,d=0;do k=S[r+(d+c)>>0]|0,N=k&255,D=N+128+(F[r+(d+h)>>0]|0)&255,w=o+(d*3|0)|0,S[w>>0]=(F[r+d>>0]|0)+128+N,S[w+1>>0]=k,S[w+2>>0]=D,d=d+1|0;while((d|0)!=(t|0))}break}case 4:{if((e[t+24>>2]|0)==1&&(w=(l|0)<(c|0)?l:c,(w|0)>0)){t=c<<1,h=c*3|0,d=0;do k=F[r+(d+c)>>0]|0,N=o+(d<<2)|0,k=(F[r+d>>0]|0)+128+k&255|k<<8|F[r+(d+h)>>0]<<24|k+128+(F[r+(d+t)>>0]|0)<<16&16711680,S[N>>0]=k,S[N+1>>0]=k>>8,S[N+2>>0]=k>>16,S[N+3>>0]=k>>24,d=d+1|0;while((d|0)!=(w|0))}break}default:}while(!1);if(t=e[C>>2]|0,!!(S[t+32>>0]|0)){if(d=e[t+16>>2]|0,(l|0)>0)t=o,h=0;else return;for(;N=t+2|0,k=S[t>>0]|0,S[t>>0]=S[N>>0]|0,S[N>>0]=k,h=h+1|0,(h|0)!=(l|0);)t=t+d|0}}function b1(t){t=t|0;var r=0,o=0;e[t>>2]=36712,r=e[t+20>>2]|0,r&&(o=t+24|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),o=e[t+8>>2]|0,o&&(r=t+12|0,(e[r>>2]|0)!=(o|0)&&(e[r>>2]=o),he(o))}function N1(t){t=t|0;var r=0,o=0;if(e[t>>2]=36712,r=e[t+20>>2]|0,r&&(o=t+24|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),r=e[t+8>>2]|0,!r){he(t);return}o=t+12|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r),he(t)}function F1(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0;if(c=t+36|0,!(e[c>>2]|0)){c=t+40|0,ls(t,r,e[c>>2]|0,o,l),e[c>>2]=(e[c>>2]|0)+(e[(e[t+4>>2]|0)+12>>2]|0);return}h=ee(e[(e[t+4>>2]|0)+16>>2]|0,o)|0,d=t+20|0,ls(t,r,e[d>>2]|0,o,l),t=e[c>>2]|0,(Yt[e[(e[t>>2]|0)+48>>2]&63](t,e[d>>2]|0,h)|0)!=(h|0)&&(c=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,Q|0)|0,bt(8)),g=0,xe(7,c|0,3,35648),d=g,g=0,d&1?(d=j()|0,Tt(c|0),le(d|0)):Qt(c|0,824,96))}function R1(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0;if(c=e[t+36>>2]|0,c){M1(t,c,r,o,l);return}else{c=t+40|0,Xn(t,e[c>>2]|0,r,o,l),e[c>>2]=(e[c>>2]|0)+(e[(e[t+4>>2]|0)+12>>2]|0);return}}function Xn(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0;if(w=t+4|0,h=e[w>>2]|0,!(S[h+32>>0]|0))w=r;else{if(d=t+8|0,o0(e[d>>2]|0,r|0,l*3|0)|0,h=e[w>>2]|0,r=e[h+16>>2]|0,(l|0)>0){for(h=e[d>>2]|0,t=0;C=h+2|0,D=S[h>>0]|0,S[h>>0]=S[C>>0]|0,S[C>>0]=D,t=t+1|0,(t|0)!=(l|0);)h=h+r|0;h=e[w>>2]|0}w=e[d>>2]|0}switch(e[h+16>>2]|0){case 3:{if((e[h+24>>2]|0)==2){if((l|0)>0)h=0;else return;do c=S[w+(h*3|0)+1>>0]|0,C=S[w+(h*3|0)+2>>0]|0,D=o+(h*3|0)|0,S[D>>0]=S[w+(h*3|0)>>0]|0,S[D+1>>0]=c,S[D+2>>0]=C,h=h+1|0;while((h|0)!=(l|0));return}if(h=(c|0)<(l|0)?c:l,(h|0)<=0)return;t=c<<1,r=0;do C=S[w+(r*3|0)+1>>0]|0,D=S[w+(r*3|0)+2>>0]|0,S[o+r>>0]=S[w+(r*3|0)>>0]|0,S[o+(r+c)>>0]=C,S[o+(r+t)>>0]=D,r=r+1|0;while((r|0)!=(h|0));return}case 4:{if((e[h+24>>2]|0)!=1||(h=(c|0)<(l|0)?c:l,(h|0)<=0))return;t=c<<1,r=c*3|0,d=0;do l=S[w+(d<<2)+1>>0]|0,C=S[w+(d<<2)+2>>0]|0,D=S[w+(d<<2)+3>>0]|0,S[o+d>>0]=S[w+(d<<2)>>0]|0,S[o+(d+c)>>0]=l,S[o+(d+t)>>0]=C,S[o+(d+r)>>0]=D,d=d+1|0;while((d|0)!=(h|0));return}default:return}}function M1(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0;if(k=b,b=b+176|0,N=k+152|0,_=k+16|0,R=k,d=ee(e[(e[t+4>>2]|0)+16>>2]|0,l)|0,C=t+20|0,h=e[C>>2]|0,!d){_=h,Xn(t,_,o,l,c),b=k;return}for(;w=Yt[e[(e[r>>2]|0)+32>>2]&63](r,h,d)|0,!!w;)if(h=e[C>>2]|0,(d|0)==(w|0)){D=26;break}else d=d-w|0;if((D|0)==26){Xn(t,h,o,l,c),b=k;return}o=_+56|0,C=_+4|0,e[_>>2]=36160,e[o>>2]=36180,g=0,Ae(62,_+56|0,C|0),k=g,g=0,k&1&&(_=j()|0,tt(o),le(_|0)),e[_+128>>2]=0,e[_+132>>2]=-1,e[_>>2]=36200,e[_+56>>2]=36220,g=0,ue(180,C|0),k=g,g=0;do if(k&1)h=j()|0;else{if(e[C>>2]=36236,r=_+36|0,e[r>>2]=0,e[r+4>>2]=0,e[r+8>>2]=0,e[r+12>>2]=0,e[_+52>>2]=16,e[N>>2]=0,e[N+4>>2]=0,e[N+8>>2]=0,g=0,Ae(63,C|0,N|0),k=g,g=0,k&1){h=j()|0,de(N),de(r),wt(C);break}de(N),g=0,h=Ve(28,_|0,49029,57)|0,N=g,g=0,!(N&1)&&(g=0,be(36,h|0,0)|0,N=g,g=0,!(N&1))&&(w=Ct(16)|0,g=0,Ae(64,R|0,C|0),N=g,g=0,N&1?h=j()|0:(!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,Q|0)|0,bt(8)),g=0,$e(36,w|0,3,35648,R|0),N=g,g=0,N&1?d=1:(g=0,xe(6,w|0,824,96),g=0,d=0),h=j()|0,de(R),d||(R=h,e[_>>2]=36200,e[o>>2]=36220,e[C>>2]=36236,de(r),wt(C),tt(o),le(R|0))),Tt(w|0),R=h,e[_>>2]=36200,e[o>>2]=36220,e[C>>2]=36236,de(r),wt(C),tt(o),le(R|0)),R=j()|0,e[_>>2]=36200,e[o>>2]=36220,e[C>>2]=36236,de(r),wt(C),tt(o),le(R|0)}while(!1);_=h,tt(o),le(_|0)}function ls(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0;C=t+4|0,t=e[C>>2]|0;e:do switch(e[t+16>>2]|0){case 3:{if((e[t+24>>2]|0)==2){if((l|0)>0)t=0;else break e;for(;;)if(d=S[r+(t*3|0)+1>>0]|0,w=S[r+(t*3|0)+2>>0]|0,c=o+(t*3|0)|0,S[c>>0]=S[r+(t*3|0)>>0]|0,S[c+1>>0]=d,S[c+2>>0]=w,t=t+1|0,(t|0)==(l|0))break e}if(t=(l|0)<(c|0)?l:c,(t|0)>0){h=c<<1,d=0;do k=S[r+(d+c)>>0]|0,D=S[r+(d+h)>>0]|0,w=o+(d*3|0)|0,S[w>>0]=S[r+d>>0]|0,S[w+1>>0]=k,S[w+2>>0]=D,d=d+1|0;while((d|0)!=(t|0))}break}case 4:{if((e[t+24>>2]|0)==1&&(w=(l|0)<(c|0)?l:c,(w|0)>0)){t=c<<1,h=c*3|0,d=0;do k=o+(d<<2)|0,D=F[r+(d+c)>>0]<<8|F[r+d>>0]|F[r+(d+t)>>0]<<16|F[r+(d+h)>>0]<<24,S[k>>0]=D,S[k+1>>0]=D>>8,S[k+2>>0]=D>>16,S[k+3>>0]=D>>24,d=d+1|0;while((d|0)!=(w|0))}break}default:}while(!1);if(t=e[C>>2]|0,!!(S[t+32>>0]|0)){if(d=e[t+16>>2]|0,(l|0)>0)t=o,h=0;else return;for(;k=t+2|0,D=S[t>>0]|0,S[t>>0]=S[k>>0]|0,S[k>>0]=D,h=h+1|0,(h|0)!=(l|0);)t=t+d|0}}function us(t){t=t|0;var r=0,o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0,G=0,$=0,P=0,O=0;K=b,b=b+32|0,$=K+12|0,H=K,R=t+180|0,_=(e[R>>2]|0)+4|0,(e[t+32>>2]|0)==1?U=e[t+24>>2]|0:U=1,r=ee(U<<1,_)|0,e[$>>2]=0,P=$+4|0,e[P>>2]=0,e[$+8>>2]=0;e:do if(r){if(r>>>0>1431655765&&(g=0,ue(178,$|0),G=g,g=0,G&1)||(h=6),(h|0)==6&&(g=0,o=ge(67,r*3|0)|0,G=g,g=0,!(G&1))){for(e[P>>2]=o,e[$>>2]=o,e[$+8>>2]=o+(r*3|0);;)if(S[o>>0]=0,S[o+1>>0]=0,S[o+2>>0]=0,o=(e[P>>2]|0)+3|0,e[P>>2]=o,r=r+-1|0,!r)break e}l=j()|0,r=e[$>>2]|0,r||le(l|0),o=e[P>>2]|0,(o|0)!=(r|0)&&(e[P>>2]=o+(~(((o+-3-r|0)>>>0)/3|0)*3|0)),he(r),le(l|0)}while(!1);e[H>>2]=0,G=H+4|0,e[G>>2]=0,e[H+8>>2]=0;do if(!U)h=19;else{if(U>>>0>1073741823&&(g=0,ue(178,H|0),N=g,g=0,N&1)||(h=17),(h|0)==17&&(l=U<<2,g=0,c=ge(67,l|0)|0,N=g,g=0,!(N&1))){e[H>>2]=c,h=c+(U<<2)|0,e[H+8>>2]=h,Jt(c|0,0,l|0)|0,e[G>>2]=h,h=19;break}l=j()|0,r=e[H>>2]|0,o=r,r&&(c=e[G>>2]|0,(c|0)!=(r|0)&&(e[G>>2]=c+(~((c+-4-o|0)>>>2)<<2)),he(r))}while(!1);if((h|0)==19){c=t+12|0;e:do if((e[c>>2]|0)>0){h=t+4604|0,d=(ee(U,_)|0)+1|0,w=t+4608|0,C=t+92|0,D=(U|0)>0,k=t+4600|0,N=0;t:for(;;){if(l=e[$>>2]|0,r=l+3|0,e[h>>2]=r,o=l+(d*3|0)|0,e[w>>2]=o,N&1?(e[h>>2]=o,e[w>>2]=r,r=1):r=d,o=e[C>>2]|0,g=0,$e(e[(e[o>>2]|0)+12>>2]|0,o|0,l+(r*3|0)|0,e[R>>2]|0,_|0),l=g,g=0,l&1){h=29;break}if(D){r=e[H>>2]|0,o=e[h>>2]|0,l=0;do{if(e[k>>2]=e[r+(l<<2)>>2],O=e[R>>2]|0,r=o+(O*3|0)|0,o=o+((O+-1|0)*3|0)|0,S[r>>0]=S[o>>0]|0,S[r+1>>0]=S[o+1>>0]|0,S[r+2>>0]=S[o+2>>0]|0,r=e[h>>2]|0,o=(e[w>>2]|0)+-3|0,S[o>>0]=S[r>>0]|0,S[o+1>>0]=S[r+1>>0]|0,S[o+2>>0]=S[r+2>>0]|0,g=0,Ae(70,t|0,0),o=g,g=0,o&1){h=28;break t}r=e[H>>2]|0,e[r+(l<<2)>>2]=e[k>>2],o=(e[h>>2]|0)+(_*3|0)|0,e[h>>2]=o,e[w>>2]=(e[w>>2]|0)+(_*3|0),l=l+1|0}while((l|0)<(U|0))}if(N=N+1|0,(N|0)>=(e[c>>2]|0)){h=41;break e}}if((h|0)==28){l=j()|0;break}else if((h|0)==29){l=j()|0;break}}else h=41;while(!1);do if((h|0)==41){if(g=0,ue(182,t|0),O=g,g=0,O&1){l=j()|0;break}if(r=e[H>>2]|0,o=r,r&&(l=e[G>>2]|0,(l|0)!=(r|0)&&(e[G>>2]=l+(~((l+-4-o|0)>>>2)<<2)),he(r)),r=e[$>>2]|0,!r){b=K;return}o=e[P>>2]|0,(o|0)!=(r|0)&&(e[P>>2]=o+(~(((o+-3-r|0)>>>0)/3|0)*3|0)),he(r),b=K;return}while(!1);r=e[H>>2]|0,o=r,r&&(c=e[G>>2]|0,(c|0)!=(r|0)&&(e[G>>2]=c+(~((c+-4-o|0)>>>2)<<2)),he(r))}r=e[$>>2]|0,r||le(l|0),o=e[P>>2]|0,(o|0)!=(r|0)&&(e[P>>2]=o+(~(((o+-3-r|0)>>>0)/3|0)*3|0)),he(r),le(l|0)}function _1(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0,ce=0,ke=0;if(oe=t+180|0,!((e[oe>>2]|0)<=0))for(ne=t+4608|0,ce=t+4604|0,ke=t+4612|0,ie=0;P=ie+-1|0,h=e[ne>>2]|0,d=e[ce>>2]|0,r=ie+1|0,c=F[d+(ie*3|0)>>0]|0,Z=e[ke>>2]|0,w=F[d+(P*3|0)>>0]|0,C=c-w|0,D=F[h+(P*3|0)>>0]|0,k=w-D|0,N=((((S[Z+((F[d+(r*3|0)>>0]|0)-c)>>0]|0)*9|0)+(S[Z+C>>0]|0)|0)*9|0)+(S[Z+k>>0]|0)|0,l=F[d+(ie*3|0)+1>>0]|0,R=F[d+(P*3|0)+1>>0]|0,_=l-R|0,U=F[h+(P*3|0)+1>>0]|0,H=R-U|0,K=((((S[Z+((F[d+(r*3|0)+1>>0]|0)-l)>>0]|0)*9|0)+(S[Z+_>>0]|0)|0)*9|0)+(S[Z+H>>0]|0)|0,o=F[d+(ie*3|0)+2>>0]|0,G=F[d+(P*3|0)+2>>0]|0,$=o-G|0,P=F[h+(P*3|0)+2>>0]|0,O=G-P|0,Z=((((S[Z+((F[d+(r*3|0)+2>>0]|0)-o)>>0]|0)*9|0)+(S[Z+$>>0]|0)|0)*9|0)+(S[Z+O>>0]|0)|0,K|N|Z?(d=F[h+(ie*3|0)>>0]|0,h=c-D>>31,(h^k|0)>=0&&((h^C|0)<0?c=D:c=D-w+c|0),d=Zn(t,N,d,c,0)|0,h=F[(e[ne>>2]|0)+(ie*3|0)+1>>0]|0,c=l-U>>31,(c^H|0)>=0&&((c^_|0)<0?l=U:l=U-R+l|0),c=Zn(t,K,h,l,0)|0,h=F[(e[ne>>2]|0)+(ie*3|0)+2>>0]|0,l=o-P>>31,(l^O|0)>=0&&((l^$|0)<0?o=P:o=P-G+o|0),Z=Zn(t,Z,h,o,0)|0,ie=(e[ne>>2]|0)+(ie*3|0)|0,S[ie>>0]=d,S[ie+1>>0]=c,S[ie+2>>0]=Z):r=(P1(t,ie,0)|0)+ie|0,(r|0)<(e[oe>>2]|0);)ie=r}function P1(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0;for(oe=b,b=b+32|0,ie=oe+15|0,R=oe+12|0,N=oe+9|0,_=oe+6|0,$=oe+3|0,P=oe,O=(e[t+180>>2]|0)-r|0,Z=e[t+4608>>2]|0,U=e[t+4604>>2]|0,G=Z+((r+-1|0)*3|0)|0,H=S[G>>0]|0,K=S[G+1>>0]|0,G=S[G+2>>0]|0,o=H&255,l=t+144|0,c=K&255,h=G&255,k=0;d=Z+((k+r|0)*3|0)|0,w=d+1|0,C=d+2|0,ne=(F[d>>0]|0)-o|0,D=e[l>>2]|0,!((((ne|0)>-1?ne:0-ne|0)|0)>(D|0)||(ne=(F[w>>0]|0)-c|0,(((ne|0)>-1?ne:0-ne|0)|0)>(D|0))||(ne=(F[C>>0]|0)-h|0,(((ne|0)>-1?ne:0-ne|0)|0)>(D|0)));)if(S[d>>0]=H,S[w>>0]=K,S[C>>0]=G,k=k+1|0,(k|0)==(O|0)){k=O;break}if(c=(k|0)==(O|0),h=t+4600|0,l=e[36476+(e[h>>2]<<2)>>2]|0,(1<(k|0))o=k;else{o=k;do _t(t,1,1),l=e[h>>2]|0,o=o-(1<>2])|0,l=(l|0)>30?31:l+1|0,e[h>>2]=l,l=e[36476+(l<<2)>>2]|0;while((o|0)>=(1<>0]=S[ne>>0]|0,S[$+1>>0]=S[ne+1>>0]|0,S[$+2>>0]=S[ne+2>>0]|0,S[P>>0]=H,S[P+1>>0]=K,S[P+2>>0]=G,r=U+(r*3|0)|0,S[N>>0]=S[$>>0]|0,S[N+1>>0]=S[$+1>>0]|0,S[N+2>>0]=S[$+2>>0]|0,S[R>>0]=S[P>>0]|0,S[R+1>>0]=S[P+1>>0]|0,S[R+2>>0]=S[P+2>>0]|0,S[ie>>0]=S[r>>0]|0,S[ie+1>>0]=S[r+1>>0]|0,S[ie+2>>0]=S[r+2>>0]|0,L1(_,t,N,R,ie),S[ne>>0]=S[_>>0]|0,S[ne+1>>0]=S[_+1>>0]|0,S[ne+2>>0]=S[_+2>>0]|0,ne=e[h>>2]|0,e[h>>2]=(ne|0)<1?0:ne+-1|0,ne=k+1|0,b=oe,ne|0)}function Zn(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0;if(H=r>>31,h=(H^r)-H|0,_=t+196+(h*12|0)+10|0,d=I[_>>1]|0,R=t+196+(h*12|0)|0,c=e[R>>2]|0,(d|0)<(c|0))if((d<<1|0)<(c|0))if((d<<2|0)<(c|0))if((d<<3|0)<(c|0))if((d<<4|0)<(c|0))for(r=5;(d<>1]^H)-H+l|0,U=t+136|0,l=e[U>>2]|0,(c&l|0)==(c|0)?D=c:D=l&~(c>>31),c=(o-D^H)-H|0,C=t+144|0,l=e[C>>2]|0,(c|0)>0?c=(c+l|0)/(l<<1|1|0)|0:c=(c-l|0)/(l<<1|1|0)|0,N=t+140|0,w=e[N>>2]|0,o=((c|0)<0?w:0)+c|0,w=o-((o|0)<((w+1|0)/2|0|0)?0:w)|0,h=t+196+(h*12|0)+4|0,l|r?c=0:c=(e[h>>2]<<1)+-1+d>>31,l=c^w,cs(t,r,l>>30^l<<1,e[t+156>>2]|0),l=e[t+160>>2]|0,r=(e[R>>2]|0)+((w|0)>-1?w:0-w|0)|0,c=(e[h>>2]|0)+(ee(e[C>>2]<<1|1,w)|0)|0,o=I[_>>1]|0,(o|0)==(l|0)&&(r=r>>1,c=c>>1,o=l>>1),e[R>>2]=r,l=o+1|0,I[_>>1]=l,r=l+c|0,(r|0)>=1?(c|0)>0&&(c=c-l|0,_=I[k>>1]|0,I[k>>1]=(_<<16>>16<127&1)+(_&65535),c=(c|0)>0?0:c):(c=I[k>>1]|0,I[k>>1]=(c&65535)-(c<<16>>16>-128&1),c=(r|0)>(~o|0)?r:0-o|0),e[h>>2]=c,l=e[C>>2]|0,o=l<<1|1,r=(ee(o,(w^H)-H|0)|0)+D|0,(r|0)>=(0-l|0)?(c=e[U>>2]|0,(c+l|0)<(r|0)&&(r=r-(ee(e[N>>2]|0,o)|0)|0)):(r=(ee(e[N>>2]|0,o)|0)+r|0,c=e[U>>2]|0),(r&c|0)==(r|0)?(H=r,H=H&255,H|0):(H=c&~(r>>31),H=H&255,H|0)}function cs(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0;if(c=o>>r,h=t+148|0,d=l-(e[h>>2]|0)|0,(c|0)<(d+-1|0)){(c|0)>30&&(l=(c|0)/2|0,_t(t,0,l),c=c-l|0),_t(t,1,c+1|0),_t(t,(1<31?(_t(t,0,31),_t(t,1,l+-31-(e[h>>2]|0)|0)):_t(t,1,d),r=e[h>>2]|0,_t(t,(1<>0]|0,R=N-(F[l>>0]|0)>>31|1,h=ee(R,(F[o>>0]|0)-N|0)|0,D=r+144|0,d=e[D>>2]|0,(h|0)>0?h=(h+d|0)/(d<<1|1|0)|0:h=(h-d|0)/(d<<1|1|0)|0,P=r+140|0,C=e[P>>2]|0,w=((h|0)<0?C:0)+h|0,C=w-((w|0)<((C+1|0)/2|0|0)?0:C)|0,w=r+4576|0,Jn(r,w,C),K=F[c+1>>0]|0,G=K-(F[l+1>>0]|0)>>31|1,h=ee(G,(F[o+1>>0]|0)-K|0)|0,d=e[D>>2]|0,(h|0)>0?h=(h+d|0)/(d<<1|1|0)|0:h=(h-d|0)/(d<<1|1|0)|0,_=e[P>>2]|0,$=((h|0)<0?_:0)+h|0,_=$-(($|0)<((_+1|0)/2|0|0)?0:_)|0,Jn(r,w,_),$=F[c+2>>0]|0,H=$-(F[l+2>>0]|0)>>31|1,h=ee(H,(F[o+2>>0]|0)-$|0)|0,d=e[D>>2]|0,(h|0)>0?h=(h+d|0)/(d<<1|1|0)|0:h=(h-d|0)/(d<<1|1|0)|0,k=e[P>>2]|0,h=((h|0)<0?k:0)+h|0,k=h-((h|0)<((k+1|0)/2|0|0)?0:k)|0,Jn(r,w,k),w=e[D>>2]|0,D=w<<1|1,h=(ee(ee(D,C)|0,R)|0)+N|0,o=0-w|0,(h|0)>=(o|0)?(d=e[U>>2]|0,(d+w|0)<(h|0)&&(h=h-(ee(e[P>>2]|0,D)|0)|0),l=d):(h=(ee(e[P>>2]|0,D)|0)+h|0,l=e[U>>2]|0),(h&l|0)!=(h|0)&&(h=l&~(h>>31)),c=h&255,h=(ee(ee(D,_)|0,G)|0)+K|0,(h|0)>=(o|0)?(l+w|0)<(h|0)&&(h=h-(ee(e[P>>2]|0,D)|0)|0):h=(ee(e[P>>2]|0,D)|0)+h|0,(h&l|0)!=(h|0)&&(h=l&~(h>>31)),d=h&255,h=(ee(ee(D,k)|0,H)|0)+$|0,(h|0)>=(o|0)?(l+w|0)<(h|0)&&(h=h-(ee(e[P>>2]|0,D)|0)|0):h=(ee(e[P>>2]|0,D)|0)+h|0,(h&l|0)==(h|0)){P=h,P=P&255,S[t>>0]=c,$=t+1|0,S[$>>0]=d,t=t+2|0,S[t>>0]=P;return}P=l&~(h>>31),P=P&255,S[t>>0]=c,$=t+1|0,S[$>>0]=d,t=t+2|0,S[t>>0]=P}function Jn(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0;if(k=r+9|0,d=F[k>>0]|0,D=r+4|0,C=e[D>>2]|0,c=(ee(d>>>1,C)|0)+(e[r>>2]|0)|0,(d|0)<(c|0)){h=d,l=0;do h=h<<1,l=l+1|0;while((h|0)<(c|0));c=l}else c=0;(o|0)>0&(c|0)==0&&F[r+10>>0]<<1>>>0>>0?l=1:w=5;do if((w|0)==5){if(l=(o|0)<0,l&&F[r+10>>0]<<1>>>0>=d>>>0){l=1;break}l=l&(c|0)!=0}while(!1);if(l=(((o|0)>-1?o:0-o|0)<<1)-C+(l<<31>>31)|0,cs(t,c,l,(e[t+156>>2]|0)+-1-(e[36476+(e[t+4600>>2]<<2)>>2]|0)|0),(o|0)<0&&(t=r+10|0,S[t>>0]=(F[t>>0]|0)+1),l=(l+1-(e[D>>2]|0)>>1)+(e[r>>2]|0)|0,e[r>>2]=l,c=S[k>>0]|0,c<<24>>24!=(S[r+8>>0]|0)){r=c,r=r&255,r=r+1|0,r=r&255,S[k>>0]=r;return}e[r>>2]=l>>1,t=(c&255)>>>1,S[k>>0]=t,r=r+10|0,S[r>>0]=(F[r>>0]|0)>>>1,r=t,r=r&255,r=r+1|0,r=r&255,S[k>>0]=r}function O1(t){t=t|0;var r=0,o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0;R=b,b=b+32|0,l=R,N=t+144|0;e:do if(e[N>>2]|0)r=t+152|0;else if(o=e[t+136>>2]|0,r=t+152|0,(o|0)==((1<>2])+-1|0)&&(m0(l,o,0),(e[l+4>>2]|0)==(e[t+184>>2]|0))&&(e[l+8>>2]|0)==(e[t+188>>2]|0)&&(e[l+12>>2]|0)==(e[t+192>>2]|0))switch(e[r>>2]|0){case 8:{N=e[8900]|0,e[t+4612>>2]=N+(((e[8901]|0)-N|0)>>>1),b=R;return}case 10:{N=e[8903]|0,e[t+4612>>2]=N+(((e[8904]|0)-N|0)>>>1),b=R;return}case 12:{N=e[8906]|0,e[t+4612>>2]=N+(((e[8907]|0)-N|0)>>>1),b=R;return}case 16:{N=e[8909]|0,e[t+4612>>2]=N+(((e[8910]|0)-N|0)>>>1),b=R;return}default:break e}while(!1);if(k=1<>2],o=t+4616|0,l=k<<1,c=t+4620|0,h=e[c>>2]|0,r=e[o>>2]|0,d=h-r|0,l>>>0<=d>>>0?l>>>0>>0&&(w=r+l|0,(h|0)!=(w|0))&&(e[c>>2]=w):(j0(o,l-d|0),r=e[o>>2]|0),D=t+4612|0,e[D>>2]=r+k,r=0-k|0,(k|0)<=(r|0)){b=R;return}w=t+192|0,C=t+188|0,d=t+184|0,h=r;do r=e[w>>2]|0,(h|0)>(0-r|0)?(o=e[C>>2]|0,(h|0)>(0-o|0)?(l=e[d>>2]|0,(h|0)>(0-l|0)?(c=e[N>>2]|0,(h|0)>=(0-c|0)?(c|0)<(h|0)?(l|0)<=(h|0)?(o|0)>(h|0)?r=2:r=(r|0)>(h|0)?3:4:r=1:r=0:r=-1):r=-2):r=-3):r=-4,S[(e[D>>2]|0)+h>>0]=r,h=h+1|0;while((h|0)!=(k|0));b=R}function $1(t){t=t|0;var r=0,o=0;e[t>>2]=35996,r=e[t+4592>>2]|0,r&&(o=t+4596|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),e[t>>2]=36612,r=e[t+120>>2]|0,r&&(o=t+124|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),o=t+92|0,r=e[o>>2]|0,e[o>>2]=0,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r),t=t+4|0,r=e[t>>2]|0,e[t>>2]=0,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r)}function B1(t){t=t|0;var r=0,o=0;if(e[t>>2]=35996,r=e[t+4592>>2]|0,r&&(o=t+4596|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),e[t>>2]=36612,r=e[t+120>>2]|0,r&&(o=t+124|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),o=t+92|0,r=e[o>>2]|0,e[o>>2]=0,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r),o=t+4|0,r=e[o>>2]|0,e[o>>2]=0,!r){he(t);return}Mt[e[(e[r>>2]|0)+4>>2]&255](r),he(t)}function V1(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0;c=b,b=b+32|0,w=c,m0(w,65535,0),d=e[r+4>>2]|0,h=e[r+8>>2]|0,h=h|0?h:e[w+8>>2]|0,l=e[r+12>>2]|0,l=l|0?l:e[w+12>>2]|0,r=e[r+16>>2]|0,o=e[w+16>>2]|0,e[t+160>>2]=d|0?d:e[w+4>>2]|0,e[t+164>>2]=h,e[t+168>>2]=l,Q1(t),l=0;do e[t+172+(l*12|0)>>2]=1024,e[t+172+(l*12|0)+4>>2]=0,I[t+172+(l*12|0)+8>>1]=0,I[t+172+(l*12|0)+10>>1]=1,l=l+1|0;while((l|0)!=365);w=(r|0?r:o)&255,e[t+4552>>2]=1024,e[t+4556>>2]=0,S[t+4560>>0]=w,S[t+4561>>0]=1,S[t+4562>>0]=0,e[t+4564>>2]=1024,e[t+4568>>2]=1,S[t+4572>>0]=w,S[t+4573>>0]=1,S[t+4574>>0]=0,e[t+4576>>2]=0,b=c}function U1(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0,D=0,k=0;if(k=b,b=b+16|0,C=k,w=t+92|0,d=e[r>>2]|0,e[r>>2]=0,r=e[w>>2]|0,e[w>>2]=d,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r),e[C>>2]=0,e[C+4>>2]=l,w=o+8|0,e[C+8>>2]=e[w>>2],l){r=Xe(4600)|0,l=t+8|0,c=r+4|0,h=l,d=c+84|0;do e[c>>2]=e[h>>2],c=c+4|0,h=h+4|0;while((c|0)<(d|0));c=r+88|0,d=c+40|0;do e[c>>2]=0,c=c+4|0;while((c|0)<(d|0));e[r>>2]=35772,c=r+132|0,e[c>>2]=0,e[c+4>>2]=0,e[c+8>>2]=0,e[c+12>>2]=0,e[r+148>>2]=e[l>>2],e[r+152>>2]=0,e[r+156>>2]=0,e[r+160>>2]=0,c=r+4544|0,l=r+164|0;do e[l>>2]=0,e[l+4>>2]=0,I[l+8>>1]=0,I[l+10>>1]=1,l=l+12|0;while((l|0)!=(c|0));h=t+4|0,e[c>>2]=0,e[c+4>>2]=0,I[c+8>>1]=0,S[c+10>>0]=0,d=r+4556|0,e[d>>2]=0,e[d+4>>2]=0,I[d+8>>1]=0,S[d+10>>0]=0,d=r+4568|0,e[d>>2]=0,e[d+4>>2]=0,e[d+8>>2]=0,e[d+12>>2]=0,e[d+16>>2]=0,e[d+20>>2]=0,e[d+24>>2]=0,S[d+28>>0]=0,e[r+28>>2]|0||(e[r+20>>2]=1),l=e[h>>2]|0,e[h>>2]=r,l&&(Mt[e[(e[l>>2]|0)+4>>2]&255](l),r=e[h>>2]|0),Y0(r,C)}return C=t+100|0,e[C>>2]=32,e[t+96>>2]=0,r=e[o>>2]|0,r?(e[t+132>>2]=r,c=t+120|0,w=t+124|0,l=e[w>>2]|0,r=e[c>>2]|0,h=r,d=l-h|0,d>>>0>=4e3?d>>>0>4e3&&(D=r+4e3|0,(l|0)!=(D|0))&&(e[w>>2]=D,l=D):(vi(c,4e3-d|0),r=e[c>>2]|0,h=r,l=e[w>>2]|0),e[t+108>>2]=h,e[t+104>>2]=l-r,fs(t),D=t+116|0,D=e[D>>2]|0,t=e[C>>2]|0,t=t+-32|0,t=(t|0)/8|0,t=D-t|0,b=k,t|0):(e[t+108>>2]=e[o+4>>2],e[t+104>>2]=e[w>>2],fs(t),D=t+116|0,D=e[D>>2]|0,t=e[C>>2]|0,t=t+-32|0,t=(t|0)/8|0,t=D-t|0,b=k,t|0)}function z1(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0,G=0,$=0,P=0,O=0;if(G=b,b=b+352|0,$=G+328|0,P=G+192|0,o=G+343|0,l=G+342|0,c=G+341|0,h=G+340|0,R=G+176|0,w=G+168|0,C=G+160|0,D=G+152|0,K=G,U=G+136|0,e[t+32>>2]|0&&(e[t+24>>2]|0)!=1){if(_=t+8|0,H=t+36|0,d=e[H>>2]|0,!d){if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[o>>0]|0,$e(37,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}if(t=e[t+16>>2]|0,(t|0)==16)switch(d|0){case 1:{if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[l>>0]|0,$e(38,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 2:{if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[c>>0]|0,$e(39,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 3:{if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[h>>0]|0,$e(40,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}default:{d=P+56|0,c=P+4|0,e[P>>2]=36160,e[d>>2]=36180,g=0,Ae(62,P+56|0,c|0),G=g,g=0,G&1&&(O=j()|0,tt(d),le(O|0)),e[P+128>>2]=0,e[P+132>>2]=-1,e[P>>2]=36200,e[P+56>>2]=36220,g=0,ue(180,c|0),G=g,g=0;do if(G&1)t=j()|0;else{if(e[c>>2]=36236,h=P+36|0,e[h>>2]=0,e[h+4>>2]=0,e[h+8>>2]=0,e[h+12>>2]=0,e[P+52>>2]=16,e[$>>2]=0,e[$+4>>2]=0,e[$+8>>2]=0,g=0,Ae(63,c|0,$|0),G=g,g=0,G&1){t=j()|0,de($),de(h),wt(c);break}de($),g=0,t=Ve(28,P|0,49007,21)|0,$=g,g=0;do if(!($&1)&&(g=0,k=be(36,t|0,e[H>>2]|0)|0,$=g,g=0,!($&1))&&(g=0,Ve(28,k|0,50997,18)|0,$=g,g=0,!($&1))){if(l=Ct(16)|0,g=0,Ae(64,R|0,c|0),$=g,g=0,$&1)t=j()|0;else if(!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,Q|0)|0,bt(8)),g=0,$e(36,l|0,9,35648,R|0),$=g,g=0,$&1?o=1:(g=0,xe(6,l|0,824,96),g=0,o=0),t=j()|0,de(R),!o)break;Tt(l|0)}else O=34;while(!1);(O|0)==34&&(t=j()|0),e[P>>2]=36200,e[d>>2]=36220,e[c>>2]=36236,de(h),wt(c),tt(d),O=t,le(O|0)}while(!1);O=t,tt(d),le(O|0)}}switch((t|0)<=8&&(t=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,Q|0)|0,bt(8)),g=0,xe(7,t|0,8,35648),O=g,g=0,O&1||Qt(t|0,824,96),O=j()|0,Tt(t|0),le(O|0)),o=16-t|0,d|0){case 1:{if(t=Xe(60)|0,e[w>>2]=o,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],e[$>>2]=e[w>>2],e[$+4>>2]=e[w+4>>2],$e(41,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 2:{if(t=Xe(60)|0,e[C>>2]=o,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],e[$>>2]=e[C>>2],e[$+4>>2]=e[C+4>>2],$e(42,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 3:{if(t=Xe(60)|0,e[D>>2]=o,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],e[$>>2]=e[D>>2],e[$+4>>2]=e[D+4>>2],$e(43,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}default:{d=K+56|0,c=K+4|0,e[K>>2]=36160,e[d>>2]=36180,g=0,Ae(62,K+56|0,c|0),P=g,g=0,P&1&&(O=j()|0,tt(d),le(O|0)),e[K+128>>2]=0,e[K+132>>2]=-1,e[K>>2]=36200,e[K+56>>2]=36220,g=0,ue(180,c|0),P=g,g=0;do if(P&1)t=j()|0;else{if(e[c>>2]=36236,h=K+36|0,e[h>>2]=0,e[h+4>>2]=0,e[h+8>>2]=0,e[h+12>>2]=0,e[K+52>>2]=16,e[$>>2]=0,e[$+4>>2]=0,e[$+8>>2]=0,g=0,Ae(63,c|0,$|0),P=g,g=0,P&1){t=j()|0,de($),de(h),wt(c);break}de($),g=0,t=Ve(28,K|0,49007,21)|0,P=g,g=0;do if(!(P&1)&&(g=0,N=be(36,t|0,e[H>>2]|0)|0,P=g,g=0,!(P&1))&&(g=0,Ve(28,N|0,50997,18)|0,P=g,g=0,!(P&1))){if(l=Ct(16)|0,g=0,Ae(64,U|0,c|0),P=g,g=0,P&1)t=j()|0;else if(!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,Q|0)|0,bt(8)),g=0,$e(36,l|0,9,35648,U|0),P=g,g=0,P&1?o=1:(g=0,xe(6,l|0,824,96),g=0,o=0),t=j()|0,de(U),!o)break;Tt(l|0)}else O=64;while(!1);(O|0)==64&&(t=j()|0),e[K>>2]=36200,e[d>>2]=36220,e[c>>2]=36236,de(h),wt(c),tt(d),O=t,le(O|0)}while(!1);O=t,tt(d),le(O|0)}}}return o=e[r+4>>2]|0,l=Xe(16)|0,t=e[t+20>>2]|0,o?(e[l>>2]=36108,e[l+4>>2]=o,e[l+8>>2]=2,e[l+12>>2]=t,O=l,b=G,O|0):(O=e[r>>2]|0,e[l>>2]=36132,e[l+4>>2]=O,e[l+8>>2]=2,e[l+12>>2]=t,O=l,b=G,O|0)}function fs(t){t=t|0;var r=0,o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0,G=0,$=0,P=0,O=0;G=b,b=b+32|0,P=G+12|0,K=G,_=t+156|0,U=(e[_>>2]|0)+4|0,(e[t+32>>2]|0)==1?H=e[t+24>>2]|0:H=1,r=ee(H<<1,U)|0,e[P>>2]=0,O=P+4|0,e[O>>2]=0,e[P+8>>2]=0;do if(r){if((r|0)<0&&(g=0,ue(178,P|0),$=g,g=0,$&1)||(d=6),(d|0)==6&&(o=r<<1,g=0,l=ge(67,o|0)|0,$=g,g=0,!($&1))){e[P>>2]=l,$=l+(r<<1)|0,e[P+8>>2]=$,Jt(l|0,0,o|0)|0,e[O>>2]=$;break}l=j()|0,r=e[P>>2]|0,r||le(l|0),o=e[O>>2]|0,(o|0)!=(r|0)&&(e[O>>2]=o+(~((o+-2-r|0)>>>1)<<1)),he(r),le(l|0)}while(!1);e[K>>2]=0,$=K+4|0,e[$>>2]=0,e[K+8>>2]=0;do if(!H)d=18;else{if(H>>>0>1073741823&&(g=0,ue(178,K|0),R=g,g=0,R&1)||(d=16),(d|0)==16&&(c=H<<2,g=0,h=ge(67,c|0)|0,R=g,g=0,!(R&1))){e[K>>2]=h,d=h+(H<<2)|0,e[K+8>>2]=d,Jt(h|0,0,c|0)|0,e[$>>2]=d,d=18;break}l=j()|0,r=e[K>>2]|0,o=r,r&&(c=e[$>>2]|0,(c|0)!=(r|0)&&(e[$>>2]=c+(~((c+-4-o|0)>>>2)<<2)),he(r))}while(!1);if((d|0)==18){h=t+12|0;e:do if((e[h>>2]|0)>0){d=t+4580|0,w=(ee(H,U)|0)+1|0,C=t+4584|0,D=t+92|0,k=(H|0)>0,N=t+4576|0,R=0;t:for(;;){if(o=e[P>>2]|0,r=o+2|0,e[d>>2]=r,o=o+(w<<1)|0,e[C>>2]=o,R&1?(e[d>>2]=o,e[C>>2]=r):r=o,c=e[D>>2]|0,g=0,$e(e[(e[c>>2]|0)+12>>2]|0,c|0,r|0,e[_>>2]|0,U|0),c=g,g=0,c&1){d=28;break}if(k){r=e[d>>2]|0,o=e[C>>2]|0,l=e[K>>2]|0,c=0;do{if(e[N>>2]=e[l+(c<<2)>>2],l=e[_>>2]|0,I[r+(l<<1)>>1]=I[r+(l+-1<<1)>>1]|0,I[o+-2>>1]=I[r>>1]|0,g=0,Ae(71,t|0,0),l=g,g=0,l&1){d=27;break t}l=e[K>>2]|0,e[l+(c<<2)>>2]=e[N>>2],r=(e[d>>2]|0)+(U<<1)|0,e[d>>2]=r,o=(e[C>>2]|0)+(U<<1)|0,e[C>>2]=o,c=c+1|0}while((c|0)<(H|0))}if(R=R+1|0,(R|0)>=(e[h>>2]|0)){d=40;break e}}if((d|0)==27){l=j()|0;break}else if((d|0)==28){l=j()|0;break}}else d=40;while(!1);do if((d|0)==40){if(g=0,ue(182,t|0),t=g,g=0,t&1){l=j()|0;break}if(r=e[K>>2]|0,o=r,r&&(l=e[$>>2]|0,(l|0)!=(r|0)&&(e[$>>2]=l+(~((l+-4-o|0)>>>2)<<2)),he(r)),r=e[P>>2]|0,!r){b=G;return}o=e[O>>2]|0,(o|0)!=(r|0)&&(e[O>>2]=o+(~((o+-2-r|0)>>>1)<<1)),he(r),b=G;return}while(!1);r=e[K>>2]|0,o=r,r&&(c=e[$>>2]|0,(c|0)!=(r|0)&&(e[$>>2]=c+(~((c+-4-o|0)>>>2)<<2)),he(r))}r=e[P>>2]|0,r||le(l|0),o=e[O>>2]|0,(o|0)!=(r|0)&&(e[O>>2]=o+(~((o+-2-r|0)>>>1)<<1)),he(r),le(l|0)}function G1(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0;if(N=t+4580|0,r=e[N>>2]|0,U=t+156|0,!((e[U>>2]|0)<=0))for(R=t+4584|0,_=t+4588|0,c=r,h=M[r+-2>>1]|0,r=M[r>>1]|0,k=0;D=e[R>>2]|0,C=M[D+(k+-1<<1)>>1]|0,l=k+1|0,o=M[c+(l<<1)>>1]|0,w=e[_>>2]|0,d=r-h|0,c=h-C|0,w=((((S[w+(o-r)>>0]|0)*9|0)+(S[w+d>>0]|0)|0)*9|0)+(S[w+c>>0]|0)|0,w?(h=r-C>>31,(h^c|0)<0?c=r:c=C+((h^d|0)<0?0:d)|0,D=q1(t,w,M[D+(k<<1)>>1]|0,c,0)|0,I[(e[R>>2]|0)+(k<<1)>>1]=D):(l=(W1(t,k,0)|0)+k|0,o=e[N>>2]|0,r=M[o+(l+-1<<1)>>1]|0,o=M[o+(l<<1)>>1]|0),!((l|0)>=(e[U>>2]|0));)c=e[N>>2]|0,h=r,r=o,k=l}function q1(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0;if(U=r>>31,C=(U^r)-U|0,_=t+172+(C*12|0)+10|0,d=I[_>>1]|0,R=t+172+(C*12|0)|0,c=e[R>>2]|0,(d|0)<(c|0))if((d<<1|0)<(c|0))if((d<<2|0)<(c|0))if((d<<3|0)<(c|0))if((d<<4|0)<(c|0))for(h=5;(d<>1]^U)-U+l|0,(c&65535|0)==(c|0)?k=c:k=c>>31&65535^65535,w=(o-k^U)-U<<16,D=w>>16,h?c=0:c=(e[t+172+(C*12|0)+4>>2]<<1)+-1+d>>31,l=c^D,l=l>>30^l<<1,c=l>>h,(c|0)<47?((c|0)>30&&(d=(c|0)/2|0,_t(t,0,d),c=c-d|0),_t(t,1,c+1|0),_t(t,l&(1<>1]|0,c=d<<16>>16==64,h=c&1,o=(e[l>>2]|0)+D>>h,d=c?32:d<<16>>16,e[R>>2]=(e[R>>2]|0)+((w|0)>-65536?D:0-D|0)>>h,h=d+1|0,I[_>>1]=h,c=h+o|0,(c|0)<1?(_=I[N>>1]|0,I[N>>1]=(_&65535)-(_<<16>>16>-128&1),_=(c|0)>(~d|0)?c:0-d|0,e[l>>2]=_,U=D^U,r=r>>>31,r=k+r|0,r=r+U|0,r=r&65535,r|0):(o|0)<=0?(_=o,e[l>>2]=_,U=D^U,r=r>>>31,r=k+r|0,r=r+U|0,r=r&65535,r|0):(_=o-h|0,R=I[N>>1]|0,I[N>>1]=(R<<16>>16<127&1)+(R&65535),_=(_|0)>0?0:_,e[l>>2]=_,U=D^U,r=r>>>31,r=k+r|0,r=r+U|0,r=r&65535,r|0)}function W1(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0;for(d=(e[t+156>>2]|0)-r|0,w=e[t+4584>>2]|0,D=e[t+4580>>2]|0,c=I[w+(r+-1<<1)>>1]|0,l=0;;){if(o=w+(l+r<<1)|0,(I[o>>1]|0)!=c<<16>>16){k=l;break}if(I[o>>1]=c,l=l+1|0,(l|0)==(d|0)){k=d;break}}if(h=c&65535,c=(k|0)==(d|0),C=t+4576|0,l=e[36476+(e[C>>2]<<2)>>2]|0,(1<(k|0))o=k;else{o=k;do _t(t,1,1),l=e[C>>2]|0,o=o-(1<>2])|0,l=(l|0)>30?31:l+1|0,e[C>>2]=l,l=e[36476+(l<<2)>>2]|0;while((o|0)>=(1<>1]|0,o=M[D+(o<<1)>>1]|0,D=h-o|0,(((D|0)>-1?D:0-D|0)|0)<1?(o=l-h<<16>>16,hs(t,t+4564|0,o),o=o+h|0):(D=o-h>>31|1,r=(ee(l-o<<16,D)|0)>>16,hs(t,t+4552|0,r),o=(ee(r,D)|0)+o|0),I[c>>1]=o,t=e[C>>2]|0,e[C>>2]=(t|0)<1?0:t+-1|0,t=k+1|0,t|0)}function hs(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0;if(k=r+9|0,d=F[k>>0]|0,D=r+4|0,C=e[D>>2]|0,c=(ee(d>>>1,C)|0)+(e[r>>2]|0)|0,(d|0)<(c|0)){h=d,l=0;do h=h<<1,l=l+1|0;while((h|0)<(c|0));c=l}else c=0;(o|0)>0&(c|0)==0&&F[r+10>>0]<<1>>>0>>0?l=1:w=5;do if((w|0)==5){if(l=(o|0)<0,l&&F[r+10>>0]<<1>>>0>=d>>>0){l=1;break}l=l&(c|0)!=0}while(!1);if(l=(((o|0)>-1?o:0-o|0)<<1)-C+(l<<31>>31)|0,H1(t,c,l,63-(e[36476+(e[t+4576>>2]<<2)>>2]|0)|0),(o|0)<0&&(t=r+10|0,S[t>>0]=(F[t>>0]|0)+1),l=(l+1-(e[D>>2]|0)>>1)+(e[r>>2]|0)|0,e[r>>2]=l,c=S[k>>0]|0,c<<24>>24!=(S[r+8>>0]|0)){r=c,r=r&255,r=r+1|0,r=r&255,S[k>>0]=r;return}e[r>>2]=l>>1,t=(c&255)>>>1,S[k>>0]=t,r=r+10|0,S[r>>0]=(F[r>>0]|0)>>>1,r=t,r=r&255,r=r+1|0,r=r&255,S[k>>0]=r}function H1(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0;if(c=o>>r,h=l+-16|0,(c|0)<(l+-17|0)){(c|0)>30&&(l=(c|0)/2|0,_t(t,0,l),c=c-l|0),_t(t,1,c+1|0),_t(t,(1<31?(_t(t,0,31),_t(t,1,l+-47|0)):_t(t,1,h),_t(t,o+65535&65535,16)}function Q1(t){t=t|0;var r=0,o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0;if(D=b,b=b+32|0,w=D,m0(w,65535,0),C=t+160|0,(e[w+4>>2]|0)==(e[C>>2]|0)&&(e[w+8>>2]|0)==(e[t+164>>2]|0)&&(e[w+12>>2]|0)==(e[t+168>>2]|0)){C=e[8909]|0,e[t+4588>>2]=C+(((e[8910]|0)-C|0)>>>1),b=D;return}for(o=t+4592|0,l=t+4596|0,c=e[l>>2]|0,r=e[o>>2]|0,h=c-r|0,h>>>0>=131072?h>>>0>131072&&(d=r+131072|0,(c|0)!=(d|0))&&(e[l>>2]=d):(j0(o,131072-h|0),r=e[o>>2]|0),w=t+4588|0,e[w>>2]=r+65536,d=t+168|0,c=t+164|0,h=-65536;;){if(r=e[d>>2]|0,(h|0)>(0-r|0))if(o=e[c>>2]|0,(h|0)>(0-o|0))if(l=e[C>>2]|0,(h|0)>(0-l|0))if((h|0)>=0){if((h|0)<1){S[(e[w>>2]|0)+h>>0]=0,h=1;continue}(l|0)<=(h|0)?(o|0)>(h|0)?r=2:r=(r|0)>(h|0)?3:4:r=1}else r=-1;else r=-2;else r=-3;else r=-4;if(S[(e[w>>2]|0)+h>>0]=r,h=h+1|0,(h|0)==65536)break}b=D}function K1(t){t=t|0;var r=0,o=0;e[t>>2]=35968,r=e[t+4592>>2]|0,r&&(o=t+4596|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),e[t>>2]=36612,r=e[t+120>>2]|0,r&&(o=t+124|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),o=t+92|0,r=e[o>>2]|0,e[o>>2]=0,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r),t=t+4|0,r=e[t>>2]|0,e[t>>2]=0,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r)}function Y1(t){t=t|0;var r=0,o=0;if(e[t>>2]=35968,r=e[t+4592>>2]|0,r&&(o=t+4596|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),e[t>>2]=36612,r=e[t+120>>2]|0,r&&(o=t+124|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),o=t+92|0,r=e[o>>2]|0,e[o>>2]=0,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r),o=t+4|0,r=e[o>>2]|0,e[o>>2]=0,!r){he(t);return}Mt[e[(e[r>>2]|0)+4>>2]&255](r),he(t)}function j1(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0;c=b,b=b+32|0,w=c,m0(w,4095,0),d=e[r+4>>2]|0,h=e[r+8>>2]|0,h=h|0?h:e[w+8>>2]|0,l=e[r+12>>2]|0,l=l|0?l:e[w+12>>2]|0,r=e[r+16>>2]|0,o=e[w+16>>2]|0,e[t+160>>2]=d|0?d:e[w+4>>2]|0,e[t+164>>2]=h,e[t+168>>2]=l,n2(t),l=0;do e[t+172+(l*12|0)>>2]=64,e[t+172+(l*12|0)+4>>2]=0,I[t+172+(l*12|0)+8>>1]=0,I[t+172+(l*12|0)+10>>1]=1,l=l+1|0;while((l|0)!=365);w=(r|0?r:o)&255,e[t+4552>>2]=64,e[t+4556>>2]=0,S[t+4560>>0]=w,S[t+4561>>0]=1,S[t+4562>>0]=0,e[t+4564>>2]=64,e[t+4568>>2]=1,S[t+4572>>0]=w,S[t+4573>>0]=1,S[t+4574>>0]=0,e[t+4576>>2]=0,b=c}function X1(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0,D=0,k=0;if(k=b,b=b+16|0,C=k,w=t+92|0,d=e[r>>2]|0,e[r>>2]=0,r=e[w>>2]|0,e[w>>2]=d,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r),e[C>>2]=0,e[C+4>>2]=l,w=o+8|0,e[C+8>>2]=e[w>>2],l){r=Xe(4600)|0,l=t+8|0,c=r+4|0,h=l,d=c+84|0;do e[c>>2]=e[h>>2],c=c+4|0,h=h+4|0;while((c|0)<(d|0));c=r+88|0,d=c+40|0;do e[c>>2]=0,c=c+4|0;while((c|0)<(d|0));e[r>>2]=35744,c=r+132|0,e[c>>2]=0,e[c+4>>2]=0,e[c+8>>2]=0,e[c+12>>2]=0,e[r+148>>2]=e[l>>2],e[r+152>>2]=0,e[r+156>>2]=0,e[r+160>>2]=0,c=r+4544|0,l=r+164|0;do e[l>>2]=0,e[l+4>>2]=0,I[l+8>>1]=0,I[l+10>>1]=1,l=l+12|0;while((l|0)!=(c|0));h=t+4|0,e[c>>2]=0,e[c+4>>2]=0,I[c+8>>1]=0,S[c+10>>0]=0,d=r+4556|0,e[d>>2]=0,e[d+4>>2]=0,I[d+8>>1]=0,S[d+10>>0]=0,d=r+4568|0,e[d>>2]=0,e[d+4>>2]=0,e[d+8>>2]=0,e[d+12>>2]=0,e[d+16>>2]=0,e[d+20>>2]=0,e[d+24>>2]=0,S[d+28>>0]=0,e[r+28>>2]|0||(e[r+20>>2]=1),l=e[h>>2]|0,e[h>>2]=r,l&&(Mt[e[(e[l>>2]|0)+4>>2]&255](l),r=e[h>>2]|0),Y0(r,C)}return C=t+100|0,e[C>>2]=32,e[t+96>>2]=0,r=e[o>>2]|0,r?(e[t+132>>2]=r,c=t+120|0,w=t+124|0,l=e[w>>2]|0,r=e[c>>2]|0,h=r,d=l-h|0,d>>>0>=4e3?d>>>0>4e3&&(D=r+4e3|0,(l|0)!=(D|0))&&(e[w>>2]=D,l=D):(vi(c,4e3-d|0),r=e[c>>2]|0,h=r,l=e[w>>2]|0),e[t+108>>2]=h,e[t+104>>2]=l-r,ds(t),D=t+116|0,D=e[D>>2]|0,t=e[C>>2]|0,t=t+-32|0,t=(t|0)/8|0,t=D-t|0,b=k,t|0):(e[t+108>>2]=e[o+4>>2],e[t+104>>2]=e[w>>2],ds(t),D=t+116|0,D=e[D>>2]|0,t=e[C>>2]|0,t=t+-32|0,t=(t|0)/8|0,t=D-t|0,b=k,t|0)}function Z1(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0,G=0,$=0,P=0,O=0;if(G=b,b=b+352|0,$=G+328|0,P=G+192|0,o=G+343|0,l=G+342|0,c=G+341|0,h=G+340|0,R=G+176|0,w=G+168|0,C=G+160|0,D=G+152|0,K=G,U=G+136|0,e[t+32>>2]|0&&(e[t+24>>2]|0)!=1){if(_=t+8|0,H=t+36|0,d=e[H>>2]|0,!d){if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[o>>0]|0,$e(37,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}if(t=e[t+16>>2]|0,(t|0)==16)switch(d|0){case 1:{if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[l>>0]|0,$e(38,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 2:{if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[c>>0]|0,$e(39,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 3:{if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[h>>0]|0,$e(40,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}default:{d=P+56|0,c=P+4|0,e[P>>2]=36160,e[d>>2]=36180,g=0,Ae(62,P+56|0,c|0),G=g,g=0,G&1&&(O=j()|0,tt(d),le(O|0)),e[P+128>>2]=0,e[P+132>>2]=-1,e[P>>2]=36200,e[P+56>>2]=36220,g=0,ue(180,c|0),G=g,g=0;do if(G&1)t=j()|0;else{if(e[c>>2]=36236,h=P+36|0,e[h>>2]=0,e[h+4>>2]=0,e[h+8>>2]=0,e[h+12>>2]=0,e[P+52>>2]=16,e[$>>2]=0,e[$+4>>2]=0,e[$+8>>2]=0,g=0,Ae(63,c|0,$|0),G=g,g=0,G&1){t=j()|0,de($),de(h),wt(c);break}de($),g=0,t=Ve(28,P|0,49007,21)|0,$=g,g=0;do if(!($&1)&&(g=0,k=be(36,t|0,e[H>>2]|0)|0,$=g,g=0,!($&1))&&(g=0,Ve(28,k|0,50997,18)|0,$=g,g=0,!($&1))){if(l=Ct(16)|0,g=0,Ae(64,R|0,c|0),$=g,g=0,$&1)t=j()|0;else if(!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,Q|0)|0,bt(8)),g=0,$e(36,l|0,9,35648,R|0),$=g,g=0,$&1?o=1:(g=0,xe(6,l|0,824,96),g=0,o=0),t=j()|0,de(R),!o)break;Tt(l|0)}else O=34;while(!1);(O|0)==34&&(t=j()|0),e[P>>2]=36200,e[d>>2]=36220,e[c>>2]=36236,de(h),wt(c),tt(d),O=t,le(O|0)}while(!1);O=t,tt(d),le(O|0)}}switch((t|0)<=8&&(t=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,Q|0)|0,bt(8)),g=0,xe(7,t|0,8,35648),O=g,g=0,O&1||Qt(t|0,824,96),O=j()|0,Tt(t|0),le(O|0)),o=16-t|0,d|0){case 1:{if(t=Xe(60)|0,e[w>>2]=o,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],e[$>>2]=e[w>>2],e[$+4>>2]=e[w+4>>2],$e(41,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 2:{if(t=Xe(60)|0,e[C>>2]=o,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],e[$>>2]=e[C>>2],e[$+4>>2]=e[C+4>>2],$e(42,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 3:{if(t=Xe(60)|0,e[D>>2]=o,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],e[$>>2]=e[D>>2],e[$+4>>2]=e[D+4>>2],$e(43,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}default:{d=K+56|0,c=K+4|0,e[K>>2]=36160,e[d>>2]=36180,g=0,Ae(62,K+56|0,c|0),P=g,g=0,P&1&&(O=j()|0,tt(d),le(O|0)),e[K+128>>2]=0,e[K+132>>2]=-1,e[K>>2]=36200,e[K+56>>2]=36220,g=0,ue(180,c|0),P=g,g=0;do if(P&1)t=j()|0;else{if(e[c>>2]=36236,h=K+36|0,e[h>>2]=0,e[h+4>>2]=0,e[h+8>>2]=0,e[h+12>>2]=0,e[K+52>>2]=16,e[$>>2]=0,e[$+4>>2]=0,e[$+8>>2]=0,g=0,Ae(63,c|0,$|0),P=g,g=0,P&1){t=j()|0,de($),de(h),wt(c);break}de($),g=0,t=Ve(28,K|0,49007,21)|0,P=g,g=0;do if(!(P&1)&&(g=0,N=be(36,t|0,e[H>>2]|0)|0,P=g,g=0,!(P&1))&&(g=0,Ve(28,N|0,50997,18)|0,P=g,g=0,!(P&1))){if(l=Ct(16)|0,g=0,Ae(64,U|0,c|0),P=g,g=0,P&1)t=j()|0;else if(!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,Q|0)|0,bt(8)),g=0,$e(36,l|0,9,35648,U|0),P=g,g=0,P&1?o=1:(g=0,xe(6,l|0,824,96),g=0,o=0),t=j()|0,de(U),!o)break;Tt(l|0)}else O=64;while(!1);(O|0)==64&&(t=j()|0),e[K>>2]=36200,e[d>>2]=36220,e[c>>2]=36236,de(h),wt(c),tt(d),O=t,le(O|0)}while(!1);O=t,tt(d),le(O|0)}}}return o=e[r+4>>2]|0,l=Xe(16)|0,t=e[t+20>>2]|0,o?(e[l>>2]=36108,e[l+4>>2]=o,e[l+8>>2]=2,e[l+12>>2]=t,O=l,b=G,O|0):(O=e[r>>2]|0,e[l>>2]=36132,e[l+4>>2]=O,e[l+8>>2]=2,e[l+12>>2]=t,O=l,b=G,O|0)}function ds(t){t=t|0;var r=0,o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0,G=0,$=0,P=0,O=0;G=b,b=b+32|0,P=G+12|0,K=G,_=t+156|0,U=(e[_>>2]|0)+4|0,(e[t+32>>2]|0)==1?H=e[t+24>>2]|0:H=1,r=ee(H<<1,U)|0,e[P>>2]=0,O=P+4|0,e[O>>2]=0,e[P+8>>2]=0;do if(r){if((r|0)<0&&(g=0,ue(178,P|0),$=g,g=0,$&1)||(d=6),(d|0)==6&&(o=r<<1,g=0,l=ge(67,o|0)|0,$=g,g=0,!($&1))){e[P>>2]=l,$=l+(r<<1)|0,e[P+8>>2]=$,Jt(l|0,0,o|0)|0,e[O>>2]=$;break}l=j()|0,r=e[P>>2]|0,r||le(l|0),o=e[O>>2]|0,(o|0)!=(r|0)&&(e[O>>2]=o+(~((o+-2-r|0)>>>1)<<1)),he(r),le(l|0)}while(!1);e[K>>2]=0,$=K+4|0,e[$>>2]=0,e[K+8>>2]=0;do if(!H)d=18;else{if(H>>>0>1073741823&&(g=0,ue(178,K|0),R=g,g=0,R&1)||(d=16),(d|0)==16&&(c=H<<2,g=0,h=ge(67,c|0)|0,R=g,g=0,!(R&1))){e[K>>2]=h,d=h+(H<<2)|0,e[K+8>>2]=d,Jt(h|0,0,c|0)|0,e[$>>2]=d,d=18;break}l=j()|0,r=e[K>>2]|0,o=r,r&&(c=e[$>>2]|0,(c|0)!=(r|0)&&(e[$>>2]=c+(~((c+-4-o|0)>>>2)<<2)),he(r))}while(!1);if((d|0)==18){h=t+12|0;e:do if((e[h>>2]|0)>0){d=t+4580|0,w=(ee(H,U)|0)+1|0,C=t+4584|0,D=t+92|0,k=(H|0)>0,N=t+4576|0,R=0;t:for(;;){if(o=e[P>>2]|0,r=o+2|0,e[d>>2]=r,o=o+(w<<1)|0,e[C>>2]=o,R&1?(e[d>>2]=o,e[C>>2]=r):r=o,c=e[D>>2]|0,g=0,$e(e[(e[c>>2]|0)+12>>2]|0,c|0,r|0,e[_>>2]|0,U|0),c=g,g=0,c&1){d=28;break}if(k){r=e[d>>2]|0,o=e[C>>2]|0,l=e[K>>2]|0,c=0;do{if(e[N>>2]=e[l+(c<<2)>>2],l=e[_>>2]|0,I[r+(l<<1)>>1]=I[r+(l+-1<<1)>>1]|0,I[o+-2>>1]=I[r>>1]|0,g=0,Ae(72,t|0,0),l=g,g=0,l&1){d=27;break t}l=e[K>>2]|0,e[l+(c<<2)>>2]=e[N>>2],r=(e[d>>2]|0)+(U<<1)|0,e[d>>2]=r,o=(e[C>>2]|0)+(U<<1)|0,e[C>>2]=o,c=c+1|0}while((c|0)<(H|0))}if(R=R+1|0,(R|0)>=(e[h>>2]|0)){d=40;break e}}if((d|0)==27){l=j()|0;break}else if((d|0)==28){l=j()|0;break}}else d=40;while(!1);do if((d|0)==40){if(g=0,ue(182,t|0),t=g,g=0,t&1){l=j()|0;break}if(r=e[K>>2]|0,o=r,r&&(l=e[$>>2]|0,(l|0)!=(r|0)&&(e[$>>2]=l+(~((l+-4-o|0)>>>2)<<2)),he(r)),r=e[P>>2]|0,!r){b=G;return}o=e[O>>2]|0,(o|0)!=(r|0)&&(e[O>>2]=o+(~((o+-2-r|0)>>>1)<<1)),he(r),b=G;return}while(!1);r=e[K>>2]|0,o=r,r&&(c=e[$>>2]|0,(c|0)!=(r|0)&&(e[$>>2]=c+(~((c+-4-o|0)>>>2)<<2)),he(r))}r=e[P>>2]|0,r||le(l|0),o=e[O>>2]|0,(o|0)!=(r|0)&&(e[O>>2]=o+(~((o+-2-r|0)>>>1)<<1)),he(r),le(l|0)}function J1(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0;if(N=t+4580|0,r=e[N>>2]|0,U=t+156|0,!((e[U>>2]|0)<=0))for(R=t+4584|0,_=t+4588|0,c=r,h=M[r+-2>>1]|0,r=M[r>>1]|0,k=0;D=e[R>>2]|0,C=M[D+(k+-1<<1)>>1]|0,l=k+1|0,o=M[c+(l<<1)>>1]|0,w=e[_>>2]|0,d=r-h|0,c=h-C|0,w=((((S[w+(o-r)>>0]|0)*9|0)+(S[w+d>>0]|0)|0)*9|0)+(S[w+c>>0]|0)|0,w?(h=r-C>>31,(h^c|0)<0?c=r:c=C+((h^d|0)<0?0:d)|0,D=e2(t,w,M[D+(k<<1)>>1]|0,c,0)|0,I[(e[R>>2]|0)+(k<<1)>>1]=D):(l=(t2(t,k,0)|0)+k|0,o=e[N>>2]|0,r=M[o+(l+-1<<1)>>1]|0,o=M[o+(l<<1)>>1]|0),!((l|0)>=(e[U>>2]|0));)c=e[N>>2]|0,h=r,r=o,k=l}function e2(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0;if(U=r>>31,C=(U^r)-U|0,_=t+172+(C*12|0)+10|0,d=I[_>>1]|0,R=t+172+(C*12|0)|0,c=e[R>>2]|0,(d|0)<(c|0))if((d<<1|0)<(c|0))if((d<<2|0)<(c|0))if((d<<3|0)<(c|0))if((d<<4|0)<(c|0))for(h=5;(d<>1]^U)-U+l|0,(c&4095|0)==(c|0)?k=c:k=c>>31&4095^4095,w=(o-k^U)-U<<20,D=w>>20,h?c=0:c=(e[t+172+(C*12|0)+4>>2]<<1)+-1+d>>31,l=c^D,l=l>>30^l<<1,c=l>>h,(c|0)<35?((c|0)>30&&(d=(c|0)/2|0,_t(t,0,d),c=c-d|0),_t(t,1,c+1|0),_t(t,l&(1<>1]|0,c=d<<16>>16==64,h=c&1,o=(e[l>>2]|0)+D>>h,d=c?32:d<<16>>16,e[R>>2]=(e[R>>2]|0)+((w|0)>-1048576?D:0-D|0)>>h,h=d+1|0,I[_>>1]=h,c=h+o|0,(c|0)<1?(_=I[N>>1]|0,I[N>>1]=(_&65535)-(_<<16>>16>-128&1),_=(c|0)>(~d|0)?c:0-d|0,e[l>>2]=_,U=D^U,r=r>>>31,r=k+r|0,r=r+U|0,r=r&4095,r=r&65535,r|0):(o|0)<=0?(_=o,e[l>>2]=_,U=D^U,r=r>>>31,r=k+r|0,r=r+U|0,r=r&4095,r=r&65535,r|0):(_=o-h|0,R=I[N>>1]|0,I[N>>1]=(R<<16>>16<127&1)+(R&65535),_=(_|0)>0?0:_,e[l>>2]=_,U=D^U,r=r>>>31,r=k+r|0,r=r+U|0,r=r&4095,r=r&65535,r|0)}function t2(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0;for(d=(e[t+156>>2]|0)-r|0,w=e[t+4584>>2]|0,D=e[t+4580>>2]|0,c=I[w+(r+-1<<1)>>1]|0,l=0;;){if(o=w+(l+r<<1)|0,(I[o>>1]|0)!=c<<16>>16){k=l;break}if(I[o>>1]=c,l=l+1|0,(l|0)==(d|0)){k=d;break}}if(h=c&65535,c=(k|0)==(d|0),C=t+4576|0,l=e[36476+(e[C>>2]<<2)>>2]|0,(1<(k|0))o=k;else{o=k;do _t(t,1,1),l=e[C>>2]|0,o=o-(1<>2])|0,l=(l|0)>30?31:l+1|0,e[C>>2]=l,l=e[36476+(l<<2)>>2]|0;while((o|0)>=(1<>1]|0,o=M[D+(o<<1)>>1]|0,D=h-o|0,(((D|0)>-1?D:0-D|0)|0)<1?(o=l-h<<20>>20,ps(t,t+4564|0,o),o=o+h|0):(D=o-h>>31|1,r=(ee(l-o<<20,D)|0)>>20,ps(t,t+4552|0,r),o=(ee(r,D)|0)+o|0),I[c>>1]=o&4095,t=e[C>>2]|0,e[C>>2]=(t|0)<1?0:t+-1|0,t=k+1|0,t|0)}function ps(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0;if(k=r+9|0,d=F[k>>0]|0,D=r+4|0,C=e[D>>2]|0,c=(ee(d>>>1,C)|0)+(e[r>>2]|0)|0,(d|0)<(c|0)){h=d,l=0;do h=h<<1,l=l+1|0;while((h|0)<(c|0));c=l}else c=0;(o|0)>0&(c|0)==0&&F[r+10>>0]<<1>>>0>>0?l=1:w=5;do if((w|0)==5){if(l=(o|0)<0,l&&F[r+10>>0]<<1>>>0>=d>>>0){l=1;break}l=l&(c|0)!=0}while(!1);if(l=(((o|0)>-1?o:0-o|0)<<1)-C+(l<<31>>31)|0,i2(t,c,l,47-(e[36476+(e[t+4576>>2]<<2)>>2]|0)|0),(o|0)<0&&(t=r+10|0,S[t>>0]=(F[t>>0]|0)+1),l=(l+1-(e[D>>2]|0)>>1)+(e[r>>2]|0)|0,e[r>>2]=l,c=S[k>>0]|0,c<<24>>24!=(S[r+8>>0]|0)){r=c,r=r&255,r=r+1|0,r=r&255,S[k>>0]=r;return}e[r>>2]=l>>1,t=(c&255)>>>1,S[k>>0]=t,r=r+10|0,S[r>>0]=(F[r>>0]|0)>>>1,r=t,r=r&255,r=r+1|0,r=r&255,S[k>>0]=r}function i2(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0;if(c=o>>r,h=l+-12|0,(c|0)<(l+-13|0)){(c|0)>30&&(l=(c|0)/2|0,_t(t,0,l),c=c-l|0),_t(t,1,c+1|0),_t(t,(1<31?(_t(t,0,31),_t(t,1,l+-43|0)):_t(t,1,h),_t(t,o+4095&4095,12)}function n2(t){t=t|0;var r=0,o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0;if(D=b,b=b+32|0,w=D,m0(w,4095,0),C=t+160|0,(e[w+4>>2]|0)==(e[C>>2]|0)&&(e[w+8>>2]|0)==(e[t+164>>2]|0)&&(e[w+12>>2]|0)==(e[t+168>>2]|0)){C=e[8906]|0,e[t+4588>>2]=C+(((e[8907]|0)-C|0)>>>1),b=D;return}for(o=t+4592|0,l=t+4596|0,c=e[l>>2]|0,r=e[o>>2]|0,h=c-r|0,h>>>0>=8192?h>>>0>8192&&(d=r+8192|0,(c|0)!=(d|0))&&(e[l>>2]=d):(j0(o,8192-h|0),r=e[o>>2]|0),w=t+4588|0,e[w>>2]=r+4096,d=t+168|0,c=t+164|0,h=-4096;;){if(r=e[d>>2]|0,(h|0)>(0-r|0))if(o=e[c>>2]|0,(h|0)>(0-o|0))if(l=e[C>>2]|0,(h|0)>(0-l|0))if((h|0)>=0){if((h|0)<1){S[(e[w>>2]|0)+h>>0]=0,h=1;continue}(l|0)<=(h|0)?(o|0)>(h|0)?r=2:r=(r|0)>(h|0)?3:4:r=1}else r=-1;else r=-2;else r=-3;else r=-4;if(S[(e[w>>2]|0)+h>>0]=r,h=h+1|0,(h|0)==4096)break}b=D}function r2(t){t=t|0;var r=0,o=0;e[t>>2]=35940,r=e[t+4592>>2]|0,r&&(o=t+4596|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),e[t>>2]=36612,r=e[t+120>>2]|0,r&&(o=t+124|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),o=t+92|0,r=e[o>>2]|0,e[o>>2]=0,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r),t=t+4|0,r=e[t>>2]|0,e[t>>2]=0,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r)}function s2(t){t=t|0;var r=0,o=0;if(e[t>>2]=35940,r=e[t+4592>>2]|0,r&&(o=t+4596|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),e[t>>2]=36612,r=e[t+120>>2]|0,r&&(o=t+124|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),o=t+92|0,r=e[o>>2]|0,e[o>>2]=0,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r),o=t+4|0,r=e[o>>2]|0,e[o>>2]=0,!r){he(t);return}Mt[e[(e[r>>2]|0)+4>>2]&255](r),he(t)}function o2(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0;c=b,b=b+32|0,w=c,m0(w,255,0),d=e[r+4>>2]|0,h=e[r+8>>2]|0,h=h|0?h:e[w+8>>2]|0,l=e[r+12>>2]|0,l=l|0?l:e[w+12>>2]|0,r=e[r+16>>2]|0,o=e[w+16>>2]|0,e[t+160>>2]=d|0?d:e[w+4>>2]|0,e[t+164>>2]=h,e[t+168>>2]=l,p2(t),l=0;do e[t+172+(l*12|0)>>2]=4,e[t+172+(l*12|0)+4>>2]=0,I[t+172+(l*12|0)+8>>1]=0,I[t+172+(l*12|0)+10>>1]=1,l=l+1|0;while((l|0)!=365);w=(r|0?r:o)&255,e[t+4552>>2]=4,e[t+4556>>2]=0,S[t+4560>>0]=w,S[t+4561>>0]=1,S[t+4562>>0]=0,e[t+4564>>2]=4,e[t+4568>>2]=1,S[t+4572>>0]=w,S[t+4573>>0]=1,S[t+4574>>0]=0,e[t+4576>>2]=0,b=c}function l2(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0,D=0,k=0;if(k=b,b=b+16|0,C=k,w=t+92|0,d=e[r>>2]|0,e[r>>2]=0,r=e[w>>2]|0,e[w>>2]=d,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r),e[C>>2]=0,e[C+4>>2]=l,w=o+8|0,e[C+8>>2]=e[w>>2],l){r=Xe(4600)|0,l=t+8|0,c=r+4|0,h=l,d=c+84|0;do e[c>>2]=e[h>>2],c=c+4|0,h=h+4|0;while((c|0)<(d|0));c=r+88|0,d=c+40|0;do e[c>>2]=0,c=c+4|0;while((c|0)<(d|0));e[r>>2]=35716,c=r+132|0,e[c>>2]=0,e[c+4>>2]=0,e[c+8>>2]=0,e[c+12>>2]=0,e[r+148>>2]=e[l>>2],e[r+152>>2]=0,e[r+156>>2]=0,e[r+160>>2]=0,c=r+4544|0,l=r+164|0;do e[l>>2]=0,e[l+4>>2]=0,I[l+8>>1]=0,I[l+10>>1]=1,l=l+12|0;while((l|0)!=(c|0));h=t+4|0,e[c>>2]=0,e[c+4>>2]=0,I[c+8>>1]=0,S[c+10>>0]=0,d=r+4556|0,e[d>>2]=0,e[d+4>>2]=0,I[d+8>>1]=0,S[d+10>>0]=0,d=r+4568|0,e[d>>2]=0,e[d+4>>2]=0,e[d+8>>2]=0,e[d+12>>2]=0,e[d+16>>2]=0,e[d+20>>2]=0,e[d+24>>2]=0,S[d+28>>0]=0,e[r+28>>2]|0||(e[r+20>>2]=1),l=e[h>>2]|0,e[h>>2]=r,l&&(Mt[e[(e[l>>2]|0)+4>>2]&255](l),r=e[h>>2]|0),Y0(r,C)}return C=t+100|0,e[C>>2]=32,e[t+96>>2]=0,r=e[o>>2]|0,r?(e[t+132>>2]=r,c=t+120|0,w=t+124|0,l=e[w>>2]|0,r=e[c>>2]|0,h=r,d=l-h|0,d>>>0>=4e3?d>>>0>4e3&&(D=r+4e3|0,(l|0)!=(D|0))&&(e[w>>2]=D,l=D):(vi(c,4e3-d|0),r=e[c>>2]|0,h=r,l=e[w>>2]|0),e[t+108>>2]=h,e[t+104>>2]=l-r,ms(t),D=t+116|0,D=e[D>>2]|0,t=e[C>>2]|0,t=t+-32|0,t=(t|0)/8|0,t=D-t|0,b=k,t|0):(e[t+108>>2]=e[o+4>>2],e[t+104>>2]=e[w>>2],ms(t),D=t+116|0,D=e[D>>2]|0,t=e[C>>2]|0,t=t+-32|0,t=(t|0)/8|0,t=D-t|0,b=k,t|0)}function u2(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0,G=0,$=0,P=0,O=0;if(G=b,b=b+352|0,$=G+328|0,P=G+192|0,o=G+343|0,l=G+342|0,c=G+341|0,h=G+340|0,R=G+176|0,w=G+168|0,C=G+160|0,D=G+152|0,K=G,U=G+136|0,e[t+32>>2]|0&&(e[t+24>>2]|0)!=1){if(_=t+8|0,H=t+36|0,d=e[H>>2]|0,!d){if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[o>>0]|0,$e(44,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}if(t=e[t+16>>2]|0,(t|0)==8)switch(d|0){case 1:{if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[l>>0]|0,$e(45,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 2:{if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[c>>0]|0,$e(46,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 3:{if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[h>>0]|0,$e(47,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}default:{d=P+56|0,c=P+4|0,e[P>>2]=36160,e[d>>2]=36180,g=0,Ae(62,P+56|0,c|0),G=g,g=0,G&1&&(O=j()|0,tt(d),le(O|0)),e[P+128>>2]=0,e[P+132>>2]=-1,e[P>>2]=36200,e[P+56>>2]=36220,g=0,ue(180,c|0),G=g,g=0;do if(G&1)t=j()|0;else{if(e[c>>2]=36236,h=P+36|0,e[h>>2]=0,e[h+4>>2]=0,e[h+8>>2]=0,e[h+12>>2]=0,e[P+52>>2]=16,e[$>>2]=0,e[$+4>>2]=0,e[$+8>>2]=0,g=0,Ae(63,c|0,$|0),G=g,g=0,G&1){t=j()|0,de($),de(h),wt(c);break}de($),g=0,t=Ve(28,P|0,49007,21)|0,$=g,g=0;do if(!($&1)&&(g=0,k=be(36,t|0,e[H>>2]|0)|0,$=g,g=0,!($&1))&&(g=0,Ve(28,k|0,50997,18)|0,$=g,g=0,!($&1))){if(l=Ct(16)|0,g=0,Ae(64,R|0,c|0),$=g,g=0,$&1)t=j()|0;else if(!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,Q|0)|0,bt(8)),g=0,$e(36,l|0,9,35648,R|0),$=g,g=0,$&1?o=1:(g=0,xe(6,l|0,824,96),g=0,o=0),t=j()|0,de(R),!o)break;Tt(l|0)}else O=34;while(!1);(O|0)==34&&(t=j()|0),e[P>>2]=36200,e[d>>2]=36220,e[c>>2]=36236,de(h),wt(c),tt(d),O=t,le(O|0)}while(!1);O=t,tt(d),le(O|0)}}switch((t|0)<=8&&(t=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,Q|0)|0,bt(8)),g=0,xe(7,t|0,8,35648),O=g,g=0,O&1||Qt(t|0,824,96),O=j()|0,Tt(t|0),le(O|0)),o=16-t|0,d|0){case 1:{if(t=Xe(60)|0,e[w>>2]=o,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],e[$>>2]=e[w>>2],e[$+4>>2]=e[w+4>>2],$e(41,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 2:{if(t=Xe(60)|0,e[C>>2]=o,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],e[$>>2]=e[C>>2],e[$+4>>2]=e[C+4>>2],$e(42,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 3:{if(t=Xe(60)|0,e[D>>2]=o,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],e[$>>2]=e[D>>2],e[$+4>>2]=e[D+4>>2],$e(43,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}default:{d=K+56|0,c=K+4|0,e[K>>2]=36160,e[d>>2]=36180,g=0,Ae(62,K+56|0,c|0),P=g,g=0,P&1&&(O=j()|0,tt(d),le(O|0)),e[K+128>>2]=0,e[K+132>>2]=-1,e[K>>2]=36200,e[K+56>>2]=36220,g=0,ue(180,c|0),P=g,g=0;do if(P&1)t=j()|0;else{if(e[c>>2]=36236,h=K+36|0,e[h>>2]=0,e[h+4>>2]=0,e[h+8>>2]=0,e[h+12>>2]=0,e[K+52>>2]=16,e[$>>2]=0,e[$+4>>2]=0,e[$+8>>2]=0,g=0,Ae(63,c|0,$|0),P=g,g=0,P&1){t=j()|0,de($),de(h),wt(c);break}de($),g=0,t=Ve(28,K|0,49007,21)|0,P=g,g=0;do if(!(P&1)&&(g=0,N=be(36,t|0,e[H>>2]|0)|0,P=g,g=0,!(P&1))&&(g=0,Ve(28,N|0,50997,18)|0,P=g,g=0,!(P&1))){if(l=Ct(16)|0,g=0,Ae(64,U|0,c|0),P=g,g=0,P&1)t=j()|0;else if(!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,Q|0)|0,bt(8)),g=0,$e(36,l|0,9,35648,U|0),P=g,g=0,P&1?o=1:(g=0,xe(6,l|0,824,96),g=0,o=0),t=j()|0,de(U),!o)break;Tt(l|0)}else O=64;while(!1);(O|0)==64&&(t=j()|0),e[K>>2]=36200,e[d>>2]=36220,e[c>>2]=36236,de(h),wt(c),tt(d),O=t,le(O|0)}while(!1);O=t,tt(d),le(O|0)}}}return o=e[r+4>>2]|0,l=Xe(16)|0,t=e[t+20>>2]|0,o?(e[l>>2]=36108,e[l+4>>2]=o,e[l+8>>2]=1,e[l+12>>2]=t,O=l,b=G,O|0):(O=e[r>>2]|0,e[l>>2]=36132,e[l+4>>2]=O,e[l+8>>2]=1,e[l+12>>2]=t,O=l,b=G,O|0)}function ms(t){t=t|0;var r=0,o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0,G=0,$=0,P=0;K=b,b=b+32|0,$=K+12|0,H=K,R=t+156|0,_=(e[R>>2]|0)+4|0,(e[t+32>>2]|0)==1?U=e[t+24>>2]|0:U=1,r=ee(U<<1,_)|0,e[$>>2]=0,P=$+4|0,e[P>>2]=0,e[$+8>>2]=0;e:do if(r){if((r|0)<0&&(g=0,ue(178,$|0),G=g,g=0,G&1)||(h=6),(h|0)==6&&(g=0,o=ge(67,r|0)|0,G=g,g=0,!(G&1))){for(e[P>>2]=o,e[$>>2]=o,e[$+8>>2]=o+r;;)if(S[o>>0]=0,o=(e[P>>2]|0)+1|0,e[P>>2]=o,r=r+-1|0,!r)break e}o=j()|0,r=e[$>>2]|0,r||le(o|0),(e[P>>2]|0)!=(r|0)&&(e[P>>2]=r),he(r),le(o|0)}while(!1);e[H>>2]=0,G=H+4|0,e[G>>2]=0,e[H+8>>2]=0;do if(!U)h=19;else{if(U>>>0>1073741823&&(g=0,ue(178,H|0),N=g,g=0,N&1)||(h=17),(h|0)==17&&(l=U<<2,g=0,c=ge(67,l|0)|0,N=g,g=0,!(N&1))){e[H>>2]=c,h=c+(U<<2)|0,e[H+8>>2]=h,Jt(c|0,0,l|0)|0,e[G>>2]=h,h=19;break}o=j()|0,r=e[H>>2]|0,l=r,r&&(c=e[G>>2]|0,(c|0)!=(r|0)&&(e[G>>2]=c+(~((c+-4-l|0)>>>2)<<2)),he(r))}while(!1);if((h|0)==19){c=t+12|0;e:do if((e[c>>2]|0)>0){h=t+4580|0,d=(ee(U,_)|0)+1|0,w=t+4584|0,C=t+92|0,D=(U|0)>0,k=t+4576|0,N=0;t:for(;;){if(o=e[$>>2]|0,r=o+1|0,e[h>>2]=r,o=o+d|0,e[w>>2]=o,N&1?(e[h>>2]=o,e[w>>2]=r):r=o,l=e[C>>2]|0,g=0,$e(e[(e[l>>2]|0)+12>>2]|0,l|0,r|0,e[R>>2]|0,_|0),l=g,g=0,l&1){h=29;break}if(D){r=e[h>>2]|0,o=e[H>>2]|0,l=0;do{if(e[k>>2]=e[o+(l<<2)>>2],o=e[R>>2]|0,S[r+o>>0]=S[r+(o+-1)>>0]|0,S[(e[w>>2]|0)+-1>>0]=S[e[h>>2]>>0]|0,g=0,Ae(73,t|0,0),o=g,g=0,o&1){h=28;break t}o=e[H>>2]|0,e[o+(l<<2)>>2]=e[k>>2],r=(e[h>>2]|0)+_|0,e[h>>2]=r,e[w>>2]=(e[w>>2]|0)+_,l=l+1|0}while((l|0)<(U|0))}if(N=N+1|0,(N|0)>=(e[c>>2]|0)){h=41;break e}}if((h|0)==28){o=j()|0;break}else if((h|0)==29){o=j()|0;break}}else h=41;while(!1);do if((h|0)==41){if(g=0,ue(182,t|0),t=g,g=0,t&1){o=j()|0;break}if(r=e[H>>2]|0,o=r,r&&(l=e[G>>2]|0,(l|0)!=(r|0)&&(e[G>>2]=l+(~((l+-4-o|0)>>>2)<<2)),he(r)),r=e[$>>2]|0,!r){b=K;return}(e[P>>2]|0)!=(r|0)&&(e[P>>2]=r),he(r),b=K;return}while(!1);r=e[H>>2]|0,l=r,r&&(c=e[G>>2]|0,(c|0)!=(r|0)&&(e[G>>2]=c+(~((c+-4-l|0)>>>2)<<2)),he(r))}r=e[$>>2]|0,r||le(o|0),(e[P>>2]|0)!=(r|0)&&(e[P>>2]=r),he(r),le(o|0)}function c2(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0;if(N=t+4580|0,r=e[N>>2]|0,U=t+156|0,!((e[U>>2]|0)<=0))for(R=t+4584|0,_=t+4588|0,c=r,h=F[r+-1>>0]|0,r=F[r>>0]|0,k=0;D=e[R>>2]|0,C=F[D+(k+-1)>>0]|0,l=k+1|0,o=F[c+l>>0]|0,w=e[_>>2]|0,d=r-h|0,c=h-C|0,w=((((S[w+(o-r)>>0]|0)*9|0)+(S[w+d>>0]|0)|0)*9|0)+(S[w+c>>0]|0)|0,w?(h=r-C>>31,(h^c|0)<0?c=r:c=C+((h^d|0)<0?0:d)|0,D=f2(t,w,F[D+k>>0]|0,c,0)|0,S[(e[R>>2]|0)+k>>0]=D):(l=(h2(t,k,0)|0)+k|0,o=e[N>>2]|0,r=F[o+(l+-1)>>0]|0,o=F[o+l>>0]|0),!((l|0)>=(e[U>>2]|0));)c=e[N>>2]|0,h=r,r=o,k=l}function f2(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0;if(U=r>>31,C=(U^r)-U|0,_=t+172+(C*12|0)+10|0,d=I[_>>1]|0,R=t+172+(C*12|0)|0,c=e[R>>2]|0,(d|0)<(c|0))if((d<<1|0)<(c|0))if((d<<2|0)<(c|0))if((d<<3|0)<(c|0))if((d<<4|0)<(c|0))for(h=5;(d<>1]^U)-U+l|0,(c&255|0)==(c|0)?k=c:k=c>>31&255^255,w=(o-k^U)-U<<24,D=w>>24,h?c=0:c=(e[t+172+(C*12|0)+4>>2]<<1)+-1+d>>31,c=c^D,c=c>>30^c<<1,l=c>>h,(l|0)<23?(_t(t,1,l+1|0),_t(t,c&(1<>1]|0,c=d<<16>>16==64,h=c&1,o=(e[l>>2]|0)+D>>h,d=c?32:d<<16>>16,e[R>>2]=(e[R>>2]|0)+((w|0)>-16777216?D:0-D|0)>>h,h=d+1|0,I[_>>1]=h,c=h+o|0,(c|0)<1?(_=I[N>>1]|0,I[N>>1]=(_&65535)-(_<<16>>16>-128&1),_=(c|0)>(~d|0)?c:0-d|0,e[l>>2]=_,U=D^U,r=r>>>31,r=k+r|0,r=r+U|0,r=r&255,r|0):(o|0)<=0?(_=o,e[l>>2]=_,U=D^U,r=r>>>31,r=k+r|0,r=r+U|0,r=r&255,r|0):(_=o-h|0,R=I[N>>1]|0,I[N>>1]=(R<<16>>16<127&1)+(R&65535),_=(_|0)>0?0:_,e[l>>2]=_,U=D^U,r=r>>>31,r=k+r|0,r=r+U|0,r=r&255,r|0)}function h2(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0;for(d=(e[t+156>>2]|0)-r|0,w=e[t+4584>>2]|0,D=e[t+4580>>2]|0,c=S[w+(r+-1)>>0]|0,l=0;;){if(o=w+(l+r)|0,(S[o>>0]|0)!=c<<24>>24){k=l;break}if(S[o>>0]=c,l=l+1|0,(l|0)==(d|0)){k=d;break}}if(h=c&255,c=(k|0)==(d|0),C=t+4576|0,l=e[36476+(e[C>>2]<<2)>>2]|0,(1<(k|0))o=k;else{o=k;do _t(t,1,1),l=e[C>>2]|0,o=o-(1<>2])|0,l=(l|0)>30?31:l+1|0,e[C>>2]=l,l=e[36476+(l<<2)>>2]|0;while((o|0)>=(1<>0]|0,o=F[D+o>>0]|0,D=h-o|0,(((D|0)>-1?D:0-D|0)|0)<1?(o=l-h<<24>>24,gs(t,t+4564|0,o),o=o+h|0):(D=o-h>>31|1,r=(ee(l-o<<24,D)|0)>>24,gs(t,t+4552|0,r),o=(ee(r,D)|0)+o|0),S[c>>0]=o,t=e[C>>2]|0,e[C>>2]=(t|0)<1?0:t+-1|0,t=k+1|0,t|0)}function gs(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0;if(k=r+9|0,d=F[k>>0]|0,D=r+4|0,C=e[D>>2]|0,c=(ee(d>>>1,C)|0)+(e[r>>2]|0)|0,(d|0)<(c|0)){h=d,l=0;do h=h<<1,l=l+1|0;while((h|0)<(c|0));c=l}else c=0;(o|0)>0&(c|0)==0&&F[r+10>>0]<<1>>>0>>0?l=1:w=5;do if((w|0)==5){if(l=(o|0)<0,l&&F[r+10>>0]<<1>>>0>=d>>>0){l=1;break}l=l&(c|0)!=0}while(!1);if(l=(((o|0)>-1?o:0-o|0)<<1)-C+(l<<31>>31)|0,d2(t,c,l,31-(e[36476+(e[t+4576>>2]<<2)>>2]|0)|0),(o|0)<0&&(t=r+10|0,S[t>>0]=(F[t>>0]|0)+1),l=(l+1-(e[D>>2]|0)>>1)+(e[r>>2]|0)|0,e[r>>2]=l,c=S[k>>0]|0,c<<24>>24!=(S[r+8>>0]|0)){r=c,r=r&255,r=r+1|0,r=r&255,S[k>>0]=r;return}e[r>>2]=l>>1,t=(c&255)>>>1,S[k>>0]=t,r=r+10|0,S[r>>0]=(F[r>>0]|0)>>>1,r=t,r=r&255,r=r+1|0,r=r&255,S[k>>0]=r}function d2(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0;if(c=o>>r,h=l+-8|0,(c|0)<(l+-9|0)){(c|0)>30&&(l=(c|0)/2|0,_t(t,0,l),c=c-l|0),_t(t,1,c+1|0),_t(t,(1<31?(_t(t,0,31),_t(t,1,l+-39|0)):_t(t,1,h),_t(t,o+255&255,8)}function p2(t){t=t|0;var r=0,o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0;if(D=b,b=b+32|0,w=D,m0(w,255,0),C=t+160|0,(e[w+4>>2]|0)==(e[C>>2]|0)&&(e[w+8>>2]|0)==(e[t+164>>2]|0)&&(e[w+12>>2]|0)==(e[t+168>>2]|0)){C=e[8900]|0,e[t+4588>>2]=C+(((e[8901]|0)-C|0)>>>1),b=D;return}for(o=t+4592|0,l=t+4596|0,c=e[l>>2]|0,r=e[o>>2]|0,h=c-r|0,h>>>0>=512?h>>>0>512&&(d=r+512|0,(c|0)!=(d|0))&&(e[l>>2]=d):(j0(o,512-h|0),r=e[o>>2]|0),w=t+4588|0,e[w>>2]=r+256,d=t+168|0,c=t+164|0,h=-256;;){if(r=e[d>>2]|0,(h|0)>(0-r|0))if(o=e[c>>2]|0,(h|0)>(0-o|0))if(l=e[C>>2]|0,(h|0)>(0-l|0))if((h|0)>=0){if((h|0)<1){S[(e[w>>2]|0)+h>>0]=0,h=1;continue}(l|0)<=(h|0)?(o|0)>(h|0)?r=2:r=(r|0)>(h|0)?3:4:r=1}else r=-1;else r=-2;else r=-3;else r=-4;if(S[(e[w>>2]|0)+h>>0]=r,h=h+1|0,(h|0)==256)break}b=D}function m2(t){t=t|0;var r=0,o=0;e[t>>2]=35912,r=e[t+4592>>2]|0,r&&(o=t+4596|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),e[t>>2]=36612,r=e[t+120>>2]|0,r&&(o=t+124|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),o=t+92|0,r=e[o>>2]|0,e[o>>2]=0,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r),t=t+4|0,r=e[t>>2]|0,e[t>>2]=0,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r)}function g2(t){t=t|0;var r=0,o=0;if(e[t>>2]=35912,r=e[t+4592>>2]|0,r&&(o=t+4596|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),e[t>>2]=36612,r=e[t+120>>2]|0,r&&(o=t+124|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),o=t+92|0,r=e[o>>2]|0,e[o>>2]=0,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r),o=t+4|0,r=e[o>>2]|0,e[o>>2]=0,!r){he(t);return}Mt[e[(e[r>>2]|0)+4>>2]&255](r),he(t)}function S2(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0;c=b,b=b+32|0,w=c,m0(w,255,0),d=e[r+4>>2]|0,h=e[r+8>>2]|0,h=h|0?h:e[w+8>>2]|0,l=e[r+12>>2]|0,l=l|0?l:e[w+12>>2]|0,r=e[r+16>>2]|0,o=e[w+16>>2]|0,e[t+160>>2]=d|0?d:e[w+4>>2]|0,e[t+164>>2]=h,e[t+168>>2]=l,C2(t),l=0;do e[t+172+(l*12|0)>>2]=4,e[t+172+(l*12|0)+4>>2]=0,I[t+172+(l*12|0)+8>>1]=0,I[t+172+(l*12|0)+10>>1]=1,l=l+1|0;while((l|0)!=365);w=(r|0?r:o)&255,e[t+4552>>2]=4,e[t+4556>>2]=0,S[t+4560>>0]=w,S[t+4561>>0]=1,S[t+4562>>0]=0,e[t+4564>>2]=4,e[t+4568>>2]=1,S[t+4572>>0]=w,S[t+4573>>0]=1,S[t+4574>>0]=0,e[t+4576>>2]=0,b=c}function A2(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0,D=0,k=0;if(k=b,b=b+16|0,C=k,w=t+92|0,d=e[r>>2]|0,e[r>>2]=0,r=e[w>>2]|0,e[w>>2]=d,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r),e[C>>2]=0,e[C+4>>2]=l,w=o+8|0,e[C+8>>2]=e[w>>2],l){r=Xe(4600)|0,l=t+8|0,c=r+4|0,h=l,d=c+84|0;do e[c>>2]=e[h>>2],c=c+4|0,h=h+4|0;while((c|0)<(d|0));c=r+88|0,d=c+40|0;do e[c>>2]=0,c=c+4|0;while((c|0)<(d|0));e[r>>2]=35688,c=r+132|0,e[c>>2]=0,e[c+4>>2]=0,e[c+8>>2]=0,e[c+12>>2]=0,e[r+148>>2]=e[l>>2],e[r+152>>2]=0,e[r+156>>2]=0,e[r+160>>2]=0,c=r+4544|0,l=r+164|0;do e[l>>2]=0,e[l+4>>2]=0,I[l+8>>1]=0,I[l+10>>1]=1,l=l+12|0;while((l|0)!=(c|0));h=t+4|0,e[c>>2]=0,e[c+4>>2]=0,I[c+8>>1]=0,S[c+10>>0]=0,d=r+4556|0,e[d>>2]=0,e[d+4>>2]=0,I[d+8>>1]=0,S[d+10>>0]=0,d=r+4568|0,e[d>>2]=0,e[d+4>>2]=0,e[d+8>>2]=0,e[d+12>>2]=0,e[d+16>>2]=0,e[d+20>>2]=0,e[d+24>>2]=0,S[d+28>>0]=0,e[r+28>>2]|0||(e[r+20>>2]=1),l=e[h>>2]|0,e[h>>2]=r,l&&(Mt[e[(e[l>>2]|0)+4>>2]&255](l),r=e[h>>2]|0),Y0(r,C)}return C=t+100|0,e[C>>2]=32,e[t+96>>2]=0,r=e[o>>2]|0,r?(e[t+132>>2]=r,c=t+120|0,w=t+124|0,l=e[w>>2]|0,r=e[c>>2]|0,h=r,d=l-h|0,d>>>0>=4e3?d>>>0>4e3&&(D=r+4e3|0,(l|0)!=(D|0))&&(e[w>>2]=D,l=D):(vi(c,4e3-d|0),r=e[c>>2]|0,h=r,l=e[w>>2]|0),e[t+108>>2]=h,e[t+104>>2]=l-r,Ss(t),D=t+116|0,D=e[D>>2]|0,t=e[C>>2]|0,t=t+-32|0,t=(t|0)/8|0,t=D-t|0,b=k,t|0):(e[t+108>>2]=e[o+4>>2],e[t+104>>2]=e[w>>2],Ss(t),D=t+116|0,D=e[D>>2]|0,t=e[C>>2]|0,t=t+-32|0,t=(t|0)/8|0,t=D-t|0,b=k,t|0)}function v2(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0,G=0,$=0,P=0,O=0;if(G=b,b=b+352|0,$=G+328|0,P=G+192|0,o=G+343|0,l=G+342|0,c=G+341|0,h=G+340|0,R=G+176|0,w=G+168|0,C=G+160|0,D=G+152|0,K=G,U=G+136|0,e[t+32>>2]|0&&(e[t+24>>2]|0)!=1){if(_=t+8|0,H=t+36|0,d=e[H>>2]|0,!d){if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[o>>0]|0,$e(44,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}if(t=e[t+16>>2]|0,(t|0)==8)switch(d|0){case 1:{if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[l>>0]|0,$e(45,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 2:{if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[c>>0]|0,$e(46,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 3:{if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[h>>0]|0,$e(47,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}default:{d=P+56|0,c=P+4|0,e[P>>2]=36160,e[d>>2]=36180,g=0,Ae(62,P+56|0,c|0),G=g,g=0,G&1&&(O=j()|0,tt(d),le(O|0)),e[P+128>>2]=0,e[P+132>>2]=-1,e[P>>2]=36200,e[P+56>>2]=36220,g=0,ue(180,c|0),G=g,g=0;do if(G&1)t=j()|0;else{if(e[c>>2]=36236,h=P+36|0,e[h>>2]=0,e[h+4>>2]=0,e[h+8>>2]=0,e[h+12>>2]=0,e[P+52>>2]=16,e[$>>2]=0,e[$+4>>2]=0,e[$+8>>2]=0,g=0,Ae(63,c|0,$|0),G=g,g=0,G&1){t=j()|0,de($),de(h),wt(c);break}de($),g=0,t=Ve(28,P|0,49007,21)|0,$=g,g=0;do if(!($&1)&&(g=0,k=be(36,t|0,e[H>>2]|0)|0,$=g,g=0,!($&1))&&(g=0,Ve(28,k|0,50997,18)|0,$=g,g=0,!($&1))){if(l=Ct(16)|0,g=0,Ae(64,R|0,c|0),$=g,g=0,$&1)t=j()|0;else if(!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,Q|0)|0,bt(8)),g=0,$e(36,l|0,9,35648,R|0),$=g,g=0,$&1?o=1:(g=0,xe(6,l|0,824,96),g=0,o=0),t=j()|0,de(R),!o)break;Tt(l|0)}else O=34;while(!1);(O|0)==34&&(t=j()|0),e[P>>2]=36200,e[d>>2]=36220,e[c>>2]=36236,de(h),wt(c),tt(d),O=t,le(O|0)}while(!1);O=t,tt(d),le(O|0)}}switch((t|0)<=8&&(t=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,Q|0)|0,bt(8)),g=0,xe(7,t|0,8,35648),O=g,g=0,O&1||Qt(t|0,824,96),O=j()|0,Tt(t|0),le(O|0)),o=16-t|0,d|0){case 1:{if(t=Xe(60)|0,e[w>>2]=o,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],e[$>>2]=e[w>>2],e[$+4>>2]=e[w+4>>2],$e(41,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 2:{if(t=Xe(60)|0,e[C>>2]=o,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],e[$>>2]=e[C>>2],e[$+4>>2]=e[C+4>>2],$e(42,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 3:{if(t=Xe(60)|0,e[D>>2]=o,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],e[$>>2]=e[D>>2],e[$+4>>2]=e[D+4>>2],$e(43,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}default:{d=K+56|0,c=K+4|0,e[K>>2]=36160,e[d>>2]=36180,g=0,Ae(62,K+56|0,c|0),P=g,g=0,P&1&&(O=j()|0,tt(d),le(O|0)),e[K+128>>2]=0,e[K+132>>2]=-1,e[K>>2]=36200,e[K+56>>2]=36220,g=0,ue(180,c|0),P=g,g=0;do if(P&1)t=j()|0;else{if(e[c>>2]=36236,h=K+36|0,e[h>>2]=0,e[h+4>>2]=0,e[h+8>>2]=0,e[h+12>>2]=0,e[K+52>>2]=16,e[$>>2]=0,e[$+4>>2]=0,e[$+8>>2]=0,g=0,Ae(63,c|0,$|0),P=g,g=0,P&1){t=j()|0,de($),de(h),wt(c);break}de($),g=0,t=Ve(28,K|0,49007,21)|0,P=g,g=0;do if(!(P&1)&&(g=0,N=be(36,t|0,e[H>>2]|0)|0,P=g,g=0,!(P&1))&&(g=0,Ve(28,N|0,50997,18)|0,P=g,g=0,!(P&1))){if(l=Ct(16)|0,g=0,Ae(64,U|0,c|0),P=g,g=0,P&1)t=j()|0;else if(!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,Q|0)|0,bt(8)),g=0,$e(36,l|0,9,35648,U|0),P=g,g=0,P&1?o=1:(g=0,xe(6,l|0,824,96),g=0,o=0),t=j()|0,de(U),!o)break;Tt(l|0)}else O=64;while(!1);(O|0)==64&&(t=j()|0),e[K>>2]=36200,e[d>>2]=36220,e[c>>2]=36236,de(h),wt(c),tt(d),O=t,le(O|0)}while(!1);O=t,tt(d),le(O|0)}}}return o=e[r+4>>2]|0,l=Xe(16)|0,t=e[t+20>>2]|0,o?(e[l>>2]=36108,e[l+4>>2]=o,e[l+8>>2]=3,e[l+12>>2]=t,O=l,b=G,O|0):(O=e[r>>2]|0,e[l>>2]=36132,e[l+4>>2]=O,e[l+8>>2]=3,e[l+12>>2]=t,O=l,b=G,O|0)}function Ss(t){t=t|0;var r=0,o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0,G=0,$=0,P=0,O=0;K=b,b=b+32|0,$=K+12|0,H=K,R=t+156|0,_=(e[R>>2]|0)+4|0,(e[t+32>>2]|0)==1?U=e[t+24>>2]|0:U=1,r=ee(U<<1,_)|0,e[$>>2]=0,P=$+4|0,e[P>>2]=0,e[$+8>>2]=0;e:do if(r){if(r>>>0>1431655765&&(g=0,ue(178,$|0),G=g,g=0,G&1)||(h=6),(h|0)==6&&(g=0,o=ge(67,r*3|0)|0,G=g,g=0,!(G&1))){for(e[P>>2]=o,e[$>>2]=o,e[$+8>>2]=o+(r*3|0);;)if(S[o>>0]=0,S[o+1>>0]=0,S[o+2>>0]=0,o=(e[P>>2]|0)+3|0,e[P>>2]=o,r=r+-1|0,!r)break e}l=j()|0,r=e[$>>2]|0,r||le(l|0),o=e[P>>2]|0,(o|0)!=(r|0)&&(e[P>>2]=o+(~(((o+-3-r|0)>>>0)/3|0)*3|0)),he(r),le(l|0)}while(!1);e[H>>2]=0,G=H+4|0,e[G>>2]=0,e[H+8>>2]=0;do if(!U)h=19;else{if(U>>>0>1073741823&&(g=0,ue(178,H|0),N=g,g=0,N&1)||(h=17),(h|0)==17&&(l=U<<2,g=0,c=ge(67,l|0)|0,N=g,g=0,!(N&1))){e[H>>2]=c,h=c+(U<<2)|0,e[H+8>>2]=h,Jt(c|0,0,l|0)|0,e[G>>2]=h,h=19;break}l=j()|0,r=e[H>>2]|0,o=r,r&&(c=e[G>>2]|0,(c|0)!=(r|0)&&(e[G>>2]=c+(~((c+-4-o|0)>>>2)<<2)),he(r))}while(!1);if((h|0)==19){c=t+12|0;e:do if((e[c>>2]|0)>0){h=t+4580|0,d=(ee(U,_)|0)+1|0,w=t+4584|0,C=t+92|0,D=(U|0)>0,k=t+4576|0,N=0;t:for(;;){if(l=e[$>>2]|0,r=l+3|0,e[h>>2]=r,o=l+(d*3|0)|0,e[w>>2]=o,N&1?(e[h>>2]=o,e[w>>2]=r,r=1):r=d,o=e[C>>2]|0,g=0,$e(e[(e[o>>2]|0)+12>>2]|0,o|0,l+(r*3|0)|0,e[R>>2]|0,_|0),l=g,g=0,l&1){h=29;break}if(D){r=e[H>>2]|0,o=e[h>>2]|0,l=0;do{if(e[k>>2]=e[r+(l<<2)>>2],O=e[R>>2]|0,r=o+(O*3|0)|0,o=o+((O+-1|0)*3|0)|0,S[r>>0]=S[o>>0]|0,S[r+1>>0]=S[o+1>>0]|0,S[r+2>>0]=S[o+2>>0]|0,r=e[h>>2]|0,o=(e[w>>2]|0)+-3|0,S[o>>0]=S[r>>0]|0,S[o+1>>0]=S[r+1>>0]|0,S[o+2>>0]=S[r+2>>0]|0,g=0,Ae(74,t|0,0),o=g,g=0,o&1){h=28;break t}r=e[H>>2]|0,e[r+(l<<2)>>2]=e[k>>2],o=(e[h>>2]|0)+(_*3|0)|0,e[h>>2]=o,e[w>>2]=(e[w>>2]|0)+(_*3|0),l=l+1|0}while((l|0)<(U|0))}if(N=N+1|0,(N|0)>=(e[c>>2]|0)){h=41;break e}}if((h|0)==28){l=j()|0;break}else if((h|0)==29){l=j()|0;break}}else h=41;while(!1);do if((h|0)==41){if(g=0,ue(182,t|0),O=g,g=0,O&1){l=j()|0;break}if(r=e[H>>2]|0,o=r,r&&(l=e[G>>2]|0,(l|0)!=(r|0)&&(e[G>>2]=l+(~((l+-4-o|0)>>>2)<<2)),he(r)),r=e[$>>2]|0,!r){b=K;return}o=e[P>>2]|0,(o|0)!=(r|0)&&(e[P>>2]=o+(~(((o+-3-r|0)>>>0)/3|0)*3|0)),he(r),b=K;return}while(!1);r=e[H>>2]|0,o=r,r&&(c=e[G>>2]|0,(c|0)!=(r|0)&&(e[G>>2]=c+(~((c+-4-o|0)>>>2)<<2)),he(r))}r=e[$>>2]|0,r||le(l|0),o=e[P>>2]|0,(o|0)!=(r|0)&&(e[P>>2]=o+(~(((o+-3-r|0)>>>0)/3|0)*3|0)),he(r),le(l|0)}function x2(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0,ce=0,ke=0;if(oe=t+156|0,!((e[oe>>2]|0)<=0))for(ne=t+4584|0,ce=t+4580|0,ke=t+4588|0,ie=0;P=ie+-1|0,h=e[ne>>2]|0,d=e[ce>>2]|0,r=ie+1|0,c=F[d+(ie*3|0)>>0]|0,Z=e[ke>>2]|0,w=F[d+(P*3|0)>>0]|0,C=c-w|0,D=F[h+(P*3|0)>>0]|0,k=w-D|0,N=((((S[Z+((F[d+(r*3|0)>>0]|0)-c)>>0]|0)*9|0)+(S[Z+C>>0]|0)|0)*9|0)+(S[Z+k>>0]|0)|0,l=F[d+(ie*3|0)+1>>0]|0,R=F[d+(P*3|0)+1>>0]|0,_=l-R|0,U=F[h+(P*3|0)+1>>0]|0,H=R-U|0,K=((((S[Z+((F[d+(r*3|0)+1>>0]|0)-l)>>0]|0)*9|0)+(S[Z+_>>0]|0)|0)*9|0)+(S[Z+H>>0]|0)|0,o=F[d+(ie*3|0)+2>>0]|0,G=F[d+(P*3|0)+2>>0]|0,$=o-G|0,P=F[h+(P*3|0)+2>>0]|0,O=G-P|0,Z=((((S[Z+((F[d+(r*3|0)+2>>0]|0)-o)>>0]|0)*9|0)+(S[Z+$>>0]|0)|0)*9|0)+(S[Z+O>>0]|0)|0,K|N|Z?(d=F[h+(ie*3|0)>>0]|0,h=c-D>>31,(h^k|0)>=0&&((h^C|0)<0?c=D:c=D-w+c|0),d=er(t,N,d,c,0)|0,h=F[(e[ne>>2]|0)+(ie*3|0)+1>>0]|0,c=l-U>>31,(c^H|0)>=0&&((c^_|0)<0?l=U:l=U-R+l|0),c=er(t,K,h,l,0)|0,h=F[(e[ne>>2]|0)+(ie*3|0)+2>>0]|0,l=o-P>>31,(l^O|0)>=0&&((l^$|0)<0?o=P:o=P-G+o|0),Z=er(t,Z,h,o,0)|0,ie=(e[ne>>2]|0)+(ie*3|0)|0,S[ie>>0]=d,S[ie+1>>0]=c,S[ie+2>>0]=Z):r=(w2(t,ie,0)|0)+ie|0,(r|0)<(e[oe>>2]|0);)ie=r}function w2(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0;for(D=(e[t+156>>2]|0)-r|0,k=e[t+4584>>2]|0,N=e[t+4580>>2]|0,C=k+((r+-1|0)*3|0)|0,R=S[C>>0]|0,w=S[C+1>>0]|0,C=S[C+2>>0]|0,h=0;o=k+((h+r|0)*3|0)|0,l=o+1|0,c=o+2|0,!!(((S[o>>0]|0)==R<<24>>24?(S[l>>0]|0)==w<<24>>24:0)&(S[c>>0]|0)==C<<24>>24);)if(S[o>>0]=R,S[l>>0]=w,S[c>>0]=C,h=h+1|0,(h|0)==(D|0)){h=D;break}if(c=(h|0)==(D|0),d=t+4576|0,l=e[36476+(e[d>>2]<<2)>>2]|0,(1<(h|0))o=h;else{o=h;do _t(t,1,1),l=e[d>>2]|0,o=o-(1<>2])|0,l=(l|0)>30?31:l+1|0,e[d>>2]=l,l=e[36476+(l<<2)>>2]|0;while((o|0)>=(1<>0]|0,r=D+2|0,c=S[r>>0]|0,N=N+(l*3|0)|0,l=S[N+1>>0]|0,K=S[N+2>>0]|0,N=F[N>>0]|0,_=N-(R&255)>>31|1,U=(ee((F[D>>0]|0)-N<<24,_)|0)>>24,H=t+4552|0,tr(t,H,U),R=l&255,l=R-(w&255)>>31|1,o=(ee((o&255)-R<<24,l)|0)>>24,tr(t,H,o),w=K&255,C=w-(C&255)>>31|1,c=(ee((c&255)-w<<24,C)|0)>>24,tr(t,H,c),N=(ee(U,_)|0)+N&255,R=(ee(o,l)|0)+R&255,t=(ee(c,C)|0)+w&255,S[D>>0]=N,S[k>>0]=R,S[r>>0]=t,t=e[d>>2]|0,e[d>>2]=(t|0)<1?0:t+-1|0,t=h+1|0,t|0)}function er(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0;if(U=r>>31,C=(U^r)-U|0,_=t+172+(C*12|0)+10|0,d=I[_>>1]|0,R=t+172+(C*12|0)|0,c=e[R>>2]|0,(d|0)<(c|0))if((d<<1|0)<(c|0))if((d<<2|0)<(c|0))if((d<<3|0)<(c|0))if((d<<4|0)<(c|0))for(h=5;(d<>1]^U)-U+l|0,(c&255|0)==(c|0)?k=c:k=c>>31&255^255,w=(o-k^U)-U<<24,D=w>>24,h?c=0:c=(e[t+172+(C*12|0)+4>>2]<<1)+-1+d>>31,c=c^D,c=c>>30^c<<1,l=c>>h,(l|0)<23?(_t(t,1,l+1|0),_t(t,c&(1<>1]|0,c=d<<16>>16==64,h=c&1,o=(e[l>>2]|0)+D>>h,d=c?32:d<<16>>16,e[R>>2]=(e[R>>2]|0)+((w|0)>-16777216?D:0-D|0)>>h,h=d+1|0,I[_>>1]=h,c=h+o|0,(c|0)<1?(_=I[N>>1]|0,I[N>>1]=(_&65535)-(_<<16>>16>-128&1),_=(c|0)>(~d|0)?c:0-d|0,e[l>>2]=_,U=D^U,r=r>>>31,r=k+r|0,r=r+U|0,r=r&255,r|0):(o|0)<=0?(_=o,e[l>>2]=_,U=D^U,r=r>>>31,r=k+r|0,r=r+U|0,r=r&255,r|0):(_=o-h|0,R=I[N>>1]|0,I[N>>1]=(R<<16>>16<127&1)+(R&65535),_=(_|0)>0?0:_,e[l>>2]=_,U=D^U,r=r>>>31,r=k+r|0,r=r+U|0,r=r&255,r|0)}function tr(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0;if(k=r+9|0,d=F[k>>0]|0,D=r+4|0,C=e[D>>2]|0,c=(ee(d>>>1,C)|0)+(e[r>>2]|0)|0,(d|0)<(c|0)){h=d,l=0;do h=h<<1,l=l+1|0;while((h|0)<(c|0));c=l}else c=0;(o|0)>0&(c|0)==0&&F[r+10>>0]<<1>>>0>>0?l=1:w=5;do if((w|0)==5){if(l=(o|0)<0,l&&F[r+10>>0]<<1>>>0>=d>>>0){l=1;break}l=l&(c|0)!=0}while(!1);if(l=(((o|0)>-1?o:0-o|0)<<1)-C+(l<<31>>31)|0,y2(t,c,l,31-(e[36476+(e[t+4576>>2]<<2)>>2]|0)|0),(o|0)<0&&(t=r+10|0,S[t>>0]=(F[t>>0]|0)+1),l=(l+1-(e[D>>2]|0)>>1)+(e[r>>2]|0)|0,e[r>>2]=l,c=S[k>>0]|0,c<<24>>24!=(S[r+8>>0]|0)){r=c,r=r&255,r=r+1|0,r=r&255,S[k>>0]=r;return}e[r>>2]=l>>1,t=(c&255)>>>1,S[k>>0]=t,r=r+10|0,S[r>>0]=(F[r>>0]|0)>>>1,r=t,r=r&255,r=r+1|0,r=r&255,S[k>>0]=r}function y2(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0;if(c=o>>r,h=l+-8|0,(c|0)<(l+-9|0)){(c|0)>30&&(l=(c|0)/2|0,_t(t,0,l),c=c-l|0),_t(t,1,c+1|0),_t(t,(1<31?(_t(t,0,31),_t(t,1,l+-39|0)):_t(t,1,h),_t(t,o+255&255,8)}function C2(t){t=t|0;var r=0,o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0;if(D=b,b=b+32|0,w=D,m0(w,255,0),C=t+160|0,(e[w+4>>2]|0)==(e[C>>2]|0)&&(e[w+8>>2]|0)==(e[t+164>>2]|0)&&(e[w+12>>2]|0)==(e[t+168>>2]|0)){C=e[8900]|0,e[t+4588>>2]=C+(((e[8901]|0)-C|0)>>>1),b=D;return}for(o=t+4592|0,l=t+4596|0,c=e[l>>2]|0,r=e[o>>2]|0,h=c-r|0,h>>>0>=512?h>>>0>512&&(d=r+512|0,(c|0)!=(d|0))&&(e[l>>2]=d):(j0(o,512-h|0),r=e[o>>2]|0),w=t+4588|0,e[w>>2]=r+256,d=t+168|0,c=t+164|0,h=-256;;){if(r=e[d>>2]|0,(h|0)>(0-r|0))if(o=e[c>>2]|0,(h|0)>(0-o|0))if(l=e[C>>2]|0,(h|0)>(0-l|0))if((h|0)>=0){if((h|0)<1){S[(e[w>>2]|0)+h>>0]=0,h=1;continue}(l|0)<=(h|0)?(o|0)>(h|0)?r=2:r=(r|0)>(h|0)?3:4:r=1}else r=-1;else r=-2;else r=-3;else r=-4;if(S[(e[w>>2]|0)+h>>0]=r,h=h+1|0,(h|0)==256)break}b=D}function T2(t){t=t|0;var r=0,o=0;e[t>>2]=35884,r=e[t+4616>>2]|0,r&&(o=t+4620|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),e[t>>2]=36612,r=e[t+120>>2]|0,r&&(o=t+124|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),o=t+92|0,r=e[o>>2]|0,e[o>>2]=0,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r),t=t+4|0,r=e[t>>2]|0,e[t>>2]=0,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r)}function I2(t){t=t|0;var r=0,o=0;if(e[t>>2]=35884,r=e[t+4616>>2]|0,r&&(o=t+4620|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),e[t>>2]=36612,r=e[t+120>>2]|0,r&&(o=t+124|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),o=t+92|0,r=e[o>>2]|0,e[o>>2]=0,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r),o=t+4|0,r=e[o>>2]|0,e[o>>2]=0,!r){he(t);return}Mt[e[(e[r>>2]|0)+4>>2]&255](r),he(t)}function E2(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0;d=b,b=b+32|0,C=d,m0(C,e[t+136>>2]|0,e[t+144>>2]|0),w=e[r+4>>2]|0,h=e[r+8>>2]|0,h=h|0?h:e[C+8>>2]|0,c=e[r+12>>2]|0,c=c|0?c:e[C+12>>2]|0,o=e[r+16>>2]|0,l=e[C+16>>2]|0,e[t+184>>2]=w|0?w:e[C+4>>2]|0,e[t+188>>2]=h,e[t+192>>2]=c,P2(t),c=t+140|0,r=(e[c>>2]|0)+32|0,r=(r|0)<128?2:(r|0)/64|0,h=0;do e[t+196+(h*12|0)>>2]=r,e[t+196+(h*12|0)+4>>2]=0,I[t+196+(h*12|0)+8>>1]=0,I[t+196+(h*12|0)+10>>1]=1,h=h+1|0;while((h|0)!=365);w=(e[c>>2]|0)+32|0,w=(w|0)<128?2:(w|0)/64|0,C=(o|0?o:l)&255,e[t+4576>>2]=w,e[t+4580>>2]=0,S[t+4584>>0]=C,S[t+4585>>0]=1,S[t+4586>>0]=0,e[t+4588>>2]=w,e[t+4592>>2]=1,S[t+4596>>0]=C,S[t+4597>>0]=1,S[t+4598>>0]=0,e[t+4600>>2]=0,b=d}function D2(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0,D=0,k=0;if(k=b,b=b+16|0,C=k,w=t+92|0,d=e[r>>2]|0,e[r>>2]=0,r=e[w>>2]|0,e[w>>2]=d,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r),e[C>>2]=0,e[C+4>>2]=l,w=o+8|0,e[C+8>>2]=e[w>>2],l){r=Xe(4624)|0,l=t+8|0,c=r+4|0,h=l,d=c+84|0;do e[c>>2]=e[h>>2],c=c+4|0,h=h+4|0;while((c|0)<(d|0));c=r+88|0,d=c+40|0;do e[c>>2]=0,c=c+4|0;while((c|0)<(d|0));e[r>>2]=35660,e[r+128>>2]=e[t+136>>2],e[r+132>>2]=e[t+140>>2],e[r+136>>2]=e[t+144>>2],e[r+140>>2]=e[t+148>>2],e[r+144>>2]=e[t+152>>2],e[r+148>>2]=e[t+156>>2],e[r+152>>2]=e[t+160>>2],c=r+156|0,e[c>>2]=0,e[c+4>>2]=0,e[c+8>>2]=0,e[c+12>>2]=0,e[r+172>>2]=e[l>>2],e[r+176>>2]=0,e[r+180>>2]=0,e[r+184>>2]=0,c=r+4568|0,l=r+188|0;do e[l>>2]=0,e[l+4>>2]=0,I[l+8>>1]=0,I[l+10>>1]=1,l=l+12|0;while((l|0)!=(c|0));h=t+4|0,e[c>>2]=0,e[c+4>>2]=0,I[c+8>>1]=0,S[c+10>>0]=0,d=r+4580|0,e[d>>2]=0,e[d+4>>2]=0,I[d+8>>1]=0,S[d+10>>0]=0,d=r+4592|0,e[d>>2]=0,e[d+4>>2]=0,e[d+8>>2]=0,e[d+12>>2]=0,e[d+16>>2]=0,e[d+20>>2]=0,e[d+24>>2]=0,S[d+28>>0]=0,e[r+28>>2]|0||(e[r+20>>2]=1),l=e[h>>2]|0,e[h>>2]=r,l&&(Mt[e[(e[l>>2]|0)+4>>2]&255](l),r=e[h>>2]|0),Y0(r,C)}return C=t+100|0,e[C>>2]=32,e[t+96>>2]=0,r=e[o>>2]|0,r?(e[t+132>>2]=r,c=t+120|0,w=t+124|0,l=e[w>>2]|0,r=e[c>>2]|0,h=r,d=l-h|0,d>>>0>=4e3?d>>>0>4e3&&(D=r+4e3|0,(l|0)!=(D|0))&&(e[w>>2]=D,l=D):(vi(c,4e3-d|0),r=e[c>>2]|0,h=r,l=e[w>>2]|0),e[t+108>>2]=h,e[t+104>>2]=l-r,As(t),D=t+116|0,D=e[D>>2]|0,t=e[C>>2]|0,t=t+-32|0,t=(t|0)/8|0,t=D-t|0,b=k,t|0):(e[t+108>>2]=e[o+4>>2],e[t+104>>2]=e[w>>2],As(t),D=t+116|0,D=e[D>>2]|0,t=e[C>>2]|0,t=t+-32|0,t=(t|0)/8|0,t=D-t|0,b=k,t|0)}function N2(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0,G=0,$=0,P=0,O=0;if(G=b,b=b+352|0,$=G+328|0,P=G+192|0,o=G+343|0,l=G+342|0,c=G+341|0,h=G+340|0,R=G+176|0,w=G+168|0,C=G+160|0,D=G+152|0,K=G,U=G+136|0,e[t+32>>2]|0&&(e[t+24>>2]|0)!=1){if(_=t+8|0,H=t+36|0,d=e[H>>2]|0,!d){if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[o>>0]|0,$e(44,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}if(t=e[t+16>>2]|0,(t|0)==8)switch(d|0){case 1:{if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[l>>0]|0,$e(45,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 2:{if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[c>>0]|0,$e(46,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 3:{if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[h>>0]|0,$e(47,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}default:{d=P+56|0,c=P+4|0,e[P>>2]=36160,e[d>>2]=36180,g=0,Ae(62,P+56|0,c|0),G=g,g=0,G&1&&(O=j()|0,tt(d),le(O|0)),e[P+128>>2]=0,e[P+132>>2]=-1,e[P>>2]=36200,e[P+56>>2]=36220,g=0,ue(180,c|0),G=g,g=0;do if(G&1)t=j()|0;else{if(e[c>>2]=36236,h=P+36|0,e[h>>2]=0,e[h+4>>2]=0,e[h+8>>2]=0,e[h+12>>2]=0,e[P+52>>2]=16,e[$>>2]=0,e[$+4>>2]=0,e[$+8>>2]=0,g=0,Ae(63,c|0,$|0),G=g,g=0,G&1){t=j()|0,de($),de(h),wt(c);break}de($),g=0,t=Ve(28,P|0,49007,21)|0,$=g,g=0;do if(!($&1)&&(g=0,k=be(36,t|0,e[H>>2]|0)|0,$=g,g=0,!($&1))&&(g=0,Ve(28,k|0,50997,18)|0,$=g,g=0,!($&1))){if(l=Ct(16)|0,g=0,Ae(64,R|0,c|0),$=g,g=0,$&1)t=j()|0;else if(!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,Q|0)|0,bt(8)),g=0,$e(36,l|0,9,35648,R|0),$=g,g=0,$&1?o=1:(g=0,xe(6,l|0,824,96),g=0,o=0),t=j()|0,de(R),!o)break;Tt(l|0)}else O=34;while(!1);(O|0)==34&&(t=j()|0),e[P>>2]=36200,e[d>>2]=36220,e[c>>2]=36236,de(h),wt(c),tt(d),O=t,le(O|0)}while(!1);O=t,tt(d),le(O|0)}}switch((t|0)<=8&&(t=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,Q|0)|0,bt(8)),g=0,xe(7,t|0,8,35648),O=g,g=0,O&1||Qt(t|0,824,96),O=j()|0,Tt(t|0),le(O|0)),o=16-t|0,d|0){case 1:{if(t=Xe(60)|0,e[w>>2]=o,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],e[$>>2]=e[w>>2],e[$+4>>2]=e[w+4>>2],$e(41,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 2:{if(t=Xe(60)|0,e[C>>2]=o,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],e[$>>2]=e[C>>2],e[$+4>>2]=e[C+4>>2],$e(42,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 3:{if(t=Xe(60)|0,e[D>>2]=o,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],e[$>>2]=e[D>>2],e[$+4>>2]=e[D+4>>2],$e(43,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}default:{d=K+56|0,c=K+4|0,e[K>>2]=36160,e[d>>2]=36180,g=0,Ae(62,K+56|0,c|0),P=g,g=0,P&1&&(O=j()|0,tt(d),le(O|0)),e[K+128>>2]=0,e[K+132>>2]=-1,e[K>>2]=36200,e[K+56>>2]=36220,g=0,ue(180,c|0),P=g,g=0;do if(P&1)t=j()|0;else{if(e[c>>2]=36236,h=K+36|0,e[h>>2]=0,e[h+4>>2]=0,e[h+8>>2]=0,e[h+12>>2]=0,e[K+52>>2]=16,e[$>>2]=0,e[$+4>>2]=0,e[$+8>>2]=0,g=0,Ae(63,c|0,$|0),P=g,g=0,P&1){t=j()|0,de($),de(h),wt(c);break}de($),g=0,t=Ve(28,K|0,49007,21)|0,P=g,g=0;do if(!(P&1)&&(g=0,N=be(36,t|0,e[H>>2]|0)|0,P=g,g=0,!(P&1))&&(g=0,Ve(28,N|0,50997,18)|0,P=g,g=0,!(P&1))){if(l=Ct(16)|0,g=0,Ae(64,U|0,c|0),P=g,g=0,P&1)t=j()|0;else if(!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,Q|0)|0,bt(8)),g=0,$e(36,l|0,9,35648,U|0),P=g,g=0,P&1?o=1:(g=0,xe(6,l|0,824,96),g=0,o=0),t=j()|0,de(U),!o)break;Tt(l|0)}else O=64;while(!1);(O|0)==64&&(t=j()|0),e[K>>2]=36200,e[d>>2]=36220,e[c>>2]=36236,de(h),wt(c),tt(d),O=t,le(O|0)}while(!1);O=t,tt(d),le(O|0)}}}return o=e[r+4>>2]|0,l=Xe(16)|0,t=e[t+20>>2]|0,o?(e[l>>2]=36108,e[l+4>>2]=o,e[l+8>>2]=1,e[l+12>>2]=t,O=l,b=G,O|0):(O=e[r>>2]|0,e[l>>2]=36132,e[l+4>>2]=O,e[l+8>>2]=1,e[l+12>>2]=t,O=l,b=G,O|0)}function As(t){t=t|0;var r=0,o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0,G=0,$=0,P=0;K=b,b=b+32|0,$=K+12|0,H=K,_=t+180|0,U=(e[_>>2]|0)+4|0,(e[t+32>>2]|0)==1?N=e[t+24>>2]|0:N=1,r=ee(N<<1,U)|0,e[$>>2]=0,P=$+4|0,e[P>>2]=0,e[$+8>>2]=0;e:do if(r){if((r|0)<0&&(g=0,ue(178,$|0),G=g,g=0,G&1)||(R=6),(R|0)==6&&(g=0,o=ge(67,r|0)|0,G=g,g=0,!(G&1))){for(e[P>>2]=o,e[$>>2]=o,e[$+8>>2]=o+r;;)if(S[o>>0]=0,o=(e[P>>2]|0)+1|0,e[P>>2]=o,r=r+-1|0,!r)break e}o=j()|0,r=e[$>>2]|0,r||le(o|0),(e[P>>2]|0)!=(r|0)&&(e[P>>2]=r),he(r),le(o|0)}while(!1);e[H>>2]=0,G=H+4|0,e[G>>2]=0,e[H+8>>2]=0;do if(!N)R=19;else{if(N>>>0>1073741823&&(g=0,ue(178,H|0),k=g,g=0,k&1)||(R=17),(R|0)==17&&(l=N<<2,g=0,c=ge(67,l|0)|0,k=g,g=0,!(k&1))){e[H>>2]=c,R=c+(N<<2)|0,e[H+8>>2]=R,Jt(c|0,0,l|0)|0,e[G>>2]=R,R=19;break}o=j()|0,r=e[H>>2]|0,l=r,r&&(c=e[G>>2]|0,(c|0)!=(r|0)&&(e[G>>2]=c+(~((c+-4-l|0)>>>2)<<2)),he(r))}while(!1);if((R|0)==19){d=t+12|0;e:do if((e[d>>2]|0)>0){if(w=t+4604|0,C=(ee(N,U)|0)+1|0,D=t+4608|0,k=t+92|0,h=t+4600|0,(N|0)>0)c=0;else{for(l=0;o=e[$>>2]|0,r=o+1|0,e[w>>2]=r,o=o+C|0,e[D>>2]=o,l&1?(e[w>>2]=o,e[D>>2]=r):r=o,N=e[k>>2]|0,g=0,$e(e[(e[N>>2]|0)+12>>2]|0,N|0,r|0,e[_>>2]|0,U|0),N=g,g=0,!(N&1);)if(l=l+1|0,(l|0)>=(e[d>>2]|0)){R=45;break e}o=j()|0;break}t:for(;;){if(o=e[$>>2]|0,r=o+1|0,e[w>>2]=r,o=o+C|0,e[D>>2]=o,c&1?(e[w>>2]=o,e[D>>2]=r):r=o,R=e[k>>2]|0,g=0,$e(e[(e[R>>2]|0)+12>>2]|0,R|0,r|0,e[_>>2]|0,U|0),R=g,g=0,R&1){R=28;break}r=e[H>>2]|0,o=e[w>>2]|0,l=0;do{if(e[h>>2]=e[r+(l<<2)>>2],R=e[_>>2]|0,S[o+R>>0]=S[o+(R+-1)>>0]|0,S[(e[D>>2]|0)+-1>>0]=S[e[w>>2]>>0]|0,g=0,Ae(75,t|0,0),R=g,g=0,R&1){R=36;break t}r=e[H>>2]|0,e[r+(l<<2)>>2]=e[h>>2],o=(e[w>>2]|0)+U|0,e[w>>2]=o,e[D>>2]=(e[D>>2]|0)+U,l=l+1|0}while((l|0)<(N|0));if(c=c+1|0,(c|0)>=(e[d>>2]|0)){R=45;break e}}if((R|0)==28){o=j()|0;break}else if((R|0)==36){o=j()|0;break}}else R=45;while(!1);do if((R|0)==45){if(g=0,ue(182,t|0),t=g,g=0,t&1){o=j()|0;break}if(r=e[H>>2]|0,o=r,r&&(l=e[G>>2]|0,(l|0)!=(r|0)&&(e[G>>2]=l+(~((l+-4-o|0)>>>2)<<2)),he(r)),r=e[$>>2]|0,!r){b=K;return}(e[P>>2]|0)!=(r|0)&&(e[P>>2]=r),he(r),b=K;return}while(!1);r=e[H>>2]|0,l=r,r&&(c=e[G>>2]|0,(c|0)!=(r|0)&&(e[G>>2]=c+(~((c+-4-l|0)>>>2)<<2)),he(r))}r=e[$>>2]|0,r||le(o|0),(e[P>>2]|0)!=(r|0)&&(e[P>>2]=r),he(r),le(o|0)}function F2(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0;if(N=t+4604|0,r=e[N>>2]|0,U=t+180|0,!((e[U>>2]|0)<=0))for(R=t+4608|0,_=t+4612|0,c=r,h=F[r+-1>>0]|0,r=F[r>>0]|0,k=0;D=e[R>>2]|0,C=F[D+(k+-1)>>0]|0,l=k+1|0,o=F[c+l>>0]|0,w=e[_>>2]|0,d=r-h|0,c=h-C|0,w=((((S[w+(o-r)>>0]|0)*9|0)+(S[w+d>>0]|0)|0)*9|0)+(S[w+c>>0]|0)|0,w?(h=r-C>>31,(h^c|0)<0?c=r:c=C+((h^d|0)<0?0:d)|0,D=R2(t,w,F[D+k>>0]|0,c,0)|0,S[(e[R>>2]|0)+k>>0]=D):(l=(M2(t,k,0)|0)+k|0,o=e[N>>2]|0,r=F[o+(l+-1)>>0]|0,o=F[o+l>>0]|0),!((l|0)>=(e[U>>2]|0));)c=e[N>>2]|0,h=r,r=o,k=l}function R2(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0;if(H=r>>31,h=(H^r)-H|0,_=t+196+(h*12|0)+10|0,d=I[_>>1]|0,R=t+196+(h*12|0)|0,c=e[R>>2]|0,(d|0)<(c|0))if((d<<1|0)<(c|0))if((d<<2|0)<(c|0))if((d<<3|0)<(c|0))if((d<<4|0)<(c|0))for(r=5;(d<>1]^H)-H+l|0,U=t+136|0,l=e[U>>2]|0,(c&l|0)==(c|0)?D=c:D=l&~(c>>31),c=(o-D^H)-H|0,C=t+144|0,l=e[C>>2]|0,(c|0)>0?c=(c+l|0)/(l<<1|1|0)|0:c=(c-l|0)/(l<<1|1|0)|0,N=t+140|0,w=e[N>>2]|0,o=((c|0)<0?w:0)+c|0,w=o-((o|0)<((w+1|0)/2|0|0)?0:w)|0,h=t+196+(h*12|0)+4|0,l|r?c=0:c=(e[h>>2]<<1)+-1+d>>31,l=c^w,xs(t,r,l>>30^l<<1,e[t+156>>2]|0),l=e[t+160>>2]|0,r=(e[R>>2]|0)+((w|0)>-1?w:0-w|0)|0,c=(e[h>>2]|0)+(ee(e[C>>2]<<1|1,w)|0)|0,o=I[_>>1]|0,(o|0)==(l|0)&&(r=r>>1,c=c>>1,o=l>>1),e[R>>2]=r,l=o+1|0,I[_>>1]=l,r=l+c|0,(r|0)>=1?(c|0)>0&&(c=c-l|0,_=I[k>>1]|0,I[k>>1]=(_<<16>>16<127&1)+(_&65535),c=(c|0)>0?0:c):(c=I[k>>1]|0,I[k>>1]=(c&65535)-(c<<16>>16>-128&1),c=(r|0)>(~o|0)?r:0-o|0),e[h>>2]=c,l=e[C>>2]|0,o=l<<1|1,r=(ee(o,(w^H)-H|0)|0)+D|0,(r|0)>=(0-l|0)?(c=e[U>>2]|0,(c+l|0)<(r|0)&&(r=r-(ee(e[N>>2]|0,o)|0)|0)):(r=(ee(e[N>>2]|0,o)|0)+r|0,c=e[U>>2]|0),(r&c|0)==(r|0)?(H=r,H=H&255,H|0):(H=c&~(r>>31),H=H&255,H|0)}function M2(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0;for(C=(e[t+180>>2]|0)-r|0,D=e[t+4608>>2]|0,k=e[t+4604>>2]|0,c=S[D+(r+-1)>>0]|0,w=c&255,o=t+144|0,h=0;l=D+(h+r)|0,d=(F[l>>0]|0)-w|0,!((((d|0)>-1?d:0-d|0)|0)>(e[o>>2]|0));)if(S[l>>0]=c,h=h+1|0,(h|0)==(C|0)){h=C;break}if(c=(h|0)==(C|0),d=t+4600|0,l=e[36476+(e[d>>2]<<2)>>2]|0,(1<(h|0))o=h;else{o=h;do _t(t,1,1),l=e[d>>2]|0,o=o-(1<>2])|0,l=(l|0)>30?31:l+1|0,e[d>>2]=l,l=e[36476+(l<<2)>>2]|0;while((o|0)>=(1<>0]|0,w,F[k+C>>0]|0)|0,S[r>>0]=t,t=e[d>>2]|0,e[d>>2]=(t|0)<1?0:t+-1|0,t=h+1|0,t|0)}function _2(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0;return w=o-l|0,C=t+136|0,d=t+144|0,c=e[d>>2]|0,(((w|0)>-1?w:0-w|0)|0)>(c|0)?(h=l-o>>31|1,r=ee(h,r-l|0)|0,(r|0)>0?r=(c+r|0)/(c<<1|1|0)|0:r=(r-c|0)/(c<<1|1|0)|0,w=t+140|0,c=e[w>>2]|0,o=((r|0)<0?c:0)+r|0,c=o-((o|0)<((c+1|0)/2|0|0)?0:c)|0,vs(t,t+4576|0,c),c=ee(c,h)|0,h=e[d>>2]|0,d=h<<1|1,c=(ee(c,d)|0)+l|0,(c|0)>=(0-h|0)?(r=e[C>>2]|0,(r+h|0)<(c|0)&&(c=c-(ee(e[w>>2]|0,d)|0)|0)):(c=(ee(e[w>>2]|0,d)|0)+c|0,r=e[C>>2]|0),(c&r|0)==(c|0)?(C=c,C=C&255,C|0):(C=r&~(c>>31),C=C&255,C|0)):(r=r-o|0,(r|0)>0?r=(c+r|0)/(c<<1|1|0)|0:r=(r-c|0)/(c<<1|1|0)|0,w=t+140|0,c=e[w>>2]|0,h=((r|0)<0?c:0)+r|0,c=h-((h|0)<((c+1|0)/2|0|0)?0:c)|0,vs(t,t+4588|0,c),h=e[d>>2]|0,d=h<<1|1,c=(ee(d,c)|0)+o|0,(c|0)>=(0-h|0)?(r=e[C>>2]|0,(r+h|0)<(c|0)&&(c=c-(ee(e[w>>2]|0,d)|0)|0)):(c=(ee(e[w>>2]|0,d)|0)+c|0,r=e[C>>2]|0),(c&r|0)==(c|0)?(C=c,C=C&255,C|0):(C=r&~(c>>31),C=C&255,C|0))}function vs(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0;if(k=r+9|0,d=F[k>>0]|0,D=r+4|0,C=e[D>>2]|0,c=(ee(d>>>1,C)|0)+(e[r>>2]|0)|0,(d|0)<(c|0)){h=d,l=0;do h=h<<1,l=l+1|0;while((h|0)<(c|0));c=l}else c=0;(o|0)>0&(c|0)==0&&F[r+10>>0]<<1>>>0>>0?l=1:w=5;do if((w|0)==5){if(l=(o|0)<0,l&&F[r+10>>0]<<1>>>0>=d>>>0){l=1;break}l=l&(c|0)!=0}while(!1);if(l=(((o|0)>-1?o:0-o|0)<<1)-C+(l<<31>>31)|0,xs(t,c,l,(e[t+156>>2]|0)+-1-(e[36476+(e[t+4600>>2]<<2)>>2]|0)|0),(o|0)<0&&(t=r+10|0,S[t>>0]=(F[t>>0]|0)+1),l=(l+1-(e[D>>2]|0)>>1)+(e[r>>2]|0)|0,e[r>>2]=l,c=S[k>>0]|0,c<<24>>24!=(S[r+8>>0]|0)){r=c,r=r&255,r=r+1|0,r=r&255,S[k>>0]=r;return}e[r>>2]=l>>1,t=(c&255)>>>1,S[k>>0]=t,r=r+10|0,S[r>>0]=(F[r>>0]|0)>>>1,r=t,r=r&255,r=r+1|0,r=r&255,S[k>>0]=r}function xs(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0;if(c=o>>r,h=t+148|0,d=l-(e[h>>2]|0)|0,(c|0)<(d+-1|0)){(c|0)>30&&(l=(c|0)/2|0,_t(t,0,l),c=c-l|0),_t(t,1,c+1|0),_t(t,(1<31?(_t(t,0,31),_t(t,1,l+-31-(e[h>>2]|0)|0)):_t(t,1,d),r=e[h>>2]|0,_t(t,(1<>2]|0)r=t+152|0;else if(o=e[t+136>>2]|0,r=t+152|0,(o|0)==((1<>2])+-1|0)&&(m0(l,o,0),(e[l+4>>2]|0)==(e[t+184>>2]|0))&&(e[l+8>>2]|0)==(e[t+188>>2]|0)&&(e[l+12>>2]|0)==(e[t+192>>2]|0))switch(e[r>>2]|0){case 8:{N=e[8900]|0,e[t+4612>>2]=N+(((e[8901]|0)-N|0)>>>1),b=R;return}case 10:{N=e[8903]|0,e[t+4612>>2]=N+(((e[8904]|0)-N|0)>>>1),b=R;return}case 12:{N=e[8906]|0,e[t+4612>>2]=N+(((e[8907]|0)-N|0)>>>1),b=R;return}case 16:{N=e[8909]|0,e[t+4612>>2]=N+(((e[8910]|0)-N|0)>>>1),b=R;return}default:break e}while(!1);if(k=1<>2],o=t+4616|0,l=k<<1,c=t+4620|0,h=e[c>>2]|0,r=e[o>>2]|0,d=h-r|0,l>>>0<=d>>>0?l>>>0>>0&&(w=r+l|0,(h|0)!=(w|0))&&(e[c>>2]=w):(j0(o,l-d|0),r=e[o>>2]|0),D=t+4612|0,e[D>>2]=r+k,r=0-k|0,(k|0)<=(r|0)){b=R;return}w=t+192|0,C=t+188|0,d=t+184|0,h=r;do r=e[w>>2]|0,(h|0)>(0-r|0)?(o=e[C>>2]|0,(h|0)>(0-o|0)?(l=e[d>>2]|0,(h|0)>(0-l|0)?(c=e[N>>2]|0,(h|0)>=(0-c|0)?(c|0)<(h|0)?(l|0)<=(h|0)?(o|0)>(h|0)?r=2:r=(r|0)>(h|0)?3:4:r=1:r=0:r=-1):r=-2):r=-3):r=-4,S[(e[D>>2]|0)+h>>0]=r,h=h+1|0;while((h|0)!=(k|0));b=R}function L2(t){t=t|0;var r=0,o=0;e[t>>2]=35856,r=e[t+4608>>2]|0,r&&(o=t+4612|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),e[t>>2]=36736,r=e[t+92>>2]|0,r&&(o=t+96|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),t=t+88|0,r=e[t>>2]|0,e[t>>2]=0,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r)}function O2(t){t=t|0;var r=0,o=0;if(e[t>>2]=35856,r=e[t+4608>>2]|0,r&&(o=t+4612|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),e[t>>2]=36736,r=e[t+92>>2]|0,r&&(o=t+96|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),o=t+88|0,r=e[o>>2]|0,e[o>>2]=0,!r){he(t);return}Mt[e[(e[r>>2]|0)+4>>2]&255](r),he(t)}function $2(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0,G=0,$=0,P=0,O=0;if(G=b,b=b+352|0,$=G+328|0,P=G+192|0,o=G+343|0,l=G+342|0,c=G+341|0,h=G+340|0,R=G+176|0,w=G+168|0,C=G+160|0,D=G+152|0,K=G,U=G+136|0,e[t+28>>2]|0&&(e[t+20>>2]|0)!=1){if(_=t+4|0,H=t+32|0,d=e[H>>2]|0,!d){if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[o>>0]|0,$e(37,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}if(t=e[t+12>>2]|0,(t|0)==16)switch(d|0){case 1:{if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[l>>0]|0,$e(38,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 2:{if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[c>>0]|0,$e(39,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 3:{if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[h>>0]|0,$e(40,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}default:{d=P+56|0,c=P+4|0,e[P>>2]=36160,e[d>>2]=36180,g=0,Ae(62,P+56|0,c|0),G=g,g=0,G&1&&(O=j()|0,tt(d),le(O|0)),e[P+128>>2]=0,e[P+132>>2]=-1,e[P>>2]=36200,e[P+56>>2]=36220,g=0,ue(180,c|0),G=g,g=0;do if(G&1)t=j()|0;else{if(e[c>>2]=36236,h=P+36|0,e[h>>2]=0,e[h+4>>2]=0,e[h+8>>2]=0,e[h+12>>2]=0,e[P+52>>2]=16,e[$>>2]=0,e[$+4>>2]=0,e[$+8>>2]=0,g=0,Ae(63,c|0,$|0),G=g,g=0,G&1){t=j()|0,de($),de(h),wt(c);break}de($),g=0,t=Ve(28,P|0,49007,21)|0,$=g,g=0;do if(!($&1)&&(g=0,k=be(36,t|0,e[H>>2]|0)|0,$=g,g=0,!($&1))&&(g=0,Ve(28,k|0,50997,18)|0,$=g,g=0,!($&1))){if(l=Ct(16)|0,g=0,Ae(64,R|0,c|0),$=g,g=0,$&1)t=j()|0;else if(!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,Q|0)|0,bt(8)),g=0,$e(36,l|0,9,35648,R|0),$=g,g=0,$&1?o=1:(g=0,xe(6,l|0,824,96),g=0,o=0),t=j()|0,de(R),!o)break;Tt(l|0)}else O=34;while(!1);(O|0)==34&&(t=j()|0),e[P>>2]=36200,e[d>>2]=36220,e[c>>2]=36236,de(h),wt(c),tt(d),O=t,le(O|0)}while(!1);O=t,tt(d),le(O|0)}}switch((t|0)<=8&&(t=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,Q|0)|0,bt(8)),g=0,xe(7,t|0,8,35648),O=g,g=0,O&1||Qt(t|0,824,96),O=j()|0,Tt(t|0),le(O|0)),o=16-t|0,d|0){case 1:{if(t=Xe(60)|0,e[w>>2]=o,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],e[$>>2]=e[w>>2],e[$+4>>2]=e[w+4>>2],$e(41,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 2:{if(t=Xe(60)|0,e[C>>2]=o,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],e[$>>2]=e[C>>2],e[$+4>>2]=e[C+4>>2],$e(42,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 3:{if(t=Xe(60)|0,e[D>>2]=o,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],e[$>>2]=e[D>>2],e[$+4>>2]=e[D+4>>2],$e(43,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}default:{d=K+56|0,c=K+4|0,e[K>>2]=36160,e[d>>2]=36180,g=0,Ae(62,K+56|0,c|0),P=g,g=0,P&1&&(O=j()|0,tt(d),le(O|0)),e[K+128>>2]=0,e[K+132>>2]=-1,e[K>>2]=36200,e[K+56>>2]=36220,g=0,ue(180,c|0),P=g,g=0;do if(P&1)t=j()|0;else{if(e[c>>2]=36236,h=K+36|0,e[h>>2]=0,e[h+4>>2]=0,e[h+8>>2]=0,e[h+12>>2]=0,e[K+52>>2]=16,e[$>>2]=0,e[$+4>>2]=0,e[$+8>>2]=0,g=0,Ae(63,c|0,$|0),P=g,g=0,P&1){t=j()|0,de($),de(h),wt(c);break}de($),g=0,t=Ve(28,K|0,49007,21)|0,P=g,g=0;do if(!(P&1)&&(g=0,N=be(36,t|0,e[H>>2]|0)|0,P=g,g=0,!(P&1))&&(g=0,Ve(28,N|0,50997,18)|0,P=g,g=0,!(P&1))){if(l=Ct(16)|0,g=0,Ae(64,U|0,c|0),P=g,g=0,P&1)t=j()|0;else if(!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,Q|0)|0,bt(8)),g=0,$e(36,l|0,9,35648,U|0),P=g,g=0,P&1?o=1:(g=0,xe(6,l|0,824,96),g=0,o=0),t=j()|0,de(U),!o)break;Tt(l|0)}else O=64;while(!1);(O|0)==64&&(t=j()|0),e[K>>2]=36200,e[d>>2]=36220,e[c>>2]=36236,de(h),wt(c),tt(d),O=t,le(O|0)}while(!1);O=t,tt(d),le(O|0)}}}return o=e[r+4>>2]|0,l=Xe(16)|0,t=e[t+16>>2]|0,o?(e[l>>2]=36108,e[l+4>>2]=o,e[l+8>>2]=2,e[l+12>>2]=t,O=l,b=G,O|0):(O=e[r>>2]|0,e[l>>2]=36132,e[l+4>>2]=O,e[l+8>>2]=2,e[l+12>>2]=t,O=l,b=G,O|0)}function B2(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0;d=b,b=b+32|0,C=d,m0(C,e[t+128>>2]|0,e[t+136>>2]|0),w=e[r+4>>2]|0,h=e[r+8>>2]|0,h=h|0?h:e[C+8>>2]|0,c=e[r+12>>2]|0,c=c|0?c:e[C+12>>2]|0,o=e[r+16>>2]|0,l=e[C+16>>2]|0,e[t+176>>2]=w|0?w:e[C+4>>2]|0,e[t+180>>2]=h,e[t+184>>2]=c,Q2(t),c=t+132|0,r=(e[c>>2]|0)+32|0,r=(r|0)<128?2:(r|0)/64|0,h=0;do e[t+188+(h*12|0)>>2]=r,e[t+188+(h*12|0)+4>>2]=0,I[t+188+(h*12|0)+8>>1]=0,I[t+188+(h*12|0)+10>>1]=1,h=h+1|0;while((h|0)!=365);w=(e[c>>2]|0)+32|0,w=(w|0)<128?2:(w|0)/64|0,C=(o|0?o:l)&255,e[t+4568>>2]=w,e[t+4572>>2]=0,S[t+4576>>0]=C,S[t+4577>>0]=1,S[t+4578>>0]=0,e[t+4580>>2]=w,e[t+4584>>2]=1,S[t+4588>>0]=C,S[t+4589>>0]=1,S[t+4590>>0]=0,e[t+4592>>2]=0,b=d}function V2(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0;for(d=t+88|0,h=e[r>>2]|0,e[r>>2]=0,r=e[d>>2]|0,e[d>>2]=h,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r),d=l+4|0,h=e[d>>2]|0,S[t+4620>>0]=c&1,r=t+156|0,e[r>>2]=e[o>>2],e[r+4>>2]=e[o+4>>2],e[r+8>>2]=e[o+8>>2],e[r+12>>2]=e[o+12>>2],Y0(t,l),U2(t),r=e[t+116>>2]|0,t=e[t+112>>2]|0;c=r+-1|0,o=(S[c>>0]|0)==-1?7:8,!((t|0)<(o|0));)r=c,t=t-o|0;r=r-h|0,c=e[d>>2]|0,c&&(e[d>>2]=c+r,l=l+8|0,e[l>>2]=(e[l>>2]|0)-r)}function U2(t){t=t|0;var r=0,o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0,ce=0;ie=b,b=b+32|0,ne=ie+12|0,Z=ie,$=t+172|0,P=(e[$>>2]|0)+4|0,(e[t+28>>2]|0)==1?O=e[t+20>>2]|0:O=1,r=ee(O<<1,P)|0,e[ne>>2]=0,ce=ne+4|0,e[ce>>2]=0,e[ne+8>>2]=0;do if(r){if((r|0)<0&&(g=0,ue(178,ne|0),oe=g,g=0,oe&1)||(d=6),(d|0)==6&&(o=r<<1,g=0,l=ge(67,o|0)|0,oe=g,g=0,!(oe&1))){e[ne>>2]=l,oe=l+(r<<1)|0,e[ne+8>>2]=oe,Jt(l|0,0,o|0)|0,e[ce>>2]=oe;break}l=j()|0,r=e[ne>>2]|0,r||le(l|0),o=e[ce>>2]|0,(o|0)!=(r|0)&&(e[ce>>2]=o+(~((o+-2-r|0)>>>1)<<1)),he(r),le(l|0)}while(!1);e[Z>>2]=0,oe=Z+4|0,e[oe>>2]=0,e[Z+8>>2]=0;do if(!O)d=18;else{if(O>>>0>1073741823&&(g=0,ue(178,Z|0),G=g,g=0,G&1)||(d=16),(d|0)==16&&(c=O<<2,g=0,h=ge(67,c|0)|0,G=g,g=0,!(G&1))){e[Z>>2]=h,d=h+(O<<2)|0,e[Z+8>>2]=d,Jt(h|0,0,c|0)|0,e[oe>>2]=d,d=18;break}l=j()|0,r=e[Z>>2]|0,o=r,r&&(c=e[oe>>2]|0,(c|0)!=(r|0)&&(e[oe>>2]=c+(~((c+-4-o|0)>>>2)<<2)),he(r))}while(!1);if((d|0)==18){h=t+8|0;e:do if((e[h>>2]|0)>0){d=t+4596|0,w=ee(O,P)|0,C=w+1|0,D=t+4600|0,k=(O|0)>0,N=t+160|0,R=t+168|0,_=t+164|0,U=t+156|0,H=t+88|0,K=t+4592|0,G=0;t:for(;;){if(l=e[ne>>2]|0,o=l+2|0,e[d>>2]=o,l=l+(C<<1)|0,e[D>>2]=l,G&1?(e[d>>2]=l,e[D>>2]=o,r=o,o=l):r=l,k){c=e[Z>>2]|0,l=0;do{if(e[K>>2]=e[c+(l<<2)>>2],c=e[$>>2]|0,I[o+(c<<1)>>1]=I[o+(c+-1<<1)>>1]|0,I[r+-2>>1]=I[o>>1]|0,g=0,Ae(76,t|0,0),c=g,g=0,c&1){d=29;break t}c=e[Z>>2]|0,e[c+(l<<2)>>2]=e[K>>2],o=(e[d>>2]|0)+(P<<1)|0,e[d>>2]=o,r=(e[D>>2]|0)+(P<<1)|0,e[D>>2]=r,l=l+1|0}while((l|0)<(O|0))}if(c=e[N>>2]|0,(c|0)<=(G|0)&&(G|0)<((e[R>>2]|0)+c|0)&&(c=e[H>>2]|0,g=0,$e(e[(e[c>>2]|0)+8>>2]|0,c|0,r+((e[U>>2]|0)-w<<1)|0,e[_>>2]|0,P|0),c=g,g=0,c&1)){d=30;break}if(G=G+1|0,(G|0)>=(e[h>>2]|0)){d=42;break e}}if((d|0)==29){l=j()|0;break}else if((d|0)==30){l=j()|0;break}}else d=42;while(!1);do if((d|0)==42){if(g=0,ue(183,t|0),t=g,g=0,t&1){l=j()|0;break}if(r=e[Z>>2]|0,o=r,r&&(l=e[oe>>2]|0,(l|0)!=(r|0)&&(e[oe>>2]=l+(~((l+-4-o|0)>>>2)<<2)),he(r)),r=e[ne>>2]|0,!r){b=ie;return}o=e[ce>>2]|0,(o|0)!=(r|0)&&(e[ce>>2]=o+(~((o+-2-r|0)>>>1)<<1)),he(r),b=ie;return}while(!1);r=e[Z>>2]|0,o=r,r&&(c=e[oe>>2]|0,(c|0)!=(r|0)&&(e[oe>>2]=c+(~((c+-4-o|0)>>>2)<<2)),he(r))}r=e[ne>>2]|0,r||le(l|0),o=e[ce>>2]|0,(o|0)!=(r|0)&&(e[ce>>2]=o+(~((o+-2-r|0)>>>1)<<1)),he(r),le(l|0)}function z2(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0;if(R=t+4596|0,o=e[R>>2]|0,K=t+172|0,r=e[K>>2]|0,!((r|0)<=0))for(_=t+4600|0,U=t+4604|0,H=t+4592|0,w=o,h=M[o+-2>>1]|0,o=M[o>>1]|0,N=0;D=e[_>>2]|0,d=I[D+(N+-1<<1)>>1]|0,k=d&65535,c=N+1|0,l=M[w+(c<<1)>>1]|0,C=e[U>>2]|0,w=o-h|0,h=h-k|0,C=((((S[C+(l-o)>>0]|0)*9|0)+(S[C+w>>0]|0)|0)*9|0)+(S[C+h>>0]|0)|0,D=D+(N<<1)|0,C?(r=o-k>>31,(r^h|0)<0?r=o:r=k+((r^w|0)<0?0:w)|0,k=q2(t,C,M[D>>1]|0,r,0)|0,I[(e[_>>2]|0)+(N<<1)>>1]=k):(r=W2(t,d,D,r-N|0)|0,o=r+N|0,(o|0)!=(e[K>>2]|0)&&(k=H2(t,k,M[(e[R>>2]|0)+(o<<1)>>1]|0)|0,I[(e[_>>2]|0)+(o<<1)>>1]=k,k=e[H>>2]|0,e[H>>2]=(k|0)<1?0:k+-1|0,r=r+1|0),c=r+N|0,l=e[R>>2]|0,o=M[l+(c+-1<<1)>>1]|0,l=M[l+(c<<1)>>1]|0),r=e[K>>2]|0,!((r|0)<=(c|0));)w=e[R>>2]|0,h=o,o=l,N=c}function G2(t){t=t|0;var r=0,o=0,l=0,c=0;l=t+116|0,o=e[l>>2]|0,(S[o>>0]|0)!=-1?(c=t+112|0,r=e[c>>2]|0,(r|0)<1&&(P0(t),r=e[c>>2]|0,o=e[l>>2]|0),t=t+108|0,l=e[t>>2]|0,e[c>>2]=r+-1,r=l<<1,e[t>>2]=r,(S[o>>0]|0)!=-1&&(r=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,Q|0)|0,bt(8)),g=0,xe(7,r|0,6,35648),t=g,g=0,t&1||Qt(r|0,824,96),t=j()|0,Tt(r|0),le(t|0))):r=e[t+108>>2]|0,r&&(r=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,Q|0)|0,bt(8)),g=0,xe(7,r|0,6,35648),t=g,g=0,t&1||Qt(r|0,824,96),t=j()|0,Tt(r|0),le(t|0))}function q2(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0;if(U=r>>31,C=(U^r)-U|0,R=t+188+(C*12|0)+10|0,o=I[R>>1]|0,N=t+188+(C*12|0)|0,c=e[N>>2]|0,(o|0)<(c|0))if((o<<1|0)<(c|0))if((o<<2|0)<(c|0))if((o<<3|0)<(c|0))if((o<<4|0)<(c|0))for(r=5;(o<>1]^U)-U+l|0,_=t+128|0,c=e[_>>2]|0,(o&c|0)==(o|0)?D=o:D=c&~(o>>31),o=t+112|0,(e[o>>2]|0)<8&&P0(t),c=t+108|0,l=e[c>>2]|0,h=l>>>24,d=e[2832+(r<<11)+(h<<3)+4>>2]|0,d?(e[o>>2]=(e[o>>2]|0)-d,e[c>>2]=l<>2]|0):(w=e[t+148>>2]|0,c=e[t+140>>2]|0,o=X0(t)|0,(o|0)<(w+-1-c|0)?r&&(o=(l0(t,r)|0)+(o<>31^o>>1,(((o|0)>-1?o:0-o|0)|0)>65535&&(o=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,Q|0)|0,bt(8)),g=0,xe(7,o|0,5,35648),t=g,g=0,t&1?(t=j()|0,Tt(o|0),le(t|0)):Qt(o|0,824,96))),w=t+136|0,l=e[w>>2]|0,r?d=o:(l?c=0:c=(e[t+188+(C*12|0)+4>>2]<<1)+-1+(I[R>>1]|0)>>31,d=c^o),r=e[t+152>>2]|0,c=(e[N>>2]|0)+((d|0)>-1?d:0-d|0)|0,h=t+188+(C*12|0)+4|0,o=(e[h>>2]|0)+(ee(l<<1|1,d)|0)|0,l=I[R>>1]|0,(l|0)==(r|0)&&(c=c>>1,o=o>>1,l=r>>1),e[N>>2]=c,r=l+1|0,I[R>>1]=r,c=r+o|0,(c|0)>=1?(o|0)>0&&(o=o-r|0,R=I[k>>1]|0,I[k>>1]=(R<<16>>16<127&1)+(R&65535),o=(o|0)>0?0:o):(o=I[k>>1]|0,I[k>>1]=(o&65535)-(o<<16>>16>-128&1),o=(c|0)>(~l|0)?c:0-l|0),e[h>>2]=o,r=e[w>>2]|0,l=r<<1|1,c=(ee(l,(d^U)-U|0)|0)+D|0,(c|0)>=(0-r|0)?(o=e[_>>2]|0,(o+r|0)<(c|0)&&(c=c-(ee(e[t+132>>2]|0,l)|0)|0)):(c=(ee(e[t+132>>2]|0,l)|0)+c|0,o=e[_>>2]|0),(c&o|0)==(c|0)?(t=c,t=t&65535,t|0):(t=o&~(c>>31),t=t&65535,t|0)}function W2(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0;for(w=t+112|0,C=t+108|0,D=t+4592|0,c=e[w>>2]|0,h=0;;){if((c|0)<1&&(P0(t),c=e[w>>2]|0),d=e[C>>2]|0,c=c+-1|0,e[w>>2]=c,e[C>>2]=d<<1,(d|0)>=0){k=8;break}if(d=e[D>>2]|0,N=1<>2],R=l-h|0,R=(N|0)<(R|0)?N:R,h=R+h|0,(R|0)==(N|0)&&(e[D>>2]=(d|0)>30?31:d+1|0),(h|0)==(l|0)){c=l;break}}if((k|0)==8&&((h|0)!=(l|0)?(c=e[D>>2]|0,(c+-4|0)>>>0<28?c=l0(t,e[36476+(c<<2)>>2]|0)|0:c=0,c=c+h|0,(c|0)>(l|0)&&(c=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,Q|0)|0,bt(8)),g=0,xe(7,c|0,5,35648),R=g,g=0,R&1?(R=j()|0,Tt(c|0),le(R|0)):Qt(c|0,824,96))):c=l),(c|0)>0)h=0;else return c|0;do I[o+(h<<1)>>1]=r,h=h+1|0;while((h|0)!=(c|0));return c|0}function H2(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0;return h=r-o|0,d=t+128|0,l=t+136|0,(((h|0)>-1?h:0-h|0)|0)>(e[l>>2]|0)?(r=ee(ws(t,t+4568|0)|0,o-r>>31|1)|0,c=e[l>>2]|0,h=c<<1|1,r=(ee(r,h)|0)+o|0,(r|0)>=(0-c|0)?(l=e[d>>2]|0,(l+c|0)<(r|0)&&(r=r-(ee(e[t+132>>2]|0,h)|0)|0)):(r=(ee(e[t+132>>2]|0,h)|0)+r|0,l=e[d>>2]|0),(r&l|0)==(r|0)?(t=r,t=t&65535,t|0):(t=l&~(r>>31),t=t&65535,t|0)):(o=ws(t,t+4580|0)|0,h=e[l>>2]|0,c=h<<1|1,r=(ee(c,o)|0)+r|0,(r|0)>=(0-h|0)?(l=e[d>>2]|0,(l+h|0)<(r|0)&&(r=r-(ee(e[t+132>>2]|0,c)|0)|0)):(r=(ee(e[t+132>>2]|0,c)|0)+r|0,l=e[d>>2]|0),(r&l|0)==(r|0)?(t=r,t=t&65535,t|0):(t=l&~(r>>31),t=t&65535,t|0))}function ws(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0;if(D=r+9|0,o=F[D>>0]|0,h=r+4|0,c=(ee(o>>>1,e[h>>2]|0)|0)+(e[r>>2]|0)|0,(o|0)<(c|0)){l=0;do o=o<<1,l=l+1|0;while((o|0)<(c|0))}else l=0;d=e[t+148>>2]|0,w=e[36476+(e[t+4592>>2]<<2)>>2]|0,o=e[t+140>>2]|0,c=X0(t)|0;do if((c|0)<(d+-2-w-o|0))if(l){w=(l0(t,l)|0)+(c<>2]|0,c=w+l|0,d=c&1,o=d,h=1,c=(d+c|0)/2|0;break}else{l=e[h>>2]|0,t=l+c|0,o=t&1,t=(o+t|0)/2|0,C=8;break}else c=(l0(t,o)|0)+1|0,d=e[h>>2]|0,t=c+d|0,o=t&1,t=(o+t|0)/2|0,l?(w=c,h=1,c=t,l=d):(l=d,C=8);while(!1);return(C|0)==8&&(w=c,h=F[r+10>>0]<<1>>>0>=(F[D>>0]|0)>>>0,c=t),c=(o|0)!=0^h?c:0-c|0,(c|0)<0&&(C=r+10|0,S[C>>0]=(F[C>>0]|0)+1),o=(w+1-l>>1)+(e[r>>2]|0)|0,e[r>>2]=o,l=S[D>>0]|0,l<<24>>24!=(S[r+8>>0]|0)?(r=l,r=r&255,r=r+1|0,r=r&255,S[D>>0]=r,c|0):(e[r>>2]=o>>1,C=(l&255)>>>1,S[D>>0]=C,r=r+10|0,S[r>>0]=(F[r>>0]|0)>>>1,r=C,r=r&255,r=r+1|0,r=r&255,S[D>>0]=r,c|0)}function X0(t){t=t|0;var r=0,o=0,l=0,c=0,h=0,d=0;if(h=t+112|0,(e[h>>2]|0)<16&&P0(t),d=t+108|0,o=e[d>>2]|0,(o|0)>=0){if(o&1073741824)r=1;else if(o&536870912)r=2;else if(o&268435456)r=3;else if(o&134217728)r=4;else if(o&67108864)r=5;else if(o&33554432)r=6;else if(o&16777216)r=7;else if(o&8388608)r=8;else if(o&4194304)r=9;else if(o&2097152)r=10;else if(o&1048576)r=11;else if(o&524288)r=12;else if(o&262144)r=13;else if(o&131072)r=14;else if(c=o>>>12&16,r=c+-1|0,!c){for(r=(e[h>>2]|0)+-15|0,e[h>>2]=r,l=o<<15,e[d>>2]=l,o=r,r=15;(o|0)<1?(P0(t),c=e[d>>2]|0,o=e[h>>2]|0):c=l,o=o+-1|0,e[h>>2]=o,l=c<<1,e[d>>2]=l,!((c|0)<0);)r=r+1|0;return r|0}}else r=0;return t=r+1|0,e[h>>2]=(e[h>>2]|0)-t,e[d>>2]=o<>2]|0,(o|0)<(r|0)&&(P0(t),o=e[l>>2]|0,(o|0)<(r|0)&&(o=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,Q|0)|0,bt(8)),g=0,xe(7,o|0,5,35648),t=g,g=0,t&1?(t=j()|0,Tt(o|0),le(t|0)):Qt(o|0,824,96))),c=t+108|0,t=e[c>>2]|0,e[l>>2]=o-r,e[c>>2]=t<>>(32-r|0)|0}function Q2(t){t=t|0;var r=0,o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0;R=b,b=b+32|0,l=R,N=t+136|0;e:do if(e[N>>2]|0)r=t+144|0;else if(o=e[t+128>>2]|0,r=t+144|0,(o|0)==((1<>2])+-1|0)&&(m0(l,o,0),(e[l+4>>2]|0)==(e[t+176>>2]|0))&&(e[l+8>>2]|0)==(e[t+180>>2]|0)&&(e[l+12>>2]|0)==(e[t+184>>2]|0))switch(e[r>>2]|0){case 8:{N=e[8900]|0,e[t+4604>>2]=N+(((e[8901]|0)-N|0)>>>1),b=R;return}case 10:{N=e[8903]|0,e[t+4604>>2]=N+(((e[8904]|0)-N|0)>>>1),b=R;return}case 12:{N=e[8906]|0,e[t+4604>>2]=N+(((e[8907]|0)-N|0)>>>1),b=R;return}case 16:{N=e[8909]|0,e[t+4604>>2]=N+(((e[8910]|0)-N|0)>>>1),b=R;return}default:break e}while(!1);if(k=1<>2],o=t+4608|0,l=k<<1,c=t+4612|0,h=e[c>>2]|0,r=e[o>>2]|0,d=h-r|0,l>>>0<=d>>>0?l>>>0>>0&&(w=r+l|0,(h|0)!=(w|0))&&(e[c>>2]=w):(j0(o,l-d|0),r=e[o>>2]|0),D=t+4604|0,e[D>>2]=r+k,r=0-k|0,(k|0)<=(r|0)){b=R;return}w=t+184|0,C=t+180|0,d=t+176|0,h=r;do r=e[w>>2]|0,(h|0)>(0-r|0)?(o=e[C>>2]|0,(h|0)>(0-o|0)?(l=e[d>>2]|0,(h|0)>(0-l|0)?(c=e[N>>2]|0,(h|0)>=(0-c|0)?(c|0)<(h|0)?(l|0)<=(h|0)?(o|0)>(h|0)?r=2:r=(r|0)>(h|0)?3:4:r=1:r=0:r=-1):r=-2):r=-3):r=-4,S[(e[D>>2]|0)+h>>0]=r,h=h+1|0;while((h|0)!=(k|0));b=R}function K2(t){t=t|0;var r=0,o=0;e[t>>2]=36736,r=e[t+92>>2]|0,r&&(o=t+96|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),t=t+88|0,r=e[t>>2]|0,e[t>>2]=0,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r)}function Y2(t){t=t|0;var r=0,o=0;if(e[t>>2]=36736,r=e[t+92>>2]|0,r&&(o=t+96|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),o=t+88|0,r=e[o>>2]|0,e[o>>2]=0,!r){he(t);return}Mt[e[(e[r>>2]|0)+4>>2]&255](r),he(t)}function j2(t){t=t|0;var r=0,o=0;e[t>>2]=35828,r=e[t+4608>>2]|0,r&&(o=t+4612|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),e[t>>2]=36736,r=e[t+92>>2]|0,r&&(o=t+96|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),t=t+88|0,r=e[t>>2]|0,e[t>>2]=0,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r)}function X2(t){t=t|0;var r=0,o=0;if(e[t>>2]=35828,r=e[t+4608>>2]|0,r&&(o=t+4612|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),e[t>>2]=36736,r=e[t+92>>2]|0,r&&(o=t+96|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),o=t+88|0,r=e[o>>2]|0,e[o>>2]=0,!r){he(t);return}Mt[e[(e[r>>2]|0)+4>>2]&255](r),he(t)}function Z2(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0,G=0,$=0,P=0,O=0;if(G=b,b=b+352|0,$=G+328|0,P=G+192|0,o=G+343|0,l=G+342|0,c=G+341|0,h=G+340|0,R=G+176|0,w=G+168|0,C=G+160|0,D=G+152|0,K=G,U=G+136|0,e[t+28>>2]|0&&(e[t+20>>2]|0)!=1){if(_=t+4|0,H=t+32|0,d=e[H>>2]|0,!d){if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[o>>0]|0,$e(37,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}if(t=e[t+12>>2]|0,(t|0)==16)switch(d|0){case 1:{if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[l>>0]|0,$e(38,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 2:{if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[c>>0]|0,$e(39,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 3:{if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[h>>0]|0,$e(40,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}default:{d=P+56|0,c=P+4|0,e[P>>2]=36160,e[d>>2]=36180,g=0,Ae(62,P+56|0,c|0),G=g,g=0,G&1&&(O=j()|0,tt(d),le(O|0)),e[P+128>>2]=0,e[P+132>>2]=-1,e[P>>2]=36200,e[P+56>>2]=36220,g=0,ue(180,c|0),G=g,g=0;do if(G&1)t=j()|0;else{if(e[c>>2]=36236,h=P+36|0,e[h>>2]=0,e[h+4>>2]=0,e[h+8>>2]=0,e[h+12>>2]=0,e[P+52>>2]=16,e[$>>2]=0,e[$+4>>2]=0,e[$+8>>2]=0,g=0,Ae(63,c|0,$|0),G=g,g=0,G&1){t=j()|0,de($),de(h),wt(c);break}de($),g=0,t=Ve(28,P|0,49007,21)|0,$=g,g=0;do if(!($&1)&&(g=0,k=be(36,t|0,e[H>>2]|0)|0,$=g,g=0,!($&1))&&(g=0,Ve(28,k|0,50997,18)|0,$=g,g=0,!($&1))){if(l=Ct(16)|0,g=0,Ae(64,R|0,c|0),$=g,g=0,$&1)t=j()|0;else if(!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,Q|0)|0,bt(8)),g=0,$e(36,l|0,9,35648,R|0),$=g,g=0,$&1?o=1:(g=0,xe(6,l|0,824,96),g=0,o=0),t=j()|0,de(R),!o)break;Tt(l|0)}else O=34;while(!1);(O|0)==34&&(t=j()|0),e[P>>2]=36200,e[d>>2]=36220,e[c>>2]=36236,de(h),wt(c),tt(d),O=t,le(O|0)}while(!1);O=t,tt(d),le(O|0)}}switch((t|0)<=8&&(t=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,Q|0)|0,bt(8)),g=0,xe(7,t|0,8,35648),O=g,g=0,O&1||Qt(t|0,824,96),O=j()|0,Tt(t|0),le(O|0)),o=16-t|0,d|0){case 1:{if(t=Xe(60)|0,e[w>>2]=o,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],e[$>>2]=e[w>>2],e[$+4>>2]=e[w+4>>2],$e(41,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 2:{if(t=Xe(60)|0,e[C>>2]=o,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],e[$>>2]=e[C>>2],e[$+4>>2]=e[C+4>>2],$e(42,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 3:{if(t=Xe(60)|0,e[D>>2]=o,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],e[$>>2]=e[D>>2],e[$+4>>2]=e[D+4>>2],$e(43,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}default:{d=K+56|0,c=K+4|0,e[K>>2]=36160,e[d>>2]=36180,g=0,Ae(62,K+56|0,c|0),P=g,g=0,P&1&&(O=j()|0,tt(d),le(O|0)),e[K+128>>2]=0,e[K+132>>2]=-1,e[K>>2]=36200,e[K+56>>2]=36220,g=0,ue(180,c|0),P=g,g=0;do if(P&1)t=j()|0;else{if(e[c>>2]=36236,h=K+36|0,e[h>>2]=0,e[h+4>>2]=0,e[h+8>>2]=0,e[h+12>>2]=0,e[K+52>>2]=16,e[$>>2]=0,e[$+4>>2]=0,e[$+8>>2]=0,g=0,Ae(63,c|0,$|0),P=g,g=0,P&1){t=j()|0,de($),de(h),wt(c);break}de($),g=0,t=Ve(28,K|0,49007,21)|0,P=g,g=0;do if(!(P&1)&&(g=0,N=be(36,t|0,e[H>>2]|0)|0,P=g,g=0,!(P&1))&&(g=0,Ve(28,N|0,50997,18)|0,P=g,g=0,!(P&1))){if(l=Ct(16)|0,g=0,Ae(64,U|0,c|0),P=g,g=0,P&1)t=j()|0;else if(!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,Q|0)|0,bt(8)),g=0,$e(36,l|0,9,35648,U|0),P=g,g=0,P&1?o=1:(g=0,xe(6,l|0,824,96),g=0,o=0),t=j()|0,de(U),!o)break;Tt(l|0)}else O=64;while(!1);(O|0)==64&&(t=j()|0),e[K>>2]=36200,e[d>>2]=36220,e[c>>2]=36236,de(h),wt(c),tt(d),O=t,le(O|0)}while(!1);O=t,tt(d),le(O|0)}}}return o=e[r+4>>2]|0,l=Xe(16)|0,t=e[t+16>>2]|0,o?(e[l>>2]=36108,e[l+4>>2]=o,e[l+8>>2]=6,e[l+12>>2]=t,O=l,b=G,O|0):(O=e[r>>2]|0,e[l>>2]=36132,e[l+4>>2]=O,e[l+8>>2]=6,e[l+12>>2]=t,O=l,b=G,O|0)}function J2(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0;d=b,b=b+32|0,C=d,m0(C,e[t+128>>2]|0,e[t+136>>2]|0),w=e[r+4>>2]|0,h=e[r+8>>2]|0,h=h|0?h:e[C+8>>2]|0,c=e[r+12>>2]|0,c=c|0?c:e[C+12>>2]|0,o=e[r+16>>2]|0,l=e[C+16>>2]|0,e[t+176>>2]=w|0?w:e[C+4>>2]|0,e[t+180>>2]=h,e[t+184>>2]=c,su(t),c=t+132|0,r=(e[c>>2]|0)+32|0,r=(r|0)<128?2:(r|0)/64|0,h=0;do e[t+188+(h*12|0)>>2]=r,e[t+188+(h*12|0)+4>>2]=0,I[t+188+(h*12|0)+8>>1]=0,I[t+188+(h*12|0)+10>>1]=1,h=h+1|0;while((h|0)!=365);w=(e[c>>2]|0)+32|0,w=(w|0)<128?2:(w|0)/64|0,C=(o|0?o:l)&255,e[t+4568>>2]=w,e[t+4572>>2]=0,S[t+4576>>0]=C,S[t+4577>>0]=1,S[t+4578>>0]=0,e[t+4580>>2]=w,e[t+4584>>2]=1,S[t+4588>>0]=C,S[t+4589>>0]=1,S[t+4590>>0]=0,e[t+4592>>2]=0,b=d}function eu(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0;for(d=t+88|0,h=e[r>>2]|0,e[r>>2]=0,r=e[d>>2]|0,e[d>>2]=h,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r),d=l+4|0,h=e[d>>2]|0,S[t+4620>>0]=c&1,r=t+156|0,e[r>>2]=e[o>>2],e[r+4>>2]=e[o+4>>2],e[r+8>>2]=e[o+8>>2],e[r+12>>2]=e[o+12>>2],Y0(t,l),tu(t),r=e[t+116>>2]|0,t=e[t+112>>2]|0;c=r+-1|0,o=(S[c>>0]|0)==-1?7:8,!((t|0)<(o|0));)r=c,t=t-o|0;r=r-h|0,c=e[d>>2]|0,c&&(e[d>>2]=c+r,l=l+8|0,e[l>>2]=(e[l>>2]|0)-r)}function tu(t){t=t|0;var r=0,o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0,ce=0;ie=b,b=b+32|0,ne=ie+12|0,Z=ie,$=t+172|0,P=(e[$>>2]|0)+4|0,(e[t+28>>2]|0)==1?O=e[t+20>>2]|0:O=1,r=ee(O<<1,P)|0,e[ne>>2]=0,ce=ne+4|0,e[ce>>2]=0,e[ne+8>>2]=0;do if(r){if(r>>>0>715827882&&(g=0,ue(178,ne|0),oe=g,g=0,oe&1)||(d=6),(d|0)==6&&(g=0,o=ge(67,r*6|0)|0,oe=g,g=0,!(oe&1))){for(e[ce>>2]=o,e[ne>>2]=o,l=o+(r*6|0)|0,e[ne+8>>2]=l;I[o>>1]=0,I[o+2>>1]=0,I[o+4>>1]=0,r=r+-1|0,r;)o=o+6|0;e[ce>>2]=l;break}l=j()|0,r=e[ne>>2]|0,r||le(l|0),o=e[ce>>2]|0,(o|0)!=(r|0)&&(e[ce>>2]=o+(~(((o+-6-r|0)>>>0)/6|0)*6|0)),he(r),le(l|0)}while(!1);e[Z>>2]=0,oe=Z+4|0,e[oe>>2]=0,e[Z+8>>2]=0;do if(!O)d=20;else{if(O>>>0>1073741823&&(g=0,ue(178,Z|0),G=g,g=0,G&1)||(d=18),(d|0)==18&&(c=O<<2,g=0,h=ge(67,c|0)|0,G=g,g=0,!(G&1))){e[Z>>2]=h,d=h+(O<<2)|0,e[Z+8>>2]=d,Jt(h|0,0,c|0)|0,e[oe>>2]=d,d=20;break}l=j()|0,r=e[Z>>2]|0,o=r,r&&(c=e[oe>>2]|0,(c|0)!=(r|0)&&(e[oe>>2]=c+(~((c+-4-o|0)>>>2)<<2)),he(r))}while(!1);if((d|0)==20){h=t+8|0;e:do if((e[h>>2]|0)>0){d=t+4596|0,w=ee(O,P)|0,C=w+1|0,D=t+4600|0,k=(O|0)>0,N=t+160|0,R=t+168|0,_=t+164|0,U=t+156|0,H=t+88|0,K=t+4592|0,G=0;t:for(;;){if(l=e[ne>>2]|0,o=l+6|0,e[d>>2]=o,l=l+(C*6|0)|0,e[D>>2]=l,G&1?(e[d>>2]=l,e[D>>2]=o,r=o,o=l):r=l,k){c=e[Z>>2]|0,l=0;do{if(e[K>>2]=e[c+(l<<2)>>2],r=e[$>>2]|0,c=o+(r*6|0)|0,o=o+((r+-1|0)*6|0)|0,I[c>>1]=I[o>>1]|0,I[c+2>>1]=I[o+2>>1]|0,I[c+4>>1]=I[o+4>>1]|0,c=(e[D>>2]|0)+-6|0,o=e[d>>2]|0,I[c>>1]=I[o>>1]|0,I[c+2>>1]=I[o+2>>1]|0,I[c+4>>1]=I[o+4>>1]|0,g=0,Ae(77,t|0,0),c=g,g=0,c&1){d=31;break t}c=e[Z>>2]|0,e[c+(l<<2)>>2]=e[K>>2],o=(e[d>>2]|0)+(P*6|0)|0,e[d>>2]=o,r=(e[D>>2]|0)+(P*6|0)|0,e[D>>2]=r,l=l+1|0}while((l|0)<(O|0))}if(c=e[N>>2]|0,(c|0)<=(G|0)&&(G|0)<((e[R>>2]|0)+c|0)&&(c=e[H>>2]|0,g=0,$e(e[(e[c>>2]|0)+8>>2]|0,c|0,r+(((e[U>>2]|0)-w|0)*6|0)|0,e[_>>2]|0,P|0),c=g,g=0,c&1)){d=32;break}if(G=G+1|0,(G|0)>=(e[h>>2]|0)){d=44;break e}}if((d|0)==31){l=j()|0;break}else if((d|0)==32){l=j()|0;break}}else d=44;while(!1);do if((d|0)==44){if(g=0,ue(183,t|0),t=g,g=0,t&1){l=j()|0;break}if(r=e[Z>>2]|0,o=r,r&&(l=e[oe>>2]|0,(l|0)!=(r|0)&&(e[oe>>2]=l+(~((l+-4-o|0)>>>2)<<2)),he(r)),r=e[ne>>2]|0,!r){b=ie;return}o=e[ce>>2]|0,(o|0)!=(r|0)&&(e[ce>>2]=o+(~(((o+-6-r|0)>>>0)/6|0)*6|0)),he(r),b=ie;return}while(!1);r=e[Z>>2]|0,o=r,r&&(c=e[oe>>2]|0,(c|0)!=(r|0)&&(e[oe>>2]=c+(~((c+-4-o|0)>>>2)<<2)),he(r))}r=e[ne>>2]|0,r||le(l|0),o=e[ce>>2]|0,(o|0)!=(r|0)&&(e[ce>>2]=o+(~(((o+-6-r|0)>>>0)/6|0)*6|0)),he(r),le(l|0)}function iu(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0,ce=0,ke=0,Ee=0,Te=0,it=0,jt=0,Gt=0,s0=0,i0=0,zt=0,gt=0;if(zt=b,b=b+32|0,ne=zt+24|0,i0=zt+18|0,s0=zt+12|0,ce=zt+6|0,ke=zt,Ee=t+172|0,r=e[Ee>>2]|0,(r|0)<=0){b=zt;return}for(Te=t+4600|0,it=t+4596|0,jt=t+4604|0,Gt=t+4592|0,oe=0;l=oe+-1|0,c=e[Te>>2]|0,gt=e[it>>2]|0,o=oe+1|0,h=M[gt+(oe*6|0)>>1]|0,ie=e[jt>>2]|0,d=M[gt+(l*6|0)>>1]|0,w=h-d|0,C=M[c+(l*6|0)>>1]|0,D=d-C|0,k=((((S[ie+((M[gt+(o*6|0)>>1]|0)-h)>>0]|0)*9|0)+(S[ie+w>>0]|0)|0)*9|0)+(S[ie+D>>0]|0)|0,N=M[gt+(oe*6|0)+2>>1]|0,R=M[gt+(l*6|0)+2>>1]|0,_=N-R|0,U=M[c+(l*6|0)+2>>1]|0,H=R-U|0,K=((((S[ie+((M[gt+(o*6|0)+2>>1]|0)-N)>>0]|0)*9|0)+(S[ie+_>>0]|0)|0)*9|0)+(S[ie+H>>0]|0)|0,G=M[gt+(oe*6|0)+4>>1]|0,$=M[gt+(l*6|0)+4>>1]|0,P=G-$|0,O=M[c+(l*6|0)+4>>1]|0,Z=$-O|0,ie=((((S[ie+((M[gt+(o*6|0)+4>>1]|0)-G)>>0]|0)*9|0)+(S[ie+P>>0]|0)|0)*9|0)+(S[ie+Z>>0]|0)|0,K|k|ie?(l=M[c+(oe*6|0)>>1]|0,r=h-C>>31,(r^D|0)>=0?(r^w|0)<0?r=C:r=C-d+h|0:r=h,h=ir(t,k,l,r,0)|0,l=M[(e[Te>>2]|0)+(oe*6|0)+2>>1]|0,r=N-U>>31,(r^H|0)>=0?(r^_|0)<0?r=U:r=U-R+N|0:r=N,l=ir(t,K,l,r,0)|0,c=M[(e[Te>>2]|0)+(oe*6|0)+4>>1]|0,r=G-O>>31,(r^Z|0)>=0?(r^P|0)<0?r=O:r=O-$+G|0:r=G,ie=ir(t,ie,c,r,0)|0,gt=e[Te>>2]|0,I[gt+(oe*6|0)>>1]=h,I[gt+(oe*6|0)+2>>1]=l,I[gt+(oe*6|0)+4>>1]=ie):(o=c+(l*6|0)|0,I[s0>>1]=I[o>>1]|0,I[s0+2>>1]=I[o+2>>1]|0,I[s0+4>>1]=I[o+4>>1]|0,I[ne>>1]=I[o>>1]|0,I[ne+2>>1]=I[o+2>>1]|0,I[ne+4>>1]=I[o+4>>1]|0,r=nu(t,ne,c+(oe*6|0)|0,r-oe|0)|0,o=r+oe|0,(o|0)!=(e[Ee>>2]|0)&&(gt=(e[it>>2]|0)+(o*6|0)|0,I[ke>>1]=I[gt>>1]|0,I[ke+2>>1]=I[gt+2>>1]|0,I[ke+4>>1]=I[gt+4>>1]|0,gt=(e[Te>>2]|0)+(o*6|0)|0,I[i0>>1]=I[s0>>1]|0,I[i0+2>>1]=I[s0+2>>1]|0,I[i0+4>>1]=I[s0+4>>1]|0,I[ne>>1]=I[ke>>1]|0,I[ne+2>>1]=I[ke+2>>1]|0,I[ne+4>>1]=I[ke+4>>1]|0,ru(ce,t,i0,ne),I[gt>>1]=I[ce>>1]|0,I[gt+2>>1]=I[ce+2>>1]|0,I[gt+4>>1]=I[ce+4>>1]|0,gt=e[Gt>>2]|0,e[Gt>>2]=(gt|0)<1?0:gt+-1|0,r=r+1|0),o=r+oe|0),r=e[Ee>>2]|0,!((o|0)>=(r|0));)oe=o;b=zt}function nu(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0;for(w=t+112|0,C=t+108|0,D=t+4592|0,c=e[w>>2]|0,h=0;;){if((c|0)<1&&(P0(t),c=e[w>>2]|0),d=e[C>>2]|0,c=c+-1|0,e[w>>2]=c,e[C>>2]=d<<1,(d|0)>=0){k=8;break}if(d=e[D>>2]|0,N=1<>2],R=l-h|0,R=(N|0)<(R|0)?N:R,h=R+h|0,(R|0)==(N|0)&&(e[D>>2]=(d|0)>30?31:d+1|0),(h|0)==(l|0)){c=l;break}}if((k|0)==8&&((h|0)!=(l|0)?(c=e[D>>2]|0,(c+-4|0)>>>0<28?c=l0(t,e[36476+(c<<2)>>2]|0)|0:c=0,c=c+h|0,(c|0)>(l|0)&&(c=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,Q|0)|0,bt(8)),g=0,xe(7,c|0,5,35648),R=g,g=0,R&1?(R=j()|0,Tt(c|0),le(R|0)):Qt(c|0,824,96))):c=l),(c|0)<=0)return c|0;h=0;do R=o+(h*6|0)|0,I[R>>1]=I[r>>1]|0,I[R+2>>1]=I[r+2>>1]|0,I[R+4>>1]=I[r+4>>1]|0,h=h+1|0;while((h|0)!=(c|0));return c|0}function ru(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0;if(C=r+4568|0,N=nr(r,C)|0,d=nr(r,C)|0,C=nr(r,C)|0,h=r+128|0,c=M[l>>1]|0,D=e[r+136>>2]|0,k=D<<1|1,c=(ee(ee(k,N)|0,c-(M[o>>1]|0)>>31|1)|0)+c|0,N=0-D|0,(c|0)>=(N|0)?(h=e[h>>2]|0,(h+D|0)<(c|0)&&(c=c-(ee(e[r+132>>2]|0,k)|0)|0)):(c=(ee(e[r+132>>2]|0,k)|0)+c|0,h=e[h>>2]|0),(c&h|0)!=(c|0)&&(c=h&~(c>>31)),w=c&65535,c=M[l+2>>1]|0,c=(ee(ee(k,d)|0,c-(M[o+2>>1]|0)>>31|1)|0)+c|0,(c|0)>=(N|0)?(h+D|0)<(c|0)&&(c=c-(ee(e[r+132>>2]|0,k)|0)|0):c=(ee(e[r+132>>2]|0,k)|0)+c|0,(c&h|0)!=(c|0)&&(c=h&~(c>>31)),d=c&65535,c=M[l+4>>1]|0,c=(ee(ee(k,C)|0,c-(M[o+4>>1]|0)>>31|1)|0)+c|0,(c|0)>=(N|0)?(h+D|0)<(c|0)&&(c=c-(ee(e[r+132>>2]|0,k)|0)|0):c=(ee(e[r+132>>2]|0,k)|0)+c|0,(c&h|0)==(c|0)){r=c,r=r&65535,I[t>>1]=w,N=t+2|0,I[N>>1]=d,t=t+4|0,I[t>>1]=r;return}r=h&~(c>>31),r=r&65535,I[t>>1]=w,N=t+2|0,I[N>>1]=d,t=t+4|0,I[t>>1]=r}function ir(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0;if(U=r>>31,C=(U^r)-U|0,R=t+188+(C*12|0)+10|0,o=I[R>>1]|0,N=t+188+(C*12|0)|0,c=e[N>>2]|0,(o|0)<(c|0))if((o<<1|0)<(c|0))if((o<<2|0)<(c|0))if((o<<3|0)<(c|0))if((o<<4|0)<(c|0))for(r=5;(o<>1]^U)-U+l|0,_=t+128|0,c=e[_>>2]|0,(o&c|0)==(o|0)?D=o:D=c&~(o>>31),o=t+112|0,(e[o>>2]|0)<8&&P0(t),c=t+108|0,l=e[c>>2]|0,h=l>>>24,d=e[2832+(r<<11)+(h<<3)+4>>2]|0,d?(e[o>>2]=(e[o>>2]|0)-d,e[c>>2]=l<>2]|0):(w=e[t+148>>2]|0,c=e[t+140>>2]|0,o=X0(t)|0,(o|0)<(w+-1-c|0)?r&&(o=(l0(t,r)|0)+(o<>31^o>>1,(((o|0)>-1?o:0-o|0)|0)>65535&&(o=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,Q|0)|0,bt(8)),g=0,xe(7,o|0,5,35648),t=g,g=0,t&1?(t=j()|0,Tt(o|0),le(t|0)):Qt(o|0,824,96))),w=t+136|0,l=e[w>>2]|0,r?d=o:(l?c=0:c=(e[t+188+(C*12|0)+4>>2]<<1)+-1+(I[R>>1]|0)>>31,d=c^o),r=e[t+152>>2]|0,c=(e[N>>2]|0)+((d|0)>-1?d:0-d|0)|0,h=t+188+(C*12|0)+4|0,o=(e[h>>2]|0)+(ee(l<<1|1,d)|0)|0,l=I[R>>1]|0,(l|0)==(r|0)&&(c=c>>1,o=o>>1,l=r>>1),e[N>>2]=c,r=l+1|0,I[R>>1]=r,c=r+o|0,(c|0)>=1?(o|0)>0&&(o=o-r|0,R=I[k>>1]|0,I[k>>1]=(R<<16>>16<127&1)+(R&65535),o=(o|0)>0?0:o):(o=I[k>>1]|0,I[k>>1]=(o&65535)-(o<<16>>16>-128&1),o=(c|0)>(~l|0)?c:0-l|0),e[h>>2]=o,r=e[w>>2]|0,l=r<<1|1,c=(ee(l,(d^U)-U|0)|0)+D|0,(c|0)>=(0-r|0)?(o=e[_>>2]|0,(o+r|0)<(c|0)&&(c=c-(ee(e[t+132>>2]|0,l)|0)|0)):(c=(ee(e[t+132>>2]|0,l)|0)+c|0,o=e[_>>2]|0),(c&o|0)==(c|0)?(t=c,t=t&65535,t|0):(t=o&~(c>>31),t=t&65535,t|0)}function nr(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0;if(D=r+9|0,o=F[D>>0]|0,h=r+4|0,c=(ee(o>>>1,e[h>>2]|0)|0)+(e[r>>2]|0)|0,(o|0)<(c|0)){l=0;do o=o<<1,l=l+1|0;while((o|0)<(c|0))}else l=0;d=e[t+148>>2]|0,w=e[36476+(e[t+4592>>2]<<2)>>2]|0,o=e[t+140>>2]|0,c=X0(t)|0;do if((c|0)<(d+-2-w-o|0))if(l){w=(l0(t,l)|0)+(c<>2]|0,c=w+l|0,d=c&1,o=d,h=1,c=(d+c|0)/2|0;break}else{l=e[h>>2]|0,t=l+c|0,o=t&1,t=(o+t|0)/2|0,C=8;break}else c=(l0(t,o)|0)+1|0,d=e[h>>2]|0,t=c+d|0,o=t&1,t=(o+t|0)/2|0,l?(w=c,h=1,c=t,l=d):(l=d,C=8);while(!1);return(C|0)==8&&(w=c,h=F[r+10>>0]<<1>>>0>=(F[D>>0]|0)>>>0,c=t),c=(o|0)!=0^h?c:0-c|0,(c|0)<0&&(C=r+10|0,S[C>>0]=(F[C>>0]|0)+1),o=(w+1-l>>1)+(e[r>>2]|0)|0,e[r>>2]=o,l=S[D>>0]|0,l<<24>>24!=(S[r+8>>0]|0)?(r=l,r=r&255,r=r+1|0,r=r&255,S[D>>0]=r,c|0):(e[r>>2]=o>>1,C=(l&255)>>>1,S[D>>0]=C,r=r+10|0,S[r>>0]=(F[r>>0]|0)>>>1,r=C,r=r&255,r=r+1|0,r=r&255,S[D>>0]=r,c|0)}function su(t){t=t|0;var r=0,o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0;R=b,b=b+32|0,l=R,N=t+136|0;e:do if(e[N>>2]|0)r=t+144|0;else if(o=e[t+128>>2]|0,r=t+144|0,(o|0)==((1<>2])+-1|0)&&(m0(l,o,0),(e[l+4>>2]|0)==(e[t+176>>2]|0))&&(e[l+8>>2]|0)==(e[t+180>>2]|0)&&(e[l+12>>2]|0)==(e[t+184>>2]|0))switch(e[r>>2]|0){case 8:{N=e[8900]|0,e[t+4604>>2]=N+(((e[8901]|0)-N|0)>>>1),b=R;return}case 10:{N=e[8903]|0,e[t+4604>>2]=N+(((e[8904]|0)-N|0)>>>1),b=R;return}case 12:{N=e[8906]|0,e[t+4604>>2]=N+(((e[8907]|0)-N|0)>>>1),b=R;return}case 16:{N=e[8909]|0,e[t+4604>>2]=N+(((e[8910]|0)-N|0)>>>1),b=R;return}default:break e}while(!1);if(k=1<>2],o=t+4608|0,l=k<<1,c=t+4612|0,h=e[c>>2]|0,r=e[o>>2]|0,d=h-r|0,l>>>0<=d>>>0?l>>>0>>0&&(w=r+l|0,(h|0)!=(w|0))&&(e[c>>2]=w):(j0(o,l-d|0),r=e[o>>2]|0),D=t+4604|0,e[D>>2]=r+k,r=0-k|0,(k|0)<=(r|0)){b=R;return}w=t+184|0,C=t+180|0,d=t+176|0,h=r;do r=e[w>>2]|0,(h|0)>(0-r|0)?(o=e[C>>2]|0,(h|0)>(0-o|0)?(l=e[d>>2]|0,(h|0)>(0-l|0)?(c=e[N>>2]|0,(h|0)>=(0-c|0)?(c|0)<(h|0)?(l|0)<=(h|0)?(o|0)>(h|0)?r=2:r=(r|0)>(h|0)?3:4:r=1:r=0:r=-1):r=-2):r=-3):r=-4,S[(e[D>>2]|0)+h>>0]=r,h=h+1|0;while((h|0)!=(k|0));b=R}function ou(t){t=t|0;var r=0,o=0;e[t>>2]=35800,r=e[t+4608>>2]|0,r&&(o=t+4612|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),e[t>>2]=36736,r=e[t+92>>2]|0,r&&(o=t+96|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),t=t+88|0,r=e[t>>2]|0,e[t>>2]=0,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r)}function au(t){t=t|0;var r=0,o=0;if(e[t>>2]=35800,r=e[t+4608>>2]|0,r&&(o=t+4612|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),e[t>>2]=36736,r=e[t+92>>2]|0,r&&(o=t+96|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),o=t+88|0,r=e[o>>2]|0,e[o>>2]=0,!r){he(t);return}Mt[e[(e[r>>2]|0)+4>>2]&255](r),he(t)}function lu(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0,G=0,$=0,P=0,O=0;if(G=b,b=b+352|0,$=G+328|0,P=G+192|0,o=G+343|0,l=G+342|0,c=G+341|0,h=G+340|0,R=G+176|0,w=G+168|0,C=G+160|0,D=G+152|0,K=G,U=G+136|0,e[t+28>>2]|0&&(e[t+20>>2]|0)!=1){if(_=t+4|0,H=t+32|0,d=e[H>>2]|0,!d){if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[o>>0]|0,$e(44,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}if(t=e[t+12>>2]|0,(t|0)==8)switch(d|0){case 1:{if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[l>>0]|0,$e(45,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 2:{if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[c>>0]|0,$e(46,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 3:{if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[h>>0]|0,$e(47,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}default:{d=P+56|0,c=P+4|0,e[P>>2]=36160,e[d>>2]=36180,g=0,Ae(62,P+56|0,c|0),G=g,g=0,G&1&&(O=j()|0,tt(d),le(O|0)),e[P+128>>2]=0,e[P+132>>2]=-1,e[P>>2]=36200,e[P+56>>2]=36220,g=0,ue(180,c|0),G=g,g=0;do if(G&1)t=j()|0;else{if(e[c>>2]=36236,h=P+36|0,e[h>>2]=0,e[h+4>>2]=0,e[h+8>>2]=0,e[h+12>>2]=0,e[P+52>>2]=16,e[$>>2]=0,e[$+4>>2]=0,e[$+8>>2]=0,g=0,Ae(63,c|0,$|0),G=g,g=0,G&1){t=j()|0,de($),de(h),wt(c);break}de($),g=0,t=Ve(28,P|0,49007,21)|0,$=g,g=0;do if(!($&1)&&(g=0,k=be(36,t|0,e[H>>2]|0)|0,$=g,g=0,!($&1))&&(g=0,Ve(28,k|0,50997,18)|0,$=g,g=0,!($&1))){if(l=Ct(16)|0,g=0,Ae(64,R|0,c|0),$=g,g=0,$&1)t=j()|0;else if(!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,Q|0)|0,bt(8)),g=0,$e(36,l|0,9,35648,R|0),$=g,g=0,$&1?o=1:(g=0,xe(6,l|0,824,96),g=0,o=0),t=j()|0,de(R),!o)break;Tt(l|0)}else O=34;while(!1);(O|0)==34&&(t=j()|0),e[P>>2]=36200,e[d>>2]=36220,e[c>>2]=36236,de(h),wt(c),tt(d),O=t,le(O|0)}while(!1);O=t,tt(d),le(O|0)}}switch((t|0)<=8&&(t=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,Q|0)|0,bt(8)),g=0,xe(7,t|0,8,35648),O=g,g=0,O&1||Qt(t|0,824,96),O=j()|0,Tt(t|0),le(O|0)),o=16-t|0,d|0){case 1:{if(t=Xe(60)|0,e[w>>2]=o,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],e[$>>2]=e[w>>2],e[$+4>>2]=e[w+4>>2],$e(41,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 2:{if(t=Xe(60)|0,e[C>>2]=o,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],e[$>>2]=e[C>>2],e[$+4>>2]=e[C+4>>2],$e(42,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 3:{if(t=Xe(60)|0,e[D>>2]=o,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],e[$>>2]=e[D>>2],e[$+4>>2]=e[D+4>>2],$e(43,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}default:{d=K+56|0,c=K+4|0,e[K>>2]=36160,e[d>>2]=36180,g=0,Ae(62,K+56|0,c|0),P=g,g=0,P&1&&(O=j()|0,tt(d),le(O|0)),e[K+128>>2]=0,e[K+132>>2]=-1,e[K>>2]=36200,e[K+56>>2]=36220,g=0,ue(180,c|0),P=g,g=0;do if(P&1)t=j()|0;else{if(e[c>>2]=36236,h=K+36|0,e[h>>2]=0,e[h+4>>2]=0,e[h+8>>2]=0,e[h+12>>2]=0,e[K+52>>2]=16,e[$>>2]=0,e[$+4>>2]=0,e[$+8>>2]=0,g=0,Ae(63,c|0,$|0),P=g,g=0,P&1){t=j()|0,de($),de(h),wt(c);break}de($),g=0,t=Ve(28,K|0,49007,21)|0,P=g,g=0;do if(!(P&1)&&(g=0,N=be(36,t|0,e[H>>2]|0)|0,P=g,g=0,!(P&1))&&(g=0,Ve(28,N|0,50997,18)|0,P=g,g=0,!(P&1))){if(l=Ct(16)|0,g=0,Ae(64,U|0,c|0),P=g,g=0,P&1)t=j()|0;else if(!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,Q|0)|0,bt(8)),g=0,$e(36,l|0,9,35648,U|0),P=g,g=0,P&1?o=1:(g=0,xe(6,l|0,824,96),g=0,o=0),t=j()|0,de(U),!o)break;Tt(l|0)}else O=64;while(!1);(O|0)==64&&(t=j()|0),e[K>>2]=36200,e[d>>2]=36220,e[c>>2]=36236,de(h),wt(c),tt(d),O=t,le(O|0)}while(!1);O=t,tt(d),le(O|0)}}}return o=e[r+4>>2]|0,l=Xe(16)|0,t=e[t+16>>2]|0,o?(e[l>>2]=36108,e[l+4>>2]=o,e[l+8>>2]=3,e[l+12>>2]=t,O=l,b=G,O|0):(O=e[r>>2]|0,e[l>>2]=36132,e[l+4>>2]=O,e[l+8>>2]=3,e[l+12>>2]=t,O=l,b=G,O|0)}function uu(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0;d=b,b=b+32|0,C=d,m0(C,e[t+128>>2]|0,e[t+136>>2]|0),w=e[r+4>>2]|0,h=e[r+8>>2]|0,h=h|0?h:e[C+8>>2]|0,c=e[r+12>>2]|0,c=c|0?c:e[C+12>>2]|0,o=e[r+16>>2]|0,l=e[C+16>>2]|0,e[t+176>>2]=w|0?w:e[C+4>>2]|0,e[t+180>>2]=h,e[t+184>>2]=c,mu(t),c=t+132|0,r=(e[c>>2]|0)+32|0,r=(r|0)<128?2:(r|0)/64|0,h=0;do e[t+188+(h*12|0)>>2]=r,e[t+188+(h*12|0)+4>>2]=0,I[t+188+(h*12|0)+8>>1]=0,I[t+188+(h*12|0)+10>>1]=1,h=h+1|0;while((h|0)!=365);w=(e[c>>2]|0)+32|0,w=(w|0)<128?2:(w|0)/64|0,C=(o|0?o:l)&255,e[t+4568>>2]=w,e[t+4572>>2]=0,S[t+4576>>0]=C,S[t+4577>>0]=1,S[t+4578>>0]=0,e[t+4580>>2]=w,e[t+4584>>2]=1,S[t+4588>>0]=C,S[t+4589>>0]=1,S[t+4590>>0]=0,e[t+4592>>2]=0,b=d}function cu(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0;for(d=t+88|0,h=e[r>>2]|0,e[r>>2]=0,r=e[d>>2]|0,e[d>>2]=h,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r),d=l+4|0,h=e[d>>2]|0,S[t+4620>>0]=c&1,r=t+156|0,e[r>>2]=e[o>>2],e[r+4>>2]=e[o+4>>2],e[r+8>>2]=e[o+8>>2],e[r+12>>2]=e[o+12>>2],Y0(t,l),fu(t),r=e[t+116>>2]|0,t=e[t+112>>2]|0;c=r+-1|0,o=(S[c>>0]|0)==-1?7:8,!((t|0)<(o|0));)r=c,t=t-o|0;r=r-h|0,c=e[d>>2]|0,c&&(e[d>>2]=c+r,l=l+8|0,e[l>>2]=(e[l>>2]|0)-r)}function fu(t){t=t|0;var r=0,o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0,ce=0;ie=b,b=b+32|0,ne=ie+12|0,Z=ie,$=t+172|0,P=(e[$>>2]|0)+4|0,(e[t+28>>2]|0)==1?O=e[t+20>>2]|0:O=1,r=ee(O<<1,P)|0,e[ne>>2]=0,ce=ne+4|0,e[ce>>2]=0,e[ne+8>>2]=0;e:do if(r){if(r>>>0>1431655765&&(g=0,ue(178,ne|0),oe=g,g=0,oe&1)||(h=6),(h|0)==6&&(g=0,o=ge(67,r*3|0)|0,oe=g,g=0,!(oe&1))){for(e[ce>>2]=o,e[ne>>2]=o,e[ne+8>>2]=o+(r*3|0);;)if(S[o>>0]=0,S[o+1>>0]=0,S[o+2>>0]=0,o=(e[ce>>2]|0)+3|0,e[ce>>2]=o,r=r+-1|0,!r)break e}l=j()|0,r=e[ne>>2]|0,r||le(l|0),o=e[ce>>2]|0,(o|0)!=(r|0)&&(e[ce>>2]=o+(~(((o+-3-r|0)>>>0)/3|0)*3|0)),he(r),le(l|0)}while(!1);e[Z>>2]=0,oe=Z+4|0,e[oe>>2]=0,e[Z+8>>2]=0;do if(!O)h=19;else{if(O>>>0>1073741823&&(g=0,ue(178,Z|0),G=g,g=0,G&1)||(h=17),(h|0)==17&&(l=O<<2,g=0,c=ge(67,l|0)|0,G=g,g=0,!(G&1))){e[Z>>2]=c,h=c+(O<<2)|0,e[Z+8>>2]=h,Jt(c|0,0,l|0)|0,e[oe>>2]=h,h=19;break}l=j()|0,r=e[Z>>2]|0,o=r,r&&(c=e[oe>>2]|0,(c|0)!=(r|0)&&(e[oe>>2]=c+(~((c+-4-o|0)>>>2)<<2)),he(r))}while(!1);if((h|0)==19){h=t+8|0;e:do if((e[h>>2]|0)>0){d=t+4596|0,w=ee(O,P)|0,C=w+1|0,D=t+4600|0,k=(O|0)>0,N=t+160|0,R=t+168|0,_=t+164|0,U=t+156|0,H=t+88|0,K=t+4592|0,G=0;t:for(;;){if(l=e[ne>>2]|0,o=l+3|0,e[d>>2]=o,l=l+(C*3|0)|0,e[D>>2]=l,G&1?(e[d>>2]=l,e[D>>2]=o,r=o,o=l):r=l,k){c=e[Z>>2]|0,l=0;do{if(e[K>>2]=e[c+(l<<2)>>2],r=e[$>>2]|0,c=o+(r*3|0)|0,o=o+((r+-1|0)*3|0)|0,S[c>>0]=S[o>>0]|0,S[c+1>>0]=S[o+1>>0]|0,S[c+2>>0]=S[o+2>>0]|0,o=e[d>>2]|0,c=(e[D>>2]|0)+-3|0,S[c>>0]=S[o>>0]|0,S[c+1>>0]=S[o+1>>0]|0,S[c+2>>0]=S[o+2>>0]|0,g=0,Ae(78,t|0,0),c=g,g=0,c&1){h=30;break t}c=e[Z>>2]|0,e[c+(l<<2)>>2]=e[K>>2],o=(e[d>>2]|0)+(P*3|0)|0,e[d>>2]=o,r=(e[D>>2]|0)+(P*3|0)|0,e[D>>2]=r,l=l+1|0}while((l|0)<(O|0))}if(c=e[N>>2]|0,(c|0)<=(G|0)&&(G|0)<((e[R>>2]|0)+c|0)&&(c=e[H>>2]|0,g=0,$e(e[(e[c>>2]|0)+8>>2]|0,c|0,r+(((e[U>>2]|0)-w|0)*3|0)|0,e[_>>2]|0,P|0),c=g,g=0,c&1)){h=31;break}if(G=G+1|0,(G|0)>=(e[h>>2]|0)){h=43;break e}}if((h|0)==30){l=j()|0;break}else if((h|0)==31){l=j()|0;break}}else h=43;while(!1);do if((h|0)==43){if(g=0,ue(183,t|0),t=g,g=0,t&1){l=j()|0;break}if(r=e[Z>>2]|0,o=r,r&&(l=e[oe>>2]|0,(l|0)!=(r|0)&&(e[oe>>2]=l+(~((l+-4-o|0)>>>2)<<2)),he(r)),r=e[ne>>2]|0,!r){b=ie;return}o=e[ce>>2]|0,(o|0)!=(r|0)&&(e[ce>>2]=o+(~(((o+-3-r|0)>>>0)/3|0)*3|0)),he(r),b=ie;return}while(!1);r=e[Z>>2]|0,o=r,r&&(c=e[oe>>2]|0,(c|0)!=(r|0)&&(e[oe>>2]=c+(~((c+-4-o|0)>>>2)<<2)),he(r))}r=e[ne>>2]|0,r||le(l|0),o=e[ce>>2]|0,(o|0)!=(r|0)&&(e[ce>>2]=o+(~(((o+-3-r|0)>>>0)/3|0)*3|0)),he(r),le(l|0)}function hu(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0,ce=0,ke=0,Ee=0,Te=0,it=0,jt=0,Gt=0,s0=0,i0=0,zt=0,gt=0;if(zt=b,b=b+16|0,ne=zt+12|0,i0=zt+9|0,s0=zt+6|0,ce=zt+3|0,ke=zt,Ee=t+172|0,r=e[Ee>>2]|0,(r|0)<=0){b=zt;return}for(Te=t+4600|0,it=t+4596|0,jt=t+4604|0,Gt=t+4592|0,oe=0;O=oe+-1|0,l=e[Te>>2]|0,c=l+(O*3|0)|0,gt=e[it>>2]|0,o=oe+1|0,h=F[gt+(oe*3|0)>>0]|0,ie=e[jt>>2]|0,d=F[gt+(O*3|0)>>0]|0,w=h-d|0,C=F[c>>0]|0,D=d-C|0,k=((((S[ie+((F[gt+(o*3|0)>>0]|0)-h)>>0]|0)*9|0)+(S[ie+w>>0]|0)|0)*9|0)+(S[ie+D>>0]|0)|0,N=F[gt+(oe*3|0)+1>>0]|0,R=F[gt+(O*3|0)+1>>0]|0,_=N-R|0,U=F[l+(O*3|0)+1>>0]|0,H=R-U|0,K=((((S[ie+((F[gt+(o*3|0)+1>>0]|0)-N)>>0]|0)*9|0)+(S[ie+_>>0]|0)|0)*9|0)+(S[ie+H>>0]|0)|0,G=F[gt+(oe*3|0)+2>>0]|0,$=F[gt+(O*3|0)+2>>0]|0,P=G-$|0,O=F[l+(O*3|0)+2>>0]|0,Z=$-O|0,ie=((((S[ie+((F[gt+(o*3|0)+2>>0]|0)-G)>>0]|0)*9|0)+(S[ie+P>>0]|0)|0)*9|0)+(S[ie+Z>>0]|0)|0,K|k|ie?(l=F[l+(oe*3|0)>>0]|0,r=h-C>>31,(r^D|0)>=0?(r^w|0)<0?r=C:r=C-d+h|0:r=h,h=rr(t,k,l,r,0)|0,l=F[(e[Te>>2]|0)+(oe*3|0)+1>>0]|0,r=N-U>>31,(r^H|0)>=0?(r^_|0)<0?r=U:r=U-R+N|0:r=N,l=rr(t,K,l,r,0)|0,c=F[(e[Te>>2]|0)+(oe*3|0)+2>>0]|0,r=G-O>>31,(r^Z|0)>=0?(r^P|0)<0?r=O:r=O-$+G|0:r=G,ie=rr(t,ie,c,r,0)|0,gt=(e[Te>>2]|0)+(oe*3|0)|0,S[gt>>0]=h,S[gt+1>>0]=l,S[gt+2>>0]=ie):(S[s0>>0]=S[c>>0]|0,S[s0+1>>0]=S[c+1>>0]|0,S[s0+2>>0]=S[c+2>>0]|0,S[ne>>0]=S[c>>0]|0,S[ne+1>>0]=S[c+1>>0]|0,S[ne+2>>0]=S[c+2>>0]|0,r=du(t,ne,l+(oe*3|0)|0,r-oe|0)|0,o=r+oe|0,(o|0)!=(e[Ee>>2]|0)&&(gt=(e[it>>2]|0)+(o*3|0)|0,S[ke>>0]=S[gt>>0]|0,S[ke+1>>0]=S[gt+1>>0]|0,S[ke+2>>0]=S[gt+2>>0]|0,gt=e[Te>>2]|0,S[i0>>0]=S[s0>>0]|0,S[i0+1>>0]=S[s0+1>>0]|0,S[i0+2>>0]=S[s0+2>>0]|0,S[ne>>0]=S[ke>>0]|0,S[ne+1>>0]=S[ke+1>>0]|0,S[ne+2>>0]=S[ke+2>>0]|0,pu(ce,t,i0,ne),gt=gt+(o*3|0)|0,S[gt>>0]=S[ce>>0]|0,S[gt+1>>0]=S[ce+1>>0]|0,S[gt+2>>0]=S[ce+2>>0]|0,gt=e[Gt>>2]|0,e[Gt>>2]=(gt|0)<1?0:gt+-1|0,r=r+1|0),o=r+oe|0),r=e[Ee>>2]|0,!((o|0)>=(r|0));)oe=o;b=zt}function du(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0;for(w=t+112|0,C=t+108|0,D=t+4592|0,c=e[w>>2]|0,h=0;;){if((c|0)<1&&(P0(t),c=e[w>>2]|0),d=e[C>>2]|0,c=c+-1|0,e[w>>2]=c,e[C>>2]=d<<1,(d|0)>=0){k=8;break}if(d=e[D>>2]|0,N=1<>2],R=l-h|0,R=(N|0)<(R|0)?N:R,h=R+h|0,(R|0)==(N|0)&&(e[D>>2]=(d|0)>30?31:d+1|0),(h|0)==(l|0)){c=l;break}}if((k|0)==8&&((h|0)!=(l|0)?(c=e[D>>2]|0,(c+-4|0)>>>0<28?c=l0(t,e[36476+(c<<2)>>2]|0)|0:c=0,c=c+h|0,(c|0)>(l|0)&&(c=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,Q|0)|0,bt(8)),g=0,xe(7,c|0,5,35648),R=g,g=0,R&1?(R=j()|0,Tt(c|0),le(R|0)):Qt(c|0,824,96))):c=l),(c|0)<=0)return c|0;h=0;do R=o+(h*3|0)|0,S[R>>0]=S[r>>0]|0,S[R+1>>0]=S[r+1>>0]|0,S[R+2>>0]=S[r+2>>0]|0,h=h+1|0;while((h|0)!=(c|0));return c|0}function pu(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0;if(C=r+4568|0,N=or(r,C)|0,d=or(r,C)|0,C=or(r,C)|0,h=r+128|0,c=F[l>>0]|0,D=e[r+136>>2]|0,k=D<<1|1,c=(ee(ee(k,N)|0,c-(F[o>>0]|0)>>31|1)|0)+c|0,N=0-D|0,(c|0)>=(N|0)?(h=e[h>>2]|0,(h+D|0)<(c|0)&&(c=c-(ee(e[r+132>>2]|0,k)|0)|0)):(c=(ee(e[r+132>>2]|0,k)|0)+c|0,h=e[h>>2]|0),(c&h|0)!=(c|0)&&(c=h&~(c>>31)),w=c&255,c=F[l+1>>0]|0,c=(ee(ee(k,d)|0,c-(F[o+1>>0]|0)>>31|1)|0)+c|0,(c|0)>=(N|0)?(h+D|0)<(c|0)&&(c=c-(ee(e[r+132>>2]|0,k)|0)|0):c=(ee(e[r+132>>2]|0,k)|0)+c|0,(c&h|0)!=(c|0)&&(c=h&~(c>>31)),d=c&255,c=F[l+2>>0]|0,c=(ee(ee(k,C)|0,c-(F[o+2>>0]|0)>>31|1)|0)+c|0,(c|0)>=(N|0)?(h+D|0)<(c|0)&&(c=c-(ee(e[r+132>>2]|0,k)|0)|0):c=(ee(e[r+132>>2]|0,k)|0)+c|0,(c&h|0)==(c|0)){r=c,r=r&255,S[t>>0]=w,N=t+1|0,S[N>>0]=d,t=t+2|0,S[t>>0]=r;return}r=h&~(c>>31),r=r&255,S[t>>0]=w,N=t+1|0,S[N>>0]=d,t=t+2|0,S[t>>0]=r}function rr(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0;if(U=r>>31,C=(U^r)-U|0,R=t+188+(C*12|0)+10|0,o=I[R>>1]|0,N=t+188+(C*12|0)|0,c=e[N>>2]|0,(o|0)<(c|0))if((o<<1|0)<(c|0))if((o<<2|0)<(c|0))if((o<<3|0)<(c|0))if((o<<4|0)<(c|0))for(r=5;(o<>1]^U)-U+l|0,_=t+128|0,c=e[_>>2]|0,(o&c|0)==(o|0)?D=o:D=c&~(o>>31),o=t+112|0,(e[o>>2]|0)<8&&P0(t),c=t+108|0,l=e[c>>2]|0,h=l>>>24,d=e[2832+(r<<11)+(h<<3)+4>>2]|0,d?(e[o>>2]=(e[o>>2]|0)-d,e[c>>2]=l<>2]|0):(w=e[t+148>>2]|0,c=e[t+140>>2]|0,o=X0(t)|0,(o|0)<(w+-1-c|0)?r&&(o=(l0(t,r)|0)+(o<>31^o>>1,(((o|0)>-1?o:0-o|0)|0)>65535&&(o=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,Q|0)|0,bt(8)),g=0,xe(7,o|0,5,35648),t=g,g=0,t&1?(t=j()|0,Tt(o|0),le(t|0)):Qt(o|0,824,96))),w=t+136|0,l=e[w>>2]|0,r?d=o:(l?c=0:c=(e[t+188+(C*12|0)+4>>2]<<1)+-1+(I[R>>1]|0)>>31,d=c^o),r=e[t+152>>2]|0,c=(e[N>>2]|0)+((d|0)>-1?d:0-d|0)|0,h=t+188+(C*12|0)+4|0,o=(e[h>>2]|0)+(ee(l<<1|1,d)|0)|0,l=I[R>>1]|0,(l|0)==(r|0)&&(c=c>>1,o=o>>1,l=r>>1),e[N>>2]=c,r=l+1|0,I[R>>1]=r,c=r+o|0,(c|0)>=1?(o|0)>0&&(o=o-r|0,R=I[k>>1]|0,I[k>>1]=(R<<16>>16<127&1)+(R&65535),o=(o|0)>0?0:o):(o=I[k>>1]|0,I[k>>1]=(o&65535)-(o<<16>>16>-128&1),o=(c|0)>(~l|0)?c:0-l|0),e[h>>2]=o,r=e[w>>2]|0,l=r<<1|1,c=(ee(l,(d^U)-U|0)|0)+D|0,(c|0)>=(0-r|0)?(o=e[_>>2]|0,(o+r|0)<(c|0)&&(c=c-(ee(e[t+132>>2]|0,l)|0)|0)):(c=(ee(e[t+132>>2]|0,l)|0)+c|0,o=e[_>>2]|0),(c&o|0)==(c|0)?(t=c,t=t&255,t|0):(t=o&~(c>>31),t=t&255,t|0)}function or(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0;if(D=r+9|0,o=F[D>>0]|0,h=r+4|0,c=(ee(o>>>1,e[h>>2]|0)|0)+(e[r>>2]|0)|0,(o|0)<(c|0)){l=0;do o=o<<1,l=l+1|0;while((o|0)<(c|0))}else l=0;d=e[t+148>>2]|0,w=e[36476+(e[t+4592>>2]<<2)>>2]|0,o=e[t+140>>2]|0,c=X0(t)|0;do if((c|0)<(d+-2-w-o|0))if(l){w=(l0(t,l)|0)+(c<>2]|0,c=w+l|0,d=c&1,o=d,h=1,c=(d+c|0)/2|0;break}else{l=e[h>>2]|0,t=l+c|0,o=t&1,t=(o+t|0)/2|0,C=8;break}else c=(l0(t,o)|0)+1|0,d=e[h>>2]|0,t=c+d|0,o=t&1,t=(o+t|0)/2|0,l?(w=c,h=1,c=t,l=d):(l=d,C=8);while(!1);return(C|0)==8&&(w=c,h=F[r+10>>0]<<1>>>0>=(F[D>>0]|0)>>>0,c=t),c=(o|0)!=0^h?c:0-c|0,(c|0)<0&&(C=r+10|0,S[C>>0]=(F[C>>0]|0)+1),o=(w+1-l>>1)+(e[r>>2]|0)|0,e[r>>2]=o,l=S[D>>0]|0,l<<24>>24!=(S[r+8>>0]|0)?(r=l,r=r&255,r=r+1|0,r=r&255,S[D>>0]=r,c|0):(e[r>>2]=o>>1,C=(l&255)>>>1,S[D>>0]=C,r=r+10|0,S[r>>0]=(F[r>>0]|0)>>>1,r=C,r=r&255,r=r+1|0,r=r&255,S[D>>0]=r,c|0)}function mu(t){t=t|0;var r=0,o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0;R=b,b=b+32|0,l=R,N=t+136|0;e:do if(e[N>>2]|0)r=t+144|0;else if(o=e[t+128>>2]|0,r=t+144|0,(o|0)==((1<>2])+-1|0)&&(m0(l,o,0),(e[l+4>>2]|0)==(e[t+176>>2]|0))&&(e[l+8>>2]|0)==(e[t+180>>2]|0)&&(e[l+12>>2]|0)==(e[t+184>>2]|0))switch(e[r>>2]|0){case 8:{N=e[8900]|0,e[t+4604>>2]=N+(((e[8901]|0)-N|0)>>>1),b=R;return}case 10:{N=e[8903]|0,e[t+4604>>2]=N+(((e[8904]|0)-N|0)>>>1),b=R;return}case 12:{N=e[8906]|0,e[t+4604>>2]=N+(((e[8907]|0)-N|0)>>>1),b=R;return}case 16:{N=e[8909]|0,e[t+4604>>2]=N+(((e[8910]|0)-N|0)>>>1),b=R;return}default:break e}while(!1);if(k=1<>2],o=t+4608|0,l=k<<1,c=t+4612|0,h=e[c>>2]|0,r=e[o>>2]|0,d=h-r|0,l>>>0<=d>>>0?l>>>0>>0&&(w=r+l|0,(h|0)!=(w|0))&&(e[c>>2]=w):(j0(o,l-d|0),r=e[o>>2]|0),D=t+4604|0,e[D>>2]=r+k,r=0-k|0,(k|0)<=(r|0)){b=R;return}w=t+184|0,C=t+180|0,d=t+176|0,h=r;do r=e[w>>2]|0,(h|0)>(0-r|0)?(o=e[C>>2]|0,(h|0)>(0-o|0)?(l=e[d>>2]|0,(h|0)>(0-l|0)?(c=e[N>>2]|0,(h|0)>=(0-c|0)?(c|0)<(h|0)?(l|0)<=(h|0)?(o|0)>(h|0)?r=2:r=(r|0)>(h|0)?3:4:r=1:r=0:r=-1):r=-2):r=-3):r=-4,S[(e[D>>2]|0)+h>>0]=r,h=h+1|0;while((h|0)!=(k|0));b=R}function gu(t){t=t|0;var r=0,o=0;e[t>>2]=35772,r=e[t+4584>>2]|0,r&&(o=t+4588|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),e[t>>2]=36736,r=e[t+92>>2]|0,r&&(o=t+96|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),t=t+88|0,r=e[t>>2]|0,e[t>>2]=0,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r)}function Su(t){t=t|0;var r=0,o=0;if(e[t>>2]=35772,r=e[t+4584>>2]|0,r&&(o=t+4588|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),e[t>>2]=36736,r=e[t+92>>2]|0,r&&(o=t+96|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),o=t+88|0,r=e[o>>2]|0,e[o>>2]=0,!r){he(t);return}Mt[e[(e[r>>2]|0)+4>>2]&255](r),he(t)}function Au(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0,G=0,$=0,P=0,O=0;if(G=b,b=b+352|0,$=G+328|0,P=G+192|0,o=G+343|0,l=G+342|0,c=G+341|0,h=G+340|0,R=G+176|0,w=G+168|0,C=G+160|0,D=G+152|0,K=G,U=G+136|0,e[t+28>>2]|0&&(e[t+20>>2]|0)!=1){if(_=t+4|0,H=t+32|0,d=e[H>>2]|0,!d){if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[o>>0]|0,$e(37,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}if(t=e[t+12>>2]|0,(t|0)==16)switch(d|0){case 1:{if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[l>>0]|0,$e(38,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 2:{if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[c>>0]|0,$e(39,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 3:{if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[h>>0]|0,$e(40,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}default:{d=P+56|0,c=P+4|0,e[P>>2]=36160,e[d>>2]=36180,g=0,Ae(62,P+56|0,c|0),G=g,g=0,G&1&&(O=j()|0,tt(d),le(O|0)),e[P+128>>2]=0,e[P+132>>2]=-1,e[P>>2]=36200,e[P+56>>2]=36220,g=0,ue(180,c|0),G=g,g=0;do if(G&1)t=j()|0;else{if(e[c>>2]=36236,h=P+36|0,e[h>>2]=0,e[h+4>>2]=0,e[h+8>>2]=0,e[h+12>>2]=0,e[P+52>>2]=16,e[$>>2]=0,e[$+4>>2]=0,e[$+8>>2]=0,g=0,Ae(63,c|0,$|0),G=g,g=0,G&1){t=j()|0,de($),de(h),wt(c);break}de($),g=0,t=Ve(28,P|0,49007,21)|0,$=g,g=0;do if(!($&1)&&(g=0,k=be(36,t|0,e[H>>2]|0)|0,$=g,g=0,!($&1))&&(g=0,Ve(28,k|0,50997,18)|0,$=g,g=0,!($&1))){if(l=Ct(16)|0,g=0,Ae(64,R|0,c|0),$=g,g=0,$&1)t=j()|0;else if(!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,Q|0)|0,bt(8)),g=0,$e(36,l|0,9,35648,R|0),$=g,g=0,$&1?o=1:(g=0,xe(6,l|0,824,96),g=0,o=0),t=j()|0,de(R),!o)break;Tt(l|0)}else O=34;while(!1);(O|0)==34&&(t=j()|0),e[P>>2]=36200,e[d>>2]=36220,e[c>>2]=36236,de(h),wt(c),tt(d),O=t,le(O|0)}while(!1);O=t,tt(d),le(O|0)}}switch((t|0)<=8&&(t=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,Q|0)|0,bt(8)),g=0,xe(7,t|0,8,35648),O=g,g=0,O&1||Qt(t|0,824,96),O=j()|0,Tt(t|0),le(O|0)),o=16-t|0,d|0){case 1:{if(t=Xe(60)|0,e[w>>2]=o,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],e[$>>2]=e[w>>2],e[$+4>>2]=e[w+4>>2],$e(41,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 2:{if(t=Xe(60)|0,e[C>>2]=o,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],e[$>>2]=e[C>>2],e[$+4>>2]=e[C+4>>2],$e(42,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 3:{if(t=Xe(60)|0,e[D>>2]=o,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],e[$>>2]=e[D>>2],e[$+4>>2]=e[D+4>>2],$e(43,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}default:{d=K+56|0,c=K+4|0,e[K>>2]=36160,e[d>>2]=36180,g=0,Ae(62,K+56|0,c|0),P=g,g=0,P&1&&(O=j()|0,tt(d),le(O|0)),e[K+128>>2]=0,e[K+132>>2]=-1,e[K>>2]=36200,e[K+56>>2]=36220,g=0,ue(180,c|0),P=g,g=0;do if(P&1)t=j()|0;else{if(e[c>>2]=36236,h=K+36|0,e[h>>2]=0,e[h+4>>2]=0,e[h+8>>2]=0,e[h+12>>2]=0,e[K+52>>2]=16,e[$>>2]=0,e[$+4>>2]=0,e[$+8>>2]=0,g=0,Ae(63,c|0,$|0),P=g,g=0,P&1){t=j()|0,de($),de(h),wt(c);break}de($),g=0,t=Ve(28,K|0,49007,21)|0,P=g,g=0;do if(!(P&1)&&(g=0,N=be(36,t|0,e[H>>2]|0)|0,P=g,g=0,!(P&1))&&(g=0,Ve(28,N|0,50997,18)|0,P=g,g=0,!(P&1))){if(l=Ct(16)|0,g=0,Ae(64,U|0,c|0),P=g,g=0,P&1)t=j()|0;else if(!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,Q|0)|0,bt(8)),g=0,$e(36,l|0,9,35648,U|0),P=g,g=0,P&1?o=1:(g=0,xe(6,l|0,824,96),g=0,o=0),t=j()|0,de(U),!o)break;Tt(l|0)}else O=64;while(!1);(O|0)==64&&(t=j()|0),e[K>>2]=36200,e[d>>2]=36220,e[c>>2]=36236,de(h),wt(c),tt(d),O=t,le(O|0)}while(!1);O=t,tt(d),le(O|0)}}}return o=e[r+4>>2]|0,l=Xe(16)|0,t=e[t+16>>2]|0,o?(e[l>>2]=36108,e[l+4>>2]=o,e[l+8>>2]=2,e[l+12>>2]=t,O=l,b=G,O|0):(O=e[r>>2]|0,e[l>>2]=36132,e[l+4>>2]=O,e[l+8>>2]=2,e[l+12>>2]=t,O=l,b=G,O|0)}function vu(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0;c=b,b=b+32|0,w=c,m0(w,65535,0),d=e[r+4>>2]|0,h=e[r+8>>2]|0,h=h|0?h:e[w+8>>2]|0,l=e[r+12>>2]|0,l=l|0?l:e[w+12>>2]|0,r=e[r+16>>2]|0,o=e[w+16>>2]|0,e[t+152>>2]=d|0?d:e[w+4>>2]|0,e[t+156>>2]=h,e[t+160>>2]=l,Eu(t),l=0;do e[t+164+(l*12|0)>>2]=1024,e[t+164+(l*12|0)+4>>2]=0,I[t+164+(l*12|0)+8>>1]=0,I[t+164+(l*12|0)+10>>1]=1,l=l+1|0;while((l|0)!=365);w=(r|0?r:o)&255,e[t+4544>>2]=1024,e[t+4548>>2]=0,S[t+4552>>0]=w,S[t+4553>>0]=1,S[t+4554>>0]=0,e[t+4556>>2]=1024,e[t+4560>>2]=1,S[t+4564>>0]=w,S[t+4565>>0]=1,S[t+4566>>0]=0,e[t+4568>>2]=0,b=c}function xu(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0;for(d=t+88|0,h=e[r>>2]|0,e[r>>2]=0,r=e[d>>2]|0,e[d>>2]=h,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r),d=l+4|0,h=e[d>>2]|0,S[t+4596>>0]=c&1,r=t+132|0,e[r>>2]=e[o>>2],e[r+4>>2]=e[o+4>>2],e[r+8>>2]=e[o+8>>2],e[r+12>>2]=e[o+12>>2],Y0(t,l),wu(t),r=e[t+116>>2]|0,t=e[t+112>>2]|0;c=r+-1|0,o=(S[c>>0]|0)==-1?7:8,!((t|0)<(o|0));)r=c,t=t-o|0;r=r-h|0,c=e[d>>2]|0,c&&(e[d>>2]=c+r,l=l+8|0,e[l>>2]=(e[l>>2]|0)-r)}function wu(t){t=t|0;var r=0,o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0,ce=0;ie=b,b=b+32|0,ne=ie+12|0,Z=ie,$=t+148|0,P=(e[$>>2]|0)+4|0,(e[t+28>>2]|0)==1?O=e[t+20>>2]|0:O=1,r=ee(O<<1,P)|0,e[ne>>2]=0,ce=ne+4|0,e[ce>>2]=0,e[ne+8>>2]=0;do if(r){if((r|0)<0&&(g=0,ue(178,ne|0),oe=g,g=0,oe&1)||(d=6),(d|0)==6&&(o=r<<1,g=0,l=ge(67,o|0)|0,oe=g,g=0,!(oe&1))){e[ne>>2]=l,oe=l+(r<<1)|0,e[ne+8>>2]=oe,Jt(l|0,0,o|0)|0,e[ce>>2]=oe;break}l=j()|0,r=e[ne>>2]|0,r||le(l|0),o=e[ce>>2]|0,(o|0)!=(r|0)&&(e[ce>>2]=o+(~((o+-2-r|0)>>>1)<<1)),he(r),le(l|0)}while(!1);e[Z>>2]=0,oe=Z+4|0,e[oe>>2]=0,e[Z+8>>2]=0;do if(!O)d=18;else{if(O>>>0>1073741823&&(g=0,ue(178,Z|0),G=g,g=0,G&1)||(d=16),(d|0)==16&&(c=O<<2,g=0,h=ge(67,c|0)|0,G=g,g=0,!(G&1))){e[Z>>2]=h,d=h+(O<<2)|0,e[Z+8>>2]=d,Jt(h|0,0,c|0)|0,e[oe>>2]=d,d=18;break}l=j()|0,r=e[Z>>2]|0,o=r,r&&(c=e[oe>>2]|0,(c|0)!=(r|0)&&(e[oe>>2]=c+(~((c+-4-o|0)>>>2)<<2)),he(r))}while(!1);if((d|0)==18){h=t+8|0;e:do if((e[h>>2]|0)>0){d=t+4572|0,w=ee(O,P)|0,C=w+1|0,D=t+4576|0,k=(O|0)>0,N=t+136|0,R=t+144|0,_=t+140|0,U=t+132|0,H=t+88|0,K=t+4568|0,G=0;t:for(;;){if(l=e[ne>>2]|0,o=l+2|0,e[d>>2]=o,l=l+(C<<1)|0,e[D>>2]=l,G&1?(e[d>>2]=l,e[D>>2]=o,r=o,o=l):r=l,k){c=e[Z>>2]|0,l=0;do{if(e[K>>2]=e[c+(l<<2)>>2],c=e[$>>2]|0,I[o+(c<<1)>>1]=I[o+(c+-1<<1)>>1]|0,I[r+-2>>1]=I[o>>1]|0,g=0,Ae(79,t|0,0),c=g,g=0,c&1){d=29;break t}c=e[Z>>2]|0,e[c+(l<<2)>>2]=e[K>>2],o=(e[d>>2]|0)+(P<<1)|0,e[d>>2]=o,r=(e[D>>2]|0)+(P<<1)|0,e[D>>2]=r,l=l+1|0}while((l|0)<(O|0))}if(c=e[N>>2]|0,(c|0)<=(G|0)&&(G|0)<((e[R>>2]|0)+c|0)&&(c=e[H>>2]|0,g=0,$e(e[(e[c>>2]|0)+8>>2]|0,c|0,r+((e[U>>2]|0)-w<<1)|0,e[_>>2]|0,P|0),c=g,g=0,c&1)){d=30;break}if(G=G+1|0,(G|0)>=(e[h>>2]|0)){d=42;break e}}if((d|0)==29){l=j()|0;break}else if((d|0)==30){l=j()|0;break}}else d=42;while(!1);do if((d|0)==42){if(g=0,ue(183,t|0),t=g,g=0,t&1){l=j()|0;break}if(r=e[Z>>2]|0,o=r,r&&(l=e[oe>>2]|0,(l|0)!=(r|0)&&(e[oe>>2]=l+(~((l+-4-o|0)>>>2)<<2)),he(r)),r=e[ne>>2]|0,!r){b=ie;return}o=e[ce>>2]|0,(o|0)!=(r|0)&&(e[ce>>2]=o+(~((o+-2-r|0)>>>1)<<1)),he(r),b=ie;return}while(!1);r=e[Z>>2]|0,o=r,r&&(c=e[oe>>2]|0,(c|0)!=(r|0)&&(e[oe>>2]=c+(~((c+-4-o|0)>>>2)<<2)),he(r))}r=e[ne>>2]|0,r||le(l|0),o=e[ce>>2]|0,(o|0)!=(r|0)&&(e[ce>>2]=o+(~((o+-2-r|0)>>>1)<<1)),he(r),le(l|0)}function yu(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0;if(N=t+4572|0,r=e[N>>2]|0,U=t+148|0,!((e[U>>2]|0)<=0))for(R=t+4576|0,_=t+4580|0,c=r,h=M[r+-2>>1]|0,r=M[r>>1]|0,k=0;D=e[R>>2]|0,C=M[D+(k+-1<<1)>>1]|0,l=k+1|0,o=M[c+(l<<1)>>1]|0,w=e[_>>2]|0,d=r-h|0,c=h-C|0,w=((((S[w+(o-r)>>0]|0)*9|0)+(S[w+d>>0]|0)|0)*9|0)+(S[w+c>>0]|0)|0,w?(h=r-C>>31,(h^c|0)<0?c=r:c=C+((h^d|0)<0?0:d)|0,D=Cu(t,w,M[D+(k<<1)>>1]|0,c,0)|0,I[(e[R>>2]|0)+(k<<1)>>1]=D):(l=(Tu(t,k,0)|0)+k|0,o=e[N>>2]|0,r=M[o+(l+-1<<1)>>1]|0,o=M[o+(l<<1)>>1]|0),!((l|0)>=(e[U>>2]|0));)c=e[N>>2]|0,h=r,r=o,k=l}function Cu(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0;if(_=r>>31,D=(_^r)-_|0,R=t+164+(D*12|0)+10|0,o=I[R>>1]|0,N=t+164+(D*12|0)|0,c=e[N>>2]|0,(o|0)<(c|0))if((o<<1|0)<(c|0))if((o<<2|0)<(c|0))if((o<<3|0)<(c|0))if((o<<4|0)<(c|0))for(h=5;(o<>1]^_)-_+l|0,(o&65535|0)!=(o|0)&&(o=o>>31&65535^65535),c=t+112|0,(e[c>>2]|0)<8&&P0(t),l=t+108|0,d=e[l>>2]|0,w=d>>>24,C=e[2832+(h<<11)+(w<<3)+4>>2]|0,C?(e[c>>2]=(e[c>>2]|0)-C,e[l>>2]=d<>2]|0):(c=X0(t)|0,(c|0)<47?h&&(c=(l0(t,h)|0)+(c<>31^c>>1,(((c|0)>-1?c:0-c|0)|0)>65535&&(o=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,Q|0)|0,bt(8)),g=0,xe(7,o|0,5,35648),r=g,g=0,r&1?(r=j()|0,Tt(o|0),le(r|0)):Qt(o|0,824,96))),C=t+164+(D*12|0)+4|0,l=e[C>>2]|0,h?h=I[R>>1]|0:(t=I[R>>1]|0,h=t,c=(l<<1)+-1+(t<<16>>16)>>31^c),d=h<<16>>16==64,t=d&1,w=l+c>>t,d=d?32:h<<16>>16,e[N>>2]=((c|0)>-1?c:0-c|0)+(e[N>>2]|0)>>t,l=d+1|0,I[R>>1]=l,h=l+w|0,(h|0)<1?(R=I[k>>1]|0,I[k>>1]=(R&65535)-(R<<16>>16>-128&1),R=(h|0)>(~d|0)?h:0-d|0,e[C>>2]=R,_=c^_,r=r>>>31,r=o+r|0,r=r+_|0,r=r&65535,r|0):(w|0)<=0?(R=w,e[C>>2]=R,_=c^_,r=r>>>31,r=o+r|0,r=r+_|0,r=r&65535,r|0):(R=w-l|0,N=I[k>>1]|0,I[k>>1]=(N<<16>>16<127&1)+(N&65535),R=(R|0)>0?0:R,e[C>>2]=R,_=c^_,r=r>>>31,r=o+r|0,r=r+_|0,r=r&65535,r|0)}function Tu(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0;return h=t+4576|0,c=e[h>>2]|0,o=I[c+(r+-1<<1)>>1]|0,d=t+148|0,c=Iu(t,o,c+(r<<1)|0,(e[d>>2]|0)-r|0)|0,l=c+r|0,(l|0)==(e[d>>2]|0)?(d=c,d|0):(o=o&65535,r=M[(e[t+4572>>2]|0)+(l<<1)>>1]|0,d=o-r|0,(((d|0)>-1?d:0-d|0)|0)<1?o=(ys(t,t+4556|0)|0)+o|0:o=(ee(ys(t,t+4544|0)|0,r-o>>31|1)|0)+r|0,I[(e[h>>2]|0)+(l<<1)>>1]=o,d=t+4568|0,t=e[d>>2]|0,e[d>>2]=(t|0)<1?0:t+-1|0,d=c+1|0,d|0)}function Iu(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0;for(w=t+112|0,C=t+108|0,D=t+4568|0,c=e[w>>2]|0,h=0;;){if((c|0)<1&&(P0(t),c=e[w>>2]|0),d=e[C>>2]|0,c=c+-1|0,e[w>>2]=c,e[C>>2]=d<<1,(d|0)>=0){k=8;break}if(d=e[D>>2]|0,N=1<>2],R=l-h|0,R=(N|0)<(R|0)?N:R,h=R+h|0,(R|0)==(N|0)&&(e[D>>2]=(d|0)>30?31:d+1|0),(h|0)==(l|0)){c=l;break}}if((k|0)==8&&((h|0)!=(l|0)?(c=e[D>>2]|0,(c+-4|0)>>>0<28?c=l0(t,e[36476+(c<<2)>>2]|0)|0:c=0,c=c+h|0,(c|0)>(l|0)&&(c=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,Q|0)|0,bt(8)),g=0,xe(7,c|0,5,35648),R=g,g=0,R&1?(R=j()|0,Tt(c|0),le(R|0)):Qt(c|0,824,96))):c=l),(c|0)>0)h=0;else return c|0;do I[o+(h<<1)>>1]=r,h=h+1|0;while((h|0)!=(c|0));return c|0}function ys(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0;if(w=r+9|0,o=F[w>>0]|0,h=r+4|0,c=(ee(o>>>1,e[h>>2]|0)|0)+(e[r>>2]|0)|0,(o|0)<(c|0)){l=0;do o=o<<1,l=l+1|0;while((o|0)<(c|0))}else l=0;c=e[36476+(e[t+4568>>2]<<2)>>2]|0,o=X0(t)|0;do if((o|0)<(46-c|0))if(l){o=(l0(t,l)|0)+(o<>2]|0,c=o+t|0,C=c&1,l=C,h=1,c=(C+c|0)/2|0;break}else{t=e[h>>2]|0,c=t+o|0,l=c&1,c=(l+c|0)/2|0,d=8;break}else o=(l0(t,16)|0)+1|0,t=e[h>>2]|0,c=o+t|0,h=c&1,c=(h+c|0)/2|0,l?(l=h,h=1):(l=h,d=8);while(!1);return(d|0)==8&&(h=F[r+10>>0]<<1>>>0>=(F[w>>0]|0)>>>0),c=(l|0)!=0^h?c:0-c|0,(c|0)<0&&(C=r+10|0,S[C>>0]=(F[C>>0]|0)+1),o=(o+1-t>>1)+(e[r>>2]|0)|0,e[r>>2]=o,l=S[w>>0]|0,l<<24>>24!=(S[r+8>>0]|0)?(C=l,C=C&255,C=C+1|0,C=C&255,S[w>>0]=C,c|0):(e[r>>2]=o>>1,C=(l&255)>>>1,S[w>>0]=C,r=r+10|0,S[r>>0]=(F[r>>0]|0)>>>1,C=C&255,C=C+1|0,C=C&255,S[w>>0]=C,c|0)}function Eu(t){t=t|0;var r=0,o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0;if(D=b,b=b+32|0,w=D,m0(w,65535,0),C=t+152|0,(e[w+4>>2]|0)==(e[C>>2]|0)&&(e[w+8>>2]|0)==(e[t+156>>2]|0)&&(e[w+12>>2]|0)==(e[t+160>>2]|0)){C=e[8909]|0,e[t+4580>>2]=C+(((e[8910]|0)-C|0)>>>1),b=D;return}for(o=t+4584|0,l=t+4588|0,c=e[l>>2]|0,r=e[o>>2]|0,h=c-r|0,h>>>0>=131072?h>>>0>131072&&(d=r+131072|0,(c|0)!=(d|0))&&(e[l>>2]=d):(j0(o,131072-h|0),r=e[o>>2]|0),w=t+4580|0,e[w>>2]=r+65536,d=t+160|0,c=t+156|0,h=-65536;;){if(r=e[d>>2]|0,(h|0)>(0-r|0))if(o=e[c>>2]|0,(h|0)>(0-o|0))if(l=e[C>>2]|0,(h|0)>(0-l|0))if((h|0)>=0){if((h|0)<1){S[(e[w>>2]|0)+h>>0]=0,h=1;continue}(l|0)<=(h|0)?(o|0)>(h|0)?r=2:r=(r|0)>(h|0)?3:4:r=1}else r=-1;else r=-2;else r=-3;else r=-4;if(S[(e[w>>2]|0)+h>>0]=r,h=h+1|0,(h|0)==65536)break}b=D}function ku(t){t=t|0;var r=0,o=0;e[t>>2]=35744,r=e[t+4584>>2]|0,r&&(o=t+4588|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),e[t>>2]=36736,r=e[t+92>>2]|0,r&&(o=t+96|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),t=t+88|0,r=e[t>>2]|0,e[t>>2]=0,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r)}function Du(t){t=t|0;var r=0,o=0;if(e[t>>2]=35744,r=e[t+4584>>2]|0,r&&(o=t+4588|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),e[t>>2]=36736,r=e[t+92>>2]|0,r&&(o=t+96|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),o=t+88|0,r=e[o>>2]|0,e[o>>2]=0,!r){he(t);return}Mt[e[(e[r>>2]|0)+4>>2]&255](r),he(t)}function bu(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0,G=0,$=0,P=0,O=0;if(G=b,b=b+352|0,$=G+328|0,P=G+192|0,o=G+343|0,l=G+342|0,c=G+341|0,h=G+340|0,R=G+176|0,w=G+168|0,C=G+160|0,D=G+152|0,K=G,U=G+136|0,e[t+28>>2]|0&&(e[t+20>>2]|0)!=1){if(_=t+4|0,H=t+32|0,d=e[H>>2]|0,!d){if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[o>>0]|0,$e(37,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}if(t=e[t+12>>2]|0,(t|0)==16)switch(d|0){case 1:{if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[l>>0]|0,$e(38,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 2:{if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[c>>0]|0,$e(39,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 3:{if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[h>>0]|0,$e(40,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}default:{d=P+56|0,c=P+4|0,e[P>>2]=36160,e[d>>2]=36180,g=0,Ae(62,P+56|0,c|0),G=g,g=0,G&1&&(O=j()|0,tt(d),le(O|0)),e[P+128>>2]=0,e[P+132>>2]=-1,e[P>>2]=36200,e[P+56>>2]=36220,g=0,ue(180,c|0),G=g,g=0;do if(G&1)t=j()|0;else{if(e[c>>2]=36236,h=P+36|0,e[h>>2]=0,e[h+4>>2]=0,e[h+8>>2]=0,e[h+12>>2]=0,e[P+52>>2]=16,e[$>>2]=0,e[$+4>>2]=0,e[$+8>>2]=0,g=0,Ae(63,c|0,$|0),G=g,g=0,G&1){t=j()|0,de($),de(h),wt(c);break}de($),g=0,t=Ve(28,P|0,49007,21)|0,$=g,g=0;do if(!($&1)&&(g=0,k=be(36,t|0,e[H>>2]|0)|0,$=g,g=0,!($&1))&&(g=0,Ve(28,k|0,50997,18)|0,$=g,g=0,!($&1))){if(l=Ct(16)|0,g=0,Ae(64,R|0,c|0),$=g,g=0,$&1)t=j()|0;else if(!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,Q|0)|0,bt(8)),g=0,$e(36,l|0,9,35648,R|0),$=g,g=0,$&1?o=1:(g=0,xe(6,l|0,824,96),g=0,o=0),t=j()|0,de(R),!o)break;Tt(l|0)}else O=34;while(!1);(O|0)==34&&(t=j()|0),e[P>>2]=36200,e[d>>2]=36220,e[c>>2]=36236,de(h),wt(c),tt(d),O=t,le(O|0)}while(!1);O=t,tt(d),le(O|0)}}switch((t|0)<=8&&(t=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,Q|0)|0,bt(8)),g=0,xe(7,t|0,8,35648),O=g,g=0,O&1||Qt(t|0,824,96),O=j()|0,Tt(t|0),le(O|0)),o=16-t|0,d|0){case 1:{if(t=Xe(60)|0,e[w>>2]=o,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],e[$>>2]=e[w>>2],e[$+4>>2]=e[w+4>>2],$e(41,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 2:{if(t=Xe(60)|0,e[C>>2]=o,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],e[$>>2]=e[C>>2],e[$+4>>2]=e[C+4>>2],$e(42,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 3:{if(t=Xe(60)|0,e[D>>2]=o,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],e[$>>2]=e[D>>2],e[$+4>>2]=e[D+4>>2],$e(43,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}default:{d=K+56|0,c=K+4|0,e[K>>2]=36160,e[d>>2]=36180,g=0,Ae(62,K+56|0,c|0),P=g,g=0,P&1&&(O=j()|0,tt(d),le(O|0)),e[K+128>>2]=0,e[K+132>>2]=-1,e[K>>2]=36200,e[K+56>>2]=36220,g=0,ue(180,c|0),P=g,g=0;do if(P&1)t=j()|0;else{if(e[c>>2]=36236,h=K+36|0,e[h>>2]=0,e[h+4>>2]=0,e[h+8>>2]=0,e[h+12>>2]=0,e[K+52>>2]=16,e[$>>2]=0,e[$+4>>2]=0,e[$+8>>2]=0,g=0,Ae(63,c|0,$|0),P=g,g=0,P&1){t=j()|0,de($),de(h),wt(c);break}de($),g=0,t=Ve(28,K|0,49007,21)|0,P=g,g=0;do if(!(P&1)&&(g=0,N=be(36,t|0,e[H>>2]|0)|0,P=g,g=0,!(P&1))&&(g=0,Ve(28,N|0,50997,18)|0,P=g,g=0,!(P&1))){if(l=Ct(16)|0,g=0,Ae(64,U|0,c|0),P=g,g=0,P&1)t=j()|0;else if(!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,Q|0)|0,bt(8)),g=0,$e(36,l|0,9,35648,U|0),P=g,g=0,P&1?o=1:(g=0,xe(6,l|0,824,96),g=0,o=0),t=j()|0,de(U),!o)break;Tt(l|0)}else O=64;while(!1);(O|0)==64&&(t=j()|0),e[K>>2]=36200,e[d>>2]=36220,e[c>>2]=36236,de(h),wt(c),tt(d),O=t,le(O|0)}while(!1);O=t,tt(d),le(O|0)}}}return o=e[r+4>>2]|0,l=Xe(16)|0,t=e[t+16>>2]|0,o?(e[l>>2]=36108,e[l+4>>2]=o,e[l+8>>2]=2,e[l+12>>2]=t,O=l,b=G,O|0):(O=e[r>>2]|0,e[l>>2]=36132,e[l+4>>2]=O,e[l+8>>2]=2,e[l+12>>2]=t,O=l,b=G,O|0)}function Nu(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0;c=b,b=b+32|0,w=c,m0(w,4095,0),d=e[r+4>>2]|0,h=e[r+8>>2]|0,h=h|0?h:e[w+8>>2]|0,l=e[r+12>>2]|0,l=l|0?l:e[w+12>>2]|0,r=e[r+16>>2]|0,o=e[w+16>>2]|0,e[t+152>>2]=d|0?d:e[w+4>>2]|0,e[t+156>>2]=h,e[t+160>>2]=l,Ou(t),l=0;do e[t+164+(l*12|0)>>2]=64,e[t+164+(l*12|0)+4>>2]=0,I[t+164+(l*12|0)+8>>1]=0,I[t+164+(l*12|0)+10>>1]=1,l=l+1|0;while((l|0)!=365);w=(r|0?r:o)&255,e[t+4544>>2]=64,e[t+4548>>2]=0,S[t+4552>>0]=w,S[t+4553>>0]=1,S[t+4554>>0]=0,e[t+4556>>2]=64,e[t+4560>>2]=1,S[t+4564>>0]=w,S[t+4565>>0]=1,S[t+4566>>0]=0,e[t+4568>>2]=0,b=c}function Fu(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0;for(d=t+88|0,h=e[r>>2]|0,e[r>>2]=0,r=e[d>>2]|0,e[d>>2]=h,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r),d=l+4|0,h=e[d>>2]|0,S[t+4596>>0]=c&1,r=t+132|0,e[r>>2]=e[o>>2],e[r+4>>2]=e[o+4>>2],e[r+8>>2]=e[o+8>>2],e[r+12>>2]=e[o+12>>2],Y0(t,l),Ru(t),r=e[t+116>>2]|0,t=e[t+112>>2]|0;c=r+-1|0,o=(S[c>>0]|0)==-1?7:8,!((t|0)<(o|0));)r=c,t=t-o|0;r=r-h|0,c=e[d>>2]|0,c&&(e[d>>2]=c+r,l=l+8|0,e[l>>2]=(e[l>>2]|0)-r)}function Ru(t){t=t|0;var r=0,o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0,ce=0;ie=b,b=b+32|0,ne=ie+12|0,Z=ie,$=t+148|0,P=(e[$>>2]|0)+4|0,(e[t+28>>2]|0)==1?O=e[t+20>>2]|0:O=1,r=ee(O<<1,P)|0,e[ne>>2]=0,ce=ne+4|0,e[ce>>2]=0,e[ne+8>>2]=0;do if(r){if((r|0)<0&&(g=0,ue(178,ne|0),oe=g,g=0,oe&1)||(d=6),(d|0)==6&&(o=r<<1,g=0,l=ge(67,o|0)|0,oe=g,g=0,!(oe&1))){e[ne>>2]=l,oe=l+(r<<1)|0,e[ne+8>>2]=oe,Jt(l|0,0,o|0)|0,e[ce>>2]=oe;break}l=j()|0,r=e[ne>>2]|0,r||le(l|0),o=e[ce>>2]|0,(o|0)!=(r|0)&&(e[ce>>2]=o+(~((o+-2-r|0)>>>1)<<1)),he(r),le(l|0)}while(!1);e[Z>>2]=0,oe=Z+4|0,e[oe>>2]=0,e[Z+8>>2]=0;do if(!O)d=18;else{if(O>>>0>1073741823&&(g=0,ue(178,Z|0),G=g,g=0,G&1)||(d=16),(d|0)==16&&(c=O<<2,g=0,h=ge(67,c|0)|0,G=g,g=0,!(G&1))){e[Z>>2]=h,d=h+(O<<2)|0,e[Z+8>>2]=d,Jt(h|0,0,c|0)|0,e[oe>>2]=d,d=18;break}l=j()|0,r=e[Z>>2]|0,o=r,r&&(c=e[oe>>2]|0,(c|0)!=(r|0)&&(e[oe>>2]=c+(~((c+-4-o|0)>>>2)<<2)),he(r))}while(!1);if((d|0)==18){h=t+8|0;e:do if((e[h>>2]|0)>0){d=t+4572|0,w=ee(O,P)|0,C=w+1|0,D=t+4576|0,k=(O|0)>0,N=t+136|0,R=t+144|0,_=t+140|0,U=t+132|0,H=t+88|0,K=t+4568|0,G=0;t:for(;;){if(l=e[ne>>2]|0,o=l+2|0,e[d>>2]=o,l=l+(C<<1)|0,e[D>>2]=l,G&1?(e[d>>2]=l,e[D>>2]=o,r=o,o=l):r=l,k){c=e[Z>>2]|0,l=0;do{if(e[K>>2]=e[c+(l<<2)>>2],c=e[$>>2]|0,I[o+(c<<1)>>1]=I[o+(c+-1<<1)>>1]|0,I[r+-2>>1]=I[o>>1]|0,g=0,Ae(80,t|0,0),c=g,g=0,c&1){d=29;break t}c=e[Z>>2]|0,e[c+(l<<2)>>2]=e[K>>2],o=(e[d>>2]|0)+(P<<1)|0,e[d>>2]=o,r=(e[D>>2]|0)+(P<<1)|0,e[D>>2]=r,l=l+1|0}while((l|0)<(O|0))}if(c=e[N>>2]|0,(c|0)<=(G|0)&&(G|0)<((e[R>>2]|0)+c|0)&&(c=e[H>>2]|0,g=0,$e(e[(e[c>>2]|0)+8>>2]|0,c|0,r+((e[U>>2]|0)-w<<1)|0,e[_>>2]|0,P|0),c=g,g=0,c&1)){d=30;break}if(G=G+1|0,(G|0)>=(e[h>>2]|0)){d=42;break e}}if((d|0)==29){l=j()|0;break}else if((d|0)==30){l=j()|0;break}}else d=42;while(!1);do if((d|0)==42){if(g=0,ue(183,t|0),t=g,g=0,t&1){l=j()|0;break}if(r=e[Z>>2]|0,o=r,r&&(l=e[oe>>2]|0,(l|0)!=(r|0)&&(e[oe>>2]=l+(~((l+-4-o|0)>>>2)<<2)),he(r)),r=e[ne>>2]|0,!r){b=ie;return}o=e[ce>>2]|0,(o|0)!=(r|0)&&(e[ce>>2]=o+(~((o+-2-r|0)>>>1)<<1)),he(r),b=ie;return}while(!1);r=e[Z>>2]|0,o=r,r&&(c=e[oe>>2]|0,(c|0)!=(r|0)&&(e[oe>>2]=c+(~((c+-4-o|0)>>>2)<<2)),he(r))}r=e[ne>>2]|0,r||le(l|0),o=e[ce>>2]|0,(o|0)!=(r|0)&&(e[ce>>2]=o+(~((o+-2-r|0)>>>1)<<1)),he(r),le(l|0)}function Mu(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0;if(N=t+4572|0,r=e[N>>2]|0,U=t+148|0,!((e[U>>2]|0)<=0))for(R=t+4576|0,_=t+4580|0,c=r,h=M[r+-2>>1]|0,r=M[r>>1]|0,k=0;D=e[R>>2]|0,C=M[D+(k+-1<<1)>>1]|0,l=k+1|0,o=M[c+(l<<1)>>1]|0,w=e[_>>2]|0,d=r-h|0,c=h-C|0,w=((((S[w+(o-r)>>0]|0)*9|0)+(S[w+d>>0]|0)|0)*9|0)+(S[w+c>>0]|0)|0,w?(h=r-C>>31,(h^c|0)<0?c=r:c=C+((h^d|0)<0?0:d)|0,D=_u(t,w,M[D+(k<<1)>>1]|0,c,0)|0,I[(e[R>>2]|0)+(k<<1)>>1]=D):(l=(Pu(t,k,0)|0)+k|0,o=e[N>>2]|0,r=M[o+(l+-1<<1)>>1]|0,o=M[o+(l<<1)>>1]|0),!((l|0)>=(e[U>>2]|0));)c=e[N>>2]|0,h=r,r=o,k=l}function _u(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0;if(_=r>>31,D=(_^r)-_|0,R=t+164+(D*12|0)+10|0,o=I[R>>1]|0,N=t+164+(D*12|0)|0,c=e[N>>2]|0,(o|0)<(c|0))if((o<<1|0)<(c|0))if((o<<2|0)<(c|0))if((o<<3|0)<(c|0))if((o<<4|0)<(c|0))for(h=5;(o<>1]^_)-_+l|0,(o&4095|0)!=(o|0)&&(o=o>>31&4095^4095),c=t+112|0,(e[c>>2]|0)<8&&P0(t),l=t+108|0,d=e[l>>2]|0,w=d>>>24,C=e[2832+(h<<11)+(w<<3)+4>>2]|0,C?(e[c>>2]=(e[c>>2]|0)-C,e[l>>2]=d<>2]|0):(c=X0(t)|0,(c|0)<35?h&&(c=(l0(t,h)|0)+(c<>31^c>>1,(((c|0)>-1?c:0-c|0)|0)>65535&&(o=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,Q|0)|0,bt(8)),g=0,xe(7,o|0,5,35648),r=g,g=0,r&1?(r=j()|0,Tt(o|0),le(r|0)):Qt(o|0,824,96))),C=t+164+(D*12|0)+4|0,l=e[C>>2]|0,h?h=I[R>>1]|0:(t=I[R>>1]|0,h=t,c=(l<<1)+-1+(t<<16>>16)>>31^c),d=h<<16>>16==64,t=d&1,w=l+c>>t,d=d?32:h<<16>>16,e[N>>2]=((c|0)>-1?c:0-c|0)+(e[N>>2]|0)>>t,l=d+1|0,I[R>>1]=l,h=l+w|0,(h|0)<1?(R=I[k>>1]|0,I[k>>1]=(R&65535)-(R<<16>>16>-128&1),R=(h|0)>(~d|0)?h:0-d|0,e[C>>2]=R,_=c^_,r=r>>>31,r=o+r|0,r=r+_|0,r=r&4095,r=r&65535,r|0):(w|0)<=0?(R=w,e[C>>2]=R,_=c^_,r=r>>>31,r=o+r|0,r=r+_|0,r=r&4095,r=r&65535,r|0):(R=w-l|0,N=I[k>>1]|0,I[k>>1]=(N<<16>>16<127&1)+(N&65535),R=(R|0)>0?0:R,e[C>>2]=R,_=c^_,r=r>>>31,r=o+r|0,r=r+_|0,r=r&4095,r=r&65535,r|0)}function Pu(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0;return h=t+4576|0,c=e[h>>2]|0,o=I[c+(r+-1<<1)>>1]|0,d=t+148|0,c=Lu(t,o,c+(r<<1)|0,(e[d>>2]|0)-r|0)|0,l=c+r|0,(l|0)==(e[d>>2]|0)?(d=c,d|0):(o=o&65535,r=M[(e[t+4572>>2]|0)+(l<<1)>>1]|0,d=o-r|0,(((d|0)>-1?d:0-d|0)|0)<1?o=(Cs(t,t+4556|0)|0)+o|0:o=(ee(Cs(t,t+4544|0)|0,r-o>>31|1)|0)+r|0,I[(e[h>>2]|0)+(l<<1)>>1]=o&4095,d=t+4568|0,t=e[d>>2]|0,e[d>>2]=(t|0)<1?0:t+-1|0,d=c+1|0,d|0)}function Lu(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0;for(w=t+112|0,C=t+108|0,D=t+4568|0,c=e[w>>2]|0,h=0;;){if((c|0)<1&&(P0(t),c=e[w>>2]|0),d=e[C>>2]|0,c=c+-1|0,e[w>>2]=c,e[C>>2]=d<<1,(d|0)>=0){k=8;break}if(d=e[D>>2]|0,N=1<>2],R=l-h|0,R=(N|0)<(R|0)?N:R,h=R+h|0,(R|0)==(N|0)&&(e[D>>2]=(d|0)>30?31:d+1|0),(h|0)==(l|0)){c=l;break}}if((k|0)==8&&((h|0)!=(l|0)?(c=e[D>>2]|0,(c+-4|0)>>>0<28?c=l0(t,e[36476+(c<<2)>>2]|0)|0:c=0,c=c+h|0,(c|0)>(l|0)&&(c=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,Q|0)|0,bt(8)),g=0,xe(7,c|0,5,35648),R=g,g=0,R&1?(R=j()|0,Tt(c|0),le(R|0)):Qt(c|0,824,96))):c=l),(c|0)>0)h=0;else return c|0;do I[o+(h<<1)>>1]=r,h=h+1|0;while((h|0)!=(c|0));return c|0}function Cs(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0;if(w=r+9|0,o=F[w>>0]|0,h=r+4|0,c=(ee(o>>>1,e[h>>2]|0)|0)+(e[r>>2]|0)|0,(o|0)<(c|0)){l=0;do o=o<<1,l=l+1|0;while((o|0)<(c|0))}else l=0;c=e[36476+(e[t+4568>>2]<<2)>>2]|0,o=X0(t)|0;do if((o|0)<(34-c|0))if(l){o=(l0(t,l)|0)+(o<>2]|0,c=o+t|0,C=c&1,l=C,h=1,c=(C+c|0)/2|0;break}else{t=e[h>>2]|0,c=t+o|0,l=c&1,c=(l+c|0)/2|0,d=8;break}else o=(l0(t,12)|0)+1|0,t=e[h>>2]|0,c=o+t|0,h=c&1,c=(h+c|0)/2|0,l?(l=h,h=1):(l=h,d=8);while(!1);return(d|0)==8&&(h=F[r+10>>0]<<1>>>0>=(F[w>>0]|0)>>>0),c=(l|0)!=0^h?c:0-c|0,(c|0)<0&&(C=r+10|0,S[C>>0]=(F[C>>0]|0)+1),o=(o+1-t>>1)+(e[r>>2]|0)|0,e[r>>2]=o,l=S[w>>0]|0,l<<24>>24!=(S[r+8>>0]|0)?(C=l,C=C&255,C=C+1|0,C=C&255,S[w>>0]=C,c|0):(e[r>>2]=o>>1,C=(l&255)>>>1,S[w>>0]=C,r=r+10|0,S[r>>0]=(F[r>>0]|0)>>>1,C=C&255,C=C+1|0,C=C&255,S[w>>0]=C,c|0)}function Ou(t){t=t|0;var r=0,o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0;if(D=b,b=b+32|0,w=D,m0(w,4095,0),C=t+152|0,(e[w+4>>2]|0)==(e[C>>2]|0)&&(e[w+8>>2]|0)==(e[t+156>>2]|0)&&(e[w+12>>2]|0)==(e[t+160>>2]|0)){C=e[8906]|0,e[t+4580>>2]=C+(((e[8907]|0)-C|0)>>>1),b=D;return}for(o=t+4584|0,l=t+4588|0,c=e[l>>2]|0,r=e[o>>2]|0,h=c-r|0,h>>>0>=8192?h>>>0>8192&&(d=r+8192|0,(c|0)!=(d|0))&&(e[l>>2]=d):(j0(o,8192-h|0),r=e[o>>2]|0),w=t+4580|0,e[w>>2]=r+4096,d=t+160|0,c=t+156|0,h=-4096;;){if(r=e[d>>2]|0,(h|0)>(0-r|0))if(o=e[c>>2]|0,(h|0)>(0-o|0))if(l=e[C>>2]|0,(h|0)>(0-l|0))if((h|0)>=0){if((h|0)<1){S[(e[w>>2]|0)+h>>0]=0,h=1;continue}(l|0)<=(h|0)?(o|0)>(h|0)?r=2:r=(r|0)>(h|0)?3:4:r=1}else r=-1;else r=-2;else r=-3;else r=-4;if(S[(e[w>>2]|0)+h>>0]=r,h=h+1|0,(h|0)==4096)break}b=D}function $u(t){t=t|0;var r=0,o=0;e[t>>2]=35716,r=e[t+4584>>2]|0,r&&(o=t+4588|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),e[t>>2]=36736,r=e[t+92>>2]|0,r&&(o=t+96|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),t=t+88|0,r=e[t>>2]|0,e[t>>2]=0,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r)}function Bu(t){t=t|0;var r=0,o=0;if(e[t>>2]=35716,r=e[t+4584>>2]|0,r&&(o=t+4588|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),e[t>>2]=36736,r=e[t+92>>2]|0,r&&(o=t+96|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),o=t+88|0,r=e[o>>2]|0,e[o>>2]=0,!r){he(t);return}Mt[e[(e[r>>2]|0)+4>>2]&255](r),he(t)}function Vu(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0,G=0,$=0,P=0,O=0;if(G=b,b=b+352|0,$=G+328|0,P=G+192|0,o=G+343|0,l=G+342|0,c=G+341|0,h=G+340|0,R=G+176|0,w=G+168|0,C=G+160|0,D=G+152|0,K=G,U=G+136|0,e[t+28>>2]|0&&(e[t+20>>2]|0)!=1){if(_=t+4|0,H=t+32|0,d=e[H>>2]|0,!d){if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[o>>0]|0,$e(44,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}if(t=e[t+12>>2]|0,(t|0)==8)switch(d|0){case 1:{if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[l>>0]|0,$e(45,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 2:{if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[c>>0]|0,$e(46,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 3:{if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[h>>0]|0,$e(47,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}default:{d=P+56|0,c=P+4|0,e[P>>2]=36160,e[d>>2]=36180,g=0,Ae(62,P+56|0,c|0),G=g,g=0,G&1&&(O=j()|0,tt(d),le(O|0)),e[P+128>>2]=0,e[P+132>>2]=-1,e[P>>2]=36200,e[P+56>>2]=36220,g=0,ue(180,c|0),G=g,g=0;do if(G&1)t=j()|0;else{if(e[c>>2]=36236,h=P+36|0,e[h>>2]=0,e[h+4>>2]=0,e[h+8>>2]=0,e[h+12>>2]=0,e[P+52>>2]=16,e[$>>2]=0,e[$+4>>2]=0,e[$+8>>2]=0,g=0,Ae(63,c|0,$|0),G=g,g=0,G&1){t=j()|0,de($),de(h),wt(c);break}de($),g=0,t=Ve(28,P|0,49007,21)|0,$=g,g=0;do if(!($&1)&&(g=0,k=be(36,t|0,e[H>>2]|0)|0,$=g,g=0,!($&1))&&(g=0,Ve(28,k|0,50997,18)|0,$=g,g=0,!($&1))){if(l=Ct(16)|0,g=0,Ae(64,R|0,c|0),$=g,g=0,$&1)t=j()|0;else if(!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,Q|0)|0,bt(8)),g=0,$e(36,l|0,9,35648,R|0),$=g,g=0,$&1?o=1:(g=0,xe(6,l|0,824,96),g=0,o=0),t=j()|0,de(R),!o)break;Tt(l|0)}else O=34;while(!1);(O|0)==34&&(t=j()|0),e[P>>2]=36200,e[d>>2]=36220,e[c>>2]=36236,de(h),wt(c),tt(d),O=t,le(O|0)}while(!1);O=t,tt(d),le(O|0)}}switch((t|0)<=8&&(t=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,Q|0)|0,bt(8)),g=0,xe(7,t|0,8,35648),O=g,g=0,O&1||Qt(t|0,824,96),O=j()|0,Tt(t|0),le(O|0)),o=16-t|0,d|0){case 1:{if(t=Xe(60)|0,e[w>>2]=o,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],e[$>>2]=e[w>>2],e[$+4>>2]=e[w+4>>2],$e(41,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 2:{if(t=Xe(60)|0,e[C>>2]=o,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],e[$>>2]=e[C>>2],e[$+4>>2]=e[C+4>>2],$e(42,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 3:{if(t=Xe(60)|0,e[D>>2]=o,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],e[$>>2]=e[D>>2],e[$+4>>2]=e[D+4>>2],$e(43,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}default:{d=K+56|0,c=K+4|0,e[K>>2]=36160,e[d>>2]=36180,g=0,Ae(62,K+56|0,c|0),P=g,g=0,P&1&&(O=j()|0,tt(d),le(O|0)),e[K+128>>2]=0,e[K+132>>2]=-1,e[K>>2]=36200,e[K+56>>2]=36220,g=0,ue(180,c|0),P=g,g=0;do if(P&1)t=j()|0;else{if(e[c>>2]=36236,h=K+36|0,e[h>>2]=0,e[h+4>>2]=0,e[h+8>>2]=0,e[h+12>>2]=0,e[K+52>>2]=16,e[$>>2]=0,e[$+4>>2]=0,e[$+8>>2]=0,g=0,Ae(63,c|0,$|0),P=g,g=0,P&1){t=j()|0,de($),de(h),wt(c);break}de($),g=0,t=Ve(28,K|0,49007,21)|0,P=g,g=0;do if(!(P&1)&&(g=0,N=be(36,t|0,e[H>>2]|0)|0,P=g,g=0,!(P&1))&&(g=0,Ve(28,N|0,50997,18)|0,P=g,g=0,!(P&1))){if(l=Ct(16)|0,g=0,Ae(64,U|0,c|0),P=g,g=0,P&1)t=j()|0;else if(!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,Q|0)|0,bt(8)),g=0,$e(36,l|0,9,35648,U|0),P=g,g=0,P&1?o=1:(g=0,xe(6,l|0,824,96),g=0,o=0),t=j()|0,de(U),!o)break;Tt(l|0)}else O=64;while(!1);(O|0)==64&&(t=j()|0),e[K>>2]=36200,e[d>>2]=36220,e[c>>2]=36236,de(h),wt(c),tt(d),O=t,le(O|0)}while(!1);O=t,tt(d),le(O|0)}}}return o=e[r+4>>2]|0,l=Xe(16)|0,t=e[t+16>>2]|0,o?(e[l>>2]=36108,e[l+4>>2]=o,e[l+8>>2]=1,e[l+12>>2]=t,O=l,b=G,O|0):(O=e[r>>2]|0,e[l>>2]=36132,e[l+4>>2]=O,e[l+8>>2]=1,e[l+12>>2]=t,O=l,b=G,O|0)}function Uu(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0;c=b,b=b+32|0,w=c,m0(w,255,0),d=e[r+4>>2]|0,h=e[r+8>>2]|0,h=h|0?h:e[w+8>>2]|0,l=e[r+12>>2]|0,l=l|0?l:e[w+12>>2]|0,r=e[r+16>>2]|0,o=e[w+16>>2]|0,e[t+152>>2]=d|0?d:e[w+4>>2]|0,e[t+156>>2]=h,e[t+160>>2]=l,Ku(t),l=0;do e[t+164+(l*12|0)>>2]=4,e[t+164+(l*12|0)+4>>2]=0,I[t+164+(l*12|0)+8>>1]=0,I[t+164+(l*12|0)+10>>1]=1,l=l+1|0;while((l|0)!=365);w=(r|0?r:o)&255,e[t+4544>>2]=4,e[t+4548>>2]=0,S[t+4552>>0]=w,S[t+4553>>0]=1,S[t+4554>>0]=0,e[t+4556>>2]=4,e[t+4560>>2]=1,S[t+4564>>0]=w,S[t+4565>>0]=1,S[t+4566>>0]=0,e[t+4568>>2]=0,b=c}function zu(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0;for(d=t+88|0,h=e[r>>2]|0,e[r>>2]=0,r=e[d>>2]|0,e[d>>2]=h,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r),d=l+4|0,h=e[d>>2]|0,S[t+4596>>0]=c&1,r=t+132|0,e[r>>2]=e[o>>2],e[r+4>>2]=e[o+4>>2],e[r+8>>2]=e[o+8>>2],e[r+12>>2]=e[o+12>>2],Y0(t,l),Gu(t),r=e[t+116>>2]|0,t=e[t+112>>2]|0;c=r+-1|0,o=(S[c>>0]|0)==-1?7:8,!((t|0)<(o|0));)r=c,t=t-o|0;r=r-h|0,c=e[d>>2]|0,c&&(e[d>>2]=c+r,l=l+8|0,e[l>>2]=(e[l>>2]|0)-r)}function Gu(t){t=t|0;var r=0,o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0,ce=0;ie=b,b=b+32|0,ne=ie+12|0,Z=ie,$=t+148|0,P=(e[$>>2]|0)+4|0,(e[t+28>>2]|0)==1?O=e[t+20>>2]|0:O=1,r=ee(O<<1,P)|0,e[ne>>2]=0,ce=ne+4|0,e[ce>>2]=0,e[ne+8>>2]=0;e:do if(r){if((r|0)<0&&(g=0,ue(178,ne|0),oe=g,g=0,oe&1)||(h=6),(h|0)==6&&(g=0,o=ge(67,r|0)|0,oe=g,g=0,!(oe&1))){for(e[ce>>2]=o,e[ne>>2]=o,e[ne+8>>2]=o+r;;)if(S[o>>0]=0,o=(e[ce>>2]|0)+1|0,e[ce>>2]=o,r=r+-1|0,!r)break e}o=j()|0,r=e[ne>>2]|0,r||le(o|0),(e[ce>>2]|0)!=(r|0)&&(e[ce>>2]=r),he(r),le(o|0)}while(!1);e[Z>>2]=0,oe=Z+4|0,e[oe>>2]=0,e[Z+8>>2]=0;do if(!O)h=19;else{if(O>>>0>1073741823&&(g=0,ue(178,Z|0),G=g,g=0,G&1)||(h=17),(h|0)==17&&(l=O<<2,g=0,c=ge(67,l|0)|0,G=g,g=0,!(G&1))){e[Z>>2]=c,h=c+(O<<2)|0,e[Z+8>>2]=h,Jt(c|0,0,l|0)|0,e[oe>>2]=h,h=19;break}o=j()|0,r=e[Z>>2]|0,l=r,r&&(c=e[oe>>2]|0,(c|0)!=(r|0)&&(e[oe>>2]=c+(~((c+-4-l|0)>>>2)<<2)),he(r))}while(!1);if((h|0)==19){h=t+8|0;e:do if((e[h>>2]|0)>0){d=t+4572|0,w=ee(O,P)|0,C=w+1|0,D=t+4576|0,k=(O|0)>0,N=t+136|0,R=t+144|0,_=t+140|0,U=t+132|0,H=t+88|0,K=t+4568|0,G=0;t:for(;;){if(l=e[ne>>2]|0,o=l+1|0,e[d>>2]=o,l=l+C|0,e[D>>2]=l,G&1?(e[d>>2]=l,e[D>>2]=o,r=o,o=l):r=l,k){c=e[Z>>2]|0,l=0;do{if(e[K>>2]=e[c+(l<<2)>>2],c=e[$>>2]|0,S[o+c>>0]=S[o+(c+-1)>>0]|0,S[(e[D>>2]|0)+-1>>0]=S[e[d>>2]>>0]|0,g=0,Ae(81,t|0,0),c=g,g=0,c&1){h=30;break t}c=e[Z>>2]|0,e[c+(l<<2)>>2]=e[K>>2],o=(e[d>>2]|0)+P|0,e[d>>2]=o,r=(e[D>>2]|0)+P|0,e[D>>2]=r,l=l+1|0}while((l|0)<(O|0))}if(c=e[N>>2]|0,(c|0)<=(G|0)&&(G|0)<((e[R>>2]|0)+c|0)&&(c=e[H>>2]|0,g=0,$e(e[(e[c>>2]|0)+8>>2]|0,c|0,r+((e[U>>2]|0)-w)|0,e[_>>2]|0,P|0),c=g,g=0,c&1)){h=31;break}if(G=G+1|0,(G|0)>=(e[h>>2]|0)){h=43;break e}}if((h|0)==30){o=j()|0;break}else if((h|0)==31){o=j()|0;break}}else h=43;while(!1);do if((h|0)==43){if(g=0,ue(183,t|0),t=g,g=0,t&1){o=j()|0;break}if(r=e[Z>>2]|0,o=r,r&&(l=e[oe>>2]|0,(l|0)!=(r|0)&&(e[oe>>2]=l+(~((l+-4-o|0)>>>2)<<2)),he(r)),r=e[ne>>2]|0,!r){b=ie;return}(e[ce>>2]|0)!=(r|0)&&(e[ce>>2]=r),he(r),b=ie;return}while(!1);r=e[Z>>2]|0,l=r,r&&(c=e[oe>>2]|0,(c|0)!=(r|0)&&(e[oe>>2]=c+(~((c+-4-l|0)>>>2)<<2)),he(r))}r=e[ne>>2]|0,r||le(o|0),(e[ce>>2]|0)!=(r|0)&&(e[ce>>2]=r),he(r),le(o|0)}function qu(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0;if(N=t+4572|0,r=e[N>>2]|0,U=t+148|0,!((e[U>>2]|0)<=0))for(R=t+4576|0,_=t+4580|0,c=r,h=F[r+-1>>0]|0,r=F[r>>0]|0,k=0;D=e[R>>2]|0,C=F[D+(k+-1)>>0]|0,l=k+1|0,o=F[c+l>>0]|0,w=e[_>>2]|0,d=r-h|0,c=h-C|0,w=((((S[w+(o-r)>>0]|0)*9|0)+(S[w+d>>0]|0)|0)*9|0)+(S[w+c>>0]|0)|0,w?(h=r-C>>31,(h^c|0)<0?c=r:c=C+((h^d|0)<0?0:d)|0,D=Wu(t,w,F[D+k>>0]|0,c,0)|0,S[(e[R>>2]|0)+k>>0]=D):(l=(Hu(t,k,0)|0)+k|0,o=e[N>>2]|0,r=F[o+(l+-1)>>0]|0,o=F[o+l>>0]|0),!((l|0)>=(e[U>>2]|0));)c=e[N>>2]|0,h=r,r=o,k=l}function Wu(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0;if(_=r>>31,D=(_^r)-_|0,R=t+164+(D*12|0)+10|0,o=I[R>>1]|0,N=t+164+(D*12|0)|0,c=e[N>>2]|0,(o|0)<(c|0))if((o<<1|0)<(c|0))if((o<<2|0)<(c|0))if((o<<3|0)<(c|0))if((o<<4|0)<(c|0))for(h=5;(o<>1]^_)-_+l|0,(o&255|0)!=(o|0)&&(o=o>>31&255^255),c=t+112|0,(e[c>>2]|0)<8&&P0(t),l=t+108|0,d=e[l>>2]|0,w=d>>>24,C=e[2832+(h<<11)+(w<<3)+4>>2]|0,C?(e[c>>2]=(e[c>>2]|0)-C,e[l>>2]=d<>2]|0):(c=X0(t)|0,(c|0)<23?h&&(c=(l0(t,h)|0)+(c<>31^c>>1,(((c|0)>-1?c:0-c|0)|0)>65535&&(o=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,Q|0)|0,bt(8)),g=0,xe(7,o|0,5,35648),r=g,g=0,r&1?(r=j()|0,Tt(o|0),le(r|0)):Qt(o|0,824,96))),C=t+164+(D*12|0)+4|0,l=e[C>>2]|0,h?h=I[R>>1]|0:(t=I[R>>1]|0,h=t,c=(l<<1)+-1+(t<<16>>16)>>31^c),d=h<<16>>16==64,t=d&1,w=l+c>>t,d=d?32:h<<16>>16,e[N>>2]=((c|0)>-1?c:0-c|0)+(e[N>>2]|0)>>t,l=d+1|0,I[R>>1]=l,h=l+w|0,(h|0)<1?(R=I[k>>1]|0,I[k>>1]=(R&65535)-(R<<16>>16>-128&1),R=(h|0)>(~d|0)?h:0-d|0,e[C>>2]=R,_=c^_,r=r>>>31,r=o+r|0,r=r+_|0,r=r&255,r|0):(w|0)<=0?(R=w,e[C>>2]=R,_=c^_,r=r>>>31,r=o+r|0,r=r+_|0,r=r&255,r|0):(R=w-l|0,N=I[k>>1]|0,I[k>>1]=(N<<16>>16<127&1)+(N&65535),R=(R|0)>0?0:R,e[C>>2]=R,_=c^_,r=r>>>31,r=o+r|0,r=r+_|0,r=r&255,r|0)}function Hu(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0;return h=t+4576|0,c=e[h>>2]|0,o=S[c+(r+-1)>>0]|0,d=t+148|0,c=Qu(t,o,c+r|0,(e[d>>2]|0)-r|0)|0,l=c+r|0,(l|0)==(e[d>>2]|0)?(d=c,d|0):(o=o&255,r=F[(e[t+4572>>2]|0)+l>>0]|0,d=o-r|0,(((d|0)>-1?d:0-d|0)|0)<1?o=(Ts(t,t+4556|0)|0)+o|0:o=(ee(Ts(t,t+4544|0)|0,r-o>>31|1)|0)+r|0,S[(e[h>>2]|0)+l>>0]=o,d=t+4568|0,t=e[d>>2]|0,e[d>>2]=(t|0)<1?0:t+-1|0,d=c+1|0,d|0)}function Qu(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0;for(w=t+112|0,C=t+108|0,D=t+4568|0,c=e[w>>2]|0,h=0;;){if((c|0)<1&&(P0(t),c=e[w>>2]|0),d=e[C>>2]|0,c=c+-1|0,e[w>>2]=c,e[C>>2]=d<<1,(d|0)>=0){k=8;break}if(d=e[D>>2]|0,N=1<>2],R=l-h|0,R=(N|0)<(R|0)?N:R,h=R+h|0,(R|0)==(N|0)&&(e[D>>2]=(d|0)>30?31:d+1|0),(h|0)==(l|0)){c=l;break}}return(k|0)==8&&((h|0)!=(l|0)?(c=e[D>>2]|0,(c+-4|0)>>>0<28?c=l0(t,e[36476+(c<<2)>>2]|0)|0:c=0,c=c+h|0,(c|0)>(l|0)&&(c=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,Q|0)|0,bt(8)),g=0,xe(7,c|0,5,35648),R=g,g=0,R&1?(R=j()|0,Tt(c|0),le(R|0)):Qt(c|0,824,96))):c=l),(c|0)<=0||Jt(o|0,r|0,c|0)|0,c|0}function Ts(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0;if(w=r+9|0,o=F[w>>0]|0,h=r+4|0,c=(ee(o>>>1,e[h>>2]|0)|0)+(e[r>>2]|0)|0,(o|0)<(c|0)){l=0;do o=o<<1,l=l+1|0;while((o|0)<(c|0))}else l=0;c=e[36476+(e[t+4568>>2]<<2)>>2]|0,o=X0(t)|0;do if((o|0)<(22-c|0))if(l){o=(l0(t,l)|0)+(o<>2]|0,c=o+t|0,C=c&1,l=C,h=1,c=(C+c|0)/2|0;break}else{t=e[h>>2]|0,c=t+o|0,l=c&1,c=(l+c|0)/2|0,d=8;break}else o=(l0(t,8)|0)+1|0,t=e[h>>2]|0,c=o+t|0,h=c&1,c=(h+c|0)/2|0,l?(l=h,h=1):(l=h,d=8);while(!1);return(d|0)==8&&(h=F[r+10>>0]<<1>>>0>=(F[w>>0]|0)>>>0),c=(l|0)!=0^h?c:0-c|0,(c|0)<0&&(C=r+10|0,S[C>>0]=(F[C>>0]|0)+1),o=(o+1-t>>1)+(e[r>>2]|0)|0,e[r>>2]=o,l=S[w>>0]|0,l<<24>>24!=(S[r+8>>0]|0)?(C=l,C=C&255,C=C+1|0,C=C&255,S[w>>0]=C,c|0):(e[r>>2]=o>>1,C=(l&255)>>>1,S[w>>0]=C,r=r+10|0,S[r>>0]=(F[r>>0]|0)>>>1,C=C&255,C=C+1|0,C=C&255,S[w>>0]=C,c|0)}function Ku(t){t=t|0;var r=0,o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0;if(D=b,b=b+32|0,w=D,m0(w,255,0),C=t+152|0,(e[w+4>>2]|0)==(e[C>>2]|0)&&(e[w+8>>2]|0)==(e[t+156>>2]|0)&&(e[w+12>>2]|0)==(e[t+160>>2]|0)){C=e[8900]|0,e[t+4580>>2]=C+(((e[8901]|0)-C|0)>>>1),b=D;return}for(o=t+4584|0,l=t+4588|0,c=e[l>>2]|0,r=e[o>>2]|0,h=c-r|0,h>>>0>=512?h>>>0>512&&(d=r+512|0,(c|0)!=(d|0))&&(e[l>>2]=d):(j0(o,512-h|0),r=e[o>>2]|0),w=t+4580|0,e[w>>2]=r+256,d=t+160|0,c=t+156|0,h=-256;;){if(r=e[d>>2]|0,(h|0)>(0-r|0))if(o=e[c>>2]|0,(h|0)>(0-o|0))if(l=e[C>>2]|0,(h|0)>(0-l|0))if((h|0)>=0){if((h|0)<1){S[(e[w>>2]|0)+h>>0]=0,h=1;continue}(l|0)<=(h|0)?(o|0)>(h|0)?r=2:r=(r|0)>(h|0)?3:4:r=1}else r=-1;else r=-2;else r=-3;else r=-4;if(S[(e[w>>2]|0)+h>>0]=r,h=h+1|0,(h|0)==256)break}b=D}function Yu(t){t=t|0;var r=0,o=0;e[t>>2]=35688,r=e[t+4584>>2]|0,r&&(o=t+4588|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),e[t>>2]=36736,r=e[t+92>>2]|0,r&&(o=t+96|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),t=t+88|0,r=e[t>>2]|0,e[t>>2]=0,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r)}function ju(t){t=t|0;var r=0,o=0;if(e[t>>2]=35688,r=e[t+4584>>2]|0,r&&(o=t+4588|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),e[t>>2]=36736,r=e[t+92>>2]|0,r&&(o=t+96|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),o=t+88|0,r=e[o>>2]|0,e[o>>2]=0,!r){he(t);return}Mt[e[(e[r>>2]|0)+4>>2]&255](r),he(t)}function Xu(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0,G=0,$=0,P=0,O=0;if(G=b,b=b+352|0,$=G+328|0,P=G+192|0,o=G+343|0,l=G+342|0,c=G+341|0,h=G+340|0,R=G+176|0,w=G+168|0,C=G+160|0,D=G+152|0,K=G,U=G+136|0,e[t+28>>2]|0&&(e[t+20>>2]|0)!=1){if(_=t+4|0,H=t+32|0,d=e[H>>2]|0,!d){if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[o>>0]|0,$e(44,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}if(t=e[t+12>>2]|0,(t|0)==8)switch(d|0){case 1:{if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[l>>0]|0,$e(45,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 2:{if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[c>>0]|0,$e(46,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 3:{if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[h>>0]|0,$e(47,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}default:{d=P+56|0,c=P+4|0,e[P>>2]=36160,e[d>>2]=36180,g=0,Ae(62,P+56|0,c|0),G=g,g=0,G&1&&(O=j()|0,tt(d),le(O|0)),e[P+128>>2]=0,e[P+132>>2]=-1,e[P>>2]=36200,e[P+56>>2]=36220,g=0,ue(180,c|0),G=g,g=0;do if(G&1)t=j()|0;else{if(e[c>>2]=36236,h=P+36|0,e[h>>2]=0,e[h+4>>2]=0,e[h+8>>2]=0,e[h+12>>2]=0,e[P+52>>2]=16,e[$>>2]=0,e[$+4>>2]=0,e[$+8>>2]=0,g=0,Ae(63,c|0,$|0),G=g,g=0,G&1){t=j()|0,de($),de(h),wt(c);break}de($),g=0,t=Ve(28,P|0,49007,21)|0,$=g,g=0;do if(!($&1)&&(g=0,k=be(36,t|0,e[H>>2]|0)|0,$=g,g=0,!($&1))&&(g=0,Ve(28,k|0,50997,18)|0,$=g,g=0,!($&1))){if(l=Ct(16)|0,g=0,Ae(64,R|0,c|0),$=g,g=0,$&1)t=j()|0;else if(!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,Q|0)|0,bt(8)),g=0,$e(36,l|0,9,35648,R|0),$=g,g=0,$&1?o=1:(g=0,xe(6,l|0,824,96),g=0,o=0),t=j()|0,de(R),!o)break;Tt(l|0)}else O=34;while(!1);(O|0)==34&&(t=j()|0),e[P>>2]=36200,e[d>>2]=36220,e[c>>2]=36236,de(h),wt(c),tt(d),O=t,le(O|0)}while(!1);O=t,tt(d),le(O|0)}}switch((t|0)<=8&&(t=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,Q|0)|0,bt(8)),g=0,xe(7,t|0,8,35648),O=g,g=0,O&1||Qt(t|0,824,96),O=j()|0,Tt(t|0),le(O|0)),o=16-t|0,d|0){case 1:{if(t=Xe(60)|0,e[w>>2]=o,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],e[$>>2]=e[w>>2],e[$+4>>2]=e[w+4>>2],$e(41,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 2:{if(t=Xe(60)|0,e[C>>2]=o,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],e[$>>2]=e[C>>2],e[$+4>>2]=e[C+4>>2],$e(42,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 3:{if(t=Xe(60)|0,e[D>>2]=o,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],e[$>>2]=e[D>>2],e[$+4>>2]=e[D+4>>2],$e(43,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}default:{d=K+56|0,c=K+4|0,e[K>>2]=36160,e[d>>2]=36180,g=0,Ae(62,K+56|0,c|0),P=g,g=0,P&1&&(O=j()|0,tt(d),le(O|0)),e[K+128>>2]=0,e[K+132>>2]=-1,e[K>>2]=36200,e[K+56>>2]=36220,g=0,ue(180,c|0),P=g,g=0;do if(P&1)t=j()|0;else{if(e[c>>2]=36236,h=K+36|0,e[h>>2]=0,e[h+4>>2]=0,e[h+8>>2]=0,e[h+12>>2]=0,e[K+52>>2]=16,e[$>>2]=0,e[$+4>>2]=0,e[$+8>>2]=0,g=0,Ae(63,c|0,$|0),P=g,g=0,P&1){t=j()|0,de($),de(h),wt(c);break}de($),g=0,t=Ve(28,K|0,49007,21)|0,P=g,g=0;do if(!(P&1)&&(g=0,N=be(36,t|0,e[H>>2]|0)|0,P=g,g=0,!(P&1))&&(g=0,Ve(28,N|0,50997,18)|0,P=g,g=0,!(P&1))){if(l=Ct(16)|0,g=0,Ae(64,U|0,c|0),P=g,g=0,P&1)t=j()|0;else if(!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,Q|0)|0,bt(8)),g=0,$e(36,l|0,9,35648,U|0),P=g,g=0,P&1?o=1:(g=0,xe(6,l|0,824,96),g=0,o=0),t=j()|0,de(U),!o)break;Tt(l|0)}else O=64;while(!1);(O|0)==64&&(t=j()|0),e[K>>2]=36200,e[d>>2]=36220,e[c>>2]=36236,de(h),wt(c),tt(d),O=t,le(O|0)}while(!1);O=t,tt(d),le(O|0)}}}return o=e[r+4>>2]|0,l=Xe(16)|0,t=e[t+16>>2]|0,o?(e[l>>2]=36108,e[l+4>>2]=o,e[l+8>>2]=3,e[l+12>>2]=t,O=l,b=G,O|0):(O=e[r>>2]|0,e[l>>2]=36132,e[l+4>>2]=O,e[l+8>>2]=3,e[l+12>>2]=t,O=l,b=G,O|0)}function Zu(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0;c=b,b=b+32|0,w=c,m0(w,255,0),d=e[r+4>>2]|0,h=e[r+8>>2]|0,h=h|0?h:e[w+8>>2]|0,l=e[r+12>>2]|0,l=l|0?l:e[w+12>>2]|0,r=e[r+16>>2]|0,o=e[w+16>>2]|0,e[t+152>>2]=d|0?d:e[w+4>>2]|0,e[t+156>>2]=h,e[t+160>>2]=l,q5(t),l=0;do e[t+164+(l*12|0)>>2]=4,e[t+164+(l*12|0)+4>>2]=0,I[t+164+(l*12|0)+8>>1]=0,I[t+164+(l*12|0)+10>>1]=1,l=l+1|0;while((l|0)!=365);w=(r|0?r:o)&255,e[t+4544>>2]=4,e[t+4548>>2]=0,S[t+4552>>0]=w,S[t+4553>>0]=1,S[t+4554>>0]=0,e[t+4556>>2]=4,e[t+4560>>2]=1,S[t+4564>>0]=w,S[t+4565>>0]=1,S[t+4566>>0]=0,e[t+4568>>2]=0,b=c}function Ju(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0;for(d=t+88|0,h=e[r>>2]|0,e[r>>2]=0,r=e[d>>2]|0,e[d>>2]=h,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r),d=l+4|0,h=e[d>>2]|0,S[t+4596>>0]=c&1,r=t+132|0,e[r>>2]=e[o>>2],e[r+4>>2]=e[o+4>>2],e[r+8>>2]=e[o+8>>2],e[r+12>>2]=e[o+12>>2],Y0(t,l),tc(t),r=e[t+116>>2]|0,t=e[t+112>>2]|0;c=r+-1|0,o=(S[c>>0]|0)==-1?7:8,!((t|0)<(o|0));)r=c,t=t-o|0;r=r-h|0,c=e[d>>2]|0,c&&(e[d>>2]=c+r,l=l+8|0,e[l>>2]=(e[l>>2]|0)-r)}function tc(t){t=t|0;var r=0,o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0,ce=0;ie=b,b=b+32|0,ne=ie+12|0,Z=ie,$=t+148|0,P=(e[$>>2]|0)+4|0,(e[t+28>>2]|0)==1?O=e[t+20>>2]|0:O=1,r=ee(O<<1,P)|0,e[ne>>2]=0,ce=ne+4|0,e[ce>>2]=0,e[ne+8>>2]=0;e:do if(r){if(r>>>0>1431655765&&(g=0,ue(178,ne|0),oe=g,g=0,oe&1)||(h=6),(h|0)==6&&(g=0,o=ge(67,r*3|0)|0,oe=g,g=0,!(oe&1))){for(e[ce>>2]=o,e[ne>>2]=o,e[ne+8>>2]=o+(r*3|0);;)if(S[o>>0]=0,S[o+1>>0]=0,S[o+2>>0]=0,o=(e[ce>>2]|0)+3|0,e[ce>>2]=o,r=r+-1|0,!r)break e}l=j()|0,r=e[ne>>2]|0,r||le(l|0),o=e[ce>>2]|0,(o|0)!=(r|0)&&(e[ce>>2]=o+(~(((o+-3-r|0)>>>0)/3|0)*3|0)),he(r),le(l|0)}while(!1);e[Z>>2]=0,oe=Z+4|0,e[oe>>2]=0,e[Z+8>>2]=0;do if(!O)h=19;else{if(O>>>0>1073741823&&(g=0,ue(178,Z|0),G=g,g=0,G&1)||(h=17),(h|0)==17&&(l=O<<2,g=0,c=ge(67,l|0)|0,G=g,g=0,!(G&1))){e[Z>>2]=c,h=c+(O<<2)|0,e[Z+8>>2]=h,Jt(c|0,0,l|0)|0,e[oe>>2]=h,h=19;break}l=j()|0,r=e[Z>>2]|0,o=r,r&&(c=e[oe>>2]|0,(c|0)!=(r|0)&&(e[oe>>2]=c+(~((c+-4-o|0)>>>2)<<2)),he(r))}while(!1);if((h|0)==19){h=t+8|0;e:do if((e[h>>2]|0)>0){d=t+4572|0,w=ee(O,P)|0,C=w+1|0,D=t+4576|0,k=(O|0)>0,N=t+136|0,R=t+144|0,_=t+140|0,U=t+132|0,H=t+88|0,K=t+4568|0,G=0;t:for(;;){if(l=e[ne>>2]|0,o=l+3|0,e[d>>2]=o,l=l+(C*3|0)|0,e[D>>2]=l,G&1?(e[d>>2]=l,e[D>>2]=o,r=o,o=l):r=l,k){c=e[Z>>2]|0,l=0;do{if(e[K>>2]=e[c+(l<<2)>>2],r=e[$>>2]|0,c=o+(r*3|0)|0,o=o+((r+-1|0)*3|0)|0,S[c>>0]=S[o>>0]|0,S[c+1>>0]=S[o+1>>0]|0,S[c+2>>0]=S[o+2>>0]|0,o=e[d>>2]|0,c=(e[D>>2]|0)+-3|0,S[c>>0]=S[o>>0]|0,S[c+1>>0]=S[o+1>>0]|0,S[c+2>>0]=S[o+2>>0]|0,g=0,Ae(82,t|0,0),c=g,g=0,c&1){h=30;break t}c=e[Z>>2]|0,e[c+(l<<2)>>2]=e[K>>2],o=(e[d>>2]|0)+(P*3|0)|0,e[d>>2]=o,r=(e[D>>2]|0)+(P*3|0)|0,e[D>>2]=r,l=l+1|0}while((l|0)<(O|0))}if(c=e[N>>2]|0,(c|0)<=(G|0)&&(G|0)<((e[R>>2]|0)+c|0)&&(c=e[H>>2]|0,g=0,$e(e[(e[c>>2]|0)+8>>2]|0,c|0,r+(((e[U>>2]|0)-w|0)*3|0)|0,e[_>>2]|0,P|0),c=g,g=0,c&1)){h=31;break}if(G=G+1|0,(G|0)>=(e[h>>2]|0)){h=43;break e}}if((h|0)==30){l=j()|0;break}else if((h|0)==31){l=j()|0;break}}else h=43;while(!1);do if((h|0)==43){if(g=0,ue(183,t|0),t=g,g=0,t&1){l=j()|0;break}if(r=e[Z>>2]|0,o=r,r&&(l=e[oe>>2]|0,(l|0)!=(r|0)&&(e[oe>>2]=l+(~((l+-4-o|0)>>>2)<<2)),he(r)),r=e[ne>>2]|0,!r){b=ie;return}o=e[ce>>2]|0,(o|0)!=(r|0)&&(e[ce>>2]=o+(~(((o+-3-r|0)>>>0)/3|0)*3|0)),he(r),b=ie;return}while(!1);r=e[Z>>2]|0,o=r,r&&(c=e[oe>>2]|0,(c|0)!=(r|0)&&(e[oe>>2]=c+(~((c+-4-o|0)>>>2)<<2)),he(r))}r=e[ne>>2]|0,r||le(l|0),o=e[ce>>2]|0,(o|0)!=(r|0)&&(e[ce>>2]=o+(~(((o+-3-r|0)>>>0)/3|0)*3|0)),he(r),le(l|0)}function ic(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0,ce=0,ke=0;if(oe=t+148|0,!((e[oe>>2]|0)<=0))for(ne=t+4576|0,ce=t+4572|0,ke=t+4580|0,ie=0;P=ie+-1|0,h=e[ne>>2]|0,d=e[ce>>2]|0,r=ie+1|0,c=F[d+(ie*3|0)>>0]|0,Z=e[ke>>2]|0,w=F[d+(P*3|0)>>0]|0,C=c-w|0,D=F[h+(P*3|0)>>0]|0,k=w-D|0,N=((((S[Z+((F[d+(r*3|0)>>0]|0)-c)>>0]|0)*9|0)+(S[Z+C>>0]|0)|0)*9|0)+(S[Z+k>>0]|0)|0,l=F[d+(ie*3|0)+1>>0]|0,R=F[d+(P*3|0)+1>>0]|0,_=l-R|0,U=F[h+(P*3|0)+1>>0]|0,H=R-U|0,K=((((S[Z+((F[d+(r*3|0)+1>>0]|0)-l)>>0]|0)*9|0)+(S[Z+_>>0]|0)|0)*9|0)+(S[Z+H>>0]|0)|0,o=F[d+(ie*3|0)+2>>0]|0,G=F[d+(P*3|0)+2>>0]|0,$=o-G|0,P=F[h+(P*3|0)+2>>0]|0,O=G-P|0,Z=((((S[Z+((F[d+(r*3|0)+2>>0]|0)-o)>>0]|0)*9|0)+(S[Z+$>>0]|0)|0)*9|0)+(S[Z+O>>0]|0)|0,K|N|Z?(d=F[h+(ie*3|0)>>0]|0,h=c-D>>31,(h^k|0)>=0&&((h^C|0)<0?c=D:c=D-w+c|0),d=ar(t,N,d,c,0)|0,h=F[(e[ne>>2]|0)+(ie*3|0)+1>>0]|0,c=l-U>>31,(c^H|0)>=0&&((c^_|0)<0?l=U:l=U-R+l|0),c=ar(t,K,h,l,0)|0,h=F[(e[ne>>2]|0)+(ie*3|0)+2>>0]|0,l=o-P>>31,(l^O|0)>=0&&((l^$|0)<0?o=P:o=P-G+o|0),Z=ar(t,Z,h,o,0)|0,ie=(e[ne>>2]|0)+(ie*3|0)|0,S[ie>>0]=d,S[ie+1>>0]=c,S[ie+2>>0]=Z):r=(nc(t,ie,0)|0)+ie|0,(r|0)<(e[oe>>2]|0);)ie=r}function nc(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0;return C=b,b=b+16|0,k=C+3|0,N=C,h=t+4576|0,o=e[h>>2]|0,l=o+((r+-1|0)*3|0)|0,d=S[l>>0]|0,w=S[l+1>>0]|0,l=S[l+2>>0]|0,S[N>>0]=d,S[N+1>>0]=w,S[N+2>>0]=l,D=t+148|0,c=(e[D>>2]|0)-r|0,S[k>>0]=S[N>>0]|0,S[k+1>>0]=S[N+1>>0]|0,S[k+2>>0]=S[N+2>>0]|0,c=rc(t,k,o+(r*3|0)|0,c)|0,o=c+r|0,(o|0)==(e[D>>2]|0)?(N=c,b=C,N|0):(k=(e[t+4572>>2]|0)+(o*3|0)|0,r=S[k>>0]|0,D=S[k+1>>0]|0,k=S[k+2>>0]|0,N=e[h>>2]|0,h=t+4544|0,_=lr(t,h)|0,R=lr(t,h)|0,r=r&255,r=(ee(r-(d&255)>>31|1,_)|0)+r&255,D=D&255,D=(ee(D-(w&255)>>31|1,R)|0)+D&255,k=k&255,k=(ee(k-(l&255)>>31|1,lr(t,h)|0)|0)+k&255,N=N+(o*3|0)|0,S[N>>0]=r,S[N+1>>0]=D,S[N+2>>0]=k,N=t+4568|0,k=e[N>>2]|0,e[N>>2]=(k|0)<1?0:k+-1|0,N=c+1|0,b=C,N|0)}function ar(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0;if(_=r>>31,D=(_^r)-_|0,R=t+164+(D*12|0)+10|0,o=I[R>>1]|0,N=t+164+(D*12|0)|0,c=e[N>>2]|0,(o|0)<(c|0))if((o<<1|0)<(c|0))if((o<<2|0)<(c|0))if((o<<3|0)<(c|0))if((o<<4|0)<(c|0))for(h=5;(o<>1]^_)-_+l|0,(o&255|0)!=(o|0)&&(o=o>>31&255^255),c=t+112|0,(e[c>>2]|0)<8&&P0(t),l=t+108|0,d=e[l>>2]|0,w=d>>>24,C=e[2832+(h<<11)+(w<<3)+4>>2]|0,C?(e[c>>2]=(e[c>>2]|0)-C,e[l>>2]=d<>2]|0):(c=X0(t)|0,(c|0)<23?h&&(c=(l0(t,h)|0)+(c<>31^c>>1,(((c|0)>-1?c:0-c|0)|0)>65535&&(o=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,Q|0)|0,bt(8)),g=0,xe(7,o|0,5,35648),r=g,g=0,r&1?(r=j()|0,Tt(o|0),le(r|0)):Qt(o|0,824,96))),C=t+164+(D*12|0)+4|0,l=e[C>>2]|0,h?h=I[R>>1]|0:(t=I[R>>1]|0,h=t,c=(l<<1)+-1+(t<<16>>16)>>31^c),d=h<<16>>16==64,t=d&1,w=l+c>>t,d=d?32:h<<16>>16,e[N>>2]=((c|0)>-1?c:0-c|0)+(e[N>>2]|0)>>t,l=d+1|0,I[R>>1]=l,h=l+w|0,(h|0)<1?(R=I[k>>1]|0,I[k>>1]=(R&65535)-(R<<16>>16>-128&1),R=(h|0)>(~d|0)?h:0-d|0,e[C>>2]=R,_=c^_,r=r>>>31,r=o+r|0,r=r+_|0,r=r&255,r|0):(w|0)<=0?(R=w,e[C>>2]=R,_=c^_,r=r>>>31,r=o+r|0,r=r+_|0,r=r&255,r|0):(R=w-l|0,N=I[k>>1]|0,I[k>>1]=(N<<16>>16<127&1)+(N&65535),R=(R|0)>0?0:R,e[C>>2]=R,_=c^_,r=r>>>31,r=o+r|0,r=r+_|0,r=r&255,r|0)}function rc(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0;for(w=t+112|0,C=t+108|0,D=t+4568|0,c=e[w>>2]|0,h=0;;){if((c|0)<1&&(P0(t),c=e[w>>2]|0),d=e[C>>2]|0,c=c+-1|0,e[w>>2]=c,e[C>>2]=d<<1,(d|0)>=0){k=8;break}if(d=e[D>>2]|0,N=1<>2],R=l-h|0,R=(N|0)<(R|0)?N:R,h=R+h|0,(R|0)==(N|0)&&(e[D>>2]=(d|0)>30?31:d+1|0),(h|0)==(l|0)){c=l;break}}if((k|0)==8&&((h|0)!=(l|0)?(c=e[D>>2]|0,(c+-4|0)>>>0<28?c=l0(t,e[36476+(c<<2)>>2]|0)|0:c=0,c=c+h|0,(c|0)>(l|0)&&(c=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,Q|0)|0,bt(8)),g=0,xe(7,c|0,5,35648),R=g,g=0,R&1?(R=j()|0,Tt(c|0),le(R|0)):Qt(c|0,824,96))):c=l),(c|0)<=0)return c|0;h=0;do R=o+(h*3|0)|0,S[R>>0]=S[r>>0]|0,S[R+1>>0]=S[r+1>>0]|0,S[R+2>>0]=S[r+2>>0]|0,h=h+1|0;while((h|0)!=(c|0));return c|0}function lr(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0;if(w=r+9|0,o=F[w>>0]|0,h=r+4|0,c=(ee(o>>>1,e[h>>2]|0)|0)+(e[r>>2]|0)|0,(o|0)<(c|0)){l=0;do o=o<<1,l=l+1|0;while((o|0)<(c|0))}else l=0;c=e[36476+(e[t+4568>>2]<<2)>>2]|0,o=X0(t)|0;do if((o|0)<(22-c|0))if(l){o=(l0(t,l)|0)+(o<>2]|0,c=o+t|0,C=c&1,l=C,h=1,c=(C+c|0)/2|0;break}else{t=e[h>>2]|0,c=t+o|0,l=c&1,c=(l+c|0)/2|0,d=8;break}else o=(l0(t,8)|0)+1|0,t=e[h>>2]|0,c=o+t|0,h=c&1,c=(h+c|0)/2|0,l?(l=h,h=1):(l=h,d=8);while(!1);return(d|0)==8&&(h=F[r+10>>0]<<1>>>0>=(F[w>>0]|0)>>>0),c=(l|0)!=0^h?c:0-c|0,(c|0)<0&&(C=r+10|0,S[C>>0]=(F[C>>0]|0)+1),o=(o+1-t>>1)+(e[r>>2]|0)|0,e[r>>2]=o,l=S[w>>0]|0,l<<24>>24!=(S[r+8>>0]|0)?(C=l,C=C&255,C=C+1|0,C=C&255,S[w>>0]=C,c|0):(e[r>>2]=o>>1,C=(l&255)>>>1,S[w>>0]=C,r=r+10|0,S[r>>0]=(F[r>>0]|0)>>>1,C=C&255,C=C+1|0,C=C&255,S[w>>0]=C,c|0)}function sc(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0;if(k=b,b=b+128|0,h=k,R=k+116|0,_=k+104|0,w=k+20|0,D=k+16|0,C=k+12|0,N=k+8|0,d=k+4|0,S[R>>0]=S[58887]|0,S[R+1>>0]=S[58888]|0,S[R+2>>0]=S[58889]|0,S[R+3>>0]=S[58890]|0,S[R+4>>0]=S[58891]|0,S[R+5>>0]=S[58892]|0,ki(R+1|0,58893,0,e[o+4>>2]|0),t=b0()|0,e[h>>2]=c,c=_+(q0(_,12,t,R,h)|0)|0,R=ri(_,c,o)|0,t=f0(o)|0,e[N>>2]=t,g=0,ht(3,_|0,R|0,c|0,w|0,D|0,C|0,N|0),c=g,g=0,c&1)_=j()|0,Bt(t)|0,le(_|0);else return Bt(t)|0,e[d>>2]=e[r>>2],R=e[D>>2]|0,_=e[C>>2]|0,e[h>>2]=e[d>>2],_=Hi(h,w,R,_,o,l)|0,b=k,_|0;return 0}function oc(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0;if(N=b,b=b+240|0,d=N+8|0,t=N,_=N+204|0,C=N+32|0,k=N+28|0,D=N+24|0,R=N+20|0,w=N+16|0,U=t,e[U>>2]=37,e[U+4>>2]=0,ki(t+1|0,58895,0,e[o+4>>2]|0),U=b0()|0,H=d,e[H>>2]=c,e[H+4>>2]=h,h=_+(q0(_,23,U,t,d)|0)|0,c=ri(_,h,o)|0,t=f0(o)|0,e[R>>2]=t,g=0,ht(3,_|0,c|0,h|0,C|0,k|0,D|0,R|0),h=g,g=0,h&1)H=j()|0,Bt(t)|0,le(H|0);else return Bt(t)|0,e[w>>2]=e[r>>2],U=e[k>>2]|0,H=e[D>>2]|0,e[d>>2]=e[w>>2],H=Hi(d,C,U,H,o,l)|0,b=N,H|0;return 0}function ac(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=+c;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0;Z=b,b=b+352|0,K=Z+312|0,R=Z+48|0,N=Z+32|0,C=Z+24|0,h=Z+8|0,k=Z,U=Z+316|0,H=Z+80|0,w=Z+84|0,O=Z+76|0,P=Z+72|0,G=Z+68|0,$=Z+64|0,D=k,e[D>>2]=37,e[D+4>>2]=0,D=gn(k+1|0,58898,e[o+4>>2]|0)|0,e[H>>2]=U,t=b0()|0,D?(e[h>>2]=e[o+8>>2],B[h+8>>3]=c,h=q0(U,30,t,k,h)|0):(B[C>>3]=c,h=q0(U,30,t,k,C)|0);e:do if((h|0)>29){g=0,t=Ce(3)|0,h=g,g=0,h=h&1,D?!h&&(g=0,e[N>>2]=e[o+8>>2],B[N+8>>3]=c,d=Pe(17,H|0,t|0,k|0,N|0)|0,_=g,g=0,!(_&1))&&(ie=12):!h&&(g=0,e[R>>2]=e[o+8>>2],B[R+8>>3]=c,_=Pe(17,H|0,t|0,k|0,R|0)|0,R=g,g=0,!(R&1))&&(d=_,ie=12);do if((ie|0)==12){if(t=e[H>>2]|0,t)h=t;else{if(g=0,Nt(6),_=g,g=0,_&1)break;h=e[H>>2]|0}t=h,k=h,ie=16;break e}while(!1);t=j()|0}else t=e[H>>2]|0,k=0,d=h,ie=16;while(!1);if((ie|0)==16){C=t+d|0,D=ri(t,C,o)|0;do if((t|0)==(U|0))t=U,h=0,ie=22;else{if(d=E0(d<<3)|0,!d){if(g=0,Nt(6),ie=g,g=0,ie&1){h=0,ie=20;break}t=e[H>>2]|0}h=d,w=d,ie=22}while(!1);do if((ie|0)==22)if(g=0,d=ge(68,o|0)|0,H=g,g=0,H&1)ie=20;else{if(e[G>>2]=d,g=0,ht(4,t|0,D|0,C|0,w|0,O|0,P|0,G|0),G=g,g=0,G&1){t=j()|0,Bt(d)|0;break}if(Bt(d)|0,e[$>>2]=e[r>>2],ie=e[O>>2]|0,t=e[P>>2]|0,g=0,e[K>>2]=e[$>>2],t=Vt(40,K|0,w|0,ie|0,t|0,o|0,l|0)|0,ie=g,g=0,ie&1)ie=20;else return e[r>>2]=t,h&&n0(h),k&&n0(k),b=Z,t|0}while(!1);(ie|0)==20&&(t=j()|0),h&&n0(h),k&&n0(k)}return le(t|0),0}function uc(t,r,o,l,c,h,d){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0;var w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0;switch(O=b,b=b+16|0,Z=O,P=O0(d,44212)|0,G=O0(d,44368)|0,t0[e[(e[G>>2]|0)+20>>2]&127](Z,G),e[h>>2]=l,d=S[t>>0]|0,d<<24>>24){case 43:case 45:{g=0,d=be(e[(e[P>>2]|0)+44>>2]|0,P|0,d|0)|0,$=g,g=0,$&1?K=8:(D=e[h>>2]|0,e[h>>2]=D+4,e[D>>2]=d,D=t+1|0,K=10);break}default:D=t,K=10}e:do if((K|0)==10){$=o;t:do if(($-D|0)>1&&(S[D>>0]|0)==48){switch(w=D+1|0,S[w>>0]|0){case 88:case 120:break;default:{K=11;break t}}if(g=0,d=be(e[(e[P>>2]|0)+44>>2]|0,P|0,48)|0,H=g,g=0,H&1){K=8;break e}if(H=e[h>>2]|0,e[h>>2]=H+4,e[H>>2]=d,D=D+2|0,g=0,d=be(e[(e[P>>2]|0)+44>>2]|0,P|0,S[w>>0]|0)|0,H=g,g=0,H&1){K=8;break e}if(H=e[h>>2]|0,e[h>>2]=H+4,e[H>>2]=d,D>>>0>>0){for(d=D;w=S[d>>0]|0,g=0,C=Ce(3)|0,H=g,g=0,!(H&1||(g=0,w=be(39,w<<24>>24|0,C|0)|0,H=g,g=0,H&1));){if(!w){H=D;break t}if(d=d+1|0,d>>>0>=o>>>0){H=D;break t}}d=j()|0;break e}else H=D,d=D}else K=11;while(!1);t:do if((K|0)==11)if(D>>>0>>0){for(d=D;w=S[d>>0]|0,g=0,C=Ce(3)|0,H=g,g=0,!(H&1||(g=0,w=be(40,w<<24>>24|0,C|0)|0,H=g,g=0,H&1));){if(!w){H=D;break t}if(d=d+1|0,d>>>0>=o>>>0){H=D;break t}}d=j()|0;break e}else H=D,d=D;while(!1);if(_=S[Z>>0]|0,U=Z+4|0,(_&1?e[U>>2]|0:(_&255)>>>1)|0){if((H|0)!=(d|0)&&(k=d+-1|0,H>>>0>>0)){C=H,w=k;do _=S[C>>0]|0,S[C>>0]=S[w>>0]|0,S[w>>0]=_,C=C+1|0,w=w+-1|0;while(C>>>0>>0)}if(g=0,k=ge(e[(e[G>>2]|0)+16>>2]|0,G|0)|0,_=g,g=0,_&1){K=8;break}N=Z+8|0,R=Z+1|0;t:do if(H>>>0>>0){for(w=0,C=0,_=H;D=S[(S[Z>>0]&1?e[N>>2]|0:R)+C>>0]|0,D<<24>>24>0&(w|0)==(D<<24>>24|0)?(w=e[h>>2]|0,e[h>>2]=w+4,e[w>>2]=k,w=S[Z>>0]|0,D=0,C=(C>>>0<((w&1?e[U>>2]|0:(w&255)>>>1)+-1|0)>>>0&1)+C|0):D=w,g=0,w=be(e[(e[P>>2]|0)+44>>2]|0,P|0,S[_>>0]|0)|0,ie=g,g=0,!(ie&1);){if(ie=e[h>>2]|0,e[h>>2]=ie+4,e[ie>>2]=w,_=_+1|0,_>>>0>=d>>>0)break t;w=D+1|0}d=j()|0;break e}while(!1);if(w=l+(H-t<<2)|0,D=e[h>>2]|0,(w|0)!=(D|0))if(C=D+-4|0,w>>>0>>0){do ie=e[w>>2]|0,e[w>>2]=e[C>>2],e[C>>2]=ie,w=w+4|0,C=C+-4|0;while(w>>>0>>0);k=P,w=D}else k=P,w=D;else k=P}else{if(g=0,Pe(e[(e[P>>2]|0)+48>>2]|0,P|0,H|0,d|0,e[h>>2]|0)|0,ie=g,g=0,ie&1){K=8;break}w=(e[h>>2]|0)+(d-H<<2)|0,e[h>>2]=w,k=P}t:do if(d>>>0>>0){for(;;){if(w=S[d>>0]|0,w<<24>>24==46){C=d;break}if(g=0,C=be(e[(e[k>>2]|0)+44>>2]|0,P|0,w|0)|0,ie=g,g=0,ie&1){K=4;break}if(ie=e[h>>2]|0,w=ie+4|0,e[h>>2]=w,e[ie>>2]=C,d=d+1|0,d>>>0>=o>>>0)break t}if((K|0)==4){d=j()|0;break e}if(g=0,d=ge(e[(e[G>>2]|0)+12>>2]|0,G|0)|0,ie=g,g=0,ie&1){K=8;break e}ie=e[h>>2]|0,w=ie+4|0,e[h>>2]=w,e[ie>>2]=d,d=C+1|0}while(!1);if(g=0,Pe(e[(e[P>>2]|0)+48>>2]|0,P|0,d|0,o|0,w|0)|0,ie=g,g=0,ie&1)K=8;else{ie=(e[h>>2]|0)+($-d<<2)|0,e[h>>2]=ie,e[c>>2]=(r|0)==(o|0)?ie:l+(r-t<<2)|0,de(Z),b=O;return}}while(!1);(K|0)==8&&(d=j()|0),de(Z),le(d|0)}function cc(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=+c;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0;Z=b,b=b+352|0,K=Z+304|0,R=Z+48|0,N=Z+32|0,C=Z+24|0,h=Z+8|0,k=Z,U=Z+308|0,H=Z+72|0,w=Z+76|0,O=Z+68|0,P=Z+64|0,G=Z+60|0,$=Z+56|0,D=k,e[D>>2]=37,e[D+4>>2]=0,D=gn(k+1|0,58899,e[o+4>>2]|0)|0,e[H>>2]=U,t=b0()|0,D?(e[h>>2]=e[o+8>>2],B[h+8>>3]=c,h=q0(U,30,t,k,h)|0):(B[C>>3]=c,h=q0(U,30,t,k,C)|0);e:do if((h|0)>29){g=0,t=Ce(3)|0,h=g,g=0,h=h&1,D?!h&&(g=0,e[N>>2]=e[o+8>>2],B[N+8>>3]=c,d=Pe(17,H|0,t|0,k|0,N|0)|0,_=g,g=0,!(_&1))&&(ie=12):!h&&(g=0,B[R>>3]=c,_=Pe(17,H|0,t|0,k|0,R|0)|0,R=g,g=0,!(R&1))&&(d=_,ie=12);do if((ie|0)==12){if(t=e[H>>2]|0,t)h=t;else{if(g=0,Nt(6),_=g,g=0,_&1)break;h=e[H>>2]|0}t=h,k=h,ie=16;break e}while(!1);t=j()|0}else t=e[H>>2]|0,k=0,d=h,ie=16;while(!1);if((ie|0)==16){C=t+d|0,D=ri(t,C,o)|0;do if((t|0)==(U|0))t=U,h=0,ie=22;else{if(d=E0(d<<3)|0,!d){if(g=0,Nt(6),ie=g,g=0,ie&1){h=0,ie=20;break}t=e[H>>2]|0}h=d,w=d,ie=22}while(!1);do if((ie|0)==22)if(g=0,d=ge(68,o|0)|0,H=g,g=0,H&1)ie=20;else{if(e[G>>2]=d,g=0,ht(4,t|0,D|0,C|0,w|0,O|0,P|0,G|0),G=g,g=0,G&1){t=j()|0,Bt(d)|0;break}if(Bt(d)|0,e[$>>2]=e[r>>2],ie=e[O>>2]|0,t=e[P>>2]|0,g=0,e[K>>2]=e[$>>2],t=Vt(40,K|0,w|0,ie|0,t|0,o|0,l|0)|0,ie=g,g=0,ie&1)ie=20;else return e[r>>2]=t,h&&n0(h),k&&n0(k),b=Z,t|0}while(!1);(ie|0)==20&&(t=j()|0),h&&n0(h),k&&n0(k)}return le(t|0),0}function fc(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0;if(R=b,b=b+192|0,C=R,t=R+180|0,k=R+160|0,N=R+12|0,w=R+8|0,D=R+4|0,S[t>>0]=S[58901]|0,S[t+1>>0]=S[58902]|0,S[t+2>>0]=S[58903]|0,S[t+3>>0]=S[58904]|0,S[t+4>>0]=S[58905]|0,S[t+5>>0]=S[58906]|0,h=b0()|0,e[C>>2]=c,t=q0(k,20,h,t,C)|0,c=k+t|0,h=ri(k,c,o)|0,d=f0(o)|0,e[w>>2]=d,g=0,w=be(37,w|0,44212)|0,_=g,g=0,_&1)_=j()|0,Bt(d)|0,le(_|0);else return Bt(d)|0,_r[e[(e[w>>2]|0)+48>>2]&31](w,k,c,N)|0,_=N+(t<<2)|0,e[D>>2]=e[r>>2],e[C>>2]=e[D>>2],_=Hi(C,N,(h|0)==(c|0)?_:N+(h-k<<2)|0,_,o,l)|0,b=R,_|0;return 0}function xi(t,r,o,l,c,h,d,w){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0,w=w|0;var C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0;ie=b,b=b+32|0,K=ie+16|0,H=ie+12|0,P=ie+8|0,G=ie+4|0,$=ie,C=f0(l)|0,e[P>>2]=C,g=0,P=be(37,P|0,44220)|0,U=g,g=0,U&1&&(ie=j()|0,Bt(C)|0,le(ie|0)),Bt(C)|0,e[c>>2]=0,U=P+8|0,C=e[r>>2]|0;e:do if((d|0)!=(w|0)){t:for(;;){D=C,C?(e[C+12>>2]|0)==(e[C+16>>2]|0)&&(Dt[e[(e[C>>2]|0)+36>>2]&127](C)|0)==-1&&(e[r>>2]=0,C=0,D=0):C=0,R=(C|0)==0,N=e[o>>2]|0,k=N;do if(N){if((e[N+12>>2]|0)==(e[N+16>>2]|0)&&(Dt[e[(e[N>>2]|0)+36>>2]&127](N)|0)==-1){e[o>>2]=0,k=0,Z=12;break}if(!R){Z=13;break t}}else Z=12;while(!1);if((Z|0)==12)if(Z=0,R){Z=13;break}else N=0;i:do if((Yt[e[(e[P>>2]|0)+36>>2]&63](P,S[d>>0]|0,0)|0)<<24>>24==37){if(N=d+1|0,(N|0)==(w|0)){Z=17;break t}switch(_=Yt[e[(e[P>>2]|0)+36>>2]&63](P,S[N>>0]|0,0)|0,_<<24>>24){case 48:case 69:{if(R=d+2|0,(R|0)==(w|0)){Z=20;break t}d=N,N=Yt[e[(e[P>>2]|0)+36>>2]&63](P,S[R>>0]|0,0)|0,C=_;break}default:N=_,C=0}_=e[(e[t>>2]|0)+36>>2]|0,e[G>>2]=D,e[$>>2]=k,e[H>>2]=e[G>>2],e[K>>2]=e[$>>2],_=Ci[_&15](t,H,K,l,c,h,N,C)|0,e[r>>2]=_,d=d+2|0}else{if(D=S[d>>0]|0,D<<24>>24>-1&&(O=e[U>>2]|0,(I[O+(D<<24>>24<<1)>>1]&8192)!=0)){do{if(d=d+1|0,(d|0)==(w|0)){d=w;break}if(D=S[d>>0]|0,D<<24>>24<=-1)break}while(I[O+(D<<24>>24<<1)>>1]&8192);for(D=N;;){C?(e[C+12>>2]|0)==(e[C+16>>2]|0)&&(Dt[e[(e[C>>2]|0)+36>>2]&127](C)|0)==-1&&(e[r>>2]=0,C=0):C=0,k=(C|0)==0;do if(N){if((e[N+12>>2]|0)!=(e[N+16>>2]|0))if(k){_=D;break}else break i;if((Dt[e[(e[N>>2]|0)+36>>2]&127](N)|0)!=-1)if(k^(D|0)==0){_=D,N=D;break}else break i;else{e[o>>2]=0,D=0,Z=39;break}}else Z=39;while(!1);if((Z|0)==39){if(Z=0,k)break i;_=D,N=0}if(k=C+12|0,D=e[k>>2]|0,R=C+16|0,(D|0)==(e[R>>2]|0)?D=Dt[e[(e[C>>2]|0)+36>>2]&127](C)|0:D=F[D>>0]|0,(D&255)<<24>>24<=-1||!(I[(e[U>>2]|0)+(D<<24>>24<<1)>>1]&8192))break i;if(D=e[k>>2]|0,(D|0)==(e[R>>2]|0)){Dt[e[(e[C>>2]|0)+40>>2]&127](C)|0,D=_;continue}else{e[k>>2]=D+1,D=_;continue}}}if(k=C+12|0,D=e[k>>2]|0,N=C+16|0,(D|0)==(e[N>>2]|0)?D=Dt[e[(e[C>>2]|0)+36>>2]&127](C)|0:D=F[D>>0]|0,_=U0[e[(e[P>>2]|0)+12>>2]&63](P,D&255)|0,_<<24>>24!=(U0[e[(e[P>>2]|0)+12>>2]&63](P,S[d>>0]|0)|0)<<24>>24){Z=57;break t}D=e[k>>2]|0,(D|0)==(e[N>>2]|0)?Dt[e[(e[C>>2]|0)+40>>2]&127](C)|0:e[k>>2]=D+1,d=d+1|0}while(!1);if(C=e[r>>2]|0,!((d|0)!=(w|0)&(e[c>>2]|0)==0))break e}if((Z|0)==13){e[c>>2]=4;break}else if((Z|0)==17){e[c>>2]=4;break}else if((Z|0)==20){e[c>>2]=4;break}else if((Z|0)==57){e[c>>2]=4,C=e[r>>2]|0;break}}while(!1);C?(e[C+12>>2]|0)==(e[C+16>>2]|0)&&(Dt[e[(e[C>>2]|0)+36>>2]&127](C)|0)==-1&&(e[r>>2]=0,C=0):C=0,d=(C|0)==0,D=e[o>>2]|0;do if(D){if((e[D+12>>2]|0)==(e[D+16>>2]|0)&&(Dt[e[(e[D>>2]|0)+36>>2]&127](D)|0)==-1){e[o>>2]=0,Z=67;break}d||(Z=68)}else Z=67;while(!1);return(Z|0)==67&&d&&(Z=68),(Z|0)==68&&(e[c>>2]=e[c>>2]|2),b=ie,C|0}function hc(t){t=t|0}function dc(t){t=t|0,he(t)}function pc(t){return t=t|0,2}function mc(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0;return d=b,b=b+16|0,w=d+12|0,C=d+8|0,k=d+4|0,D=d,e[k>>2]=e[r>>2],e[D>>2]=e[o>>2],e[C>>2]=e[k>>2],e[w>>2]=e[D>>2],t=xi(t,C,w,l,c,h,58907,58915)|0,b=d,t|0}function gc(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0,N=0,R=0;return d=b,b=b+16|0,w=d+12|0,C=d+8|0,k=d+4|0,D=d,N=t+8|0,N=Dt[e[(e[N>>2]|0)+20>>2]&127](N)|0,e[k>>2]=e[r>>2],e[D>>2]=e[o>>2],o=S[N>>0]|0,R=(o&1)==0,r=R?N+1|0:e[N+8>>2]|0,o=r+(R?(o&255)>>>1:e[N+4>>2]|0)|0,e[C>>2]=e[k>>2],e[w>>2]=e[D>>2],t=xi(t,C,w,l,c,h,r,o)|0,b=d,t|0}function Sc(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0;if(D=b,b=b+16|0,w=D+8|0,d=D+4|0,C=D,l=f0(l)|0,e[d>>2]=l,g=0,d=be(37,d|0,44220)|0,k=g,g=0,k&1)k=j()|0,Bt(l)|0,le(k|0);else return Bt(l)|0,e[C>>2]=e[o>>2],e[w>>2]=e[C>>2],Is(t,h+24|0,r,w,c,d),b=D,e[r>>2]|0;return 0}function Is(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0;d=b,b=b+16|0,w=d+4|0,C=d,t=t+8|0,t=Dt[e[e[t>>2]>>2]&127](t)|0,e[C>>2]=e[l>>2],e[w>>2]=e[C>>2],o=(Sn(o,w,t,t+168|0,h,c,0)|0)-t|0,(o|0)<168&&(e[r>>2]=((o|0)/12|0|0)%7|0),b=d}function Ac(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0;if(D=b,b=b+16|0,w=D+8|0,d=D+4|0,C=D,l=f0(l)|0,e[d>>2]=l,g=0,d=be(37,d|0,44220)|0,k=g,g=0,k&1)k=j()|0,Bt(l)|0,le(k|0);else return Bt(l)|0,e[C>>2]=e[o>>2],e[w>>2]=e[C>>2],Es(t,h+16|0,r,w,c,d),b=D,e[r>>2]|0;return 0}function Es(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0;d=b,b=b+16|0,w=d+4|0,C=d,t=t+8|0,t=Dt[e[(e[t>>2]|0)+4>>2]&127](t)|0,e[C>>2]=e[l>>2],e[w>>2]=e[C>>2],o=(Sn(o,w,t,t+288|0,h,c,0)|0)-t|0,(o|0)<288&&(e[r>>2]=((o|0)/12|0|0)%12|0),b=d}function vc(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0;if(D=b,b=b+16|0,w=D+8|0,d=D+4|0,C=D,l=f0(l)|0,e[d>>2]=l,g=0,d=be(37,d|0,44220)|0,k=g,g=0,k&1)k=j()|0,Bt(l)|0,le(k|0);else return Bt(l)|0,e[C>>2]=e[o>>2],e[w>>2]=e[C>>2],ks(t,h+20|0,r,w,c,d),b=D,e[r>>2]|0;return 0}function ks(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0;d=b,b=b+16|0,t=d+4|0,w=d,e[w>>2]=e[l>>2],e[t>>2]=e[w>>2],t=fi(o,t,c,h,4)|0,e[c>>2]&4||((t|0)<69?t=t+2e3|0:t=(t+-69|0)>>>0<31?t+1900|0:t,e[r>>2]=t+-1900),b=d}function xc(t,r,o,l,c,h,d,w){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0,w=w|0;var C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0,ce=0,ke=0,Ee=0,Te=0,it=0,jt=0,Gt=0,s0=0,i0=0,zt=0,gt=0,Kt=0,dt=0,At=0,y0=0,T0=0,g0=0,Oe=0,yt=0,qt=0;Oe=b,b=b+144|0,C=Oe+132|0,w=Oe+116|0,gt=Oe+128|0,P=Oe+124|0,jt=Oe+120|0,Kt=Oe+112|0,dt=Oe+108|0,At=Oe+104|0,y0=Oe+100|0,T0=Oe+96|0,g0=Oe+92|0,D=Oe+88|0,k=Oe+84|0,N=Oe+80|0,R=Oe+76|0,_=Oe+72|0,U=Oe+68|0,H=Oe+64|0,K=Oe+60|0,G=Oe+56|0,$=Oe+52|0,O=Oe+48|0,Z=Oe+44|0,ie=Oe+40|0,oe=Oe+36|0,ne=Oe+32|0,ce=Oe+28|0,ke=Oe+24|0,Ee=Oe+20|0,Te=Oe+16|0,it=Oe+12|0,Gt=Oe+8|0,s0=Oe+4|0,i0=Oe,e[c>>2]=0,zt=f0(l)|0,e[gt>>2]=zt,g=0,gt=be(37,gt|0,44220)|0,qt=g,g=0,qt&1&&(qt=j()|0,Bt(zt)|0,le(qt|0)),Bt(zt)|0;do switch(d<<24>>24|0){case 65:case 97:{e[P>>2]=e[o>>2],e[C>>2]=e[P>>2],Is(t,h+24|0,r,C,c,gt),yt=28;break}case 104:case 66:case 98:{e[jt>>2]=e[o>>2],e[C>>2]=e[jt>>2],Es(t,h+16|0,r,C,c,gt),yt=28;break}case 99:{yt=t+8|0,yt=Dt[e[(e[yt>>2]|0)+12>>2]&127](yt)|0,e[Kt>>2]=e[r>>2],e[dt>>2]=e[o>>2],d=S[yt>>0]|0,o=(d&1)==0,qt=o?yt+1|0:e[yt+8>>2]|0,yt=qt+(o?(d&255)>>>1:e[yt+4>>2]|0)|0,e[w>>2]=e[Kt>>2],e[C>>2]=e[dt>>2],yt=xi(t,w,C,l,c,h,qt,yt)|0,e[r>>2]=yt,yt=28;break}case 101:case 100:{e[At>>2]=e[o>>2],e[C>>2]=e[At>>2],wc(t,h+12|0,r,C,c,gt),yt=28;break}case 68:{e[y0>>2]=e[r>>2],e[T0>>2]=e[o>>2],e[w>>2]=e[y0>>2],e[C>>2]=e[T0>>2],yt=xi(t,w,C,l,c,h,58915,58923)|0,e[r>>2]=yt,yt=28;break}case 70:{e[g0>>2]=e[r>>2],e[D>>2]=e[o>>2],e[w>>2]=e[g0>>2],e[C>>2]=e[D>>2],yt=xi(t,w,C,l,c,h,58923,58931)|0,e[r>>2]=yt,yt=28;break}case 72:{e[k>>2]=e[o>>2],e[C>>2]=e[k>>2],yc(t,h+8|0,r,C,c,gt),yt=28;break}case 73:{e[N>>2]=e[o>>2],e[C>>2]=e[N>>2],Cc(t,h+8|0,r,C,c,gt),yt=28;break}case 106:{e[R>>2]=e[o>>2],e[C>>2]=e[R>>2],Tc(t,h+28|0,r,C,c,gt),yt=28;break}case 109:{e[_>>2]=e[o>>2],e[C>>2]=e[_>>2],Ic(t,h+16|0,r,C,c,gt),yt=28;break}case 77:{e[U>>2]=e[o>>2],e[C>>2]=e[U>>2],Ec(t,h+4|0,r,C,c,gt),yt=28;break}case 116:case 110:{e[H>>2]=e[o>>2],e[C>>2]=e[H>>2],kc(t,r,C,c,gt),yt=28;break}case 112:{e[K>>2]=e[o>>2],e[C>>2]=e[K>>2],Dc(t,h+8|0,r,C,c,gt),yt=28;break}case 114:{e[G>>2]=e[r>>2],e[$>>2]=e[o>>2],e[w>>2]=e[G>>2],e[C>>2]=e[$>>2],yt=xi(t,w,C,l,c,h,58931,58942)|0,e[r>>2]=yt,yt=28;break}case 82:{e[O>>2]=e[r>>2],e[Z>>2]=e[o>>2],e[w>>2]=e[O>>2],e[C>>2]=e[Z>>2],yt=xi(t,w,C,l,c,h,58942,58947)|0,e[r>>2]=yt,yt=28;break}case 83:{e[ie>>2]=e[o>>2],e[C>>2]=e[ie>>2],bc(t,h,r,C,c,gt),yt=28;break}case 84:{e[oe>>2]=e[r>>2],e[ne>>2]=e[o>>2],e[w>>2]=e[oe>>2],e[C>>2]=e[ne>>2],yt=xi(t,w,C,l,c,h,58947,58955)|0,e[r>>2]=yt,yt=28;break}case 119:{e[ce>>2]=e[o>>2],e[C>>2]=e[ce>>2],Nc(t,h+24|0,r,C,c,gt),yt=28;break}case 120:{qt=e[(e[t>>2]|0)+20>>2]|0,e[ke>>2]=e[r>>2],e[Ee>>2]=e[o>>2],e[w>>2]=e[ke>>2],e[C>>2]=e[Ee>>2],w=on[qt&63](t,w,C,l,c,h)|0;break}case 88:{yt=t+8|0,yt=Dt[e[(e[yt>>2]|0)+24>>2]&127](yt)|0,e[Te>>2]=e[r>>2],e[it>>2]=e[o>>2],d=S[yt>>0]|0,o=(d&1)==0,qt=o?yt+1|0:e[yt+8>>2]|0,yt=qt+(o?(d&255)>>>1:e[yt+4>>2]|0)|0,e[w>>2]=e[Te>>2],e[C>>2]=e[it>>2],yt=xi(t,w,C,l,c,h,qt,yt)|0,e[r>>2]=yt,yt=28;break}case 121:{e[Gt>>2]=e[o>>2],e[C>>2]=e[Gt>>2],ks(t,h+20|0,r,C,c,gt),yt=28;break}case 89:{e[s0>>2]=e[o>>2],e[C>>2]=e[s0>>2],Fc(t,h+20|0,r,C,c,gt),yt=28;break}case 37:{e[i0>>2]=e[o>>2],e[C>>2]=e[i0>>2],Rc(t,r,C,c,gt),yt=28;break}default:e[c>>2]=e[c>>2]|4,yt=28}while(!1);return(yt|0)==28&&(w=e[r>>2]|0),b=Oe,w|0}function wc(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0;d=b,b=b+16|0,t=d+4|0,w=d,e[w>>2]=e[l>>2],e[t>>2]=e[w>>2],t=fi(o,t,c,h,2)|0,o=e[c>>2]|0,(t+-1|0)>>>0<31&(o&4|0)==0?e[r>>2]=t:e[c>>2]=o|4,b=d}function yc(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0;d=b,b=b+16|0,t=d+4|0,w=d,e[w>>2]=e[l>>2],e[t>>2]=e[w>>2],t=fi(o,t,c,h,2)|0,o=e[c>>2]|0,(t|0)<24&(o&4|0)==0?e[r>>2]=t:e[c>>2]=o|4,b=d}function Cc(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0;d=b,b=b+16|0,t=d+4|0,w=d,e[w>>2]=e[l>>2],e[t>>2]=e[w>>2],t=fi(o,t,c,h,2)|0,o=e[c>>2]|0,(t+-1|0)>>>0<12&(o&4|0)==0?e[r>>2]=t:e[c>>2]=o|4,b=d}function Tc(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0;d=b,b=b+16|0,t=d+4|0,w=d,e[w>>2]=e[l>>2],e[t>>2]=e[w>>2],t=fi(o,t,c,h,3)|0,o=e[c>>2]|0,(t|0)<366&(o&4|0)==0?e[r>>2]=t:e[c>>2]=o|4,b=d}function Ic(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0;d=b,b=b+16|0,t=d+4|0,w=d,e[w>>2]=e[l>>2],e[t>>2]=e[w>>2],t=fi(o,t,c,h,2)|0,o=e[c>>2]|0,(t|0)<13&(o&4|0)==0?e[r>>2]=t+-1:e[c>>2]=o|4,b=d}function Ec(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0;d=b,b=b+16|0,t=d+4|0,w=d,e[w>>2]=e[l>>2],e[t>>2]=e[w>>2],t=fi(o,t,c,h,2)|0,o=e[c>>2]|0,(t|0)<60&(o&4|0)==0?e[r>>2]=t:e[c>>2]=o|4,b=d}function kc(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0;d=c+8|0;e:for(;;){c=e[r>>2]|0;do if(c){if((e[c+12>>2]|0)==(e[c+16>>2]|0))if((Dt[e[(e[c>>2]|0)+36>>2]&127](c)|0)==-1){e[r>>2]=0,c=0;break}else{c=e[r>>2]|0;break}}else c=0;while(!1);c=(c|0)==0,t=e[o>>2]|0;do if(t){if((e[t+12>>2]|0)!=(e[t+16>>2]|0)){if(c)break;break e}if((Dt[e[(e[t>>2]|0)+36>>2]&127](t)|0)!=-1){if(c)break;break e}else{e[o>>2]=0,w=12;break}}else w=12;while(!1);if((w|0)==12)if(w=0,c){t=0;break}else t=0;if(c=e[r>>2]|0,h=e[c+12>>2]|0,(h|0)==(e[c+16>>2]|0)?c=Dt[e[(e[c>>2]|0)+36>>2]&127](c)|0:c=F[h>>0]|0,(c&255)<<24>>24<=-1||!(I[(e[d>>2]|0)+(c<<24>>24<<1)>>1]&8192))break;if(c=e[r>>2]|0,t=c+12|0,h=e[t>>2]|0,(h|0)==(e[c+16>>2]|0)){Dt[e[(e[c>>2]|0)+40>>2]&127](c)|0;continue}else{e[t>>2]=h+1;continue}}c=e[r>>2]|0;do if(c){if((e[c+12>>2]|0)==(e[c+16>>2]|0))if((Dt[e[(e[c>>2]|0)+36>>2]&127](c)|0)==-1){e[r>>2]=0,c=0;break}else{c=e[r>>2]|0;break}}else c=0;while(!1);c=(c|0)==0;do if(t){if((e[t+12>>2]|0)==(e[t+16>>2]|0)&&(Dt[e[(e[t>>2]|0)+36>>2]&127](t)|0)==-1){e[o>>2]=0,w=32;break}c||(w=33)}else w=32;while(!1);(w|0)==32&&c&&(w=33),(w|0)==33&&(e[l>>2]=e[l>>2]|2)}function Dc(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0;k=b,b=b+16|0,w=k+4|0,C=k,D=t+8|0,D=Dt[e[(e[D>>2]|0)+8>>2]&127](D)|0,t=S[D>>0]|0,t&1?d=e[D+4>>2]|0:d=(t&255)>>>1,t=S[D+12>>0]|0,t&1?t=e[D+16>>2]|0:t=(t&255)>>>1;do if((d|0)!=(0-t|0)){if(e[C>>2]=e[l>>2],e[w>>2]=e[C>>2],t=Sn(o,w,D,D+24|0,h,c,0)|0,d=e[r>>2]|0,(t|0)==(D|0)&(d|0)==12){e[r>>2]=0;break}(d|0)<12&(t-D|0)==12&&(e[r>>2]=d+12)}else e[c>>2]=e[c>>2]|4;while(!1);b=k}function bc(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0;d=b,b=b+16|0,t=d+4|0,w=d,e[w>>2]=e[l>>2],e[t>>2]=e[w>>2],t=fi(o,t,c,h,2)|0,o=e[c>>2]|0,(t|0)<61&(o&4|0)==0?e[r>>2]=t:e[c>>2]=o|4,b=d}function Nc(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0;d=b,b=b+16|0,t=d+4|0,w=d,e[w>>2]=e[l>>2],e[t>>2]=e[w>>2],t=fi(o,t,c,h,1)|0,o=e[c>>2]|0,(t|0)<7&(o&4|0)==0?e[r>>2]=t:e[c>>2]=o|4,b=d}function Fc(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0;d=b,b=b+16|0,t=d+4|0,w=d,e[w>>2]=e[l>>2],e[t>>2]=e[w>>2],t=fi(o,t,c,h,4)|0,e[c>>2]&4||(e[r>>2]=t+-1900),b=d}function Rc(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0;t=e[r>>2]|0;do if(t){if((e[t+12>>2]|0)==(e[t+16>>2]|0))if((Dt[e[(e[t>>2]|0)+36>>2]&127](t)|0)==-1){e[r>>2]=0,t=0;break}else{t=e[r>>2]|0;break}}else t=0;while(!1);h=(t|0)==0,t=e[o>>2]|0;do if(t){if((e[t+12>>2]|0)==(e[t+16>>2]|0)&&(Dt[e[(e[t>>2]|0)+36>>2]&127](t)|0)==-1){e[o>>2]=0,w=11;break}h?(d=t,w=13):w=12}else w=11;while(!1);(w|0)==11&&(h?w=12:(d=0,w=13));e:do if((w|0)==12)e[l>>2]=e[l>>2]|6;else if((w|0)==13){if(t=e[r>>2]|0,h=e[t+12>>2]|0,(h|0)==(e[t+16>>2]|0)?t=Dt[e[(e[t>>2]|0)+36>>2]&127](t)|0:t=F[h>>0]|0,(Yt[e[(e[c>>2]|0)+36>>2]&63](c,t&255,0)|0)<<24>>24!=37){e[l>>2]=e[l>>2]|4;break}t=e[r>>2]|0,h=t+12|0,c=e[h>>2]|0,(c|0)==(e[t+16>>2]|0)?(Dt[e[(e[t>>2]|0)+40>>2]&127](t)|0,t=e[r>>2]|0,t?w=21:t=0):(e[h>>2]=c+1,w=21);do if((w|0)==21&&(e[t+12>>2]|0)==(e[t+16>>2]|0))if((Dt[e[(e[t>>2]|0)+36>>2]&127](t)|0)==-1){e[r>>2]=0,t=0;break}else{t=e[r>>2]|0;break}while(!1);t=(t|0)==0;do if(d){if((e[d+12>>2]|0)==(e[d+16>>2]|0)&&(Dt[e[(e[d>>2]|0)+36>>2]&127](d)|0)==-1){e[o>>2]=0,w=30;break}if(t)break e}else w=30;while(!1);if((w|0)==30&&!t)break;e[l>>2]=e[l>>2]|2}while(!1)}function wi(t,r,o,l,c,h,d,w){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0,w=w|0;var C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0,G=0,$=0,P=0,O=0;O=b,b=b+32|0,H=O+16|0,U=O+12|0,$=O+8|0,K=O+4|0,G=O,C=f0(l)|0,e[$>>2]=C,g=0,$=be(37,$|0,44212)|0,_=g,g=0,_&1&&(O=j()|0,Bt(C)|0,le(O|0)),Bt(C)|0,e[c>>2]=0,C=e[r>>2]|0;e:do if((d|0)!=(w|0)){t:for(;;){k=C,C?(D=e[C+12>>2]|0,(D|0)==(e[C+16>>2]|0)?D=Dt[e[(e[C>>2]|0)+36>>2]&127](C)|0:D=e[D>>2]|0,(D|0)==-1?(e[r>>2]=0,C=0,R=1,_=0):(R=0,_=k)):(C=0,R=1,_=k),N=e[o>>2]|0,D=N;do if(N)if(k=e[N+12>>2]|0,(k|0)==(e[N+16>>2]|0)?k=Dt[e[(e[N>>2]|0)+36>>2]&127](N)|0:k=e[k>>2]|0,(k|0)!=-1){if(R)break;P=17;break t}else{e[o>>2]=0,D=0,P=15;break}else P=15;while(!1);if((P|0)==15)if(P=0,R){P=17;break}else N=0;i:do if((Yt[e[(e[$>>2]|0)+52>>2]&63]($,e[d>>2]|0,0)|0)<<24>>24==37){if(k=d+4|0,(k|0)==(w|0)){P=21;break t}switch(R=Yt[e[(e[$>>2]|0)+52>>2]&63]($,e[k>>2]|0,0)|0,R<<24>>24){case 48:case 69:{if(N=d+8|0,(N|0)==(w|0)){P=24;break t}d=k,k=Yt[e[(e[$>>2]|0)+52>>2]&63]($,e[N>>2]|0,0)|0,C=R;break}default:k=R,C=0}R=e[(e[t>>2]|0)+36>>2]|0,e[K>>2]=_,e[G>>2]=D,e[U>>2]=e[K>>2],e[H>>2]=e[G>>2],_=Ci[R&15](t,U,H,l,c,h,k,C)|0,e[r>>2]=_,d=d+8|0}else{if(!(Yt[e[(e[$>>2]|0)+12>>2]&63]($,8192,e[d>>2]|0)|0)){if(k=C+12|0,D=e[k>>2]|0,N=C+16|0,(D|0)==(e[N>>2]|0)?D=Dt[e[(e[C>>2]|0)+36>>2]&127](C)|0:D=e[D>>2]|0,_=U0[e[(e[$>>2]|0)+28>>2]&63]($,D)|0,(_|0)!=(U0[e[(e[$>>2]|0)+28>>2]&63]($,e[d>>2]|0)|0)){P=61;break t}D=e[k>>2]|0,(D|0)==(e[N>>2]|0)?Dt[e[(e[C>>2]|0)+40>>2]&127](C)|0:e[k>>2]=D+4,d=d+4|0;break}do if(d=d+4|0,(d|0)==(w|0)){d=w;break}while(Yt[e[(e[$>>2]|0)+12>>2]&63]($,8192,e[d>>2]|0)|0);for(D=N,R=N;;){C?(k=e[C+12>>2]|0,(k|0)==(e[C+16>>2]|0)?k=Dt[e[(e[C>>2]|0)+36>>2]&127](C)|0:k=e[k>>2]|0,(k|0)==-1?(e[r>>2]=0,N=1,C=0):N=0):(N=1,C=0);do if(R)if(k=e[R+12>>2]|0,(k|0)==(e[R+16>>2]|0)?k=Dt[e[(e[R>>2]|0)+36>>2]&127](R)|0:k=e[k>>2]|0,(k|0)!=-1)if(N^(D|0)==0){_=D,R=D;break}else break i;else{e[o>>2]=0,D=0,P=44;break}else P=44;while(!1);if((P|0)==44){if(P=0,N)break i;_=D,R=0}if(k=C+12|0,D=e[k>>2]|0,N=C+16|0,(D|0)==(e[N>>2]|0)?D=Dt[e[(e[C>>2]|0)+36>>2]&127](C)|0:D=e[D>>2]|0,!(Yt[e[(e[$>>2]|0)+12>>2]&63]($,8192,D)|0))break i;if(D=e[k>>2]|0,(D|0)==(e[N>>2]|0)){Dt[e[(e[C>>2]|0)+40>>2]&127](C)|0,D=_;continue}else{e[k>>2]=D+4,D=_;continue}}}while(!1);if(C=e[r>>2]|0,!((d|0)!=(w|0)&(e[c>>2]|0)==0))break e}if((P|0)==17){e[c>>2]=4;break}else if((P|0)==21){e[c>>2]=4;break}else if((P|0)==24){e[c>>2]=4;break}else if((P|0)==61){e[c>>2]=4,C=e[r>>2]|0;break}}while(!1);C?(d=e[C+12>>2]|0,(d|0)==(e[C+16>>2]|0)?d=Dt[e[(e[C>>2]|0)+36>>2]&127](C)|0:d=e[d>>2]|0,(d|0)==-1?(e[r>>2]=0,C=0,k=1):k=0):(C=0,k=1),d=e[o>>2]|0;do if(d)if(D=e[d+12>>2]|0,(D|0)==(e[d+16>>2]|0)?d=Dt[e[(e[d>>2]|0)+36>>2]&127](d)|0:d=e[D>>2]|0,(d|0)!=-1){if(k)break;P=76;break}else{e[o>>2]=0,P=74;break}else P=74;while(!1);return(P|0)==74&&k&&(P=76),(P|0)==76&&(e[c>>2]=e[c>>2]|2),b=O,C|0}function Mc(t){t=t|0}function _c(t){t=t|0,he(t)}function Pc(t){return t=t|0,2}function Lc(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0;return d=b,b=b+16|0,w=d+12|0,C=d+8|0,k=d+4|0,D=d,e[k>>2]=e[r>>2],e[D>>2]=e[o>>2],e[C>>2]=e[k>>2],e[w>>2]=e[D>>2],t=wi(t,C,w,l,c,h,44788,44820)|0,b=d,t|0}function Oc(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0;return d=b,b=b+16|0,w=d+12|0,C=d+8|0,k=d+4|0,D=d,_=t+8|0,_=Dt[e[(e[_>>2]|0)+20>>2]&127](_)|0,e[k>>2]=e[r>>2],e[D>>2]=e[o>>2],N=S[_>>0]|0,R=(N&1)==0,o=_+4|0,r=R?o:e[_+8>>2]|0,o=r+((R?(N&255)>>>1:e[o>>2]|0)<<2)|0,e[C>>2]=e[k>>2],e[w>>2]=e[D>>2],t=wi(t,C,w,l,c,h,r,o)|0,b=d,t|0}function $c(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0;if(D=b,b=b+16|0,w=D+8|0,d=D+4|0,C=D,l=f0(l)|0,e[d>>2]=l,g=0,d=be(37,d|0,44212)|0,k=g,g=0,k&1)k=j()|0,Bt(l)|0,le(k|0);else return Bt(l)|0,e[C>>2]=e[o>>2],e[w>>2]=e[C>>2],Ds(t,h+24|0,r,w,c,d),b=D,e[r>>2]|0;return 0}function Ds(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0;d=b,b=b+16|0,w=d+4|0,C=d,t=t+8|0,t=Dt[e[e[t>>2]>>2]&127](t)|0,e[C>>2]=e[l>>2],e[w>>2]=e[C>>2],o=(An(o,w,t,t+168|0,h,c,0)|0)-t|0,(o|0)<168&&(e[r>>2]=((o|0)/12|0|0)%7|0),b=d}function Bc(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0;if(D=b,b=b+16|0,w=D+8|0,d=D+4|0,C=D,l=f0(l)|0,e[d>>2]=l,g=0,d=be(37,d|0,44212)|0,k=g,g=0,k&1)k=j()|0,Bt(l)|0,le(k|0);else return Bt(l)|0,e[C>>2]=e[o>>2],e[w>>2]=e[C>>2],bs(t,h+16|0,r,w,c,d),b=D,e[r>>2]|0;return 0}function bs(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0;d=b,b=b+16|0,w=d+4|0,C=d,t=t+8|0,t=Dt[e[(e[t>>2]|0)+4>>2]&127](t)|0,e[C>>2]=e[l>>2],e[w>>2]=e[C>>2],o=(An(o,w,t,t+288|0,h,c,0)|0)-t|0,(o|0)<288&&(e[r>>2]=((o|0)/12|0|0)%12|0),b=d}function Vc(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0;if(D=b,b=b+16|0,w=D+8|0,d=D+4|0,C=D,l=f0(l)|0,e[d>>2]=l,g=0,d=be(37,d|0,44212)|0,k=g,g=0,k&1)k=j()|0,Bt(l)|0,le(k|0);else return Bt(l)|0,e[C>>2]=e[o>>2],e[w>>2]=e[C>>2],Ns(t,h+20|0,r,w,c,d),b=D,e[r>>2]|0;return 0}function Ns(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0;d=b,b=b+16|0,t=d+4|0,w=d,e[w>>2]=e[l>>2],e[t>>2]=e[w>>2],t=hi(o,t,c,h,4)|0,e[c>>2]&4||((t|0)<69?t=t+2e3|0:t=(t+-69|0)>>>0<31?t+1900|0:t,e[r>>2]=t+-1900),b=d}function Uc(t,r,o,l,c,h,d,w){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0,w=w|0;var C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0,ce=0,ke=0,Ee=0,Te=0,it=0,jt=0,Gt=0,s0=0,i0=0,zt=0,gt=0,Kt=0,dt=0,At=0,y0=0,T0=0,g0=0,Oe=0,yt=0,qt=0;Oe=b,b=b+144|0,C=Oe+132|0,w=Oe+116|0,gt=Oe+128|0,P=Oe+124|0,jt=Oe+120|0,Kt=Oe+112|0,dt=Oe+108|0,At=Oe+104|0,y0=Oe+100|0,T0=Oe+96|0,g0=Oe+92|0,D=Oe+88|0,k=Oe+84|0,N=Oe+80|0,R=Oe+76|0,_=Oe+72|0,U=Oe+68|0,H=Oe+64|0,K=Oe+60|0,G=Oe+56|0,$=Oe+52|0,O=Oe+48|0,Z=Oe+44|0,ie=Oe+40|0,oe=Oe+36|0,ne=Oe+32|0,ce=Oe+28|0,ke=Oe+24|0,Ee=Oe+20|0,Te=Oe+16|0,it=Oe+12|0,Gt=Oe+8|0,s0=Oe+4|0,i0=Oe,e[c>>2]=0,zt=f0(l)|0,e[gt>>2]=zt,g=0,gt=be(37,gt|0,44212)|0,qt=g,g=0,qt&1&&(qt=j()|0,Bt(zt)|0,le(qt|0)),Bt(zt)|0;do switch(d<<24>>24|0){case 65:case 97:{e[P>>2]=e[o>>2],e[C>>2]=e[P>>2],Ds(t,h+24|0,r,C,c,gt),yt=28;break}case 104:case 66:case 98:{e[jt>>2]=e[o>>2],e[C>>2]=e[jt>>2],bs(t,h+16|0,r,C,c,gt),yt=28;break}case 99:{qt=t+8|0,qt=Dt[e[(e[qt>>2]|0)+12>>2]&127](qt)|0,e[Kt>>2]=e[r>>2],e[dt>>2]=e[o>>2],d=S[qt>>0]|0,o=(d&1)==0,yt=qt+4|0,qt=o?yt:e[qt+8>>2]|0,yt=qt+((o?(d&255)>>>1:e[yt>>2]|0)<<2)|0,e[w>>2]=e[Kt>>2],e[C>>2]=e[dt>>2],yt=wi(t,w,C,l,c,h,qt,yt)|0,e[r>>2]=yt,yt=28;break}case 101:case 100:{e[At>>2]=e[o>>2],e[C>>2]=e[At>>2],zc(t,h+12|0,r,C,c,gt),yt=28;break}case 68:{e[y0>>2]=e[r>>2],e[T0>>2]=e[o>>2],e[w>>2]=e[y0>>2],e[C>>2]=e[T0>>2],yt=wi(t,w,C,l,c,h,44820,44852)|0,e[r>>2]=yt,yt=28;break}case 70:{e[g0>>2]=e[r>>2],e[D>>2]=e[o>>2],e[w>>2]=e[g0>>2],e[C>>2]=e[D>>2],yt=wi(t,w,C,l,c,h,44852,44884)|0,e[r>>2]=yt,yt=28;break}case 72:{e[k>>2]=e[o>>2],e[C>>2]=e[k>>2],Gc(t,h+8|0,r,C,c,gt),yt=28;break}case 73:{e[N>>2]=e[o>>2],e[C>>2]=e[N>>2],qc(t,h+8|0,r,C,c,gt),yt=28;break}case 106:{e[R>>2]=e[o>>2],e[C>>2]=e[R>>2],Wc(t,h+28|0,r,C,c,gt),yt=28;break}case 109:{e[_>>2]=e[o>>2],e[C>>2]=e[_>>2],Hc(t,h+16|0,r,C,c,gt),yt=28;break}case 77:{e[U>>2]=e[o>>2],e[C>>2]=e[U>>2],Qc(t,h+4|0,r,C,c,gt),yt=28;break}case 116:case 110:{e[H>>2]=e[o>>2],e[C>>2]=e[H>>2],Kc(t,r,C,c,gt),yt=28;break}case 112:{e[K>>2]=e[o>>2],e[C>>2]=e[K>>2],Yc(t,h+8|0,r,C,c,gt),yt=28;break}case 114:{e[G>>2]=e[r>>2],e[$>>2]=e[o>>2],e[w>>2]=e[G>>2],e[C>>2]=e[$>>2],yt=wi(t,w,C,l,c,h,44884,44928)|0,e[r>>2]=yt,yt=28;break}case 82:{e[O>>2]=e[r>>2],e[Z>>2]=e[o>>2],e[w>>2]=e[O>>2],e[C>>2]=e[Z>>2],yt=wi(t,w,C,l,c,h,44928,44948)|0,e[r>>2]=yt,yt=28;break}case 83:{e[ie>>2]=e[o>>2],e[C>>2]=e[ie>>2],jc(t,h,r,C,c,gt),yt=28;break}case 84:{e[oe>>2]=e[r>>2],e[ne>>2]=e[o>>2],e[w>>2]=e[oe>>2],e[C>>2]=e[ne>>2],yt=wi(t,w,C,l,c,h,44948,44980)|0,e[r>>2]=yt,yt=28;break}case 119:{e[ce>>2]=e[o>>2],e[C>>2]=e[ce>>2],Xc(t,h+24|0,r,C,c,gt),yt=28;break}case 120:{qt=e[(e[t>>2]|0)+20>>2]|0,e[ke>>2]=e[r>>2],e[Ee>>2]=e[o>>2],e[w>>2]=e[ke>>2],e[C>>2]=e[Ee>>2],w=on[qt&63](t,w,C,l,c,h)|0;break}case 88:{qt=t+8|0,qt=Dt[e[(e[qt>>2]|0)+24>>2]&127](qt)|0,e[Te>>2]=e[r>>2],e[it>>2]=e[o>>2],d=S[qt>>0]|0,o=(d&1)==0,yt=qt+4|0,qt=o?yt:e[qt+8>>2]|0,yt=qt+((o?(d&255)>>>1:e[yt>>2]|0)<<2)|0,e[w>>2]=e[Te>>2],e[C>>2]=e[it>>2],yt=wi(t,w,C,l,c,h,qt,yt)|0,e[r>>2]=yt,yt=28;break}case 121:{e[Gt>>2]=e[o>>2],e[C>>2]=e[Gt>>2],Ns(t,h+20|0,r,C,c,gt),yt=28;break}case 89:{e[s0>>2]=e[o>>2],e[C>>2]=e[s0>>2],Zc(t,h+20|0,r,C,c,gt),yt=28;break}case 37:{e[i0>>2]=e[o>>2],e[C>>2]=e[i0>>2],Jc(t,r,C,c,gt),yt=28;break}default:e[c>>2]=e[c>>2]|4,yt=28}while(!1);return(yt|0)==28&&(w=e[r>>2]|0),b=Oe,w|0}function zc(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0;d=b,b=b+16|0,t=d+4|0,w=d,e[w>>2]=e[l>>2],e[t>>2]=e[w>>2],t=hi(o,t,c,h,2)|0,o=e[c>>2]|0,(t+-1|0)>>>0<31&(o&4|0)==0?e[r>>2]=t:e[c>>2]=o|4,b=d}function Gc(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0;d=b,b=b+16|0,t=d+4|0,w=d,e[w>>2]=e[l>>2],e[t>>2]=e[w>>2],t=hi(o,t,c,h,2)|0,o=e[c>>2]|0,(t|0)<24&(o&4|0)==0?e[r>>2]=t:e[c>>2]=o|4,b=d}function qc(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0;d=b,b=b+16|0,t=d+4|0,w=d,e[w>>2]=e[l>>2],e[t>>2]=e[w>>2],t=hi(o,t,c,h,2)|0,o=e[c>>2]|0,(t+-1|0)>>>0<12&(o&4|0)==0?e[r>>2]=t:e[c>>2]=o|4,b=d}function Wc(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0;d=b,b=b+16|0,t=d+4|0,w=d,e[w>>2]=e[l>>2],e[t>>2]=e[w>>2],t=hi(o,t,c,h,3)|0,o=e[c>>2]|0,(t|0)<366&(o&4|0)==0?e[r>>2]=t:e[c>>2]=o|4,b=d}function Hc(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0;d=b,b=b+16|0,t=d+4|0,w=d,e[w>>2]=e[l>>2],e[t>>2]=e[w>>2],t=hi(o,t,c,h,2)|0,o=e[c>>2]|0,(t|0)<13&(o&4|0)==0?e[r>>2]=t+-1:e[c>>2]=o|4,b=d}function Qc(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0;d=b,b=b+16|0,t=d+4|0,w=d,e[w>>2]=e[l>>2],e[t>>2]=e[w>>2],t=hi(o,t,c,h,2)|0,o=e[c>>2]|0,(t|0)<60&(o&4|0)==0?e[r>>2]=t:e[c>>2]=o|4,b=d}function Kc(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0;e:for(;;){t=e[r>>2]|0;do if(t)if(h=e[t+12>>2]|0,(h|0)==(e[t+16>>2]|0)?t=Dt[e[(e[t>>2]|0)+36>>2]&127](t)|0:t=e[h>>2]|0,(t|0)==-1){e[r>>2]=0,d=1;break}else{d=(e[r>>2]|0)==0;break}else d=1;while(!1);h=e[o>>2]|0;do if(h)if(t=e[h+12>>2]|0,(t|0)==(e[h+16>>2]|0)?t=Dt[e[(e[h>>2]|0)+36>>2]&127](h)|0:t=e[t>>2]|0,(t|0)!=-1)if(d){d=h;break}else{d=h;break e}else{e[o>>2]=0,w=15;break}else w=15;while(!1);if((w|0)==15)if(w=0,d){d=0;break}else d=0;if(t=e[r>>2]|0,h=e[t+12>>2]|0,(h|0)==(e[t+16>>2]|0)?t=Dt[e[(e[t>>2]|0)+36>>2]&127](t)|0:t=e[h>>2]|0,!(Yt[e[(e[c>>2]|0)+12>>2]&63](c,8192,t)|0))break;if(t=e[r>>2]|0,h=t+12|0,d=e[h>>2]|0,(d|0)==(e[t+16>>2]|0)){Dt[e[(e[t>>2]|0)+40>>2]&127](t)|0;continue}else{e[h>>2]=d+4;continue}}t=e[r>>2]|0;do if(t)if(h=e[t+12>>2]|0,(h|0)==(e[t+16>>2]|0)?t=Dt[e[(e[t>>2]|0)+36>>2]&127](t)|0:t=e[h>>2]|0,(t|0)==-1){e[r>>2]=0,h=1;break}else{h=(e[r>>2]|0)==0;break}else h=1;while(!1);do if(d)if(t=e[d+12>>2]|0,(t|0)==(e[d+16>>2]|0)?t=Dt[e[(e[d>>2]|0)+36>>2]&127](d)|0:t=e[t>>2]|0,(t|0)!=-1){if(h)break;w=39;break}else{e[o>>2]=0,w=37;break}else w=37;while(!1);(w|0)==37&&h&&(w=39),(w|0)==39&&(e[l>>2]=e[l>>2]|2)}function Yc(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0;k=b,b=b+16|0,w=k+4|0,C=k,D=t+8|0,D=Dt[e[(e[D>>2]|0)+8>>2]&127](D)|0,t=S[D>>0]|0,t&1?d=e[D+4>>2]|0:d=(t&255)>>>1,t=S[D+12>>0]|0,t&1?t=e[D+16>>2]|0:t=(t&255)>>>1;do if((d|0)!=(0-t|0)){if(e[C>>2]=e[l>>2],e[w>>2]=e[C>>2],t=An(o,w,D,D+24|0,h,c,0)|0,d=e[r>>2]|0,(t|0)==(D|0)&(d|0)==12){e[r>>2]=0;break}(d|0)<12&(t-D|0)==12&&(e[r>>2]=d+12)}else e[c>>2]=e[c>>2]|4;while(!1);b=k}function jc(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0;d=b,b=b+16|0,t=d+4|0,w=d,e[w>>2]=e[l>>2],e[t>>2]=e[w>>2],t=hi(o,t,c,h,2)|0,o=e[c>>2]|0,(t|0)<61&(o&4|0)==0?e[r>>2]=t:e[c>>2]=o|4,b=d}function Xc(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0;d=b,b=b+16|0,t=d+4|0,w=d,e[w>>2]=e[l>>2],e[t>>2]=e[w>>2],t=hi(o,t,c,h,1)|0,o=e[c>>2]|0,(t|0)<7&(o&4|0)==0?e[r>>2]=t:e[c>>2]=o|4,b=d}function Zc(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0;d=b,b=b+16|0,t=d+4|0,w=d,e[w>>2]=e[l>>2],e[t>>2]=e[w>>2],t=hi(o,t,c,h,4)|0,e[c>>2]&4||(e[r>>2]=t+-1900),b=d}function Jc(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0;t=e[r>>2]|0;do if(t)if(h=e[t+12>>2]|0,(h|0)==(e[t+16>>2]|0)?t=Dt[e[(e[t>>2]|0)+36>>2]&127](t)|0:t=e[h>>2]|0,(t|0)==-1){e[r>>2]=0,d=1;break}else{d=(e[r>>2]|0)==0;break}else d=1;while(!1);h=e[o>>2]|0;do if(h)if(t=e[h+12>>2]|0,(t|0)==(e[h+16>>2]|0)?t=Dt[e[(e[h>>2]|0)+36>>2]&127](h)|0:t=e[t>>2]|0,(t|0)!=-1)if(d){w=h,C=17;break}else{C=16;break}else{e[o>>2]=0,C=14;break}else C=14;while(!1);(C|0)==14&&(d?C=16:(w=0,C=17));e:do if((C|0)==16)e[l>>2]=e[l>>2]|6;else if((C|0)==17){if(t=e[r>>2]|0,h=e[t+12>>2]|0,(h|0)==(e[t+16>>2]|0)?t=Dt[e[(e[t>>2]|0)+36>>2]&127](t)|0:t=e[h>>2]|0,(Yt[e[(e[c>>2]|0)+52>>2]&63](c,t,0)|0)<<24>>24!=37){e[l>>2]=e[l>>2]|4;break}t=e[r>>2]|0,h=t+12|0,d=e[h>>2]|0,(d|0)==(e[t+16>>2]|0)?(Dt[e[(e[t>>2]|0)+40>>2]&127](t)|0,t=e[r>>2]|0,t?C=25:h=1):(e[h>>2]=d+4,C=25);do if((C|0)==25)if(h=e[t+12>>2]|0,(h|0)==(e[t+16>>2]|0)?t=Dt[e[(e[t>>2]|0)+36>>2]&127](t)|0:t=e[h>>2]|0,(t|0)==-1){e[r>>2]=0,h=1;break}else{h=(e[r>>2]|0)==0;break}while(!1);do if(w)if(t=e[w+12>>2]|0,(t|0)==(e[w+16>>2]|0)?t=Dt[e[(e[w>>2]|0)+36>>2]&127](w)|0:t=e[t>>2]|0,(t|0)!=-1){if(h)break e;break}else{e[o>>2]=0,C=37;break}else C=37;while(!1);if((C|0)==37&&!h)break;e[l>>2]=e[l>>2]|2}while(!1)}function ef(t){t=t|0,cn(t+8|0)}function cn(t){t=t|0;var r=0,o=0,l=0;r=e[t>>2]|0,g=0,o=Ce(3)|0,l=g,g=0;do if(!(l&1)){if((r|0)!=(o|0)&&(g=0,ue(188,e[t>>2]|0),l=g,g=0,l&1))break;return}while(!1);l=j(0)|0,$t(l)}function tf(t){t=t|0,cn(t+8|0),he(t)}function nf(t,r,o,l,c,h,d){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0;var w=0,C=0;if(C=b,b=b+112|0,w=C+4|0,o=C,e[o>>2]=w+100,Fs(t+8|0,w,o,c,h,d),c=e[o>>2]|0,o=e[r>>2]|0,(w|0)!=(c|0))do{d=S[w>>0]|0;do if(o)if(l=o+24|0,h=e[l>>2]|0,(h|0)==(e[o+28>>2]|0)){r=(U0[e[(e[o>>2]|0)+52>>2]&63](o,d&255)|0)==-1,o=r?0:o;break}else{e[l>>2]=h+1,S[h>>0]=d;break}else o=0;while(!1);w=w+1|0}while((w|0)!=(c|0));return b=C,o|0}function Fs(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0;D=b,b=b+16|0,C=D,S[C>>0]=37,d=C+1|0,S[d>>0]=c,w=C+2|0,S[w>>0]=h,S[C+3>>0]=0,h<<24>>24&&(S[d>>0]=h,S[w>>0]=c),t=r+(Go(r|0,(e[o>>2]|0)-r|0,C|0,l|0,e[t>>2]|0)|0)|0,e[o>>2]=t,b=D}function rf(t){t=t|0,cn(t+8|0)}function sf(t){t=t|0,cn(t+8|0),he(t)}function of(t,r,o,l,c,h,d){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0;var w=0;if(w=b,b=b+416|0,l=w+8|0,o=w,e[o>>2]=l+400,af(t+8|0,l,o,c,h,d),t=e[o>>2]|0,o=e[r>>2]|0,(l|0)!=(t|0)){c=l;do l=e[c>>2]|0,o?(h=o+24|0,d=e[h>>2]|0,(d|0)==(e[o+28>>2]|0)?l=U0[e[(e[o>>2]|0)+52>>2]&63](o,l)|0:(e[h>>2]=d+4,e[d>>2]=l),o=(l|0)==-1?0:o):o=0,c=c+4|0;while((c|0)!=(t|0))}return b=w,o|0}function af(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0;if(d=b,b=b+128|0,D=d+16|0,k=d+12|0,w=d,C=d+8|0,e[k>>2]=D+100,Fs(t,D,k,l,c,h),c=w,e[c>>2]=0,e[c+4>>2]=0,e[C>>2]=D,c=(e[o>>2]|0)-r>>2,h=ai(e[t>>2]|0)|0,g=0,c=Pe(18,r|0,C|0,c|0,w|0)|0,t=g,g=0,t&1&&(c=j()|0,h|0&&(g=0,ge(75,h|0)|0,k=g,g=0,k&1)&&(k=j(0)|0,$t(k)),le(c|0)),h|0&&(g=0,ge(75,h|0)|0,k=g,g=0,k&1)&&(k=j(0)|0,$t(k)),(c|0)==-1)fn(58955);else{e[o>>2]=r+(c<<2),b=d;return}}function lf(t){t=t|0}function uf(t){t=t|0,he(t)}function cf(t){return t=t|0,127}function ff(t){return t=t|0,127}function hf(t,r){t=t|0,r=r|0,e[t>>2]=0,e[t+4>>2]=0,e[t+8>>2]=0}function df(t,r){t=t|0,r=r|0,e[t>>2]=0,e[t+4>>2]=0,e[t+8>>2]=0}function pf(t,r){t=t|0,r=r|0,e[t>>2]=0,e[t+4>>2]=0,e[t+8>>2]=0}function mf(t,r){t=t|0,r=r|0,dr(t,1,45)}function gf(t){return t=t|0,0}function Sf(t,r){t=t|0,r=r|0,S[t>>0]=2,S[t+1>>0]=3,S[t+2>>0]=0,S[t+3>>0]=4}function Af(t,r){t=t|0,r=r|0,S[t>>0]=2,S[t+1>>0]=3,S[t+2>>0]=0,S[t+3>>0]=4}function vf(t){t=t|0}function xf(t){t=t|0,he(t)}function wf(t){return t=t|0,127}function yf(t){return t=t|0,127}function Cf(t,r){t=t|0,r=r|0,e[t>>2]=0,e[t+4>>2]=0,e[t+8>>2]=0}function Tf(t,r){t=t|0,r=r|0,e[t>>2]=0,e[t+4>>2]=0,e[t+8>>2]=0}function If(t,r){t=t|0,r=r|0,e[t>>2]=0,e[t+4>>2]=0,e[t+8>>2]=0}function Ef(t,r){t=t|0,r=r|0,dr(t,1,45)}function kf(t){return t=t|0,0}function Df(t,r){t=t|0,r=r|0,S[t>>0]=2,S[t+1>>0]=3,S[t+2>>0]=0,S[t+3>>0]=4}function bf(t,r){t=t|0,r=r|0,S[t>>0]=2,S[t+1>>0]=3,S[t+2>>0]=0,S[t+3>>0]=4}function Nf(t){t=t|0}function Ff(t){t=t|0,he(t)}function Rf(t){return t=t|0,2147483647}function Mf(t){return t=t|0,2147483647}function _f(t,r){t=t|0,r=r|0,e[t>>2]=0,e[t+4>>2]=0,e[t+8>>2]=0}function Pf(t,r){t=t|0,r=r|0,e[t>>2]=0,e[t+4>>2]=0,e[t+8>>2]=0}function Lf(t,r){t=t|0,r=r|0,e[t>>2]=0,e[t+4>>2]=0,e[t+8>>2]=0}function Of(t,r){t=t|0,r=r|0,gr(t,1,45)}function $f(t){return t=t|0,0}function Bf(t,r){t=t|0,r=r|0,S[t>>0]=2,S[t+1>>0]=3,S[t+2>>0]=0,S[t+3>>0]=4}function Vf(t,r){t=t|0,r=r|0,S[t>>0]=2,S[t+1>>0]=3,S[t+2>>0]=0,S[t+3>>0]=4}function Uf(t){t=t|0}function zf(t){t=t|0,he(t)}function Gf(t){return t=t|0,2147483647}function qf(t){return t=t|0,2147483647}function Wf(t,r){t=t|0,r=r|0,e[t>>2]=0,e[t+4>>2]=0,e[t+8>>2]=0}function Hf(t,r){t=t|0,r=r|0,e[t>>2]=0,e[t+4>>2]=0,e[t+8>>2]=0}function Qf(t,r){t=t|0,r=r|0,e[t>>2]=0,e[t+4>>2]=0,e[t+8>>2]=0}function Kf(t,r){t=t|0,r=r|0,gr(t,1,45)}function Yf(t){return t=t|0,0}function jf(t,r){t=t|0,r=r|0,S[t>>0]=2,S[t+1>>0]=3,S[t+2>>0]=0,S[t+3>>0]=4}function Xf(t,r){t=t|0,r=r|0,S[t>>0]=2,S[t+1>>0]=3,S[t+2>>0]=0,S[t+3>>0]=4}function Zf(t){t=t|0}function Jf(t){t=t|0,he(t)}function eh(t,r,o,l,c,h,d){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0;var w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0,ce=0,ke=0,Ee=0,Te=0;if(oe=b,b=b+240|0,Z=oe+24|0,ie=oe,t=oe+136|0,ce=oe+16|0,O=oe+12|0,ne=oe+8|0,N=oe+134|0,C=oe+4|0,P=oe+124|0,e[ce>>2]=t,ke=ce+4|0,e[ke>>2]=189,D=t+100|0,g=0,w=ge(68,c|0)|0,$=g,g=0,$&1)C=j()|0,e[ce>>2]=0,w=189,Te=45;else{e[ne>>2]=w,g=0,t=be(37,ne|0,44220)|0,$=g,g=0;e:do if(!($&1)&&(S[N>>0]=0,e[C>>2]=e[o>>2],k=e[c+4>>2]|0,g=0,e[Z>>2]=e[C>>2],k=Ut(1,r|0,Z|0,l|0,ne|0,k|0,h|0,N|0,t|0,ce|0,O|0,D|0)|0,$=g,g=0,!($&1))){t:do if(k){if(g=0,Pe(e[(e[t>>2]|0)+32>>2]|0,t|0,58976,58986,P|0)|0,$=g,g=0,$&1){Te=10;break e}C=e[O>>2]|0,D=e[ce>>2]|0,t=C-D|0,(t|0)>98?(t=E0(t+2|0)|0,w=t,t?Te=13:(g=0,Nt(6),$=g,g=0,$&1||(t=0,Te=13))):(w=0,t=Z,Te=13);do if((Te|0)==13){if(S[N>>0]|0&&(S[t>>0]=45,t=t+1|0),G=P+10|0,$=P,D>>>0>>0){k=P+1|0,l=k+1|0,c=l+1|0,N=c+1|0,R=N+1|0,_=R+1|0,U=_+1|0,H=U+1|0,K=H+1|0;do{C=S[D>>0]|0;do if((S[P>>0]|0)!=C<<24>>24)if((S[k>>0]|0)!=C<<24>>24)if((S[l>>0]|0)!=C<<24>>24)if((S[c>>0]|0)!=C<<24>>24)if((S[N>>0]|0)==C<<24>>24)C=N;else{if((S[R>>0]|0)==C<<24>>24){C=R;break}if((S[_>>0]|0)==C<<24>>24){C=_;break}if((S[U>>0]|0)==C<<24>>24){C=U;break}if((S[H>>0]|0)==C<<24>>24){C=H;break}C=(S[K>>0]|0)==C<<24>>24?K:G}else C=c;else C=l;else C=k;else C=P;while(!1);S[t>>0]=S[58976+(C-$)>>0]|0,D=D+1|0,t=t+1|0}while(D>>>0<(e[O>>2]|0)>>>0)}if(S[t>>0]=0,e[ie>>2]=d,(_o(Z,58987,ie)|0)!=1&&(g=0,ue(190,58991),d=g,g=0,d&1))break;w&&n0(w);break t}while(!1);if(t=j()|0,!w){C=t,w=ce;break e}n0(w),C=t,w=ce;break e}while(!1);t=e[r>>2]|0;do if(t){if((e[t+12>>2]|0)==(e[t+16>>2]|0)){if(g=0,t=ge(e[(e[t>>2]|0)+36>>2]|0,t|0)|0,d=g,g=0,d&1){Te=10;break e}if((t|0)==-1){e[r>>2]=0,t=0;break}else{t=e[r>>2]|0;break}}}else t=0;while(!1);w=(t|0)==0,t=e[o>>2]|0;do if(t){if((e[t+12>>2]|0)==(e[t+16>>2]|0)){if(g=0,t=ge(e[(e[t>>2]|0)+36>>2]|0,t|0)|0,d=g,g=0,d&1){Te=10;break e}if((t|0)==-1){e[o>>2]=0,Te=37;break}}w||(Te=38)}else Te=37;while(!1);return(Te|0)==37&&w&&(Te=38),(Te|0)==38&&(e[h>>2]=e[h>>2]|2),w=e[r>>2]|0,Bt(e[ne>>2]|0)|0,t=e[ce>>2]|0,e[ce>>2]=0,t|0&&(g=0,ue(e[ke>>2]|0,t|0),Te=g,g=0,Te&1)&&(Te=j(0)|0,$t(Te)),b=oe,w|0}else Te=10;while(!1);(Te|0)==10&&(C=j()|0,w=ce),Bt(e[ne>>2]|0)|0,t=e[w>>2]|0,e[w>>2]=0,t?(w=e[ke>>2]|0,Te=45):Ee=C}return(Te|0)==45&&(g=0,ue(w|0,t|0),Te=g,g=0,Te&1?(Te=j(0)|0,$t(Te)):Ee=C),le(Ee|0),0}function th(t){t=t|0}function ih(t,r,o,l,c,h,d,w,C,D,k){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0,w=w|0,C=C|0,D=D|0,k=k|0;var N=0,R=0,_=0,U=0,H=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0,ce=0,ke=0,Ee=0,Te=0,it=0,jt=0,Gt=0,s0=0,i0=0,zt=0,gt=0,Kt=0,dt=0,At=0,y0=0,T0=0,g0=0,Oe=0,yt=0,qt=0,c0=0,a0=0,h0=0,D0=0,A0=0,Ti=0,F0=0;A0=b,b=b+512|0,gt=A0+88|0,U=A0+96|0,F0=A0+80|0,y0=A0+72|0,At=A0+68|0,T0=A0+500|0,Kt=A0+497|0,g0=A0+496|0,qt=A0+56|0,D0=A0+44|0,a0=A0+32|0,c0=A0+20|0,h0=A0+8|0,dt=A0+4|0,yt=A0,e[gt>>2]=k,e[F0>>2]=U,Ti=F0+4|0,e[Ti>>2]=189,e[y0>>2]=U,e[At>>2]=U+400,e[qt>>2]=0,e[qt+4>>2]=0,e[qt+8>>2]=0,e[D0>>2]=0,e[D0+4>>2]=0,e[D0+8>>2]=0,e[a0>>2]=0,e[a0+4>>2]=0,e[a0+8>>2]=0,e[c0>>2]=0,e[c0+4>>2]=0,e[c0+8>>2]=0,e[h0>>2]=0,e[h0+4>>2]=0,e[h0+8>>2]=0,g=0,I0(1,o|0,l|0,T0|0,Kt|0,g0|0,qt|0,D0|0,a0|0,c0|0,dt|0),zt=g,g=0;e:do if(zt&1)w=j()|0;else{e[D>>2]=e[C>>2],Te=w+8|0,it=a0+4|0,jt=c0+4|0,Gt=c0+8|0,s0=c0+1|0,i0=a0+8|0,zt=a0+1|0,P=(c&512|0)!=0,O=D0+8|0,Z=D0+1|0,ie=D0+4|0,oe=h0+4|0,ne=h0+8|0,ce=h0+1|0,ke=T0+3|0,Ee=qt+4|0,$=0,_=0;t:for(;;){k=e[t>>2]|0;do if(k){if((e[k+12>>2]|0)==(e[k+16>>2]|0)){if(g=0,k=ge(e[(e[k>>2]|0)+36>>2]|0,k|0)|0,G=g,g=0,G&1){Oe=24;break t}if((k|0)==-1){e[t>>2]=0,k=0;break}else{k=e[t>>2]|0;break}}}else k=0;while(!1);k=(k|0)==0,w=e[r>>2]|0;do if(w){if((e[w+12>>2]|0)!=(e[w+16>>2]|0))if(k){G=w;break}else{Oe=235;break t}if(g=0,o=ge(e[(e[w>>2]|0)+36>>2]|0,w|0)|0,G=g,g=0,G&1){Oe=24;break t}if((o|0)!=-1)if(k){G=w;break}else{Oe=235;break t}else{e[r>>2]=0,Oe=15;break}}else Oe=15;while(!1);if((Oe|0)==15)if(Oe=0,k){Oe=235;break}else G=0;i:do switch(S[T0+$>>0]|0){case 1:{if(($|0)!=3){if(k=e[t>>2]|0,w=e[k+12>>2]|0,(w|0)==(e[k+16>>2]|0)){if(g=0,k=ge(e[(e[k>>2]|0)+36>>2]|0,k|0)|0,Oe=g,g=0,Oe&1){Oe=24;break t}}else k=F[w>>0]|0;if((k&255)<<24>>24<=-1){Oe=40;break t}if(!(I[(e[Te>>2]|0)+(k<<24>>24<<1)>>1]&8192)){Oe=40;break t}if(k=e[t>>2]|0,w=k+12|0,o=e[w>>2]|0,(o|0)==(e[k+16>>2]|0)){if(g=0,k=ge(e[(e[k>>2]|0)+40>>2]|0,k|0)|0,Oe=g,g=0,Oe&1){Oe=24;break t}}else e[w>>2]=o+1,k=F[o>>0]|0;if(g=0,Ae(67,h0|0,k&255|0),Oe=g,g=0,Oe&1){Oe=24;break t}else k=G,l=G,Oe=42}break}case 0:{($|0)!=3&&(k=G,l=G,Oe=42);break}case 3:{if(w=S[a0>>0]|0,k=w&1?e[it>>2]|0:(w&255)>>>1,o=S[c0>>0]|0,l=o&1?e[jt>>2]|0:(o&255)>>>1,(k|0)!=(0-l|0)){if(!k){if(k=e[t>>2]|0,w=e[k+12>>2]|0,(w|0)==(e[k+16>>2]|0)){if(g=0,k=ge(e[(e[k>>2]|0)+36>>2]|0,k|0)|0,G=g,g=0,G&1){Oe=24;break t}w=S[c0>>0]|0}else k=F[w>>0]|0,w=o;if((k&255)<<24>>24!=(S[(w&1?e[Gt>>2]|0:s0)>>0]|0))break i;if(k=e[t>>2]|0,w=k+12|0,o=e[w>>2]|0,(o|0)==(e[k+16>>2]|0)){if(g=0,ge(e[(e[k>>2]|0)+40>>2]|0,k|0)|0,G=g,g=0,G&1){Oe=24;break t}}else e[w>>2]=o+1;S[d>>0]=1,G=S[c0>>0]|0,_=(G&1?e[jt>>2]|0:(G&255)>>>1)>>>0>1?c0:_;break i}if(c=e[t>>2]|0,N=e[c+12>>2]|0,o=e[c+16>>2]|0,k=(N|0)==(o|0),!l){if(k){if(g=0,k=ge(e[(e[c>>2]|0)+36>>2]|0,c|0)|0,G=g,g=0,G&1){Oe=24;break t}w=S[a0>>0]|0}else k=F[N>>0]|0;if((k&255)<<24>>24!=(S[(w&1?e[i0>>2]|0:zt)>>0]|0)){S[d>>0]=1;break i}if(k=e[t>>2]|0,w=k+12|0,o=e[w>>2]|0,(o|0)==(e[k+16>>2]|0)){if(g=0,ge(e[(e[k>>2]|0)+40>>2]|0,k|0)|0,G=g,g=0,G&1){Oe=24;break t}}else e[w>>2]=o+1;G=S[a0>>0]|0,_=(G&1?e[it>>2]|0:(G&255)>>>1)>>>0>1?a0:_;break i}if(k){if(g=0,k=ge(e[(e[c>>2]|0)+36>>2]|0,c|0)|0,G=g,g=0,G&1){Oe=24;break t}o=e[t>>2]|0,w=S[a0>>0]|0,c=o,N=e[o+12>>2]|0,o=e[o+16>>2]|0}else k=F[N>>0]|0;if(l=c+12|0,o=(N|0)==(o|0),(k&255)<<24>>24==(S[(w&1?e[i0>>2]|0:zt)>>0]|0)){if(o){if(g=0,ge(e[(e[c>>2]|0)+40>>2]|0,c|0)|0,G=g,g=0,G&1){Oe=24;break t}}else e[l>>2]=N+1;G=S[a0>>0]|0,_=(G&1?e[it>>2]|0:(G&255)>>>1)>>>0>1?a0:_;break i}if(o){if(g=0,k=ge(e[(e[c>>2]|0)+36>>2]|0,c|0)|0,G=g,g=0,G&1){Oe=24;break t}}else k=F[N>>0]|0;if((k&255)<<24>>24!=(S[(S[c0>>0]&1?e[Gt>>2]|0:s0)>>0]|0)){Oe=104;break t}if(k=e[t>>2]|0,w=k+12|0,o=e[w>>2]|0,(o|0)==(e[k+16>>2]|0)){if(g=0,ge(e[(e[k>>2]|0)+40>>2]|0,k|0)|0,G=g,g=0,G&1){Oe=24;break t}}else e[w>>2]=o+1;S[d>>0]=1,G=S[c0>>0]|0,_=(G&1?e[jt>>2]|0:(G&255)>>>1)>>>0>1?c0:_}break}case 2:{if(!($>>>0<2|(_|0)!=0)&&!(P|($|0)==2&(S[ke>>0]|0)!=0)){_=0;break i}H=S[D0>>0]|0,k=(H&1)==0,K=e[O>>2]|0,o=k?Z:K,R=o;n:do if($|0&&(F[T0+($+-1)>>0]|0)<2){N=k?(H&255)>>>1:e[ie>>2]|0,l=o+N|0,c=e[Te>>2]|0;r:do if(!N)w=R;else{N=o,w=R;do{if(k=S[N>>0]|0,k<<24>>24<=-1||!(I[c+(k<<24>>24<<1)>>1]&8192))break r;N=N+1|0,w=N}while((N|0)!=(l|0))}while(!1);if(l=w-R|0,c=S[h0>>0]|0,k=(c&1)==0,c=k?(c&255)>>>1:e[oe>>2]|0,c>>>0>=l>>>0){if(k=k?ce:e[ne>>2]|0,N=k+c|0,(w|0)!=(R|0))for(k=k+(c-l)|0;;){if((S[k>>0]|0)!=(S[o>>0]|0)){w=R;break n}if(k=k+1|0,(k|0)==(N|0))break;o=o+1|0}}else w=R}else w=R;while(!1);k=(H&1)==0,k=(k?Z:K)+(k?(H&255)>>>1:e[ie>>2]|0)|0;n:do if((w|0)!=(k|0))for(c=G,l=G,k=w;;){w=e[t>>2]|0;do if(w){if((e[w+12>>2]|0)==(e[w+16>>2]|0)){if(g=0,w=ge(e[(e[w>>2]|0)+36>>2]|0,w|0)|0,G=g,g=0,G&1){Oe=21;break t}if((w|0)==-1){e[t>>2]=0,w=0;break}else{w=e[t>>2]|0;break}}}else w=0;while(!1);o=(w|0)==0;do if(l){if((e[l+12>>2]|0)!=(e[l+16>>2]|0))if(o){w=c,N=l;break}else break n;if(g=0,w=ge(e[(e[l>>2]|0)+36>>2]|0,l|0)|0,G=g,g=0,G&1){Oe=21;break t}if((w|0)!=-1)if(o^(c|0)==0){w=c,N=c;break}else break n;else{e[r>>2]=0,w=0,Oe=131;break}}else w=c,Oe=131;while(!1);if((Oe|0)==131){if(Oe=0,o)break n;N=0}if(o=e[t>>2]|0,l=e[o+12>>2]|0,(l|0)==(e[o+16>>2]|0)){if(g=0,o=ge(e[(e[o>>2]|0)+36>>2]|0,o|0)|0,G=g,g=0,G&1){Oe=21;break t}}else o=F[l>>0]|0;if((o&255)<<24>>24!=(S[k>>0]|0))break n;if(o=e[t>>2]|0,l=o+12|0,c=e[l>>2]|0,(c|0)==(e[o+16>>2]|0)){if(g=0,ge(e[(e[o>>2]|0)+40>>2]|0,o|0)|0,G=g,g=0,G&1){Oe=21;break t}}else e[l>>2]=c+1;if(k=k+1|0,o=S[D0>>0]|0,G=(o&1)==0,o=(G?Z:e[O>>2]|0)+(G?(o&255)>>>1:e[ie>>2]|0)|0,(k|0)==(o|0)){k=o;break}else c=w,l=N}while(!1);if(P&&(G=S[D0>>0]|0,K=(G&1)==0,(k|0)!=((K?Z:e[O>>2]|0)+(K?(G&255)>>>1:e[ie>>2]|0)|0))){Oe=143;break t}break}case 4:{R=S[g0>>0]|0,w=G,c=G,k=0;n:for(;;){o=e[t>>2]|0;do if(o){if((e[o+12>>2]|0)==(e[o+16>>2]|0)){if(g=0,o=ge(e[(e[o>>2]|0)+36>>2]|0,o|0)|0,G=g,g=0,G&1){Oe=23;break t}if((o|0)==-1){e[t>>2]=0,o=0;break}else{o=e[t>>2]|0;break}}}else o=0;while(!1);l=(o|0)==0;do if(c){if((e[c+12>>2]|0)!=(e[c+16>>2]|0))if(l){N=w;break}else{l=w;break n}if(g=0,o=ge(e[(e[c>>2]|0)+36>>2]|0,c|0)|0,G=g,g=0,G&1){Oe=23;break t}if((o|0)!=-1)if(l^(w|0)==0){N=w,c=w;break}else{l=w;break n}else{e[r>>2]=0,w=0,Oe=156;break}}else Oe=156;while(!1);if((Oe|0)==156)if(Oe=0,l){l=w;break}else N=w,c=0;if(w=e[t>>2]|0,o=e[w+12>>2]|0,(o|0)==(e[w+16>>2]|0)){if(g=0,w=ge(e[(e[w>>2]|0)+36>>2]|0,w|0)|0,G=g,g=0,G&1){Oe=23;break t}}else w=F[o>>0]|0;if(o=w&255,o<<24>>24>-1&&I[(e[Te>>2]|0)+(w<<24>>24<<1)>>1]&2048){if(w=e[D>>2]|0,(w|0)==(e[gt>>2]|0)){if(g=0,xe(12,C|0,D|0,gt|0),G=g,g=0,G&1){Oe=23;break t}w=e[D>>2]|0}e[D>>2]=w+1,S[w>>0]=o,k=k+1|0}else{if(G=S[qt>>0]|0,!(o<<24>>24==R<<24>>24&(k|0?((G&1?e[Ee>>2]|0:(G&255)>>>1)|0)!=0:0))){l=N;break}if((U|0)==(e[At>>2]|0)){if(g=0,xe(13,F0|0,y0|0,At|0),G=g,g=0,G&1){Oe=23;break t}U=e[y0>>2]|0}G=U+4|0,e[y0>>2]=G,e[U>>2]=k,U=G,k=0}if(w=e[t>>2]|0,o=w+12|0,l=e[o>>2]|0,(l|0)==(e[w+16>>2]|0))if(g=0,ge(e[(e[w>>2]|0)+40>>2]|0,w|0)|0,G=g,g=0,G&1){Oe=23;break t}else{w=N;continue}else{e[o>>2]=l+1,w=N;continue}}if(k|0&&(e[F0>>2]|0)!=(U|0)){if((U|0)==(e[At>>2]|0)){if(g=0,xe(13,F0|0,y0|0,At|0),G=g,g=0,G&1){Oe=24;break t}U=e[y0>>2]|0}G=U+4|0,e[y0>>2]=G,e[U>>2]=k,U=G}if(N=e[dt>>2]|0,(N|0)>0){k=e[t>>2]|0;do if(k){if((e[k+12>>2]|0)==(e[k+16>>2]|0)){if(g=0,k=ge(e[(e[k>>2]|0)+36>>2]|0,k|0)|0,G=g,g=0,G&1){Oe=24;break t}if((k|0)==-1){e[t>>2]=0,k=0;break}else{k=e[t>>2]|0;break}}}else k=0;while(!1);k=(k|0)==0;do if(l){if((e[l+12>>2]|0)==(e[l+16>>2]|0)){if(g=0,w=ge(e[(e[l>>2]|0)+36>>2]|0,l|0)|0,G=g,g=0,G&1){Oe=24;break t}if((w|0)==-1){e[r>>2]=0,Oe=193;break}}if(!k){Oe=198;break t}}else Oe=193;while(!1);if((Oe|0)==193)if(Oe=0,k){Oe=198;break t}else l=0;if(k=e[t>>2]|0,w=e[k+12>>2]|0,(w|0)==(e[k+16>>2]|0)){if(g=0,k=ge(e[(e[k>>2]|0)+36>>2]|0,k|0)|0,G=g,g=0,G&1){Oe=24;break t}}else k=F[w>>0]|0;if((k&255)<<24>>24!=(S[Kt>>0]|0)){Oe=198;break t}if(k=e[t>>2]|0,w=k+12|0,o=e[w>>2]|0,(o|0)==(e[k+16>>2]|0)){if(g=0,ge(e[(e[k>>2]|0)+40>>2]|0,k|0)|0,G=g,g=0,G&1){Oe=24;break t}}else e[w>>2]=o+1;if((N|0)>0)for(c=l,o=l,R=N;;){k=e[t>>2]|0;do if(k){if((e[k+12>>2]|0)==(e[k+16>>2]|0)){if(g=0,k=ge(e[(e[k>>2]|0)+36>>2]|0,k|0)|0,G=g,g=0,G&1){Oe=22;break t}if((k|0)==-1){e[t>>2]=0,k=0;break}else{k=e[t>>2]|0;break}}}else k=0;while(!1);w=(k|0)==0;do if(o){if((e[o+12>>2]|0)!=(e[o+16>>2]|0))if(w){k=c,N=o;break}else{Oe=222;break t}if(g=0,k=ge(e[(e[o>>2]|0)+36>>2]|0,o|0)|0,G=g,g=0,G&1){Oe=22;break t}if((k|0)!=-1)if(w^(c|0)==0){k=c,N=c;break}else{Oe=222;break t}else{e[r>>2]=0,k=0,Oe=215;break}}else k=c,Oe=215;while(!1);if((Oe|0)==215)if(Oe=0,w){Oe=222;break t}else N=0;if(w=e[t>>2]|0,o=e[w+12>>2]|0,(o|0)==(e[w+16>>2]|0)){if(g=0,w=ge(e[(e[w>>2]|0)+36>>2]|0,w|0)|0,G=g,g=0,G&1){Oe=22;break t}}else w=F[o>>0]|0;if((w&255)<<24>>24<=-1){Oe=222;break t}if(!(I[(e[Te>>2]|0)+(w<<24>>24<<1)>>1]&2048)){Oe=222;break t}if((e[D>>2]|0)==(e[gt>>2]|0)&&(g=0,xe(12,C|0,D|0,gt|0),G=g,g=0,G&1)){Oe=22;break t}if(w=e[t>>2]|0,o=e[w+12>>2]|0,(o|0)==(e[w+16>>2]|0)){if(g=0,w=ge(e[(e[w>>2]|0)+36>>2]|0,w|0)|0,G=g,g=0,G&1){Oe=22;break t}}else w=F[o>>0]|0;if(o=e[D>>2]|0,e[D>>2]=o+1,S[o>>0]=w,w=R,R=R+-1|0,e[dt>>2]=R,o=e[t>>2]|0,l=o+12|0,c=e[l>>2]|0,(c|0)==(e[o+16>>2]|0)){if(g=0,ge(e[(e[o>>2]|0)+40>>2]|0,o|0)|0,G=g,g=0,G&1){Oe=22;break t}}else e[l>>2]=c+1;if((w|0)<=1)break;c=k,o=N}}if((e[D>>2]|0)==(e[C>>2]|0)){Oe=233;break t}break}default:}while(!1);i:do if((Oe|0)==42)for(;;){Oe=0,w=e[t>>2]|0;do if(w){if((e[w+12>>2]|0)==(e[w+16>>2]|0)){if(g=0,w=ge(e[(e[w>>2]|0)+36>>2]|0,w|0)|0,G=g,g=0,G&1){Oe=20;break t}if((w|0)==-1){e[t>>2]=0,w=0;break}else{w=e[t>>2]|0;break}}}else w=0;while(!1);o=(w|0)==0;do if(l){if((e[l+12>>2]|0)!=(e[l+16>>2]|0))if(o){c=k;break}else break i;if(g=0,w=ge(e[(e[l>>2]|0)+36>>2]|0,l|0)|0,G=g,g=0,G&1){Oe=20;break t}if((w|0)!=-1)if(o^(k|0)==0){c=k,l=k;break}else break i;else{e[r>>2]=0,k=0,Oe=54;break}}else Oe=54;while(!1);if((Oe|0)==54){if(Oe=0,o)break i;c=k,l=0}if(k=e[t>>2]|0,w=e[k+12>>2]|0,(w|0)==(e[k+16>>2]|0)){if(g=0,k=ge(e[(e[k>>2]|0)+36>>2]|0,k|0)|0,G=g,g=0,G&1){Oe=20;break t}}else k=F[w>>0]|0;if((k&255)<<24>>24<=-1||!(I[(e[Te>>2]|0)+(k<<24>>24<<1)>>1]&8192))break i;if(k=e[t>>2]|0,w=k+12|0,o=e[w>>2]|0,(o|0)==(e[k+16>>2]|0)){if(g=0,k=ge(e[(e[k>>2]|0)+40>>2]|0,k|0)|0,Oe=g,g=0,Oe&1){Oe=20;break t}}else e[w>>2]=o+1,k=F[o>>0]|0;if(g=0,Ae(67,h0|0,k&255|0),Oe=g,g=0,Oe&1){Oe=20;break t}else k=c,Oe=42}while(!1);if($=$+1|0,$>>>0>=4){Oe=235;break}}t:switch(Oe|0){case 20:{w=j()|0;break e}case 21:{w=j()|0;break e}case 22:{w=j()|0;break e}case 23:{w=j()|0;break e}case 24:{w=j()|0;break e}case 40:{e[h>>2]=e[h>>2]|4,w=0;break}case 104:{e[h>>2]=e[h>>2]|4,w=0;break}case 143:{e[h>>2]=e[h>>2]|4,w=0;break}case 198:{e[h>>2]=e[h>>2]|4,w=0;break}case 222:{e[h>>2]=e[h>>2]|4,w=0;break}case 233:{e[h>>2]=e[h>>2]|4,w=0;break}case 235:{i:do if(_){c=_+1|0,N=_+8|0,R=_+4|0,o=1;n:for(;;){if(k=S[_>>0]|0,k&1?k=e[R>>2]|0:k=(k&255)>>>1,o>>>0>=k>>>0)break i;k=e[t>>2]|0;do if(k){if((e[k+12>>2]|0)==(e[k+16>>2]|0)){if(g=0,k=ge(e[(e[k>>2]|0)+36>>2]|0,k|0)|0,D=g,g=0,D&1){Oe=19;break n}if((k|0)==-1){e[t>>2]=0,k=0;break}else{k=e[t>>2]|0;break}}}else k=0;while(!1);w=(k|0)==0,k=e[r>>2]|0;do if(k){if((e[k+12>>2]|0)==(e[k+16>>2]|0)){if(g=0,k=ge(e[(e[k>>2]|0)+36>>2]|0,k|0)|0,D=g,g=0,D&1){Oe=19;break n}if((k|0)==-1){e[r>>2]=0,Oe=253;break}}if(!w){Oe=260;break n}}else Oe=253;while(!1);if((Oe|0)==253&&(Oe=0,w)){Oe=260;break}if(k=e[t>>2]|0,w=e[k+12>>2]|0,(w|0)==(e[k+16>>2]|0)){if(g=0,k=ge(e[(e[k>>2]|0)+36>>2]|0,k|0)|0,D=g,g=0,D&1){Oe=19;break}}else k=F[w>>0]|0;if(S[_>>0]&1?w=e[N>>2]|0:w=c,(k&255)<<24>>24!=(S[w+o>>0]|0)){Oe=260;break}if(k=o+1|0,w=e[t>>2]|0,o=w+12|0,l=e[o>>2]|0,(l|0)==(e[w+16>>2]|0))if(g=0,ge(e[(e[w>>2]|0)+40>>2]|0,w|0)|0,D=g,g=0,D&1){Oe=19;break}else{o=k;continue}else{e[o>>2]=l+1,o=k;continue}}if((Oe|0)==19){w=j()|0;break e}else if((Oe|0)==260){e[h>>2]=e[h>>2]|4,w=0;break t}}while(!1);k=e[F0>>2]|0,(k|0)!=(U|0)&&(e[yt>>2]=0,V0(qt,k,U,yt),(e[yt>>2]|0)!=0)?(e[h>>2]=e[h>>2]|4,w=0):w=1;break}}return de(h0),de(c0),de(a0),de(D0),de(qt),k=e[F0>>2]|0,e[F0>>2]=0,k|0&&(g=0,ue(e[Ti>>2]|0,k|0),F0=g,g=0,F0&1)&&(F0=j(0)|0,$t(F0)),b=A0,w|0}while(!1);return de(h0),de(c0),de(a0),de(D0),de(qt),k=e[F0>>2]|0,e[F0>>2]=0,k|0&&(g=0,ue(e[Ti>>2]|0,k|0),F0=g,g=0,F0&1)&&(F0=j(0)|0,$t(F0)),le(w|0),0}function fn(t){t=t|0;var r=0;r=Ct(8)|0,g=0,Ae(90,r|0,t|0),t=g,g=0,t&1?(t=j()|0,Tt(r|0),le(t|0)):Qt(r|0,616,80)}function nh(t,r,o,l,c,h,d){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0;var w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0;if($=b,b=b+144|0,w=$+24|0,t=$+32|0,P=$+16|0,U=$+8|0,N=$+4|0,R=$+28|0,C=$,e[P>>2]=t,ie=P+4|0,e[ie>>2]=189,D=t+100|0,g=0,G=ge(68,c|0)|0,k=g,g=0,k&1)w=j()|0,e[P>>2]=0,Z=36;else{e[N>>2]=G,g=0,k=be(37,N|0,44220)|0,t=g,g=0;e:do if(!(t&1)&&(S[R>>0]=0,H=e[o>>2]|0,e[C>>2]=H,_=e[c+4>>2]|0,K=H,g=0,e[w>>2]=e[C>>2],_=Ut(1,r|0,w|0,l|0,N|0,_|0,h|0,R|0,k|0,P|0,U|0,D|0)|0,c=g,g=0,!(c&1))){if(_){if(S[d>>0]&1?(S[e[d+8>>2]>>0]=0,e[d+4>>2]=0):(S[d+1>>0]=0,S[d>>0]=0),S[R>>0]|0&&(g=0,t=be(e[(e[k>>2]|0)+28>>2]|0,k|0,45)|0,c=g,g=0,c&1||(g=0,Ae(67,d|0,t|0),c=g,g=0,c&1))||(g=0,C=be(e[(e[k>>2]|0)+28>>2]|0,k|0,48)|0,c=g,g=0,c&1))break;t=e[P>>2]|0,D=e[U>>2]|0,w=D+-1|0;t:do if(t>>>0>>0)do{if((S[t>>0]|0)!=C<<24>>24)break t;t=t+1|0}while(t>>>0>>0);while(!1);if(g=0,Ve(32,d|0,t|0,D|0)|0,d=g,g=0,d&1)break}t=e[r>>2]|0;do if(t){if((e[t+12>>2]|0)==(e[t+16>>2]|0)){if(g=0,t=ge(e[(e[t>>2]|0)+36>>2]|0,t|0)|0,d=g,g=0,d&1)break e;if((t|0)==-1){e[r>>2]=0,t=0;break}else{t=e[r>>2]|0;break}}}else t=0;while(!1);w=(t|0)==0;do if(H){if((e[K+12>>2]|0)==(e[K+16>>2]|0)){if(g=0,t=ge(e[(e[H>>2]|0)+36>>2]|0,K|0)|0,K=g,g=0,K&1)break e;if((t|0)==-1){e[o>>2]=0,Z=29;break}}w||(Z=30)}else Z=29;while(!1);return(Z|0)==29&&w&&(Z=30),(Z|0)==30&&(e[h>>2]=e[h>>2]|2),w=e[r>>2]|0,Bt(G)|0,t=e[P>>2]|0,e[P>>2]=0,t|0&&(g=0,ue(e[ie>>2]|0,t|0),ie=g,g=0,ie&1)&&(ie=j(0)|0,$t(ie)),b=$,w|0}while(!1);w=j()|0,Bt(G)|0,t=e[P>>2]|0,e[P>>2]=0,t?Z=36:O=w}return(Z|0)==36&&(g=0,ue(e[ie>>2]|0,t|0),ie=g,g=0,ie&1?(ie=j(0)|0,$t(ie)):O=w),le(O|0),0}function rh(t,r,o,l,c,h,d,w,C,D){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0,w=w|0,C=C|0,D=D|0;var k=0,N=0,R=0,_=0,U=0,H=0,K=0,G=0,$=0,P=0,O=0,Z=0;Z=b,b=b+112|0,k=Z+100|0,N=Z+88|0,R=Z+76|0,_=Z+64|0,U=Z+52|0,H=Z+48|0,K=Z+36|0,G=Z+24|0,$=Z+12|0,P=Z;do if(t)if(t=O0(r,43828)|0,t0[e[(e[t>>2]|0)+44>>2]&127](k,t),P=e[k>>2]|0,S[o>>0]=P,S[o+1>>0]=P>>8,S[o+2>>0]=P>>16,S[o+3>>0]=P>>24,t0[e[(e[t>>2]|0)+32>>2]&127](N,t),S[C>>0]&1?(S[e[C+8>>2]>>0]=0,e[C+4>>2]=0):(S[C+1>>0]=0,S[C>>0]=0),g=0,Ae(91,C|0,0),o=g,g=0,o&1&&(o=j(0)|0,$t(o)),e[C>>2]=e[N>>2],e[C+4>>2]=e[N+4>>2],e[C+8>>2]=e[N+8>>2],e[N>>2]=0,e[N+4>>2]=0,e[N+8>>2]=0,de(N),t0[e[(e[t>>2]|0)+28>>2]&127](R,t),S[w>>0]&1?(S[e[w+8>>2]>>0]=0,e[w+4>>2]=0):(S[w+1>>0]=0,S[w>>0]=0),g=0,Ae(91,w|0,0),o=g,g=0,o&1&&(o=j(0)|0,$t(o)),e[w>>2]=e[R>>2],e[w+4>>2]=e[R+4>>2],e[w+8>>2]=e[R+8>>2],e[R>>2]=0,e[R+4>>2]=0,e[R+8>>2]=0,de(R),w=Dt[e[(e[t>>2]|0)+12>>2]&127](t)|0,S[l>>0]=w,w=Dt[e[(e[t>>2]|0)+16>>2]&127](t)|0,S[c>>0]=w,t0[e[(e[t>>2]|0)+20>>2]&127](_,t),S[h>>0]&1?(S[e[h+8>>2]>>0]=0,e[h+4>>2]=0):(S[h+1>>0]=0,S[h>>0]=0),g=0,Ae(91,h|0,0),c=g,g=0,c&1&&(c=j(0)|0,$t(c)),e[h>>2]=e[_>>2],e[h+4>>2]=e[_+4>>2],e[h+8>>2]=e[_+8>>2],e[_>>2]=0,e[_+4>>2]=0,e[_+8>>2]=0,de(_),t0[e[(e[t>>2]|0)+24>>2]&127](U,t),S[d>>0]&1?(S[e[d+8>>2]>>0]=0,e[d+4>>2]=0):(S[d+1>>0]=0,S[d>>0]=0),g=0,Ae(91,d|0,0),c=g,g=0,c&1)c=j(0)|0,$t(c);else{e[d>>2]=e[U>>2],e[d+4>>2]=e[U+4>>2],e[d+8>>2]=e[U+8>>2],e[U>>2]=0,e[U+4>>2]=0,e[U+8>>2]=0,de(U),O=Dt[e[(e[t>>2]|0)+36>>2]&127](t)|0;break}else if(t=O0(r,43764)|0,t0[e[(e[t>>2]|0)+44>>2]&127](H,t),H=e[H>>2]|0,S[o>>0]=H,S[o+1>>0]=H>>8,S[o+2>>0]=H>>16,S[o+3>>0]=H>>24,t0[e[(e[t>>2]|0)+32>>2]&127](K,t),S[C>>0]&1?(S[e[C+8>>2]>>0]=0,e[C+4>>2]=0):(S[C+1>>0]=0,S[C>>0]=0),g=0,Ae(91,C|0,0),o=g,g=0,o&1&&(o=j(0)|0,$t(o)),e[C>>2]=e[K>>2],e[C+4>>2]=e[K+4>>2],e[C+8>>2]=e[K+8>>2],e[K>>2]=0,e[K+4>>2]=0,e[K+8>>2]=0,de(K),t0[e[(e[t>>2]|0)+28>>2]&127](G,t),S[w>>0]&1?(S[e[w+8>>2]>>0]=0,e[w+4>>2]=0):(S[w+1>>0]=0,S[w>>0]=0),g=0,Ae(91,w|0,0),o=g,g=0,o&1&&(o=j(0)|0,$t(o)),e[w>>2]=e[G>>2],e[w+4>>2]=e[G+4>>2],e[w+8>>2]=e[G+8>>2],e[G>>2]=0,e[G+4>>2]=0,e[G+8>>2]=0,de(G),w=Dt[e[(e[t>>2]|0)+12>>2]&127](t)|0,S[l>>0]=w,w=Dt[e[(e[t>>2]|0)+16>>2]&127](t)|0,S[c>>0]=w,t0[e[(e[t>>2]|0)+20>>2]&127]($,t),S[h>>0]&1?(S[e[h+8>>2]>>0]=0,e[h+4>>2]=0):(S[h+1>>0]=0,S[h>>0]=0),g=0,Ae(91,h|0,0),c=g,g=0,c&1&&(c=j(0)|0,$t(c)),e[h>>2]=e[$>>2],e[h+4>>2]=e[$+4>>2],e[h+8>>2]=e[$+8>>2],e[$>>2]=0,e[$+4>>2]=0,e[$+8>>2]=0,de($),t0[e[(e[t>>2]|0)+24>>2]&127](P,t),S[d>>0]&1?(S[e[d+8>>2]>>0]=0,e[d+4>>2]=0):(S[d+1>>0]=0,S[d>>0]=0),g=0,Ae(91,d|0,0),c=g,g=0,c&1)c=j(0)|0,$t(c);else{e[d>>2]=e[P>>2],e[d+4>>2]=e[P+4>>2],e[d+8>>2]=e[P+8>>2],e[P>>2]=0,e[P+4>>2]=0,e[P+8>>2]=0,de(P),O=Dt[e[(e[t>>2]|0)+36>>2]&127](t)|0;break}while(!1);e[D>>2]=O,b=Z}function V0(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0;c=S[t>>0]|0,d=t+4|0,h=e[d>>2]|0;e:do if((c&1?h:(c&255)>>>1)|0){if((r|0)!=(o|0)){if(c=o+-4|0,c>>>0>r>>>0){h=r;do w=e[h>>2]|0,e[h>>2]=e[c>>2],e[c>>2]=w,h=h+4|0,c=c+-4|0;while(h>>>0>>0)}c=S[t>>0]|0,h=e[d>>2]|0}w=(c&1)==0,d=w?t+1|0:e[t+8>>2]|0,o=o+-4|0,t=d+(w?(c&255)>>>1:h)|0,h=S[d>>0]|0,c=h<<24>>24<1|h<<24>>24==127;t:do if(o>>>0>r>>>0){for(;!(!c&&(h<<24>>24|0)!=(e[r>>2]|0));)if(d=(t-d|0)>1?d+1|0:d,r=r+4|0,h=S[d>>0]|0,c=h<<24>>24<1|h<<24>>24==127,r>>>0>=o>>>0)break t;e[l>>2]=4;break e}while(!1);!c&&((e[o>>2]|0)+-1|0)>>>0>=h<<24>>24>>>0&&(e[l>>2]=4)}while(!1)}function sh(t){t=t|0}function oh(t){t=t|0,he(t)}function ah(t,r,o,l,c,h,d){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0;var w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0,ce=0,ke=0,Ee=0,Te=0;if(oe=b,b=b+576|0,P=oe+424|0,ie=oe,t=oe+24|0,ce=oe+16|0,O=oe+12|0,ne=oe+8|0,N=oe+464|0,C=oe+4|0,Z=oe+468|0,e[ce>>2]=t,Ee=ce+4|0,e[Ee>>2]=189,D=t+400|0,g=0,w=ge(68,c|0)|0,$=g,g=0,$&1)C=j()|0,e[ce>>2]=0,w=189,Te=47;else{e[ne>>2]=w,g=0,t=be(37,ne|0,44212)|0,$=g,g=0;e:do if(!($&1)&&(S[N>>0]=0,e[C>>2]=e[o>>2],k=e[c+4>>2]|0,g=0,e[P>>2]=e[C>>2],k=Ut(2,r|0,P|0,l|0,ne|0,k|0,h|0,N|0,t|0,ce|0,O|0,D|0)|0,$=g,g=0,!($&1))){t:do if(k){if(g=0,Pe(e[(e[t>>2]|0)+48>>2]|0,t|0,59007,59017,P|0)|0,$=g,g=0,$&1){Te=10;break e}C=e[O>>2]|0,D=e[ce>>2]|0,t=C-D|0,(t|0)>392?(t=E0((t>>2)+2|0)|0,w=t,t?Te=13:(g=0,Nt(6),$=g,g=0,$&1||(t=0,Te=13))):(w=0,t=Z,Te=13);do if((Te|0)==13){if(S[N>>0]|0&&(S[t>>0]=45,t=t+1|0),G=P+40|0,$=P,D>>>0>>0){k=P+4|0,l=k+4|0,c=l+4|0,N=c+4|0,R=N+4|0,_=R+4|0,U=_+4|0,H=U+4|0,K=H+4|0;do{C=e[D>>2]|0;do if((e[P>>2]|0)!=(C|0))if((e[k>>2]|0)!=(C|0))if((e[l>>2]|0)!=(C|0))if((e[c>>2]|0)!=(C|0))if((e[N>>2]|0)==(C|0))C=N;else{if((e[R>>2]|0)==(C|0)){C=R;break}if((e[_>>2]|0)==(C|0)){C=_;break}if((e[U>>2]|0)==(C|0)){C=U;break}if((e[H>>2]|0)==(C|0)){C=H;break}C=(e[K>>2]|0)==(C|0)?K:G}else C=c;else C=l;else C=k;else C=P;while(!1);S[t>>0]=S[59007+(C-$>>2)>>0]|0,D=D+4|0,t=t+1|0}while(D>>>0<(e[O>>2]|0)>>>0)}if(S[t>>0]=0,e[ie>>2]=d,(_o(Z,58987,ie)|0)!=1&&(g=0,ue(190,58991),d=g,g=0,d&1))break;w&&n0(w);break t}while(!1);if(t=j()|0,!w){C=t,w=ce;break e}n0(w),C=t,w=ce;break e}while(!1);t=e[r>>2]|0;do if(t){if(w=e[t+12>>2]|0,(w|0)==(e[t+16>>2]|0)){if(g=0,t=ge(e[(e[t>>2]|0)+36>>2]|0,t|0)|0,d=g,g=0,d&1){Te=10;break e}}else t=e[w>>2]|0;if((t|0)==-1){e[r>>2]=0,C=1;break}else{C=(e[r>>2]|0)==0;break}}else C=1;while(!1);t=e[o>>2]|0;do if(t){if(w=e[t+12>>2]|0,(w|0)==(e[t+16>>2]|0)){if(g=0,t=ge(e[(e[t>>2]|0)+36>>2]|0,t|0)|0,d=g,g=0,d&1){Te=10;break e}}else t=e[w>>2]|0;if((t|0)!=-1){if(C)break;Te=40;break}else{e[o>>2]=0,Te=38;break}}else Te=38;while(!1);return(Te|0)==38&&C&&(Te=40),(Te|0)==40&&(e[h>>2]=e[h>>2]|2),w=e[r>>2]|0,Bt(e[ne>>2]|0)|0,t=e[ce>>2]|0,e[ce>>2]=0,t|0&&(g=0,ue(e[Ee>>2]|0,t|0),Te=g,g=0,Te&1)&&(Te=j(0)|0,$t(Te)),b=oe,w|0}else Te=10;while(!1);(Te|0)==10&&(C=j()|0,w=ce),Bt(e[ne>>2]|0)|0,t=e[w>>2]|0,e[w>>2]=0,t?(w=e[Ee>>2]|0,Te=47):ke=C}return(Te|0)==47&&(g=0,ue(w|0,t|0),Te=g,g=0,Te&1?(Te=j(0)|0,$t(Te)):ke=C),le(ke|0),0}function lh(t,r,o,l,c,h,d,w,C,D,k){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0,w=w|0,C=C|0,D=D|0,k=k|0;var N=0,R=0,_=0,U=0,H=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0,ce=0,ke=0,Ee=0,Te=0,it=0,jt=0,Gt=0,s0=0,i0=0,zt=0,gt=0,Kt=0,dt=0,At=0,y0=0,T0=0,g0=0,Oe=0,yt=0,qt=0,c0=0,a0=0,h0=0;c0=b,b=b+512|0,Gt=c0+96|0,N=c0+104|0,h0=c0+88|0,gt=c0+80|0,zt=c0+76|0,Kt=c0+504|0,s0=c0+72|0,dt=c0+68|0,T0=c0+56|0,qt=c0+44|0,Oe=c0+32|0,g0=c0+20|0,yt=c0+8|0,i0=c0+4|0,y0=c0,e[Gt>>2]=k,e[h0>>2]=N,a0=h0+4|0,e[a0>>2]=189,e[gt>>2]=N,e[zt>>2]=N+400,e[T0>>2]=0,e[T0+4>>2]=0,e[T0+8>>2]=0,e[qt>>2]=0,e[qt+4>>2]=0,e[qt+8>>2]=0,e[Oe>>2]=0,e[Oe+4>>2]=0,e[Oe+8>>2]=0,e[g0>>2]=0,e[g0+4>>2]=0,e[g0+8>>2]=0,e[yt>>2]=0,e[yt+4>>2]=0,e[yt+8>>2]=0,g=0,I0(2,o|0,l|0,Kt|0,s0|0,dt|0,T0|0,qt|0,Oe|0,g0|0,i0|0),jt=g,g=0;e:do if(jt&1)o=j()|0;else{e[D>>2]=e[C>>2],Ee=Oe+4|0,Te=g0+4|0,it=g0+8|0,jt=Oe+8|0,O=(c&512|0)!=0,Z=qt+8|0,ie=qt+4|0,oe=yt+4|0,ne=yt+8|0,ce=Kt+3|0,ke=T0+4|0,P=0,_=0;t:for(;;){k=e[t>>2]|0;do if(k){if(o=e[k+12>>2]|0,(o|0)==(e[k+16>>2]|0)){if(g=0,k=ge(e[(e[k>>2]|0)+36>>2]|0,k|0)|0,$=g,g=0,$&1){At=26;break t}}else k=e[o>>2]|0;if((k|0)==-1){e[t>>2]=0,l=1;break}else{l=(e[t>>2]|0)==0;break}}else l=1;while(!1);o=e[r>>2]|0;do if(o){if(k=e[o+12>>2]|0,(k|0)==(e[o+16>>2]|0)){if(g=0,k=ge(e[(e[o>>2]|0)+36>>2]|0,o|0)|0,$=g,g=0,$&1){At=26;break t}}else k=e[k>>2]|0;if((k|0)!=-1)if(l){$=o;break}else{U=N,At=244;break t}else{e[r>>2]=0,At=16;break}}else At=16;while(!1);if((At|0)==16)if(At=0,l){U=N,At=244;break}else $=0;i:do switch(S[Kt+P>>0]|0){case 1:{if((P|0)!=3){if(k=e[t>>2]|0,o=e[k+12>>2]|0,(o|0)==(e[k+16>>2]|0)){if(g=0,k=ge(e[(e[k>>2]|0)+36>>2]|0,k|0)|0,At=g,g=0,At&1){At=26;break t}}else k=e[o>>2]|0;if(g=0,k=Ve(e[(e[w>>2]|0)+12>>2]|0,w|0,8192,k|0)|0,At=g,g=0,At&1){At=26;break t}if(!k){At=42;break t}if(k=e[t>>2]|0,o=k+12|0,l=e[o>>2]|0,(l|0)==(e[k+16>>2]|0)){if(g=0,k=ge(e[(e[k>>2]|0)+40>>2]|0,k|0)|0,At=g,g=0,At&1){At=26;break t}}else e[o>>2]=l+4,k=e[l>>2]|0;if(g=0,Ae(92,yt|0,k|0),At=g,g=0,At&1){At=26;break t}else k=$,c=$,At=44}else k=N;break}case 0:{(P|0)==3?k=N:(k=$,c=$,At=44);break}case 3:{if(o=S[Oe>>0]|0,k=o&1?e[Ee>>2]|0:(o&255)>>>1,l=S[g0>>0]|0,c=l&1?e[Te>>2]|0:(l&255)>>>1,(k|0)==(0-c|0))k=N;else{if(!k){if(k=e[t>>2]|0,o=e[k+12>>2]|0,(o|0)==(e[k+16>>2]|0)){if(g=0,k=ge(e[(e[k>>2]|0)+36>>2]|0,k|0)|0,$=g,g=0,$&1){At=26;break t}o=S[g0>>0]|0}else k=e[o>>2]|0,o=l;if((k|0)!=(e[(o&1?e[it>>2]|0:Te)>>2]|0)){k=N;break i}if(k=e[t>>2]|0,o=k+12|0,l=e[o>>2]|0,(l|0)==(e[k+16>>2]|0)){if(g=0,ge(e[(e[k>>2]|0)+40>>2]|0,k|0)|0,$=g,g=0,$&1){At=26;break t}}else e[o>>2]=l+4;S[d>>0]=1,$=S[g0>>0]|0,k=N,_=($&1?e[Te>>2]|0:($&255)>>>1)>>>0>1?g0:_;break i}if(R=e[t>>2]|0,U=e[R+12>>2]|0,l=e[R+16>>2]|0,k=(U|0)==(l|0),!c){if(k){if(g=0,k=ge(e[(e[R>>2]|0)+36>>2]|0,R|0)|0,$=g,g=0,$&1){At=26;break t}o=S[Oe>>0]|0}else k=e[U>>2]|0;if((k|0)!=(e[(o&1?e[jt>>2]|0:Ee)>>2]|0)){S[d>>0]=1,k=N;break i}if(k=e[t>>2]|0,o=k+12|0,l=e[o>>2]|0,(l|0)==(e[k+16>>2]|0)){if(g=0,ge(e[(e[k>>2]|0)+40>>2]|0,k|0)|0,$=g,g=0,$&1){At=26;break t}}else e[o>>2]=l+4;$=S[Oe>>0]|0,k=N,_=($&1?e[Ee>>2]|0:($&255)>>>1)>>>0>1?Oe:_;break i}if(k){if(g=0,k=ge(e[(e[R>>2]|0)+36>>2]|0,R|0)|0,$=g,g=0,$&1){At=26;break t}l=e[t>>2]|0,o=S[Oe>>0]|0,R=l,U=e[l+12>>2]|0,l=e[l+16>>2]|0}else k=e[U>>2]|0;if(c=R+12|0,l=(U|0)==(l|0),(k|0)==(e[(o&1?e[jt>>2]|0:Ee)>>2]|0)){if(l){if(g=0,ge(e[(e[R>>2]|0)+40>>2]|0,R|0)|0,$=g,g=0,$&1){At=26;break t}}else e[c>>2]=U+4;$=S[Oe>>0]|0,k=N,_=($&1?e[Ee>>2]|0:($&255)>>>1)>>>0>1?Oe:_;break i}if(l){if(g=0,k=ge(e[(e[R>>2]|0)+36>>2]|0,R|0)|0,$=g,g=0,$&1){At=26;break t}}else k=e[U>>2]|0;if((k|0)!=(e[(S[g0>>0]&1?e[it>>2]|0:Te)>>2]|0)){At=107;break t}if(k=e[t>>2]|0,o=k+12|0,l=e[o>>2]|0,(l|0)==(e[k+16>>2]|0)){if(g=0,ge(e[(e[k>>2]|0)+40>>2]|0,k|0)|0,$=g,g=0,$&1){At=26;break t}}else e[o>>2]=l+4;S[d>>0]=1,$=S[g0>>0]|0,k=N,_=($&1?e[Te>>2]|0:($&255)>>>1)>>>0>1?g0:_}break}case 2:{if(!(P>>>0<2|(_|0)!=0)&&!(O|(P|0)==2&(S[ce>>0]|0)!=0)){k=N,_=0;break i}c=S[qt>>0]|0,l=e[Z>>2]|0,o=c&1?l:ie,k=o;n:do if(P|0&&(F[Kt+(P+-1)>>0]|0)<2){G=(c&1)==0;r:do if((o|0)!=((G?ie:l)+((G?(c&255)>>>1:e[ie>>2]|0)<<2)|0)){for(c=o;;){if(g=0,o=Ve(e[(e[w>>2]|0)+12>>2]|0,w|0,8192,e[c>>2]|0)|0,G=g,g=0,G&1){At=23;break t}if(!o)break;if(c=c+4|0,k=c,o=S[qt>>0]|0,l=e[Z>>2]|0,G=(o&1)==0,(c|0)==((G?ie:l)+((G?(o&255)>>>1:e[ie>>2]|0)<<2)|0)){c=o;break r}}c=S[qt>>0]|0,l=e[Z>>2]|0}while(!1);if(U=c&1?l:ie,o=U,H=k-o>>2,K=S[yt>>0]|0,R=(K&1)==0,K=R?(K&255)>>>1:e[oe>>2]|0,K>>>0>=H>>>0)if(R=R?oe:e[ne>>2]|0,G=R+(K<<2)|0,!H)o=k;else for(R=R+(K-H<<2)|0;;){if((e[R>>2]|0)!=(e[U>>2]|0))break n;if(R=R+4|0,(R|0)==(G|0)){o=k;break}else U=U+4|0}}else o=k;while(!1);k=(c&1)==0,k=(k?ie:l)+((k?(c&255)>>>1:e[ie>>2]|0)<<2)|0;n:do if((o|0)!=(k|0))for(R=$,c=$,k=o;;){o=e[t>>2]|0;do if(o){if(l=e[o+12>>2]|0,(l|0)==(e[o+16>>2]|0)){if(g=0,o=ge(e[(e[o>>2]|0)+36>>2]|0,o|0)|0,$=g,g=0,$&1){At=22;break t}}else o=e[l>>2]|0;if((o|0)==-1){e[t>>2]=0,l=1;break}else{l=(e[t>>2]|0)==0;break}}else l=1;while(!1);do if(c){if(o=e[c+12>>2]|0,(o|0)==(e[c+16>>2]|0)){if(g=0,o=ge(e[(e[c>>2]|0)+36>>2]|0,c|0)|0,$=g,g=0,$&1){At=22;break t}}else o=e[o>>2]|0;if((o|0)!=-1)if(l^(R|0)==0){o=R,U=R;break}else break n;else{e[r>>2]=0,o=0,At=136;break}}else o=R,At=136;while(!1);if((At|0)==136){if(At=0,l)break n;U=0}if(l=e[t>>2]|0,c=e[l+12>>2]|0,(c|0)==(e[l+16>>2]|0)){if(g=0,l=ge(e[(e[l>>2]|0)+36>>2]|0,l|0)|0,$=g,g=0,$&1){At=22;break t}}else l=e[c>>2]|0;if((l|0)!=(e[k>>2]|0))break n;if(l=e[t>>2]|0,c=l+12|0,R=e[c>>2]|0,(R|0)==(e[l+16>>2]|0)){if(g=0,ge(e[(e[l>>2]|0)+40>>2]|0,l|0)|0,$=g,g=0,$&1){At=22;break t}}else e[c>>2]=R+4;if(k=k+4|0,l=S[qt>>0]|0,$=(l&1)==0,l=($?ie:e[Z>>2]|0)+(($?(l&255)>>>1:e[ie>>2]|0)<<2)|0,(k|0)==(l|0)){k=l;break}else R=o,c=U}while(!1);if(O&&($=S[qt>>0]|0,G=($&1)==0,(k|0)!=((G?ie:e[Z>>2]|0)+((G?($&255)>>>1:e[ie>>2]|0)<<2)|0))){At=148;break t}else k=N;break}case 4:{K=e[dt>>2]|0,H=$,R=$,k=N,o=0;n:for(;;){l=e[t>>2]|0;do if(l){if(c=e[l+12>>2]|0,(c|0)==(e[l+16>>2]|0)){if(g=0,l=ge(e[(e[l>>2]|0)+36>>2]|0,l|0)|0,$=g,g=0,$&1){At=25;break t}}else l=e[c>>2]|0;if((l|0)==-1){e[t>>2]=0,c=1;break}else{c=(e[t>>2]|0)==0;break}}else c=1;while(!1);do if(R){if(l=e[R+12>>2]|0,(l|0)==(e[R+16>>2]|0)){if(g=0,l=ge(e[(e[R>>2]|0)+36>>2]|0,R|0)|0,$=g,g=0,$&1){At=25;break t}}else l=e[l>>2]|0;if((l|0)!=-1)if(c^(H|0)==0){l=H,U=H;break}else{N=H;break n}else{e[r>>2]=0,l=0,At=162;break}}else l=H,At=162;while(!1);if((At|0)==162)if(At=0,c){N=l;break}else U=0;if(c=e[t>>2]|0,N=e[c+12>>2]|0,(N|0)==(e[c+16>>2]|0)){if(g=0,c=ge(e[(e[c>>2]|0)+36>>2]|0,c|0)|0,$=g,g=0,$&1){At=25;break t}}else c=e[N>>2]|0;if(g=0,N=Ve(e[(e[w>>2]|0)+12>>2]|0,w|0,2048,c|0)|0,$=g,g=0,$&1){At=25;break t}if(N){if(N=e[D>>2]|0,(N|0)==(e[Gt>>2]|0)){if(g=0,xe(14,C|0,D|0,Gt|0),$=g,g=0,$&1){At=25;break t}N=e[D>>2]|0}e[D>>2]=N+4,e[N>>2]=c,o=o+1|0}else{if($=S[T0>>0]|0,!((c|0)==(K|0)&(o|0?(($&1?e[ke>>2]|0:($&255)>>>1)|0)!=0:0))){N=l;break}if((k|0)==(e[zt>>2]|0)){if(g=0,xe(13,h0|0,gt|0,zt|0),$=g,g=0,$&1){At=25;break t}k=e[gt>>2]|0}$=k+4|0,e[gt>>2]=$,e[k>>2]=o,k=$,o=0}if(c=e[t>>2]|0,N=c+12|0,R=e[N>>2]|0,(R|0)==(e[c+16>>2]|0))if(g=0,ge(e[(e[c>>2]|0)+40>>2]|0,c|0)|0,$=g,g=0,$&1){At=25;break t}else{H=l,R=U;continue}else{e[N>>2]=R+4,H=l,R=U;continue}}if(o|0&&(e[h0>>2]|0)!=(k|0)){if((k|0)==(e[zt>>2]|0)){if(g=0,xe(13,h0|0,gt|0,zt|0),$=g,g=0,$&1){At=26;break t}k=e[gt>>2]|0}$=k+4|0,e[gt>>2]=$,e[k>>2]=o,k=$}if(U=e[i0>>2]|0,(U|0)>0){o=e[t>>2]|0;do if(o){if(l=e[o+12>>2]|0,(l|0)==(e[o+16>>2]|0)){if(g=0,o=ge(e[(e[o>>2]|0)+36>>2]|0,o|0)|0,$=g,g=0,$&1){At=26;break t}}else o=e[l>>2]|0;if((o|0)==-1){e[t>>2]=0,l=1;break}else{l=(e[t>>2]|0)==0;break}}else l=1;while(!1);do if(N){if(o=e[N+12>>2]|0,(o|0)==(e[N+16>>2]|0)){if(g=0,o=ge(e[(e[N>>2]|0)+36>>2]|0,N|0)|0,$=g,g=0,$&1){At=26;break t}}else o=e[o>>2]|0;if((o|0)!=-1){if(l)break;At=206;break t}else{e[r>>2]=0,At=200;break}}else At=200;while(!1);if((At|0)==200)if(At=0,l){At=206;break t}else N=0;if(o=e[t>>2]|0,l=e[o+12>>2]|0,(l|0)==(e[o+16>>2]|0)){if(g=0,o=ge(e[(e[o>>2]|0)+36>>2]|0,o|0)|0,$=g,g=0,$&1){At=26;break t}}else o=e[l>>2]|0;if((o|0)!=(e[s0>>2]|0)){At=206;break t}if(o=e[t>>2]|0,l=o+12|0,c=e[l>>2]|0,(c|0)==(e[o+16>>2]|0)){if(g=0,ge(e[(e[o>>2]|0)+40>>2]|0,o|0)|0,$=g,g=0,$&1){At=26;break t}}else e[l>>2]=c+4;if((U|0)>0)for(R=N,c=N,H=U;;){o=e[t>>2]|0;do if(o){if(l=e[o+12>>2]|0,(l|0)==(e[o+16>>2]|0)){if(g=0,o=ge(e[(e[o>>2]|0)+36>>2]|0,o|0)|0,$=g,g=0,$&1){At=24;break t}}else o=e[l>>2]|0;if((o|0)==-1){e[t>>2]=0,l=1;break}else{l=(e[t>>2]|0)==0;break}}else l=1;while(!1);do if(c){if(o=e[c+12>>2]|0,(o|0)==(e[c+16>>2]|0)){if(g=0,o=ge(e[(e[c>>2]|0)+36>>2]|0,c|0)|0,$=g,g=0,$&1){At=24;break t}}else o=e[o>>2]|0;if((o|0)!=-1)if(l^(R|0)==0){o=R,U=R;break}else{At=231;break t}else{e[r>>2]=0,o=0,At=224;break}}else o=R,At=224;while(!1);if((At|0)==224)if(At=0,l){At=231;break t}else U=0;if(l=e[t>>2]|0,c=e[l+12>>2]|0,(c|0)==(e[l+16>>2]|0)){if(g=0,l=ge(e[(e[l>>2]|0)+36>>2]|0,l|0)|0,$=g,g=0,$&1){At=24;break t}}else l=e[c>>2]|0;if(g=0,l=Ve(e[(e[w>>2]|0)+12>>2]|0,w|0,2048,l|0)|0,$=g,g=0,$&1){At=24;break t}if(!l){At=231;break t}if((e[D>>2]|0)==(e[Gt>>2]|0)&&(g=0,xe(14,C|0,D|0,Gt|0),$=g,g=0,$&1)){At=24;break t}if(l=e[t>>2]|0,c=e[l+12>>2]|0,(c|0)==(e[l+16>>2]|0)){if(g=0,l=ge(e[(e[l>>2]|0)+36>>2]|0,l|0)|0,$=g,g=0,$&1){At=24;break t}}else l=e[c>>2]|0;if(c=e[D>>2]|0,e[D>>2]=c+4,e[c>>2]=l,l=H,H=H+-1|0,e[i0>>2]=H,c=e[t>>2]|0,N=c+12|0,R=e[N>>2]|0,(R|0)==(e[c+16>>2]|0)){if(g=0,ge(e[(e[c>>2]|0)+40>>2]|0,c|0)|0,$=g,g=0,$&1){At=24;break t}}else e[N>>2]=R+4;if((l|0)<=1)break;R=o,c=U}}if((e[D>>2]|0)==(e[C>>2]|0)){At=242;break t}break}default:k=N}while(!1);i:do if((At|0)==44)for(;;){At=0,o=e[t>>2]|0;do if(o){if(l=e[o+12>>2]|0,(l|0)==(e[o+16>>2]|0)){if(g=0,o=ge(e[(e[o>>2]|0)+36>>2]|0,o|0)|0,$=g,g=0,$&1){At=21;break t}}else o=e[l>>2]|0;if((o|0)==-1){e[t>>2]=0,l=1;break}else{l=(e[t>>2]|0)==0;break}}else l=1;while(!1);do if(c){if(o=e[c+12>>2]|0,(o|0)==(e[c+16>>2]|0)){if(g=0,o=ge(e[(e[c>>2]|0)+36>>2]|0,c|0)|0,$=g,g=0,$&1){At=21;break t}}else o=e[o>>2]|0;if((o|0)!=-1)if(l^(k|0)==0){R=k,c=k;break}else{k=N;break i}else{e[r>>2]=0,k=0,At=57;break}}else At=57;while(!1);if((At|0)==57)if(At=0,l){k=N;break i}else R=k,c=0;if(k=e[t>>2]|0,o=e[k+12>>2]|0,(o|0)==(e[k+16>>2]|0)){if(g=0,k=ge(e[(e[k>>2]|0)+36>>2]|0,k|0)|0,$=g,g=0,$&1){At=21;break t}}else k=e[o>>2]|0;if(g=0,k=Ve(e[(e[w>>2]|0)+12>>2]|0,w|0,8192,k|0)|0,$=g,g=0,$&1){At=21;break t}if(!k){k=N;break i}if(k=e[t>>2]|0,o=k+12|0,l=e[o>>2]|0,(l|0)==(e[k+16>>2]|0)){if(g=0,k=ge(e[(e[k>>2]|0)+40>>2]|0,k|0)|0,At=g,g=0,At&1){At=21;break t}}else e[o>>2]=l+4,k=e[l>>2]|0;if(g=0,Ae(92,yt|0,k|0),At=g,g=0,At&1){At=21;break t}else k=R,At=44}while(!1);if(P=P+1|0,P>>>0>=4){U=k,At=244;break}else N=k}t:switch(At|0){case 21:{o=j()|0;break e}case 22:{o=j()|0;break e}case 23:{o=j()|0;break e}case 24:{o=j()|0;break e}case 25:{o=j()|0;break e}case 26:{o=j()|0;break e}case 42:{e[h>>2]=e[h>>2]|4,o=0;break}case 107:{e[h>>2]=e[h>>2]|4,o=0;break}case 148:{e[h>>2]=e[h>>2]|4,o=0;break}case 206:{e[h>>2]=e[h>>2]|4,o=0;break}case 231:{e[h>>2]=e[h>>2]|4,o=0;break}case 242:{e[h>>2]=e[h>>2]|4,o=0;break}case 244:{i:do if(_){N=_+4|0,R=_+8|0,c=1;n:for(;;){if(k=S[_>>0]|0,k&1?k=e[N>>2]|0:k=(k&255)>>>1,c>>>0>=k>>>0)break i;k=e[t>>2]|0;do if(k){if(o=e[k+12>>2]|0,(o|0)==(e[k+16>>2]|0)){if(g=0,k=ge(e[(e[k>>2]|0)+36>>2]|0,k|0)|0,D=g,g=0,D&1){At=20;break n}}else k=e[o>>2]|0;if((k|0)==-1){e[t>>2]=0,l=1;break}else{l=(e[t>>2]|0)==0;break}}else l=1;while(!1);k=e[r>>2]|0;do if(k){if(o=e[k+12>>2]|0,(o|0)==(e[k+16>>2]|0)){if(g=0,k=ge(e[(e[k>>2]|0)+36>>2]|0,k|0)|0,D=g,g=0,D&1){At=20;break n}}else k=e[o>>2]|0;if((k|0)!=-1){if(l)break;At=271;break n}else{e[r>>2]=0,At=263;break}}else At=263;while(!1);if((At|0)==263&&(At=0,l)){At=271;break}if(k=e[t>>2]|0,o=e[k+12>>2]|0,(o|0)==(e[k+16>>2]|0)){if(g=0,k=ge(e[(e[k>>2]|0)+36>>2]|0,k|0)|0,D=g,g=0,D&1){At=20;break}}else k=e[o>>2]|0;if(S[_>>0]&1?o=e[R>>2]|0:o=N,(k|0)!=(e[o+(c<<2)>>2]|0)){At=271;break}if(k=c+1|0,o=e[t>>2]|0,l=o+12|0,c=e[l>>2]|0,(c|0)==(e[o+16>>2]|0))if(g=0,ge(e[(e[o>>2]|0)+40>>2]|0,o|0)|0,D=g,g=0,D&1){At=20;break}else{c=k;continue}else{e[l>>2]=c+4,c=k;continue}}if((At|0)==20){o=j()|0;break e}else if((At|0)==271){e[h>>2]=e[h>>2]|4,o=0;break t}}while(!1);k=e[h0>>2]|0,(k|0)!=(U|0)&&(e[y0>>2]=0,V0(T0,k,U,y0),(e[y0>>2]|0)!=0)?(e[h>>2]=e[h>>2]|4,o=0):o=1;break}}return Pt(yt),Pt(g0),Pt(Oe),Pt(qt),de(T0),k=e[h0>>2]|0,e[h0>>2]=0,k|0&&(g=0,ue(e[a0>>2]|0,k|0),h0=g,g=0,h0&1)&&(h0=j(0)|0,$t(h0)),b=c0,o|0}while(!1);return Pt(yt),Pt(g0),Pt(Oe),Pt(qt),de(T0),k=e[h0>>2]|0,e[h0>>2]=0,k|0&&(g=0,ue(e[a0>>2]|0,k|0),h0=g,g=0,h0&1)&&(h0=j(0)|0,$t(h0)),le(o|0),0}function uh(t,r,o,l,c,h,d){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0;var w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0;if($=b,b=b+432|0,w=$+424|0,t=$+24|0,O=$+16|0,U=$+8|0,N=$+4|0,R=$+428|0,C=$,e[O>>2]=t,ie=O+4|0,e[ie>>2]=189,D=t+400|0,g=0,G=ge(68,c|0)|0,k=g,g=0,k&1)w=j()|0,e[O>>2]=0,Z=38;else{e[N>>2]=G,g=0,k=be(37,N|0,44212)|0,t=g,g=0;e:do if(!(t&1)&&(S[R>>0]=0,H=e[o>>2]|0,e[C>>2]=H,_=e[c+4>>2]|0,K=H,g=0,e[w>>2]=e[C>>2],_=Ut(2,r|0,w|0,l|0,N|0,_|0,h|0,R|0,k|0,O|0,U|0,D|0)|0,c=g,g=0,!(c&1))){if(_){if(S[d>>0]&1?e[e[d+8>>2]>>2]=0:S[d>>0]=0,e[d+4>>2]=0,S[R>>0]|0&&(g=0,t=be(e[(e[k>>2]|0)+44>>2]|0,k|0,45)|0,c=g,g=0,c&1||(g=0,Ae(92,d|0,t|0),c=g,g=0,c&1))||(g=0,C=be(e[(e[k>>2]|0)+44>>2]|0,k|0,48)|0,c=g,g=0,c&1))break;t=e[O>>2]|0,D=e[U>>2]|0,w=D+-4|0;t:do if(t>>>0>>0)do{if((e[t>>2]|0)!=(C|0))break t;t=t+4|0}while(t>>>0>>0);while(!1);if(g=0,Ve(33,d|0,t|0,D|0)|0,d=g,g=0,d&1)break}t=e[r>>2]|0;do if(t){if(w=e[t+12>>2]|0,(w|0)==(e[t+16>>2]|0)){if(g=0,t=ge(e[(e[t>>2]|0)+36>>2]|0,t|0)|0,d=g,g=0,d&1)break e}else t=e[w>>2]|0;if((t|0)==-1){e[r>>2]=0,w=1;break}else{w=(e[r>>2]|0)==0;break}}else w=1;while(!1);do if(H){if(t=e[K+12>>2]|0,(t|0)==(e[K+16>>2]|0)){if(g=0,t=ge(e[(e[H>>2]|0)+36>>2]|0,K|0)|0,K=g,g=0,K&1)break e}else t=e[t>>2]|0;if((t|0)!=-1){if(w)break;Z=32;break}else{e[o>>2]=0,Z=30;break}}else Z=30;while(!1);return(Z|0)==30&&w&&(Z=32),(Z|0)==32&&(e[h>>2]=e[h>>2]|2),w=e[r>>2]|0,Bt(G)|0,t=e[O>>2]|0,e[O>>2]=0,t|0&&(g=0,ue(e[ie>>2]|0,t|0),ie=g,g=0,ie&1)&&(ie=j(0)|0,$t(ie)),b=$,w|0}while(!1);w=j()|0,Bt(G)|0,t=e[O>>2]|0,e[O>>2]=0,t?Z=38:P=w}return(Z|0)==38&&(g=0,ue(e[ie>>2]|0,t|0),ie=g,g=0,ie&1?(ie=j(0)|0,$t(ie)):P=w),le(P|0),0}function fh(t,r,o,l,c,h,d,w,C,D){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0,w=w|0,C=C|0,D=D|0;var k=0,N=0,R=0,_=0,U=0,H=0,K=0,G=0,$=0,P=0,O=0,Z=0;Z=b,b=b+112|0,k=Z+100|0,N=Z+88|0,R=Z+76|0,_=Z+64|0,U=Z+52|0,H=Z+48|0,K=Z+36|0,G=Z+24|0,$=Z+12|0,P=Z;do if(t)if(t=O0(r,43956)|0,t0[e[(e[t>>2]|0)+44>>2]&127](k,t),P=e[k>>2]|0,S[o>>0]=P,S[o+1>>0]=P>>8,S[o+2>>0]=P>>16,S[o+3>>0]=P>>24,t0[e[(e[t>>2]|0)+32>>2]&127](N,t),S[C>>0]&1?e[e[C+8>>2]>>2]=0:S[C>>0]=0,e[C+4>>2]=0,g=0,Ae(93,C|0,0),o=g,g=0,o&1&&(o=j(0)|0,$t(o)),e[C>>2]=e[N>>2],e[C+4>>2]=e[N+4>>2],e[C+8>>2]=e[N+8>>2],e[N>>2]=0,e[N+4>>2]=0,e[N+8>>2]=0,Pt(N),t0[e[(e[t>>2]|0)+28>>2]&127](R,t),S[w>>0]&1?e[e[w+8>>2]>>2]=0:S[w>>0]=0,e[w+4>>2]=0,g=0,Ae(93,w|0,0),o=g,g=0,o&1&&(o=j(0)|0,$t(o)),e[w>>2]=e[R>>2],e[w+4>>2]=e[R+4>>2],e[w+8>>2]=e[R+8>>2],e[R>>2]=0,e[R+4>>2]=0,e[R+8>>2]=0,Pt(R),w=Dt[e[(e[t>>2]|0)+12>>2]&127](t)|0,e[l>>2]=w,w=Dt[e[(e[t>>2]|0)+16>>2]&127](t)|0,e[c>>2]=w,t0[e[(e[t>>2]|0)+20>>2]&127](_,t),S[h>>0]&1?(S[e[h+8>>2]>>0]=0,e[h+4>>2]=0):(S[h+1>>0]=0,S[h>>0]=0),g=0,Ae(91,h|0,0),c=g,g=0,c&1&&(c=j(0)|0,$t(c)),e[h>>2]=e[_>>2],e[h+4>>2]=e[_+4>>2],e[h+8>>2]=e[_+8>>2],e[_>>2]=0,e[_+4>>2]=0,e[_+8>>2]=0,de(_),t0[e[(e[t>>2]|0)+24>>2]&127](U,t),S[d>>0]&1?e[e[d+8>>2]>>2]=0:S[d>>0]=0,e[d+4>>2]=0,g=0,Ae(93,d|0,0),c=g,g=0,c&1)c=j(0)|0,$t(c);else{e[d>>2]=e[U>>2],e[d+4>>2]=e[U+4>>2],e[d+8>>2]=e[U+8>>2],e[U>>2]=0,e[U+4>>2]=0,e[U+8>>2]=0,Pt(U),O=Dt[e[(e[t>>2]|0)+36>>2]&127](t)|0;break}else if(t=O0(r,43892)|0,t0[e[(e[t>>2]|0)+44>>2]&127](H,t),H=e[H>>2]|0,S[o>>0]=H,S[o+1>>0]=H>>8,S[o+2>>0]=H>>16,S[o+3>>0]=H>>24,t0[e[(e[t>>2]|0)+32>>2]&127](K,t),S[C>>0]&1?e[e[C+8>>2]>>2]=0:S[C>>0]=0,e[C+4>>2]=0,g=0,Ae(93,C|0,0),o=g,g=0,o&1&&(o=j(0)|0,$t(o)),e[C>>2]=e[K>>2],e[C+4>>2]=e[K+4>>2],e[C+8>>2]=e[K+8>>2],e[K>>2]=0,e[K+4>>2]=0,e[K+8>>2]=0,Pt(K),t0[e[(e[t>>2]|0)+28>>2]&127](G,t),S[w>>0]&1?e[e[w+8>>2]>>2]=0:S[w>>0]=0,e[w+4>>2]=0,g=0,Ae(93,w|0,0),o=g,g=0,o&1&&(o=j(0)|0,$t(o)),e[w>>2]=e[G>>2],e[w+4>>2]=e[G+4>>2],e[w+8>>2]=e[G+8>>2],e[G>>2]=0,e[G+4>>2]=0,e[G+8>>2]=0,Pt(G),w=Dt[e[(e[t>>2]|0)+12>>2]&127](t)|0,e[l>>2]=w,w=Dt[e[(e[t>>2]|0)+16>>2]&127](t)|0,e[c>>2]=w,t0[e[(e[t>>2]|0)+20>>2]&127]($,t),S[h>>0]&1?(S[e[h+8>>2]>>0]=0,e[h+4>>2]=0):(S[h+1>>0]=0,S[h>>0]=0),g=0,Ae(91,h|0,0),c=g,g=0,c&1&&(c=j(0)|0,$t(c)),e[h>>2]=e[$>>2],e[h+4>>2]=e[$+4>>2],e[h+8>>2]=e[$+8>>2],e[$>>2]=0,e[$+4>>2]=0,e[$+8>>2]=0,de($),t0[e[(e[t>>2]|0)+24>>2]&127](P,t),S[d>>0]&1?e[e[d+8>>2]>>2]=0:S[d>>0]=0,e[d+4>>2]=0,g=0,Ae(93,d|0,0),c=g,g=0,c&1)c=j(0)|0,$t(c);else{e[d>>2]=e[P>>2],e[d+4>>2]=e[P+4>>2],e[d+8>>2]=e[P+8>>2],e[P>>2]=0,e[P+4>>2]=0,e[P+8>>2]=0,Pt(P),O=Dt[e[(e[t>>2]|0)+36>>2]&127](t)|0;break}while(!1);e[D>>2]=O,b=Z}function hh(t){t=t|0}function dh(t){t=t|0,he(t)}function ph(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=+h;var d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0,ce=0,ke=0,Ee=0,Te=0,it=0;ne=b,b=b+384|0,K=ne+8|0,d=ne,C=ne+284|0,D=ne+72|0,w=ne+184|0,ke=ne+68|0,Z=ne+80|0,$=ne+77|0,ie=ne+76|0,Ee=ne+56|0,it=ne+44|0,Te=ne+32|0,k=ne+28|0,H=ne+84|0,O=ne+24|0,P=ne+20|0,G=ne+16|0,e[D>>2]=C,B[K>>3]=h,C=Mo(C,100,59018,K)|0;do if(C>>>0>99)if(g=0,t=Ce(3)|0,oe=g,g=0,!(oe&1)&&(g=0,B[d>>3]=h,_=Pe(17,D|0,t|0,59018,d|0)|0,oe=g,g=0,!(oe&1))){if(t=e[D>>2]|0,!t){if(g=0,Nt(6),oe=g,g=0,oe&1){t=0,d=0,oe=7;break}t=e[D>>2]|0}w=E0(_)|0,d=w,w?(U=w,oe=10):(g=0,Nt(6),oe=g,g=0,oe&1?oe=7:(U=0,oe=10))}else t=0,d=0,oe=7;else d=0,t=0,U=w,_=C,oe=10;while(!1);if((oe|0)==10)if(g=0,w=ge(68,l|0)|0,R=g,g=0,R&1)oe=7;else{if(e[ke>>2]=w,g=0,R=be(37,ke|0,44220)|0,N=g,g=0,!(N&1)&&(N=e[D>>2]|0,g=0,Pe(e[(e[R>>2]|0)+32>>2]|0,R|0,N|0,N+_|0,U|0)|0,N=g,g=0,!(N&1))){if(_?N=(S[e[D>>2]>>0]|0)==45:N=0,e[Ee>>2]=0,e[Ee+4>>2]=0,e[Ee+8>>2]=0,e[it>>2]=0,e[it+4>>2]=0,e[it+8>>2]=0,e[Te>>2]=0,e[Te+4>>2]=0,e[Te+8>>2]=0,g=0,I0(3,o|0,N|0,ke|0,Z|0,$|0,ie|0,Ee|0,it|0,Te|0,k|0),o=g,g=0,o&1)C=j()|0;else{if(k=e[k>>2]|0,(_|0)>(k|0)?(o=S[Te>>0]|0,C=S[it>>0]|0,C=(_-k<<1|1)+k+(o&1?e[Te+4>>2]|0:(o&255)>>>1)+(C&1?e[it+4>>2]|0:(C&255)>>>1)|0):(o=S[Te>>0]|0,C=S[it>>0]|0,C=k+2+(o&1?e[Te+4>>2]|0:(o&255)>>>1)+(C&1?e[it+4>>2]|0:(C&255)>>>1)|0),C>>>0>100?(C=E0(C)|0,D=C,C?oe=26:(g=0,Nt(6),H=g,g=0,H&1||(C=0,oe=26))):(D=0,C=H,oe=26),(oe|0)==26&&(g=0,Zt(1,C|0,O|0,P|0,e[l+4>>2]|0,U|0,U+_|0,R|0,N|0,Z|0,S[$>>0]|0,S[ie>>0]|0,Ee|0,it|0,Te|0,k|0),ie=g,g=0,!(ie&1)&&(e[G>>2]=e[r>>2],r=e[O>>2]|0,ce=e[P>>2]|0,g=0,e[K>>2]=e[G>>2],ce=Vt(39,K|0,C|0,r|0,ce|0,l|0,c|0)|0,r=g,g=0,!(r&1))))return D&&(n0(D),w=e[ke>>2]|0),de(Te),de(it),de(Ee),Bt(w)|0,d&&n0(d),t&&n0(t),b=ne,ce|0;C=j()|0,D&&(n0(D),w=e[ke>>2]|0)}de(Te),de(it),de(Ee)}else C=j()|0;Bt(w)|0}return(oe|0)==7&&(C=j()|0),d&&n0(d),t&&n0(t),le(C|0),0}function mh(t,r,o,l,c,h,d,w,C,D){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0,w=w|0,C=C|0,D=D|0;var k=0,N=0,R=0,_=0,U=0,H=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0,ce=0;ce=b,b=b+112|0,R=ce+108|0,_=ce+96|0,K=ce+92|0,G=ce+80|0,$=ce+68|0,P=ce+56|0,O=ce+52|0,Z=ce+40|0,ie=ce+36|0,oe=ce+24|0,U=ce+12|0,H=ce;do if(t){t=O0(o,43828)|0,o=e[t>>2]|0;do if(r)if(t0[e[o+44>>2]&127](R,t),r=e[R>>2]|0,S[l>>0]=r,S[l+1>>0]=r>>8,S[l+2>>0]=r>>16,S[l+3>>0]=r>>24,t0[e[(e[t>>2]|0)+32>>2]&127](_,t),S[C>>0]&1?(S[e[C+8>>2]>>0]=0,e[C+4>>2]=0):(S[C+1>>0]=0,S[C>>0]=0),g=0,Ae(91,C|0,0),l=g,g=0,l&1)C=j(0)|0,$t(C);else{e[C>>2]=e[_>>2],e[C+4>>2]=e[_+4>>2],e[C+8>>2]=e[_+8>>2],e[_>>2]=0,e[_+4>>2]=0,e[_+8>>2]=0,de(_),N=t;break}else if(t0[e[o+40>>2]&127](K,t),r=e[K>>2]|0,S[l>>0]=r,S[l+1>>0]=r>>8,S[l+2>>0]=r>>16,S[l+3>>0]=r>>24,t0[e[(e[t>>2]|0)+28>>2]&127](G,t),S[C>>0]&1?(S[e[C+8>>2]>>0]=0,e[C+4>>2]=0):(S[C+1>>0]=0,S[C>>0]=0),g=0,Ae(91,C|0,0),l=g,g=0,l&1)C=j(0)|0,$t(C);else{e[C>>2]=e[G>>2],e[C+4>>2]=e[G+4>>2],e[C+8>>2]=e[G+8>>2],e[G>>2]=0,e[G+4>>2]=0,e[G+8>>2]=0,de(G),N=t;break}while(!1);if(C=Dt[e[(e[t>>2]|0)+12>>2]&127](t)|0,S[c>>0]=C,C=Dt[e[(e[t>>2]|0)+16>>2]&127](t)|0,S[h>>0]=C,t0[e[(e[N>>2]|0)+20>>2]&127]($,t),S[d>>0]&1?(S[e[d+8>>2]>>0]=0,e[d+4>>2]=0):(S[d+1>>0]=0,S[d>>0]=0),g=0,Ae(91,d|0,0),h=g,g=0,h&1&&(h=j(0)|0,$t(h)),e[d>>2]=e[$>>2],e[d+4>>2]=e[$+4>>2],e[d+8>>2]=e[$+8>>2],e[$>>2]=0,e[$+4>>2]=0,e[$+8>>2]=0,de($),t0[e[(e[N>>2]|0)+24>>2]&127](P,t),S[w>>0]&1?(S[e[w+8>>2]>>0]=0,e[w+4>>2]=0):(S[w+1>>0]=0,S[w>>0]=0),g=0,Ae(91,w|0,0),h=g,g=0,h&1)h=j(0)|0,$t(h);else{e[w>>2]=e[P>>2],e[w+4>>2]=e[P+4>>2],e[w+8>>2]=e[P+8>>2],e[P>>2]=0,e[P+4>>2]=0,e[P+8>>2]=0,de(P),ne=Dt[e[(e[t>>2]|0)+36>>2]&127](t)|0;break}}else{t=O0(o,43764)|0,o=e[t>>2]|0;do if(r)if(t0[e[o+44>>2]&127](O,t),r=e[O>>2]|0,S[l>>0]=r,S[l+1>>0]=r>>8,S[l+2>>0]=r>>16,S[l+3>>0]=r>>24,t0[e[(e[t>>2]|0)+32>>2]&127](Z,t),S[C>>0]&1?(S[e[C+8>>2]>>0]=0,e[C+4>>2]=0):(S[C+1>>0]=0,S[C>>0]=0),g=0,Ae(91,C|0,0),l=g,g=0,l&1)C=j(0)|0,$t(C);else{e[C>>2]=e[Z>>2],e[C+4>>2]=e[Z+4>>2],e[C+8>>2]=e[Z+8>>2],e[Z>>2]=0,e[Z+4>>2]=0,e[Z+8>>2]=0,de(Z),k=t;break}else if(t0[e[o+40>>2]&127](ie,t),r=e[ie>>2]|0,S[l>>0]=r,S[l+1>>0]=r>>8,S[l+2>>0]=r>>16,S[l+3>>0]=r>>24,t0[e[(e[t>>2]|0)+28>>2]&127](oe,t),S[C>>0]&1?(S[e[C+8>>2]>>0]=0,e[C+4>>2]=0):(S[C+1>>0]=0,S[C>>0]=0),g=0,Ae(91,C|0,0),l=g,g=0,l&1)C=j(0)|0,$t(C);else{e[C>>2]=e[oe>>2],e[C+4>>2]=e[oe+4>>2],e[C+8>>2]=e[oe+8>>2],e[oe>>2]=0,e[oe+4>>2]=0,e[oe+8>>2]=0,de(oe),k=t;break}while(!1);if(C=Dt[e[(e[t>>2]|0)+12>>2]&127](t)|0,S[c>>0]=C,C=Dt[e[(e[t>>2]|0)+16>>2]&127](t)|0,S[h>>0]=C,t0[e[(e[k>>2]|0)+20>>2]&127](U,t),S[d>>0]&1?(S[e[d+8>>2]>>0]=0,e[d+4>>2]=0):(S[d+1>>0]=0,S[d>>0]=0),g=0,Ae(91,d|0,0),h=g,g=0,h&1&&(h=j(0)|0,$t(h)),e[d>>2]=e[U>>2],e[d+4>>2]=e[U+4>>2],e[d+8>>2]=e[U+8>>2],e[U>>2]=0,e[U+4>>2]=0,e[U+8>>2]=0,de(U),t0[e[(e[k>>2]|0)+24>>2]&127](H,t),S[w>>0]&1?(S[e[w+8>>2]>>0]=0,e[w+4>>2]=0):(S[w+1>>0]=0,S[w>>0]=0),g=0,Ae(91,w|0,0),h=g,g=0,h&1)h=j(0)|0,$t(h);else{e[w>>2]=e[H>>2],e[w+4>>2]=e[H+4>>2],e[w+8>>2]=e[H+8>>2],e[H>>2]=0,e[H+4>>2]=0,e[H+8>>2]=0,de(H),ne=Dt[e[(e[t>>2]|0)+36>>2]&127](t)|0;break}}while(!1);e[D>>2]=ne,b=ce}function gh(t,r,o,l,c,h,d,w,C,D,k,N,R,_,U){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0,w=w|0,C=C|0,D=D|0,k=k|0,N=N|0,R=R|0,_=_|0,U=U|0;var H=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0,ce=0,ke=0,Ee=0,Te=0,it=0,jt=0,Gt=0,s0=0,i0=0,zt=0,gt=0,Kt=0,dt=0,At=0;e[o>>2]=t,Kt=_+4|0,dt=_+8|0,At=_+1|0,jt=R+4|0,Gt=(l&512|0)==0,s0=R+8|0,i0=R+1|0,zt=d+8|0,gt=(U|0)>0,oe=N+4|0,ne=N+8|0,ce=N+1|0,ke=U+1|0,Te=-2-U-((U|0)<0?~U:-1)|0,it=(U|0)>0,ie=0;do{switch(S[C+ie>>0]|0){case 0:{e[r>>2]=e[o>>2];break}case 1:{e[r>>2]=e[o>>2],O=U0[e[(e[d>>2]|0)+28>>2]&63](d,32)|0,Z=e[o>>2]|0,e[o>>2]=Z+1,S[Z>>0]=O;break}case 3:{Z=S[_>>0]|0,H=(Z&1)==0,(H?(Z&255)>>>1:e[Kt>>2]|0)|0&&(O=S[(H?At:e[dt>>2]|0)>>0]|0,Z=e[o>>2]|0,e[o>>2]=Z+1,S[Z>>0]=O);break}case 2:{if(G=S[R>>0]|0,H=(G&1)==0,G=H?(G&255)>>>1:e[jt>>2]|0,!(Gt|(G|0)==0)){if(K=H?i0:e[s0>>2]|0,$=K+G|0,H=e[o>>2]|0,G)do S[H>>0]=S[K>>0]|0,K=K+1|0,H=H+1|0;while((K|0)!=($|0));e[o>>2]=H}break}case 4:{H=e[o>>2]|0,c=w?c+1|0:c,P=c,$=e[zt>>2]|0;e:do if(c>>>0>>0){K=c;do{if(G=S[K>>0]|0,G<<24>>24<=-1||!(I[$+(G<<24>>24<<1)>>1]&2048))break e;K=K+1|0}while(K>>>0>>0)}else K=c;while(!1);if(G=K,gt){if(O=-2-G-~(G>>>0>P>>>0?P:G)|0,O=Te>>>0>O>>>0?Te:O,K>>>0>c>>>0&it)for(G=K,P=U;G=G+-1|0,Z=S[G>>0]|0,$=e[o>>2]|0,e[o>>2]=$+1,S[$>>0]=Z,$=(P|0)>1,G>>>0>c>>>0&$;)P=P+-1|0;else $=it;if(Z=ke+O|0,G=K+(O+1)|0,$?P=U0[e[(e[d>>2]|0)+28>>2]&63](d,48)|0:P=0,K=e[o>>2]|0,e[o>>2]=K+1,(Z|0)>0)for($=Z;S[K>>0]=P,K=e[o>>2]|0,e[o>>2]=K+1,($|0)>1;)$=$+-1|0;S[K>>0]=D}else G=K;if((G|0)!=(c|0)){if(Z=S[N>>0]|0,K=(Z&1)==0,(K?(Z&255)>>>1:e[oe>>2]|0)|0?K=S[(K?ce:e[ne>>2]|0)>>0]|0:K=-1,(G|0)!=(c|0))for($=0,P=0;(P|0)==(K|0)&&(Z=e[o>>2]|0,e[o>>2]=Z+1,S[Z>>0]=k,$=$+1|0,Z=S[N>>0]|0,K=(Z&1)==0,$>>>0<(K?(Z&255)>>>1:e[oe>>2]|0)>>>0?(K=S[(K?ce:e[ne>>2]|0)+$>>0]|0,K=K<<24>>24==127?-1:K<<24>>24,P=0):(K=P,P=0)),G=G+-1|0,O=S[G>>0]|0,Z=e[o>>2]|0,e[o>>2]=Z+1,S[Z>>0]=O,(G|0)!=(c|0);)P=P+1|0}else O=U0[e[(e[d>>2]|0)+28>>2]&63](d,48)|0,Z=e[o>>2]|0,e[o>>2]=Z+1,S[Z>>0]=O;if(K=e[o>>2]|0,(H|0)!=(K|0)&&(Ee=K+-1|0,H>>>0>>0)){K=Ee;do Z=S[H>>0]|0,S[H>>0]=S[K>>0]|0,S[K>>0]=Z,H=H+1|0,K=K+-1|0;while(H>>>0>>0)}break}default:}ie=ie+1|0}while((ie|0)!=4);if(K=S[_>>0]|0,c=(K&1)==0,K=c?(K&255)>>>1:e[Kt>>2]|0,K>>>0>1){if(H=c?At:e[dt>>2]|0,G=H+K|0,c=e[o>>2]|0,(K|0)!=1){H=H+1|0;do S[c>>0]=S[H>>0]|0,c=c+1|0,H=H+1|0;while((H|0)!=(G|0))}e[o>>2]=c}switch(l&176|0){case 32:{e[r>>2]=e[o>>2];break}case 16:break;default:e[r>>2]=t}}function Sh(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0,ce=0,ke=0,Ee=0,Te=0;Z=b,b=b+176|0,_=Z+56|0,oe=Z+52|0,P=Z+64|0,K=Z+61|0,O=Z+60|0,ne=Z+40|0,ke=Z+28|0,ce=Z+16|0,D=Z+12|0,R=Z+68|0,$=Z+8|0,G=Z+4|0,U=Z,t=f0(l)|0,e[oe>>2]=t,g=0,H=be(37,oe|0,44220)|0,N=g,g=0;do if(N&1)Ee=13;else{if(k=S[h>>0]|0,d=(k&1)==0,N=h+4|0,!((d?(k&255)>>>1:e[N>>2]|0)|0))k=0;else{if(d=S[(d?h+1|0:e[h+8>>2]|0)>>0]|0,g=0,w=be(e[(e[H>>2]|0)+28>>2]|0,H|0,45)|0,k=g,g=0,k&1){Ee=13;break}k=d<<24>>24==w<<24>>24}if(e[ne>>2]=0,e[ne+4>>2]=0,e[ne+8>>2]=0,e[ke>>2]=0,e[ke+4>>2]=0,e[ke+8>>2]=0,e[ce>>2]=0,e[ce+4>>2]=0,e[ce+8>>2]=0,g=0,I0(3,o|0,k|0,oe|0,P|0,K|0,O|0,ne|0,ke|0,ce|0,D|0),C=g,g=0,C&1)d=j()|0;else{if(C=S[h>>0]|0,o=e[N>>2]|0,d=C&1?o:(C&255)>>>1,D=e[D>>2]|0,(d|0)>(D|0)?(Te=S[ce>>0]|0,w=S[ke>>0]|0,d=(d-D<<1|1)+D+(Te&1?e[ce+4>>2]|0:(Te&255)>>>1)+(w&1?e[ke+4>>2]|0:(w&255)>>>1)|0):(Te=S[ce>>0]|0,d=S[ke>>0]|0,d=D+2+(Te&1?e[ce+4>>2]|0:(Te&255)>>>1)+(d&1?e[ke+4>>2]|0:(d&255)>>>1)|0),d>>>0>100?(d=E0(d)|0,w=d,d?Ee=17:(g=0,Nt(6),Te=g,g=0,Te&1||(C=S[h>>0]|0,o=e[N>>2]|0,d=0,Ee=17))):(w=0,d=R,Ee=17),(Ee|0)==17&&(Te=(C&1)==0,h=Te?h+1|0:e[h+8>>2]|0,g=0,Zt(1,d|0,$|0,G|0,e[l+4>>2]|0,h|0,h+(Te?(C&255)>>>1:o)|0,H|0,k|0,P|0,S[K>>0]|0,S[O>>0]|0,ne|0,ke|0,ce|0,D|0),Te=g,g=0,!(Te&1)&&(e[U>>2]=e[r>>2],Te=e[$>>2]|0,ie=e[G>>2]|0,g=0,e[_>>2]=e[U>>2],ie=Vt(39,_|0,d|0,Te|0,ie|0,l|0,c|0)|0,Te=g,g=0,!(Te&1))))return w&&(n0(w),t=e[oe>>2]|0),de(ce),de(ke),de(ne),Bt(t)|0,b=Z,ie|0;d=j()|0,w&&(n0(w),t=e[oe>>2]|0)}de(ce),de(ke),de(ne)}while(!1);return(Ee|0)==13&&(d=j()|0),Bt(t)|0,le(d|0),0}function Ah(t){t=t|0}function vh(t){t=t|0,he(t)}function xh(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=+h;var d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0,ce=0,ke=0,Ee=0,Te=0,it=0;ne=b,b=b+992|0,K=ne+8|0,d=ne,C=ne+888|0,D=ne+880|0,w=ne+480|0,ke=ne+76|0,Z=ne+884|0,$=ne+72|0,ie=ne+68|0,Ee=ne+56|0,it=ne+44|0,Te=ne+32|0,k=ne+28|0,H=ne+80|0,O=ne+24|0,P=ne+20|0,G=ne+16|0,e[D>>2]=C,B[K>>3]=h,C=Mo(C,100,59018,K)|0;do if(C>>>0>99)if(g=0,t=Ce(3)|0,oe=g,g=0,!(oe&1)&&(g=0,B[d>>3]=h,_=Pe(17,D|0,t|0,59018,d|0)|0,oe=g,g=0,!(oe&1))){if(t=e[D>>2]|0,!t){if(g=0,Nt(6),oe=g,g=0,oe&1){t=0,d=0,oe=7;break}t=e[D>>2]|0}w=E0(_<<2)|0,d=w,w?(U=w,oe=10):(g=0,Nt(6),oe=g,g=0,oe&1?oe=7:(U=0,oe=10))}else t=0,d=0,oe=7;else d=0,t=0,U=w,_=C,oe=10;while(!1);if((oe|0)==10)if(g=0,w=ge(68,l|0)|0,R=g,g=0,R&1)oe=7;else{if(e[ke>>2]=w,g=0,R=be(37,ke|0,44212)|0,N=g,g=0,!(N&1)&&(N=e[D>>2]|0,g=0,Pe(e[(e[R>>2]|0)+48>>2]|0,R|0,N|0,N+_|0,U|0)|0,N=g,g=0,!(N&1))){if(_?N=(S[e[D>>2]>>0]|0)==45:N=0,e[Ee>>2]=0,e[Ee+4>>2]=0,e[Ee+8>>2]=0,e[it>>2]=0,e[it+4>>2]=0,e[it+8>>2]=0,e[Te>>2]=0,e[Te+4>>2]=0,e[Te+8>>2]=0,g=0,I0(4,o|0,N|0,ke|0,Z|0,$|0,ie|0,Ee|0,it|0,Te|0,k|0),o=g,g=0,o&1)C=j()|0;else{if(k=e[k>>2]|0,(_|0)>(k|0)?(o=S[Te>>0]|0,C=S[it>>0]|0,C=(_-k<<1|1)+k+(o&1?e[Te+4>>2]|0:(o&255)>>>1)+(C&1?e[it+4>>2]|0:(C&255)>>>1)|0):(o=S[Te>>0]|0,C=S[it>>0]|0,C=k+2+(o&1?e[Te+4>>2]|0:(o&255)>>>1)+(C&1?e[it+4>>2]|0:(C&255)>>>1)|0),C>>>0>100?(C=E0(C<<2)|0,D=C,C?oe=26:(g=0,Nt(6),H=g,g=0,H&1||(C=0,oe=26))):(D=0,C=H,oe=26),(oe|0)==26&&(g=0,Zt(2,C|0,O|0,P|0,e[l+4>>2]|0,U|0,U+(_<<2)|0,R|0,N|0,Z|0,e[$>>2]|0,e[ie>>2]|0,Ee|0,it|0,Te|0,k|0),ie=g,g=0,!(ie&1)&&(e[G>>2]=e[r>>2],r=e[O>>2]|0,ce=e[P>>2]|0,g=0,e[K>>2]=e[G>>2],ce=Vt(40,K|0,C|0,r|0,ce|0,l|0,c|0)|0,r=g,g=0,!(r&1))))return D&&(n0(D),w=e[ke>>2]|0),Pt(Te),Pt(it),de(Ee),Bt(w)|0,d&&n0(d),t&&n0(t),b=ne,ce|0;C=j()|0,D&&(n0(D),w=e[ke>>2]|0)}Pt(Te),Pt(it),de(Ee)}else C=j()|0;Bt(w)|0}return(oe|0)==7&&(C=j()|0),d&&n0(d),t&&n0(t),le(C|0),0}function wh(t,r,o,l,c,h,d,w,C,D){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0,w=w|0,C=C|0,D=D|0;var k=0,N=0,R=0,_=0,U=0,H=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0;oe=b,b=b+112|0,k=oe+108|0,N=oe+96|0,U=oe+92|0,H=oe+80|0,K=oe+68|0,G=oe+56|0,$=oe+52|0,P=oe+40|0,O=oe+36|0,Z=oe+24|0,R=oe+12|0,_=oe;do if(t){t=O0(o,43956)|0,o=e[t>>2]|0;do if(r)if(t0[e[o+44>>2]&127](k,t),r=e[k>>2]|0,S[l>>0]=r,S[l+1>>0]=r>>8,S[l+2>>0]=r>>16,S[l+3>>0]=r>>24,t0[e[(e[t>>2]|0)+32>>2]&127](N,t),S[C>>0]&1?e[e[C+8>>2]>>2]=0:S[C>>0]=0,e[C+4>>2]=0,g=0,Ae(93,C|0,0),l=g,g=0,l&1)C=j(0)|0,$t(C);else{e[C>>2]=e[N>>2],e[C+4>>2]=e[N+4>>2],e[C+8>>2]=e[N+8>>2],e[N>>2]=0,e[N+4>>2]=0,e[N+8>>2]=0,Pt(N);break}else if(t0[e[o+40>>2]&127](U,t),r=e[U>>2]|0,S[l>>0]=r,S[l+1>>0]=r>>8,S[l+2>>0]=r>>16,S[l+3>>0]=r>>24,t0[e[(e[t>>2]|0)+28>>2]&127](H,t),S[C>>0]&1?e[e[C+8>>2]>>2]=0:S[C>>0]=0,e[C+4>>2]=0,g=0,Ae(93,C|0,0),l=g,g=0,l&1)C=j(0)|0,$t(C);else{e[C>>2]=e[H>>2],e[C+4>>2]=e[H+4>>2],e[C+8>>2]=e[H+8>>2],e[H>>2]=0,e[H+4>>2]=0,e[H+8>>2]=0,Pt(H);break}while(!1);if(C=Dt[e[(e[t>>2]|0)+12>>2]&127](t)|0,e[c>>2]=C,C=Dt[e[(e[t>>2]|0)+16>>2]&127](t)|0,e[h>>2]=C,t0[e[(e[t>>2]|0)+20>>2]&127](K,t),S[d>>0]&1?(S[e[d+8>>2]>>0]=0,e[d+4>>2]=0):(S[d+1>>0]=0,S[d>>0]=0),g=0,Ae(91,d|0,0),h=g,g=0,h&1&&(h=j(0)|0,$t(h)),e[d>>2]=e[K>>2],e[d+4>>2]=e[K+4>>2],e[d+8>>2]=e[K+8>>2],e[K>>2]=0,e[K+4>>2]=0,e[K+8>>2]=0,de(K),t0[e[(e[t>>2]|0)+24>>2]&127](G,t),S[w>>0]&1?e[e[w+8>>2]>>2]=0:S[w>>0]=0,e[w+4>>2]=0,g=0,Ae(93,w|0,0),h=g,g=0,h&1)h=j(0)|0,$t(h);else{e[w>>2]=e[G>>2],e[w+4>>2]=e[G+4>>2],e[w+8>>2]=e[G+8>>2],e[G>>2]=0,e[G+4>>2]=0,e[G+8>>2]=0,Pt(G),ie=Dt[e[(e[t>>2]|0)+36>>2]&127](t)|0;break}}else{t=O0(o,43892)|0,o=e[t>>2]|0;do if(r)if(t0[e[o+44>>2]&127]($,t),r=e[$>>2]|0,S[l>>0]=r,S[l+1>>0]=r>>8,S[l+2>>0]=r>>16,S[l+3>>0]=r>>24,t0[e[(e[t>>2]|0)+32>>2]&127](P,t),S[C>>0]&1?e[e[C+8>>2]>>2]=0:S[C>>0]=0,e[C+4>>2]=0,g=0,Ae(93,C|0,0),l=g,g=0,l&1)C=j(0)|0,$t(C);else{e[C>>2]=e[P>>2],e[C+4>>2]=e[P+4>>2],e[C+8>>2]=e[P+8>>2],e[P>>2]=0,e[P+4>>2]=0,e[P+8>>2]=0,Pt(P);break}else if(t0[e[o+40>>2]&127](O,t),r=e[O>>2]|0,S[l>>0]=r,S[l+1>>0]=r>>8,S[l+2>>0]=r>>16,S[l+3>>0]=r>>24,t0[e[(e[t>>2]|0)+28>>2]&127](Z,t),S[C>>0]&1?e[e[C+8>>2]>>2]=0:S[C>>0]=0,e[C+4>>2]=0,g=0,Ae(93,C|0,0),l=g,g=0,l&1)C=j(0)|0,$t(C);else{e[C>>2]=e[Z>>2],e[C+4>>2]=e[Z+4>>2],e[C+8>>2]=e[Z+8>>2],e[Z>>2]=0,e[Z+4>>2]=0,e[Z+8>>2]=0,Pt(Z);break}while(!1);if(C=Dt[e[(e[t>>2]|0)+12>>2]&127](t)|0,e[c>>2]=C,C=Dt[e[(e[t>>2]|0)+16>>2]&127](t)|0,e[h>>2]=C,t0[e[(e[t>>2]|0)+20>>2]&127](R,t),S[d>>0]&1?(S[e[d+8>>2]>>0]=0,e[d+4>>2]=0):(S[d+1>>0]=0,S[d>>0]=0),g=0,Ae(91,d|0,0),h=g,g=0,h&1&&(h=j(0)|0,$t(h)),e[d>>2]=e[R>>2],e[d+4>>2]=e[R+4>>2],e[d+8>>2]=e[R+8>>2],e[R>>2]=0,e[R+4>>2]=0,e[R+8>>2]=0,de(R),t0[e[(e[t>>2]|0)+24>>2]&127](_,t),S[w>>0]&1?e[e[w+8>>2]>>2]=0:S[w>>0]=0,e[w+4>>2]=0,g=0,Ae(93,w|0,0),h=g,g=0,h&1)h=j(0)|0,$t(h);else{e[w>>2]=e[_>>2],e[w+4>>2]=e[_+4>>2],e[w+8>>2]=e[_+8>>2],e[_>>2]=0,e[_+4>>2]=0,e[_+8>>2]=0,Pt(_),ie=Dt[e[(e[t>>2]|0)+36>>2]&127](t)|0;break}}while(!1);e[D>>2]=ie,b=oe}function yh(t,r,o,l,c,h,d,w,C,D,k,N,R,_,U){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0,w=w|0,C=C|0,D=D|0,k=k|0,N=N|0,R=R|0,_=_|0,U=U|0;var H=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0,ce=0,ke=0,Ee=0,Te=0,it=0,jt=0,Gt=0,s0=0,i0=0,zt=0;e[o>>2]=t,i0=_+4|0,zt=_+8|0,ke=R+4|0,Ee=(l&512|0)==0,Te=R+8|0,it=(U|0)>0,jt=N+4|0,Gt=N+8|0,s0=N+1|0,ne=(U|0)>0,oe=0;do{switch(S[C+oe>>0]|0){case 0:{e[r>>2]=e[o>>2];break}case 1:{e[r>>2]=e[o>>2],Z=U0[e[(e[d>>2]|0)+44>>2]&63](d,32)|0,ie=e[o>>2]|0,e[o>>2]=ie+4,e[ie>>2]=Z;break}case 3:{ie=S[_>>0]|0,H=(ie&1)==0,(H?(ie&255)>>>1:e[i0>>2]|0)|0&&(Z=e[(H?i0:e[zt>>2]|0)>>2]|0,ie=e[o>>2]|0,e[o>>2]=ie+4,e[ie>>2]=Z);break}case 2:{if(P=S[R>>0]|0,H=(P&1)==0,P=H?(P&255)>>>1:e[ke>>2]|0,!(Ee|(P|0)==0)){if(H=H?ke:e[Te>>2]|0,G=H+(P<<2)|0,$=e[o>>2]|0,P)for(K=$;e[K>>2]=e[H>>2],H=H+4|0,(H|0)!=(G|0);)K=K+4|0;e[o>>2]=$+(P<<2)}break}case 4:{H=e[o>>2]|0,c=w?c+4|0:c;e:do if(c>>>0>>0){K=c;do{if(!(Yt[e[(e[d>>2]|0)+12>>2]&63](d,2048,e[K>>2]|0)|0))break e;K=K+4|0}while(K>>>0>>0)}else K=c;while(!1);if(it){if(K>>>0>c>>>0&ne){for(P=e[o>>2]|0,$=U;;)if(K=K+-4|0,G=P+4|0,e[P>>2]=e[K>>2],O=$+-1|0,$=($|0)>1,K>>>0>c>>>0&$)P=G,$=O;else{P=O;break}e[o>>2]=G,G=P}else $=ne,G=U;if($?O=U0[e[(e[d>>2]|0)+44>>2]&63](d,48)|0:O=0,Z=e[o>>2]|0,$=G+((G|0)<0?~G:-1)|0,(G|0)>0)for(P=Z;e[P>>2]=O,(G|0)>1;)P=P+4|0,G=G+-1|0;e[o>>2]=Z+($+2<<2),e[Z+($+1<<2)>>2]=D}if((K|0)==(c|0))Z=U0[e[(e[d>>2]|0)+44>>2]&63](d,48)|0,ie=e[o>>2]|0,K=ie+4|0,e[o>>2]=K,e[ie>>2]=Z;else{if(Z=S[N>>0]|0,G=(Z&1)==0,ie=e[jt>>2]|0,(G?(Z&255)>>>1:ie)|0?G=S[(G?s0:e[Gt>>2]|0)>>0]|0:G=-1,(K|0)!=(c|0))for(O=0,Z=0;$=e[o>>2]|0,(Z|0)==(G|0)?(P=$+4|0,e[o>>2]=P,e[$>>2]=k,O=O+1|0,$=S[N>>0]|0,G=($&1)==0,O>>>0<(G?($&255)>>>1:ie)>>>0?(G=S[(G?s0:e[Gt>>2]|0)+O>>0]|0,$=P,G=G<<24>>24==127?-1:G<<24>>24,P=0):($=P,G=Z,P=0)):P=Z,K=K+-4|0,Z=e[K>>2]|0,e[o>>2]=$+4,e[$>>2]=Z,(K|0)!=(c|0);)Z=P+1|0;K=e[o>>2]|0}if((H|0)!=(K|0)&&(ce=K+-4|0,H>>>0>>0)){K=ce;do ie=e[H>>2]|0,e[H>>2]=e[K>>2],e[K>>2]=ie,H=H+4|0,K=K+-4|0;while(H>>>0>>0)}break}default:}oe=oe+1|0}while((oe|0)!=4);if(H=S[_>>0]|0,c=(H&1)==0,H=c?(H&255)>>>1:e[i0>>2]|0,H>>>0>1){if(K=c?i0:e[zt>>2]|0,c=K+4|0,K=K+(H<<2)|0,G=e[o>>2]|0,$=K-c|0,(H|0)!=1)for(H=G;e[H>>2]=e[c>>2],c=c+4|0,(c|0)!=(K|0);)H=H+4|0;e[o>>2]=G+($>>>2<<2)}switch(l&176|0){case 32:{e[r>>2]=e[o>>2];break}case 16:break;default:e[r>>2]=t}}function Ch(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0,ce=0,ke=0,Ee=0,Te=0;Z=b,b=b+480|0,R=Z+468|0,oe=Z+464|0,P=Z+472|0,K=Z+56|0,O=Z+52|0,ne=Z+40|0,ke=Z+28|0,ce=Z+16|0,D=Z+12|0,N=Z+64|0,$=Z+8|0,G=Z+4|0,_=Z,t=f0(l)|0,e[oe>>2]=t,g=0,U=be(37,oe|0,44212)|0,H=g,g=0;do if(H&1)Ee=13;else{if(k=S[h>>0]|0,d=(k&1)==0,H=h+4|0,!((d?(k&255)>>>1:e[H>>2]|0)|0))k=0;else{if(d=e[(d?H:e[h+8>>2]|0)>>2]|0,g=0,w=be(e[(e[U>>2]|0)+44>>2]|0,U|0,45)|0,k=g,g=0,k&1){Ee=13;break}k=(d|0)==(w|0)}if(e[ne>>2]=0,e[ne+4>>2]=0,e[ne+8>>2]=0,e[ke>>2]=0,e[ke+4>>2]=0,e[ke+8>>2]=0,e[ce>>2]=0,e[ce+4>>2]=0,e[ce+8>>2]=0,g=0,I0(4,o|0,k|0,oe|0,P|0,K|0,O|0,ne|0,ke|0,ce|0,D|0),C=g,g=0,C&1)d=j()|0;else{if(C=S[h>>0]|0,o=e[H>>2]|0,d=C&1?o:(C&255)>>>1,D=e[D>>2]|0,(d|0)>(D|0)?(Te=S[ce>>0]|0,w=S[ke>>0]|0,d=(d-D<<1|1)+D+(Te&1?e[ce+4>>2]|0:(Te&255)>>>1)+(w&1?e[ke+4>>2]|0:(w&255)>>>1)|0):(Te=S[ce>>0]|0,d=S[ke>>0]|0,d=D+2+(Te&1?e[ce+4>>2]|0:(Te&255)>>>1)+(d&1?e[ke+4>>2]|0:(d&255)>>>1)|0),d>>>0>100?(d=E0(d<<2)|0,w=d,d?Ee=17:(g=0,Nt(6),Te=g,g=0,Te&1||(C=S[h>>0]|0,o=e[H>>2]|0,d=0,Ee=17))):(w=0,d=N,Ee=17),(Ee|0)==17&&(Te=(C&1)==0,h=Te?H:e[h+8>>2]|0,g=0,Zt(2,d|0,$|0,G|0,e[l+4>>2]|0,h|0,h+((Te?(C&255)>>>1:o)<<2)|0,U|0,k|0,P|0,e[K>>2]|0,e[O>>2]|0,ne|0,ke|0,ce|0,D|0),Te=g,g=0,!(Te&1)&&(e[_>>2]=e[r>>2],Te=e[$>>2]|0,ie=e[G>>2]|0,g=0,e[R>>2]=e[_>>2],ie=Vt(40,R|0,d|0,Te|0,ie|0,l|0,c|0)|0,Te=g,g=0,!(Te&1))))return w&&(n0(w),t=e[oe>>2]|0),Pt(ce),Pt(ke),de(ne),Bt(t)|0,b=Z,ie|0;d=j()|0,w&&(n0(w),t=e[oe>>2]|0)}Pt(ce),Pt(ke),de(ne)}while(!1);return(Ee|0)==13&&(d=j()|0),Bt(t)|0,le(d|0),0}function Th(t){t=t|0}function Ih(t){t=t|0,he(t)}function Eh(t,r,o){return t=t|0,r=r|0,o=o|0,t=yo(S[r>>0]&1?e[r+8>>2]|0:r+1|0,1)|0,t>>>((t|0)!=-1&1)|0}function kh(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0;w=b,b=b+16|0,C=w,e[C>>2]=0,e[C+4>>2]=0,e[C+8>>2]=0,d=S[h>>0]|0,D=(d&1)==0,r=D?h+1|0:e[h+8>>2]|0,d=D?(d&255)>>>1:e[h+4>>2]|0,h=r+d|0;e:do if((d|0)>0){for(;g=0,Ae(67,C|0,S[r>>0]|0),D=g,g=0,!(D&1);)if(r=r+1|0,r>>>0>=h>>>0){d=4;break e}r=j()|0,d=7}else d=4;while(!1);e:do if((d|0)==4){if(g=0,r=Pe(19,((o|0)==-1?-1:o<<1)|0,l|0,c|0,(S[C>>0]&1?e[C+8>>2]|0:C+1|0)|0)|0,D=g,g=0,D&1){r=j()|0,d=7;break}e[t>>2]=0,e[t+4>>2]=0,e[t+8>>2]=0,D=$i(r)|0,h=r+D|0;t:do if((D|0)>0){for(;g=0,Ae(67,t|0,S[r>>0]|0),D=g,g=0,!(D&1);)if(r=r+1|0,r>>>0>=h>>>0)break t;r=j()|0,de(t);break e}while(!1);de(C),b=w;return}while(!1);de(C),le(r|0)}function Dh(t,r){t=t|0,r=r|0}function bh(t){t=t|0}function Nh(t){t=t|0,he(t)}function Fh(t,r,o){return t=t|0,r=r|0,o=o|0,t=yo(S[r>>0]&1?e[r+8>>2]|0:r+1|0,1)|0,t>>>((t|0)!=-1&1)|0}function Rh(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0,G=0,$=0,P=0,O=0;$=b,b=b+224|0,N=$+184|0,k=$+192|0,D=$+180|0,R=$+176|0,K=$+168|0,H=$+40|0,U=$+32|0,G=$+28|0,P=$+16|0,C=$+8|0,_=$,e[P>>2]=0,e[P+4>>2]=0,e[P+8>>2]=0,e[C+4>>2]=0,e[C>>2]=44696,w=S[h>>0]|0,O=(w&1)==0,d=h+4|0,r=O?d:e[h+8>>2]|0,h=O?(w&255)>>>1:e[d>>2]|0,d=r+(h<<2)|0,w=k+32|0;e:do if((h|0)>0){t:for(;;){if(e[R>>2]=r,g=0,h=Xt(e[(e[C>>2]|0)+12>>2]|0,C|0,N|0,r|0,d|0,R|0,k|0,w|0,D|0)|0,O=g,g=0,O&1){h=12;break}if((h|0)==2||(e[R>>2]|0)==(r|0)){h=5;break}if(k>>>0<(e[D>>2]|0)>>>0){r=k;do{if(g=0,Ae(67,P|0,S[r>>0]|0),O=g,g=0,O&1){h=11;break t}r=r+1|0}while(r>>>0<(e[D>>2]|0)>>>0)}if(r=e[R>>2]|0,!((h|0)!=2&r>>>0>>0)){h=9;break e}}(h|0)==5?(g=0,ue(190,58955),g=0,r=j()|0):((h|0)==11||(h|0)==12)&&(r=j()|0)}else h=9;while(!1);e:do if((h|0)==9){if(g=0,r=Pe(19,((o|0)==-1?-1:o<<1)|0,l|0,c|0,(S[P>>0]&1?e[P+8>>2]|0:P+1|0)|0)|0,O=g,g=0,O&1){r=j()|0;break}e[t>>2]=0,e[t+4>>2]=0,e[t+8>>2]=0,e[_+4>>2]=0,e[_>>2]=44744,O=$i(r)|0,d=r+O|0,w=d,C=H+128|0;t:do if((O|0)>0){i:for(;;){if(e[G>>2]=r,g=0,h=Xt(e[(e[_>>2]|0)+16>>2]|0,_|0,K|0,r|0,((w-r|0)>32?r+32|0:d)|0,G|0,H|0,C|0,U|0)|0,O=g,g=0,O&1){h=24;break}if((h|0)==2||(e[G>>2]|0)==(r|0)){h=18;break}if(H>>>0<(e[U>>2]|0)>>>0){r=H;do{if(g=0,Ae(92,t|0,e[r>>2]|0),O=g,g=0,O&1){h=23;break i}r=r+4|0}while(r>>>0<(e[U>>2]|0)>>>0)}if(r=e[G>>2]|0,!((h|0)!=2&r>>>0>>0))break t}(h|0)==18?(g=0,ue(190,58955),g=0,r=j()|0):((h|0)==23||(h|0)==24)&&(r=j()|0),Pt(t);break e}while(!1);de(P),b=$;return}while(!1);de(P),le(r|0)}function Mh(t,r){t=t|0,r=r|0}function _h(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0;if(e[t+4>>2]=r+-1,e[t>>2]=44196,h=t+8|0,g=0,Ae(94,h|0,28),c=g,g=0,c&1)r=j()|0;else{if(c=t+144|0,g=0,xe(5,c|0,58885,1),l=g,g=0,l&1)r=j()|0;else{if(o=e[h>>2]|0,l=t+12|0,r=e[l>>2]|0,(r|0)!=(o|0)){do r=r+-4|0;while((r|0)!=(o|0));e[l>>2]=r}e[495]=0,e[494]=43124,g=0,Ae(95,t|0,1976),l=g,g=0;do if(!(l&1)&&(e[497]=0,e[496]=43164,g=0,Ae(96,t|0,1984),l=g,g=0,!(l&1))&&(e[499]=0,e[498]=44236,e[500]=0,S[2004]=0,l=nn()|0,e[500]=l,g=0,Ae(97,t|0,1992),l=g,g=0,!(l&1))&&(e[503]=0,e[502]=44484,g=0,Ae(98,t|0,2008),l=g,g=0,!(l&1))&&(e[505]=0,e[504]=44552,g=0,Ae(99,t|0,2016),l=g,g=0,!(l&1))&&(g=0,Ae(100,2024,1),l=g,g=0,!(l&1))&&(g=0,Ae(101,t|0,2024),l=g,g=0,!(l&1))&&(e[511]=0,e[510]=44600,g=0,Ae(102,t|0,2040),l=g,g=0,!(l&1))&&(e[513]=0,e[512]=44648,g=0,Ae(103,t|0,2048),l=g,g=0,!(l&1))&&(i4(2056,1),g=0,Ae(104,t|0,2056),l=g,g=0,!(l&1))&&(n4(2080,1),g=0,Ae(105,t|0,2080),l=g,g=0,!(l&1))&&(e[529]=0,e[528]=43204,g=0,Ae(106,t|0,2112),l=g,g=0,!(l&1))&&(e[531]=0,e[530]=43276,g=0,Ae(107,t|0,2120),l=g,g=0,!(l&1))&&(e[533]=0,e[532]=43348,g=0,Ae(108,t|0,2128),l=g,g=0,!(l&1))){if(e[535]=0,e[534]=43408,g=0,Ae(109,t|0,2136),l=g,g=0,l&1){d=42;break}if(e[537]=0,e[536]=43716,g=0,Ae(110,t|0,2144),l=g,g=0,l&1){d=42;break}if(e[539]=0,e[538]=43780,g=0,Ae(111,t|0,2152),l=g,g=0,l&1){d=42;break}if(e[541]=0,e[540]=43844,g=0,Ae(112,t|0,2160),l=g,g=0,l&1){d=42;break}if(e[543]=0,e[542]=43908,g=0,Ae(113,t|0,2168),l=g,g=0,l&1){d=42;break}if(e[545]=0,e[544]=43972,g=0,Ae(114,t|0,2176),l=g,g=0,l&1){d=42;break}if(e[547]=0,e[546]=44008,g=0,Ae(115,t|0,2184),l=g,g=0,l&1){d=42;break}if(e[549]=0,e[548]=44044,g=0,Ae(116,t|0,2192),l=g,g=0,l&1){d=42;break}if(e[551]=0,e[550]=44080,g=0,Ae(117,t|0,2200),l=g,g=0,l&1){d=42;break}if(e[553]=0,e[552]=43468,e[554]=43516,g=0,Ae(118,t|0,2208),l=g,g=0,l&1){d=42;break}if(e[557]=0,e[556]=43560,e[558]=43608,g=0,Ae(119,t|0,2224),l=g,g=0,l&1){d=42;break}if(e[561]=0,e[560]=44464,g=0,r=Ce(3)|0,l=g,g=0,l&1){r=j()|0;break}if(e[562]=r,e[560]=43652,g=0,Ae(120,t|0,2240),l=g,g=0,l&1){d=42;break}if(e[565]=0,e[564]=44464,g=0,r=Ce(3)|0,l=g,g=0,l&1){r=j()|0;break}if(e[566]=r,e[564]=43684,g=0,Ae(121,t|0,2256),d=g,g=0,d&1){d=42;break}if(e[569]=0,e[568]=44116,g=0,Ae(122,t|0,2272),d=g,g=0,d&1){d=42;break}if(e[571]=0,e[570]=44156,g=0,Ae(123,t|0,2280),d=g,g=0,d&1){d=42;break}return}else d=42;while(!1);(d|0)==42&&(r=j()|0),de(c)}yr(h)}le(r|0)}function Ph(){var t=0;do if(!(S[2288]|0)&&kt(2288)|0)if(g=0,Ce(4)|0,t=g,g=0,t&1)t=j()|0,W0(2288),le(t|0);else{e[11246]=44980,bt(2288);break}while(!1);return e[11246]|0}function w0(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0;pn(r),c=t+8|0,l=e[c>>2]|0;do if((e[t+12>>2]|0)-l>>2>>>0<=o>>>0){if(g=0,Ae(124,c|0,o+1|0),t=g,g=0,!(t&1)){l=e[c>>2]|0;break}l=j()|0,r&&Bt(r)|0,le(l|0)}while(!1);t=e[l+(o<<2)>>2]|0,t&&(Bt(t)|0,l=e[c>>2]|0),e[l+(o<<2)>>2]=r}function Rs(t){t=t|0;var r=0,o=0,l=0,c=0;if(e[t>>2]=44196,l=t+8|0,c=t+12|0,r=e[l>>2]|0,(e[c>>2]|0)!=(r|0)){o=0;do r=e[r+(o<<2)>>2]|0,r&&Bt(r)|0,o=o+1|0,r=e[l>>2]|0;while(o>>>0<(e[c>>2]|0)-r>>2>>>0)}de(t+144|0),yr(l)}function Lh(t){t=t|0,Rs(t),he(t)}function Oh(t,r){return t=t|0,r=r|0,P3(t,r)|0?e[(e[t+8>>2]|0)+(r<<2)>>2]|0:(t=Ct(4)|0,B6(t),Qt(t|0,640,82),0)}function $h(){return _h(2296,1),e[11245]=2296,44980}function Bh(){var t=0;return t=Ph()|0,t=e[t>>2]|0,e[11247]=t,pn(t),44988}function Vh(){var t=0;do if(!(S[2456]|0)&&kt(2456)|0)if(g=0,Ce(5)|0,t=g,g=0,t&1)t=j()|0,W0(2456),le(t|0);else{e[11248]=44988,bt(2456);break}while(!1);return e[11248]|0}function ur(t){t=t|0;var r=0,o=0;if(g=0,r=Ce(6)|0,o=g,g=0,o&1)o=j(0)|0,$t(o);else{o=e[r>>2]|0,e[t>>2]=o,pn(o);return}}function tn(t,r){t=t|0,r=r|0,r=e[r>>2]|0,e[t>>2]=r,pn(r)}function _0(t){t=t|0,Bt(e[t>>2]|0)|0}function x0(t){t=t|0;var r=0,o=0;return o=b,b=b+16|0,r=o,(e[t>>2]|0)!=-1&&(e[r>>2]=t,e[r+4>>2]=191,e[r+8>>2]=0,gp(t,r,192)),b=o,(e[t+4>>2]|0)+-1|0}function O0(t,r){return t=t|0,r=r|0,t=e[t>>2]|0,Oh(t,x0(r)|0)|0}function Uh(t){t=t|0,he(t)}function Gh(t){t=t|0,t&&Mt[e[(e[t>>2]|0)+4>>2]&255](t)}function qh(t){t=t|0;var r=0;r=e[11052]|0,e[11052]=r+1,e[t+4>>2]=r+1}function Wh(t){t=t|0,he(t)}function Hh(t,r,o){return t=t|0,r=r|0,o=o|0,o>>>0<128?(o=(nn()|0)+(o<<1)|0,o=(I[o>>1]&r)<<16>>16!=0):o=0,o|0}function nn(){var t=0,r=0;if(g=0,t=Ce(7)|0,r=g,g=0,r&1)r=j(0)|0,$t(r);else return e[t>>2]|0;return 0}function Qh(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0;if(h=(o-r|0)>>>2,(r|0)!=(o|0))for(c=r;t=e[c>>2]|0,t>>>0<128?(t=(nn()|0)+(t<<1)|0,t=M[t>>1]|0):t=0,I[l>>1]=t,c=c+4|0,(c|0)!=(o|0);)l=l+2|0;return r+(h<<2)|0}function Kh(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;e:do if((o|0)==(l|0))o=l;else for(;;){if(t=e[o>>2]|0,t>>>0<128&&(t=(nn()|0)+(t<<1)|0,(I[t>>1]&r)<<16>>16!=0))break e;if(o=o+4|0,(o|0)==(l|0)){o=l;break}}while(!1);return o|0}function Yh(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;e:do if((o|0)==(l|0))o=l;else for(;;){if(t=e[o>>2]|0,t>>>0>=128||(t=(nn()|0)+(t<<1)|0,!((I[t>>1]&r)<<16>>16)))break e;if(o=o+4|0,(o|0)==(l|0)){o=l;break}}while(!1);return o|0}function jh(t,r){return t=t|0,r=r|0,r>>>0<128&&(r=(hn()|0)+(r<<2)|0,r=e[r>>2]|0),r|0}function hn(){var t=0,r=0;if(g=0,t=Ce(8)|0,r=g,g=0,r&1)r=j(0)|0,$t(r);else return e[t>>2]|0;return 0}function Xh(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0;if(c=(o-r|0)>>>2,(r|0)!=(o|0)){l=r;do t=e[l>>2]|0,t>>>0<128&&(t=(hn()|0)+(t<<2)|0,t=e[t>>2]|0),e[l>>2]=t,l=l+4|0;while((l|0)!=(o|0))}return r+(c<<2)|0}function Zh(t,r){return t=t|0,r=r|0,r>>>0<128&&(r=(dn()|0)+(r<<2)|0,r=e[r>>2]|0),r|0}function dn(){var t=0,r=0;if(g=0,t=Ce(9)|0,r=g,g=0,r&1)r=j(0)|0,$t(r);else return e[t>>2]|0;return 0}function Jh(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0;if(c=(o-r|0)>>>2,(r|0)!=(o|0)){l=r;do t=e[l>>2]|0,t>>>0<128&&(t=(dn()|0)+(t<<2)|0,t=e[t>>2]|0),e[l>>2]=t,l=l+4|0;while((l|0)!=(o|0))}return r+(c<<2)|0}function ed(t,r){return t=t|0,r=r|0,r<<24>>24|0}function id(t,r,o,l){if(t=t|0,r=r|0,o=o|0,l=l|0,(r|0)!=(o|0))for(;e[l>>2]=S[r>>0],r=r+1|0,(r|0)!=(o|0);)l=l+4|0;return o|0}function nd(t,r,o){return t=t|0,r=r|0,o=o|0,(r>>>0<128?r&255:o)|0}function rd(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0;if(d=(o-r|0)>>>2,(r|0)!=(o|0))for(h=r,t=c;c=e[h>>2]|0,S[t>>0]=c>>>0<128?c&255:l,h=h+4|0,(h|0)!=(o|0);)t=t+1|0;return r+(d<<2)|0}function Ms(t){t=t|0;var r=0;e[t>>2]=44236,r=e[t+8>>2]|0,r|0&&S[t+12>>0]|0&&N6(r)}function sd(t){t=t|0,Ms(t),he(t)}function od(t,r){return t=t|0,r=r|0,r<<24>>24>-1&&(r=(hn()|0)+((r&255)<<2)|0,r=e[r>>2]&255),r|0}function ad(t,r,o){if(t=t|0,r=r|0,o=o|0,(r|0)!=(o|0)){t=r;do r=S[t>>0]|0,r<<24>>24>-1&&(r=(hn()|0)+(r<<24>>24<<2)|0,r=e[r>>2]&255),S[t>>0]=r,t=t+1|0;while((t|0)!=(o|0))}return o|0}function ld(t,r){return t=t|0,r=r|0,r<<24>>24>-1&&(r=(dn()|0)+(r<<24>>24<<2)|0,r=e[r>>2]&255),r|0}function ud(t,r,o){if(t=t|0,r=r|0,o=o|0,(r|0)!=(o|0)){t=r;do r=S[t>>0]|0,r<<24>>24>-1&&(r=(dn()|0)+(r<<24>>24<<2)|0,r=e[r>>2]&255),S[t>>0]=r,t=t+1|0;while((t|0)!=(o|0))}return o|0}function cd(t,r){return t=t|0,r=r|0,r|0}function hd(t,r,o,l){if(t=t|0,r=r|0,o=o|0,l=l|0,(r|0)!=(o|0))for(;S[l>>0]=S[r>>0]|0,r=r+1|0,(r|0)!=(o|0);)l=l+1|0;return o|0}function dd(t,r,o){return t=t|0,r=r|0,o=o|0,(r<<24>>24>-1?r:o)|0}function pd(t,r,o,l,c){if(t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,(r|0)!=(o|0))for(;t=S[r>>0]|0,S[c>>0]=t<<24>>24>-1?t:l,r=r+1|0,(r|0)!=(o|0);)c=c+1|0;return o|0}function md(t){t=t|0,he(t)}function gd(t,r,o,l,c,h,d,w){return t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0,w=w|0,e[c>>2]=o,e[w>>2]=h,3}function Sd(t,r,o,l,c,h,d,w){return t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0,w=w|0,e[c>>2]=o,e[w>>2]=h,3}function Ad(t,r,o,l,c){return t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,e[c>>2]=o,3}function vd(t){return t=t|0,1}function xd(t){return t=t|0,1}function wd(t,r,o,l,c){return t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,t=l-o|0,(t>>>0>>0?t:c)|0}function yd(t){return t=t|0,1}function Cd(t,r){t=t|0,r=r|0;var o=0;if(e[t+4>>2]=r+-1,e[t>>2]=44304,g=0,r=Ce(3)|0,o=g,g=0,o&1)o=j()|0,le(o|0);else{e[t+8>>2]=r;return}}function Td(t){t=t|0,io(t),he(t)}function cr(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0,ce=0,ke=0,Ee=0,Te=0,it=0,jt=0,Gt=0,s0=0,i0=0,zt=0,gt=0,Kt=0,dt=0,At=0,y0=0,T0=0,g0=0,Oe=0,yt=0,qt=0,c0=0,a0=0,h0=0,D0=0,A0=0,Ti=0,F0=0,Si=0;Si=b,b=b+624|0,h0=Si+24|0,A0=Si+16|0,D0=Si+588|0,Oe=Si+576|0,a0=Si,y0=Si+536|0,F0=Si+8|0,Ti=Si+528|0,jt=(t|0)!=0,Gt=y0+40|0,At=Gt,y0=y0+39|0,T0=F0+4|0,g0=Oe+12|0,Oe=Oe+11|0,yt=D0,qt=g0,c0=qt-yt|0,s0=-2-yt|0,i0=qt+2|0,zt=h0+288|0,gt=D0+9|0,Kt=gt,dt=D0+8|0,h=0,H=r,d=0,r=0;e:for(;;){do if((h|0)>-1)if((d|0)>(2147483647-h|0)){h=S0()|0,e[h>>2]=75,h=-1;break}else{h=d+h|0;break}while(!1);if(d=S[H>>0]|0,d<<24>>24)w=H;else{it=245;break}t:for(;;){switch(d<<24>>24){case 37:{d=w,it=9;break t}case 0:{d=w;break t}default:}Te=w+1|0,d=S[Te>>0]|0,w=Te}t:do if((it|0)==9)for(;;){if(it=0,(S[d+1>>0]|0)!=37)break t;if(w=w+1|0,d=d+2|0,(S[d>>0]|0)==37)it=9;else break}while(!1);if(G=w-H|0,jt&&!(e[t>>2]&32|0)&&B0(H,G,t)|0,(w|0)!=(H|0)){H=d,d=G;continue}k=d+1|0,w=S[k>>0]|0,C=(w<<24>>24)+-48|0,C>>>0<10?(Te=(S[d+2>>0]|0)==36,k=Te?d+3|0:k,w=S[k>>0]|0,_=Te?C:-1,r=Te?1:r):_=-1,d=w<<24>>24;t:do if((d&-32|0)==32)for(C=0;;){if(!(1<>24)+-32|C,k=k+1|0,w=S[k>>0]|0,d=w<<24>>24,(d&-32|0)!=32){N=C,d=k;break}}else N=0,d=k;while(!1);do if(w<<24>>24==42){if(C=d+1|0,w=(S[C>>0]|0)+-48|0,w>>>0<10&&(S[d+2>>0]|0)==36)e[c+(w<<2)>>2]=10,r=1,d=d+3|0,w=e[l+((S[C>>0]|0)+-48<<3)>>2]|0;else{if(r){h=-1;break e}if(!jt){K=N,d=C,r=0,Te=0;break}r=(e[o>>2]|0)+3&-4,w=e[r>>2]|0,e[o>>2]=r+4,r=0,d=C}(w|0)<0?(K=N|8192,Te=0-w|0):(K=N,Te=w)}else if(C=(w<<24>>24)+-48|0,C>>>0<10){w=0;do w=(w*10|0)+C|0,d=d+1|0,C=(S[d>>0]|0)+-48|0;while(C>>>0<10);if((w|0)<0){h=-1;break e}else K=N,Te=w}else K=N,Te=0;while(!1);t:do if((S[d>>0]|0)==46){if(C=d+1|0,w=S[C>>0]|0,w<<24>>24!=42){if(k=(w<<24>>24)+-48|0,k>>>0<10)d=C,w=0;else{d=C,k=0;break}for(;;)if(w=(w*10|0)+k|0,d=d+1|0,k=(S[d>>0]|0)+-48|0,k>>>0>=10){k=w;break t}}if(C=d+2|0,w=(S[C>>0]|0)+-48|0,w>>>0<10&&(S[d+3>>0]|0)==36){e[c+(w<<2)>>2]=10,d=d+4|0,k=e[l+((S[C>>0]|0)+-48<<3)>>2]|0;break}if(r){h=-1;break e}jt?(d=(e[o>>2]|0)+3&-4,k=e[d>>2]|0,e[o>>2]=d+4,d=C):(d=C,k=0)}else k=-1;while(!1);for(R=0;;){if(w=(S[d>>0]|0)+-65|0,w>>>0>57){h=-1;break e}if(C=d+1|0,w=S[56223+(R*58|0)+w>>0]|0,N=w&255,(N+-1|0)>>>0<8)d=C,R=N;else{Ee=C;break}}if(!(w<<24>>24)){h=-1;break}C=(_|0)>-1;do if(w<<24>>24==19)if(C){h=-1;break e}else it=52;else{if(C){e[c+(_<<2)>>2]=N,ce=l+(_<<3)|0,ke=e[ce+4>>2]|0,it=a0,e[it>>2]=e[ce>>2],e[it+4>>2]=ke,it=52;break}if(!jt){h=0;break e}Ps(a0,N,o)}while(!1);if((it|0)==52&&(it=0,!jt)){H=Ee,d=G;continue}_=S[d>>0]|0,_=(R|0)!=0&(_&15|0)==3?_&-33:_,C=K&-65537,ke=K&8192|0?C:K;t:do switch(_|0){case 110:switch(R|0){case 0:{e[e[a0>>2]>>2]=h,H=Ee,d=G;continue e}case 1:{e[e[a0>>2]>>2]=h,H=Ee,d=G;continue e}case 2:{H=e[a0>>2]|0,e[H>>2]=h,e[H+4>>2]=((h|0)<0)<<31>>31,H=Ee,d=G;continue e}case 3:{I[e[a0>>2]>>1]=h,H=Ee,d=G;continue e}case 4:{S[e[a0>>2]>>0]=h,H=Ee,d=G;continue e}case 6:{e[e[a0>>2]>>2]=h,H=Ee,d=G;continue e}case 7:{H=e[a0>>2]|0,e[H>>2]=h,e[H+4>>2]=((h|0)<0)<<31>>31,H=Ee,d=G;continue e}default:{H=Ee,d=G;continue e}}case 112:{R=ke|8,k=k>>>0>8?k:8,_=120,it=64;break}case 88:case 120:{R=ke,it=64;break}case 111:{if(C=a0,w=e[C>>2]|0,C=e[C+4>>2]|0,(w|0)==0&(C|0)==0)d=Gt;else{d=Gt;do d=d+-1|0,S[d>>0]=w&7|48,w=Di(w|0,C|0,3)|0,C=ye;while(!((w|0)==0&(C|0)==0))}ke&8?(R=At-d+1|0,w=ke,k=(k|0)<(R|0)?R:k,R=0,N=56703,it=77):(w=ke,R=0,N=56703,it=77);break}case 105:case 100:{if(w=a0,d=e[w>>2]|0,w=e[w+4>>2]|0,(w|0)<0){d=ii(0,0,d|0,w|0)|0,w=ye,C=a0,e[C>>2]=d,e[C+4>>2]=w,C=1,N=56703,it=76;break t}ke&2048?(C=1,N=56704,it=76):(N=ke&1,C=N,N=N|0?56705:56703,it=76);break}case 117:{w=a0,d=e[w>>2]|0,w=e[w+4>>2]|0,C=0,N=56703,it=76;break}case 99:{S[y0>>0]=e[a0>>2],H=y0,w=1,R=0,_=56703,d=Gt;break}case 109:{d=S0()|0,d=vo(e[d>>2]|0)|0,it=82;break}case 115:{d=e[a0>>2]|0,d=d|0?d:56713,it=82;break}case 67:{e[F0>>2]=e[a0>>2],e[T0>>2]=0,e[a0>>2]=F0,k=-1,it=86;break}case 83:{k?it=86:(z0(t,32,Te,0,ke),d=0,it=98);break}case 65:case 71:case 70:case 69:case 97:case 103:case 102:case 101:{D=+B[a0>>3],e[A0>>2]=0,B[q>>3]=D,(e[q+4>>2]|0)>=0?ke&2048?(ne=1,ce=56723):(ce=ke&1,ne=ce,ce=ce|0?56726:56721):(D=-D,ne=1,ce=56720),B[q>>3]=D,oe=e[q+4>>2]&2146435072;do if(oe>>>0<2146435072|(oe|0)==2146435072&!1){if(U=+yS(D,A0)*2,w=U!=0,w&&(e[A0>>2]=(e[A0>>2]|0)+-1),Z=_|32,(Z|0)==97){H=_&32,G=H|0?ce+9|0:ce,K=ne|2,d=12-k|0;do if(k>>>0>11|(d|0)==0)D=U;else{D=8;do d=d+-1|0,D=D*16;while(d|0);if((S[G>>0]|0)==45){D=-(D+(-U-D));break}else{D=U+D-D;break}}while(!1);for(w=e[A0>>2]|0,d=(w|0)<0?0-w|0:w,d=zi(d,((d|0)<0)<<31>>31,g0)|0,(d|0)==(g0|0)&&(S[Oe>>0]=48,d=Oe),S[d+-1>>0]=(w>>31&2)+43,R=d+-2|0,S[R>>0]=_+15,N=(k|0)<1,C=(ke&8|0)==0,w=D0;;){ce=~~D,d=w+1|0,S[w>>0]=F[56687+ce>>0]|H,D=(D-+(ce|0))*16;do if((d-yt|0)==1){if(C&(N&D==0))break;S[d>>0]=46,d=w+2|0}while(!1);if(D==0)break;w=d}k=(k|0)!=0&(s0+d|0)<(k|0)?i0+k-R|0:c0-R+d|0,C=k+K|0,z0(t,32,Te,C,ke),e[t>>2]&32||B0(G,K,t)|0,z0(t,48,Te,C,ke^65536),d=d-yt|0,e[t>>2]&32||B0(D0,d,t)|0,w=qt-R|0,z0(t,48,k-(d+w)|0,0,0),e[t>>2]&32||B0(R,w,t)|0,z0(t,32,Te,C,ke^8192),d=(C|0)<(Te|0)?Te:C;break}d=(k|0)<0?6:k,w?(w=(e[A0>>2]|0)+-28|0,e[A0>>2]=w,D=U*268435456):(D=U,w=e[A0>>2]|0),oe=(w|0)<0?h0:zt,ie=oe,w=oe;do O=~~D>>>0,e[w>>2]=O,w=w+4|0,D=(D-+(O>>>0))*1e9;while(D!=0);if(C=w,w=e[A0>>2]|0,(w|0)>0)for(N=oe;;){R=(w|0)>29?29:w,k=C+-4|0;do if(k>>>0>>0)k=N;else{w=0;do O=v0(e[k>>2]|0,0,R|0)|0,O=$0(O|0,ye|0,w|0,0)|0,w=ye,P=Cr(O|0,w|0,1e9,0)|0,e[k>>2]=P,w=xn(O|0,w|0,1e9,0)|0,k=k+-4|0;while(k>>>0>=N>>>0);if(!w){k=N;break}k=N+-4|0,e[k>>2]=w}while(!1);for(;!(C>>>0<=k>>>0);)if(w=C+-4|0,!(e[w>>2]|0))C=w;else break;if(w=(e[A0>>2]|0)-R|0,e[A0>>2]=w,(w|0)>0)N=k;else break}else k=oe;if((w|0)<0)for(G=((d+25|0)/9|0)+1|0,$=(Z|0)==102,H=k;;){K=0-w|0,K=(K|0)>9?9:K;do if(H>>>0>>0){w=(1<>>K,k=0,R=H;do O=e[R>>2]|0,e[R>>2]=(O>>>K)+k,k=ee(O&w,N)|0,R=R+4|0;while(R>>>0>>0);if(w=e[H>>2]|0?H:H+4|0,!k){k=w;break}e[C>>2]=k,k=w,C=C+4|0}else k=e[H>>2]|0?H:H+4|0;while(!1);if(w=$?oe:k,C=(C-w>>2|0)>(G|0)?w+(G<<2)|0:C,w=(e[A0>>2]|0)+K|0,e[A0>>2]=w,(w|0)>=0){H=k;break}else H=k}else H=k;do if(H>>>0>>0){if(w=(ie-H>>2)*9|0,N=e[H>>2]|0,N>>>0<10)break;k=10;do k=k*10|0,w=w+1|0;while(N>>>0>=k>>>0)}else w=0;while(!1);if(P=(Z|0)==103,O=(d|0)!=0,k=d-((Z|0)!=102?w:0)+((O&P)<<31>>31)|0,(k|0)<(((C-ie>>2)*9|0)+-9|0)){if(R=k+9216|0,$=(R|0)/9|0,k=oe+($+-1023<<2)|0,R=((R|0)%9|0)+1|0,(R|0)<9){N=10;do N=N*10|0,R=R+1|0;while((R|0)!=9)}else N=10;K=e[k>>2]|0,G=(K>>>0)%(N>>>0)|0,!(G|0)&&(oe+($+-1022<<2)|0)==(C|0)?N=H:it=163;do if((it|0)==163){it=0,U=((K>>>0)/(N>>>0)|0)&1|0?9007199254740994:9007199254740992,R=(N|0)/2|0;do if(G>>>0>>0)D=.5;else{if((G|0)==(R|0)&&(oe+($+-1022<<2)|0)==(C|0)){D=1;break}D=1.5}while(!1);do if(ne){if((S[ce>>0]|0)!=45)break;U=-U,D=-D}while(!1);if(R=K-G|0,e[k>>2]=R,U+D==U){N=H;break}if(Z=R+N|0,e[k>>2]=Z,Z>>>0>999999999)for(w=H;;)if(N=k+-4|0,e[k>>2]=0,N>>>0>>0&&(w=w+-4|0,e[w>>2]=0),Z=(e[N>>2]|0)+1|0,e[N>>2]=Z,Z>>>0>999999999)k=N;else{H=w,k=N;break}if(w=(ie-H>>2)*9|0,R=e[H>>2]|0,R>>>0<10){N=H;break}else N=10;do N=N*10|0,w=w+1|0;while(R>>>0>=N>>>0);N=H}while(!1);Z=k+4|0,H=N,C=C>>>0>Z>>>0?Z:C}for(G=0-w|0;;){if(C>>>0<=H>>>0){$=0,Z=C;break}if(k=C+-4|0,!(e[k>>2]|0))C=k;else{$=1,Z=C;break}}do if(P){if(d=(O&1^1)+d|0,(d|0)>(w|0)&(w|0)>-5?(_=_+-1|0,d=d+-1-w|0):(_=_+-2|0,d=d+-1|0),C=ke&8,C)break;do if($){if(C=e[Z+-4>>2]|0,!C){k=9;break}if(!((C>>>0)%10|0))N=10,k=0;else{k=0;break}do N=N*10|0,k=k+1|0;while(!((C>>>0)%(N>>>0)|0|0))}else k=9;while(!1);if(C=((Z-ie>>2)*9|0)+-9|0,(_|32|0)==102){C=C-k|0,C=(C|0)<0?0:C,d=(d|0)<(C|0)?d:C,C=0;break}else{C=C+w-k|0,C=(C|0)<0?0:C,d=(d|0)<(C|0)?d:C,C=0;break}}else C=ke&8;while(!1);if(K=d|C,N=(K|0)!=0&1,R=(_|32|0)==102,R)w=(w|0)>0?w:0,_=0;else{if(k=(w|0)<0?G:w,k=zi(k,((k|0)<0)<<31>>31,g0)|0,(qt-k|0)<2)do k=k+-1|0,S[k>>0]=48;while((qt-k|0)<2);S[k+-1>>0]=(w>>31&2)+43,ie=k+-2|0,S[ie>>0]=_,w=qt-ie|0,_=ie}G=ne+1+d+N+w|0,z0(t,32,Te,G,ke),e[t>>2]&32||B0(ce,ne,t)|0,z0(t,48,Te,G,ke^65536);do if(R){k=H>>>0>oe>>>0?oe:H,w=k;do{C=zi(e[w>>2]|0,0,gt)|0;do if((w|0)==(k|0)){if((C|0)!=(gt|0))break;S[dt>>0]=48,C=dt}else{if(C>>>0<=D0>>>0)break;do C=C+-1|0,S[C>>0]=48;while(C>>>0>D0>>>0)}while(!1);e[t>>2]&32||B0(C,Kt-C|0,t)|0,w=w+4|0}while(w>>>0<=oe>>>0);do if(K){if(e[t>>2]&32)break;B0(56755,1,t)|0}while(!1);if((d|0)>0&w>>>0>>0)for(C=w;;){if(w=zi(e[C>>2]|0,0,gt)|0,w>>>0>D0>>>0)do w=w+-1|0,S[w>>0]=48;while(w>>>0>D0>>>0);if(e[t>>2]&32||B0(w,(d|0)>9?9:d,t)|0,C=C+4|0,w=d+-9|0,(d|0)>9&C>>>0>>0)d=w;else{d=w;break}}z0(t,48,d+9|0,9,0)}else{if(R=$?Z:H+4|0,(d|0)>-1){N=(C|0)==0,k=H;do{w=zi(e[k>>2]|0,0,gt)|0,(w|0)==(gt|0)&&(S[dt>>0]=48,w=dt);do if((k|0)==(H|0)){if(C=w+1|0,e[t>>2]&32||B0(w,1,t)|0,N&(d|0)<1){w=C;break}if(e[t>>2]&32){w=C;break}B0(56755,1,t)|0,w=C}else{if(w>>>0<=D0>>>0)break;do w=w+-1|0,S[w>>0]=48;while(w>>>0>D0>>>0)}while(!1);C=Kt-w|0,e[t>>2]&32||B0(w,(d|0)>(C|0)?C:d,t)|0,d=d-C|0,k=k+4|0}while(k>>>0>>0&(d|0)>-1)}if(z0(t,48,d+18|0,18,0),e[t>>2]&32)break;B0(_,qt-_|0,t)|0}while(!1);z0(t,32,Te,G,ke^8192),d=(G|0)<(Te|0)?Te:G}else R=(_&32|0)!=0,N=D!=D|!1,w=N?0:ne,k=w+3|0,z0(t,32,Te,k,C),d=e[t>>2]|0,d&32||(B0(ce,w,t)|0,d=e[t>>2]|0),d&32||B0(N?R?56747:56751:R?56739:56743,3,t)|0,z0(t,32,Te,k,ke^8192),d=(k|0)<(Te|0)?Te:k;while(!1);H=Ee;continue e}default:C=ke,w=k,R=0,_=56703,d=Gt}while(!1);t:do if((it|0)==64)if(C=a0,w=e[C>>2]|0,C=e[C+4>>2]|0,N=_&32,(w|0)==0&(C|0)==0)d=Gt,w=R,R=0,N=56703,it=77;else{d=Gt;do d=d+-1|0,S[d>>0]=F[56687+(w&15)>>0]|N,w=Di(w|0,C|0,4)|0,C=ye;while(!((w|0)==0&(C|0)==0));it=a0,(R&8|0)==0|(e[it>>2]|0)==0&(e[it+4>>2]|0)==0?(w=R,R=0,N=56703,it=77):(w=R,R=2,N=56703+(_>>4)|0,it=77)}else if((it|0)==76)d=zi(d,w,Gt)|0,w=ke,R=C,it=77;else if((it|0)==82)it=0,ke=Oo(d,0,k)|0,ce=(ke|0)==0,H=d,w=ce?k:ke-d|0,R=0,_=56703,d=ce?d+k|0:ke;else if((it|0)==86){for(it=0,w=0,d=0,N=e[a0>>2]|0;C=e[N>>2]|0,!(!C||(d=Do(Ti,C)|0,(d|0)<0|d>>>0>(k-w|0)>>>0));)if(w=d+w|0,k>>>0>w>>>0)N=N+4|0;else break;if((d|0)<0){h=-1;break e}if(z0(t,32,Te,w,ke),!w)d=0,it=98;else for(C=0,k=e[a0>>2]|0;;){if(d=e[k>>2]|0,!d){d=w,it=98;break t}if(d=Do(Ti,d)|0,C=d+C|0,(C|0)>(w|0)){d=w,it=98;break t}if(e[t>>2]&32||B0(Ti,d,t)|0,C>>>0>=w>>>0){d=w,it=98;break}else k=k+4|0}}while(!1);if((it|0)==98){it=0,z0(t,32,Te,d,ke^8192),H=Ee,d=(Te|0)>(d|0)?Te:d;continue}(it|0)==77&&(it=0,C=(k|0)>-1?w&-65537:w,w=a0,w=(e[w>>2]|0)!=0|(e[w+4>>2]|0)!=0,(k|0)!=0|w?(w=(w&1^1)+(At-d)|0,H=d,w=(k|0)>(w|0)?k:w,_=N,d=Gt):(H=Gt,w=0,_=N,d=Gt)),N=d-H|0,w=(w|0)<(N|0)?N:w,k=R+w|0,d=(Te|0)<(k|0)?k:Te,z0(t,32,d,k,C),e[t>>2]&32||B0(_,R,t)|0,z0(t,48,d,k,C^65536),z0(t,48,w,N,0),e[t>>2]&32||B0(H,N,t)|0,z0(t,32,d,k,C^8192),H=Ee}e:do if((it|0)==245&&!t)if(r){for(h=1;r=e[c+(h<<2)>>2]|0,!!r;)if(Ps(l+(h<<3)|0,r,o),h=h+1|0,(h|0)>=10){h=1;break e}if((h|0)<10)for(;;){if(e[c+(h<<2)>>2]|0){h=-1;break e}if(h=h+1|0,(h|0)>=10){h=1;break}}else h=1}else h=0;while(!1);return b=Si,h|0}function Id(t,r,o){return t=t|0,r=r|0,o=o|0,_S(t,r,o)|0}function Ed(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0,w=0;w=b,b=b+112|0,d=w,c=d,h=c+112|0;do e[c>>2]=0,c=c+4|0;while((c|0)<(h|0));return c=d+4|0,e[c>>2]=t,h=d+8|0,e[h>>2]=-1,e[d+44>>2]=t,e[d+76>>2]=-1,oi(d,0),l=+xo(d,o,1),o=(e[c>>2]|0)-(e[h>>2]|0)+(e[d+108>>2]|0)|0,r&&(e[r>>2]=o|0?t+o|0:t),b=w,+l}function _s(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0;return C=b,b=b+112|0,w=C,e[w>>2]=0,h=w+4|0,e[h>>2]=t,e[w+44>>2]=t,d=w+8|0,e[d>>2]=(t|0)<0?-1:t+2147483647|0,e[w+76>>2]=-1,oi(w,0),l=wo(w,o,1,l,c)|0,r&&(e[r>>2]=t+((e[h>>2]|0)+(e[w+108>>2]|0)-(e[d>>2]|0))),b=C,l|0}function kd(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0;return l=t+20|0,c=e[l>>2]|0,t=(e[t+16>>2]|0)-c|0,t=t>>>0>o>>>0?o:t,o0(c|0,r|0,t|0)|0,e[l>>2]=(e[l>>2]|0)+t,o|0}function Ps(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0;e:do if(r>>>0<=20)do switch(r|0){case 9:{l=(e[o>>2]|0)+3&-4,r=e[l>>2]|0,e[o>>2]=l+4,e[t>>2]=r;break e}case 10:{l=(e[o>>2]|0)+3&-4,r=e[l>>2]|0,e[o>>2]=l+4,l=t,e[l>>2]=r,e[l+4>>2]=((r|0)<0)<<31>>31;break e}case 11:{l=(e[o>>2]|0)+3&-4,r=e[l>>2]|0,e[o>>2]=l+4,l=t,e[l>>2]=r,e[l+4>>2]=0;break e}case 12:{l=(e[o>>2]|0)+7&-8,r=l,c=e[r>>2]|0,r=e[r+4>>2]|0,e[o>>2]=l+8,l=t,e[l>>2]=c,e[l+4>>2]=r;break e}case 13:{c=(e[o>>2]|0)+3&-4,l=e[c>>2]|0,e[o>>2]=c+4,l=(l&65535)<<16>>16,c=t,e[c>>2]=l,e[c+4>>2]=((l|0)<0)<<31>>31;break e}case 14:{c=(e[o>>2]|0)+3&-4,l=e[c>>2]|0,e[o>>2]=c+4,c=t,e[c>>2]=l&65535,e[c+4>>2]=0;break e}case 15:{c=(e[o>>2]|0)+3&-4,l=e[c>>2]|0,e[o>>2]=c+4,l=(l&255)<<24>>24,c=t,e[c>>2]=l,e[c+4>>2]=((l|0)<0)<<31>>31;break e}case 16:{c=(e[o>>2]|0)+3&-4,l=e[c>>2]|0,e[o>>2]=c+4,c=t,e[c>>2]=l&255,e[c+4>>2]=0;break e}case 17:{c=(e[o>>2]|0)+7&-8,h=+B[c>>3],e[o>>2]=c+8,B[t>>3]=h;break e}case 18:{c=(e[o>>2]|0)+7&-8,h=+B[c>>3],e[o>>2]=c+8,B[t>>3]=h;break e}default:break e}while(!1);while(!1)}function zi(t,r,o){t=t|0,r=r|0,o=o|0;var l=0;if(r>>>0>0|(r|0)==0&t>>>0>4294967295)for(;;)if(l=Cr(t|0,r|0,10,0)|0,o=o+-1|0,S[o>>0]=l|48,l=xn(t|0,r|0,10,0)|0,r>>>0>9|(r|0)==9&t>>>0>4294967295)t=l,r=ye;else{t=l;break}if(t)for(;o=o+-1|0,S[o>>0]=(t>>>0)%10|0|48,!(t>>>0<10);)t=(t>>>0)/10|0;return o|0}function z0(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0;w=b,b=b+256|0,d=w;do if((o|0)>(l|0)&(c&73728|0)==0){if(c=o-l|0,Jt(d|0,r|0,(c>>>0>256?256:c)|0)|0,r=e[t>>2]|0,h=(r&32|0)==0,c>>>0>255){l=o-l|0;do h&&(B0(d,256,t)|0,r=e[t>>2]|0),c=c+-256|0,h=(r&32|0)==0;while(c>>>0>255);if(h)c=l&255;else break}else if(!h)break;B0(d,c,t)|0}while(!1);b=w}function E0(t){t=t|0;var r=0,o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0,ce=0,ke=0,Ee=0,Te=0,it=0,jt=0,Gt=0,s0=0,i0=0,zt=0,gt=0,Kt=0,dt=0;do if(t>>>0<245){if(_=t>>>0<11?16:t+11&-8,t=_>>>3,w=e[10218]|0,o=w>>>t,o&3){t=(o&1^1)+t|0,l=t<<1,o=40912+(l<<2)|0,l=40912+(l+2<<2)|0,c=e[l>>2]|0,h=c+8|0,d=e[h>>2]|0;do if((o|0)!=(d|0))if(d>>>0<(e[10222]|0)>>>0&&St(),r=d+12|0,(e[r>>2]|0)==(c|0)){e[r>>2]=o,e[l>>2]=d;break}else St();else e[10218]=w&~(1<>2]=dt|3,dt=c+(dt|4)|0,e[dt>>2]=e[dt>>2]|1,dt=h,dt|0}if(d=e[10220]|0,_>>>0>d>>>0){if(o){l=2<>>12&16,l=l>>>C,c=l>>>5&8,l=l>>>c,h=l>>>2&4,l=l>>>h,o=l>>>1&2,l=l>>>o,t=l>>>1&1,t=(c|C|h|o|t)+(l>>>t)|0,l=t<<1,o=40912+(l<<2)|0,l=40912+(l+2<<2)|0,h=e[l>>2]|0,C=h+8|0,c=e[C>>2]|0;do if((o|0)!=(c|0))if(c>>>0<(e[10222]|0)>>>0&&St(),r=c+12|0,(e[r>>2]|0)==(h|0)){e[r>>2]=o,e[l>>2]=c,D=e[10220]|0;break}else St();else e[10218]=w&~(1<>2]=_|3,w=h+_|0,e[h+(_|4)>>2]=d|1,e[h+dt>>2]=d,D&&(c=e[10223]|0,o=D>>>3,r=o<<1,l=40912+(r<<2)|0,t=e[10218]|0,o=1<>2]|0,r>>>0<(e[10222]|0)>>>0?St():(k=t,N=r)):(e[10218]=t|o,k=40912+(r+2<<2)|0,N=l),e[k>>2]=c,e[N+12>>2]=c,e[c+8>>2]=N,e[c+12>>2]=l),e[10220]=d,e[10223]=w,dt=C,dt|0}if(t=e[10219]|0,t){for(o=(t&0-t)+-1|0,Kt=o>>>12&16,o=o>>>Kt,gt=o>>>5&8,o=o>>>gt,dt=o>>>2&4,o=o>>>dt,t=o>>>1&2,o=o>>>t,l=o>>>1&1,l=e[41176+((gt|Kt|dt|t|l)+(o>>>l)<<2)>>2]|0,o=(e[l+4>>2]&-8)-_|0,t=l;;){if(r=e[t+16>>2]|0,!r&&(r=e[t+20>>2]|0,!r)){C=o;break}t=(e[r+4>>2]&-8)-_|0,dt=t>>>0>>0,o=dt?t:o,t=r,l=dt?r:l}h=e[10222]|0,l>>>0>>0&&St(),w=l+_|0,l>>>0>=w>>>0&&St(),d=e[l+24>>2]|0,o=e[l+12>>2]|0;do if((o|0)==(l|0)){if(t=l+20|0,r=e[t>>2]|0,!r&&(t=l+16|0,r=e[t>>2]|0,!r)){R=0;break}for(;;){if(o=r+20|0,c=e[o>>2]|0,c){r=c,t=o;continue}if(o=r+16|0,c=e[o>>2]|0,c)r=c,t=o;else break}if(t>>>0>>0)St();else{e[t>>2]=0,R=r;break}}else if(c=e[l+8>>2]|0,c>>>0>>0&&St(),r=c+12|0,(e[r>>2]|0)!=(l|0)&&St(),t=o+8|0,(e[t>>2]|0)==(l|0)){e[r>>2]=o,e[t>>2]=c,R=o;break}else St();while(!1);do if(d){if(r=e[l+28>>2]|0,t=41176+(r<<2)|0,(l|0)==(e[t>>2]|0)){if(e[t>>2]=R,!R){e[10219]=e[10219]&~(1<>>0<(e[10222]|0)>>>0&&St(),r=d+16|0,(e[r>>2]|0)==(l|0)?e[r>>2]=R:e[d+20>>2]=R,!R)break;t=e[10222]|0,R>>>0>>0&&St(),e[R+24>>2]=d,r=e[l+16>>2]|0;do if(r)if(r>>>0>>0)St();else{e[R+16>>2]=r,e[r+24>>2]=R;break}while(!1);if(r=e[l+20>>2]|0,r)if(r>>>0<(e[10222]|0)>>>0)St();else{e[R+20>>2]=r,e[r+24>>2]=R;break}}while(!1);return C>>>0<16?(dt=C+_|0,e[l+4>>2]=dt|3,dt=l+(dt+4)|0,e[dt>>2]=e[dt>>2]|1):(e[l+4>>2]=_|3,e[l+(_|4)>>2]=C|1,e[l+(C+_)>>2]=C,r=e[10220]|0,r&&(h=e[10223]|0,o=r>>>3,r=o<<1,c=40912+(r<<2)|0,t=e[10218]|0,o=1<>2]|0,t>>>0<(e[10222]|0)>>>0?St():(U=r,H=t)):(e[10218]=t|o,U=40912+(r+2<<2)|0,H=c),e[U>>2]=h,e[H+12>>2]=h,e[h+8>>2]=H,e[h+12>>2]=c),e[10220]=C,e[10223]=w),dt=l+8|0,dt|0}else H=_}else H=_}else if(t>>>0<=4294967231)if(t=t+11|0,N=t&-8,k=e[10219]|0,k){o=0-N|0,t=t>>>8,t?N>>>0>16777215?D=31:(H=(t+1048320|0)>>>16&8,O=t<>>16&4,O=O<>>16&2,D=14-(U|H|D)+(O<>>15)|0,D=N>>>(D+7|0)&1|D<<1):D=0,t=e[41176+(D<<2)>>2]|0;e:do if(!t)c=0,t=0,O=86;else for(d=o,c=0,w=N<<((D|0)==31?0:25-(D>>>1)|0),C=t,t=0;;){if(h=e[C+4>>2]&-8,o=h-N|0,o>>>0>>0)if((h|0)==(N|0)){h=C,t=C,O=90;break e}else t=C;else o=d;if(O=e[C+20>>2]|0,C=e[C+16+(w>>>31<<2)>>2]|0,c=(O|0)==0|(O|0)==(C|0)?c:O,C)d=o,w=w<<1;else{O=86;break}}while(!1);if((O|0)==86){if((c|0)==0&(t|0)==0){if(t=2<>>12&16,t=t>>>R,k=t>>>5&8,t=t>>>k,U=t>>>2&4,t=t>>>U,H=t>>>1&2,t=t>>>H,c=t>>>1&1,c=e[41176+((k|R|U|H|c)+(t>>>c)<<2)>>2]|0,t=0}c?(h=c,O=90):(w=o,C=t)}if((O|0)==90)for(;;){if(O=0,H=(e[h+4>>2]&-8)-N|0,c=H>>>0>>0,o=c?H:o,t=c?h:t,c=e[h+16>>2]|0,c){h=c,O=90;continue}if(h=e[h+20>>2]|0,h)O=90;else{w=o,C=t;break}}if(C|0&&w>>>0<((e[10220]|0)-N|0)>>>0){c=e[10222]|0,C>>>0>>0&&St(),d=C+N|0,C>>>0>=d>>>0&&St(),h=e[C+24>>2]|0,o=e[C+12>>2]|0;do if((o|0)==(C|0)){if(t=C+20|0,r=e[t>>2]|0,!r&&(t=C+16|0,r=e[t>>2]|0,!r)){_=0;break}for(;;){if(o=r+20|0,l=e[o>>2]|0,l){r=l,t=o;continue}if(o=r+16|0,l=e[o>>2]|0,l)r=l,t=o;else break}if(t>>>0>>0)St();else{e[t>>2]=0,_=r;break}}else if(l=e[C+8>>2]|0,l>>>0>>0&&St(),r=l+12|0,(e[r>>2]|0)!=(C|0)&&St(),t=o+8|0,(e[t>>2]|0)==(C|0)){e[r>>2]=o,e[t>>2]=l,_=o;break}else St();while(!1);do if(h){if(r=e[C+28>>2]|0,t=41176+(r<<2)|0,(C|0)==(e[t>>2]|0)){if(e[t>>2]=_,!_){e[10219]=e[10219]&~(1<>>0<(e[10222]|0)>>>0&&St(),r=h+16|0,(e[r>>2]|0)==(C|0)?e[r>>2]=_:e[h+20>>2]=_,!_)break;t=e[10222]|0,_>>>0>>0&&St(),e[_+24>>2]=h,r=e[C+16>>2]|0;do if(r)if(r>>>0>>0)St();else{e[_+16>>2]=r,e[r+24>>2]=_;break}while(!1);if(r=e[C+20>>2]|0,r)if(r>>>0<(e[10222]|0)>>>0)St();else{e[_+20>>2]=r,e[r+24>>2]=_;break}}while(!1);e:do if(w>>>0>=16){if(e[C+4>>2]=N|3,e[C+(N|4)>>2]=w|1,e[C+(w+N)>>2]=w,r=w>>>3,w>>>0<256){t=r<<1,l=40912+(t<<2)|0,o=e[10218]|0,r=1<>2]|0,t>>>0<(e[10222]|0)>>>0?St():(G=r,$=t)):(e[10218]=o|r,G=40912+(t+2<<2)|0,$=l),e[G>>2]=d,e[$+12>>2]=d,e[C+(N+8)>>2]=$,e[C+(N+12)>>2]=l;break}if(r=w>>>8,r?w>>>0>16777215?l=31:(Kt=(r+1048320|0)>>>16&8,dt=r<>>16&4,dt=dt<>>16&2,l=14-(gt|Kt|l)+(dt<>>15)|0,l=w>>>(l+7|0)&1|l<<1):l=0,r=41176+(l<<2)|0,e[C+(N+28)>>2]=l,e[C+(N+20)>>2]=0,e[C+(N+16)>>2]=0,t=e[10219]|0,o=1<>2]=d,e[C+(N+24)>>2]=r,e[C+(N+12)>>2]=d,e[C+(N+8)>>2]=d;break}r=e[r>>2]|0;t:do if((e[r+4>>2]&-8|0)!=(w|0)){for(l=w<<((l|0)==31?0:25-(l>>>1)|0);t=r+16+(l>>>31<<2)|0,o=e[t>>2]|0,!!o;)if((e[o+4>>2]&-8|0)==(w|0)){oe=o;break t}else l=l<<1,r=o;if(t>>>0<(e[10222]|0)>>>0)St();else{e[t>>2]=d,e[C+(N+24)>>2]=r,e[C+(N+12)>>2]=d,e[C+(N+8)>>2]=d;break e}}else oe=r;while(!1);if(r=oe+8|0,t=e[r>>2]|0,dt=e[10222]|0,t>>>0>=dt>>>0&oe>>>0>=dt>>>0){e[t+12>>2]=d,e[r>>2]=d,e[C+(N+8)>>2]=t,e[C+(N+12)>>2]=oe,e[C+(N+24)>>2]=0;break}else St()}else dt=w+N|0,e[C+4>>2]=dt|3,dt=C+(dt+4)|0,e[dt>>2]=e[dt>>2]|1;while(!1);return dt=C+8|0,dt|0}else H=N}else H=N;else H=-1;while(!1);if(o=e[10220]|0,o>>>0>=H>>>0)return r=o-H|0,t=e[10223]|0,r>>>0>15?(e[10223]=t+H,e[10220]=r,e[t+(H+4)>>2]=r|1,e[t+o>>2]=r,e[t+4>>2]=H|3):(e[10220]=0,e[10223]=0,e[t+4>>2]=o|3,dt=t+(o+4)|0,e[dt>>2]=e[dt>>2]|1),dt=t+8|0,dt|0;if(t=e[10221]|0,t>>>0>H>>>0)return Kt=t-H|0,e[10221]=Kt,dt=e[10224]|0,e[10224]=dt+H,e[dt+(H+4)>>2]=Kt|1,e[dt+4>>2]=H|3,dt=dt+8|0,dt|0;do if(!(e[10336]|0))if(t=Wo(30)|0,t+-1&t)St();else{e[10338]=t,e[10337]=t,e[10339]=-1,e[10340]=-1,e[10341]=0,e[10329]=0,oe=(ea(0)|0)&-16^1431655768,e[10336]=oe;break}while(!1);if(C=H+48|0,w=e[10338]|0,D=H+47|0,d=w+D|0,w=0-w|0,k=d&w,k>>>0<=H>>>0||(t=e[10328]|0,t|0&&($=e[10326]|0,oe=$+k|0,oe>>>0<=$>>>0|oe>>>0>t>>>0)))return dt=0,dt|0;e:do if(e[10329]&4)t=0,O=191;else{t=e[10224]|0;t:do if(t){for(c=41320;;){if(o=e[c>>2]|0,o>>>0<=t>>>0&&(K=c+4|0,(o+(e[K>>2]|0)|0)>>>0>t>>>0)){h=c,t=K;break}if(c=e[c+8>>2]|0,!c){O=174;break t}}if(o=d-(e[10221]|0)&w,o>>>0<2147483647)if(c=Mi(o|0)|0,oe=(c|0)==((e[h>>2]|0)+(e[t>>2]|0)|0),t=oe?o:0,oe){if((c|0)!=-1){Z=c,U=t,O=194;break e}}else O=184;else t=0}else O=174;while(!1);do if((O|0)==174)if(h=Mi(0)|0,(h|0)!=-1)if(t=h,o=e[10337]|0,c=o+-1|0,c&t?o=k-t+(c+t&0-o)|0:o=k,t=e[10326]|0,c=t+o|0,o>>>0>H>>>0&o>>>0<2147483647){if(oe=e[10328]|0,oe|0&&c>>>0<=t>>>0|c>>>0>oe>>>0){t=0;break}if(c=Mi(o|0)|0,oe=(c|0)==(h|0),t=oe?o:0,oe){Z=h,U=t,O=194;break e}else O=184}else t=0;else t=0;while(!1);t:do if((O|0)==184){h=0-o|0;do if(C>>>0>o>>>0&(o>>>0<2147483647&(c|0)!=-1)&&(P=e[10338]|0,P=D-o+P&0-P,P>>>0<2147483647))if((Mi(P|0)|0)==-1){Mi(h|0)|0;break t}else{o=P+o|0;break}while(!1);if((c|0)!=-1){Z=c,U=o,O=194;break e}}while(!1);e[10329]=e[10329]|4,O=191}while(!1);if((O|0)==191&&k>>>0<2147483647&&(Z=Mi(k|0)|0,ie=Mi(0)|0,Z>>>0>>0&((Z|0)!=-1&(ie|0)!=-1))&&(ne=ie-Z|0,ce=ne>>>0>(H+40|0)>>>0,ce)&&(U=ce?ne:t,O=194),(O|0)==194){t=(e[10326]|0)+U|0,e[10326]=t,t>>>0>(e[10327]|0)>>>0&&(e[10327]=t),d=e[10224]|0;e:do if(d){h=41320;do{if(t=e[h>>2]|0,o=h+4|0,c=e[o>>2]|0,(Z|0)==(t+c|0)){ke=t,Ee=o,Te=c,it=h,O=204;break}h=e[h+8>>2]|0}while(h|0);if((O|0)==204&&!(e[it+12>>2]&8|0)&&d>>>0>>0&d>>>0>=ke>>>0){e[Ee>>2]=Te+U,dt=(e[10221]|0)+U|0,Kt=d+8|0,Kt=Kt&7|0?0-Kt&7:0,gt=dt-Kt|0,e[10224]=d+Kt,e[10221]=gt,e[d+(Kt+4)>>2]=gt|1,e[d+(dt+4)>>2]=40,e[10225]=e[10340];break}for(t=e[10222]|0,Z>>>0>>0&&(e[10222]=Z,t=Z),o=Z+U|0,h=41320;;){if((e[h>>2]|0)==(o|0)){c=h,o=h,O=212;break}if(h=e[h+8>>2]|0,!h){o=41320;break}}if((O|0)==212)if(e[o+12>>2]&8)o=41320;else{e[c>>2]=Z,R=o+4|0,e[R>>2]=(e[R>>2]|0)+U,R=Z+8|0,R=R&7|0?0-R&7:0,D=Z+(U+8)|0,D=D&7|0?0-D&7:0,r=Z+(D+U)|0,N=R+H|0,_=Z+N|0,k=r-(Z+R)-H|0,e[Z+(R+4)>>2]=H|3;t:do if((r|0)!=(d|0)){if((r|0)==(e[10223]|0)){dt=(e[10220]|0)+k|0,e[10220]=dt,e[10223]=_,e[Z+(N+4)>>2]=dt|1,e[Z+(dt+N)>>2]=dt;break}if(w=U+4|0,o=e[Z+(w+D)>>2]|0,(o&3|0)==1){C=o&-8,h=o>>>3;i:do if(o>>>0>=256){d=e[Z+((D|24)+U)>>2]|0,l=e[Z+(U+12+D)>>2]|0;do if((l|0)==(r|0)){if(c=D|16,l=Z+(w+c)|0,o=e[l>>2]|0,!o&&(l=Z+(c+U)|0,o=e[l>>2]|0,!o)){zt=0;break}for(;;){if(c=o+20|0,h=e[c>>2]|0,h){o=h,l=c;continue}if(c=o+16|0,h=e[c>>2]|0,h)o=h,l=c;else break}if(l>>>0>>0)St();else{e[l>>2]=0,zt=o;break}}else if(c=e[Z+((D|8)+U)>>2]|0,c>>>0>>0&&St(),t=c+12|0,(e[t>>2]|0)!=(r|0)&&St(),o=l+8|0,(e[o>>2]|0)==(r|0)){e[t>>2]=l,e[o>>2]=c,zt=l;break}else St();while(!1);if(!d)break;t=e[Z+(U+28+D)>>2]|0,o=41176+(t<<2)|0;do if((r|0)!=(e[o>>2]|0)){if(d>>>0<(e[10222]|0)>>>0&&St(),t=d+16|0,(e[t>>2]|0)==(r|0)?e[t>>2]=zt:e[d+20>>2]=zt,!zt)break i}else{if(e[o>>2]=zt,zt)break;e[10219]=e[10219]&~(1<>>0>>0&&St(),e[zt+24>>2]=d,r=D|16,t=e[Z+(r+U)>>2]|0;do if(t)if(t>>>0>>0)St();else{e[zt+16>>2]=t,e[t+24>>2]=zt;break}while(!1);if(r=e[Z+(w+r)>>2]|0,!r)break;if(r>>>0<(e[10222]|0)>>>0)St();else{e[zt+20>>2]=r,e[r+24>>2]=zt;break}}else{l=e[Z+((D|8)+U)>>2]|0,c=e[Z+(U+12+D)>>2]|0,o=40912+(h<<1<<2)|0;do if((l|0)!=(o|0)){if(l>>>0>>0&&St(),(e[l+12>>2]|0)==(r|0))break;St()}while(!1);if((c|0)==(l|0)){e[10218]=e[10218]&~(1<>>0>>0&&St(),t=c+8|0,(e[t>>2]|0)==(r|0)){jt=t;break}St()}while(!1);e[l+12>>2]=c,e[jt>>2]=l}while(!1);r=Z+((C|D)+U)|0,c=C+k|0}else c=k;if(r=r+4|0,e[r>>2]=e[r>>2]&-2,e[Z+(N+4)>>2]=c|1,e[Z+(c+N)>>2]=c,r=c>>>3,c>>>0<256){t=r<<1,l=40912+(t<<2)|0,o=e[10218]|0,r=1<>2]|0,t>>>0>=(e[10222]|0)>>>0){gt=r,Kt=t;break}St()}while(!1);e[gt>>2]=_,e[Kt+12>>2]=_,e[Z+(N+8)>>2]=Kt,e[Z+(N+12)>>2]=l;break}r=c>>>8;do if(!r)l=0;else{if(c>>>0>16777215){l=31;break}gt=(r+1048320|0)>>>16&8,Kt=r<>>16&4,Kt=Kt<>>16&2,l=14-(zt|gt|l)+(Kt<>>15)|0,l=c>>>(l+7|0)&1|l<<1}while(!1);if(r=41176+(l<<2)|0,e[Z+(N+28)>>2]=l,e[Z+(N+20)>>2]=0,e[Z+(N+16)>>2]=0,t=e[10219]|0,o=1<>2]=_,e[Z+(N+24)>>2]=r,e[Z+(N+12)>>2]=_,e[Z+(N+8)>>2]=_;break}r=e[r>>2]|0;i:do if((e[r+4>>2]&-8|0)!=(c|0)){for(l=c<<((l|0)==31?0:25-(l>>>1)|0);t=r+16+(l>>>31<<2)|0,o=e[t>>2]|0,!!o;)if((e[o+4>>2]&-8|0)==(c|0)){dt=o;break i}else l=l<<1,r=o;if(t>>>0<(e[10222]|0)>>>0)St();else{e[t>>2]=_,e[Z+(N+24)>>2]=r,e[Z+(N+12)>>2]=_,e[Z+(N+8)>>2]=_;break t}}else dt=r;while(!1);if(r=dt+8|0,t=e[r>>2]|0,Kt=e[10222]|0,t>>>0>=Kt>>>0&dt>>>0>=Kt>>>0){e[t+12>>2]=_,e[r>>2]=_,e[Z+(N+8)>>2]=t,e[Z+(N+12)>>2]=dt,e[Z+(N+24)>>2]=0;break}else St()}else dt=(e[10221]|0)+k|0,e[10221]=dt,e[10224]=_,e[Z+(N+4)>>2]=dt|1;while(!1);return dt=Z+(R|8)|0,dt|0}for(;t=e[o>>2]|0,!(t>>>0<=d>>>0&&(r=e[o+4>>2]|0,l=t+r|0,l>>>0>d>>>0));)o=e[o+8>>2]|0;if(c=t+(r+-39)|0,t=t+(r+-47+(c&7|0?0-c&7:0))|0,c=d+16|0,t=t>>>0>>0?d:t,r=t+8|0,o=Z+8|0,o=o&7|0?0-o&7:0,dt=U+-40-o|0,e[10224]=Z+o,e[10221]=dt,e[Z+(o+4)>>2]=dt|1,e[Z+(U+-36)>>2]=40,e[10225]=e[10340],o=t+4|0,e[o>>2]=27,e[r>>2]=e[10330],e[r+4>>2]=e[10331],e[r+8>>2]=e[10332],e[r+12>>2]=e[10333],e[10330]=Z,e[10331]=U,e[10333]=0,e[10332]=r,r=t+28|0,e[r>>2]=7,(t+32|0)>>>0>>0)do dt=r,r=r+4|0,e[r>>2]=7;while((dt+8|0)>>>0>>0);if((t|0)!=(d|0)){if(h=t-d|0,e[o>>2]=e[o>>2]&-2,e[d+4>>2]=h|1,e[t>>2]=h,r=h>>>3,h>>>0<256){t=r<<1,l=40912+(t<<2)|0,o=e[10218]|0,r=1<>2]|0,t>>>0<(e[10222]|0)>>>0?St():(Gt=r,s0=t)):(e[10218]=o|r,Gt=40912+(t+2<<2)|0,s0=l),e[Gt>>2]=d,e[s0+12>>2]=d,e[d+8>>2]=s0,e[d+12>>2]=l;break}if(r=h>>>8,r?h>>>0>16777215?l=31:(Kt=(r+1048320|0)>>>16&8,dt=r<>>16&4,dt=dt<>>16&2,l=14-(gt|Kt|l)+(dt<>>15)|0,l=h>>>(l+7|0)&1|l<<1):l=0,o=41176+(l<<2)|0,e[d+28>>2]=l,e[d+20>>2]=0,e[c>>2]=0,r=e[10219]|0,t=1<>2]=d,e[d+24>>2]=o,e[d+12>>2]=d,e[d+8>>2]=d;break}r=e[o>>2]|0;t:do if((e[r+4>>2]&-8|0)!=(h|0)){for(l=h<<((l|0)==31?0:25-(l>>>1)|0);t=r+16+(l>>>31<<2)|0,o=e[t>>2]|0,!!o;)if((e[o+4>>2]&-8|0)==(h|0)){i0=o;break t}else l=l<<1,r=o;if(t>>>0<(e[10222]|0)>>>0)St();else{e[t>>2]=d,e[d+24>>2]=r,e[d+12>>2]=d,e[d+8>>2]=d;break e}}else i0=r;while(!1);if(r=i0+8|0,t=e[r>>2]|0,dt=e[10222]|0,t>>>0>=dt>>>0&i0>>>0>=dt>>>0){e[t+12>>2]=d,e[r>>2]=d,e[d+8>>2]=t,e[d+12>>2]=i0,e[d+24>>2]=0;break}else St()}}else{dt=e[10222]|0,(dt|0)==0|Z>>>0
>>0&&(e[10222]=Z),e[10330]=Z,e[10331]=U,e[10333]=0,e[10227]=e[10336],e[10226]=-1,r=0;do dt=r<<1,Kt=40912+(dt<<2)|0,e[40912+(dt+3<<2)>>2]=Kt,e[40912+(dt+2<<2)>>2]=Kt,r=r+1|0;while((r|0)!=32);dt=Z+8|0,dt=dt&7|0?0-dt&7:0,Kt=U+-40-dt|0,e[10224]=Z+dt,e[10221]=Kt,e[Z+(dt+4)>>2]=Kt|1,e[Z+(U+-36)>>2]=40,e[10225]=e[10340]}while(!1);if(r=e[10221]|0,r>>>0>H>>>0)return Kt=r-H|0,e[10221]=Kt,dt=e[10224]|0,e[10224]=dt+H,e[dt+(H+4)>>2]=Kt|1,e[dt+4>>2]=H|3,dt=dt+8|0,dt|0}return dt=S0()|0,e[dt>>2]=12,dt=0,dt|0}function n0(t){t=t|0;var r=0,o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0,G=0,$=0,P=0;if(t){r=t+-8|0,w=e[10222]|0,r>>>0>>0&&St(),o=e[t+-4>>2]|0,l=o&3,(l|0)==1&&St(),_=o&-8,H=t+(_+-8)|0;do if(o&1)P=r,h=_;else{if(r=e[r>>2]|0,!l)return;if(C=-8-r|0,k=t+C|0,N=r+_|0,k>>>0>>0&&St(),(k|0)==(e[10223]|0)){if(r=t+(_+-4)|0,o=e[r>>2]|0,(o&3|0)!=3){P=k,h=N;break}e[10220]=N,e[r>>2]=o&-2,e[t+(C+4)>>2]=N|1,e[H>>2]=N;return}if(c=r>>>3,r>>>0<256){if(l=e[t+(C+8)>>2]|0,o=e[t+(C+12)>>2]|0,r=40912+(c<<1<<2)|0,(l|0)!=(r|0)&&(l>>>0>>0&&St(),(e[l+12>>2]|0)!=(k|0)&&St()),(o|0)==(l|0)){e[10218]=e[10218]&~(1<>>0>>0&&St(),r=o+8|0,(e[r>>2]|0)==(k|0)?d=r:St()):d=o+8|0,e[l+12>>2]=o,e[d>>2]=l,P=k,h=N;break}d=e[t+(C+24)>>2]|0,l=e[t+(C+12)>>2]|0;do if((l|0)==(k|0)){if(o=t+(C+20)|0,r=e[o>>2]|0,!r&&(o=t+(C+16)|0,r=e[o>>2]|0,!r)){D=0;break}for(;;){if(l=r+20|0,c=e[l>>2]|0,c){r=c,o=l;continue}if(l=r+16|0,c=e[l>>2]|0,c)r=c,o=l;else break}if(o>>>0>>0)St();else{e[o>>2]=0,D=r;break}}else if(c=e[t+(C+8)>>2]|0,c>>>0>>0&&St(),r=c+12|0,(e[r>>2]|0)!=(k|0)&&St(),o=l+8|0,(e[o>>2]|0)==(k|0)){e[r>>2]=l,e[o>>2]=c,D=l;break}else St();while(!1);if(d){if(r=e[t+(C+28)>>2]|0,o=41176+(r<<2)|0,(k|0)==(e[o>>2]|0)){if(e[o>>2]=D,!D){e[10219]=e[10219]&~(1<>>0<(e[10222]|0)>>>0&&St(),r=d+16|0,(e[r>>2]|0)==(k|0)?e[r>>2]=D:e[d+20>>2]=D,!D){P=k,h=N;break}o=e[10222]|0,D>>>0>>0&&St(),e[D+24>>2]=d,r=e[t+(C+16)>>2]|0;do if(r)if(r>>>0>>0)St();else{e[D+16>>2]=r,e[r+24>>2]=D;break}while(!1);if(r=e[t+(C+20)>>2]|0,r)if(r>>>0<(e[10222]|0)>>>0)St();else{e[D+20>>2]=r,e[r+24>>2]=D,P=k,h=N;break}else P=k,h=N}else P=k,h=N}while(!1);if(P>>>0>=H>>>0&&St(),r=t+(_+-4)|0,o=e[r>>2]|0,o&1||St(),o&2)e[r>>2]=o&-2,e[P+4>>2]=h|1,e[P+h>>2]=h;else{if((H|0)==(e[10224]|0)){if($=(e[10221]|0)+h|0,e[10221]=$,e[10224]=P,e[P+4>>2]=$|1,(P|0)!=(e[10223]|0))return;e[10223]=0,e[10220]=0;return}if((H|0)==(e[10223]|0)){$=(e[10220]|0)+h|0,e[10220]=$,e[10223]=P,e[P+4>>2]=$|1,e[P+$>>2]=$;return}h=(o&-8)+h|0,c=o>>>3;do if(o>>>0>=256){d=e[t+(_+16)>>2]|0,r=e[t+(_|4)>>2]|0;do if((r|0)==(H|0)){if(o=t+(_+12)|0,r=e[o>>2]|0,!r&&(o=t+(_+8)|0,r=e[o>>2]|0,!r)){U=0;break}for(;;){if(l=r+20|0,c=e[l>>2]|0,c){r=c,o=l;continue}if(l=r+16|0,c=e[l>>2]|0,c)r=c,o=l;else break}if(o>>>0<(e[10222]|0)>>>0)St();else{e[o>>2]=0,U=r;break}}else if(o=e[t+_>>2]|0,o>>>0<(e[10222]|0)>>>0&&St(),l=o+12|0,(e[l>>2]|0)!=(H|0)&&St(),c=r+8|0,(e[c>>2]|0)==(H|0)){e[l>>2]=r,e[c>>2]=o,U=r;break}else St();while(!1);if(d){if(r=e[t+(_+20)>>2]|0,o=41176+(r<<2)|0,(H|0)==(e[o>>2]|0)){if(e[o>>2]=U,!U){e[10219]=e[10219]&~(1<>>0<(e[10222]|0)>>>0&&St(),r=d+16|0,(e[r>>2]|0)==(H|0)?e[r>>2]=U:e[d+20>>2]=U,!U)break;o=e[10222]|0,U>>>0>>0&&St(),e[U+24>>2]=d,r=e[t+(_+8)>>2]|0;do if(r)if(r>>>0>>0)St();else{e[U+16>>2]=r,e[r+24>>2]=U;break}while(!1);if(r=e[t+(_+12)>>2]|0,r)if(r>>>0<(e[10222]|0)>>>0)St();else{e[U+20>>2]=r,e[r+24>>2]=U;break}}}else{if(l=e[t+_>>2]|0,o=e[t+(_|4)>>2]|0,r=40912+(c<<1<<2)|0,(l|0)!=(r|0)&&(l>>>0<(e[10222]|0)>>>0&&St(),(e[l+12>>2]|0)!=(H|0)&&St()),(o|0)==(l|0)){e[10218]=e[10218]&~(1<>>0<(e[10222]|0)>>>0&&St(),r=o+8|0,(e[r>>2]|0)==(H|0)?R=r:St()):R=o+8|0,e[l+12>>2]=o,e[R>>2]=l}while(!1);if(e[P+4>>2]=h|1,e[P+h>>2]=h,(P|0)==(e[10223]|0)){e[10220]=h;return}}if(r=h>>>3,h>>>0<256){o=r<<1,c=40912+(o<<2)|0,l=e[10218]|0,r=1<>2]|0,o>>>0<(e[10222]|0)>>>0?St():(K=r,G=o)):(e[10218]=l|r,K=40912+(o+2<<2)|0,G=c),e[K>>2]=P,e[G+12>>2]=P,e[P+8>>2]=G,e[P+12>>2]=c;return}r=h>>>8,r?h>>>0>16777215?c=31:(K=(r+1048320|0)>>>16&8,G=r<>>16&4,G=G<>>16&2,c=14-(H|K|c)+(G<>>15)|0,c=h>>>(c+7|0)&1|c<<1):c=0,r=41176+(c<<2)|0,e[P+28>>2]=c,e[P+20>>2]=0,e[P+16>>2]=0,o=e[10219]|0,l=1<>2]|0;t:do if((e[r+4>>2]&-8|0)!=(h|0)){for(c=h<<((c|0)==31?0:25-(c>>>1)|0);o=r+16+(c>>>31<<2)|0,l=e[o>>2]|0,!!l;)if((e[l+4>>2]&-8|0)==(h|0)){$=l;break t}else c=c<<1,r=l;if(o>>>0<(e[10222]|0)>>>0)St();else{e[o>>2]=P,e[P+24>>2]=r,e[P+12>>2]=P,e[P+8>>2]=P;break e}}else $=r;while(!1);if(r=$+8|0,o=e[r>>2]|0,G=e[10222]|0,o>>>0>=G>>>0&$>>>0>=G>>>0){e[o+12>>2]=P,e[r>>2]=P,e[P+8>>2]=o,e[P+12>>2]=$,e[P+24>>2]=0;break}else St()}else e[10219]=o|l,e[r>>2]=P,e[P+24>>2]=r,e[P+12>>2]=P,e[P+8>>2]=P;while(!1);if(P=(e[10226]|0)+-1|0,e[10226]=P,!P)r=41328;else return;for(;r=e[r>>2]|0,r;)r=r+8|0;e[10226]=-1}}function Dd(t,r){t=t|0,r=r|0;var o=0;return t?(o=ee(r,t)|0,(r|t)>>>0>65535&&(o=((o>>>0)/(t>>>0)|0|0)==(r|0)?o:-1)):o=0,r=E0(o)|0,!r||!(e[r+-4>>2]&3)||Jt(r|0,0,o|0)|0,r|0}function Gi(t,r){t=t|0,r=r|0;var o=0,l=0;return t?r>>>0>4294967231?(t=S0()|0,e[t>>2]=12,t=0,t|0):(o=bd(t+-8|0,r>>>0<11?16:r+11&-8)|0,o?(t=o+8|0,t|0):(o=E0(r)|0,o?(l=e[t+-4>>2]|0,l=(l&-8)-(l&3|0?4:8)|0,o0(o|0,t|0,(l>>>0>>0?l:r)|0)|0,n0(t),t=o,t|0):(t=0,t|0))):(t=E0(r)|0,t|0)}function bd(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0;if(_=t+4|0,U=e[_>>2]|0,C=U&-8,k=t+C|0,w=e[10222]|0,o=U&3,(o|0)!=1&t>>>0>=w>>>0&t>>>0>>0||St(),l=t+(C|4)|0,c=e[l>>2]|0,c&1||St(),!o)return r>>>0<256?(t=0,t|0):(C>>>0>=(r+4|0)>>>0&&(C-r|0)>>>0<=e[10338]<<1>>>0||(t=0),t|0);if(C>>>0>=r>>>0)return o=C-r|0,o>>>0<=15||(e[_>>2]=U&1|r|2,e[t+(r+4)>>2]=o|3,e[l>>2]=e[l>>2]|1,Ls(t+r|0,o)),t|0;if((k|0)==(e[10224]|0))return o=(e[10221]|0)+C|0,o>>>0<=r>>>0?(t=0,t|0):(R=o-r|0,e[_>>2]=U&1|r|2,e[t+(r+4)>>2]=R|1,e[10224]=t+r,e[10221]=R,t|0);if((k|0)==(e[10223]|0))return l=(e[10220]|0)+C|0,l>>>0>>0?(t=0,t|0):(o=l-r|0,o>>>0>15?(e[_>>2]=U&1|r|2,e[t+(r+4)>>2]=o|1,e[t+l>>2]=o,l=t+(l+4)|0,e[l>>2]=e[l>>2]&-2,l=t+r|0):(e[_>>2]=U&1|l|2,l=t+(l+4)|0,e[l>>2]=e[l>>2]|1,l=0,o=0),e[10220]=o,e[10223]=l,t|0);if(c&2||(N=(c&-8)+C|0,N>>>0>>0))return t=0,t|0;R=N-r|0,h=c>>>3;do if(c>>>0>=256){d=e[t+(C+24)>>2]|0,h=e[t+(C+12)>>2]|0;do if((h|0)==(k|0)){if(l=t+(C+20)|0,o=e[l>>2]|0,!o&&(l=t+(C+16)|0,o=e[l>>2]|0,!o)){D=0;break}for(;;){if(c=o+20|0,h=e[c>>2]|0,h){o=h,l=c;continue}if(c=o+16|0,h=e[c>>2]|0,h)o=h,l=c;else break}if(l>>>0>>0)St();else{e[l>>2]=0,D=o;break}}else if(c=e[t+(C+8)>>2]|0,c>>>0>>0&&St(),o=c+12|0,(e[o>>2]|0)!=(k|0)&&St(),l=h+8|0,(e[l>>2]|0)==(k|0)){e[o>>2]=h,e[l>>2]=c,D=h;break}else St();while(!1);if(d){if(o=e[t+(C+28)>>2]|0,l=41176+(o<<2)|0,(k|0)==(e[l>>2]|0)){if(e[l>>2]=D,!D){e[10219]=e[10219]&~(1<>>0<(e[10222]|0)>>>0&&St(),o=d+16|0,(e[o>>2]|0)==(k|0)?e[o>>2]=D:e[d+20>>2]=D,!D)break;l=e[10222]|0,D>>>0>>0&&St(),e[D+24>>2]=d,o=e[t+(C+16)>>2]|0;do if(o)if(o>>>0>>0)St();else{e[D+16>>2]=o,e[o+24>>2]=D;break}while(!1);if(o=e[t+(C+20)>>2]|0,o)if(o>>>0<(e[10222]|0)>>>0)St();else{e[D+20>>2]=o,e[o+24>>2]=D;break}}}else{if(c=e[t+(C+8)>>2]|0,l=e[t+(C+12)>>2]|0,o=40912+(h<<1<<2)|0,(c|0)!=(o|0)&&(c>>>0>>0&&St(),(e[c+12>>2]|0)!=(k|0)&&St()),(l|0)==(c|0)){e[10218]=e[10218]&~(1<>>0>>0&&St(),o=l+8|0,(e[o>>2]|0)==(k|0)?d=o:St()):d=l+8|0,e[c+12>>2]=l,e[d>>2]=c}while(!1);return R>>>0<16?(e[_>>2]=N|U&1|2,r=t+(N|4)|0,e[r>>2]=e[r>>2]|1,t|0):(e[_>>2]=U&1|r|2,e[t+(r+4)>>2]=R|3,U=t+(N|4)|0,e[U>>2]=e[U>>2]|1,Ls(t+r|0,R),t|0)}function Ls(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0,G=0,$=0;H=t+r|0,o=e[t+4>>2]|0;do if(o&1)$=t,d=r;else{if(D=e[t>>2]|0,!(o&3))return;if(R=t+(0-D)|0,N=D+r|0,C=e[10222]|0,R>>>0>>0&&St(),(R|0)==(e[10223]|0)){if(l=t+(r+4)|0,o=e[l>>2]|0,(o&3|0)!=3){$=R,d=N;break}e[10220]=N,e[l>>2]=o&-2,e[t+(4-D)>>2]=N|1,e[H>>2]=N;return}if(h=D>>>3,D>>>0<256){if(c=e[t+(8-D)>>2]|0,l=e[t+(12-D)>>2]|0,o=40912+(h<<1<<2)|0,(c|0)!=(o|0)&&(c>>>0>>0&&St(),(e[c+12>>2]|0)!=(R|0)&&St()),(l|0)==(c|0)){e[10218]=e[10218]&~(1<>>0>>0&&St(),o=l+8|0,(e[o>>2]|0)==(R|0)?w=o:St()):w=l+8|0,e[c+12>>2]=l,e[w>>2]=c,$=R,d=N;break}w=e[t+(24-D)>>2]|0,c=e[t+(12-D)>>2]|0;do if((c|0)==(R|0)){if(c=16-D|0,l=t+(c+4)|0,o=e[l>>2]|0,!o&&(l=t+c|0,o=e[l>>2]|0,!o)){k=0;break}for(;;){if(c=o+20|0,h=e[c>>2]|0,h){o=h,l=c;continue}if(c=o+16|0,h=e[c>>2]|0,h)o=h,l=c;else break}if(l>>>0>>0)St();else{e[l>>2]=0,k=o;break}}else if(h=e[t+(8-D)>>2]|0,h>>>0>>0&&St(),o=h+12|0,(e[o>>2]|0)!=(R|0)&&St(),l=c+8|0,(e[l>>2]|0)==(R|0)){e[o>>2]=c,e[l>>2]=h,k=c;break}else St();while(!1);if(w){if(o=e[t+(28-D)>>2]|0,l=41176+(o<<2)|0,(R|0)==(e[l>>2]|0)){if(e[l>>2]=k,!k){e[10219]=e[10219]&~(1<>>0<(e[10222]|0)>>>0&&St(),o=w+16|0,(e[o>>2]|0)==(R|0)?e[o>>2]=k:e[w+20>>2]=k,!k){$=R,d=N;break}c=e[10222]|0,k>>>0>>0&&St(),e[k+24>>2]=w,o=16-D|0,l=e[t+o>>2]|0;do if(l)if(l>>>0>>0)St();else{e[k+16>>2]=l,e[l+24>>2]=k;break}while(!1);if(o=e[t+(o+4)>>2]|0,o)if(o>>>0<(e[10222]|0)>>>0)St();else{e[k+20>>2]=o,e[o+24>>2]=k,$=R,d=N;break}else $=R,d=N}else $=R,d=N}while(!1);if(C=e[10222]|0,H>>>0>>0&&St(),o=t+(r+4)|0,l=e[o>>2]|0,l&2)e[o>>2]=l&-2,e[$+4>>2]=d|1,e[$+d>>2]=d;else{if((H|0)==(e[10224]|0)){if(G=(e[10221]|0)+d|0,e[10221]=G,e[10224]=$,e[$+4>>2]=G|1,($|0)!=(e[10223]|0))return;e[10223]=0,e[10220]=0;return}if((H|0)==(e[10223]|0)){G=(e[10220]|0)+d|0,e[10220]=G,e[10223]=$,e[$+4>>2]=G|1,e[$+G>>2]=G;return}d=(l&-8)+d|0,h=l>>>3;do if(l>>>0>=256){w=e[t+(r+24)>>2]|0,c=e[t+(r+12)>>2]|0;do if((c|0)==(H|0)){if(l=t+(r+20)|0,o=e[l>>2]|0,!o&&(l=t+(r+16)|0,o=e[l>>2]|0,!o)){U=0;break}for(;;){if(c=o+20|0,h=e[c>>2]|0,h){o=h,l=c;continue}if(c=o+16|0,h=e[c>>2]|0,h)o=h,l=c;else break}if(l>>>0>>0)St();else{e[l>>2]=0,U=o;break}}else if(h=e[t+(r+8)>>2]|0,h>>>0>>0&&St(),o=h+12|0,(e[o>>2]|0)!=(H|0)&&St(),l=c+8|0,(e[l>>2]|0)==(H|0)){e[o>>2]=c,e[l>>2]=h,U=c;break}else St();while(!1);if(w){if(o=e[t+(r+28)>>2]|0,l=41176+(o<<2)|0,(H|0)==(e[l>>2]|0)){if(e[l>>2]=U,!U){e[10219]=e[10219]&~(1<>>0<(e[10222]|0)>>>0&&St(),o=w+16|0,(e[o>>2]|0)==(H|0)?e[o>>2]=U:e[w+20>>2]=U,!U)break;l=e[10222]|0,U>>>0>>0&&St(),e[U+24>>2]=w,o=e[t+(r+16)>>2]|0;do if(o)if(o>>>0>>0)St();else{e[U+16>>2]=o,e[o+24>>2]=U;break}while(!1);if(o=e[t+(r+20)>>2]|0,o)if(o>>>0<(e[10222]|0)>>>0)St();else{e[U+20>>2]=o,e[o+24>>2]=U;break}}}else{if(c=e[t+(r+8)>>2]|0,l=e[t+(r+12)>>2]|0,o=40912+(h<<1<<2)|0,(c|0)!=(o|0)&&(c>>>0>>0&&St(),(e[c+12>>2]|0)!=(H|0)&&St()),(l|0)==(c|0)){e[10218]=e[10218]&~(1<>>0>>0&&St(),o=l+8|0,(e[o>>2]|0)==(H|0)?_=o:St()):_=l+8|0,e[c+12>>2]=l,e[_>>2]=c}while(!1);if(e[$+4>>2]=d|1,e[$+d>>2]=d,($|0)==(e[10223]|0)){e[10220]=d;return}}if(o=d>>>3,d>>>0<256){l=o<<1,h=40912+(l<<2)|0,c=e[10218]|0,o=1<>2]|0,l>>>0<(e[10222]|0)>>>0?St():(K=o,G=l)):(e[10218]=c|o,K=40912+(l+2<<2)|0,G=h),e[K>>2]=$,e[G+12>>2]=$,e[$+8>>2]=G,e[$+12>>2]=h;return}if(o=d>>>8,o?d>>>0>16777215?h=31:(K=(o+1048320|0)>>>16&8,G=o<>>16&4,G=G<>>16&2,h=14-(H|K|h)+(G<>>15)|0,h=d>>>(h+7|0)&1|h<<1):h=0,o=41176+(h<<2)|0,e[$+28>>2]=h,e[$+20>>2]=0,e[$+16>>2]=0,l=e[10219]|0,c=1<>2]=$,e[$+24>>2]=o,e[$+12>>2]=$,e[$+8>>2]=$;return}o=e[o>>2]|0;e:do if((e[o+4>>2]&-8|0)!=(d|0)){for(h=d<<((h|0)==31?0:25-(h>>>1)|0);l=o+16+(h>>>31<<2)|0,c=e[l>>2]|0,!!c;)if((e[c+4>>2]&-8|0)==(d|0)){o=c;break e}else h=h<<1,o=c;l>>>0<(e[10222]|0)>>>0&&St(),e[l>>2]=$,e[$+24>>2]=o,e[$+12>>2]=$,e[$+8>>2]=$;return}while(!1);l=o+8|0,c=e[l>>2]|0,G=e[10222]|0,c>>>0>=G>>>0&o>>>0>=G>>>0||St(),e[c+12>>2]=$,e[l>>2]=$,e[$+8>>2]=c,e[$+12>>2]=o,e[$+24>>2]=0}function Nd(t){t=t|0;var r=0,o=0,l=0,c=0,h=0,d=0;if(l=e[9321]|0,_d(42048,l,42104),e[10342]=42892,e[10344]=42912,e[10343]=0,t=e[10720]|0,g=0,Ae(62,41368+t|0,42048),h=g,g=0,h&1&&(h=j()|0,tt(41376),le(h|0)),e[41368+(t+72)>>2]=0,e[41368+(t+76)>>2]=-1,c=e[9322]|0,Os(42152,c,42112),e[10364]=42972,e[10365]=42992,o=e[10740]|0,g=0,Ae(62,41456+o|0,42152),h=g,g=0,h&1&&(h=j()|0,tt(41460),le(h|0)),t=o+72|0,e[41456+t>>2]=0,r=o+76|0,e[41456+r>>2]=-1,h=e[9320]|0,Os(42200,h,42120),e[10385]=42972,e[10386]=42992,g=0,Ae(62,41540+o|0,42200),d=g,g=0,d&1&&(d=j()|0,tt(41544),le(d|0)),e[41540+t>>2]=0,e[41540+r>>2]=-1,d=e[41540+((e[(e[10385]|0)+-12>>2]|0)+24)>>2]|0,e[10406]=42972,e[10407]=42992,g=0,Ae(62,41624+o|0,d|0),d=g,g=0,d&1&&(d=j()|0,tt(41628),le(d|0)),e[41624+t>>2]=0,e[41624+r>>2]=-1,e[41368+((e[(e[10342]|0)+-12>>2]|0)+72)>>2]=41456,t=41540+((e[(e[10385]|0)+-12>>2]|0)+4)|0,e[t>>2]=e[t>>2]|8192,e[41540+((e[(e[10385]|0)+-12>>2]|0)+72)>>2]=41456,Pd(42248,l,42128),e[10427]=42932,e[10429]=42952,e[10428]=0,t=e[10730]|0,g=0,Ae(62,41708+t|0,42248),d=g,g=0,d&1&&(d=j()|0,mn(41716),le(d|0)),e[41708+(t+72)>>2]=0,e[41708+(t+76)>>2]=-1,$s(42304,c,42136),e[10449]=43012,e[10450]=43032,o=e[10750]|0,g=0,Ae(62,41796+o|0,42304),d=g,g=0,d&1&&(d=j()|0,mn(41800),le(d|0)),t=o+72|0,e[41796+t>>2]=0,r=o+76|0,e[41796+r>>2]=-1,$s(42352,h,42144),e[10470]=43012,e[10471]=43032,g=0,Ae(62,41880+o|0,42352),d=g,g=0,d&1&&(d=j()|0,mn(41884),le(d|0)),e[41880+t>>2]=0,e[41880+r>>2]=-1,d=e[41880+((e[(e[10470]|0)+-12>>2]|0)+24)>>2]|0,e[10491]=43012,e[10492]=43032,g=0,Ae(62,41964+o|0,d|0),d=g,g=0,d&1)d=j()|0,mn(41968),le(d|0);else{e[41964+t>>2]=0,e[41964+r>>2]=-1,e[41708+((e[(e[10427]|0)+-12>>2]|0)+72)>>2]=41796,d=41880+((e[(e[10470]|0)+-12>>2]|0)+4)|0,e[d>>2]=e[d>>2]|8192,e[41880+((e[(e[10470]|0)+-12>>2]|0)+72)>>2]=41796;return}}function Fd(t){t=t|0,g=0,ge(70,41456)|0,t=g,g=0,!(!(t&1)&&(g=0,ge(70,41624)|0,t=g,g=0,!(t&1))&&(g=0,ge(71,41796)|0,t=g,g=0,!(t&1))&&(g=0,ge(71,41964)|0,t=g,g=0,!(t&1)))&&(t=j(0)|0,$t(t))}function Rd(){Nd(0),Ft(187,56757,Q|0)|0}function Md(){}function _d(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0;if(c=b,b=b+16|0,h=c+4|0,l=c,Sr(t),e[t>>2]=42600,e[t+32>>2]=r,e[t+40>>2]=o,e[t+48>>2]=-1,S[t+52>>0]=0,tn(h,t+4|0),e[l>>2]=e[h>>2],g=0,Ae(23,t|0,l|0),o=g,g=0,o&1)h=j()|0,_0(l),wt(t),le(h|0);else{_0(l),b=c;return}}function Os(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0;if(c=b,b=b+16|0,h=c+4|0,l=c,Sr(t),e[t>>2]=42536,e[t+32>>2]=r,tn(h,t+4|0),e[l>>2]=e[h>>2],g=0,r=be(37,l|0,44280)|0,h=g,g=0,h&1)h=j()|0,_0(l),wt(t),le(h|0);else{_0(l),e[t+36>>2]=r,e[t+40>>2]=o,h=(Dt[e[(e[r>>2]|0)+28>>2]&127](r)|0)&1,S[t+44>>0]=h,b=c;return}}function Pd(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0;if(c=b,b=b+16|0,h=c+4|0,l=c,Hs(t),e[t>>2]=42472,e[t+32>>2]=r,e[t+40>>2]=o,e[t+48>>2]=-1,S[t+52>>0]=0,tn(h,t+4|0),e[l>>2]=e[h>>2],g=0,Ae(21,t|0,l|0),o=g,g=0,o&1)h=j()|0,_0(l),rn(t),le(h|0);else{_0(l),b=c;return}}function $s(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0;if(c=b,b=b+16|0,h=c+4|0,l=c,Hs(t),e[t>>2]=42408,e[t+32>>2]=r,tn(h,t+4|0),e[l>>2]=e[h>>2],g=0,r=be(37,l|0,44288)|0,h=g,g=0,h&1)h=j()|0,_0(l),rn(t),le(h|0);else{_0(l),e[t+36>>2]=r,e[t+40>>2]=o,h=(Dt[e[(e[r>>2]|0)+28>>2]&127](r)|0)&1,S[t+44>>0]=h,b=c;return}}function Ld(t){t=t|0,rn(t),he(t)}function Od(t,r){t=t|0,r=r|0,Dt[e[(e[t>>2]|0)+24>>2]&127](t)|0,r=O0(r,44288)|0,e[t+36>>2]=r,r=(Dt[e[(e[r>>2]|0)+28>>2]&127](r)|0)&1,S[t+44>>0]=r}function $d(t){t=t|0;var r=0,o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0;D=b,b=b+16|0,w=D+8|0,d=D,o=t+36|0,l=t+40|0,c=w+8|0,h=w,r=t+32|0;e:for(;;){if(t=e[o>>2]|0,t=an[e[(e[t>>2]|0)+20>>2]&31](t,e[l>>2]|0,w,c,d)|0,k=(e[d>>2]|0)-h|0,(gi(w,1,k,e[r>>2]|0)|0)!=(k|0)){t=-1;break}switch(t|0){case 1:break;case 2:{t=-1;break e}default:{C=4;break e}}}return(C|0)==4&&(t=((Nr(e[r>>2]|0)|0)!=0)<<31>>31),b=D,t|0}function Bd(t,r,o){t=t|0,r=r|0,o=o|0;var l=0;e:do if(S[t+44>>0]|0)r=gi(r,4,o,e[t+32>>2]|0)|0;else if((o|0)>0)for(l=r,r=0;;){if((U0[e[(e[t>>2]|0)+52>>2]&63](t,e[l>>2]|0)|0)==-1)break e;if(r=r+1|0,(r|0)<(o|0))l=l+4|0;else break}else r=0;while(!1);return r|0}function Vd(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0;H=b,b=b+32|0,R=H+16|0,o=H+8|0,N=H+4|0,k=H,_=(r|0)==-1;e:do if(_)U=11;else{if(e[o>>2]=r,S[t+44>>0]|0)if((gi(o,4,1,e[t+32>>2]|0)|0)==1){U=11;break}else{o=-1;break}for(e[N>>2]=R,C=o+4|0,D=t+36|0,c=t+40|0,h=R+8|0,d=R,w=t+32|0;;){if(t=e[D>>2]|0,t=Ci[e[(e[t>>2]|0)+12>>2]&15](t,e[c>>2]|0,o,C,k,R,h,N)|0,(e[k>>2]|0)==(o|0)){o=-1;break e}if((t|0)==3)break;if(l=(t|0)==1,t>>>0>=2){o=-1;break e}if(t=(e[N>>2]|0)-d|0,(gi(R,1,t,e[w>>2]|0)|0)!=(t|0)){o=-1;break e}if(l)o=l?e[k>>2]|0:o;else{U=11;break e}}(gi(o,1,1,e[w>>2]|0)|0)!=1?o=-1:U=11}while(!1);return(U|0)==11&&(o=_?0:r),b=H,o|0}function Ud(t,r){t=t|0,r=r|0;var o=0,l=0;l=O0(r,44288)|0,o=t+36|0,e[o>>2]=l,l=Dt[e[(e[l>>2]|0)+24>>2]&127](l)|0,r=t+44|0,e[r>>2]=l,o=e[o>>2]|0,o=(Dt[e[(e[o>>2]|0)+28>>2]&127](o)|0)&1,S[t+53>>0]=o,(e[r>>2]|0)>8&&fn(56783)}function zd(t){t=t|0,rn(t),he(t)}function Gd(t){return t=t|0,Bs(t,0)|0}function qd(t){return t=t|0,Bs(t,1)|0}function Wd(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0;D=b,b=b+32|0,C=D+16|0,w=D+8|0,l=D+4|0,c=D,h=t+52|0,o=(S[h>>0]|0)!=0;e:do if((r|0)==-1)o?r=-1:(r=e[t+48>>2]|0,S[h>>0]=(r|0)!=-1&1);else{d=t+48|0;t:do if(o){switch(e[l>>2]=e[d>>2],o=e[t+36>>2]|0,Ci[e[(e[o>>2]|0)+12>>2]&15](o,e[t+40>>2]|0,l,l+4|0,c,C,C+8|0,w)|0){case 1:case 2:{r=-1;break e}case 3:{S[C>>0]=e[d>>2],e[w>>2]=C+1;break}default:}for(o=t+32|0;;){if(l=e[w>>2]|0,l>>>0<=C>>>0)break t;if(t=l+-1|0,e[w>>2]=t,(Rn(S[t>>0]|0,e[o>>2]|0)|0)==-1){r=-1;break e}}}while(!1);e[d>>2]=r,S[h>>0]=1}while(!1);return b=D,r|0}function Bs(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0;U=b,b=b+32|0,_=U+16|0,R=U+8|0,D=U+4|0,k=U,c=t+52|0;e:do if(S[c>>0]|0)l=t+48|0,o=e[l>>2]|0,r&&(e[l>>2]=-1,S[c>>0]=0);else{if(o=e[t+44>>2]|0,o=(o|0)>1?o:1,N=t+32|0,(o|0)>0){c=0;do{if(l=Fn(e[N>>2]|0)|0,(l|0)==-1){o=-1;break e}S[_+c>>0]=l,c=c+1|0}while((c|0)<(o|0))}t:do if(S[t+53>>0]|0)e[R>>2]=S[_>>0];else{d=t+40|0,w=t+36|0,C=R+4|0;i:for(;;){switch(H=e[d>>2]|0,c=H,l=e[c>>2]|0,c=e[c+4>>2]|0,K=e[w>>2]|0,h=_+o|0,Ci[e[(e[K>>2]|0)+16>>2]&15](K,H,_,h,D,R,C,k)|0){case 2:{o=-1;break e}case 3:break i;case 1:break;default:break t}if(K=e[d>>2]|0,e[K>>2]=l,e[K+4>>2]=c,(o|0)==8){o=-1;break e}if(l=Fn(e[N>>2]|0)|0,(l|0)==-1){o=-1;break e}S[h>>0]=l,o=o+1|0}e[R>>2]=S[_>>0]}while(!1);if(r){o=e[R>>2]|0,e[t+48>>2]=o;break}for(;!((o|0)<=0);)if(o=o+-1|0,(Rn(S[_+o>>0]|0,e[N>>2]|0)|0)==-1){o=-1;break e}o=e[R>>2]|0}while(!1);return b=U,o|0}function Hd(t){t=t|0,wt(t),he(t)}function Qd(t,r){t=t|0,r=r|0,Dt[e[(e[t>>2]|0)+24>>2]&127](t)|0,r=O0(r,44280)|0,e[t+36>>2]=r,r=(Dt[e[(e[r>>2]|0)+28>>2]&127](r)|0)&1,S[t+44>>0]=r}function Kd(t){t=t|0;var r=0,o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0;D=b,b=b+16|0,w=D+8|0,d=D,o=t+36|0,l=t+40|0,c=w+8|0,h=w,r=t+32|0;e:for(;;){if(t=e[o>>2]|0,t=an[e[(e[t>>2]|0)+20>>2]&31](t,e[l>>2]|0,w,c,d)|0,k=(e[d>>2]|0)-h|0,(gi(w,1,k,e[r>>2]|0)|0)!=(k|0)){t=-1;break}switch(t|0){case 1:break;case 2:{t=-1;break e}default:{C=4;break e}}}return(C|0)==4&&(t=((Nr(e[r>>2]|0)|0)!=0)<<31>>31),b=D,t|0}function Yd(t,r,o){t=t|0,r=r|0,o=o|0;var l=0;e:do if(S[t+44>>0]|0)r=gi(r,1,o,e[t+32>>2]|0)|0;else if((o|0)>0)for(l=r,r=0;;){if((U0[e[(e[t>>2]|0)+52>>2]&63](t,F[l>>0]|0)|0)==-1)break e;if(r=r+1|0,(r|0)<(o|0))l=l+1|0;else break}else r=0;while(!1);return r|0}function jd(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0;H=b,b=b+32|0,R=H+16|0,o=H+8|0,N=H+4|0,k=H,_=(r|0)==-1;e:do if(_)U=11;else{if(S[o>>0]=r,S[t+44>>0]|0)if((gi(o,1,1,e[t+32>>2]|0)|0)==1){U=11;break}else{o=-1;break}for(e[N>>2]=R,D=o+1|0,c=t+36|0,h=t+40|0,d=R+8|0,w=R,C=t+32|0;;){if(t=e[c>>2]|0,t=Ci[e[(e[t>>2]|0)+12>>2]&15](t,e[h>>2]|0,o,D,k,R,d,N)|0,(e[k>>2]|0)==(o|0)){o=-1;break e}if((t|0)==3)break;if(l=(t|0)==1,t>>>0>=2){o=-1;break e}if(t=(e[N>>2]|0)-w|0,(gi(R,1,t,e[C>>2]|0)|0)!=(t|0)){o=-1;break e}if(l)o=l?e[k>>2]|0:o;else{U=11;break e}}(gi(o,1,1,e[C>>2]|0)|0)!=1?o=-1:U=11}while(!1);return(U|0)==11&&(o=_?0:r),b=H,o|0}function Xd(t,r){t=t|0,r=r|0;var o=0,l=0;l=O0(r,44280)|0,o=t+36|0,e[o>>2]=l,l=Dt[e[(e[l>>2]|0)+24>>2]&127](l)|0,r=t+44|0,e[r>>2]=l,o=e[o>>2]|0,o=(Dt[e[(e[o>>2]|0)+28>>2]&127](o)|0)&1,S[t+53>>0]=o,(e[r>>2]|0)>8&&fn(56783)}function Zd(t){t=t|0,wt(t),he(t)}function Jd(t){return t=t|0,Vs(t,0)|0}function ep(t){return t=t|0,Vs(t,1)|0}function tp(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0;D=b,b=b+32|0,C=D+16|0,w=D+4|0,l=D+8|0,c=D,h=t+52|0,o=(S[h>>0]|0)!=0;e:do if((r|0)==-1)o?r=-1:(r=e[t+48>>2]|0,S[h>>0]=(r|0)!=-1&1);else{d=t+48|0;t:do if(o){switch(S[l>>0]=e[d>>2],o=e[t+36>>2]|0,Ci[e[(e[o>>2]|0)+12>>2]&15](o,e[t+40>>2]|0,l,l+1|0,c,C,C+8|0,w)|0){case 1:case 2:{r=-1;break e}case 3:{S[C>>0]=e[d>>2],e[w>>2]=C+1;break}default:}for(o=t+32|0;;){if(l=e[w>>2]|0,l>>>0<=C>>>0)break t;if(t=l+-1|0,e[w>>2]=t,(Rn(S[t>>0]|0,e[o>>2]|0)|0)==-1){r=-1;break e}}}while(!1);e[d>>2]=r,S[h>>0]=1}while(!1);return b=D,r|0}function Vs(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0;U=b,b=b+32|0,_=U+16|0,R=U+8|0,D=U+4|0,k=U,c=t+52|0;e:do if(S[c>>0]|0)l=t+48|0,o=e[l>>2]|0,r&&(e[l>>2]=-1,S[c>>0]=0);else{if(o=e[t+44>>2]|0,o=(o|0)>1?o:1,N=t+32|0,(o|0)>0){c=0;do{if(l=Fn(e[N>>2]|0)|0,(l|0)==-1){o=-1;break e}S[_+c>>0]=l,c=c+1|0}while((c|0)<(o|0))}t:do if(S[t+53>>0]|0)S[R>>0]=S[_>>0]|0;else{d=t+40|0,w=t+36|0,C=R+1|0;i:for(;;){switch(H=e[d>>2]|0,c=H,l=e[c>>2]|0,c=e[c+4>>2]|0,K=e[w>>2]|0,h=_+o|0,Ci[e[(e[K>>2]|0)+16>>2]&15](K,H,_,h,D,R,C,k)|0){case 2:{o=-1;break e}case 3:break i;case 1:break;default:break t}if(K=e[d>>2]|0,e[K>>2]=l,e[K+4>>2]=c,(o|0)==8){o=-1;break e}if(l=Fn(e[N>>2]|0)|0,(l|0)==-1){o=-1;break e}S[h>>0]=l,o=o+1|0}S[R>>0]=S[_>>0]|0}while(!1);if(r)o=S[R>>0]|0,e[t+48>>2]=o&255;else{for(;!((o|0)<=0);)if(o=o+-1|0,(Rn(F[_+o>>0]|0,e[N>>2]|0)|0)==-1){o=-1;break e}o=S[R>>0]|0}o=o&255}while(!1);return b=U,o|0}function pA(t){t=t|0}function pn(t){t=t|0,t=t+4|0,e[t>>2]=(e[t>>2]|0)+1}function Bt(t){t=t|0;var r=0,o=0;return o=t+4|0,r=e[o>>2]|0,e[o>>2]=r+-1,r?t=0:(Mt[e[(e[t>>2]|0)+8>>2]&255](t),t=1),t|0}function ip(t,r){if(t=t|0,r=r|0,e[t>>2]=36868,g=0,Ae(86,t+4|0,(S[r>>0]&1?e[r+8>>2]|0:r+1|0)|0),t=g,g=0,t&1)t=j()|0,le(t|0);else return}function np(t,r){if(t=t|0,r=r|0,e[t>>2]=36868,g=0,Ae(86,t+4|0,r|0),t=g,g=0,t&1)t=j()|0,le(t|0);else return}function rp(t,r){t=t|0,r=r|0;var o=0,l=0;l=$i(r)|0,o=Xe(l+13|0)|0,e[o>>2]=l,e[o+4>>2]=l,e[o+8>>2]=0,o=o+12|0,o0(o|0,r|0,l+1|0)|0,e[t>>2]=o}function sp(t,r,o){t=t|0,r=r|0,o=o|0,e[t>>2]=o,e[t+4>>2]=r}function ap(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0;return c=b,b=b+16|0,l=c,Ln[e[(e[t>>2]|0)+12>>2]&15](l,t,r),(e[l+4>>2]|0)==(e[o+4>>2]|0)?l=(e[l>>2]|0)==(e[o>>2]|0):l=0,b=c,l|0}function lp(t,r,o){return t=t|0,r=r|0,o=o|0,((e[r>>2]|0)==(o|0)?(e[r+4>>2]|0)==(t|0):0)|0}function up(t,r,o){t=t|0,r=r|0,o=o|0,r=vo(o)|0,yi(t,r,$i(r)|0)}function cp(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0;d=b,b=b+16|0,h=d,l=e[r>>2]|0;do if(l)if(c=S[o>>0]|0,c&1?c=e[o+4>>2]|0:c=(c&255)>>>1,c&&(wp(o,56990)|0,l=e[r>>2]|0),r=e[r+4>>2]|0,Ln[e[(e[r>>2]|0)+24>>2]&15](h,r,l),r=S[h>>0]|0,c=(r&1)==0,g=0,Ve(30,o|0,(c?h+1|0:e[h+8>>2]|0)|0,(c?(r&255)>>>1:e[h+4>>2]|0)|0)|0,r=g,g=0,r&1)d=j()|0,de(h),le(d|0);else{de(h);break}while(!1);e[t>>2]=e[o>>2],e[t+4>>2]=e[o+4>>2],e[t+8>>2]=e[o+8>>2],e[o>>2]=0,e[o+4>>2]=0,e[o+8>>2]=0,b=d}function fp(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0;c=b,b=b+32|0,l=c+12|0,h=c,yi(h,o,$i(o)|0),g=0,xe(10,l|0,r|0,h|0),o=g,g=0;do if(o&1)l=j()|0;else if(g=0,Ae(87,t|0,l|0),o=g,g=0,o&1){c=j()|0,de(l),l=c;break}else{de(l),de(h),e[t>>2]=42664,o=e[r+4>>2]|0,h=t+8|0,e[h>>2]=e[r>>2],e[h+4>>2]=o,b=c;return}while(!1);de(h),le(l|0)}function hp(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0;h=b,b=b+48|0,c=h+24|0,w=h+16|0,d=h,e[w>>2]=r,e[w+4>>2]=o,hr(d,l),g=0,xe(10,c|0,w|0,d|0),l=g,g=0;do if(l&1)c=j()|0;else if(g=0,Ae(87,t|0,c|0),w=g,g=0,w&1){w=j()|0,de(c),c=w;break}else{de(c),de(d),e[t>>2]=42664,e[t+8>>2]=r,e[t+12>>2]=o,b=h;return}while(!1);de(d),le(c|0)}function dp(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0;c=b,b=b+48|0,l=c+24|0,d=c+16|0,h=c,e[d>>2]=r,e[d+4>>2]=o,yi(h,58898,0),g=0,xe(10,l|0,d|0,h|0),d=g,g=0;do if(d&1)l=j()|0;else if(g=0,Ae(87,t|0,l|0),d=g,g=0,d&1){d=j()|0,de(l),l=d;break}else{de(l),de(h),e[t>>2]=42664,e[t+8>>2]=r,e[t+12>>2]=o,b=c;return}while(!1);de(h),le(l|0)}function fr(t){t=t|0,In(t)}function pp(t){t=t|0,In(t),he(t)}function mp(t){t=t|0}function gp(t,r,o){t=t|0,r=r|0,o=o|0;var l=0;if(Gr(42676)|0,(e[t>>2]|0)==1)do Q0(42704,42676)|0;while((e[t>>2]|0)==1);do if(e[t>>2]|0)Br(42676)|0;else{if(e[t>>2]=1,g=0,ge(72,42676)|0,l=g,g=0,!(l&1)&&(g=0,ue(o|0,r|0),l=g,g=0,!(l&1))&&(g=0,ge(73,42676)|0,l=g,g=0,!(l&1))&&(e[t>>2]=-1,g=0,ge(72,42676)|0,l=g,g=0,!(l&1))&&(g=0,ge(74,42704)|0,l=g,g=0,!(l&1)))break;l=j(0)|0,K0(l|0)|0,g=0,ge(73,42676)|0,l=g,g=0,!(l&1)&&(e[t>>2]=0,g=0,ge(72,42676)|0,l=g,g=0,!(l&1))&&(g=0,ge(74,42704)|0,l=g,g=0,!(l&1))&&(g=0,Nt(5),g=0),r=j()|0,g=0,Nt(3),l=g,g=0,l&1?(l=j(0)|0,$t(l)):le(r|0)}while(!1)}function hr(t,r){t=t|0,r=r|0,S[r>>0]&1?yi(t,e[r+8>>2]|0,e[r+4>>2]|0):(e[t>>2]=e[r>>2],e[t+4>>2]=e[r+4>>2],e[t+8>>2]=e[r+8>>2])}function yi(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0;o>>>0>4294967279&&si(t),o>>>0<11?(S[t>>0]=o<<1,t=t+1|0):(c=o+16&-16,l=Xe(c)|0,e[t+8>>2]=l,e[t>>2]=c|1,e[t+4>>2]=o,t=l),o0(t|0,r|0,o|0)|0,S[t+o>>0]=0}function dr(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0;r>>>0>4294967279&&si(t),r>>>0<11?(S[t>>0]=r<<1,t=t+1|0):(c=r+16&-16,l=Xe(c)|0,e[t+8>>2]=l,e[t>>2]=c|1,e[t+4>>2]=r,t=l),Jt(t|0,o|0,r|0)|0,S[t+r>>0]=0}function de(t){t=t|0,S[t>>0]&1&&he(e[t+8>>2]|0)}function Sp(t,r){t=t|0,r=r|0;var o=0,l=0;return(t|0)!=(r|0)&&(o=S[r>>0]|0,l=(o&1)==0,Us(t,l?r+1|0:e[r+8>>2]|0,l?(o&255)>>>1:e[r+4>>2]|0)|0),t|0}function Ap(t,r){return t=t|0,r=r|0,Us(t,r,$i(r)|0)|0}function Us(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0;l=S[t>>0]|0,l&1?(l=e[t>>2]|0,h=(l&-2)+-1|0,l=l&255):h=10,c=(l&1)==0;do if(h>>>0>=o>>>0)if(c?l=t+1|0:l=e[t+8>>2]|0,vn(l|0,r|0,o|0)|0,S[l+o>>0]=0,S[t>>0]&1){e[t+4>>2]=o;break}else{S[t>>0]=o<<1;break}else c?l=(l&255)>>>1:l=e[t+4>>2]|0,qs(t,h,o-h|0,l,0,l,o,r);while(!1);return t|0}function zs(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0;l=S[t>>0]|0,c=(l&1)==0,c?l=(l&255)>>>1:l=e[t+4>>2]|0;do if(l>>>0>=r>>>0)if(c){S[t+1+r>>0]=0,S[t>>0]=r<<1;break}else{S[(e[t+8>>2]|0)+r>>0]=0,e[t+4>>2]=r;break}else vp(t,r-l|0,o)|0;while(!1)}function vp(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0;return r&&(l=S[t>>0]|0,l&1?(l=e[t>>2]|0,c=(l&-2)+-1|0,l=l&255):c=10,l&1?h=e[t+4>>2]|0:h=(l&255)>>>1,(c-h|0)>>>0>>0&&(pr(t,c,r-c+h|0,h,h,0,0),l=S[t>>0]|0),l&1?c=e[t+8>>2]|0:c=t+1|0,Jt(c+h|0,o|0,r|0)|0,l=h+r|0,S[t>>0]&1?e[t+4>>2]=l:S[t>>0]=l<<1,S[c+l>>0]=0),t|0}function xp(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0;r>>>0>4294967279&&si(t),o=S[t>>0]|0,o&1?(o=e[t>>2]|0,l=(o&-2)+-1|0,o=o&255):l=10,o&1?w=e[t+4>>2]|0:w=(o&255)>>>1,r=w>>>0>r>>>0?w:r,r>>>0<11?d=10:d=(r+16&-16)+-1|0;e:do if((d|0)!=(l|0)){do if((d|0)!=10){if(r=d+1|0,d>>>0<=l>>>0){if(g=0,r=ge(67,r|0)|0,h=g,g=0,h&1){t=j(0)|0,K0(t|0)|0,ei();break e}}else r=Xe(r)|0;if(o&1){l=1,c=e[t+8>>2]|0,h=1;break}else{l=1,c=t+1|0,h=0;break}}else r=t+1|0,l=0,c=e[t+8>>2]|0,h=1;while(!1);if(o&1?o=e[t+4>>2]|0:o=(o&255)>>>1,o0(r|0,c|0,o+1|0)|0,h&&he(c),l){e[t>>2]=d+1|1,e[t+4>>2]=w,e[t+8>>2]=r;break}else{S[t>>0]=w<<1;break}}while(!1)}function wp(t,r){return t=t|0,r=r|0,Gs(t,r,$i(r)|0)|0}function yp(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0;o=S[t>>0]|0,l=(o&1)!=0,l?(c=(e[t>>2]&-2)+-1|0,h=e[t+4>>2]|0):(c=10,h=(o&255)>>>1),(h|0)==(c|0)?(pr(t,c,1,c,c,0,0),S[t>>0]&1?c=8:c=7):l?c=8:c=7,(c|0)==7?(S[t>>0]=(h<<1)+2,o=t+1|0,l=h+1|0):(c|0)==8&&(o=e[t+8>>2]|0,l=h+1|0,e[t+4>>2]=l),S[o+h>>0]=r,S[o+l>>0]=0}function Gs(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0;return l=S[t>>0]|0,l&1?(l=e[t>>2]|0,c=(l&-2)+-1|0,l=l&255):c=10,l&1?h=e[t+4>>2]|0:h=(l&255)>>>1,(c-h|0)>>>0>=o>>>0?o&&(l&1?c=e[t+8>>2]|0:c=t+1|0,o0(c+h|0,r|0,o|0)|0,l=h+o|0,S[t>>0]&1?e[t+4>>2]=l:S[t>>0]=l<<1,S[c+l>>0]=0):qs(t,c,o-c+h|0,h,h,0,o,r),t|0}function qs(t,r,o,l,c,h,d,w){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0,w=w|0;var C=0,D=0,k=0;(-18-r|0)>>>0>>0&&si(t),S[t>>0]&1?k=e[t+8>>2]|0:k=t+1|0,r>>>0<2147483623?(C=o+r|0,D=r<<1,C=C>>>0>>0?D:C,C=C>>>0<11?11:C+16&-16):C=-17,D=Xe(C)|0,c&&o0(D|0,k|0,c|0)|0,d&&o0(D+c|0,w|0,d|0)|0,o=l-h|0,(o|0)!=(c|0)&&o0(D+(d+c)|0,k+(h+c)|0,o-c|0)|0,(r|0)!=10&&he(k),e[t+8>>2]=D,e[t>>2]=C|1,r=o+d|0,e[t+4>>2]=r,S[D+r>>0]=0}function pr(t,r,o,l,c,h,d){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0;var w=0,C=0,D=0;(-17-r|0)>>>0>>0&&si(t),S[t>>0]&1?D=e[t+8>>2]|0:D=t+1|0,r>>>0<2147483623?(w=o+r|0,C=r<<1,w=w>>>0>>0?C:w,w=w>>>0<11?11:w+16&-16):w=-17,C=Xe(w)|0,c&&o0(C|0,D|0,c|0)|0,o=l-h|0,(o|0)!=(c|0)&&o0(C+(d+c)|0,D+(h+c)|0,o-c|0)|0,(r|0)!=10&&he(D),e[t+8>>2]=C,e[t>>2]=w|1}function mr(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0;o>>>0>1073741807&&si(t),o>>>0<2?(S[t>>0]=o<<1,t=t+4|0):(c=o+4&-4,l=Xe(c<<2)|0,e[t+8>>2]=l,e[t>>2]=c|1,e[t+4>>2]=o,t=l),Bi(t,r,o)|0,e[t+(o<<2)>>2]=0}function gr(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0;r>>>0>1073741807&&si(t),r>>>0<2?(S[t>>0]=r<<1,t=t+4|0):(c=r+4&-4,l=Xe(c<<2)|0,e[t+8>>2]=l,e[t>>2]=c|1,e[t+4>>2]=r,t=l),GS(t,o,r)|0,e[t+(r<<2)>>2]=0}function Pt(t){t=t|0,S[t>>0]&1&&he(e[t+8>>2]|0)}function Cp(t,r){return t=t|0,r=r|0,Tp(t,r,_n(r)|0)|0}function Tp(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0;l=S[t>>0]|0,l&1?(l=e[t>>2]|0,h=(l&-2)+-1|0,l=l&255):h=1,c=(l&1)==0;do if(h>>>0>=o>>>0)if(c?l=t+4|0:l=e[t+8>>2]|0,zS(l,r,o)|0,e[l+(o<<2)>>2]=0,S[t>>0]&1){e[t+4>>2]=o;break}else{S[t>>0]=o<<1;break}else c?l=(l&255)>>>1:l=e[t+4>>2]|0,kp(t,h,o-h|0,l,0,l,o,r);while(!1);return t|0}function Ip(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0;r>>>0>1073741807&&si(t),o=S[t>>0]|0,o&1?(o=e[t>>2]|0,l=(o&-2)+-1|0,o=o&255):l=1,o&1?w=e[t+4>>2]|0:w=(o&255)>>>1,r=w>>>0>r>>>0?w:r,r>>>0<2?d=1:d=(r+4&-4)+-1|0;e:do if((d|0)!=(l|0)){do if((d|0)!=1){if(r=(d<<2)+4|0,d>>>0<=l>>>0){if(g=0,r=ge(67,r|0)|0,h=g,g=0,h&1){t=j(0)|0,K0(t|0)|0,ei();break e}}else r=Xe(r)|0;if(o&1){l=1,c=e[t+8>>2]|0,h=1;break}else{l=1,c=t+4|0,h=0;break}}else r=t+4|0,l=0,c=e[t+8>>2]|0,h=1;while(!1);if(o&1?o=e[t+4>>2]|0:o=(o&255)>>>1,Bi(r,c,o+1|0)|0,h&&he(c),l){e[t>>2]=d+1|1,e[t+4>>2]=w,e[t+8>>2]=r;break}else{S[t>>0]=w<<1;break}}while(!1)}function Ep(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0;o=S[t>>0]|0,l=(o&1)!=0,l?(c=(e[t>>2]&-2)+-1|0,h=e[t+4>>2]|0):(c=1,h=(o&255)>>>1),(h|0)==(c|0)?(Ws(t,c,1,c,c,0,0),S[t>>0]&1?c=8:c=7):l?c=8:c=7,(c|0)==7?(S[t>>0]=(h<<1)+2,o=t+4|0,l=h+1|0):(c|0)==8&&(o=e[t+8>>2]|0,l=h+1|0,e[t+4>>2]=l),e[o+(h<<2)>>2]=r,e[o+(l<<2)>>2]=0}function kp(t,r,o,l,c,h,d,w){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0,w=w|0;var C=0,D=0,k=0;(1073741806-r|0)>>>0>>0&&si(t),S[t>>0]&1?k=e[t+8>>2]|0:k=t+4|0,r>>>0<536870887?(C=o+r|0,D=r<<1,C=C>>>0>>0?D:C,C=C>>>0<2?2:C+4&-4):C=1073741807,D=Xe(C<<2)|0,c&&Bi(D,k,c)|0,d&&Bi(D+(c<<2)|0,w,d)|0,o=l-h|0,(o|0)!=(c|0)&&Bi(D+(d+c<<2)|0,k+(h+c<<2)|0,o-c|0)|0,(r|0)!=1&&he(k),e[t+8>>2]=D,e[t>>2]=C|1,r=o+d|0,e[t+4>>2]=r,e[D+(r<<2)>>2]=0}function Ws(t,r,o,l,c,h,d){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0;var w=0,C=0,D=0;(1073741807-r|0)>>>0>>0&&si(t),S[t>>0]&1?D=e[t+8>>2]|0:D=t+4|0,r>>>0<536870887?(w=o+r|0,C=r<<1,w=w>>>0>>0?C:w,w=w>>>0<2?2:w+4&-4):w=1073741807,C=Xe(w<<2)|0,c&&Bi(C,D,c)|0,o=l-h|0,(o|0)!=(c|0)&&Bi(C+(d+c<<2)|0,D+(h+c<<2)|0,o-c|0)|0,(r|0)!=1&&he(D),e[t+8>>2]=C,e[t>>2]=w|1}function Dp(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0;if(c=r,l=o-c|0,l>>>0>4294967279&&si(t),l>>>0<11?(S[t>>0]=l<<1,h=t+1|0):(d=l+16&-16,h=Xe(d)|0,e[t+8>>2]=h,e[t>>2]=d|1,e[t+4>>2]=l),t=o-c|0,(r|0)!=(o|0))for(l=h;S[l>>0]=S[r>>0]|0,r=r+1|0,(r|0)!=(o|0);)l=l+1|0;S[h+t>>0]=0}function bp(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0;if(h=r,l=o-h|0,c=l>>2,c>>>0>1073741807&&si(t),c>>>0<2?(S[t>>0]=l>>>1,t=t+4|0):(d=c+4&-4,l=Xe(d<<2)|0,e[t+8>>2]=l,e[t>>2]=d|1,e[t+4>>2]=c,t=l),c=(o-h|0)>>>2,(r|0)!=(o|0))for(l=t;e[l>>2]=e[r>>2],r=r+4|0,(r|0)!=(o|0);)l=l+4|0;e[t+(c<<2)>>2]=0}function Np(t,r){t=t|0,r=r|0;var o=0,l=0,c=0;if(o=b,b=b+16|0,l=o,c=(e[t+24>>2]|0)==0,e[t+16>>2]=c&1|r,!((c&1|r)&e[t+20>>2])){b=o;return}r=Ct(16)|0,Tm()|0,e[l>>2]=1,e[l+4>>2]=43112,g=0,xe(11,r|0,57437,l|0),c=g,g=0,c&1?(c=j()|0,Tt(r|0),le(c|0)):Qt(r|0,864,112)}function G0(t){t=t|0;var r=0;if(e[t>>2]=43068,g=0,Ae(88,t|0,0),r=g,g=0,r&1)r=j(0)|0,$t(r);else{_0(t+28|0),n0(e[t+32>>2]|0),n0(e[t+36>>2]|0),n0(e[t+48>>2]|0),n0(e[t+60>>2]|0);return}}function tt(t){t=t|0,G0(t)}function mA(t){t=t|0,G0(t),he(t)}function Fp(t,r){t=t|0,r=r|0;var o=0,l=0,c=0;if(o=e[t+40>>2]|0,l=t+32|0,c=t+36|0,o)do o=o+-1|0,Ln[e[(e[l>>2]|0)+(o<<2)>>2]&15](r,t,e[(e[c>>2]|0)+(o<<2)>>2]|0);while(o|0)}function f0(t){t=t|0;var r=0,o=0;return o=b,b=b+16|0,r=o,tn(r,t+28|0),b=o,e[r>>2]|0}function Rp(t,r){t=t|0,r=r|0;var o=0;e[t+24>>2]=r,e[t+16>>2]=(r|0)==0&1,e[t+20>>2]=0,e[t+4>>2]=4098,e[t+12>>2]=0,e[t+8>>2]=6,o=t+28|0,r=t+32|0,t=r+40|0;do e[r>>2]=0,r=r+4|0;while((r|0)<(t|0));ur(o)}function mn(t){t=t|0,G0(t)}function gA(t){t=t|0,G0(t),he(t)}function wt(t){t=t|0,e[t>>2]=42760,_0(t+4|0)}function Mp(t){t=t|0,e[t>>2]=42760,_0(t+4|0),he(t)}function Sr(t){t=t|0,e[t>>2]=42760,ur(t+4|0),t=t+8|0,e[t>>2]=0,e[t+4>>2]=0,e[t+8>>2]=0,e[t+12>>2]=0,e[t+16>>2]=0,e[t+20>>2]=0}function _p(t,r){t=t|0,r=r|0}function Pp(t,r,o){return t=t|0,r=r|0,o=o|0,t|0}function Lp(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,r=t,e[r>>2]=0,e[r+4>>2]=0,r=t+8|0,e[r>>2]=-1,e[r+4>>2]=-1}function Op(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0,r=t,e[r>>2]=0,e[r+4>>2]=0,r=t+8|0,e[r>>2]=-1,e[r+4>>2]=-1}function $p(t){return t=t|0,0}function Bp(t){return t=t|0,0}function Vp(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0;h=t+12|0,d=t+16|0;e:do if((o|0)>0)for(c=r,r=0;;){if(l=e[h>>2]|0,l>>>0<(e[d>>2]|0)>>>0)e[h>>2]=l+1,l=S[l>>0]|0;else{if(l=Dt[e[(e[t>>2]|0)+40>>2]&127](t)|0,(l|0)==-1)break e;l=l&255}if(S[c>>0]=l,r=r+1|0,(r|0)<(o|0))c=c+1|0;else break}else r=0;while(!1);return r|0}function Up(t){return t=t|0,-1}function zp(t){t=t|0;var r=0;return(Dt[e[(e[t>>2]|0)+36>>2]&127](t)|0)==-1?t=-1:(r=t+12|0,t=e[r>>2]|0,e[r>>2]=t+1,t=F[t>>0]|0),t|0}function Gp(t,r){return t=t|0,r=r|0,-1}function qp(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0,w=0;h=t+24|0,d=t+28|0;e:do if((o|0)>0)for(c=r,r=0;;){if(l=e[h>>2]|0,l>>>0>=(e[d>>2]|0)>>>0){if((U0[e[(e[t>>2]|0)+52>>2]&63](t,F[c>>0]|0)|0)==-1)break e}else w=S[c>>0]|0,e[h>>2]=l+1,S[l>>0]=w;if(r=r+1|0,(r|0)<(o|0))c=c+1|0;else break}else r=0;while(!1);return r|0}function Wp(t,r){return t=t|0,r=r|0,-1}function rn(t){t=t|0,e[t>>2]=42824,_0(t+4|0)}function Hp(t){t=t|0,e[t>>2]=42824,_0(t+4|0),he(t)}function Hs(t){t=t|0,e[t>>2]=42824,ur(t+4|0),t=t+8|0,e[t>>2]=0,e[t+4>>2]=0,e[t+8>>2]=0,e[t+12>>2]=0,e[t+16>>2]=0,e[t+20>>2]=0}function Qp(t,r){t=t|0,r=r|0}function Kp(t,r,o){return t=t|0,r=r|0,o=o|0,t|0}function Yp(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,r=t,e[r>>2]=0,e[r+4>>2]=0,r=t+8|0,e[r>>2]=-1,e[r+4>>2]=-1}function jp(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0,r=t,e[r>>2]=0,e[r+4>>2]=0,r=t+8|0,e[r>>2]=-1,e[r+4>>2]=-1}function Xp(t){return t=t|0,0}function Zp(t){return t=t|0,0}function Jp(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0;h=t+12|0,d=t+16|0;e:do if((o|0)>0)for(c=r,r=0;;){if(l=e[h>>2]|0,l>>>0>=(e[d>>2]|0)>>>0){if(l=Dt[e[(e[t>>2]|0)+40>>2]&127](t)|0,(l|0)==-1)break e}else e[h>>2]=l+4,l=e[l>>2]|0;if(e[c>>2]=l,r=r+1|0,(r|0)<(o|0))c=c+4|0;else break}else r=0;while(!1);return r|0}function em(t){return t=t|0,-1}function tm(t){t=t|0;var r=0;return(Dt[e[(e[t>>2]|0)+36>>2]&127](t)|0)==-1?t=-1:(r=t+12|0,t=e[r>>2]|0,e[r>>2]=t+4,t=e[t>>2]|0),t|0}function im(t,r){return t=t|0,r=r|0,-1}function nm(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0,w=0;h=t+24|0,d=t+28|0;e:do if((o|0)>0)for(c=r,r=0;;){if(l=e[h>>2]|0,l>>>0>=(e[d>>2]|0)>>>0){if((U0[e[(e[t>>2]|0)+52>>2]&63](t,e[c>>2]|0)|0)==-1)break e}else w=e[c>>2]|0,e[h>>2]=l+4,e[l>>2]=w;if(r=r+1|0,(r|0)<(o|0))c=c+4|0;else break}else r=0;while(!1);return r|0}function rm(t,r){return t=t|0,r=r|0,-1}function sm(t){t=t|0,G0(t+8|0)}function om(t){t=t|0,G0(t+((e[(e[t>>2]|0)+-12>>2]|0)+8)|0)}function Qs(t){t=t|0,G0(t+8|0),he(t)}function am(t){t=t|0,Qs(t+(e[(e[t>>2]|0)+-12>>2]|0)|0)}function Ks(t){t=t|0;var r=0,o=0,l=0,c=0;l=b,b=b+16|0,o=l;e:do if(e[t+((e[(e[t>>2]|0)+-12>>2]|0)+24)>>2]|0){g=0,Ae(65,o|0,t|0),r=g,g=0;t:do if(r&1)r=j(0)|0;else{do if(S[o>>0]|0){if(r=e[t+((e[(e[t>>2]|0)+-12>>2]|0)+24)>>2]|0,g=0,r=ge(e[(e[r>>2]|0)+24>>2]|0,r|0)|0,c=g,g=0,!(c&1)&&((r|0)!=-1||(c=e[(e[t>>2]|0)+-12>>2]|0,g=0,Ae(66,t+c|0,e[t+(c+16)>>2]|1|0),c=g,g=0,!(c&1))))break;r=j(0)|0,Ei(o);break t}while(!1);Ei(o);break e}while(!1);if(K0(r|0)|0,g=0,ue(181,t+(e[(e[t>>2]|0)+-12>>2]|0)|0),c=g,g=0,!(c&1)){ei();break}r=j()|0,g=0,Nt(3),c=g,g=0,c&1?(c=j(0)|0,$t(c)):le(r|0)}while(!1);return b=l,t|0}function lm(t){t=t|0;var r=0;if(r=t+16|0,e[r>>2]=e[r>>2]|1,e[t+20>>2]&1)Ur();else return}function um(t){t=t|0,G0(t+8|0)}function cm(t){t=t|0,G0(t+((e[(e[t>>2]|0)+-12>>2]|0)+8)|0)}function Ys(t){t=t|0,G0(t+8|0),he(t)}function fm(t){t=t|0,Ys(t+(e[(e[t>>2]|0)+-12>>2]|0)|0)}function js(t){t=t|0;var r=0,o=0,l=0,c=0;l=b,b=b+16|0,o=l;e:do if(e[t+((e[(e[t>>2]|0)+-12>>2]|0)+24)>>2]|0){g=0,Ae(89,o|0,t|0),r=g,g=0;t:do if(r&1)r=j(0)|0;else{do if(S[o>>0]|0){if(r=e[t+((e[(e[t>>2]|0)+-12>>2]|0)+24)>>2]|0,g=0,r=ge(e[(e[r>>2]|0)+24>>2]|0,r|0)|0,c=g,g=0,!(c&1)&&((r|0)!=-1||(c=e[(e[t>>2]|0)+-12>>2]|0,g=0,Ae(66,t+c|0,e[t+(c+16)>>2]|1|0),c=g,g=0,!(c&1))))break;r=j(0)|0,Js(o);break t}while(!1);Js(o);break e}while(!1);if(K0(r|0)|0,g=0,ue(181,t+(e[(e[t>>2]|0)+-12>>2]|0)|0),c=g,g=0,!(c&1)){ei();break}r=j()|0,g=0,Nt(3),c=g,g=0,c&1?(c=j(0)|0,$t(c)):le(r|0)}while(!1);return b=l,t|0}function SA(t,r){t=t|0,r=r|0}function hm(t){t=t|0,G0(t+4|0)}function dm(t){t=t|0,G0(t+((e[(e[t>>2]|0)+-12>>2]|0)+4)|0)}function Xs(t){t=t|0,G0(t+4|0),he(t)}function pm(t){t=t|0,Xs(t+(e[(e[t>>2]|0)+-12>>2]|0)|0)}function mm(t,r){t=t|0,r=r|0;var o=0;S[t>>0]=0,e[t+4>>2]=r,o=e[(e[r>>2]|0)+-12>>2]|0,e[r+(o+16)>>2]|0||(o=e[r+(o+72)>>2]|0,o&&Ks(o)|0,S[t>>0]=1)}function Ei(t){t=t|0;var r=0,o=0;t=t+4|0,o=e[t>>2]|0,r=e[(e[o>>2]|0)+-12>>2]|0;do if(e[o+(r+24)>>2]|0&&!(e[o+(r+16)>>2]|0)&&e[o+(r+4)>>2]&8192|0&&!(Or()|0)){if(r=e[t>>2]|0,r=e[r+((e[(e[r>>2]|0)+-12>>2]|0)+24)>>2]|0,g=0,r=ge(e[(e[r>>2]|0)+24>>2]|0,r|0)|0,o=g,g=0,!(o&1)&&((r|0)!=-1||(r=e[t>>2]|0,o=e[(e[r>>2]|0)+-12>>2]|0,g=0,Ae(66,r+o|0,e[r+(o+16)>>2]|1|0),o=g,g=0,!(o&1))))break;o=j(0)|0,K0(o|0)|0,g=0,Nt(3),o=g,g=0,o&1&&(o=j(0)|0,$t(o))}while(!1)}function gm(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0;R=b,b=b+32|0,w=R+20|0,C=R+16|0,k=R+8|0,o=R,g=0,Ae(65,k|0,t|0),D=g,g=0;e:do if(D&1)o=j(0)|0,l=t,c=t,N=19;else{do if(S[k>>0]|0){if(D=f0(t+(e[(e[t>>2]|0)+-12>>2]|0)|0)|0,e[o>>2]=D,g=0,D=be(37,o|0,43392)|0,d=g,g=0,d&1)N=j(0)|0,_0(o),o=N;else{_0(o),c=e[(e[t>>2]|0)+-12>>2]|0,d=e[t+(c+24)>>2]|0,l=t+c|0,c=t+(c+76)|0,o=e[c>>2]|0;do if((o|0)==-1){if(o=f0(l)|0,e[w>>2]=o,g=0,o=be(37,w|0,44220)|0,_=g,g=0,!(_&1)&&(g=0,h=be(e[(e[o>>2]|0)+28>>2]|0,o|0,32)|0,_=g,g=0,!(_&1))){_0(w),o=h<<24>>24,e[c>>2]=o,N=10;break}o=j(0)|0,_0(w)}else N=10;while(!1);if((N|0)==10){if(_=e[(e[D>>2]|0)+16>>2]|0,e[C>>2]=d,g=0,e[w>>2]=e[C>>2],o=se(_|0,D|0,w|0,l|0,o&255|0,r|0)|0,_=g,g=0,!(_&1)&&(o||(_=e[(e[t>>2]|0)+-12>>2]|0,g=0,Ae(66,t+_|0,e[t+(_+16)>>2]|5|0),_=g,g=0,!(_&1))))break;o=j(0)|0}}Ei(k),l=t,c=t,N=19;break e}while(!1);Ei(k)}while(!1);do if((N|0)==19){if(K0(o|0)|0,g=0,ue(181,l+(e[(e[c>>2]|0)+-12>>2]|0)|0),_=g,g=0,!(_&1)){ei();break}o=j()|0,g=0,Nt(3),_=g,g=0,_&1?(_=j(0)|0,$t(_)):le(o|0)}while(!1);return b=R,t|0}function Sm(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0;R=b,b=b+32|0,w=R+20|0,C=R+16|0,k=R+8|0,o=R,g=0,Ae(65,k|0,t|0),D=g,g=0;e:do if(D&1)o=j(0)|0,l=t,c=t,N=19;else{do if(S[k>>0]|0){if(D=f0(t+(e[(e[t>>2]|0)+-12>>2]|0)|0)|0,e[o>>2]=D,g=0,D=be(37,o|0,43392)|0,d=g,g=0,d&1)N=j(0)|0,_0(o),o=N;else{_0(o),c=e[(e[t>>2]|0)+-12>>2]|0,d=e[t+(c+24)>>2]|0,l=t+c|0,c=t+(c+76)|0,o=e[c>>2]|0;do if((o|0)==-1){if(o=f0(l)|0,e[w>>2]=o,g=0,o=be(37,w|0,44220)|0,_=g,g=0,!(_&1)&&(g=0,h=be(e[(e[o>>2]|0)+28>>2]|0,o|0,32)|0,_=g,g=0,!(_&1))){_0(w),o=h<<24>>24,e[c>>2]=o,N=10;break}o=j(0)|0,_0(w)}else N=10;while(!1);if((N|0)==10){if(_=e[(e[D>>2]|0)+24>>2]|0,e[C>>2]=d,g=0,e[w>>2]=e[C>>2],o=se(_|0,D|0,w|0,l|0,o&255|0,r|0)|0,_=g,g=0,!(_&1)&&(o||(_=e[(e[t>>2]|0)+-12>>2]|0,g=0,Ae(66,t+_|0,e[t+(_+16)>>2]|5|0),_=g,g=0,!(_&1))))break;o=j(0)|0}}Ei(k),l=t,c=t,N=19;break e}while(!1);Ei(k)}while(!1);do if((N|0)==19){if(K0(o|0)|0,g=0,ue(181,l+(e[(e[c>>2]|0)+-12>>2]|0)|0),_=g,g=0,!(_&1)){ei();break}o=j()|0,g=0,Nt(3),_=g,g=0,_&1?(_=j(0)|0,$t(_)):le(o|0)}while(!1);return b=R,t|0}function Am(t){t=t|0,G0(t+4|0)}function vm(t){t=t|0,G0(t+((e[(e[t>>2]|0)+-12>>2]|0)+4)|0)}function Zs(t){t=t|0,G0(t+4|0),he(t)}function xm(t){t=t|0,Zs(t+(e[(e[t>>2]|0)+-12>>2]|0)|0)}function wm(t,r){t=t|0,r=r|0;var o=0;S[t>>0]=0,e[t+4>>2]=r,o=e[(e[r>>2]|0)+-12>>2]|0,e[r+(o+16)>>2]|0||(o=e[r+(o+72)>>2]|0,o&&js(o)|0,S[t>>0]=1)}function Js(t){t=t|0;var r=0,o=0;t=t+4|0,o=e[t>>2]|0,r=e[(e[o>>2]|0)+-12>>2]|0;do if(e[o+(r+24)>>2]|0&&!(e[o+(r+16)>>2]|0)&&e[o+(r+4)>>2]&8192|0&&!(Or()|0)){if(r=e[t>>2]|0,r=e[r+((e[(e[r>>2]|0)+-12>>2]|0)+24)>>2]|0,g=0,r=ge(e[(e[r>>2]|0)+24>>2]|0,r|0)|0,o=g,g=0,!(o&1)&&((r|0)!=-1||(r=e[t>>2]|0,o=e[(e[r>>2]|0)+-12>>2]|0,g=0,Ae(66,r+o|0,e[r+(o+16)>>2]|1|0),o=g,g=0,!(o&1))))break;o=j(0)|0,K0(o|0)|0,g=0,Nt(3),o=g,g=0,o&1&&(o=j(0)|0,$t(o))}while(!1)}function ym(t){return t=t|0,57453}function Cm(t,r,o){t=t|0,r=r|0,o=o|0,(o|0)!=1&(o|0)<257?up(t,r,o):yi(t,57462,35)}function Tm(){return!(S[1048]|0)&&kt(1048)|0&&(e[10778]=43084,Ft(72,43112,Q|0)|0,bt(1048)),43112}function Im(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0,w=0;l=b,b=b+16|0,c=l+8|0,h=l,w=o,d=e[w+4>>2]|0,o=h,e[o>>2]=e[w>>2],e[o+4>>2]=d,e[c>>2]=e[h>>2],e[c+4>>2]=e[h+4>>2],fp(t,c,r),e[t>>2]=43048,b=l}function Em(t){t=t|0,fr(t)}function km(t){t=t|0,fr(t),he(t)}function Dm(t){t=t|0,G0(t),he(t)}function bm(t){t=t|0,he(t)}function Nm(t){t=t|0}function Fm(t){t=t|0}function Rm(t){t=t|0,he(t)}function Mm(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0;e:do if((l|0)==(c|0))d=6;else for(;;){if((r|0)==(o|0)){r=-1;break e}if(t=S[r>>0]|0,h=S[l>>0]|0,t<<24>>24>24){r=-1;break e}if(h<<24>>24>24){r=1;break e}if(r=r+1|0,l=l+1|0,(l|0)==(c|0)){d=6;break}}while(!1);return(d|0)==6&&(r=(r|0)!=(o|0)&1),r|0}function _m(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0,Dp(t,o,l)}function Pm(t,r,o){t=t|0,r=r|0,o=o|0;var l=0;if((r|0)==(o|0))t=0;else{t=0;do t=(S[r>>0]|0)+(t<<4)|0,l=t&-268435456,t=(l>>>24|l)^t,r=r+1|0;while((r|0)!=(o|0))}return t|0}function Lm(t){t=t|0}function Om(t){t=t|0,he(t)}function $m(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0;e:do if((l|0)==(c|0))d=6;else for(;;){if((r|0)==(o|0)){r=-1;break e}if(t=e[r>>2]|0,h=e[l>>2]|0,(t|0)<(h|0)){r=-1;break e}if((h|0)<(t|0)){r=1;break e}if(r=r+4|0,l=l+4|0,(l|0)==(c|0)){d=6;break}}while(!1);return(d|0)==6&&(r=(r|0)!=(o|0)&1),r|0}function Bm(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0,bp(t,o,l)}function Vm(t,r,o){t=t|0,r=r|0,o=o|0;var l=0;if((r|0)==(o|0))t=0;else{t=0;do t=(e[r>>2]|0)+(t<<4)|0,l=t&-268435456,t=(l>>>24|l)^t,r=r+4|0;while((r|0)!=(o|0))}return t|0}function Um(t){t=t|0}function zm(t){t=t|0,he(t)}function Gm(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0;U=b,b=b+64|0,R=U+56|0,d=U+52|0,k=U+48|0,w=U+44|0,C=U+40|0,D=U+36|0,N=U+32|0,H=U+8|0,_=U;e:do if(e[l+4>>2]&1){d=f0(l)|0,e[D>>2]=d,g=0,t=be(37,D|0,44220)|0,k=g,g=0;do if(k&1)H=j()|0,Bt(d)|0,d=H;else{if(Bt(d)|0,d=f0(l)|0,e[N>>2]=d,g=0,C=be(37,N|0,44360)|0,N=g,g=0,N&1){H=j()|0,Bt(d)|0,d=H;break}if(Bt(d)|0,g=0,Ae(e[(e[C>>2]|0)+24>>2]|0,H|0,C|0),N=g,g=0,N&1)w=H;else if(w=H+12|0,g=0,Ae(e[(e[C>>2]|0)+28>>2]|0,w|0,C|0),N=g,g=0,!(N&1))if(e[_>>2]=e[o>>2],g=0,e[R>>2]=e[_>>2],d=vt(7,r|0,R|0,H|0,H+24|0,t|0,c|0,1)|0,c=g,g=0,c&1){d=j()|0,de(H+12|0),de(H);break}else{S[h>>0]=(d|0)==(H|0)&1,d=e[r>>2]|0,de(H+12|0),de(H);break e}if(d=j()|0,C=ye,(H|0)!=(w|0))do w=w+-12|0,de(w);while((w|0)!=(H|0))}while(!1);le(d|0)}else switch(e[k>>2]=-1,H=e[(e[t>>2]|0)+16>>2]|0,e[w>>2]=e[r>>2],e[C>>2]=e[o>>2],e[d>>2]=e[w>>2],e[R>>2]=e[C>>2],d=on[H&63](t,d,R,l,c,k)|0,e[r>>2]=d,e[k>>2]|0){case 0:{S[h>>0]=0;break e}case 1:{S[h>>0]=1;break e}default:{S[h>>0]=1,e[c>>2]=4;break e}}while(!1);return b=U,d|0}function qm(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0;return d=b,b=b+16|0,w=d+12|0,C=d+8|0,k=d+4|0,D=d,e[k>>2]=e[r>>2],e[D>>2]=e[o>>2],e[C>>2]=e[k>>2],e[w>>2]=e[D>>2],t=M4(t,C,w,l,c,h)|0,b=d,t|0}function Wm(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0;return d=b,b=b+16|0,w=d+12|0,C=d+8|0,k=d+4|0,D=d,e[k>>2]=e[r>>2],e[D>>2]=e[o>>2],e[C>>2]=e[k>>2],e[w>>2]=e[D>>2],t=_4(t,C,w,l,c,h)|0,b=d,t|0}function Hm(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0;return d=b,b=b+16|0,w=d+12|0,C=d+8|0,k=d+4|0,D=d,e[k>>2]=e[r>>2],e[D>>2]=e[o>>2],e[C>>2]=e[k>>2],e[w>>2]=e[D>>2],t=P4(t,C,w,l,c,h)|0,b=d,t|0}function Qm(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0;return d=b,b=b+16|0,w=d+12|0,C=d+8|0,k=d+4|0,D=d,e[k>>2]=e[r>>2],e[D>>2]=e[o>>2],e[C>>2]=e[k>>2],e[w>>2]=e[D>>2],t=L4(t,C,w,l,c,h)|0,b=d,t|0}function Km(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0;return d=b,b=b+16|0,w=d+12|0,C=d+8|0,k=d+4|0,D=d,e[k>>2]=e[r>>2],e[D>>2]=e[o>>2],e[C>>2]=e[k>>2],e[w>>2]=e[D>>2],t=O4(t,C,w,l,c,h)|0,b=d,t|0}function Ym(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0;return d=b,b=b+16|0,w=d+12|0,C=d+8|0,k=d+4|0,D=d,e[k>>2]=e[r>>2],e[D>>2]=e[o>>2],e[C>>2]=e[k>>2],e[w>>2]=e[D>>2],t=$4(t,C,w,l,c,h)|0,b=d,t|0}function jm(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0;return d=b,b=b+16|0,w=d+12|0,C=d+8|0,k=d+4|0,D=d,e[k>>2]=e[r>>2],e[D>>2]=e[o>>2],e[C>>2]=e[k>>2],e[w>>2]=e[D>>2],t=B4(t,C,w,l,c,h)|0,b=d,t|0}function Xm(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0;return d=b,b=b+16|0,w=d+12|0,C=d+8|0,k=d+4|0,D=d,e[k>>2]=e[r>>2],e[D>>2]=e[o>>2],e[C>>2]=e[k>>2],e[w>>2]=e[D>>2],t=V4(t,C,w,l,c,h)|0,b=d,t|0}function Zm(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0;return d=b,b=b+16|0,w=d+12|0,C=d+8|0,k=d+4|0,D=d,e[k>>2]=e[r>>2],e[D>>2]=e[o>>2],e[C>>2]=e[k>>2],e[w>>2]=e[D>>2],t=U4(t,C,w,l,c,h)|0,b=d,t|0}function Jm(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0,ce=0,ke=0,Ee=0;oe=b,b=b+240|0,$=oe,_=oe+208|0,ce=oe+32|0,t=oe+28|0,ne=oe+16|0,G=oe+12|0,H=oe+48|0,K=oe+8|0,U=oe+4|0,e[ce>>2]=0,e[ce+4>>2]=0,e[ce+8>>2]=0,g=0,l=ge(68,l|0)|0,R=g,g=0;do if(R&1)t=j()|0;else{if(e[t>>2]=l,g=0,t=be(37,t|0,44220)|0,R=g,g=0,!(R&1)&&(g=0,Pe(e[(e[t>>2]|0)+32>>2]|0,t|0,57498,57524,_|0)|0,R=g,g=0,!(R&1))){Bt(l)|0,e[ne>>2]=0,e[ne+4>>2]=0,e[ne+8>>2]=0,S[ne>>0]&1?t=(e[ne>>2]&-2)+-1|0:t=10,g=0,xe(8,ne|0,t|0,0),R=g,g=0;e:do if(R&1)ke=30;else{N=ne+8|0,R=ne+1|0,l=S[ne>>0]&1?e[N>>2]|0:R,e[G>>2]=l,e[K>>2]=H,e[U>>2]=0,k=ne+4|0,t=e[r>>2]|0;t:for(;;){if(t){if((e[t+12>>2]|0)==(e[t+16>>2]|0)){if(g=0,d=ge(e[(e[t>>2]|0)+36>>2]|0,t|0)|0,D=g,g=0,D&1){ke=29;break}(d|0)==-1&&(e[r>>2]=0,t=0)}}else t=0;w=(t|0)==0,d=e[o>>2]|0;do if(d){if((e[d+12>>2]|0)!=(e[d+16>>2]|0)){if(w)break;break t}if(g=0,C=ge(e[(e[d>>2]|0)+36>>2]|0,d|0)|0,D=g,g=0,D&1){ke=29;break t}if((C|0)!=-1){if(w)break;break t}else{e[o>>2]=0,ke=19;break}}else ke=19;while(!1);if((ke|0)==19)if(ke=0,w){d=0;break}else d=0;if(w=S[ne>>0]|0,w=w&1?e[k>>2]|0:(w&255)>>>1,(e[G>>2]|0)==(l+w|0)){if(g=0,xe(8,ne|0,w<<1|0,0),D=g,g=0,D&1){ke=29;break}if(S[ne>>0]&1?l=(e[ne>>2]&-2)+-1|0:l=10,g=0,xe(8,ne|0,l|0,0),D=g,g=0,D&1){ke=29;break}l=S[ne>>0]&1?e[N>>2]|0:R,e[G>>2]=l+w}if(C=t+12|0,w=e[C>>2]|0,D=t+16|0,(w|0)==(e[D>>2]|0)){if(g=0,w=ge(e[(e[t>>2]|0)+36>>2]|0,t|0)|0,Ee=g,g=0,Ee&1){ke=29;break}}else w=F[w>>0]|0;if(_i(w&255,16,l,G,U,0,ce,H,K,_)|0)break;if(d=e[C>>2]|0,(d|0)==(e[D>>2]|0))if(g=0,ge(e[(e[t>>2]|0)+40>>2]|0,t|0)|0,Ee=g,g=0,Ee&1){ke=29;break}else continue;else{e[C>>2]=d+1;continue}}if((ke|0)==29){t=j()|0;break}if(g=0,xe(8,ne|0,(e[G>>2]|0)-l|0,0),Ee=g,g=0,!(Ee&1)&&(P=S[ne>>0]|0,O=e[N>>2]|0,g=0,Z=Ce(3)|0,Ee=g,g=0,!(Ee&1))&&(g=0,e[$>>2]=h,ie=Pe(16,(P&1?O:R)|0,Z|0,58882,$|0)|0,Ee=g,g=0,!(Ee&1))){if((ie|0)!=1&&(e[c>>2]=4),t){if((e[t+12>>2]|0)==(e[t+16>>2]|0)){if(g=0,l=ge(e[(e[t>>2]|0)+36>>2]|0,t|0)|0,Ee=g,g=0,Ee&1){ke=30;break}(l|0)==-1&&(e[r>>2]=0,t=0)}}else t=0;l=(t|0)==0;do if(d){if((e[d+12>>2]|0)==(e[d+16>>2]|0)){if(g=0,t=ge(e[(e[d>>2]|0)+36>>2]|0,d|0)|0,Ee=g,g=0,Ee&1){ke=30;break e}if((t|0)==-1){e[o>>2]=0,ke=55;break}}l||(ke=56)}else ke=55;while(!1);return(ke|0)==55&&l&&(ke=56),(ke|0)==56&&(e[c>>2]=e[c>>2]|2),Ee=e[r>>2]|0,de(ne),de(ce),b=oe,Ee|0}else ke=30}while(!1);(ke|0)==30&&(t=j()|0),de(ne);break}t=j()|0,Bt(l)|0}while(!1);return de(ce),le(t|0),0}function _i(t,r,o,l,c,h,d,w,C,D){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0,w=w|0,C=C|0,D=D|0;var k=0,N=0,R=0,_=0;R=e[l>>2]|0,_=(R|0)==(o|0);do if(_){if(k=(S[D+24>>0]|0)==t<<24>>24,!k&&(S[D+25>>0]|0)!=t<<24>>24){N=5;break}e[l>>2]=o+1,S[o>>0]=k?43:45,e[c>>2]=0,k=0}else N=5;while(!1);e:do if((N|0)==5){if(N=S[d>>0]|0,t<<24>>24==h<<24>>24&&(N&1?e[d+4>>2]|0:(N&255)>>>1)|0){if(k=e[C>>2]|0,(k-w|0)>=160){k=0;break}r=e[c>>2]|0,e[C>>2]=k+4,e[k>>2]=r,e[c>>2]=0,k=0;break}for(d=D+26|0,k=D;(S[k>>0]|0)!=t<<24>>24;)if(k=k+1|0,(k|0)==(d|0)){k=d;break}if(k=k-D|0,(k|0)>23)k=-1;else{switch(r|0){case 10:case 8:{if((k|0)>=(r|0)){k=-1;break e}break}case 16:{if((k|0)>=22){if(_){k=-1;break e}if((R-o|0)>=3){k=-1;break e}if((S[R+-1>>0]|0)!=48){k=-1;break e}e[c>>2]=0,k=S[57498+k>>0]|0,e[l>>2]=R+1,S[R>>0]=k,k=0;break e}break}default:}k=S[57498+k>>0]|0,e[l>>2]=R+1,S[R>>0]=k,e[c>>2]=(e[c>>2]|0)+1,k=0}}while(!1);return k|0}function b0(){var t=0,r=0;do if(!(S[1968]|0)&&kt(1968)|0)if(g=0,t=Ve(31,2147483647,58885,0)|0,r=g,g=0,r&1)r=j()|0,W0(1968),le(r|0);else{e[11196]=t,bt(1968);break}while(!1);return e[11196]|0}function eg(t){t=t|0}function tg(t){t=t|0,he(t)}function ig(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0;U=b,b=b+64|0,R=U+56|0,d=U+52|0,k=U+48|0,w=U+44|0,C=U+40|0,D=U+36|0,N=U+32|0,H=U+8|0,_=U;e:do if(e[l+4>>2]&1){d=f0(l)|0,e[D>>2]=d,g=0,t=be(37,D|0,44212)|0,k=g,g=0;do if(k&1)H=j()|0,Bt(d)|0,d=H;else{if(Bt(d)|0,d=f0(l)|0,e[N>>2]=d,g=0,C=be(37,N|0,44368)|0,N=g,g=0,N&1){H=j()|0,Bt(d)|0,d=H;break}if(Bt(d)|0,g=0,Ae(e[(e[C>>2]|0)+24>>2]|0,H|0,C|0),N=g,g=0,N&1)w=H;else if(w=H+12|0,g=0,Ae(e[(e[C>>2]|0)+28>>2]|0,w|0,C|0),N=g,g=0,!(N&1))if(e[_>>2]=e[o>>2],g=0,e[R>>2]=e[_>>2],d=vt(8,r|0,R|0,H|0,H+24|0,t|0,c|0,1)|0,c=g,g=0,c&1){d=j()|0,Pt(H+12|0),Pt(H);break}else{S[h>>0]=(d|0)==(H|0)&1,d=e[r>>2]|0,Pt(H+12|0),Pt(H);break e}if(d=j()|0,C=ye,(H|0)!=(w|0))do w=w+-12|0,Pt(w);while((w|0)!=(H|0))}while(!1);le(d|0)}else switch(e[k>>2]=-1,H=e[(e[t>>2]|0)+16>>2]|0,e[w>>2]=e[r>>2],e[C>>2]=e[o>>2],e[d>>2]=e[w>>2],e[R>>2]=e[C>>2],d=on[H&63](t,d,R,l,c,k)|0,e[r>>2]=d,e[k>>2]|0){case 0:{S[h>>0]=0;break e}case 1:{S[h>>0]=1;break e}default:{S[h>>0]=1,e[c>>2]=4;break e}}while(!1);return b=U,d|0}function ng(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0;return d=b,b=b+16|0,w=d+12|0,C=d+8|0,k=d+4|0,D=d,e[k>>2]=e[r>>2],e[D>>2]=e[o>>2],e[C>>2]=e[k>>2],e[w>>2]=e[D>>2],t=G4(t,C,w,l,c,h)|0,b=d,t|0}function rg(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0;return d=b,b=b+16|0,w=d+12|0,C=d+8|0,k=d+4|0,D=d,e[k>>2]=e[r>>2],e[D>>2]=e[o>>2],e[C>>2]=e[k>>2],e[w>>2]=e[D>>2],t=q4(t,C,w,l,c,h)|0,b=d,t|0}function sg(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0;return d=b,b=b+16|0,w=d+12|0,C=d+8|0,k=d+4|0,D=d,e[k>>2]=e[r>>2],e[D>>2]=e[o>>2],e[C>>2]=e[k>>2],e[w>>2]=e[D>>2],t=W4(t,C,w,l,c,h)|0,b=d,t|0}function og(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0;return d=b,b=b+16|0,w=d+12|0,C=d+8|0,k=d+4|0,D=d,e[k>>2]=e[r>>2],e[D>>2]=e[o>>2],e[C>>2]=e[k>>2],e[w>>2]=e[D>>2],t=H4(t,C,w,l,c,h)|0,b=d,t|0}function ag(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0;return d=b,b=b+16|0,w=d+12|0,C=d+8|0,k=d+4|0,D=d,e[k>>2]=e[r>>2],e[D>>2]=e[o>>2],e[C>>2]=e[k>>2],e[w>>2]=e[D>>2],t=Q4(t,C,w,l,c,h)|0,b=d,t|0}function lg(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0;return d=b,b=b+16|0,w=d+12|0,C=d+8|0,k=d+4|0,D=d,e[k>>2]=e[r>>2],e[D>>2]=e[o>>2],e[C>>2]=e[k>>2],e[w>>2]=e[D>>2],t=K4(t,C,w,l,c,h)|0,b=d,t|0}function ug(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0;return d=b,b=b+16|0,w=d+12|0,C=d+8|0,k=d+4|0,D=d,e[k>>2]=e[r>>2],e[D>>2]=e[o>>2],e[C>>2]=e[k>>2],e[w>>2]=e[D>>2],t=Y4(t,C,w,l,c,h)|0,b=d,t|0}function cg(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0;return d=b,b=b+16|0,w=d+12|0,C=d+8|0,k=d+4|0,D=d,e[k>>2]=e[r>>2],e[D>>2]=e[o>>2],e[C>>2]=e[k>>2],e[w>>2]=e[D>>2],t=j4(t,C,w,l,c,h)|0,b=d,t|0}function fg(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0;return d=b,b=b+16|0,w=d+12|0,C=d+8|0,k=d+4|0,D=d,e[k>>2]=e[r>>2],e[D>>2]=e[o>>2],e[C>>2]=e[k>>2],e[w>>2]=e[D>>2],t=X4(t,C,w,l,c,h)|0,b=d,t|0}function hg(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0,ce=0,ke=0,Ee=0;oe=b,b=b+320|0,$=oe,_=oe+208|0,ce=oe+32|0,t=oe+28|0,ne=oe+16|0,G=oe+12|0,H=oe+48|0,K=oe+8|0,U=oe+4|0,e[ce>>2]=0,e[ce+4>>2]=0,e[ce+8>>2]=0,g=0,l=ge(68,l|0)|0,R=g,g=0;do if(R&1)t=j()|0;else{if(e[t>>2]=l,g=0,t=be(37,t|0,44212)|0,R=g,g=0,!(R&1)&&(g=0,Pe(e[(e[t>>2]|0)+48>>2]|0,t|0,57498,57524,_|0)|0,R=g,g=0,!(R&1))){Bt(l)|0,e[ne>>2]=0,e[ne+4>>2]=0,e[ne+8>>2]=0,S[ne>>0]&1?t=(e[ne>>2]&-2)+-1|0:t=10,g=0,xe(8,ne|0,t|0,0),R=g,g=0;e:do if(R&1)ke=31;else{N=ne+8|0,R=ne+1|0,t=S[ne>>0]&1?e[N>>2]|0:R,e[G>>2]=t,e[K>>2]=H,e[U>>2]=0,k=ne+4|0,d=e[r>>2]|0;t:for(;;){if(d){if(l=e[d+12>>2]|0,(l|0)==(e[d+16>>2]|0)){if(g=0,l=ge(e[(e[d>>2]|0)+36>>2]|0,d|0)|0,D=g,g=0,D&1){ke=30;break}}else l=e[l>>2]|0;(l|0)==-1?(e[r>>2]=0,l=0,w=1):(l=d,w=0)}else l=0,w=1;C=e[o>>2]|0;do if(C){if(d=e[C+12>>2]|0,(d|0)==(e[C+16>>2]|0)){if(g=0,d=ge(e[(e[C>>2]|0)+36>>2]|0,C|0)|0,D=g,g=0,D&1){ke=30;break t}}else d=e[d>>2]|0;if((d|0)!=-1)if(w){d=C;break}else{d=C;break t}else{e[o>>2]=0,ke=20;break}}else ke=20;while(!1);if((ke|0)==20)if(ke=0,w){d=0;break}else d=0;if(w=S[ne>>0]|0,w=w&1?e[k>>2]|0:(w&255)>>>1,(e[G>>2]|0)==(t+w|0)){if(g=0,xe(8,ne|0,w<<1|0,0),D=g,g=0,D&1){ke=30;break}if(S[ne>>0]&1?t=(e[ne>>2]&-2)+-1|0:t=10,g=0,xe(8,ne|0,t|0,0),D=g,g=0,D&1){ke=30;break}t=S[ne>>0]&1?e[N>>2]|0:R,e[G>>2]=t+w}if(C=l+12|0,w=e[C>>2]|0,D=l+16|0,(w|0)==(e[D>>2]|0)){if(g=0,w=ge(e[(e[l>>2]|0)+36>>2]|0,l|0)|0,Ee=g,g=0,Ee&1){ke=30;break}}else w=e[w>>2]|0;if(Pi(w,16,t,G,U,0,ce,H,K,_)|0)break;if(d=e[C>>2]|0,(d|0)==(e[D>>2]|0))if(g=0,ge(e[(e[l>>2]|0)+40>>2]|0,l|0)|0,Ee=g,g=0,Ee&1){ke=30;break}else{d=l;continue}else{e[C>>2]=d+4,d=l;continue}}if((ke|0)==30){t=j()|0;break}if(g=0,xe(8,ne|0,(e[G>>2]|0)-t|0,0),Ee=g,g=0,!(Ee&1)&&(P=S[ne>>0]|0,O=e[N>>2]|0,g=0,Z=Ce(3)|0,Ee=g,g=0,!(Ee&1))&&(g=0,e[$>>2]=h,ie=Pe(16,(P&1?O:R)|0,Z|0,58882,$|0)|0,Ee=g,g=0,!(Ee&1))){if((ie|0)!=1&&(e[c>>2]=4),l){if(t=e[l+12>>2]|0,(t|0)==(e[l+16>>2]|0)){if(g=0,t=ge(e[(e[l>>2]|0)+36>>2]|0,l|0)|0,Ee=g,g=0,Ee&1){ke=31;break}}else t=e[t>>2]|0;(t|0)==-1?(e[r>>2]=0,l=1):l=0}else l=1;do if(d){if(t=e[d+12>>2]|0,(t|0)==(e[d+16>>2]|0)){if(g=0,t=ge(e[(e[d>>2]|0)+36>>2]|0,d|0)|0,Ee=g,g=0,Ee&1){ke=31;break e}}else t=e[t>>2]|0;if((t|0)!=-1){if(l)break;ke=59;break}else{e[o>>2]=0,ke=57;break}}else ke=57;while(!1);return(ke|0)==57&&l&&(ke=59),(ke|0)==59&&(e[c>>2]=e[c>>2]|2),Ee=e[r>>2]|0,de(ne),de(ce),b=oe,Ee|0}else ke=31}while(!1);(ke|0)==31&&(t=j()|0),de(ne);break}t=j()|0,Bt(l)|0}while(!1);return de(ce),le(t|0),0}function Pi(t,r,o,l,c,h,d,w,C,D){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0,w=w|0,C=C|0,D=D|0;var k=0,N=0,R=0,_=0;R=e[l>>2]|0,_=(R|0)==(o|0);do if(_){if(k=(e[D+96>>2]|0)==(t|0),!k&&(e[D+100>>2]|0)!=(t|0)){N=5;break}e[l>>2]=o+1,S[o>>0]=k?43:45,e[c>>2]=0,k=0}else N=5;while(!1);e:do if((N|0)==5){if(N=S[d>>0]|0,(t|0)==(h|0)&&(N&1?e[d+4>>2]|0:(N&255)>>>1)|0){if(k=e[C>>2]|0,(k-w|0)>=160){k=0;break}r=e[c>>2]|0,e[C>>2]=k+4,e[k>>2]=r,e[c>>2]=0,k=0;break}for(d=D+104|0,k=D;(e[k>>2]|0)!=(t|0);)if(k=k+4|0,(k|0)==(d|0)){k=d;break}if(k=k-D|0,d=k>>2,(k|0)>92)k=-1;else{switch(r|0){case 10:case 8:{if((d|0)>=(r|0)){k=-1;break e}break}case 16:{if((k|0)>=88){if(_){k=-1;break e}if((R-o|0)>=3){k=-1;break e}if((S[R+-1>>0]|0)!=48){k=-1;break e}e[c>>2]=0,k=S[57498+d>>0]|0,e[l>>2]=R+1,S[R>>0]=k,k=0;break e}break}default:}k=S[57498+d>>0]|0,e[l>>2]=R+1,S[R>>0]=k,e[c>>2]=(e[c>>2]|0)+1,k=0}}while(!1);return k|0}function qi(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0,D=0;if(C=b,b=b+16|0,w=C,r=f0(r)|0,e[w>>2]=r,g=0,c=be(37,w|0,44220)|0,D=g,g=0,!(D&1)&&(g=0,Pe(e[(e[c>>2]|0)+32>>2]|0,c|0,57498,57524,o|0)|0,D=g,g=0,!(D&1))&&(g=0,d=be(37,w|0,44360)|0,D=g,g=0,!(D&1))&&(g=0,h=ge(e[(e[d>>2]|0)+16>>2]|0,d|0)|0,D=g,g=0,!(D&1))&&(S[l>>0]=h,g=0,Ae(e[(e[d>>2]|0)+20>>2]|0,t|0,d|0),D=g,g=0,!(D&1))){Bt(r)|0,b=C;return}D=j()|0,Bt(r)|0,le(D|0)}function Ar(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0;if(k=b,b=b+16|0,D=k,r=f0(r)|0,e[D>>2]=r,g=0,h=be(37,D|0,44220)|0,N=g,g=0,!(N&1)&&(g=0,Pe(e[(e[h>>2]|0)+32>>2]|0,h|0,57498,57530,o|0)|0,N=g,g=0,!(N&1))&&(g=0,C=be(37,D|0,44360)|0,N=g,g=0,!(N&1))&&(g=0,d=ge(e[(e[C>>2]|0)+12>>2]|0,C|0)|0,N=g,g=0,!(N&1))&&(S[l>>0]=d,g=0,w=ge(e[(e[C>>2]|0)+16>>2]|0,C|0)|0,N=g,g=0,!(N&1))&&(S[c>>0]=w,g=0,Ae(e[(e[C>>2]|0)+20>>2]|0,t|0,C|0),N=g,g=0,!(N&1))){Bt(r)|0,b=k;return}N=j()|0,Bt(r)|0,le(N|0)}function vr(t,r,o,l,c,h,d,w,C,D,k,N){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0,w=w|0,C=C|0,D=D|0,k=k|0,N=N|0;var R=0,_=0;e:do if(t<<24>>24==h<<24>>24)S[r>>0]|0?(S[r>>0]=0,o=e[c>>2]|0,e[c>>2]=o+1,S[o>>0]=46,o=S[w>>0]|0,(o&1?e[w+4>>2]|0:(o&255)>>>1)|0&&(R=e[D>>2]|0,(R-C|0)<160)&&(C=e[k>>2]|0,e[D>>2]=R+4,e[R>>2]=C),R=0):R=-1;else{if(t<<24>>24==d<<24>>24&&(d=S[w>>0]|0,((d&1?e[w+4>>2]|0:(d&255)>>>1)|0)!=0)){if(!(S[r>>0]|0)){R=-1;break}if(R=e[D>>2]|0,(R-C|0)>=160){R=0;break}C=e[k>>2]|0,e[D>>2]=R+4,e[R>>2]=C,e[k>>2]=0,R=0;break}for(h=N+32|0,R=N;(S[R>>0]|0)!=t<<24>>24;)if(R=R+1|0,(R|0)==(h|0)){R=h;break}if(h=R-N|0,(h|0)>31)R=-1;else switch(d=S[57498+h>>0]|0,h|0){case 24:case 25:{if(R=e[c>>2]|0,(R|0)!=(l|0)&&(F[R+-1>>0]&95|0)!=(F[o>>0]&127|0)){R=-1;break e}e[c>>2]=R+1,S[R>>0]=d,R=0;break e}case 23:case 22:{S[o>>0]=80,R=e[c>>2]|0,e[c>>2]=R+1,S[R>>0]=d,R=0;break e}default:{if(R=d&95,(R|0)==(S[o>>0]|0)&&(S[o>>0]=R|128,(S[r>>0]|0)!=0)&&(S[r>>0]=0,o=S[w>>0]|0,((o&1?e[w+4>>2]|0:(o&255)>>>1)|0)!=0)&&(_=e[D>>2]|0,(_-C|0)<160)&&(C=e[k>>2]|0,e[D>>2]=_+4,e[_>>2]=C),D=e[c>>2]|0,e[c>>2]=D+1,S[D>>0]=d,(h|0)>21){R=0;break e}e[k>>2]=(e[k>>2]|0)+1,R=0;break e}}}while(!1);return R|0}function Wi(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0,D=0;if(C=b,b=b+16|0,w=C,r=f0(r)|0,e[w>>2]=r,g=0,c=be(37,w|0,44212)|0,D=g,g=0,!(D&1)&&(g=0,Pe(e[(e[c>>2]|0)+48>>2]|0,c|0,57498,57524,o|0)|0,D=g,g=0,!(D&1))&&(g=0,d=be(37,w|0,44368)|0,D=g,g=0,!(D&1))&&(g=0,h=ge(e[(e[d>>2]|0)+16>>2]|0,d|0)|0,D=g,g=0,!(D&1))&&(e[l>>2]=h,g=0,Ae(e[(e[d>>2]|0)+20>>2]|0,t|0,d|0),D=g,g=0,!(D&1))){Bt(r)|0,b=C;return}D=j()|0,Bt(r)|0,le(D|0)}function xr(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0;if(k=b,b=b+16|0,D=k,r=f0(r)|0,e[D>>2]=r,g=0,h=be(37,D|0,44212)|0,N=g,g=0,!(N&1)&&(g=0,Pe(e[(e[h>>2]|0)+48>>2]|0,h|0,57498,57530,o|0)|0,N=g,g=0,!(N&1))&&(g=0,C=be(37,D|0,44368)|0,N=g,g=0,!(N&1))&&(g=0,d=ge(e[(e[C>>2]|0)+12>>2]|0,C|0)|0,N=g,g=0,!(N&1))&&(e[l>>2]=d,g=0,w=ge(e[(e[C>>2]|0)+16>>2]|0,C|0)|0,N=g,g=0,!(N&1))&&(e[c>>2]=w,g=0,Ae(e[(e[C>>2]|0)+20>>2]|0,t|0,C|0),N=g,g=0,!(N&1))){Bt(r)|0,b=k;return}N=j()|0,Bt(r)|0,le(N|0)}function wr(t,r,o,l,c,h,d,w,C,D,k,N){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0,w=w|0,C=C|0,D=D|0,k=k|0,N=N|0;var R=0,_=0;e:do if((t|0)==(h|0))S[r>>0]|0?(S[r>>0]=0,o=e[c>>2]|0,e[c>>2]=o+1,S[o>>0]=46,o=S[w>>0]|0,(o&1?e[w+4>>2]|0:(o&255)>>>1)|0&&(R=e[D>>2]|0,(R-C|0)<160)&&(C=e[k>>2]|0,e[D>>2]=R+4,e[R>>2]=C),R=0):R=-1;else{if((t|0)==(d|0)&&(d=S[w>>0]|0,((d&1?e[w+4>>2]|0:(d&255)>>>1)|0)!=0)){if(!(S[r>>0]|0)){R=-1;break}if(R=e[D>>2]|0,(R-C|0)>=160){R=0;break}C=e[k>>2]|0,e[D>>2]=R+4,e[R>>2]=C,e[k>>2]=0,R=0;break}for(h=N+128|0,R=N;(e[R>>2]|0)!=(t|0);)if(R=R+4|0,(R|0)==(h|0)){R=h;break}if(h=R-N|0,R=h>>2,(h|0)<=124){switch(d=S[57498+R>>0]|0,R|0){case 24:case 25:{if(R=e[c>>2]|0,(R|0)!=(l|0)&&(F[R+-1>>0]&95|0)!=(F[o>>0]&127|0)){R=-1;break e}e[c>>2]=R+1,S[R>>0]=d,R=0;break e}case 23:case 22:{S[o>>0]=80;break}default:R=d&95,(R|0)==(S[o>>0]|0)&&(S[o>>0]=R|128,(S[r>>0]|0)!=0)&&(S[r>>0]=0,o=S[w>>0]|0,((o&1?e[w+4>>2]|0:(o&255)>>>1)|0)!=0)&&(_=e[D>>2]|0,(_-C|0)<160)&&(C=e[k>>2]|0,e[D>>2]=_+4,e[_>>2]=C)}D=e[c>>2]|0,e[c>>2]=D+1,S[D>>0]=d,(h|0)>84||(e[k>>2]=(e[k>>2]|0)+1),R=0}else R=-1}while(!1);return R|0}function dg(t){t=t|0}function pg(t){t=t|0,he(t)}function mg(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0;k=b,b=b+32|0,h=k+20|0,d=k+16|0,w=k+12|0,D=k;e:do if(!(e[o+4>>2]&1))D=e[(e[t>>2]|0)+24>>2]|0,e[d>>2]=e[r>>2],e[h>>2]=e[d>>2],h=an[D&31](t,h,o,l,c&1)|0;else{h=f0(o)|0,e[w>>2]=h,g=0,d=be(37,w|0,44360)|0,C=g,g=0;t:do if(C&1)k=j()|0,Bt(h)|0,h=k;else{Bt(h)|0,h=e[d>>2]|0,c?t0[e[h+24>>2]&127](D,d):t0[e[h+28>>2]&127](D,d),t=S[D>>0]|0,C=(t&1)==0,h=D+1|0,c=D+8|0,w=C?h:D+1|0,h=C?h:e[D+8>>2]|0,C=D+4|0,o=(t&1)==0;i:do if((h|0)!=((o?w:e[c>>2]|0)+(o?(t&255)>>>1:e[C>>2]|0)|0)){n:for(;;){d=S[h>>0]|0,l=e[r>>2]|0;do if(l){if(o=l+24|0,t=e[o>>2]|0,(t|0)!=(e[l+28>>2]|0)){e[o>>2]=t+1,S[t>>0]=d;break}if(g=0,d=be(e[(e[l>>2]|0)+52>>2]|0,l|0,d&255|0)|0,t=g,g=0,t&1)break n;(d|0)==-1&&(e[r>>2]=0)}while(!1);if(h=h+1|0,t=S[D>>0]|0,o=(t&1)==0,(h|0)==((o?w:e[c>>2]|0)+(o?(t&255)>>>1:e[C>>2]|0)|0))break i}h=j()|0,de(D);break t}while(!1);h=e[r>>2]|0,de(D);break e}while(!1);le(h|0)}while(!1);return b=k,h|0}function gg(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0;if(k=b,b=b+64|0,h=k,R=k+56|0,_=k+44|0,w=k+20|0,D=k+16|0,C=k+12|0,N=k+8|0,d=k+4|0,S[R>>0]=S[58887]|0,S[R+1>>0]=S[58888]|0,S[R+2>>0]=S[58889]|0,S[R+3>>0]=S[58890]|0,S[R+4>>0]=S[58891]|0,S[R+5>>0]=S[58892]|0,ki(R+1|0,58893,1,e[o+4>>2]|0),t=b0()|0,e[h>>2]=c,c=_+(q0(_,12,t,R,h)|0)|0,R=ri(_,c,o)|0,t=f0(o)|0,e[N>>2]=t,g=0,ht(1,_|0,R|0,c|0,w|0,D|0,C|0,N|0),c=g,g=0,c&1)_=j()|0,Bt(t)|0,le(_|0);else return Bt(t)|0,e[d>>2]=e[r>>2],R=e[D>>2]|0,_=e[C>>2]|0,e[h>>2]=e[d>>2],_=Ui(h,w,R,_,o,l)|0,b=k,_|0;return 0}function ki(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0;if(l&2048&&(S[t>>0]=43,t=t+1|0),l&512&&(S[t>>0]=35,t=t+1|0),c=S[r>>0]|0,c<<24>>24)for(h=r;;)if(h=h+1|0,r=t+1|0,S[t>>0]=c,c=S[h>>0]|0,c<<24>>24)t=r;else{t=r;break}e:do switch(l&74|0){case 64:{S[t>>0]=111;break}case 8:if(l&16384){S[t>>0]=88;break e}else{S[t>>0]=120;break e}default:if(o){S[t>>0]=100;break e}else{S[t>>0]=117;break e}}while(!1)}function ri(t,r,o){t=t|0,r=r|0,o=o|0;var l=0;e:do switch(e[o+4>>2]&176|0){case 16:{switch(o=S[t>>0]|0,o<<24>>24){case 43:case 45:{t=t+1|0;break e}default:}if((r-t|0)>1&o<<24>>24==48){switch(S[t+1>>0]|0){case 88:case 120:break;default:{l=7;break e}}t=t+2|0}else l=7;break}case 32:{t=r;break}default:l=7}while(!1);return t|0}function Sg(t,r,o,l,c,h,d){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0;var w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0,G=0,$=0,P=0;G=b,b=b+16|0,$=G,H=O0(d,44220)|0,D=O0(d,44360)|0,t0[e[(e[D>>2]|0)+20>>2]&127]($,D),_=S[$>>0]|0,U=$+4|0;e:do if(!((_&1?e[U>>2]|0:(_&255)>>>1)|0))g=0,Pe(e[(e[H>>2]|0)+32>>2]|0,H|0,t|0,o|0,l|0)|0,K=g,g=0,K&1?K=5:(d=l+(o-t)|0,e[h>>2]=d,K=29);else{switch(e[h>>2]=l,d=S[t>>0]|0,d<<24>>24){case 43:case 45:{if(g=0,d=be(e[(e[H>>2]|0)+28>>2]|0,H|0,d|0)|0,_=g,g=0,_&1){K=5;break e}C=e[h>>2]|0,e[h>>2]=C+1,S[C>>0]=d,C=t+1|0;break}default:C=t}t:do if((o-C|0)>1&&(S[C>>0]|0)==48){switch(d=C+1|0,S[d>>0]|0){case 88:case 120:break;default:break t}if(g=0,w=be(e[(e[H>>2]|0)+28>>2]|0,H|0,48)|0,_=g,g=0,_&1){K=5;break e}if(_=e[h>>2]|0,e[h>>2]=_+1,S[_>>0]=w,g=0,d=be(e[(e[H>>2]|0)+28>>2]|0,H|0,S[d>>0]|0)|0,_=g,g=0,_&1){K=5;break e}_=e[h>>2]|0,e[h>>2]=_+1,S[_>>0]=d,C=C+2|0}while(!1);if((C|0)!=(o|0)&&(k=o+-1|0,C>>>0>>0)){w=C,d=k;do _=S[w>>0]|0,S[w>>0]=S[d>>0]|0,S[d>>0]=_,w=w+1|0,d=d+-1|0;while(w>>>0>>0)}if(g=0,k=ge(e[(e[D>>2]|0)+16>>2]|0,D|0)|0,_=g,g=0,_&1)K=5;else{N=$+8|0,R=$+1|0;t:do if(C>>>0>>0){for(d=0,w=0,_=C;D=S[(S[$>>0]&1?e[N>>2]|0:R)+w>>0]|0,D<<24>>24!=0&(d|0)==(D<<24>>24|0)?(d=e[h>>2]|0,e[h>>2]=d+1,S[d>>0]=k,d=S[$>>0]|0,D=0,w=(w>>>0<((d&1?e[U>>2]|0:(d&255)>>>1)+-1|0)>>>0&1)+w|0):D=d,g=0,d=be(e[(e[H>>2]|0)+28>>2]|0,H|0,S[_>>0]|0)|0,P=g,g=0,!(P&1);){if(P=e[h>>2]|0,e[h>>2]=P+1,S[P>>0]=d,_=_+1|0,_>>>0>=o>>>0)break t;d=D+1|0}d=j()|0;break e}while(!1);if(w=t,d=l+(C-w)|0,t=e[h>>2]|0,(d|0)==(t|0))t=w,K=29;else{if(t=t+-1|0,d>>>0>>0)do P=S[d>>0]|0,S[d>>0]=S[t>>0]|0,S[t>>0]=P,d=d+1|0,t=t+-1|0;while(d>>>0>>0);t=w,d=e[h>>2]|0,K=29}}}while(!1);if((K|0)==5)d=j()|0;else if((K|0)==29){e[c>>2]=(r|0)==(o|0)?d:l+(r-t)|0,de($),b=G;return}de($),le(d|0)}function Ag(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0;if(N=b,b=b+96|0,d=N+8|0,t=N,_=N+74|0,C=N+32|0,k=N+28|0,D=N+24|0,R=N+20|0,w=N+16|0,U=t,e[U>>2]=37,e[U+4>>2]=0,ki(t+1|0,58895,1,e[o+4>>2]|0),U=b0()|0,H=d,e[H>>2]=c,e[H+4>>2]=h,h=_+(q0(_,22,U,t,d)|0)|0,c=ri(_,h,o)|0,t=f0(o)|0,e[R>>2]=t,g=0,ht(1,_|0,c|0,h|0,C|0,k|0,D|0,R|0),h=g,g=0,h&1)H=j()|0,Bt(t)|0,le(H|0);else return Bt(t)|0,e[w>>2]=e[r>>2],U=e[k>>2]|0,H=e[D>>2]|0,e[d>>2]=e[w>>2],H=Ui(d,C,U,H,o,l)|0,b=N,H|0;return 0}function vg(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0;if(k=b,b=b+64|0,h=k,R=k+56|0,_=k+44|0,w=k+20|0,D=k+16|0,C=k+12|0,N=k+8|0,d=k+4|0,S[R>>0]=S[58887]|0,S[R+1>>0]=S[58888]|0,S[R+2>>0]=S[58889]|0,S[R+3>>0]=S[58890]|0,S[R+4>>0]=S[58891]|0,S[R+5>>0]=S[58892]|0,ki(R+1|0,58893,0,e[o+4>>2]|0),t=b0()|0,e[h>>2]=c,c=_+(q0(_,12,t,R,h)|0)|0,R=ri(_,c,o)|0,t=f0(o)|0,e[N>>2]=t,g=0,ht(1,_|0,R|0,c|0,w|0,D|0,C|0,N|0),c=g,g=0,c&1)_=j()|0,Bt(t)|0,le(_|0);else return Bt(t)|0,e[d>>2]=e[r>>2],R=e[D>>2]|0,_=e[C>>2]|0,e[h>>2]=e[d>>2],_=Ui(h,w,R,_,o,l)|0,b=k,_|0;return 0}function xg(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0;if(N=b,b=b+112|0,d=N+8|0,t=N,_=N+75|0,C=N+32|0,k=N+28|0,D=N+24|0,R=N+20|0,w=N+16|0,U=t,e[U>>2]=37,e[U+4>>2]=0,ki(t+1|0,58895,0,e[o+4>>2]|0),U=b0()|0,H=d,e[H>>2]=c,e[H+4>>2]=h,h=_+(q0(_,23,U,t,d)|0)|0,c=ri(_,h,o)|0,t=f0(o)|0,e[R>>2]=t,g=0,ht(1,_|0,c|0,h|0,C|0,k|0,D|0,R|0),h=g,g=0,h&1)H=j()|0,Bt(t)|0,le(H|0);else return Bt(t)|0,e[w>>2]=e[r>>2],U=e[k>>2]|0,H=e[D>>2]|0,e[d>>2]=e[w>>2],H=Ui(d,C,U,H,o,l)|0,b=N,H|0;return 0}function wg(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=+c;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0;Z=b,b=b+176|0,K=Z+84|0,R=Z+48|0,N=Z+32|0,C=Z+24|0,h=Z+8|0,k=Z,U=Z+88|0,H=Z+80|0,w=Z+118|0,O=Z+76|0,P=Z+72|0,G=Z+68|0,$=Z+64|0,D=k,e[D>>2]=37,e[D+4>>2]=0,D=gn(k+1|0,58898,e[o+4>>2]|0)|0,e[H>>2]=U,t=b0()|0,D?(e[h>>2]=e[o+8>>2],B[h+8>>3]=c,h=q0(U,30,t,k,h)|0):(B[C>>3]=c,h=q0(U,30,t,k,C)|0);e:do if((h|0)>29){g=0,t=Ce(3)|0,h=g,g=0,h=h&1,D?!h&&(g=0,e[N>>2]=e[o+8>>2],B[N+8>>3]=c,d=Pe(17,H|0,t|0,k|0,N|0)|0,_=g,g=0,!(_&1))&&(ie=12):!h&&(g=0,e[R>>2]=e[o+8>>2],B[R+8>>3]=c,_=Pe(17,H|0,t|0,k|0,R|0)|0,R=g,g=0,!(R&1))&&(d=_,ie=12);do if((ie|0)==12){if(t=e[H>>2]|0,t)h=t;else{if(g=0,Nt(6),_=g,g=0,_&1)break;h=e[H>>2]|0}t=h,k=h,ie=16;break e}while(!1);t=j()|0}else t=e[H>>2]|0,k=0,d=h,ie=16;while(!1);if((ie|0)==16){C=t+d|0,D=ri(t,C,o)|0;do if((t|0)==(U|0))t=U,h=0,ie=22;else{if(d=E0(d<<1)|0,!d){if(g=0,Nt(6),ie=g,g=0,ie&1){h=0,ie=20;break}t=e[H>>2]|0}h=d,w=d,ie=22}while(!1);do if((ie|0)==22)if(g=0,d=ge(68,o|0)|0,H=g,g=0,H&1)ie=20;else{if(e[G>>2]=d,g=0,ht(2,t|0,D|0,C|0,w|0,O|0,P|0,G|0),G=g,g=0,G&1){t=j()|0,Bt(d)|0;break}if(Bt(d)|0,e[$>>2]=e[r>>2],ie=e[O>>2]|0,t=e[P>>2]|0,g=0,e[K>>2]=e[$>>2],t=Vt(39,K|0,w|0,ie|0,t|0,o|0,l|0)|0,ie=g,g=0,ie&1)ie=20;else return e[r>>2]=t,h&&n0(h),k&&n0(k),b=Z,t|0}while(!1);(ie|0)==20&&(t=j()|0),h&&n0(h),k&&n0(k)}return le(t|0),0}function gn(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0,w=0;if(o&2048&&(S[t>>0]=43,t=t+1|0),o&1024&&(S[t>>0]=35,t=t+1|0),d=o&260,c=o>>>14,w=(d|0)==260,w?h=0:(S[t>>0]=46,S[t+1>>0]=42,t=t+2|0,h=1),o=S[r>>0]|0,o<<24>>24)for(l=t;r=r+1|0,t=l+1|0,S[l>>0]=o,o=S[r>>0]|0,o<<24>>24;)l=t;e:do switch(d|0){case 4:if(c&1){S[t>>0]=70;break e}else{S[t>>0]=102;break e}case 256:if(c&1){S[t>>0]=69;break e}else{S[t>>0]=101;break e}default:if(o=(c&1|0)!=0,w)if(o){S[t>>0]=65;break e}else{S[t>>0]=97;break e}else if(o){S[t>>0]=71;break e}else{S[t>>0]=103;break e}}while(!1);return h|0}function yg(t,r,o,l,c,h,d){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0;var w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0;switch(Z=b,b=b+16|0,ie=Z,O=O0(d,44220)|0,$=O0(d,44360)|0,t0[e[(e[$>>2]|0)+20>>2]&127](ie,$),e[h>>2]=l,d=S[t>>0]|0,d<<24>>24){case 43:case 45:{g=0,d=be(e[(e[O>>2]|0)+28>>2]|0,O|0,d|0)|0,P=g,g=0,P&1?G=8:(k=e[h>>2]|0,e[h>>2]=k+1,S[k>>0]=d,k=t+1|0,G=10);break}default:k=t,G=10}e:do if((G|0)==10){P=o;t:do if((P-k|0)>1&&(S[k>>0]|0)==48){switch(C=k+1|0,S[C>>0]|0){case 88:case 120:break;default:{G=11;break t}}if(g=0,d=be(e[(e[O>>2]|0)+28>>2]|0,O|0,48)|0,K=g,g=0,K&1){G=8;break e}if(K=e[h>>2]|0,e[h>>2]=K+1,S[K>>0]=d,k=k+2|0,g=0,d=be(e[(e[O>>2]|0)+28>>2]|0,O|0,S[C>>0]|0)|0,K=g,g=0,K&1){G=8;break e}if(K=e[h>>2]|0,e[h>>2]=K+1,S[K>>0]=d,k>>>0>>0){for(d=k;C=S[d>>0]|0,g=0,D=Ce(3)|0,K=g,g=0,!(K&1||(g=0,C=be(39,C<<24>>24|0,D|0)|0,K=g,g=0,K&1));){if(!C){K=k;break t}if(d=d+1|0,d>>>0>=o>>>0){K=k;break t}}d=j()|0;break e}else K=k,d=k}else G=11;while(!1);t:do if((G|0)==11)if(k>>>0>>0){for(d=k;C=S[d>>0]|0,g=0,D=Ce(3)|0,K=g,g=0,!(K&1||(g=0,C=be(40,C<<24>>24|0,D|0)|0,K=g,g=0,K&1));){if(!C){K=k;break t}if(d=d+1|0,d>>>0>=o>>>0){K=k;break t}}d=j()|0;break e}else K=k,d=k;while(!1);if(U=S[ie>>0]|0,H=ie+4|0,(U&1?e[H>>2]|0:(U&255)>>>1)|0){if((K|0)!=(d|0)&&(N=d+-1|0,K>>>0>>0)){D=K,C=N;do U=S[D>>0]|0,S[D>>0]=S[C>>0]|0,S[C>>0]=U,D=D+1|0,C=C+-1|0;while(D>>>0>>0)}if(g=0,N=ge(e[(e[$>>2]|0)+16>>2]|0,$|0)|0,U=g,g=0,U&1){G=8;break}R=ie+8|0,_=ie+1|0;t:do if(K>>>0>>0){for(C=0,D=0,U=K;k=S[(S[ie>>0]&1?e[R>>2]|0:_)+D>>0]|0,k<<24>>24>0&(C|0)==(k<<24>>24|0)?(C=e[h>>2]|0,e[h>>2]=C+1,S[C>>0]=N,C=S[ie>>0]|0,k=0,D=(D>>>0<((C&1?e[H>>2]|0:(C&255)>>>1)+-1|0)>>>0&1)+D|0):k=C,g=0,C=be(e[(e[O>>2]|0)+28>>2]|0,O|0,S[U>>0]|0)|0,oe=g,g=0,!(oe&1);){if(oe=e[h>>2]|0,e[h>>2]=oe+1,S[oe>>0]=C,U=U+1|0,U>>>0>=d>>>0)break t;C=k+1|0}d=j()|0;break e}while(!1);if(C=l+(K-t)|0,D=e[h>>2]|0,(C|0)!=(D|0)&&(w=D+-1|0,C>>>0>>0)){do oe=S[C>>0]|0,S[C>>0]=S[w>>0]|0,S[w>>0]=oe,C=C+1|0,w=w+-1|0;while(C>>>0>>0);C=O}else C=O}else{if(g=0,Pe(e[(e[O>>2]|0)+32>>2]|0,O|0,K|0,d|0,e[h>>2]|0)|0,oe=g,g=0,oe&1){G=8;break}e[h>>2]=(e[h>>2]|0)+(d-K),C=O}t:do if(d>>>0>>0){for(;w=S[d>>0]|0,w<<24>>24!=46;){if(g=0,w=be(e[(e[C>>2]|0)+28>>2]|0,O|0,w|0)|0,oe=g,g=0,oe&1){G=4;break}if(oe=e[h>>2]|0,e[h>>2]=oe+1,S[oe>>0]=w,d=d+1|0,d>>>0>=o>>>0)break t}if((G|0)==4){d=j()|0;break e}if(g=0,w=ge(e[(e[$>>2]|0)+12>>2]|0,$|0)|0,oe=g,g=0,oe&1){G=8;break e}oe=e[h>>2]|0,e[h>>2]=oe+1,S[oe>>0]=w,d=d+1|0}while(!1);if(g=0,Pe(e[(e[O>>2]|0)+32>>2]|0,O|0,d|0,o|0,e[h>>2]|0)|0,oe=g,g=0,oe&1)G=8;else{oe=(e[h>>2]|0)+(P-d)|0,e[h>>2]=oe,e[c>>2]=(r|0)==(o|0)?oe:l+(r-t)|0,de(ie),b=Z;return}}while(!1);(G|0)==8&&(d=j()|0),de(ie),le(d|0)}function Cg(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=+c;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0;Z=b,b=b+176|0,K=Z+76|0,R=Z+48|0,N=Z+32|0,C=Z+24|0,h=Z+8|0,k=Z,U=Z+80|0,H=Z+72|0,w=Z+110|0,O=Z+68|0,P=Z+64|0,G=Z+60|0,$=Z+56|0,D=k,e[D>>2]=37,e[D+4>>2]=0,D=gn(k+1|0,58899,e[o+4>>2]|0)|0,e[H>>2]=U,t=b0()|0,D?(e[h>>2]=e[o+8>>2],B[h+8>>3]=c,h=q0(U,30,t,k,h)|0):(B[C>>3]=c,h=q0(U,30,t,k,C)|0);e:do if((h|0)>29){g=0,t=Ce(3)|0,h=g,g=0,h=h&1,D?!h&&(g=0,e[N>>2]=e[o+8>>2],B[N+8>>3]=c,d=Pe(17,H|0,t|0,k|0,N|0)|0,_=g,g=0,!(_&1))&&(ie=12):!h&&(g=0,B[R>>3]=c,_=Pe(17,H|0,t|0,k|0,R|0)|0,R=g,g=0,!(R&1))&&(d=_,ie=12);do if((ie|0)==12){if(t=e[H>>2]|0,t)h=t;else{if(g=0,Nt(6),_=g,g=0,_&1)break;h=e[H>>2]|0}t=h,k=h,ie=16;break e}while(!1);t=j()|0}else t=e[H>>2]|0,k=0,d=h,ie=16;while(!1);if((ie|0)==16){C=t+d|0,D=ri(t,C,o)|0;do if((t|0)==(U|0))t=U,h=0,ie=22;else{if(d=E0(d<<1)|0,!d){if(g=0,Nt(6),ie=g,g=0,ie&1){h=0,ie=20;break}t=e[H>>2]|0}h=d,w=d,ie=22}while(!1);do if((ie|0)==22)if(g=0,d=ge(68,o|0)|0,H=g,g=0,H&1)ie=20;else{if(e[G>>2]=d,g=0,ht(2,t|0,D|0,C|0,w|0,O|0,P|0,G|0),G=g,g=0,G&1){t=j()|0,Bt(d)|0;break}if(Bt(d)|0,e[$>>2]=e[r>>2],ie=e[O>>2]|0,t=e[P>>2]|0,g=0,e[K>>2]=e[$>>2],t=Vt(39,K|0,w|0,ie|0,t|0,o|0,l|0)|0,ie=g,g=0,ie&1)ie=20;else return e[r>>2]=t,h&&n0(h),k&&n0(k),b=Z,t|0}while(!1);(ie|0)==20&&(t=j()|0),h&&n0(h),k&&n0(k)}return le(t|0),0}function Tg(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0;if(R=b,b=b+80|0,C=R,t=R+70|0,k=R+12|0,N=R+32|0,w=R+8|0,D=R+4|0,S[t>>0]=S[58901]|0,S[t+1>>0]=S[58902]|0,S[t+2>>0]=S[58903]|0,S[t+3>>0]=S[58904]|0,S[t+4>>0]=S[58905]|0,S[t+5>>0]=S[58906]|0,h=b0()|0,e[C>>2]=c,t=q0(k,20,h,t,C)|0,c=k+t|0,h=ri(k,c,o)|0,d=f0(o)|0,e[w>>2]=d,g=0,w=be(37,w|0,44220)|0,_=g,g=0,_&1)_=j()|0,Bt(d)|0,le(_|0);else return Bt(d)|0,_r[e[(e[w>>2]|0)+32>>2]&31](w,k,c,N)|0,_=N+t|0,e[D>>2]=e[r>>2],e[C>>2]=e[D>>2],_=Ui(C,N,(h|0)==(c|0)?_:N+(h-k)|0,_,o,l)|0,b=R,_|0;return 0}function Ig(t){t=t|0}function Eg(t){t=t|0,he(t)}function kg(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0;D=b,b=b+32|0,h=D+20|0,d=D+16|0,w=D+12|0,C=D;e:do if(!(e[o+4>>2]&1))C=e[(e[t>>2]|0)+24>>2]|0,e[d>>2]=e[r>>2],e[h>>2]=e[d>>2],h=an[C&31](t,h,o,l,c&1)|0;else{h=f0(o)|0,e[w>>2]=h,g=0,d=be(37,w|0,44368)|0,w=g,g=0;t:do if(w&1)D=j()|0,Bt(h)|0,h=D;else{Bt(h)|0,h=e[d>>2]|0,c?t0[e[h+24>>2]&127](C,d):t0[e[h+28>>2]&127](C,d),t=S[C>>0]|0,o=(t&1)==0,h=C+4|0,c=C+8|0,w=o?h:C+4|0,h=o?h:e[C+8>>2]|0,o=(t&1)==0;i:do if((h|0)!=((o?w:e[c>>2]|0)+((o?(t&255)>>>1:e[w>>2]|0)<<2)|0)){for(;;){if(d=e[h>>2]|0,l=e[r>>2]|0,l){if(o=l+24|0,t=e[o>>2]|0,(t|0)==(e[l+28>>2]|0)){if(g=0,d=be(e[(e[l>>2]|0)+52>>2]|0,l|0,d|0)|0,t=g,g=0,t&1)break}else e[o>>2]=t+4,e[t>>2]=d;(d|0)==-1&&(e[r>>2]=0)}if(h=h+4|0,t=S[C>>0]|0,o=(t&1)==0,(h|0)==((o?w:e[c>>2]|0)+((o?(t&255)>>>1:e[w>>2]|0)<<2)|0))break i}h=j()|0,Pt(C);break t}while(!1);h=e[r>>2]|0,Pt(C);break e}while(!1);le(h|0)}while(!1);return b=D,h|0}function Dg(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0;if(k=b,b=b+128|0,h=k,R=k+116|0,_=k+104|0,w=k+20|0,D=k+16|0,C=k+12|0,N=k+8|0,d=k+4|0,S[R>>0]=S[58887]|0,S[R+1>>0]=S[58888]|0,S[R+2>>0]=S[58889]|0,S[R+3>>0]=S[58890]|0,S[R+4>>0]=S[58891]|0,S[R+5>>0]=S[58892]|0,ki(R+1|0,58893,1,e[o+4>>2]|0),t=b0()|0,e[h>>2]=c,c=_+(q0(_,12,t,R,h)|0)|0,R=ri(_,c,o)|0,t=f0(o)|0,e[N>>2]=t,g=0,ht(3,_|0,R|0,c|0,w|0,D|0,C|0,N|0),c=g,g=0,c&1)_=j()|0,Bt(t)|0,le(_|0);else return Bt(t)|0,e[d>>2]=e[r>>2],R=e[D>>2]|0,_=e[C>>2]|0,e[h>>2]=e[d>>2],_=Hi(h,w,R,_,o,l)|0,b=k,_|0;return 0}function bg(t,r,o,l,c,h,d){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0;var w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0,G=0,$=0,P=0;G=b,b=b+16|0,$=G,H=O0(d,44212)|0,D=O0(d,44368)|0,t0[e[(e[D>>2]|0)+20>>2]&127]($,D),_=S[$>>0]|0,U=$+4|0;e:do if(!((_&1?e[U>>2]|0:(_&255)>>>1)|0))g=0,Pe(e[(e[H>>2]|0)+48>>2]|0,H|0,t|0,o|0,l|0)|0,K=g,g=0,K&1?K=5:(d=l+(o-t<<2)|0,e[h>>2]=d,K=28);else{switch(e[h>>2]=l,d=S[t>>0]|0,d<<24>>24){case 43:case 45:{if(g=0,d=be(e[(e[H>>2]|0)+44>>2]|0,H|0,d|0)|0,_=g,g=0,_&1){K=5;break e}C=e[h>>2]|0,e[h>>2]=C+4,e[C>>2]=d,C=t+1|0;break}default:C=t}t:do if((o-C|0)>1&&(S[C>>0]|0)==48){switch(d=C+1|0,S[d>>0]|0){case 88:case 120:break;default:{_=C;break t}}if(g=0,w=be(e[(e[H>>2]|0)+44>>2]|0,H|0,48)|0,_=g,g=0,_&1){K=5;break e}if(_=e[h>>2]|0,e[h>>2]=_+4,e[_>>2]=w,g=0,d=be(e[(e[H>>2]|0)+44>>2]|0,H|0,S[d>>0]|0)|0,_=g,g=0,_&1){K=5;break e}_=e[h>>2]|0,e[h>>2]=_+4,e[_>>2]=d,_=C+2|0}else _=C;while(!1);if((_|0)!=(o|0)&&(k=o+-1|0,_>>>0>>0)){w=_,d=k;do R=S[w>>0]|0,S[w>>0]=S[d>>0]|0,S[d>>0]=R,w=w+1|0,d=d+-1|0;while(w>>>0>>0)}if(g=0,D=ge(e[(e[D>>2]|0)+16>>2]|0,D|0)|0,R=g,g=0,R&1)K=5;else{k=$+8|0,N=$+1|0;t:do if(_>>>0>>0){for(d=0,w=0,R=_;C=S[(S[$>>0]&1?e[k>>2]|0:N)+w>>0]|0,C<<24>>24!=0&(d|0)==(C<<24>>24|0)?(d=e[h>>2]|0,e[h>>2]=d+4,e[d>>2]=D,d=S[$>>0]|0,C=0,w=(w>>>0<((d&1?e[U>>2]|0:(d&255)>>>1)+-1|0)>>>0&1)+w|0):C=d,g=0,d=be(e[(e[H>>2]|0)+44>>2]|0,H|0,S[R>>0]|0)|0,P=g,g=0,!(P&1);){if(P=e[h>>2]|0,e[h>>2]=P+4,e[P>>2]=d,R=R+1|0,R>>>0>=o>>>0)break t;d=C+1|0}d=j()|0;break e}while(!1);if(C=t,d=l+(_-C<<2)|0,w=e[h>>2]|0,(d|0)!=(w|0))if(t=w+-4|0,d>>>0>>0){do P=e[d>>2]|0,e[d>>2]=e[t>>2],e[t>>2]=P,d=d+4|0,t=t+-4|0;while(d>>>0>>0);t=C,d=w,K=28}else t=C,d=w,K=28;else t=C,K=28}}while(!1);if((K|0)==5)d=j()|0;else if((K|0)==28){e[c>>2]=(r|0)==(o|0)?d:l+(r-t<<2)|0,de($),b=G;return}de($),le(d|0)}function Ng(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0;if(N=b,b=b+224|0,d=N+8|0,t=N,_=N+196|0,C=N+32|0,k=N+28|0,D=N+24|0,R=N+20|0,w=N+16|0,U=t,e[U>>2]=37,e[U+4>>2]=0,ki(t+1|0,58895,1,e[o+4>>2]|0),U=b0()|0,H=d,e[H>>2]=c,e[H+4>>2]=h,h=_+(q0(_,22,U,t,d)|0)|0,c=ri(_,h,o)|0,t=f0(o)|0,e[R>>2]=t,g=0,ht(3,_|0,c|0,h|0,C|0,k|0,D|0,R|0),h=g,g=0,h&1)H=j()|0,Bt(t)|0,le(H|0);else return Bt(t)|0,e[w>>2]=e[r>>2],U=e[k>>2]|0,H=e[D>>2]|0,e[d>>2]=e[w>>2],H=Hi(d,C,U,H,o,l)|0,b=N,H|0;return 0}function Fg(t,r,o,l,c,h,d,w){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0,w=w|0;var C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0,G=0,$=0;K=b,b=b+16|0,U=K,R=K+8|0;e:do if((o|0)==(l|0))C=l;else for(C=o;;){if(!(e[C>>2]|0))break e;if(C=C+4|0,(C|0)==(l|0)){C=l;break}}while(!1);e[w>>2]=h,e[c>>2]=o,k=d,_=t+8|0;e:do if((h|0)==(d|0)|(o|0)==(l|0))G=47;else{t=h,D=C;t:for(;;){if($=r,h=e[$+4>>2]|0,C=U,e[C>>2]=e[$>>2],e[C+4>>2]=h,C=ai(e[_>>2]|0)|0,g=0,h=se(21,t|0,c|0,D-o>>2|0,k-t|0,r|0)|0,$=g,g=0,$&1){G=9;break}if(C|0&&(g=0,ge(75,C|0)|0,$=g,g=0,$&1)){G=8;break}switch(h|0){case 0:{N=1;break e}case-1:{C=t,G=14;break t}default:}if(C=(e[w>>2]|0)+h|0,e[w>>2]=C,(C|0)==(d|0)){G=27;break}if((D|0)==(l|0))o=e[c>>2]|0,t=C,C=l;else{if(C=ai(e[_>>2]|0)|0,g=0,o=Ve(34,R|0,0,r|0)|0,$=g,g=0,$&1){G=35;break}if(C|0&&(g=0,ge(75,C|0)|0,$=g,g=0,$&1)){G=34;break}if((o|0)==-1){N=2;break e}if(o>>>0>(k-(e[w>>2]|0)|0)>>>0){N=1;break e}if(o)for(C=R;D=S[C>>0]|0,$=e[w>>2]|0,e[w>>2]=$+1,S[$>>0]=D,o=o+-1|0,o;)C=C+1|0;o=(e[c>>2]|0)+4|0,e[c>>2]=o;i:do if((o|0)==(l|0))C=l;else for(C=o;;){if(!(e[C>>2]|0))break i;if(C=C+4|0,(C|0)==(l|0)){C=l;break}}while(!1);t=e[w>>2]|0}if((t|0)==(d|0)|(o|0)==(l|0)){G=47;break e}else D=C}if((G|0)==8)$=j(0)|0,$t($);else if((G|0)==9)o=j()|0,C|0&&(g=0,ge(75,C|0)|0,$=g,g=0,$&1)&&($=j(0)|0,$t($)),le(o|0);else if((G|0)==14){e[w>>2]=C;t:do if((o|0)!=(e[c>>2]|0)){for(;;){if($=e[o>>2]|0,t=ai(e[_>>2]|0)|0,g=0,C=Ve(34,C|0,$|0,U|0)|0,$=g,g=0,$&1){H=t;break}if(t|0&&(g=0,ge(75,t|0)|0,$=g,g=0,$&1)){G=18;break}if((C|0)==-1||(C=(e[w>>2]|0)+C|0,e[w>>2]=C,o=o+4|0,(o|0)==(e[c>>2]|0)))break t}(G|0)==18&&($=j(0)|0,$t($)),o=j()|0,H|0&&(g=0,ge(75,H|0)|0,$=g,g=0,$&1)&&($=j(0)|0,$t($)),le(o|0)}while(!1);e[c>>2]=o,N=2;break}else if((G|0)==27){o=e[c>>2]|0,G=47;break}else(G|0)==34?($=j(0)|0,$t($)):(G|0)==35&&(o=j()|0,C|0&&(g=0,ge(75,C|0)|0,$=g,g=0,$&1)&&($=j(0)|0,$t($)),le(o|0))}while(!1);return(G|0)==47&&(N=(o|0)!=(l|0)&1),b=K,N|0}function Rg(t,r,o,l,c,h,d,w){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0,w=w|0;var C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0,G=0,$=0;K=b,b=b+16|0,H=K;e:do if((o|0)==(l|0))C=l;else for(C=o;;){if(!(S[C>>0]|0))break e;if(C=C+1|0,(C|0)==(l|0)){C=l;break}}while(!1);e[w>>2]=h,e[c>>2]=o,N=d,_=t+8|0;e:do if((h|0)==(d|0)|(o|0)==(l|0))G=47;else{t=h,k=C;t:for(;;){if(D=r,C=e[D+4>>2]|0,h=H,e[h>>2]=e[D>>2],e[h+4>>2]=C,h=k,C=ai(e[_>>2]|0)|0,g=0,D=se(22,t|0,c|0,h-o|0,N-t>>2|0,r|0)|0,$=g,g=0,$&1){G=9;break}if(C|0&&(g=0,ge(75,C|0)|0,$=g,g=0,$&1)){G=8;break}switch(D|0){case 0:{R=2;break e}case-1:{C=t,G=14;break t}default:}if(t=(e[w>>2]|0)+(D<<2)|0,e[w>>2]=t,(t|0)==(d|0)){G=31;break}if(o=e[c>>2]|0,(k|0)==(l|0))C=l;else{if(C=ai(e[_>>2]|0)|0,g=0,o=Pe(20,t|0,o|0,1,r|0)|0,$=g,g=0,$&1){G=38;break}if(C|0&&(g=0,ge(75,C|0)|0,$=g,g=0,$&1)){G=37;break}if(o){R=2;break e}e[w>>2]=(e[w>>2]|0)+4,o=(e[c>>2]|0)+1|0,e[c>>2]=o;i:do if((o|0)==(l|0))C=l;else for(C=o;;){if(!(S[C>>0]|0))break i;if(C=C+1|0,(C|0)==(l|0)){C=l;break}}while(!1);t=e[w>>2]|0}if((t|0)==(d|0)|(o|0)==(l|0)){G=47;break e}else k=C}if((G|0)==8)$=j(0)|0,$t($);else if((G|0)==9)o=j()|0,C|0&&(g=0,ge(75,C|0)|0,$=g,g=0,$&1)&&($=j(0)|0,$t($)),le(o|0);else if((G|0)==14){e[w>>2]=C;t:do if((o|0)!=(e[c>>2]|0)){t=C;i:for(;;){if(C=ai(e[_>>2]|0)|0,g=0,t=Pe(20,t|0,o|0,h-o|0,H|0)|0,$=g,g=0,$&1){G=19;break}if(C|0&&(g=0,ge(75,C|0)|0,$=g,g=0,$&1)){G=18;break}switch(t|0){case-1:{G=25;break i}case-2:{G=26;break i}case 0:{o=o+1|0;break}default:o=o+t|0}if(t=(e[w>>2]|0)+4|0,e[w>>2]=t,(o|0)==(e[c>>2]|0)){U=o;break t}}if((G|0)==18)$=j(0)|0,$t($);else if((G|0)==19)o=j()|0,C|0&&(g=0,ge(75,C|0)|0,$=g,g=0,$&1)&&($=j(0)|0,$t($)),le(o|0);else if((G|0)==25){e[c>>2]=o,R=2;break e}else if((G|0)==26){e[c>>2]=o,R=1;break e}}else U=o;while(!1);e[c>>2]=U,R=(U|0)!=(l|0)&1;break}else if((G|0)==31){o=e[c>>2]|0,G=47;break}else(G|0)==37?($=j(0)|0,$t($)):(G|0)==38&&(o=j()|0,C|0&&(g=0,ge(75,C|0)|0,$=g,g=0,$&1)&&($=j(0)|0,$t($)),le(o|0))}while(!1);return(G|0)==47&&(R=(o|0)!=(l|0)&1),b=K,R|0}function Mg(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0;switch(d=b,b=b+16|0,h=d,e[c>>2]=o,o=ai(e[t+8>>2]|0)|0,g=0,t=Ve(34,h|0,0,r|0)|0,r=g,g=0,r&1&&(h=j()|0,o|0&&(g=0,ge(75,o|0)|0,d=g,g=0,d&1)&&(d=j(0)|0,$t(d)),le(h|0)),o|0&&(g=0,ge(75,o|0)|0,r=g,g=0,r&1)&&(r=j(0)|0,$t(r)),t|0){case 0:case-1:{h=2;break}default:if(t=t+-1|0,t>>>0<=(l-(e[c>>2]|0)|0)>>>0)if(!t)h=0;else for(;;)if(r=S[h>>0]|0,l=e[c>>2]|0,e[c>>2]=l+1,S[l>>0]=r,t=t+-1|0,t)h=h+1|0;else{h=0;break}else h=1}return b=d,h|0}function _g(t){t=t|0;var r=0,o=0,l=0,c=0,h=0,d=0;r=t+8|0,g=0,o=ge(75,e[r>>2]|0)|0,l=g,g=0;do if(l&1)c=16;else{if(g=0,l=Ve(35,0,0,4)|0,t=g,g=0,t&1){if(t=j(0)|0,!o||(g=0,ge(75,o|0)|0,d=g,g=0,!(d&1)))break;d=j(0)|0,$t(d)}if(o|0&&(g=0,ge(75,o|0)|0,d=g,g=0,d&1)&&(d=j(0)|0,$t(d)),l)h=-1;else if(t=e[r>>2]|0,t){if(g=0,t=ge(75,t|0)|0,d=g,g=0,d&1){c=16;break}t|0&&(g=0,ge(75,t|0)|0,d=g,g=0,d&1)?(d=j(0)|0,$t(d)):h=0}else h=1;return h|0}while(!1);return(c|0)==16&&(t=j(0)|0),$t(t),0}function Pg(t){return t=t|0,0}function Lg(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0;D=l,C=t+8|0;e:do if((o|0)==(l|0)|(c|0)==0)t=0;else{for(t=0,w=0;;){if(d=ai(e[C>>2]|0)|0,g=0,h=Ve(36,o|0,D-o|0,r|0)|0,R=g,g=0,R&1){N=d;break}if(d|0&&(g=0,ge(75,d|0)|0,R=g,g=0,R&1)){k=5;break}switch(h|0){case-2:case-1:break e;case 0:{o=o+1|0,h=1;break}default:o=o+h|0}if(t=h+t|0,w=w+1|0,(o|0)==(l|0)|w>>>0>=c>>>0)break e}(k|0)==5&&(R=j(0)|0,$t(R)),t=j()|0,N|0&&(g=0,ge(75,N|0)|0,R=g,g=0,R&1)&&(R=j(0)|0,$t(R)),le(t|0)}while(!1);return t|0}function Og(t){t=t|0;var r=0,o=0;return t=e[t+8>>2]|0,t?(g=0,t=ge(75,t|0)|0,o=g,g=0,o&1&&(o=j(0)|0,$t(o)),t|0&&(g=0,ge(75,t|0)|0,o=g,g=0,o&1)?(o=j(0)|0,$t(o)):r=4):r=1,r|0}function $g(t){t=t|0,he(t)}function Bg(t,r,o,l,c,h,d,w){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0,w=w|0;var C=0;return t=b,b=b+16|0,C=t+4|0,r=t,e[C>>2]=o,e[r>>2]=h,d=O3(o,l,C,h,d,r,1114111,0)|0,e[c>>2]=e[C>>2],e[w>>2]=e[r>>2],b=t,d|0}function Vg(t,r,o,l,c,h,d,w){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0,w=w|0;var C=0;return t=b,b=b+16|0,C=t+4|0,r=t,e[C>>2]=o,e[r>>2]=h,d=$3(o,l,C,h,d,r,1114111,0)|0,e[c>>2]=e[C>>2],e[w>>2]=e[r>>2],b=t,d|0}function Ug(t,r,o,l,c){return t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,e[c>>2]=o,3}function zg(t){return t=t|0,0}function Gg(t){return t=t|0,0}function qg(t,r,o,l,c){return t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,B3(o,l,c,1114111,0)|0}function Wg(t){return t=t|0,4}function Hg(t){t=t|0,he(t)}function Qg(t,r,o,l,c,h,d,w){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0,w=w|0;var C=0;return t=b,b=b+16|0,C=t+4|0,r=t,e[C>>2]=o,e[r>>2]=h,d=V3(o,l,C,h,d,r,1114111,0)|0,e[c>>2]=e[C>>2],e[w>>2]=e[r>>2],b=t,d|0}function Kg(t,r,o,l,c,h,d,w){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0,w=w|0;var C=0;return t=b,b=b+16|0,C=t+4|0,r=t,e[C>>2]=o,e[r>>2]=h,d=U3(o,l,C,h,d,r,1114111,0)|0,e[c>>2]=e[C>>2],e[w>>2]=e[r>>2],b=t,d|0}function Yg(t,r,o,l,c){return t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,e[c>>2]=o,3}function jg(t){return t=t|0,0}function Xg(t){return t=t|0,0}function Zg(t,r,o,l,c){return t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,z3(o,l,c,1114111,0)|0}function Jg(t){return t=t|0,4}function e4(t){t=t|0,he(t)}function t4(t){t=t|0,he(t)}function i4(t,r){t=t|0,r=r|0,e[t+4>>2]=r+-1,e[t>>2]=44384,S[t+8>>0]=46,S[t+9>>0]=44,t=t+12|0,e[t>>2]=0,e[t+4>>2]=0,e[t+8>>2]=0}function n4(t,r){t=t|0,r=r|0,e[t+4>>2]=r+-1,e[t>>2]=44424,e[t+8>>2]=46,e[t+12>>2]=44,t=t+16|0,e[t>>2]=0,e[t+4>>2]=0,e[t+8>>2]=0}function eo(t){t=t|0,e[t>>2]=44384,de(t+12|0)}function r4(t){t=t|0,eo(t),he(t)}function to(t){t=t|0,e[t>>2]=44424,de(t+16|0)}function s4(t){t=t|0,to(t),he(t)}function o4(t){return t=t|0,S[t+8>>0]|0}function l4(t){return t=t|0,e[t+8>>2]|0}function u4(t){return t=t|0,S[t+9>>0]|0}function c4(t){return t=t|0,e[t+12>>2]|0}function f4(t,r){t=t|0,r=r|0,hr(t,r+12|0)}function h4(t,r){t=t|0,r=r|0,hr(t,r+16|0)}function d4(t,r){t=t|0,r=r|0,yi(t,59024,4)}function p4(t,r){t=t|0,r=r|0,mr(t,44996,_n(44996)|0)}function m4(t,r){t=t|0,r=r|0,yi(t,59029,5)}function g4(t,r){t=t|0,r=r|0,mr(t,45016,_n(45016)|0)}function li(t){switch(t=t|0,e[t+4>>2]&74|0){case 64:{t=8;break}case 8:{t=16;break}case 0:{t=0;break}default:t=10}return t|0}function S4(t){t=t|0;do if(!(S[2464]|0)&&kt(2464)|0){if(!(S[2472]|0)&&kt(2472)|0){t=45040;do e[t>>2]=0,e[t+4>>2]=0,e[t+8>>2]=0,t=t+12|0;while((t|0)!=45208);Ft(193,0,Q|0)|0,bt(2472)}if(g=0,be(41,45040,59035)|0,t=g,g=0,!(t&1)&&(g=0,be(41,45052,59042)|0,t=g,g=0,!(t&1))&&(g=0,be(41,45064,59049)|0,t=g,g=0,!(t&1))&&(g=0,be(41,45076,59057)|0,t=g,g=0,!(t&1))&&(g=0,be(41,45088,59067)|0,t=g,g=0,!(t&1))&&(g=0,be(41,45100,59076)|0,t=g,g=0,!(t&1))&&(g=0,be(41,45112,59083)|0,t=g,g=0,!(t&1))&&(g=0,be(41,45124,59092)|0,t=g,g=0,!(t&1))&&(g=0,be(41,45136,59096)|0,t=g,g=0,!(t&1))&&(g=0,be(41,45148,59100)|0,t=g,g=0,!(t&1))&&(g=0,be(41,45160,59104)|0,t=g,g=0,!(t&1))&&(g=0,be(41,45172,59108)|0,t=g,g=0,!(t&1))&&(g=0,be(41,45184,59112)|0,t=g,g=0,!(t&1))&&(g=0,be(41,45196,59116)|0,t=g,g=0,!(t&1))){e[11302]=45040,bt(2464);break}t=j()|0,W0(2464),le(t|0)}while(!1);return e[11302]|0}function A4(t){t=t|0;do if(!(S[2480]|0)&&kt(2480)|0){if(!(S[2488]|0)&&kt(2488)|0){t=45212;do e[t>>2]=0,e[t+4>>2]=0,e[t+8>>2]=0,t=t+12|0;while((t|0)!=45380);Ft(194,0,Q|0)|0,bt(2488)}if(g=0,be(42,45212,45380)|0,t=g,g=0,!(t&1)&&(g=0,be(42,45224,45408)|0,t=g,g=0,!(t&1))&&(g=0,be(42,45236,45436)|0,t=g,g=0,!(t&1))&&(g=0,be(42,45248,45468)|0,t=g,g=0,!(t&1))&&(g=0,be(42,45260,45508)|0,t=g,g=0,!(t&1))&&(g=0,be(42,45272,45544)|0,t=g,g=0,!(t&1))&&(g=0,be(42,45284,45572)|0,t=g,g=0,!(t&1))&&(g=0,be(42,45296,45608)|0,t=g,g=0,!(t&1))&&(g=0,be(42,45308,45624)|0,t=g,g=0,!(t&1))&&(g=0,be(42,45320,45640)|0,t=g,g=0,!(t&1))&&(g=0,be(42,45332,45656)|0,t=g,g=0,!(t&1))&&(g=0,be(42,45344,45672)|0,t=g,g=0,!(t&1))&&(g=0,be(42,45356,45688)|0,t=g,g=0,!(t&1))&&(g=0,be(42,45368,45704)|0,t=g,g=0,!(t&1))){e[11430]=45212,bt(2480);break}t=j()|0,W0(2480),le(t|0)}while(!1);return e[11430]|0}function x4(t){t=t|0;e:do if(!(S[2496]|0)&&kt(2496)|0){if(!(S[2504]|0)&&kt(2504)|0){t=45724;do e[t>>2]=0,e[t+4>>2]=0,e[t+8>>2]=0,t=t+12|0;while((t|0)!=46012);Ft(195,0,Q|0)|0,bt(2504)}g=0,be(41,45724,59120)|0,t=g,g=0;do if(!(t&1)&&(g=0,be(41,45736,59128)|0,t=g,g=0,!(t&1))&&(g=0,be(41,45748,59137)|0,t=g,g=0,!(t&1))&&(g=0,be(41,45760,59143)|0,t=g,g=0,!(t&1))&&(g=0,be(41,45772,59149)|0,t=g,g=0,!(t&1))&&(g=0,be(41,45784,59153)|0,t=g,g=0,!(t&1))&&(g=0,be(41,45796,59158)|0,t=g,g=0,!(t&1))&&(g=0,be(41,45808,59163)|0,t=g,g=0,!(t&1))&&(g=0,be(41,45820,59170)|0,t=g,g=0,!(t&1))&&(g=0,be(41,45832,59180)|0,t=g,g=0,!(t&1))&&(g=0,be(41,45844,59188)|0,t=g,g=0,!(t&1))&&(g=0,be(41,45856,59197)|0,t=g,g=0,!(t&1))&&(g=0,be(41,45868,59206)|0,t=g,g=0,!(t&1))&&(g=0,be(41,45880,59210)|0,t=g,g=0,!(t&1))&&(g=0,be(41,45892,59214)|0,t=g,g=0,!(t&1))){if(g=0,be(41,45904,59218)|0,t=g,g=0,t&1||(g=0,be(41,45916,59149)|0,t=g,g=0,t&1)||(g=0,be(41,45928,59222)|0,t=g,g=0,t&1)||(g=0,be(41,45940,59226)|0,t=g,g=0,t&1)||(g=0,be(41,45952,59230)|0,t=g,g=0,t&1)||(g=0,be(41,45964,59234)|0,t=g,g=0,t&1)||(g=0,be(41,45976,59238)|0,t=g,g=0,t&1)||(g=0,be(41,45988,59242)|0,t=g,g=0,t&1)||(g=0,be(41,46e3,59246)|0,t=g,g=0,t&1))break;e[11503]=45724,bt(2496);break e}while(!1);t=j()|0,W0(2496),le(t|0)}while(!1);return e[11503]|0}function w4(t){t=t|0;e:do if(!(S[2512]|0)&&kt(2512)|0){if(!(S[2520]|0)&&kt(2520)|0){t=46016;do e[t>>2]=0,e[t+4>>2]=0,e[t+8>>2]=0,t=t+12|0;while((t|0)!=46304);Ft(196,0,Q|0)|0,bt(2520)}g=0,be(42,46016,46304)|0,t=g,g=0;do if(!(t&1)&&(g=0,be(42,46028,46336)|0,t=g,g=0,!(t&1))&&(g=0,be(42,46040,46372)|0,t=g,g=0,!(t&1))&&(g=0,be(42,46052,46396)|0,t=g,g=0,!(t&1))&&(g=0,be(42,46064,46420)|0,t=g,g=0,!(t&1))&&(g=0,be(42,46076,46436)|0,t=g,g=0,!(t&1))&&(g=0,be(42,46088,46456)|0,t=g,g=0,!(t&1))&&(g=0,be(42,46100,46476)|0,t=g,g=0,!(t&1))&&(g=0,be(42,46112,46504)|0,t=g,g=0,!(t&1))&&(g=0,be(42,46124,46544)|0,t=g,g=0,!(t&1))&&(g=0,be(42,46136,46576)|0,t=g,g=0,!(t&1))&&(g=0,be(42,46148,46612)|0,t=g,g=0,!(t&1))&&(g=0,be(42,46160,46648)|0,t=g,g=0,!(t&1))&&(g=0,be(42,46172,46664)|0,t=g,g=0,!(t&1))&&(g=0,be(42,46184,46680)|0,t=g,g=0,!(t&1))){if(g=0,be(42,46196,46696)|0,t=g,g=0,t&1||(g=0,be(42,46208,46420)|0,t=g,g=0,t&1)||(g=0,be(42,46220,46712)|0,t=g,g=0,t&1)||(g=0,be(42,46232,46728)|0,t=g,g=0,t&1)||(g=0,be(42,46244,46744)|0,t=g,g=0,t&1)||(g=0,be(42,46256,46760)|0,t=g,g=0,t&1)||(g=0,be(42,46268,46776)|0,t=g,g=0,t&1)||(g=0,be(42,46280,46792)|0,t=g,g=0,t&1)||(g=0,be(42,46292,46808)|0,t=g,g=0,t&1))break;e[11706]=46016,bt(2512);break e}while(!1);t=j()|0,W0(2512),le(t|0)}while(!1);return e[11706]|0}function y4(t){t=t|0;do if(!(S[2528]|0)&&kt(2528)|0){if(!(S[2536]|0)&&kt(2536)|0){t=46828;do e[t>>2]=0,e[t+4>>2]=0,e[t+8>>2]=0,t=t+12|0;while((t|0)!=47116);Ft(197,0,Q|0)|0,bt(2536)}if(g=0,be(41,46828,59250)|0,t=g,g=0,!(t&1)&&(g=0,be(41,46840,59253)|0,t=g,g=0,!(t&1))){e[11779]=46828,bt(2528);break}t=j()|0,W0(2528),le(t|0)}while(!1);return e[11779]|0}function C4(t){t=t|0;do if(!(S[2544]|0)&&kt(2544)|0){if(!(S[2552]|0)&&kt(2552)|0){t=47120;do e[t>>2]=0,e[t+4>>2]=0,e[t+8>>2]=0,t=t+12|0;while((t|0)!=47408);Ft(198,0,Q|0)|0,bt(2552)}if(g=0,be(42,47120,47408)|0,t=g,g=0,!(t&1)&&(g=0,be(42,47132,47420)|0,t=g,g=0,!(t&1))){e[11858]=47120,bt(2544);break}t=j()|0,W0(2544),le(t|0)}while(!1);return e[11858]|0}function T4(t){t=t|0;do if(!(S[2560]|0)&&kt(2560)|0)if(g=0,xe(5,47436,59256,8),t=g,g=0,t&1)t=j()|0,W0(2560),le(t|0);else{Ft(199,47436,Q|0)|0,bt(2560);break}while(!1);return 47436}function I4(t){t=t|0;var r=0;do if(!(S[2568]|0)&&kt(2568)|0){if(g=0,t=ge(76,47448)|0,r=g,g=0,!(r&1)&&(g=0,xe(15,47484,47448,t|0),r=g,g=0,!(r&1))){Ft(200,47484,Q|0)|0,bt(2568);break}r=j()|0,W0(2568),le(r|0)}while(!1);return 47484}function E4(t){t=t|0;do if(!(S[2576]|0)&&kt(2576)|0)if(g=0,xe(5,47496,59265,8),t=g,g=0,t&1)t=j()|0,W0(2576),le(t|0);else{Ft(199,47496,Q|0)|0,bt(2576);break}while(!1);return 47496}function k4(t){t=t|0;var r=0;do if(!(S[2584]|0)&&kt(2584)|0){if(g=0,t=ge(76,47508)|0,r=g,g=0,!(r&1)&&(g=0,xe(15,47544,47508,t|0),r=g,g=0,!(r&1))){Ft(200,47544,Q|0)|0,bt(2584);break}r=j()|0,W0(2584),le(r|0)}while(!1);return 47544}function D4(t){t=t|0;do if(!(S[2592]|0)&&kt(2592)|0)if(g=0,xe(5,47556,59274,20),t=g,g=0,t&1)t=j()|0,W0(2592),le(t|0);else{Ft(199,47556,Q|0)|0,bt(2592);break}while(!1);return 47556}function N4(t){t=t|0;var r=0;do if(!(S[2600]|0)&&kt(2600)|0){if(g=0,t=ge(76,47568)|0,r=g,g=0,!(r&1)&&(g=0,xe(15,47652,47568,t|0),r=g,g=0,!(r&1))){Ft(200,47652,Q|0)|0,bt(2600);break}r=j()|0,W0(2600),le(r|0)}while(!1);return 47652}function F4(t){t=t|0;do if(!(S[2608]|0)&&kt(2608)|0)if(g=0,xe(5,47664,59295,11),t=g,g=0,t&1)t=j()|0,W0(2608),le(t|0);else{Ft(199,47664,Q|0)|0,bt(2608);break}while(!1);return 47664}function R4(t){t=t|0;var r=0;do if(!(S[2616]|0)&&kt(2616)|0){if(g=0,t=ge(76,47676)|0,r=g,g=0,!(r&1)&&(g=0,xe(15,47724,47676,t|0),r=g,g=0,!(r&1))){Ft(200,47724,Q|0)|0,bt(2616);break}r=j()|0,W0(2616),le(r|0)}while(!1);return 47724}function io(t){t=t|0;var r=0,o=0,l=0;e[t>>2]=44304,t=t+8|0,r=e[t>>2]|0,g=0,o=Ce(3)|0,l=g,g=0;do if(!(l&1)){if((r|0)!=(o|0)&&(g=0,ue(188,e[t>>2]|0),l=g,g=0,l&1))break;return}while(!1);l=j(0)|0,$t(l)}function Sn(t,r,o,l,c,h,d){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0;var w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0,G=0,$=0,P=0,O=0,Z=0;O=b,b=b+112|0,C=O,k=(l-o|0)/12|0;do if(k>>>0>100){if(C=E0(k)|0,!(C|0)&&(g=0,Nt(6),P=g,g=0,P&1)){w=0,_=6;break}w=C,_=11}else w=0,_=11;while(!1);e:do if((_|0)==11){if((o|0)==(l|0))D=0;else for(_=o,N=0,R=C;D=S[_>>0]|0,D&1?D=e[_+4>>2]|0:D=(D&255)>>>1,D?(S[R>>0]=1,D=N):(S[R>>0]=2,D=N+1|0,k=k+-1|0),_=_+12|0,(_|0)!=(l|0);)N=D,R=R+1|0;$=(o|0)==(l|0),P=(o|0)==(l|0),G=0,U=D;t:for(;;){D=e[t>>2]|0;do if(D){if((e[D+12>>2]|0)==(e[D+16>>2]|0)){if(g=0,D=ge(e[(e[D>>2]|0)+36>>2]|0,D|0)|0,K=g,g=0,K&1){_=5;break t}if((D|0)==-1){e[t>>2]=0,D=0;break}else{D=e[t>>2]|0;break}}}else D=0;while(!1);if(_=(D|0)==0,N=e[r>>2]|0,N){if((e[N+12>>2]|0)==(e[N+16>>2]|0)){if(g=0,D=ge(e[(e[N>>2]|0)+36>>2]|0,N|0)|0,K=g,g=0,K&1){_=5;break}(D|0)==-1&&(e[r>>2]=0,N=0)}}else N=0;if(R=(N|0)==0,D=e[t>>2]|0,!((k|0)!=0&(_^R))){_=64;break}if(N=e[D+12>>2]|0,(N|0)==(e[D+16>>2]|0)){if(g=0,D=ge(e[(e[D>>2]|0)+36>>2]|0,D|0)|0,K=g,g=0,K&1){_=5;break}}else D=F[N>>0]|0;if(D=D&255,!d&&(g=0,D=be(e[(e[c>>2]|0)+12>>2]|0,c|0,D|0)|0,K=g,g=0,K&1)){_=5;break}if(K=G+1|0,$)D=0,_=U;else for(R=0,H=o,_=U,U=C;;){do if((S[U>>0]|0)==1){if(S[H>>0]&1?N=e[H+8>>2]|0:N=H+1|0,N=S[N+G>>0]|0,!d&&(g=0,N=be(e[(e[c>>2]|0)+12>>2]|0,c|0,N|0)|0,Z=g,g=0,Z&1)){_=4;break t}if(D<<24>>24!=N<<24>>24){S[U>>0]=0,N=R,k=k+-1|0;break}N=S[H>>0]|0,N&1?N=e[H+4>>2]|0:N=(N&255)>>>1,(N|0)==(K|0)?(S[U>>0]=2,N=1,_=_+1|0,k=k+-1|0):N=1}else N=R;while(!1);if(H=H+12|0,(H|0)==(l|0)){D=N;break}else R=N,U=U+1|0}if(!D){G=K,U=_;continue}if(D=e[t>>2]|0,N=D+12|0,R=e[N>>2]|0,(R|0)==(e[D+16>>2]|0)){if(g=0,ge(e[(e[D>>2]|0)+40>>2]|0,D|0)|0,Z=g,g=0,Z&1){_=5;break}}else e[N>>2]=R+1;if((_+k|0)>>>0<2|P){G=K,U=_;continue}else D=o,R=_,_=C;for(;;)if((S[_>>0]|0)==2&&(N=S[D>>0]|0,N&1?N=e[D+4>>2]|0:N=(N&255)>>>1,(N|0)!=(K|0)&&(S[_>>0]=0,R=R+-1|0)),D=D+12|0,(D|0)==(l|0)){G=K,U=R;continue t}else _=_+1|0}if((_|0)==4){o=j()|0;break}else if((_|0)==5){o=j()|0;break}else if((_|0)==64){do if(D){if((e[D+12>>2]|0)==(e[D+16>>2]|0)){if(g=0,D=ge(e[(e[D>>2]|0)+36>>2]|0,D|0)|0,Z=g,g=0,Z&1){_=6;break e}if((D|0)==-1){e[t>>2]=0,D=0;break}else{D=e[t>>2]|0;break}}}else D=0;while(!1);k=(D|0)==0;do if(R)_=76;else{if((e[N+12>>2]|0)==(e[N+16>>2]|0)){if(g=0,D=ge(e[(e[N>>2]|0)+36>>2]|0,N|0)|0,Z=g,g=0,Z&1){_=6;break e}if((D|0)==-1){e[r>>2]=0,_=76;break}}k||(_=77)}while(!1);(_|0)==76&&k&&(_=77),(_|0)==77&&(e[h>>2]=e[h>>2]|2);t:do if((o|0)==(l|0))_=81;else for(;;){if((S[C>>0]|0)==2)break t;if(o=o+12|0,(o|0)==(l|0)){_=81;break}else C=C+1|0}while(!1);return(_|0)==81&&(e[h>>2]=e[h>>2]|4,o=l),w&&n0(w),b=O,o|0}}while(!1);return(_|0)==6&&(o=j()|0),w&&n0(w),le(o|0),0}function M4(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0,ce=0;Z=b,b=b+240|0,U=Z+202|0,d=Z+200|0,oe=Z+24|0,ie=Z+12|0,K=Z+8|0,P=Z+40|0,O=Z+4|0,G=Z,H=li(l)|0,qi(oe,l,U,d),e[ie>>2]=0,e[ie+4>>2]=0,e[ie+8>>2]=0,S[ie>>0]&1?t=(e[ie>>2]&-2)+-1|0:t=10,g=0,xe(8,ie|0,t|0,0),_=g,g=0;e:do if(_&1)ne=25;else{N=ie+8|0,R=ie+1|0,l=S[ie>>0]&1?e[N>>2]|0:R,e[K>>2]=l,e[O>>2]=P,e[G>>2]=0,_=ie+4|0,k=S[d>>0]|0,t=e[r>>2]|0;t:for(;;){if(t){if((e[t+12>>2]|0)==(e[t+16>>2]|0)){if(g=0,d=ge(e[(e[t>>2]|0)+36>>2]|0,t|0)|0,D=g,g=0,D&1){ne=24;break}(d|0)==-1&&(e[r>>2]=0,t=0)}}else t=0;w=(t|0)==0,d=e[o>>2]|0;do if(d){if((e[d+12>>2]|0)!=(e[d+16>>2]|0)){if(w)break;break t}if(g=0,C=ge(e[(e[d>>2]|0)+36>>2]|0,d|0)|0,D=g,g=0,D&1){ne=24;break t}if((C|0)!=-1){if(w)break;break t}else{e[o>>2]=0,ne=16;break}}else ne=16;while(!1);if((ne|0)==16)if(ne=0,w){d=0;break}else d=0;if(w=S[ie>>0]|0,w=w&1?e[_>>2]|0:(w&255)>>>1,(e[K>>2]|0)==(l+w|0)){if(g=0,xe(8,ie|0,w<<1|0,0),D=g,g=0,D&1){ne=24;break}if(S[ie>>0]&1?l=(e[ie>>2]&-2)+-1|0:l=10,g=0,xe(8,ie|0,l|0,0),D=g,g=0,D&1){ne=24;break}l=S[ie>>0]&1?e[N>>2]|0:R,e[K>>2]=l+w}if(C=t+12|0,w=e[C>>2]|0,D=t+16|0,(w|0)==(e[D>>2]|0)){if(g=0,w=ge(e[(e[t>>2]|0)+36>>2]|0,t|0)|0,ce=g,g=0,ce&1){ne=24;break}}else w=F[w>>0]|0;if(_i(w&255,H,l,K,G,k,oe,P,O,U)|0)break;if(d=e[C>>2]|0,(d|0)==(e[D>>2]|0))if(g=0,ge(e[(e[t>>2]|0)+40>>2]|0,t|0)|0,ce=g,g=0,ce&1){ne=24;break}else continue;else{e[C>>2]=d+1;continue}}if((ne|0)==24){t=j()|0;break}if(ce=S[oe>>0]|0,(ce&1?e[oe+4>>2]|0:(ce&255)>>>1)|0&&($=e[O>>2]|0,($-P|0)<160)&&(ce=e[G>>2]|0,e[O>>2]=$+4,e[$>>2]=ce),g=0,l=Pe(21,l|0,e[K>>2]|0,c|0,H|0)|0,ce=g,g=0,ce&1)ne=25;else{if(e[h>>2]=l,V0(oe,P,e[O>>2]|0,c),t){if((e[t+12>>2]|0)==(e[t+16>>2]|0)){if(g=0,l=ge(e[(e[t>>2]|0)+36>>2]|0,t|0)|0,ce=g,g=0,ce&1){ne=25;break}(l|0)==-1&&(e[r>>2]=0,t=0)}}else t=0;l=(t|0)==0;do if(d){if((e[d+12>>2]|0)==(e[d+16>>2]|0)){if(g=0,t=ge(e[(e[d>>2]|0)+36>>2]|0,d|0)|0,ce=g,g=0,ce&1){ne=25;break e}if((t|0)==-1){e[o>>2]=0,ne=49;break}}l||(ne=50)}else ne=49;while(!1);return(ne|0)==49&&l&&(ne=50),(ne|0)==50&&(e[c>>2]=e[c>>2]|2),ce=e[r>>2]|0,de(ie),de(oe),b=Z,ce|0}}while(!1);return(ne|0)==25&&(t=j()|0),de(ie),de(oe),le(t|0),0}function _4(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0,ce=0;Z=b,b=b+240|0,U=Z+202|0,d=Z+200|0,oe=Z+24|0,ie=Z+12|0,K=Z+8|0,P=Z+40|0,O=Z+4|0,G=Z,H=li(l)|0,qi(oe,l,U,d),e[ie>>2]=0,e[ie+4>>2]=0,e[ie+8>>2]=0,S[ie>>0]&1?t=(e[ie>>2]&-2)+-1|0:t=10,g=0,xe(8,ie|0,t|0,0),_=g,g=0;e:do if(_&1)ne=25;else{N=ie+8|0,R=ie+1|0,l=S[ie>>0]&1?e[N>>2]|0:R,e[K>>2]=l,e[O>>2]=P,e[G>>2]=0,_=ie+4|0,k=S[d>>0]|0,t=e[r>>2]|0;t:for(;;){if(t){if((e[t+12>>2]|0)==(e[t+16>>2]|0)){if(g=0,d=ge(e[(e[t>>2]|0)+36>>2]|0,t|0)|0,D=g,g=0,D&1){ne=24;break}(d|0)==-1&&(e[r>>2]=0,t=0)}}else t=0;d=(t|0)==0,w=e[o>>2]|0;do if(w){if((e[w+12>>2]|0)!=(e[w+16>>2]|0)){if(d)break;break t}if(g=0,C=ge(e[(e[w>>2]|0)+36>>2]|0,w|0)|0,D=g,g=0,D&1){ne=24;break t}if((C|0)!=-1){if(d)break;break t}else{e[o>>2]=0,ne=16;break}}else ne=16;while(!1);if((ne|0)==16)if(ne=0,d){w=0;break}else w=0;if(d=S[ie>>0]|0,d=d&1?e[_>>2]|0:(d&255)>>>1,(e[K>>2]|0)==(l+d|0)){if(g=0,xe(8,ie|0,d<<1|0,0),D=g,g=0,D&1){ne=24;break}if(S[ie>>0]&1?l=(e[ie>>2]&-2)+-1|0:l=10,g=0,xe(8,ie|0,l|0,0),D=g,g=0,D&1){ne=24;break}l=S[ie>>0]&1?e[N>>2]|0:R,e[K>>2]=l+d}if(C=t+12|0,d=e[C>>2]|0,D=t+16|0,(d|0)==(e[D>>2]|0)){if(g=0,d=ge(e[(e[t>>2]|0)+36>>2]|0,t|0)|0,ce=g,g=0,ce&1){ne=24;break}}else d=F[d>>0]|0;if(_i(d&255,H,l,K,G,k,oe,P,O,U)|0)break;if(d=e[C>>2]|0,(d|0)==(e[D>>2]|0))if(g=0,ge(e[(e[t>>2]|0)+40>>2]|0,t|0)|0,ce=g,g=0,ce&1){ne=24;break}else continue;else{e[C>>2]=d+1;continue}}if((ne|0)==24){t=j()|0;break}if(ce=S[oe>>0]|0,(ce&1?e[oe+4>>2]|0:(ce&255)>>>1)|0&&($=e[O>>2]|0,($-P|0)<160)&&(ce=e[G>>2]|0,e[O>>2]=$+4,e[$>>2]=ce),g=0,l=Pe(22,l|0,e[K>>2]|0,c|0,H|0)|0,d=ye,ce=g,g=0,ce&1)ne=25;else{if(ce=h,e[ce>>2]=l,e[ce+4>>2]=d,V0(oe,P,e[O>>2]|0,c),t){if((e[t+12>>2]|0)==(e[t+16>>2]|0)){if(g=0,l=ge(e[(e[t>>2]|0)+36>>2]|0,t|0)|0,ce=g,g=0,ce&1){ne=25;break}(l|0)==-1&&(e[r>>2]=0,t=0)}}else t=0;l=(t|0)==0;do if(w){if((e[w+12>>2]|0)==(e[w+16>>2]|0)){if(g=0,t=ge(e[(e[w>>2]|0)+36>>2]|0,w|0)|0,ce=g,g=0,ce&1){ne=25;break e}if((t|0)==-1){e[o>>2]=0,ne=49;break}}l||(ne=50)}else ne=49;while(!1);return(ne|0)==49&&l&&(ne=50),(ne|0)==50&&(e[c>>2]=e[c>>2]|2),ce=e[r>>2]|0,de(ie),de(oe),b=Z,ce|0}}while(!1);return(ne|0)==25&&(t=j()|0),de(ie),de(oe),le(t|0),0}function P4(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0,ce=0;Z=b,b=b+240|0,U=Z+202|0,d=Z+200|0,oe=Z+24|0,ie=Z+12|0,K=Z+8|0,P=Z+40|0,O=Z+4|0,G=Z,H=li(l)|0,qi(oe,l,U,d),e[ie>>2]=0,e[ie+4>>2]=0,e[ie+8>>2]=0,S[ie>>0]&1?t=(e[ie>>2]&-2)+-1|0:t=10,g=0,xe(8,ie|0,t|0,0),_=g,g=0;e:do if(_&1)ne=25;else{N=ie+8|0,R=ie+1|0,l=S[ie>>0]&1?e[N>>2]|0:R,e[K>>2]=l,e[O>>2]=P,e[G>>2]=0,_=ie+4|0,k=S[d>>0]|0,t=e[r>>2]|0;t:for(;;){if(t){if((e[t+12>>2]|0)==(e[t+16>>2]|0)){if(g=0,d=ge(e[(e[t>>2]|0)+36>>2]|0,t|0)|0,D=g,g=0,D&1){ne=24;break}(d|0)==-1&&(e[r>>2]=0,t=0)}}else t=0;w=(t|0)==0,d=e[o>>2]|0;do if(d){if((e[d+12>>2]|0)!=(e[d+16>>2]|0)){if(w)break;break t}if(g=0,C=ge(e[(e[d>>2]|0)+36>>2]|0,d|0)|0,D=g,g=0,D&1){ne=24;break t}if((C|0)!=-1){if(w)break;break t}else{e[o>>2]=0,ne=16;break}}else ne=16;while(!1);if((ne|0)==16)if(ne=0,w){d=0;break}else d=0;if(w=S[ie>>0]|0,w=w&1?e[_>>2]|0:(w&255)>>>1,(e[K>>2]|0)==(l+w|0)){if(g=0,xe(8,ie|0,w<<1|0,0),D=g,g=0,D&1){ne=24;break}if(S[ie>>0]&1?l=(e[ie>>2]&-2)+-1|0:l=10,g=0,xe(8,ie|0,l|0,0),D=g,g=0,D&1){ne=24;break}l=S[ie>>0]&1?e[N>>2]|0:R,e[K>>2]=l+w}if(C=t+12|0,w=e[C>>2]|0,D=t+16|0,(w|0)==(e[D>>2]|0)){if(g=0,w=ge(e[(e[t>>2]|0)+36>>2]|0,t|0)|0,ce=g,g=0,ce&1){ne=24;break}}else w=F[w>>0]|0;if(_i(w&255,H,l,K,G,k,oe,P,O,U)|0)break;if(d=e[C>>2]|0,(d|0)==(e[D>>2]|0))if(g=0,ge(e[(e[t>>2]|0)+40>>2]|0,t|0)|0,ce=g,g=0,ce&1){ne=24;break}else continue;else{e[C>>2]=d+1;continue}}if((ne|0)==24){t=j()|0;break}if(ce=S[oe>>0]|0,(ce&1?e[oe+4>>2]|0:(ce&255)>>>1)|0&&($=e[O>>2]|0,($-P|0)<160)&&(ce=e[G>>2]|0,e[O>>2]=$+4,e[$>>2]=ce),g=0,l=Pe(23,l|0,e[K>>2]|0,c|0,H|0)|0,ce=g,g=0,ce&1)ne=25;else{if(I[h>>1]=l,V0(oe,P,e[O>>2]|0,c),t){if((e[t+12>>2]|0)==(e[t+16>>2]|0)){if(g=0,l=ge(e[(e[t>>2]|0)+36>>2]|0,t|0)|0,ce=g,g=0,ce&1){ne=25;break}(l|0)==-1&&(e[r>>2]=0,t=0)}}else t=0;l=(t|0)==0;do if(d){if((e[d+12>>2]|0)==(e[d+16>>2]|0)){if(g=0,t=ge(e[(e[d>>2]|0)+36>>2]|0,d|0)|0,ce=g,g=0,ce&1){ne=25;break e}if((t|0)==-1){e[o>>2]=0,ne=49;break}}l||(ne=50)}else ne=49;while(!1);return(ne|0)==49&&l&&(ne=50),(ne|0)==50&&(e[c>>2]=e[c>>2]|2),ce=e[r>>2]|0,de(ie),de(oe),b=Z,ce|0}}while(!1);return(ne|0)==25&&(t=j()|0),de(ie),de(oe),le(t|0),0}function L4(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0,ce=0;Z=b,b=b+240|0,U=Z+202|0,d=Z+200|0,oe=Z+24|0,ie=Z+12|0,K=Z+8|0,P=Z+40|0,O=Z+4|0,G=Z,H=li(l)|0,qi(oe,l,U,d),e[ie>>2]=0,e[ie+4>>2]=0,e[ie+8>>2]=0,S[ie>>0]&1?t=(e[ie>>2]&-2)+-1|0:t=10,g=0,xe(8,ie|0,t|0,0),_=g,g=0;e:do if(_&1)ne=25;else{N=ie+8|0,R=ie+1|0,l=S[ie>>0]&1?e[N>>2]|0:R,e[K>>2]=l,e[O>>2]=P,e[G>>2]=0,_=ie+4|0,k=S[d>>0]|0,t=e[r>>2]|0;t:for(;;){if(t){if((e[t+12>>2]|0)==(e[t+16>>2]|0)){if(g=0,d=ge(e[(e[t>>2]|0)+36>>2]|0,t|0)|0,D=g,g=0,D&1){ne=24;break}(d|0)==-1&&(e[r>>2]=0,t=0)}}else t=0;w=(t|0)==0,d=e[o>>2]|0;do if(d){if((e[d+12>>2]|0)!=(e[d+16>>2]|0)){if(w)break;break t}if(g=0,C=ge(e[(e[d>>2]|0)+36>>2]|0,d|0)|0,D=g,g=0,D&1){ne=24;break t}if((C|0)!=-1){if(w)break;break t}else{e[o>>2]=0,ne=16;break}}else ne=16;while(!1);if((ne|0)==16)if(ne=0,w){d=0;break}else d=0;if(w=S[ie>>0]|0,w=w&1?e[_>>2]|0:(w&255)>>>1,(e[K>>2]|0)==(l+w|0)){if(g=0,xe(8,ie|0,w<<1|0,0),D=g,g=0,D&1){ne=24;break}if(S[ie>>0]&1?l=(e[ie>>2]&-2)+-1|0:l=10,g=0,xe(8,ie|0,l|0,0),D=g,g=0,D&1){ne=24;break}l=S[ie>>0]&1?e[N>>2]|0:R,e[K>>2]=l+w}if(C=t+12|0,w=e[C>>2]|0,D=t+16|0,(w|0)==(e[D>>2]|0)){if(g=0,w=ge(e[(e[t>>2]|0)+36>>2]|0,t|0)|0,ce=g,g=0,ce&1){ne=24;break}}else w=F[w>>0]|0;if(_i(w&255,H,l,K,G,k,oe,P,O,U)|0)break;if(d=e[C>>2]|0,(d|0)==(e[D>>2]|0))if(g=0,ge(e[(e[t>>2]|0)+40>>2]|0,t|0)|0,ce=g,g=0,ce&1){ne=24;break}else continue;else{e[C>>2]=d+1;continue}}if((ne|0)==24){t=j()|0;break}if(ce=S[oe>>0]|0,(ce&1?e[oe+4>>2]|0:(ce&255)>>>1)|0&&($=e[O>>2]|0,($-P|0)<160)&&(ce=e[G>>2]|0,e[O>>2]=$+4,e[$>>2]=ce),g=0,l=Pe(24,l|0,e[K>>2]|0,c|0,H|0)|0,ce=g,g=0,ce&1)ne=25;else{if(e[h>>2]=l,V0(oe,P,e[O>>2]|0,c),t){if((e[t+12>>2]|0)==(e[t+16>>2]|0)){if(g=0,l=ge(e[(e[t>>2]|0)+36>>2]|0,t|0)|0,ce=g,g=0,ce&1){ne=25;break}(l|0)==-1&&(e[r>>2]=0,t=0)}}else t=0;l=(t|0)==0;do if(d){if((e[d+12>>2]|0)==(e[d+16>>2]|0)){if(g=0,t=ge(e[(e[d>>2]|0)+36>>2]|0,d|0)|0,ce=g,g=0,ce&1){ne=25;break e}if((t|0)==-1){e[o>>2]=0,ne=49;break}}l||(ne=50)}else ne=49;while(!1);return(ne|0)==49&&l&&(ne=50),(ne|0)==50&&(e[c>>2]=e[c>>2]|2),ce=e[r>>2]|0,de(ie),de(oe),b=Z,ce|0}}while(!1);return(ne|0)==25&&(t=j()|0),de(ie),de(oe),le(t|0),0}function O4(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0,ce=0;Z=b,b=b+240|0,U=Z+202|0,d=Z+200|0,oe=Z+24|0,ie=Z+12|0,K=Z+8|0,P=Z+40|0,O=Z+4|0,G=Z,H=li(l)|0,qi(oe,l,U,d),e[ie>>2]=0,e[ie+4>>2]=0,e[ie+8>>2]=0,S[ie>>0]&1?t=(e[ie>>2]&-2)+-1|0:t=10,g=0,xe(8,ie|0,t|0,0),_=g,g=0;e:do if(_&1)ne=25;else{N=ie+8|0,R=ie+1|0,l=S[ie>>0]&1?e[N>>2]|0:R,e[K>>2]=l,e[O>>2]=P,e[G>>2]=0,_=ie+4|0,k=S[d>>0]|0,t=e[r>>2]|0;t:for(;;){if(t){if((e[t+12>>2]|0)==(e[t+16>>2]|0)){if(g=0,d=ge(e[(e[t>>2]|0)+36>>2]|0,t|0)|0,D=g,g=0,D&1){ne=24;break}(d|0)==-1&&(e[r>>2]=0,t=0)}}else t=0;w=(t|0)==0,d=e[o>>2]|0;do if(d){if((e[d+12>>2]|0)!=(e[d+16>>2]|0)){if(w)break;break t}if(g=0,C=ge(e[(e[d>>2]|0)+36>>2]|0,d|0)|0,D=g,g=0,D&1){ne=24;break t}if((C|0)!=-1){if(w)break;break t}else{e[o>>2]=0,ne=16;break}}else ne=16;while(!1);if((ne|0)==16)if(ne=0,w){d=0;break}else d=0;if(w=S[ie>>0]|0,w=w&1?e[_>>2]|0:(w&255)>>>1,(e[K>>2]|0)==(l+w|0)){if(g=0,xe(8,ie|0,w<<1|0,0),D=g,g=0,D&1){ne=24;break}if(S[ie>>0]&1?l=(e[ie>>2]&-2)+-1|0:l=10,g=0,xe(8,ie|0,l|0,0),D=g,g=0,D&1){ne=24;break}l=S[ie>>0]&1?e[N>>2]|0:R,e[K>>2]=l+w}if(C=t+12|0,w=e[C>>2]|0,D=t+16|0,(w|0)==(e[D>>2]|0)){if(g=0,w=ge(e[(e[t>>2]|0)+36>>2]|0,t|0)|0,ce=g,g=0,ce&1){ne=24;break}}else w=F[w>>0]|0;if(_i(w&255,H,l,K,G,k,oe,P,O,U)|0)break;if(d=e[C>>2]|0,(d|0)==(e[D>>2]|0))if(g=0,ge(e[(e[t>>2]|0)+40>>2]|0,t|0)|0,ce=g,g=0,ce&1){ne=24;break}else continue;else{e[C>>2]=d+1;continue}}if((ne|0)==24){t=j()|0;break}if(ce=S[oe>>0]|0,(ce&1?e[oe+4>>2]|0:(ce&255)>>>1)|0&&($=e[O>>2]|0,($-P|0)<160)&&(ce=e[G>>2]|0,e[O>>2]=$+4,e[$>>2]=ce),g=0,l=Pe(25,l|0,e[K>>2]|0,c|0,H|0)|0,ce=g,g=0,ce&1)ne=25;else{if(e[h>>2]=l,V0(oe,P,e[O>>2]|0,c),t){if((e[t+12>>2]|0)==(e[t+16>>2]|0)){if(g=0,l=ge(e[(e[t>>2]|0)+36>>2]|0,t|0)|0,ce=g,g=0,ce&1){ne=25;break}(l|0)==-1&&(e[r>>2]=0,t=0)}}else t=0;l=(t|0)==0;do if(d){if((e[d+12>>2]|0)==(e[d+16>>2]|0)){if(g=0,t=ge(e[(e[d>>2]|0)+36>>2]|0,d|0)|0,ce=g,g=0,ce&1){ne=25;break e}if((t|0)==-1){e[o>>2]=0,ne=49;break}}l||(ne=50)}else ne=49;while(!1);return(ne|0)==49&&l&&(ne=50),(ne|0)==50&&(e[c>>2]=e[c>>2]|2),ce=e[r>>2]|0,de(ie),de(oe),b=Z,ce|0}}while(!1);return(ne|0)==25&&(t=j()|0),de(ie),de(oe),le(t|0),0}function $4(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0,ce=0;Z=b,b=b+240|0,U=Z+202|0,d=Z+200|0,oe=Z+24|0,ie=Z+12|0,K=Z+8|0,P=Z+40|0,O=Z+4|0,G=Z,H=li(l)|0,qi(oe,l,U,d),e[ie>>2]=0,e[ie+4>>2]=0,e[ie+8>>2]=0,S[ie>>0]&1?t=(e[ie>>2]&-2)+-1|0:t=10,g=0,xe(8,ie|0,t|0,0),_=g,g=0;e:do if(_&1)ne=25;else{N=ie+8|0,R=ie+1|0,l=S[ie>>0]&1?e[N>>2]|0:R,e[K>>2]=l,e[O>>2]=P,e[G>>2]=0,_=ie+4|0,k=S[d>>0]|0,t=e[r>>2]|0;t:for(;;){if(t){if((e[t+12>>2]|0)==(e[t+16>>2]|0)){if(g=0,d=ge(e[(e[t>>2]|0)+36>>2]|0,t|0)|0,D=g,g=0,D&1){ne=24;break}(d|0)==-1&&(e[r>>2]=0,t=0)}}else t=0;d=(t|0)==0,w=e[o>>2]|0;do if(w){if((e[w+12>>2]|0)!=(e[w+16>>2]|0)){if(d)break;break t}if(g=0,C=ge(e[(e[w>>2]|0)+36>>2]|0,w|0)|0,D=g,g=0,D&1){ne=24;break t}if((C|0)!=-1){if(d)break;break t}else{e[o>>2]=0,ne=16;break}}else ne=16;while(!1);if((ne|0)==16)if(ne=0,d){w=0;break}else w=0;if(d=S[ie>>0]|0,d=d&1?e[_>>2]|0:(d&255)>>>1,(e[K>>2]|0)==(l+d|0)){if(g=0,xe(8,ie|0,d<<1|0,0),D=g,g=0,D&1){ne=24;break}if(S[ie>>0]&1?l=(e[ie>>2]&-2)+-1|0:l=10,g=0,xe(8,ie|0,l|0,0),D=g,g=0,D&1){ne=24;break}l=S[ie>>0]&1?e[N>>2]|0:R,e[K>>2]=l+d}if(C=t+12|0,d=e[C>>2]|0,D=t+16|0,(d|0)==(e[D>>2]|0)){if(g=0,d=ge(e[(e[t>>2]|0)+36>>2]|0,t|0)|0,ce=g,g=0,ce&1){ne=24;break}}else d=F[d>>0]|0;if(_i(d&255,H,l,K,G,k,oe,P,O,U)|0)break;if(d=e[C>>2]|0,(d|0)==(e[D>>2]|0))if(g=0,ge(e[(e[t>>2]|0)+40>>2]|0,t|0)|0,ce=g,g=0,ce&1){ne=24;break}else continue;else{e[C>>2]=d+1;continue}}if((ne|0)==24){t=j()|0;break}if(ce=S[oe>>0]|0,(ce&1?e[oe+4>>2]|0:(ce&255)>>>1)|0&&($=e[O>>2]|0,($-P|0)<160)&&(ce=e[G>>2]|0,e[O>>2]=$+4,e[$>>2]=ce),g=0,l=Pe(26,l|0,e[K>>2]|0,c|0,H|0)|0,d=ye,ce=g,g=0,ce&1)ne=25;else{if(ce=h,e[ce>>2]=l,e[ce+4>>2]=d,V0(oe,P,e[O>>2]|0,c),t){if((e[t+12>>2]|0)==(e[t+16>>2]|0)){if(g=0,l=ge(e[(e[t>>2]|0)+36>>2]|0,t|0)|0,ce=g,g=0,ce&1){ne=25;break}(l|0)==-1&&(e[r>>2]=0,t=0)}}else t=0;l=(t|0)==0;do if(w){if((e[w+12>>2]|0)==(e[w+16>>2]|0)){if(g=0,t=ge(e[(e[w>>2]|0)+36>>2]|0,w|0)|0,ce=g,g=0,ce&1){ne=25;break e}if((t|0)==-1){e[o>>2]=0,ne=49;break}}l||(ne=50)}else ne=49;while(!1);return(ne|0)==49&&l&&(ne=50),(ne|0)==50&&(e[c>>2]=e[c>>2]|2),ce=e[r>>2]|0,de(ie),de(oe),b=Z,ce|0}}while(!1);return(ne|0)==25&&(t=j()|0),de(ie),de(oe),le(t|0),0}function B4(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0,ce=0,ke=0,Ee=0,Te=0;ne=b,b=b+240|0,K=ne+208|0,w=ne+203|0,C=ne+202|0,ke=ne+24|0,ce=ne+12|0,$=ne+8|0,ie=ne+40|0,oe=ne+4|0,P=ne,O=ne+201|0,G=ne+200|0,Ar(ke,l,K,w,C),e[ce>>2]=0,e[ce+4>>2]=0,e[ce+8>>2]=0,S[ce>>0]&1?t=(e[ce>>2]&-2)+-1|0:t=10,g=0,xe(8,ce|0,t|0,0),H=g,g=0;e:do if(H&1)Ee=25;else{_=ce+8|0,U=ce+1|0,l=S[ce>>0]&1?e[_>>2]|0:U,e[$>>2]=l,e[oe>>2]=ie,e[P>>2]=0,S[O>>0]=1,S[G>>0]=69,H=ce+4|0,R=S[w>>0]|0,N=S[C>>0]|0,t=e[r>>2]|0;t:for(;;){if(t){if((e[t+12>>2]|0)==(e[t+16>>2]|0)){if(g=0,w=ge(e[(e[t>>2]|0)+36>>2]|0,t|0)|0,k=g,g=0,k&1){Ee=24;break}(w|0)==-1&&(e[r>>2]=0,t=0)}}else t=0;C=(t|0)==0,w=e[o>>2]|0;do if(w){if((e[w+12>>2]|0)!=(e[w+16>>2]|0)){if(C)break;break t}if(g=0,D=ge(e[(e[w>>2]|0)+36>>2]|0,w|0)|0,k=g,g=0,k&1){Ee=24;break t}if((D|0)!=-1){if(C)break;break t}else{e[o>>2]=0,Ee=16;break}}else Ee=16;while(!1);if((Ee|0)==16)if(Ee=0,C){w=0;break}else w=0;if(C=S[ce>>0]|0,C=C&1?e[H>>2]|0:(C&255)>>>1,(e[$>>2]|0)==(l+C|0)){if(g=0,xe(8,ce|0,C<<1|0,0),k=g,g=0,k&1){Ee=24;break}if(S[ce>>0]&1?l=(e[ce>>2]&-2)+-1|0:l=10,g=0,xe(8,ce|0,l|0,0),k=g,g=0,k&1){Ee=24;break}l=S[ce>>0]&1?e[_>>2]|0:U,e[$>>2]=l+C}if(D=t+12|0,C=e[D>>2]|0,k=t+16|0,(C|0)==(e[k>>2]|0)){if(g=0,C=ge(e[(e[t>>2]|0)+36>>2]|0,t|0)|0,Te=g,g=0,Te&1){Ee=24;break}}else C=F[C>>0]|0;if(vr(C&255,O,G,l,$,R,N,ke,ie,oe,P,K)|0)break;if(w=e[D>>2]|0,(w|0)==(e[k>>2]|0))if(g=0,ge(e[(e[t>>2]|0)+40>>2]|0,t|0)|0,Te=g,g=0,Te&1){Ee=24;break}else continue;else{e[D>>2]=w+1;continue}}if((Ee|0)==24){t=j()|0;break}if(Te=S[ke>>0]|0,!(!(S[O>>0]|0)||!((Te&1?e[ke+4>>2]|0:(Te&255)>>>1)|0))&&(Z=e[oe>>2]|0,(Z-ie|0)<160)&&(Te=e[P>>2]|0,e[oe>>2]=Z+4,e[Z>>2]=Te),g=0,d=+lt(1,l|0,e[$>>2]|0,c|0),Te=g,g=0,Te&1)Ee=25;else{if(V[h>>2]=d,V0(ke,ie,e[oe>>2]|0,c),t){if((e[t+12>>2]|0)==(e[t+16>>2]|0)){if(g=0,l=ge(e[(e[t>>2]|0)+36>>2]|0,t|0)|0,Te=g,g=0,Te&1){Ee=25;break}(l|0)==-1&&(e[r>>2]=0,t=0)}}else t=0;l=(t|0)==0;do if(w){if((e[w+12>>2]|0)==(e[w+16>>2]|0)){if(g=0,t=ge(e[(e[w>>2]|0)+36>>2]|0,w|0)|0,Te=g,g=0,Te&1){Ee=25;break e}if((t|0)==-1){e[o>>2]=0,Ee=49;break}}l||(Ee=50)}else Ee=49;while(!1);return(Ee|0)==49&&l&&(Ee=50),(Ee|0)==50&&(e[c>>2]=e[c>>2]|2),Te=e[r>>2]|0,de(ce),de(ke),b=ne,Te|0}}while(!1);return(Ee|0)==25&&(t=j()|0),de(ce),de(ke),le(t|0),0}function V4(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0,ce=0,ke=0,Ee=0,Te=0;ne=b,b=b+240|0,K=ne+208|0,w=ne+203|0,C=ne+202|0,ke=ne+24|0,ce=ne+12|0,$=ne+8|0,ie=ne+40|0,oe=ne+4|0,P=ne,O=ne+201|0,G=ne+200|0,Ar(ke,l,K,w,C),e[ce>>2]=0,e[ce+4>>2]=0,e[ce+8>>2]=0,S[ce>>0]&1?t=(e[ce>>2]&-2)+-1|0:t=10,g=0,xe(8,ce|0,t|0,0),H=g,g=0;e:do if(H&1)Ee=25;else{_=ce+8|0,U=ce+1|0,l=S[ce>>0]&1?e[_>>2]|0:U,e[$>>2]=l,e[oe>>2]=ie,e[P>>2]=0,S[O>>0]=1,S[G>>0]=69,H=ce+4|0,R=S[w>>0]|0,N=S[C>>0]|0,t=e[r>>2]|0;t:for(;;){if(t){if((e[t+12>>2]|0)==(e[t+16>>2]|0)){if(g=0,w=ge(e[(e[t>>2]|0)+36>>2]|0,t|0)|0,k=g,g=0,k&1){Ee=24;break}(w|0)==-1&&(e[r>>2]=0,t=0)}}else t=0;C=(t|0)==0,w=e[o>>2]|0;do if(w){if((e[w+12>>2]|0)!=(e[w+16>>2]|0)){if(C)break;break t}if(g=0,D=ge(e[(e[w>>2]|0)+36>>2]|0,w|0)|0,k=g,g=0,k&1){Ee=24;break t}if((D|0)!=-1){if(C)break;break t}else{e[o>>2]=0,Ee=16;break}}else Ee=16;while(!1);if((Ee|0)==16)if(Ee=0,C){w=0;break}else w=0;if(C=S[ce>>0]|0,C=C&1?e[H>>2]|0:(C&255)>>>1,(e[$>>2]|0)==(l+C|0)){if(g=0,xe(8,ce|0,C<<1|0,0),k=g,g=0,k&1){Ee=24;break}if(S[ce>>0]&1?l=(e[ce>>2]&-2)+-1|0:l=10,g=0,xe(8,ce|0,l|0,0),k=g,g=0,k&1){Ee=24;break}l=S[ce>>0]&1?e[_>>2]|0:U,e[$>>2]=l+C}if(D=t+12|0,C=e[D>>2]|0,k=t+16|0,(C|0)==(e[k>>2]|0)){if(g=0,C=ge(e[(e[t>>2]|0)+36>>2]|0,t|0)|0,Te=g,g=0,Te&1){Ee=24;break}}else C=F[C>>0]|0;if(vr(C&255,O,G,l,$,R,N,ke,ie,oe,P,K)|0)break;if(w=e[D>>2]|0,(w|0)==(e[k>>2]|0))if(g=0,ge(e[(e[t>>2]|0)+40>>2]|0,t|0)|0,Te=g,g=0,Te&1){Ee=24;break}else continue;else{e[D>>2]=w+1;continue}}if((Ee|0)==24){t=j()|0;break}if(Te=S[ke>>0]|0,!(!(S[O>>0]|0)||!((Te&1?e[ke+4>>2]|0:(Te&255)>>>1)|0))&&(Z=e[oe>>2]|0,(Z-ie|0)<160)&&(Te=e[P>>2]|0,e[oe>>2]=Z+4,e[Z>>2]=Te),g=0,d=+lt(2,l|0,e[$>>2]|0,c|0),Te=g,g=0,Te&1)Ee=25;else{if(B[h>>3]=d,V0(ke,ie,e[oe>>2]|0,c),t){if((e[t+12>>2]|0)==(e[t+16>>2]|0)){if(g=0,l=ge(e[(e[t>>2]|0)+36>>2]|0,t|0)|0,Te=g,g=0,Te&1){Ee=25;break}(l|0)==-1&&(e[r>>2]=0,t=0)}}else t=0;l=(t|0)==0;do if(w){if((e[w+12>>2]|0)==(e[w+16>>2]|0)){if(g=0,t=ge(e[(e[w>>2]|0)+36>>2]|0,w|0)|0,Te=g,g=0,Te&1){Ee=25;break e}if((t|0)==-1){e[o>>2]=0,Ee=49;break}}l||(Ee=50)}else Ee=49;while(!1);return(Ee|0)==49&&l&&(Ee=50),(Ee|0)==50&&(e[c>>2]=e[c>>2]|2),Te=e[r>>2]|0,de(ce),de(ke),b=ne,Te|0}}while(!1);return(Ee|0)==25&&(t=j()|0),de(ce),de(ke),le(t|0),0}function U4(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0,ce=0,ke=0,Ee=0,Te=0;ne=b,b=b+240|0,K=ne+208|0,w=ne+203|0,C=ne+202|0,ke=ne+24|0,ce=ne+12|0,$=ne+8|0,ie=ne+40|0,oe=ne+4|0,P=ne,O=ne+201|0,G=ne+200|0,Ar(ke,l,K,w,C),e[ce>>2]=0,e[ce+4>>2]=0,e[ce+8>>2]=0,S[ce>>0]&1?t=(e[ce>>2]&-2)+-1|0:t=10,g=0,xe(8,ce|0,t|0,0),H=g,g=0;e:do if(H&1)Ee=25;else{_=ce+8|0,U=ce+1|0,l=S[ce>>0]&1?e[_>>2]|0:U,e[$>>2]=l,e[oe>>2]=ie,e[P>>2]=0,S[O>>0]=1,S[G>>0]=69,H=ce+4|0,R=S[w>>0]|0,N=S[C>>0]|0,t=e[r>>2]|0;t:for(;;){if(t){if((e[t+12>>2]|0)==(e[t+16>>2]|0)){if(g=0,w=ge(e[(e[t>>2]|0)+36>>2]|0,t|0)|0,k=g,g=0,k&1){Ee=24;break}(w|0)==-1&&(e[r>>2]=0,t=0)}}else t=0;C=(t|0)==0,w=e[o>>2]|0;do if(w){if((e[w+12>>2]|0)!=(e[w+16>>2]|0)){if(C)break;break t}if(g=0,D=ge(e[(e[w>>2]|0)+36>>2]|0,w|0)|0,k=g,g=0,k&1){Ee=24;break t}if((D|0)!=-1){if(C)break;break t}else{e[o>>2]=0,Ee=16;break}}else Ee=16;while(!1);if((Ee|0)==16)if(Ee=0,C){w=0;break}else w=0;if(C=S[ce>>0]|0,C=C&1?e[H>>2]|0:(C&255)>>>1,(e[$>>2]|0)==(l+C|0)){if(g=0,xe(8,ce|0,C<<1|0,0),k=g,g=0,k&1){Ee=24;break}if(S[ce>>0]&1?l=(e[ce>>2]&-2)+-1|0:l=10,g=0,xe(8,ce|0,l|0,0),k=g,g=0,k&1){Ee=24;break}l=S[ce>>0]&1?e[_>>2]|0:U,e[$>>2]=l+C}if(D=t+12|0,C=e[D>>2]|0,k=t+16|0,(C|0)==(e[k>>2]|0)){if(g=0,C=ge(e[(e[t>>2]|0)+36>>2]|0,t|0)|0,Te=g,g=0,Te&1){Ee=24;break}}else C=F[C>>0]|0;if(vr(C&255,O,G,l,$,R,N,ke,ie,oe,P,K)|0)break;if(w=e[D>>2]|0,(w|0)==(e[k>>2]|0))if(g=0,ge(e[(e[t>>2]|0)+40>>2]|0,t|0)|0,Te=g,g=0,Te&1){Ee=24;break}else continue;else{e[D>>2]=w+1;continue}}if((Ee|0)==24){t=j()|0;break}if(Te=S[ke>>0]|0,!(!(S[O>>0]|0)||!((Te&1?e[ke+4>>2]|0:(Te&255)>>>1)|0))&&(Z=e[oe>>2]|0,(Z-ie|0)<160)&&(Te=e[P>>2]|0,e[oe>>2]=Z+4,e[Z>>2]=Te),g=0,d=+lt(3,l|0,e[$>>2]|0,c|0),Te=g,g=0,Te&1)Ee=25;else{if(B[h>>3]=d,V0(ke,ie,e[oe>>2]|0,c),t){if((e[t+12>>2]|0)==(e[t+16>>2]|0)){if(g=0,l=ge(e[(e[t>>2]|0)+36>>2]|0,t|0)|0,Te=g,g=0,Te&1){Ee=25;break}(l|0)==-1&&(e[r>>2]=0,t=0)}}else t=0;l=(t|0)==0;do if(w){if((e[w+12>>2]|0)==(e[w+16>>2]|0)){if(g=0,t=ge(e[(e[w>>2]|0)+36>>2]|0,w|0)|0,Te=g,g=0,Te&1){Ee=25;break e}if((t|0)==-1){e[o>>2]=0,Ee=49;break}}l||(Ee=50)}else Ee=49;while(!1);return(Ee|0)==49&&l&&(Ee=50),(Ee|0)==50&&(e[c>>2]=e[c>>2]|2),Te=e[r>>2]|0,de(ce),de(ke),b=ne,Te|0}}while(!1);return(Ee|0)==25&&(t=j()|0),de(ce),de(ke),le(t|0),0}function z4(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0;return c=b,b=b+16|0,h=c,e[h>>2]=l,l=ai(r)|0,r=Lo(t,o,h)|0,l|0&&(g=0,ge(75,l|0)|0,h=g,g=0,h&1)&&(h=j(0)|0,$t(h)),b=c,r|0}function An(t,r,o,l,c,h,d){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0;var w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0,G=0,$=0,P=0,O=0,Z=0;O=b,b=b+112|0,C=O,k=(l-o|0)/12|0;do if(k>>>0>100){if(C=E0(k)|0,!(C|0)&&(g=0,Nt(6),P=g,g=0,P&1)){w=0,R=6;break}w=C,R=11}else w=0,R=11;while(!1);e:do if((R|0)==11){if((o|0)==(l|0))D=0;else for(_=o,N=0,R=C;D=S[_>>0]|0,D&1?D=e[_+4>>2]|0:D=(D&255)>>>1,D?(S[R>>0]=1,D=N):(S[R>>0]=2,D=N+1|0,k=k+-1|0),_=_+12|0,(_|0)!=(l|0);)N=D,R=R+1|0;$=(o|0)==(l|0),P=(o|0)==(l|0),G=0,U=k;t:for(;;){k=e[t>>2]|0;do if(k){if(N=e[k+12>>2]|0,(N|0)==(e[k+16>>2]|0)){if(g=0,k=ge(e[(e[k>>2]|0)+36>>2]|0,k|0)|0,K=g,g=0,K&1){R=5;break t}}else k=e[N>>2]|0;if((k|0)==-1){e[t>>2]=0,_=1;break}else{_=(e[t>>2]|0)==0;break}}else _=1;while(!1);if(N=e[r>>2]|0,N){if(k=e[N+12>>2]|0,(k|0)==(e[N+16>>2]|0)){if(g=0,k=ge(e[(e[N>>2]|0)+36>>2]|0,N|0)|0,K=g,g=0,K&1){R=5;break}}else k=e[k>>2]|0;(k|0)==-1?(e[r>>2]=0,N=0,R=1):R=0}else N=0,R=1;if(k=e[t>>2]|0,!((U|0)!=0&(_^R))){R=66;break}if(N=e[k+12>>2]|0,(N|0)==(e[k+16>>2]|0)){if(g=0,k=ge(e[(e[k>>2]|0)+36>>2]|0,k|0)|0,K=g,g=0,K&1){R=5;break}}else k=e[N>>2]|0;if(!d&&(g=0,k=be(e[(e[c>>2]|0)+28>>2]|0,c|0,k|0)|0,K=g,g=0,K&1)){R=5;break}if(K=G+1|0,$)k=0,_=U;else for(_=0,H=o,R=U,U=C;;){do if((S[U>>0]|0)==1){if(S[H>>0]&1?N=e[H+8>>2]|0:N=H+4|0,N=e[N+(G<<2)>>2]|0,!d&&(g=0,N=be(e[(e[c>>2]|0)+28>>2]|0,c|0,N|0)|0,Z=g,g=0,Z&1)){R=4;break t}if((k|0)!=(N|0)){S[U>>0]=0,N=_,R=R+-1|0;break}N=S[H>>0]|0,N&1?N=e[H+4>>2]|0:N=(N&255)>>>1,(N|0)==(K|0)?(S[U>>0]=2,N=1,D=D+1|0,R=R+-1|0):N=1}else N=_;while(!1);if(H=H+12|0,(H|0)==(l|0)){k=N,_=R;break}else _=N,U=U+1|0}if(!k){G=K,U=_;continue}if(k=e[t>>2]|0,N=k+12|0,R=e[N>>2]|0,(R|0)==(e[k+16>>2]|0)){if(g=0,ge(e[(e[k>>2]|0)+40>>2]|0,k|0)|0,Z=g,g=0,Z&1){R=5;break}}else e[N>>2]=R+4;if((D+_|0)>>>0<2|P){G=K,U=_;continue}else k=o,R=C;for(;;)if((S[R>>0]|0)==2&&(N=S[k>>0]|0,N&1?N=e[k+4>>2]|0:N=(N&255)>>>1,(N|0)!=(K|0)&&(S[R>>0]=0,D=D+-1|0)),k=k+12|0,(k|0)==(l|0)){G=K,U=_;continue t}else R=R+1|0}if((R|0)==4){o=j()|0;break}else if((R|0)==5){o=j()|0;break}else if((R|0)==66){do if(k){if(D=e[k+12>>2]|0,(D|0)==(e[k+16>>2]|0)){if(g=0,D=ge(e[(e[k>>2]|0)+36>>2]|0,k|0)|0,Z=g,g=0,Z&1){R=6;break e}}else D=e[D>>2]|0;if((D|0)==-1){e[t>>2]=0,k=1;break}else{k=(e[t>>2]|0)==0;break}}else k=1;while(!1);do if(N){if(D=e[N+12>>2]|0,(D|0)==(e[N+16>>2]|0)){if(g=0,D=ge(e[(e[N>>2]|0)+36>>2]|0,N|0)|0,Z=g,g=0,Z&1){R=6;break e}}else D=e[D>>2]|0;if((D|0)!=-1){if(k)break;R=81;break}else{e[r>>2]=0,R=79;break}}else R=79;while(!1);(R|0)==79&&k&&(R=81),(R|0)==81&&(e[h>>2]=e[h>>2]|2);t:do if((o|0)==(l|0))R=85;else for(;;){if((S[C>>0]|0)==2)break t;if(o=o+12|0,(o|0)==(l|0)){R=85;break}else C=C+1|0}while(!1);return(R|0)==85&&(e[h>>2]=e[h>>2]|4,o=l),w&&n0(w),b=O,o|0}}while(!1);return(R|0)==6&&(o=j()|0),w&&n0(w),le(o|0),0}function G4(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0,ce=0;Z=b,b=b+320|0,U=Z+208|0,d=Z+200|0,oe=Z+24|0,ie=Z+12|0,K=Z+8|0,P=Z+40|0,O=Z+4|0,G=Z,H=li(l)|0,Wi(oe,l,U,d),e[ie>>2]=0,e[ie+4>>2]=0,e[ie+8>>2]=0,S[ie>>0]&1?t=(e[ie>>2]&-2)+-1|0:t=10,g=0,xe(8,ie|0,t|0,0),_=g,g=0;e:do if(_&1)ne=26;else{N=ie+8|0,R=ie+1|0,t=S[ie>>0]&1?e[N>>2]|0:R,e[K>>2]=t,e[O>>2]=P,e[G>>2]=0,_=ie+4|0,k=e[d>>2]|0,d=e[r>>2]|0;t:for(;;){if(d){if(l=e[d+12>>2]|0,(l|0)==(e[d+16>>2]|0)){if(g=0,l=ge(e[(e[d>>2]|0)+36>>2]|0,d|0)|0,D=g,g=0,D&1){ne=25;break}}else l=e[l>>2]|0;(l|0)==-1?(e[r>>2]=0,l=0,w=1):(l=d,w=0)}else l=0,w=1;C=e[o>>2]|0;do if(C){if(d=e[C+12>>2]|0,(d|0)==(e[C+16>>2]|0)){if(g=0,d=ge(e[(e[C>>2]|0)+36>>2]|0,C|0)|0,D=g,g=0,D&1){ne=25;break t}}else d=e[d>>2]|0;if((d|0)!=-1){if(w)break;d=C;break t}else{e[o>>2]=0,ne=17;break}}else ne=17;while(!1);if((ne|0)==17)if(ne=0,w){d=0;break}else C=0;if(d=S[ie>>0]|0,d=d&1?e[_>>2]|0:(d&255)>>>1,(e[K>>2]|0)==(t+d|0)){if(g=0,xe(8,ie|0,d<<1|0,0),D=g,g=0,D&1){ne=25;break}if(S[ie>>0]&1?t=(e[ie>>2]&-2)+-1|0:t=10,g=0,xe(8,ie|0,t|0,0),D=g,g=0,D&1){ne=25;break}t=S[ie>>0]&1?e[N>>2]|0:R,e[K>>2]=t+d}if(w=l+12|0,d=e[w>>2]|0,D=l+16|0,(d|0)==(e[D>>2]|0)){if(g=0,d=ge(e[(e[l>>2]|0)+36>>2]|0,l|0)|0,ce=g,g=0,ce&1){ne=25;break}}else d=e[d>>2]|0;if(Pi(d,H,t,K,G,k,oe,P,O,U)|0){d=C;break}if(d=e[w>>2]|0,(d|0)==(e[D>>2]|0))if(g=0,ge(e[(e[l>>2]|0)+40>>2]|0,l|0)|0,ce=g,g=0,ce&1){ne=25;break}else{d=l;continue}else{e[w>>2]=d+4,d=l;continue}}if((ne|0)==25){t=j()|0;break}if(ce=S[oe>>0]|0,(ce&1?e[oe+4>>2]|0:(ce&255)>>>1)|0&&($=e[O>>2]|0,($-P|0)<160)&&(ce=e[G>>2]|0,e[O>>2]=$+4,e[$>>2]=ce),g=0,t=Pe(21,t|0,e[K>>2]|0,c|0,H|0)|0,ce=g,g=0,ce&1)ne=26;else{if(e[h>>2]=t,V0(oe,P,e[O>>2]|0,c),l){if(t=e[l+12>>2]|0,(t|0)==(e[l+16>>2]|0)){if(g=0,t=ge(e[(e[l>>2]|0)+36>>2]|0,l|0)|0,ce=g,g=0,ce&1){ne=26;break}}else t=e[t>>2]|0;(t|0)==-1?(e[r>>2]=0,l=1):l=0}else l=1;do if(d){if(t=e[d+12>>2]|0,(t|0)==(e[d+16>>2]|0)){if(g=0,t=ge(e[(e[d>>2]|0)+36>>2]|0,d|0)|0,ce=g,g=0,ce&1){ne=26;break e}}else t=e[t>>2]|0;if((t|0)!=-1){if(l)break;ne=53;break}else{e[o>>2]=0,ne=51;break}}else ne=51;while(!1);return(ne|0)==51&&l&&(ne=53),(ne|0)==53&&(e[c>>2]=e[c>>2]|2),ce=e[r>>2]|0,de(ie),de(oe),b=Z,ce|0}}while(!1);return(ne|0)==26&&(t=j()|0),de(ie),de(oe),le(t|0),0}function q4(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0,ce=0;Z=b,b=b+320|0,U=Z+208|0,d=Z+200|0,oe=Z+24|0,ie=Z+12|0,K=Z+8|0,P=Z+40|0,O=Z+4|0,G=Z,H=li(l)|0,Wi(oe,l,U,d),e[ie>>2]=0,e[ie+4>>2]=0,e[ie+8>>2]=0,S[ie>>0]&1?t=(e[ie>>2]&-2)+-1|0:t=10,g=0,xe(8,ie|0,t|0,0),_=g,g=0;e:do if(_&1)ne=26;else{N=ie+8|0,R=ie+1|0,t=S[ie>>0]&1?e[N>>2]|0:R,e[K>>2]=t,e[O>>2]=P,e[G>>2]=0,_=ie+4|0,k=e[d>>2]|0,d=e[r>>2]|0;t:for(;;){if(d){if(l=e[d+12>>2]|0,(l|0)==(e[d+16>>2]|0)){if(g=0,l=ge(e[(e[d>>2]|0)+36>>2]|0,d|0)|0,D=g,g=0,D&1){ne=25;break}}else l=e[l>>2]|0;(l|0)==-1?(e[r>>2]=0,d=0,C=1):C=0}else d=0,C=1;w=e[o>>2]|0;do if(w){if(l=e[w+12>>2]|0,(l|0)==(e[w+16>>2]|0)){if(g=0,l=ge(e[(e[w>>2]|0)+36>>2]|0,w|0)|0,D=g,g=0,D&1){ne=25;break t}}else l=e[l>>2]|0;if((l|0)!=-1){if(C)break;break t}else{e[o>>2]=0,ne=17;break}}else ne=17;while(!1);if((ne|0)==17)if(ne=0,C){w=0;break}else w=0;if(l=S[ie>>0]|0,l=l&1?e[_>>2]|0:(l&255)>>>1,(e[K>>2]|0)==(t+l|0)){if(g=0,xe(8,ie|0,l<<1|0,0),D=g,g=0,D&1){ne=25;break}if(S[ie>>0]&1?t=(e[ie>>2]&-2)+-1|0:t=10,g=0,xe(8,ie|0,t|0,0),D=g,g=0,D&1){ne=25;break}t=S[ie>>0]&1?e[N>>2]|0:R,e[K>>2]=t+l}if(C=d+12|0,l=e[C>>2]|0,D=d+16|0,(l|0)==(e[D>>2]|0)){if(g=0,l=ge(e[(e[d>>2]|0)+36>>2]|0,d|0)|0,ce=g,g=0,ce&1){ne=25;break}}else l=e[l>>2]|0;if(Pi(l,H,t,K,G,k,oe,P,O,U)|0)break;if(l=e[C>>2]|0,(l|0)==(e[D>>2]|0))if(g=0,ge(e[(e[d>>2]|0)+40>>2]|0,d|0)|0,ce=g,g=0,ce&1){ne=25;break}else continue;else{e[C>>2]=l+4;continue}}if((ne|0)==25){t=j()|0;break}if(ce=S[oe>>0]|0,(ce&1?e[oe+4>>2]|0:(ce&255)>>>1)|0&&($=e[O>>2]|0,($-P|0)<160)&&(ce=e[G>>2]|0,e[O>>2]=$+4,e[$>>2]=ce),g=0,t=Pe(22,t|0,e[K>>2]|0,c|0,H|0)|0,l=ye,ce=g,g=0,ce&1)ne=26;else{if(ce=h,e[ce>>2]=t,e[ce+4>>2]=l,V0(oe,P,e[O>>2]|0,c),d){if(t=e[d+12>>2]|0,(t|0)==(e[d+16>>2]|0)){if(g=0,t=ge(e[(e[d>>2]|0)+36>>2]|0,d|0)|0,ce=g,g=0,ce&1){ne=26;break}}else t=e[t>>2]|0;(t|0)==-1?(e[r>>2]=0,l=1):l=0}else l=1;do if(w){if(t=e[w+12>>2]|0,(t|0)==(e[w+16>>2]|0)){if(g=0,t=ge(e[(e[w>>2]|0)+36>>2]|0,w|0)|0,ce=g,g=0,ce&1){ne=26;break e}}else t=e[t>>2]|0;if((t|0)!=-1){if(l)break;ne=53;break}else{e[o>>2]=0,ne=51;break}}else ne=51;while(!1);return(ne|0)==51&&l&&(ne=53),(ne|0)==53&&(e[c>>2]=e[c>>2]|2),ce=e[r>>2]|0,de(ie),de(oe),b=Z,ce|0}}while(!1);return(ne|0)==26&&(t=j()|0),de(ie),de(oe),le(t|0),0}function W4(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0,ce=0;Z=b,b=b+320|0,U=Z+208|0,d=Z+200|0,oe=Z+24|0,ie=Z+12|0,K=Z+8|0,P=Z+40|0,O=Z+4|0,G=Z,H=li(l)|0,Wi(oe,l,U,d),e[ie>>2]=0,e[ie+4>>2]=0,e[ie+8>>2]=0,S[ie>>0]&1?t=(e[ie>>2]&-2)+-1|0:t=10,g=0,xe(8,ie|0,t|0,0),_=g,g=0;e:do if(_&1)ne=26;else{N=ie+8|0,R=ie+1|0,t=S[ie>>0]&1?e[N>>2]|0:R,e[K>>2]=t,e[O>>2]=P,e[G>>2]=0,_=ie+4|0,k=e[d>>2]|0,d=e[r>>2]|0;t:for(;;){if(d){if(l=e[d+12>>2]|0,(l|0)==(e[d+16>>2]|0)){if(g=0,l=ge(e[(e[d>>2]|0)+36>>2]|0,d|0)|0,D=g,g=0,D&1){ne=25;break}}else l=e[l>>2]|0;(l|0)==-1?(e[r>>2]=0,l=0,w=1):(l=d,w=0)}else l=0,w=1;C=e[o>>2]|0;do if(C){if(d=e[C+12>>2]|0,(d|0)==(e[C+16>>2]|0)){if(g=0,d=ge(e[(e[C>>2]|0)+36>>2]|0,C|0)|0,D=g,g=0,D&1){ne=25;break t}}else d=e[d>>2]|0;if((d|0)!=-1){if(w)break;d=C;break t}else{e[o>>2]=0,ne=17;break}}else ne=17;while(!1);if((ne|0)==17)if(ne=0,w){d=0;break}else C=0;if(d=S[ie>>0]|0,d=d&1?e[_>>2]|0:(d&255)>>>1,(e[K>>2]|0)==(t+d|0)){if(g=0,xe(8,ie|0,d<<1|0,0),D=g,g=0,D&1){ne=25;break}if(S[ie>>0]&1?t=(e[ie>>2]&-2)+-1|0:t=10,g=0,xe(8,ie|0,t|0,0),D=g,g=0,D&1){ne=25;break}t=S[ie>>0]&1?e[N>>2]|0:R,e[K>>2]=t+d}if(w=l+12|0,d=e[w>>2]|0,D=l+16|0,(d|0)==(e[D>>2]|0)){if(g=0,d=ge(e[(e[l>>2]|0)+36>>2]|0,l|0)|0,ce=g,g=0,ce&1){ne=25;break}}else d=e[d>>2]|0;if(Pi(d,H,t,K,G,k,oe,P,O,U)|0){d=C;break}if(d=e[w>>2]|0,(d|0)==(e[D>>2]|0))if(g=0,ge(e[(e[l>>2]|0)+40>>2]|0,l|0)|0,ce=g,g=0,ce&1){ne=25;break}else{d=l;continue}else{e[w>>2]=d+4,d=l;continue}}if((ne|0)==25){t=j()|0;break}if(ce=S[oe>>0]|0,(ce&1?e[oe+4>>2]|0:(ce&255)>>>1)|0&&($=e[O>>2]|0,($-P|0)<160)&&(ce=e[G>>2]|0,e[O>>2]=$+4,e[$>>2]=ce),g=0,t=Pe(23,t|0,e[K>>2]|0,c|0,H|0)|0,ce=g,g=0,ce&1)ne=26;else{if(I[h>>1]=t,V0(oe,P,e[O>>2]|0,c),l){if(t=e[l+12>>2]|0,(t|0)==(e[l+16>>2]|0)){if(g=0,t=ge(e[(e[l>>2]|0)+36>>2]|0,l|0)|0,ce=g,g=0,ce&1){ne=26;break}}else t=e[t>>2]|0;(t|0)==-1?(e[r>>2]=0,l=1):l=0}else l=1;do if(d){if(t=e[d+12>>2]|0,(t|0)==(e[d+16>>2]|0)){if(g=0,t=ge(e[(e[d>>2]|0)+36>>2]|0,d|0)|0,ce=g,g=0,ce&1){ne=26;break e}}else t=e[t>>2]|0;if((t|0)!=-1){if(l)break;ne=53;break}else{e[o>>2]=0,ne=51;break}}else ne=51;while(!1);return(ne|0)==51&&l&&(ne=53),(ne|0)==53&&(e[c>>2]=e[c>>2]|2),ce=e[r>>2]|0,de(ie),de(oe),b=Z,ce|0}}while(!1);return(ne|0)==26&&(t=j()|0),de(ie),de(oe),le(t|0),0}function H4(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0,ce=0;Z=b,b=b+320|0,U=Z+208|0,d=Z+200|0,oe=Z+24|0,ie=Z+12|0,K=Z+8|0,P=Z+40|0,O=Z+4|0,G=Z,H=li(l)|0,Wi(oe,l,U,d),e[ie>>2]=0,e[ie+4>>2]=0,e[ie+8>>2]=0,S[ie>>0]&1?t=(e[ie>>2]&-2)+-1|0:t=10,g=0,xe(8,ie|0,t|0,0),_=g,g=0;e:do if(_&1)ne=26;else{N=ie+8|0,R=ie+1|0,t=S[ie>>0]&1?e[N>>2]|0:R,e[K>>2]=t,e[O>>2]=P,e[G>>2]=0,_=ie+4|0,k=e[d>>2]|0,d=e[r>>2]|0;t:for(;;){if(d){if(l=e[d+12>>2]|0,(l|0)==(e[d+16>>2]|0)){if(g=0,l=ge(e[(e[d>>2]|0)+36>>2]|0,d|0)|0,D=g,g=0,D&1){ne=25;break}}else l=e[l>>2]|0;(l|0)==-1?(e[r>>2]=0,l=0,w=1):(l=d,w=0)}else l=0,w=1;C=e[o>>2]|0;do if(C){if(d=e[C+12>>2]|0,(d|0)==(e[C+16>>2]|0)){if(g=0,d=ge(e[(e[C>>2]|0)+36>>2]|0,C|0)|0,D=g,g=0,D&1){ne=25;break t}}else d=e[d>>2]|0;if((d|0)!=-1){if(w)break;d=C;break t}else{e[o>>2]=0,ne=17;break}}else ne=17;while(!1);if((ne|0)==17)if(ne=0,w){d=0;break}else C=0;if(d=S[ie>>0]|0,d=d&1?e[_>>2]|0:(d&255)>>>1,(e[K>>2]|0)==(t+d|0)){if(g=0,xe(8,ie|0,d<<1|0,0),D=g,g=0,D&1){ne=25;break}if(S[ie>>0]&1?t=(e[ie>>2]&-2)+-1|0:t=10,g=0,xe(8,ie|0,t|0,0),D=g,g=0,D&1){ne=25;break}t=S[ie>>0]&1?e[N>>2]|0:R,e[K>>2]=t+d}if(w=l+12|0,d=e[w>>2]|0,D=l+16|0,(d|0)==(e[D>>2]|0)){if(g=0,d=ge(e[(e[l>>2]|0)+36>>2]|0,l|0)|0,ce=g,g=0,ce&1){ne=25;break}}else d=e[d>>2]|0;if(Pi(d,H,t,K,G,k,oe,P,O,U)|0){d=C;break}if(d=e[w>>2]|0,(d|0)==(e[D>>2]|0))if(g=0,ge(e[(e[l>>2]|0)+40>>2]|0,l|0)|0,ce=g,g=0,ce&1){ne=25;break}else{d=l;continue}else{e[w>>2]=d+4,d=l;continue}}if((ne|0)==25){t=j()|0;break}if(ce=S[oe>>0]|0,(ce&1?e[oe+4>>2]|0:(ce&255)>>>1)|0&&($=e[O>>2]|0,($-P|0)<160)&&(ce=e[G>>2]|0,e[O>>2]=$+4,e[$>>2]=ce),g=0,t=Pe(24,t|0,e[K>>2]|0,c|0,H|0)|0,ce=g,g=0,ce&1)ne=26;else{if(e[h>>2]=t,V0(oe,P,e[O>>2]|0,c),l){if(t=e[l+12>>2]|0,(t|0)==(e[l+16>>2]|0)){if(g=0,t=ge(e[(e[l>>2]|0)+36>>2]|0,l|0)|0,ce=g,g=0,ce&1){ne=26;break}}else t=e[t>>2]|0;(t|0)==-1?(e[r>>2]=0,l=1):l=0}else l=1;do if(d){if(t=e[d+12>>2]|0,(t|0)==(e[d+16>>2]|0)){if(g=0,t=ge(e[(e[d>>2]|0)+36>>2]|0,d|0)|0,ce=g,g=0,ce&1){ne=26;break e}}else t=e[t>>2]|0;if((t|0)!=-1){if(l)break;ne=53;break}else{e[o>>2]=0,ne=51;break}}else ne=51;while(!1);return(ne|0)==51&&l&&(ne=53),(ne|0)==53&&(e[c>>2]=e[c>>2]|2),ce=e[r>>2]|0,de(ie),de(oe),b=Z,ce|0}}while(!1);return(ne|0)==26&&(t=j()|0),de(ie),de(oe),le(t|0),0}function Q4(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0,ce=0;Z=b,b=b+320|0,U=Z+208|0,d=Z+200|0,oe=Z+24|0,ie=Z+12|0,K=Z+8|0,P=Z+40|0,O=Z+4|0,G=Z,H=li(l)|0,Wi(oe,l,U,d),e[ie>>2]=0,e[ie+4>>2]=0,e[ie+8>>2]=0,S[ie>>0]&1?t=(e[ie>>2]&-2)+-1|0:t=10,g=0,xe(8,ie|0,t|0,0),_=g,g=0;e:do if(_&1)ne=26;else{N=ie+8|0,R=ie+1|0,t=S[ie>>0]&1?e[N>>2]|0:R,e[K>>2]=t,e[O>>2]=P,e[G>>2]=0,_=ie+4|0,k=e[d>>2]|0,d=e[r>>2]|0;t:for(;;){if(d){if(l=e[d+12>>2]|0,(l|0)==(e[d+16>>2]|0)){if(g=0,l=ge(e[(e[d>>2]|0)+36>>2]|0,d|0)|0,D=g,g=0,D&1){ne=25;break}}else l=e[l>>2]|0;(l|0)==-1?(e[r>>2]=0,l=0,w=1):(l=d,w=0)}else l=0,w=1;C=e[o>>2]|0;do if(C){if(d=e[C+12>>2]|0,(d|0)==(e[C+16>>2]|0)){if(g=0,d=ge(e[(e[C>>2]|0)+36>>2]|0,C|0)|0,D=g,g=0,D&1){ne=25;break t}}else d=e[d>>2]|0;if((d|0)!=-1){if(w)break;d=C;break t}else{e[o>>2]=0,ne=17;break}}else ne=17;while(!1);if((ne|0)==17)if(ne=0,w){d=0;break}else C=0;if(d=S[ie>>0]|0,d=d&1?e[_>>2]|0:(d&255)>>>1,(e[K>>2]|0)==(t+d|0)){if(g=0,xe(8,ie|0,d<<1|0,0),D=g,g=0,D&1){ne=25;break}if(S[ie>>0]&1?t=(e[ie>>2]&-2)+-1|0:t=10,g=0,xe(8,ie|0,t|0,0),D=g,g=0,D&1){ne=25;break}t=S[ie>>0]&1?e[N>>2]|0:R,e[K>>2]=t+d}if(w=l+12|0,d=e[w>>2]|0,D=l+16|0,(d|0)==(e[D>>2]|0)){if(g=0,d=ge(e[(e[l>>2]|0)+36>>2]|0,l|0)|0,ce=g,g=0,ce&1){ne=25;break}}else d=e[d>>2]|0;if(Pi(d,H,t,K,G,k,oe,P,O,U)|0){d=C;break}if(d=e[w>>2]|0,(d|0)==(e[D>>2]|0))if(g=0,ge(e[(e[l>>2]|0)+40>>2]|0,l|0)|0,ce=g,g=0,ce&1){ne=25;break}else{d=l;continue}else{e[w>>2]=d+4,d=l;continue}}if((ne|0)==25){t=j()|0;break}if(ce=S[oe>>0]|0,(ce&1?e[oe+4>>2]|0:(ce&255)>>>1)|0&&($=e[O>>2]|0,($-P|0)<160)&&(ce=e[G>>2]|0,e[O>>2]=$+4,e[$>>2]=ce),g=0,t=Pe(25,t|0,e[K>>2]|0,c|0,H|0)|0,ce=g,g=0,ce&1)ne=26;else{if(e[h>>2]=t,V0(oe,P,e[O>>2]|0,c),l){if(t=e[l+12>>2]|0,(t|0)==(e[l+16>>2]|0)){if(g=0,t=ge(e[(e[l>>2]|0)+36>>2]|0,l|0)|0,ce=g,g=0,ce&1){ne=26;break}}else t=e[t>>2]|0;(t|0)==-1?(e[r>>2]=0,l=1):l=0}else l=1;do if(d){if(t=e[d+12>>2]|0,(t|0)==(e[d+16>>2]|0)){if(g=0,t=ge(e[(e[d>>2]|0)+36>>2]|0,d|0)|0,ce=g,g=0,ce&1){ne=26;break e}}else t=e[t>>2]|0;if((t|0)!=-1){if(l)break;ne=53;break}else{e[o>>2]=0,ne=51;break}}else ne=51;while(!1);return(ne|0)==51&&l&&(ne=53),(ne|0)==53&&(e[c>>2]=e[c>>2]|2),ce=e[r>>2]|0,de(ie),de(oe),b=Z,ce|0}}while(!1);return(ne|0)==26&&(t=j()|0),de(ie),de(oe),le(t|0),0}function K4(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0,ce=0;Z=b,b=b+320|0,U=Z+208|0,d=Z+200|0,oe=Z+24|0,ie=Z+12|0,K=Z+8|0,P=Z+40|0,O=Z+4|0,G=Z,H=li(l)|0,Wi(oe,l,U,d),e[ie>>2]=0,e[ie+4>>2]=0,e[ie+8>>2]=0,S[ie>>0]&1?t=(e[ie>>2]&-2)+-1|0:t=10,g=0,xe(8,ie|0,t|0,0),_=g,g=0;e:do if(_&1)ne=26;else{N=ie+8|0,R=ie+1|0,t=S[ie>>0]&1?e[N>>2]|0:R,e[K>>2]=t,e[O>>2]=P,e[G>>2]=0,_=ie+4|0,k=e[d>>2]|0,d=e[r>>2]|0;t:for(;;){if(d){if(l=e[d+12>>2]|0,(l|0)==(e[d+16>>2]|0)){if(g=0,l=ge(e[(e[d>>2]|0)+36>>2]|0,d|0)|0,D=g,g=0,D&1){ne=25;break}}else l=e[l>>2]|0;(l|0)==-1?(e[r>>2]=0,d=0,C=1):C=0}else d=0,C=1;w=e[o>>2]|0;do if(w){if(l=e[w+12>>2]|0,(l|0)==(e[w+16>>2]|0)){if(g=0,l=ge(e[(e[w>>2]|0)+36>>2]|0,w|0)|0,D=g,g=0,D&1){ne=25;break t}}else l=e[l>>2]|0;if((l|0)!=-1){if(C)break;break t}else{e[o>>2]=0,ne=17;break}}else ne=17;while(!1);if((ne|0)==17)if(ne=0,C){w=0;break}else w=0;if(l=S[ie>>0]|0,l=l&1?e[_>>2]|0:(l&255)>>>1,(e[K>>2]|0)==(t+l|0)){if(g=0,xe(8,ie|0,l<<1|0,0),D=g,g=0,D&1){ne=25;break}if(S[ie>>0]&1?t=(e[ie>>2]&-2)+-1|0:t=10,g=0,xe(8,ie|0,t|0,0),D=g,g=0,D&1){ne=25;break}t=S[ie>>0]&1?e[N>>2]|0:R,e[K>>2]=t+l}if(C=d+12|0,l=e[C>>2]|0,D=d+16|0,(l|0)==(e[D>>2]|0)){if(g=0,l=ge(e[(e[d>>2]|0)+36>>2]|0,d|0)|0,ce=g,g=0,ce&1){ne=25;break}}else l=e[l>>2]|0;if(Pi(l,H,t,K,G,k,oe,P,O,U)|0)break;if(l=e[C>>2]|0,(l|0)==(e[D>>2]|0))if(g=0,ge(e[(e[d>>2]|0)+40>>2]|0,d|0)|0,ce=g,g=0,ce&1){ne=25;break}else continue;else{e[C>>2]=l+4;continue}}if((ne|0)==25){t=j()|0;break}if(ce=S[oe>>0]|0,(ce&1?e[oe+4>>2]|0:(ce&255)>>>1)|0&&($=e[O>>2]|0,($-P|0)<160)&&(ce=e[G>>2]|0,e[O>>2]=$+4,e[$>>2]=ce),g=0,t=Pe(26,t|0,e[K>>2]|0,c|0,H|0)|0,l=ye,ce=g,g=0,ce&1)ne=26;else{if(ce=h,e[ce>>2]=t,e[ce+4>>2]=l,V0(oe,P,e[O>>2]|0,c),d){if(t=e[d+12>>2]|0,(t|0)==(e[d+16>>2]|0)){if(g=0,t=ge(e[(e[d>>2]|0)+36>>2]|0,d|0)|0,ce=g,g=0,ce&1){ne=26;break}}else t=e[t>>2]|0;(t|0)==-1?(e[r>>2]=0,l=1):l=0}else l=1;do if(w){if(t=e[w+12>>2]|0,(t|0)==(e[w+16>>2]|0)){if(g=0,t=ge(e[(e[w>>2]|0)+36>>2]|0,w|0)|0,ce=g,g=0,ce&1){ne=26;break e}}else t=e[t>>2]|0;if((t|0)!=-1){if(l)break;ne=53;break}else{e[o>>2]=0,ne=51;break}}else ne=51;while(!1);return(ne|0)==51&&l&&(ne=53),(ne|0)==53&&(e[c>>2]=e[c>>2]|2),ce=e[r>>2]|0,de(ie),de(oe),b=Z,ce|0}}while(!1);return(ne|0)==26&&(t=j()|0),de(ie),de(oe),le(t|0),0}function Y4(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0,ce=0,ke=0,Ee=0,Te=0;ne=b,b=b+352|0,K=ne+208|0,w=ne+40|0,C=ne+36|0,ke=ne+24|0,ce=ne+12|0,$=ne+8|0,ie=ne+48|0,oe=ne+4|0,P=ne,O=ne+337|0,G=ne+336|0,xr(ke,l,K,w,C),e[ce>>2]=0,e[ce+4>>2]=0,e[ce+8>>2]=0,S[ce>>0]&1?t=(e[ce>>2]&-2)+-1|0:t=10,g=0,xe(8,ce|0,t|0,0),H=g,g=0;e:do if(H&1)Ee=26;else{_=ce+8|0,U=ce+1|0,t=S[ce>>0]&1?e[_>>2]|0:U,e[$>>2]=t,e[oe>>2]=ie,e[P>>2]=0,S[O>>0]=1,S[G>>0]=69,H=ce+4|0,R=e[w>>2]|0,N=e[C>>2]|0,l=e[r>>2]|0;t:for(;;){if(l){if(w=e[l+12>>2]|0,(w|0)==(e[l+16>>2]|0)){if(g=0,w=ge(e[(e[l>>2]|0)+36>>2]|0,l|0)|0,k=g,g=0,k&1){Ee=25;break}}else w=e[w>>2]|0;(w|0)==-1?(e[r>>2]=0,l=0,D=1):D=0}else l=0,D=1;w=e[o>>2]|0;do if(w){if(C=e[w+12>>2]|0,(C|0)==(e[w+16>>2]|0)){if(g=0,C=ge(e[(e[w>>2]|0)+36>>2]|0,w|0)|0,k=g,g=0,k&1){Ee=25;break t}}else C=e[C>>2]|0;if((C|0)!=-1){if(D)break;break t}else{e[o>>2]=0,Ee=17;break}}else Ee=17;while(!1);if((Ee|0)==17)if(Ee=0,D){w=0;break}else w=0;if(C=S[ce>>0]|0,C=C&1?e[H>>2]|0:(C&255)>>>1,(e[$>>2]|0)==(t+C|0)){if(g=0,xe(8,ce|0,C<<1|0,0),k=g,g=0,k&1){Ee=25;break}if(S[ce>>0]&1?t=(e[ce>>2]&-2)+-1|0:t=10,g=0,xe(8,ce|0,t|0,0),k=g,g=0,k&1){Ee=25;break}t=S[ce>>0]&1?e[_>>2]|0:U,e[$>>2]=t+C}if(D=l+12|0,C=e[D>>2]|0,k=l+16|0,(C|0)==(e[k>>2]|0)){if(g=0,C=ge(e[(e[l>>2]|0)+36>>2]|0,l|0)|0,Te=g,g=0,Te&1){Ee=25;break}}else C=e[C>>2]|0;if(wr(C,O,G,t,$,R,N,ke,ie,oe,P,K)|0)break;if(w=e[D>>2]|0,(w|0)==(e[k>>2]|0))if(g=0,ge(e[(e[l>>2]|0)+40>>2]|0,l|0)|0,Te=g,g=0,Te&1){Ee=25;break}else continue;else{e[D>>2]=w+4;continue}}if((Ee|0)==25){t=j()|0;break}if(Te=S[ke>>0]|0,!(!(S[O>>0]|0)||!((Te&1?e[ke+4>>2]|0:(Te&255)>>>1)|0))&&(Z=e[oe>>2]|0,(Z-ie|0)<160)&&(Te=e[P>>2]|0,e[oe>>2]=Z+4,e[Z>>2]=Te),g=0,d=+lt(1,t|0,e[$>>2]|0,c|0),Te=g,g=0,Te&1)Ee=26;else{if(V[h>>2]=d,V0(ke,ie,e[oe>>2]|0,c),l){if(t=e[l+12>>2]|0,(t|0)==(e[l+16>>2]|0)){if(g=0,t=ge(e[(e[l>>2]|0)+36>>2]|0,l|0)|0,Te=g,g=0,Te&1){Ee=26;break}}else t=e[t>>2]|0;(t|0)==-1?(e[r>>2]=0,l=1):l=0}else l=1;do if(w){if(t=e[w+12>>2]|0,(t|0)==(e[w+16>>2]|0)){if(g=0,t=ge(e[(e[w>>2]|0)+36>>2]|0,w|0)|0,Te=g,g=0,Te&1){Ee=26;break e}}else t=e[t>>2]|0;if((t|0)!=-1){if(l)break;Ee=53;break}else{e[o>>2]=0,Ee=51;break}}else Ee=51;while(!1);return(Ee|0)==51&&l&&(Ee=53),(Ee|0)==53&&(e[c>>2]=e[c>>2]|2),Te=e[r>>2]|0,de(ce),de(ke),b=ne,Te|0}}while(!1);return(Ee|0)==26&&(t=j()|0),de(ce),de(ke),le(t|0),0}function j4(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0,ce=0,ke=0,Ee=0,Te=0;ne=b,b=b+352|0,K=ne+208|0,w=ne+40|0,C=ne+36|0,ke=ne+24|0,ce=ne+12|0,$=ne+8|0,ie=ne+48|0,oe=ne+4|0,P=ne,O=ne+337|0,G=ne+336|0,xr(ke,l,K,w,C),e[ce>>2]=0,e[ce+4>>2]=0,e[ce+8>>2]=0,S[ce>>0]&1?t=(e[ce>>2]&-2)+-1|0:t=10,g=0,xe(8,ce|0,t|0,0),H=g,g=0;e:do if(H&1)Ee=26;else{_=ce+8|0,U=ce+1|0,t=S[ce>>0]&1?e[_>>2]|0:U,e[$>>2]=t,e[oe>>2]=ie,e[P>>2]=0,S[O>>0]=1,S[G>>0]=69,H=ce+4|0,R=e[w>>2]|0,N=e[C>>2]|0,l=e[r>>2]|0;t:for(;;){if(l){if(w=e[l+12>>2]|0,(w|0)==(e[l+16>>2]|0)){if(g=0,w=ge(e[(e[l>>2]|0)+36>>2]|0,l|0)|0,k=g,g=0,k&1){Ee=25;break}}else w=e[w>>2]|0;(w|0)==-1?(e[r>>2]=0,l=0,D=1):D=0}else l=0,D=1;w=e[o>>2]|0;do if(w){if(C=e[w+12>>2]|0,(C|0)==(e[w+16>>2]|0)){if(g=0,C=ge(e[(e[w>>2]|0)+36>>2]|0,w|0)|0,k=g,g=0,k&1){Ee=25;break t}}else C=e[C>>2]|0;if((C|0)!=-1){if(D)break;break t}else{e[o>>2]=0,Ee=17;break}}else Ee=17;while(!1);if((Ee|0)==17)if(Ee=0,D){w=0;break}else w=0;if(C=S[ce>>0]|0,C=C&1?e[H>>2]|0:(C&255)>>>1,(e[$>>2]|0)==(t+C|0)){if(g=0,xe(8,ce|0,C<<1|0,0),k=g,g=0,k&1){Ee=25;break}if(S[ce>>0]&1?t=(e[ce>>2]&-2)+-1|0:t=10,g=0,xe(8,ce|0,t|0,0),k=g,g=0,k&1){Ee=25;break}t=S[ce>>0]&1?e[_>>2]|0:U,e[$>>2]=t+C}if(D=l+12|0,C=e[D>>2]|0,k=l+16|0,(C|0)==(e[k>>2]|0)){if(g=0,C=ge(e[(e[l>>2]|0)+36>>2]|0,l|0)|0,Te=g,g=0,Te&1){Ee=25;break}}else C=e[C>>2]|0;if(wr(C,O,G,t,$,R,N,ke,ie,oe,P,K)|0)break;if(w=e[D>>2]|0,(w|0)==(e[k>>2]|0))if(g=0,ge(e[(e[l>>2]|0)+40>>2]|0,l|0)|0,Te=g,g=0,Te&1){Ee=25;break}else continue;else{e[D>>2]=w+4;continue}}if((Ee|0)==25){t=j()|0;break}if(Te=S[ke>>0]|0,!(!(S[O>>0]|0)||!((Te&1?e[ke+4>>2]|0:(Te&255)>>>1)|0))&&(Z=e[oe>>2]|0,(Z-ie|0)<160)&&(Te=e[P>>2]|0,e[oe>>2]=Z+4,e[Z>>2]=Te),g=0,d=+lt(2,t|0,e[$>>2]|0,c|0),Te=g,g=0,Te&1)Ee=26;else{if(B[h>>3]=d,V0(ke,ie,e[oe>>2]|0,c),l){if(t=e[l+12>>2]|0,(t|0)==(e[l+16>>2]|0)){if(g=0,t=ge(e[(e[l>>2]|0)+36>>2]|0,l|0)|0,Te=g,g=0,Te&1){Ee=26;break}}else t=e[t>>2]|0;(t|0)==-1?(e[r>>2]=0,l=1):l=0}else l=1;do if(w){if(t=e[w+12>>2]|0,(t|0)==(e[w+16>>2]|0)){if(g=0,t=ge(e[(e[w>>2]|0)+36>>2]|0,w|0)|0,Te=g,g=0,Te&1){Ee=26;break e}}else t=e[t>>2]|0;if((t|0)!=-1){if(l)break;Ee=53;break}else{e[o>>2]=0,Ee=51;break}}else Ee=51;while(!1);return(Ee|0)==51&&l&&(Ee=53),(Ee|0)==53&&(e[c>>2]=e[c>>2]|2),Te=e[r>>2]|0,de(ce),de(ke),b=ne,Te|0}}while(!1);return(Ee|0)==26&&(t=j()|0),de(ce),de(ke),le(t|0),0}function X4(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0,ce=0,ke=0,Ee=0,Te=0;ne=b,b=b+352|0,K=ne+208|0,w=ne+40|0,C=ne+36|0,ke=ne+24|0,ce=ne+12|0,$=ne+8|0,ie=ne+48|0,oe=ne+4|0,P=ne,O=ne+337|0,G=ne+336|0,xr(ke,l,K,w,C),e[ce>>2]=0,e[ce+4>>2]=0,e[ce+8>>2]=0,S[ce>>0]&1?t=(e[ce>>2]&-2)+-1|0:t=10,g=0,xe(8,ce|0,t|0,0),H=g,g=0;e:do if(H&1)Ee=26;else{_=ce+8|0,U=ce+1|0,t=S[ce>>0]&1?e[_>>2]|0:U,e[$>>2]=t,e[oe>>2]=ie,e[P>>2]=0,S[O>>0]=1,S[G>>0]=69,H=ce+4|0,R=e[w>>2]|0,N=e[C>>2]|0,l=e[r>>2]|0;t:for(;;){if(l){if(w=e[l+12>>2]|0,(w|0)==(e[l+16>>2]|0)){if(g=0,w=ge(e[(e[l>>2]|0)+36>>2]|0,l|0)|0,k=g,g=0,k&1){Ee=25;break}}else w=e[w>>2]|0;(w|0)==-1?(e[r>>2]=0,l=0,D=1):D=0}else l=0,D=1;w=e[o>>2]|0;do if(w){if(C=e[w+12>>2]|0,(C|0)==(e[w+16>>2]|0)){if(g=0,C=ge(e[(e[w>>2]|0)+36>>2]|0,w|0)|0,k=g,g=0,k&1){Ee=25;break t}}else C=e[C>>2]|0;if((C|0)!=-1){if(D)break;break t}else{e[o>>2]=0,Ee=17;break}}else Ee=17;while(!1);if((Ee|0)==17)if(Ee=0,D){w=0;break}else w=0;if(C=S[ce>>0]|0,C=C&1?e[H>>2]|0:(C&255)>>>1,(e[$>>2]|0)==(t+C|0)){if(g=0,xe(8,ce|0,C<<1|0,0),k=g,g=0,k&1){Ee=25;break}if(S[ce>>0]&1?t=(e[ce>>2]&-2)+-1|0:t=10,g=0,xe(8,ce|0,t|0,0),k=g,g=0,k&1){Ee=25;break}t=S[ce>>0]&1?e[_>>2]|0:U,e[$>>2]=t+C}if(D=l+12|0,C=e[D>>2]|0,k=l+16|0,(C|0)==(e[k>>2]|0)){if(g=0,C=ge(e[(e[l>>2]|0)+36>>2]|0,l|0)|0,Te=g,g=0,Te&1){Ee=25;break}}else C=e[C>>2]|0;if(wr(C,O,G,t,$,R,N,ke,ie,oe,P,K)|0)break;if(w=e[D>>2]|0,(w|0)==(e[k>>2]|0))if(g=0,ge(e[(e[l>>2]|0)+40>>2]|0,l|0)|0,Te=g,g=0,Te&1){Ee=25;break}else continue;else{e[D>>2]=w+4;continue}}if((Ee|0)==25){t=j()|0;break}if(Te=S[ke>>0]|0,!(!(S[O>>0]|0)||!((Te&1?e[ke+4>>2]|0:(Te&255)>>>1)|0))&&(Z=e[oe>>2]|0,(Z-ie|0)<160)&&(Te=e[P>>2]|0,e[oe>>2]=Z+4,e[Z>>2]=Te),g=0,d=+lt(3,t|0,e[$>>2]|0,c|0),Te=g,g=0,Te&1)Ee=26;else{if(B[h>>3]=d,V0(ke,ie,e[oe>>2]|0,c),l){if(t=e[l+12>>2]|0,(t|0)==(e[l+16>>2]|0)){if(g=0,t=ge(e[(e[l>>2]|0)+36>>2]|0,l|0)|0,Te=g,g=0,Te&1){Ee=26;break}}else t=e[t>>2]|0;(t|0)==-1?(e[r>>2]=0,l=1):l=0}else l=1;do if(w){if(t=e[w+12>>2]|0,(t|0)==(e[w+16>>2]|0)){if(g=0,t=ge(e[(e[w>>2]|0)+36>>2]|0,w|0)|0,Te=g,g=0,Te&1){Ee=26;break e}}else t=e[t>>2]|0;if((t|0)!=-1){if(l)break;Ee=53;break}else{e[o>>2]=0,Ee=51;break}}else Ee=51;while(!1);return(Ee|0)==51&&l&&(Ee=53),(Ee|0)==53&&(e[c>>2]=e[c>>2]|2),Te=e[r>>2]|0,de(ce),de(ke),b=ne,Te|0}}while(!1);return(Ee|0)==26&&(t=j()|0),de(ce),de(ke),le(t|0),0}function q0(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0;return h=b,b=b+16|0,d=h,e[d>>2]=c,c=ai(o)|0,o=Mn(t,r,l,d)|0,c|0&&(g=0,ge(75,c|0)|0,d=g,g=0,d&1)&&(d=j(0)|0,$t(d)),b=h,o|0}function Z4(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0;if(c=b,b=b+16|0,h=c,e[h>>2]=l,l=ai(r)|0,g=0,r=Ve(37,t|0,o|0,h|0)|0,t=g,g=0,t&1)r=j()|0,l|0&&(g=0,ge(75,l|0)|0,h=g,g=0,h&1)&&(h=j(0)|0,$t(h)),le(r|0);else return l|0&&(g=0,ge(75,l|0)|0,h=g,g=0,h&1)&&(h=j(0)|0,$t(h)),b=c,r|0;return 0}function Hi(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0,N=0,R=0;N=b,b=b+16|0,k=N,d=e[t>>2]|0;e:do if(!d)d=0;else{if(R=r,C=l-R>>2,D=c+12|0,w=e[D>>2]|0,C=(w|0)>(C|0)?w-C|0:0,w=o,R=w-R|0,c=R>>2,(R|0)>0&&(Yt[e[(e[d>>2]|0)+48>>2]&63](d,r,c)|0)!=(c|0)){e[t>>2]=0,d=0;break}do if((C|0)>0)if(gr(k,C,h),g=0,c=Ve(e[(e[d>>2]|0)+48>>2]|0,d|0,(S[k>>0]&1?e[k+8>>2]|0:k+4|0)|0,C|0)|0,R=g,g=0,R&1&&(R=j()|0,Pt(k),le(R|0)),(c|0)==(C|0)){Pt(k);break}else{e[t>>2]=0,Pt(k),d=0;break e}while(!1);if(R=l-w|0,l=R>>2,(R|0)>0&&(Yt[e[(e[d>>2]|0)+48>>2]&63](d,o,l)|0)!=(l|0)){e[t>>2]=0,d=0;break}e[D>>2]=0}while(!1);return b=N,d|0}function fi(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0;h=e[t>>2]|0;do if(h){if((e[h+12>>2]|0)==(e[h+16>>2]|0))if((Dt[e[(e[h>>2]|0)+36>>2]&127](h)|0)==-1){e[t>>2]=0,h=0;break}else{h=e[t>>2]|0;break}}else h=0;while(!1);d=(h|0)==0,h=e[r>>2]|0;do if(h){if((e[h+12>>2]|0)==(e[h+16>>2]|0)&&(Dt[e[(e[h>>2]|0)+36>>2]&127](h)|0)==-1){e[r>>2]=0,U=11;break}d?U=13:U=12}else U=11;while(!1);(U|0)==11&&(d?U=12:(h=0,U=13));e:do if((U|0)==12)e[o>>2]=e[o>>2]|6,h=0;else if((U|0)==13){if(d=e[t>>2]|0,w=e[d+12>>2]|0,(w|0)==(e[d+16>>2]|0)?d=Dt[e[(e[d>>2]|0)+36>>2]&127](d)|0:d=F[w>>0]|0,w=d&255,w<<24>>24>-1&&(_=l+8|0,(I[(e[_>>2]|0)+(d<<24>>24<<1)>>1]&2048)!=0)){for(D=(Yt[e[(e[l>>2]|0)+36>>2]&63](l,w,0)|0)<<24>>24,d=e[t>>2]|0,w=d+12|0,C=e[w>>2]|0,(C|0)==(e[d+16>>2]|0)?(Dt[e[(e[d>>2]|0)+40>>2]&127](d)|0,N=c,k=h,c=h,h=D):(e[w>>2]=C+1,N=c,k=h,c=h,h=D);;){h=h+-48|0,R=N+-1|0,d=e[t>>2]|0;do if(d){if((e[d+12>>2]|0)==(e[d+16>>2]|0))if((Dt[e[(e[d>>2]|0)+36>>2]&127](d)|0)==-1){e[t>>2]=0,d=0;break}else{d=e[t>>2]|0;break}}else d=0;while(!1);if(C=(d|0)==0,c?(e[c+12>>2]|0)==(e[c+16>>2]|0)?(Dt[e[(e[c>>2]|0)+36>>2]&127](c)|0)==-1?(e[r>>2]=0,w=0,c=0):(w=k,c=k):w=k:(w=k,c=0),d=e[t>>2]|0,!((N|0)>1&(C^(c|0)==0)))break;if(C=e[d+12>>2]|0,(C|0)==(e[d+16>>2]|0)?d=Dt[e[(e[d>>2]|0)+36>>2]&127](d)|0:d=F[C>>0]|0,C=d&255,C<<24>>24<=-1||!(I[(e[_>>2]|0)+(d<<24>>24<<1)>>1]&2048))break e;if(h=((Yt[e[(e[l>>2]|0)+36>>2]&63](l,C,0)|0)<<24>>24)+(h*10|0)|0,d=e[t>>2]|0,C=d+12|0,D=e[C>>2]|0,(D|0)==(e[d+16>>2]|0)){Dt[e[(e[d>>2]|0)+40>>2]&127](d)|0,N=R,k=w;continue}else{e[C>>2]=D+1,N=R,k=w;continue}}do if(d){if((e[d+12>>2]|0)==(e[d+16>>2]|0))if((Dt[e[(e[d>>2]|0)+36>>2]&127](d)|0)==-1){e[t>>2]=0,d=0;break}else{d=e[t>>2]|0;break}}else d=0;while(!1);d=(d|0)==0;do if(w){if((e[w+12>>2]|0)==(e[w+16>>2]|0)&&(Dt[e[(e[w>>2]|0)+36>>2]&127](w)|0)==-1){e[r>>2]=0,U=50;break}if(d)break e}else U=50;while(!1);if((U|0)==50&&!d)break;e[o>>2]=e[o>>2]|2;break}e[o>>2]=e[o>>2]|4,h=0}while(!1);return h|0}function hi(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0;h=e[t>>2]|0;do if(h)if(d=e[h+12>>2]|0,(d|0)==(e[h+16>>2]|0)?h=Dt[e[(e[h>>2]|0)+36>>2]&127](h)|0:h=e[d>>2]|0,(h|0)==-1){e[t>>2]=0,w=1;break}else{w=(e[t>>2]|0)==0;break}else w=1;while(!1);d=e[r>>2]|0;do if(d)if(h=e[d+12>>2]|0,(h|0)==(e[d+16>>2]|0)?h=Dt[e[(e[d>>2]|0)+36>>2]&127](d)|0:h=e[h>>2]|0,(h|0)!=-1)if(w){_=17;break}else{_=16;break}else{e[r>>2]=0,_=14;break}else _=14;while(!1);(_|0)==14&&(w?_=16:(d=0,_=17));e:do if((_|0)==16)e[o>>2]=e[o>>2]|6,h=0;else if((_|0)==17){if(h=e[t>>2]|0,w=e[h+12>>2]|0,(w|0)==(e[h+16>>2]|0)?h=Dt[e[(e[h>>2]|0)+36>>2]&127](h)|0:h=e[w>>2]|0,!(Yt[e[(e[l>>2]|0)+12>>2]&63](l,2048,h)|0)){e[o>>2]=e[o>>2]|4,h=0;break}for(h=(Yt[e[(e[l>>2]|0)+52>>2]&63](l,h,0)|0)<<24>>24,w=e[t>>2]|0,C=w+12|0,D=e[C>>2]|0,(D|0)==(e[w+16>>2]|0)?(Dt[e[(e[w>>2]|0)+40>>2]&127](w)|0,N=c,k=d,C=d):(e[C>>2]=D+4,N=c,k=d,C=d);;){h=h+-48|0,R=N+-1|0,d=e[t>>2]|0;do if(d)if(w=e[d+12>>2]|0,(w|0)==(e[d+16>>2]|0)?d=Dt[e[(e[d>>2]|0)+36>>2]&127](d)|0:d=e[w>>2]|0,(d|0)==-1){e[t>>2]=0,D=1;break}else{D=(e[t>>2]|0)==0;break}else D=1;while(!1);do if(C)if(d=e[C+12>>2]|0,(d|0)==(e[C+16>>2]|0)?d=Dt[e[(e[C>>2]|0)+36>>2]&127](C)|0:d=e[d>>2]|0,(d|0)==-1){e[r>>2]=0,C=0,c=0,d=1;break}else{C=k,c=k,d=(k|0)==0;break}else C=k,c=0,d=1;while(!1);if(w=e[t>>2]|0,!((N|0)>1&(D^d)))break;if(d=e[w+12>>2]|0,(d|0)==(e[w+16>>2]|0)?d=Dt[e[(e[w>>2]|0)+36>>2]&127](w)|0:d=e[d>>2]|0,!(Yt[e[(e[l>>2]|0)+12>>2]&63](l,2048,d)|0))break e;if(h=((Yt[e[(e[l>>2]|0)+52>>2]&63](l,d,0)|0)<<24>>24)+(h*10|0)|0,d=e[t>>2]|0,w=d+12|0,D=e[w>>2]|0,(D|0)==(e[d+16>>2]|0)){Dt[e[(e[d>>2]|0)+40>>2]&127](d)|0,N=R,k=C,C=c;continue}else{e[w>>2]=D+4,N=R,k=C,C=c;continue}}do if(w)if(d=e[w+12>>2]|0,(d|0)==(e[w+16>>2]|0)?d=Dt[e[(e[w>>2]|0)+36>>2]&127](w)|0:d=e[d>>2]|0,(d|0)==-1){e[t>>2]=0,w=1;break}else{w=(e[t>>2]|0)==0;break}else w=1;while(!1);do if(C)if(d=e[C+12>>2]|0,(d|0)==(e[C+16>>2]|0)?d=Dt[e[(e[C>>2]|0)+36>>2]&127](C)|0:d=e[d>>2]|0,(d|0)!=-1){if(w)break e;break}else{e[r>>2]=0,_=60;break}else _=60;while(!1);if((_|0)==60&&!w)break;e[o>>2]=e[o>>2]|2}while(!1);return h|0}function J4(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0,w=0,C=0;h=t+4|0,l=(e[h>>2]|0)!=189,w=e[t>>2]|0,d=w,c=(e[o>>2]|0)-d|0,c=c>>>0<2147483647?c<<1:-1,d=(e[r>>2]|0)-d|0,w=Gi(l?w:0,c)|0,w||kn();do if(l)e[t>>2]=w,C=w;else if(l=e[t>>2]|0,e[t>>2]=w,l)if(g=0,ue(e[h>>2]|0,l|0),w=g,g=0,w&1)w=j(0)|0,$t(w);else{C=e[t>>2]|0;break}else C=w;while(!1);e[h>>2]=201,e[r>>2]=C+d,e[o>>2]=(e[t>>2]|0)+c}function e3(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0,w=0,C=0;h=t+4|0,l=(e[h>>2]|0)!=189,w=e[t>>2]|0,d=w,c=(e[o>>2]|0)-d|0,c=c>>>0<2147483647?c<<1:-1,d=(e[r>>2]|0)-d>>2,w=Gi(l?w:0,c)|0,w||kn();do if(l)e[t>>2]=w,C=w;else if(l=e[t>>2]|0,e[t>>2]=w,l)if(g=0,ue(e[h>>2]|0,l|0),w=g,g=0,w&1)w=j(0)|0,$t(w);else{C=e[t>>2]|0;break}else C=w;while(!1);e[h>>2]=201,e[r>>2]=C+(d<<2),e[o>>2]=(e[t>>2]|0)+(c>>>2<<2)}function t3(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0,w=0,C=0;h=r,l=S[t>>0]|0,l&1?(l=e[t>>2]|0,c=(l&-2)+-1|0,C=e[t+4>>2]|0,l=l&255):(c=10,C=(l&255)>>>1),w=o-h|0;do if((o|0)!=(r|0)){if((c-C|0)>>>0>>0&&(pr(t,c,C+w-c|0,C,C,0,0),l=S[t>>0]|0),l&1?d=e[t+8>>2]|0:d=t+1|0,h=o+(C-h)|0,(r|0)!=(o|0))for(l=r,c=d+C|0;S[c>>0]=S[l>>0]|0,l=l+1|0,(l|0)!=(o|0);)c=c+1|0;if(S[d+h>>0]=0,l=C+w|0,S[t>>0]&1){e[t+4>>2]=l;break}else{S[t>>0]=l<<1;break}}while(!1);return t|0}function i3(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0,w=0,C=0;h=t+4|0,l=(e[h>>2]|0)!=189,w=e[t>>2]|0,d=w,c=(e[o>>2]|0)-d|0,c=c>>>0<2147483647?c<<1:-1,d=(e[r>>2]|0)-d>>2,w=Gi(l?w:0,c)|0,w||kn();do if(l)e[t>>2]=w,C=w;else if(l=e[t>>2]|0,e[t>>2]=w,l)if(g=0,ue(e[h>>2]|0,l|0),w=g,g=0,w&1)w=j(0)|0,$t(w);else{C=e[t>>2]|0;break}else C=w;while(!1);e[h>>2]=201,e[r>>2]=C+(d<<2),e[o>>2]=(e[t>>2]|0)+(c>>>2<<2)}function n3(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0,w=0,C=0;h=r,l=S[t>>0]|0,l&1?(l=e[t>>2]|0,c=(l&-2)+-1|0,C=e[t+4>>2]|0,l=l&255):(c=1,C=(l&255)>>>1),w=o-h>>2;do if(w){if((c-C|0)>>>0>>0&&(Ws(t,c,C+w-c|0,C,C,0,0),l=S[t>>0]|0),l&1?d=e[t+8>>2]|0:d=t+4|0,h=C+((o-h|0)>>>2)|0,(r|0)!=(o|0))for(l=r,c=d+(C<<2)|0;e[c>>2]=e[l>>2],l=l+4|0,(l|0)!=(o|0);)c=c+4|0;if(e[d+(h<<2)>>2]=0,l=C+w|0,S[t>>0]&1){e[t+4>>2]=l;break}else{S[t>>0]=l<<1;break}}while(!1);return t|0}function r3(t,r){t=t|0,r=r|0;var o=0;e[t>>2]=0,e[t+4>>2]=0,e[t+8>>2]=0,S[t+128>>0]=0;do if(r)if(g=0,Ae(125,t|0,r|0),o=g,g=0,o&1)o=j()|0,yr(t),le(o|0);else{no(t,r);break}while(!1)}function s3(t,r){t=t|0,r=r|0,w0(t,r,x0(43148)|0)}function o3(t,r){t=t|0,r=r|0,w0(t,r,x0(43188)|0)}function l3(t,r){t=t|0,r=r|0,w0(t,r,x0(44220)|0)}function u3(t,r){t=t|0,r=r|0,w0(t,r,x0(44212)|0)}function c3(t,r){t=t|0,r=r|0,w0(t,r,x0(44280)|0)}function f3(t,r){t=t|0,r=r|0,w0(t,r,x0(44288)|0)}function h3(t,r){t=t|0,r=r|0,w0(t,r,x0(44344)|0)}function d3(t,r){t=t|0,r=r|0,w0(t,r,x0(44352)|0)}function p3(t,r){t=t|0,r=r|0,w0(t,r,x0(44360)|0)}function m3(t,r){t=t|0,r=r|0,w0(t,r,x0(44368)|0)}function g3(t,r){t=t|0,r=r|0,w0(t,r,x0(43260)|0)}function S3(t,r){t=t|0,r=r|0,w0(t,r,x0(43332)|0)}function A3(t,r){t=t|0,r=r|0,w0(t,r,x0(43392)|0)}function v3(t,r){t=t|0,r=r|0,w0(t,r,x0(43452)|0)}function x3(t,r){t=t|0,r=r|0,w0(t,r,x0(43764)|0)}function w3(t,r){t=t|0,r=r|0,w0(t,r,x0(43828)|0)}function y3(t,r){t=t|0,r=r|0,w0(t,r,x0(43892)|0)}function C3(t,r){t=t|0,r=r|0,w0(t,r,x0(43956)|0)}function T3(t,r){t=t|0,r=r|0,w0(t,r,x0(43992)|0)}function I3(t,r){t=t|0,r=r|0,w0(t,r,x0(44028)|0)}function E3(t,r){t=t|0,r=r|0,w0(t,r,x0(44064)|0)}function k3(t,r){t=t|0,r=r|0,w0(t,r,x0(44100)|0)}function D3(t,r){t=t|0,r=r|0,w0(t,r,x0(43544)|0)}function b3(t,r){t=t|0,r=r|0,w0(t,r,x0(43636)|0)}function N3(t,r){t=t|0,r=r|0,w0(t,r,x0(43668)|0)}function F3(t,r){t=t|0,r=r|0,w0(t,r,x0(43700)|0)}function R3(t,r){t=t|0,r=r|0,w0(t,r,x0(44140)|0)}function M3(t,r){t=t|0,r=r|0,w0(t,r,x0(44180)|0)}function yr(t){t=t|0;var r=0,o=0,l=0;o=e[t>>2]|0;do if(o){if(l=t+4|0,r=e[l>>2]|0,(r|0)!=(o|0)){do r=r+-4|0;while((r|0)!=(o|0));e[l>>2]=r}if((t+16|0)==(o|0)){S[t+128>>0]=0;break}else{he(o);break}}while(!1)}function _3(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0;if(d=t+4|0,o=e[d>>2]|0,l=e[t>>2]|0,c=o-l>>2,c>>>0>=r>>>0){if(c>>>0>r>>>0&&(h=l+(r<<2)|0,(o|0)!=(h|0))){do o=o+-4|0;while((o|0)!=(h|0));e[d>>2]=o}}else Y3(t,r-c|0)}function P3(t,r){t=t|0,r=r|0;var o=0;return o=e[t+8>>2]|0,(e[t+12>>2]|0)-o>>2>>>0>r>>>0?o=(e[o+(r<<2)>>2]|0)!=0:o=0,o|0}function L3(t){t=t|0;var r=0,o=0;o=t+4|0,r=e[o>>2]|0,o=e[o+4>>2]|0,t=(e[t>>2]|0)+(o>>1)|0,o&1&&(r=e[(e[t>>2]|0)+r>>2]|0),Mt[r&255](t)}function O3(t,r,o,l,c,h,d,w){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0,w=w|0;var C=0,D=0;e[o>>2]=t,e[h>>2]=l,w&2?(c-l|0)<3?t=1:(e[h>>2]=l+1,S[l>>0]=-17,C=e[h>>2]|0,e[h>>2]=C+1,S[C>>0]=-69,C=e[h>>2]|0,e[h>>2]=C+1,S[C>>0]=-65,C=4):C=4;e:do if((C|0)==4)if(D=r,t=e[o>>2]|0,t>>>0>>0)for(;;){if(w=I[t>>1]|0,C=w&65535,C>>>0>d>>>0){t=2;break e}do if((w&65535)<128){if(t=e[h>>2]|0,(c-t|0)<1){t=1;break e}e[h>>2]=t+1,S[t>>0]=w}else{if((w&65535)<2048){if(t=e[h>>2]|0,(c-t|0)<2){t=1;break e}e[h>>2]=t+1,S[t>>0]=C>>>6|192,l=e[h>>2]|0,e[h>>2]=l+1,S[l>>0]=C&63|128;break}if((w&65535)<55296){if(t=e[h>>2]|0,(c-t|0)<3){t=1;break e}e[h>>2]=t+1,S[t>>0]=C>>>12|224,l=e[h>>2]|0,e[h>>2]=l+1,S[l>>0]=C>>>6&63|128,l=e[h>>2]|0,e[h>>2]=l+1,S[l>>0]=C&63|128;break}if((w&65535)>=56320){if((w&65535)<57344){t=2;break e}if(t=e[h>>2]|0,(c-t|0)<3){t=1;break e}e[h>>2]=t+1,S[t>>0]=C>>>12|224,l=e[h>>2]|0,e[h>>2]=l+1,S[l>>0]=C>>>6&63|128,l=e[h>>2]|0,e[h>>2]=l+1,S[l>>0]=C&63|128;break}if((D-t|0)<4){t=1;break e}if(t=t+2|0,w=M[t>>1]|0,(w&64512|0)!=56320){t=2;break e}if((c-(e[h>>2]|0)|0)<4){t=1;break e}if(l=C&960,((l<<10)+65536|C<<10&64512|w&1023)>>>0>d>>>0){t=2;break e}e[o>>2]=t,t=(l>>>6)+1|0,l=e[h>>2]|0,e[h>>2]=l+1,S[l>>0]=t>>>2|240,l=e[h>>2]|0,e[h>>2]=l+1,S[l>>0]=C>>>2&15|t<<4&48|128,l=e[h>>2]|0,e[h>>2]=l+1,S[l>>0]=C<<4&48|w>>>6&15|128,C=e[h>>2]|0,e[h>>2]=C+1,S[C>>0]=w&63|128}while(!1);if(t=(e[o>>2]|0)+2|0,e[o>>2]=t,t>>>0>=r>>>0){t=0;break}}else t=0;while(!1);return t|0}function $3(t,r,o,l,c,h,d,w){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0,w=w|0;var C=0,D=0,k=0,N=0,R=0,_=0;e[o>>2]=t,e[h>>2]=l,w&4?(t=e[o>>2]|0,w=r,(w-t|0)>2&&(S[t>>0]|0)==-17&&(S[t+1>>0]|0)==-69&&(S[t+2>>0]|0)==-65?(e[o>>2]=t+3,C=e[h>>2]|0):C=l):(C=l,w=r),R=c,l=e[o>>2]|0,t=l>>>0>>0;e:do if(t&C>>>0>>0)for(;;){if(t=S[l>>0]|0,k=t&255,k>>>0>d>>>0){t=2;break e}do if(t<<24>>24>-1)I[C>>1]=t&255,e[o>>2]=l+1;else{if((t&255)<194){t=2;break e}if((t&255)<224){if((w-l|0)<2){t=1;break e}if(t=F[l+1>>0]|0,(t&192|0)!=128){t=2;break e}if(t=t&63|k<<6&1984,t>>>0>d>>>0){t=2;break e}I[C>>1]=t,e[o>>2]=l+2;break}if((t&255)<240){if((w-l|0)<3){t=1;break e}switch(D=S[l+1>>0]|0,t=S[l+2>>0]|0,k|0){case 224:{if((D&-32)<<24>>24!=-96){t=2;break e}break}case 237:{if((D&-32)<<24>>24!=-128){t=2;break e}break}default:if((D&-64)<<24>>24!=-128){t=2;break e}}if(t=t&255,(t&192|0)!=128){t=2;break e}if(t=(D&255)<<6&4032|k<<12|t&63,(t&65535)>>>0>d>>>0){t=2;break e}I[C>>1]=t,e[o>>2]=l+3;break}if((t&255)>=245){t=2;break e}if((w-l|0)<4){t=1;break e}switch(D=S[l+1>>0]|0,t=S[l+2>>0]|0,l=S[l+3>>0]|0,k|0){case 240:{if((D+112&255)>=48){t=2;break e}break}case 244:{if((D&-16)<<24>>24!=-128){t=2;break e}break}default:if((D&-64)<<24>>24!=-128){t=2;break e}}if(N=t&255,(N&192|0)!=128){t=2;break e}if(t=l&255,(t&192|0)!=128){t=2;break e}if((R-C|0)<4){t=1;break e}if(k=k&7,l=D&255,D=N<<6,t=t&63,(l<<12&258048|k<<18|D&4032|t)>>>0>d>>>0){t=2;break e}I[C>>1]=l<<2&60|N>>>4&3|((l>>>4&3|k<<2)<<6)+16320|55296,N=C+2|0,e[h>>2]=N,I[N>>1]=t|D&960|56320,e[o>>2]=(e[o>>2]|0)+4}while(!1);if(C=(e[h>>2]|0)+2|0,e[h>>2]=C,l=e[o>>2]|0,t=l>>>0>>0,!(t&C>>>0>>0)){_=39;break}}else _=39;while(!1);return(_|0)==39&&(t=t&1),t|0}function B3(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0;N=r,c&4|0&&(N-t|0)>2&&(S[t>>0]|0)==-17&&(S[t+1>>0]|0)==-69?c=(S[t+2>>0]|0)==-65?t+3|0:t:c=t;e:do if((o|0)!=0&c>>>0>>0){k=c,h=0;t:for(;;){if(c=S[k>>0]|0,D=c&255,D>>>0>l>>>0){c=k,h=42;break e}do if(c<<24>>24>-1)c=k+1|0;else{if((c&255)<194){c=k,h=42;break e}if((c&255)<224){if((N-k|0)<2){c=k,h=42;break e}if(c=F[k+1>>0]|0,(c&192|0)!=128){c=k,h=42;break e}if((c&63|D<<6&1984)>>>0>l>>>0){c=k,h=42;break e}c=k+2|0;break}if((c&255)<240){if(c=k,(N-c|0)<3){c=k,h=42;break e}switch(w=S[k+1>>0]|0,d=S[k+2>>0]|0,D|0){case 224:{if((w&-32)<<24>>24!=-96){h=20;break t}break}case 237:{if((w&-32)<<24>>24!=-128){h=22;break t}break}default:if((w&-64)<<24>>24!=-128){h=24;break t}}if(c=d&255,(c&192|0)!=128){c=k,h=42;break e}if(((w&255)<<6&4032|D<<12&61440|c&63)>>>0>l>>>0){c=k,h=42;break e}c=k+3|0;break}if((c&255)>=245){c=k,h=42;break e}if(c=k,(o-h|0)>>>0<2|(N-c|0)<4){c=k,h=42;break e}switch(C=S[k+1>>0]|0,d=S[k+2>>0]|0,w=S[k+3>>0]|0,D|0){case 240:{if((C+112&255)>=48){h=32;break t}break}case 244:{if((C&-16)<<24>>24!=-128){h=34;break t}break}default:if((C&-64)<<24>>24!=-128){h=36;break t}}if(d=d&255,(d&192|0)!=128){c=k,h=42;break e}if(c=w&255,(c&192|0)!=128){c=k,h=42;break e}if(((C&255)<<12&258048|D<<18&1835008|d<<6&4032|c&63)>>>0>l>>>0){c=k,h=42;break e}c=k+4|0,h=h+1|0}while(!1);if(h=h+1|0,h>>>0>>0&c>>>0>>0)k=c;else{h=42;break e}}if((h|0)==20){c=c-t|0;break}else if((h|0)==22){c=c-t|0;break}else if((h|0)==24){c=c-t|0;break}else if((h|0)==32){c=c-t|0;break}else if((h|0)==34){c=c-t|0;break}else if((h|0)==36){c=c-t|0;break}}else h=42;while(!1);return(h|0)==42&&(c=c-t|0),c|0}function V3(t,r,o,l,c,h,d,w){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0,w=w|0;var C=0,D=0;e[o>>2]=t,e[h>>2]=l,D=c,w&2?(D-l|0)<3?t=1:(e[h>>2]=l+1,S[l>>0]=-17,C=e[h>>2]|0,e[h>>2]=C+1,S[C>>0]=-69,C=e[h>>2]|0,e[h>>2]=C+1,S[C>>0]=-65,C=4):C=4;e:do if((C|0)==4)if(t=e[o>>2]|0,t>>>0>>0)for(;;){if(w=e[t>>2]|0,w>>>0>d>>>0|(w&-2048|0)==55296){t=2;break e}do if(w>>>0>=128){if(w>>>0<2048){if(t=e[h>>2]|0,(D-t|0)<2){t=1;break e}e[h>>2]=t+1,S[t>>0]=w>>>6|192,C=e[h>>2]|0,e[h>>2]=C+1,S[C>>0]=w&63|128;break}if(t=e[h>>2]|0,c=D-t|0,w>>>0<65536){if((c|0)<3){t=1;break e}e[h>>2]=t+1,S[t>>0]=w>>>12|224,C=e[h>>2]|0,e[h>>2]=C+1,S[C>>0]=w>>>6&63|128,C=e[h>>2]|0,e[h>>2]=C+1,S[C>>0]=w&63|128;break}else{if((c|0)<4){t=1;break e}e[h>>2]=t+1,S[t>>0]=w>>>18|240,C=e[h>>2]|0,e[h>>2]=C+1,S[C>>0]=w>>>12&63|128,C=e[h>>2]|0,e[h>>2]=C+1,S[C>>0]=w>>>6&63|128,C=e[h>>2]|0,e[h>>2]=C+1,S[C>>0]=w&63|128;break}}else{if(t=e[h>>2]|0,(D-t|0)<1){t=1;break e}e[h>>2]=t+1,S[t>>0]=w}while(!1);if(t=(e[o>>2]|0)+4|0,e[o>>2]=t,t>>>0>=r>>>0){t=0;break}}else t=0;while(!1);return t|0}function U3(t,r,o,l,c,h,d,w){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0,w=w|0;var C=0,D=0,k=0,N=0,R=0,_=0;e[o>>2]=t,e[h>>2]=l,w&4?(t=e[o>>2]|0,w=r,(w-t|0)>2&&(S[t>>0]|0)==-17&&(S[t+1>>0]|0)==-69&&(S[t+2>>0]|0)==-65&&(e[o>>2]=t+3,l=e[h>>2]|0),R=w):R=r,w=e[o>>2]|0,t=w>>>0>>0;e:do if(t&l>>>0>>0)for(;;){t=S[w>>0]|0,N=t&255;do if(t<<24>>24>-1){if(N>>>0>d>>>0){t=2;break e}e[l>>2]=N,e[o>>2]=w+1}else{if((t&255)<194){t=2;break e}if((t&255)<224){if((R-w|0)<2){t=1;break e}if(t=F[w+1>>0]|0,(t&192|0)!=128){t=2;break e}if(t=t&63|N<<6&1984,t>>>0>d>>>0){t=2;break e}e[l>>2]=t,e[o>>2]=w+2;break}if((t&255)<240){if((R-w|0)<3){t=1;break e}switch(C=S[w+1>>0]|0,t=S[w+2>>0]|0,N|0){case 224:{if((C&-32)<<24>>24!=-96){t=2;break e}break}case 237:{if((C&-32)<<24>>24!=-128){t=2;break e}break}default:if((C&-64)<<24>>24!=-128){t=2;break e}}if(t=t&255,(t&192|0)!=128){t=2;break e}if(t=(C&255)<<6&4032|N<<12&61440|t&63,t>>>0>d>>>0){t=2;break e}e[l>>2]=t,e[o>>2]=w+3;break}if((t&255)>=245){t=2;break e}if((R-w|0)<4){t=1;break e}switch(k=S[w+1>>0]|0,t=S[w+2>>0]|0,C=S[w+3>>0]|0,N|0){case 240:{if((k+112&255)>=48){t=2;break e}break}case 244:{if((k&-16)<<24>>24!=-128){t=2;break e}break}default:if((k&-64)<<24>>24!=-128){t=2;break e}}if(D=t&255,(D&192|0)!=128){t=2;break e}if(t=C&255,(t&192|0)!=128){t=2;break e}if(t=(k&255)<<12&258048|N<<18&1835008|D<<6&4032|t&63,t>>>0>d>>>0){t=2;break e}e[l>>2]=t,e[o>>2]=w+4}while(!1);if(l=(e[h>>2]|0)+4|0,e[h>>2]=l,w=e[o>>2]|0,t=w>>>0>>0,!(t&l>>>0>>0)){_=38;break}}else _=38;while(!1);return(_|0)==38&&(t=t&1),t|0}function z3(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0;N=r,c&4|0&&(N-t|0)>2&&(S[t>>0]|0)==-17&&(S[t+1>>0]|0)==-69?c=(S[t+2>>0]|0)==-65?t+3|0:t:c=t;e:do if((o|0)!=0&c>>>0>>0){D=c,k=0;t:for(;;){c=S[D>>0]|0,C=c&255;do if(c<<24>>24>-1){if(C>>>0>l>>>0){c=D,h=42;break e}c=D+1|0}else{if((c&255)<194){c=D,h=42;break e}if((c&255)<224){if((N-D|0)<2){c=D,h=42;break e}if(c=F[D+1>>0]|0,(c&192|0)!=128){c=D,h=42;break e}if((c&63|C<<6&1984)>>>0>l>>>0){c=D,h=42;break e}c=D+2|0;break}if((c&255)<240){if(c=D,(N-c|0)<3){c=D,h=42;break e}switch(d=S[D+1>>0]|0,h=S[D+2>>0]|0,C|0){case 224:{if((d&-32)<<24>>24!=-96){h=20;break t}break}case 237:{if((d&-32)<<24>>24!=-128){h=22;break t}break}default:if((d&-64)<<24>>24!=-128){h=24;break t}}if(c=h&255,(c&192|0)!=128){c=D,h=42;break e}if(((d&255)<<6&4032|C<<12&61440|c&63)>>>0>l>>>0){c=D,h=42;break e}c=D+3|0;break}if((c&255)>=245){c=D,h=42;break e}if(c=D,(N-c|0)<4){c=D,h=42;break e}switch(w=S[D+1>>0]|0,h=S[D+2>>0]|0,d=S[D+3>>0]|0,C|0){case 240:{if((w+112&255)>=48){h=32;break t}break}case 244:{if((w&-16)<<24>>24!=-128){h=34;break t}break}default:if((w&-64)<<24>>24!=-128){h=36;break t}}if(h=h&255,(h&192|0)!=128){c=D,h=42;break e}if(c=d&255,(c&192|0)!=128){c=D,h=42;break e}if(((w&255)<<12&258048|C<<18&1835008|h<<6&4032|c&63)>>>0>l>>>0){c=D,h=42;break e}c=D+4|0}while(!1);if(k=k+1|0,k>>>0>>0&c>>>0>>0)D=c;else{h=42;break e}}if((h|0)==20){c=c-t|0;break}else if((h|0)==22){c=c-t|0;break}else if((h|0)==24){c=c-t|0;break}else if((h|0)==32){c=c-t|0;break}else if((h|0)==34){c=c-t|0;break}else if((h|0)==36){c=c-t|0;break}}else h=42;while(!1);return(h|0)==42&&(c=c-t|0),c|0}function G3(t){t=t|0,de(45196),de(45184),de(45172),de(45160),de(45148),de(45136),de(45124),de(45112),de(45100),de(45088),de(45076),de(45064),de(45052),de(45040)}function q3(t){t=t|0,Pt(45368),Pt(45356),Pt(45344),Pt(45332),Pt(45320),Pt(45308),Pt(45296),Pt(45284),Pt(45272),Pt(45260),Pt(45248),Pt(45236),Pt(45224),Pt(45212)}function W3(t){t=t|0,de(46e3),de(45988),de(45976),de(45964),de(45952),de(45940),de(45928),de(45916),de(45904),de(45892),de(45880),de(45868),de(45856),de(45844),de(45832),de(45820),de(45808),de(45796),de(45784),de(45772),de(45760),de(45748),de(45736),de(45724)}function H3(t){t=t|0,Pt(46292),Pt(46280),Pt(46268),Pt(46256),Pt(46244),Pt(46232),Pt(46220),Pt(46208),Pt(46196),Pt(46184),Pt(46172),Pt(46160),Pt(46148),Pt(46136),Pt(46124),Pt(46112),Pt(46100),Pt(46088),Pt(46076),Pt(46064),Pt(46052),Pt(46040),Pt(46028),Pt(46016)}function Q3(t){t=t|0,de(47104),de(47092),de(47080),de(47068),de(47056),de(47044),de(47032),de(47020),de(47008),de(46996),de(46984),de(46972),de(46960),de(46948),de(46936),de(46924),de(46912),de(46900),de(46888),de(46876),de(46864),de(46852),de(46840),de(46828)}function K3(t){t=t|0,Pt(47396),Pt(47384),Pt(47372),Pt(47360),Pt(47348),Pt(47336),Pt(47324),Pt(47312),Pt(47300),Pt(47288),Pt(47276),Pt(47264),Pt(47252),Pt(47240),Pt(47228),Pt(47216),Pt(47204),Pt(47192),Pt(47180),Pt(47168),Pt(47156),Pt(47144),Pt(47132),Pt(47120)}function Y3(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0;C=b,b=b+32|0,w=C,h=e[t+8>>2]|0,o=e[t+4>>2]|0,h-o>>2>>>0>>0?(l=e[t>>2]|0,d=o-l>>2,c=d+r|0,c>>>0>1073741823&&pi(t),o=h-l|0,o>>2>>>0<536870911?(o=o>>1,o=o>>>0>>0?c:o):o=1073741823,j3(w,o,d,t+16|0),d=w+8|0,h=e[d>>2]|0,Jt(h|0,0,r<<2|0)|0,e[d>>2]=h+(r<<2),X3(t,w),Z3(w)):no(t,r),b=C}function no(t,r){t=t|0,r=r|0;var o=0;o=t+4|0,t=r,r=e[o>>2]|0;do e[r>>2]=0,r=(e[o>>2]|0)+4|0,e[o>>2]=r,t=t+-1|0;while(t|0)}function j3(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0;e[t+12>>2]=0,e[t+16>>2]=l;do if(r)if(c=l+112|0,r>>>0<29&(S[c>>0]|0)==0){S[c>>0]=1;break}else{l=Xe(r<<2)|0;break}else l=0;while(!1);e[t>>2]=l,o=l+(o<<2)|0,e[t+8>>2]=o,e[t+4>>2]=o,e[t+12>>2]=l+(r<<2)}function X3(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0;l=e[t>>2]|0,h=t+4|0,o=r+4|0,c=(e[h>>2]|0)-l|0,d=(e[o>>2]|0)+(0-(c>>2)<<2)|0,e[o>>2]=d,o0(d|0,l|0,c|0)|0,c=e[t>>2]|0,e[t>>2]=e[o>>2],e[o>>2]=c,c=r+8|0,l=e[h>>2]|0,e[h>>2]=e[c>>2],e[c>>2]=l,c=t+8|0,t=r+12|0,l=e[c>>2]|0,e[c>>2]=e[t>>2],e[t>>2]=l,e[r>>2]=e[o>>2]}function Z3(t){t=t|0;var r=0,o=0,l=0;if(o=e[t+4>>2]|0,l=t+8|0,r=e[l>>2]|0,(r|0)!=(o|0)){do r=r+-4|0;while((r|0)!=(o|0));e[l>>2]=r}o=e[t>>2]|0;do if(o)if(r=e[t+16>>2]|0,(r|0)==(o|0)){S[r+112>>0]=0;break}else{he(o);break}while(!1)}function J3(t,r){t=t|0,r=r|0;var o=0;r>>>0>1073741823&&pi(t),o=t+128|0,r>>>0<29&(S[o>>0]|0)==0?(S[o>>0]=1,o=t+16|0):o=Xe(r<<2)|0,e[t+4>>2]=o,e[t>>2]=o,e[t+8>>2]=o+(r<<2)}function e5(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0,w=0;w=b,b=b+16|0,d=w;do if((t|0)!=(r|0)){if(c=S0()|0,h=e[c>>2]|0,e[c>>2]=0,l=+Fr(t,d,b0()|0),t=e[c>>2]|0,t||(e[c>>2]=h),(e[d>>2]|0)!=(r|0)){e[o>>2]=4,l=0;break}(t|0)==34&&(e[o>>2]=4)}else e[o>>2]=4,l=0;while(!1);return b=w,+l}function t5(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0,w=0;w=b,b=b+16|0,d=w;do if((t|0)!=(r|0)){if(c=S0()|0,h=e[c>>2]|0,e[c>>2]=0,l=+Fr(t,d,b0()|0),t=e[c>>2]|0,t||(e[c>>2]=h),(e[d>>2]|0)!=(r|0)){e[o>>2]=4,l=0;break}(t|0)==34&&(e[o>>2]=4)}else e[o>>2]=4,l=0;while(!1);return b=w,+l}function i5(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0,w=0;w=b,b=b+16|0,d=w;do if((t|0)==(r|0))e[o>>2]=4,l=0;else{if(c=S0()|0,h=e[c>>2]|0,e[c>>2]=0,l=+Fr(t,d,b0()|0),t=e[c>>2]|0,t||(e[c>>2]=h),(e[d>>2]|0)!=(r|0)){e[o>>2]=4,l=0;break}(t|0)==34&&(e[o>>2]=4)}while(!1);return b=w,+l}function n5(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0;w=b,b=b+16|0,d=w;do if((t|0)!=(r|0)){if((S[t>>0]|0)==45){e[o>>2]=4,l=0,t=0;break}if(c=S0()|0,h=e[c>>2]|0,e[c>>2]=0,t=Dn(t,d,l,b0()|0)|0,l=e[c>>2]|0,l||(e[c>>2]=h),(e[d>>2]|0)!=(r|0)){e[o>>2]=4,l=0,t=0;break}(l|0)==34?(e[o>>2]=4,l=-1,t=-1):l=ye}else e[o>>2]=4,l=0,t=0;while(!1);return ye=l,b=w,t|0}function r5(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0;C=b,b=b+16|0,w=C;do if((t|0)!=(r|0)){if((S[t>>0]|0)==45){e[o>>2]=4,t=0;break}if(h=S0()|0,d=e[h>>2]|0,e[h>>2]=0,t=Dn(t,w,l,b0()|0)|0,l=ye,c=e[h>>2]|0,c||(e[h>>2]=d),(e[w>>2]|0)!=(r|0)){e[o>>2]=4,t=0;break}if(l>>>0>0|(l|0)==0&t>>>0>4294967295|(c|0)==34){e[o>>2]=4,t=-1;break}else break}else e[o>>2]=4,t=0;while(!1);return b=C,t|0}function s5(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0;C=b,b=b+16|0,w=C;do if((t|0)!=(r|0)){if((S[t>>0]|0)==45){e[o>>2]=4,t=0;break}if(h=S0()|0,d=e[h>>2]|0,e[h>>2]=0,t=Dn(t,w,l,b0()|0)|0,l=ye,c=e[h>>2]|0,c||(e[h>>2]=d),(e[w>>2]|0)!=(r|0)){e[o>>2]=4,t=0;break}if(l>>>0>0|(l|0)==0&t>>>0>4294967295|(c|0)==34){e[o>>2]=4,t=-1;break}else break}else e[o>>2]=4,t=0;while(!1);return b=C,t|0}function o5(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0;C=b,b=b+16|0,w=C;do if((t|0)!=(r|0)){if((S[t>>0]|0)==45){e[o>>2]=4,t=0;break}if(h=S0()|0,d=e[h>>2]|0,e[h>>2]=0,t=Dn(t,w,l,b0()|0)|0,l=ye,c=e[h>>2]|0,c||(e[h>>2]=d),(e[w>>2]|0)!=(r|0)){e[o>>2]=4,t=0;break}if(l>>>0>0|(l|0)==0&t>>>0>65535|(c|0)==34){e[o>>2]=4,t=-1;break}else{t=t&65535;break}}else e[o>>2]=4,t=0;while(!1);return b=C,t|0}function l5(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0;C=b,b=b+16|0,w=C;do if((t|0)!=(r|0)){if(h=S0()|0,d=e[h>>2]|0,e[h>>2]=0,t=Ao(t,w,l,b0()|0)|0,l=ye,c=e[h>>2]|0,c||(e[h>>2]=d),(e[w>>2]|0)!=(r|0)){e[o>>2]=4,l=0,t=0;break}if((c|0)==34)return e[o>>2]=4,w=(l|0)>0|(l|0)==0&t>>>0>0,ye=w?2147483647:-2147483648,b=C,(w?-1:0)|0}else e[o>>2]=4,l=0,t=0;while(!1);return ye=l,b=C,t|0}function u5(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0;C=b,b=b+16|0,w=C;e:do if((t|0)==(r|0))e[o>>2]=4,t=0;else{if(h=S0()|0,d=e[h>>2]|0,e[h>>2]=0,t=Ao(t,w,l,b0()|0)|0,l=ye,c=e[h>>2]|0,c||(e[h>>2]=d),(e[w>>2]|0)!=(r|0)){e[o>>2]=4,t=0;break}do if((c|0)==34){if(e[o>>2]=4,(l|0)>0|(l|0)==0&t>>>0>0){t=2147483647;break e}}else{if((l|0)<-1|(l|0)==-1&t>>>0<2147483648){e[o>>2]=4;break}if((l|0)>0|(l|0)==0&t>>>0>2147483647){e[o>>2]=4,t=2147483647;break e}else break e}while(!1);t=-2147483648}while(!1);return b=C,t|0}function c5(){}function ii(t,r,o,l){return t=t|0,r=r|0,o=o|0,l=l|0,l=r-l-(o>>>0>t>>>0|0)>>>0,ye=l,t-o>>>0|0|0}function Jt(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0;if(l=t+o|0,(o|0)>=20){if(r=r&255,h=t&3,d=r|r<<8|r<<16|r<<24,c=l&-4,h)for(h=t+4-h|0;(t|0)<(h|0);)S[t>>0]=r,t=t+1|0;for(;(t|0)<(c|0);)e[t>>2]=d,t=t+4|0}for(;(t|0)<(l|0);)S[t>>0]=r,t=t+1|0;return t-o|0}function $0(t,r,o,l){return t=t|0,r=r|0,o=o|0,l=l|0,o=t+o>>>0,ye=r+l+(o>>>0>>0|0)>>>0,o|0|0}function Di(t,r,o){return t=t|0,r=r|0,o=o|0,(o|0)<32?(ye=r>>>o,t>>>o|(r&(1<>>o-32|0)}function o0(t,r,o){t=t|0,r=r|0,o=o|0;var l=0;if((o|0)>=4096)return qo(t|0,r|0,o|0)|0;if(l=t|0,(t&3)==(r&3)){for(;t&3;){if(!o)return l|0;S[t>>0]=S[r>>0]|0,t=t+1|0,r=r+1|0,o=o-1|0}for(;(o|0)>=4;)e[t>>2]=e[r>>2],t=t+4|0,r=r+4|0,o=o-4|0}for(;(o|0)>0;)S[t>>0]=S[r>>0]|0,t=t+1|0,r=r+1|0,o=o-1|0;return l|0}function v0(t,r,o){return t=t|0,r=r|0,o=o|0,(o|0)<32?(ye=r<>>32-o,t<0;)t=t-1|0,r=r-1|0,o=o-1|0,S[t>>0]=S[r>>0]|0;t=l}else o0(t,r,o)|0;return t|0}function AA(t,r,o){return t=t|0,r=r|0,o=o|0,(o|0)<32?(ye=r>>o,t>>>o|(r&(1<>o-32|0)}function ro(t){t=t|0;var r=0;return r=S[X+(t&255)>>0]|0,(r|0)<8?r|0:(r=S[X+(t>>8&255)>>0]|0,(r|0)<8?r+8|0:(r=S[X+(t>>16&255)>>0]|0,(r|0)<8?r+16|0:(S[X+(t>>>24)>>0]|0)+24|0))}function f5(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0;return h=t&65535,c=r&65535,o=ee(c,h)|0,l=t>>>16,t=(o>>>16)+(ee(c,l)|0)|0,c=r>>>16,r=ee(c,h)|0,ye=(t>>>16)+(ee(c,l)|0)+(((t&65535)+r|0)>>>16)|0,t+r<<16|o&65535|0|0}function vA(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0,D=0;return D=r>>31|((r|0)<0?-1:0)<<1,C=((r|0)<0?-1:0)>>31|((r|0)<0?-1:0)<<1,h=l>>31|((l|0)<0?-1:0)<<1,c=((l|0)<0?-1:0)>>31|((l|0)<0?-1:0)<<1,w=ii(D^t,C^r,D,C)|0,d=ye,t=h^D,r=c^C,ii((wn(w,d,ii(h^o,c^l,h,c)|0,ye,0)|0)^t,ye^r,t,r)|0}function xA(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0,D=0;return c=b,b=b+16|0,w=c|0,d=r>>31|((r|0)<0?-1:0)<<1,h=((r|0)<0?-1:0)>>31|((r|0)<0?-1:0)<<1,D=l>>31|((l|0)<0?-1:0)<<1,C=((l|0)<0?-1:0)>>31|((l|0)<0?-1:0)<<1,t=ii(d^t,h^r,d,h)|0,r=ye,wn(t,r,ii(D^o,C^l,D,C)|0,ye,w)|0,l=ii(e[w>>2]^d,e[w+4>>2]^h,d,h)|0,o=ye,b=c,ye=o,l|0}function Qi(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0;return c=t,h=o,o=f5(c,h)|0,t=ye,ye=(ee(r,h)|0)+(ee(l,c)|0)+t|t&0,o|0|0|0}function xn(t,r,o,l){return t=t|0,r=r|0,o=o|0,l=l|0,wn(t,r,o,l,0)|0}function Cr(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0;return h=b,b=b+16|0,c=h|0,wn(t,r,o,l,c)|0,b=h,ye=e[c+4>>2]|0,e[c>>2]|0|0}function wn(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0;if(k=t,C=r,D=C,d=o,R=l,w=R,!D)return h=(c|0)!=0,w?h?(e[c>>2]=t|0,e[c+4>>2]=r&0,R=0,c=0,ye=R,c|0):(R=0,c=0,ye=R,c|0):(h&&(e[c>>2]=(k>>>0)%(d>>>0),e[c+4>>2]=0),R=0,c=(k>>>0)/(d>>>0)>>>0,ye=R,c|0);h=(w|0)==0;do if(d){if(!h){if(h=(st(w|0)|0)-(st(D|0)|0)|0,h>>>0<=31){N=h+1|0,w=31-h|0,r=h-31>>31,d=N,t=k>>>(N>>>0)&r|D<>>(N>>>0)&r,h=0,w=k<>2]=t|0,e[c+4>>2]=C|r&0,R=0,c=0,ye=R,c|0):(R=0,c=0,ye=R,c|0)}if(h=d-1|0,h&d){w=(st(d|0)|0)+33-(st(D|0)|0)|0,U=64-w|0,N=32-w|0,C=N>>31,_=w-32|0,r=_>>31,d=w,t=N-1>>31&D>>>(_>>>0)|(D<>>(w>>>0))&r,r=r&D>>>(w>>>0),h=k<>>(_>>>0))&C|k<>31;break}return c&&(e[c>>2]=h&k,e[c+4>>2]=0),(d|0)==1?(_=C|r&0,U=t|0|0,ye=_,U|0):(U=ro(d|0)|0,_=D>>>(U>>>0)|0,U=D<<32-U|k>>>(U>>>0)|0,ye=_,U|0)}else{if(h)return c&&(e[c>>2]=(D>>>0)%(d>>>0),e[c+4>>2]=0),_=0,U=(D>>>0)/(d>>>0)>>>0,ye=_,U|0;if(!k)return c&&(e[c>>2]=0,e[c+4>>2]=(D>>>0)%(w>>>0)),_=0,U=(D>>>0)/(w>>>0)>>>0,ye=_,U|0;if(h=w-1|0,!(h&w))return c&&(e[c>>2]=t|0,e[c+4>>2]=h&D|r&0),_=0,U=D>>>((ro(w|0)|0)>>>0),ye=_,U|0;if(h=(st(w|0)|0)-(st(D|0)|0)|0,h>>>0<=30){r=h+1|0,w=31-h|0,d=r,t=D<>>(r>>>0),r=D>>>(r>>>0),h=0,w=k<>2]=t|0,e[c+4>>2]=C|r&0,_=0,U=0,ye=_,U|0):(_=0,U=0,ye=_,U|0)}while(!1);if(!d)D=w,C=0,w=0;else{N=o|0|0,k=R|l&0,D=$0(N|0,k|0,-1,-1)|0,o=ye,C=w,w=0;do l=C,C=h>>>31|C<<1,h=w|h<<1,l=t<<1|l>>>31|0,R=t>>>31|r<<1|0,ii(D,o,l,R)|0,U=ye,_=U>>31|((U|0)<0?-1:0)<<1,w=_&1,t=ii(l,R,_&N,(((U|0)<0?-1:0)>>31|((U|0)<0?-1:0)<<1)&k)|0,r=ye,d=d-1|0;while(d|0);D=C,C=0}return d=0,c&&(e[c>>2]=t,e[c+4>>2]=r),_=(h|0)>>>31|(D|d)<<1|(d<<1|h>>>31)&0|C,U=(h<<1|0)&-2|w,ye=_,U|0}function h5(t,r,o,l,c,h,d,w){return t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0,w=w|0,HS[t&15](r|0,o|0,l|0,c|0,h|0,d|0,w|0)|0}function d5(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,Pn[t&15](r|0,o|0,l|0,c|0,h|0)}function p5(t,r,o,l,c,h,d){return t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=+d,QS[t&3](r|0,o|0,l|0,c|0,h|0,+d)|0}function m5(t,r){t=t|0,r=r|0,Mt[t&255](r|0)}function g5(t,r,o){t=t|0,r=r|0,o=o|0,t0[t&127](r|0,o|0)}function S5(t,r,o,l,c,h,d){return t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0,on[t&63](r|0,o|0,l|0,c|0,h|0,d|0)|0}function A5(t,r){return t=t|0,r=r|0,Dt[t&127](r|0)|0}function v5(t,r,o,l,c,h,d,w,C,D,k,N){return t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0,w=w|0,C=C|0,D=D|0,k=k|0,N=N|0,KS[t&3](r|0,o|0,l|0,c|0,h|0,d|0,w|0,C|0,D|0,k|0,N|0)|0}function x5(t,r,o,l){return t=t|0,r=r|0,o=o|0,l=l|0,Yt[t&63](r|0,o|0,l|0)|0}function w5(t,r,o,l,c,h,d,w,C,D,k,N,R,_,U,H){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0,w=w|0,C=C|0,D=D|0,k=k|0,N=N|0,R=R|0,_=_|0,U=U|0,H=H|0,YS[t&3](r|0,o|0,l|0,c|0,h|0,d|0,w|0,C|0,D|0,k|0,N|0,R|0,_|0,U|0,H|0)}function y5(t,r,o,l,c,h,d){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0,Vi[t&15](r|0,o|0,l|0,c|0,h|0,d|0)}function C5(t,r,o,l,c,h,d,w){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0,w=w|0,jS[t&7](r|0,o|0,l|0,c|0,h|0,d|0,w|0)}function T5(t,r,o,l,c,h,d,w,C,D,k){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0,w=w|0,C=C|0,D=D|0,k=k|0,XS[t&7](r|0,o|0,l|0,c|0,h|0,d|0,w|0,C|0,D|0,k|0)}function I5(t,r,o){return t=t|0,r=r|0,o=o|0,U0[t&63](r|0,o|0)|0}function E5(t,r,o,l,c,h){return t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,an[t&31](r|0,o|0,l|0,c|0,h|0)|0}function k5(t,r,o,l){return t=t|0,r=r|0,o=o|0,l=l|0,+ZS[t&3](r|0,o|0,l|0)}function D5(t){return t=t|0,JS[t&15]()|0}function b5(t,r,o,l,c){return t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,_r[t&31](r|0,o|0,l|0,c|0)|0}function N5(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0,Ln[t&15](r|0,o|0,l|0)}function F5(t){t=t|0,Vo[t&7]()}function R5(t,r,o,l,c,h,d,w,C){return t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0,w=w|0,C=C|0,Ci[t&15](r|0,o|0,l|0,c|0,h|0,d|0,w|0,C|0)|0}function M5(t,r,o,l,c,h){return t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=+h,eA[t&7](r|0,o|0,l|0,c|0,+h)|0}function _5(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,On[t&63](r|0,o|0,l|0,c|0)}function bi(t,r,o,l,c,h,d){return t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0,Ke(0),0}function sn(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,Ke(1)}function so(t,r,o,l,c,h){return t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=+h,Ke(2),0}function e0(t){t=t|0,Ke(3)}function Tr(t,r){t=t|0,r=r|0,Ke(4)}function N0(t,r,o,l,c,h){return t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,Ke(5),0}function r0(t){return t=t|0,Ke(6),0}function P5(t){return t=t|0,Br(t|0)|0}function L5(t){return t=t|0,Gr(t|0)|0}function O5(t){return t=t|0,jo(t|0)|0}function oo(t,r,o,l,c,h,d,w,C,D,k){return t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0,w=w|0,C=C|0,D=D|0,k=k|0,Ke(7),0}function C0(t,r,o){return t=t|0,r=r|0,o=o|0,Ke(8),0}function ao(t,r,o,l,c,h,d,w,C,D,k,N,R,_,U){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0,w=w|0,C=C|0,D=D|0,k=k|0,N=N|0,R=R|0,_=_|0,U=U|0,Ke(9)}function Ni(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,Ke(10)}function yn(t,r,o,l,c,h,d){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0,Ke(11)}function Cn(t,r,o,l,c,h,d,w,C,D){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0,w=w|0,C=C|0,D=D|0,Ke(12)}function L0(t,r){return t=t|0,r=r|0,Ke(13),0}function di(t,r,o,l,c){return t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,Ke(14),0}function $5(t,r,o){return t=t|0,r=r|0,o=o|0,Ke(15),0}function Li(){return Ke(16),0}function Ki(t,r,o,l){return t=t|0,r=r|0,o=o|0,l=l|0,Ke(17),0}function B5(t,r,o){t=t|0,r=r|0,o=o|0,Ke(18)}function V5(t,r,o){t=t|0,r=r|0,o=o|0,Qt(t|0,r|0,o|0)}function lo(){Ke(19)}function U5(){Jo()}function z5(){ei()}function G5(){Ur()}function Yi(t,r,o,l,c,h,d,w){return t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0,w=w|0,Ke(20),0}function Tn(t,r,o,l,c){return t=t|0,r=r|0,o=o|0,l=l|0,c=+c,Ke(21),0}function H0(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0,Ke(22)}function q5(t){t=t|0;var r=0,o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0;if(D=b,b=b+32|0,w=D,m0(w,255,0),C=t+152|0,(e[w+4>>2]|0)==(e[C>>2]|0)&&(e[w+8>>2]|0)==(e[t+156>>2]|0)&&(e[w+12>>2]|0)==(e[t+160>>2]|0)){C=e[8900]|0,e[t+4580>>2]=C+(((e[8901]|0)-C|0)>>>1),b=D;return}for(o=t+4584|0,l=t+4588|0,c=e[l>>2]|0,r=e[o>>2]|0,h=c-r|0,h>>>0>=512?h>>>0>512&&(d=r+512|0,(c|0)!=(d|0))&&(e[l>>2]=d):(j0(o,512-h|0),r=e[o>>2]|0),w=t+4580|0,e[w>>2]=r+256,d=t+160|0,c=t+156|0,h=-256;;){if(r=e[d>>2]|0,(h|0)>(0-r|0))if(o=e[c>>2]|0,(h|0)>(0-o|0))if(l=e[C>>2]|0,(h|0)>(0-l|0))if((h|0)>=0){if((h|0)<1){S[(e[w>>2]|0)+h>>0]=0,h=1;continue}(l|0)<=(h|0)?(o|0)>(h|0)?r=2:r=(r|0)>(h|0)?3:4:r=1}else r=-1;else r=-2;else r=-3;else r=-4;if(S[(e[w>>2]|0)+h>>0]=r,h=h+1|0,(h|0)==256)break}b=D}function W5(t){t=t|0;var r=0,o=0;e[t>>2]=35660,r=e[t+4608>>2]|0,r&&(o=t+4612|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),e[t>>2]=36736,r=e[t+92>>2]|0,r&&(o=t+96|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),t=t+88|0,r=e[t>>2]|0,e[t>>2]=0,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r)}function H5(t){t=t|0;var r=0,o=0;if(e[t>>2]=35660,r=e[t+4608>>2]|0,r&&(o=t+4612|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),e[t>>2]=36736,r=e[t+92>>2]|0,r&&(o=t+96|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r)),o=t+88|0,r=e[o>>2]|0,e[o>>2]=0,!r){he(t);return}Mt[e[(e[r>>2]|0)+4>>2]&255](r),he(t)}function Q5(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0,G=0,$=0,P=0,O=0;if(G=b,b=b+352|0,$=G+328|0,P=G+192|0,o=G+343|0,l=G+342|0,c=G+341|0,h=G+340|0,R=G+176|0,w=G+168|0,C=G+160|0,D=G+152|0,K=G,U=G+136|0,e[t+28>>2]|0&&(e[t+20>>2]|0)!=1){if(_=t+4|0,H=t+32|0,d=e[H>>2]|0,!d){if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[o>>0]|0,$e(44,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}if(t=e[t+12>>2]|0,(t|0)==8)switch(d|0){case 1:{if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[l>>0]|0,$e(45,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 2:{if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[c>>0]|0,$e(46,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 3:{if(t=Xe(48)|0,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],S[$>>0]=S[h>>0]|0,$e(47,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}default:{d=P+56|0,c=P+4|0,e[P>>2]=36160,e[d>>2]=36180,g=0,Ae(62,P+56|0,c|0),G=g,g=0,G&1&&(O=j()|0,tt(d),le(O|0)),e[P+128>>2]=0,e[P+132>>2]=-1,e[P>>2]=36200,e[P+56>>2]=36220,g=0,ue(180,c|0),G=g,g=0;do if(G&1)t=j()|0;else{if(e[c>>2]=36236,h=P+36|0,e[h>>2]=0,e[h+4>>2]=0,e[h+8>>2]=0,e[h+12>>2]=0,e[P+52>>2]=16,e[$>>2]=0,e[$+4>>2]=0,e[$+8>>2]=0,g=0,Ae(63,c|0,$|0),G=g,g=0,G&1){t=j()|0,de($),de(h),wt(c);break}de($),g=0,t=Ve(28,P|0,49007,21)|0,$=g,g=0;do if(!($&1)&&(g=0,k=be(36,t|0,e[H>>2]|0)|0,$=g,g=0,!($&1))&&(g=0,Ve(28,k|0,50997,18)|0,$=g,g=0,!($&1))){if(l=Ct(16)|0,g=0,Ae(64,R|0,c|0),$=g,g=0,$&1)t=j()|0;else if(!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,Q|0)|0,bt(8)),g=0,$e(36,l|0,9,35648,R|0),$=g,g=0,$&1?o=1:(g=0,xe(6,l|0,824,96),g=0,o=0),t=j()|0,de(R),!o)break;Tt(l|0)}else O=34;while(!1);(O|0)==34&&(t=j()|0),e[P>>2]=36200,e[d>>2]=36220,e[c>>2]=36236,de(h),wt(c),tt(d),O=t,le(O|0)}while(!1);O=t,tt(d),le(O|0)}}switch((t|0)<=8&&(t=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,Q|0)|0,bt(8)),g=0,xe(7,t|0,8,35648),O=g,g=0,O&1||Qt(t|0,824,96),O=j()|0,Tt(t|0),le(O|0)),o=16-t|0,d|0){case 1:{if(t=Xe(60)|0,e[w>>2]=o,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],e[$>>2]=e[w>>2],e[$+4>>2]=e[w+4>>2],$e(41,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 2:{if(t=Xe(60)|0,e[C>>2]=o,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],e[$>>2]=e[C>>2],e[$+4>>2]=e[C+4>>2],$e(42,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}case 3:{if(t=Xe(60)|0,e[D>>2]=o,g=0,e[P>>2]=e[r>>2],e[P+4>>2]=e[r+4>>2],e[P+8>>2]=e[r+8>>2],e[$>>2]=e[D>>2],e[$+4>>2]=e[D+4>>2],$e(43,t|0,P|0,_|0,$|0),O=g,g=0,!(O&1))return O=t,b=G,O|0;O=j()|0,he(t),le(O|0)}default:{d=K+56|0,c=K+4|0,e[K>>2]=36160,e[d>>2]=36180,g=0,Ae(62,K+56|0,c|0),P=g,g=0,P&1&&(O=j()|0,tt(d),le(O|0)),e[K+128>>2]=0,e[K+132>>2]=-1,e[K>>2]=36200,e[K+56>>2]=36220,g=0,ue(180,c|0),P=g,g=0;do if(P&1)t=j()|0;else{if(e[c>>2]=36236,h=K+36|0,e[h>>2]=0,e[h+4>>2]=0,e[h+8>>2]=0,e[h+12>>2]=0,e[K+52>>2]=16,e[$>>2]=0,e[$+4>>2]=0,e[$+8>>2]=0,g=0,Ae(63,c|0,$|0),P=g,g=0,P&1){t=j()|0,de($),de(h),wt(c);break}de($),g=0,t=Ve(28,K|0,49007,21)|0,P=g,g=0;do if(!(P&1)&&(g=0,N=be(36,t|0,e[H>>2]|0)|0,P=g,g=0,!(P&1))&&(g=0,Ve(28,N|0,50997,18)|0,P=g,g=0,!(P&1))){if(l=Ct(16)|0,g=0,Ae(64,U|0,c|0),P=g,g=0,P&1)t=j()|0;else if(!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,Q|0)|0,bt(8)),g=0,$e(36,l|0,9,35648,U|0),P=g,g=0,P&1?o=1:(g=0,xe(6,l|0,824,96),g=0,o=0),t=j()|0,de(U),!o)break;Tt(l|0)}else O=64;while(!1);(O|0)==64&&(t=j()|0),e[K>>2]=36200,e[d>>2]=36220,e[c>>2]=36236,de(h),wt(c),tt(d),O=t,le(O|0)}while(!1);O=t,tt(d),le(O|0)}}}return o=e[r+4>>2]|0,l=Xe(16)|0,t=e[t+16>>2]|0,o?(e[l>>2]=36108,e[l+4>>2]=o,e[l+8>>2]=1,e[l+12>>2]=t,O=l,b=G,O|0):(O=e[r>>2]|0,e[l>>2]=36132,e[l+4>>2]=O,e[l+8>>2]=1,e[l+12>>2]=t,O=l,b=G,O|0)}function K5(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0;d=b,b=b+32|0,C=d,m0(C,e[t+128>>2]|0,e[t+136>>2]|0),w=e[r+4>>2]|0,h=e[r+8>>2]|0,h=h|0?h:e[C+8>>2]|0,c=e[r+12>>2]|0,c=c|0?c:e[C+12>>2]|0,o=e[r+16>>2]|0,l=e[C+16>>2]|0,e[t+176>>2]=w|0?w:e[C+4>>2]|0,e[t+180>>2]=h,e[t+184>>2]=c,t6(t),c=t+132|0,r=(e[c>>2]|0)+32|0,r=(r|0)<128?2:(r|0)/64|0,h=0;do e[t+188+(h*12|0)>>2]=r,e[t+188+(h*12|0)+4>>2]=0,I[t+188+(h*12|0)+8>>1]=0,I[t+188+(h*12|0)+10>>1]=1,h=h+1|0;while((h|0)!=365);w=(e[c>>2]|0)+32|0,w=(w|0)<128?2:(w|0)/64|0,C=(o|0?o:l)&255,e[t+4568>>2]=w,e[t+4572>>2]=0,S[t+4576>>0]=C,S[t+4577>>0]=1,S[t+4578>>0]=0,e[t+4580>>2]=w,e[t+4584>>2]=1,S[t+4588>>0]=C,S[t+4589>>0]=1,S[t+4590>>0]=0,e[t+4592>>2]=0,b=d}function Y5(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0;for(d=t+88|0,h=e[r>>2]|0,e[r>>2]=0,r=e[d>>2]|0,e[d>>2]=h,r&&Mt[e[(e[r>>2]|0)+4>>2]&255](r),d=l+4|0,h=e[d>>2]|0,S[t+4620>>0]=c&1,r=t+156|0,e[r>>2]=e[o>>2],e[r+4>>2]=e[o+4>>2],e[r+8>>2]=e[o+8>>2],e[r+12>>2]=e[o+12>>2],Y0(t,l),j5(t),r=e[t+116>>2]|0,t=e[t+112>>2]|0;c=r+-1|0,o=(S[c>>0]|0)==-1?7:8,!((t|0)<(o|0));)r=c,t=t-o|0;r=r-h|0,c=e[d>>2]|0,c&&(e[d>>2]=c+r,l=l+8|0,e[l>>2]=(e[l>>2]|0)-r)}function j5(t){t=t|0;var r=0,o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0,ce=0;ie=b,b=b+32|0,ne=ie+12|0,Z=ie,w=t+172|0,O=(e[w>>2]|0)+4|0,(e[t+28>>2]|0)==1?C=e[t+20>>2]|0:C=1,r=ee(C<<1,O)|0,e[ne>>2]=0,ce=ne+4|0,e[ce>>2]=0,e[ne+8>>2]=0;e:do if(r){if((r|0)<0&&(g=0,ue(178,ne|0),oe=g,g=0,oe&1)||(P=6),(P|0)==6&&(g=0,o=ge(67,r|0)|0,oe=g,g=0,!(oe&1))){for(e[ce>>2]=o,e[ne>>2]=o,e[ne+8>>2]=o+r;;)if(S[o>>0]=0,o=(e[ce>>2]|0)+1|0,e[ce>>2]=o,r=r+-1|0,!r)break e}o=j()|0,r=e[ne>>2]|0,r||le(o|0),(e[ce>>2]|0)!=(r|0)&&(e[ce>>2]=r),he(r),le(o|0)}while(!1);e[Z>>2]=0,oe=Z+4|0,e[oe>>2]=0,e[Z+8>>2]=0;do if(!C)P=19;else{if(C>>>0>1073741823&&(g=0,ue(178,Z|0),$=g,g=0,$&1)||(P=17),(P|0)==17&&(l=C<<2,g=0,c=ge(67,l|0)|0,$=g,g=0,!($&1))){e[Z>>2]=c,P=c+(C<<2)|0,e[Z+8>>2]=P,Jt(c|0,0,l|0)|0,e[oe>>2]=P,P=19;break}o=j()|0,r=e[Z>>2]|0,l=r,r&&(c=e[oe>>2]|0,(c|0)!=(r|0)&&(e[oe>>2]=c+(~((c+-4-l|0)>>>2)<<2)),he(r))}while(!1);if((P|0)==19){D=t+8|0,r=e[D>>2]|0;e:do if((r|0)>0){if(k=t+4596|0,N=ee(C,O)|0,R=N+1|0,_=t+4600|0,U=t+160|0,H=t+168|0,K=t+164|0,G=t+156|0,$=t+88|0,d=t+4592|0,(C|0)>0)h=0;else{for(h=0;;){if(c=e[ne>>2]|0,o=c+1|0,e[k>>2]=o,l=c+R|0,e[_>>2]=l,h&1?(e[k>>2]=l,e[_>>2]=o,o=1):o=R,C=e[U>>2]|0,(C|0)<=(h|0)&&(h|0)<((e[H>>2]|0)+C|0)){if(C=e[$>>2]|0,g=0,$e(e[(e[C>>2]|0)+8>>2]|0,C|0,c+(o+((e[G>>2]|0)-N))|0,e[K>>2]|0,O|0),C=g,g=0,C&1)break;r=e[D>>2]|0}if(h=h+1|0,(h|0)>=(r|0)){P=50;break e}}o=j()|0;break}t:for(;;){o=e[ne>>2]|0,r=o+1|0,e[k>>2]=r,o=o+R|0,e[_>>2]=o,h&1&&(e[k>>2]=o,e[_>>2]=r,r=o),c=e[Z>>2]|0,o=r,l=0;do{if(e[d>>2]=e[c+(l<<2)>>2],P=e[w>>2]|0,S[o+P>>0]=S[o+(P+-1)>>0]|0,S[(e[_>>2]|0)+-1>>0]=S[e[k>>2]>>0]|0,g=0,Ae(83,t|0,0),P=g,g=0,P&1){P=38;break t}c=e[Z>>2]|0,e[c+(l<<2)>>2]=e[d>>2],o=(e[k>>2]|0)+O|0,e[k>>2]=o,r=e[_>>2]|0,e[_>>2]=r+O,l=l+1|0}while((l|0)<(C|0));if(P=e[U>>2]|0,(P|0)<=(h|0)&&(h|0)<((e[H>>2]|0)+P|0)&&(P=e[$>>2]|0,g=0,$e(e[(e[P>>2]|0)+8>>2]|0,P|0,r+(O+((e[G>>2]|0)-N))|0,e[K>>2]|0,O|0),P=g,g=0,P&1)){P=30;break}if(h=h+1|0,(h|0)>=(e[D>>2]|0)){P=50;break e}}if((P|0)==30){o=j()|0;break}else if((P|0)==38){o=j()|0;break}}else P=50;while(!1);do if((P|0)==50){if(g=0,ue(183,t|0),t=g,g=0,t&1){o=j()|0;break}if(r=e[Z>>2]|0,o=r,r&&(l=e[oe>>2]|0,(l|0)!=(r|0)&&(e[oe>>2]=l+(~((l+-4-o|0)>>>2)<<2)),he(r)),r=e[ne>>2]|0,!r){b=ie;return}(e[ce>>2]|0)!=(r|0)&&(e[ce>>2]=r),he(r),b=ie;return}while(!1);r=e[Z>>2]|0,l=r,r&&(c=e[oe>>2]|0,(c|0)!=(r|0)&&(e[oe>>2]=c+(~((c+-4-l|0)>>>2)<<2)),he(r))}r=e[ne>>2]|0,r||le(o|0),(e[ce>>2]|0)!=(r|0)&&(e[ce>>2]=r),he(r),le(o|0)}function X5(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0;if(R=t+4596|0,o=e[R>>2]|0,K=t+172|0,r=e[K>>2]|0,!((r|0)<=0))for(_=t+4600|0,U=t+4604|0,H=t+4592|0,w=o,h=F[o+-1>>0]|0,o=F[o>>0]|0,N=0;D=e[_>>2]|0,d=S[D+(N+-1)>>0]|0,k=d&255,c=N+1|0,l=F[w+c>>0]|0,C=e[U>>2]|0,w=o-h|0,h=h-k|0,C=((((S[C+(l-o)>>0]|0)*9|0)+(S[C+w>>0]|0)|0)*9|0)+(S[C+h>>0]|0)|0,D=D+N|0,C?(r=o-k>>31,(r^h|0)<0?r=o:r=k+((r^w|0)<0?0:w)|0,k=Z5(t,C,F[D>>0]|0,r,0)|0,S[(e[_>>2]|0)+N>>0]=k):(r=J5(t,d,D,r-N|0)|0,o=r+N|0,(o|0)!=(e[K>>2]|0)&&(k=e6(t,k,F[(e[R>>2]|0)+o>>0]|0)|0,S[(e[_>>2]|0)+o>>0]=k,k=e[H>>2]|0,e[H>>2]=(k|0)<1?0:k+-1|0,r=r+1|0),c=r+N|0,l=e[R>>2]|0,o=F[l+(c+-1)>>0]|0,l=F[l+c>>0]|0),r=e[K>>2]|0,!((r|0)<=(c|0));)w=e[R>>2]|0,h=o,o=l,N=c}function Z5(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0;if(U=r>>31,C=(U^r)-U|0,R=t+188+(C*12|0)+10|0,o=I[R>>1]|0,N=t+188+(C*12|0)|0,c=e[N>>2]|0,(o|0)<(c|0))if((o<<1|0)<(c|0))if((o<<2|0)<(c|0))if((o<<3|0)<(c|0))if((o<<4|0)<(c|0))for(r=5;(o<>1]^U)-U+l|0,_=t+128|0,c=e[_>>2]|0,(o&c|0)==(o|0)?D=o:D=c&~(o>>31),o=t+112|0,(e[o>>2]|0)<8&&P0(t),c=t+108|0,l=e[c>>2]|0,h=l>>>24,d=e[2832+(r<<11)+(h<<3)+4>>2]|0,d?(e[o>>2]=(e[o>>2]|0)-d,e[c>>2]=l<>2]|0):(w=e[t+148>>2]|0,c=e[t+140>>2]|0,o=X0(t)|0,(o|0)<(w+-1-c|0)?r&&(o=(l0(t,r)|0)+(o<>31^o>>1,(((o|0)>-1?o:0-o|0)|0)>65535&&(o=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,Q|0)|0,bt(8)),g=0,xe(7,o|0,5,35648),t=g,g=0,t&1?(t=j()|0,Tt(o|0),le(t|0)):Qt(o|0,824,96))),w=t+136|0,l=e[w>>2]|0,r?d=o:(l?c=0:c=(e[t+188+(C*12|0)+4>>2]<<1)+-1+(I[R>>1]|0)>>31,d=c^o),r=e[t+152>>2]|0,c=(e[N>>2]|0)+((d|0)>-1?d:0-d|0)|0,h=t+188+(C*12|0)+4|0,o=(e[h>>2]|0)+(ee(l<<1|1,d)|0)|0,l=I[R>>1]|0,(l|0)==(r|0)&&(c=c>>1,o=o>>1,l=r>>1),e[N>>2]=c,r=l+1|0,I[R>>1]=r,c=r+o|0,(c|0)>=1?(o|0)>0&&(o=o-r|0,R=I[k>>1]|0,I[k>>1]=(R<<16>>16<127&1)+(R&65535),o=(o|0)>0?0:o):(o=I[k>>1]|0,I[k>>1]=(o&65535)-(o<<16>>16>-128&1),o=(c|0)>(~l|0)?c:0-l|0),e[h>>2]=o,r=e[w>>2]|0,l=r<<1|1,c=(ee(l,(d^U)-U|0)|0)+D|0,(c|0)>=(0-r|0)?(o=e[_>>2]|0,(o+r|0)<(c|0)&&(c=c-(ee(e[t+132>>2]|0,l)|0)|0)):(c=(ee(e[t+132>>2]|0,l)|0)+c|0,o=e[_>>2]|0),(c&o|0)==(c|0)?(t=c,t=t&255,t|0):(t=o&~(c>>31),t=t&255,t|0)}function J5(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0;for(w=t+112|0,C=t+108|0,D=t+4592|0,c=e[w>>2]|0,h=0;;){if((c|0)<1&&(P0(t),c=e[w>>2]|0),d=e[C>>2]|0,c=c+-1|0,e[w>>2]=c,e[C>>2]=d<<1,(d|0)>=0){k=8;break}if(d=e[D>>2]|0,N=1<>2],R=l-h|0,R=(N|0)<(R|0)?N:R,h=R+h|0,(R|0)==(N|0)&&(e[D>>2]=(d|0)>30?31:d+1|0),(h|0)==(l|0)){c=l;break}}return(k|0)==8&&((h|0)!=(l|0)?(c=e[D>>2]|0,(c+-4|0)>>>0<28?c=l0(t,e[36476+(c<<2)>>2]|0)|0:c=0,c=c+h|0,(c|0)>(l|0)&&(c=Ct(16)|0,!(S[8]|0)&&kt(8)|0&&(Ft(72,35648,Q|0)|0,bt(8)),g=0,xe(7,c|0,5,35648),R=g,g=0,R&1?(R=j()|0,Tt(c|0),le(R|0)):Qt(c|0,824,96))):c=l),(c|0)<=0||Jt(o|0,r|0,c|0)|0,c|0}function e6(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0;return h=r-o|0,d=t+128|0,l=t+136|0,(((h|0)>-1?h:0-h|0)|0)>(e[l>>2]|0)?(r=ee(uo(t,t+4568|0)|0,o-r>>31|1)|0,c=e[l>>2]|0,h=c<<1|1,r=(ee(r,h)|0)+o|0,(r|0)>=(0-c|0)?(l=e[d>>2]|0,(l+c|0)<(r|0)&&(r=r-(ee(e[t+132>>2]|0,h)|0)|0)):(r=(ee(e[t+132>>2]|0,h)|0)+r|0,l=e[d>>2]|0),(r&l|0)==(r|0)?(t=r,t=t&255,t|0):(t=l&~(r>>31),t=t&255,t|0)):(o=uo(t,t+4580|0)|0,h=e[l>>2]|0,c=h<<1|1,r=(ee(c,o)|0)+r|0,(r|0)>=(0-h|0)?(l=e[d>>2]|0,(l+h|0)<(r|0)&&(r=r-(ee(e[t+132>>2]|0,c)|0)|0)):(r=(ee(e[t+132>>2]|0,c)|0)+r|0,l=e[d>>2]|0),(r&l|0)==(r|0)?(t=r,t=t&255,t|0):(t=l&~(r>>31),t=t&255,t|0))}function uo(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0;if(D=r+9|0,o=F[D>>0]|0,h=r+4|0,c=(ee(o>>>1,e[h>>2]|0)|0)+(e[r>>2]|0)|0,(o|0)<(c|0)){l=0;do o=o<<1,l=l+1|0;while((o|0)<(c|0))}else l=0;d=e[t+148>>2]|0,w=e[36476+(e[t+4592>>2]<<2)>>2]|0,o=e[t+140>>2]|0,c=X0(t)|0;do if((c|0)<(d+-2-w-o|0))if(l){w=(l0(t,l)|0)+(c<>2]|0,c=w+l|0,d=c&1,o=d,h=1,c=(d+c|0)/2|0;break}else{l=e[h>>2]|0,t=l+c|0,o=t&1,t=(o+t|0)/2|0,C=8;break}else c=(l0(t,o)|0)+1|0,d=e[h>>2]|0,t=c+d|0,o=t&1,t=(o+t|0)/2|0,l?(w=c,h=1,c=t,l=d):(l=d,C=8);while(!1);return(C|0)==8&&(w=c,h=F[r+10>>0]<<1>>>0>=(F[D>>0]|0)>>>0,c=t),c=(o|0)!=0^h?c:0-c|0,(c|0)<0&&(C=r+10|0,S[C>>0]=(F[C>>0]|0)+1),o=(w+1-l>>1)+(e[r>>2]|0)|0,e[r>>2]=o,l=S[D>>0]|0,l<<24>>24!=(S[r+8>>0]|0)?(r=l,r=r&255,r=r+1|0,r=r&255,S[D>>0]=r,c|0):(e[r>>2]=o>>1,C=(l&255)>>>1,S[D>>0]=C,r=r+10|0,S[r>>0]=(F[r>>0]|0)>>>1,r=C,r=r&255,r=r+1|0,r=r&255,S[D>>0]=r,c|0)}function t6(t){t=t|0;var r=0,o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0;R=b,b=b+32|0,l=R,N=t+136|0;e:do if(e[N>>2]|0)r=t+144|0;else if(o=e[t+128>>2]|0,r=t+144|0,(o|0)==((1<>2])+-1|0)&&(m0(l,o,0),(e[l+4>>2]|0)==(e[t+176>>2]|0))&&(e[l+8>>2]|0)==(e[t+180>>2]|0)&&(e[l+12>>2]|0)==(e[t+184>>2]|0))switch(e[r>>2]|0){case 8:{N=e[8900]|0,e[t+4604>>2]=N+(((e[8901]|0)-N|0)>>>1),b=R;return}case 10:{N=e[8903]|0,e[t+4604>>2]=N+(((e[8904]|0)-N|0)>>>1),b=R;return}case 12:{N=e[8906]|0,e[t+4604>>2]=N+(((e[8907]|0)-N|0)>>>1),b=R;return}case 16:{N=e[8909]|0,e[t+4604>>2]=N+(((e[8910]|0)-N|0)>>>1),b=R;return}default:break e}while(!1);if(k=1<>2],o=t+4608|0,l=k<<1,c=t+4612|0,h=e[c>>2]|0,r=e[o>>2]|0,d=h-r|0,l>>>0<=d>>>0?l>>>0>>0&&(w=r+l|0,(h|0)!=(w|0))&&(e[c>>2]=w):(j0(o,l-d|0),r=e[o>>2]|0),D=t+4604|0,e[D>>2]=r+k,r=0-k|0,(k|0)<=(r|0)){b=R;return}w=t+184|0,C=t+180|0,d=t+176|0,h=r;do r=e[w>>2]|0,(h|0)>(0-r|0)?(o=e[C>>2]|0,(h|0)>(0-o|0)?(l=e[d>>2]|0,(h|0)>(0-l|0)?(c=e[N>>2]|0,(h|0)>=(0-c|0)?(c|0)<(h|0)?(l|0)<=(h|0)?(o|0)>(h|0)?r=2:r=(r|0)>(h|0)?3:4:r=1:r=0:r=-1):r=-2):r=-3):r=-4,S[(e[D>>2]|0)+h>>0]=r,h=h+1|0;while((h|0)!=(k|0));b=R}function i6(t){t=t|0,he(t)}function n6(t){return t=t|0,50767}function r6(t,r,o){t=t|0,r=r|0,o=o|0,yi(t,50754,12)}function s6(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0;U=b,b=b+16|0,H=U,e[H>>2]=0,K=H+4|0,e[K>>2]=0,e[H+8>>2]=0,R=H+8|0,g=0,c=ge(67,1)|0,N=g,g=0;e:do if(!(N&1)&&(N=c+1|0,S[c>>0]=o,e[H>>2]=c,e[K>>2]=N,e[R>>2]=N,g=0,Ae(84,H|0,r&65535|0),N=g,g=0,!(N&1))&&(g=0,Ae(84,H|0,t&65535|0),N=g,g=0,!(N&1))){if(D=l&255,c=e[K>>2]|0,o=e[R>>2]|0,c>>>0>=o>>>0){if(r=e[H>>2]|0,t=r,d=c-t+1|0,(d|0)<0){if(g=0,ue(178,H|0),N=g,g=0,N&1){_=52;break}t=e[H>>2]|0,o=e[R>>2]|0,r=t}if(C=r,c=o-C|0,c>>>0<1073741823?(c=c<<1,c=c>>>0>>0?d:c,o=e[K>>2]|0,w=o-C|0,c?_=12:(c=0,d=0)):(w=e[K>>2]|0,c=2147483647,o=w,w=w-C|0,_=12),(_|0)==12&&(g=0,d=ge(67,c|0)|0,N=g,g=0,N&1)){_=52;break}S[d+w>>0]=D,k=o-C|0,N=d+(w-k)|0,o0(N|0,r|0,k|0)|0,e[H>>2]=N,e[K>>2]=d+(w+1),e[R>>2]=d+c,t&&he(t)}else S[c>>0]=D,e[K>>2]=(e[K>>2]|0)+1;t:do if((l|0)>0){for(N=0;;){if(N=N+1|0,k=N&255,c=e[K>>2]|0,r=e[R>>2]|0,c>>>0>=r>>>0){if(t=e[H>>2]|0,o=t,d=c-o+1|0,(d|0)<0){if(g=0,ue(178,H|0),D=g,g=0,D&1)break;t=e[H>>2]|0,o=t,r=e[R>>2]|0}if(D=t,c=r-D|0,c>>>0<1073741823?(c=c<<1,c=c>>>0>>0?d:c,r=e[K>>2]|0,w=r-D|0,c?_=25:(C=0,d=0)):(w=e[K>>2]|0,c=2147483647,r=w,w=w-D|0,_=25),(_|0)==25){if(_=0,g=0,d=ge(67,c|0)|0,C=g,g=0,C&1)break;C=c}S[d+w>>0]=k,c=d+(w+1)|0,D=r-D|0,k=d+(w-D)|0,o0(k|0,t|0,D|0)|0,e[H>>2]=k,e[K>>2]=c,e[R>>2]=d+C,o&&(he(o),c=e[K>>2]|0)}else S[c>>0]=k,c=(e[K>>2]|0)+1|0,e[K>>2]=c;if(o=e[R>>2]|0,c>>>0>=o>>>0){if(r=e[H>>2]|0,t=r,d=c-t+1|0,(d|0)<0){if(g=0,ue(178,H|0),k=g,g=0,k&1)break;t=e[H>>2]|0,o=e[R>>2]|0,r=t}if(D=r,c=o-D|0,c>>>0<1073741823?(c=c<<1,c=c>>>0>>0?d:c,d=e[K>>2]|0,w=d-D|0,c?_=36:(C=0,o=0)):(w=e[K>>2]|0,c=2147483647,d=w,w=w-D|0,_=36),(_|0)==36){if(_=0,g=0,o=ge(67,c|0)|0,k=g,g=0,k&1)break;C=c}S[o+w>>0]=17,c=o+(w+1)|0,D=d-D|0,k=o+(w-D)|0,o0(k|0,r|0,D|0)|0,e[H>>2]=k,e[K>>2]=c,e[R>>2]=o+C,t&&(he(t),c=e[K>>2]|0)}else S[c>>0]=17,c=(e[K>>2]|0)+1|0,e[K>>2]=c;if(o=e[R>>2]|0,c>>>0>=o>>>0){if(r=e[H>>2]|0,t=r,d=c-t+1|0,(d|0)<0){if(g=0,ue(178,H|0),k=g,g=0,k&1)break;t=e[H>>2]|0,o=e[R>>2]|0,r=t}if(C=r,c=o-C|0,c>>>0<1073741823?(c=c<<1,c=c>>>0>>0?d:c,o=e[K>>2]|0,w=o-C|0,c?_=48:(c=0,d=0)):(w=e[K>>2]|0,c=2147483647,o=w,w=w-C|0,_=48),(_|0)==48&&(_=0,g=0,d=ge(67,c|0)|0,k=g,g=0,k&1))break;S[d+w>>0]=0,D=o-C|0,k=d+(w-D)|0,o0(k|0,r|0,D|0)|0,e[H>>2]=k,e[K>>2]=d+(w+1),e[R>>2]=d+c,t&&he(t)}else S[c>>0]=0,e[K>>2]=(e[K>>2]|0)+1;if((N|0)>=(l|0))break t}h=j()|0;break e}while(!1);if(g=0,w=ge(67,20)|0,l=g,g=0,l&1)_=52;else{e[w>>2]=36800,S[w+4>>0]=-9,t=w+8|0,e[t>>2]=0,d=w+12|0,e[d>>2]=0,o=w+16|0,e[o>>2]=0,c=e[K>>2]|0,l=e[H>>2]|0,r=c-l|0;do if((c|0)!=(l|0)){if((r|0)<0&&(g=0,ue(178,t|0),l=g,g=0,l&1)||(_=62),(_|0)==62&&(g=0,h=ge(67,r|0)|0,l=g,g=0,!(l&1))){if(e[d>>2]=h,e[t>>2]=h,e[o>>2]=h+r,c=e[H>>2]|0,o=e[K>>2]|0,(c|0)==(o|0))break;do S[h>>0]=S[c>>0]|0,h=(e[d>>2]|0)+1|0,e[d>>2]=h,c=c+1|0;while((c|0)!=(o|0));c=e[H>>2]|0;break}h=j()|0,c=e[t>>2]|0,c&&((e[d>>2]|0)!=(c|0)&&(e[d>>2]=c),he(c)),he(w);break e}while(!1);return c?((e[K>>2]|0)!=(c|0)&&(e[K>>2]=c),he(c),b=U,w|0):(b=U,w|0)}}else _=52;while(!1);return(_|0)==52&&(h=j()|0),c=e[H>>2]|0,c||le(h|0),(e[K>>2]|0)!=(c|0)&&(e[K>>2]=c),he(c),le(h|0),0}function o6(t){t=t|0;var r=0,o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0,G=0,$=0,P=0,O=0;K=b,b=b+32|0,_=K+28|0,$=K+16|0,H=K+4|0,U=K,e[$>>2]=0,P=$+4|0,e[P>>2]=0,e[$+8>>2]=0,N=Xe(5)|0,e[$>>2]=N,R=$+8|0,e[R>>2]=N+5,S[N>>0]=74,S[N+1>>0]=70,S[N+2>>0]=73,S[N+3>>0]=70,S[N+4>>0]=0,e[P>>2]=N+5,g=0,Ae(84,$|0,e[t>>2]&65535|0),N=g,g=0;e:do if(N&1)G=43;else{if(D=e[t+4>>2]&255,r=e[P>>2]|0,l=e[R>>2]|0,r>>>0>=l>>>0){if(c=e[$>>2]|0,h=c,d=r-h+1|0,(d|0)<0){if(g=0,ue(178,$|0),N=g,g=0,N&1){G=43;break}h=e[$>>2]|0,l=e[R>>2]|0,c=h}if(C=c,r=l-C|0,r>>>0<1073741823?(r=r<<1,r=r>>>0>>0?d:r,l=e[P>>2]|0,w=l-C|0,r?G=10:(r=0,d=0)):(w=e[P>>2]|0,r=2147483647,l=w,w=w-C|0,G=10),(G|0)==10&&(g=0,d=ge(67,r|0)|0,N=g,g=0,N&1)){G=43;break}S[d+w>>0]=D,k=l-C|0,N=d+(w-k)|0,o0(N|0,c|0,k|0)|0,e[$>>2]=N,e[P>>2]=d+(w+1),e[R>>2]=d+r,h&&he(h)}else S[r>>0]=D,e[P>>2]=(e[P>>2]|0)+1;if(g=0,Ae(84,$|0,e[t+8>>2]&65535|0),N=g,g=0,!(N&1)&&(g=0,Ae(84,$|0,e[t+12>>2]&65535|0),N=g,g=0,!(N&1))){if(N=t+16|0,k=e[N>>2]&255,r=e[P>>2]|0,c=e[R>>2]|0,r>>>0>=c>>>0){if(h=e[$>>2]|0,l=h,d=r-l+1|0,(d|0)<0){if(g=0,ue(178,$|0),D=g,g=0,D&1){G=43;break}h=e[$>>2]|0,l=h,c=e[R>>2]|0}if(D=h,r=c-D|0,r>>>0<1073741823?(r=r<<1,r=r>>>0>>0?d:r,d=e[P>>2]|0,w=d-D|0,r?G=23:(C=0,c=0)):(w=e[P>>2]|0,r=2147483647,d=w,w=w-D|0,G=23),(G|0)==23)if(g=0,c=ge(67,r|0)|0,C=g,g=0,C&1){G=43;break}else C=r;S[c+w>>0]=k,r=c+(w+1)|0,D=d-D|0,k=c+(w-D)|0,o0(k|0,h|0,D|0)|0,e[$>>2]=k,e[P>>2]=r,e[R>>2]=c+C,l&&(he(l),r=e[P>>2]|0)}else S[r>>0]=k,r=(e[P>>2]|0)+1|0,e[P>>2]=r;if(k=t+20|0,D=e[k>>2]&255,l=e[R>>2]|0,r>>>0>=l>>>0){if(c=e[$>>2]|0,h=c,d=r-h+1|0,(d|0)<0){if(g=0,ue(178,$|0),C=g,g=0,C&1){G=43;break}h=e[$>>2]|0,l=e[R>>2]|0,c=h}if(C=c,r=l-C|0,r>>>0<1073741823?(r=r<<1,r=r>>>0>>0?d:r,l=e[P>>2]|0,w=l-C|0,r?G=34:(r=0,d=0)):(w=e[P>>2]|0,r=2147483647,l=w,w=w-C|0,G=34),(G|0)==34&&(g=0,d=ge(67,r|0)|0,O=g,g=0,O&1)){G=43;break}S[d+w>>0]=D,D=l-C|0,O=d+(w-D)|0,o0(O|0,c|0,D|0)|0,e[$>>2]=O,e[P>>2]=d+(w+1),e[R>>2]=d+r,h&&he(h)}else S[r>>0]=D,e[P>>2]=(e[P>>2]|0)+1;r=e[N>>2]|0;do if((r|0)>0){if(!(e[t+24>>2]|0))if(e[U>>2]=e[P>>2],O=0+(ee(r*3|0,e[k>>2]|0)|0)|0,g=0,e[_>>2]=e[U>>2],Pe(15,$|0,_|0,0,O|0)|0,O=g,g=0,O&1){G=43;break e}else break;if(l=Ct(16)|0,g=0,xe(5,H|0,50792,57),O=g,g=0,O&1)r=j()|0;else if(g=0,r=Ce(1)|0,O=g,g=0,!(O&1)&&(g=0,$e(36,l|0,1,r|0,H|0),O=g,g=0,!(O&1))?(g=0,xe(6,l|0,824,96),g=0,o=0):o=1,r=j()|0,de(H),!o){o=r;break e}Tt(l|0),o=r;break e}while(!1);if(g=0,w=ge(67,20)|0,O=g,g=0,O&1)G=43;else{e[w>>2]=36800,S[w+4>>0]=-32,h=w+8|0,e[h>>2]=0,d=w+12|0,e[d>>2]=0,l=w+16|0,e[l>>2]=0,r=e[P>>2]|0,O=e[$>>2]|0,c=r-O|0;do if((r|0)!=(O|0)){if((c|0)<0&&(g=0,ue(178,h|0),O=g,g=0,O&1)||(G=53),(G|0)==53&&(g=0,o=ge(67,c|0)|0,O=g,g=0,!(O&1))){if(e[d>>2]=o,e[h>>2]=o,e[l>>2]=o+c,r=e[$>>2]|0,l=e[P>>2]|0,(r|0)==(l|0))break;do S[o>>0]=S[r>>0]|0,o=(e[d>>2]|0)+1|0,e[d>>2]=o,r=r+1|0;while((r|0)!=(l|0));r=e[$>>2]|0;break}r=j()|0,o=e[h>>2]|0,o&&((e[d>>2]|0)!=(o|0)&&(e[d>>2]=o),he(o)),he(w),G=44;break e}while(!1);return r?((e[P>>2]|0)!=(r|0)&&(e[P>>2]=r),he(r),b=K,w|0):(b=K,w|0)}}else G=43}while(!1);return(G|0)==43&&(r=j()|0,G=44),(G|0)==44&&(o=r),r=e[$>>2]|0,r||le(o|0),(e[P>>2]|0)!=(r|0)&&(e[P>>2]=r),he(r),le(o|0),0}function co(t){t=t|0;var r=0,o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0;w=b,b=b+16|0,D=w,e[D>>2]=0,k=D+4|0,e[k>>2]=0,e[D+8>>2]=0,g=0,r=ge(67,1)|0,d=g,g=0;e:do if(!(d&1)&&(d=r+1|0,S[r>>0]=1,e[D>>2]=r,e[k>>2]=d,e[D+8>>2]=d,g=0,Ae(84,D|0,e[t>>2]&65535|0),d=g,g=0,!(d&1))&&(g=0,Ae(84,D|0,e[t+4>>2]&65535|0),d=g,g=0,!(d&1))&&(g=0,Ae(84,D|0,e[t+8>>2]&65535|0),d=g,g=0,!(d&1))&&(g=0,Ae(84,D|0,e[t+12>>2]&65535|0),d=g,g=0,!(d&1))&&(g=0,Ae(84,D|0,e[t+16>>2]&65535|0),d=g,g=0,!(d&1))&&(g=0,C=ge(67,20)|0,d=g,g=0,!(d&1))){e[C>>2]=36800,S[C+4>>0]=-8,c=C+8|0,e[c>>2]=0,d=C+12|0,e[d>>2]=0,t=C+16|0,e[t>>2]=0,r=e[k>>2]|0,N=e[D>>2]|0,l=r-N|0;do if((r|0)!=(N|0)){if((l|0)<0&&(g=0,ue(178,c|0),N=g,g=0,N&1)||(h=11),(h|0)==11&&(g=0,o=ge(67,l|0)|0,N=g,g=0,!(N&1))){if(e[d>>2]=o,e[c>>2]=o,e[t>>2]=o+l,r=e[D>>2]|0,t=e[k>>2]|0,(r|0)==(t|0))break;do S[o>>0]=S[r>>0]|0,o=(e[d>>2]|0)+1|0,e[d>>2]=o,r=r+1|0;while((r|0)!=(t|0));r=e[D>>2]|0;break}o=j()|0,r=e[c>>2]|0,r&&((e[d>>2]|0)!=(r|0)&&(e[d>>2]=r),he(r)),he(C);break e}while(!1);return r?((e[k>>2]|0)!=(r|0)&&(e[k>>2]=r),he(r),b=w,C|0):(b=w,C|0)}else h=25;while(!1);return(h|0)==25&&(o=j()|0),r=e[D>>2]|0,r||le(o|0),(e[k>>2]|0)!=(r|0)&&(e[k>>2]=r),he(r),le(o|0),0}function a6(t){t=t|0;var r=0,o=0,l=0,c=0,h=0,d=0;return h=Xe(5)|0,S[h>>0]=109,S[h+1>>0]=114,S[h+2>>0]=102,S[h+3>>0]=120,S[h+4>>0]=t,g=0,c=ge(67,20)|0,l=g,g=0,l&1&&(c=j()|0,he(h),le(c|0)),e[c>>2]=36800,S[c+4>>0]=-24,t=c+8|0,e[t>>2]=0,r=c+12|0,e[r>>2]=0,o=c+16|0,e[o>>2]=0,g=0,l=ge(67,5)|0,d=g,g=0,d&1?(d=j()|0,he(c),he(h),le(d|0),0):(e[r>>2]=l,e[t>>2]=l,e[o>>2]=l+5,S[l>>0]=109,d=(e[r>>2]|0)+1|0,e[r>>2]=d,l=h+1|0,S[d>>0]=S[l>>0]|0,d=(e[r>>2]|0)+1|0,e[r>>2]=d,l=l+1|0,S[d>>0]=S[l>>0]|0,d=(e[r>>2]|0)+1|0,e[r>>2]=d,l=l+1|0,S[d>>0]=S[l>>0]|0,d=(e[r>>2]|0)+1|0,e[r>>2]=d,S[d>>0]=S[l+1>>0]|0,e[r>>2]=(e[r>>2]|0)+1,he(h),c|0)}function l6(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0,G=0,$=0,P=0;G=b,b=b+16|0,$=G,e[$>>2]=0,P=$+4|0,e[P>>2]=0,e[$+8>>2]=0,H=$+8|0,g=0,c=ge(67,1)|0,U=g,g=0;e:do if(U&1)K=29;else{if(w=c+1|0,U=w,S[c>>0]=r,e[$>>2]=c,e[P>>2]=U,e[H>>2]=U,(r|0)>0){d=w,U=0;do{if(_=U+t&255,d>>>0>=w>>>0){if(c=e[$>>2]|0,C=c,d=d-C+1|0,(d|0)<0){if(g=0,ue(178,$|0),R=g,g=0,R&1){K=28;break}C=e[$>>2]|0,w=e[H>>2]|0,R=C}else R=c;if(N=R,c=w-N|0,c>>>0<1073741823?(c=c<<1,c=c>>>0>>0?d:c,w=e[P>>2]|0,D=w-N|0,c?K=13:(k=0,d=0)):(D=e[P>>2]|0,c=2147483647,w=D,D=D-N|0,K=13),(K|0)==13)if(K=0,g=0,d=ge(67,c|0)|0,k=g,g=0,k&1){K=28;break}else k=c;S[d+D>>0]=_,c=d+(D+1)|0,N=w-N|0,_=d+(D-N)|0,o0(_|0,R|0,N|0)|0,e[$>>2]=_,e[P>>2]=c,e[H>>2]=d+k,C&&(he(C),c=e[P>>2]|0)}else S[d>>0]=_,c=(e[P>>2]|0)+1|0,e[P>>2]=c;if(w=e[H>>2]|0,c>>>0>=w>>>0){if(C=e[$>>2]|0,d=C,D=c-d+1|0,(D|0)<0){if(g=0,ue(178,$|0),_=g,g=0,_&1){K=28;break}C=e[$>>2]|0,d=C,w=e[H>>2]|0}if(N=C,c=w-N|0,c>>>0<1073741823?(c=c<<1,c=c>>>0>>0?D:c,D=e[P>>2]|0,w=D-N|0,c?K=24:(c=0,k=0)):(w=e[P>>2]|0,c=2147483647,D=w,w=w-N|0,K=24),(K|0)==24&&(K=0,g=0,k=ge(67,c|0)|0,_=g,g=0,_&1)){K=28;break}S[k+w>>0]=0,R=D-N|0,_=k+(w-R)|0,o0(_|0,C|0,R|0)|0,e[$>>2]=_,e[P>>2]=k+(w+1),e[H>>2]=k+c,d&&he(d)}else S[c>>0]=0,e[P>>2]=(e[P>>2]|0)+1;U=U+1|0,d=e[P>>2]|0,w=e[H>>2]|0}while((U|0)<(r|0));if((K|0)==28){h=j()|0;break}c=o&255,d>>>0>>0?(S[d>>0]=c,d=(e[P>>2]|0)+1|0,e[P>>2]=d):K=37}else d=w,c=o&255,K=37;if((K|0)==37){if(C=e[$>>2]|0,D=C,k=d-D+1|0,(k|0)<0){if(g=0,ue(178,$|0),o=g,g=0,o&1){K=29;break}D=e[$>>2]|0,w=e[H>>2]|0,C=D}if(_=C,d=w-_|0,d>>>0<1073741823?(d=d<<1,d=d>>>0>>0?k:d,k=e[P>>2]|0,N=k-_|0,d?K=43:(R=0,w=0)):(N=e[P>>2]|0,d=2147483647,k=N,N=N-_|0,K=43),(K|0)==43)if(g=0,w=ge(67,d|0)|0,o=g,g=0,o&1){K=29;break}else R=d;S[w+N>>0]=c,d=w+(N+1)|0,t=k-_|0,o=w+(N-t)|0,o0(o|0,C|0,t|0)|0,e[$>>2]=o,e[P>>2]=d,e[H>>2]=w+R,D&&(he(D),d=e[P>>2]|0)}if(_=l&255,c=e[H>>2]|0,d>>>0>=c>>>0){if(w=e[$>>2]|0,C=w,d=d-C+1|0,(d|0)<0){if(g=0,ue(178,$|0),l=g,g=0,l&1){K=29;break}C=e[$>>2]|0,c=e[H>>2]|0,w=C}if(R=w,c=c-R|0,c>>>0<1073741823?(c=c<<1,c=c>>>0>>0?d:c,D=e[P>>2]|0,k=D-R|0,c?K=54:(N=0,d=0)):(k=e[P>>2]|0,c=2147483647,D=k,k=k-R|0,K=54),(K|0)==54)if(g=0,d=ge(67,c|0)|0,l=g,g=0,l&1){K=29;break}else N=c;S[d+k>>0]=_,c=d+(k+1)|0,o=D-R|0,l=d+(k-o)|0,o0(l|0,w|0,o|0)|0,e[$>>2]=l,e[P>>2]=c,e[H>>2]=d+N,C&&(he(C),c=e[P>>2]|0)}else S[d>>0]=_,c=(e[P>>2]|0)+1|0,e[P>>2]=c;if(d=e[H>>2]|0,c>>>0>=d>>>0){if(w=e[$>>2]|0,C=w,D=c-C+1|0,(D|0)<0){if(g=0,ue(178,$|0),l=g,g=0,l&1){K=29;break}C=e[$>>2]|0,d=e[H>>2]|0,w=C}if(N=w,c=d-N|0,c>>>0<1073741823?(c=c<<1,c=c>>>0>>0?D:c,d=e[P>>2]|0,k=d-N|0,c?K=65:(c=0,D=0)):(k=e[P>>2]|0,c=2147483647,d=k,k=k-N|0,K=65),(K|0)==65&&(g=0,D=ge(67,c|0)|0,l=g,g=0,l&1)){K=29;break}S[D+k>>0]=0,o=d-N|0,l=D+(k-o)|0,o0(l|0,w|0,o|0)|0,e[$>>2]=l,e[P>>2]=D+(k+1),e[H>>2]=D+c,C&&he(C)}else S[c>>0]=0,e[P>>2]=(e[P>>2]|0)+1;if(g=0,k=ge(67,20)|0,H=g,g=0,H&1)K=29;else{e[k>>2]=36800,S[k+4>>0]=-38,C=k+8|0,e[C>>2]=0,D=k+12|0,e[D>>2]=0,d=k+16|0,e[d>>2]=0,c=e[P>>2]|0,H=e[$>>2]|0,w=c-H|0;do if((c|0)!=(H|0)){if((w|0)<0&&(g=0,ue(178,C|0),H=g,g=0,H&1)||(K=72),(K|0)==72&&(g=0,h=ge(67,w|0)|0,H=g,g=0,!(H&1))){if(e[D>>2]=h,e[C>>2]=h,e[d>>2]=h+w,c=e[$>>2]|0,d=e[P>>2]|0,(c|0)==(d|0))break;do S[h>>0]=S[c>>0]|0,h=(e[D>>2]|0)+1|0,e[D>>2]=h,c=c+1|0;while((c|0)!=(d|0));c=e[$>>2]|0;break}h=j()|0,c=e[C>>2]|0,c&&((e[D>>2]|0)!=(c|0)&&(e[D>>2]=c),he(c)),he(k);break e}while(!1);return c?((e[P>>2]|0)!=(c|0)&&(e[P>>2]=c),he(c),b=G,k|0):(b=G,k|0)}}while(!1);return(K|0)==29&&(h=j()|0),c=e[$>>2]|0,c||le(h|0),(e[P>>2]|0)!=(c|0)&&(e[P>>2]=c),he(c),le(h|0),0}function u6(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0;if(N=(r&65535)>>>8&255,R=t+4|0,o=e[R>>2]|0,_=t+8|0,l=e[_>>2]|0,o>>>0>=l>>>0?(c=e[t>>2]|0,h=c,d=o-h+1|0,(d|0)<0&&(pi(t),h=e[t>>2]|0,l=e[_>>2]|0,c=h),k=c,o=l-k|0,o>>>0<1073741823?(o=o<<1,o=o>>>0>>0?d:o,d=e[R>>2]|0,l=d-k|0,o?U=8:(D=0,C=0,w=l,o=d)):(l=e[R>>2]|0,o=2147483647,d=l,l=l-k|0,U=8),(U|0)==8&&(D=o,C=Xe(o)|0,w=l,o=d),S[C+w>>0]=N,l=C+(w+1)|0,k=o-k|0,N=C+(w-k)|0,o0(N|0,c|0,k|0)|0,e[t>>2]=N,e[R>>2]=l,e[_>>2]=C+D,h&&(he(h),l=e[R>>2]|0)):(S[o>>0]=N,l=(e[R>>2]|0)+1|0,e[R>>2]=l),k=r&255,o=e[_>>2]|0,l>>>0>>0){S[l>>0]=k,e[R>>2]=(e[R>>2]|0)+1;return}c=e[t>>2]|0,h=c,l=l-h+1|0,(l|0)<0&&(pi(t),h=e[t>>2]|0,o=e[_>>2]|0,c=h),D=c,o=o-D|0,o>>>0<1073741823?(o=o<<1,o=o>>>0>>0?l:o,d=e[R>>2]|0,l=d-D|0,o?U=18:(C=0,w=0,o=d)):(l=e[R>>2]|0,o=2147483647,d=l,l=l-D|0,U=18),(U|0)==18&&(C=o,w=Xe(o)|0,o=d),S[w+l>>0]=k,r=o-D|0,U=w+(l-r)|0,o0(U|0,c|0,r|0)|0,e[t>>2]=U,e[R>>2]=w+(l+1),e[_>>2]=w+C,h&&he(h)}function c6(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0;if(c=e[t>>2]|0,U=e[r>>2]|0,_=U,C=c,N=o,D=l-N|0,(D|0)<=0)return H=U,H|0;if(R=t+8|0,r=e[R>>2]|0,H=t+4|0,k=e[H>>2]|0,h=k,(D|0)<=(r-h|0)){if(w=h-_|0,(D|0)>(w|0)){if(d=o+w|0,(d|0)==(l|0))r=k;else{h=d,r=k;do S[r>>0]=S[h>>0]|0,r=(e[H>>2]|0)+1|0,e[H>>2]=r,h=h+1|0;while((h|0)!=(l|0))}if((w|0)>0)w=r;else return H=U,H|0}else w=k,d=l;if(c=w-(c+(D-C+_))|0,r=U+c|0,r>>>0>>0){h=w;do S[h>>0]=S[r>>0]|0,r=r+1|0,h=(e[H>>2]|0)+1|0,e[H>>2]=h;while((r|0)!=(k|0))}return vn(w+(0-c)|0,U|0,c|0)|0,vn(U|0,o|0,d-N|0)|0,H=U,H|0}if(h=h-C+D|0,(h|0)<0&&(pi(t),r=e[R>>2]|0,c=e[t>>2]|0),d=c,r=r-d|0,r>>>0<1073741823?(r=r<<1,r=r>>>0>>0?h:r,h=_-d|0,r?w=15:(d=0,D=0)):(r=2147483647,h=_-d|0,w=15),(w|0)==15&&(d=r,D=Xe(r)|0),C=D+h|0,r=C,w=D+d|0,(o|0)!=(l|0)){c=o,d=C;do S[d>>0]=S[c>>0]|0,d=r+1|0,r=d,c=c+1|0;while((c|0)!=(l|0));c=e[t>>2]|0}return o=_-c|0,l=D+(h-o)|0,o0(l|0,c|0,o|0)|0,_=(e[H>>2]|0)-_|0,o=r,o0(o|0,U|0,_|0)|0,r=e[t>>2]|0,e[t>>2]=l,e[H>>2]=o+_,e[R>>2]=w,r?(he(r),H=C,H|0):(H=C,H|0)}function f6(t){t=t|0;var r=0;e[t>>2]=36800,r=e[t+8>>2]|0,r&&(t=t+12|0,(e[t>>2]|0)!=(r|0)&&(e[t>>2]=r),he(r))}function h6(t){t=t|0;var r=0,o=0;if(e[t>>2]=36800,r=e[t+8>>2]|0,!r){he(t);return}o=t+12|0,(e[o>>2]|0)!=(r|0)&&(e[o>>2]=r),he(r),he(t)}function d6(t,r){t=t|0,r=r|0;var o=0,l=0,c=0;if(ui(r,-1),ui(r,S[t+4>>0]|0),c=t+12|0,l=t+8|0,t=(e[c>>2]|0)-(e[l>>2]|0)+2|0,ui(r,(t&65535)>>>8&255),ui(r,t&255),t=e[l>>2]|0,(e[c>>2]|0)!=(t|0)){o=0;do ui(r,S[t+o>>0]|0),o=o+1|0,t=e[l>>2]|0;while(o>>>0<((e[c>>2]|0)-t|0)>>>0)}}function ui(t,r){t=t|0,r=r|0;var o=0,l=0,c=0;if(c=e[t+4>>2]|0,c)if(o=c+24|0,l=e[o>>2]|0,(l|0)==(e[c+28>>2]|0)){U0[e[(e[c>>2]|0)+52>>2]&63](c,r&255)|0;return}else{e[o>>2]=l+1,S[l>>0]=r;return}if(o=t+16|0,l=e[o>>2]|0,l>>>0<(e[t+12>>2]|0)>>>0){e[o>>2]=l+1,S[(e[t+8>>2]|0)+l>>0]=r;return}o=Ct(16)|0,g=0,l=Ce(1)|0,r=g,g=0,r&1&&(r=j()|0,Tt(o|0),le(r|0)),g=0,xe(7,o|0,4,l|0),r=g,g=0,r&1?(r=j()|0,Tt(o|0),le(r|0)):Qt(o|0,824,96)}function m0(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0;e[t>>2]=0,e[t+4>>2]=0,e[t+8>>2]=0,e[t+12>>2]=0,c=(r|0)<4095?(r+128|0)/256|0:16,h=(o*3|0)+2+c|0,l=o+1|0,h=(h|0)<(l|0)|(h|0)>(r|0)?l:h,e[t+4>>2]=h,l=(c<<2|3)+(o*5|0)|0,l=(l|0)>(r|0)|(l|0)<(h|0)?h:l,e[t+8>>2]=l,o=(o*7|0)+4+(c*17|0)|0,e[t+12>>2]=(o|0)>(r|0)|(o|0)<(l|0)?l:o,e[t>>2]=r,e[t+16>>2]=64}function p6(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0;D=b,b=b+128|0,w=D+100|0,l=D+16|0,o=D+112|0,C=D+4|0,k=D,c=l,h=t+20|0,d=c+84|0;do e[c>>2]=e[h>>2],c=c+4|0,h=h+4|0;while((c|0)<(d|0));e[l+16>>2]=e[t+4>>2],h=wa(o,l,t+56|0)|0,o=e[(e[h>>2]|0)+16>>2]|0,t=t+8|0,g=0,e[w>>2]=e[t>>2],e[w+4>>2]=e[t+4>>2],e[w+8>>2]=e[t+8>>2],o=be(o|0,h|0,w|0)|0,t=g,g=0;do if(t&1)o=j()|0;else{if(c=r+4|0,e[C>>2]=e[c>>2],e[C+4>>2]=e[c+4>>2],e[C+8>>2]=e[c+8>>2],c=r+16|0,t=e[c>>2]|0,w=C+8|0,e[w>>2]=(e[w>>2]|0)-t,w=C+4|0,e[w>>2]=(e[w>>2]|0)+t,w=e[(e[h>>2]|0)+12>>2]|0,e[k>>2]=o,g=0,o=Pe(w|0,h|0,k|0,C|0,(S[r>>0]|0?(e[r+8>>2]|0)+t|0:0)|0)|0,C=g,g=0,C&1){if(o=j()|0,l=e[k>>2]|0,e[k>>2]=0,!l)break;Mt[e[(e[l>>2]|0)+4>>2]&255](l);break}if(l=e[k>>2]|0,e[k>>2]=0,l&&Mt[e[(e[l>>2]|0)+4>>2]&255](l),e[r+4>>2]|0||(e[c>>2]=(e[c>>2]|0)+o),!h){b=D;return}Mt[e[(e[h>>2]|0)+4>>2]&255](h),b=D;return}while(!1);h||le(o|0),Mt[e[(e[h>>2]|0)+4>>2]&255](h),le(o|0)}function m6(t,r){t=t|0,r=r|0,e[t>>2]=e[r>>2],e[t+4>>2]=e[r+4>>2],e[t+8>>2]=e[r+8>>2],S[t+12>>0]=0,r=t+16|0,t=r+100|0;do e[r>>2]=0,r=r+4|0;while((r|0)<(t|0))}function g6(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0,G=0,$=0,P=0;G=b,b=b+32|0,K=G+4|0,R=G+16|0,$=G,fo(t),_=t+16|0,c=e[t+24>>2]|0;e:do if((c+-2|0)>>>0<=14)if(U=t+40|0,o=e[U>>2]|0,o>>>0>2)o=5;else{switch(H=t+32|0,h=e[H>>2]|0,h|0){case 0:{o=1;break e}case 4:{if((o|0)==2){o=2;break e}break}case 3:break;default:if(o){o=2;break e}}if(N=t+100|0,o=t+108|0,l=e[o>>2]|0,(l|0)<1?(l=e[_>>2]|0,e[o>>2]=l,o=e[t+20>>2]|0,e[t+112>>2]=o):o=e[t+112>>2]|0,C=Qi(o|0,((o|0)<0)<<31>>31|0,l|0,((l|0)<0)<<31>>31|0)|0,w=(c+7|0)/8|0,w=Qi(C|0,ye|0,w|0,((w|0)<0)<<31>>31|0)|0,C=r+4|0,o=e[C>>2]|0,d=r+8|0,o|0&&(D=e[d>>2]|0,k=Qi(h|0,((h|0)<0)<<31>>31|0,w|0,ye|0)|0,c=ye,0<(c|0)|(c|0)==0&D>>>0>>0)&&(o=Ct(16)|0,g=0,l=Ce(1)|0,$=g,g=0,!($&1)&&(g=0,xe(7,o|0,3,l|0),$=g,g=0,!($&1))&&Qt(o|0,824,96),$=j()|0,Tt(o|0),le($|0)),D=t+52|0,k=t+12|0,(h|0)>0)h=0;else{b=G;return}for(;;){if(ho(t,(h|0)==0),l=va(R,_,D)|0,c=e[(e[l>>2]|0)+8>>2]|0,g=0,e[K>>2]=e[r>>2],e[K+4>>2]=e[r+4>>2],e[K+8>>2]=e[r+8>>2],c=be(c|0,l|0,K|0)|0,P=g,g=0,P&1){c=32;break}if(P=e[(e[l>>2]|0)+16>>2]|0,e[$>>2]=c,g=0,Re(P|0,l|0,$|0,N|0,t|0,(S[k>>0]|0)!=0|0),P=g,g=0,P&1){c=30;break}if(c=e[$>>2]|0,e[$>>2]=0,c&&Mt[e[(e[c>>2]|0)+4>>2]&255](c),o?(o=o+w|0,e[C>>2]=o,e[d>>2]=(e[d>>2]|0)-w):o=0,c=(e[U>>2]|0)==0,h=(c&1)+h|0,l&&Mt[e[(e[l>>2]|0)+4>>2]&255](l),!c){c=34;break}if((h|0)>=(e[H>>2]|0)){c=34;break}}if((c|0)==30)o=j()|0,c=e[$>>2]|0,e[$>>2]=0,c&&Mt[e[(e[c>>2]|0)+4>>2]&255](c);else if((c|0)==32)o=j()|0,l||(P=o,le(P|0));else if((c|0)==34){b=G;return}Mt[e[(e[l>>2]|0)+4>>2]&255](l),P=o,le(P|0)}else o=2;while(!1);l=Ct(16)|0,g=0,c=Ce(1)|0,P=g,g=0,!(P&1)&&(g=0,xe(7,l|0,o|0,c|0),P=g,g=0,!(P&1))&&Qt(l|0,824,96),P=j()|0,Tt(l|0),le(P|0)}function fo(t){t=t|0;var r=0,o=0,l=0,c=0;if((Ir(t)|0)<<24>>24!=-40&&(r=Ct(16)|0,g=0,o=Ce(1)|0,c=g,g=0,!(c&1)&&(g=0,xe(7,r|0,5,o|0),c=g,g=0,!(c&1))&&Qt(r|0,824,96),c=j()|0,Tt(r|0),le(c|0)),r=Ir(t)|0,r<<24>>24!=-38){for(;l=((d0(t)|0)&255)<<8,l=l|(d0(t)|0)&255,r=A6(t,r)|0,o=-2-r+l|0,!((o|0)<0);){if((o|0)>0){r=l+-2-r|0,o=0;do d0(t)|0,o=o+1|0;while((o|0)!=(r|0))}if(r=Ir(t)|0,r<<24>>24==-38){c=8;break}}(c|0)!=8&&(r=Ct(16)|0,g=0,o=Ce(1)|0,c=g,g=0,!(c&1)&&(g=0,xe(7,r|0,5,o|0),c=g,g=0,!(c&1))&&Qt(r|0,824,96),c=j()|0,Tt(r|0),le(c|0))}}function ho(t,r){t=t|0,r=r|0;var o=0,l=0,c=0;r||((d0(t)|0)<<24>>24!=-1&&(r=Ct(16)|0,g=0,o=Ce(1)|0,t=g,g=0,!(t&1)&&(g=0,xe(7,r|0,12,o|0),t=g,g=0,!(t&1))&&Qt(r|0,824,96),t=j()|0,Tt(r|0),le(t|0)),(d0(t)|0)<<24>>24!=-38&&(r=Ct(16)|0,g=0,o=Ce(1)|0,t=g,g=0,!(t&1)&&(g=0,xe(7,r|0,5,o|0),t=g,g=0,!(t&1))&&Qt(r|0,824,96),t=j()|0,Tt(r|0),le(t|0))),d0(t)|0,d0(t)|0,o=d0(t)|0,l=o&255;do if(o<<24>>24==1)d0(t)|0,o=0,c=20;else{if((l|0)==(e[t+32>>2]|0))if(r=d0(t)|0,o<<24>>24){o=0,c=20;break}else break;r=Ct(16)|0,g=0,o=Ce(1)|0,t=g,g=0,!(t&1)&&(g=0,xe(7,r|0,2,o|0),t=g,g=0,!(t&1))&&Qt(r|0,824,96),t=j()|0,Tt(r|0),le(t|0)}while(!1);if((c|0)==20)for(;d0(t)|0,o=o+1|0,r=d0(t)|0,(o|0)!=(l|0);)c=20;e[t+36>>2]=r&255,c=d0(t)|0,o=t+40|0,e[o>>2]=c&255,(c&255)>=3&&(r=Ct(16)|0,g=0,o=Ce(1)|0,t=g,g=0,!(t&1)&&(g=0,xe(7,r|0,5,o|0),t=g,g=0,!(t&1))&&Qt(r|0,824,96),t=j()|0,Tt(r|0),le(t|0)),(d0(t)|0)<<24>>24&&(r=Ct(16)|0,g=0,o=Ce(1)|0,t=g,g=0,!(t&1)&&(g=0,xe(7,r|0,5,o|0),t=g,g=0,!(t&1))&&Qt(r|0,824,96),t=j()|0,Tt(r|0),le(t|0)),l=t+28|0,!(e[l>>2]|0)&&(r=e[t+108>>2]|0,r||(r=e[t+16>>2]|0),e[o>>2]|0?o=e[t+32>>2]|0:o=1,c=ee(o,r)|0,t=ee(c,((e[t+24>>2]|0)+7|0)/8|0)|0,e[l>>2]=t)}function S6(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0;if(!((o|0)<=0)){N=r+4|0,R=r+8|0,U=0;do _=d0(t)|0,l=e[N>>2]|0,c=e[R>>2]|0,l>>>0>=c>>>0?(h=e[r>>2]|0,d=h,w=l-d+1|0,(w|0)<0&&(pi(r),d=e[r>>2]|0,c=e[R>>2]|0,h=d),k=h,l=c-k|0,l>>>0<1073741823?(l=l<<1,l=l>>>0>>0?w:l,w=e[N>>2]|0,c=w-k|0,l?H=10:(D=0,C=0,l=w)):(c=e[N>>2]|0,l=2147483647,w=c,c=c-k|0,H=10),(H|0)==10&&(H=0,D=l,C=Xe(l)|0,l=w),S[C+c>>0]=_,k=l-k|0,_=C+(c-k)|0,o0(_|0,h|0,k|0)|0,e[r>>2]=_,e[N>>2]=C+(c+1),e[R>>2]=C+D,d&&he(d)):(S[l>>0]=_,e[N>>2]=(e[N>>2]|0)+1),U=U+1|0;while((U|0)!=(o|0))}}function d0(t){t=t|0;var r=0,o=0,l=0,c=0;return o=e[t>>2]|0,o?(t=o+12|0,r=e[t>>2]|0,(r|0)==(e[o+16>>2]|0)?t=Dt[e[(e[o>>2]|0)+40>>2]&127](o)|0:(e[t>>2]=r+1,t=F[r>>0]|0),c=t&255,c|0):(l=t+8|0,c=e[l>>2]|0,c?(t=t+4|0,r=e[t>>2]|0,o=S[r>>0]|0,r?(e[t>>2]=r+1,e[l>>2]=c+-1,c=o,c|0):(c=o,c|0)):(t=Ct(16)|0,g=0,r=Ce(1)|0,c=g,g=0,c&1&&(c=j()|0,Tt(t|0),le(c|0)),g=0,xe(7,t|0,4,r|0),c=g,g=0,c&1?(c=j()|0,Tt(t|0),le(c|0)):Qt(t|0,824,96),0))}function Ir(t){t=t|0;var r=0,o=0,l=0,c=0,h=0,d=0,w=0,C=0;if(o=b,b=b+176|0,r=o+152|0,C=o+16|0,d=o,w=d0(t)|0,l=w&255,w<<24>>24==-1){do r=d0(t)|0;while(r<<24>>24==-1);return b=o,r|0}w=C+56|0,h=C+4|0,e[C>>2]=36160,e[w>>2]=36180,g=0,Ae(62,C+56|0,h|0),c=g,g=0,c&1&&(C=j()|0,tt(w),le(C|0)),e[C+128>>2]=0,e[C+132>>2]=-1,e[C>>2]=36200,e[C+56>>2]=36220,g=0,ue(180,h|0),c=g,g=0;do if(c&1)r=j()|0;else{if(e[h>>2]=36236,c=C+36|0,e[c>>2]=0,e[c+4>>2]=0,e[c+8>>2]=0,e[c+12>>2]=0,e[C+52>>2]=16,e[r>>2]=0,e[r+4>>2]=0,e[r+8>>2]=0,g=0,Ae(63,h|0,r|0),o=g,g=0,o&1){C=j()|0,de(r),de(c),wt(h),r=C;break}de(r),e[C+((e[(e[C>>2]|0)+-12>>2]|0)+76)>>2]=48,g=0,r=Ve(28,C|0,50907,62)|0,o=g,g=0,!(o&1)&&(o=r+((e[(e[r>>2]|0)+-12>>2]|0)+4)|0,e[o>>2]=e[o>>2]&-75|8,o=r+((e[(e[r>>2]|0)+-12>>2]|0)+4)|0,e[o>>2]=e[o>>2]|16384,e[r+((e[(e[r>>2]|0)+-12>>2]|0)+12)>>2]=2,g=0,be(38,r|0,l|0)|0,l=g,g=0,!(l&1))&&(o=Ct(16)|0,g=0,Ae(64,d|0,h|0),l=g,g=0,l&1?r=j()|0:(g=0,r=Ce(1)|0,l=g,g=0,!(l&1)&&(g=0,$e(36,o|0,12,r|0,d|0),l=g,g=0,!(l&1))?(g=0,xe(6,o|0,824,96),g=0,t=0):t=1,r=j()|0,de(d),t||(d=r,e[C>>2]=36200,e[w>>2]=36220,e[h>>2]=36236,de(c),wt(h),tt(w),le(d|0))),Tt(o|0),d=r,e[C>>2]=36200,e[w>>2]=36220,e[h>>2]=36236,de(c),wt(h),tt(w),le(d|0)),d=j()|0,e[C>>2]=36200,e[w>>2]=36220,e[h>>2]=36236,de(c),wt(h),tt(w),le(d|0)}while(!1);return C=r,tt(w),le(C|0),0}function A6(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0;switch(o=b,b=b+320|0,w=o+300|0,k=o+152|0,C=o+288|0,N=o+16|0,D=o,r<<24>>24){case-9:return R=(d0(t)|0)&255,e[t+24>>2]=R,R=((d0(t)|0)&255)<<8|(d0(t)|0)&255,N=((d0(t)|0)&255)<<8|(d0(t)|0)&255,e[t+16>>2]=N,e[t+20>>2]=R,R=(d0(t)|0)&255,e[t+32>>2]=R,R=6,b=o,R|0;case-8:return R=v6(t)|0,b=o,R|0;case-24:return R=x6(t)|0,b=o,R|0;case-53:case-54:case-55:case-57:case-58:case-59:case-61:case-62:case-63:case-64:{d=k+56|0,c=k+4|0,e[k>>2]=36160,e[d>>2]=36180,g=0,Ae(62,k+56|0,c|0),N=g,g=0,N&1&&(R=j()|0,tt(d),le(R|0)),e[k+128>>2]=0,e[k+132>>2]=-1,e[k>>2]=36200,e[k+56>>2]=36220,g=0,ue(180,c|0),N=g,g=0;do if(N&1)t=j()|0;else{if(e[c>>2]=36236,h=k+36|0,e[h>>2]=0,e[h+4>>2]=0,e[h+8>>2]=0,e[h+12>>2]=0,e[k+52>>2]=16,e[w>>2]=0,e[w+4>>2]=0,e[w+8>>2]=0,g=0,Ae(63,c|0,w|0),N=g,g=0,N&1){t=j()|0,de(w),de(h),wt(c);break}de(w),g=0,t=Ve(28,k|0,50970,26)|0,N=g,g=0;do if(!(N&1)&&(g=0,l=be(38,t|0,r&255|0)|0,N=g,g=0,!(N&1))&&(g=0,Ve(28,l|0,50997,18)|0,N=g,g=0,!(N&1))){if(l=Ct(16)|0,g=0,Ae(64,C|0,c|0),N=g,g=0,N&1)t=j()|0;else if(g=0,t=Ce(1)|0,N=g,g=0,!(N&1)&&(g=0,$e(36,l|0,10,t|0,C|0),N=g,g=0,!(N&1))?(g=0,xe(6,l|0,824,96),g=0,o=0):o=1,t=j()|0,de(C),!o)break;Tt(l|0)}else R=20;while(!1);(R|0)==20&&(t=j()|0),e[k>>2]=36200,e[d>>2]=36220,e[c>>2]=36236,de(h),wt(c),tt(d),R=t,le(R|0)}while(!1);R=t,tt(d),le(R|0)}case-25:case-32:case-2:return R=0,b=o,R|0;default:{C=N+56|0,h=N+4|0,e[N>>2]=36160,e[C>>2]=36180,g=0,Ae(62,N+56|0,h|0),k=g,g=0,k&1&&(R=j()|0,tt(C),le(R|0)),e[N+128>>2]=0,e[N+132>>2]=-1,e[N>>2]=36200,e[N+56>>2]=36220,g=0,ue(180,h|0),k=g,g=0;do if(k&1)t=j()|0;else{if(e[h>>2]=36236,d=N+36|0,e[d>>2]=0,e[d+4>>2]=0,e[d+8>>2]=0,e[d+12>>2]=0,e[N+52>>2]=16,e[w>>2]=0,e[w+4>>2]=0,e[w+8>>2]=0,g=0,Ae(63,h|0,w|0),k=g,g=0,k&1){t=j()|0,de(w),de(d),wt(h);break}de(w),g=0,t=Ve(28,N|0,51016,20)|0,k=g,g=0;do if(!(k&1)&&(g=0,c=be(38,t|0,r&255|0)|0,k=g,g=0,!(k&1))&&(g=0,Ve(28,c|0,51037,13)|0,k=g,g=0,!(k&1))){if(l=Ct(16)|0,g=0,Ae(64,D|0,h|0),k=g,g=0,k&1)t=j()|0;else if(g=0,t=Ce(1)|0,k=g,g=0,!(k&1)&&(g=0,$e(36,l|0,11,t|0,D|0),k=g,g=0,!(k&1))?(g=0,xe(6,l|0,824,96),g=0,o=0):o=1,t=j()|0,de(D),!o)break;Tt(l|0)}else R=40;while(!1);(R|0)==40&&(t=j()|0),e[N>>2]=36200,e[C>>2]=36220,e[h>>2]=36236,de(d),wt(h),tt(C),R=t,le(R|0)}while(!1);R=t,tt(C),le(R|0)}}return 0}function v6(t){t=t|0;var r=0;return(d0(t)|0)<<24>>24!=1?(t=1,t|0):(r=((d0(t)|0)&255)<<8,r=r|(d0(t)|0)&255,e[t+52>>2]=r,r=((d0(t)|0)&255)<<8,r=r|(d0(t)|0)&255,e[t+56>>2]=r,r=((d0(t)|0)&255)<<8,r=r|(d0(t)|0)&255,e[t+60>>2]=r,r=((d0(t)|0)&255)<<8,r=r|(d0(t)|0)&255,e[t+64>>2]=r,r=((d0(t)|0)&255)<<8,r=r|(d0(t)|0)&255,e[t+68>>2]=r,t=11,t|0)}function x6(t){t=t|0;var r=0,o=0,l=0,c=0,h=0,d=0;o=b,b=b+16|0,c=o,e[c>>2]=0,h=c+4|0,e[h>>2]=0,e[c+8>>2]=0,g=0,xe(9,t|0,c|0,4),r=g,g=0;e:do if(r&1)l=3;else{r=e[c>>2]|0;t:do if(US(r,51051,4)|0)t=4;else{if(g=0,r=ge(69,t|0)|0,d=g,g=0,d&1){l=3;break e}switch(r=r&255,r|0){case 3:case 2:case 1:case 0:{e[t+44>>2]=r,t=5,r=e[c>>2]|0;break t}case 5:case 4:{if(r=Ct(16)|0,g=0,t=Ce(1)|0,d=g,g=0,!(d&1)&&(g=0,xe(7,r|0,7,t|0),d=g,g=0,!(d&1))){g=0,xe(6,r|0,824,96),g=0,l=3;break e}t=j()|0,Tt(r|0);break e}default:{if(r=Ct(16)|0,g=0,t=Ce(1)|0,d=g,g=0,!(d&1)&&(g=0,xe(7,r|0,5,t|0),d=g,g=0,!(d&1))){g=0,xe(6,r|0,824,96),g=0,l=3;break e}t=j()|0,Tt(r|0);break e}}}while(!1);return r?((e[h>>2]|0)!=(r|0)&&(e[h>>2]=r),he(r),b=o,t|0):(b=o,t|0)}while(!1);return(l|0)==3&&(t=j()|0),r=e[c>>2]|0,r||le(t|0),(e[h>>2]|0)!=(r|0)&&(e[h>>2]=r),he(r),le(t|0),0}function w6(t){t=t|0;var r=0,o=0,l=0;l=e[(e[t>>2]|0)+-12>>2]|0,e[t+l>>2]=36200,r=t+(l+56)|0,e[r>>2]=36220,o=t+(l+4)|0,e[o>>2]=36236,de(t+(l+36)|0),wt(o),tt(r)}function y6(t){t=t|0}function C6(t){t=t|0,he(t)}function T6(t){t=t|0,S[t>>0]=0,t=t+4|0,e[t>>2]=0,e[t+4>>2]=0,e[t+8>>2]=0,e[t+12>>2]=0,e[t+16>>2]=0,e[t+20>>2]=0,e[t+24>>2]=0,e[t+28>>2]=0}function I6(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0;if(c=b,b=b+16|0,h=c,r=a6(r)|0,e[h>>2]=r,o=t+28|0,l=e[o>>2]|0,l>>>0<(e[t+32>>2]|0)>>>0){e[l>>2]=r,e[o>>2]=l+4,e[h>>2]=0,b=c;return}if(g=0,Ae(57,t+24|0,h|0),t=g,g=0,t&1)r=j()|0,o=e[h>>2]|0,e[h>>2]=0,o||le(r|0),Mt[e[(e[o>>2]|0)+4>>2]&255](o),le(r|0);else{if(r=e[h>>2]|0,e[h>>2]=0,!r){b=c;return}Mt[e[(e[r>>2]|0)+4>>2]&255](r),b=c;return}}function E6(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0;if(l=t+4|0,e[l>>2]=e[r>>2],e[l+4>>2]=e[r+4>>2],e[l+8>>2]=e[r+8>>2],ui(t,-1),ui(t,-40),l=t+28|0,c=t+24|0,r=e[c>>2]|0,(e[l>>2]|0)==(r|0))return ui(t,-1),ui(t,-39),t=t+16|0,t=e[t>>2]|0,t|0;o=0;do h=e[r+(o<<2)>>2]|0,t0[e[(e[h>>2]|0)+8>>2]&127](h,t),o=o+1|0,r=e[c>>2]|0;while(o>>>0<(e[l>>2]|0)-r>>2>>>0);return ui(t,-1),ui(t,-39),h=t+16|0,h=e[h>>2]|0,h|0}function k6(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0;N=b,b=b+48|0,w=N+32|0,c=N+12|0,C=N+8|0,k=N+4|0,R=N,l=o+36|0;do if(!(e[l>>2]|0)&&!(e[o+40>>2]|0)&&!(e[o+44>>2]|0)&&!(e[o+48>>2]|0)&&!(e[o+52>>2]|0)){if(l=e[o+8>>2]|0,(l|0)<=12){h=t+28|0,d=t+32|0;break}if(m0(c,(1<>2]|0),l=co(c)|0,e[C>>2]=l,h=t+28|0,c=e[h>>2]|0,d=t+32|0,c>>>0<(e[d>>2]|0)>>>0){e[c>>2]=l,e[h>>2]=c+4,e[C>>2]=0;break}if(g=0,Ae(57,t+24|0,C|0),w=g,g=0,!(w&1)){if(l=e[C>>2]|0,e[C>>2]=0,!l)break;Mt[e[(e[l>>2]|0)+4>>2]&255](l);break}o=j()|0,l=e[C>>2]|0,e[C>>2]=0,l||(R=o,le(R|0)),Mt[e[(e[l>>2]|0)+4>>2]&255](l),R=o,le(R|0)}else D=6;while(!1);do if((D|0)==6){if(l=co(l)|0,e[w>>2]=l,h=t+28|0,c=e[h>>2]|0,d=t+32|0,c>>>0<(e[d>>2]|0)>>>0){e[c>>2]=l,e[h>>2]=c+4,e[w>>2]=0;break}if(g=0,Ae(57,t+24|0,w|0),D=g,g=0,!(D&1)){if(l=e[w>>2]|0,e[w>>2]=0,!l)break;Mt[e[(e[l>>2]|0)+4>>2]&255](l);break}o=j()|0,l=e[w>>2]|0,e[w>>2]=0,l||(R=o,le(R|0)),Mt[e[(e[l>>2]|0)+4>>2]&255](l),R=o,le(R|0)}while(!1);l=t+20|0,c=(e[l>>2]|0)+1|0,e[l>>2]=c,l=e[o+24>>2]|0,w=l|0?e[o+16>>2]|0:1,l=l6(c,w,e[o+20>>2]|0,l)|0,e[k>>2]=l,c=e[h>>2]|0;do if(c>>>0<(e[d>>2]|0)>>>0)e[c>>2]=l,e[h>>2]=c+4,e[k>>2]=0;else{if(g=0,Ae(57,t+24|0,k|0),D=g,g=0,!(D&1)){if(l=e[k>>2]|0,e[k>>2]=0,!l)break;Mt[e[(e[l>>2]|0)+4>>2]&255](l);break}o=j()|0,l=e[k>>2]|0,e[k>>2]=0,l||(R=o,le(R|0)),Mt[e[(e[l>>2]|0)+4>>2]&255](l),R=o,le(R|0)}while(!1);C=Xe(104)|0,e[C>>2]=36820,e[C+4>>2]=w,c=C+8|0,e[c>>2]=e[r>>2],e[c+4>>2]=e[r+4>>2],e[c+8>>2]=e[r+8>>2],c=C+20|0,l=c+84|0;do e[c>>2]=e[o>>2],c=c+4|0,o=o+4|0;while((c|0)<(l|0));if(e[R>>2]=C,o=e[h>>2]|0,o>>>0<(e[d>>2]|0)>>>0){e[o>>2]=C,e[h>>2]=o+4,e[R>>2]=0,b=N;return}if(g=0,Ae(57,t+24|0,R|0),t=g,g=0,t&1)o=j()|0,l=e[R>>2]|0,e[R>>2]=0,l||(R=o,le(R|0)),Mt[e[(e[l>>2]|0)+4>>2]&255](l),R=o,le(R|0);else{if(o=e[R>>2]|0,e[R>>2]=0,!o){b=N;return}Mt[e[(e[o>>2]|0)+4>>2]&255](o),b=N;return}}function D6(t,r,o,l,c,h,d,w,C,D,k){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0,w=w|0,C=C|0,D=D|0,k=k|0;var N=0,R=0,_=0,U=0,H=0,K=0,G=0;return _=b,b=b+96|0,R=_,N=ma(t,r,R,0)|0,N?(c=N,b=_,c|0):(S[R+32>>0]=0,H=e[R+8>>2]|0,G=e[R>>2]|0,K=e[R+4>>2]|0,N=ee(K,G)|0,U=e[R+16>>2]|0,N=ee(ee(N,(H|0)<9?1:2)|0,U)|0,e[l>>2]=N,N=E0(N)|0,e[o>>2]=N,e[c>>2]=G,e[h>>2]=K,e[d>>2]=H,e[w>>2]=e[R+12>>2],e[C>>2]=U,e[D>>2]=e[R+20>>2],e[k>>2]=e[R+24>>2],c=ga(N,e[l>>2]|0,t,r,0,0)|0,b=_,c|0)}function b6(t,r,o,l,c,h,d,w,C){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,d=d|0,w=w|0,C=C|0;var D=0,k=0,N=0,R=0;N=b,b=b+96|0,D=N+4|0,d=N,k=D,R=k+84|0;do e[k>>2]=0,k=k+4|0;while((k|0)<(R|0));return e[D+16>>2]=h,e[D+8>>2]=c,e[D>>2]=o,e[D+4>>2]=l,o=E0(r)|0,e[w>>2]=o,e[d>>2]=0,o=pa(w,r,d,t,r,D,0)|0,e[C>>2]=e[d>>2],b=N,o|0}function Fi(t,r){t=t|0,r=r|0;var o=0;o=b,b=b+16|0,e[o>>2]=r,r=e[9320]|0,Po(r,t,o)|0,PS(10,r)|0,St()}function si(t){t=t|0,Lr(51337,51366,1164,51442)}function pi(t){t=t|0,Lr(51463,51486,303,51442)}function po(){var t=0,r=0;if(t=b,b=b+16|0,Qo(37024,4)|0)Fi(51562,t);else return r=Ho(e[9255]|0)|0,b=t,r|0;return 0}function Xe(t){t=t|0;var r=0;r=t|0?t:1,t=E0(r)|0;e:do if(!t){for(;t=L6()|0,!!t;)if(Vo[t&7](),t=E0(r)|0,t)break e;r=Ct(4)|0,e[r>>2]=36844,Qt(r|0,592,78)}while(!1);return t|0}function he(t){t=t|0,n0(t)}function N6(t){t=t|0,he(t)}function F6(t){t=t|0,e[t>>2]=36844}function R6(t){t=t|0}function M6(t){t=t|0,he(t)}function _6(t){return t=t|0,51611}function mo(t){t=t|0;var r=0;r=b,b=b+16|0,g=0,Nt(t|0),t=g,g=0,t&1||(g=0,Ae(85,51626,r|0),g=0),t=j(0)|0,K0(t|0)|0,g=0,Ae(85,51666,r+8|0),g=0,t=j(0)|0,g=0,Nt(3),r=g,g=0,r&1?(r=j(0)|0,$t(r)):$t(t)}function P6(){var t=0,r=0,o=0;g=0,t=Ce(2)|0,o=g,g=0,o&1&&(o=j(0)|0,$t(o)),t|0&&(r=e[t>>2]|0,(r|0)!=0)&&(o=r+48|0,(e[o>>2]&-256|0)==1126902528?(e[o+4>>2]|0)==1129074247:0)&&mo(e[r+12>>2]|0),o=e[9208]|0,e[9208]=o+0,mo(o)}function L6(){var t=0;return t=e[9214]|0,e[9214]=t+0,t|0}function wA(t){t=t|0}function In(t){t=t|0,e[t>>2]=36868,uS(t+4|0)}function O6(t){t=t|0,In(t),he(t)}function $6(t){return t=t|0,e[t+4>>2]|0}function yA(t){t=t|0}function B6(t){t=t|0,e[t>>2]=36888}function V6(t){t=t|0}function U6(t){t=t|0,he(t)}function z6(t){return t=t|0,51716}function G6(t){t=t|0}function q6(t){t=t|0}function W6(t){t=t|0}function H6(t){t=t|0,he(t)}function Q6(t){t=t|0,he(t)}function K6(t){t=t|0,he(t)}function Y6(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0;if(d=b,b=b+64|0,h=d,(t|0)!=(r|0))if(r|0&&(c=So(r,656,672,0)|0,(c|0)!=0)){r=h,l=r+56|0;do e[r>>2]=0,r=r+4|0;while((r|0)<(l|0));e[h>>2]=c,e[h+8>>2]=t,e[h+12>>2]=-1,e[h+48>>2]=1,On[e[(e[c>>2]|0)+28>>2]&63](c,h,e[o>>2]|0,1),(e[h+24>>2]|0)==1?(e[o>>2]=e[h+16>>2],r=1):r=0}else r=0;else r=1;return b=d,r|0}function Er(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0;t=r+16|0,c=e[t>>2]|0;do if(c){if((c|0)!=(o|0)){l=r+36|0,e[l>>2]=(e[l>>2]|0)+1,e[r+24>>2]=2,S[r+54>>0]=1;break}t=r+24|0,(e[t>>2]|0)==2&&(e[t>>2]=l)}else e[t>>2]=o,e[r+24>>2]=l,e[r+36>>2]=1;while(!1)}function j6(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0,(t|0)==(e[r+8>>2]|0)&&Er(0,r,o,l)}function X6(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0,(t|0)==(e[r+8>>2]|0)?Er(0,r,o,l):(t=e[t+8>>2]|0,On[e[(e[t>>2]|0)+28>>2]&63](t,r,o,l))}function go(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0;h=e[t+4>>2]|0,c=h>>8,h&1&&(c=e[(e[o>>2]|0)+c>>2]|0),t=e[t>>2]|0,On[e[(e[t>>2]|0)+28>>2]&63](t,r,o+c|0,h&2|0?l:2)}function Z6(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0;e:do if((t|0)!=(e[r+8>>2]|0)){if(h=e[t+12>>2]|0,c=t+16+(h<<3)|0,go(t+16|0,r,o,l),(h|0)>1){h=r+54|0,t=t+24|0;do{if(go(t,r,o,l),S[h>>0]|0)break e;t=t+8|0}while(t>>>0>>0)}}else Er(0,r,o,l);while(!1)}function So(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0;_=b,b=b+64|0,R=_,N=e[t>>2]|0,k=t+(e[N+-8>>2]|0)|0,N=e[N+-4>>2]|0,e[R>>2]=o,e[R+4>>2]=t,e[R+8>>2]=r,e[R+12>>2]=l,l=R+16|0,t=R+20|0,r=R+24|0,c=R+28|0,h=R+32|0,d=R+40|0,w=(N|0)==(o|0),C=l,D=C+36|0;do e[C>>2]=0,C=C+4|0;while((C|0)<(D|0));I[l+36>>1]=0,S[l+38>>0]=0;e:do if(w)e[R+48>>2]=1,Vi[e[(e[o>>2]|0)+20>>2]&15](o,R,k,k,1,0),l=(e[r>>2]|0)==1?k:0;else{switch(Pn[e[(e[N>>2]|0)+24>>2]&15](N,R,k,1,0),e[R+36>>2]|0){case 0:{l=(e[d>>2]|0)==1&(e[c>>2]|0)==1&(e[h>>2]|0)==1?e[t>>2]|0:0;break e}case 1:break;default:{l=0;break e}}if((e[r>>2]|0)!=1&&!((e[d>>2]|0)==0&(e[c>>2]|0)==1&(e[h>>2]|0)==1)){l=0;break}l=e[l>>2]|0}while(!1);return b=_,l|0}function kr(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,S[r+53>>0]=1;do if((e[r+4>>2]|0)==(l|0)){if(S[r+52>>0]=1,l=r+16|0,t=e[l>>2]|0,!t){if(e[l>>2]=o,e[r+24>>2]=c,e[r+36>>2]=1,!((c|0)==1&&(e[r+48>>2]|0)==1))break;S[r+54>>0]=1;break}if((t|0)!=(o|0)){c=r+36|0,e[c>>2]=(e[c>>2]|0)+1,S[r+54>>0]=1;break}t=r+24|0,l=e[t>>2]|0,(l|0)==2&&(e[t>>2]=c,l=c),(l|0)==1&&(e[r+48>>2]|0)==1&&(S[r+54>>0]=1)}while(!1)}function J6(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0;e:do if((t|0)==(e[r+8>>2]|0))(e[r+4>>2]|0)==(o|0)&&(h=r+28|0,(e[h>>2]|0)!=1)&&(e[h>>2]=l);else{if((t|0)!=(e[r>>2]|0)){if(U=e[t+12>>2]|0,w=t+16+(U<<3)|0,En(t+16|0,r,o,l,c),h=t+24|0,(U|0)<=1)break;if(d=e[t+8>>2]|0,!(d&2|0)&&(C=r+36|0,(e[C>>2]|0)!=1)){if(!(d&1)){for(d=r+54|0;;)if(S[d>>0]|0||(e[C>>2]|0)==1||(En(h,r,o,l,c),h=h+8|0,h>>>0>=w>>>0))break e}for(d=r+24|0,t=r+54|0;;)if(S[t>>0]|0||(e[C>>2]|0)==1&&(e[d>>2]|0)==1||(En(h,r,o,l,c),h=h+8|0,h>>>0>=w>>>0))break e}for(d=r+54|0;;)if(S[d>>0]|0||(En(h,r,o,l,c),h=h+8|0,h>>>0>=w>>>0))break e}if((e[r+16>>2]|0)!=(o|0)&&(_=r+20|0,(e[_>>2]|0)!=(o|0))){if(e[r+32>>2]=l,k=r+44|0,(e[k>>2]|0)==4)break;d=e[t+12>>2]|0,w=t+16+(d<<3)|0,C=r+52|0,l=r+53|0,N=r+54|0,D=t+8|0,R=r+24|0;t:do if((d|0)>0)for(d=0,h=0,t=t+16|0;;){if(S[C>>0]=0,S[l>>0]=0,Dr(t,r,o,o,1,c),S[N>>0]|0){U=20;break t}do if(S[l>>0]|0){if(!(S[C>>0]|0))if(e[D>>2]&1){h=1;break}else{h=1,U=20;break t}if((e[R>>2]|0)==1)break t;if(e[D>>2]&2)d=1,h=1;else break t}while(!1);if(t=t+8|0,t>>>0>=w>>>0){U=20;break}}else d=0,h=0,U=20;while(!1);do if((U|0)==20){if(!d&&(e[_>>2]=o,o=r+40|0,e[o>>2]=(e[o>>2]|0)+1,(e[r+36>>2]|0)==1)&&(e[R>>2]|0)==2){if(S[N>>0]=1,h)break}else U=24;if((U|0)==24&&h)break;e[k>>2]=4;break e}while(!1);e[k>>2]=3;break}(l|0)==1&&(e[r+32>>2]=1)}while(!1)}function Dr(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0;w=e[t+4>>2]|0,d=w>>8,w&1&&(d=e[(e[l>>2]|0)+d>>2]|0),t=e[t>>2]|0,Vi[e[(e[t>>2]|0)+20>>2]&15](t,r,o,l+d|0,w&2|0?c:2,h)}function En(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0;d=e[t+4>>2]|0,h=d>>8,d&1&&(h=e[(e[o>>2]|0)+h>>2]|0),t=e[t>>2]|0,Pn[e[(e[t>>2]|0)+24>>2]&15](t,r,o+h|0,d&2|0?l:2,c)}function eS(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0;e:do if((t|0)==(e[r+8>>2]|0))(e[r+4>>2]|0)==(o|0)&&(h=r+28|0,(e[h>>2]|0)!=1)&&(e[h>>2]=l);else{if((t|0)!=(e[r>>2]|0)){w=e[t+8>>2]|0,Pn[e[(e[w>>2]|0)+24>>2]&15](w,r,o,l,c);break}if((e[r+16>>2]|0)!=(o|0)&&(d=r+20|0,(e[d>>2]|0)!=(o|0))){if(e[r+32>>2]=l,l=r+44|0,(e[l>>2]|0)==4)break;h=r+52|0,S[h>>0]=0,C=r+53|0,S[C>>0]=0,t=e[t+8>>2]|0,Vi[e[(e[t>>2]|0)+20>>2]&15](t,r,o,o,1,c),S[C>>0]|0?S[h>>0]|0||(h=1,w=13):(h=0,w=13);do if((w|0)==13){if(e[d>>2]=o,C=r+40|0,e[C>>2]=(e[C>>2]|0)+1,(e[r+36>>2]|0)==1&&(e[r+24>>2]|0)==2){if(S[r+54>>0]=1,h)break}else w=16;if((w|0)==16&&h)break;e[l>>2]=4;break e}while(!1);e[l>>2]=3;break}(l|0)==1&&(e[r+32>>2]=1)}while(!1)}function tS(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0;do if((t|0)==(e[r+8>>2]|0))(e[r+4>>2]|0)==(o|0)&&(d=r+28|0,(e[d>>2]|0)!=1)&&(e[d>>2]=l);else if((t|0)==(e[r>>2]|0)){if((e[r+16>>2]|0)!=(o|0)&&(h=r+20|0,(e[h>>2]|0)!=(o|0))){e[r+32>>2]=l,e[h>>2]=o,c=r+40|0,e[c>>2]=(e[c>>2]|0)+1,(e[r+36>>2]|0)==1&&(e[r+24>>2]|0)==2&&(S[r+54>>0]=1),e[r+44>>2]=4;break}(l|0)==1&&(e[r+32>>2]=1)}while(!1)}function iS(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0;var d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0;if((t|0)==(e[r+8>>2]|0))kr(0,r,o,l,c);else{k=r+52|0,N=S[k>>0]|0,R=r+53|0,_=S[R>>0]|0,D=e[t+12>>2]|0,d=t+16+(D<<3)|0,S[k>>0]=0,S[R>>0]=0,Dr(t+16|0,r,o,l,c,h);e:do if((D|0)>1){w=r+24|0,C=t+8|0,D=r+54|0,t=t+24|0;do{if(S[D>>0]|0)break e;if(S[k>>0]|0){if((e[w>>2]|0)==1||!(e[C>>2]&2))break e}else if(S[R>>0]|0&&!(e[C>>2]&1|0))break e;S[k>>0]=0,S[R>>0]=0,Dr(t,r,o,l,c,h),t=t+8|0}while(t>>>0>>0)}while(!1);S[k>>0]=N,S[R>>0]=_}}function nS(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,(t|0)==(e[r+8>>2]|0)?kr(0,r,o,l,c):(t=e[t+8>>2]|0,Vi[e[(e[t>>2]|0)+20>>2]&15](t,r,o,l,c,h))}function rS(t,r,o,l,c,h){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0,h=h|0,(t|0)==(e[r+8>>2]|0)&&kr(0,r,o,l,c)}function sS(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0;return c=b,b=b+16|0,l=c,e[l>>2]=e[o>>2],t=Yt[e[(e[t>>2]|0)+16>>2]&63](t,r,l)|0,t&&(e[o>>2]=e[l>>2]),b=c,t&1|0}function oS(t){return t=t|0,t?t=(So(t,656,704,0)|0)!=0:t=0,t&1|0}function kn(){var t=0;t=Ct(4)|0,F6(t),Qt(t|0,592,78)}function aS(){var t=0,r=0,o=0,l=0,c=0,h=0,d=0,w=0;c=b,b=b+48|0,d=c+32|0,o=c+24|0,w=c+16|0,h=c,c=c+36|0,t=po()|0,t|0&&(l=e[t>>2]|0,(l|0)!=0)&&(t=l+48|0,r=e[t>>2]|0,t=e[t+4>>2]|0,(r&-256|0)==1126902528&(t|0)==1129074247||(e[o>>2]=e[9257],Fi(51919,o)),(r|0)==1126902529&(t|0)==1129074247?t=e[l+44>>2]|0:t=l+80|0,e[c>>2]=t,l=e[l>>2]|0,t=e[l+4>>2]|0,Yt[e[(e[152]|0)+16>>2]&63](608,l,c)|0?(w=e[c>>2]|0,c=e[9257]|0,w=Dt[e[(e[w>>2]|0)+8>>2]&127](w)|0,e[h>>2]=c,e[h+4>>2]=t,e[h+8>>2]=w,Fi(51833,h)):(e[w>>2]=e[9257],e[w+4>>2]=t,Fi(51878,w))),Fi(51957,d)}function lS(){var t=0;if(t=b,b=b+16|0,ni(37020,184)|0)Fi(51730,t);else{b=t;return}}function uS(t){t=t|0;var r=0,o=0;o=(e[t>>2]|0)+-4|0,r=e[o>>2]|0,e[o>>2]=r+-1,(r+-1|0)<0&&he((e[t>>2]|0)+-12|0)}function cS(t){t=t|0;var r=0;if(r=b,b=b+16|0,n0(t),Xo(e[9255]|0,0)|0)Fi(51780,r);else{b=r;return}}function Dn(t,r,o,l){return t=t|0,r=r|0,o=o|0,l=l|0,t=$S(t,r,o)|0,t|0}function Ao(t,r,o,l){return t=t|0,r=r|0,o=o|0,l=l|0,t=BS(t,r,o)|0,t|0}function fS(){return 37296}function hS(){return 37300}function dS(){return 37304}function ji(t){return t=t|0,((t|0)==32|(t+-9|0)>>>0<5)&1|0}function pS(t){return t=t|0,(t+-48|0)>>>0<10?t=1:t=((t|32)+-97|0)>>>0<6,t&1|0}function S0(){var t=0;return e[9258]|0?(t=($r()|0)+60|0,t=e[t>>2]|0):t=37308,t|0}function vo(t){t=t|0;var r=0,o=0;for(r=0;;){if((F[51978+r>>0]|0)==(t|0)){o=2;break}if(r=r+1|0,(r|0)==87){r=87,t=52066,o=5;break}}if((o|0)==2&&(r?(t=52066,o=5):t=52066),(o|0)==5)for(;;){for(o=t;t=o+1|0,S[o>>0]|0;)o=t;if(r=r+-1|0,r)o=5;else break}return t|0}function xo(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0,ce=0,ke=0,Ee=0,Te=0,it=0,jt=0,Gt=0;switch(jt=b,b=b+512|0,ke=jt,r|0){case 0:{it=24,Te=-149,O=4;break}case 1:{it=53,Te=-1074,O=4;break}case 2:{it=53,Te=-1074,O=4;break}default:l=0}e:do if((O|0)==4){oe=t+4|0,ie=t+100|0;do r=e[oe>>2]|0,r>>>0<(e[ie>>2]|0)>>>0?(e[oe>>2]=r+1,r=F[r>>0]|0):r=u0(t)|0;while(ji(r)|0);t:do switch(r|0){case 43:case 45:if(c=1-(((r|0)==45&1)<<1)|0,r=e[oe>>2]|0,r>>>0<(e[ie>>2]|0)>>>0){e[oe>>2]=r+1,r=F[r>>0]|0,Ee=c;break t}else{r=u0(t)|0,Ee=c;break t}default:Ee=1}while(!1);c=r,r=0;do{if((c|32|0)!=(S[53870+r>>0]|0))break;do if(r>>>0<7)if(c=e[oe>>2]|0,c>>>0<(e[ie>>2]|0)>>>0){e[oe>>2]=c+1,c=F[c>>0]|0;break}else{c=u0(t)|0;break}while(!1);r=r+1|0}while(r>>>0<8);t:do switch(r|0){case 8:break;case 3:{O=23;break}default:{if(d=(o|0)!=0,d&r>>>0>3){if((r|0)==8)break t;O=23;break t}i:do if(!r){r=0;do{if((c|32|0)!=(S[56747+r>>0]|0))break i;do if(r>>>0<2)if(c=e[oe>>2]|0,c>>>0<(e[ie>>2]|0)>>>0){e[oe>>2]=c+1,c=F[c>>0]|0;break}else{c=u0(t)|0;break}while(!1);r=r+1|0}while(r>>>0<3)}while(!1);switch(r|0){case 3:{if(r=e[oe>>2]|0,r>>>0<(e[ie>>2]|0)>>>0?(e[oe>>2]=r+1,r=F[r>>0]|0):r=u0(t)|0,(r|0)==40)r=1;else{if(!(e[ie>>2]|0)){l=fe;break e}e[oe>>2]=(e[oe>>2]|0)+-1,l=fe;break e}for(;c=e[oe>>2]|0,c>>>0<(e[ie>>2]|0)>>>0?(e[oe>>2]=c+1,c=F[c>>0]|0):c=u0(t)|0,!(!((c+-48|0)>>>0<10|(c+-65|0)>>>0<26)&&!((c|0)==95|(c+-97|0)>>>0<26));)r=r+1|0;if((c|0)==41){l=fe;break e}if(c=(e[ie>>2]|0)==0,c||(e[oe>>2]=(e[oe>>2]|0)+-1),!d){it=S0()|0,e[it>>2]=22,oi(t,0),l=0;break e}if(!r){l=fe;break e}for(;;)if(r=r+-1|0,c||(e[oe>>2]=(e[oe>>2]|0)+-1),!r){l=fe;break e}}case 0:{do if((c|0)==48){if(r=e[oe>>2]|0,r>>>0<(e[ie>>2]|0)>>>0?(e[oe>>2]=r+1,r=F[r>>0]|0):r=u0(t)|0,(r|32|0)!=120){if(!(e[ie>>2]|0)){r=48;break}e[oe>>2]=(e[oe>>2]|0)+-1,r=48;break}r=e[oe>>2]|0,r>>>0<(e[ie>>2]|0)>>>0?(e[oe>>2]=r+1,r=F[r>>0]|0,d=0):(r=u0(t)|0,d=0);i:for(;;){switch(r|0){case 46:{O=74;break i}case 48:break;default:{$=0,w=0,G=0,c=0,D=d,k=0,K=0,C=1,d=0,l=0;break i}}if(r=e[oe>>2]|0,r>>>0<(e[ie>>2]|0)>>>0){e[oe>>2]=r+1,r=F[r>>0]|0,d=1;continue}else{r=u0(t)|0,d=1;continue}}if((O|0)==74)if(r=e[oe>>2]|0,r>>>0<(e[ie>>2]|0)>>>0?(e[oe>>2]=r+1,r=F[r>>0]|0):r=u0(t)|0,(r|0)==48){d=0,c=0;do r=e[oe>>2]|0,r>>>0<(e[ie>>2]|0)>>>0?(e[oe>>2]=r+1,r=F[r>>0]|0):r=u0(t)|0,d=$0(d|0,c|0,-1,-1)|0,c=ye;while((r|0)==48);$=0,w=0,G=d,D=1,k=1,K=0,C=1,d=0,l=0}else $=0,w=0,G=0,c=0,D=d,k=1,K=0,C=1,d=0,l=0;for(;;){if(U=r+-48|0,N=r|32,U>>>0>=10){if(H=(r|0)==46,!(H|(N+-97|0)>>>0<6)){N=G,U=$;break}if(H)if(!k)H=w,c=$,U=$,k=1,N=K,h=C;else{N=G,U=$,r=46;break}else O=86}else O=86;if((O|0)==86){O=0,r=(r|0)>57?N+-87|0:U;do if(($|0)<0|($|0)==0&w>>>0<8)N=K,h=C,d=r+(d<<4)|0;else{if(($|0)<0|($|0)==0&w>>>0<14){_=C*.0625,N=K,h=_,l=l+_*+(r|0);break}(K|0)!=0|(r|0)==0?(N=K,h=C):(N=1,h=C,l=l+C*.5)}while(!1);w=$0(w|0,$|0,1,0)|0,H=G,U=ye,D=1}if(r=e[oe>>2]|0,r>>>0<(e[ie>>2]|0)>>>0){e[oe>>2]=r+1,$=U,G=H,r=F[r>>0]|0,K=N,C=h;continue}else{$=U,G=H,r=u0(t)|0,K=N,C=h;continue}}if(!D){r=(e[ie>>2]|0)==0,r||(e[oe>>2]=(e[oe>>2]|0)+-1),o?!r&&(P=e[oe>>2]|0,e[oe>>2]=P+-1,(k|0)!=0)&&(e[oe>>2]=P+-2):oi(t,0),l=+(Ee|0)*0;break e}if(D=(k|0)==0,k=D?w:N,D=D?U:c,(U|0)<0|(U|0)==0&w>>>0<8){c=U;do d=d<<4,w=$0(w|0,c|0,1,0)|0,c=ye;while((c|0)<0|(c|0)==0&w>>>0<8)}if((r|32|0)==112){if(c=Bo(t,o)|0,r=ye,(c|0)==0&(r|0)==-2147483648){if(!o){oi(t,0),l=0;break e}e[ie>>2]|0?(e[oe>>2]=(e[oe>>2]|0)+-1,c=0,r=0):(c=0,r=0)}}else e[ie>>2]|0?(e[oe>>2]=(e[oe>>2]|0)+-1,c=0,r=0):(c=0,r=0);if(ke=v0(k|0,D|0,2)|0,ke=$0(ke|0,ye|0,-32,-1)|0,r=$0(ke|0,ye|0,c|0,r|0)|0,c=ye,!d){l=+(Ee|0)*0;break e}if((c|0)>0|(c|0)==0&r>>>0>(0-Te|0)>>>0){it=S0()|0,e[it>>2]=34,l=+(Ee|0)*17976931348623157e292*17976931348623157e292;break e}if(ke=Te+-106|0,ce=((ke|0)<0)<<31>>31,(c|0)<(ce|0)|(c|0)==(ce|0)&r>>>0>>0){it=S0()|0,e[it>>2]=34,l=+(Ee|0)*22250738585072014e-324*22250738585072014e-324;break e}if((d|0)>-1){do ce=!(l>=.5),ke=ce&1|d<<1,d=ke^1,l=l+(ce?l:l+-1),r=$0(r|0,c|0,-1,-1)|0,c=ye;while((ke|0)>-1);w=r,C=l}else w=r,C=l;r=ii(32,0,Te|0,((Te|0)<0)<<31>>31|0)|0,r=$0(w|0,c|0,r|0,ye|0)|0,Te=ye,0>(Te|0)|(Te|0)==0&it>>>0>r>>>0?(r|0)<0?(r=0,O=127):O=125:(r=it,O=125),(O|0)==125&&((r|0)<53?O=127:(c=r,h=+(Ee|0),l=0)),(O|0)==127&&(l=+(Ee|0),c=r,h=l,l=+Co(+bn(1,84-r|0),l)),it=(d&1|0)==0&(C!=0&(c|0)<32),l=h*(it?0:C)+(l+h*+(((it&1)+d|0)>>>0))-l,l==0&&(it=S0()|0,e[it>>2]=34),l=+Eo(l,w);break e}else r=c;while(!1);ne=Te+it|0,ce=0-ne|0,d=0;i:for(;;){switch(r|0){case 46:{O=138;break i}case 48:break;default:{c=0,N=0,k=0;break i}}if(r=e[oe>>2]|0,r>>>0<(e[ie>>2]|0)>>>0){e[oe>>2]=r+1,r=F[r>>0]|0,d=1;continue}else{r=u0(t)|0,d=1;continue}}if((O|0)==138)if(r=e[oe>>2]|0,r>>>0<(e[ie>>2]|0)>>>0?(e[oe>>2]=r+1,r=F[r>>0]|0):r=u0(t)|0,(r|0)==48)for(c=0,r=0;;)if(c=$0(c|0,r|0,-1,-1)|0,d=ye,r=e[oe>>2]|0,r>>>0<(e[ie>>2]|0)>>>0?(e[oe>>2]=r+1,r=F[r>>0]|0):r=u0(t)|0,(r|0)==48)r=d;else{N=d,d=1,k=1;break}else c=0,N=0,k=1;e[ke>>2]=0,D=r+-48|0,w=(r|0)==46;i:do if(w|D>>>0<10){Z=ke+496|0,$=0,H=0,K=w,O=N,U=d,P=k,d=0,w=0,k=0;n:for(;;){do if(K)if(!P)c=$,N=H,P=1;else{N=O,r=$,D=H;break n}else{if(K=$0($|0,H|0,1,0)|0,H=ye,G=(r|0)!=48,(w|0)>=125){if(!G){N=O,$=K;break}e[Z>>2]=e[Z>>2]|1,N=O,$=K;break}N=ke+(w<<2)|0,d&&(D=r+-48+((e[N>>2]|0)*10|0)|0),e[N>>2]=D,d=d+1|0,D=(d|0)==9,N=O,$=K,U=1,d=D?0:d,w=(D&1)+w|0,k=G?K:k}while(!1);if(r=e[oe>>2]|0,r>>>0<(e[ie>>2]|0)>>>0?(e[oe>>2]=r+1,r=F[r>>0]|0):r=u0(t)|0,D=r+-48|0,K=(r|0)==46,K|D>>>0<10)O=N;else{D=P,O=161;break i}}U=(U|0)!=0,O=169}else $=0,H=0,U=d,D=k,d=0,w=0,k=0,O=161;while(!1);do if((O|0)==161){if(Z=(D|0)==0,c=Z?$:c,N=Z?H:N,U=(U|0)!=0,!((r|32|0)==101&U))if((r|0)>-1){r=$,D=H,O=169;break}else{r=$,D=H,O=171;break}if(D=Bo(t,o)|0,r=ye,(D|0)==0&(r|0)==-2147483648){if(!o){oi(t,0),l=0;break}e[ie>>2]|0?(e[oe>>2]=(e[oe>>2]|0)+-1,D=0,r=0):(D=0,r=0)}c=$0(D|0,r|0,c|0,N|0)|0,U=$,N=ye,D=H,O=173}while(!1);(O|0)==169&&(e[ie>>2]|0?(e[oe>>2]=(e[oe>>2]|0)+-1,U?(U=r,O=173):O=172):O=171),(O|0)==171&&(U?(U=r,O=173):O=172);do if((O|0)==172)it=S0()|0,e[it>>2]=22,oi(t,0),l=0;else if((O|0)==173){if(r=e[ke>>2]|0,!r){l=+(Ee|0)*0;break}if(((D|0)<0|(D|0)==0&U>>>0<10)&((c|0)==(U|0)&(N|0)==(D|0))&&it>>>0>30|(r>>>it|0)==0){l=+(Ee|0)*+(r>>>0);break}if(t=(Te|0)/-2|0,oe=((t|0)<0)<<31>>31,(N|0)>(oe|0)|(N|0)==(oe|0)&c>>>0>t>>>0){it=S0()|0,e[it>>2]=34,l=+(Ee|0)*17976931348623157e292*17976931348623157e292;break}if(t=Te+-106|0,oe=((t|0)<0)<<31>>31,(N|0)<(oe|0)|(N|0)==(oe|0)&c>>>0>>0){it=S0()|0,e[it>>2]=34,l=+(Ee|0)*22250738585072014e-324*22250738585072014e-324;break}if(d){if((d|0)<9){D=ke+(w<<2)|0,r=e[D>>2]|0;do r=r*10|0,d=d+1|0;while((d|0)!=9);e[D>>2]=r}w=w+1|0}if((k|0)<9&&(k|0)<=(c|0)&(c|0)<18){if((c|0)==9){l=+(Ee|0)*+((e[ke>>2]|0)>>>0);break}if((c|0)<9){l=+(Ee|0)*+((e[ke>>2]|0)>>>0)/+(e[37312+(8-c<<2)>>2]|0);break}if(t=it+27+(ee(c,-3)|0)|0,r=e[ke>>2]|0,(t|0)>30|(r>>>t|0)==0){l=+(Ee|0)*+(r>>>0)*+(e[37312+(c+-10<<2)>>2]|0);break}}if(r=(c|0)%9|0,!r)d=0,r=0;else{if(U=(c|0)>-1?r:r+9|0,D=e[37312+(8-U<<2)>>2]|0,w){k=1e9/(D|0)|0,d=0,r=0,N=0;do ie=ke+(N<<2)|0,oe=e[ie>>2]|0,t=((oe>>>0)/(D>>>0)|0)+r|0,e[ie>>2]=t,r=ee((oe>>>0)%(D>>>0)|0,k)|0,t=(N|0)==(d|0)&(t|0)==0,N=N+1|0,c=t?c+-9|0:c,d=t?N&127:d;while((N|0)!=(w|0));r&&(e[ke+(w<<2)>>2]=r,w=w+1|0)}else d=0,w=0;r=0,c=9-U+c|0}i:for(;;){H=(c|0)<18,K=(c|0)==18,G=ke+(d<<2)|0;do{if(!H){if(!K)break i;if((e[G>>2]|0)>>>0>=9007199){c=18;break i}}for(D=0,k=w+127|0;U=k&127,N=ke+(U<<2)|0,k=v0(e[N>>2]|0,0,29)|0,k=$0(k|0,ye|0,D|0,0)|0,D=ye,D>>>0>0|(D|0)==0&k>>>0>1e9?(t=xn(k|0,D|0,1e9,0)|0,k=Cr(k|0,D|0,1e9,0)|0,D=t):D=0,e[N>>2]=k,t=(U|0)==(d|0),w=(U|0)!=(w+127&127|0)|t||k|0?w:U,!t;)k=U+-1|0;r=r+-29|0}while(!(D|0));d=d+127&127,(d|0)==(w|0)&&(t=w+127&127,w=ke+((w+126&127)<<2)|0,e[w>>2]=e[w>>2]|e[ke+(t<<2)>>2],w=t),e[ke+(d<<2)>>2]=D,c=c+9|0}i:for(;;){for($=w+1&127,G=ke+((w+127&127)<<2)|0;;){for(H=(c|0)==18,K=(c|0)>27?9:1,U=H^1;;){k=d&127,N=(k|0)==(w|0);do if(N)O=219;else{if(D=e[ke+(k<<2)>>2]|0,D>>>0<9007199){O=219;break}if(D>>>0>9007199)break;if(D=d+1&127,(D|0)==(w|0)){O=219;break}if(D=e[ke+(D<<2)>>2]|0,D>>>0<254740991){O=219;break}if(!(D>>>0>254740991|U)){c=k;break i}}while(!1);if((O|0)==219&&(O=0,H)){O=220;break i}if(r=r+K|0,(d|0)==(w|0))d=w;else break}for(U=(1<>>K,k=d,D=0,N=d;oe=ke+(N<<2)|0,t=e[oe>>2]|0,d=(t>>>K)+D|0,e[oe>>2]=d,D=ee(t&U,H)|0,d=(N|0)==(k|0)&(d|0)==0,N=N+1&127,c=d?c+-9|0:c,d=d?N:k,(N|0)!=(w|0);)k=d;if(D){if(($|0)!=(d|0))break;e[G>>2]=e[G>>2]|1}}e[ke+(w<<2)>>2]=D,w=$}(O|0)==220&&(N?(e[ke+($+-1<<2)>>2]=0,c=w,w=$):c=k),l=+((e[ke+(c<<2)>>2]|0)>>>0),c=d+1&127,(c|0)==(w|0)&&(w=d+2&127,e[ke+(w+-1<<2)>>2]=0),_=+(Ee|0),h=_*(l*1e9+ +((e[ke+(c<<2)>>2]|0)>>>0)),H=r+53|0,N=H-Te|0,U=(N|0)<(it|0),c=U&1,k=U?(N|0)<0?0:N:it,(k|0)<53?(Gt=+Co(+bn(1,105-k|0),h),C=+To(h,+bn(1,53-k|0)),R=Gt,l=C,C=Gt+(h-C)):(R=0,l=0,C=h),D=d+2&127;do if((D|0)==(w|0))h=l;else{D=e[ke+(D<<2)>>2]|0;do if(D>>>0>=5e8){if(D>>>0>5e8){l=_*.75+l;break}if((d+3&127|0)==(w|0)){l=_*.5+l;break}else{l=_*.75+l;break}}else{if(!(D|0)&&(d+3&127|0)==(w|0))break;l=_*.25+l}while(!1);if((53-k|0)<=1){h=l;break}if(+To(l,1)!=0){h=l;break}h=l+1}while(!1);l=C+h-R;do if((H&2147483647|0)>(-2-ne|0)){if(+Ie(+l)>=9007199254740992&&(c=U&(k|0)==(N|0)?0:c,r=r+1|0,l=l*.5),(r+50|0)<=(ce|0)&&!(h!=0&(c|0)!=0))break;it=S0()|0,e[it>>2]=34}while(!1);l=+Eo(l,r)}while(!1);break e}default:{e[ie>>2]|0&&(e[oe>>2]=(e[oe>>2]|0)+-1),it=S0()|0,e[it>>2]=22,oi(t,0),l=0;break e}}}}while(!1);if((O|0)==23&&(c=(e[ie>>2]|0)==0,c||(e[oe>>2]=(e[oe>>2]|0)+-1),(o|0)!=0&r>>>0>3))do c||(e[oe>>2]=(e[oe>>2]|0)+-1),r=r+-1|0;while(r>>>0>3);l=+(Ee|0)*pe}while(!1);return b=jt,+l}function wo(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0;e:do if(r>>>0>36)c=S0()|0,e[c>>2]=22,c=0,l=0;else{U=t+4|0,_=t+100|0;do h=e[U>>2]|0,h>>>0<(e[_>>2]|0)>>>0?(e[U>>2]=h+1,h=F[h>>0]|0):h=u0(t)|0;while(ji(h)|0);t:do switch(h|0){case 43:case 45:if(d=((h|0)==45)<<31>>31,h=e[U>>2]|0,h>>>0<(e[_>>2]|0)>>>0){e[U>>2]=h+1,h=F[h>>0]|0,R=d;break t}else{h=u0(t)|0,R=d;break t}default:R=0}while(!1);d=(r|0)==0;do if((r&-17|0)==0&(h|0)==48){if(h=e[U>>2]|0,h>>>0<(e[_>>2]|0)>>>0?(e[U>>2]=h+1,h=F[h>>0]|0):h=u0(t)|0,(h|32|0)!=120)if(d){r=8,k=46;break}else{k=32;break}if(r=e[U>>2]|0,r>>>0<(e[_>>2]|0)>>>0?(e[U>>2]=r+1,h=F[r>>0]|0):h=u0(t)|0,(F[53879+(h+1)>>0]|0)>15){if(l=(e[_>>2]|0)==0,l||(e[U>>2]=(e[U>>2]|0)+-1),!o){oi(t,0),c=0,l=0;break e}if(l){c=0,l=0;break e}e[U>>2]=(e[U>>2]|0)+-1,c=0,l=0;break e}else r=16,k=46}else if(r=d?10:r,(F[53879+(h+1)>>0]|0)>>>0>>0)k=32;else{e[_>>2]|0&&(e[U>>2]=(e[U>>2]|0)+-1),oi(t,0),c=S0()|0,e[c>>2]=22,c=0,l=0;break e}while(!1);if((k|0)==32)if((r|0)==10){if(r=h+-48|0,r>>>0<10){for(h=0;;)if(d=(h*10|0)+r|0,r=e[U>>2]|0,r>>>0<(e[_>>2]|0)>>>0?(e[U>>2]=r+1,h=F[r>>0]|0):h=u0(t)|0,r=h+-48|0,r>>>0<10&d>>>0<429496729)h=d;else{r=d;break}d=0}else r=0,d=0;if(o=h+-48|0,o>>>0<10){for(;;){if(w=Qi(r|0,d|0,10,0)|0,C=ye,D=((o|0)<0)<<31>>31,N=~D,C>>>0>N>>>0|(C|0)==(N|0)&w>>>0>~o>>>0){w=r;break}if(r=$0(w|0,C|0,o|0,D|0)|0,d=ye,h=e[U>>2]|0,h>>>0<(e[_>>2]|0)>>>0?(e[U>>2]=h+1,h=F[h>>0]|0):h=u0(t)|0,o=h+-48|0,!(o>>>0<10&(d>>>0<429496729|(d|0)==429496729&r>>>0<2576980378))){w=r;break}}o>>>0>9?(h=w,r=R):(r=10,k=72)}else h=r,r=R}else k=46;t:do if((k|0)==46){if(!(r+-1&r)){if(k=S[54136+((r*23|0)>>>5&7)>>0]|0,d=S[53879+(h+1)>>0]|0,o=d&255,o>>>0>>0){for(h=0;w=o|h<>2]|0,h>>>0<(e[_>>2]|0)>>>0?(e[U>>2]=h+1,h=F[h>>0]|0):h=u0(t)|0,d=S[53879+(h+1)>>0]|0,o=d&255,w>>>0<134217728&o>>>0>>0;)h=w;o=0}else o=0,w=0;if(C=Di(-1,-1,k|0)|0,D=ye,(d&255)>>>0>=r>>>0|(o>>>0>D>>>0|(o|0)==(D|0)&w>>>0>C>>>0)){d=o,k=72;break}else h=o;for(;;)if(w=v0(w|0,h|0,k|0)|0,o=ye,w=d&255|w,h=e[U>>2]|0,h>>>0<(e[_>>2]|0)>>>0?(e[U>>2]=h+1,h=F[h>>0]|0):h=u0(t)|0,d=S[53879+(h+1)>>0]|0,(d&255)>>>0>=r>>>0|(o>>>0>D>>>0|(o|0)==(D|0)&w>>>0>C>>>0)){d=o,k=72;break t}else h=o}if(d=S[53879+(h+1)>>0]|0,o=d&255,o>>>0>>0){for(h=0;w=o+(ee(h,r)|0)|0,h=e[U>>2]|0,h>>>0<(e[_>>2]|0)>>>0?(e[U>>2]=h+1,h=F[h>>0]|0):h=u0(t)|0,d=S[53879+(h+1)>>0]|0,o=d&255,w>>>0<119304647&o>>>0>>0;)h=w;o=0}else w=0,o=0;if((d&255)>>>0>>0)for(k=xn(-1,-1,r|0,0)|0,N=ye,D=o;;){if(D>>>0>N>>>0|(D|0)==(N|0)&w>>>0>k>>>0){d=D,k=72;break t}if(o=Qi(w|0,D|0,r|0,0)|0,C=ye,d=d&255,C>>>0>4294967295|(C|0)==-1&o>>>0>~d>>>0){d=D,k=72;break t}if(w=$0(d|0,0,o|0,C|0)|0,o=ye,h=e[U>>2]|0,h>>>0<(e[_>>2]|0)>>>0?(e[U>>2]=h+1,h=F[h>>0]|0):h=u0(t)|0,d=S[53879+(h+1)>>0]|0,(d&255)>>>0>=r>>>0){d=o,k=72;break}else D=o}else d=o,k=72}while(!1);if((k|0)==72)if((F[53879+(h+1)>>0]|0)>>>0>>0){do h=e[U>>2]|0,h>>>0<(e[_>>2]|0)>>>0?(e[U>>2]=h+1,h=F[h>>0]|0):h=u0(t)|0;while((F[53879+(h+1)>>0]|0)>>>0>>0);d=S0()|0,e[d>>2]=34,d=c,h=l,r=(l&1|0)==0&!0?R:0}else h=w,r=R;if(e[_>>2]|0&&(e[U>>2]=(e[U>>2]|0)+-1),!(d>>>0>>0|(d|0)==(c|0)&h>>>0>>0)){if(!((l&1|0)!=0|!1|(r|0)!=0)){U=S0()|0,e[U>>2]=34,l=$0(l|0,c|0,-1,-1)|0,c=ye;break}if(d>>>0>c>>>0|(d|0)==(c|0)&h>>>0>l>>>0){U=S0()|0,e[U>>2]=34;break}}l=((r|0)<0)<<31>>31,l=ii(h^r|0,d^l|0,r|0,l|0)|0,c=ye}while(!1);return ye=c,l|0}function oi(t,r){t=t|0,r=r|0;var o=0,l=0,c=0;e[t+104>>2]=r,o=e[t+4>>2]|0,l=e[t+8>>2]|0,c=l-o|0,e[t+108>>2]=c,(r|0)!=0&(c|0)>(r|0)?e[t+100>>2]=o+r:e[t+100>>2]=l}function u0(t){t=t|0;var r=0,o=0,l=0,c=0,h=0,d=0;return o=t+104|0,h=e[o>>2]|0,h|0&&(e[t+108>>2]|0)>=(h|0)?d=4:(r=br(t)|0,(r|0)>=0?(c=e[o>>2]|0,o=t+8|0,c?(l=e[o>>2]|0,h=e[t+4>>2]|0,o=l,c=c-(e[t+108>>2]|0)+-1|0,(o-h|0)>(c|0)?e[t+100>>2]=h+c:d=9):(l=e[o>>2]|0,o=l,d=9),(d|0)==9&&(e[t+100>>2]=o),o=e[t+4>>2]|0,l&&(t=t+108|0,e[t>>2]=l+1-o+(e[t>>2]|0)),o=o+-1|0,(F[o>>0]|0|0)!=(r|0)&&(S[o>>0]=r)):d=4),(d|0)==4&&(e[t+100>>2]=0,r=-1),r|0}function Xi(t){t=t|0;var r=0;return t>>>0>4294963200&&(r=S0()|0,e[r>>2]=0-t,t=-1),t|0}function CA(t){return t=t|0,0}function mS(t,r,o,l){return t=t|0,r=r|0,o=o|0,l=l|0,l|0}function yo(t,r){return t=t|0,r=r|0,-1}function gS(t){t=t|0,n0(t)}function SS(t,r){return t=t|0,r=r|0,(t+-48|0)>>>0<10|0}function AS(t,r){return t=t|0,r=r|0,pS(t)|0}function vS(t,r,o){return t=t|0,r=r|0,o=o|0,S[r>>0]|0&&$o(r,58885)|0&&$o(r,54145)|0?o=0:o||(o=Dd(1,4)|0),o|0}function ai(t){t=t|0;var r=0,o=0;return r=($r()|0)+176|0,o=e[r>>2]|0,t&&(e[r>>2]=t),o|0}function xS(t,r){t=+t,r=+r;var o=0,l=0;return B[q>>3]=t,l=e[q>>2]|0,o=e[q+4>>2]|0,B[q>>3]=r,o=e[q+4>>2]&-2147483648|o&2147483647,e[q>>2]=l,e[q+4>>2]=o,+ +B[q>>3]}function Co(t,r){return t=+t,r=+r,+ +xS(t,r)}function wS(t,r){t=+t,r=+r;var o=0,l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0;B[q>>3]=t,o=e[q>>2]|0,D=e[q+4>>2]|0,B[q>>3]=r,k=e[q>>2]|0,N=e[q+4>>2]|0,l=Di(o|0,D|0,52)|0,l=l&2047,w=Di(k|0,N|0,52)|0,w=w&2047,R=D&-2147483648,d=v0(k|0,N|0,1)|0,C=ye;e:do if(!((d|0)==0&(C|0)==0)&&(h=N&2147483647,!(h>>>0>2146435072|(h|0)==2146435072&k>>>0>0|(l|0)==2047))){if(c=v0(o|0,D|0,1)|0,h=ye,!(h>>>0>C>>>0|(h|0)==(C|0)&c>>>0>d>>>0))return+((c|0)==(d|0)&(h|0)==(C|0)?t*0:t);if(l)c=D&1048575|1048576;else{if(l=v0(o|0,D|0,12)|0,c=ye,(c|0)>-1|(c|0)==-1&l>>>0>4294967295){h=l,l=0;do l=l+-1|0,h=v0(h|0,c|0,1)|0,c=ye;while((c|0)>-1|(c|0)==-1&h>>>0>4294967295)}else l=0;o=v0(o|0,D|0,1-l|0)|0,c=ye}if(w)D=N&1048575|1048576;else{if(h=v0(k|0,N|0,12)|0,d=ye,(d|0)>-1|(d|0)==-1&h>>>0>4294967295){w=0;do w=w+-1|0,h=v0(h|0,d|0,1)|0,d=ye;while((d|0)>-1|(d|0)==-1&h>>>0>4294967295)}else w=0;k=v0(k|0,N|0,1-w|0)|0,D=ye}C=ii(o|0,c|0,k|0,D|0)|0,d=ye,h=(d|0)>-1|(d|0)==-1&C>>>0>4294967295;t:do if((l|0)>(w|0)){for(;;){if(h){if((o|0)==(k|0)&(c|0)==(D|0))break;o=C,c=d}if(o=v0(o|0,c|0,1)|0,c=ye,l=l+-1|0,C=ii(o|0,c|0,k|0,D|0)|0,d=ye,h=(d|0)>-1|(d|0)==-1&C>>>0>4294967295,(l|0)<=(w|0))break t}r=t*0;break e}while(!1);if(h)if((o|0)==(k|0)&(c|0)==(D|0)){r=t*0;break}else c=d,o=C;if(c>>>0<1048576|(c|0)==1048576&o>>>0<0)do o=v0(o|0,c|0,1)|0,c=ye,l=l+-1|0;while(c>>>0<1048576|(c|0)==1048576&o>>>0<0);(l|0)>0?(N=$0(o|0,c|0,0,-1048576)|0,o=ye,l=v0(l|0,0,52)|0,o=o|ye,l=N|l):(l=Di(o|0,c|0,1-l|0)|0,o=ye),e[q>>2]=l,e[q+4>>2]=o|R,r=+B[q>>3]}else _=3;while(!1);return(_|0)==3&&(r=t*r,r=r/r),+r}function To(t,r){return t=+t,r=+r,+ +wS(t,r)}function Io(t,r){t=+t,r=r|0;var o=0,l=0,c=0;switch(B[q>>3]=t,o=e[q>>2]|0,l=e[q+4>>2]|0,c=Di(o|0,l|0,52)|0,c=c&2047,c|0){case 0:{t!=0?(t=+Io(t*18446744073709552e3,r),o=(e[r>>2]|0)+-64|0):o=0,e[r>>2]=o;break}case 2047:break;default:e[r>>2]=c+-1022,e[q>>2]=o,e[q+4>>2]=l&-2146435073|1071644672,t=+B[q>>3]}return+t}function yS(t,r){return t=+t,r=r|0,+ +Io(t,r)}function bn(t,r){t=+t,r=r|0;var o=0;return(r|0)>1023?(t=t*898846567431158e293,o=r+-1023|0,(o|0)>1023&&(o=r+-2046|0,o=(o|0)>1023?1023:o,t=t*898846567431158e293)):(r|0)<-1022?(t=t*22250738585072014e-324,o=r+1022|0,(o|0)<-1022&&(o=r+2044|0,o=(o|0)<-1022?-1022:o,t=t*22250738585072014e-324)):o=r,o=v0(o+1023|0,0,52)|0,r=ye,e[q>>2]=o,e[q+4>>2]=r,+(t*+B[q>>3])}function Eo(t,r){return t=+t,r=r|0,+ +bn(t,r)}function CS(t,r,o){return t=t|0,r=r|0,o=o|0,Nn(0,t,r,o|0?o:37344)|0}function Nn(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0,D=0;C=b,b=b+16|0,c=C,d=l|0?l:37348,l=e[d>>2]|0;e:do if(!r)l?w=15:l=0;else if(h=t|0?t:c,!o)l=-2;else{if(l)c=o,w=9;else{if(l=S[r>>0]|0,c=l&255,l<<24>>24>-1){e[h>>2]=c,l=l<<24>>24!=0&1;break}if(l=c+-194|0,l>>>0>50){w=15;break}l=e[37076+(l<<2)>>2]|0,c=o+-1|0,c&&(r=r+1|0,w=9)}t:do if((w|0)==9){if(t=S[r>>0]|0,D=(t&255)>>>3,(D+-16|D+(l>>26))>>>0>7){w=15;break e}for(;r=r+1|0,l=(t&255)+-128|l<<6,c=c+-1|0,!((l|0)>=0);){if(!c)break t;if(t=S[r>>0]|0,(t&-64)<<24>>24!=-128){w=15;break e}}e[d>>2]=0,e[h>>2]=l,l=o-c|0;break e}while(!1);e[d>>2]=l,l=-2}while(!1);return(w|0)==15&&(e[d>>2]=0,l=S0()|0,e[l>>2]=84,l=-1),b=C,l|0}function TS(t){return t=t|0,t?t=(e[t>>2]|0)==0:t=1,t&1|0}function IS(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0;R=b,b=b+1040|0,D=R+8|0,N=R,C=e[r>>2]|0,e[N>>2]=C,k=(t|0)!=0,l=k?l:256,t=k?t:D,h=C;e:do if((l|0)!=0&(C|0)!=0){for(w=l,C=h,l=0;;){if(h=o>>>2,d=h>>>0>=w>>>0,!(o>>>0>131|d)){h=C;break e}if(h=d?w:h,o=o-h|0,h=ko(t,N,h,c)|0,(h|0)==-1){l=o;break}if(_=(t|0)==(D|0),C=_?0:h,d=w-C|0,t=_?t:t+(h<<2)|0,l=h+l|0,h=e[N>>2]|0,(w|0)!=(C|0)&(h|0)!=0)w=d,C=h;else{w=d;break e}}o=l,w=0,h=e[N>>2]|0,l=-1}else w=l,l=0;while(!1);e:do if(h|0&&(w|0)!=0&(o|0)!=0){for(d=h,h=t;t=Nn(h,d,o,c)|0,!((t+2|0)>>>0<3);)if(d=(e[N>>2]|0)+t|0,e[N>>2]=d,w=w+-1|0,l=l+1|0,(w|0)!=0&(o|0)!=(t|0))o=o-t|0,h=h+4|0;else break e;switch(t|0){case-1:{l=-1;break e}case 0:{e[N>>2]=0;break e}default:{e[c>>2]=0;break e}}}while(!1);return k&&(e[r>>2]=e[N>>2]),b=R,l|0}function ko(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0,D=0;c=e[r>>2]|0,l|0&&(h=e[l>>2]|0,(h|0)!=0)?t?(e[l>>2]=0,C=t,l=o,w=h,D=37):(l=o,d=c,D=16):t?(h=t,l=o,D=6):(l=o,D=7);e:for(;;)if((D|0)==6){if(l)t=h;else{D=26;break}for(;;){h=S[c>>0]|0;do if(((h&255)+-1|0)>>>0<127&&l>>>0>4&(c&3|0)==0){for(d=c;;){if(c=e[d>>2]|0,(c+-16843009|c)&-2139062144){h=c,c=d,D=32;break}if(e[t>>2]=c&255,e[t+4>>2]=F[d+1>>0],e[t+8>>2]=F[d+2>>0],c=d+4|0,h=t+16|0,e[t+12>>2]=F[d+3>>0],l=l+-4|0,l>>>0>4)t=h,d=c;else{D=31;break}}if((D|0)==31){t=h,h=S[c>>0]|0;break}else if((D|0)==32){h=h&255;break}}while(!1);if(h=h&255,(h+-1|0)>>>0>=127)break;if(c=c+1|0,e[t>>2]=h,l=l+-1|0,l)t=t+4|0;else{D=26;break e}}if(h=h+-194|0,h>>>0>50){D=48;break}C=t,w=e[37076+(h<<2)>>2]|0,c=c+1|0,D=37;continue}else if((D|0)==7){if(h=S[c>>0]|0,((h&255)+-1|0)>>>0<127&&!(c&3|0)){if(h=e[c>>2]|0,!((h+-16843009|h)&-2139062144))do c=c+4|0,l=l+-4|0,h=e[c>>2]|0;while(!((h+-16843009|h)&-2139062144|0));h=h&255}if(h=h&255,(h+-1|0)>>>0<127){l=l+-1|0,c=c+1|0,D=7;continue}if(h=h+-194|0,h>>>0>50){D=48;break}h=e[37076+(h<<2)>>2]|0,d=c+1|0,D=16;continue}else if((D|0)==16){if(D=(F[d>>0]|0)>>>3,(D+-16|D+(h>>26))>>>0>7){D=17;break}if(c=d+1|0,h&33554432){if((S[c>>0]&-64)<<24>>24!=-128){D=20;break}if(c=d+2|0,h&524288){if((S[c>>0]&-64)<<24>>24!=-128){D=23;break}c=d+3|0}}l=l+-1|0,D=7;continue}else if((D|0)==37){if(h=F[c>>0]|0,D=h>>>3,(D+-16|D+(w>>26))>>>0>7){D=38;break}if(d=c+1|0,t=h+-128|w<<6,(t|0)<0){if(h=F[d>>0]|0,(h&192|0)!=128){D=41;break}if(d=c+2|0,t=h+-128|t<<6,(t|0)<0){if(h=F[d>>0]|0,(h&192|0)!=128){D=44;break}t=h+-128|t<<6,c=c+3|0}else c=d}else c=d;e[C>>2]=t,h=C+4|0,l=l+-1|0,D=6;continue}return(D|0)==17||(D|0)==20||(D|0)==23?(c=d+-1|0,D=47):(D|0)==26?e[r>>2]=c:(D|0)==38?(t=C,h=w,c=c+-1|0,D=47):((D|0)==41||(D|0)==44)&&(l=C,o=c+-1|0,D=52),(D|0)==47&&(h?(l=t,o=c,D=52):D=48),(D|0)==48&&(S[c>>0]|0?(l=t,o=c,D=52):(t&&(e[t>>2]=0,e[r>>2]=0),o=o-l|0)),(D|0)==52&&(D=S0()|0,e[D>>2]=84,l&&(e[r>>2]=o),o=-1),o|0}function ES(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0;d=b,b=b+16|0,l=d;e:do if(!r)l=0;else{do if(o){if(h=t|0?t:l,l=S[r>>0]|0,t=l&255,l<<24>>24>-1){e[h>>2]=t,l=l<<24>>24!=0&1;break e}if(l=t+-194|0,l>>>0<=50){if(t=r+1|0,c=e[37076+(l<<2)>>2]|0,o>>>0<4&&c&-2147483648>>>((o*6|0)+-6|0)|0)break;if(l=F[t>>0]|0,o=l>>>3,(o+-16|o+(c>>26))>>>0<=7){if(l=l+-128|c<<6,(l|0)>=0){e[h>>2]=l,l=2;break e}if(t=F[r+2>>0]|0,(t&192|0)==128){if(t=t+-128|l<<6,(t|0)>=0){e[h>>2]=t,l=3;break e}if(l=F[r+3>>0]|0,(l&192|0)==128){e[h>>2]=l+-128|t<<6,l=4;break e}}}}}while(!1);l=S0()|0,e[l>>2]=84,l=-1}while(!1);return b=d,l|0}function Oi(t,r,o){t=t|0,r=r|0,o=o|0;do if(t){if(r>>>0<128){S[t>>0]=r,t=1;break}if(r>>>0<2048){S[t>>0]=r>>>6|192,S[t+1>>0]=r&63|128,t=2;break}if(r>>>0<55296|(r&-8192|0)==57344){S[t>>0]=r>>>12|224,S[t+1>>0]=r>>>6&63|128,S[t+2>>0]=r&63|128,t=3;break}if((r+-65536|0)>>>0<1048576){S[t>>0]=r>>>18|240,S[t+1>>0]=r>>>12&63|128,S[t+2>>0]=r>>>6&63|128,S[t+3>>0]=r&63|128,t=4;break}else{t=S0()|0,e[t>>2]=84,t=-1;break}}else t=1;while(!1);return t|0}function kS(t,r,o,l,c){t=t|0,r=r|0,o=o|0,l=l|0,c=c|0;var h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0;k=b,b=b+272|0,w=k+8|0,D=k,d=e[r>>2]|0,e[D>>2]=d,C=(t|0)!=0,c=C?l:256,l=C?t:w,t=d;e:do if((c|0)!=0&(d|0)!=0){for(d=c,h=t,c=0;;){if(t=o>>>0>=d>>>0,!(t|o>>>0>32)){t=h;break e}if(t=t?d:o,o=o-t|0,t=DS(l,D,t,0)|0,(t|0)==-1){c=o;break}if(R=(l|0)==(w|0),N=R?0:t,h=d-N|0,l=R?l:l+t|0,c=t+c|0,t=e[D>>2]|0,(d|0)!=(N|0)&(t|0)!=0)d=h,h=t;else{d=h;break e}}o=c,d=0,t=e[D>>2]|0,c=-1}else d=c,c=0;while(!1);e:do if(t|0&&(d|0)!=0&(o|0)!=0){for(h=t,t=l;l=Oi(t,e[h>>2]|0,0)|0,!((l+1|0)>>>0<2);)if(h=(e[D>>2]|0)+4|0,e[D>>2]=h,o=o+-1|0,c=c+1|0,(d|0)!=(l|0)&(o|0)!=0)d=d-l|0,t=t+l|0;else break e;l?c=-1:e[D>>2]=0}while(!1);return C&&(e[r>>2]=e[D>>2]),b=k,c|0}function DS(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0;w=b,b=b+16|0,d=w;e:do if(t){t:do if(o>>>0>3){for(l=o,c=e[r>>2]|0;;){if(h=e[c>>2]|0,(h+-1|0)>>>0>126){if(!h)break;if(h=Oi(t,h,0)|0,(h|0)==-1){o=-1;break e}t=t+h|0,l=l-h|0}else S[t>>0]=h,t=t+1|0,l=l+-1|0,c=e[r>>2]|0;if(c=c+4|0,e[r>>2]=c,l>>>0<=3)break t}S[t>>0]=0,e[r>>2]=0,o=o-l|0;break e}else l=o;while(!1);if(l){for(c=e[r>>2]|0;;){if(h=e[c>>2]|0,(h+-1|0)>>>0>126){if(!h){c=19;break}if(h=Oi(d,h,0)|0,(h|0)==-1){o=-1;break e}if(l>>>0>>0){c=22;break}Oi(t,e[c>>2]|0,0)|0,t=t+h|0,l=l-h|0}else S[t>>0]=h,t=t+1|0,l=l+-1|0,c=e[r>>2]|0;if(c=c+4|0,e[r>>2]=c,!l)break e}if((c|0)==19){S[t>>0]=0,e[r>>2]=0,o=o-l|0;break}else if((c|0)==22){o=o-l|0;break}}}else if(t=e[r>>2]|0,l=e[t>>2]|0,!l)o=0;else{o=0;do{if(l>>>0>127){if(l=Oi(d,l,0)|0,(l|0)==-1){o=-1;break e}}else l=1;o=l+o|0,t=t+4|0,l=e[t>>2]|0}while(l|0)}while(!1);return b=w,o|0}function Do(t,r){return t=t|0,r=r|0,t?t=Oi(t,r,0)|0:t=0,t|0}function Ri(t){return t=t|0,0}function mi(t){t=t|0}function bo(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0,C=0;C=b,b=b+16|0,w=C,d=r&255,S[w>>0]=d,l=t+16|0,c=e[l>>2]|0,c?h=4:Ro(t)|0?o=-1:(c=e[l>>2]|0,h=4);do if((h|0)==4){if(l=t+20|0,h=e[l>>2]|0,h>>>0>>0&&(o=r&255,(o|0)!=(S[t+75>>0]|0))){e[l>>2]=h+1,S[h>>0]=d;break}(Yt[e[t+36>>2]&63](t,w,1)|0)==1?o=F[w>>0]|0:o=-1}while(!1);return b=C,o|0}function bS(t){t=t|0;var r=0,o=0;return r=b,b=b+16|0,o=r,e[o>>2]=e[t+60>>2],t=Xi(Zo(6,o|0)|0)|0,b=r,t|0}function NS(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0;return D=b,b=b+48|0,h=D+16|0,c=D,l=D+32|0,e[l>>2]=r,d=l+4|0,C=t+48|0,k=e[C>>2]|0,e[d>>2]=o-((k|0)!=0&1),w=t+44|0,e[l+8>>2]=e[w>>2],e[l+12>>2]=k,e[9258]|0?(zr(185,t|0),e[c>>2]=e[t+60>>2],e[c+4>>2]=l,e[c+8>>2]=2,l=Xi(Wr(145,c|0)|0)|0,Vr(0)):(e[h>>2]=e[t+60>>2],e[h+4>>2]=l,e[h+8>>2]=2,l=Xi(Wr(145,h|0)|0)|0),(l|0)>=1?(d=e[d>>2]|0,l>>>0>d>>>0&&(h=e[w>>2]|0,c=t+4|0,e[c>>2]=h,e[t+8>>2]=h+(l-d),e[C>>2]|0&&(e[c>>2]=h+1,S[r+(o+-1)>>0]=S[h>>0]|0),l=o)):(e[t>>2]=e[t>>2]|l&48^16,e[t+8>>2]=0,e[t+4>>2]=0),b=D,l|0}function RS(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0;return c=b,b=b+32|0,h=c,l=c+20|0,e[h>>2]=e[t+60>>2],e[h+4>>2]=0,e[h+8>>2]=r,e[h+12>>2]=l,e[h+16>>2]=o,(Xi(ta(140,h|0)|0)|0)<0?(e[l>>2]=-1,t=-1):t=e[l>>2]|0,b=c,t|0}function No(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0;for(U=b,b=b+48|0,N=U+16|0,k=U,l=U+32|0,R=t+28|0,c=e[R>>2]|0,e[l>>2]=c,_=t+20|0,c=(e[_>>2]|0)-c|0,e[l+4>>2]=c,e[l+8>>2]=r,e[l+12>>2]=o,C=t+60|0,D=t+44|0,r=2,c=c+o|0;;){if(e[9258]|0?(zr(186,t|0),e[k>>2]=e[C>>2],e[k+4>>2]=l,e[k+8>>2]=r,d=Xi(Hr(146,k|0)|0)|0,Vr(0)):(e[N>>2]=e[C>>2],e[N+4>>2]=l,e[N+8>>2]=r,d=Xi(Hr(146,N|0)|0)|0),(c|0)==(d|0)){c=6;break}if((d|0)<0){c=8;break}c=c-d|0,h=e[l+4>>2]|0,d>>>0<=h>>>0?(r|0)==2?(e[R>>2]=(e[R>>2]|0)+d,w=h,r=2):w=h:(w=e[D>>2]|0,e[R>>2]=w,e[_>>2]=w,w=e[l+12>>2]|0,d=d-h|0,l=l+8|0,r=r+-1|0),e[l>>2]=(e[l>>2]|0)+d,e[l+4>>2]=w-d}return(c|0)==6?(N=e[D>>2]|0,e[t+16>>2]=N+(e[t+48>>2]|0),t=N,e[R>>2]=t,e[_>>2]=t):(c|0)==8&&(e[t+16>>2]=0,e[R>>2]=0,e[_>>2]=0,e[t>>2]=e[t>>2]|32,(r|0)==2?o=0:o=o-(e[l+4>>2]|0)|0),b=U,o|0}function MS(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0;return c=b,b=b+80|0,l=c,e[t+36>>2]=8,!(e[t>>2]&64|0)&&(e[l>>2]=e[t+60>>2],e[l+4>>2]=21505,e[l+8>>2]=c+12,(Ko(54,l|0)|0)!=0)&&(S[t+75>>0]=-1),l=No(t,r,o)|0,b=c,l|0}function _S(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0;return l=t+84|0,h=e[l>>2]|0,d=o+256|0,c=Oo(h,0,d)|0,c=c|0?c-h|0:d,o=c>>>0>>0?c:o,o0(r|0,h|0,o|0)|0,e[t+4>>2]=h+o,r=h+c|0,e[t+8>>2]=r,e[l>>2]=r,o|0}function Fo(t){t=t|0;var r=0,o=0;return r=t+74|0,o=S[r>>0]|0,S[r>>0]=o+255|o,r=t+20|0,o=t+44|0,(e[r>>2]|0)>>>0>(e[o>>2]|0)>>>0&&Yt[e[t+36>>2]&63](t,0,0)|0,e[t+16>>2]=0,e[t+28>>2]=0,e[r>>2]=0,r=e[t>>2]|0,r&20?(r&4&&(e[t>>2]=r|32),r=-1):(r=e[o>>2]|0,e[t+8>>2]=r,e[t+4>>2]=r,r=0),r|0}function Ro(t){t=t|0;var r=0,o=0;return r=t+74|0,o=S[r>>0]|0,S[r>>0]=o+255|o,r=e[t>>2]|0,r&8?(e[t>>2]=r|32,r=-1):(e[t+8>>2]=0,e[t+4>>2]=0,r=e[t+44>>2]|0,e[t+28>>2]=r,e[t+20>>2]=r,e[t+16>>2]=r+(e[t+48>>2]|0),r=0),r|0}function br(t){t=t|0;var r=0,o=0;return o=b,b=b+16|0,r=o,!(e[t+8>>2]|0)&&Fo(t)|0?r=-1:(Yt[e[t+32>>2]&63](t,r,1)|0)==1?r=F[r>>0]|0:r=-1,b=o,r|0}function Nr(t){t=t|0;var r=0,o=0;do if(t){if((e[t+76>>2]|0)<=-1){r=Mr(t)|0;break}o=(Ri(t)|0)==0,r=Mr(t)|0,o||mi(t)}else{if(e[9323]|0?r=Nr(e[9323]|0)|0:r=0,M0(37060),t=e[9264]|0,t)do(e[t+76>>2]|0)>-1?o=Ri(t)|0:o=0,(e[t+20>>2]|0)>>>0>(e[t+28>>2]|0)>>>0&&(r=Mr(t)|0|r),o&&mi(t),t=e[t+56>>2]|0;while(t|0);Yo(37060)}while(!1);return r|0}function PS(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0;(e[r+76>>2]|0)>=0&&Ri(r)|0?((S[r+75>>0]|0)!=(t|0)&&(l=r+20|0,c=e[l>>2]|0,c>>>0<(e[r+16>>2]|0)>>>0)?(e[l>>2]=c+1,S[c>>0]=t,o=t&255):o=bo(r,t)|0,mi(r)):d=3;do if((d|0)==3){if((S[r+75>>0]|0)!=(t|0)&&(h=r+20|0,o=e[h>>2]|0,o>>>0<(e[r+16>>2]|0)>>>0)){e[h>>2]=o+1,S[o>>0]=t,o=t&255;break}o=bo(r,t)|0}while(!1);return o|0}function B0(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0;l=o+16|0,c=e[l>>2]|0,c?h=4:Ro(o)|0?l=0:(c=e[l>>2]|0,h=4);e:do if((h|0)==4){if(d=o+20|0,h=e[d>>2]|0,(c-h|0)>>>0>>0){l=Yt[e[o+36>>2]&63](o,t,r)|0;break}t:do if((S[o+75>>0]|0)>-1){for(l=r;;){if(!l){c=h,l=0;break t}if(c=l+-1|0,(S[t+c>>0]|0)==10)break;l=c}if((Yt[e[o+36>>2]&63](o,t,l)|0)>>>0>>0)break e;r=r-l|0,t=t+l|0,c=e[d>>2]|0}else c=h,l=0;while(!1);o0(c|0,t|0,r|0)|0,e[d>>2]=(e[d>>2]|0)+r,l=l+r|0}while(!1);return l|0}function gi(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0;return c=ee(o,r)|0,(e[l+76>>2]|0)>-1?(h=(Ri(l)|0)==0,t=B0(t,c,l)|0,h||mi(l)):t=B0(t,c,l)|0,(t|0)!=(c|0)&&(o=(t>>>0)/(r>>>0)|0),o|0}function Fn(t){t=t|0;var r=0,o=0,l=0;(e[t+76>>2]|0)>=0&&Ri(t)|0?(r=t+4|0,o=e[r>>2]|0,o>>>0<(e[t+8>>2]|0)>>>0?(e[r>>2]=o+1,r=F[o>>0]|0):r=br(t)|0):l=3;do if((l|0)==3)if(r=t+4|0,o=e[r>>2]|0,o>>>0<(e[t+8>>2]|0)>>>0){e[r>>2]=o+1,r=F[o>>0]|0;break}else{r=br(t)|0;break}while(!1);return r|0}function Mo(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0;return c=b,b=b+16|0,h=c,e[h>>2]=l,l=Mn(t,r,o,h)|0,b=c,l|0}function _o(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0;return l=b,b=b+16|0,c=l,e[c>>2]=o,o=Lo(t,r,c)|0,b=l,o|0}function Rn(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0;do if((t|0)!=-1){if((e[r+76>>2]|0)>-1?c=Ri(r)|0:c=0,!(e[r+8>>2]|0)&&Fo(r)|0||(h=6),(h|0)==6&&(o=r+4|0,l=e[o>>2]|0,l>>>0>((e[r+44>>2]|0)+-8|0)>>>0)){if(h=l+-1|0,e[o>>2]=h,S[h>>0]=t,e[r>>2]=e[r>>2]&-17,!c)break;mi(r);break}c&&mi(r),t=-1}else t=-1;while(!1);return t|0}function LS(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0,w=0;w=b,b=b+16|0,l=w,c=E0(240)|0;do if(c){if(e[l>>2]=e[o>>2],l=Mn(c,240,r,l)|0,l>>>0<240){r=Gi(c,l+1|0)|0,e[t>>2]=r|0?r:c;break}n0(c),(l|0)>=0&&(d=l+1|0,h=E0(d)|0,e[t>>2]=h,(h|0)!=0)?l=Mn(h,d,r,o)|0:l=-1}else l=-1;while(!1);return b=w,l|0}function Po(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0;H=b,b=b+224|0,N=H+80|0,U=H+96|0,_=H,R=H+136|0,l=U,c=l+40|0;do e[l>>2]=0,l=l+4|0;while((l|0)<(c|0));return e[N>>2]=e[o>>2],(cr(0,r,N,_,U)|0)<0?o=-1:((e[t+76>>2]|0)>-1?D=Ri(t)|0:D=0,o=e[t>>2]|0,k=o&32,(S[t+74>>0]|0)<1&&(e[t>>2]=o&-33),o=t+48|0,e[o>>2]|0?l=cr(t,r,N,_,U)|0:(c=t+44|0,h=e[c>>2]|0,e[c>>2]=R,d=t+28|0,e[d>>2]=R,w=t+20|0,e[w>>2]=R,e[o>>2]=80,C=t+16|0,e[C>>2]=R+80,l=cr(t,r,N,_,U)|0,h&&(Yt[e[t+36>>2]&63](t,0,0)|0,l=e[w>>2]|0?l:-1,e[c>>2]=h,e[o>>2]=0,e[C>>2]=0,e[d>>2]=0,e[w>>2]=0)),o=e[t>>2]|0,e[t>>2]=o|k,D&&mi(t),o=o&32|0?-1:l),b=H,o|0}function OS(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0,w=0,C=0,D=0,k=0,N=0,R=0,_=0,U=0,H=0,K=0,G=0,$=0,P=0,O=0,Z=0,ie=0,oe=0,ne=0,ce=0,ke=0,Ee=0,Te=0,it=0,jt=0,Gt=0,s0=0,i0=0,zt=0;i0=b,b=b+304|0,ce=i0+16|0,Ee=i0+8|0,ke=i0+33|0,Te=i0,G=i0+32|0,(e[t+76>>2]|0)>-1?s0=Ri(t)|0:s0=0,l=S[r>>0]|0;e:do if(l<<24>>24){it=t+4|0,jt=t+100|0,ne=t+108|0,$=t+8|0,P=ke+10|0,O=ke+33|0,Z=Ee+4|0,ie=ke+46|0,oe=ke+94|0,h=l,l=0,d=r,N=0,c=0,r=0;t:for(;;){i:do if(ji(h&255)|0){for(;h=d+1|0,ji(F[h>>0]|0)|0;)d=h;oi(t,0);do h=e[it>>2]|0,h>>>0<(e[jt>>2]|0)>>>0?(e[it>>2]=h+1,h=F[h>>0]|0):h=u0(t)|0;while(ji(h)|0);h=e[it>>2]|0,e[jt>>2]|0&&(h=h+-1|0,e[it>>2]=h),w=(e[ne>>2]|0)+N+h-(e[$>>2]|0)|0}else{h=(S[d>>0]|0)==37;n:do if(h){D=d+1|0,w=S[D>>0]|0;r:do switch(w<<24>>24){case 37:break n;case 42:{K=0,w=d+2|0;break}default:{if(w=(w&255)+-48|0,w>>>0<10&&(S[d+2>>0]|0)==36){for(e[ce>>2]=e[o>>2];K=(e[ce>>2]|0)+3&-4,h=e[K>>2]|0,e[ce>>2]=K+4,w>>>0>1;)w=w+-1|0;K=h,w=d+3|0;break r}w=(e[o>>2]|0)+3&-4,K=e[w>>2]|0,e[o>>2]=w+4,w=D}}while(!1);if(h=S[w>>0]|0,d=h&255,(d+-48|0)>>>0<10)for(h=0;D=(h*10|0)+-48+d|0,w=w+1|0,h=S[w>>0]|0,d=h&255,!((d+-48|0)>>>0>=10);)h=D;else D=0;switch(h<<24>>24==109?(w=w+1|0,k=S[w>>0]|0,h=(K|0)!=0&1,c=0,r=0):(k=h,h=0),d=w+1|0,k&255|0){case 104:{H=(S[d>>0]|0)==104,d=H?w+2|0:d,w=H?-2:-1;break}case 108:{H=(S[d>>0]|0)==108,d=H?w+2|0:d,w=H?3:1;break}case 106:{w=3;break}case 116:case 122:{w=1;break}case 76:{w=2;break}case 110:case 112:case 67:case 83:case 91:case 99:case 115:case 88:case 71:case 70:case 69:case 65:case 103:case 102:case 101:case 97:case 120:case 117:case 111:case 105:case 100:{d=w,w=0;break}default:{Gt=152;break t}}switch(k=F[d>>0]|0,R=(k&47|0)==3,k=R?k|32:k,R=R?1:w,k|0){case 99:{H=N,U=(D|0)<1?1:D;break}case 91:{H=N,U=D;break}case 110:{if(!K){w=N;break i}switch(R|0){case-2:{S[K>>0]=N,w=N;break i}case-1:{I[K>>1]=N,w=N;break i}case 0:{e[K>>2]=N,w=N;break i}case 1:{e[K>>2]=N,w=N;break i}case 3:{w=K,e[w>>2]=N,e[w+4>>2]=((N|0)<0)<<31>>31,w=N;break i}default:{w=N;break i}}}default:{oi(t,0);do w=e[it>>2]|0,w>>>0<(e[jt>>2]|0)>>>0?(e[it>>2]=w+1,w=F[w>>0]|0):w=u0(t)|0;while(ji(w)|0);w=e[it>>2]|0,e[jt>>2]|0&&(w=w+-1|0,e[it>>2]=w),H=(e[ne>>2]|0)+N+w-(e[$>>2]|0)|0,U=D}}if(oi(t,U),w=e[it>>2]|0,D=e[jt>>2]|0,w>>>0>>0)e[it>>2]=w+1;else{if((u0(t)|0)<0){Gt=152;break t}D=e[jt>>2]|0}D&&(e[it>>2]=(e[it>>2]|0)+-1);r:do switch(k|0){case 91:case 99:case 115:{_=(k|0)==99;s:do if((k&239|0)==99)Jt(ke|0,-1,257)|0,S[ke>>0]=0,(k|0)==115&&(S[O>>0]=0,S[P>>0]=0,S[P+1>>0]=0,S[P+2>>0]=0,S[P+3>>0]=0,S[P+4>>0]=0);else{switch(zt=d+1|0,N=(S[zt>>0]|0)==94,w=N&1,k=N?zt:d,d=N?d+2|0:zt,Jt(ke|0,N&1|0,257)|0,S[ke>>0]=0,S[d>>0]|0){case 45:{N=(w^1)&255,S[ie>>0]=N,d=k+2|0;break}case 93:{N=(w^1)&255,S[oe>>0]=N,d=k+2|0;break}default:N=(w^1)&255}for(;;){w=S[d>>0]|0;o:do switch(w<<24>>24){case 0:{Gt=152;break t}case 93:break s;case 45:{switch(k=d+1|0,w=S[k>>0]|0,w<<24>>24){case 93:case 0:{w=45;break o}default:}if(d=S[d+-1>>0]|0,(d&255)<(w&255)){d=d&255;do d=d+1|0,S[ke+d>>0]=N,w=S[k>>0]|0;while((d|0)<(w&255|0));d=k}else d=k;break}default:}while(!1);S[ke+((w&255)+1)>>0]=N,d=d+1|0}}while(!1);k=_?U+1|0:31,N=(R|0)==1,R=(h|0)!=0;s:do if(N){if(R){if(r=E0(k<<2)|0,!r){c=0,Gt=152;break t}}else r=K;e[Ee>>2]=0,e[Z>>2]=0,c=0;o:for(;;){D=(r|0)==0;do{a:for(;;){if(w=e[it>>2]|0,w>>>0<(e[jt>>2]|0)>>>0?(e[it>>2]=w+1,w=F[w>>0]|0):w=u0(t)|0,!(S[ke+(w+1)>>0]|0))break o;switch(S[G>>0]=w,Nn(Te,G,1,Ee)|0){case-1:{c=0,Gt=152;break t}case-2:break;default:break a}}D||(e[r+(c<<2)>>2]=e[Te>>2],c=c+1|0)}while(!(R&(c|0)==(k|0)));if(c=k<<1|1,w=Gi(r,c<<2)|0,!w){c=0,Gt=152;break t}zt=k,k=c,r=w,c=zt}if(TS(Ee)|0)D=c,c=0;else{c=0,Gt=152;break t}}else{if(R){if(c=E0(k)|0,c)w=0;else{c=0,r=0,Gt=152;break t}for(;;){do{if(r=e[it>>2]|0,r>>>0<(e[jt>>2]|0)>>>0?(e[it>>2]=r+1,r=F[r>>0]|0):r=u0(t)|0,!(S[ke+(r+1)>>0]|0)){D=w,r=0;break s}S[c+w>>0]=r,w=w+1|0}while((w|0)!=(k|0));if(r=k<<1|1,w=Gi(c,r)|0,w)zt=k,k=r,c=w,w=zt;else{r=0,Gt=152;break t}}}if(K)for(c=0;;){if(r=e[it>>2]|0,r>>>0>>0?(e[it>>2]=r+1,r=F[r>>0]|0):r=u0(t)|0,!(S[ke+(r+1)>>0]|0)){D=c,c=K,r=0;break s}S[K+c>>0]=r,D=e[jt>>2]|0,c=c+1|0}else for(c=D;;){if(r=e[it>>2]|0,r>>>0>>0?(e[it>>2]=r+1,r=F[r>>0]|0):r=u0(t)|0,!(S[ke+(r+1)>>0]|0)){D=0,c=0,r=0;break s}c=e[jt>>2]|0}}while(!1);if(w=e[it>>2]|0,e[jt>>2]|0&&(w=w+-1|0,e[it>>2]=w),w=w-(e[$>>2]|0)+(e[ne>>2]|0)|0,!w||!((w|0)==(U|0)|_^1))break t;do if(R)if(N){e[K>>2]=r;break}else{e[K>>2]=c;break}while(!1);if(!_){if(r&&(e[r+(D<<2)>>2]=0),!c){c=0;break r}S[c+D>>0]=0}break}case 120:case 88:case 112:{w=16,Gt=134;break}case 111:{w=8,Gt=134;break}case 117:case 100:{w=10,Gt=134;break}case 105:{w=0,Gt=134;break}case 71:case 103:case 70:case 102:case 69:case 101:case 65:case 97:{if(C=+xo(t,R,0),(e[ne>>2]|0)==((e[$>>2]|0)-(e[it>>2]|0)|0))break t;if(K)switch(R|0){case 0:{V[K>>2]=C;break r}case 1:{B[K>>3]=C;break r}case 2:{B[K>>3]=C;break r}default:break r}break}default:}while(!1);r:do if((Gt|0)==134){if(Gt=0,w=wo(t,w,0,-1,-1)|0,(e[ne>>2]|0)==((e[$>>2]|0)-(e[it>>2]|0)|0))break t;if((K|0)!=0&(k|0)==112){e[K>>2]=w;break}if(K)switch(R|0){case-2:{S[K>>0]=w;break r}case-1:{I[K>>1]=w;break r}case 0:{e[K>>2]=w;break r}case 1:{e[K>>2]=w;break r}case 3:{zt=K,e[zt>>2]=w,e[zt+4>>2]=ye;break r}default:break r}}while(!1);l=((K|0)!=0&1)+l|0,w=(e[ne>>2]|0)+H+(e[it>>2]|0)-(e[$>>2]|0)|0;break i}while(!1);if(d=d+(h&1)|0,oi(t,0),h=e[it>>2]|0,h>>>0<(e[jt>>2]|0)>>>0?(e[it>>2]=h+1,h=F[h>>0]|0):h=u0(t)|0,(h|0)!=(F[d>>0]|0)){Gt=21;break t}w=N+1|0}while(!1);if(d=d+1|0,h=S[d>>0]|0,h<<24>>24)N=w;else break e}if((Gt|0)==21){if(e[jt>>2]|0&&(e[it>>2]=(e[it>>2]|0)+-1),(l|0)!=0|(h|0)>-1)break;l=0,Gt=153}else(Gt|0)==152&&(l||(l=h,Gt=153));(Gt|0)==153&&(h=l,l=-1),h&&(n0(c),n0(r))}else l=0;while(!1);return s0&&mi(t),b=i0,l|0}function Mn(t,r,o,l){t=t|0,r=r|0,o=o|0,l=l|0;var c=0,h=0,d=0,w=0,C=0,D=0,k=0;k=b,b=b+128|0,c=k+112|0,D=k,h=D,d=37352,w=h+112|0;do e[h>>2]=e[d>>2],h=h+4|0,d=d+4|0;while((h|0)<(w|0));return(r+-1|0)>>>0>2147483646?r?(r=S0()|0,e[r>>2]=75,r=-1):(r=1,C=4):(c=t,C=4),(C|0)==4&&(C=-2-c|0,C=r>>>0>C>>>0?C:r,e[D+48>>2]=C,t=D+20|0,e[t>>2]=c,e[D+44>>2]=c,r=c+C|0,c=D+16|0,e[c>>2]=r,e[D+28>>2]=r,r=Po(D,o,l)|0,C&&(o=e[t>>2]|0,S[o+(((o|0)==(e[c>>2]|0))<<31>>31)>>0]=0)),b=k,r|0}function Lo(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0;h=b,b=b+112|0,l=h,c=l,d=c+112|0;do e[c>>2]=0,c=c+4|0;while((c|0)<(d|0));return e[l+32>>2]=29,e[l+44>>2]=t,e[l+76>>2]=-1,e[l+84>>2]=t,d=OS(l,r,o)|0,b=h,d|0}function Fr(t,r,o){return t=t|0,r=r|0,o=o|0,+ +Ed(t,r,2)}function $S(t,r,o){return t=t|0,r=r|0,o=o|0,t=_s(t,r,o,-1,-1)|0,t|0}function BS(t,r,o){return t=t|0,r=r|0,o=o|0,t=_s(t,r,o,0,-2147483648)|0,t|0}function Oo(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0,h=0,d=0;h=r&255,l=(o|0)!=0;e:do if(l&(t&3|0)!=0)for(c=r&255;;){if((S[t>>0]|0)==c<<24>>24){d=6;break e}if(t=t+1|0,o=o+-1|0,l=(o|0)!=0,!(l&(t&3|0)!=0)){d=5;break}}else d=5;while(!1);(d|0)==5&&(l?d=6:o=0);e:do if((d|0)==6&&(c=r&255,(S[t>>0]|0)!=c<<24>>24)){l=ee(h,16843009)|0;t:do if(o>>>0>3){for(;h=e[t>>2]^l,!((h&-2139062144^-2139062144)&h+-16843009);)if(t=t+4|0,o=o+-4|0,o>>>0<=3){d=11;break t}}else d=11;while(!1);if((d|0)==11&&!o){o=0;break}for(;;){if((S[t>>0]|0)==c<<24>>24)break e;if(t=t+1|0,o=o+-1|0,!o){o=0;break}}}while(!1);return(o|0?t:0)|0}function VS(t,r){t=t|0,r=r|0;var o=0,l=0;o=r;e:do if((o^t)&3)l=8;else{if(o&3)do{if(o=S[r>>0]|0,S[t>>0]=o,!(o<<24>>24))break e;r=r+1|0,t=t+1|0}while(r&3|0);if(o=e[r>>2]|0,!((o&-2139062144^-2139062144)&o+-16843009))for(l=t;r=r+4|0,t=l+4|0,e[l>>2]=o,o=e[r>>2]|0,!((o&-2139062144^-2139062144)&o+-16843009);)l=t;l=8}while(!1);if((l|0)==8&&(l=S[r>>0]|0,S[t>>0]=l,l<<24>>24))do r=r+1|0,t=t+1|0,l=S[r>>0]|0,S[t>>0]=l;while(l<<24>>24);return t|0}function $o(t,r){t=t|0,r=r|0;var o=0,l=0;if(l=S[t>>0]|0,o=S[r>>0]|0,!(l<<24>>24)||l<<24>>24!=o<<24>>24)r=l;else{do t=t+1|0,r=r+1|0,l=S[t>>0]|0,o=S[r>>0]|0;while(!(!(l<<24>>24)||l<<24>>24!=o<<24>>24));r=l}return(r&255)-(o&255)|0}function Rr(t,r){return t=t|0,r=r|0,VS(t,r)|0,t|0}function $i(t){t=t|0;var r=0,o=0,l=0;l=t;e:do if(!(l&3))o=4;else for(r=t,t=l;;){if(!(S[r>>0]|0))break e;if(r=r+1|0,t=r,!(t&3)){t=r,o=4;break}}while(!1);if((o|0)==4){for(;r=e[t>>2]|0,!((r&-2139062144^-2139062144)&r+-16843009);)t=t+4|0;if((r&255)<<24>>24)do t=t+1|0;while(S[t>>0]|0)}return t-l|0}function US(t,r,o){t=t|0,r=r|0,o=o|0;var l=0,c=0;if(!o)r=0;else{l=S[t>>0]|0;e:do if(!(l<<24>>24))l=0;else for(;;){if(o=o+-1|0,c=S[r>>0]|0,!(l<<24>>24==c<<24>>24&((o|0)!=0&c<<24>>24!=0)))break e;if(t=t+1|0,r=r+1|0,l=S[t>>0]|0,!(l<<24>>24)){l=0;break}}while(!1);r=(l&255)-(F[r>>0]|0)|0}return r|0}function _n(t){t=t|0;var r=0;for(r=t;e[r>>2]|0;)r=r+4|0;return r-t>>2|0}function Bi(t,r,o){t=t|0,r=r|0,o=o|0;var l=0;if(o)for(l=t;o=o+-1|0,e[l>>2]=e[r>>2],o;)r=r+4|0,l=l+4|0;return t|0}function zS(t,r,o){t=t|0,r=r|0,o=o|0;var l=0;if(l=(o|0)==0,t-r>>2>>>0>>0){if(!l)do o=o+-1|0,e[t+(o<<2)>>2]=e[r+(o<<2)>>2];while(o|0)}else if(!l)for(l=r,r=t;o=o+-1|0,e[r>>2]=e[l>>2],o;)l=l+4|0,r=r+4|0;return t|0}function GS(t,r,o){t=t|0,r=r|0,o=o|0;var l=0;if(o)for(l=t;o=o+-1|0,e[l>>2]=r,o;)l=l+4|0;return t|0}function Bo(t,r){t=t|0,r=r|0;var o=0,l=0,c=0,h=0,d=0,w=0;switch(d=t+4|0,o=e[d>>2]|0,w=t+100|0,o>>>0<(e[w>>2]|0)>>>0?(e[d>>2]=o+1,o=F[o>>0]|0):o=u0(t)|0,o|0){case 43:case 45:{l=(o|0)==45&1,o=e[d>>2]|0,o>>>0<(e[w>>2]|0)>>>0?(e[d>>2]=o+1,o=F[o>>0]|0):o=u0(t)|0,(r|0)!=0&(o+-48|0)>>>0>9&&e[w>>2]|0&&(e[d>>2]=(e[d>>2]|0)+-1),h=l;break}default:h=0}if((o+-48|0)>>>0>9)e[w>>2]|0?(e[d>>2]=(e[d>>2]|0)+-1,l=-2147483648,o=0):(l=-2147483648,o=0);else{l=0;do l=o+-48+(l*10|0)|0,o=e[d>>2]|0,o>>>0<(e[w>>2]|0)>>>0?(e[d>>2]=o+1,o=F[o>>0]|0):o=u0(t)|0;while((o+-48|0)>>>0<10&(l|0)<214748364);if(r=((l|0)<0)<<31>>31,(o+-48|0)>>>0<10){do r=Qi(l|0,r|0,10,0)|0,l=ye,o=$0(o|0,((o|0)<0)<<31>>31|0,-48,-1)|0,l=$0(o|0,ye|0,r|0,l|0)|0,r=ye,o=e[d>>2]|0,o>>>0<(e[w>>2]|0)>>>0?(e[d>>2]=o+1,o=F[o>>0]|0):o=u0(t)|0;while((o+-48|0)>>>0<10&((r|0)<21474836|(r|0)==21474836&l>>>0<2061584302));c=l}else c=l;if((o+-48|0)>>>0<10)do o=e[d>>2]|0,o>>>0<(e[w>>2]|0)>>>0?(e[d>>2]=o+1,o=F[o>>0]|0):o=u0(t)|0;while((o+-48|0)>>>0<10);e[w>>2]|0&&(e[d>>2]=(e[d>>2]|0)+-1),t=(h|0)!=0,o=ii(0,0,c|0,r|0)|0,l=t?ye:r,o=t?o:c}return ye=l,o|0}function qS(t){t=t|0,e[t+68>>2]|0||mi(t)}function WS(t){t=t|0,e[t+68>>2]|0||mi(t)}function Mr(t){t=t|0;var r=0,o=0,l=0,c=0,h=0,d=0;return r=t+20|0,h=t+28|0,(e[r>>2]|0)>>>0>(e[h>>2]|0)>>>0&&(Yt[e[t+36>>2]&63](t,0,0)|0,(e[r>>2]|0)==0)?r=-1:(d=t+4|0,o=e[d>>2]|0,l=t+8|0,c=e[l>>2]|0,o>>>0>>0&&Yt[e[t+40>>2]&63](t,o-c|0,1)|0,e[t+16>>2]=0,e[h>>2]=0,e[r>>2]=0,e[l>>2]=0,e[d>>2]=0,r=0),r|0}var HS=[bi,nf,of,eh,nh,ah,uh,Sn,An,bi,bi,bi,bi,bi,bi,bi],Pn=[sn,Y5,Ju,zu,Fu,xu,cu,eu,V2,tS,eS,J6,sn,sn,sn,sn],QS=[so,ph,xh,so],Mt=[e0,W5,H5,Yu,ju,$u,Bu,ku,Du,gu,Su,ou,au,j2,X2,L2,O2,T2,I2,m2,g2,r2,s2,K1,Y1,$1,B1,n1,r1,Kl,Yl,Ia,Ea,Ml,Ol,_l,hm,Xs,dm,pm,ul,cl,w6,hl,il,nl,Ua,za,Ha,Qa,Xa,Za,dl,pl,Al,vl,Cl,Tl,Dl,bl,Hl,Ql,d1,p1,A1,v1,C1,T1,b1,N1,K2,Y2,mp,i6,f6,h6,y6,C6,R6,M6,In,O6,V6,U6,G6,H6,q6,W6,Q6,K6,rn,Ld,zd,wt,Hd,Zd,fr,pp,Mp,Hp,sm,Qs,om,am,um,Ys,cm,fm,Am,Zs,vm,xm,Em,km,G0,Dm,bm,Nm,Rm,Gh,Lm,Om,Um,zm,eg,tg,dg,pg,Ig,Eg,hc,dc,Mc,_c,ef,tf,rf,sf,lf,uf,vf,xf,Nf,Ff,Uf,zf,Zf,Jf,sh,oh,hh,dh,Ah,vh,Th,Ih,bh,Nh,Rs,Lh,Ms,sd,io,Td,eo,r4,to,s4,Fm,Uh,Wh,md,$g,Hg,e4,t4,T6,fo,pi,Ta,Sr,lm,Ul,G2,cS,qS,WS,Fd,gS,th,fn,qh,L3,G3,q3,W3,H3,Q3,K3,de,Pt,n0,e0,e0,e0,e0,e0,e0,e0,e0,e0,e0,e0,e0,e0,e0,e0,e0,e0,e0,e0,e0,e0,e0,e0,e0,e0,e0,e0,e0,e0,e0,e0,e0,e0,e0,e0,e0,e0,e0,e0,e0,e0,e0,e0,e0,e0,e0,e0,e0,e0,e0,e0,e0,e0,e0],t0=[Tr,K5,Zu,Uu,Nu,vu,uu,J2,B2,E2,S2,o2,j1,V1,s1,jl,ka,_p,d6,p6,Od,Ud,Qd,Xd,Qp,hf,df,pf,mf,Sf,Af,Cf,Tf,If,Ef,Df,bf,_f,Pf,Lf,Of,Bf,Vf,Wf,Hf,Qf,Kf,jf,Xf,Dh,Mh,f4,d4,m4,h4,p4,g4,Sa,I6,m6,g6,ho,Rp,Pa,Oa,mm,Np,yp,Vl,Jl,_1,G1,J1,c2,x2,F2,z2,iu,hu,yu,Mu,qu,ic,X5,u6,Fi,rp,ip,Fp,wm,np,xp,Ep,Ip,r3,s3,o3,l3,u3,c3,Cd,f3,h3,d3,p3,m3,g3,S3,A3,v3,x3,w3,y3,C3,T3,I3,E3,k3,D3,b3,N3,F3,R3,M3,_3,J3,Tr,Tr],on=[N0,Gm,qm,Wm,Hm,Qm,Km,Ym,jm,Xm,Zm,Jm,ig,ng,rg,sg,og,ag,lg,ug,cg,fg,hg,Ag,xg,Ng,oc,mc,gc,Sc,Ac,vc,Lc,Oc,$c,Bc,Vc,Sh,Ch,Ui,Hi,N0,N0,N0,N0,N0,N0,N0,N0,N0,N0,N0,N0,N0,N0,N0,N0,N0,N0,N0,N0,N0,N0,N0],Dt=[r0,$p,Bp,ol,zp,n6,_6,$6,z6,bS,$d,Zp,em,tm,Xp,Gd,qd,Kd,Up,Jd,ep,ym,pc,S4,x4,y4,D4,F4,T4,E4,Pc,A4,w4,C4,N4,R4,I4,k4,cf,ff,gf,wf,yf,kf,Rf,Mf,$f,Gf,qf,Yf,_g,Pg,Og,o4,u4,l4,c4,vd,xd,yd,zg,Gg,Wg,jg,Xg,Jg,o6,Xe,f0,d0,Ks,js,P5,L5,O5,ai,_n,r0,r0,r0,r0,r0,r0,r0,r0,r0,r0,r0,r0,r0,r0,r0,r0,r0,r0,r0,r0,r0,r0,r0,r0,r0,r0,r0,r0,r0,r0,r0,r0,r0,r0,r0,r0,r0,r0,r0,r0,r0,r0,r0,r0,r0,r0,r0,r0,r0,r0,r0],KS=[oo,ih,lh,oo],Yt=[C0,Pp,Vp,qp,ap,lp,Y6,kd,No,RS,NS,MS,Kp,Jp,Bd,nm,Yd,Pm,Vm,Eh,Fh,ad,ud,dd,Hh,Xh,Jh,nd,La,Id,Gs,vS,t3,n3,Oi,ES,CS,LS,C0,C0,C0,C0,C0,C0,C0,C0,C0,C0,C0,C0,C0,C0,C0,C0,C0,C0,C0,C0,C0,C0,C0,C0,C0,C0],YS=[ao,gh,yh,ao],Vi=[Ni,rl,rS,nS,iS,Yp,Lp,kh,Rh,Ni,Ni,Ni,Ni,Ni,Ni,Ni],jS=[yn,Sg,yg,bg,uc,yn,yn,yn],XS=[Cn,rh,fh,mh,wh,Cn,Cn,Cn],U0=[L0,Q5,Xu,Vu,bu,Au,lu,Z2,$2,N2,v2,u2,Z1,z1,l1,Zl,ba,al,ll,im,Vd,Wd,rm,Gp,jd,tp,Wp,od,ld,cd,jh,Zh,ed,E6,xa,ya,gm,O0,Sm,AS,SS,Ap,Cp,L0,L0,L0,L0,L0,L0,L0,L0,L0,L0,L0,L0,L0,L0,L0,L0,L0,L0,L0,L0,L0],an=[di,Mm,$m,mg,gg,vg,Tg,kg,Dg,sc,fc,pd,Mg,Lg,rd,Ad,wd,Ug,qg,Yg,Zg,kS,IS,di,di,di,di,di,di,di,di,di],ZS=[$5,i5,t5,e5],JS=[Li,Aa,po,b0,$h,Bh,Vh,fS,dS,hS,Li,Li,Li,Li,Li,Li],_r=[Ki,D2,A2,l2,X1,U1,o1,Xl,Da,hd,Qh,Kh,Yh,id,s6,c6,z4,Z4,ko,mS,Nn,u5,l5,o5,s5,r5,n5,Ki,Ki,Ki,Ki,Ki],Ln=[B5,sp,r6,Cm,k6,yi,V5,dp,zs,S6,cp,Im,J4,e3,i3,mr],Vo=[lo,U5,aS,z5,lS,G5,kn,lo],Ci=[Yi,xc,Uc,Fg,Rg,gd,Sd,Bg,Vg,Qg,Kg,Yi,Yi,Yi,Yi,Yi],eA=[Tn,wg,Cg,ac,cc,Tn,Tn,Tn],On=[H0,$l,Bl,Pl,Ll,sl,Ga,qa,Ka,Ya,Ja,el,ml,gl,xl,wl,Il,El,Nl,Fl,m1,g1,x1,w1,I1,E1,F1,R1,j6,X6,Z6,jp,Op,_m,Bm,fa,hp,Na,Fa,Ra,Ma,$a,Ba,Va,u1,c1,f1,h1,H0,H0,H0,H0,H0,H0,H0,H0,H0,H0,H0,H0,H0,H0,H0,H0];return{_jpegls_encode:b6,___cxa_can_catch:sS,_free:n0,_jpegls_decode:D6,___cxa_is_pointer_type:oS,_i64Add:$0,_memmove:vn,_i64Subtract:ii,_memset:Jt,_malloc:E0,_memcpy:o0,_bitshift64Lshr:Di,_bitshift64Shl:v0,__GLOBAL__I_000101:Rd,__GLOBAL__sub_I_jpegls_cpp:Ca,__GLOBAL__sub_I_iostream_cpp:Md,runPostSets:c5,_emscripten_replace_memory:ia,stackAlloc:na,stackSave:ra,stackRestore:sa,establishStackSpace:oa,setThrew:aa,setTempRet0:la,getTempRet0:ua,dynCall_iiiiiiii:h5,dynCall_viiiii:d5,dynCall_iiiiiid:p5,dynCall_vi:m5,dynCall_vii:g5,dynCall_iiiiiii:S5,dynCall_ii:A5,dynCall_iiiiiiiiiiii:v5,dynCall_iiii:x5,dynCall_viiiiiiiiiiiiiii:w5,dynCall_viiiiii:y5,dynCall_viiiiiii:C5,dynCall_viiiiiiiiii:T5,dynCall_iii:I5,dynCall_iiiiii:E5,dynCall_diii:k5,dynCall_i:D5,dynCall_iiiii:b5,dynCall_viii:N5,dynCall_v:F5,dynCall_iiiiiiiii:R5,dynCall_iiiiid:M5,dynCall_viiii:_5}}(Module.asmGlobalArg,Module.asmLibraryArg,buffer);Module._jpegls_encode=asm._jpegls_encode,Module.___cxa_can_catch=asm.___cxa_can_catch;var _free=Module._free=asm._free;Module._jpegls_decode=asm._jpegls_decode,Module.___cxa_is_pointer_type=asm.___cxa_is_pointer_type;var _i64Add=Module._i64Add=asm._i64Add,_memmove=Module._memmove=asm._memmove,_i64Subtract=Module._i64Subtract=asm._i64Subtract,_memset=Module._memset=asm._memset,_malloc=Module._malloc=asm._malloc,_memcpy=Module._memcpy=asm._memcpy,_emscripten_replace_memory=Module._emscripten_replace_memory=asm._emscripten_replace_memory;Module.runPostSets=asm.runPostSets,Module.__GLOBAL__sub_I_iostream_cpp=asm.__GLOBAL__sub_I_iostream_cpp;var _bitshift64Lshr=Module._bitshift64Lshr=asm._bitshift64Lshr,__GLOBAL__sub_I_jpegls_cpp=Module.__GLOBAL__sub_I_jpegls_cpp=asm.__GLOBAL__sub_I_jpegls_cpp,__GLOBAL__I_000101=Module.__GLOBAL__I_000101=asm.__GLOBAL__I_000101,_bitshift64Shl=Module._bitshift64Shl=asm._bitshift64Shl;Module.dynCall_iiiiiiii=asm.dynCall_iiiiiiii,Module.dynCall_viiiii=asm.dynCall_viiiii,Module.dynCall_iiiiiid=asm.dynCall_iiiiiid,Module.dynCall_vi=asm.dynCall_vi,Module.dynCall_vii=asm.dynCall_vii,Module.dynCall_iiiiiii=asm.dynCall_iiiiiii,Module.dynCall_ii=asm.dynCall_ii,Module.dynCall_iiiiiiiiiiii=asm.dynCall_iiiiiiiiiiii,Module.dynCall_iiii=asm.dynCall_iiii,Module.dynCall_viiiiiiiiiiiiiii=asm.dynCall_viiiiiiiiiiiiiii,Module.dynCall_viiiiii=asm.dynCall_viiiiii,Module.dynCall_viiiiiii=asm.dynCall_viiiiiii,Module.dynCall_viiiiiiiiii=asm.dynCall_viiiiiiiiii,Module.dynCall_iii=asm.dynCall_iii,Module.dynCall_iiiiii=asm.dynCall_iiiiii,Module.dynCall_diii=asm.dynCall_diii,Module.dynCall_i=asm.dynCall_i,Module.dynCall_iiiii=asm.dynCall_iiiii,Module.dynCall_viii=asm.dynCall_viii,Module.dynCall_v=asm.dynCall_v,Module.dynCall_iiiiiiiii=asm.dynCall_iiiiiiiii,Module.dynCall_iiiiid=asm.dynCall_iiiiid,Module.dynCall_viiii=asm.dynCall_viiii,Runtime.stackAlloc=asm.stackAlloc,Runtime.stackSave=asm.stackSave,Runtime.stackRestore=asm.stackRestore,Runtime.establishStackSpace=asm.establishStackSpace,Runtime.setTempRet0=asm.setTempRet0,Runtime.getTempRet0=asm.getTempRet0;function ExitStatus(a){this.name="ExitStatus",this.message="Program terminated with exit("+a+")",this.status=a}ExitStatus.prototype=new Error,ExitStatus.prototype.constructor=ExitStatus;var initialStackTop;dependenciesFulfilled=function a(){Module.calledRun||run(),Module.calledRun||(dependenciesFulfilled=a)},Module.callMain=Module.callMain=function a(n){assert(runDependencies==0,"cannot call main when async dependencies remain! (listen on __ATMAIN__)"),assert(__ATPRERUN__.length==0,"cannot call main when preRun functions remain to be called"),n=n||[],ensureInitRuntime();var s=n.length+1;function u(){for(var v=0;v<3;v++)f.push(0)}var f=[allocate(intArrayFromString(Module.thisProgram),"i8",ALLOC_NORMAL)];u();for(var m=0;m0||(preRun(),runDependencies>0)||Module.calledRun)return;function n(){Module.calledRun||(Module.calledRun=!0,!ABORT&&(ensureInitRuntime(),preMain(),Module.onRuntimeInitialized&&Module.onRuntimeInitialized(),Module._main&&shouldRunNow&&Module.callMain(a),postRun()))}Module.setStatus?(Module.setStatus("Running..."),setTimeout(function(){setTimeout(function(){Module.setStatus("")},1),n()},1)):n()}Module.run=Module.run=run;function exit(a,n){if(!(n&&Module.noExitRuntime))throw Module.noExitRuntime||(ABORT=!0,STACKTOP=initialStackTop,exitRuntime(),Module.onExit&&Module.onExit(a)),ENVIRONMENT_IS_NODE?(process.stdout.once("drain",function(){process.exit(a)}),console.log(" "),setTimeout(function(){process.exit(a)},500)):ENVIRONMENT_IS_SHELL&&typeof quit=="function"&&quit(a),new ExitStatus(a)}Module.exit=Module.exit=exit;var abortDecorators=[];function abort(a){a!==void 0?(Module.print(a),Module.printErr(a),a=JSON.stringify(a)):a="",ABORT=!0;var n=` +If this abort() is unexpected, build with -s ASSERTIONS=1 which can give more information.`,s="abort("+a+") at "+stackTrace()+n;throw abortDecorators&&abortDecorators.forEach(function(u){s=u(s,a)}),s}if(Module.abort=Module.abort=abort,Module.preInit)for(typeof Module.preInit=="function"&&(Module.preInit=[Module.preInit]);Module.preInit.length>0;)Module.preInit.pop()();var shouldRunNow=!0;return Module.noInitialRun&&(shouldRunNow=!1),run(),Module};module.exports&&(module.exports=CharLS)}(charLSDynamicMemoryBrowser)),charLSDynamicMemoryBrowser.exports}var hasRequiredJpegLs;function requireJpegLs(){return hasRequiredJpegLs||(hasRequiredJpegLs=1,function(a){var n=n||(typeof commonjsRequire<"u"?requireCharLSDynamicMemoryBrowser():null),s=function(){var u;function f(){}f.prototype={decodeJPEGLS:function(y,T){return v(y,T)}};function m(y,T){var E=u._malloc(y.length);u.writeArrayToMemory(y,E);var S=u._malloc(4),I=u._malloc(4),e=u._malloc(4),F=u._malloc(4),M=u._malloc(4),L=u._malloc(4),V=u._malloc(4),B=u._malloc(4),z=u._malloc(4),b=u.ccall("jpegls_decode","number",["number","number","number","number","number","number","number","number","number","number","number"],[E,y.length,S,I,e,F,M,L,B,V,z]),W={result:b,width:u.getValue(e,"i32"),height:u.getValue(F,"i32"),bitsPerSample:u.getValue(M,"i32"),stride:u.getValue(L,"i32"),components:u.getValue(B,"i32"),allowedLossyError:u.getValue(V,"i32"),interleaveMode:u.getValue(z,"i32"),pixelData:void 0},q=u.getValue(S,"*");return W.bitsPerSample<=8?(W.pixelData=new Uint8Array(W.width*W.height*W.components),W.pixelData.set(new Uint8Array(u.HEAP8.buffer,q,W.pixelData.length))):T?(W.pixelData=new Int16Array(W.width*W.height*W.components),W.pixelData.set(new Int16Array(u.HEAP16.buffer,q,W.pixelData.length))):(W.pixelData=new Uint16Array(W.width*W.height*W.components),W.pixelData.set(new Uint16Array(u.HEAP16.buffer,q,W.pixelData.length))),u._free(E),u._free(q),u._free(S),u._free(I),u._free(e),u._free(F),u._free(M),u._free(L),u._free(B),u._free(z),W}function A(){if(typeof n>"u")throw"No JPEG-LS decoder loaded";if(!u&&(u=n(),!u||!u._jpegls_decode))throw"JPEG-LS failed to initialize"}function v(y,T){A();var E=m(y,T);if(E.result!==0&&E.result!==6)throw"JPEG-LS decoder failed to decode frame (error code "+E.result+")";var S={};return S.columns=E.width,S.rows=E.height,S.pixelData=E.pixelData,S}return f}();a.exports&&(a.exports=s)}(jpegLs)),jpegLs.exports}var parser={exports:{}},pako={},deflate$1={},deflate={},trees={},hasRequiredTrees;function requireTrees(){if(hasRequiredTrees)return trees;hasRequiredTrees=1;const a=4,n=0,s=1,u=2;function f(ee){let Be=ee.length;for(;--Be>=0;)ee[Be]=0}const m=0,A=1,v=2,y=3,T=258,E=29,S=256,I=S+1+E,e=30,F=19,M=2*I+1,L=15,V=16,B=7,z=256,b=16,W=17,q=18,Y=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),X=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),Q=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),g=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),J=512,re=new Array((I+2)*2);f(re);const ae=new Array(e*2);f(ae);const fe=new Array(J);f(fe);const pe=new Array(T-y+1);f(pe);const me=new Array(E);f(me);const Se=new Array(e);f(Se);function ve(ee,Be,st,Ke,ft){this.static_tree=ee,this.extra_bits=Be,this.extra_base=st,this.elems=Ke,this.max_length=ft,this.has_stree=ee&&ee.length}let we,Ne,De;function je(ee,Be){this.dyn_tree=ee,this.max_code=0,this.stat_desc=Be}const nt=ee=>ee<256?fe[ee]:fe[256+(ee>>>7)],Ue=(ee,Be)=>{ee.pending_buf[ee.pending++]=Be&255,ee.pending_buf[ee.pending++]=Be>>>8&255},ye=(ee,Be,st)=>{ee.bi_valid>V-st?(ee.bi_buf|=Be<>V-ee.bi_valid,ee.bi_valid+=st-V):(ee.bi_buf|=Be<{ye(ee,st[Be*2],st[Be*2+1])},pt=(ee,Be)=>{let st=0;do st|=ee&1,ee>>>=1,st<<=1;while(--Be>0);return st>>>1},It=ee=>{ee.bi_valid===16?(Ue(ee,ee.bi_buf),ee.bi_buf=0,ee.bi_valid=0):ee.bi_valid>=8&&(ee.pending_buf[ee.pending++]=ee.bi_buf&255,ee.bi_buf>>=8,ee.bi_valid-=8)},Lt=(ee,Be)=>{const st=Be.dyn_tree,Ke=Be.max_code,ft=Be.stat_desc.static_tree,vt=Be.stat_desc.has_stree,Re=Be.stat_desc.extra_bits,Ye=Be.stat_desc.extra_base,ue=Be.stat_desc.max_length;let Ae,Vt,ge,Ut,Ve,Zt,ot=0;for(Ut=0;Ut<=L;Ut++)ee.bl_count[Ut]=0;for(st[ee.heap[ee.heap_max]*2+1]=0,Ae=ee.heap_max+1;Aeue&&(Ut=ue,ot++),st[Vt*2+1]=Ut,!(Vt>Ke)&&(ee.bl_count[Ut]++,Ve=0,Vt>=Ye&&(Ve=Re[Vt-Ye]),Zt=st[Vt*2],ee.opt_len+=Zt*(Ut+Ve),vt&&(ee.static_len+=Zt*(ft[Vt*2+1]+Ve)));if(ot!==0){do{for(Ut=ue-1;ee.bl_count[Ut]===0;)Ut--;ee.bl_count[Ut]--,ee.bl_count[Ut+1]+=2,ee.bl_count[ue]--,ot-=2}while(ot>0);for(Ut=ue;Ut!==0;Ut--)for(Vt=ee.bl_count[Ut];Vt!==0;)ge=ee.heap[--Ae],!(ge>Ke)&&(st[ge*2+1]!==Ut&&(ee.opt_len+=(Ut-st[ge*2+1])*st[ge*2],st[ge*2+1]=Ut),Vt--)}},Ot=(ee,Be,st)=>{const Ke=new Array(L+1);let ft=0,vt,Re;for(vt=1;vt<=L;vt++)ft=ft+st[vt-1]<<1,Ke[vt]=ft;for(Re=0;Re<=Be;Re++){let Ye=ee[Re*2+1];Ye!==0&&(ee[Re*2]=pt(Ke[Ye]++,Ye))}},Et=()=>{let ee,Be,st,Ke,ft;const vt=new Array(L+1);for(st=0,Ke=0;Ke>=7;Ke{let Be;for(Be=0;Be{ee.bi_valid>8?Ue(ee,ee.bi_buf):ee.bi_valid>0&&(ee.pending_buf[ee.pending++]=ee.bi_buf),ee.bi_buf=0,ee.bi_valid=0},Me=(ee,Be,st,Ke)=>{const ft=Be*2,vt=st*2;return ee[ft]{const Ke=ee.heap[st];let ft=st<<1;for(;ft<=ee.heap_len&&(ft{let Ke,ft,vt=0,Re,Ye;if(ee.sym_next!==0)do Ke=ee.pending_buf[ee.sym_buf+vt++]&255,Ke+=(ee.pending_buf[ee.sym_buf+vt++]&255)<<8,ft=ee.pending_buf[ee.sym_buf+vt++],Ke===0?ut(ee,ft,Be):(Re=pe[ft],ut(ee,Re+S+1,Be),Ye=Y[Re],Ye!==0&&(ft-=me[Re],ye(ee,ft,Ye)),Ke--,Re=nt(Ke),ut(ee,Re,st),Ye=X[Re],Ye!==0&&(Ke-=Se[Re],ye(ee,Ke,Ye)));while(vt{const st=Be.dyn_tree,Ke=Be.stat_desc.static_tree,ft=Be.stat_desc.has_stree,vt=Be.stat_desc.elems;let Re,Ye,ue=-1,Ae;for(ee.heap_len=0,ee.heap_max=M,Re=0;Re>1;Re>=1;Re--)Qe(ee,st,Re);Ae=vt;do Re=ee.heap[1],ee.heap[1]=ee.heap[ee.heap_len--],Qe(ee,st,1),Ye=ee.heap[1],ee.heap[--ee.heap_max]=Re,ee.heap[--ee.heap_max]=Ye,st[Ae*2]=st[Re*2]+st[Ye*2],ee.depth[Ae]=(ee.depth[Re]>=ee.depth[Ye]?ee.depth[Re]:ee.depth[Ye])+1,st[Re*2+1]=st[Ye*2+1]=Ae,ee.heap[1]=Ae++,Qe(ee,st,1);while(ee.heap_len>=2);ee.heap[--ee.heap_max]=ee.heap[1],Lt(ee,Be),Ot(st,ue,ee.bl_count)},at=(ee,Be,st)=>{let Ke,ft=-1,vt,Re=Be[0*2+1],Ye=0,ue=7,Ae=4;for(Re===0&&(ue=138,Ae=3),Be[(st+1)*2+1]=65535,Ke=0;Ke<=st;Ke++)vt=Re,Re=Be[(Ke+1)*2+1],!(++Ye{let Ke,ft=-1,vt,Re=Be[0*2+1],Ye=0,ue=7,Ae=4;for(Re===0&&(ue=138,Ae=3),Ke=0;Ke<=st;Ke++)if(vt=Re,Re=Be[(Ke+1)*2+1],!(++Ye{let Be;for(at(ee,ee.dyn_ltree,ee.l_desc.max_code),at(ee,ee.dyn_dtree,ee.d_desc.max_code),Fe(ee,ee.bl_desc),Be=F-1;Be>=3&&ee.bl_tree[g[Be]*2+1]===0;Be--);return ee.opt_len+=3*(Be+1)+5+5+4,Be},qe=(ee,Be,st,Ke)=>{let ft;for(ye(ee,Be-257,5),ye(ee,st-1,5),ye(ee,Ke-4,4),ft=0;ft{let Be=4093624447,st;for(st=0;st<=31;st++,Be>>>=1)if(Be&1&&ee.dyn_ltree[st*2]!==0)return n;if(ee.dyn_ltree[9*2]!==0||ee.dyn_ltree[10*2]!==0||ee.dyn_ltree[13*2]!==0)return s;for(st=32;st{Je||(Et(),Je=!0),ee.l_desc=new je(ee.dyn_ltree,we),ee.d_desc=new je(ee.dyn_dtree,Ne),ee.bl_desc=new je(ee.bl_tree,De),ee.bi_buf=0,ee.bi_valid=0,Rt(ee)},Ge=(ee,Be,st,Ke)=>{ye(ee,(m<<1)+(Ke?1:0),3),Ze(ee),Ue(ee,st),Ue(ee,~st),st&&ee.pending_buf.set(ee.window.subarray(Be,Be+st),ee.pending),ee.pending+=st},xt=ee=>{ye(ee,A<<1,3),ut(ee,z,re),It(ee)},He=(ee,Be,st,Ke)=>{let ft,vt,Re=0;ee.level>0?(ee.strm.data_type===u&&(ee.strm.data_type=_e(ee)),Fe(ee,ee.l_desc),Fe(ee,ee.d_desc),Re=Le(ee),ft=ee.opt_len+3+7>>>3,vt=ee.static_len+3+7>>>3,vt<=ft&&(ft=vt)):ft=vt=st+5,st+4<=ft&&Be!==-1?Ge(ee,Be,st,Ke):ee.strategy===a||vt===ft?(ye(ee,(A<<1)+(Ke?1:0),3),Ie(ee,re,ae)):(ye(ee,(v<<1)+(Ke?1:0),3),qe(ee,ee.l_desc.max_code+1,ee.d_desc.max_code+1,Re+1),Ie(ee,ee.dyn_ltree,ee.dyn_dtree)),Rt(ee),Ke&&Ze(ee)},rt=(ee,Be,st)=>(ee.pending_buf[ee.sym_buf+ee.sym_next++]=Be,ee.pending_buf[ee.sym_buf+ee.sym_next++]=Be>>8,ee.pending_buf[ee.sym_buf+ee.sym_next++]=st,Be===0?ee.dyn_ltree[st*2]++:(ee.matches++,Be--,ee.dyn_ltree[(pe[st]+S+1)*2]++,ee.dyn_dtree[nt(Be)*2]++),ee.sym_next===ee.sym_end);return trees._tr_init=We,trees._tr_stored_block=Ge,trees._tr_flush_block=He,trees._tr_tally=rt,trees._tr_align=xt,trees}var adler32_1,hasRequiredAdler32;function requireAdler32(){return hasRequiredAdler32||(hasRequiredAdler32=1,adler32_1=(n,s,u,f)=>{let m=n&65535|0,A=n>>>16&65535|0,v=0;for(;u!==0;){v=u>2e3?2e3:u,u-=v;do m=m+s[f++]|0,A=A+m|0;while(--v);m%=65521,A%=65521}return m|A<<16|0}),adler32_1}var crc32_1,hasRequiredCrc32;function requireCrc32(){if(hasRequiredCrc32)return crc32_1;hasRequiredCrc32=1;const a=()=>{let u,f=[];for(var m=0;m<256;m++){u=m;for(var A=0;A<8;A++)u=u&1?3988292384^u>>>1:u>>>1;f[m]=u}return f},n=new Uint32Array(a());return crc32_1=(u,f,m,A)=>{const v=n,y=A+m;u^=-1;for(let T=A;T>>8^v[(u^f[T])&255];return u^-1},crc32_1}var messages,hasRequiredMessages;function requireMessages(){return hasRequiredMessages||(hasRequiredMessages=1,messages={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}),messages}var constants,hasRequiredConstants;function requireConstants(){return hasRequiredConstants||(hasRequiredConstants=1,constants={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}),constants}var hasRequiredDeflate$1;function requireDeflate$1(){if(hasRequiredDeflate$1)return deflate;hasRequiredDeflate$1=1;const{_tr_init:a,_tr_stored_block:n,_tr_flush_block:s,_tr_tally:u,_tr_align:f}=requireTrees(),m=requireAdler32(),A=requireCrc32(),v=requireMessages(),{Z_NO_FLUSH:y,Z_PARTIAL_FLUSH:T,Z_FULL_FLUSH:E,Z_FINISH:S,Z_BLOCK:I,Z_OK:e,Z_STREAM_END:F,Z_STREAM_ERROR:M,Z_DATA_ERROR:L,Z_BUF_ERROR:V,Z_DEFAULT_COMPRESSION:B,Z_FILTERED:z,Z_HUFFMAN_ONLY:b,Z_RLE:W,Z_FIXED:q,Z_DEFAULT_STRATEGY:Y,Z_UNKNOWN:X,Z_DEFLATED:Q}=requireConstants(),g=9,J=15,re=8,pe=256+1+29,me=30,Se=19,ve=2*pe+1,we=15,Ne=3,De=258,je=De+Ne+1,nt=32,Ue=42,ye=57,ut=69,pt=73,It=91,Lt=103,Ot=113,Et=666,Rt=1,Ze=2,Me=3,Qe=4,Ie=3,Fe=(se,lt)=>(se.msg=v[lt],lt),at=se=>se*2-(se>4?9:0),ze=se=>{let lt=se.length;for(;--lt>=0;)se[lt]=0},Le=se=>{let lt,Ce,Pe,xe=se.w_size;lt=se.hash_size,Pe=lt;do Ce=se.head[--Pe],se.head[Pe]=Ce>=xe?Ce-xe:0;while(--lt);lt=xe,Pe=lt;do Ce=se.prev[--Pe],se.prev[Pe]=Ce>=xe?Ce-xe:0;while(--lt)};let _e=(se,lt,Ce)=>(lt<{const lt=se.state;let Ce=lt.pending;Ce>se.avail_out&&(Ce=se.avail_out),Ce!==0&&(se.output.set(lt.pending_buf.subarray(lt.pending_out,lt.pending_out+Ce),se.next_out),se.next_out+=Ce,lt.pending_out+=Ce,se.total_out+=Ce,se.avail_out-=Ce,lt.pending-=Ce,lt.pending===0&&(lt.pending_out=0))},We=(se,lt)=>{s(se,se.block_start>=0?se.block_start:-1,se.strstart-se.block_start,lt),se.block_start=se.strstart,Je(se.strm)},Ge=(se,lt)=>{se.pending_buf[se.pending++]=lt},xt=(se,lt)=>{se.pending_buf[se.pending++]=lt>>>8&255,se.pending_buf[se.pending++]=lt&255},He=(se,lt,Ce,Pe)=>{let xe=se.avail_in;return xe>Pe&&(xe=Pe),xe===0?0:(se.avail_in-=xe,lt.set(se.input.subarray(se.next_in,se.next_in+xe),Ce),se.state.wrap===1?se.adler=m(se.adler,lt,xe,Ce):se.state.wrap===2&&(se.adler=A(se.adler,lt,xe,Ce)),se.next_in+=xe,se.total_in+=xe,xe)},rt=(se,lt)=>{let Ce=se.max_chain_length,Pe=se.strstart,xe,Nt,Xt=se.prev_length,Wt=se.nice_match;const $e=se.strstart>se.w_size-je?se.strstart-(se.w_size-je):0,p0=se.window,R0=se.w_mask,Q0=se.prev,M0=se.strstart+De;let ni=p0[Pe+Xt-1],St=p0[Pe+Xt];se.prev_length>=se.good_match&&(Ce>>=2),Wt>se.lookahead&&(Wt=se.lookahead);do if(xe=lt,!(p0[xe+Xt]!==St||p0[xe+Xt-1]!==ni||p0[xe]!==p0[Pe]||p0[++xe]!==p0[Pe+1])){Pe+=2,xe++;do;while(p0[++Pe]===p0[++xe]&&p0[++Pe]===p0[++xe]&&p0[++Pe]===p0[++xe]&&p0[++Pe]===p0[++xe]&&p0[++Pe]===p0[++xe]&&p0[++Pe]===p0[++xe]&&p0[++Pe]===p0[++xe]&&p0[++Pe]===p0[++xe]&&PeXt){if(se.match_start=lt,Xt=Nt,Nt>=Wt)break;ni=p0[Pe+Xt-1],St=p0[Pe+Xt]}}while((lt=Q0[lt&R0])>$e&&--Ce!==0);return Xt<=se.lookahead?Xt:se.lookahead},ee=se=>{const lt=se.w_size;let Ce,Pe,xe;do{if(Pe=se.window_size-se.lookahead-se.strstart,se.strstart>=lt+(lt-je)&&(se.window.set(se.window.subarray(lt,lt+lt-Pe),0),se.match_start-=lt,se.strstart-=lt,se.block_start-=lt,se.insert>se.strstart&&(se.insert=se.strstart),Le(se),Pe+=lt),se.strm.avail_in===0)break;if(Ce=He(se.strm,se.window,se.strstart+se.lookahead,Pe),se.lookahead+=Ce,se.lookahead+se.insert>=Ne)for(xe=se.strstart-se.insert,se.ins_h=se.window[xe],se.ins_h=_e(se,se.ins_h,se.window[xe+1]);se.insert&&(se.ins_h=_e(se,se.ins_h,se.window[xe+Ne-1]),se.prev[xe&se.w_mask]=se.head[se.ins_h],se.head[se.ins_h]=xe,xe++,se.insert--,!(se.lookahead+se.insert{let Ce=se.pending_buf_size-5>se.w_size?se.w_size:se.pending_buf_size-5,Pe,xe,Nt,Xt=0,Wt=se.strm.avail_in;do{if(Pe=65535,Nt=se.bi_valid+42>>3,se.strm.avail_outxe+se.strm.avail_in&&(Pe=xe+se.strm.avail_in),Pe>Nt&&(Pe=Nt),Pe>8,se.pending_buf[se.pending-2]=~Pe,se.pending_buf[se.pending-1]=~Pe>>8,Je(se.strm),xe&&(xe>Pe&&(xe=Pe),se.strm.output.set(se.window.subarray(se.block_start,se.block_start+xe),se.strm.next_out),se.strm.next_out+=xe,se.strm.avail_out-=xe,se.strm.total_out+=xe,se.block_start+=xe,Pe-=xe),Pe&&(He(se.strm,se.strm.output,se.strm.next_out,Pe),se.strm.next_out+=Pe,se.strm.avail_out-=Pe,se.strm.total_out+=Pe)}while(Xt===0);return Wt-=se.strm.avail_in,Wt&&(Wt>=se.w_size?(se.matches=2,se.window.set(se.strm.input.subarray(se.strm.next_in-se.w_size,se.strm.next_in),0),se.strstart=se.w_size,se.insert=se.strstart):(se.window_size-se.strstart<=Wt&&(se.strstart-=se.w_size,se.window.set(se.window.subarray(se.w_size,se.w_size+se.strstart),0),se.matches<2&&se.matches++,se.insert>se.strstart&&(se.insert=se.strstart)),se.window.set(se.strm.input.subarray(se.strm.next_in-Wt,se.strm.next_in),se.strstart),se.strstart+=Wt,se.insert+=Wt>se.w_size-se.insert?se.w_size-se.insert:Wt),se.block_start=se.strstart),se.high_waterNt&&se.block_start>=se.w_size&&(se.block_start-=se.w_size,se.strstart-=se.w_size,se.window.set(se.window.subarray(se.w_size,se.w_size+se.strstart),0),se.matches<2&&se.matches++,Nt+=se.w_size,se.insert>se.strstart&&(se.insert=se.strstart)),Nt>se.strm.avail_in&&(Nt=se.strm.avail_in),Nt&&(He(se.strm,se.window,se.strstart,Nt),se.strstart+=Nt,se.insert+=Nt>se.w_size-se.insert?se.w_size-se.insert:Nt),se.high_water>3,Nt=se.pending_buf_size-Nt>65535?65535:se.pending_buf_size-Nt,Ce=Nt>se.w_size?se.w_size:Nt,xe=se.strstart-se.block_start,(xe>=Ce||(xe||lt===S)&<!==y&&se.strm.avail_in===0&&xe<=Nt)&&(Pe=xe>Nt?Nt:xe,Xt=lt===S&&se.strm.avail_in===0&&Pe===xe?1:0,n(se,se.block_start,Pe,Xt),se.block_start+=Pe,Je(se.strm)),Xt?Me:Rt)},st=(se,lt)=>{let Ce,Pe;for(;;){if(se.lookahead=Ne&&(se.ins_h=_e(se,se.ins_h,se.window[se.strstart+Ne-1]),Ce=se.prev[se.strstart&se.w_mask]=se.head[se.ins_h],se.head[se.ins_h]=se.strstart),Ce!==0&&se.strstart-Ce<=se.w_size-je&&(se.match_length=rt(se,Ce)),se.match_length>=Ne)if(Pe=u(se,se.strstart-se.match_start,se.match_length-Ne),se.lookahead-=se.match_length,se.match_length<=se.max_lazy_match&&se.lookahead>=Ne){se.match_length--;do se.strstart++,se.ins_h=_e(se,se.ins_h,se.window[se.strstart+Ne-1]),Ce=se.prev[se.strstart&se.w_mask]=se.head[se.ins_h],se.head[se.ins_h]=se.strstart;while(--se.match_length!==0);se.strstart++}else se.strstart+=se.match_length,se.match_length=0,se.ins_h=se.window[se.strstart],se.ins_h=_e(se,se.ins_h,se.window[se.strstart+1]);else Pe=u(se,0,se.window[se.strstart]),se.lookahead--,se.strstart++;if(Pe&&(We(se,!1),se.strm.avail_out===0))return Rt}return se.insert=se.strstart{let Ce,Pe,xe;for(;;){if(se.lookahead=Ne&&(se.ins_h=_e(se,se.ins_h,se.window[se.strstart+Ne-1]),Ce=se.prev[se.strstart&se.w_mask]=se.head[se.ins_h],se.head[se.ins_h]=se.strstart),se.prev_length=se.match_length,se.prev_match=se.match_start,se.match_length=Ne-1,Ce!==0&&se.prev_length4096)&&(se.match_length=Ne-1)),se.prev_length>=Ne&&se.match_length<=se.prev_length){xe=se.strstart+se.lookahead-Ne,Pe=u(se,se.strstart-1-se.prev_match,se.prev_length-Ne),se.lookahead-=se.prev_length-1,se.prev_length-=2;do++se.strstart<=xe&&(se.ins_h=_e(se,se.ins_h,se.window[se.strstart+Ne-1]),Ce=se.prev[se.strstart&se.w_mask]=se.head[se.ins_h],se.head[se.ins_h]=se.strstart);while(--se.prev_length!==0);if(se.match_available=0,se.match_length=Ne-1,se.strstart++,Pe&&(We(se,!1),se.strm.avail_out===0))return Rt}else if(se.match_available){if(Pe=u(se,0,se.window[se.strstart-1]),Pe&&We(se,!1),se.strstart++,se.lookahead--,se.strm.avail_out===0)return Rt}else se.match_available=1,se.strstart++,se.lookahead--}return se.match_available&&(Pe=u(se,0,se.window[se.strstart-1]),se.match_available=0),se.insert=se.strstart{let Ce,Pe,xe,Nt;const Xt=se.window;for(;;){if(se.lookahead<=De){if(ee(se),se.lookahead<=De&<===y)return Rt;if(se.lookahead===0)break}if(se.match_length=0,se.lookahead>=Ne&&se.strstart>0&&(xe=se.strstart-1,Pe=Xt[xe],Pe===Xt[++xe]&&Pe===Xt[++xe]&&Pe===Xt[++xe])){Nt=se.strstart+De;do;while(Pe===Xt[++xe]&&Pe===Xt[++xe]&&Pe===Xt[++xe]&&Pe===Xt[++xe]&&Pe===Xt[++xe]&&Pe===Xt[++xe]&&Pe===Xt[++xe]&&Pe===Xt[++xe]&&xese.lookahead&&(se.match_length=se.lookahead)}if(se.match_length>=Ne?(Ce=u(se,1,se.match_length-Ne),se.lookahead-=se.match_length,se.strstart+=se.match_length,se.match_length=0):(Ce=u(se,0,se.window[se.strstart]),se.lookahead--,se.strstart++),Ce&&(We(se,!1),se.strm.avail_out===0))return Rt}return se.insert=0,lt===S?(We(se,!0),se.strm.avail_out===0?Me:Qe):se.sym_next&&(We(se,!1),se.strm.avail_out===0)?Rt:Ze},vt=(se,lt)=>{let Ce;for(;;){if(se.lookahead===0&&(ee(se),se.lookahead===0)){if(lt===y)return Rt;break}if(se.match_length=0,Ce=u(se,0,se.window[se.strstart]),se.lookahead--,se.strstart++,Ce&&(We(se,!1),se.strm.avail_out===0))return Rt}return se.insert=0,lt===S?(We(se,!0),se.strm.avail_out===0?Me:Qe):se.sym_next&&(We(se,!1),se.strm.avail_out===0)?Rt:Ze};function Re(se,lt,Ce,Pe,xe){this.good_length=se,this.max_lazy=lt,this.nice_length=Ce,this.max_chain=Pe,this.func=xe}const Ye=[new Re(0,0,0,0,Be),new Re(4,4,8,4,st),new Re(4,5,16,8,st),new Re(4,6,32,32,st),new Re(4,4,16,16,Ke),new Re(8,16,32,32,Ke),new Re(8,16,128,128,Ke),new Re(8,32,128,256,Ke),new Re(32,128,258,1024,Ke),new Re(32,258,258,4096,Ke)],ue=se=>{se.window_size=2*se.w_size,ze(se.head),se.max_lazy_match=Ye[se.level].max_lazy,se.good_match=Ye[se.level].good_length,se.nice_match=Ye[se.level].nice_length,se.max_chain_length=Ye[se.level].max_chain,se.strstart=0,se.block_start=0,se.lookahead=0,se.insert=0,se.match_length=se.prev_length=Ne-1,se.match_available=0,se.ins_h=0};function Ae(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=Q,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(ve*2),this.dyn_dtree=new Uint16Array((2*me+1)*2),this.bl_tree=new Uint16Array((2*Se+1)*2),ze(this.dyn_ltree),ze(this.dyn_dtree),ze(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(we+1),this.heap=new Uint16Array(2*pe+1),ze(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*pe+1),ze(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const Vt=se=>{if(!se)return 1;const lt=se.state;return!lt||lt.strm!==se||lt.status!==Ue&<.status!==ye&<.status!==ut&<.status!==pt&<.status!==It&<.status!==Lt&<.status!==Ot&<.status!==Et?1:0},ge=se=>{if(Vt(se))return Fe(se,M);se.total_in=se.total_out=0,se.data_type=X;const lt=se.state;return lt.pending=0,lt.pending_out=0,lt.wrap<0&&(lt.wrap=-lt.wrap),lt.status=lt.wrap===2?ye:lt.wrap?Ue:Ot,se.adler=lt.wrap===2?0:1,lt.last_flush=-2,a(lt),e},Ut=se=>{const lt=ge(se);return lt===e&&ue(se.state),lt},Ve=(se,lt)=>Vt(se)||se.state.wrap!==2?M:(se.state.gzhead=lt,e),Zt=(se,lt,Ce,Pe,xe,Nt)=>{if(!se)return M;let Xt=1;if(lt===B&&(lt=6),Pe<0?(Xt=0,Pe=-Pe):Pe>15&&(Xt=2,Pe-=16),xe<1||xe>g||Ce!==Q||Pe<8||Pe>15||lt<0||lt>9||Nt<0||Nt>q||Pe===8&&Xt!==1)return Fe(se,M);Pe===8&&(Pe=9);const Wt=new Ae;return se.state=Wt,Wt.strm=se,Wt.status=Ue,Wt.wrap=Xt,Wt.gzhead=null,Wt.w_bits=Pe,Wt.w_size=1<Zt(se,lt,Q,J,re,Y),ht=(se,lt)=>{if(Vt(se)||lt>I||lt<0)return se?Fe(se,M):M;const Ce=se.state;if(!se.output||se.avail_in!==0&&!se.input||Ce.status===Et&<!==S)return Fe(se,se.avail_out===0?V:M);const Pe=Ce.last_flush;if(Ce.last_flush=lt,Ce.pending!==0){if(Je(se),se.avail_out===0)return Ce.last_flush=-1,e}else if(se.avail_in===0&&at(lt)<=at(Pe)&<!==S)return Fe(se,V);if(Ce.status===Et&&se.avail_in!==0)return Fe(se,V);if(Ce.status===Ue&&Ce.wrap===0&&(Ce.status=Ot),Ce.status===Ue){let xe=Q+(Ce.w_bits-8<<4)<<8,Nt=-1;if(Ce.strategy>=b||Ce.level<2?Nt=0:Ce.level<6?Nt=1:Ce.level===6?Nt=2:Nt=3,xe|=Nt<<6,Ce.strstart!==0&&(xe|=nt),xe+=31-xe%31,xt(Ce,xe),Ce.strstart!==0&&(xt(Ce,se.adler>>>16),xt(Ce,se.adler&65535)),se.adler=1,Ce.status=Ot,Je(se),Ce.pending!==0)return Ce.last_flush=-1,e}if(Ce.status===ye){if(se.adler=0,Ge(Ce,31),Ge(Ce,139),Ge(Ce,8),Ce.gzhead)Ge(Ce,(Ce.gzhead.text?1:0)+(Ce.gzhead.hcrc?2:0)+(Ce.gzhead.extra?4:0)+(Ce.gzhead.name?8:0)+(Ce.gzhead.comment?16:0)),Ge(Ce,Ce.gzhead.time&255),Ge(Ce,Ce.gzhead.time>>8&255),Ge(Ce,Ce.gzhead.time>>16&255),Ge(Ce,Ce.gzhead.time>>24&255),Ge(Ce,Ce.level===9?2:Ce.strategy>=b||Ce.level<2?4:0),Ge(Ce,Ce.gzhead.os&255),Ce.gzhead.extra&&Ce.gzhead.extra.length&&(Ge(Ce,Ce.gzhead.extra.length&255),Ge(Ce,Ce.gzhead.extra.length>>8&255)),Ce.gzhead.hcrc&&(se.adler=A(se.adler,Ce.pending_buf,Ce.pending,0)),Ce.gzindex=0,Ce.status=ut;else if(Ge(Ce,0),Ge(Ce,0),Ge(Ce,0),Ge(Ce,0),Ge(Ce,0),Ge(Ce,Ce.level===9?2:Ce.strategy>=b||Ce.level<2?4:0),Ge(Ce,Ie),Ce.status=Ot,Je(se),Ce.pending!==0)return Ce.last_flush=-1,e}if(Ce.status===ut){if(Ce.gzhead.extra){let xe=Ce.pending,Nt=(Ce.gzhead.extra.length&65535)-Ce.gzindex;for(;Ce.pending+Nt>Ce.pending_buf_size;){let Wt=Ce.pending_buf_size-Ce.pending;if(Ce.pending_buf.set(Ce.gzhead.extra.subarray(Ce.gzindex,Ce.gzindex+Wt),Ce.pending),Ce.pending=Ce.pending_buf_size,Ce.gzhead.hcrc&&Ce.pending>xe&&(se.adler=A(se.adler,Ce.pending_buf,Ce.pending-xe,xe)),Ce.gzindex+=Wt,Je(se),Ce.pending!==0)return Ce.last_flush=-1,e;xe=0,Nt-=Wt}let Xt=new Uint8Array(Ce.gzhead.extra);Ce.pending_buf.set(Xt.subarray(Ce.gzindex,Ce.gzindex+Nt),Ce.pending),Ce.pending+=Nt,Ce.gzhead.hcrc&&Ce.pending>xe&&(se.adler=A(se.adler,Ce.pending_buf,Ce.pending-xe,xe)),Ce.gzindex=0}Ce.status=pt}if(Ce.status===pt){if(Ce.gzhead.name){let xe=Ce.pending,Nt;do{if(Ce.pending===Ce.pending_buf_size){if(Ce.gzhead.hcrc&&Ce.pending>xe&&(se.adler=A(se.adler,Ce.pending_buf,Ce.pending-xe,xe)),Je(se),Ce.pending!==0)return Ce.last_flush=-1,e;xe=0}Ce.gzindexxe&&(se.adler=A(se.adler,Ce.pending_buf,Ce.pending-xe,xe)),Ce.gzindex=0}Ce.status=It}if(Ce.status===It){if(Ce.gzhead.comment){let xe=Ce.pending,Nt;do{if(Ce.pending===Ce.pending_buf_size){if(Ce.gzhead.hcrc&&Ce.pending>xe&&(se.adler=A(se.adler,Ce.pending_buf,Ce.pending-xe,xe)),Je(se),Ce.pending!==0)return Ce.last_flush=-1,e;xe=0}Ce.gzindexxe&&(se.adler=A(se.adler,Ce.pending_buf,Ce.pending-xe,xe))}Ce.status=Lt}if(Ce.status===Lt){if(Ce.gzhead.hcrc){if(Ce.pending+2>Ce.pending_buf_size&&(Je(se),Ce.pending!==0))return Ce.last_flush=-1,e;Ge(Ce,se.adler&255),Ge(Ce,se.adler>>8&255),se.adler=0}if(Ce.status=Ot,Je(se),Ce.pending!==0)return Ce.last_flush=-1,e}if(se.avail_in!==0||Ce.lookahead!==0||lt!==y&&Ce.status!==Et){let xe=Ce.level===0?Be(Ce,lt):Ce.strategy===b?vt(Ce,lt):Ce.strategy===W?ft(Ce,lt):Ye[Ce.level].func(Ce,lt);if((xe===Me||xe===Qe)&&(Ce.status=Et),xe===Rt||xe===Me)return se.avail_out===0&&(Ce.last_flush=-1),e;if(xe===Ze&&(lt===T?f(Ce):lt!==I&&(n(Ce,0,0,!1),lt===E&&(ze(Ce.head),Ce.lookahead===0&&(Ce.strstart=0,Ce.block_start=0,Ce.insert=0))),Je(se),se.avail_out===0))return Ce.last_flush=-1,e}return lt!==S?e:Ce.wrap<=0?F:(Ce.wrap===2?(Ge(Ce,se.adler&255),Ge(Ce,se.adler>>8&255),Ge(Ce,se.adler>>16&255),Ge(Ce,se.adler>>24&255),Ge(Ce,se.total_in&255),Ge(Ce,se.total_in>>8&255),Ge(Ce,se.total_in>>16&255),Ge(Ce,se.total_in>>24&255)):(xt(Ce,se.adler>>>16),xt(Ce,se.adler&65535)),Je(se),Ce.wrap>0&&(Ce.wrap=-Ce.wrap),Ce.pending!==0?e:F)},I0=se=>{if(Vt(se))return M;const lt=se.state.status;return se.state=null,lt===Ot?Fe(se,L):e},be=(se,lt)=>{let Ce=lt.length;if(Vt(se))return M;const Pe=se.state,xe=Pe.wrap;if(xe===2||xe===1&&Pe.status!==Ue||Pe.lookahead)return M;if(xe===1&&(se.adler=m(se.adler,lt,Ce,0)),Pe.wrap=0,Ce>=Pe.w_size){xe===0&&(ze(Pe.head),Pe.strstart=0,Pe.block_start=0,Pe.insert=0);let $e=new Uint8Array(Pe.w_size);$e.set(lt.subarray(Ce-Pe.w_size,Ce),0),lt=$e,Ce=Pe.w_size}const Nt=se.avail_in,Xt=se.next_in,Wt=se.input;for(se.avail_in=Ce,se.next_in=0,se.input=lt,ee(Pe);Pe.lookahead>=Ne;){let $e=Pe.strstart,p0=Pe.lookahead-(Ne-1);do Pe.ins_h=_e(Pe,Pe.ins_h,Pe.window[$e+Ne-1]),Pe.prev[$e&Pe.w_mask]=Pe.head[Pe.ins_h],Pe.head[Pe.ins_h]=$e,$e++;while(--p0);Pe.strstart=$e,Pe.lookahead=Ne-1,ee(Pe)}return Pe.strstart+=Pe.lookahead,Pe.block_start=Pe.strstart,Pe.insert=Pe.lookahead,Pe.lookahead=0,Pe.match_length=Pe.prev_length=Ne-1,Pe.match_available=0,se.next_in=Xt,se.input=Wt,se.avail_in=Nt,Pe.wrap=xe,e};return deflate.deflateInit=ot,deflate.deflateInit2=Zt,deflate.deflateReset=Ut,deflate.deflateResetKeep=ge,deflate.deflateSetHeader=Ve,deflate.deflate=ht,deflate.deflateEnd=I0,deflate.deflateSetDictionary=be,deflate.deflateInfo="pako deflate (from Nodeca project)",deflate}var common={},hasRequiredCommon;function requireCommon(){if(hasRequiredCommon)return common;hasRequiredCommon=1;const a=(n,s)=>Object.prototype.hasOwnProperty.call(n,s);return common.assign=function(n){const s=Array.prototype.slice.call(arguments,1);for(;s.length;){const u=s.shift();if(u){if(typeof u!="object")throw new TypeError(u+"must be non-object");for(const f in u)a(u,f)&&(n[f]=u[f])}}return n},common.flattenChunks=n=>{let s=0;for(let f=0,m=n.length;f=252?6:u>=248?5:u>=240?4:u>=224?3:u>=192?2:1;n[254]=n[254]=1,strings.string2buf=u=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(u);let f,m,A,v,y,T=u.length,E=0;for(v=0;v>>6,f[y++]=128|m&63):m<65536?(f[y++]=224|m>>>12,f[y++]=128|m>>>6&63,f[y++]=128|m&63):(f[y++]=240|m>>>18,f[y++]=128|m>>>12&63,f[y++]=128|m>>>6&63,f[y++]=128|m&63);return f};const s=(u,f)=>{if(f<65534&&u.subarray&&a)return String.fromCharCode.apply(null,u.length===f?u:u.subarray(0,f));let m="";for(let A=0;A{const m=f||u.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(u.subarray(0,f));let A,v;const y=new Array(m*2);for(v=0,A=0;A4){y[v++]=65533,A+=E-1;continue}for(T&=E===2?31:E===3?15:7;E>1&&A1){y[v++]=65533;continue}T<65536?y[v++]=T:(T-=65536,y[v++]=55296|T>>10&1023,y[v++]=56320|T&1023)}return s(y,v)},strings.utf8border=(u,f)=>{f=f||u.length,f>u.length&&(f=u.length);let m=f-1;for(;m>=0&&(u[m]&192)===128;)m--;return m<0||m===0?f:m+n[u[m]]>f?m:f},strings}var zstream,hasRequiredZstream;function requireZstream(){if(hasRequiredZstream)return zstream;hasRequiredZstream=1;function a(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}return zstream=a,zstream}var hasRequiredDeflate;function requireDeflate(){if(hasRequiredDeflate)return deflate$1;hasRequiredDeflate=1;const a=requireDeflate$1(),n=requireCommon(),s=requireStrings(),u=requireMessages(),f=requireZstream(),m=Object.prototype.toString,{Z_NO_FLUSH:A,Z_SYNC_FLUSH:v,Z_FULL_FLUSH:y,Z_FINISH:T,Z_OK:E,Z_STREAM_END:S,Z_DEFAULT_COMPRESSION:I,Z_DEFAULT_STRATEGY:e,Z_DEFLATED:F}=requireConstants();function M(z){this.options=n.assign({level:I,method:F,chunkSize:16384,windowBits:15,memLevel:8,strategy:e},z||{});let b=this.options;b.raw&&b.windowBits>0?b.windowBits=-b.windowBits:b.gzip&&b.windowBits>0&&b.windowBits<16&&(b.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new f,this.strm.avail_out=0;let W=a.deflateInit2(this.strm,b.level,b.method,b.windowBits,b.memLevel,b.strategy);if(W!==E)throw new Error(u[W]);if(b.header&&a.deflateSetHeader(this.strm,b.header),b.dictionary){let q;if(typeof b.dictionary=="string"?q=s.string2buf(b.dictionary):m.call(b.dictionary)==="[object ArrayBuffer]"?q=new Uint8Array(b.dictionary):q=b.dictionary,W=a.deflateSetDictionary(this.strm,q),W!==E)throw new Error(u[W]);this._dict_set=!0}}M.prototype.push=function(z,b){const W=this.strm,q=this.options.chunkSize;let Y,X;if(this.ended)return!1;for(b===~~b?X=b:X=b===!0?T:A,typeof z=="string"?W.input=s.string2buf(z):m.call(z)==="[object ArrayBuffer]"?W.input=new Uint8Array(z):W.input=z,W.next_in=0,W.avail_in=W.input.length;;){if(W.avail_out===0&&(W.output=new Uint8Array(q),W.next_out=0,W.avail_out=q),(X===v||X===y)&&W.avail_out<=6){this.onData(W.output.subarray(0,W.next_out)),W.avail_out=0;continue}if(Y=a.deflate(W,X),Y===S)return W.next_out>0&&this.onData(W.output.subarray(0,W.next_out)),Y=a.deflateEnd(this.strm),this.onEnd(Y),this.ended=!0,Y===E;if(W.avail_out===0){this.onData(W.output);continue}if(X>0&&W.next_out>0){this.onData(W.output.subarray(0,W.next_out)),W.avail_out=0;continue}if(W.avail_in===0)break}return!0},M.prototype.onData=function(z){this.chunks.push(z)},M.prototype.onEnd=function(z){z===E&&(this.result=n.flattenChunks(this.chunks)),this.chunks=[],this.err=z,this.msg=this.strm.msg};function L(z,b){const W=new M(b);if(W.push(z,!0),W.err)throw W.msg||u[W.err];return W.result}function V(z,b){return b=b||{},b.raw=!0,L(z,b)}function B(z,b){return b=b||{},b.gzip=!0,L(z,b)}return deflate$1.Deflate=M,deflate$1.deflate=L,deflate$1.deflateRaw=V,deflate$1.gzip=B,deflate$1.constants=requireConstants(),deflate$1}var inflate$1={},inflate={},inffast,hasRequiredInffast;function requireInffast(){if(hasRequiredInffast)return inffast;hasRequiredInffast=1;const a=16209,n=16191;return inffast=function(u,f){let m,A,v,y,T,E,S,I,e,F,M,L,V,B,z,b,W,q,Y,X,Q,g,J,re;const ae=u.state;m=u.next_in,J=u.input,A=m+(u.avail_in-5),v=u.next_out,re=u.output,y=v-(f-u.avail_out),T=v+(u.avail_out-257),E=ae.dmax,S=ae.wsize,I=ae.whave,e=ae.wnext,F=ae.window,M=ae.hold,L=ae.bits,V=ae.lencode,B=ae.distcode,z=(1<>>24,M>>>=q,L-=q,q=W>>>16&255,q===0)re[v++]=W&65535;else if(q&16){Y=W&65535,q&=15,q&&(L>>=q,L-=q),L<15&&(M+=J[m++]<>>24,M>>>=q,L-=q,q=W>>>16&255,q&16){if(X=W&65535,q&=15,LE){u.msg="invalid distance too far back",ae.mode=a;break e}if(M>>>=q,L-=q,q=v-y,X>q){if(q=X-q,q>I&&ae.sane){u.msg="invalid distance too far back",ae.mode=a;break e}if(Q=0,g=F,e===0){if(Q+=S-q,q2;)re[v++]=g[Q++],re[v++]=g[Q++],re[v++]=g[Q++],Y-=3;Y&&(re[v++]=g[Q++],Y>1&&(re[v++]=g[Q++]))}else{Q=v-X;do re[v++]=re[Q++],re[v++]=re[Q++],re[v++]=re[Q++],Y-=3;while(Y>2);Y&&(re[v++]=re[Q++],Y>1&&(re[v++]=re[Q++]))}}else if(q&64){u.msg="invalid distance code",ae.mode=a;break e}else{W=B[(W&65535)+(M&(1<>3,m-=Y,L-=Y<<3,M&=(1<{const z=B.bits;let b=0,W=0,q=0,Y=0,X=0,Q=0,g=0,J=0,re=0,ae=0,fe,pe,me,Se,ve,we=null,Ne;const De=new Uint16Array(a+1),je=new Uint16Array(a+1);let nt=null,Ue,ye,ut;for(b=0;b<=a;b++)De[b]=0;for(W=0;W=1&&De[Y]===0;Y--);if(X>Y&&(X=Y),Y===0)return M[L++]=1<<24|64<<16|0,M[L++]=1<<24|64<<16|0,B.bits=1,0;for(q=1;q0&&(S===u||Y!==1))return-1;for(je[1]=0,b=1;bn||S===m&&re>s)return 1;for(;;){Ue=b-g,V[W]+1=Ne?(ye=nt[V[W]-Ne],ut=we[V[W]-Ne]):(ye=96,ut=0),fe=1<>g)+pe]=Ue<<24|ye<<16|ut|0;while(pe!==0);for(fe=1<>=1;if(fe!==0?(ae&=fe-1,ae+=fe):ae=0,W++,--De[b]===0){if(b===Y)break;b=I[e+V[W]]}if(b>X&&(ae&Se)!==me){for(g===0&&(g=X),ve+=q,Q=b-g,J=1<n||S===m&&re>s)return 1;me=ae&Se,M[me]=X<<24|Q<<16|ve-L|0}}return ae!==0&&(M[ve+ae]=b-g<<24|64<<16|0),B.bits=X,0},inftrees}var hasRequiredInflate$1;function requireInflate$1(){if(hasRequiredInflate$1)return inflate;hasRequiredInflate$1=1;const a=requireAdler32(),n=requireCrc32(),s=requireInffast(),u=requireInftrees(),f=0,m=1,A=2,{Z_FINISH:v,Z_BLOCK:y,Z_TREES:T,Z_OK:E,Z_STREAM_END:S,Z_NEED_DICT:I,Z_STREAM_ERROR:e,Z_DATA_ERROR:F,Z_MEM_ERROR:M,Z_BUF_ERROR:L,Z_DEFLATED:V}=requireConstants(),B=16180,z=16181,b=16182,W=16183,q=16184,Y=16185,X=16186,Q=16187,g=16188,J=16189,re=16190,ae=16191,fe=16192,pe=16193,me=16194,Se=16195,ve=16196,we=16197,Ne=16198,De=16199,je=16200,nt=16201,Ue=16202,ye=16203,ut=16204,pt=16205,It=16206,Lt=16207,Ot=16208,Et=16209,Rt=16210,Ze=16211,Me=852,Qe=592,Fe=15,at=Re=>(Re>>>24&255)+(Re>>>8&65280)+((Re&65280)<<8)+((Re&255)<<24);function ze(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const Le=Re=>{if(!Re)return 1;const Ye=Re.state;return!Ye||Ye.strm!==Re||Ye.modeZe?1:0},qe=Re=>{if(Le(Re))return e;const Ye=Re.state;return Re.total_in=Re.total_out=Ye.total=0,Re.msg="",Ye.wrap&&(Re.adler=Ye.wrap&1),Ye.mode=B,Ye.last=0,Ye.havedict=0,Ye.flags=-1,Ye.dmax=32768,Ye.head=null,Ye.hold=0,Ye.bits=0,Ye.lencode=Ye.lendyn=new Int32Array(Me),Ye.distcode=Ye.distdyn=new Int32Array(Qe),Ye.sane=1,Ye.back=-1,E},_e=Re=>{if(Le(Re))return e;const Ye=Re.state;return Ye.wsize=0,Ye.whave=0,Ye.wnext=0,qe(Re)},Je=(Re,Ye)=>{let ue;if(Le(Re))return e;const Ae=Re.state;return Ye<0?(ue=0,Ye=-Ye):(ue=(Ye>>4)+5,Ye<48&&(Ye&=15)),Ye&&(Ye<8||Ye>15)?e:(Ae.window!==null&&Ae.wbits!==Ye&&(Ae.window=null),Ae.wrap=ue,Ae.wbits=Ye,_e(Re))},We=(Re,Ye)=>{if(!Re)return e;const ue=new ze;Re.state=ue,ue.strm=Re,ue.window=null,ue.mode=B;const Ae=Je(Re,Ye);return Ae!==E&&(Re.state=null),Ae},Ge=Re=>We(Re,Fe);let xt=!0,He,rt;const ee=Re=>{if(xt){He=new Int32Array(512),rt=new Int32Array(32);let Ye=0;for(;Ye<144;)Re.lens[Ye++]=8;for(;Ye<256;)Re.lens[Ye++]=9;for(;Ye<280;)Re.lens[Ye++]=7;for(;Ye<288;)Re.lens[Ye++]=8;for(u(m,Re.lens,0,288,He,0,Re.work,{bits:9}),Ye=0;Ye<32;)Re.lens[Ye++]=5;u(A,Re.lens,0,32,rt,0,Re.work,{bits:5}),xt=!1}Re.lencode=He,Re.lenbits=9,Re.distcode=rt,Re.distbits=5},Be=(Re,Ye,ue,Ae)=>{let Vt;const ge=Re.state;return ge.window===null&&(ge.wsize=1<=ge.wsize?(ge.window.set(Ye.subarray(ue-ge.wsize,ue),0),ge.wnext=0,ge.whave=ge.wsize):(Vt=ge.wsize-ge.wnext,Vt>Ae&&(Vt=Ae),ge.window.set(Ye.subarray(ue-Ae,ue-Ae+Vt),ge.wnext),Ae-=Vt,Ae?(ge.window.set(Ye.subarray(ue-Ae,ue),0),ge.wnext=Ae,ge.whave=ge.wsize):(ge.wnext+=Vt,ge.wnext===ge.wsize&&(ge.wnext=0),ge.whave{let ue,Ae,Vt,ge,Ut,Ve,Zt,ot,ht,I0,be,se,lt,Ce,Pe=0,xe,Nt,Xt,Wt,$e,p0,R0,Q0;const M0=new Uint8Array(4);let ni,St;const kt=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(Le(Re)||!Re.output||!Re.input&&Re.avail_in!==0)return e;ue=Re.state,ue.mode===ae&&(ue.mode=fe),Ut=Re.next_out,Vt=Re.output,Zt=Re.avail_out,ge=Re.next_in,Ae=Re.input,Ve=Re.avail_in,ot=ue.hold,ht=ue.bits,I0=Ve,be=Zt,Q0=E;e:for(;;)switch(ue.mode){case B:if(ue.wrap===0){ue.mode=fe;break}for(;ht<16;){if(Ve===0)break e;Ve--,ot+=Ae[ge++]<>>8&255,ue.check=n(ue.check,M0,2,0),ot=0,ht=0,ue.mode=z;break}if(ue.head&&(ue.head.done=!1),!(ue.wrap&1)||(((ot&255)<<8)+(ot>>8))%31){Re.msg="incorrect header check",ue.mode=Et;break}if((ot&15)!==V){Re.msg="unknown compression method",ue.mode=Et;break}if(ot>>>=4,ht-=4,R0=(ot&15)+8,ue.wbits===0&&(ue.wbits=R0),R0>15||R0>ue.wbits){Re.msg="invalid window size",ue.mode=Et;break}ue.dmax=1<>8&1),ue.flags&512&&ue.wrap&4&&(M0[0]=ot&255,M0[1]=ot>>>8&255,ue.check=n(ue.check,M0,2,0)),ot=0,ht=0,ue.mode=b;case b:for(;ht<32;){if(Ve===0)break e;Ve--,ot+=Ae[ge++]<>>8&255,M0[2]=ot>>>16&255,M0[3]=ot>>>24&255,ue.check=n(ue.check,M0,4,0)),ot=0,ht=0,ue.mode=W;case W:for(;ht<16;){if(Ve===0)break e;Ve--,ot+=Ae[ge++]<>8),ue.flags&512&&ue.wrap&4&&(M0[0]=ot&255,M0[1]=ot>>>8&255,ue.check=n(ue.check,M0,2,0)),ot=0,ht=0,ue.mode=q;case q:if(ue.flags&1024){for(;ht<16;){if(Ve===0)break e;Ve--,ot+=Ae[ge++]<>>8&255,ue.check=n(ue.check,M0,2,0)),ot=0,ht=0}else ue.head&&(ue.head.extra=null);ue.mode=Y;case Y:if(ue.flags&1024&&(se=ue.length,se>Ve&&(se=Ve),se&&(ue.head&&(R0=ue.head.extra_len-ue.length,ue.head.extra||(ue.head.extra=new Uint8Array(ue.head.extra_len)),ue.head.extra.set(Ae.subarray(ge,ge+se),R0)),ue.flags&512&&ue.wrap&4&&(ue.check=n(ue.check,Ae,se,ge)),Ve-=se,ge+=se,ue.length-=se),ue.length))break e;ue.length=0,ue.mode=X;case X:if(ue.flags&2048){if(Ve===0)break e;se=0;do R0=Ae[ge+se++],ue.head&&R0&&ue.length<65536&&(ue.head.name+=String.fromCharCode(R0));while(R0&&se>9&1,ue.head.done=!0),Re.adler=ue.check=0,ue.mode=ae;break;case J:for(;ht<32;){if(Ve===0)break e;Ve--,ot+=Ae[ge++]<>>=ht&7,ht-=ht&7,ue.mode=It;break}for(;ht<3;){if(Ve===0)break e;Ve--,ot+=Ae[ge++]<>>=1,ht-=1,ot&3){case 0:ue.mode=pe;break;case 1:if(ee(ue),ue.mode=De,Ye===T){ot>>>=2,ht-=2;break e}break;case 2:ue.mode=ve;break;case 3:Re.msg="invalid block type",ue.mode=Et}ot>>>=2,ht-=2;break;case pe:for(ot>>>=ht&7,ht-=ht&7;ht<32;){if(Ve===0)break e;Ve--,ot+=Ae[ge++]<>>16^65535)){Re.msg="invalid stored block lengths",ue.mode=Et;break}if(ue.length=ot&65535,ot=0,ht=0,ue.mode=me,Ye===T)break e;case me:ue.mode=Se;case Se:if(se=ue.length,se){if(se>Ve&&(se=Ve),se>Zt&&(se=Zt),se===0)break e;Vt.set(Ae.subarray(ge,ge+se),Ut),Ve-=se,ge+=se,Zt-=se,Ut+=se,ue.length-=se;break}ue.mode=ae;break;case ve:for(;ht<14;){if(Ve===0)break e;Ve--,ot+=Ae[ge++]<>>=5,ht-=5,ue.ndist=(ot&31)+1,ot>>>=5,ht-=5,ue.ncode=(ot&15)+4,ot>>>=4,ht-=4,ue.nlen>286||ue.ndist>30){Re.msg="too many length or distance symbols",ue.mode=Et;break}ue.have=0,ue.mode=we;case we:for(;ue.have>>=3,ht-=3}for(;ue.have<19;)ue.lens[kt[ue.have++]]=0;if(ue.lencode=ue.lendyn,ue.lenbits=7,ni={bits:ue.lenbits},Q0=u(f,ue.lens,0,19,ue.lencode,0,ue.work,ni),ue.lenbits=ni.bits,Q0){Re.msg="invalid code lengths set",ue.mode=Et;break}ue.have=0,ue.mode=Ne;case Ne:for(;ue.have>>24,Nt=Pe>>>16&255,Xt=Pe&65535,!(xe<=ht);){if(Ve===0)break e;Ve--,ot+=Ae[ge++]<>>=xe,ht-=xe,ue.lens[ue.have++]=Xt;else{if(Xt===16){for(St=xe+2;ht>>=xe,ht-=xe,ue.have===0){Re.msg="invalid bit length repeat",ue.mode=Et;break}R0=ue.lens[ue.have-1],se=3+(ot&3),ot>>>=2,ht-=2}else if(Xt===17){for(St=xe+3;ht>>=xe,ht-=xe,R0=0,se=3+(ot&7),ot>>>=3,ht-=3}else{for(St=xe+7;ht>>=xe,ht-=xe,R0=0,se=11+(ot&127),ot>>>=7,ht-=7}if(ue.have+se>ue.nlen+ue.ndist){Re.msg="invalid bit length repeat",ue.mode=Et;break}for(;se--;)ue.lens[ue.have++]=R0}}if(ue.mode===Et)break;if(ue.lens[256]===0){Re.msg="invalid code -- missing end-of-block",ue.mode=Et;break}if(ue.lenbits=9,ni={bits:ue.lenbits},Q0=u(m,ue.lens,0,ue.nlen,ue.lencode,0,ue.work,ni),ue.lenbits=ni.bits,Q0){Re.msg="invalid literal/lengths set",ue.mode=Et;break}if(ue.distbits=6,ue.distcode=ue.distdyn,ni={bits:ue.distbits},Q0=u(A,ue.lens,ue.nlen,ue.ndist,ue.distcode,0,ue.work,ni),ue.distbits=ni.bits,Q0){Re.msg="invalid distances set",ue.mode=Et;break}if(ue.mode=De,Ye===T)break e;case De:ue.mode=je;case je:if(Ve>=6&&Zt>=258){Re.next_out=Ut,Re.avail_out=Zt,Re.next_in=ge,Re.avail_in=Ve,ue.hold=ot,ue.bits=ht,s(Re,be),Ut=Re.next_out,Vt=Re.output,Zt=Re.avail_out,ge=Re.next_in,Ae=Re.input,Ve=Re.avail_in,ot=ue.hold,ht=ue.bits,ue.mode===ae&&(ue.back=-1);break}for(ue.back=0;Pe=ue.lencode[ot&(1<>>24,Nt=Pe>>>16&255,Xt=Pe&65535,!(xe<=ht);){if(Ve===0)break e;Ve--,ot+=Ae[ge++]<>Wt)],xe=Pe>>>24,Nt=Pe>>>16&255,Xt=Pe&65535,!(Wt+xe<=ht);){if(Ve===0)break e;Ve--,ot+=Ae[ge++]<>>=Wt,ht-=Wt,ue.back+=Wt}if(ot>>>=xe,ht-=xe,ue.back+=xe,ue.length=Xt,Nt===0){ue.mode=pt;break}if(Nt&32){ue.back=-1,ue.mode=ae;break}if(Nt&64){Re.msg="invalid literal/length code",ue.mode=Et;break}ue.extra=Nt&15,ue.mode=nt;case nt:if(ue.extra){for(St=ue.extra;ht>>=ue.extra,ht-=ue.extra,ue.back+=ue.extra}ue.was=ue.length,ue.mode=Ue;case Ue:for(;Pe=ue.distcode[ot&(1<>>24,Nt=Pe>>>16&255,Xt=Pe&65535,!(xe<=ht);){if(Ve===0)break e;Ve--,ot+=Ae[ge++]<>Wt)],xe=Pe>>>24,Nt=Pe>>>16&255,Xt=Pe&65535,!(Wt+xe<=ht);){if(Ve===0)break e;Ve--,ot+=Ae[ge++]<>>=Wt,ht-=Wt,ue.back+=Wt}if(ot>>>=xe,ht-=xe,ue.back+=xe,Nt&64){Re.msg="invalid distance code",ue.mode=Et;break}ue.offset=Xt,ue.extra=Nt&15,ue.mode=ye;case ye:if(ue.extra){for(St=ue.extra;ht>>=ue.extra,ht-=ue.extra,ue.back+=ue.extra}if(ue.offset>ue.dmax){Re.msg="invalid distance too far back",ue.mode=Et;break}ue.mode=ut;case ut:if(Zt===0)break e;if(se=be-Zt,ue.offset>se){if(se=ue.offset-se,se>ue.whave&&ue.sane){Re.msg="invalid distance too far back",ue.mode=Et;break}se>ue.wnext?(se-=ue.wnext,lt=ue.wsize-se):lt=ue.wnext-se,se>ue.length&&(se=ue.length),Ce=ue.window}else Ce=Vt,lt=Ut-ue.offset,se=ue.length;se>Zt&&(se=Zt),Zt-=se,ue.length-=se;do Vt[Ut++]=Ce[lt++];while(--se);ue.length===0&&(ue.mode=je);break;case pt:if(Zt===0)break e;Vt[Ut++]=ue.length,Zt--,ue.mode=je;break;case It:if(ue.wrap){for(;ht<32;){if(Ve===0)break e;Ve--,ot|=Ae[ge++]<{if(Le(Re))return e;let Ye=Re.state;return Ye.window&&(Ye.window=null),Re.state=null,E},ft=(Re,Ye)=>{if(Le(Re))return e;const ue=Re.state;return ue.wrap&2?(ue.head=Ye,Ye.done=!1,E):e},vt=(Re,Ye)=>{const ue=Ye.length;let Ae,Vt,ge;return Le(Re)||(Ae=Re.state,Ae.wrap!==0&&Ae.mode!==re)?e:Ae.mode===re&&(Vt=1,Vt=a(Vt,Ye,ue,0),Vt!==Ae.check)?F:(ge=Be(Re,Ye,ue,ue),ge?(Ae.mode=Rt,M):(Ae.havedict=1,E))};return inflate.inflateReset=_e,inflate.inflateReset2=Je,inflate.inflateResetKeep=qe,inflate.inflateInit=Ge,inflate.inflateInit2=We,inflate.inflate=st,inflate.inflateEnd=Ke,inflate.inflateGetHeader=ft,inflate.inflateSetDictionary=vt,inflate.inflateInfo="pako inflate (from Nodeca project)",inflate}var gzheader,hasRequiredGzheader;function requireGzheader(){if(hasRequiredGzheader)return gzheader;hasRequiredGzheader=1;function a(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}return gzheader=a,gzheader}var hasRequiredInflate;function requireInflate(){if(hasRequiredInflate)return inflate$1;hasRequiredInflate=1;const a=requireInflate$1(),n=requireCommon(),s=requireStrings(),u=requireMessages(),f=requireZstream(),m=requireGzheader(),A=Object.prototype.toString,{Z_NO_FLUSH:v,Z_FINISH:y,Z_OK:T,Z_STREAM_END:E,Z_NEED_DICT:S,Z_STREAM_ERROR:I,Z_DATA_ERROR:e,Z_MEM_ERROR:F}=requireConstants();function M(B){this.options=n.assign({chunkSize:1024*64,windowBits:15,to:""},B||{});const z=this.options;z.raw&&z.windowBits>=0&&z.windowBits<16&&(z.windowBits=-z.windowBits,z.windowBits===0&&(z.windowBits=-15)),z.windowBits>=0&&z.windowBits<16&&!(B&&B.windowBits)&&(z.windowBits+=32),z.windowBits>15&&z.windowBits<48&&(z.windowBits&15||(z.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new f,this.strm.avail_out=0;let b=a.inflateInit2(this.strm,z.windowBits);if(b!==T)throw new Error(u[b]);if(this.header=new m,a.inflateGetHeader(this.strm,this.header),z.dictionary&&(typeof z.dictionary=="string"?z.dictionary=s.string2buf(z.dictionary):A.call(z.dictionary)==="[object ArrayBuffer]"&&(z.dictionary=new Uint8Array(z.dictionary)),z.raw&&(b=a.inflateSetDictionary(this.strm,z.dictionary),b!==T)))throw new Error(u[b])}M.prototype.push=function(B,z){const b=this.strm,W=this.options.chunkSize,q=this.options.dictionary;let Y,X,Q;if(this.ended)return!1;for(z===~~z?X=z:X=z===!0?y:v,A.call(B)==="[object ArrayBuffer]"?b.input=new Uint8Array(B):b.input=B,b.next_in=0,b.avail_in=b.input.length;;){for(b.avail_out===0&&(b.output=new Uint8Array(W),b.next_out=0,b.avail_out=W),Y=a.inflate(b,X),Y===S&&q&&(Y=a.inflateSetDictionary(b,q),Y===T?Y=a.inflate(b,X):Y===e&&(Y=S));b.avail_in>0&&Y===E&&b.state.wrap>0&&B[b.next_in]!==0;)a.inflateReset(b),Y=a.inflate(b,X);switch(Y){case I:case e:case S:case F:return this.onEnd(Y),this.ended=!0,!1}if(Q=b.avail_out,b.next_out&&(b.avail_out===0||Y===E))if(this.options.to==="string"){let g=s.utf8border(b.output,b.next_out),J=b.next_out-g,re=s.buf2string(b.output,g);b.next_out=J,b.avail_out=W-J,J&&b.output.set(b.output.subarray(g,g+J),0),this.onData(re)}else this.onData(b.output.length===b.next_out?b.output:b.output.subarray(0,b.next_out));if(!(Y===T&&Q===0)){if(Y===E)return Y=a.inflateEnd(this.strm),this.onEnd(Y),this.ended=!0,!0;if(b.avail_in===0)break}}return!0},M.prototype.onData=function(B){this.chunks.push(B)},M.prototype.onEnd=function(B){B===T&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=n.flattenChunks(this.chunks)),this.chunks=[],this.err=B,this.msg=this.strm.msg};function L(B,z){const b=new M(z);if(b.push(B),b.err)throw b.msg||u[b.err];return b.result}function V(B,z){return z=z||{},z.raw=!0,L(B,z)}return inflate$1.Inflate=M,inflate$1.inflate=L,inflate$1.inflateRaw=V,inflate$1.ungzip=L,inflate$1.constants=requireConstants(),inflate$1}var hasRequiredPako;function requirePako(){if(hasRequiredPako)return pako;hasRequiredPako=1;const{Deflate:a,deflate:n,deflateRaw:s,gzip:u}=requireDeflate(),{Inflate:f,inflate:m,inflateRaw:A,ungzip:v}=requireInflate(),y=requireConstants();return pako.Deflate=a,pako.deflate=n,pako.deflateRaw=s,pako.gzip=u,pako.Inflate=f,pako.inflate=m,pako.inflateRaw=A,pako.ungzip=v,pako.constants=y,pako}var hasRequiredParser;function requireParser(){return hasRequiredParser||(hasRequiredParser=1,function(a){var n=n||{};n.Tag=n.Tag||(typeof commonjsRequire<"u"?requireTag():null),n.Utils=n.Utils||(typeof commonjsRequire<"u"?requireUtilities():null),n.Dictionary=n.Dictionary||(typeof commonjsRequire<"u"?requireDictionary():null),n.Image=n.Image||(typeof commonjsRequire<"u"?requireImage():null);var s=s||(typeof commonjsRequire<"u"?requirePako():null);n.Parser=n.Parser||function(){this.littleEndian=!0,this.explicit=!0,this.metaFound=!1,this.metaFinished=!1,this.metaFinishedOffset=-1,this.needsDeflate=!1,this.inflated=null,this.encapsulation=!1,this.level=0,this.error=null},n.Parser.verbose=!1,n.Parser.MAGIC_COOKIE_OFFSET=128,n.Parser.MAGIC_COOKIE=[68,73,67,77],n.Parser.VRS=["AE","AS","AT","CS","DA","DS","DT","FL","FD","IS","LO","LT","OB","OD","OF","OW","PN","SH","SL","SS","ST","TM","UI","UL","UN","US","UT","UC"],n.Parser.DATA_VRS=["OB","OW","OF","SQ","UT","UN","UC"],n.Parser.RAW_DATA_VRS=["OB","OD","OF","OW","UN"],n.Parser.TRANSFER_SYNTAX_IMPLICIT_LITTLE="1.2.840.10008.1.2",n.Parser.TRANSFER_SYNTAX_EXPLICIT_LITTLE="1.2.840.10008.1.2.1",n.Parser.TRANSFER_SYNTAX_EXPLICIT_BIG="1.2.840.10008.1.2.2",n.Parser.TRANSFER_SYNTAX_COMPRESSION_JPEG="1.2.840.10008.1.2.4",n.Parser.TRANSFER_SYNTAX_COMPRESSION_JPEG_LOSSLESS="1.2.840.10008.1.2.4.57",n.Parser.TRANSFER_SYNTAX_COMPRESSION_JPEG_LOSSLESS_SEL1="1.2.840.10008.1.2.4.70",n.Parser.TRANSFER_SYNTAX_COMPRESSION_JPEG_BASELINE_8BIT="1.2.840.10008.1.2.4.50",n.Parser.TRANSFER_SYNTAX_COMPRESSION_JPEG_BASELINE_12BIT="1.2.840.10008.1.2.4.51",n.Parser.TRANSFER_SYNTAX_COMPRESSION_JPEG_LS_LOSSLESS="1.2.840.10008.1.2.4.80",n.Parser.TRANSFER_SYNTAX_COMPRESSION_JPEG_LS="1.2.840.10008.1.2.4.81",n.Parser.TRANSFER_SYNTAX_COMPRESSION_JPEG_2000_LOSSLESS="1.2.840.10008.1.2.4.90",n.Parser.TRANSFER_SYNTAX_COMPRESSION_JPEG_2000="1.2.840.10008.1.2.4.91",n.Parser.TRANSFER_SYNTAX_COMPRESSION_RLE="1.2.840.10008.1.2.5",n.Parser.TRANSFER_SYNTAX_COMPRESSION_DEFLATE="1.2.840.10008.1.2.1.99",n.Parser.UNDEFINED_LENGTH=4294967295,n.Parser.isMagicCookieFound=function(u){var f=n.Parser.MAGIC_COOKIE_OFFSET,m=n.Parser.MAGIC_COOKIE.length,A;for(A=0;A=this.metaFinishedOffset&&(this.needsDeflate=!1,v=u.buffer.slice(0,A.offsetEnd),y=u.buffer.slice(A.offsetEnd),this.inflated=n.Utils.concatArrayBuffers(v,s.inflateRaw(y)),u=new DataView(this.inflated)),A=this.getNextTag(u,A.offsetEnd)}catch(T){this.error=T}return f!==null&&(f.littleEndian=this.littleEndian),f},n.Parser.prototype.parseEncapsulated=function(u){var f=0,m,A=[];this.encapsulation=!0;try{for(m=this.getNextTag(u,f);m!==null;)m.isSublistItem()&&A.push(m),n.Parser.verbose&&console.log(m.toString()),m=this.getNextTag(u,m.offsetEnd)}catch(v){this.error=v}return A},n.Parser.prototype.testForValidTag=function(u){var f,m=null;try{f=this.findFirstTagOffset(u),m=this.getNextTag(u,f,!1)}catch(A){this.error=A}return m},n.Parser.prototype.getNextTag=function(u,f,m){var A=0,v,y=null,T=f,E,S=0,I=!0,e=null,F;if(f>=u.byteLength)return null;this.metaFinished?(I=this.littleEndian,A=u.getUint16(f,I)):(A=u.getUint16(f,!0),this.metaFinishedOffset!==-1&&f>=this.metaFinishedOffset||A!==2?(this.metaFinished=!0,I=this.littleEndian,A=u.getUint16(f,I)):I=!0),!this.metaFound&&A===2&&(this.metaFound=!0),f+=2,v=u.getUint16(f,I),f+=2,this.explicit||!this.metaFinished?(e=n.Utils.getStringAt(u,f,2),!this.metaFound&&this.metaFinished&&n.Parser.VRS.indexOf(e)===-1?(e=n.Dictionary.getVR(A,v),S=u.getUint32(f,I),f+=4,this.explicit=!1):(f+=2,n.Parser.DATA_VRS.indexOf(e)!==-1?(f+=2,S=u.getUint32(f,I),f+=4):(S=u.getUint16(f,I),f+=2))):(e=n.Dictionary.getVR(A,v),S=u.getUint32(f,I),S===n.Parser.UNDEFINED_LENGTH&&(e="SQ"),f+=4),E=f;var M=A===n.Tag.TAG_PIXEL_DATA[0]&&v===n.Tag.TAG_PIXEL_DATA[1],L=A===40&&v>=4609&&v<4864;if(e==="SQ"||!L&&!M&&!this.encapsulation&&n.Parser.DATA_VRS.indexOf(e)!==-1&&e!=="UC"?(y=this.parseSublist(u,f,S,e!=="SQ"),S===n.Parser.UNDEFINED_LENGTH&&(S=y[y.length-1].offsetEnd-f)):S>0&&!m&&(S===n.Parser.UNDEFINED_LENGTH&&M&&(S=u.byteLength-f),y=u.buffer.slice(f,f+S)),f+=S,F=new n.Tag(A,v,e,y,T,E,f,this.littleEndian,this.charset),F.value){if(F.isTransformSyntax())this.transformSyntaxAlreadyExist=!0,F.value[0]===n.Parser.TRANSFER_SYNTAX_IMPLICIT_LITTLE?(this.explicit=!1,this.littleEndian=!0):F.value[0]===n.Parser.TRANSFER_SYNTAX_EXPLICIT_BIG?(this.explicit=!0,this.littleEndian=!1):F.value[0]===n.Parser.TRANSFER_SYNTAX_COMPRESSION_DEFLATE?(this.needsDeflate=!0,this.explicit=!0,this.littleEndian=!0):(this.explicit=!0,this.littleEndian=!0);else if(F.isMetaLength())this.metaFinishedOffset=F.value[0]+f;else if(F.isCharset()){var V=F.value;V.length==2?V=(V[0]||"ISO 2022 IR 6")+"\\"+V[1]:V.length==1&&(V=V[0]),this.charset=V}}return F},n.Parser.prototype.parseSublist=function(u,f,m,A){var v,y=f+m,T=[];if(this.level++,m===n.Parser.UNDEFINED_LENGTH){for(v=this.parseSublistItem(u,f,A);!v.isSequenceDelim();)T.push(v),f=v.offsetEnd,v=this.parseSublistItem(u,f,A);T.push(v)}else for(;fn.Image.OBLIQUITY_THRESHOLD_COSINE_VALUE&&e>F&&e>M?T=E:F>n.Image.OBLIQUITY_THRESHOLD_COSINE_VALUE&&F>e&&F>M?T=S:M>n.Image.OBLIQUITY_THRESHOLD_COSINE_VALUE&&M>e&&M>F?T=I:T=null,T},n.Image.prototype.getCols=function(){return n.Image.getSingleValueSafely(this.getTag(n.Tag.TAG_COLS[0],n.Tag.TAG_COLS[1]),0)},n.Image.prototype.getRows=function(){return n.Image.getSingleValueSafely(this.getTag(n.Tag.TAG_ROWS[0],n.Tag.TAG_ROWS[1]),0)},n.Image.prototype.getSeriesDescription=function(){return n.Image.getSingleValueSafely(this.getTag(n.Tag.TAG_SERIES_DESCRIPTION[0],n.Tag.TAG_SERIES_DESCRIPTION[1]),0)},n.Image.prototype.getSeriesInstanceUID=function(){return n.Image.getSingleValueSafely(this.getTag(n.Tag.TAG_SERIES_INSTANCE_UID[0],n.Tag.TAG_SERIES_INSTANCE_UID[1]),0)},n.Image.prototype.getSeriesNumber=function(){return n.Image.getSingleValueSafely(this.getTag(n.Tag.TAG_SERIES_NUMBER[0],n.Tag.TAG_SERIES_NUMBER[1]),0)},n.Image.prototype.getEchoNumber=function(){return n.Image.getSingleValueSafely(this.getTag(n.Tag.TAG_ECHO_NUMBER[0],n.Tag.TAG_ECHO_NUMBER[1]),0)},n.Image.prototype.getImagePosition=function(){return n.Image.getValueSafely(this.getTag(n.Tag.TAG_IMAGE_POSITION[0],n.Tag.TAG_IMAGE_POSITION[1]))},n.Image.prototype.getImageDirections=function(){return n.Image.getValueSafely(this.getTag(n.Tag.TAG_IMAGE_ORIENTATION[0],n.Tag.TAG_IMAGE_ORIENTATION[1]))},n.Image.prototype.getImagePositionSliceDir=function(A){var v=n.Image.getValueSafely(this.getTag(n.Tag.TAG_IMAGE_POSITION[0],n.Tag.TAG_IMAGE_POSITION[1]));return v&&A>=0?v[A]:0},n.Image.prototype.getModality=function(){return n.Image.getSingleValueSafely(this.getTag(n.Tag.TAG_MODALITY[0],n.Tag.TAG_MODALITY[1]),0)},n.Image.prototype.getSliceLocation=function(){return n.Image.getSingleValueSafely(this.getTag(n.Tag.TAG_SLICE_LOCATION[0],n.Tag.TAG_SLICE_LOCATION[1]),0)},n.Image.prototype.getSliceLocationVector=function(){return n.Image.getValueSafely(this.getTag(n.Tag.TAG_SLICE_LOCATION_VECTOR[0],n.Tag.TAG_SLICE_LOCATION_VECTOR[1]))},n.Image.prototype.getImageNumber=function(){return n.Image.getSingleValueSafely(this.getTag(n.Tag.TAG_IMAGE_NUM[0],n.Tag.TAG_IMAGE_NUM[1]),0)},n.Image.prototype.getTemporalPosition=function(){return n.Image.getSingleValueSafely(this.getTag(n.Tag.TAG_TEMPORAL_POSITION[0],n.Tag.TAG_TEMPORAL_POSITION[1]),0)},n.Image.prototype.getTemporalNumber=function(){return n.Image.getSingleValueSafely(this.getTag(n.Tag.TAG_NUMBER_TEMPORAL_POSITIONS[0],n.Tag.TAG_NUMBER_TEMPORAL_POSITIONS[1]),0)},n.Image.prototype.getSliceGap=function(){return n.Image.getSingleValueSafely(this.getTag(n.Tag.TAG_SLICE_GAP[0],n.Tag.TAG_SLICE_GAP[1]),0)},n.Image.prototype.getSliceThickness=function(){return n.Image.getSingleValueSafely(this.getTag(n.Tag.TAG_SLICE_THICKNESS[0],n.Tag.TAG_SLICE_THICKNESS[1]),0)},n.Image.prototype.getImageMax=function(){return n.Image.getSingleValueSafely(this.getTag(n.Tag.TAG_IMAGE_MAX[0],n.Tag.TAG_IMAGE_MAX[1]),0)},n.Image.prototype.getImageMin=function(){return n.Image.getSingleValueSafely(this.getTag(n.Tag.TAG_IMAGE_MIN[0],n.Tag.TAG_IMAGE_MIN[1]),0)},n.Image.prototype.getDataScaleSlope=function(){return n.Image.getSingleValueSafely(this.getTag(n.Tag.TAG_DATA_SCALE_SLOPE[0],n.Tag.TAG_DATA_SCALE_SLOPE[1]),0)},n.Image.prototype.getDataScaleIntercept=function(){return n.Image.getSingleValueSafely(this.getTag(n.Tag.TAG_DATA_SCALE_INTERCEPT[0],n.Tag.TAG_DATA_SCALE_INTERCEPT[1]),0)},n.Image.prototype.getDataScaleElscint=function(){var A=n.Image.getSingleValueSafely(this.getTag(n.Tag.TAG_DATA_SCALE_ELSCINT[0],n.Tag.TAG_DATA_SCALE_ELSCINT[1]),0);A||(A=1);var v=this.getPixelBandwidth();return A=Math.sqrt(v)/(10*A),A<=0&&(A=1),A},n.Image.prototype.getWindowWidth=function(){return n.Image.getSingleValueSafely(this.getTag(n.Tag.TAG_WINDOW_WIDTH[0],n.Tag.TAG_WINDOW_WIDTH[1]),0)},n.Image.prototype.getWindowCenter=function(){return n.Image.getSingleValueSafely(this.getTag(n.Tag.TAG_WINDOW_CENTER[0],n.Tag.TAG_WINDOW_CENTER[1]),0)},n.Image.prototype.getPixelBandwidth=function(){return n.Image.getSingleValueSafely(this.getTag(n.Tag.TAG_PIXEL_BANDWIDTH[0],n.Tag.TAG_PIXEL_BANDWIDTH[1]),0)},n.Image.prototype.getSeriesId=function(){var A=this.getSeriesDescription(),v=this.getSeriesInstanceUID(),y=this.getSeriesNumber(),T=this.getEchoNumber(),E=this.getOrientation(),S=this.getCols(),I=this.getRows(),e="";return A!==null&&(e+=" "+A),v!==null&&(e+=" "+v),y!==null&&(e+=" "+y),T!==null&&(e+=" "+T),E!==null&&(e+=" "+E),e+=" ("+S+" x "+I+")",e},n.Image.prototype.getPixelSpacing=function(){return n.Image.getValueSafely(this.getTag(n.Tag.TAG_PIXEL_SPACING[0],n.Tag.TAG_PIXEL_SPACING[1]))},n.Image.prototype.getImageType=function(){return n.Image.getValueSafely(this.getTag(n.Tag.TAG_IMAGE_TYPE[0],n.Tag.TAG_IMAGE_TYPE[1]))},n.Image.prototype.getBitsStored=function(){return n.Image.getSingleValueSafely(this.getTag(n.Tag.TAG_BITS_STORED[0],n.Tag.TAG_BITS_STORED[1]),0)},n.Image.prototype.getBitsAllocated=function(){return n.Image.getSingleValueSafely(this.getTag(n.Tag.TAG_BITS_ALLOCATED[0],n.Tag.TAG_BITS_ALLOCATED[1]),0)},n.Image.prototype.getFrameTime=function(){return n.Image.getSingleValueSafely(this.getTag(n.Tag.TAG_FRAME_TIME[0],n.Tag.TAG_FRAME_TIME[1]),0)},n.Image.prototype.getAcquisitionMatrix=function(){var A,v,y,T,E;return A=[0,0],A[0]=n.Image.getSingleValueSafely(this.getTag(n.Tag.TAG_ACQUISITION_MATRIX[0],n.Tag.TAG_ACQUISITION_MATRIX[1]),0),this.privateDataAll===null&&(this.privateDataAll=this.getAllInterpretedPrivateData()),this.privateDataAll!==null&&this.privateDataAll.length>0&&(y=this.privateDataAll.indexOf("AcquisitionMatrixText"),y!==-1&&(T=this.privateDataAll.indexOf(` +`,y),T!==-1&&(E=this.privateDataAll.substring(y,T),v=E.match(/\d+/g),v!==null&&v.length===2?(A[0]=v[0],A[1]=v[1]):v!==null&&v.length===1&&(A[0]=v[0])))),A[1]===0&&(A[1]=A[0]),A},n.Image.prototype.getTR=function(){return n.Image.getSingleValueSafely(this.getTag(n.Tag.TAG_TR,n.Tag.TAG_TR[1]),0)},n.Image.prototype.putTag=function(A){this.tags[A.id]&&this.tags[A.id].value[0]!==A.value[0]||(this.tags[A.id]=A,this.putFlattenedTag(this.tagsFlat,A))},n.Image.prototype.putFlattenedTag=function(A,v){var y;if(v.sublist)for(y=0;yz&&(z=b,q=fe);return v?{data:e,min:B,minIndex:W,max:z,maxIndex:q,numCols:this.getCols(),numRows:this.getRows()}:e},n.Image.prototype.convertPalette=function(){var A,v,y,T,E,S,I,e,F,M,L,V;if(A=this.tags[n.Tag.createId(n.Tag.TAG_PIXEL_DATA[0],n.Tag.TAG_PIXEL_DATA[1])].value,v=this.getPalleteValues(n.Tag.TAG_PALETTE_RED),y=this.getPalleteValues(n.Tag.TAG_PALETTE_GREEN),T=this.getPalleteValues(n.Tag.TAG_PALETTE_BLUE),v!==null&&v.length>0&&y!==null&&y.length>0&&T!==null&&T.length>0&&!this.convertedPalette){if(E=new DataView(new ArrayBuffer(this.getRows()*this.getCols()*this.getNumberOfFrames()*3)),S=parseInt(Math.ceil(this.getBitsAllocated()/8)),I=A.byteLength/S,S===1)for(e=0;eF&&(F=Math.abs(v[y]),I=y);for(F=0;y<6;y+=1)Math.abs(v[y])>F&&(F=Math.abs(v[y]),e=y);switch(I){case 0:M+="X",e===4?M+="YZ":M+="ZY";break;case 1:M+="Y",e===3?M+="XZ":M+="ZX";break;case 2:M+="Z",e===3?M+="XY":M+="YX";break}switch(I){case 0:v[I]>0?M+="-":M+="+",e===4?v[e]>0?M+="-":M+="+":v[e]>0?M+="+":M+="-";break;case 1:v[I]>0?M+="-":M+="+",e===3?v[e]>0?M+="-":M+="+":v[e]>0?M+="+":M+="-";break;case 2:v[I]>0?M+="+":M+="-",v[e]>0?M+="-":M+="+";break}if(E===0)M+="+",A=M;else{if(S)switch(M.charAt(2)){case"X":E>0?M+="-":M+="+";break;case"Y":case"Z":E>0?M+="+":M+="-";break}else switch(M.charAt(2)){case"X":E>0?M+="+":M+="-";break;case"Y":case"Z":E>0?M+="-":M+="+";break}A=M}return A},n.Image.prototype.isMosaic=function(){var A,v=!1,y,T,E;if(A=this.getImageType(),A!==null){for(T=0;T0&&(E[0]1?S[y]=n.Utils.concatArrayBuffers2(E[y]):S[y]=E[y][0],E[y]=null;return S},n.Image.prototype.getRLE=function(){var A,v,y,T=[];if(A=this.getEncapsulatedData(),A)for(v=A.length,y=1;y");return T=T.replace(/\n\s*\n/g,` `),T=T.replace(/(?:\r\n|\r|\n)/g,"
"),T},n.Image.prototype.getPalleteValues=function(A){var v,y,T,E,S,I,e,F,M,L,V;if(v=null,y=null,T=n.Image.getValueSafely(this.getTag(A[0],A[1])),T!==null){for(E=T.buffer.byteLength/2,v=[],y=[],S=0;S255||v<0)for(E=255/(y-v),S=v,T=0;T1&&s[0].getTemporalPosition()!==null,T=u>1&&s[0].getTemporalNumber()!==null&&s[0].getTemporalNumber()===u,y&&T)for(E=0;E1||this.isMosaic&&this.images[0].length>1,this.isMultiFrameVolume=!1,this.isMultiFrameTimeseries=!1,this.isImplicitTimeseries=!1,this.isMultiFrame&&(s=this.images[0].getFrameTime()>0,this.isMosaic?this.isMultiFrameTimeseries=!0:s?this.isMultiFrameTimeseries=!0:this.numberOfFramesInFile>1?(this.isMultiFrameTimeseries=!0,this.numberOfFrames=this.images.length):this.isMultiFrameVolume=!0),!this.isMosaic&&this.numberOfFrames<=1){for(S=this.images[0].getImagePosition()||[],f=S.toString(),this.numberOfFrames=0,u=0;u1&&(this.isImplicitTimeseries=!0)}this.sliceDir=this.images[0].getAcquiredSliceDirection(),n.Series.useExplicitOrdering?m=this.images.slice():m=n.Series.orderDicoms(this.images,this.numberOfFrames,this.sliceDir),A=m[0].getImagePositionSliceDir(this.sliceDir),v=m[m.length-1].getImagePositionSliceDir(this.sliceDir),y=v-A,n.Series.useExplicitOrdering?this.sliceSense=!1:this.isMosaic?this.sliceSense=!0:this.isMultiFrame?(T=m[0].getSliceLocationVector(),T!==null?(E=m[0].getOrientation(),E.charAt(2)==="Z"?this.sliceSense=T[0]-T[T.length-1]<0:this.sliceSense=T[0]-T[T.length-1]>0):this.sliceSense=!(A<0)):this.sliceDir===n.Image.SLICE_DIRECTION_SAGITTAL||this.sliceDir===n.Image.SLICE_DIRECTION_CORONAL?y>0?this.sliceSense=!1:this.sliceSense=!0:y>0?this.sliceSense=!0:this.sliceSense=!1,this.imagesOriginalOrder=this.images,this.images=m},n.Series.prototype.concatenateImageData=function(s,u){var f,m,A;this.isMosaic?m=this.getMosaicData(this.images[0],this.images[0].getPixelDataBytes()):m=this.images[0].getPixelDataBytes(),A=this.validatePixelDataLength(this.images[0]),this.images[0].clearPixelData(),f=new Uint8Array(new ArrayBuffer(A*this.images.length)),f.set(new Uint8Array(m,0,A),0),setTimeout(n.Utils.bind(this,function(){this.concatenateNextImageData(f,A,s,1,u)}),0)},n.Series.prototype.concatenateNextImageData=function(s,u,f,m,A){var v,y;m>=this.images.length?(f&&f.drawProgress(1,"Reading DICOM Images"),A(s.buffer)):(f&&f.drawProgress(m/this.images.length,"Reading DICOM Images"),this.isMosaic?v=this.getMosaicData(this.images[m],this.images[m].getPixelDataBytes()):v=this.images[m].getPixelDataBytes(),y=this.validatePixelDataLength(this.images[m]),this.images[m].clearPixelData(),s.set(new Uint8Array(v,0,y),u*m),setTimeout(n.Utils.bind(this,function(){this.concatenateNextImageData(s,u,f,m+1,A)}),0))},n.Series.prototype.validatePixelDataLength=function(s){var u=s.getPixelDataBytes().byteLength,f=s.getCols()*s.getRows();return u%f===0?u:f*s.getNumberOfFrames()*s.getNumberOfSamplesPerPixel()*(s.getBitsAllocated()/8)},n.Series.prototype.getMosaicData=function(s,u){var f,m,A,v,y,T,E,S,I,e,F,M,L,V,B,z,b,W=0;for(E=parseInt(this.images[0].getBitsAllocated()/8),F=this.images[0].getMosaicCols()*this.images[0].getMosaicRows(),M=parseInt(this.images[0].getRows()/this.images[0].getMosaicRows()),L=parseInt(this.images[0].getCols()/this.images[0].getMosaicCols()),f=this.images[0].getCols(),m=this.images[0].getRows(),A=this.images[0].getMosaicRows(),v=this.images[0].getMosaicCols(),y=parseInt(m/A),T=parseInt(f/v),V=new Uint8Array(new ArrayBuffer(F*M*L*E)),B=new Uint8Array(u),S=0;Sn in a?__defProp(a,n,{enumerable:!0,configurable:!0,writable:!0,value:s}):a[n]=s,__export=(a,n)=>{for(var s in n)__defProp(a,s,{get:n[s],enumerable:!0})},__publicField=(a,n,s)=>(__defNormalProp(a,typeof n!="symbol"?n+"":n,s),s),version$1="0.43.0",_Log=class ci{constructor({name:n="niivue",level:s="info"}={}){__publicField(this,"level"),__publicField(this,"name"),this.name=`${n}`,this.level=s}debug(...n){ci.levels[this.level]>ci.levels.debug||console.debug(`${this.name}-debug`,...n)}info(...n){ci.levels[this.level]>ci.levels.info||console.info(`${this.name}-info`,...n)}warn(...n){ci.levels[this.level]>ci.levels.warn||console.warn(`${this.name}-warn`,...n)}error(...n){ci.levels[this.level]>ci.levels.error||console.error(`${this.name}-error`,...n)}fatal(...n){ci.levels[this.level]>ci.levels.fatal||console.error(`${this.name}-fatal`,...n)}setLogLevel(n){this.level=n}setName(n){this.name=n}};__publicField(_Log,"levels",{debug:0,info:1,warn:2,error:3,fatal:4,silent:1/0});var Log$1=_Log,log$4=new Log$1({name:"niivue",level:"info"}),compileShader=function(a,n,s){const u=a.createShader(a.VERTEX_SHADER);if(u===null)throw new Error("could not create vertex shader");if(a.shaderSource(u,n),a.compileShader(u),!a.getShaderParameter(u,a.COMPILE_STATUS))throw log$4.error(a.getShaderInfoLog(u)),new Error("Vertex shader failed to compile, see console for log");const f=a.createShader(a.FRAGMENT_SHADER);if(f===null)throw new Error("could not create fragment shader");if(a.shaderSource(f,s),a.compileShader(f),!a.getShaderParameter(f,a.COMPILE_STATUS))throw log$4.error(a.getShaderInfoLog(f)),new Error("Fragment shader failed to compile, see console for log");const m=a.createProgram();if(m===null)throw new Error("could not create GL program");if(a.attachShader(m,u),a.attachShader(m,f),a.linkProgram(m),!a.getProgramParameter(m,a.LINK_STATUS))throw log$4.error(a.getProgramInfoLog(m)),new Error("Shader failed to link, see console for log");return m},Shader=class{constructor(a,n,s){__publicField(this,"program"),__publicField(this,"uniforms",{}),__publicField(this,"isMatcap"),this.program=compileShader(a,n,s);const u=/uniform[^;]+[ ](\w+);/g,f=/uniform[^;]+[ ](\w+);/,m=n.match(u),A=s.match(u);m&&m.forEach(v=>{const y=v.match(f);this.uniforms[y[1]]=-1}),A&&A.forEach(v=>{const y=v.match(f);this.uniforms[y[1]]=-1});for(const v in this.uniforms)this.uniforms[v]=a.getUniformLocation(this.program,v)}use(a){a.useProgram(this.program)}},vertRenderShader=`#version 300 es #line 4 layout(location=0) in vec3 pos; @@ -1601,17 +1601,17 @@ void main(void) { gradientSample.rgb = normalize(gradientSample.rgb); gradientSample.rgb = (gradientSample.rgb * 0.5)+0.5; FragColor = gradientSample; -}`,orientCube=new Float32Array([-1,-1,-1,.28,.28,.28,-1,-1,-1,.28,.28,.28,-1,1,-1,.28,.28,.28,1,-1,-1,.28,.28,.28,1,1,-1,.28,.28,.28,1,1,-1,.28,.28,.28,-1,-1,1,.8,.8,.8,-1,-1,1,.8,.8,.8,1,-1,1,.8,.8,.8,-1,1,1,.8,.8,.8,1,1,1,.8,.8,.8,1,1,1,.8,.8,.8,-1,1,-1,0,0,.74,-1,1,-1,0,0,.74,-1,1,1,0,0,.74,1,1,-1,0,0,.74,1,1,1,0,0,.74,1,1,1,0,0,.74,-1,-1,-1,.42,0,.42,-1,-1,-1,.42,0,.42,1,-1,-1,.42,0,.42,-1,-1,1,.42,0,.42,1,-1,1,.42,0,.42,1,-1,1,.42,0,.42,-1,-1,-1,.64,0,0,-1,-1,-1,.64,0,0,-1,-1,1,.64,0,0,-1,1,-1,.64,0,0,-1,1,1,.64,0,0,-1,1,1,.64,0,0,1,-1,-1,0,.5,0,1,-1,-1,0,.5,0,1,1,-1,0,.5,0,1,-1,1,0,.5,0,1,1,1,0,.5,0,1,1,1,0,.5,0,-.45,1,-.8,0,0,0,-.45,1,-.8,0,0,0,-.45,1,.8,0,0,0,-.25,1,-.8,0,0,0,-.25,1,.8,0,0,0,-.25,1,.8,0,0,0,-.25,1,.6,0,0,0,-.25,1,.6,0,0,0,-.25,1,.8,0,0,0,.45,1,.6,0,0,0,.25,1,.8,0,0,0,.25,1,.8,0,0,0,.25,1,.1,0,0,0,.25,1,.1,0,0,0,.25,1,.6,0,0,0,.45,1,.1,0,0,0,.45,1,.6,0,0,0,.45,1,.6,0,0,0,-.25,1,-.1,0,0,0,-.25,1,-.1,0,0,0,-.25,1,.1,0,0,0,.25,1,-.1,0,0,0,.45,1,.1,0,0,0,.45,1,.1,0,0,0,.45,-1,-.8,0,0,0,.45,-1,-.8,0,0,0,.05,-1,.8,0,0,0,.25,-1,-.8,0,0,0,-.15,-1,.8,0,0,0,-.15,-1,.8,0,0,0,-.25,-1,-.8,0,0,0,-.25,-1,-.8,0,0,0,.05,-1,.8,0,0,0,-.45,-1,-.8,0,0,0,-.15,-1,.8,0,0,0,-.15,-1,.8,0,0,0,.13,-1,-.3,0,0,0,.13,-1,-.3,0,0,0,.07,-1,-.1,0,0,0,-.33,-1,-.3,0,0,0,-.27,-1,-.1,0,0,0,-.27,-1,-.1,0,0,0,-.45,.6,1,0,0,0,-.45,.6,1,0,0,0,-.45,.4,1,0,0,0,-.25,.8,1,0,0,0,-.25,.4,1,0,0,0,-.25,.4,1,0,0,0,-.25,.8,1,0,0,0,-.25,.8,1,0,0,0,-.25,.6,1,0,0,0,.25,.8,1,0,0,0,.45,.6,1,0,0,0,.45,.6,1,0,0,0,.25,.8,1,0,0,0,.25,.8,1,0,0,0,.25,-.1,1,0,0,0,.45,.6,1,0,0,0,.45,.1,1,0,0,0,.45,.1,1,0,0,0,-.25,.1,1,0,0,0,-.25,.1,1,0,0,0,-.45,-.1,1,0,0,0,.25,.1,1,0,0,0,.25,-.1,1,0,0,0,.25,-.1,1,0,0,0,-.45,-.1,1,0,0,0,-.45,-.1,1,0,0,0,-.45,-.6,1,0,0,0,-.25,-.1,1,0,0,0,-.25,-.8,1,0,0,0,-.25,-.8,1,0,0,0,-.25,-.6,1,0,0,0,-.25,-.6,1,0,0,0,-.25,-.8,1,0,0,0,.45,-.6,1,0,0,0,.25,-.8,1,0,0,0,.25,-.8,1,0,0,0,.25,-.4,1,0,0,0,.25,-.4,1,0,0,0,.25,-.6,1,0,0,0,.45,-.4,1,0,0,0,.45,-.6,1,0,0,0,.45,-.6,1,0,0,0,-.1,-.8,-1,0,0,0,-.1,-.8,-1,0,0,0,-.1,.8,-1,0,0,0,.1,-.8,-1,0,0,0,.1,.8,-1,0,0,0,.1,.8,-1,0,0,0,-1,-.45,-.8,0,0,0,-1,-.45,-.8,0,0,0,-1,-.45,.8,0,0,0,-1,-.25,-.8,0,0,0,-1,-.25,.8,0,0,0,-1,-.25,.8,0,0,0,-1,-.25,-.8,0,0,0,-1,-.25,-.8,0,0,0,-1,-.25,-.6,0,0,0,-1,.45,-.8,0,0,0,-1,.45,-.6,0,0,0,-1,.45,-.6,0,0,0,1,.45,-.8,0,0,0,1,.45,-.8,0,0,0,1,.45,.8,0,0,0,1,.25,-.8,0,0,0,1,.25,.8,0,0,0,1,.25,.8,0,0,0,1,.25,.6,0,0,0,1,.25,.6,0,0,0,1,.25,.8,0,0,0,1,-.45,.6,0,0,0,1,-.25,.8,0,0,0,1,-.25,.8,0,0,0,1,-.25,.1,0,0,0,1,-.25,.1,0,0,0,1,-.25,.6,0,0,0,1,-.45,.1,0,0,0,1,-.45,.6,0,0,0,1,-.45,.6,0,0,0,1,.25,-.1,0,0,0,1,.25,-.1,0,0,0,1,.25,.1,0,0,0,1,-.25,-.1,0,0,0,1,-.45,.1,0,0,0,1,-.45,.1,0,0,0,1,-.25,-.8,0,0,0,1,-.25,-.8,0,0,0,1,-.05,-.1,0,0,0,1,-.45,-.8,0,0,0,1,-.25,-.1,0,0,0,1,-.25,-.1,0,0,0]),_NiivueObject3D=class{constructor(n,s,u,f,m=null,A=null){__publicField(this,"sphereIdx",[]),__publicField(this,"sphereVtx",[]),__publicField(this,"renderShaders",[]),__publicField(this,"isVisible",!0),__publicField(this,"isPickable",!0),__publicField(this,"vertexBuffer"),__publicField(this,"indexCount"),__publicField(this,"indexBuffer"),__publicField(this,"vao"),__publicField(this,"mode"),__publicField(this,"glFlags",0),__publicField(this,"id"),__publicField(this,"colorId"),__publicField(this,"modelMatrix",create$3()),__publicField(this,"scale",[1,1,1]),__publicField(this,"position",[0,0,0]),__publicField(this,"rotation",[0,0,0]),__publicField(this,"rotationRadians",0),__publicField(this,"extentsMin",[]),__publicField(this,"extentsMax",[]),__publicField(this,"furthestVertexFromOrigin"),__publicField(this,"originNegate"),__publicField(this,"fieldOfViewDeObliqueMM"),__publicField(this,"mm"),this.vertexBuffer=s,this.indexCount=f,this.indexBuffer=m,this.vao=A,this.mode=u,this.id=n,this.colorId=[(n>>0&255)/255,(n>>8&255)/255,(n>>16&255)/255,(n>>24&255)/255]}};__publicField(_NiivueObject3D,"BLEND",1);__publicField(_NiivueObject3D,"CULL_FACE",2);__publicField(_NiivueObject3D,"CULL_FRONT",4);__publicField(_NiivueObject3D,"CULL_BACK",8);__publicField(_NiivueObject3D,"ENABLE_DEPTH_TEST",16);__publicField(_NiivueObject3D,"generateCrosshairs",function(a,n,s,u,f,m,A=20,v=0){const y=_NiivueObject3D.generateCrosshairsGeometry(a,s,u,f,m,A,v);return new _NiivueObject3D(n,y.vertexBuffer,a.TRIANGLES,y.indexCount,y.indexBuffer,y.vao)});__publicField(_NiivueObject3D,"generateCrosshairsGeometry",function(a,n,s,u,f,m=20,A=0){const v=[],y=[],T=f*A;if(T<=0){let e=fromValues$2(s[0],n[1],n[2]),F=fromValues$2(u[0],n[1],n[2]);_NiivueObject3D.makeCylinder(v,y,e,F,f,m),e=fromValues$2(n[0],s[1],n[2]),F=fromValues$2(n[0],u[1],n[2]),_NiivueObject3D.makeCylinder(v,y,e,F,f,m),e=fromValues$2(n[0],n[1],s[2]),F=fromValues$2(n[0],n[1],u[2]),_NiivueObject3D.makeCylinder(v,y,e,F,f,m)}else{let e=fromValues$2(s[0],n[1],n[2]),F=fromValues$2(n[0]-T,n[1],n[2]);_NiivueObject3D.makeCylinder(v,y,e,F,f,m,!1),e=fromValues$2(n[0]+T,n[1],n[2]),F=fromValues$2(u[0],n[1],n[2]),_NiivueObject3D.makeCylinder(v,y,e,F,f,m,!1),e=fromValues$2(n[0],s[1],n[2]),F=fromValues$2(n[0],n[1]-T,n[2]),_NiivueObject3D.makeCylinder(v,y,e,F,f,m,!1),e=fromValues$2(n[0],n[1]+T,n[2]),F=fromValues$2(n[0],u[1],n[2]),_NiivueObject3D.makeCylinder(v,y,e,F,f,m,!1),e=fromValues$2(n[0],n[1],s[2]),F=fromValues$2(n[0],n[1],n[2]-T),_NiivueObject3D.makeCylinder(v,y,e,F,f,m,!1),e=fromValues$2(n[0],n[1],n[2]+T),F=fromValues$2(n[0],n[1],u[2]),_NiivueObject3D.makeCylinder(v,y,e,F,f,m,!1)}const E=a.createBuffer();if(E===null)throw new Error("could not instantiate vertex buffer");a.bindBuffer(a.ARRAY_BUFFER,E),a.bufferData(a.ARRAY_BUFFER,new Float32Array(v),a.STATIC_DRAW);const S=a.createBuffer();if(S===null)throw new Error("could not instantiate index buffer");a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,S),a.bufferData(a.ELEMENT_ARRAY_BUFFER,new Uint32Array(y),a.STATIC_DRAW);const I=a.createVertexArray();return a.bindVertexArray(I),a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,S),a.bindBuffer(a.ARRAY_BUFFER,E),a.enableVertexAttribArray(0),a.vertexAttribPointer(0,3,a.FLOAT,!1,0,0),a.bindVertexArray(null),{vertexBuffer:E,indexBuffer:S,indexCount:y.length,vao:I}});__publicField(_NiivueObject3D,"getFirstPerpVector",function(a){const n=fromValues$2(0,0,0);return a[0]===0?n[0]=1:a[1]===0?n[1]=1:a[2]===0?n[2]=1:(n[0]=a[2],n[1]=a[2],n[2]=-(a[0]+a[1]),normalize$1(n,n)),n});__publicField(_NiivueObject3D,"subdivide",function(a,n){let s=a.length/3,u=n.length/3;const f=u,m=create$2(),A=create$2();for(let v=0;vitksnap_default,$slicer3d:()=>slicer3d_default,actc:()=>actc_default,afni_blues_inv:()=>afni_blues_inv_default,afni_reds_inv:()=>afni_reds_inv_default,bcgwhw:()=>bcgwhw_default,bcgwhw_dark:()=>bcgwhw_dark_default,blue:()=>blue_default,blue2cyan:()=>blue2cyan_default,blue2magenta:()=>blue2magenta_default,blue2red:()=>blue2red_default,bluegrn:()=>bluegrn_default,bone:()=>bone_default,bronze:()=>bronze_default,cet_l17:()=>cet_l17_default,cividis:()=>cividis_default,cool:()=>cool_default,copper:()=>copper_default,copper2:()=>copper2_default,ct_airways:()=>ct_airways_default,ct_artery:()=>ct_artery_default,ct_bones:()=>ct_bones_default,ct_brain:()=>ct_brain_default,ct_brain_gray:()=>ct_brain_gray_default,ct_cardiac:()=>ct_cardiac_default,ct_head:()=>ct_head_default,ct_kidneys:()=>ct_kidneys_default,ct_liver:()=>ct_liver_default,ct_muscles:()=>ct_muscles_default,ct_scalp:()=>ct_scalp_default,ct_skull:()=>ct_skull_default,ct_soft:()=>ct_soft_default,ct_soft_tissue:()=>ct_soft_tissue_default,ct_surface:()=>ct_surface_default,ct_vessels:()=>ct_vessels_default,ct_w_contrast:()=>ct_w_contrast_default,cubehelix:()=>cubehelix_default,electric_blue:()=>electric_blue_default,freesurfer:()=>freesurfer_default,ge_color:()=>ge_color_default,gold:()=>gold_default,gray:()=>gray_default,green:()=>green_default,green2cyan:()=>green2cyan_default,green2orange:()=>green2orange_default,hot:()=>hot_default,hotiron:()=>hotiron_default,hsv:()=>hsv_default,inferno:()=>inferno_default,jet:()=>jet_default,linspecer:()=>linspecer_default,magma:()=>magma_default,mako:()=>mako_default,nih:()=>nih_default,plasma:()=>plasma_default,random:()=>random_default,red:()=>red_default,redyell:()=>redyell_default,rocket:()=>rocket_default,roi_i256:()=>roi_i256_default,surface:()=>surface_default,turbo:()=>turbo_default,violet:()=>violet_default,viridis:()=>viridis_default,warm:()=>warm_default,winter:()=>winter_default,x_rain:()=>x_rain_default});var itksnap_default={R:[0,255,0,0,255,0,255,255,0,205,210,102,0,0,46,255,106,221,233,165,255,147,218,75,255,60,255,255,218,0,188,255,255,222,127,139,124,255,70,0,238,238,240,245,184,32,255,25,112,34,248,245,255,144,173,65,255,250,128,50,244,255,123,255,173,255,127,255,143,220,253,255,0,0,128,255,250,148,178,255,135,100,240,250,255,107,135,0,139,245,186,255,255,0,210,255,47,72,175,128,176,255,139,240,255,216,119,219,72,255,199,154,189,240,230,0,85,64,153,205,250,95,0,255,224,176,138,30,240,152,160],G:[0,0,255,0,255,255,0,239,0,133,180,205,0,139,139,228,90,160,150,42,250,112,112,0,182,179,235,228,165,128,143,105,218,184,255,69,252,255,130,100,130,232,255,222,134,178,20,25,128,139,248,255,160,238,255,105,99,240,0,205,164,255,104,165,216,192,255,140,188,20,245,250,206,255,0,250,128,0,34,127,206,149,230,235,245,142,206,0,0,245,85,228,222,191,105,248,79,61,238,128,224,240,0,255,215,191,136,112,209,0,21,205,183,248,230,250,107,224,50,92,250,158,128,69,255,196,43,144,128,251,82],B:[0,0,0,255,0,255,255,213,205,63,140,170,128,139,87,225,205,221,122,42,250,219,214,130,193,113,205,196,32,128,143,180,185,135,0,19,0,224,180,0,238,170,240,179,11,170,147,112,144,34,255,250,122,144,47,225,71,230,0,50,96,240,238,0,230,203,212,0,143,60,230,240,209,127,128,205,114,211,34,80,235,237,140,215,238,35,250,139,139,220,211,181,173,255,30,220,79,139,238,0,230,245,0,255,0,216,153,147,204,255,133,50,107,255,250,154,47,208,204,92,210,160,0,0,255,222,226,255,128,152,45],A:[0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255],I:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130]},slicer3d_default={labels:["background","tissue","bone","skin","connective tissue","blood","organ","mass","muscle","foreign object","waste","teeth","fat","gray matter","white matter","nerve","vein","artery","capillary","ligament","tendon","cartilage","meniscus","lymph node","lymphatic vessel","cerebro-spinal fluid","bile","urine","feces","gas","fluid","edema","bleeding","necrosis","clot","embolism","head","central nervous system","brain","gray matter of brain","telencephalon","cerebral cortex","right frontal lobe","left frontal lobe","right temporal lobe","left temporal lobe","right parietal lobe","left parietal lobe","right occipital lobe","left occipital lobe","right insular lobe","left insular lobe","right limbic lobe","left limbic lobe","right striatum","left striatum","right caudate nucleus","left caudate nucleus","right putamen","left putamen","right pallidum","left pallidum","right amygdaloid complex","left amygdaloid complex","diencephalon","thalamus","right thalamus","left thalamus","pineal gland","midbrain","substantia nigra","right substantia nigra","left substantia nigra","cerebral white matter","right superior longitudinal fasciculus","left superior longitudinal fasciculus","right inferior longitudinal fasciculus","left inferior longitudinal fasciculus","right arcuate fasciculus","left arcuate fasciculus","right uncinate fasciculus","left uncinate fasciculus","right cingulum bundle","left cingulum bundle","projection fibers","right corticospinal tract","left corticospinal tract","right optic radiation","left optic radiation","right medial lemniscus","left medial lemniscus","right superior cerebellar peduncle","left superior cerebellar peduncle","right middle cerebellar peduncle","left middle cerebellar peduncle","right inferior cerebellar peduncle","left inferior cerebellar peduncle","optic chiasm","right optic tract","left optic tract","right fornix","left fornix","commissural fibers","corpus callosum","posterior commissure","cerebellar white matter","CSF space","ventricles of brain","right lateral ventricle","left lateral ventricle","right third ventricle","left third ventricle","cerebral aqueduct","fourth ventricle","subarachnoid space","spinal cord","gray matter of spinal cord","white matter of spinal cord","endocrine system of brain","pituitary gland","adenohypophysis","neurohypophysis","meninges","dura mater","arachnoid","pia mater","muscles of head","salivary glands","lips","nose","tongue","soft palate","right inner ear","left inner ear","right external ear","left external ear","right middle ear","left middle ear","right eyeball","left eyeball","skull","right frontal bone","left frontal bone","right parietal bone","left parietal bone","right temporal bone","left temporal bone","right sphenoid bone","left sphenoid bone","right ethmoid bone","left ethmoid bone","occipital bone","maxilla","right zygomatic bone","right lacrimal bone","vomer bone","right palatine bone","left palatine bone","mandible","neck","muscles of neck","pharynx","larynx","thyroid gland","right parathyroid glands","left parathyroid glands","skeleton of neck","hyoid bone","cervical vertebral column","thorax","trachea","bronchi","right lung","left lung","superior lobe of right lung","superior lobe of left lung","middle lobe of right lung","inferior lobe of right lung","inferior lobe of left lung","pleura","heart","right atrium","left atrium","atrial septum","ventricular septum","right ventricle of heart","left ventricle of heart","mitral valve","tricuspid valve","aortic valve","pulmonary valve","aorta","pericardium","pericardial cavity","esophagus","thymus","mediastinum","skin of thoracic wall","muscles of thoracic wall","skeleton of thorax","thoracic vertebral column","ribs","sternum","right clavicle","left clavicle","abdominal cavity","abdomen","peritoneum","omentum","peritoneal cavity","retroperitoneal space","stomach","duodenum","small bowel","colon","anus","liver","biliary tree","gallbladder","pancreas","spleen","urinary system","right kidney","left kidney","right ureter","left ureter","urinary bladder","urethra","right adrenal gland","left adrenal gland","female internal genitalia","uterus","right fallopian tube","left fallopian tube","right ovary","left ovary","vagina","male internal genitalia","prostate","right seminal vesicle","left seminal vesicle","right deferent duct","left deferent duct","skin of abdominal wall","muscles of abdominal wall","skeleton of abdomen","lumbar vertebral column","female external genitalia","male external genitalia","skeleton of upper limb","muscles of upper limb","right upper limb","left upper limb","right shoulder","left shoulder","right arm"],R:[0,128,241,177,111,216,221,144,192,220,78,255,230,200,250,244,0,216,183,183,152,111,178,68,111,85,0,214,78,218,170,140,188,216,145,150,177,244,250,200,68,128,83,83,162,162,141,141,182,182,188,188,154,154,177,177,30,30,210,210,48,48,98,98,69,166,122,122,253,145,46,0,0,250,127,127,159,159,125,125,106,106,154,154,126,201,201,78,78,174,174,139,139,148,148,186,186,99,156,156,64,64,138,97,126,194,85,88,88,88,88,88,88,88,88,244,200,250,82,57,60,92,255,255,255,255,201,70,188,177,166,182,229,229,174,174,201,201,194,194,241,203,203,229,229,255,255,209,209,248,248,255,196,255,255,255,242,242,222,177,213,184,150,62,62,62,242,250,255,177,182,175,197,197,172,172,202,224,224,255,206,210,203,233,195,181,152,159,166,218,225,224,255,184,211,47,255,173,188,255,226,253,244,205,205,186,177,255,234,204,180,216,255,205,204,255,221,0,139,249,157,203,185,185,247,247,222,124,249,249,244,255,255,227,213,213,193,216,230,245,245,241,241,177,171,217,212,185,185,198,194,177,177,177,177,177],G:[0,174,214,122,184,101,130,238,104,245,63,250,220,200,250,214,151,101,156,214,189,184,212,172,197,188,145,230,63,255,250,224,65,191,60,98,122,214,250,200,131,174,146,146,115,115,93,93,166,166,135,135,150,150,140,140,111,111,157,157,129,129,153,153,110,113,101,101,135,92,101,108,108,250,150,150,116,116,102,102,174,174,146,146,126,160,160,152,152,140,140,126,126,120,120,135,135,106,171,171,123,123,95,113,161,195,188,106,106,106,106,106,106,106,106,214,200,250,174,157,143,162,244,244,244,244,121,163,91,122,84,105,147,147,122,122,112,112,142,142,213,179,179,204,204,243,243,185,185,223,223,230,172,255,250,237,217,217,198,122,124,105,208,162,162,162,206,210,255,122,228,216,165,165,138,138,164,186,186,245,110,115,108,138,100,85,55,63,70,123,130,97,244,122,171,150,244,121,95,239,202,232,217,179,179,124,122,255,234,142,119,132,253,167,168,224,130,145,150,180,108,136,102,102,182,182,154,186,186,186,170,181,190,153,141,141,123,146,158,172,172,172,172,124,85,198,188,135,135,175,98,122,122,122,122,122],B:[0,128,145,101,210,79,101,144,88,20,0,220,70,235,210,49,206,79,220,211,207,210,242,100,131,255,30,130,0,255,250,228,28,216,66,83,101,49,225,215,98,128,164,164,105,105,137,137,110,110,166,166,201,201,190,190,85,85,166,166,126,126,112,112,53,137,38,38,192,109,131,112,112,225,88,88,163,163,154,154,155,155,83,83,55,133,133,141,141,103,103,177,177,72,72,135,135,24,108,108,147,147,74,158,197,164,255,215,215,215,215,215,215,215,215,49,215,225,128,110,83,109,209,209,209,209,77,117,95,101,94,107,118,118,90,90,73,73,0,0,144,77,77,109,109,152,152,85,85,131,131,138,68,167,160,145,123,123,101,101,109,108,243,114,114,114,142,139,207,101,255,244,145,145,115,115,140,162,162,217,84,89,81,112,73,57,13,27,38,97,104,76,209,154,143,103,209,88,76,172,134,158,154,108,108,161,101,220,194,178,153,105,229,142,143,199,101,30,98,111,162,116,83,83,164,164,132,223,150,150,147,158,165,130,113,113,103,127,140,147,147,151,151,92,68,131,102,134,134,125,79,101,101,101,101,101],A:[0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255],I:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255]},actc_default={R:[0,0,24,248,255],G:[0,0,177,254,0],B:[0,136,0,0,0],A:[0,32,64,78,128],I:[0,64,128,156,255]},bcgwhw_dark_default={R:[0,248,242,235,229,222,212,202,193,183,173,145,117,78,39,0,0,0,0,0,0,64,128,191,255,255,255,255,255,238,221,204,214,224,235,245,255,249,242,236,229,223,217,210,204,197,191,184,176,169,161,154,146,139,132,124,117,109,102,0],G:[0,251,247,243,239,235,235,235,235,235,235,216,197,174,150,127,153,178,204,229,255,255,255,255,255,220,185,150,115,77,38,0,31,61,92,122,153,138,122,107,92,77,61,46,31,15,0,0,0,0,0,0,0,0,0,0,0,0,0,0],B:[0,254,253,252,251,250,251,252,253,254,255,226,198,132,66,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,40,80,120,160,200,199,198,197,196,196,195,194,193,192,191,184,176,169,161,154,146,139,132,124,117,109,102,0],A:[256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256],I:[0,4,8,12,16,20,24,28,32,36,40,44,48,52,56,60,64,68,72,76,80,84,88,92,96,100,104,108,112,116,120,124,128,132,136,140,144,148,152,156,160,164,168,172,176,180,184,188,192,196,200,204,208,212,216,220,224,228,232,236,240,244,248,255]},bcgwhw_default={R:[255,248,242,235,229,222,212,202,193,183,173,145,117,78,39,0,0,0,0,0,0,64,128,191,255,255,255,255,255,238,221,204,214,224,235,245,255,249,242,236,229,223,217,210,204,197,191,184,176,169,161,154,146,139,132,124,117,109,102,0],G:[255,251,247,243,239,235,235,235,235,235,235,216,197,174,150,127,153,178,204,229,255,255,255,255,255,220,185,150,115,77,38,0,31,61,92,122,153,138,122,107,92,77,61,46,31,15,0,0,0,0,0,0,0,0,0,0,0,0,0,0],B:[255,254,253,252,251,250,251,252,253,254,255,226,198,132,66,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,40,80,120,160,200,199,198,197,196,196,195,194,193,192,191,184,176,169,161,154,146,139,132,124,117,109,102,0],A:[256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256],I:[0,4,8,12,16,20,24,28,32,36,40,44,48,52,56,60,64,68,72,76,80,84,88,92,96,100,104,108,112,116,120,124,128,132,136,140,144,148,152,156,160,164,168,172,176,180,184,188,192,196,200,204,208,212,216,220,224,228,232,236,240,244,248,255]},blue2red_default={R:[0,0,0,0,196,255],G:[0,32,128,128,128,32],B:[0,255,196,0,0,0],A:[0,128,64,64,64,128],I:[0,1,64,128,192,255]},blue2magenta_default={R:[0,255],G:[0,0],B:[255,255],A:[0,128],I:[0,255]},blue2cyan_default={R:[0,0],G:[0,255],B:[255,255],A:[0,128],I:[0,255]},bluegrn_default={R:[0,0,0,0],G:[0,1,128,255],B:[0,222,127,32],A:[0,0,64,128],I:[0,1,128,255]},blue_default={R:[0,0,0],G:[0,0,0],B:[0,128,255],A:[0,64,128],I:[0,128,255]},bone_default={R:[0,103,255],G:[0,126,255],B:[0,165,255],A:[0,76,128],I:[0,153,255]},bronze_default={R:[0,43,103,199,216,255],G:[0,0,37,155,213,255],B:[0,0,20,97,201,255],A:[0,44,48,54,56,56],I:[0,64,128,196,240,255]},cet_l17_default={R:[0,9,24,33,40,46,52,57,62,66,70,74,78,81,85,88,91,94,98,101,103,106,109,112,114,117,119,121,124,126,128,130,133,135,137,139,141,143,145,147,149,151,153,155,157,159,161,163,164,166,168,169,171,172,174,175,177,178,180,181,183,184,186,187,189,190,191,193,194,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,222,223,224,224,225,226,226,227,228,228,229,229,230,231,231,232,233,233,234,234,235,235,236,236,236,237,237,237,238,238,238,239,239,239,240,240,240,241,241,241,242,242,242,243,243,243,243,243,243,243,243,244,244,244,244,244,244,244,244,244,244,244,245,245,245,245,245,245,245,245,245,245,245,245,245,245,245,245,244,244,244,244,244,244,244,244,244,244,244,244,244,244,244,243,243,243,243,243,243,243,243,243,243,243,243,242,242,242,242,242,242,242,242,241,242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,243,243,244,244,245,246,246,247,247,248,249,249,250,250,251,251,252,252,253,253,254,254,254],G:[42,41,41,41,40,40,40,39,39,39,38,38,37,37,36,36,35,35,34,34,33,32,32,31,30,30,30,30,29,29,29,29,28,28,28,27,27,27,26,26,26,25,25,25,24,24,24,24,24,25,25,26,27,27,28,28,29,30,30,31,31,32,33,33,34,34,35,36,36,37,38,39,40,42,43,44,45,47,48,49,50,51,53,54,55,56,57,58,59,60,62,63,64,65,66,68,69,71,72,73,75,76,77,79,80,81,83,84,85,87,88,89,90,92,93,94,95,97,98,100,101,102,104,105,107,108,109,111,112,113,115,116,117,119,120,121,122,124,125,126,128,129,130,132,133,134,136,137,138,140,141,142,144,145,146,147,149,150,151,153,154,155,156,158,159,160,161,163,164,165,167,168,169,170,172,173,174,175,176,178,179,180,181,183,184,185,186,187,189,190,191,192,193,194,196,197,198,199,200,201,203,204,205,206,207,208,209,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,228,229,230,231,232,233,234,235,236,237,238,238,239,240,241,241,242,243,244,244,245,246,247,248,248,249,250,251,251,252,253,254,255],B:[167,167,166,166,166,165,165,165,164,164,164,163,163,162,162,162,161,161,161,160,160,160,159,159,158,158,157,157,156,155,155,154,154,153,153,152,151,151,150,150,149,149,148,147,147,146,146,145,144,144,143,143,142,141,141,140,139,139,138,137,137,136,135,135,134,133,133,132,131,131,130,130,129,128,128,127,127,126,125,125,124,124,123,123,122,121,121,120,119,119,118,118,117,116,116,116,115,115,114,114,113,113,113,112,112,111,111,110,110,109,109,109,108,108,107,107,106,106,106,106,106,105,105,105,105,105,105,105,104,104,104,104,104,103,103,103,103,103,102,102,102,103,103,103,103,104,104,104,104,104,105,105,105,105,106,106,106,106,106,107,107,107,107,108,108,109,110,111,111,112,113,113,114,115,115,116,117,117,118,119,120,120,121,122,122,123,124,125,126,128,129,130,131,132,134,135,136,137,138,140,141,142,143,144,146,147,148,149,150,152,153,155,157,158,160,162,163,165,167,168,170,172,173,175,177,178,180,182,183,185,187,188,190,193,196,199,201,204,207,210,212,215,218,221,224,226,229,232,235,238,240,243,246,249,252,255],A:[0,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64],I:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255]},cividis_default={R:[0,86,166,255],G:[32,92,156,233],B:[76,108,117,69],A:[0,56,80,88],I:[0,64,192,255]},cool_default={R:[0,0,0],G:[127,196,254],B:[255,255,255],A:[0,64,128],I:[0,128,255]},copper2_default={R:[0,61,122,183,244,255],G:[0,41,81,122,163,255],B:[0,25,51,76,102,255],A:[0,25,51,71,102,128],I:[0,51,102,153,204,255]},copper_default={R:[0,61,122,183,244,255],G:[0,41,81,122,163,203],B:[0,25,51,76,102,127],A:[0,25,51,71,102,128],I:[0,51,102,153,204,255]},ct_airways_default={min:-643,max:-235,R:[0,0,0],G:[154,154,154],B:[179,179,101],A:[0,32,0],I:[0,163,255]},ct_artery_default={min:114,max:800,R:[0,255,255,255],G:[0,0,129,255],B:[0,0,0,255],A:[0,64,88,228],I:[0,80,160,255]},ct_bones_default={min:180,max:600,R:[0,0,113,255],G:[0,0,109,250],B:[0,0,101,245],A:[0,0,100,160],I:[0,1,128,255]},ct_brain_gray_default={min:-10,max:110,R:[0,127,255],G:[0,127,255],B:[0,127,255],A:[0,48,128],I:[0,124,255]},ct_brain_default={min:-10,max:110,R:[0,199,255],G:[0,127,255],B:[0,127,255],A:[0,48,128],I:[0,124,255]},ct_cardiac_default={min:-80,max:1e3,R:[0,189,150,150,150,150,255],G:[0,169,54,54,54,54,240],B:[0,153,52,52,52,52,242],A:[0,32,64,0,0,64,64],I:[0,1,82,92,234,242,255]},ct_head_default={min:-590,max:600,R:[0,241,241,248,248,178,178,232,255,255,255],G:[0,156,156,222,222,36,36,51,255,255,255],B:[0,130,130,169,169,24,24,37,255,255,255],A:[0,8,0,0,0,64,64,0,0,222,222],I:[0,2,3,64,122,142,172,182,252,253,255]},ct_kidneys_default={min:114,max:302,R:[0,255,255],G:[0,129,255],B:[0,0,255],A:[0,88,228],I:[0,103,255]},ct_liver_default={min:-23,max:246,R:[0,44,255,255,255],G:[0,128,90,255,255],B:[0,0,70,0,255],A:[0,0,82,184,228],I:[0,64,131,196,255]},ct_muscles_default={min:-100,max:246,R:[0,128,159,255,255,255,255],G:[0,0,56,90,0,255,255],B:[0,0,41,70,0,0,255],A:[0,63,105,135,167,184,228],I:[0,100,128,155,180,209,255]},ct_scalp_default={min:-590,max:600,R:[0,241,241,248,248,178,232,255,255],G:[0,156,156,222,222,36,51,255,255],B:[0,130,130,169,169,24,37,255,255],A:[0,63,105,135,167,184,228,228,228],I:[0,1,52,127,137,162,172,252,255]},ct_skull_default={min:140,max:1024,R:[0,2,113,255],G:[0,1,109,250],B:[0,1,101,245],A:[0,1,96,168],I:[0,1,128,255]},ct_soft_default={min:-923,max:679,R:[0,0,0,0,0,255,255,255],G:[154,154,154,154,0,0,254,255],B:[179,179,179,179,0,0,0,255],A:[0,3,8,0,0,10,15,20],I:[0,30,62,88,170,200,232,255]},ct_soft_tissue_default={min:-10,max:110,R:[0,199,255],G:[0,127,255],B:[0,127,255],A:[0,48,128],I:[0,124,255]},ct_surface_default={min:-600,max:100,R:[0,134,255],G:[0,109,250],B:[0,101,245],A:[0,60,148],I:[0,128,255]},ct_vessels_default={min:114,max:246,R:[0,255,255],G:[0,128,255],B:[0,128,255],A:[0,64,96],I:[0,87,255]},ct_w_contrast_default={min:50,max:1e3,R:[98,210,169,128,255],G:[94,26,77,128,255],B:[45,21,74,128,255],A:[0,25,0,4,168],I:[0,41,87,154,255]},cubehelix_default={R:[0,13,21,26,27,25,22,21,22,28,39,54,75,98,124,148,171,189,202,210,213,211,206,200,195,193,195,201,211,225,240,255],G:[0,5,11,20,31,44,58,72,86,99,109,116,120,122,122,122,121,121,124,129,137,147,161,175,190,205,218,229,238,245,251,255],B:[0,14,30,46,61,71,77,78,75,68,60,52,48,47,53,65,83,105,131,157,183,205,222,235,241,243,242,240,239,240,245,255],A:[0,4,8,12,17,21,25,29,33,37,41,45,50,54,58,62,66,70,74,78,83,87,91,95,99,103,107,111,116,120,124,128],I:[0,8,16,25,33,41,49,58,66,74,82,90,99,107,115,123,132,140,148,156,165,173,181,189,197,206,214,222,230,239,247,255]},electric_blue_default={R:[0,10,136,255],G:[0,39,220,255],B:[0,223,253,255],A:[0,48,64,70],I:[0,92,192,255]},freesurfer_default={R:[0,245,205,120,196,220,230,0,122,236,12,204,42,119,220,103,60,255,165,160,0,245,205,120,196,220,230,0,122,236,13,220,103,255,165,160,0,120,200,255,255,164,164,164,234,0,0,0,0,0],G:[0,245,62,18,58,248,148,118,186,13,48,182,204,159,216,255,60,165,42,32,200,245,62,18,58,248,148,118,186,13,48,216,255,165,42,32,200,190,70,148,148,108,108,108,169,0,0,0,0,0],B:[0,245,78,134,250,164,34,14,220,176,255,142,164,176,20,255,60,0,42,240,200,245,78,134,250,164,34,14,220,176,255,20,255,0,42,240,221,150,255,10,10,226,226,226,30,64,112,160,208,255],A:[0,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64],I:[0,2,3,4,5,7,8,10,11,12,13,14,15,16,17,18,24,26,28,30,31,41,42,43,44,46,47,49,50,51,52,53,54,58,60,62,63,72,77,78,79,80,81,82,85,251,252,253,254,255]},ge_color_default={R:[0,0,128,255,255],G:[0,128,0,128,255],B:[0,125,255,0,255],A:[0,32,64,96,128],I:[0,63,128,192,255]},gold_default={R:[0,142,227,255],G:[0,85,170,255],B:[0,14,76,255],A:[0,42,84,128],I:[0,85,170,255]},gray_default={R:[0,255],G:[0,255],B:[0,255],A:[0,128],I:[0,255]},green_default={R:[0,0,0],G:[0,128,255],B:[0,0,0],A:[0,64,128],I:[0,128,255]},green2cyan_default={R:[0,0,0],G:[72,72,255],B:[0,255,255],A:[0,64,128],I:[0,88,255]},green2orange_default={R:[0,255,255],G:[72,88,255],B:[0,0,0],A:[0,64,128],I:[0,88,255]},hotiron_default={R:[0,255,255,255],G:[0,0,126,255],B:[0,0,0,255],A:[0,64,96,128],I:[0,128,191,255]},hot_default={R:[3,255,255,255],G:[0,0,255,255],B:[0,0,0,255],A:[0,48,96,128],I:[0,95,191,255]},hsv_default={R:[255,255,0,0,0,255,255],G:[0,255,255,255,0,0,0],B:[0,0,0,255,255,255,0],A:[0,14,28,43,57,71,85],I:[0,43,85,128,170,213,255]},inferno_default={R:[0,120,237,240],G:[0,28,105,249],B:[4,109,37,33],A:[0,56,80,88],I:[0,64,192,255]},jet_default={R:[0,0,127,255,127],G:[0,127,255,127,0],B:[127,255,127,0,0],A:[0,32,64,96,128],I:[0,63,128,192,255]},linspecer_default={R:[94,50,90,152,215,238,249,254,252,241,209,158],G:[79,131,186,214,240,244,237,210,157,100,57,1],B:[162,189,167,164,155,169,168,123,86,68,79,66],A:[0,12,23,35,47,58,70,81,93,105,116,128],I:[0,23,46,70,93,116,139,162,185,209,232,255]},magma_default={R:[0,148,183,223,247,252],G:[0,44,55,74,112,253],B:[4,128,121,104,92,191],A:[0,44,53,64,75,107],I:[0,107,128,154,179,255]},mako_default={R:[11,59,55,222],G:[4,45,165,245],B:[5,91,172,229],A:[0,23,70,107],I:[0,56,167,255]},nih_default={R:[0,85,0,0,0,0,0,0,85,255,255,255,172],G:[0,0,0,0,85,170,255,255,255,255,85,0,0],B:[0,170,85,255,255,170,170,0,85,0,0,0,0],A:[0,5,10,21,26,32,37,42,48,53,64,72,85],I:[0,15,31,63,79,95,111,127,143,159,191,217,255]},plasma_default={R:[13,156,237,240],G:[8,23,121,249],B:[135,158,83,33],A:[0,56,80,88],I:[0,64,192,255]},random_default={R:[208,71,33,192,32,195,208,173,233,202,25,210,145,89,87,245,246,38,3,25,57,167,245,86,227,208,81,64,90,199,140,48,212,180,70,120,9,192,245,177,65,157,9,193,100,181,125,145,62,8,108,36,140,237,242,248,161,189,41,114,65,121,97,50,238,149,44,214,124,167,40,167,127,178,231,30,173,244,193,203,204,238,139,135,71,234,234,217,66,14,129,19,97,165,112,244,35,73,192,12,149,71,33,192,32,195,208,173,233,202,25,210,145,89,87,245,246,38,3,25,57,167,245,86,227,208,81,64,90,199,140,48,212,180,70,120,9,192,245,177,65,157,9,193,100,181,125,145,62,8,108,36,140,237,242,248,161,189,41,114,65,121,97,50,238,149,44,214,124,167,40,167,127,178,231,30,173,244,193,203,204,238,139,135,71,234,234,217,66,14,129,19,97,165,112,244,35,73,192,12,149,71,33,192,32,195,208,173,233,202,25,210,145,89,87,245,246,38,3,25,57,167,245,86,227,208,81,64,90,199,140,48,212,180,70,120,9,192,245,177,65,157,9,193,100,181,125,145,62,8,108,36,140,237,242,248],G:[182,46,78,199,79,89,41,208,135,20,154,35,21,43,230,113,191,147,208,37,28,27,86,203,25,209,148,187,139,111,48,102,76,110,106,130,37,160,34,222,90,165,245,222,102,47,19,130,4,232,137,211,240,11,140,21,42,22,241,61,99,115,199,166,114,190,204,60,233,66,115,230,125,103,203,125,13,176,94,131,39,198,167,124,67,175,254,1,15,198,62,237,159,31,218,58,244,47,61,67,94,46,78,199,79,89,41,208,135,20,154,35,21,43,230,113,191,147,208,37,28,27,86,203,25,209,148,187,139,111,48,102,76,110,106,130,37,160,34,222,90,165,245,222,102,47,19,130,4,232,137,211,240,11,140,21,42,22,241,61,99,115,199,166,114,190,204,60,233,66,115,230,125,103,203,125,13,176,94,131,39,198,167,124,67,175,254,1,15,198,62,237,159,31,218,58,244,47,61,67,94,46,78,199,79,89,41,208,135,20,154,35,21,43,230,113,191,147,208,37,28,27,86,203,25,209,148,187,139,111,48,102,76,110,106,130,37,160,34,222,90,165,245,222,102,47,19,130,4,232,137,211,240,11,140,21],B:[191,154,43,10,207,204,164,231,136,58,239,30,147,230,101,111,150,35,128,57,252,79,173,120,25,126,81,85,8,7,122,237,190,152,246,182,130,219,67,76,167,178,235,250,28,61,186,250,199,67,58,50,86,182,108,77,89,112,59,125,226,50,205,227,125,128,104,27,59,66,53,133,159,203,97,125,139,159,158,7,215,47,140,226,223,231,44,110,184,61,233,47,67,148,22,120,173,156,117,181,94,154,43,10,207,204,164,231,136,58,239,30,147,230,101,111,150,35,128,57,252,79,173,120,25,126,81,85,8,7,122,237,190,152,246,182,130,219,67,76,167,178,235,250,28,61,186,250,199,67,58,50,86,182,108,77,89,112,59,125,226,50,205,227,125,128,104,27,59,66,53,133,159,203,97,125,139,159,158,7,215,47,140,226,223,231,44,110,184,61,233,47,67,148,22,120,173,156,117,181,94,154,43,10,207,204,164,231,136,58,239,30,147,230,101,111,150,35,128,57,252,79,173,120,25,126,81,85,8,7,122,237,190,152,246,182,130,219,67,76,167,178,235,250,28,61,186,250,199,67,58,50,86,182,108,77],A:[0,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64],I:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255]},red_default={R:[0,128,255],G:[0,0,0],B:[0,0,0],A:[0,64,128],I:[0,128,255]},redyell_default={R:[192,224,255],G:[1,128,255],B:[0,0,0],A:[0,64,128],I:[0,128,255]},rocket_default={R:[3,112,144,188,236,246,255],G:[5,31,29,22,76,158,250],B:[26,87,91,86,62,117,235],A:[0,30,38,49,67,85,107],I:[0,73,92,118,160,205,255]},surface_default={R:[1,240,255],G:[1,128,255],B:[1,128,255],A:[0,76,128],I:[0,153,255]},turbo_default={R:[48,48,64,70,65,25,132,195,244,254,218,122],G:[18,18,64,107,150,226,255,241,199,158,57,4],B:[59,59,162,227,255,187,81,52,58,47,7,3],A:[0,22,26,30,34,43,52,57,63,67,77,86],I:[0,1,16,32,49,83,118,140,164,181,219,255]},violet_default={R:[0,128,255],G:[0,0,0],B:[0,128,255],A:[0,64,128],I:[0,128,255]},viridis_default={R:[68,49,53,253],G:[1,104,183,231],B:[84,142,121,37],A:[0,56,80,88],I:[0,64,192,255]},warm_default={R:[255,255,255],G:[127,196,254],B:[0,0,0],A:[0,64,128],I:[0,128,255]},winter_default={R:[0,0,0],G:[0,128,255],B:[255,196,128],A:[0,64,128],I:[0,128,255]},x_rain_default={R:[3,64,0,0,255,255,255],G:[0,0,0,255,255,192,3],B:[0,32,48,56,64,96,128],A:[0,8,16,24,32,52,80],I:[0,32,64,96,160,192,255]},afni_blues_inv_default={min:0,max:0,R:[0,37],G:[242,0],B:[255,255],A:[0,64],I:[0,255]},afni_reds_inv_default={R:[255,255],G:[255,11],B:[0,0],A:[0,64],I:[0,255]},roi_i256_default={min:0,max:0,R:[65,10,223,120,216,207,251,93,252,217,21,253,131,165,173,143,144,217,86,89,63,254,172,1,142,107,42,78,221,8,222,71,127,126,167,33,104,2,208,216,0,251,7,105,2,101,248,190,253,62,255,224,166,37,110,138,45,34,6,37,69,201,43,122,199,37,173,194,103,211,75,159,96,4,239,98,110,193,253,166,40,255,48,130,140,243,101,9,177,220,133,32,4,81,48,48,210,109,60,132,1,119,1,159,247,33,212,187,253,144,196,254,168,79,64,196,39,97,73,173,104,216,217,43,101,119,254,5,237,103,203,122,57,87,251,164,19,75,200,2,252,150,66,0,255,157,23,254,55,16,240,161,69,253,207,195,5,60,255,251,200,217,134,123,253,180,27,246,130,136,250,232,4,125,140,22,253,255,13,180,123,61,254,111,10,185,76,192,255,223,186,61,198,5,172,13,83,172,171,6,23,73,134,133,109,61,213,55,57,132,36,209,2,144,1,253,68,155,3,160,2,77,121,70,67,176,223,131,4,162,232,255,150,94,235,191,207,10,246,0,225,4,209,116,57,112,172,253,1,6,92,227,73,62,135,223],G:[162,50,112,245,4,124,176,243,56,125,183,139,182,68,189,4,225,10,20,223,7,46,31,193,225,250,219,41,2,100,83,181,34,150,72,223,168,248,80,253,7,117,214,2,248,10,3,59,179,160,90,244,146,4,207,4,125,255,96,100,1,208,130,51,116,181,236,53,244,5,165,28,181,86,96,42,254,1,134,194,214,92,41,204,137,86,207,3,143,3,100,239,164,94,65,251,131,244,173,57,143,107,217,53,210,0,148,250,45,198,81,40,61,218,252,88,171,0,248,24,248,4,41,100,187,46,208,145,43,168,121,46,175,250,125,107,233,112,207,231,174,215,53,9,43,153,52,124,128,65,210,147,255,147,63,200,148,254,0,179,241,42,239,2,230,8,82,135,87,16,3,87,86,151,254,8,255,86,53,19,7,192,171,201,253,247,197,103,251,126,0,149,54,183,61,126,79,113,10,103,184,75,11,195,222,136,149,131,8,99,240,177,252,255,198,16,7,68,178,66,191,150,73,26,211,109,78,209,240,254,1,166,247,131,2,0,167,127,133,10,43,99,235,3,214,142,176,82,132,38,10,249,255,215,44,81],B:[176,182,248,37,117,35,96,69,32,152,108,20,237,250,2,89,141,216,111,251,211,149,10,44,214,103,31,251,3,32,252,246,97,1,219,167,197,4,36,116,206,118,106,43,205,204,114,69,127,205,87,80,41,251,145,204,253,161,247,1,149,9,43,253,97,72,136,161,171,181,26,255,108,80,218,214,231,255,84,31,109,4,218,3,217,36,68,85,241,39,221,2,240,2,173,42,206,5,110,46,103,27,212,184,2,207,246,45,116,72,110,253,38,105,248,159,243,81,192,93,141,145,24,157,234,131,57,178,62,75,65,176,148,40,253,66,76,240,51,154,17,251,139,253,207,9,114,49,200,254,96,73,138,118,204,102,137,89,145,161,4,112,66,234,147,178,212,205,185,11,203,131,2,250,118,169,1,185,154,53,171,197,61,175,249,96,15,254,95,5,222,75,246,194,2,61,180,25,133,165,15,233,59,35,221,140,109,7,114,255,198,0,115,168,252,23,242,80,75,142,137,255,12,182,68,201,4,111,37,228,83,248,24,192,249,5,54,223,160,122,160,114,145,119,252,31,253,250,10,214,8,47,0,142,222,70],A:[0,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64],I:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255]},ColorTables=class{constructor(){__publicField(this,"gamma",1),__publicField(this,"version",.1),__publicField(this,"cluts",{});const n=Object.keys(cmaps_exports).filter(s=>!s.startsWith("$")).sort(new Intl.Collator("en").compare);for(const s of n)this.cluts[s]=cmaps_exports[s]}addColormap(a,n){this.cluts[a]=n}colormaps(){return Object.keys(this.cluts)}colorMaps(){return this.colormaps()}colormapFromKey(a){let n=this.cluts[a];return n!==void 0||(n=this.cluts[a.toLowerCase()],n!==void 0)?n:(a.length>0&&log$4.warn("No color map named "+a),{min:0,max:0,R:[0,255],G:[0,255],B:[0,255],A:[0,255],I:[0,255]})}colormap(a="",n=!1){const s=this.colormapFromKey(a);return this.makeLut(s.R,s.G,s.B,s.A,s.I,n)}makeLabelLut(a,n=255){if(a.R===void 0||a.G===void 0||a.B===void 0)throw new Error(`Invalid colormap table: ${a}`);const s=a.R.length,u=a.I??[...Array(s).keys()];if(s!==a.G.length||s!==a.B.length||s!==u.length)throw new Error(`colormap does not make sense: ${a}`);let f=new Uint8ClampedArray(s).fill(n);f[0]=0,a.A!==void 0&&(f=Uint8ClampedArray.from(a.A));const m=Math.min(...u),A=Math.max(...u),v=A-m+1,y=new Uint8ClampedArray(v*4).fill(0);for(let E=0;E0)for(let A=0;A"u"){S=new Uint8ClampedArray(A).fill(0);for(let e=0;e"u"&&(E=new Uint8ClampedArray(A).fill(64),E[0]=0);for(let e=0;e0&&(u[A]=!0);const f=n.length/3;let m=0;for(let A=0;A0&&(L=1/Math.sqrt(L),s[0]*=L,s[1]*=L,s[2]*=L),F[u]=s[0],F[u+1]=s[1],F[u+2]=s[2]}return F}},utiltiesLogger=log$4,NVMeshLoaders=class Z0{static readTRACT(n){const s=n.byteLength;if(s<20)throw new Error("File too small to be niml.tract: bytes = "+s);const u=new DataView(n),f=new Uint8Array(n);let m=0;function A(){for(;m=1&&ae<=2)fe=4;else if(ae>=3&&ae<=4)fe=2;else if(ae===5)fe=1;else if(ae!==0)throw new Error("impossible Matlab v4 datatype");if(L+=H,W>50)throw new Error("Does not appear to be little-endian V4 Matlab file");const pe=L+g*fe;V[re]=z(ae,L,pe),L=pe}for(;L+20>10,L=F&1023;return(F>>15?-1:1)*(M?M===31?L?NaN:1/0:Math.pow(2,M-15)*(1+L/1024):6103515625e-14*(L/1024))}let u=0,f=0,m=new Float32Array([]);const A=[],v=[],y=[],T=[];let E=[],S=!1;const I=unzipSync$1(new Uint8Array(n),{filter(F){return F.originalSize>0}}),e=Object.keys(I);for(let F=0,M=e.length;F2||m!==1e3||u!==1128354388)throw new Error("Not a valid TRK file");const A=s.getInt16(36,!0),v=[];for(let J=0;J0)for(let me=0;me0)for(let re=0;re=T);L++)E[S]=parseFloat(M[L]),S++}const I=[];for(A++;f[A].length<1;)A++;if(v=f[A].trim().split(/\s+/),A++,v[0].includes("LINES")){const F=parseInt(v[1]);if(F<1)throw new Error("Corrupted VTK ASCII");let M=f[A].trim();const L=[];let V=[];if(M.startsWith("OFFSETS")){A++;let B=0;for(;B=F));b++);}V=Array.from(E)}else{let B=function(){M=f[A].trim();const q=M.trim().split(/\s+/);b=[];for(let Y=0;Y=b.length&&B();const Y=b[W++];z+=Y,L[q+1]=z;for(let X=0;X=b.length&&B();const H=b[W++]*3;V.push(E[H+0]),V.push(E[H+1]),V.push(E[H+2])}}}return{pts:Float32Array.from(V),offsetPt0:Uint32Array.from(L)}}else if(v[0].includes("TRIANGLE_STRIPS")){const F=parseInt(v[1]);for(let M=0;M1&&B.pop()&&(z=z.split(".").slice(0,-1).join("."));const b=Z0.readTSF(s,V);u.dpv||(u.dpv=[]);const W=b.reduce((Y,X)=>Math.min(Y,X)),q=b.reduce((Y,X)=>Math.max(Y,X));u.dpv.push({id:z,vals:Float32Array.from(b.slice()),global_min:W,global_max:q,cal_min:W,cal_max:q});return}if(F<3)return;if(e==="MZ3")S.values=Z0.readMZ3(s,F);else if(e==="ANNOT"){const V=Z0.readANNOT(s,F,!0);V instanceof Uint32Array?S.values=V:(S.values=V.scalars,S.colormapLabel=V.colormapLabel)}else if(e==="CRV"||e==="CURV")S.values=Z0.readCURV(s,F),S.isTransparentBelowCalMin=!1;else if(e==="GII"){const V=Z0.readGII(s,F);S.values=V.scalars,S.colormapLabel=V.colormapLabel}else if(e==="MGH"||e==="MGZ"){const V=Z0.readMGH(s,F,!0);"scalars"in V?(S.values=V.scalars,S.colormapLabel=V.colormapLabel):S.values=V}else if(e==="NII")S.values=Z0.readNII(s,F,u.anatomicalStructurePrimary);else if(e==="SMP")S.values=Z0.readSMP(s,F);else if(e==="STC")S.values=Z0.readSTC(s,F);else{log$4.warn("Unknown layer overlay format "+n);return}if(!S.values)return;S.nFrame4D=S.values.length/F,S.frame4D=0,S.outlineBorder=E;let M=S.values[0],L=S.values[0];for(let V=0;V5){const S=decompressSync$1(new Uint8Array(n));f=new DataView(S.buffer),m=f.getUint16(0,!0),n=S.buffer}m>5&&log$4.error("Unsupported or invalid BrainVoyager SMP version "+m);const A=f.getUint32(2,!0);A!==s&&log$4.error("SMP file has "+A+" vertices, background mesh has "+s);const v=f.getUint16(6,!0),y=new Float32Array(A*v);let T=9;function E(){const S=T;for(;T=3&&I.mapType===3&&(I.nLags=f.getUint32(T,!0),T+=4,I.mnLag=f.getUint32(T,!0),T+=4,I.mxLag=f.getUint32(T,!0),T+=4,I.ccOverlay=f.getUint32(T,!0),T+=4),I.clusterSize=f.getUint32(T,!0),T+=4,I.clusterCheck=f.getUint8(T),T+=1,I.critThresh=f.getFloat32(T,!0),T+=4,I.maxThresh=f.getFloat32(T,!0),T+=4,m>=4&&(I.includeValuesGreaterThreshMax=f.getUint32(T,!0),T+=4),I.df1=f.getUint32(T,!0),T+=4,I.df2=f.getUint32(T,!0),T+=4,m>=5?(I.posNegFlag=f.getUint32(T,!0),T+=4):I.posNegFlag=3,I.cortexBonferroni=f.getUint32(T,!0),T+=4,I.posMinRGB=[0,0,0],I.posMaxRGB=[0,0,0],I.negMinRGB=[0,0,0],I.negMaxRGB=[0,0,0],m>=2&&(I.posMinRGB[0]=f.getUint8(T),T++,I.posMinRGB[1]=f.getUint8(T),T++,I.posMinRGB[2]=f.getUint8(T),T++,I.posMaxRGB[0]=f.getUint8(T),T++,I.posMaxRGB[1]=f.getUint8(T),T++,I.posMaxRGB[2]=f.getUint8(T),T++,m>=4&&(I.negMinRGB[0]=f.getUint8(T),T++,I.negMinRGB[1]=f.getUint8(T),T++,I.negMinRGB[2]=f.getUint8(T),T++,I.negMaxRGB[0]=f.getUint8(T),T++,I.negMaxRGB[1]=f.getUint8(T),T++,I.negMaxRGB[2]=f.getUint8(T),T++),I.enableSMPColor=f.getUint8(T),T++,m>=4&&(I.lut=E()),I.colorAlpha=f.getFloat32(T,!0),T+=4),I.name=E();const e=new Float32Array(n,T,A);y.set(e,S*A),T+=A*4}return y}static readSTC(n,s){const u=new DataView(n),f=u.getInt32(8,!1);if(f!==s)throw new Error("Overlay has "+f+" vertices, expected "+s);let m=12+f*4;const A=u.getUint32(m,!1);m+=4;const v=new Float32Array(A*f);for(let y=0;y0)return v;const S=f.getInt32(A+=4,!1),I=f.getInt32(A+=4,!1);A+=I;const e=f.getInt32(A+=4,!1);if(e<1)return v;const F={R:Array(S).fill(0),G:Array(S).fill(0),B:Array(S).fill(0),A:Array(S).fill(0),I:Array(S).fill(0),labels:Array(S).fill("")};for(let B=0;B=S){log$4.warn("annot entry out of range");continue}F.R[z]=q,F.G[z]=Y,F.B[z]=X,F.A[z]=H,F.I[z]=(H<<24)+(X<<16)+(Y<<8)+q,F.labels[z]=W}const M=new Float32Array(m);M.fill(-1);let L=0;for(let B=0;B0&&log$4.error(`annot vertex colors do not match ${L} of ${m} vertices.`);for(let B=0;B=v*3)break;S[T+2]=parseInt(e[0])-1,S[T+1]=parseInt(e[1])-1,S[T+0]=parseInt(e[2])-1,T+=3}return{positions:E,indices:S}}static readASC(n){const s=n.byteLength,u=new Uint8Array(n);let f=0;function m(){for(;f65535)throw new Error("Invalid VTK binary polygons using little-endian data (MRtrix)");f+=4;const B=I.getInt32(f,!1);f+=4;let z=I.getInt32(f,!1);f+=4;for(let b=0;b=0&&(I=new Float32Array(n,y,v*3)),{positions:S,indices:E,colors:I}}static readMZ3(n,s=0){if(n.byteLength<20)throw new Error("File too small to be mz3: bytes = "+n.byteLength);let u=new DataView(n),f=u.getUint16(0,!0),m=n;if(f===35615||f===8075){const q=decompressSync$1(new Uint8Array(n));u=new DataView(q.buffer),f=u.getUint16(0,!0),m=q.buffer}const A=u.getUint16(2,!0),v=u.getUint32(4,!0);let y=u.getUint32(8,!0);const T=u.getUint32(12,!0);if(utiltiesLogger.debug("MZ3 magic %d attr %d face %d vert %d skip %d",f,A,v,y,T),f!==23117)throw new Error("Invalid MZ3 file");const E=(A&1)!==0,S=(A&2)!==0,I=(A&4)!==0;let e=(A&8)!==0;const F=(A&16)!==0;if(A>63)throw new Error("Unsupported future version of MZ3 file");let M=4;F&&(M=8);let L=0;if(s>0&&!E&&v<1&&!I&&(e=!0),e){let q=s;s===0&&(q=y);const Y=16+T+(E?1:0)*v*12+(S?1:0)*q*12+(I?1:0)*q*4,X=Math.floor((m.byteLength-Y)/M);y!==s&&X%s===0&&(log$4.warn("Issue 729: mz3 mismatch scalar NVERT does not match mesh NVERT"),y=s),L=Math.floor(X/y),L<1&&(log$4.warn("Corrupt MZ3: file reports NSCALAR but not enough bytes"),e=!1)}if(y<3&&s<3)throw new Error("Not a mesh MZ3 file (maybe scalar)");s>0&&s!==y&&log$4.warn("Layer has "+y+"vertices, but background mesh has "+s);let V=16+T,B=null;E&&(B=new Uint32Array(m,V,v*3),V+=v*3*4);let z=null;S&&(z=new Float32Array(m,V,y*3),V+=y*3*4);let b=null;if(I){b=new Float32Array(y*3);const q=new Uint8Array(m,V,y*4);V+=y*4;let Y=0,X=0;for(let H=0;H0){if(F){const q=new Float64Array(m,V,L*y);W=Float32Array.from(q)}else W=new Float32Array(m,V,L*y);V+=M*L*y}return s>0?W:{positions:z,indices:B,scalars:W,colors:b}}static readPLY(n){const s=n.byteLength,u=new Uint8Array(n);let f=0;function m(){for(;fg.length){const Se=new Uint32Array(g.length+g.length);Se.set(g),g=Se.slice()}const pe=parseInt(ae[V+1]);let me=parseInt(ae[V+2]);for(let Se=0;Se>0&255)/255,(n>>8&255)/255,(n>>16&255)/255,(n>>24&255)/255]}};__publicField(_NiivueObject3D,"BLEND",1);__publicField(_NiivueObject3D,"CULL_FACE",2);__publicField(_NiivueObject3D,"CULL_FRONT",4);__publicField(_NiivueObject3D,"CULL_BACK",8);__publicField(_NiivueObject3D,"ENABLE_DEPTH_TEST",16);__publicField(_NiivueObject3D,"generateCrosshairs",function(a,n,s,u,f,m,A=20,v=0){const y=_NiivueObject3D.generateCrosshairsGeometry(a,s,u,f,m,A,v);return new _NiivueObject3D(n,y.vertexBuffer,a.TRIANGLES,y.indexCount,y.indexBuffer,y.vao)});__publicField(_NiivueObject3D,"generateCrosshairsGeometry",function(a,n,s,u,f,m=20,A=0){const v=[],y=[],T=f*A;if(T<=0){let e=fromValues$2(s[0],n[1],n[2]),F=fromValues$2(u[0],n[1],n[2]);_NiivueObject3D.makeCylinder(v,y,e,F,f,m),e=fromValues$2(n[0],s[1],n[2]),F=fromValues$2(n[0],u[1],n[2]),_NiivueObject3D.makeCylinder(v,y,e,F,f,m),e=fromValues$2(n[0],n[1],s[2]),F=fromValues$2(n[0],n[1],u[2]),_NiivueObject3D.makeCylinder(v,y,e,F,f,m)}else{let e=fromValues$2(s[0],n[1],n[2]),F=fromValues$2(n[0]-T,n[1],n[2]);_NiivueObject3D.makeCylinder(v,y,e,F,f,m,!1),e=fromValues$2(n[0]+T,n[1],n[2]),F=fromValues$2(u[0],n[1],n[2]),_NiivueObject3D.makeCylinder(v,y,e,F,f,m,!1),e=fromValues$2(n[0],s[1],n[2]),F=fromValues$2(n[0],n[1]-T,n[2]),_NiivueObject3D.makeCylinder(v,y,e,F,f,m,!1),e=fromValues$2(n[0],n[1]+T,n[2]),F=fromValues$2(n[0],u[1],n[2]),_NiivueObject3D.makeCylinder(v,y,e,F,f,m,!1),e=fromValues$2(n[0],n[1],s[2]),F=fromValues$2(n[0],n[1],n[2]-T),_NiivueObject3D.makeCylinder(v,y,e,F,f,m,!1),e=fromValues$2(n[0],n[1],n[2]+T),F=fromValues$2(n[0],n[1],u[2]),_NiivueObject3D.makeCylinder(v,y,e,F,f,m,!1)}const E=a.createBuffer();if(E===null)throw new Error("could not instantiate vertex buffer");a.bindBuffer(a.ARRAY_BUFFER,E),a.bufferData(a.ARRAY_BUFFER,new Float32Array(v),a.STATIC_DRAW);const S=a.createBuffer();if(S===null)throw new Error("could not instantiate index buffer");a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,S),a.bufferData(a.ELEMENT_ARRAY_BUFFER,new Uint32Array(y),a.STATIC_DRAW);const I=a.createVertexArray();return a.bindVertexArray(I),a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,S),a.bindBuffer(a.ARRAY_BUFFER,E),a.enableVertexAttribArray(0),a.vertexAttribPointer(0,3,a.FLOAT,!1,0,0),a.bindVertexArray(null),{vertexBuffer:E,indexBuffer:S,indexCount:y.length,vao:I}});__publicField(_NiivueObject3D,"getFirstPerpVector",function(a){const n=fromValues$2(0,0,0);return a[0]===0?n[0]=1:a[1]===0?n[1]=1:a[2]===0?n[2]=1:(n[0]=a[2],n[1]=a[2],n[2]=-(a[0]+a[1]),normalize$1(n,n)),n});__publicField(_NiivueObject3D,"subdivide",function(a,n){let s=a.length/3,u=n.length/3;const f=u,m=create$2(),A=create$2();for(let v=0;vitksnap_default,$slicer3d:()=>slicer3d_default,actc:()=>actc_default,afni_blues_inv:()=>afni_blues_inv_default,afni_reds_inv:()=>afni_reds_inv_default,bcgwhw:()=>bcgwhw_default,bcgwhw_dark:()=>bcgwhw_dark_default,blue:()=>blue_default,blue2cyan:()=>blue2cyan_default,blue2magenta:()=>blue2magenta_default,blue2red:()=>blue2red_default,bluegrn:()=>bluegrn_default,bone:()=>bone_default,bronze:()=>bronze_default,cet_l17:()=>cet_l17_default,cividis:()=>cividis_default,cool:()=>cool_default,copper:()=>copper_default,copper2:()=>copper2_default,ct_airways:()=>ct_airways_default,ct_artery:()=>ct_artery_default,ct_bones:()=>ct_bones_default,ct_brain:()=>ct_brain_default,ct_brain_gray:()=>ct_brain_gray_default,ct_cardiac:()=>ct_cardiac_default,ct_head:()=>ct_head_default,ct_kidneys:()=>ct_kidneys_default,ct_liver:()=>ct_liver_default,ct_muscles:()=>ct_muscles_default,ct_scalp:()=>ct_scalp_default,ct_skull:()=>ct_skull_default,ct_soft:()=>ct_soft_default,ct_soft_tissue:()=>ct_soft_tissue_default,ct_surface:()=>ct_surface_default,ct_vessels:()=>ct_vessels_default,ct_w_contrast:()=>ct_w_contrast_default,cubehelix:()=>cubehelix_default,electric_blue:()=>electric_blue_default,freesurfer:()=>freesurfer_default,ge_color:()=>ge_color_default,gold:()=>gold_default,gray:()=>gray_default,green:()=>green_default,green2cyan:()=>green2cyan_default,green2orange:()=>green2orange_default,hot:()=>hot_default,hotiron:()=>hotiron_default,hsv:()=>hsv_default,inferno:()=>inferno_default,jet:()=>jet_default,linspecer:()=>linspecer_default,magma:()=>magma_default,mako:()=>mako_default,nih:()=>nih_default,plasma:()=>plasma_default,random:()=>random_default,red:()=>red_default,redyell:()=>redyell_default,rocket:()=>rocket_default,roi_i256:()=>roi_i256_default,surface:()=>surface_default,turbo:()=>turbo_default,violet:()=>violet_default,viridis:()=>viridis_default,warm:()=>warm_default,winter:()=>winter_default,x_rain:()=>x_rain_default});var itksnap_default={R:[0,255,0,0,255,0,255,255,0,205,210,102,0,0,46,255,106,221,233,165,255,147,218,75,255,60,255,255,218,0,188,255,255,222,127,139,124,255,70,0,238,238,240,245,184,32,255,25,112,34,248,245,255,144,173,65,255,250,128,50,244,255,123,255,173,255,127,255,143,220,253,255,0,0,128,255,250,148,178,255,135,100,240,250,255,107,135,0,139,245,186,255,255,0,210,255,47,72,175,128,176,255,139,240,255,216,119,219,72,255,199,154,189,240,230,0,85,64,153,205,250,95,0,255,224,176,138,30,240,152,160],G:[0,0,255,0,255,255,0,239,0,133,180,205,0,139,139,228,90,160,150,42,250,112,112,0,182,179,235,228,165,128,143,105,218,184,255,69,252,255,130,100,130,232,255,222,134,178,20,25,128,139,248,255,160,238,255,105,99,240,0,205,164,255,104,165,216,192,255,140,188,20,245,250,206,255,0,250,128,0,34,127,206,149,230,235,245,142,206,0,0,245,85,228,222,191,105,248,79,61,238,128,224,240,0,255,215,191,136,112,209,0,21,205,183,248,230,250,107,224,50,92,250,158,128,69,255,196,43,144,128,251,82],B:[0,0,0,255,0,255,255,213,205,63,140,170,128,139,87,225,205,221,122,42,250,219,214,130,193,113,205,196,32,128,143,180,185,135,0,19,0,224,180,0,238,170,240,179,11,170,147,112,144,34,255,250,122,144,47,225,71,230,0,50,96,240,238,0,230,203,212,0,143,60,230,240,209,127,128,205,114,211,34,80,235,237,140,215,238,35,250,139,139,220,211,181,173,255,30,220,79,139,238,0,230,245,0,255,0,216,153,147,204,255,133,50,107,255,250,154,47,208,204,92,210,160,0,0,255,222,226,255,128,152,45],A:[0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255],I:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130]},slicer3d_default={labels:["background","tissue","bone","skin","connective tissue","blood","organ","mass","muscle","foreign object","waste","teeth","fat","gray matter","white matter","nerve","vein","artery","capillary","ligament","tendon","cartilage","meniscus","lymph node","lymphatic vessel","cerebro-spinal fluid","bile","urine","feces","gas","fluid","edema","bleeding","necrosis","clot","embolism","head","central nervous system","brain","gray matter of brain","telencephalon","cerebral cortex","right frontal lobe","left frontal lobe","right temporal lobe","left temporal lobe","right parietal lobe","left parietal lobe","right occipital lobe","left occipital lobe","right insular lobe","left insular lobe","right limbic lobe","left limbic lobe","right striatum","left striatum","right caudate nucleus","left caudate nucleus","right putamen","left putamen","right pallidum","left pallidum","right amygdaloid complex","left amygdaloid complex","diencephalon","thalamus","right thalamus","left thalamus","pineal gland","midbrain","substantia nigra","right substantia nigra","left substantia nigra","cerebral white matter","right superior longitudinal fasciculus","left superior longitudinal fasciculus","right inferior longitudinal fasciculus","left inferior longitudinal fasciculus","right arcuate fasciculus","left arcuate fasciculus","right uncinate fasciculus","left uncinate fasciculus","right cingulum bundle","left cingulum bundle","projection fibers","right corticospinal tract","left corticospinal tract","right optic radiation","left optic radiation","right medial lemniscus","left medial lemniscus","right superior cerebellar peduncle","left superior cerebellar peduncle","right middle cerebellar peduncle","left middle cerebellar peduncle","right inferior cerebellar peduncle","left inferior cerebellar peduncle","optic chiasm","right optic tract","left optic tract","right fornix","left fornix","commissural fibers","corpus callosum","posterior commissure","cerebellar white matter","CSF space","ventricles of brain","right lateral ventricle","left lateral ventricle","right third ventricle","left third ventricle","cerebral aqueduct","fourth ventricle","subarachnoid space","spinal cord","gray matter of spinal cord","white matter of spinal cord","endocrine system of brain","pituitary gland","adenohypophysis","neurohypophysis","meninges","dura mater","arachnoid","pia mater","muscles of head","salivary glands","lips","nose","tongue","soft palate","right inner ear","left inner ear","right external ear","left external ear","right middle ear","left middle ear","right eyeball","left eyeball","skull","right frontal bone","left frontal bone","right parietal bone","left parietal bone","right temporal bone","left temporal bone","right sphenoid bone","left sphenoid bone","right ethmoid bone","left ethmoid bone","occipital bone","maxilla","right zygomatic bone","right lacrimal bone","vomer bone","right palatine bone","left palatine bone","mandible","neck","muscles of neck","pharynx","larynx","thyroid gland","right parathyroid glands","left parathyroid glands","skeleton of neck","hyoid bone","cervical vertebral column","thorax","trachea","bronchi","right lung","left lung","superior lobe of right lung","superior lobe of left lung","middle lobe of right lung","inferior lobe of right lung","inferior lobe of left lung","pleura","heart","right atrium","left atrium","atrial septum","ventricular septum","right ventricle of heart","left ventricle of heart","mitral valve","tricuspid valve","aortic valve","pulmonary valve","aorta","pericardium","pericardial cavity","esophagus","thymus","mediastinum","skin of thoracic wall","muscles of thoracic wall","skeleton of thorax","thoracic vertebral column","ribs","sternum","right clavicle","left clavicle","abdominal cavity","abdomen","peritoneum","omentum","peritoneal cavity","retroperitoneal space","stomach","duodenum","small bowel","colon","anus","liver","biliary tree","gallbladder","pancreas","spleen","urinary system","right kidney","left kidney","right ureter","left ureter","urinary bladder","urethra","right adrenal gland","left adrenal gland","female internal genitalia","uterus","right fallopian tube","left fallopian tube","right ovary","left ovary","vagina","male internal genitalia","prostate","right seminal vesicle","left seminal vesicle","right deferent duct","left deferent duct","skin of abdominal wall","muscles of abdominal wall","skeleton of abdomen","lumbar vertebral column","female external genitalia","male external genitalia","skeleton of upper limb","muscles of upper limb","right upper limb","left upper limb","right shoulder","left shoulder","right arm"],R:[0,128,241,177,111,216,221,144,192,220,78,255,230,200,250,244,0,216,183,183,152,111,178,68,111,85,0,214,78,218,170,140,188,216,145,150,177,244,250,200,68,128,83,83,162,162,141,141,182,182,188,188,154,154,177,177,30,30,210,210,48,48,98,98,69,166,122,122,253,145,46,0,0,250,127,127,159,159,125,125,106,106,154,154,126,201,201,78,78,174,174,139,139,148,148,186,186,99,156,156,64,64,138,97,126,194,85,88,88,88,88,88,88,88,88,244,200,250,82,57,60,92,255,255,255,255,201,70,188,177,166,182,229,229,174,174,201,201,194,194,241,203,203,229,229,255,255,209,209,248,248,255,196,255,255,255,242,242,222,177,213,184,150,62,62,62,242,250,255,177,182,175,197,197,172,172,202,224,224,255,206,210,203,233,195,181,152,159,166,218,225,224,255,184,211,47,255,173,188,255,226,253,244,205,205,186,177,255,234,204,180,216,255,205,204,255,221,0,139,249,157,203,185,185,247,247,222,124,249,249,244,255,255,227,213,213,193,216,230,245,245,241,241,177,171,217,212,185,185,198,194,177,177,177,177,177],G:[0,174,214,122,184,101,130,238,104,245,63,250,220,200,250,214,151,101,156,214,189,184,212,172,197,188,145,230,63,255,250,224,65,191,60,98,122,214,250,200,131,174,146,146,115,115,93,93,166,166,135,135,150,150,140,140,111,111,157,157,129,129,153,153,110,113,101,101,135,92,101,108,108,250,150,150,116,116,102,102,174,174,146,146,126,160,160,152,152,140,140,126,126,120,120,135,135,106,171,171,123,123,95,113,161,195,188,106,106,106,106,106,106,106,106,214,200,250,174,157,143,162,244,244,244,244,121,163,91,122,84,105,147,147,122,122,112,112,142,142,213,179,179,204,204,243,243,185,185,223,223,230,172,255,250,237,217,217,198,122,124,105,208,162,162,162,206,210,255,122,228,216,165,165,138,138,164,186,186,245,110,115,108,138,100,85,55,63,70,123,130,97,244,122,171,150,244,121,95,239,202,232,217,179,179,124,122,255,234,142,119,132,253,167,168,224,130,145,150,180,108,136,102,102,182,182,154,186,186,186,170,181,190,153,141,141,123,146,158,172,172,172,172,124,85,198,188,135,135,175,98,122,122,122,122,122],B:[0,128,145,101,210,79,101,144,88,20,0,220,70,235,210,49,206,79,220,211,207,210,242,100,131,255,30,130,0,255,250,228,28,216,66,83,101,49,225,215,98,128,164,164,105,105,137,137,110,110,166,166,201,201,190,190,85,85,166,166,126,126,112,112,53,137,38,38,192,109,131,112,112,225,88,88,163,163,154,154,155,155,83,83,55,133,133,141,141,103,103,177,177,72,72,135,135,24,108,108,147,147,74,158,197,164,255,215,215,215,215,215,215,215,215,49,215,225,128,110,83,109,209,209,209,209,77,117,95,101,94,107,118,118,90,90,73,73,0,0,144,77,77,109,109,152,152,85,85,131,131,138,68,167,160,145,123,123,101,101,109,108,243,114,114,114,142,139,207,101,255,244,145,145,115,115,140,162,162,217,84,89,81,112,73,57,13,27,38,97,104,76,209,154,143,103,209,88,76,172,134,158,154,108,108,161,101,220,194,178,153,105,229,142,143,199,101,30,98,111,162,116,83,83,164,164,132,223,150,150,147,158,165,130,113,113,103,127,140,147,147,151,151,92,68,131,102,134,134,125,79,101,101,101,101,101],A:[0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255],I:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255]},actc_default={R:[0,0,24,248,255],G:[0,0,177,254,0],B:[0,136,0,0,0],A:[0,32,64,78,128],I:[0,64,128,156,255]},bcgwhw_dark_default={R:[0,248,242,235,229,222,212,202,193,183,173,145,117,78,39,0,0,0,0,0,0,64,128,191,255,255,255,255,255,238,221,204,214,224,235,245,255,249,242,236,229,223,217,210,204,197,191,184,176,169,161,154,146,139,132,124,117,109,102,0],G:[0,251,247,243,239,235,235,235,235,235,235,216,197,174,150,127,153,178,204,229,255,255,255,255,255,220,185,150,115,77,38,0,31,61,92,122,153,138,122,107,92,77,61,46,31,15,0,0,0,0,0,0,0,0,0,0,0,0,0,0],B:[0,254,253,252,251,250,251,252,253,254,255,226,198,132,66,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,40,80,120,160,200,199,198,197,196,196,195,194,193,192,191,184,176,169,161,154,146,139,132,124,117,109,102,0],A:[256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256],I:[0,4,8,12,16,20,24,28,32,36,40,44,48,52,56,60,64,68,72,76,80,84,88,92,96,100,104,108,112,116,120,124,128,132,136,140,144,148,152,156,160,164,168,172,176,180,184,188,192,196,200,204,208,212,216,220,224,228,232,236,240,244,248,255]},bcgwhw_default={R:[255,248,242,235,229,222,212,202,193,183,173,145,117,78,39,0,0,0,0,0,0,64,128,191,255,255,255,255,255,238,221,204,214,224,235,245,255,249,242,236,229,223,217,210,204,197,191,184,176,169,161,154,146,139,132,124,117,109,102,0],G:[255,251,247,243,239,235,235,235,235,235,235,216,197,174,150,127,153,178,204,229,255,255,255,255,255,220,185,150,115,77,38,0,31,61,92,122,153,138,122,107,92,77,61,46,31,15,0,0,0,0,0,0,0,0,0,0,0,0,0,0],B:[255,254,253,252,251,250,251,252,253,254,255,226,198,132,66,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,40,80,120,160,200,199,198,197,196,196,195,194,193,192,191,184,176,169,161,154,146,139,132,124,117,109,102,0],A:[256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256],I:[0,4,8,12,16,20,24,28,32,36,40,44,48,52,56,60,64,68,72,76,80,84,88,92,96,100,104,108,112,116,120,124,128,132,136,140,144,148,152,156,160,164,168,172,176,180,184,188,192,196,200,204,208,212,216,220,224,228,232,236,240,244,248,255]},blue2red_default={R:[0,0,0,0,196,255],G:[0,32,128,128,128,32],B:[0,255,196,0,0,0],A:[0,128,64,64,64,128],I:[0,1,64,128,192,255]},blue2magenta_default={R:[0,255],G:[0,0],B:[255,255],A:[0,128],I:[0,255]},blue2cyan_default={R:[0,0],G:[0,255],B:[255,255],A:[0,128],I:[0,255]},bluegrn_default={R:[0,0,0,0],G:[0,1,128,255],B:[0,222,127,32],A:[0,0,64,128],I:[0,1,128,255]},blue_default={R:[0,0,0],G:[0,0,0],B:[0,128,255],A:[0,64,128],I:[0,128,255]},bone_default={R:[0,103,255],G:[0,126,255],B:[0,165,255],A:[0,76,128],I:[0,153,255]},bronze_default={R:[0,43,103,199,216,255],G:[0,0,37,155,213,255],B:[0,0,20,97,201,255],A:[0,44,48,54,56,56],I:[0,64,128,196,240,255]},cet_l17_default={R:[0,9,24,33,40,46,52,57,62,66,70,74,78,81,85,88,91,94,98,101,103,106,109,112,114,117,119,121,124,126,128,130,133,135,137,139,141,143,145,147,149,151,153,155,157,159,161,163,164,166,168,169,171,172,174,175,177,178,180,181,183,184,186,187,189,190,191,193,194,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,222,223,224,224,225,226,226,227,228,228,229,229,230,231,231,232,233,233,234,234,235,235,236,236,236,237,237,237,238,238,238,239,239,239,240,240,240,241,241,241,242,242,242,243,243,243,243,243,243,243,243,244,244,244,244,244,244,244,244,244,244,244,245,245,245,245,245,245,245,245,245,245,245,245,245,245,245,245,244,244,244,244,244,244,244,244,244,244,244,244,244,244,244,243,243,243,243,243,243,243,243,243,243,243,243,242,242,242,242,242,242,242,242,241,242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,242,243,243,244,244,245,246,246,247,247,248,249,249,250,250,251,251,252,252,253,253,254,254,254],G:[42,41,41,41,40,40,40,39,39,39,38,38,37,37,36,36,35,35,34,34,33,32,32,31,30,30,30,30,29,29,29,29,28,28,28,27,27,27,26,26,26,25,25,25,24,24,24,24,24,25,25,26,27,27,28,28,29,30,30,31,31,32,33,33,34,34,35,36,36,37,38,39,40,42,43,44,45,47,48,49,50,51,53,54,55,56,57,58,59,60,62,63,64,65,66,68,69,71,72,73,75,76,77,79,80,81,83,84,85,87,88,89,90,92,93,94,95,97,98,100,101,102,104,105,107,108,109,111,112,113,115,116,117,119,120,121,122,124,125,126,128,129,130,132,133,134,136,137,138,140,141,142,144,145,146,147,149,150,151,153,154,155,156,158,159,160,161,163,164,165,167,168,169,170,172,173,174,175,176,178,179,180,181,183,184,185,186,187,189,190,191,192,193,194,196,197,198,199,200,201,203,204,205,206,207,208,209,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,228,229,230,231,232,233,234,235,236,237,238,238,239,240,241,241,242,243,244,244,245,246,247,248,248,249,250,251,251,252,253,254,255],B:[167,167,166,166,166,165,165,165,164,164,164,163,163,162,162,162,161,161,161,160,160,160,159,159,158,158,157,157,156,155,155,154,154,153,153,152,151,151,150,150,149,149,148,147,147,146,146,145,144,144,143,143,142,141,141,140,139,139,138,137,137,136,135,135,134,133,133,132,131,131,130,130,129,128,128,127,127,126,125,125,124,124,123,123,122,121,121,120,119,119,118,118,117,116,116,116,115,115,114,114,113,113,113,112,112,111,111,110,110,109,109,109,108,108,107,107,106,106,106,106,106,105,105,105,105,105,105,105,104,104,104,104,104,103,103,103,103,103,102,102,102,103,103,103,103,104,104,104,104,104,105,105,105,105,106,106,106,106,106,107,107,107,107,108,108,109,110,111,111,112,113,113,114,115,115,116,117,117,118,119,120,120,121,122,122,123,124,125,126,128,129,130,131,132,134,135,136,137,138,140,141,142,143,144,146,147,148,149,150,152,153,155,157,158,160,162,163,165,167,168,170,172,173,175,177,178,180,182,183,185,187,188,190,193,196,199,201,204,207,210,212,215,218,221,224,226,229,232,235,238,240,243,246,249,252,255],A:[0,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64],I:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255]},cividis_default={R:[0,86,166,255],G:[32,92,156,233],B:[76,108,117,69],A:[0,56,80,88],I:[0,64,192,255]},cool_default={R:[0,0,0],G:[127,196,254],B:[255,255,255],A:[0,64,128],I:[0,128,255]},copper2_default={R:[0,61,122,183,244,255],G:[0,41,81,122,163,255],B:[0,25,51,76,102,255],A:[0,25,51,71,102,128],I:[0,51,102,153,204,255]},copper_default={R:[0,61,122,183,244,255],G:[0,41,81,122,163,203],B:[0,25,51,76,102,127],A:[0,25,51,71,102,128],I:[0,51,102,153,204,255]},ct_airways_default={min:-643,max:-235,R:[0,0,0],G:[154,154,154],B:[179,179,101],A:[0,32,0],I:[0,163,255]},ct_artery_default={min:114,max:800,R:[0,255,255,255],G:[0,0,129,255],B:[0,0,0,255],A:[0,64,88,228],I:[0,80,160,255]},ct_bones_default={min:180,max:600,R:[0,0,113,255],G:[0,0,109,250],B:[0,0,101,245],A:[0,0,100,160],I:[0,1,128,255]},ct_brain_gray_default={min:-10,max:110,R:[0,127,255],G:[0,127,255],B:[0,127,255],A:[0,48,128],I:[0,124,255]},ct_brain_default={min:-10,max:110,R:[0,199,255],G:[0,127,255],B:[0,127,255],A:[0,48,128],I:[0,124,255]},ct_cardiac_default={min:-80,max:1e3,R:[0,189,150,150,150,150,255],G:[0,169,54,54,54,54,240],B:[0,153,52,52,52,52,242],A:[0,32,64,0,0,64,64],I:[0,1,82,92,234,242,255]},ct_head_default={min:-590,max:600,R:[0,241,241,248,248,178,178,232,255,255,255],G:[0,156,156,222,222,36,36,51,255,255,255],B:[0,130,130,169,169,24,24,37,255,255,255],A:[0,8,0,0,0,64,64,0,0,222,222],I:[0,2,3,64,122,142,172,182,252,253,255]},ct_kidneys_default={min:114,max:302,R:[0,255,255],G:[0,129,255],B:[0,0,255],A:[0,88,228],I:[0,103,255]},ct_liver_default={min:-23,max:246,R:[0,44,255,255,255],G:[0,128,90,255,255],B:[0,0,70,0,255],A:[0,0,82,184,228],I:[0,64,131,196,255]},ct_muscles_default={min:-100,max:246,R:[0,128,159,255,255,255,255],G:[0,0,56,90,0,255,255],B:[0,0,41,70,0,0,255],A:[0,63,105,135,167,184,228],I:[0,100,128,155,180,209,255]},ct_scalp_default={min:-590,max:600,R:[0,241,241,248,248,178,232,255,255],G:[0,156,156,222,222,36,51,255,255],B:[0,130,130,169,169,24,37,255,255],A:[0,63,105,135,167,184,228,228,228],I:[0,1,52,127,137,162,172,252,255]},ct_skull_default={min:140,max:1024,R:[0,2,113,255],G:[0,1,109,250],B:[0,1,101,245],A:[0,1,96,168],I:[0,1,128,255]},ct_soft_default={min:-923,max:679,R:[0,0,0,0,0,255,255,255],G:[154,154,154,154,0,0,254,255],B:[179,179,179,179,0,0,0,255],A:[0,3,8,0,0,10,15,20],I:[0,30,62,88,170,200,232,255]},ct_soft_tissue_default={min:-10,max:110,R:[0,199,255],G:[0,127,255],B:[0,127,255],A:[0,48,128],I:[0,124,255]},ct_surface_default={min:-600,max:100,R:[0,134,255],G:[0,109,250],B:[0,101,245],A:[0,60,148],I:[0,128,255]},ct_vessels_default={min:114,max:246,R:[0,255,255],G:[0,128,255],B:[0,128,255],A:[0,64,96],I:[0,87,255]},ct_w_contrast_default={min:50,max:1e3,R:[98,210,169,128,255],G:[94,26,77,128,255],B:[45,21,74,128,255],A:[0,25,0,4,168],I:[0,41,87,154,255]},cubehelix_default={R:[0,13,21,26,27,25,22,21,22,28,39,54,75,98,124,148,171,189,202,210,213,211,206,200,195,193,195,201,211,225,240,255],G:[0,5,11,20,31,44,58,72,86,99,109,116,120,122,122,122,121,121,124,129,137,147,161,175,190,205,218,229,238,245,251,255],B:[0,14,30,46,61,71,77,78,75,68,60,52,48,47,53,65,83,105,131,157,183,205,222,235,241,243,242,240,239,240,245,255],A:[0,4,8,12,17,21,25,29,33,37,41,45,50,54,58,62,66,70,74,78,83,87,91,95,99,103,107,111,116,120,124,128],I:[0,8,16,25,33,41,49,58,66,74,82,90,99,107,115,123,132,140,148,156,165,173,181,189,197,206,214,222,230,239,247,255]},electric_blue_default={R:[0,10,136,255],G:[0,39,220,255],B:[0,223,253,255],A:[0,48,64,70],I:[0,92,192,255]},freesurfer_default={R:[0,245,205,120,196,220,230,0,122,236,12,204,42,119,220,103,60,255,165,160,0,245,205,120,196,220,230,0,122,236,13,220,103,255,165,160,0,120,200,255,255,164,164,164,234,0,0,0,0,0],G:[0,245,62,18,58,248,148,118,186,13,48,182,204,159,216,255,60,165,42,32,200,245,62,18,58,248,148,118,186,13,48,216,255,165,42,32,200,190,70,148,148,108,108,108,169,0,0,0,0,0],B:[0,245,78,134,250,164,34,14,220,176,255,142,164,176,20,255,60,0,42,240,200,245,78,134,250,164,34,14,220,176,255,20,255,0,42,240,221,150,255,10,10,226,226,226,30,64,112,160,208,255],A:[0,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64],I:[0,2,3,4,5,7,8,10,11,12,13,14,15,16,17,18,24,26,28,30,31,41,42,43,44,46,47,49,50,51,52,53,54,58,60,62,63,72,77,78,79,80,81,82,85,251,252,253,254,255]},ge_color_default={R:[0,0,128,255,255],G:[0,128,0,128,255],B:[0,125,255,0,255],A:[0,32,64,96,128],I:[0,63,128,192,255]},gold_default={R:[0,142,227,255],G:[0,85,170,255],B:[0,14,76,255],A:[0,42,84,128],I:[0,85,170,255]},gray_default={R:[0,255],G:[0,255],B:[0,255],A:[0,128],I:[0,255]},green_default={R:[0,0,0],G:[0,128,255],B:[0,0,0],A:[0,64,128],I:[0,128,255]},green2cyan_default={R:[0,0,0],G:[72,72,255],B:[0,255,255],A:[0,64,128],I:[0,88,255]},green2orange_default={R:[0,255,255],G:[72,88,255],B:[0,0,0],A:[0,64,128],I:[0,88,255]},hotiron_default={R:[0,255,255,255],G:[0,0,126,255],B:[0,0,0,255],A:[0,64,96,128],I:[0,128,191,255]},hot_default={R:[3,255,255,255],G:[0,0,255,255],B:[0,0,0,255],A:[0,48,96,128],I:[0,95,191,255]},hsv_default={R:[255,255,0,0,0,255,255],G:[0,255,255,255,0,0,0],B:[0,0,0,255,255,255,0],A:[0,14,28,43,57,71,85],I:[0,43,85,128,170,213,255]},inferno_default={R:[0,120,237,240],G:[0,28,105,249],B:[4,109,37,33],A:[0,56,80,88],I:[0,64,192,255]},jet_default={R:[0,0,127,255,127],G:[0,127,255,127,0],B:[127,255,127,0,0],A:[0,32,64,96,128],I:[0,63,128,192,255]},linspecer_default={R:[94,50,90,152,215,238,249,254,252,241,209,158],G:[79,131,186,214,240,244,237,210,157,100,57,1],B:[162,189,167,164,155,169,168,123,86,68,79,66],A:[0,12,23,35,47,58,70,81,93,105,116,128],I:[0,23,46,70,93,116,139,162,185,209,232,255]},magma_default={R:[0,148,183,223,247,252],G:[0,44,55,74,112,253],B:[4,128,121,104,92,191],A:[0,44,53,64,75,107],I:[0,107,128,154,179,255]},mako_default={R:[11,59,55,222],G:[4,45,165,245],B:[5,91,172,229],A:[0,23,70,107],I:[0,56,167,255]},nih_default={R:[0,85,0,0,0,0,0,0,85,255,255,255,172],G:[0,0,0,0,85,170,255,255,255,255,85,0,0],B:[0,170,85,255,255,170,170,0,85,0,0,0,0],A:[0,5,10,21,26,32,37,42,48,53,64,72,85],I:[0,15,31,63,79,95,111,127,143,159,191,217,255]},plasma_default={R:[13,156,237,240],G:[8,23,121,249],B:[135,158,83,33],A:[0,56,80,88],I:[0,64,192,255]},random_default={R:[208,71,33,192,32,195,208,173,233,202,25,210,145,89,87,245,246,38,3,25,57,167,245,86,227,208,81,64,90,199,140,48,212,180,70,120,9,192,245,177,65,157,9,193,100,181,125,145,62,8,108,36,140,237,242,248,161,189,41,114,65,121,97,50,238,149,44,214,124,167,40,167,127,178,231,30,173,244,193,203,204,238,139,135,71,234,234,217,66,14,129,19,97,165,112,244,35,73,192,12,149,71,33,192,32,195,208,173,233,202,25,210,145,89,87,245,246,38,3,25,57,167,245,86,227,208,81,64,90,199,140,48,212,180,70,120,9,192,245,177,65,157,9,193,100,181,125,145,62,8,108,36,140,237,242,248,161,189,41,114,65,121,97,50,238,149,44,214,124,167,40,167,127,178,231,30,173,244,193,203,204,238,139,135,71,234,234,217,66,14,129,19,97,165,112,244,35,73,192,12,149,71,33,192,32,195,208,173,233,202,25,210,145,89,87,245,246,38,3,25,57,167,245,86,227,208,81,64,90,199,140,48,212,180,70,120,9,192,245,177,65,157,9,193,100,181,125,145,62,8,108,36,140,237,242,248],G:[182,46,78,199,79,89,41,208,135,20,154,35,21,43,230,113,191,147,208,37,28,27,86,203,25,209,148,187,139,111,48,102,76,110,106,130,37,160,34,222,90,165,245,222,102,47,19,130,4,232,137,211,240,11,140,21,42,22,241,61,99,115,199,166,114,190,204,60,233,66,115,230,125,103,203,125,13,176,94,131,39,198,167,124,67,175,254,1,15,198,62,237,159,31,218,58,244,47,61,67,94,46,78,199,79,89,41,208,135,20,154,35,21,43,230,113,191,147,208,37,28,27,86,203,25,209,148,187,139,111,48,102,76,110,106,130,37,160,34,222,90,165,245,222,102,47,19,130,4,232,137,211,240,11,140,21,42,22,241,61,99,115,199,166,114,190,204,60,233,66,115,230,125,103,203,125,13,176,94,131,39,198,167,124,67,175,254,1,15,198,62,237,159,31,218,58,244,47,61,67,94,46,78,199,79,89,41,208,135,20,154,35,21,43,230,113,191,147,208,37,28,27,86,203,25,209,148,187,139,111,48,102,76,110,106,130,37,160,34,222,90,165,245,222,102,47,19,130,4,232,137,211,240,11,140,21],B:[191,154,43,10,207,204,164,231,136,58,239,30,147,230,101,111,150,35,128,57,252,79,173,120,25,126,81,85,8,7,122,237,190,152,246,182,130,219,67,76,167,178,235,250,28,61,186,250,199,67,58,50,86,182,108,77,89,112,59,125,226,50,205,227,125,128,104,27,59,66,53,133,159,203,97,125,139,159,158,7,215,47,140,226,223,231,44,110,184,61,233,47,67,148,22,120,173,156,117,181,94,154,43,10,207,204,164,231,136,58,239,30,147,230,101,111,150,35,128,57,252,79,173,120,25,126,81,85,8,7,122,237,190,152,246,182,130,219,67,76,167,178,235,250,28,61,186,250,199,67,58,50,86,182,108,77,89,112,59,125,226,50,205,227,125,128,104,27,59,66,53,133,159,203,97,125,139,159,158,7,215,47,140,226,223,231,44,110,184,61,233,47,67,148,22,120,173,156,117,181,94,154,43,10,207,204,164,231,136,58,239,30,147,230,101,111,150,35,128,57,252,79,173,120,25,126,81,85,8,7,122,237,190,152,246,182,130,219,67,76,167,178,235,250,28,61,186,250,199,67,58,50,86,182,108,77],A:[0,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64],I:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255]},red_default={R:[0,128,255],G:[0,0,0],B:[0,0,0],A:[0,64,128],I:[0,128,255]},redyell_default={R:[192,224,255],G:[1,128,255],B:[0,0,0],A:[0,64,128],I:[0,128,255]},rocket_default={R:[3,112,144,188,236,246,255],G:[5,31,29,22,76,158,250],B:[26,87,91,86,62,117,235],A:[0,30,38,49,67,85,107],I:[0,73,92,118,160,205,255]},surface_default={R:[1,240,255],G:[1,128,255],B:[1,128,255],A:[0,76,128],I:[0,153,255]},turbo_default={R:[48,48,64,70,65,25,132,195,244,254,218,122],G:[18,18,64,107,150,226,255,241,199,158,57,4],B:[59,59,162,227,255,187,81,52,58,47,7,3],A:[0,22,26,30,34,43,52,57,63,67,77,86],I:[0,1,16,32,49,83,118,140,164,181,219,255]},violet_default={R:[0,128,255],G:[0,0,0],B:[0,128,255],A:[0,64,128],I:[0,128,255]},viridis_default={R:[68,49,53,253],G:[1,104,183,231],B:[84,142,121,37],A:[0,56,80,88],I:[0,64,192,255]},warm_default={R:[255,255,255],G:[127,196,254],B:[0,0,0],A:[0,64,128],I:[0,128,255]},winter_default={R:[0,0,0],G:[0,128,255],B:[255,196,128],A:[0,64,128],I:[0,128,255]},x_rain_default={R:[3,64,0,0,255,255,255],G:[0,0,0,255,255,192,3],B:[0,32,48,56,64,96,128],A:[0,8,16,24,32,52,80],I:[0,32,64,96,160,192,255]},afni_blues_inv_default={min:0,max:0,R:[0,37],G:[242,0],B:[255,255],A:[0,64],I:[0,255]},afni_reds_inv_default={R:[255,255],G:[255,11],B:[0,0],A:[0,64],I:[0,255]},roi_i256_default={min:0,max:0,R:[65,10,223,120,216,207,251,93,252,217,21,253,131,165,173,143,144,217,86,89,63,254,172,1,142,107,42,78,221,8,222,71,127,126,167,33,104,2,208,216,0,251,7,105,2,101,248,190,253,62,255,224,166,37,110,138,45,34,6,37,69,201,43,122,199,37,173,194,103,211,75,159,96,4,239,98,110,193,253,166,40,255,48,130,140,243,101,9,177,220,133,32,4,81,48,48,210,109,60,132,1,119,1,159,247,33,212,187,253,144,196,254,168,79,64,196,39,97,73,173,104,216,217,43,101,119,254,5,237,103,203,122,57,87,251,164,19,75,200,2,252,150,66,0,255,157,23,254,55,16,240,161,69,253,207,195,5,60,255,251,200,217,134,123,253,180,27,246,130,136,250,232,4,125,140,22,253,255,13,180,123,61,254,111,10,185,76,192,255,223,186,61,198,5,172,13,83,172,171,6,23,73,134,133,109,61,213,55,57,132,36,209,2,144,1,253,68,155,3,160,2,77,121,70,67,176,223,131,4,162,232,255,150,94,235,191,207,10,246,0,225,4,209,116,57,112,172,253,1,6,92,227,73,62,135,223],G:[162,50,112,245,4,124,176,243,56,125,183,139,182,68,189,4,225,10,20,223,7,46,31,193,225,250,219,41,2,100,83,181,34,150,72,223,168,248,80,253,7,117,214,2,248,10,3,59,179,160,90,244,146,4,207,4,125,255,96,100,1,208,130,51,116,181,236,53,244,5,165,28,181,86,96,42,254,1,134,194,214,92,41,204,137,86,207,3,143,3,100,239,164,94,65,251,131,244,173,57,143,107,217,53,210,0,148,250,45,198,81,40,61,218,252,88,171,0,248,24,248,4,41,100,187,46,208,145,43,168,121,46,175,250,125,107,233,112,207,231,174,215,53,9,43,153,52,124,128,65,210,147,255,147,63,200,148,254,0,179,241,42,239,2,230,8,82,135,87,16,3,87,86,151,254,8,255,86,53,19,7,192,171,201,253,247,197,103,251,126,0,149,54,183,61,126,79,113,10,103,184,75,11,195,222,136,149,131,8,99,240,177,252,255,198,16,7,68,178,66,191,150,73,26,211,109,78,209,240,254,1,166,247,131,2,0,167,127,133,10,43,99,235,3,214,142,176,82,132,38,10,249,255,215,44,81],B:[176,182,248,37,117,35,96,69,32,152,108,20,237,250,2,89,141,216,111,251,211,149,10,44,214,103,31,251,3,32,252,246,97,1,219,167,197,4,36,116,206,118,106,43,205,204,114,69,127,205,87,80,41,251,145,204,253,161,247,1,149,9,43,253,97,72,136,161,171,181,26,255,108,80,218,214,231,255,84,31,109,4,218,3,217,36,68,85,241,39,221,2,240,2,173,42,206,5,110,46,103,27,212,184,2,207,246,45,116,72,110,253,38,105,248,159,243,81,192,93,141,145,24,157,234,131,57,178,62,75,65,176,148,40,253,66,76,240,51,154,17,251,139,253,207,9,114,49,200,254,96,73,138,118,204,102,137,89,145,161,4,112,66,234,147,178,212,205,185,11,203,131,2,250,118,169,1,185,154,53,171,197,61,175,249,96,15,254,95,5,222,75,246,194,2,61,180,25,133,165,15,233,59,35,221,140,109,7,114,255,198,0,115,168,252,23,242,80,75,142,137,255,12,182,68,201,4,111,37,228,83,248,24,192,249,5,54,223,160,122,160,114,145,119,252,31,253,250,10,214,8,47,0,142,222,70],A:[0,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64],I:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255]},ColorTables=class{constructor(){__publicField(this,"gamma",1),__publicField(this,"version",.1),__publicField(this,"cluts",{});const n=Object.keys(cmaps_exports).filter(s=>!s.startsWith("$")).sort(new Intl.Collator("en").compare);for(const s of n)this.cluts[s]=cmaps_exports[s]}addColormap(a,n){this.cluts[a]=n}colormaps(){return Object.keys(this.cluts)}colorMaps(){return this.colormaps()}colormapFromKey(a){let n=this.cluts[a];return n!==void 0||(n=this.cluts[a.toLowerCase()],n!==void 0)?n:(a.length>0&&log$4.warn("No color map named "+a),{min:0,max:0,R:[0,255],G:[0,255],B:[0,255],A:[0,255],I:[0,255]})}colormap(a="",n=!1){const s=this.colormapFromKey(a);return this.makeLut(s.R,s.G,s.B,s.A,s.I,n)}makeLabelLut(a,n=255){if(a.R===void 0||a.G===void 0||a.B===void 0)throw new Error(`Invalid colormap table: ${a}`);const s=a.R.length,u=a.I??[...Array(s).keys()];if(s!==a.G.length||s!==a.B.length||s!==u.length)throw new Error(`colormap does not make sense: ${a}`);let f=new Uint8ClampedArray(s).fill(n);f[0]=0,a.A!==void 0&&(f=Uint8ClampedArray.from(a.A));const m=Math.min(...u),A=Math.max(...u),v=A-m+1,y=new Uint8ClampedArray(v*4).fill(0);for(let E=0;E0)for(let A=0;A"u"){S=new Uint8ClampedArray(A).fill(0);for(let e=0;e"u"&&(E=new Uint8ClampedArray(A).fill(64),E[0]=0);for(let e=0;e0&&(u[A]=!0);const f=n.length/3;let m=0;for(let A=0;A0&&(L=1/Math.sqrt(L),s[0]*=L,s[1]*=L,s[2]*=L),F[u]=s[0],F[u+1]=s[1],F[u+2]=s[2]}return F}},utiltiesLogger=log$4,NVMeshLoaders=class Z0{static readTRACT(n){const s=n.byteLength;if(s<20)throw new Error("File too small to be niml.tract: bytes = "+s);const u=new DataView(n),f=new Uint8Array(n);let m=0;function A(){for(;m=1&&ae<=2)fe=4;else if(ae>=3&&ae<=4)fe=2;else if(ae===5)fe=1;else if(ae!==0)throw new Error("impossible Matlab v4 datatype");if(L+=Q,W>50)throw new Error("Does not appear to be little-endian V4 Matlab file");const pe=L+g*fe;V[re]=z(ae,L,pe),L=pe}for(;L+20>10,L=F&1023;return(F>>15?-1:1)*(M?M===31?L?NaN:1/0:Math.pow(2,M-15)*(1+L/1024):6103515625e-14*(L/1024))}let u=0,f=0,m=new Float32Array([]);const A=[],v=[],y=[],T=[];let E=[],S=!1;const I=unzipSync$1(new Uint8Array(n),{filter(F){return F.originalSize>0}}),e=Object.keys(I);for(let F=0,M=e.length;F2||m!==1e3||u!==1128354388)throw new Error("Not a valid TRK file");const A=s.getInt16(36,!0),v=[];for(let J=0;J0)for(let me=0;me0)for(let re=0;re=T);L++)E[S]=parseFloat(M[L]),S++}const I=[];for(A++;f[A].length<1;)A++;if(v=f[A].trim().split(/\s+/),A++,v[0].includes("LINES")){const F=parseInt(v[1]);if(F<1)throw new Error("Corrupted VTK ASCII");let M=f[A].trim();const L=[];let V=[];if(M.startsWith("OFFSETS")){A++;let B=0;for(;B=F));b++);}V=Array.from(E)}else{let B=function(){M=f[A].trim();const q=M.trim().split(/\s+/);b=[];for(let Y=0;Y=b.length&&B();const Y=b[W++];z+=Y,L[q+1]=z;for(let X=0;X=b.length&&B();const Q=b[W++]*3;V.push(E[Q+0]),V.push(E[Q+1]),V.push(E[Q+2])}}}return{pts:Float32Array.from(V),offsetPt0:Uint32Array.from(L)}}else if(v[0].includes("TRIANGLE_STRIPS")){const F=parseInt(v[1]);for(let M=0;M1&&B.pop()&&(z=z.split(".").slice(0,-1).join("."));const b=Z0.readTSF(s,V);u.dpv||(u.dpv=[]);const W=b.reduce((Y,X)=>Math.min(Y,X)),q=b.reduce((Y,X)=>Math.max(Y,X));u.dpv.push({id:z,vals:Float32Array.from(b.slice()),global_min:W,global_max:q,cal_min:W,cal_max:q});return}if(F<3)return;if(e==="MZ3")S.values=Z0.readMZ3(s,F);else if(e==="ANNOT"){const V=Z0.readANNOT(s,F,!0);V instanceof Uint32Array?S.values=V:(S.values=V.scalars,S.colormapLabel=V.colormapLabel)}else if(e==="CRV"||e==="CURV")S.values=Z0.readCURV(s,F),S.isTransparentBelowCalMin=!1;else if(e==="GII"){const V=Z0.readGII(s,F);S.values=V.scalars,S.colormapLabel=V.colormapLabel}else if(e==="MGH"||e==="MGZ"){const V=Z0.readMGH(s,F,!0);"scalars"in V?(S.values=V.scalars,S.colormapLabel=V.colormapLabel):S.values=V}else if(e==="NII")S.values=Z0.readNII(s,F,u.anatomicalStructurePrimary);else if(e==="SMP")S.values=Z0.readSMP(s,F);else if(e==="STC")S.values=Z0.readSTC(s,F);else{log$4.warn("Unknown layer overlay format "+n);return}if(!S.values)return;S.nFrame4D=S.values.length/F,S.frame4D=0,S.outlineBorder=E;let M=S.values[0],L=S.values[0];for(let V=0;V5){const S=decompressSync$1(new Uint8Array(n));f=new DataView(S.buffer),m=f.getUint16(0,!0),n=S.buffer}m>5&&log$4.error("Unsupported or invalid BrainVoyager SMP version "+m);const A=f.getUint32(2,!0);A!==s&&log$4.error("SMP file has "+A+" vertices, background mesh has "+s);const v=f.getUint16(6,!0),y=new Float32Array(A*v);let T=9;function E(){const S=T;for(;T=3&&I.mapType===3&&(I.nLags=f.getUint32(T,!0),T+=4,I.mnLag=f.getUint32(T,!0),T+=4,I.mxLag=f.getUint32(T,!0),T+=4,I.ccOverlay=f.getUint32(T,!0),T+=4),I.clusterSize=f.getUint32(T,!0),T+=4,I.clusterCheck=f.getUint8(T),T+=1,I.critThresh=f.getFloat32(T,!0),T+=4,I.maxThresh=f.getFloat32(T,!0),T+=4,m>=4&&(I.includeValuesGreaterThreshMax=f.getUint32(T,!0),T+=4),I.df1=f.getUint32(T,!0),T+=4,I.df2=f.getUint32(T,!0),T+=4,m>=5?(I.posNegFlag=f.getUint32(T,!0),T+=4):I.posNegFlag=3,I.cortexBonferroni=f.getUint32(T,!0),T+=4,I.posMinRGB=[0,0,0],I.posMaxRGB=[0,0,0],I.negMinRGB=[0,0,0],I.negMaxRGB=[0,0,0],m>=2&&(I.posMinRGB[0]=f.getUint8(T),T++,I.posMinRGB[1]=f.getUint8(T),T++,I.posMinRGB[2]=f.getUint8(T),T++,I.posMaxRGB[0]=f.getUint8(T),T++,I.posMaxRGB[1]=f.getUint8(T),T++,I.posMaxRGB[2]=f.getUint8(T),T++,m>=4&&(I.negMinRGB[0]=f.getUint8(T),T++,I.negMinRGB[1]=f.getUint8(T),T++,I.negMinRGB[2]=f.getUint8(T),T++,I.negMaxRGB[0]=f.getUint8(T),T++,I.negMaxRGB[1]=f.getUint8(T),T++,I.negMaxRGB[2]=f.getUint8(T),T++),I.enableSMPColor=f.getUint8(T),T++,m>=4&&(I.lut=E()),I.colorAlpha=f.getFloat32(T,!0),T+=4),I.name=E();const e=new Float32Array(n,T,A);y.set(e,S*A),T+=A*4}return y}static readSTC(n,s){const u=new DataView(n),f=u.getInt32(8,!1);if(f!==s)throw new Error("Overlay has "+f+" vertices, expected "+s);let m=12+f*4;const A=u.getUint32(m,!1);m+=4;const v=new Float32Array(A*f);for(let y=0;y0)return v;const S=f.getInt32(A+=4,!1),I=f.getInt32(A+=4,!1);A+=I;const e=f.getInt32(A+=4,!1);if(e<1)return v;const F={R:Array(S).fill(0),G:Array(S).fill(0),B:Array(S).fill(0),A:Array(S).fill(0),I:Array(S).fill(0),labels:Array(S).fill("")};for(let B=0;B=S){log$4.warn("annot entry out of range");continue}F.R[z]=q,F.G[z]=Y,F.B[z]=X,F.A[z]=Q,F.I[z]=(Q<<24)+(X<<16)+(Y<<8)+q,F.labels[z]=W}const M=new Float32Array(m);M.fill(-1);let L=0;for(let B=0;B0&&log$4.error(`annot vertex colors do not match ${L} of ${m} vertices.`);for(let B=0;B=v*3)break;S[T+2]=parseInt(e[0])-1,S[T+1]=parseInt(e[1])-1,S[T+0]=parseInt(e[2])-1,T+=3}return{positions:E,indices:S}}static readASC(n){const s=n.byteLength,u=new Uint8Array(n);let f=0;function m(){for(;f65535)throw new Error("Invalid VTK binary polygons using little-endian data (MRtrix)");f+=4;const B=I.getInt32(f,!1);f+=4;let z=I.getInt32(f,!1);f+=4;for(let b=0;b=0&&(I=new Float32Array(n,y,v*3)),{positions:S,indices:E,colors:I}}static readMZ3(n,s=0){if(n.byteLength<20)throw new Error("File too small to be mz3: bytes = "+n.byteLength);let u=new DataView(n),f=u.getUint16(0,!0),m=n;if(f===35615||f===8075){const q=decompressSync$1(new Uint8Array(n));u=new DataView(q.buffer),f=u.getUint16(0,!0),m=q.buffer}const A=u.getUint16(2,!0),v=u.getUint32(4,!0);let y=u.getUint32(8,!0);const T=u.getUint32(12,!0);if(utiltiesLogger.debug("MZ3 magic %d attr %d face %d vert %d skip %d",f,A,v,y,T),f!==23117)throw new Error("Invalid MZ3 file");const E=(A&1)!==0,S=(A&2)!==0,I=(A&4)!==0;let e=(A&8)!==0;const F=(A&16)!==0;if(A>63)throw new Error("Unsupported future version of MZ3 file");let M=4;F&&(M=8);let L=0;if(s>0&&!E&&v<1&&!I&&(e=!0),e){let q=s;s===0&&(q=y);const Y=16+T+(E?1:0)*v*12+(S?1:0)*q*12+(I?1:0)*q*4,X=Math.floor((m.byteLength-Y)/M);y!==s&&X%s===0&&(log$4.warn("Issue 729: mz3 mismatch scalar NVERT does not match mesh NVERT"),y=s),L=Math.floor(X/y),L<1&&(log$4.warn("Corrupt MZ3: file reports NSCALAR but not enough bytes"),e=!1)}if(y<3&&s<3)throw new Error("Not a mesh MZ3 file (maybe scalar)");s>0&&s!==y&&log$4.warn("Layer has "+y+"vertices, but background mesh has "+s);let V=16+T,B=null;E&&(B=new Uint32Array(m,V,v*3),V+=v*3*4);let z=null;S&&(z=new Float32Array(m,V,y*3),V+=y*3*4);let b=null;if(I){b=new Float32Array(y*3);const q=new Uint8Array(m,V,y*4);V+=y*4;let Y=0,X=0;for(let Q=0;Q0){if(F){const q=new Float64Array(m,V,L*y);W=Float32Array.from(q)}else W=new Float32Array(m,V,L*y);V+=M*L*y}return s>0?W:{positions:z,indices:B,scalars:W,colors:b}}static readPLY(n){const s=n.byteLength,u=new Uint8Array(n);let f=0;function m(){for(;fg.length){const Se=new Uint32Array(g.length+g.length);Se.set(g),g=Se.slice()}const pe=parseInt(ae[V+1]);let me=parseInt(ae[V+2]);for(let Se=0;Se1&&log$4.warn("This is not a valid FreeSurfer ICO/TRI mesh.");const A=parseInt(m[0]),v=new Float32Array(A*3);let y=1;for(let S=0;S=A){log$4.error("ICO vertices corrupted");break}e*=3,v[e]=F,v[e+1]=M,v[e+2]=L}m=f[y].trim().split(/\s+/),y++;const T=parseInt(m[0]),E=new Uint32Array(T*3);for(let S=0;S=T){log$4.error("ICO indices corrupted");break}e*=3,E[e]=F,E[e+1]=M,E[e+2]=L}for(let S=0;S1||E!==T*3)&&log$4.warn("Multi-part BYU/GEO header or not a triangular mesh.");const S=[];y*=3;let I=0,e=2;for(;I=y));z++);}const F=[];T*=3;let M=0;for(;M=T));z++);}if(s)for(let B=0;B2)&&log$4.warn("This is not a valid MNI OBJ mesh.");let S=1;E===1?S=T:E===1&&(S=A),m+=S*4,m+=T;const I=T*3,e=new Uint32Array(I);for(let F=0;F1056964608&&(z[I+0]=(Y>>16&255)/255,z[I+1]=(Y>>8&255)/255,z[I+2]=(Y&255)/255),Y===0&&(z[I+0]=e,z[I+1]=F,z[I+2]=M),Y===1&&(z[I+0]=L,z[I+1]=V,z[I+2]=B),I+=3}S+=m*4;for(let q=0;q=3e3&&I<=3099&&T>580){let L=function(){for(;H"))return me;for(;H");)me+=L();return me},B=function(me,Se=!1){const ve=g.indexOf(me);if(ve<0)return 1;const we=g.indexOf('"',ve)+1,Ne=g.indexOf('"',we),De=g.slice(we,Ne);return Se?De:parseInt(De)},z=0,b=0,W=0,q="",Y=new Uint32Array;const X=new Uint8Array(n);let H=552,g;const J=M[5],re=new Float32Array(s*J);for(;H"));)if(g.includes("")||(g=V()),!g.startsWith("")||!g.endsWith(""))return log$4.warn("Unable to find CIfTI "),re;g=g.slice(15,-16);const we=g.trim().split(/\s+/);we.length4)&&log$4.warn("Not a valid MGH file");const F=v*y*T*E;let M=[];if(F%s!==0)return log$4.warn("Vertices in NIfTI ("+F+") is not a multiple of number of vertices ("+s+")"),M;if(S===3){M=new Float32Array(F);for(let Y=0;Y0)return log$4.warn("unsupported CTABreadFromBinaryV1"),M;if(H=-H,H!==2)return log$4.warn("CTABreadFromBinary: unknown version"),M;const g=f.getInt32(I+=4,e);if(g<0)return log$4.warn("CTABreadFromBinaryV2: nentries was ",g),M;const J=f.getInt32(I+=4,e);I+=J;const re=f.getInt32(I+=4,e);if(re<0)return M;const ae={R:[],G:[],B:[],A:[],I:[],labels:[]};for(let fe=0;fe"))if(A.startsWith(""))for(;f");)A+=m();else for(;f");)A+=m();const z=v("USE");if(z.length>1){z in V?M=V[z]:log$4.warn("Unable to find DEF for "+z);return}const b=y("diffuseColor");if(b.length<3)return;M[0]=Math.round(b[0]*255),M[1]=Math.round(b[1]*255),M[2]=Math.round(b[2]*255);const W=v("DEF");W.length<1||(V[W]=M)}for(;f=0?(E.push(W[J]+Y),E.push(W[X-1]+Y),E.push(W[X-0]+Y),X+=1):(X+=3,J=X-2)}else for(;X=0?(E.push(W[X-2]+Y),E.push(W[X-1]+Y),E.push(W[X-0]+Y),X+=1):X+=3;T=[...T,...q];const H=Math.floor(q.length/3),g=Array(H).fill(M).flat();if(I.length===H*3){let J=0,re=0;for(let ae=0;ae";)m++;if(re=f[m-1]==="/",ae+1=u)break}const fe=new TextDecoder().decode(n.slice(ae+1,m)).trim(),pe=fe.split(" ")[0].trim(),me=m;let Se=m,ve=m;if(f[ae+1]!=="?"&&f[ae+1]!=="!"){const we="";Se=f.indexOf(we,me),ve=Se+we.length-1}return{name:fe,startPos:ae,contentStartPos:me,contentEndPos:Se,endPos:ve}}let v=A();if(!v.name.startsWith("?xml"))throw new Error("readGII: Invalid XML file");for(;!v.name.startsWith("GIFTI")&&v.endPos1;){if(v=A(),v.name.startsWith("Label Key")&&(Y=v.name,g.I.push(X("Key=")),g.R.push(Math.round(255*X("Red=",!0))),g.G.push(Math.round(255*X("Green=",!0))),g.B.push(Math.round(255*X("Blue=",!0))),g.A.push(Math.round(255*X("Alpha",!0))),Y=new TextDecoder().decode(n.slice(v.contentStartPos+1,v.contentEndPos)).trim(),g.labels.push(H(""u"){let ae=function(fe){const pe=atob(fe),me=pe.length,Se=new Uint8Array(me);for(let ve=0;ve1&&(J=cmapper.makeLabelLut(g)),s>0)return{scalars:E,colormapLabel:J,anatomicalStructurePrimary:S};if(y.length>2&&!q&&(V[0]!==0||V[1]!==0||V[2]!==0)){W=Math.floor(y.length/3);let re=0;for(let ae=0;ae1?1:m,this.visible=A,this.meshShaderIndex=0,this.indexBuffer=v.createBuffer(),this.vertexBuffer=v.createBuffer(),this.vao=v.createVertexArray(),v.bindVertexArray(this.vao),v.bindBuffer(v.ELEMENT_ARRAY_BUFFER,this.indexBuffer),v.bindBuffer(v.ARRAY_BUFFER,this.vertexBuffer),v.enableVertexAttribArray(0),v.enableVertexAttribArray(1),this.f32PerVertex!==7?(v.vertexAttribPointer(0,3,v.FLOAT,!1,20,0),v.vertexAttribPointer(1,4,v.BYTE,!0,20,12),v.enableVertexAttribArray(2),v.vertexAttribPointer(2,4,v.UNSIGNED_BYTE,!0,20,16)):(v.vertexAttribPointer(0,3,v.FLOAT,!1,28,0),v.vertexAttribPointer(1,3,v.FLOAT,!1,28,12),v.enableVertexAttribArray(2),v.vertexAttribPointer(2,4,v.UNSIGNED_BYTE,!0,28,24)),v.bindVertexArray(null),this.vaoFiber=v.createVertexArray(),this.offsetPt0=null,this.hasConnectome=!1,this.colormapInvert=!1,this.fiberGroupColormap=null,this.pts=n,this.layers=[],this.type="mesh",f[3]<1){this.rgba255=f,this.fiberLength=2,this.fiberDither=.1,this.fiberColor="Global",this.fiberDecimationStride=1,this.fiberMask=[],this.colormap=y,this.dpg=T,this.dps=E,this.dpv=S,T&&this.initValuesArray(T),E&&this.initValuesArray(E),S&&this.initValuesArray(S),this.offsetPt0=s,this.updateFibers(v),v.bindVertexArray(this.vaoFiber),v.bindBuffer(v.ELEMENT_ARRAY_BUFFER,this.indexBuffer),v.bindBuffer(v.ARRAY_BUFFER,this.vertexBuffer),v.enableVertexAttribArray(0),v.vertexAttribPointer(0,3,v.FLOAT,!1,16,0),v.enableVertexAttribArray(1),v.vertexAttribPointer(1,4,v.UNSIGNED_BYTE,!0,16,12),v.bindVertexArray(null);return}if(y){this.connectome=y,this.hasConnectome=!0;const L=Object.keys(y);for(let V=0,B=L.length;VMath.min(m,A)),f=n[s].vals.reduce((m,A)=>Math.max(m,A));n[s].global_min=u,n[s].global_max=f,n[s].cal_min=u,n[s].cal_max=f}return n}linesToCylinders(n,s,u){function f(H){return fromValues$2(H[0],H[1],H[2])}const m=Math.pow(2,32)-1,A=u.length;let v=0,y=0;for(let H=0;H 1 requires f32PerVertex == 5");const I=new Float32Array(E*S),e=new Uint8Array(I.buffer);let F=0,M=create$1(),L=create$1(),V=create$1();const B=create$2();let z=create$2(),b=0;const W=this.fiberRadius;for(let H=0;H0){const q=parseInt(F.substring(3));q0){const q=parseInt(F.substring(3));q=this.dpg.length||X.A[H]<1||(Y[g]=!0,g*=4,q[g]=X.R[H],q[g+1]=X.G[H],q[g+2]=X.B[H],q[g+3]=255)}V.fill(-1);for(let H=0;H2&&this.fiberRadius>0?this.linesToCylinders(n,A,b):(this.indexCount=b.length,n.bindBuffer(n.ARRAY_BUFFER,this.vertexBuffer),n.bufferData(n.ARRAY_BUFFER,Uint32Array.from(v),n.STATIC_DRAW),n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,this.indexBuffer),n.bufferData(n.ELEMENT_ARRAY_BUFFER,Uint32Array.from(b),n.STATIC_DRAW))}indexNearestXYZmm(n,s,u){const f=this.pts,m=this.pts.length/3;let A=0,v=1/0,y=0;for(let T=0;T0)for(let T=0;TE.cal_max)continue;if(E.outlineBorder===void 0&&(E.outlineBorder=0),E.isAdditiveBlend===void 0&&(E.isAdditiveBlend=!1),E.colormapLabel&&E.colormapLabel.R&&!E.colormapLabel.lut&&(E.colormapLabel=cmapper.makeLabelLut(E.colormapLabel)),E.colormapLabel&&E.colormapLabel.lut){const z=E.colormapLabel.lut,b=Math.floor(z.length/4),W=Math.min(Math.max(E.frame4D,0),E.nFrame4D-1),q=m*W,Y=new Uint8Array(m*4);let X=0;for(let g=0;g0&&(H=NVMeshUtilities.getClusterBoundary(Y,this.tris)),X=0;for(let g=0;g0&&(z=NVMeshUtilities.getClusterBoundary(B,this.tris));let b=0;for(let W=0;W0)for(let T=0;T"u"){const L=new Float32Array([0,0,0,0,0,0]),V=new Uint32Array([0]);E={pts:L,offsetPt0:V},log$4.error("Creating empty tracts")}return m[3]=0,new Ii(E.pts,E.offsetPt0,s,m,f,A,u,"inferno",E.dpg||null,E.dps||null,E.dpv||null)}if(I==="GII")E=NVMeshLoaders.readGII(n);else if(I==="MZ3")E=NVMeshLoaders.readMZ3(n),(E instanceof Float32Array||E.positions===null)&&log$4.warn("MZ3 does not have positions (statistical overlay?)");else if(I==="ASC")E=NVMeshLoaders.readASC(n);else if(I==="DFS")E=NVMeshLoaders.readDFS(n);else if(I==="BYU"||I==="G")E=NVMeshLoaders.readGEO(n);else if(I==="GEO")E=NVMeshLoaders.readGEO(n,!0);else if(I==="ICO"||I==="TRI")E=NVMeshLoaders.readICO(n);else if(I==="OFF")E=NVMeshLoaders.readOFF(n);else if(I==="NV")E=NVMeshLoaders.readNV(n);else if(I==="OBJ")E=NVMeshLoaders.readOBJ(n);else if(I==="PLY")E=NVMeshLoaders.readPLY(n);else if(I==="X3D")E=NVMeshLoaders.readX3D(n);else if(I==="FIB"||I==="VTK"){if(E=NVMeshLoaders.readVTK(n),"offsetPt0"in E)return m[3]=0,new Ii(E.pts,E.offsetPt0,s,m,f,A,u,"inferno")}else I==="SRF"?E=NVMeshLoaders.readSRF(n):I==="STL"?E=NVMeshLoaders.readSTL(n):E=NVMeshLoaders.readFreeSurfer(n);if(E.anatomicalStructurePrimary&&(T=E.anatomicalStructurePrimary),E instanceof Float32Array)throw new Error("fatal: unknown mesh type loaded");if(!E.positions)throw new Error("positions not loaded");if(!E.indices)throw new Error("indices not loaded");if(y=E.positions,v=E.indices,"rgba255"in E&&E.rgba255.length>0&&(m=E.rgba255),"colors"in E&&E.colors&&E.colors.length===y.length){const L=y.length/3;m=new Uint8Array(L*4);let V=0,B=0;for(let z=0;z0&&(NVMeshLoaders.readLayer(s,n,M,f,"gray"),M.updateMesh(u)),M}static async loadLayer(n,s){let u;function f(e){const F=window.atob(e),M=F.length,L=new Uint8Array(M);for(let V=0;V-1&&(m=m.slice(0,m.indexOf("?")));let v=.5;"opacity"in n&&(v=n.opacity);let y="warm";"colormap"in n&&(y=n.colormap);let T="winter";"colormapNegative"in n&&(T=n.colormapNegative);let E=!1;"useNegativeCmap"in n&&(E=n.useNegativeCmap);let S=null;"cal_min"in n&&(S=n.cal_min);let I=null;"cal_max"in n&&(I=n.cal_max),NVMeshLoaders.readLayer(m,u,s,v,y,T,E,S,I)}static async loadFromUrl({url:n="",headers:s={},gl:u,name:f="",opacity:m=1,rgba255:A=[255,255,255,255],visible:v=!0,layers:y=[]}={}){let T=n.split("/");if(f===""){try{T=new URL(n).pathname.split("/")}catch{T=n.split("/")}f=T.slice(-1)[0],f.indexOf("?")>-1&&(f=f.slice(0,f.indexOf("?")))}if(n==="")throw Error("url must not be empty");if(!u)throw Error("gl context is null");const E=await fetch(n,{headers:s});if(!E.ok)throw Error(E.statusText);const S=await E.arrayBuffer(),I=await this.readMesh(S,f,u,m,new Uint8Array(A),v);if(!y||y.length<1)return I;for(let e=0;e{const f=new FileReader;f.onload=()=>{s(f.result)},f.onerror=u,f.readAsArrayBuffer(n)})}static async loadFromFile({file:n,gl:s,name:u="",opacity:f=1,rgba255:m=[255,255,255,255],visible:A=!0,layers:v=[]}={}){if(!n)throw new Error("file must be set");if(!s)throw new Error("rendering context must be set");const y=await Ii.readFileAsync(n),T=Ii.readMesh(y,u,s,f,new Uint8Array(m),A);if(!v||v.length<1)return T;for(let E=0;E>18,y=(S&258048)>>12,T=(S&4032)>>6,E=S&63,s+=u[v]+u[y]+u[T]+u[E];return m===1?(S=n[A],v=(S&252)>>2,y=(S&3)<<4,s+=u[v]+u[y]+"=="):m===2&&(S=n[A]<<8|n[A+1],v=(S&64512)>>10,y=(S&1008)>>4,T=(S&15)<<2,s+=u[v]+u[y]+u[T]+"="),s}static download(n,s,u){const f=document.createElement("a"),m=new Blob([n],{type:u});f.href=URL.createObjectURL(m),f.download=s,f.click()}static readFileAsync(n){return new Promise((s,u)=>{const f=new FileReader;f.onload=()=>{s(f.result)},f.onerror=u,f.readAsArrayBuffer(n)})}static blobToBase64(n){return new Promise(s=>{const u=new FileReader;u.onloadend=()=>s(u.result),u.readAsDataURL(n)})}static decompressBase64String(n){const s=atob(n),u=new ArrayBuffer(s.length),f=new Uint8Array(u);for(let v=0;vn+m*u)}static sph2cartDeg(n,s){const u=-s*(Math.PI/180),f=(n-90)%360*(Math.PI/180),m=[Math.cos(u)*Math.cos(f),Math.cos(u)*Math.sin(f),Math.sin(u)],A=Math.sqrt(m[0]*m[0]+m[1]*m[1]+m[2]*m[2]);return A<=0||(m[0]/=A,m[1]/=A,m[2]/=A),m}static vox2mm(n,s){const u=clone$3(s);transpose$3(u,u);const f=fromValues$1(n[0],n[1],n[2],1);return transformMat4(f,f,u),fromValues$2(f[0],f[1],f[2])}},isPlatformLittleEndian=()=>{const a=new ArrayBuffer(2);return new DataView(a).setInt16(0,256,!0),new Int16Array(a)[0]===256},ImageType=(a=>(a[a.UNKNOWN=0]="UNKNOWN",a[a.NII=1]="NII",a[a.DCM=2]="DCM",a[a.DCM_MANIFEST=3]="DCM_MANIFEST",a[a.MIH=4]="MIH",a[a.MIF=5]="MIF",a[a.NHDR=6]="NHDR",a[a.NRRD=7]="NRRD",a[a.MHD=8]="MHD",a[a.MHA=9]="MHA",a[a.MGH=10]="MGH",a[a.MGZ=11]="MGZ",a[a.V=12]="V",a[a.V16=13]="V16",a[a.VMR=14]="VMR",a[a.HEAD=15]="HEAD",a[a.DCM_FOLDER=16]="DCM_FOLDER",a))(ImageType||{}),NVIMAGE_TYPE=Object.freeze({...ImageType,parse:a=>{let n=0;switch(a.toUpperCase()){case"":case"DCM":n=2;break;case"TXT":n=3;break;case"NII":n=1;break;case"MIH":n=4;break;case"MIF":n=5;break;case"NHDR":n=6;break;case"NRRD":n=7;break;case"MHD":n=8;break;case"MHA":n=9;break;case"MGH":n=10;break;case"MGZ":n=11;break;case"V":n=12;break;case"V16":n=13;break;case"VMR":n=14;break;case"HEAD":n=15;break}return n}}),NVImageFromUrlOptions=(a,n="",s="",u="gray",f=1,m=NaN,A=NaN,v=!0,y=.02,T=!1,E=!1,S="",I=0,e=NVIMAGE_TYPE.UNKNOWN,F=NaN,M=NaN,L=!0,V=!1,B=[])=>({url:a,urlImageData:n,name:s,colormap:u,colorMap:u,opacity:f,cal_min:m,cal_max:A,trustCalMinMax:v,percentileFrac:y,ignoreZeroVoxels:T,useQFormNotSForm:E,colormapNegative:S,imageType:e,cal_minNeg:F,cal_maxNeg:M,colorbarVisible:L,frame4D:I,alphaThreshold:V,colormapLabel:B});function getBestTransform(a,n,s){const u=a;let f=null;if(u){const m={colSize:n[0],rowSize:n[1],sliceSize:n[2]},A=s,v=[u[0],u[1],u[2]],y=[u[3],u[4],u[5]],T=[v[1]*y[2]-v[2]*y[1],v[2]*y[0]-v[0]*y[2],v[0]*y[1]-v[1]*y[0]];f=[[v[0]*m.colSize*-1,y[0]*m.rowSize*-1,T[0]*m.sliceSize*-1,-1*A[0]],[v[1]*m.colSize*-1,y[1]*m.rowSize*-1,T[1]*m.sliceSize*-1,-1*A[1]],[v[2]*m.colSize,y[2]*m.rowSize,T[2]*m.sliceSize,A[2]],[0,0,0,1]]}return f}function str2Buffer(a){const n=[];for(let s=0;s=v)break;let I=!0;for(let e=0;e<3;++e)f[e]>u[e]&&(I=!1),m[e]{}),__publicField(this,"onOpacityChange",()=>{}),__publicField(this,"mm000"),__publicField(this,"mm100"),__publicField(this,"mm010"),__publicField(this,"mm001"),__publicField(this,"cal_min"),__publicField(this,"cal_max"),__publicField(this,"robust_min"),__publicField(this,"robust_max"),__publicField(this,"global_min"),__publicField(this,"global_max"),__publicField(this,"urlImgData"),__publicField(this,"isManifest"),__publicField(this,"limitFrames4D"),this.name=s,this.id=v4(),this._colormap=u,this._opacity=f>1?1:f,this.percentileFrac=T,this.ignoreZeroVoxels=E,this.trustCalMinMax=y,this.colormapNegative=I,this.colormapLabel=B,this.frame4D=e,this.cal_minNeg=M,this.cal_maxNeg=L,this.colorbarVisible=V,this.useQFormNotSForm=S,!n)return;const z=/(?:\.([^.]+))?$/;let b=z.exec(s)[1]||"";b=b.toUpperCase(),b==="GZ"&&(b=z.exec(s.slice(0,-3))[1],b=b.toUpperCase());let W=null;switch(F===NVIMAGE_TYPE.UNKNOWN&&(F=NVIMAGE_TYPE.parse(b)),this.imageType=F,F){case NVIMAGE_TYPE.DCM_FOLDER:case NVIMAGE_TYPE.DCM_MANIFEST:case NVIMAGE_TYPE.DCM:W=this.readDICOM(n);break;case NVIMAGE_TYPE.MIH:case NVIMAGE_TYPE.MIF:W=this.readMIF(n,m);break;case NVIMAGE_TYPE.NHDR:case NVIMAGE_TYPE.NRRD:W=this.readNRRD(n,m);break;case NVIMAGE_TYPE.MHD:case NVIMAGE_TYPE.MHA:W=this.readMHA(n,m);break;case NVIMAGE_TYPE.MGH:case NVIMAGE_TYPE.MGZ:W=this.readMGH(n);break;case NVIMAGE_TYPE.V:W=this.readECAT(n);break;case NVIMAGE_TYPE.V16:W=this.readV16(n);break;case NVIMAGE_TYPE.VMR:W=this.readVMR(n);break;case NVIMAGE_TYPE.HEAD:W=this.readHEAD(n,m);break;case NVIMAGE_TYPE.NII:this.hdr=nifti.readHeader(n),this.hdr!==null&&(this.hdr.cal_min===0&&this.hdr.cal_max===255&&(this.hdr.cal_max=0),nifti.isCompressed(n)?W=nifti.readImage(this.hdr,nifti.decompress(n)):W=nifti.readImage(this.hdr,n));break;default:throw new Error("Image type not supported")}if(this.hdr&&typeof this.hdr.magic=="number"&&(this.hdr.magic="n+1"),this.nFrame4D=1,this.hdr)for(let H=4;H<7;H++)this.hdr.dims[H]>1&&(this.nFrame4D*=this.hdr.dims[H]);if(this.frame4D=Math.min(this.frame4D,this.nFrame4D-1),this.nTotalFrame4D=this.nFrame4D,!this.hdr||!W)return;this.nVox3D=this.hdr.dims[1]*this.hdr.dims[2]*this.hdr.dims[3];const q=this.nVox3D*(this.hdr.numBitsPerVoxel/8),Y=W.byteLength/q;if(Y!==this.nFrame4D&&(Y>0&&Y*q===W.byteLength?log$4.debug("Loading the first "+Y+" of "+this.nFrame4D+" volumes"):log$4.warn("This header does not match voxel data",this.hdr,W.byteLength),this.nFrame4D=Y),(this.hdr.intent_code===1007||this.hdr.intent_code===2003)&&this.nFrame4D===3&&this.hdr.datatypeCode===16){const g=new Float32Array(W).slice();this.hdr.datatypeCode=2304,this.nFrame4D=1;for(let pe=4;pe<7;pe++)this.hdr.dims[pe]=1;this.hdr.dims[0]=3,W=new Uint8Array(this.nVox3D*4);let J=1;for(let pe=0;pe0)*1,Ne=+(Se>0)*2,De=+(ve>0)*4;let je=248+we+Ne+De;Math.abs(me)+Math.abs(Se)+Math.abs(ve)<.1&&(je=0),W[fe+3]=je,fe+=4}}(this.hdr.pixDims[1]===0||this.hdr.pixDims[2]===0||this.hdr.pixDims[3]===0)&&log$4.error("pixDims not plausible",this.hdr),(isNaN(this.hdr.scl_slope)||this.hdr.scl_slope===0)&&(this.hdr.scl_slope=1),isNaN(this.hdr.scl_inter)&&(this.hdr.scl_inter=0);let X=isAffineOK(this.hdr.affine);if(S||!X||this.hdr.qform_code>this.hdr.sform_code){log$4.debug("spatial transform based on QForm");const H=this.hdr.quatern_b,g=this.hdr.quatern_c,J=this.hdr.quatern_d,re=Math.sqrt(1-(Math.pow(H,2)+Math.pow(g,2)+Math.pow(J,2))),ae=this.hdr.pixDims[0]===0?1:this.hdr.pixDims[0],fe=[[re*re+H*H-g*g-J*J,2*H*g-2*re*J,2*H*J+2*re*g],[2*H*g+2*re*J,re*re+g*g-H*H-J*J,2*g*J-2*re*H],[2*H*J-2*re*g,2*g*J+2*re*H,re*re+J*J-g*g-H*H]],pe=this.hdr.affine;for(let me=0;me<3;me+=1)for(let Se=0;Se<3;Se+=1)pe[me][Se]=fe[me][Se]*this.hdr.pixDims[Se+1],Se===2&&(pe[me][Se]*=ae);pe[0][3]=this.hdr.qoffset_x,pe[1][3]=this.hdr.qoffset_y,pe[2][3]=this.hdr.qoffset_z,this.hdr.affine=pe}if(X=isAffineOK(this.hdr.affine),!X){log$4.debug("Defective NIfTI: spatial transform does not make sense");let H=this.hdr.pixDims[1],g=this.hdr.pixDims[2],J=this.hdr.pixDims[3];(isNaN(H)||H===0)&&(H=1),(isNaN(g)||g===0)&&(g=1),(isNaN(J)||J===0)&&(J=1),this.hdr.pixDims[1]=H,this.hdr.pixDims[2]=g,this.hdr.pixDims[3]=J;const re=[[H,0,0,0],[0,g,0,0],[0,0,J,0],[0,0,0,1]];this.hdr.affine=re}if(this.hdr.datatypeCode!==128&&this.hdr.datatypeCode!==2304&&this.hdr.littleEndian!==isPlatformLittleEndian()&&this.hdr.numBitsPerVoxel>8){if(this.hdr.numBitsPerVoxel===16){const H=new Uint16Array(W);for(let g=0;g>8&255)<<16>>16}}else if(this.hdr.numBitsPerVoxel===32){const H=new Uint32Array(W);for(let g=0;g>8&65280|J>>24&255}}else if(this.hdr.numBitsPerVoxel===64){const H=this.hdr.numBitsPerVoxel/8,g=new Uint8Array(W);for(let J=0;J.01?log$4.warn("Warning voxels not aligned with world space: "+E+` degrees from plumb. -`):E=0,E}calculateOblique(){if(!this.matRAS)throw new Error("matRAS not defined");if(this.pixDimsRAS===void 0)throw new Error("pixDimsRAS not defined");if(!this.dimsRAS)throw new Error("dimsRAS not defined");this.oblique_angle=this.computeObliqueAngle(this.matRAS);const n=this.vox2mm([0,0,0],this.matRAS),s=this.vox2mm([1/this.pixDimsRAS[1],0,0],this.matRAS),u=this.vox2mm([0,1/this.pixDimsRAS[2],0],this.matRAS),f=this.vox2mm([0,0,1/this.pixDimsRAS[3]],this.matRAS);subtract$1(s,s,n),subtract$1(u,u,n),subtract$1(f,f,n);const m=fromValues$3(s[0],s[1],s[2],0,u[0],u[1],u[2],0,f[0],f[1],f[2],0,0,0,0,1);this.obliqueRAS=clone$3(m);const A=Math.abs(90-angle(s,u)*(180/Math.PI)),v=Math.abs(90-angle(s,f)*(180/Math.PI)),y=Math.abs(90-angle(u,f)*(180/Math.PI));this.maxShearDeg=Math.max(Math.max(A,v),y),this.maxShearDeg>.1&&log$4.warn("Warning: voxels are rhomboidal, maximum shear is %f degrees.",this.maxShearDeg);const T=fromValues$1(this.dimsRAS[1],this.dimsRAS[2],this.dimsRAS[3],1),E=clone$3(this.matRAS);transpose$3(E,E);const S=fromValues$1(-.5,-.5,-.5,0);translate(E,E,fromValues$2(S[0],S[1],S[2])),E[0]*=T[0],E[1]*=T[0],E[2]*=T[0],E[4]*=T[1],E[5]*=T[1],E[6]*=T[1],E[8]*=T[2],E[9]*=T[2],E[10]*=T[2],this.frac2mm=clone$3(E);const I=this.pixDimsRAS[1],e=this.pixDimsRAS[2],F=this.pixDimsRAS[3],M=clone$3(E);M[0]=I*T[0],M[1]=0,M[2]=0,M[4]=0,M[5]=e*T[1],M[6]=0,M[8]=0,M[9]=0,M[10]=F*T[2];const L=this.mm2vox([0,0,0],!0);M[12]=(-L[0]-.5)*I,M[13]=(-L[1]-.5)*e,M[14]=(-L[2]-.5)*F,this.frac2mmOrtho=clone$3(M),this.extentsMinOrtho=[M[12],M[13],M[14]],this.extentsMaxOrtho=[M[0]+M[12],M[5]+M[13],M[10]+M[14]],this.mm2ortho=create$3(),invert(this.mm2ortho,m)}THD_daxes_to_NIFTI(n,s,u){const f=this.hdr;if(f===null)throw new Error("HDR is not set");f.sform_code=2;const m="xxyyzzg";let A=-1,v=-1,y=-1;const T=["x","y","z"];T[0]=m[u[0]],T[1]=m[u[1]],T[2]=m[u[2]];const E=n.slice(0,3),S=s.slice(0,3);for(let I=0;I<3;I++)T[I]==="x"?A=I:T[I]==="y"?v=I:y=I;A<0||v<0||y<0||A===v||A===y||v===y||(f.pixDims[1]=Math.abs(E[0]),f.pixDims[2]=Math.abs(E[1]),f.pixDims[3]=Math.abs(E[2]),f.affine=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]],f.affine[0][A]=-E[A],f.affine[1][v]=-E[v],f.affine[2][y]=E[y],f.affine[0][3]=-S[A],f.affine[1][3]=-S[v],f.affine[2][3]=S[y])}SetPixDimFromSForm(){if(!this.hdr)throw new Error("hdr not defined");const n=this.hdr.affine,s=fromValues$3(n[0][0],n[0][1],n[0][2],n[0][3],n[1][0],n[1][1],n[1][2],n[1][3],n[2][0],n[2][1],n[2][2],n[2][3],n[3][0],n[3][1],n[3][2],n[3][3]),u=this.vox2mm([0,0,0],s),f=this.vox2mm([1,0,0],s);subtract$1(f,f,u);const m=this.vox2mm([0,1,0],s);subtract$1(m,m,u);const A=this.vox2mm([0,0,1],s);subtract$1(A,A,u),this.hdr.pixDims[1]=length$1(f),this.hdr.pixDims[2]=length$1(m),this.hdr.pixDims[3]=length$1(A)}readDICOM(n){if(this.series=new daikon.Series,Array.isArray(n))for(let S=0;S1&&(s.dims[3]>1&&log$4.debug("To Do: multiple slices per file and multiple files (XA30 DWI)"),s.dims[3]=this.series.images.length);const u=this.series.images[0].getPixelSpacing();if(s.pixDims[1]=u[0],s.pixDims[2]=u[1],this.series.images.length>1){const S=fromValues$2(...this.series.images[0].getImagePosition()),I=fromValues$2(...this.series.images[1].getImagePosition()),e=fromValues$2(0,0,0);subtract$1(e,S,I),s.pixDims[3]=length$1(e)}else s.pixDims[3]=this.series.images[0].getSliceThickness();s.pixDims[4]=this.series.images[0].getTR()/1e3;const f=this.series.images[0].getDataType(),m=this.series.images[0].getBitsAllocated();s.numBitsPerVoxel=m,this.hdr.littleEndian=this.series.images[0].littleEndian,m===8&&f===2?s.datatypeCode=256:m===8&&f===3?s.datatypeCode=2:m===16&&f===2?s.datatypeCode=4:m===16&&f===3?s.datatypeCode=512:m===32&&f===2?s.datatypeCode=8:m===32&&f===3?s.datatypeCode=768:m===32&&f===4?s.datatypeCode=16:m===64&&f===4?s.datatypeCode=64:m===1?s.datatypeCode=1:log$4.warn("Unsupported DICOM format: "+f+" "+m);const A=s.pixDims.slice(1,4),v=getBestTransform(this.series.images[0].getImageDirections(),A,this.series.images[0].getImagePosition());v&&(s.sform_code=1,s.affine=[[v[0][0],v[0][1],v[0][2],v[0][3]],[v[1][0],v[1][1],v[1][2],v[1][3]],[v[2][0],v[2][1],v[2][2],v[2][3]],[0,0,0,1]]);let y,T=this.series.validatePixelDataLength(this.series.images[0]);const E=new Uint8Array(new ArrayBuffer(T*this.series.images.length));for(let S=0;S14)throw new Error("Not a valid ECAT file");let A=512,v=0;const y=[];let T=new Float32Array;for(;;){const E=u.getInt32(A,!1),S=u.getInt32(A+12,!1);if(E+S!==31)break;let I=A+20,e=0,F=0;for(;e<31&&(F=u.getInt32(I,!1),I+=16,F!==0);){e++;let M=F*512;const L=M-512,V=u.getUint16(L,!1);s.dims[1]=u.getUint16(L+4,!1),s.dims[2]=u.getUint16(L+6,!1),s.dims[3]=u.getUint16(L+8,!1);const B=u.getFloat32(L+26,!1);s.pixDims[1]=u.getFloat32(L+34,!1)*10,s.pixDims[2]=u.getFloat32(L+38,!1)*10,s.pixDims[3]=u.getFloat32(L+42,!1)*10,s.pixDims[4]=u.getUint32(L+46,!1)/1e3,y.push(s.pixDims[4]);const z=s.dims[1]*s.dims[2]*s.dims[3],b=new Float32Array(z);if(V===1)for(let q=0;q1){s.dims[0]=4;let E=!1;for(let S=0;S=4){let A=8+m;const v=u.getUint32(A+88,!0);if(A=A+92,v>0){const y=n.byteLength;for(let T=0;T4)&&log$4.warn("Not a valid MGH file"),E===0?(s.numBitsPerVoxel=8,s.datatypeCode=2):E===4?(s.numBitsPerVoxel=16,s.datatypeCode=4):E===1?(s.numBitsPerVoxel=32,s.datatypeCode=8):E===3&&(s.numBitsPerVoxel=32,s.datatypeCode=16),s.dims[1]=A,s.dims[2]=v,s.dims[3]=y,s.dims[4]=T,T>1&&(s.dims[0]=4),s.pixDims[1]=S,s.pixDims[2]=I,s.pixDims[3]=e,s.vox_offset=284,s.sform_code=1;const g=fromValues$3(F*s.pixDims[1],V*s.pixDims[2],b*s.pixDims[3],0,M*s.pixDims[1],B*s.pixDims[2],W*s.pixDims[3],0,L*s.pixDims[1],z*s.pixDims[2],q*s.pixDims[3],0,0,0,0,1),J=[s.dims[1]/2,s.dims[2]/2,s.dims[3]/2,1],re=[0,0,0,0];for(let fe=0;fe<3;fe++){re[fe]=0;for(let pe=0;pe<3;pe++)re[fe]=re[fe]+g[pe+fe*4]*J[pe]}s.affine=[[g[0],g[1],g[2],Y-re[0]],[g[4],g[5],g[6],X-re[1]],[g[8],g[9],g[10],H-re[2]],[0,0,0,1]];const ae=s.dims[1]*s.dims[2]*s.dims[3]*s.dims[4]*(s.numBitsPerVoxel/8);return u.slice(s.vox_offset,s.vox_offset+ae)}readHEAD(n,s){this.hdr=new nifti.NIFTI1;const u=this.hdr;u.dims[0]=3,u.pixDims=[1,1,1,1,1,0,0,0];let f=[0,0,0],m=[0,0,0],A=[1,1,1];const y=new TextDecoder().decode(n).split(/\r?\n/),T=(n.byteLength+8)%16,E=n.byteLength+(16-T);log$4.debug(n.byteLength,"len",E);const S=new Uint8Array(E);S.fill(0),S.set(new Uint8Array(n));const I=new nifti.NIFTIEXTENSION(E+8,42,S,!0);u.addExtension(I),u.extensionCode=42,u.extensionFlag[0]=1,u.extensionSize=E+8;const e=y.length;let F=0,M=!1;for(;F2&&(M=M.slice(2)),y.startsWith("BinaryDataByteOrderMSB")&&M[0].includes("False")&&(T.littleEndian=!0),y.startsWith("BinaryDataByteOrderMSB")&&M[0].includes("True")&&(T.littleEndian=!1),y.startsWith("CompressedData")&&M[0].includes("True")&&(E=!0),y.startsWith("TransformMatrix"))for(let L=0;L<9;L++)I[L]=parseFloat(M[L]);if(y.startsWith("Offset"))for(let L=0;L2||J.length!==4)break;u.affine[E][0]=parseFloat(J[0]),u.affine[E][1]=parseFloat(J[1]),u.affine[E][2]=parseFloat(J[2]),u.affine[E][3]=parseFloat(J[3]),E++;break;case"RepetitionTime":S=parseFloat(J[0]);break;case"file":I=!J[0].startsWith(". "),I||(J=J[0].split(" "),u.vox_offset=parseInt(J[1]));break}}const e=u.dims[0];e>5&&log$4.warn("reader only designed for a maximum of 5 dimensions (XYZTD)");let F=1;for(let J=0;J0&&(u.pixDims[4]=S),I&&!s&&log$4.warn("MIH header provided without paired image data");let M;s&&I?M=s.slice(0):M=n.slice(u.vox_offset,u.vox_offset+F*(u.numBitsPerVoxel/8)),T.length!==u.dims[0]&&log$4.warn("dims does not match layout");let L=1;const V=[1,1,1,1,1],B=[!1,!1,!1,!1,!1];for(let J=0;J=3e3&&I<=3099&&T>580){let L=function(){for(;Q"))return me;for(;Q");)me+=L();return me},B=function(me,Se=!1){const ve=g.indexOf(me);if(ve<0)return 1;const we=g.indexOf('"',ve)+1,Ne=g.indexOf('"',we),De=g.slice(we,Ne);return Se?De:parseInt(De)},z=0,b=0,W=0,q="",Y=new Uint32Array;const X=new Uint8Array(n);let Q=552,g;const J=M[5],re=new Float32Array(s*J);for(;Q"));)if(g.includes("")||(g=V()),!g.startsWith("")||!g.endsWith(""))return log$4.warn("Unable to find CIfTI "),re;g=g.slice(15,-16);const we=g.trim().split(/\s+/);we.length4)&&log$4.warn("Not a valid MGH file");const F=v*y*T*E;let M=[];if(F%s!==0)return log$4.warn("Vertices in NIfTI ("+F+") is not a multiple of number of vertices ("+s+")"),M;if(S===3){M=new Float32Array(F);for(let Y=0;Y0)return log$4.warn("unsupported CTABreadFromBinaryV1"),M;if(Q=-Q,Q!==2)return log$4.warn("CTABreadFromBinary: unknown version"),M;const g=f.getInt32(I+=4,e);if(g<0)return log$4.warn("CTABreadFromBinaryV2: nentries was ",g),M;const J=f.getInt32(I+=4,e);I+=J;const re=f.getInt32(I+=4,e);if(re<0)return M;const ae={R:[],G:[],B:[],A:[],I:[],labels:[]};for(let fe=0;fe"))if(A.startsWith(""))for(;f");)A+=m();else for(;f");)A+=m();const z=v("USE");if(z.length>1){z in V?M=V[z]:log$4.warn("Unable to find DEF for "+z);return}const b=y("diffuseColor");if(b.length<3)return;M[0]=Math.round(b[0]*255),M[1]=Math.round(b[1]*255),M[2]=Math.round(b[2]*255);const W=v("DEF");W.length<1||(V[W]=M)}for(;f=0?(E.push(W[J]+Y),E.push(W[X-1]+Y),E.push(W[X-0]+Y),X+=1):(X+=3,J=X-2)}else for(;X=0?(E.push(W[X-2]+Y),E.push(W[X-1]+Y),E.push(W[X-0]+Y),X+=1):X+=3;T=[...T,...q];const Q=Math.floor(q.length/3),g=Array(Q).fill(M).flat();if(I.length===Q*3){let J=0,re=0;for(let ae=0;ae";)m++;if(re=f[m-1]==="/",ae+1=u)break}const fe=new TextDecoder().decode(n.slice(ae+1,m)).trim(),pe=fe.split(" ")[0].trim(),me=m;let Se=m,ve=m;if(f[ae+1]!=="?"&&f[ae+1]!=="!"){const we="";Se=f.indexOf(we,me),ve=Se+we.length-1}return{name:fe,startPos:ae,contentStartPos:me,contentEndPos:Se,endPos:ve}}let v=A();if(!v.name.startsWith("?xml"))throw new Error("readGII: Invalid XML file");for(;!v.name.startsWith("GIFTI")&&v.endPos1;){if(v=A(),v.name.startsWith("Label Key")&&(Y=v.name,g.I.push(X("Key=")),g.R.push(Math.round(255*X("Red=",!0))),g.G.push(Math.round(255*X("Green=",!0))),g.B.push(Math.round(255*X("Blue=",!0))),g.A.push(Math.round(255*X("Alpha",!0))),Y=new TextDecoder().decode(n.slice(v.contentStartPos+1,v.contentEndPos)).trim(),g.labels.push(Q(""u"){let ae=function(fe){const pe=atob(fe),me=pe.length,Se=new Uint8Array(me);for(let ve=0;ve1&&(J=cmapper.makeLabelLut(g)),s>0)return{scalars:E,colormapLabel:J,anatomicalStructurePrimary:S};if(y.length>2&&!q&&(V[0]!==0||V[1]!==0||V[2]!==0)){W=Math.floor(y.length/3);let re=0;for(let ae=0;ae1?1:m,this.visible=A,this.meshShaderIndex=0,this.indexBuffer=v.createBuffer(),this.vertexBuffer=v.createBuffer(),this.vao=v.createVertexArray(),v.bindVertexArray(this.vao),v.bindBuffer(v.ELEMENT_ARRAY_BUFFER,this.indexBuffer),v.bindBuffer(v.ARRAY_BUFFER,this.vertexBuffer),v.enableVertexAttribArray(0),v.enableVertexAttribArray(1),this.f32PerVertex!==7?(v.vertexAttribPointer(0,3,v.FLOAT,!1,20,0),v.vertexAttribPointer(1,4,v.BYTE,!0,20,12),v.enableVertexAttribArray(2),v.vertexAttribPointer(2,4,v.UNSIGNED_BYTE,!0,20,16)):(v.vertexAttribPointer(0,3,v.FLOAT,!1,28,0),v.vertexAttribPointer(1,3,v.FLOAT,!1,28,12),v.enableVertexAttribArray(2),v.vertexAttribPointer(2,4,v.UNSIGNED_BYTE,!0,28,24)),v.bindVertexArray(null),this.vaoFiber=v.createVertexArray(),this.offsetPt0=null,this.hasConnectome=!1,this.colormapInvert=!1,this.fiberGroupColormap=null,this.pts=n,this.layers=[],this.type="mesh",f[3]<1){this.rgba255=f,this.fiberLength=2,this.fiberDither=.1,this.fiberColor="Global",this.fiberDecimationStride=1,this.fiberMask=[],this.colormap=y,this.dpg=T,this.dps=E,this.dpv=S,T&&this.initValuesArray(T),E&&this.initValuesArray(E),S&&this.initValuesArray(S),this.offsetPt0=s,this.updateFibers(v),v.bindVertexArray(this.vaoFiber),v.bindBuffer(v.ELEMENT_ARRAY_BUFFER,this.indexBuffer),v.bindBuffer(v.ARRAY_BUFFER,this.vertexBuffer),v.enableVertexAttribArray(0),v.vertexAttribPointer(0,3,v.FLOAT,!1,16,0),v.enableVertexAttribArray(1),v.vertexAttribPointer(1,4,v.UNSIGNED_BYTE,!0,16,12),v.bindVertexArray(null);return}if(y){this.connectome=y,this.hasConnectome=!0;const L=Object.keys(y);for(let V=0,B=L.length;VMath.min(m,A)),f=n[s].vals.reduce((m,A)=>Math.max(m,A));n[s].global_min=u,n[s].global_max=f,n[s].cal_min=u,n[s].cal_max=f}return n}linesToCylinders(n,s,u){function f(Q){return fromValues$2(Q[0],Q[1],Q[2])}const m=Math.pow(2,32)-1,A=u.length;let v=0,y=0;for(let Q=0;Q 1 requires f32PerVertex == 5");const I=new Float32Array(E*S),e=new Uint8Array(I.buffer);let F=0,M=create$1(),L=create$1(),V=create$1();const B=create$2();let z=create$2(),b=0;const W=this.fiberRadius;for(let Q=0;Q0){const q=parseInt(F.substring(3));q0){const q=parseInt(F.substring(3));q=this.dpg.length||X.A[Q]<1||(Y[g]=!0,g*=4,q[g]=X.R[Q],q[g+1]=X.G[Q],q[g+2]=X.B[Q],q[g+3]=255)}V.fill(-1);for(let Q=0;Q2&&this.fiberRadius>0?this.linesToCylinders(n,A,b):(this.indexCount=b.length,n.bindBuffer(n.ARRAY_BUFFER,this.vertexBuffer),n.bufferData(n.ARRAY_BUFFER,Uint32Array.from(v),n.STATIC_DRAW),n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,this.indexBuffer),n.bufferData(n.ELEMENT_ARRAY_BUFFER,Uint32Array.from(b),n.STATIC_DRAW))}indexNearestXYZmm(n,s,u){const f=this.pts,m=this.pts.length/3;let A=0,v=1/0,y=0;for(let T=0;T0)for(let T=0;TE.cal_max)continue;if(E.outlineBorder===void 0&&(E.outlineBorder=0),E.isAdditiveBlend===void 0&&(E.isAdditiveBlend=!1),E.colormapLabel&&E.colormapLabel.R&&!E.colormapLabel.lut&&(E.colormapLabel=cmapper.makeLabelLut(E.colormapLabel)),E.colormapLabel&&E.colormapLabel.lut){const z=E.colormapLabel.lut,b=Math.floor(z.length/4),W=Math.min(Math.max(E.frame4D,0),E.nFrame4D-1),q=m*W,Y=new Uint8Array(m*4);let X=0;for(let g=0;g0&&(Q=NVMeshUtilities.getClusterBoundary(Y,this.tris)),X=0;for(let g=0;g0&&(z=NVMeshUtilities.getClusterBoundary(B,this.tris));let b=0;for(let W=0;W0)for(let T=0;T"u"){const L=new Float32Array([0,0,0,0,0,0]),V=new Uint32Array([0]);E={pts:L,offsetPt0:V},log$4.error("Creating empty tracts")}return m[3]=0,new Ii(E.pts,E.offsetPt0,s,m,f,A,u,"inferno",E.dpg||null,E.dps||null,E.dpv||null)}if(I==="GII")E=NVMeshLoaders.readGII(n);else if(I==="MZ3")E=NVMeshLoaders.readMZ3(n),(E instanceof Float32Array||E.positions===null)&&log$4.warn("MZ3 does not have positions (statistical overlay?)");else if(I==="ASC")E=NVMeshLoaders.readASC(n);else if(I==="DFS")E=NVMeshLoaders.readDFS(n);else if(I==="BYU"||I==="G")E=NVMeshLoaders.readGEO(n);else if(I==="GEO")E=NVMeshLoaders.readGEO(n,!0);else if(I==="ICO"||I==="TRI")E=NVMeshLoaders.readICO(n);else if(I==="OFF")E=NVMeshLoaders.readOFF(n);else if(I==="NV")E=NVMeshLoaders.readNV(n);else if(I==="OBJ")E=NVMeshLoaders.readOBJ(n);else if(I==="PLY")E=NVMeshLoaders.readPLY(n);else if(I==="X3D")E=NVMeshLoaders.readX3D(n);else if(I==="FIB"||I==="VTK"){if(E=NVMeshLoaders.readVTK(n),"offsetPt0"in E)return m[3]=0,new Ii(E.pts,E.offsetPt0,s,m,f,A,u,"inferno")}else I==="SRF"?E=NVMeshLoaders.readSRF(n):I==="STL"?E=NVMeshLoaders.readSTL(n):E=NVMeshLoaders.readFreeSurfer(n);if(E.anatomicalStructurePrimary&&(T=E.anatomicalStructurePrimary),E instanceof Float32Array)throw new Error("fatal: unknown mesh type loaded");if(!E.positions)throw new Error("positions not loaded");if(!E.indices)throw new Error("indices not loaded");if(y=E.positions,v=E.indices,"rgba255"in E&&E.rgba255.length>0&&(m=E.rgba255),"colors"in E&&E.colors&&E.colors.length===y.length){const L=y.length/3;m=new Uint8Array(L*4);let V=0,B=0;for(let z=0;z0&&(NVMeshLoaders.readLayer(s,n,M,f,"gray"),M.updateMesh(u)),M}static async loadLayer(n,s){let u;function f(e){const F=window.atob(e),M=F.length,L=new Uint8Array(M);for(let V=0;V-1&&(m=m.slice(0,m.indexOf("?")));let v=.5;"opacity"in n&&(v=n.opacity);let y="warm";"colormap"in n&&(y=n.colormap);let T="winter";"colormapNegative"in n&&(T=n.colormapNegative);let E=!1;"useNegativeCmap"in n&&(E=n.useNegativeCmap);let S=null;"cal_min"in n&&(S=n.cal_min);let I=null;"cal_max"in n&&(I=n.cal_max),NVMeshLoaders.readLayer(m,u,s,v,y,T,E,S,I)}static async loadFromUrl({url:n="",headers:s={},gl:u,name:f="",opacity:m=1,rgba255:A=[255,255,255,255],visible:v=!0,layers:y=[]}={}){let T=n.split("/");if(f===""){try{T=new URL(n).pathname.split("/")}catch{T=n.split("/")}f=T.slice(-1)[0],f.indexOf("?")>-1&&(f=f.slice(0,f.indexOf("?")))}if(n==="")throw Error("url must not be empty");if(!u)throw Error("gl context is null");const E=await fetch(n,{headers:s});if(!E.ok)throw Error(E.statusText);const S=await E.arrayBuffer(),I=await this.readMesh(S,f,u,m,new Uint8Array(A),v);if(!y||y.length<1)return I;for(let e=0;e{const f=new FileReader;f.onload=()=>{s(f.result)},f.onerror=u,f.readAsArrayBuffer(n)})}static async loadFromFile({file:n,gl:s,name:u="",opacity:f=1,rgba255:m=[255,255,255,255],visible:A=!0,layers:v=[]}={}){if(!n)throw new Error("file must be set");if(!s)throw new Error("rendering context must be set");const y=await Ii.readFileAsync(n),T=Ii.readMesh(y,u,s,f,new Uint8Array(m),A);if(!v||v.length<1)return T;for(let E=0;E>18,y=(S&258048)>>12,T=(S&4032)>>6,E=S&63,s+=u[v]+u[y]+u[T]+u[E];return m===1?(S=n[A],v=(S&252)>>2,y=(S&3)<<4,s+=u[v]+u[y]+"=="):m===2&&(S=n[A]<<8|n[A+1],v=(S&64512)>>10,y=(S&1008)>>4,T=(S&15)<<2,s+=u[v]+u[y]+u[T]+"="),s}static download(n,s,u){const f=document.createElement("a"),m=new Blob([n],{type:u});f.href=URL.createObjectURL(m),f.download=s,f.click()}static readFileAsync(n){return new Promise((s,u)=>{const f=new FileReader;f.onload=()=>{s(f.result)},f.onerror=u,f.readAsArrayBuffer(n)})}static blobToBase64(n){return new Promise(s=>{const u=new FileReader;u.onloadend=()=>s(u.result),u.readAsDataURL(n)})}static decompressBase64String(n){const s=atob(n),u=new ArrayBuffer(s.length),f=new Uint8Array(u);for(let v=0;vn+m*u)}static sph2cartDeg(n,s){const u=-s*(Math.PI/180),f=(n-90)%360*(Math.PI/180),m=[Math.cos(u)*Math.cos(f),Math.cos(u)*Math.sin(f),Math.sin(u)],A=Math.sqrt(m[0]*m[0]+m[1]*m[1]+m[2]*m[2]);return A<=0||(m[0]/=A,m[1]/=A,m[2]/=A),m}static vox2mm(n,s){const u=clone$3(s);transpose$3(u,u);const f=fromValues$1(n[0],n[1],n[2],1);return transformMat4(f,f,u),fromValues$2(f[0],f[1],f[2])}},isPlatformLittleEndian=()=>{const a=new ArrayBuffer(2);return new DataView(a).setInt16(0,256,!0),new Int16Array(a)[0]===256},ImageType=(a=>(a[a.UNKNOWN=0]="UNKNOWN",a[a.NII=1]="NII",a[a.DCM=2]="DCM",a[a.DCM_MANIFEST=3]="DCM_MANIFEST",a[a.MIH=4]="MIH",a[a.MIF=5]="MIF",a[a.NHDR=6]="NHDR",a[a.NRRD=7]="NRRD",a[a.MHD=8]="MHD",a[a.MHA=9]="MHA",a[a.MGH=10]="MGH",a[a.MGZ=11]="MGZ",a[a.V=12]="V",a[a.V16=13]="V16",a[a.VMR=14]="VMR",a[a.HEAD=15]="HEAD",a[a.DCM_FOLDER=16]="DCM_FOLDER",a))(ImageType||{}),NVIMAGE_TYPE=Object.freeze({...ImageType,parse:a=>{let n=0;switch(a.toUpperCase()){case"":case"DCM":n=2;break;case"TXT":n=3;break;case"NII":n=1;break;case"MIH":n=4;break;case"MIF":n=5;break;case"NHDR":n=6;break;case"NRRD":n=7;break;case"MHD":n=8;break;case"MHA":n=9;break;case"MGH":n=10;break;case"MGZ":n=11;break;case"V":n=12;break;case"V16":n=13;break;case"VMR":n=14;break;case"HEAD":n=15;break}return n}}),NVImageFromUrlOptions=(a,n="",s="",u="gray",f=1,m=NaN,A=NaN,v=!0,y=.02,T=!1,E=!1,S="",I=0,e=NVIMAGE_TYPE.UNKNOWN,F=NaN,M=NaN,L=!0,V=!1,B=[])=>({url:a,urlImageData:n,name:s,colormap:u,colorMap:u,opacity:f,cal_min:m,cal_max:A,trustCalMinMax:v,percentileFrac:y,ignoreZeroVoxels:T,useQFormNotSForm:E,colormapNegative:S,imageType:e,cal_minNeg:F,cal_maxNeg:M,colorbarVisible:L,frame4D:I,alphaThreshold:V,colormapLabel:B});function getBestTransform(a,n,s){const u=a;let f=null;if(u){const m={colSize:n[0],rowSize:n[1],sliceSize:n[2]},A=s,v=[u[0],u[1],u[2]],y=[u[3],u[4],u[5]],T=[v[1]*y[2]-v[2]*y[1],v[2]*y[0]-v[0]*y[2],v[0]*y[1]-v[1]*y[0]];f=[[v[0]*m.colSize*-1,y[0]*m.rowSize*-1,T[0]*m.sliceSize*-1,-1*A[0]],[v[1]*m.colSize*-1,y[1]*m.rowSize*-1,T[1]*m.sliceSize*-1,-1*A[1]],[v[2]*m.colSize,y[2]*m.rowSize,T[2]*m.sliceSize,A[2]],[0,0,0,1]]}return f}function str2Buffer(a){const n=[];for(let s=0;s=v)break;let I=!0;for(let e=0;e<3;++e)f[e]>u[e]&&(I=!1),m[e]{}),__publicField(this,"onOpacityChange",()=>{}),__publicField(this,"mm000"),__publicField(this,"mm100"),__publicField(this,"mm010"),__publicField(this,"mm001"),__publicField(this,"cal_min"),__publicField(this,"cal_max"),__publicField(this,"robust_min"),__publicField(this,"robust_max"),__publicField(this,"global_min"),__publicField(this,"global_max"),__publicField(this,"urlImgData"),__publicField(this,"isManifest"),__publicField(this,"limitFrames4D"),this.name=s,this.id=v4(),this._colormap=u,this._opacity=f>1?1:f,this.percentileFrac=T,this.ignoreZeroVoxels=E,this.trustCalMinMax=y,this.colormapNegative=I,this.colormapLabel=B,this.frame4D=e,this.cal_minNeg=M,this.cal_maxNeg=L,this.colorbarVisible=V,this.useQFormNotSForm=S,!n)return;const z=/(?:\.([^.]+))?$/;let b=z.exec(s)[1]||"";b=b.toUpperCase(),b==="GZ"&&(b=z.exec(s.slice(0,-3))[1],b=b.toUpperCase());let W=null;switch(F===NVIMAGE_TYPE.UNKNOWN&&(F=NVIMAGE_TYPE.parse(b)),this.imageType=F,F){case NVIMAGE_TYPE.DCM_FOLDER:case NVIMAGE_TYPE.DCM_MANIFEST:case NVIMAGE_TYPE.DCM:W=this.readDICOM(n);break;case NVIMAGE_TYPE.MIH:case NVIMAGE_TYPE.MIF:W=this.readMIF(n,m);break;case NVIMAGE_TYPE.NHDR:case NVIMAGE_TYPE.NRRD:W=this.readNRRD(n,m);break;case NVIMAGE_TYPE.MHD:case NVIMAGE_TYPE.MHA:W=this.readMHA(n,m);break;case NVIMAGE_TYPE.MGH:case NVIMAGE_TYPE.MGZ:W=this.readMGH(n);break;case NVIMAGE_TYPE.V:W=this.readECAT(n);break;case NVIMAGE_TYPE.V16:W=this.readV16(n);break;case NVIMAGE_TYPE.VMR:W=this.readVMR(n);break;case NVIMAGE_TYPE.HEAD:W=this.readHEAD(n,m);break;case NVIMAGE_TYPE.NII:this.hdr=nifti.readHeader(n),this.hdr!==null&&(this.hdr.cal_min===0&&this.hdr.cal_max===255&&(this.hdr.cal_max=0),nifti.isCompressed(n)?W=nifti.readImage(this.hdr,nifti.decompress(n)):W=nifti.readImage(this.hdr,n));break;default:throw new Error("Image type not supported")}if(this.hdr&&typeof this.hdr.magic=="number"&&(this.hdr.magic="n+1"),this.nFrame4D=1,this.hdr)for(let Q=4;Q<7;Q++)this.hdr.dims[Q]>1&&(this.nFrame4D*=this.hdr.dims[Q]);if(this.frame4D=Math.min(this.frame4D,this.nFrame4D-1),this.nTotalFrame4D=this.nFrame4D,!this.hdr||!W)return;this.nVox3D=this.hdr.dims[1]*this.hdr.dims[2]*this.hdr.dims[3];const q=this.nVox3D*(this.hdr.numBitsPerVoxel/8),Y=W.byteLength/q;if(Y!==this.nFrame4D&&(Y>0&&Y*q===W.byteLength?log$4.debug("Loading the first "+Y+" of "+this.nFrame4D+" volumes"):log$4.warn("This header does not match voxel data",this.hdr,W.byteLength),this.nFrame4D=Y),(this.hdr.intent_code===1007||this.hdr.intent_code===2003)&&this.nFrame4D===3&&this.hdr.datatypeCode===16){const g=new Float32Array(W).slice();this.hdr.datatypeCode=2304,this.nFrame4D=1;for(let pe=4;pe<7;pe++)this.hdr.dims[pe]=1;this.hdr.dims[0]=3,W=new Uint8Array(this.nVox3D*4);let J=1;for(let pe=0;pe0)*1,Ne=+(Se>0)*2,De=+(ve>0)*4;let je=248+we+Ne+De;Math.abs(me)+Math.abs(Se)+Math.abs(ve)<.1&&(je=0),W[fe+3]=je,fe+=4}}(this.hdr.pixDims[1]===0||this.hdr.pixDims[2]===0||this.hdr.pixDims[3]===0)&&log$4.error("pixDims not plausible",this.hdr),(isNaN(this.hdr.scl_slope)||this.hdr.scl_slope===0)&&(this.hdr.scl_slope=1),isNaN(this.hdr.scl_inter)&&(this.hdr.scl_inter=0);let X=isAffineOK(this.hdr.affine);if(S||!X||this.hdr.qform_code>this.hdr.sform_code){log$4.debug("spatial transform based on QForm");const Q=this.hdr.quatern_b,g=this.hdr.quatern_c,J=this.hdr.quatern_d,re=Math.sqrt(1-(Math.pow(Q,2)+Math.pow(g,2)+Math.pow(J,2))),ae=this.hdr.pixDims[0]===0?1:this.hdr.pixDims[0],fe=[[re*re+Q*Q-g*g-J*J,2*Q*g-2*re*J,2*Q*J+2*re*g],[2*Q*g+2*re*J,re*re+g*g-Q*Q-J*J,2*g*J-2*re*Q],[2*Q*J-2*re*g,2*g*J+2*re*Q,re*re+J*J-g*g-Q*Q]],pe=this.hdr.affine;for(let me=0;me<3;me+=1)for(let Se=0;Se<3;Se+=1)pe[me][Se]=fe[me][Se]*this.hdr.pixDims[Se+1],Se===2&&(pe[me][Se]*=ae);pe[0][3]=this.hdr.qoffset_x,pe[1][3]=this.hdr.qoffset_y,pe[2][3]=this.hdr.qoffset_z,this.hdr.affine=pe}if(X=isAffineOK(this.hdr.affine),!X){log$4.debug("Defective NIfTI: spatial transform does not make sense");let Q=this.hdr.pixDims[1],g=this.hdr.pixDims[2],J=this.hdr.pixDims[3];(isNaN(Q)||Q===0)&&(Q=1),(isNaN(g)||g===0)&&(g=1),(isNaN(J)||J===0)&&(J=1),this.hdr.pixDims[1]=Q,this.hdr.pixDims[2]=g,this.hdr.pixDims[3]=J;const re=[[Q,0,0,0],[0,g,0,0],[0,0,J,0],[0,0,0,1]];this.hdr.affine=re}if(this.hdr.datatypeCode!==128&&this.hdr.datatypeCode!==2304&&this.hdr.littleEndian!==isPlatformLittleEndian()&&this.hdr.numBitsPerVoxel>8){if(this.hdr.numBitsPerVoxel===16){const Q=new Uint16Array(W);for(let g=0;g>8&255)<<16>>16}}else if(this.hdr.numBitsPerVoxel===32){const Q=new Uint32Array(W);for(let g=0;g>8&65280|J>>24&255}}else if(this.hdr.numBitsPerVoxel===64){const Q=this.hdr.numBitsPerVoxel/8,g=new Uint8Array(W);for(let J=0;J.01?log$4.warn("Warning voxels not aligned with world space: "+E+` degrees from plumb. +`):E=0,E}calculateOblique(){if(!this.matRAS)throw new Error("matRAS not defined");if(this.pixDimsRAS===void 0)throw new Error("pixDimsRAS not defined");if(!this.dimsRAS)throw new Error("dimsRAS not defined");this.oblique_angle=this.computeObliqueAngle(this.matRAS);const n=this.vox2mm([0,0,0],this.matRAS),s=this.vox2mm([1/this.pixDimsRAS[1],0,0],this.matRAS),u=this.vox2mm([0,1/this.pixDimsRAS[2],0],this.matRAS),f=this.vox2mm([0,0,1/this.pixDimsRAS[3]],this.matRAS);subtract$1(s,s,n),subtract$1(u,u,n),subtract$1(f,f,n);const m=fromValues$3(s[0],s[1],s[2],0,u[0],u[1],u[2],0,f[0],f[1],f[2],0,0,0,0,1);this.obliqueRAS=clone$3(m);const A=Math.abs(90-angle(s,u)*(180/Math.PI)),v=Math.abs(90-angle(s,f)*(180/Math.PI)),y=Math.abs(90-angle(u,f)*(180/Math.PI));this.maxShearDeg=Math.max(Math.max(A,v),y),this.maxShearDeg>.1&&log$4.warn("Warning: voxels are rhomboidal, maximum shear is %f degrees.",this.maxShearDeg);const T=fromValues$1(this.dimsRAS[1],this.dimsRAS[2],this.dimsRAS[3],1),E=clone$3(this.matRAS);transpose$3(E,E);const S=fromValues$1(-.5,-.5,-.5,0);translate(E,E,fromValues$2(S[0],S[1],S[2])),E[0]*=T[0],E[1]*=T[0],E[2]*=T[0],E[4]*=T[1],E[5]*=T[1],E[6]*=T[1],E[8]*=T[2],E[9]*=T[2],E[10]*=T[2],this.frac2mm=clone$3(E);const I=this.pixDimsRAS[1],e=this.pixDimsRAS[2],F=this.pixDimsRAS[3],M=clone$3(E);M[0]=I*T[0],M[1]=0,M[2]=0,M[4]=0,M[5]=e*T[1],M[6]=0,M[8]=0,M[9]=0,M[10]=F*T[2];const L=this.mm2vox([0,0,0],!0);M[12]=(-L[0]-.5)*I,M[13]=(-L[1]-.5)*e,M[14]=(-L[2]-.5)*F,this.frac2mmOrtho=clone$3(M),this.extentsMinOrtho=[M[12],M[13],M[14]],this.extentsMaxOrtho=[M[0]+M[12],M[5]+M[13],M[10]+M[14]],this.mm2ortho=create$3(),invert(this.mm2ortho,m)}THD_daxes_to_NIFTI(n,s,u){const f=this.hdr;if(f===null)throw new Error("HDR is not set");f.sform_code=2;const m="xxyyzzg";let A=-1,v=-1,y=-1;const T=["x","y","z"];T[0]=m[u[0]],T[1]=m[u[1]],T[2]=m[u[2]];const E=n.slice(0,3),S=s.slice(0,3);for(let I=0;I<3;I++)T[I]==="x"?A=I:T[I]==="y"?v=I:y=I;A<0||v<0||y<0||A===v||A===y||v===y||(f.pixDims[1]=Math.abs(E[0]),f.pixDims[2]=Math.abs(E[1]),f.pixDims[3]=Math.abs(E[2]),f.affine=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]],f.affine[0][A]=-E[A],f.affine[1][v]=-E[v],f.affine[2][y]=E[y],f.affine[0][3]=-S[A],f.affine[1][3]=-S[v],f.affine[2][3]=S[y])}SetPixDimFromSForm(){if(!this.hdr)throw new Error("hdr not defined");const n=this.hdr.affine,s=fromValues$3(n[0][0],n[0][1],n[0][2],n[0][3],n[1][0],n[1][1],n[1][2],n[1][3],n[2][0],n[2][1],n[2][2],n[2][3],n[3][0],n[3][1],n[3][2],n[3][3]),u=this.vox2mm([0,0,0],s),f=this.vox2mm([1,0,0],s);subtract$1(f,f,u);const m=this.vox2mm([0,1,0],s);subtract$1(m,m,u);const A=this.vox2mm([0,0,1],s);subtract$1(A,A,u),this.hdr.pixDims[1]=length$1(f),this.hdr.pixDims[2]=length$1(m),this.hdr.pixDims[3]=length$1(A)}readDICOM(n){if(this.series=new daikon.Series,Array.isArray(n))for(let S=0;S1&&(s.dims[3]>1&&log$4.debug("To Do: multiple slices per file and multiple files (XA30 DWI)"),s.dims[3]=this.series.images.length);const u=this.series.images[0].getPixelSpacing();if(s.pixDims[1]=u[0],s.pixDims[2]=u[1],this.series.images.length>1){const S=fromValues$2(...this.series.images[0].getImagePosition()),I=fromValues$2(...this.series.images[1].getImagePosition()),e=fromValues$2(0,0,0);subtract$1(e,S,I),s.pixDims[3]=length$1(e)}else s.pixDims[3]=this.series.images[0].getSliceThickness();s.pixDims[4]=this.series.images[0].getTR()/1e3;const f=this.series.images[0].getDataType(),m=this.series.images[0].getBitsAllocated();s.numBitsPerVoxel=m,this.hdr.littleEndian=this.series.images[0].littleEndian,m===8&&f===2?s.datatypeCode=256:m===8&&f===3?s.datatypeCode=2:m===16&&f===2?s.datatypeCode=4:m===16&&f===3?s.datatypeCode=512:m===32&&f===2?s.datatypeCode=8:m===32&&f===3?s.datatypeCode=768:m===32&&f===4?s.datatypeCode=16:m===64&&f===4?s.datatypeCode=64:m===1?s.datatypeCode=1:log$4.warn("Unsupported DICOM format: "+f+" "+m);const A=s.pixDims.slice(1,4),v=getBestTransform(this.series.images[0].getImageDirections(),A,this.series.images[0].getImagePosition());v&&(s.sform_code=1,s.affine=[[v[0][0],v[0][1],v[0][2],v[0][3]],[v[1][0],v[1][1],v[1][2],v[1][3]],[v[2][0],v[2][1],v[2][2],v[2][3]],[0,0,0,1]]);let y,T=this.series.validatePixelDataLength(this.series.images[0]);const E=new Uint8Array(new ArrayBuffer(T*this.series.images.length));for(let S=0;S14)throw new Error("Not a valid ECAT file");let A=512,v=0;const y=[];let T=new Float32Array;for(;;){const E=u.getInt32(A,!1),S=u.getInt32(A+12,!1);if(E+S!==31)break;let I=A+20,e=0,F=0;for(;e<31&&(F=u.getInt32(I,!1),I+=16,F!==0);){e++;let M=F*512;const L=M-512,V=u.getUint16(L,!1);s.dims[1]=u.getUint16(L+4,!1),s.dims[2]=u.getUint16(L+6,!1),s.dims[3]=u.getUint16(L+8,!1);const B=u.getFloat32(L+26,!1);s.pixDims[1]=u.getFloat32(L+34,!1)*10,s.pixDims[2]=u.getFloat32(L+38,!1)*10,s.pixDims[3]=u.getFloat32(L+42,!1)*10,s.pixDims[4]=u.getUint32(L+46,!1)/1e3,y.push(s.pixDims[4]);const z=s.dims[1]*s.dims[2]*s.dims[3],b=new Float32Array(z);if(V===1)for(let q=0;q1){s.dims[0]=4;let E=!1;for(let S=0;S=4){let A=8+m;const v=u.getUint32(A+88,!0);if(A=A+92,v>0){const y=n.byteLength;for(let T=0;T4)&&log$4.warn("Not a valid MGH file"),E===0?(s.numBitsPerVoxel=8,s.datatypeCode=2):E===4?(s.numBitsPerVoxel=16,s.datatypeCode=4):E===1?(s.numBitsPerVoxel=32,s.datatypeCode=8):E===3&&(s.numBitsPerVoxel=32,s.datatypeCode=16),s.dims[1]=A,s.dims[2]=v,s.dims[3]=y,s.dims[4]=T,T>1&&(s.dims[0]=4),s.pixDims[1]=S,s.pixDims[2]=I,s.pixDims[3]=e,s.vox_offset=284,s.sform_code=1;const g=fromValues$3(F*s.pixDims[1],V*s.pixDims[2],b*s.pixDims[3],0,M*s.pixDims[1],B*s.pixDims[2],W*s.pixDims[3],0,L*s.pixDims[1],z*s.pixDims[2],q*s.pixDims[3],0,0,0,0,1),J=[s.dims[1]/2,s.dims[2]/2,s.dims[3]/2,1],re=[0,0,0,0];for(let fe=0;fe<3;fe++){re[fe]=0;for(let pe=0;pe<3;pe++)re[fe]=re[fe]+g[pe+fe*4]*J[pe]}s.affine=[[g[0],g[1],g[2],Y-re[0]],[g[4],g[5],g[6],X-re[1]],[g[8],g[9],g[10],Q-re[2]],[0,0,0,1]];const ae=s.dims[1]*s.dims[2]*s.dims[3]*s.dims[4]*(s.numBitsPerVoxel/8);return u.slice(s.vox_offset,s.vox_offset+ae)}readHEAD(n,s){this.hdr=new nifti.NIFTI1;const u=this.hdr;u.dims[0]=3,u.pixDims=[1,1,1,1,1,0,0,0];let f=[0,0,0],m=[0,0,0],A=[1,1,1];const y=new TextDecoder().decode(n).split(/\r?\n/),T=(n.byteLength+8)%16,E=n.byteLength+(16-T);log$4.debug(n.byteLength,"len",E);const S=new Uint8Array(E);S.fill(0),S.set(new Uint8Array(n));const I=new nifti.NIFTIEXTENSION(E+8,42,S,!0);u.addExtension(I),u.extensionCode=42,u.extensionFlag[0]=1,u.extensionSize=E+8;const e=y.length;let F=0,M=!1;for(;F2&&(M=M.slice(2)),y.startsWith("BinaryDataByteOrderMSB")&&M[0].includes("False")&&(T.littleEndian=!0),y.startsWith("BinaryDataByteOrderMSB")&&M[0].includes("True")&&(T.littleEndian=!1),y.startsWith("CompressedData")&&M[0].includes("True")&&(E=!0),y.startsWith("TransformMatrix"))for(let L=0;L<9;L++)I[L]=parseFloat(M[L]);if(y.startsWith("Offset"))for(let L=0;L2||J.length!==4)break;u.affine[E][0]=parseFloat(J[0]),u.affine[E][1]=parseFloat(J[1]),u.affine[E][2]=parseFloat(J[2]),u.affine[E][3]=parseFloat(J[3]),E++;break;case"RepetitionTime":S=parseFloat(J[0]);break;case"file":I=!J[0].startsWith(". "),I||(J=J[0].split(" "),u.vox_offset=parseInt(J[1]));break}}const e=u.dims[0];e>5&&log$4.warn("reader only designed for a maximum of 5 dimensions (XYZTD)");let F=1;for(let J=0;J0&&(u.pixDims[4]=S),I&&!s&&log$4.warn("MIH header provided without paired image data");let M;s&&I?M=s.slice(0):M=n.slice(u.vox_offset,u.vox_offset+F*(u.numBitsPerVoxel/8)),T.length!==u.dims[0]&&log$4.warn("dims does not match layout");let L=1;const V=[1,1,1,1,1],B=[!1,!1,!1,!1,!1];for(let J=0;Ju[0]&&(f[0]=2),u[6]>u[0]&&u[6]>u[3]&&(f[0]=3),f[1]=1,f[0]===1?u[4]>u[7]?f[1]=2:f[1]=3:f[0]===2?u[1]>u[7]?f[1]=1:f[1]=3:u[1]>u[4]?f[1]=1:f[1]=2,f[2]=6-f[1]-f[0];let m=[1,2,3];m[f[0]-1]=1,m[f[1]-1]=2,m[f[2]-1]=3;let A=fromValues$3(n[0][0],n[0][1],n[0][2],n[0][3],n[1][0],n[1][1],n[1][2],n[1][3],n[2][0],n[2][1],n[2][2],n[2][3],0,0,0,1);this.mm000=this.vox2mm([-.5,-.5,-.5],A),this.mm100=this.vox2mm([s.dims[1]-.5,-.5,-.5],A),this.mm010=this.vox2mm([-.5,s.dims[2]-.5,-.5],A),this.mm001=this.vox2mm([-.5,-.5,s.dims[3]-.5],A);const v=create$3();copy$1(v,A);for(let L=0;L<3;L++)for(let V=0;V<3;V++)v[L*4+V]=A[L*4+m[V]-1];const y=[0,0,0];v[0]<0&&(y[0]=1),v[5]<0&&(y[1]=1),v[10]<0&&(y[2]=1),this.dimsRAS=[s.dims[0],s.dims[m[0]],s.dims[m[1]],s.dims[m[2]]],this.pixDimsRAS=[s.pixDims[0],s.pixDims[m[0]],s.pixDims[m[1]],s.pixDims[m[2]]],this.permRAS=m.slice();for(let L=0;L<3;L++)y[L]===1&&(this.permRAS[L]=-this.permRAS[L]);if(this.arrayEquals(m,[1,2,3])&&this.arrayEquals(y,[0,0,0])){this.toRAS=create$3(),this.matRAS=clone$3(A),this.calculateOblique(),this.img2RASstep=[1,this.dimsRAS[1],this.dimsRAS[1]*this.dimsRAS[2]],this.img2RASstart=[0,0,0];return}identity$2(A),A[0+0*4]=1-y[0]*2,A[1+1*4]=1-y[1]*2,A[2+2*4]=1-y[2]*2,A[3+0*4]=(s.dims[m[0]]-1)*y[0],A[3+1*4]=(s.dims[m[1]]-1)*y[1],A[3+2*4]=(s.dims[m[2]]-1)*y[2];const T=create$3();invert(T,A),multiply$2(T,T,v),this.matRAS=clone$3(T),A=fromValues$3(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1),A[m[0]-1+0*4]=-y[0]*2+1,A[m[1]-1+1*4]=-y[1]*2+1,A[m[2]-1+2*4]=-y[2]*2+1,A[3+0*4]=y[0],A[3+1*4]=y[1],A[3+2*4]=y[2],this.toRAS=clone$3(A),A[3]=0,A[7]=0,A[11]=0,A[12]=0,(this.permRAS[0]===-1||this.permRAS[1]===-1||this.permRAS[2]===-1)&&(A[12]=s.dims[1]-1),A[13]=0,(this.permRAS[0]===-2||this.permRAS[1]===-2||this.permRAS[2]===-2)&&(A[13]=s.dims[2]-1),A[14]=0,(this.permRAS[0]===-3||this.permRAS[1]===-3||this.permRAS[2]===-3)&&(A[14]=s.dims[3]-1),this.toRASvox=clone$3(A),log$4.debug(this.hdr.dims),log$4.debug(this.dimsRAS);const E=this.hdr;m=this.permRAS;const S=[Math.abs(m[0]),Math.abs(m[1]),Math.abs(m[2])],I=[E.dims[S[0]],E.dims[S[1]],E.dims[S[2]]],e=[1,E.dims[1],E.dims[1]*E.dims[2]],F=[e[S[0]-1],e[S[1]-1],e[S[2]-1]],M=[0,0,0];for(let L=0;L<3;L++)m[L]<0&&(M[L]=F[L]*(I[L]-1),F[L]=-F[L]);this.img2RASstep=F,this.img2RASstart=M,this.calculateOblique()}img2RAS(){if(!this.permRAS)throw new Error("permRAS undefined");if(!this.img)throw new Error("img undefined");if(!this.hdr)throw new Error("hdr undefined");const n=this.permRAS.slice();if(n[0]===1&&n[1]===2&&n[2]===3)return this.img;const s=this.hdr,u=this.img.slice(0,s.dims[1]*s.dims[1]*s.dims[2]*s.dims[3]),f=[Math.abs(n[0]),Math.abs(n[1]),Math.abs(n[2])],m=[s.dims[f[0]],s.dims[f[1]],s.dims[f[2]]],A=[1,s.dims[1],s.dims[1]*s.dims[2]],v=[A[f[0]-1],A[f[1]-1],A[f[2]-1]],y=[0,0,0];for(let E=0;E<3;E++)n[E]<0&&(y[E]=v[E]*(m[E]-1),v[E]=-v[E]);let T=0;for(let E=0;Eu===s[f])}setColormap(n){this._colormap=n,this.calMinMax(),this.onColormapChange&&this.onColormapChange(this)}setColormapLabel(n){this.colormapLabel=cmapper.makeLabelLut(n)}async setColormapLabelFromUrl(n){this.colormapLabel=await cmapper.makeLabelLutFromUrl(n)}get colormap(){return this._colormap}get colorMap(){return this._colormap}set colormap(n){this.setColormap(n)}set colorMap(n){this.setColormap(n)}get opacity(){return this._opacity}set opacity(n){this._opacity=n,this.onOpacityChange&&this.onOpacityChange(this)}calMinMax(){if(!this.hdr)throw new Error("hdr undefined");if(!this.img)throw new Error("img undefined");let n=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY,u=0,f=0;const m=this.img.length,A=this.img.constructor!==Float64Array&&this.img.constructor!==Float32Array&&this.ignoreZeroVoxels;if(A)for(let Y=0;Ythis.hdr.cal_min)return this.cal_min=this.hdr.cal_min,this.cal_max=this.hdr.cal_max,this.robust_min=this.cal_min,this.robust_max=this.cal_max,this.global_min=v,this.global_max=y,[this.hdr.cal_min,this.hdr.cal_max,this.hdr.cal_min,this.hdr.cal_max];if(E!==S)return this.cal_min=E,this.cal_max=S,this.robust_min=this.cal_min,this.robust_max=this.cal_max,[E,S,E,S];const I=100*u/m;let e=!1;I>60&&!this.ignoreZeroVoxels&&(log$4.warn(`${Math.round(I)}% of voxels are zero: ignoring zeros for cal_max`),e=!0,this.ignoreZeroVoxels=!0),this.ignoreZeroVoxels||(u=0),u+=f;const F=Math.round((m-u)*this.percentileFrac);if(F<1||n===s)return log$4.debug("no variability in image intensity?"),this.cal_min=v,this.cal_max=y,this.robust_min=this.cal_min,this.robust_max=this.cal_max,this.global_min=v,this.global_max=y,[v,y,v,y];const M=1001,L=(M-1)/(s-n),V=new Array(M);for(let Y=0;Y0&&(z--,V[z]>0&&(Y=0)),Y!==0&&b0&&(Y=0)),z===0&&b===M-1&&(Y=0)}let W=this.intensityRaw2Scaled(z/L+n),q=this.intensityRaw2Scaled(b/L+n);return this.hdr.cal_min=v&&this.hdr.cal_max<=y&&(W=this.hdr.cal_min,q=this.hdr.cal_max),e&&(W=Math.min(W,0)),this.cal_min=W,this.cal_max=q,this.robust_min=this.cal_min,this.robust_max=this.cal_max,this.global_min=v,this.global_max=y,[W,q,v,y]}intensityRaw2Scaled(n){if(!this.hdr)throw new Error("hdr undefined");return this.hdr.scl_slope===0&&(this.hdr.scl_slope=1),n*this.hdr.scl_slope+this.hdr.scl_inter}intensityScaled2Raw(n){if(!this.hdr)throw new Error("hdr undefined");return this.hdr.scl_slope===0&&(this.hdr.scl_slope=1),(n-this.hdr.scl_inter)/this.hdr.scl_slope}saveToUint8Array(n,s=null){if(!this.hdr)throw new Error("hdr undefined");if(!this.img)throw new Error("img undefined");const u=s!==null,f=hdrToArrayBuffer(this.hdr,u),m=new Uint8Array(4);let A=new Uint8Array(this.img.buffer);u&&(A=new Uint8Array(s.buffer));const v=new Uint8Array(f.length+m.length+A.length);v.set(f),v.set(m,f.length),v.set(A,f.length+m.length);let y=null;return n.endsWith(".gz")?y=gzipSync$1(v,{filename:n,mtime:Date.now(),level:6}):y=v,y}saveToDisk(n="",s=null){const u=this.saveToUint8Array(n,s);if(n==="")return log$4.debug("saveToDisk: empty file name, returning data as Uint8Array rather than triggering download"),u;const f=new Blob([u.buffer],{type:"application/octet-stream"}),m=URL.createObjectURL(f),A=document.createElement("a");return A.setAttribute("href",m),A.setAttribute("download",n),A.style.visibility="hidden",document.body.appendChild(A),A.click(),document.body.removeChild(A),u}static async fetchDicomData(n,s={}){if(n==="")throw Error("url must not be empty");let f=/^(?:[a-z+]+:)?\/\//i.test(n)?n:new URL(n,window.location.href);/(?:.([^.]+))?$/.exec(f.pathname)||(f=new URL("niivue-manifest.txt",n));let v=await fetch(f,{headers:s});if(!v.ok)throw Error(v.statusText);const T=(await v.text()).split(` -`),S=/(.*\/).*/.exec(f)[0],I=[];for(const e of T){const F=new URL(e,S);if(v=await fetch(F,{headers:s}),!v.ok)throw Error(v.statusText);const M=await v.arrayBuffer();I.push(M)}return I}static async fetchPartial(n,s,u={}){try{return await fetch(n,{headers:{range:`bytes=0-'${s}`,stream:"true",...u}})}catch(f){return log$4.error(f),log$4.error("fetchPartial failed, trying again without range header"),await fetch(n,{headers:u})}}static async loadFromUrl({url:n="",urlImgData:s="",headers:u={},name:f="",colormap:m="gray",opacity:A=1,cal_min:v=NaN,cal_max:y=NaN,trustCalMinMax:T=!0,percentileFrac:E=.02,ignoreZeroVoxels:S=!1,useQFormNotSForm:I=!1,colormapNegative:e="",frame4D:F=0,isManifest:M=!1,limitFrames4D:L=NaN,imageType:V=NVIMAGE_TYPE.UNKNOWN,colorbarVisible:B=!0}={}){if(n==="")throw Error("url must not be empty");let z=null,b=null;if(n instanceof Uint8Array&&(n=n.buffer),n instanceof ArrayBuffer){b=n,n="array.nii";const H=new Uint8Array(b);H[0]===31&&H[1]===139&&(n="array.nii.gz")}if(!isNaN(L)){let H=await this.fetchPartial(n,512,u);b=await H.arrayBuffer();let g=new Uint8Array(b),J=!1;g[0]===31&&g[1]===139&&(J=!0,new Decompress$1(fe=>{g=fe}).push(g),b=g.buffer);let re=g[0]===92&&g[1]===1;if(re||(re=g[1]===92&&g[0]===1),!re)b=null;else{const ae=nifti.readHeader(b);if(ae===null)throw new Error("could not read nifti header");const fe=ae.numBitsPerVoxel/8;let pe=1;for(let we=1;we<4;we++)ae.dims[we]>1&&(pe*=ae.dims[we]);let me=1;for(let we=4;we<7;we++)ae.dims[we]>1&&(me*=ae.dims[we]);const Se=Math.max(Math.min(L,me),1),ve=ae.vox_offset+Se*pe*fe;if(b.byteLength{we=De}).push(we),b=we.buffer}b.byteLength-1&&(f=f.slice(0,f.indexOf("?")))}let X=null;if(s.length>0){let H=await fetch(s,{headers:u});H.status===404&&s.lastIndexOf("BRIK")!==-1&&(H=await fetch(s+".gz",{headers:u})),X=await H.arrayBuffer()}if(!b)throw new Error("Unable to load buffer properly from volume");return z=new Zi(b,f,m,A,X,v,y,T,E,S,I,e,F,V),z.url=n,z.colorbarVisible=B,z}static readFileAsync(n,s=NaN){return new Promise((u,f)=>{const m=new FileReader;m.onload=()=>{n.name.lastIndexOf("gz")!==-1&&isNaN(s)?u(nifti.decompress(m.result)):u(m.result)},m.onerror=f,isNaN(s)?m.readAsArrayBuffer(n):m.readAsArrayBuffer(n.slice(0,s))})}static async loadFromFile({file:n,name:s="",colormap:u="gray",opacity:f=1,urlImgData:m=null,cal_min:A=NaN,cal_max:v=NaN,trustCalMinMax:y=!0,percentileFrac:T=.02,ignoreZeroVoxels:E=!1,useQFormNotSForm:S=!1,colormapNegative:I="",frame4D:e=0,limitFrames4D:F=NaN,imageType:M=NVIMAGE_TYPE.UNKNOWN}){let L=null,V=[];try{if(Array.isArray(n))for(let z=0;z{z=Y}).push(z),V=z.buffer);let W=z[0]===92&&z[1]===1;if(W||(W=z[1]===92&&z[0]===1),!W)V=await this.readFileAsync(n);else{const q=nifti.readHeader(V);if(!q)throw new Error("could not read nifti header");const Y=q.numBitsPerVoxel/8;let X=1;for(let re=1;re<4;re++)q.dims[re]>1&&(X*=q.dims[re]);let H=1;for(let re=4;re<7;re++)q.dims[re]>1&&(H*=q.dims[re]);const g=Math.max(Math.min(F,H),1),J=q.vox_offset+g*X*Y;if(V.byteLength{re=fe}).push(re),V=re.buffer}if(V.byteLength"u")return m;if(!s){const v=clone$3(this.frac2mmOrtho);return invert(v,v),transformMat4(u,u,v),m[0]=u[0],m[1]=u[1],m[2]=u[2],m}if(f[1]<1||f[2]<1||f[3]<1)return m;const A=clone$3(this.matRAS);return invert(A,A),transpose$3(A,A),transformMat4(u,u,A),m[0]=(u[0]+.5)/f[1],m[1]=(u[1]+.5)/f[2],m[2]=(u[2]+.5)/f[3],m}},DRAG_MODE=(a=>(a[a.none=0]="none",a[a.contrast=1]="contrast",a[a.measurement=2]="measurement",a[a.pan=3]="pan",a[a.slicer3D=4]="slicer3D",a[a.callbackOnly=5]="callbackOnly",a))(DRAG_MODE||{}),DEFAULT_OPTIONS={textHeight:.06,colorbarHeight:.05,crosshairWidth:1,crosshairGap:0,rulerWidth:4,show3Dcrosshair:!1,backColor:[0,0,0,1],crosshairColor:[1,0,0,1],fontColor:[.5,.5,.5,1],selectionBoxColor:[1,1,1,.5],clipPlaneColor:[.7,0,.7,.5],rulerColor:[1,0,0,.8],colorbarMargin:.05,trustCalMinMax:!0,clipPlaneHotKey:"KeyC",viewModeHotKey:"KeyV",doubleTouchTimeout:500,longTouchTimeout:1e3,keyDebounceTime:50,isNearestInterpolation:!1,isResizeCanvas:!0,atlasOutline:0,isRuler:!1,isColorbar:!1,isOrientCube:!1,multiplanarPadPixels:0,multiplanarForceRender:!1,isRadiologicalConvention:!1,meshThicknessOn2D:1/0,dragMode:1,yoke3Dto2DZoom:!1,isDepthPickMesh:!1,isCornerOrientationText:!1,sagittalNoseLeft:!1,isSliceMM:!1,isV1SliceShader:!1,isHighResolutionCapable:!0,logLevel:"info",loadingText:"waiting for images...",isForceMouseClickToVoxelCenters:!1,dragAndDropEnabled:!0,drawingEnabled:!1,penValue:1,floodFillNeighbors:6,isFilledPen:!1,thumbnail:"",maxDrawUndoBitmaps:8,sliceType:3,meshXRay:0,isAntiAlias:null,limitFrames4D:NaN,isAdditiveBlend:!1,showLegend:!0,legendBackgroundColor:[.3,.3,.3,.5],legendTextColor:[1,1,1,1],multiplanarLayout:0,renderOverlayBlend:1,sliceMosaicString:""},INITIAL_SCENE_DATA={azimuth:110,elevation:10,crosshairPos:fromValues$2(.5,.5,.5),clipPlane:[0,0,0,0],clipPlaneDepthAziElev:[2,0,0],volScaleMultiplier:1,pan2Dxyzmm:fromValues$1(0,0,0,1)},NVDocument=class Ji{constructor(){__publicField(this,"data",{title:"Untitled document",imageOptionsArray:[],meshOptionsArray:[],opts:{...DEFAULT_OPTIONS},previewImageDataURL:"",labels:[],encodedImageBlobs:[],encodedDrawingBlob:""}),__publicField(this,"scene"),__publicField(this,"volumes",[]),__publicField(this,"meshDataObjects"),__publicField(this,"meshes",[]),__publicField(this,"drawBitmap",null),__publicField(this,"imageOptionsMap",new Map),__publicField(this,"meshOptionsMap",new Map),this.scene={onAzimuthElevationChange:()=>{},onZoom3DChange:()=>{},sceneData:INITIAL_SCENE_DATA,get renderAzimuth(){return this.sceneData.azimuth},set renderAzimuth(n){this.sceneData.azimuth=n,this.onAzimuthElevationChange&&this.onAzimuthElevationChange(this.sceneData.azimuth,this.sceneData.elevation)},get renderElevation(){return this.sceneData.elevation},set renderElevation(n){this.sceneData.elevation=n,this.onAzimuthElevationChange&&this.onAzimuthElevationChange(this.sceneData.azimuth,this.sceneData.elevation)},get volScaleMultiplier(){return this.sceneData.volScaleMultiplier},set volScaleMultiplier(n){this.sceneData.volScaleMultiplier=n,this.onZoom3DChange(n)},get crosshairPos(){return this.sceneData.crosshairPos},set crosshairPos(n){this.sceneData.crosshairPos=n},get clipPlane(){return this.sceneData.clipPlane},set clipPlane(n){this.sceneData.clipPlane=n},get clipPlaneDepthAziElev(){return this.sceneData.clipPlaneDepthAziElev},set clipPlaneDepthAziElev(n){this.sceneData.clipPlaneDepthAziElev=n},get pan2Dxyzmm(){return this.sceneData.pan2Dxyzmm},set pan2Dxyzmm(n){this.sceneData.pan2Dxyzmm=n}}}get title(){return this.data.title}get previewImageDataURL(){return this.data.previewImageDataURL}set previewImageDataURL(n){this.data.previewImageDataURL=n}set title(n){this.data.title=n}get imageOptionsArray(){return this.data.imageOptionsArray}get encodedImageBlobs(){return this.data.encodedImageBlobs}get encodedDrawingBlob(){return this.data.encodedDrawingBlob}get opts(){return this.data.opts}set opts(n){this.data.opts={...n}}get labels(){return this.data.labels}set labels(n){this.data.labels=n}hasImage(n){return this.volumes.find(s=>s.id===n.id)!==void 0}hasImageFromUrl(n){return this.data.imageOptionsArray.find(s=>s.url===n)!==void 0}addImageOptions(n,s){if(!this.hasImage(n)&&!s.name)if(s.url){const f=/^(?:[a-z+]+:)?\/\//i.test(s.url)?new URL(s.url):new URL(s.url,window.location.href);s.name=f.pathname.split("/").pop(),s.name.toLowerCase().endsWith(".gz")&&(s.name=s.name.slice(0,-3)),s.name.toLowerCase().endsWith(".nii")||(s.name+=".nii")}else s.name="untitled.nii";s.imageType=NVIMAGE_TYPE.NII,this.data.imageOptionsArray.push(s),this.imageOptionsMap.set(n.id,this.data.imageOptionsArray.length-1)}removeImage(n){if(this.imageOptionsMap.has(n.id)){const s=this.imageOptionsMap.get(n.id);this.data.imageOptionsArray.length>s&&this.data.imageOptionsArray.splice(s,1),this.imageOptionsMap.delete(n.id)}this.volumes=this.volumes.filter(s=>s.id!==n.id)}getImageOptions(n){return this.imageOptionsMap.has(n.id)?this.data.imageOptionsArray[this.imageOptionsMap.get(n.id)]:null}json(){const n={encodedImageBlobs:[],previewImageDataURL:this.data.previewImageDataURL,imageOptionsMap:new Map},s=[];if(n.sceneData={...this.scene.sceneData},n.opts={...this.opts},this.opts.meshThicknessOn2D===1/0&&(n.opts.meshThicknessOn2D="infinity"),n.labels=[...this.data.labels],this.volumes.length){let f=this.imageOptionsArray[0];if(f||(log$4.debug("no image options for base image"),f={name:"",colormap:"gray",opacity:1,pairedImgData:null,cal_min:NaN,cal_max:NaN,trustCalMinMax:!0,percentileFrac:.02,ignoreZeroVoxels:!1,useQFormNotSForm:!1,colormapNegative:"",colormapLabel:[],imageType:NVIMAGE_TYPE.NII,frame4D:0,limitFrames4D:NaN,url:"",urlImageData:"",alphaThreshold:!1,cal_minNeg:NaN,cal_maxNeg:NaN,colorbarVisible:!0}),f.colormap=this.volumes[0].colormap,f.opacity=this.volumes[0].opacity,f.cal_max=this.volumes[0].cal_max||NaN,f.cal_min=this.volumes[0].cal_min||NaN,f){s.push(f);const m=NVUtilities.uint8tob64(this.volumes[0].toUint8Array());n.encodedImageBlobs.push(m),this.drawBitmap&&(n.encodedDrawingBlob=NVUtilities.uint8tob64(this.volumes[0].toUint8Array(this.drawBitmap))),n.imageOptionsMap.set(this.volumes[0].id,0)}else throw new Error("image options for base layer not found");for(let m=1;m({values:A.values,nFrame4D:A.nFrame4D,frame4D:0,outlineBorder:A.outlineBorder,global_min:A.global_min,global_max:A.global_max,cal_min:A.cal_min,cal_max:A.cal_max,opacity:A.opacity,colormap:A.colormap,colormapNegative:A.colormapNegative,colormapLabel:A.colormapLabel,useNegativeCmap:A.useNegativeCmap})),hasConnectome:f.hasConnectome,edgeColormap:f.edgeColormap,edgeColormapNegative:f.edgeColormapNegative,edgeMax:f.edgeMax,edgeMin:f.edgeMin,edges:f.edges&&Array.isArray(f.edges)?[...f.edges]:[],extentsMax:f.extentsMax,extentsMin:f.extentsMin,fiberGroupColormap:f.fiberGroupColormap,furthestVertexFromOrigin:f.furthestVertexFromOrigin,nodeColormap:f.nodeColormap,nodeColormapNegative:f.nodeColormapNegative,nodeMaxColor:f.nodeMaxColor,nodeMinColor:f.nodeMinColor,nodeScale:f.nodeScale,legendLineThickness:f.legendLineThickness,offsetPt0:f.offsetPt0,nodes:f.nodes};u.push(m)}return n.meshesString=JSON.stringify(serialize(u)),n}download(n){const s=this.json();NVUtilities.download(JSON.stringify(s),n,"application/json")}static deserializeMeshDataObjects(n){if(n.data.meshesString){n.meshDataObjects=deserialize$1(JSON.parse(n.data.meshesString));for(const s of n.meshDataObjects)for(const u of s.layers)"colorMap"in u&&(u.colormap=u.colorMap,delete u.colorMap),"colorMapNegative"in u&&(u.colormapNegative=u.colorMapNegative,delete u.colorMapNegative)}}static async loadFromUrl(n){const u=await(await fetch(n)).json();return Ji.loadFromJSON(u)}static async loadFromFile(n){const s=await NVUtilities.readFileAsync(n),u=new Ji,m=new TextDecoder().decode(s);return u.data=JSON.parse(m),Ji.deserializeMeshDataObjects(u),u}static loadFromJSON(n){const s=new Ji;return s.data=n,s.data.opts.meshThicknessOn2D==="infinity"&&(s.data.opts.meshThicknessOn2D=1/0),s.scene.sceneData=n.sceneData,Ji.deserializeMeshDataObjects(s),s}},NVLabel3D=class{constructor(a,n,s){__publicField(this,"text"),__publicField(this,"style"),__publicField(this,"points"),this.text=a,this.style=n,this.points=s}},defaultOptions={name:"untitled connectome",nodeColormap:"warm",nodeColormapNegative:"winter",nodeMinColor:0,nodeMaxColor:4,nodeScale:3,edgeColormap:"warm",edgeColormapNegative:"winter",edgeMin:2,edgeMax:6,edgeScale:1,legendLineThickness:0},NVConnectome=class Uo extends NVMesh{constructor(n,s){super(new Float32Array([]),new Uint32Array([]),s.name,new Uint8Array([]),1,!0,n,s),__publicField(this,"gl"),__publicField(this,"nodesChanged"),this.gl=n,this.type="connectome",this.nodes&&this.updateLabels(),this.nodesChanged=new EventTarget}static convertLegacyConnectome(n){const s={nodes:[],edges:[],...defaultOptions};for(const f in n)if(f in defaultOptions){const m=f;s[m]=n[m]}const u=n.nodes;for(let f=0;f({name:Array.isArray(A.comments)&&A.comments.length>0&&"text"in A.comments[0]?A.comments[0].text:"",x:A.coordinates.x,y:A.coordinates.y,z:A.coordinates.z,colorValue:1,sizeValue:1,metadata:A.comments}));return{...defaultOptions,nodeColormap:s,edgeColormap:s,nodes:f,edges:[]}}updateLabels(){const n=this.nodes;if(n&&n.length>0){const s=n.reduce((T,E)=>T.sizeValue>E.sizeValue?T:E).sizeValue,u=this.nodeMinColor?this.nodeMinColor:n.reduce((T,E)=>T.colorValueT.colorValue>E.colorValue?T:E).colorValue,m=cmapper.colormap(this.nodeColormap,this.colormapInvert),A=cmapper.colormap(this.nodeColormapNegative,this.colormapInvert),v="nodeColormapNegative"in this,y=this.legendLineThickness?this.legendLineThickness:0;for(let T=0;Te/255),log$4.debug("adding label for ",n[T]),n[T].label=new NVLabel3D(n[T].name,{textColor:I,bulletScale:n[T].sizeValue/s,bulletColor:I,lineWidth:y,lineColor:I,textScale:1,textAlignment:"left",lineTerminator:"none"},[n[T].x,n[T].y,n[T].z]),log$4.debug("label for node:",n[T].label)}}}addConnectomeNode(n){if(log$4.debug("adding node",n),!this.nodes)throw new Error("nodes not defined");this.nodes.push(n),this.updateLabels(),this.nodesChanged.dispatchEvent(new CustomEvent("nodeAdded",{detail:{node:n}}))}deleteConnectomeNode(n){const s=this.nodes.indexOf(n),u=this.edges;u&&(this.edges=u.filter(f=>f.first!==s&&f.second!==s)),this.nodes=this.nodes.filter(f=>f!==n),this.updateLabels(),this.updateConnectome(this.gl),this.nodesChanged.dispatchEvent(new CustomEvent("nodeDeleted",{detail:{node:n}}))}updateConnectomeNodeByIndex(n,s){this.nodes[n]=s,this.updateLabels(),this.updateConnectome(this.gl),this.nodesChanged.dispatchEvent(new CustomEvent("nodeChanged",{detail:{node:s}}))}updateConnectomeNodeByPoint(n,s){const u=this.nodes;if(!u)throw new Error("Node to update does not exist");const f=u.find(A=>NVUtilities.arraysAreEqual([A.x,A.y,A.z],n));if(!f)throw new Error(`Node with point ${n} to update does not exist`);const m=u.findIndex(A=>A===f);this.updateConnectomeNodeByIndex(m,s)}addConnectomeEdge(n,s,u){const f=this.edges;let m=f.find(A=>(A.first===n||A.second===n)&&A.first+A.second===n+s);return m||(m={first:n,second:s,colorValue:u},f.push(m),this.updateConnectome(this.gl),m)}deleteConnectomeEdge(n,s){const u=this.edges,f=u.find(m=>(m.first===n||m.first===s)&&m.first+m.second===n+s);if(f)this.edges=u.filter(m=>m!==f);else throw new Error(`edge between ${n} and ${s} not found`);return this.updateConnectome(this.gl),f}findClosestConnectomeNode(n,s){const u=this.nodes;if(!u||u.length===0)return null;const f=u.map((m,A)=>({node:m,distance:Math.sqrt(Math.pow(m.x-n[0],2)+Math.pow(m.y-n[1],2)+Math.pow(m.z-n[2],2)),index:A})).filter(m=>m.distancem.distance-A.distance);return f.length>0?f[0].node:null}updateConnectome(n){const s=[],u=[],f=[];let m=cmapper.colormap(this.nodeColormap,this.colormapInvert),A=cmapper.colormap(this.nodeColormapNegative,this.colormapInvert),v="nodeColormapNegative"in this;if(this.nodeMinColor===void 0||this.nodeMaxColor===void 0)throw new Error("nodeMinColor or nodeMaxColor is undefined");if(this.edgeMin===void 0||this.edgeMax===void 0)throw new Error("edgeMin or edgeMax undefined");let y=this.nodeMinColor,T=this.nodeMaxColor;const E=this.nodes,S=E.length;for(let V=0;Vm&&([f,m]=[m,f]),[f,m]}function swizzleVec3(a,n=[0,1,2]){const s=create$2();return s[0]=a[n[0]],s[1]=a[n[1]],s[2]=a[n[2]],s}function isRadiological(a){const n=fromValues$1(1,0,0,0),s=create$1();return transformMat4(s,n,a),s[0]}function unProject(a,n,s,u){const f=fromValues$1(a,n,s,1),m=clone$3(u);invert(m,m),f[0]=f[0]*2-1,f[1]=f[1]*2-1,f[2]=f[2]*2-1;const A=create$1();return transformMat4(A,f,m),A[3]===0||(A[0]/=A[3],A[1]/=A[3],A[2]/=A[3]),A}function unpackFloatFromVec4i(a){const n=[5960464477539063e-23,152587890625e-16,.00390625,1];return(a[0]*n[0]+a[1]*n[1]+a[2]*n[2]+a[3]*n[3])/255}function clamp$1(a,n,s){return Math.min(Math.max(a,n),s)}function encodeRLE(a){const n=a.length;let s=0;const u=new Uint8Array(n+Math.ceil(.01*n)),f=new Int8Array(u.buffer);let m=0;for(;s1){f[m]=-v+1,m++,u[m]=A,m++;continue}for(;s127||s+2 "+m+" bytes (x"+n/m+")"),u.slice(0,m)}function decodeRLE(a,n){const s=new Uint8Array(a.buffer),u=new Int8Array(s.buffer);let f=0;const m=new Uint8Array(n);let A=0;for(;f{}),__publicField(this,"onMouseUp",()=>{}),__publicField(this,"onLocationChange",()=>{}),__publicField(this,"onIntensityChange",()=>{}),__publicField(this,"onImageLoaded",()=>{}),__publicField(this,"onMeshLoaded",()=>{}),__publicField(this,"onFrameChange",()=>{}),__publicField(this,"onError",()=>{}),__publicField(this,"onColormapChange",()=>{}),__publicField(this,"onInfo",()=>{}),__publicField(this,"onWarn",()=>{}),__publicField(this,"onDebug",()=>{}),__publicField(this,"onVolumeAddedFromUrl",()=>{}),__publicField(this,"onVolumeWithUrlRemoved",()=>{}),__publicField(this,"onVolumeUpdated",()=>{}),__publicField(this,"onMeshAddedFromUrl",()=>{}),__publicField(this,"onMeshAdded",()=>{}),__publicField(this,"onMeshWithUrlRemoved",()=>{}),__publicField(this,"onZoom3DChange",()=>{}),__publicField(this,"onAzimuthElevationChange",()=>{}),__publicField(this,"onClipPlaneChange",()=>{}),__publicField(this,"onCustomMeshShaderAdded",()=>{}),__publicField(this,"onMeshShaderChanged",()=>{}),__publicField(this,"onMeshPropertyChanged",()=>{}),__publicField(this,"onDocumentLoaded",()=>{}),__publicField(this,"document",new NVDocument),__publicField(this,"mediaUrlMap",new Map),__publicField(this,"initialized",!1),__publicField(this,"currentDrawUndoBitmap"),__publicField(this,"loadingText");for(const s in n)typeof n[s]=="function"?this[s]=n[s]:this.opts[s]=DEFAULT_OPTIONS[s]===void 0?DEFAULT_OPTIONS[s]:n[s];this.opts.isHighResolutionCapable?this.uiData.dpr=window.devicePixelRatio||1:this.uiData.dpr=1,this.currentDrawUndoBitmap=this.opts.maxDrawUndoBitmaps,this.opts.drawingEnabled&&this.createEmptyDrawing(),this.opts.thumbnail.length>0&&(this.thumbnailVisible=!0),this.loadingText=this.opts.loadingText,log$4.setLogLevel(this.opts.logLevel)}get scene(){return this.document.scene}get opts(){return this.document.opts}get sliceMosaicString(){return this.document.opts.sliceMosaicString||""}set sliceMosaicString(n){this.document.opts.sliceMosaicString=n}get volumes(){return this.document.volumes}set volumes(n){this.document.volumes=n}get meshes(){return this.document.meshes}set meshes(n){this.document.meshes=n}get drawBitmap(){return this.document.drawBitmap}set drawBitmap(n){this.document.drawBitmap=n}get volScaleMultiplier(){return this.scene.volScaleMultiplier}set volScaleMultiplier(n){this.setScale(n)}async saveScene(n="niivue.png"){function s(f,m){const A=document.createElement("a");document.body.appendChild(A),A.style.display="none";const v=window.URL.createObjectURL(f);A.href=v,A.download=m,A.click(),A.remove()}const u=this.canvas;if(!u)throw new Error("canvas not defined");this.drawScene(),u.toBlob(f=>{f&&(n===""&&(n=`niivue-screenshot-${new Date().toString()}.png`,n=n.replace(/\s/g,"_")),s(f,n))})}async attachTo(n,s=null){return await this.attachToCanvas(document.getElementById(n),s),log$4.debug("attached to element with id: ",n),this}async attachToCanvas(n,s=null){return this.canvas=n,s===null&&(s=navigator.hardwareConcurrency>6,log$4.debug("AntiAlias ",s," Threads ",navigator.hardwareConcurrency)),this.gl=this.canvas.getContext("webgl2",{alpha:!0,antialias:s}),log$4.info("NIIVUE VERSION ",version$1),this.canvas.parentElement.style.backgroundColor="black",this.opts.isResizeCanvas&&(this.canvas.style.width="100%",this.canvas.style.height="100%",this.canvas.style.display="block",this.canvas.width=this.canvas.offsetWidth,this.canvas.height=this.canvas.offsetHeight,window.addEventListener("resize",this.resizeListener.bind(this)),this.resizeObserver=new ResizeObserver(this.resizeListener.bind(this)),this.resizeObserver.observe(this.canvas.parentElement)),this.registerInteractions(),await this.init(),this.drawScene(),this}syncWith(n,s={"2d":!0,"3d":!0}){this.otherNV=n,this.syncOpts=s}broadcastTo(n,s={"2d":!0,"3d":!0}){this.otherNV=n,this.syncOpts=s}sync(){if(!this.gl||!this.otherNV||typeof this.otherNV>"u"||!this.gl.canvas.matches(":focus"))return;const n=this.frac2mm(this.scene.crosshairPos);if(this.otherNV instanceof zo)this.syncOpts["2d"]&&(this.otherNV.scene.crosshairPos=this.otherNV.mm2frac(n)),this.syncOpts["3d"]&&(this.otherNV.scene.renderAzimuth=this.scene.renderAzimuth,this.otherNV.scene.renderElevation=this.scene.renderElevation),this.otherNV.drawScene(),this.otherNV.createOnLocationChange();else if(Array.isArray(this.otherNV))for(let s=0;su===s[f])}resizeListener(){if(!(!this.canvas||!this.gl)){if(!this.opts.isResizeCanvas){this.opts.isHighResolutionCapable&&(log$4.warn("isHighResolutionCapable requires isResizeCanvas"),this.opts.isHighResolutionCapable=!1),this.uiData.dpr=1,this.drawScene();return}this.canvas.style.width="100%",this.canvas.style.height="100%",this.canvas.style.display="block",this.opts.isHighResolutionCapable?(this.uiData.dpr=window.devicePixelRatio||1,log$4.debug("devicePixelRatio: "+this.uiData.dpr)):this.uiData.dpr=1,"width"in this.canvas.parentElement?(this.canvas.width=this.canvas.parentElement.width*this.uiData.dpr,this.canvas.height=this.canvas.parentElement.height*this.uiData.dpr):(this.canvas.width=this.canvas.offsetWidth*this.uiData.dpr,this.canvas.height=this.canvas.offsetHeight*this.uiData.dpr),this.gl.viewport(0,0,this.gl.canvas.width,this.gl.canvas.height),this.drawScene()}}getRelativeMousePosition(n,s){if(s=s||n.target,!s)return;const u=s.getBoundingClientRect();return{x:n.clientX-u.left,y:n.clientY-u.top}}getNoPaddingNoBorderCanvasRelativeMousePosition(n,s){return s=s||n.target,this.getRelativeMousePosition(n,s)}mouseContextMenuListener(n){n.preventDefault()}mouseDownListener(n){n.preventDefault(),this.drawPenLocation=[NaN,NaN,NaN],this.drawPenAxCorSag=-1,this.uiData.mousedown=!0,log$4.debug("mouse down"),log$4.debug(n);const s=this.getNoPaddingNoBorderCanvasRelativeMousePosition(n,this.gl.canvas);if(!s)return;const[u,f]=[s.x*this.uiData.dpr,s.y*this.uiData.dpr],m=this.getLabelAtPoint([u,f]);if(m){for(const A of this.meshes)if(A.type==="connectome")for(const v of A.nodes)v.label===m&&(this.scene.crosshairPos=this.mm2frac([v.x,v.y,v.z]),this.updateGLVolume(),this.drawScene())}this.uiData.clickedTile=this.tileIndex(u,f),n.button===LEFT_MOUSE_BUTTON&&n.shiftKey?(this.uiData.mouseButtonCenterDown=!0,this.mouseCenterButtonHandler(n)):n.button===LEFT_MOUSE_BUTTON?(this.uiData.mouseButtonLeftDown=!0,this.mouseLeftButtonHandler(n)):n.button===RIGHT_MOUSE_BUTTON?(this.uiData.mouseButtonRightDown=!0,this.mouseRightButtonHandler(n)):n.button===CENTER_MOUSE_BUTTON&&(this.uiData.mouseButtonCenterDown=!0,this.mouseCenterButtonHandler(n))}mouseLeftButtonHandler(n){const s=this.getNoPaddingNoBorderCanvasRelativeMousePosition(n,this.gl.canvas);this.mouseDown(s.x,s.y),this.mouseClick(s.x,s.y)}mouseCenterButtonHandler(n){const s=this.getNoPaddingNoBorderCanvasRelativeMousePosition(n,this.gl.canvas);this.mousePos=[s.x*this.uiData.dpr,s.y*this.uiData.dpr],this.opts.dragMode!==0&&(this.setDragStart(s.x,s.y),this.uiData.isDragging||(this.uiData.pan2DxyzmmAtMouseDown=clone$1(this.scene.pan2Dxyzmm)),this.uiData.isDragging=!0,this.uiData.dragClipPlaneStartDepthAziElev=this.scene.clipPlaneDepthAziElev)}mouseRightButtonHandler(n){const s=this.getNoPaddingNoBorderCanvasRelativeMousePosition(n,this.gl.canvas);this.mousePos=[s.x*this.uiData.dpr,s.y*this.uiData.dpr],this.opts.dragMode!==0&&(this.setDragStart(s.x,s.y),this.uiData.isDragging||(this.uiData.pan2DxyzmmAtMouseDown=clone$1(this.scene.pan2Dxyzmm)),this.uiData.isDragging=!0,this.uiData.dragClipPlaneStartDepthAziElev=this.scene.clipPlaneDepthAziElev)}calculateMinMaxVoxIdx(n){if(n.length>2)throw new Error("array must not contain more than two values");return[Math.floor(Math.min(n[0],n[1])),Math.floor(Math.max(n[0],n[1]))]}calculateNewRange({volIdx:n=0}={}){if(this.opts.sliceType===4&&this.sliceMosaicString.length<1||this.uiData.dragStart[0]===this.uiData.dragEnd[0]&&this.uiData.dragStart[1]===this.uiData.dragEnd[1])return;let s=this.canvasPos2frac([this.uiData.dragStart[0],this.uiData.dragStart[1]]);if(s[0]<0)return;const u=this.frac2vox(s,n);if(s=this.canvasPos2frac([this.uiData.dragEnd[0],this.uiData.dragEnd[1]]),s[0]<0)return;const f=this.frac2vox(s,n);let m=-Number.MAX_VALUE,A=Number.MAX_VALUE;const v=this.calculateMinMaxVoxIdx([u[0],f[0]]),y=this.calculateMinMaxVoxIdx([u[1],f[1]]),T=this.calculateMinMaxVoxIdx([u[2],f[2]]);u[0]-f[0]===0?v[1]=u[0]+1:u[1]-f[1]===0?y[1]=u[1]+1:u[2]-f[2]===0&&(T[1]=u[2]+1);const E=this.volumes[n].hdr,S=this.volumes[n].img;if(!E||!S)return;const I=E.dims[1],e=E.dims[2];for(let L=T[0];LS[W]&&(A=S[W]),m=m)return;const F=intensityRaw2Scaled(E,A),M=intensityRaw2Scaled(E,m);this.volumes[n].cal_min=F,this.volumes[n].cal_max=M,this.onIntensityChange(this.volumes[n])}generateMouseUpCallback(n,s){const u=this.tileIndex(this.uiData.dragStart[0],this.uiData.dragStart[1]),f=this.tileIndex(this.uiData.dragEnd[0],this.uiData.dragEnd[1]);let m=-1;u===f&&(m=f);let A=-1;m>=0&&(A=this.screenSlices[m].axCorSag);const v=this.frac2mm(n),y=this.frac2mm(s),T=create$2();sub$4(T,fromValues$2(v[0],v[1],v[2]),fromValues$2(y[0],y[1],y[2]));const E=len(T),S=this.frac2vox(n),I=this.frac2vox(s);this.onDragRelease({fracStart:n,fracEnd:s,voxStart:S,voxEnd:I,mmStart:v,mmEnd:y,mmLength:E,tileIdx:m,axCorSag:A})}mouseUpListener(){function n(f){return Object.prototype.toString.call(f).indexOf("Function")>-1}const s={mouseButtonRightDown:this.uiData.mouseButtonRightDown,mouseButtonCenterDown:this.uiData.mouseButtonCenterDown,isDragging:this.uiData.isDragging,mousePos:this.mousePos,fracPos:this.canvasPos2frac(this.mousePos)};this.uiData.mousedown=!1,this.uiData.mouseButtonRightDown=!1;const u=this.uiData.mouseButtonCenterDown;if(this.uiData.mouseButtonCenterDown=!1,this.uiData.mouseButtonLeftDown=!1,this.drawPenFillPts.length>0?this.drawPenFilled():this.drawPenAxCorSag>=0&&this.drawAddUndoBitmap(),this.drawPenLocation=[NaN,NaN,NaN],this.drawPenAxCorSag=-1,n(this.onMouseUp)&&this.onMouseUp(s),this.uiData.isDragging){this.uiData.isDragging=!1,this.opts.dragMode===5&&this.drawScene();const f=this.canvasPos2frac([this.uiData.dragStart[0],this.uiData.dragStart[1]]),m=this.canvasPos2frac([this.uiData.dragEnd[0],this.uiData.dragEnd[1]]);if(this.generateMouseUpCallback(f,m),this.opts.dragMode!==1||u||this.uiData.dragStart[0]===this.uiData.dragEnd[0]&&this.uiData.dragStart[1]===this.uiData.dragEnd[1])return;this.calculateNewRange({volIdx:0}),this.refreshLayers(this.volumes[0],0)}this.drawScene()}checkMultitouch(n){if(this.uiData.touchdown&&!this.uiData.multiTouchGesture){const s=this.canvas.getBoundingClientRect();this.mouseDown(n.touches[0].clientX-s.left,n.touches[0].clientY-s.top),this.mouseClick(n.touches[0].clientX-s.left,n.touches[0].clientY-s.top)}}touchStartListener(n){n.preventDefault(),this.uiData.touchTimer||(this.uiData.touchTimer=setTimeout(()=>{this.resetBriCon(n)},this.opts.longTouchTimeout)),this.uiData.touchdown=!0,this.uiData.currentTouchTime=new Date().getTime();const s=this.uiData.currentTouchTime-this.uiData.lastTouchTime;if(s0){this.uiData.doubleTouch=!0,this.setDragStart(n.targetTouches[0].clientX-n.target.getBoundingClientRect().left,n.targetTouches[0].clientY-n.target.getBoundingClientRect().top),this.resetBriCon(n),this.uiData.lastTouchTime=this.uiData.currentTouchTime;return}else this.uiData.doubleTouch=!1,this.setDragStart(0,0),this.setDragEnd(0,0),this.uiData.lastTouchTime=this.uiData.currentTouchTime;this.uiData.touchdown&&n.touches.length<2?this.uiData.multiTouchGesture=!1:this.uiData.multiTouchGesture=!0,setTimeout(this.checkMultitouch.bind(this),1,n)}touchEndListener(n){if(n.preventDefault(),this.uiData.touchdown=!1,this.uiData.lastTwoTouchDistance=0,this.uiData.multiTouchGesture=!1,this.uiData.touchTimer&&(clearTimeout(this.uiData.touchTimer),this.uiData.touchTimer=null),this.uiData.isDragging){this.uiData.isDragging=!1,this.opts.dragMode===1&&(this.calculateNewRange(),this.refreshLayers(this.volumes[0],0));const s=this.canvasPos2frac([this.uiData.dragStart[0],this.uiData.dragStart[1]]),u=this.canvasPos2frac([this.uiData.dragEnd[0],this.uiData.dragEnd[1]]);this.generateMouseUpCallback(s,u)}this.mouseUpListener()}mouseMoveListener(n){if(this.uiData.mousedown){const s=this.getNoPaddingNoBorderCanvasRelativeMousePosition(n,this.gl.canvas);if(!s)return;const u=s.x*this.uiData.dpr,f=s.y*this.uiData.dpr;if(this.tileIndex(u,f)!==this.uiData.clickedTile)return;this.uiData.mouseButtonLeftDown?(this.mouseMove(s.x,s.y),this.mouseClick(s.x,s.y)):(this.uiData.mouseButtonRightDown||this.uiData.mouseButtonCenterDown)&&this.setDragEnd(s.x,s.y),this.drawScene(),this.uiData.prevX=this.uiData.currX,this.uiData.prevY=this.uiData.currY}}resetBriCon(n=null){if(this.uiData.isDragging)return;let s=!1;this.opts.sliceType===4&&(s=!0);let u=0,f=0;if(n!==null&&("targetTouches"in n?(u=n.targetTouches[0].clientX-n.target.getBoundingClientRect().left,f=n.targetTouches[0].clientY-n.target.getBoundingClientRect().top):(u=n.offsetX,f=n.offsetY),u*=this.uiData.dpr,f*=this.uiData.dpr,this.inRenderTile(u,f)>=0&&(s=!0)),s){this.uiData.mouseDepthPicker=!0,this.drawScene(),this.drawScene();return}this.opts.dragMode!==4&&(this.volumes.length<1||this.uiData.doubleTouch||(this.volumes[0].cal_min=this.volumes[0].robust_min,this.volumes[0].cal_max=this.volumes[0].robust_max,this.onIntensityChange(this.volumes[0]),this.refreshLayers(this.volumes[0],0),this.drawScene()))}setDragStart(n,s){n*=this.uiData.dpr,s*=this.uiData.dpr,this.uiData.dragStart[0]=n,this.uiData.dragStart[1]=s}setDragEnd(n,s){n*=this.uiData.dpr,s*=this.uiData.dpr,this.uiData.dragEnd[0]=n,this.uiData.dragEnd[1]=s}touchMoveListener(n){if(this.uiData.touchdown&&n.touches.length<2){const s=this.canvas.getBoundingClientRect();if(this.uiData.isDragging||(this.uiData.pan2DxyzmmAtMouseDown=clone$1(this.scene.pan2Dxyzmm)),this.uiData.isDragging=!0,this.uiData.doubleTouch&&this.uiData.isDragging){this.setDragEnd(n.targetTouches[0].clientX-n.target.getBoundingClientRect().left,n.targetTouches[0].clientY-n.target.getBoundingClientRect().top),this.drawScene();return}this.mouseClick(n.touches[0].clientX-s.left,n.touches[0].clientY-s.top),this.mouseMove(n.touches[0].clientX-s.left,n.touches[0].clientY-s.top)}else this.handlePinchZoom(n)}handlePinchZoom(n){if(n.targetTouches.length===2&&n.changedTouches.length===2){const s=Math.hypot(n.touches[0].pageX-n.touches[1].pageX,n.touches[0].pageY-n.touches[1].pageY),u=this.canvas.getBoundingClientRect();this.mousePos=[n.touches[0].clientX-u.left,n.touches[0].clientY-u.top],sthis.opts.keyDebounceTime){switch(this.currentClipPlaneIndex=(this.currentClipPlaneIndex+1)%7,this.currentClipPlaneIndex){case 0:this.scene.clipPlaneDepthAziElev=[2,0,0];break;case 1:this.scene.clipPlaneDepthAziElev=[0,270,0];break;case 2:this.scene.clipPlaneDepthAziElev=[0,90,0];break;case 3:this.scene.clipPlaneDepthAziElev=[0,0,0];break;case 4:this.scene.clipPlaneDepthAziElev=[0,180,0];break;case 5:this.scene.clipPlaneDepthAziElev=[0,0,-90];break;case 6:this.scene.clipPlaneDepthAziElev=[0,0,90];break}this.setClipPlane(this.scene.clipPlaneDepthAziElev)}this.lastCalled=s}else if(n.code===this.opts.viewModeHotKey){const s=new Date().getTime();s-this.lastCalled>this.opts.keyDebounceTime&&(this.setSliceType((this.opts.sliceType+1)%5),this.lastCalled=s)}}keyDownListener(n){n.code==="KeyH"&&this.opts.sliceType===4?this.setRenderAzimuthElevation(this.scene.renderAzimuth-1,this.scene.renderElevation):n.code==="KeyL"&&this.opts.sliceType===4?this.setRenderAzimuthElevation(this.scene.renderAzimuth+1,this.scene.renderElevation):n.code==="KeyJ"&&this.opts.sliceType===4?this.setRenderAzimuthElevation(this.scene.renderAzimuth,this.scene.renderElevation+1):n.code==="KeyK"&&this.opts.sliceType===4?this.setRenderAzimuthElevation(this.scene.renderAzimuth,this.scene.renderElevation-1):n.code==="KeyH"&&this.opts.sliceType!==4?this.moveCrosshairInVox(-1,0,0):n.code==="KeyL"&&this.opts.sliceType!==4?this.moveCrosshairInVox(1,0,0):n.code==="KeyU"&&this.opts.sliceType!==4&&n.ctrlKey?this.moveCrosshairInVox(0,0,1):n.code==="KeyD"&&this.opts.sliceType!==4&&n.ctrlKey?this.moveCrosshairInVox(0,0,-1):n.code==="KeyJ"&&this.opts.sliceType!==4?this.moveCrosshairInVox(0,-1,0):n.code==="KeyK"&&this.opts.sliceType!==4?this.moveCrosshairInVox(0,1,0):n.code==="KeyM"&&this.opts.sliceType!==4?(this.opts.dragMode++,this.opts.dragMode>=4&&(this.opts.dragMode=0),log$4.info("drag mode changed to ",DRAG_MODE[this.opts.dragMode])):n.code==="ArrowLeft"?this.setFrame4D(this.volumes[0].id,this.volumes[0].frame4D-1):n.code==="ArrowRight"?this.setFrame4D(this.volumes[0].id,this.volumes[0].frame4D+1):n.code==="Slash"&&n.shiftKey&&alert(`NIIVUE VERSION: ${version$1}`)}wheelListener(n){if(n.preventDefault(),n.stopPropagation(),this.thumbnailVisible)return;const s=this.canvas.getBoundingClientRect();n.deltaY<0?this.sliceScroll2D(-.01,n.clientX-s.left,n.clientY-s.top):this.sliceScroll2D(.01,n.clientX-s.left,n.clientY-s.top)}registerInteractions(){if(!this.canvas)throw new Error("canvas undefined");this.canvas.addEventListener("mousedown",this.mouseDownListener.bind(this)),this.canvas.addEventListener("mouseup",this.mouseUpListener.bind(this)),this.canvas.addEventListener("mousemove",this.mouseMoveListener.bind(this)),this.canvas.addEventListener("touchstart",this.touchStartListener.bind(this)),this.canvas.addEventListener("touchend",this.touchEndListener.bind(this)),this.canvas.addEventListener("touchmove",this.touchMoveListener.bind(this)),this.canvas.addEventListener("wheel",this.wheelListener.bind(this)),this.canvas.addEventListener("contextmenu",this.mouseContextMenuListener.bind(this)),this.canvas.addEventListener("dblclick",this.resetBriCon.bind(this)),this.canvas.addEventListener("dragenter",this.dragEnterListener.bind(this),!1),this.canvas.addEventListener("dragover",this.dragOverListener.bind(this),!1),this.canvas.addEventListener("drop",this.dropListener.bind(this),!1),this.canvas.setAttribute("tabindex","0"),this.canvas.addEventListener("keyup",this.keyUpListener.bind(this),!1),this.canvas.addEventListener("keydown",this.keyDownListener.bind(this),!1)}dragEnterListener(n){n.stopPropagation(),n.preventDefault()}dragOverListener(n){n.stopPropagation(),n.preventDefault()}getFileExt(n,s=!0){log$4.debug("fullname: ",n);const u=/(?:\.([^.]+))?$/;let f=u.exec(n)[1];return f=f.toUpperCase(),f==="GZ"&&(f=u.exec(n.slice(0,-3))[1],f=f.toUpperCase()),s?f:f.toLowerCase()}async addVolumeFromUrl(n){const s=await NVImage.loadFromUrl(n);return this.document.addImageOptions(s,n),s.onColormapChange=this.onColormapChange,this.mediaUrlMap.set(s,n.url),this.onVolumeAddedFromUrl&&this.onVolumeAddedFromUrl(n,s),this.addVolume(s),s}getMediaByUrl(n){return[...this.mediaUrlMap.entries()].filter(s=>s[1]===n).map(s=>s[0]).pop()}removeVolumeByUrl(n){const s=this.getMediaByUrl(n);if(s)this.removeVolume(s);else throw new Error("No volume with URL present")}readDirectory(n){const s=n.createReader();let u=[];const f=async A=>{const v=[],y=async T=>new Promise((E,S)=>T.file(E,S));for(let T=0;T{s.readEntries(A=>{A.length?(u=u.concat(A),m()):f(u).then(v=>{NVImage.loadFromFile({file:v,name:n.name,urlImgData:null,imageType:NVIMAGE_TYPE.DCM_FOLDER}).then(y=>this.addVolume(y)).catch(y=>{throw y})}).catch(v=>{throw v})})};return m(),u}isMeshExt(n){const s=this.getFileExt(n);return log$4.debug("dropped ext"),log$4.debug(s),MESH_EXTENSIONS.includes(s)}dropListener(n){if(n.stopPropagation(),n.preventDefault(),!this.opts.dragAndDropEnabled)return;const s=n.dataTransfer;if(!s)return;const u=s.getData("text/uri-list");if(u){const f=NVImageFromUrlOptions(u),m=this.getFileExt(u);log$4.debug("dropped ext"),log$4.debug(m),MESH_EXTENSIONS.includes(m)?this.addMeshFromUrl({url:u}).catch(A=>{throw A}):m==="NVD"?this.loadDocumentFromUrl(u).catch(A=>{throw A}):this.addVolumeFromUrl(f).catch(A=>{throw A})}else{const f=s.items;if(f.length>0){!n.shiftKey&&!n.altKey&&(this.volumes=[],this.overlays=[],this.meshes=[]),this.closeDrawing();for(const m of Array.from(f)){const A=m.webkitGetAsEntry();if(log$4.debug(A),!A)throw new Error("could not get entry from file");if(A.isFile){const v=this.getFileExt(A.name);if(v==="PNG"){A.file(T=>{this.loadBmpTexture(T).catch(E=>{throw E})});continue}let y;if(A.name.lastIndexOf("HEAD")!==-1)for(const T of Array.from(f)){const E=T.webkitGetAsEntry();if(!E)throw new Error("could not get paired entry");const S=A.name.substring(0,A.name.lastIndexOf("HEAD")),I=E.name.substring(0,E.name.lastIndexOf("BRIK"));S===I&&(y=E)}if(A.name.lastIndexOf("BRIK")!==-1)continue;if(MESH_EXTENSIONS.includes(v)){A.file(T=>{NVMesh.loadFromFile({file:T,gl:this.gl,name:T.name}).then(E=>{this.addMesh(E)}).catch(E=>{throw E})});continue}else if(v==="NVD"){A.file(T=>{NVDocument.loadFromFile(T).then(E=>{this.loadDocument(E),log$4.debug("loaded document")}).catch(E=>{throw E})});break}A.file(T=>{y?y.file(E=>{NVImage.loadFromFile({file:T,urlImgData:E,limitFrames4D:this.opts.limitFrames4D}).then(S=>{this.addVolume(S)}).catch(S=>{throw S})}):NVImage.loadFromFile({file:T,urlImgData:y,limitFrames4D:this.opts.limitFrames4D}).then(E=>{n.altKey?(log$4.debug("alt key detected: assuming this is a drawing overlay"),this.drawClearAllUndoBitmaps(),this.loadDrawing(E)):this.addVolume(E)}).catch(E=>{throw E})})}else A.isDirectory&&this.readDirectory(A)}}}this.drawScene()}setMultiplanarPadPixels(n){this.opts.multiplanarPadPixels=n,this.drawScene()}setMultiplanarLayout(n){typeof n=="string"&&(n=parseInt(n)),this.opts.multiplanarLayout=n,this.drawScene()}setCornerOrientationText(n){this.opts.isCornerOrientationText=n,this.updateGLVolume()}setRadiologicalConvention(n){this.opts.isRadiologicalConvention=n,this.updateGLVolume()}setDefaults(n={},s=!1){this.document.opts={...DEFAULT_OPTIONS},this.scene.sceneData={...INITIAL_SCENE_DATA};for(const u in n)typeof n[u]=="function"?this[u]=n[u]:this.opts[u]=DEFAULT_OPTIONS[u]===void 0?DEFAULT_OPTIONS[u]:n[u];if(this.scene.pan2Dxyzmm=[0,0,0,1],s&&this.volumes&&this.volumes.length>0)for(let u=0;u=this.opts.maxDrawUndoBitmaps&&(this.currentDrawUndoBitmap=0),this.drawUndoBitmaps[this.currentDrawUndoBitmap]=encodeRLE(this.drawBitmap)}drawClearAllUndoBitmaps(){if(this.currentDrawUndoBitmap=this.opts.maxDrawUndoBitmaps,!(!this.drawUndoBitmaps||this.drawUndoBitmaps.length<1))for(let n=this.drawUndoBitmaps.length-1;n>=0;n--)this.drawUndoBitmaps[n]=new Uint8Array}drawUndo(){if(this.drawUndoBitmaps.length<1){log$4.debug("undo bitmaps not loaded");return}if(this.currentDrawUndoBitmap--,this.currentDrawUndoBitmap<0&&(this.currentDrawUndoBitmap=this.drawUndoBitmaps.length-1),this.currentDrawUndoBitmap>=this.drawUndoBitmaps.length&&(this.currentDrawUndoBitmap=0),this.drawUndoBitmaps[this.currentDrawUndoBitmap].length<2){log$4.debug("drawUndo is misbehaving");return}this.drawBitmap=decodeRLE(this.drawUndoBitmaps[this.currentDrawUndoBitmap],this.drawBitmap.length),this.refreshDrawing(!0)}loadDrawing(n){if(this.drawBitmap&&log$4.debug("Overwriting open drawing!"),!this.back)throw new Error("back undefined");this.drawClearAllUndoBitmaps();const s=n.hdr.dims;if(s[1]!==this.back.hdr.dims[1]||s[2]!==this.back.hdr.dims[2]||s[3]!==this.back.hdr.dims[3])return log$4.debug("drawing dimensions do not match background image"),!1;n.img.constructor!==Uint8Array&&log$4.debug("Drawings should be UINT8");const u=n.permRAS,f=s[1]*s[2]*s[3];this.drawBitmap=new Uint8Array(f),this.drawTexture=this.r8Tex(this.drawTexture,TEXTURE7_DRAW,this.back.dims,!0);const m=[0,0,0];for(let M=0;M<3;M++)for(let L=0;L<3;L++)Math.abs(u[M])-1===L&&(m[L]=M*Math.sign(u[M]));let A=1;const v=[1,1,1],y=[!1,!1,!1];for(let M=0;MArray(f).fill(0)),M=Array(f).fill(0).map(()=>Array(f).fill(0));for(let B=1;B3)for(let B=0;BL&&(V[0]=B,V[1]=z,V[2]=b,L=W)}else if(n===3)for(let B=0;BL&&(V[0]=B,V[1]=z,L=b)}else for(let B=0;BL&&(V[0]=B,L=z)}return[E(V[0]),E(V[1]),E(V[2])]}drawOtsu(n=2){if(this.volumes.length===0)return;const s=this.volumes[0].img.length,u=this.findOtsu(n);if(u.length<3)return;this.drawBitmap||this.createEmptyDrawing();const f=this.drawBitmap,m=this.volumes[0].img;for(let A=0;Au[0]&&(f[A]=1),v>u[1]&&(f[A]=2),v>u[2]&&(f[A]=3)}this.drawAddUndoBitmap(),this.refreshDrawing(!0)}removeHaze(n=5,s=0){const u=this.volumes[s].img,f=this.volumes[s].hdr,m=u.length;let A=2;(n===5||n===1)&&(A=4),(n===4||n===2)&&(A=3);const v=this.findOtsu(A);if(v.length<3)return;let y=v[0];n===1&&(y=v[2]),n===2&&(y=v[1]);const T=f.scl_inter,E=f.scl_slope,S=this.volumes[s].global_min;for(let I=0;I=this.meshes.length?-1:n;const s=this.meshes.length;for(let u=0;uu)return;const f=this.getVolumeIndexByID(n.id);s===0?(this.volumes.splice(f,1),this.volumes.unshift(n),this.back=this.volumes[0],this.overlays=this.volumes.slice(1)):s<0?(this.volumes.splice(this.getVolumeIndexByID(n.id),1),this.back=this.volumes[0],this.volumes.length>1?this.overlays=this.volumes.slice(1):this.overlays=[]):(this.volumes.splice(f,1),this.volumes.splice(s,0,n),this.overlays=this.volumes.slice(1),this.back=this.volumes[0]),this.updateGLVolume()}setMesh(n,s=0){this.meshes.forEach(m=>{log$4.debug("MESH: ",m.name)});const u=this.meshes.length;if(s>u)return;const f=this.getMeshIndexByID(n.id);s===0?(this.meshes.splice(f,1),this.meshes.unshift(n)):s<0?this.meshes.splice(this.getMeshIndexByID(n.id),1):(this.meshes.splice(f,1),this.meshes.splice(s,0,n)),this.updateGLVolume(),this.meshes.forEach(m=>{log$4.debug(m.name)})}removeVolume(n){if(this.setVolume(n,-1),this.mediaUrlMap.has(n)){const s=this.mediaUrlMap.get(n);this.onVolumeWithUrlRemoved(s),this.mediaUrlMap.delete(n)}this.drawScene()}removeVolumeByIndex(n){if(n>=this.volumes.length)throw new Error("Index of volume out of bounds");this.removeVolume(this.volumes[n])}removeMesh(n){if(this.setMesh(n,-1),this.mediaUrlMap.has(n)){const s=this.mediaUrlMap.get(n);this.onMeshWithUrlRemoved(s),this.mediaUrlMap.delete(n)}}removeMeshByUrl(n){const s=this.getMediaByUrl(n);s&&(this.removeMesh(s),this.mediaUrlMap.delete(s),this.onMeshWithUrlRemoved(n))}moveVolumeToBottom(n){this.setVolume(n,0)}moveVolumeUp(n){const s=this.getVolumeIndexByID(n.id);this.setVolume(n,s+1)}moveVolumeDown(n){const s=this.getVolumeIndexByID(n.id);this.setVolume(n,s-1)}moveVolumeToTop(n){this.setVolume(n,this.volumes.length-1)}mouseDown(n,s){n*=this.uiData.dpr,s*=this.uiData.dpr,this.mousePos=[n,s]}mouseMove(n,s){n*=this.uiData.dpr,s*=this.uiData.dpr;const u=(n-this.mousePos[0])/this.uiData.dpr,f=(s-this.mousePos[1])/this.uiData.dpr;this.mousePos=[n,s],!(this.inRenderTile(n,s)<0)&&(Math.abs(u)<1&&Math.abs(f)<1||(this.scene.renderAzimuth+=u,this.scene.renderElevation+=f,this.drawScene()))}sph2cartDeg(n,s){const u=-s*(Math.PI/180),f=(n-90)%360*(Math.PI/180),m=[Math.cos(u)*Math.cos(f),Math.cos(u)*Math.sin(f),Math.sin(u)],A=Math.sqrt(m[0]*m[0]+m[1]*m[1]+m[2]*m[2]);return A<=0||(m[0]/=A,m[1]/=A,m[2]/=A),m}setClipPlane(n){const s=this.sph2cartDeg(n[1]+180,n[2]);this.scene.clipPlane=[s[0],s[1],s[2],n[0]],this.scene.clipPlaneDepthAziElev=n,this.onClipPlaneChange(this.scene.clipPlane),this.drawScene()}setCrosshairColor(n){this.opts.crosshairColor=n,this.drawScene()}setCrosshairWidth(n){this.opts.crosshairWidth=n,this.crosshairs3D&&(this.crosshairs3D.mm[0]=NaN),this.drawScene()}setDrawColormap(n){this.drawLut=cmapper.makeDrawLut(n),this.updateGLVolume()}setDrawingEnabled(n){this.opts.drawingEnabled=n,this.opts.drawingEnabled&&(this.drawBitmap||this.createEmptyDrawing()),this.drawScene()}setPenValue(n,s=!1){this.opts.penValue=n,this.opts.isFilledPen=s,this.drawScene()}setDrawOpacity(n){this.drawOpacity=n,this.drawScene()}setSelectionBoxColor(n){this.opts.selectionBoxColor=n}sliceScroll2D(n,s,u,f=!0){if(this.inGraphTile(s,u)){let m=this.volumes[0].frame4D;n>0&&m++,n<0&&m--,this.setFrame4D(this.volumes[0].id,m);return}if(n!==0&&this.opts.dragMode===3&&this.inRenderTile(this.uiData.dpr*s,this.uiData.dpr*u)===-1){let m=this.scene.pan2Dxyzmm[3]*(1+10*n);m=Math.round(m*10)/10;const A=this.scene.pan2Dxyzmm[3]-m;this.opts.yoke3Dto2DZoom&&(this.scene.volScaleMultiplier=m),this.scene.pan2Dxyzmm[3]=m;const v=this.frac2mm(this.scene.crosshairPos);this.scene.pan2Dxyzmm[0]+=A*v[0],this.scene.pan2Dxyzmm[1]+=A*v[1],this.scene.pan2Dxyzmm[2]+=A*v[2],this.drawScene();return}this.mouseClick(s,u,n,f)}setSliceType(n){return this.opts.sliceType=n,this.drawScene(),this}setOpacity(n,s){if(this.volumes[n].opacity=s,n===0){this.drawScene();return}this.updateGLVolume()}setScale(n){this.scene.volScaleMultiplier=n,this.drawScene()}setClipPlaneColor(n){this.opts.clipPlaneColor=n,this.renderShader.use(this.gl),this.gl.uniform4fv(this.renderShader.uniforms.clipPlaneColor,this.opts.clipPlaneColor),this.drawScene()}async setVolumeRenderIllumination(n=0){this.renderShader=this.renderVolumeShader,n>0&&(this.renderShader=this.renderGradientShader),n<0&&(this.renderShader=this.renderSliceShader),this.initRenderShader(this.renderShader,n),this.renderShader.use(this.gl),this.setClipPlaneColor(this.opts.clipPlaneColor),this.gradientTextureAmount=n,this.refreshLayers(this.volumes[0],0),this.drawScene()}overlayRGBA(n){const s=n.hdr,u=s.dims[1]*s.dims[2]*s.dims[3],f=new Uint8ClampedArray(u*4),m=.2*Math.min(Math.min(s.dims[1],s.dims[2]),s.dims[3]),A=.5*s.dims[1],v=.5*s.dims[2],y=.5*s.dims[3];let T=0;for(let E=0;E0&&(this.back=this.volumes[0]);const f=n.encodedDrawingBlob;if(f){const m=n.imageOptionsArray[0],A=NVImage.loadFromBase64({base64:f,...m});A&&this.loadDrawing(A)}for(const m of n.meshDataObjects??[]){const A={gl:this.gl,...m};log$4.debug(A);const v=new NVMesh(A.pts,A.tris,A.name,A.rgba255,A.opacity,A.visible,this.gl,A.connectome,A.dpg,A.dps,A.dpv);v.meshShaderIndex=A.meshShaderIndex,v.layers=A.layers,v.updateMesh(this.gl),log$4.debug(v),this.addMesh(v)}if(n.data.connectomes)for(const m of n.data.connectomes){const A=JSON.parse(m);this.loadConnectome(A)}return this.updateGLVolume(),this.drawScene(),this.onDocumentLoaded(n),this}generateLoadDocumentJavaScript(n,s){const u=this.json(),f=NVUtilities.compressToBase64String(JSON.stringify(u));return` +`),S=/(.*\/).*/.exec(f)[0],I=[];for(const e of T){const F=new URL(e,S);if(v=await fetch(F,{headers:s}),!v.ok)throw Error(v.statusText);const M=await v.arrayBuffer();I.push(M)}return I}static async fetchPartial(n,s,u={}){try{return await fetch(n,{headers:{range:`bytes=0-'${s}`,stream:"true",...u}})}catch(f){return log$4.error(f),log$4.error("fetchPartial failed, trying again without range header"),await fetch(n,{headers:u})}}static async loadFromUrl({url:n="",urlImgData:s="",headers:u={},name:f="",colormap:m="gray",opacity:A=1,cal_min:v=NaN,cal_max:y=NaN,trustCalMinMax:T=!0,percentileFrac:E=.02,ignoreZeroVoxels:S=!1,useQFormNotSForm:I=!1,colormapNegative:e="",frame4D:F=0,isManifest:M=!1,limitFrames4D:L=NaN,imageType:V=NVIMAGE_TYPE.UNKNOWN,colorbarVisible:B=!0}={}){if(n==="")throw Error("url must not be empty");let z=null,b=null;if(n instanceof Uint8Array&&(n=n.buffer),n instanceof ArrayBuffer){b=n,n="array.nii";const Q=new Uint8Array(b);Q[0]===31&&Q[1]===139&&(n="array.nii.gz")}if(!isNaN(L)){let Q=await this.fetchPartial(n,512,u);b=await Q.arrayBuffer();let g=new Uint8Array(b),J=!1;g[0]===31&&g[1]===139&&(J=!0,new Decompress$1(fe=>{g=fe}).push(g),b=g.buffer);let re=g[0]===92&&g[1]===1;if(re||(re=g[1]===92&&g[0]===1),!re)b=null;else{const ae=nifti.readHeader(b);if(ae===null)throw new Error("could not read nifti header");const fe=ae.numBitsPerVoxel/8;let pe=1;for(let we=1;we<4;we++)ae.dims[we]>1&&(pe*=ae.dims[we]);let me=1;for(let we=4;we<7;we++)ae.dims[we]>1&&(me*=ae.dims[we]);const Se=Math.max(Math.min(L,me),1),ve=ae.vox_offset+Se*pe*fe;if(b.byteLength{we=De}).push(we),b=we.buffer}b.byteLength-1&&(f=f.slice(0,f.indexOf("?")))}let X=null;if(s.length>0){let Q=await fetch(s,{headers:u});Q.status===404&&s.lastIndexOf("BRIK")!==-1&&(Q=await fetch(s+".gz",{headers:u})),X=await Q.arrayBuffer()}if(!b)throw new Error("Unable to load buffer properly from volume");return z=new Zi(b,f,m,A,X,v,y,T,E,S,I,e,F,V),z.url=n,z.colorbarVisible=B,z}static readFileAsync(n,s=NaN){return new Promise((u,f)=>{const m=new FileReader;m.onload=()=>{n.name.lastIndexOf("gz")!==-1&&isNaN(s)?u(nifti.decompress(m.result)):u(m.result)},m.onerror=f,isNaN(s)?m.readAsArrayBuffer(n):m.readAsArrayBuffer(n.slice(0,s))})}static async loadFromFile({file:n,name:s="",colormap:u="gray",opacity:f=1,urlImgData:m=null,cal_min:A=NaN,cal_max:v=NaN,trustCalMinMax:y=!0,percentileFrac:T=.02,ignoreZeroVoxels:E=!1,useQFormNotSForm:S=!1,colormapNegative:I="",frame4D:e=0,limitFrames4D:F=NaN,imageType:M=NVIMAGE_TYPE.UNKNOWN}){let L=null,V=[];try{if(Array.isArray(n))for(let z=0;z{z=Y}).push(z),V=z.buffer);let W=z[0]===92&&z[1]===1;if(W||(W=z[1]===92&&z[0]===1),!W)V=await this.readFileAsync(n);else{const q=nifti.readHeader(V);if(!q)throw new Error("could not read nifti header");const Y=q.numBitsPerVoxel/8;let X=1;for(let re=1;re<4;re++)q.dims[re]>1&&(X*=q.dims[re]);let Q=1;for(let re=4;re<7;re++)q.dims[re]>1&&(Q*=q.dims[re]);const g=Math.max(Math.min(F,Q),1),J=q.vox_offset+g*X*Y;if(V.byteLength{re=fe}).push(re),V=re.buffer}if(V.byteLength"u")return m;if(!s){const v=clone$3(this.frac2mmOrtho);return invert(v,v),transformMat4(u,u,v),m[0]=u[0],m[1]=u[1],m[2]=u[2],m}if(f[1]<1||f[2]<1||f[3]<1)return m;const A=clone$3(this.matRAS);return invert(A,A),transpose$3(A,A),transformMat4(u,u,A),m[0]=(u[0]+.5)/f[1],m[1]=(u[1]+.5)/f[2],m[2]=(u[2]+.5)/f[3],m}},DRAG_MODE=(a=>(a[a.none=0]="none",a[a.contrast=1]="contrast",a[a.measurement=2]="measurement",a[a.pan=3]="pan",a[a.slicer3D=4]="slicer3D",a[a.callbackOnly=5]="callbackOnly",a))(DRAG_MODE||{}),DEFAULT_OPTIONS={textHeight:.06,colorbarHeight:.05,crosshairWidth:1,crosshairGap:0,rulerWidth:4,show3Dcrosshair:!1,backColor:[0,0,0,1],crosshairColor:[1,0,0,1],fontColor:[.5,.5,.5,1],selectionBoxColor:[1,1,1,.5],clipPlaneColor:[.7,0,.7,.5],rulerColor:[1,0,0,.8],colorbarMargin:.05,trustCalMinMax:!0,clipPlaneHotKey:"KeyC",viewModeHotKey:"KeyV",doubleTouchTimeout:500,longTouchTimeout:1e3,keyDebounceTime:50,isNearestInterpolation:!1,isResizeCanvas:!0,atlasOutline:0,isRuler:!1,isColorbar:!1,isOrientCube:!1,multiplanarPadPixels:0,multiplanarForceRender:!1,isRadiologicalConvention:!1,meshThicknessOn2D:1/0,dragMode:1,yoke3Dto2DZoom:!1,isDepthPickMesh:!1,isCornerOrientationText:!1,sagittalNoseLeft:!1,isSliceMM:!1,isV1SliceShader:!1,isHighResolutionCapable:!0,logLevel:"info",loadingText:"waiting for images...",isForceMouseClickToVoxelCenters:!1,dragAndDropEnabled:!0,drawingEnabled:!1,penValue:1,floodFillNeighbors:6,isFilledPen:!1,thumbnail:"",maxDrawUndoBitmaps:8,sliceType:3,meshXRay:0,isAntiAlias:null,limitFrames4D:NaN,isAdditiveBlend:!1,showLegend:!0,legendBackgroundColor:[.3,.3,.3,.5],legendTextColor:[1,1,1,1],multiplanarLayout:0,renderOverlayBlend:1,sliceMosaicString:""},INITIAL_SCENE_DATA={azimuth:110,elevation:10,crosshairPos:fromValues$2(.5,.5,.5),clipPlane:[0,0,0,0],clipPlaneDepthAziElev:[2,0,0],volScaleMultiplier:1,pan2Dxyzmm:fromValues$1(0,0,0,1)},NVDocument=class Ji{constructor(){__publicField(this,"data",{title:"Untitled document",imageOptionsArray:[],meshOptionsArray:[],opts:{...DEFAULT_OPTIONS},previewImageDataURL:"",labels:[],encodedImageBlobs:[],encodedDrawingBlob:""}),__publicField(this,"scene"),__publicField(this,"volumes",[]),__publicField(this,"meshDataObjects"),__publicField(this,"meshes",[]),__publicField(this,"drawBitmap",null),__publicField(this,"imageOptionsMap",new Map),__publicField(this,"meshOptionsMap",new Map),this.scene={onAzimuthElevationChange:()=>{},onZoom3DChange:()=>{},sceneData:INITIAL_SCENE_DATA,get renderAzimuth(){return this.sceneData.azimuth},set renderAzimuth(n){this.sceneData.azimuth=n,this.onAzimuthElevationChange&&this.onAzimuthElevationChange(this.sceneData.azimuth,this.sceneData.elevation)},get renderElevation(){return this.sceneData.elevation},set renderElevation(n){this.sceneData.elevation=n,this.onAzimuthElevationChange&&this.onAzimuthElevationChange(this.sceneData.azimuth,this.sceneData.elevation)},get volScaleMultiplier(){return this.sceneData.volScaleMultiplier},set volScaleMultiplier(n){this.sceneData.volScaleMultiplier=n,this.onZoom3DChange(n)},get crosshairPos(){return this.sceneData.crosshairPos},set crosshairPos(n){this.sceneData.crosshairPos=n},get clipPlane(){return this.sceneData.clipPlane},set clipPlane(n){this.sceneData.clipPlane=n},get clipPlaneDepthAziElev(){return this.sceneData.clipPlaneDepthAziElev},set clipPlaneDepthAziElev(n){this.sceneData.clipPlaneDepthAziElev=n},get pan2Dxyzmm(){return this.sceneData.pan2Dxyzmm},set pan2Dxyzmm(n){this.sceneData.pan2Dxyzmm=n}}}get title(){return this.data.title}get previewImageDataURL(){return this.data.previewImageDataURL}set previewImageDataURL(n){this.data.previewImageDataURL=n}set title(n){this.data.title=n}get imageOptionsArray(){return this.data.imageOptionsArray}get encodedImageBlobs(){return this.data.encodedImageBlobs}get encodedDrawingBlob(){return this.data.encodedDrawingBlob}get opts(){return this.data.opts}set opts(n){this.data.opts={...n}}get labels(){return this.data.labels}set labels(n){this.data.labels=n}hasImage(n){return this.volumes.find(s=>s.id===n.id)!==void 0}hasImageFromUrl(n){return this.data.imageOptionsArray.find(s=>s.url===n)!==void 0}addImageOptions(n,s){if(!this.hasImage(n)&&!s.name)if(s.url){const f=/^(?:[a-z+]+:)?\/\//i.test(s.url)?new URL(s.url):new URL(s.url,window.location.href);s.name=f.pathname.split("/").pop(),s.name.toLowerCase().endsWith(".gz")&&(s.name=s.name.slice(0,-3)),s.name.toLowerCase().endsWith(".nii")||(s.name+=".nii")}else s.name="untitled.nii";s.imageType=NVIMAGE_TYPE.NII,this.data.imageOptionsArray.push(s),this.imageOptionsMap.set(n.id,this.data.imageOptionsArray.length-1)}removeImage(n){if(this.imageOptionsMap.has(n.id)){const s=this.imageOptionsMap.get(n.id);this.data.imageOptionsArray.length>s&&this.data.imageOptionsArray.splice(s,1),this.imageOptionsMap.delete(n.id)}this.volumes=this.volumes.filter(s=>s.id!==n.id)}getImageOptions(n){return this.imageOptionsMap.has(n.id)?this.data.imageOptionsArray[this.imageOptionsMap.get(n.id)]:null}json(){const n={encodedImageBlobs:[],previewImageDataURL:this.data.previewImageDataURL,imageOptionsMap:new Map},s=[];if(n.sceneData={...this.scene.sceneData},n.opts={...this.opts},this.opts.meshThicknessOn2D===1/0&&(n.opts.meshThicknessOn2D="infinity"),n.labels=[...this.data.labels],this.volumes.length){let f=this.imageOptionsArray[0];if(f||(log$4.debug("no image options for base image"),f={name:"",colormap:"gray",opacity:1,pairedImgData:null,cal_min:NaN,cal_max:NaN,trustCalMinMax:!0,percentileFrac:.02,ignoreZeroVoxels:!1,useQFormNotSForm:!1,colormapNegative:"",colormapLabel:[],imageType:NVIMAGE_TYPE.NII,frame4D:0,limitFrames4D:NaN,url:"",urlImageData:"",alphaThreshold:!1,cal_minNeg:NaN,cal_maxNeg:NaN,colorbarVisible:!0}),f.colormap=this.volumes[0].colormap,f.opacity=this.volumes[0].opacity,f.cal_max=this.volumes[0].cal_max||NaN,f.cal_min=this.volumes[0].cal_min||NaN,f){s.push(f);const m=NVUtilities.uint8tob64(this.volumes[0].toUint8Array());n.encodedImageBlobs.push(m),this.drawBitmap&&(n.encodedDrawingBlob=NVUtilities.uint8tob64(this.volumes[0].toUint8Array(this.drawBitmap))),n.imageOptionsMap.set(this.volumes[0].id,0)}else throw new Error("image options for base layer not found");for(let m=1;m({values:A.values,nFrame4D:A.nFrame4D,frame4D:0,outlineBorder:A.outlineBorder,global_min:A.global_min,global_max:A.global_max,cal_min:A.cal_min,cal_max:A.cal_max,opacity:A.opacity,colormap:A.colormap,colormapNegative:A.colormapNegative,colormapLabel:A.colormapLabel,useNegativeCmap:A.useNegativeCmap})),hasConnectome:f.hasConnectome,edgeColormap:f.edgeColormap,edgeColormapNegative:f.edgeColormapNegative,edgeMax:f.edgeMax,edgeMin:f.edgeMin,edges:f.edges&&Array.isArray(f.edges)?[...f.edges]:[],extentsMax:f.extentsMax,extentsMin:f.extentsMin,fiberGroupColormap:f.fiberGroupColormap,furthestVertexFromOrigin:f.furthestVertexFromOrigin,nodeColormap:f.nodeColormap,nodeColormapNegative:f.nodeColormapNegative,nodeMaxColor:f.nodeMaxColor,nodeMinColor:f.nodeMinColor,nodeScale:f.nodeScale,legendLineThickness:f.legendLineThickness,offsetPt0:f.offsetPt0,nodes:f.nodes};u.push(m)}return n.meshesString=JSON.stringify(serialize(u)),n}download(n){const s=this.json();NVUtilities.download(JSON.stringify(s),n,"application/json")}static deserializeMeshDataObjects(n){if(n.data.meshesString){n.meshDataObjects=deserialize$1(JSON.parse(n.data.meshesString));for(const s of n.meshDataObjects)for(const u of s.layers)"colorMap"in u&&(u.colormap=u.colorMap,delete u.colorMap),"colorMapNegative"in u&&(u.colormapNegative=u.colorMapNegative,delete u.colorMapNegative)}}static async loadFromUrl(n){const u=await(await fetch(n)).json();return Ji.loadFromJSON(u)}static async loadFromFile(n){const s=await NVUtilities.readFileAsync(n),u=new Ji,m=new TextDecoder().decode(s);return u.data=JSON.parse(m),Ji.deserializeMeshDataObjects(u),u}static loadFromJSON(n){const s=new Ji;return s.data=n,s.data.opts.meshThicknessOn2D==="infinity"&&(s.data.opts.meshThicknessOn2D=1/0),s.scene.sceneData=n.sceneData,Ji.deserializeMeshDataObjects(s),s}},NVLabel3D=class{constructor(a,n,s){__publicField(this,"text"),__publicField(this,"style"),__publicField(this,"points"),this.text=a,this.style=n,this.points=s}},defaultOptions={name:"untitled connectome",nodeColormap:"warm",nodeColormapNegative:"winter",nodeMinColor:0,nodeMaxColor:4,nodeScale:3,edgeColormap:"warm",edgeColormapNegative:"winter",edgeMin:2,edgeMax:6,edgeScale:1,legendLineThickness:0},NVConnectome=class Uo extends NVMesh{constructor(n,s){super(new Float32Array([]),new Uint32Array([]),s.name,new Uint8Array([]),1,!0,n,s),__publicField(this,"gl"),__publicField(this,"nodesChanged"),this.gl=n,this.type="connectome",this.nodes&&this.updateLabels(),this.nodesChanged=new EventTarget}static convertLegacyConnectome(n){const s={nodes:[],edges:[],...defaultOptions};for(const f in n)if(f in defaultOptions){const m=f;s[m]=n[m]}const u=n.nodes;for(let f=0;f({name:Array.isArray(A.comments)&&A.comments.length>0&&"text"in A.comments[0]?A.comments[0].text:"",x:A.coordinates.x,y:A.coordinates.y,z:A.coordinates.z,colorValue:1,sizeValue:1,metadata:A.comments}));return{...defaultOptions,nodeColormap:s,edgeColormap:s,nodes:f,edges:[]}}updateLabels(){const n=this.nodes;if(n&&n.length>0){const s=n.reduce((T,E)=>T.sizeValue>E.sizeValue?T:E).sizeValue,u=this.nodeMinColor?this.nodeMinColor:n.reduce((T,E)=>T.colorValueT.colorValue>E.colorValue?T:E).colorValue,m=cmapper.colormap(this.nodeColormap,this.colormapInvert),A=cmapper.colormap(this.nodeColormapNegative,this.colormapInvert),v="nodeColormapNegative"in this,y=this.legendLineThickness?this.legendLineThickness:0;for(let T=0;Te/255),log$4.debug("adding label for ",n[T]),n[T].label=new NVLabel3D(n[T].name,{textColor:I,bulletScale:n[T].sizeValue/s,bulletColor:I,lineWidth:y,lineColor:I,textScale:1,textAlignment:"left",lineTerminator:"none"},[n[T].x,n[T].y,n[T].z]),log$4.debug("label for node:",n[T].label)}}}addConnectomeNode(n){if(log$4.debug("adding node",n),!this.nodes)throw new Error("nodes not defined");this.nodes.push(n),this.updateLabels(),this.nodesChanged.dispatchEvent(new CustomEvent("nodeAdded",{detail:{node:n}}))}deleteConnectomeNode(n){const s=this.nodes.indexOf(n),u=this.edges;u&&(this.edges=u.filter(f=>f.first!==s&&f.second!==s)),this.nodes=this.nodes.filter(f=>f!==n),this.updateLabels(),this.updateConnectome(this.gl),this.nodesChanged.dispatchEvent(new CustomEvent("nodeDeleted",{detail:{node:n}}))}updateConnectomeNodeByIndex(n,s){this.nodes[n]=s,this.updateLabels(),this.updateConnectome(this.gl),this.nodesChanged.dispatchEvent(new CustomEvent("nodeChanged",{detail:{node:s}}))}updateConnectomeNodeByPoint(n,s){const u=this.nodes;if(!u)throw new Error("Node to update does not exist");const f=u.find(A=>NVUtilities.arraysAreEqual([A.x,A.y,A.z],n));if(!f)throw new Error(`Node with point ${n} to update does not exist`);const m=u.findIndex(A=>A===f);this.updateConnectomeNodeByIndex(m,s)}addConnectomeEdge(n,s,u){const f=this.edges;let m=f.find(A=>(A.first===n||A.second===n)&&A.first+A.second===n+s);return m||(m={first:n,second:s,colorValue:u},f.push(m),this.updateConnectome(this.gl),m)}deleteConnectomeEdge(n,s){const u=this.edges,f=u.find(m=>(m.first===n||m.first===s)&&m.first+m.second===n+s);if(f)this.edges=u.filter(m=>m!==f);else throw new Error(`edge between ${n} and ${s} not found`);return this.updateConnectome(this.gl),f}findClosestConnectomeNode(n,s){const u=this.nodes;if(!u||u.length===0)return null;const f=u.map((m,A)=>({node:m,distance:Math.sqrt(Math.pow(m.x-n[0],2)+Math.pow(m.y-n[1],2)+Math.pow(m.z-n[2],2)),index:A})).filter(m=>m.distancem.distance-A.distance);return f.length>0?f[0].node:null}updateConnectome(n){const s=[],u=[],f=[];let m=cmapper.colormap(this.nodeColormap,this.colormapInvert),A=cmapper.colormap(this.nodeColormapNegative,this.colormapInvert),v="nodeColormapNegative"in this;if(this.nodeMinColor===void 0||this.nodeMaxColor===void 0)throw new Error("nodeMinColor or nodeMaxColor is undefined");if(this.edgeMin===void 0||this.edgeMax===void 0)throw new Error("edgeMin or edgeMax undefined");let y=this.nodeMinColor,T=this.nodeMaxColor;const E=this.nodes,S=E.length;for(let V=0;Vm&&([f,m]=[m,f]),[f,m]}function swizzleVec3(a,n=[0,1,2]){const s=create$2();return s[0]=a[n[0]],s[1]=a[n[1]],s[2]=a[n[2]],s}function isRadiological(a){const n=fromValues$1(1,0,0,0),s=create$1();return transformMat4(s,n,a),s[0]}function unProject(a,n,s,u){const f=fromValues$1(a,n,s,1),m=clone$3(u);invert(m,m),f[0]=f[0]*2-1,f[1]=f[1]*2-1,f[2]=f[2]*2-1;const A=create$1();return transformMat4(A,f,m),A[3]===0||(A[0]/=A[3],A[1]/=A[3],A[2]/=A[3]),A}function unpackFloatFromVec4i(a){const n=[5960464477539063e-23,152587890625e-16,.00390625,1];return(a[0]*n[0]+a[1]*n[1]+a[2]*n[2]+a[3]*n[3])/255}function clamp$1(a,n,s){return Math.min(Math.max(a,n),s)}function encodeRLE(a){const n=a.length;let s=0;const u=new Uint8Array(n+Math.ceil(.01*n)),f=new Int8Array(u.buffer);let m=0;for(;s1){f[m]=-v+1,m++,u[m]=A,m++;continue}for(;s127||s+2 "+m+" bytes (x"+n/m+")"),u.slice(0,m)}function decodeRLE(a,n){const s=new Uint8Array(a.buffer),u=new Int8Array(s.buffer);let f=0;const m=new Uint8Array(n);let A=0;for(;f{}),__publicField(this,"onMouseUp",()=>{}),__publicField(this,"onLocationChange",()=>{}),__publicField(this,"onIntensityChange",()=>{}),__publicField(this,"onImageLoaded",()=>{}),__publicField(this,"onMeshLoaded",()=>{}),__publicField(this,"onFrameChange",()=>{}),__publicField(this,"onError",()=>{}),__publicField(this,"onColormapChange",()=>{}),__publicField(this,"onInfo",()=>{}),__publicField(this,"onWarn",()=>{}),__publicField(this,"onDebug",()=>{}),__publicField(this,"onVolumeAddedFromUrl",()=>{}),__publicField(this,"onVolumeWithUrlRemoved",()=>{}),__publicField(this,"onVolumeUpdated",()=>{}),__publicField(this,"onMeshAddedFromUrl",()=>{}),__publicField(this,"onMeshAdded",()=>{}),__publicField(this,"onMeshWithUrlRemoved",()=>{}),__publicField(this,"onZoom3DChange",()=>{}),__publicField(this,"onAzimuthElevationChange",()=>{}),__publicField(this,"onClipPlaneChange",()=>{}),__publicField(this,"onCustomMeshShaderAdded",()=>{}),__publicField(this,"onMeshShaderChanged",()=>{}),__publicField(this,"onMeshPropertyChanged",()=>{}),__publicField(this,"onDocumentLoaded",()=>{}),__publicField(this,"document",new NVDocument),__publicField(this,"mediaUrlMap",new Map),__publicField(this,"initialized",!1),__publicField(this,"currentDrawUndoBitmap"),__publicField(this,"loadingText");for(const s in n)typeof n[s]=="function"?this[s]=n[s]:this.opts[s]=DEFAULT_OPTIONS[s]===void 0?DEFAULT_OPTIONS[s]:n[s];this.opts.isHighResolutionCapable?this.uiData.dpr=window.devicePixelRatio||1:this.uiData.dpr=1,this.currentDrawUndoBitmap=this.opts.maxDrawUndoBitmaps,this.opts.drawingEnabled&&this.createEmptyDrawing(),this.opts.thumbnail.length>0&&(this.thumbnailVisible=!0),this.loadingText=this.opts.loadingText,log$4.setLogLevel(this.opts.logLevel)}get scene(){return this.document.scene}get opts(){return this.document.opts}get sliceMosaicString(){return this.document.opts.sliceMosaicString||""}set sliceMosaicString(n){this.document.opts.sliceMosaicString=n}get volumes(){return this.document.volumes}set volumes(n){this.document.volumes=n}get meshes(){return this.document.meshes}set meshes(n){this.document.meshes=n}get drawBitmap(){return this.document.drawBitmap}set drawBitmap(n){this.document.drawBitmap=n}get volScaleMultiplier(){return this.scene.volScaleMultiplier}set volScaleMultiplier(n){this.setScale(n)}async saveScene(n="niivue.png"){function s(f,m){const A=document.createElement("a");document.body.appendChild(A),A.style.display="none";const v=window.URL.createObjectURL(f);A.href=v,A.download=m,A.click(),A.remove()}const u=this.canvas;if(!u)throw new Error("canvas not defined");this.drawScene(),u.toBlob(f=>{f&&(n===""&&(n=`niivue-screenshot-${new Date().toString()}.png`,n=n.replace(/\s/g,"_")),s(f,n))})}async attachTo(n,s=null){return await this.attachToCanvas(document.getElementById(n),s),log$4.debug("attached to element with id: ",n),this}async attachToCanvas(n,s=null){return this.canvas=n,s===null&&(s=navigator.hardwareConcurrency>6,log$4.debug("AntiAlias ",s," Threads ",navigator.hardwareConcurrency)),this.gl=this.canvas.getContext("webgl2",{alpha:!0,antialias:s}),log$4.info("NIIVUE VERSION ",version$1),this.canvas.parentElement.style.backgroundColor="black",this.opts.isResizeCanvas&&(this.canvas.style.width="100%",this.canvas.style.height="100%",this.canvas.style.display="block",this.canvas.width=this.canvas.offsetWidth,this.canvas.height=this.canvas.offsetHeight,window.addEventListener("resize",this.resizeListener.bind(this)),this.resizeObserver=new ResizeObserver(this.resizeListener.bind(this)),this.resizeObserver.observe(this.canvas.parentElement)),this.registerInteractions(),await this.init(),this.drawScene(),this}syncWith(n,s={"2d":!0,"3d":!0}){this.otherNV=n,this.syncOpts=s}broadcastTo(n,s={"2d":!0,"3d":!0}){this.otherNV=n,this.syncOpts=s}sync(){if(!this.gl||!this.otherNV||typeof this.otherNV>"u"||!this.gl.canvas.matches(":focus"))return;const n=this.frac2mm(this.scene.crosshairPos);if(this.otherNV instanceof zo)this.syncOpts["2d"]&&(this.otherNV.scene.crosshairPos=this.otherNV.mm2frac(n)),this.syncOpts["3d"]&&(this.otherNV.scene.renderAzimuth=this.scene.renderAzimuth,this.otherNV.scene.renderElevation=this.scene.renderElevation),this.otherNV.drawScene(),this.otherNV.createOnLocationChange();else if(Array.isArray(this.otherNV))for(let s=0;su===s[f])}resizeListener(){if(!(!this.canvas||!this.gl)){if(!this.opts.isResizeCanvas){this.opts.isHighResolutionCapable&&(log$4.warn("isHighResolutionCapable requires isResizeCanvas"),this.opts.isHighResolutionCapable=!1),this.uiData.dpr=1,this.drawScene();return}this.canvas.style.width="100%",this.canvas.style.height="100%",this.canvas.style.display="block",this.opts.isHighResolutionCapable?(this.uiData.dpr=window.devicePixelRatio||1,log$4.debug("devicePixelRatio: "+this.uiData.dpr)):this.uiData.dpr=1,"width"in this.canvas.parentElement?(this.canvas.width=this.canvas.parentElement.width*this.uiData.dpr,this.canvas.height=this.canvas.parentElement.height*this.uiData.dpr):(this.canvas.width=this.canvas.offsetWidth*this.uiData.dpr,this.canvas.height=this.canvas.offsetHeight*this.uiData.dpr),this.gl.viewport(0,0,this.gl.canvas.width,this.gl.canvas.height),this.drawScene()}}getRelativeMousePosition(n,s){if(s=s||n.target,!s)return;const u=s.getBoundingClientRect();return{x:n.clientX-u.left,y:n.clientY-u.top}}getNoPaddingNoBorderCanvasRelativeMousePosition(n,s){return s=s||n.target,this.getRelativeMousePosition(n,s)}mouseContextMenuListener(n){n.preventDefault()}mouseDownListener(n){n.preventDefault(),this.drawPenLocation=[NaN,NaN,NaN],this.drawPenAxCorSag=-1,this.uiData.mousedown=!0,log$4.debug("mouse down"),log$4.debug(n);const s=this.getNoPaddingNoBorderCanvasRelativeMousePosition(n,this.gl.canvas);if(!s)return;const[u,f]=[s.x*this.uiData.dpr,s.y*this.uiData.dpr],m=this.getLabelAtPoint([u,f]);if(m){for(const A of this.meshes)if(A.type==="connectome")for(const v of A.nodes)v.label===m&&(this.scene.crosshairPos=this.mm2frac([v.x,v.y,v.z]),this.updateGLVolume(),this.drawScene())}this.uiData.clickedTile=this.tileIndex(u,f),n.button===LEFT_MOUSE_BUTTON&&n.shiftKey?(this.uiData.mouseButtonCenterDown=!0,this.mouseCenterButtonHandler(n)):n.button===LEFT_MOUSE_BUTTON?(this.uiData.mouseButtonLeftDown=!0,this.mouseLeftButtonHandler(n)):n.button===RIGHT_MOUSE_BUTTON?(this.uiData.mouseButtonRightDown=!0,this.mouseRightButtonHandler(n)):n.button===CENTER_MOUSE_BUTTON&&(this.uiData.mouseButtonCenterDown=!0,this.mouseCenterButtonHandler(n))}mouseLeftButtonHandler(n){const s=this.getNoPaddingNoBorderCanvasRelativeMousePosition(n,this.gl.canvas);this.mouseDown(s.x,s.y),this.mouseClick(s.x,s.y)}mouseCenterButtonHandler(n){const s=this.getNoPaddingNoBorderCanvasRelativeMousePosition(n,this.gl.canvas);this.mousePos=[s.x*this.uiData.dpr,s.y*this.uiData.dpr],this.opts.dragMode!==0&&(this.setDragStart(s.x,s.y),this.uiData.isDragging||(this.uiData.pan2DxyzmmAtMouseDown=clone$1(this.scene.pan2Dxyzmm)),this.uiData.isDragging=!0,this.uiData.dragClipPlaneStartDepthAziElev=this.scene.clipPlaneDepthAziElev)}mouseRightButtonHandler(n){const s=this.getNoPaddingNoBorderCanvasRelativeMousePosition(n,this.gl.canvas);this.mousePos=[s.x*this.uiData.dpr,s.y*this.uiData.dpr],this.opts.dragMode!==0&&(this.setDragStart(s.x,s.y),this.uiData.isDragging||(this.uiData.pan2DxyzmmAtMouseDown=clone$1(this.scene.pan2Dxyzmm)),this.uiData.isDragging=!0,this.uiData.dragClipPlaneStartDepthAziElev=this.scene.clipPlaneDepthAziElev)}calculateMinMaxVoxIdx(n){if(n.length>2)throw new Error("array must not contain more than two values");return[Math.floor(Math.min(n[0],n[1])),Math.floor(Math.max(n[0],n[1]))]}calculateNewRange({volIdx:n=0}={}){if(this.opts.sliceType===4&&this.sliceMosaicString.length<1||this.uiData.dragStart[0]===this.uiData.dragEnd[0]&&this.uiData.dragStart[1]===this.uiData.dragEnd[1])return;let s=this.canvasPos2frac([this.uiData.dragStart[0],this.uiData.dragStart[1]]);if(s[0]<0)return;const u=this.frac2vox(s,n);if(s=this.canvasPos2frac([this.uiData.dragEnd[0],this.uiData.dragEnd[1]]),s[0]<0)return;const f=this.frac2vox(s,n);let m=-Number.MAX_VALUE,A=Number.MAX_VALUE;const v=this.calculateMinMaxVoxIdx([u[0],f[0]]),y=this.calculateMinMaxVoxIdx([u[1],f[1]]),T=this.calculateMinMaxVoxIdx([u[2],f[2]]);u[0]-f[0]===0?v[1]=u[0]+1:u[1]-f[1]===0?y[1]=u[1]+1:u[2]-f[2]===0&&(T[1]=u[2]+1);const E=this.volumes[n].hdr,S=this.volumes[n].img;if(!E||!S)return;const I=E.dims[1],e=E.dims[2];for(let L=T[0];LS[W]&&(A=S[W]),m=m)return;const F=intensityRaw2Scaled(E,A),M=intensityRaw2Scaled(E,m);this.volumes[n].cal_min=F,this.volumes[n].cal_max=M,this.onIntensityChange(this.volumes[n])}generateMouseUpCallback(n,s){const u=this.tileIndex(this.uiData.dragStart[0],this.uiData.dragStart[1]),f=this.tileIndex(this.uiData.dragEnd[0],this.uiData.dragEnd[1]);let m=-1;u===f&&(m=f);let A=-1;m>=0&&(A=this.screenSlices[m].axCorSag);const v=this.frac2mm(n),y=this.frac2mm(s),T=create$2();sub$4(T,fromValues$2(v[0],v[1],v[2]),fromValues$2(y[0],y[1],y[2]));const E=len(T),S=this.frac2vox(n),I=this.frac2vox(s);this.onDragRelease({fracStart:n,fracEnd:s,voxStart:S,voxEnd:I,mmStart:v,mmEnd:y,mmLength:E,tileIdx:m,axCorSag:A})}mouseUpListener(){function n(f){return Object.prototype.toString.call(f).indexOf("Function")>-1}const s={mouseButtonRightDown:this.uiData.mouseButtonRightDown,mouseButtonCenterDown:this.uiData.mouseButtonCenterDown,isDragging:this.uiData.isDragging,mousePos:this.mousePos,fracPos:this.canvasPos2frac(this.mousePos)};this.uiData.mousedown=!1,this.uiData.mouseButtonRightDown=!1;const u=this.uiData.mouseButtonCenterDown;if(this.uiData.mouseButtonCenterDown=!1,this.uiData.mouseButtonLeftDown=!1,this.drawPenFillPts.length>0?this.drawPenFilled():this.drawPenAxCorSag>=0&&this.drawAddUndoBitmap(),this.drawPenLocation=[NaN,NaN,NaN],this.drawPenAxCorSag=-1,n(this.onMouseUp)&&this.onMouseUp(s),this.uiData.isDragging){this.uiData.isDragging=!1,this.opts.dragMode===5&&this.drawScene();const f=this.canvasPos2frac([this.uiData.dragStart[0],this.uiData.dragStart[1]]),m=this.canvasPos2frac([this.uiData.dragEnd[0],this.uiData.dragEnd[1]]);if(this.generateMouseUpCallback(f,m),this.opts.dragMode!==1||u||this.uiData.dragStart[0]===this.uiData.dragEnd[0]&&this.uiData.dragStart[1]===this.uiData.dragEnd[1])return;this.calculateNewRange({volIdx:0}),this.refreshLayers(this.volumes[0],0)}this.drawScene()}checkMultitouch(n){if(this.uiData.touchdown&&!this.uiData.multiTouchGesture){const s=this.canvas.getBoundingClientRect();this.mouseDown(n.touches[0].clientX-s.left,n.touches[0].clientY-s.top),this.mouseClick(n.touches[0].clientX-s.left,n.touches[0].clientY-s.top)}}touchStartListener(n){n.preventDefault(),this.uiData.touchTimer||(this.uiData.touchTimer=setTimeout(()=>{this.resetBriCon(n)},this.opts.longTouchTimeout)),this.uiData.touchdown=!0,this.uiData.currentTouchTime=new Date().getTime();const s=this.uiData.currentTouchTime-this.uiData.lastTouchTime;if(s0){this.uiData.doubleTouch=!0,this.setDragStart(n.targetTouches[0].clientX-n.target.getBoundingClientRect().left,n.targetTouches[0].clientY-n.target.getBoundingClientRect().top),this.resetBriCon(n),this.uiData.lastTouchTime=this.uiData.currentTouchTime;return}else this.uiData.doubleTouch=!1,this.setDragStart(0,0),this.setDragEnd(0,0),this.uiData.lastTouchTime=this.uiData.currentTouchTime;this.uiData.touchdown&&n.touches.length<2?this.uiData.multiTouchGesture=!1:this.uiData.multiTouchGesture=!0,setTimeout(this.checkMultitouch.bind(this),1,n)}touchEndListener(n){if(n.preventDefault(),this.uiData.touchdown=!1,this.uiData.lastTwoTouchDistance=0,this.uiData.multiTouchGesture=!1,this.uiData.touchTimer&&(clearTimeout(this.uiData.touchTimer),this.uiData.touchTimer=null),this.uiData.isDragging){this.uiData.isDragging=!1,this.opts.dragMode===1&&(this.calculateNewRange(),this.refreshLayers(this.volumes[0],0));const s=this.canvasPos2frac([this.uiData.dragStart[0],this.uiData.dragStart[1]]),u=this.canvasPos2frac([this.uiData.dragEnd[0],this.uiData.dragEnd[1]]);this.generateMouseUpCallback(s,u)}this.mouseUpListener()}mouseMoveListener(n){if(this.uiData.mousedown){const s=this.getNoPaddingNoBorderCanvasRelativeMousePosition(n,this.gl.canvas);if(!s)return;const u=s.x*this.uiData.dpr,f=s.y*this.uiData.dpr;if(this.tileIndex(u,f)!==this.uiData.clickedTile)return;this.uiData.mouseButtonLeftDown?(this.mouseMove(s.x,s.y),this.mouseClick(s.x,s.y)):(this.uiData.mouseButtonRightDown||this.uiData.mouseButtonCenterDown)&&this.setDragEnd(s.x,s.y),this.drawScene(),this.uiData.prevX=this.uiData.currX,this.uiData.prevY=this.uiData.currY}}resetBriCon(n=null){if(this.uiData.isDragging)return;let s=!1;this.opts.sliceType===4&&(s=!0);let u=0,f=0;if(n!==null&&("targetTouches"in n?(u=n.targetTouches[0].clientX-n.target.getBoundingClientRect().left,f=n.targetTouches[0].clientY-n.target.getBoundingClientRect().top):(u=n.offsetX,f=n.offsetY),u*=this.uiData.dpr,f*=this.uiData.dpr,this.inRenderTile(u,f)>=0&&(s=!0)),s){this.uiData.mouseDepthPicker=!0,this.drawScene(),this.drawScene();return}this.opts.dragMode!==4&&(this.volumes.length<1||this.uiData.doubleTouch||(this.volumes[0].cal_min=this.volumes[0].robust_min,this.volumes[0].cal_max=this.volumes[0].robust_max,this.onIntensityChange(this.volumes[0]),this.refreshLayers(this.volumes[0],0),this.drawScene()))}setDragStart(n,s){n*=this.uiData.dpr,s*=this.uiData.dpr,this.uiData.dragStart[0]=n,this.uiData.dragStart[1]=s}setDragEnd(n,s){n*=this.uiData.dpr,s*=this.uiData.dpr,this.uiData.dragEnd[0]=n,this.uiData.dragEnd[1]=s}touchMoveListener(n){if(this.uiData.touchdown&&n.touches.length<2){const s=this.canvas.getBoundingClientRect();if(this.uiData.isDragging||(this.uiData.pan2DxyzmmAtMouseDown=clone$1(this.scene.pan2Dxyzmm)),this.uiData.isDragging=!0,this.uiData.doubleTouch&&this.uiData.isDragging){this.setDragEnd(n.targetTouches[0].clientX-n.target.getBoundingClientRect().left,n.targetTouches[0].clientY-n.target.getBoundingClientRect().top),this.drawScene();return}this.mouseClick(n.touches[0].clientX-s.left,n.touches[0].clientY-s.top),this.mouseMove(n.touches[0].clientX-s.left,n.touches[0].clientY-s.top)}else this.handlePinchZoom(n)}handlePinchZoom(n){if(n.targetTouches.length===2&&n.changedTouches.length===2){const s=Math.hypot(n.touches[0].pageX-n.touches[1].pageX,n.touches[0].pageY-n.touches[1].pageY),u=this.canvas.getBoundingClientRect();this.mousePos=[n.touches[0].clientX-u.left,n.touches[0].clientY-u.top],sthis.opts.keyDebounceTime){switch(this.currentClipPlaneIndex=(this.currentClipPlaneIndex+1)%7,this.currentClipPlaneIndex){case 0:this.scene.clipPlaneDepthAziElev=[2,0,0];break;case 1:this.scene.clipPlaneDepthAziElev=[0,270,0];break;case 2:this.scene.clipPlaneDepthAziElev=[0,90,0];break;case 3:this.scene.clipPlaneDepthAziElev=[0,0,0];break;case 4:this.scene.clipPlaneDepthAziElev=[0,180,0];break;case 5:this.scene.clipPlaneDepthAziElev=[0,0,-90];break;case 6:this.scene.clipPlaneDepthAziElev=[0,0,90];break}this.setClipPlane(this.scene.clipPlaneDepthAziElev)}this.lastCalled=s}else if(n.code===this.opts.viewModeHotKey){const s=new Date().getTime();s-this.lastCalled>this.opts.keyDebounceTime&&(this.setSliceType((this.opts.sliceType+1)%5),this.lastCalled=s)}}keyDownListener(n){n.code==="KeyH"&&this.opts.sliceType===4?this.setRenderAzimuthElevation(this.scene.renderAzimuth-1,this.scene.renderElevation):n.code==="KeyL"&&this.opts.sliceType===4?this.setRenderAzimuthElevation(this.scene.renderAzimuth+1,this.scene.renderElevation):n.code==="KeyJ"&&this.opts.sliceType===4?this.setRenderAzimuthElevation(this.scene.renderAzimuth,this.scene.renderElevation+1):n.code==="KeyK"&&this.opts.sliceType===4?this.setRenderAzimuthElevation(this.scene.renderAzimuth,this.scene.renderElevation-1):n.code==="KeyH"&&this.opts.sliceType!==4?this.moveCrosshairInVox(-1,0,0):n.code==="KeyL"&&this.opts.sliceType!==4?this.moveCrosshairInVox(1,0,0):n.code==="KeyU"&&this.opts.sliceType!==4&&n.ctrlKey?this.moveCrosshairInVox(0,0,1):n.code==="KeyD"&&this.opts.sliceType!==4&&n.ctrlKey?this.moveCrosshairInVox(0,0,-1):n.code==="KeyJ"&&this.opts.sliceType!==4?this.moveCrosshairInVox(0,-1,0):n.code==="KeyK"&&this.opts.sliceType!==4?this.moveCrosshairInVox(0,1,0):n.code==="KeyM"&&this.opts.sliceType!==4?(this.opts.dragMode++,this.opts.dragMode>=4&&(this.opts.dragMode=0),log$4.info("drag mode changed to ",DRAG_MODE[this.opts.dragMode])):n.code==="ArrowLeft"?this.setFrame4D(this.volumes[0].id,this.volumes[0].frame4D-1):n.code==="ArrowRight"?this.setFrame4D(this.volumes[0].id,this.volumes[0].frame4D+1):n.code==="Slash"&&n.shiftKey&&alert(`NIIVUE VERSION: ${version$1}`)}wheelListener(n){if(n.preventDefault(),n.stopPropagation(),this.thumbnailVisible)return;const s=this.canvas.getBoundingClientRect();n.deltaY<0?this.sliceScroll2D(-.01,n.clientX-s.left,n.clientY-s.top):this.sliceScroll2D(.01,n.clientX-s.left,n.clientY-s.top)}registerInteractions(){if(!this.canvas)throw new Error("canvas undefined");this.canvas.addEventListener("mousedown",this.mouseDownListener.bind(this)),this.canvas.addEventListener("mouseup",this.mouseUpListener.bind(this)),this.canvas.addEventListener("mousemove",this.mouseMoveListener.bind(this)),this.canvas.addEventListener("touchstart",this.touchStartListener.bind(this)),this.canvas.addEventListener("touchend",this.touchEndListener.bind(this)),this.canvas.addEventListener("touchmove",this.touchMoveListener.bind(this)),this.canvas.addEventListener("wheel",this.wheelListener.bind(this)),this.canvas.addEventListener("contextmenu",this.mouseContextMenuListener.bind(this)),this.canvas.addEventListener("dblclick",this.resetBriCon.bind(this)),this.canvas.addEventListener("dragenter",this.dragEnterListener.bind(this),!1),this.canvas.addEventListener("dragover",this.dragOverListener.bind(this),!1),this.canvas.addEventListener("drop",this.dropListener.bind(this),!1),this.canvas.setAttribute("tabindex","0"),this.canvas.addEventListener("keyup",this.keyUpListener.bind(this),!1),this.canvas.addEventListener("keydown",this.keyDownListener.bind(this),!1)}dragEnterListener(n){n.stopPropagation(),n.preventDefault()}dragOverListener(n){n.stopPropagation(),n.preventDefault()}getFileExt(n,s=!0){log$4.debug("fullname: ",n);const u=/(?:\.([^.]+))?$/;let f=u.exec(n)[1];return f=f.toUpperCase(),f==="GZ"&&(f=u.exec(n.slice(0,-3))[1],f=f.toUpperCase()),s?f:f.toLowerCase()}async addVolumeFromUrl(n){const s=await NVImage.loadFromUrl(n);return this.document.addImageOptions(s,n),s.onColormapChange=this.onColormapChange,this.mediaUrlMap.set(s,n.url),this.onVolumeAddedFromUrl&&this.onVolumeAddedFromUrl(n,s),this.addVolume(s),s}getMediaByUrl(n){return[...this.mediaUrlMap.entries()].filter(s=>s[1]===n).map(s=>s[0]).pop()}removeVolumeByUrl(n){const s=this.getMediaByUrl(n);if(s)this.removeVolume(s);else throw new Error("No volume with URL present")}readDirectory(n){const s=n.createReader();let u=[];const f=async A=>{const v=[],y=async T=>new Promise((E,S)=>T.file(E,S));for(let T=0;T{s.readEntries(A=>{A.length?(u=u.concat(A),m()):f(u).then(v=>{NVImage.loadFromFile({file:v,name:n.name,urlImgData:null,imageType:NVIMAGE_TYPE.DCM_FOLDER}).then(y=>this.addVolume(y)).catch(y=>{throw y})}).catch(v=>{throw v})})};return m(),u}isMeshExt(n){const s=this.getFileExt(n);return log$4.debug("dropped ext"),log$4.debug(s),MESH_EXTENSIONS.includes(s)}dropListener(n){if(n.stopPropagation(),n.preventDefault(),!this.opts.dragAndDropEnabled)return;const s=n.dataTransfer;if(!s)return;const u=s.getData("text/uri-list");if(u){const f=NVImageFromUrlOptions(u),m=this.getFileExt(u);log$4.debug("dropped ext"),log$4.debug(m),MESH_EXTENSIONS.includes(m)?this.addMeshFromUrl({url:u}).catch(A=>{throw A}):m==="NVD"?this.loadDocumentFromUrl(u).catch(A=>{throw A}):this.addVolumeFromUrl(f).catch(A=>{throw A})}else{const f=s.items;if(f.length>0){!n.shiftKey&&!n.altKey&&(this.volumes=[],this.overlays=[],this.meshes=[]),this.closeDrawing();for(const m of Array.from(f)){const A=m.webkitGetAsEntry();if(log$4.debug(A),!A)throw new Error("could not get entry from file");if(A.isFile){const v=this.getFileExt(A.name);if(v==="PNG"){A.file(T=>{this.loadBmpTexture(T).catch(E=>{throw E})});continue}let y;if(A.name.lastIndexOf("HEAD")!==-1)for(const T of Array.from(f)){const E=T.webkitGetAsEntry();if(!E)throw new Error("could not get paired entry");const S=A.name.substring(0,A.name.lastIndexOf("HEAD")),I=E.name.substring(0,E.name.lastIndexOf("BRIK"));S===I&&(y=E)}if(A.name.lastIndexOf("BRIK")!==-1)continue;if(MESH_EXTENSIONS.includes(v)){A.file(T=>{NVMesh.loadFromFile({file:T,gl:this.gl,name:T.name}).then(E=>{this.addMesh(E)}).catch(E=>{throw E})});continue}else if(v==="NVD"){A.file(T=>{NVDocument.loadFromFile(T).then(E=>{this.loadDocument(E),log$4.debug("loaded document")}).catch(E=>{throw E})});break}A.file(T=>{y?y.file(E=>{NVImage.loadFromFile({file:T,urlImgData:E,limitFrames4D:this.opts.limitFrames4D}).then(S=>{this.addVolume(S)}).catch(S=>{throw S})}):NVImage.loadFromFile({file:T,urlImgData:y,limitFrames4D:this.opts.limitFrames4D}).then(E=>{n.altKey?(log$4.debug("alt key detected: assuming this is a drawing overlay"),this.drawClearAllUndoBitmaps(),this.loadDrawing(E)):this.addVolume(E)}).catch(E=>{throw E})})}else A.isDirectory&&this.readDirectory(A)}}}this.drawScene()}setMultiplanarPadPixels(n){this.opts.multiplanarPadPixels=n,this.drawScene()}setMultiplanarLayout(n){typeof n=="string"&&(n=parseInt(n)),this.opts.multiplanarLayout=n,this.drawScene()}setCornerOrientationText(n){this.opts.isCornerOrientationText=n,this.updateGLVolume()}setRadiologicalConvention(n){this.opts.isRadiologicalConvention=n,this.updateGLVolume()}setDefaults(n={},s=!1){this.document.opts={...DEFAULT_OPTIONS},this.scene.sceneData={...INITIAL_SCENE_DATA};for(const u in n)typeof n[u]=="function"?this[u]=n[u]:this.opts[u]=DEFAULT_OPTIONS[u]===void 0?DEFAULT_OPTIONS[u]:n[u];if(this.scene.pan2Dxyzmm=[0,0,0,1],s&&this.volumes&&this.volumes.length>0)for(let u=0;u=this.opts.maxDrawUndoBitmaps&&(this.currentDrawUndoBitmap=0),this.drawUndoBitmaps[this.currentDrawUndoBitmap]=encodeRLE(this.drawBitmap)}drawClearAllUndoBitmaps(){if(this.currentDrawUndoBitmap=this.opts.maxDrawUndoBitmaps,!(!this.drawUndoBitmaps||this.drawUndoBitmaps.length<1))for(let n=this.drawUndoBitmaps.length-1;n>=0;n--)this.drawUndoBitmaps[n]=new Uint8Array}drawUndo(){if(this.drawUndoBitmaps.length<1){log$4.debug("undo bitmaps not loaded");return}if(this.currentDrawUndoBitmap--,this.currentDrawUndoBitmap<0&&(this.currentDrawUndoBitmap=this.drawUndoBitmaps.length-1),this.currentDrawUndoBitmap>=this.drawUndoBitmaps.length&&(this.currentDrawUndoBitmap=0),this.drawUndoBitmaps[this.currentDrawUndoBitmap].length<2){log$4.debug("drawUndo is misbehaving");return}this.drawBitmap=decodeRLE(this.drawUndoBitmaps[this.currentDrawUndoBitmap],this.drawBitmap.length),this.refreshDrawing(!0)}loadDrawing(n){if(this.drawBitmap&&log$4.debug("Overwriting open drawing!"),!this.back)throw new Error("back undefined");this.drawClearAllUndoBitmaps();const s=n.hdr.dims;if(s[1]!==this.back.hdr.dims[1]||s[2]!==this.back.hdr.dims[2]||s[3]!==this.back.hdr.dims[3])return log$4.debug("drawing dimensions do not match background image"),!1;n.img.constructor!==Uint8Array&&log$4.debug("Drawings should be UINT8");const u=n.permRAS,f=s[1]*s[2]*s[3];this.drawBitmap=new Uint8Array(f),this.drawTexture=this.r8Tex(this.drawTexture,TEXTURE7_DRAW,this.back.dims,!0);const m=[0,0,0];for(let M=0;M<3;M++)for(let L=0;L<3;L++)Math.abs(u[M])-1===L&&(m[L]=M*Math.sign(u[M]));let A=1;const v=[1,1,1],y=[!1,!1,!1];for(let M=0;MArray(f).fill(0)),M=Array(f).fill(0).map(()=>Array(f).fill(0));for(let B=1;B3)for(let B=0;BL&&(V[0]=B,V[1]=z,V[2]=b,L=W)}else if(n===3)for(let B=0;BL&&(V[0]=B,V[1]=z,L=b)}else for(let B=0;BL&&(V[0]=B,L=z)}return[E(V[0]),E(V[1]),E(V[2])]}drawOtsu(n=2){if(this.volumes.length===0)return;const s=this.volumes[0].img.length,u=this.findOtsu(n);if(u.length<3)return;this.drawBitmap||this.createEmptyDrawing();const f=this.drawBitmap,m=this.volumes[0].img;for(let A=0;Au[0]&&(f[A]=1),v>u[1]&&(f[A]=2),v>u[2]&&(f[A]=3)}this.drawAddUndoBitmap(),this.refreshDrawing(!0)}removeHaze(n=5,s=0){const u=this.volumes[s].img,f=this.volumes[s].hdr,m=u.length;let A=2;(n===5||n===1)&&(A=4),(n===4||n===2)&&(A=3);const v=this.findOtsu(A);if(v.length<3)return;let y=v[0];n===1&&(y=v[2]),n===2&&(y=v[1]);const T=f.scl_inter,E=f.scl_slope,S=this.volumes[s].global_min;for(let I=0;I=this.meshes.length?-1:n;const s=this.meshes.length;for(let u=0;uu)return;const f=this.getVolumeIndexByID(n.id);s===0?(this.volumes.splice(f,1),this.volumes.unshift(n),this.back=this.volumes[0],this.overlays=this.volumes.slice(1)):s<0?(this.volumes.splice(this.getVolumeIndexByID(n.id),1),this.back=this.volumes[0],this.volumes.length>1?this.overlays=this.volumes.slice(1):this.overlays=[]):(this.volumes.splice(f,1),this.volumes.splice(s,0,n),this.overlays=this.volumes.slice(1),this.back=this.volumes[0]),this.updateGLVolume()}setMesh(n,s=0){this.meshes.forEach(m=>{log$4.debug("MESH: ",m.name)});const u=this.meshes.length;if(s>u)return;const f=this.getMeshIndexByID(n.id);s===0?(this.meshes.splice(f,1),this.meshes.unshift(n)):s<0?this.meshes.splice(this.getMeshIndexByID(n.id),1):(this.meshes.splice(f,1),this.meshes.splice(s,0,n)),this.updateGLVolume(),this.meshes.forEach(m=>{log$4.debug(m.name)})}removeVolume(n){if(this.setVolume(n,-1),this.mediaUrlMap.has(n)){const s=this.mediaUrlMap.get(n);this.onVolumeWithUrlRemoved(s),this.mediaUrlMap.delete(n)}this.drawScene()}removeVolumeByIndex(n){if(n>=this.volumes.length)throw new Error("Index of volume out of bounds");this.removeVolume(this.volumes[n])}removeMesh(n){if(this.setMesh(n,-1),this.mediaUrlMap.has(n)){const s=this.mediaUrlMap.get(n);this.onMeshWithUrlRemoved(s),this.mediaUrlMap.delete(n)}}removeMeshByUrl(n){const s=this.getMediaByUrl(n);s&&(this.removeMesh(s),this.mediaUrlMap.delete(s),this.onMeshWithUrlRemoved(n))}moveVolumeToBottom(n){this.setVolume(n,0)}moveVolumeUp(n){const s=this.getVolumeIndexByID(n.id);this.setVolume(n,s+1)}moveVolumeDown(n){const s=this.getVolumeIndexByID(n.id);this.setVolume(n,s-1)}moveVolumeToTop(n){this.setVolume(n,this.volumes.length-1)}mouseDown(n,s){n*=this.uiData.dpr,s*=this.uiData.dpr,this.mousePos=[n,s]}mouseMove(n,s){n*=this.uiData.dpr,s*=this.uiData.dpr;const u=(n-this.mousePos[0])/this.uiData.dpr,f=(s-this.mousePos[1])/this.uiData.dpr;this.mousePos=[n,s],!(this.inRenderTile(n,s)<0)&&(Math.abs(u)<1&&Math.abs(f)<1||(this.scene.renderAzimuth+=u,this.scene.renderElevation+=f,this.drawScene()))}sph2cartDeg(n,s){const u=-s*(Math.PI/180),f=(n-90)%360*(Math.PI/180),m=[Math.cos(u)*Math.cos(f),Math.cos(u)*Math.sin(f),Math.sin(u)],A=Math.sqrt(m[0]*m[0]+m[1]*m[1]+m[2]*m[2]);return A<=0||(m[0]/=A,m[1]/=A,m[2]/=A),m}setClipPlane(n){const s=this.sph2cartDeg(n[1]+180,n[2]);this.scene.clipPlane=[s[0],s[1],s[2],n[0]],this.scene.clipPlaneDepthAziElev=n,this.onClipPlaneChange(this.scene.clipPlane),this.drawScene()}setCrosshairColor(n){this.opts.crosshairColor=n,this.drawScene()}setCrosshairWidth(n){this.opts.crosshairWidth=n,this.crosshairs3D&&(this.crosshairs3D.mm[0]=NaN),this.drawScene()}setDrawColormap(n){this.drawLut=cmapper.makeDrawLut(n),this.updateGLVolume()}setDrawingEnabled(n){this.opts.drawingEnabled=n,this.opts.drawingEnabled&&(this.drawBitmap||this.createEmptyDrawing()),this.drawScene()}setPenValue(n,s=!1){this.opts.penValue=n,this.opts.isFilledPen=s,this.drawScene()}setDrawOpacity(n){this.drawOpacity=n,this.drawScene()}setSelectionBoxColor(n){this.opts.selectionBoxColor=n}sliceScroll2D(n,s,u,f=!0){if(this.inGraphTile(s,u)){let m=this.volumes[0].frame4D;n>0&&m++,n<0&&m--,this.setFrame4D(this.volumes[0].id,m);return}if(n!==0&&this.opts.dragMode===3&&this.inRenderTile(this.uiData.dpr*s,this.uiData.dpr*u)===-1){let m=this.scene.pan2Dxyzmm[3]*(1+10*n);m=Math.round(m*10)/10;const A=this.scene.pan2Dxyzmm[3]-m;this.opts.yoke3Dto2DZoom&&(this.scene.volScaleMultiplier=m),this.scene.pan2Dxyzmm[3]=m;const v=this.frac2mm(this.scene.crosshairPos);this.scene.pan2Dxyzmm[0]+=A*v[0],this.scene.pan2Dxyzmm[1]+=A*v[1],this.scene.pan2Dxyzmm[2]+=A*v[2],this.drawScene();return}this.mouseClick(s,u,n,f)}setSliceType(n){return this.opts.sliceType=n,this.drawScene(),this}setOpacity(n,s){if(this.volumes[n].opacity=s,n===0){this.drawScene();return}this.updateGLVolume()}setScale(n){this.scene.volScaleMultiplier=n,this.drawScene()}setClipPlaneColor(n){this.opts.clipPlaneColor=n,this.renderShader.use(this.gl),this.gl.uniform4fv(this.renderShader.uniforms.clipPlaneColor,this.opts.clipPlaneColor),this.drawScene()}async setVolumeRenderIllumination(n=0){this.renderShader=this.renderVolumeShader,n>0&&(this.renderShader=this.renderGradientShader),n<0&&(this.renderShader=this.renderSliceShader),this.initRenderShader(this.renderShader,n),this.renderShader.use(this.gl),this.setClipPlaneColor(this.opts.clipPlaneColor),this.gradientTextureAmount=n,this.refreshLayers(this.volumes[0],0),this.drawScene()}overlayRGBA(n){const s=n.hdr,u=s.dims[1]*s.dims[2]*s.dims[3],f=new Uint8ClampedArray(u*4),m=.2*Math.min(Math.min(s.dims[1],s.dims[2]),s.dims[3]),A=.5*s.dims[1],v=.5*s.dims[2],y=.5*s.dims[3];let T=0;for(let E=0;E0&&(this.back=this.volumes[0]);const f=n.encodedDrawingBlob;if(f){const m=n.imageOptionsArray[0],A=NVImage.loadFromBase64({base64:f,...m});A&&this.loadDrawing(A)}for(const m of n.meshDataObjects??[]){const A={gl:this.gl,...m};log$4.debug(A);const v=new NVMesh(A.pts,A.tris,A.name,A.rgba255,A.opacity,A.visible,this.gl,A.connectome,A.dpg,A.dps,A.dpv);v.meshShaderIndex=A.meshShaderIndex,v.layers=A.layers,v.updateMesh(this.gl),log$4.debug(v),this.addMesh(v)}if(n.data.connectomes)for(const m of n.data.connectomes){const A=JSON.parse(m);this.loadConnectome(A)}return this.updateGLVolume(),this.drawScene(),this.onDocumentLoaded(n),this}generateLoadDocumentJavaScript(n,s){const u=this.json(),f=NVUtilities.compressToBase64String(JSON.stringify(u));return` ${s} function saveNiivueAsHtml(pageName) { @@ -1699,8 +1699,8 @@ void main(void) { button.onclick = saveAsHtml; <\/script> - `}saveHTML(n="untitled.html",s="gl1",u){const f=this.generateHTML(s,u);NVUtilities.download(f,n,"application/html")}json(){this.document.opts=this.opts,this.document.scene=this.scene,this.document.volumes=this.volumes,this.document.meshes=this.meshes,this.drawScene(),this.document.previewImageDataURL=this.canvas.toDataURL();const n=this.document.json();return n.sceneData={...this.scene},n}async saveDocument(n="untitled.nvd"){this.document.opts=this.opts,this.document.scene=this.scene,this.document.title=n,log$4.debug("saveDocument",this.volumes[0]),this.drawScene(),this.document.previewImageDataURL=this.canvas.toDataURL(),this.document.download(n)}async loadVolumes(n){if(this.loadingText="loading...",this.drawScene(),this.thumbnailVisible)return this.deferredVolumes=n,this;this.volumes=[],this.gl.clearColor(0,0,0,1),this.gl.clear(this.gl.COLOR_BUFFER_BIT);for(let s=0;s0&&(m[W]=T);const E=this.r16Tex(null,TEXTURE12_GC_STRENGTH0,this.back.dims,m),S=this.r16Tex(null,TEXTURE13_GC_STRENGTH1,this.back.dims,m);s.bindVertexArray(this.genericVAO);const I=this.growCutShader;I.use(s);const e=128;s.uniform1i(I.uniforms.finalPass,0),s.uniform1i(I.uniforms.backTex,11);for(let W=0;Wn[0]&&(v=1),s[1]>n[1]&&(y=1),s[2]>n[2]&&(T=1);let E=n[0],S=n[1],I=n[2];const e=s[0],F=s[1],M=s[2];if(f>=m&&f>=A){let L=2*m-f,V=2*A-f;for(;E!==e;)E+=v,L>=0&&(S+=y,L-=2*f),V>=0&&(I+=T,V-=2*f),L+=2*m,V+=2*A,this.drawPt(E,S,I,u)}else if(m>=f&&m>=A){let L=2*f-m,V=2*A-m;for(;S!==F;)S+=y,L>=0&&(E+=v,L-=2*m),V>=0&&(I+=T,V-=2*m),L+=2*f,V+=2*A,this.drawPt(E,S,I,u)}else{let L=2*m-A,V=2*f-A;for(;I!==M;)I+=T,L>=0&&(S+=y,L-=2*A),V>=0&&(E+=v,V-=2*A),L+=2*m,V+=2*f,this.drawPt(E,S,I,u)}}drawFloodFillCore(n,s,u=6){var E;if(!((E=this.back)!=null&&E.dims))throw new Error("back.dims undefined");const f=[this.back.dims[1],this.back.dims[2],this.back.dims[3]],m=f[0],A=m*f[1];function v(S){return S[0]+S[1]*m+S[2]*A}function y(S){const I=Math.floor(S/A),e=Math.floor((S-I*A)/m);return[Math.floor(S%m),e,I]}const T=[];for(T.push(s),n[s]=2;T.length>0;){let S=function(F){const M=e.slice();if(M[0]+=F[0],M[1]+=F[1],M[2]+=F[2],M[0]<0||M[1]<0||M[2]<0||M[0]>=f[0]||M[1]>=f[1]||M[2]>=f[2])return;const L=v(M);n[L]===1&&(n[L]=2,T.push(L))};const I=T[0];T.shift();const e=y(I);S([0,0,-1]),S([0,0,1]),S([0,-1,0]),S([0,1,0]),S([-1,0,0]),S([1,0,0]),!(u<=6)&&(S([-1,-1,0]),S([1,1,0]),S([-1,1,0]),S([1,1,0]),S([0,-1,-1]),S([0,1,-1]),S([-1,0,-1]),S([1,0,-1]),S([0,-1,1]),S([0,1,1]),S([-1,0,1]),S([1,0,1]),!(u<=18)&&(S([-1,-1,-1]),S([1,-1,-1]),S([-1,1,-1]),S([1,1,-1]),S([-1,-1,1]),S([1,-1,1]),S([-1,1,1]),S([1,1,1])))}}drawFloodFill(n,s=0,u=0,f=NaN,m=NaN,A=6){var M;if(!this.drawBitmap)throw new Error("drawBitmap undefined");if(!((M=this.back)!=null&&M.dims))throw new Error("back.dims undefined");s=Math.abs(s);const v=[this.back.dims[1],this.back.dims[2],this.back.dims[3]];if(n[0]<0||n[1]<0||n[2]<0||n[0]>=v[0]||n[1]>=v[1]||n[2]>=v[2])return;const y=v[0],T=y*v[1],E=T*v[2],S=this.drawBitmap.slice();if(S.length!==T*v[2])return;function I(L){return L[0]+L[1]*y+L[2]*T}const e=I(n),F=S[e];if(F===s){u!==0?log$4.debug("drawFloodFill selected voxel is not part of a drawing"):log$4.debug("drawFloodFill selected voxel is already desired color");return}for(let L=1;L=B&&L[z]<=V&&(S[z]=1);this.drawFloodFillCore(S,e,A),s=F}for(let L=1;LM[0]&&(z=1),L[1]>M[1]&&(b=1);let W=M[0],q=M[1];const Y=L[0],X=L[1];if(V>=B){let H=2*B-V;for(;W!==Y;)W+=z,H>=0&&(q+=b,H-=2*V),H+=2*B,A[W+q*m[0]]=v}else{let H=2*V-B;for(;q!==X;)q+=b,H>=0&&(W+=z,H-=2*B),H+=2*V,A[W+q*m[0]]=v}}const T=[this.drawPenFillPts[0][u],this.drawPenFillPts[0][f]];let E=T;for(let M=1;M=m[0]||M[1]>=m[1])return;const L=M[0]+M[1]*m[0];A[L]===0&&(S.push(M),A[L]=2)}for(let M=0;M0;){const M=S.shift();I([M[0]-1,M[1]]),I([M[0]+1,M[1]]),I([M[0],M[1]-1]),I([M[0],M[1]+1])}v=this.opts.penValue;const e=this.drawPenFillPts[0][3-(u+f)];if(!this.drawBitmap)throw new Error("drawBitmap undefined");if(s===0){const M=e*m[0]*m[1];for(let L=0;L0){const M=this.drawBitmap.length,L=decodeRLE(this.drawUndoBitmaps[this.currentDrawUndoBitmap],M);for(let V=0;V{const m=new Image;m.onload=()=>{if(!this.bmpShader)return;let A;s===4?(this.bmpTexture!==null&&this.gl.deleteTexture(this.bmpTexture),this.bmpTexture=this.gl.createTexture(),A=this.bmpTexture,this.bmpTextureWH=m.width/m.height,this.gl.activeTexture(TEXTURE4_THUMBNAIL),this.bmpShader.use(this.gl),this.gl.uniform1i(this.bmpShader.uniforms.bmpTexture,4)):s===5?(this.gl.activeTexture(TEXTURE5_MATCAP),this.matCapTexture!==null&&this.gl.deleteTexture(this.matCapTexture),this.matCapTexture=this.gl.createTexture(),A=this.matCapTexture):(this.fontShader.use(this.gl),this.gl.activeTexture(TEXTURE3_FONT),this.gl.uniform1i(this.fontShader.uniforms.fontTexture,3),this.fontTexture!==null&&this.gl.deleteTexture(this.fontTexture),this.fontTexture=this.gl.createTexture(),A=this.fontTexture),this.gl.bindTexture(this.gl.TEXTURE_2D,A),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,this.gl.RGBA,this.gl.UNSIGNED_BYTE,m),u(A),s!==4&&this.drawScene()},m.onerror=f,this.requestCORSIfNotSameOrigin(m,n),m.src=n})}async loadFontTexture(n){return this.loadPngAsTexture(n,3)}async loadBmpTexture(n){return this.loadPngAsTexture(n,4)}async loadMatCapTexture(n){return this.loadPngAsTexture(n,5)}initFontMets(){if(!this.fontMetrics)throw new Error("fontMetrics undefined");this.fontMets={distanceRange:this.fontMetrics.atlas.distanceRange,size:this.fontMetrics.atlas.size,mets:{}};for(let u=0;u<256;u++)this.fontMets.mets[u]={xadv:0,uv_lbwh:[0,0,0,0],lbwh:[0,0,0,0]};const n=this.fontMetrics.atlas.width,s=this.fontMetrics.atlas.height;for(let u=0;u=this.meshes.length){log$4.debug("Unable to change shader until mesh is loaded (maybe you need async)");return}this.meshes[f].meshShaderIndex=u,this.updateGLVolume(),this.onMeshShaderChanged(f,u)}createCustomMeshShader(n,s="Custom"){if(!n)throw new Error("Need fragment shader");const u=this.meshShaderNameToNumber(s);u>=0&&(this.gl.deleteProgram(this.meshShaders[u].shader.program),this.meshShaders.splice(u,1));const f=new Shader(this.gl,vertMeshShader,n);return f.use(this.gl),{Name:s,Frag:n,shader:f}}setCustomMeshShader(n="",s="Custom"){const u=this.createCustomMeshShader(n,s);return this.meshShaders.push(u),this.onCustomMeshShaderAdded(n,s),this.meshShaders.length-1}meshShaderNames(n=!0){const s=[];for(let u=0;u0&&(await this.loadBmpTexture(this.opts.thumbnail),this.thumbnailVisible=!0),this.updateGLVolume(),this.initialized=!0,this.resizeListener(),this.drawScene(),this}gradientGL(n){const s=this.gl,u=[0,0,0,0,1,0,1,0,0,1,1,0],f=s.createVertexArray();s.bindVertexArray(f);const m=s.createBuffer();s.bindBuffer(s.ARRAY_BUFFER,m),s.bufferData(s.ARRAY_BUFFER,new Float32Array(u),s.STATIC_DRAW),s.enableVertexAttribArray(0),s.vertexAttribPointer(0,3,s.FLOAT,!1,0,0);const A=s.createFramebuffer();s.bindFramebuffer(s.FRAMEBUFFER,A),s.disable(s.CULL_FACE),s.viewport(0,0,n.dims[1],n.dims[2]),s.disable(s.BLEND);const v=this.rgbaTex(null,TEXTURE8_GRADIENT_TEMP,n.dims),y=this.blurShader;y.use(s),s.activeTexture(TEXTURE0_BACK_VOL),s.bindTexture(s.TEXTURE_3D,this.volumeTexture);const T=.7;s.uniform1i(y.uniforms.intensityVol,0),s.uniform1f(y.uniforms.dX,T/n.dims[1]),s.uniform1f(y.uniforms.dY,T/n.dims[2]),s.uniform1f(y.uniforms.dZ,T/n.dims[3]),s.bindVertexArray(f);for(let I=0;I0&&(this.furthestVertexFromOrigin=this.volumeObject3D.furthestVertexFromOrigin),this.meshes)for(let u=0;u0)for(let Y=0;Y0&&n.frame4D1&&m===0)return;let A=null;if(!this.back)throw new Error("back undefined");this.gl.bindVertexArray(this.unusedVAO),this.crosshairs3D&&(this.crosshairs3D.mm[0]=NaN);let v=clone$3(n.toRAS);if(s===0){this.volumeObject3D=n.toNiivueObject3D(this.VOLUME_ID,this.gl),invert(v,v),this.back.matRAS=n.matRAS,this.back.dims=n.dimsRAS,this.back.pixDims=n.pixDimsRAS,A=this.rgbaTex(this.volumeTexture,TEXTURE0_BACK_VOL,n.dimsRAS);const{volScale:q,vox:Y}=this.sliceScale(!0);if(this.volScale=q,this.vox=Y,this.volumeObject3D.scale=q,!this.renderShader)throw new Error("renderShader undefined");this.renderShader.use(this.gl),this.gl.uniform3fv(this.renderShader.uniforms.texVox,Y),this.gl.uniform3fv(this.renderShader.uniforms.volScale,q);const X=this.pickingImageShader;X.use(this.gl),this.gl.uniform1i(X.uniforms.volume,0),this.gl.uniform1i(X.uniforms.colormap,1),this.gl.uniform1i(X.uniforms.overlay,2),this.gl.uniform3fv(X.uniforms.volScale,q),log$4.debug(this.volumeObject3D)}else{((W=this.back)==null?void 0:W.dims)===void 0&&log$4.error("Fatal error: Unable to render overlay: background dimensions not defined!");const q=this.mm2frac(n.mm000,0,!0);let Y=this.mm2frac(n.mm100,0,!0),X=this.mm2frac(n.mm010,0,!0),H=this.mm2frac(n.mm001,0,!0);Y=subtract$1(Y,Y,q),X=subtract$1(X,X,q),H=subtract$1(H,H,q),v=fromValues$3(Y[0],X[0],H[0],q[0],Y[1],X[1],H[1],q[1],Y[2],X[2],H[2],q[2],0,0,0,1),invert(v,v),s===1?(A=this.rgbaTex(this.overlayTexture,TEXTURE2_OVERLAY_VOL,this.back.dims),this.overlayTexture=A,this.overlayTextureID=A):A=this.overlayTextureID}const y=this.gl.createFramebuffer();this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,y),this.gl.disable(this.gl.CULL_FACE),this.gl.viewport(0,0,this.back.dims[1],this.back.dims[2]),this.gl.disable(this.gl.BLEND);const T=this.gl.createTexture();this.gl.activeTexture(TEXTURE9_ORIENT),this.gl.bindTexture(this.gl.TEXTURE_3D,T),this.gl.texParameteri(this.gl.TEXTURE_3D,this.gl.TEXTURE_MIN_FILTER,this.gl.NEAREST),this.gl.texParameteri(this.gl.TEXTURE_3D,this.gl.TEXTURE_MAG_FILTER,this.gl.NEAREST),this.gl.texParameteri(this.gl.TEXTURE_3D,this.gl.TEXTURE_WRAP_R,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_3D,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_3D,this.gl.TEXTURE_WRAP_T,this.gl.CLAMP_TO_EDGE),this.gl.pixelStorei(this.gl.UNPACK_ALIGNMENT,1);let E=this.orientShaderU;if(!u)throw new Error("hdr undefined");if(!f)throw new Error("img undefined");if(u.datatypeCode===2)u.intent_code===1002&&(E=this.orientShaderAtlasU),this.gl.texStorage3D(this.gl.TEXTURE_3D,1,this.gl.R8UI,u.dims[1],u.dims[2],u.dims[3]),this.gl.texSubImage3D(this.gl.TEXTURE_3D,0,0,0,0,u.dims[1],u.dims[2],u.dims[3],this.gl.RED_INTEGER,this.gl.UNSIGNED_BYTE,f);else if(u.datatypeCode===4)E=this.orientShaderI,u.intent_code===1002&&(E=this.orientShaderAtlasI),this.gl.texStorage3D(this.gl.TEXTURE_3D,1,this.gl.R16I,u.dims[1],u.dims[2],u.dims[3]),this.gl.texSubImage3D(this.gl.TEXTURE_3D,0,0,0,0,u.dims[1],u.dims[2],u.dims[3],this.gl.RED_INTEGER,this.gl.SHORT,f);else if(u.datatypeCode===16)this.gl.texStorage3D(this.gl.TEXTURE_3D,1,this.gl.R32F,u.dims[1],u.dims[2],u.dims[3]),this.gl.texSubImage3D(this.gl.TEXTURE_3D,0,0,0,0,u.dims[1],u.dims[2],u.dims[3],this.gl.RED,this.gl.FLOAT,f),E=this.orientShaderF;else if(u.datatypeCode===64){let q=new Float32Array;q=Float32Array.from(f),this.gl.texStorage3D(this.gl.TEXTURE_3D,1,this.gl.R32F,u.dims[1],u.dims[2],u.dims[3]),this.gl.texSubImage3D(this.gl.TEXTURE_3D,0,0,0,0,u.dims[1],u.dims[2],u.dims[3],this.gl.RED,this.gl.FLOAT,q),E=this.orientShaderF}else u.datatypeCode===128?(E=this.orientShaderRGBU,E.use(this.gl),this.gl.uniform1i(E.uniforms.hasAlpha,0),this.gl.texStorage3D(this.gl.TEXTURE_3D,1,this.gl.RGB8UI,u.dims[1],u.dims[2],u.dims[3]),this.gl.texSubImage3D(this.gl.TEXTURE_3D,0,0,0,0,u.dims[1],u.dims[2],u.dims[3],this.gl.RGB_INTEGER,this.gl.UNSIGNED_BYTE,f)):u.datatypeCode===512?(u.intent_code===1002&&(E=this.orientShaderAtlasU),this.gl.texStorage3D(this.gl.TEXTURE_3D,1,this.gl.R16UI,u.dims[1],u.dims[2],u.dims[3]),this.gl.texSubImage3D(this.gl.TEXTURE_3D,0,0,0,0,u.dims[1],u.dims[2],u.dims[3],this.gl.RED_INTEGER,this.gl.UNSIGNED_SHORT,f)):u.datatypeCode===2304&&(E=this.orientShaderRGBU,E.use(this.gl),this.gl.uniform1i(E.uniforms.hasAlpha,1),this.gl.texStorage3D(this.gl.TEXTURE_3D,1,this.gl.RGBA8UI,u.dims[1],u.dims[2],u.dims[3]),this.gl.texSubImage3D(this.gl.TEXTURE_3D,0,0,0,0,u.dims[1],u.dims[2],u.dims[3],this.gl.RGBA_INTEGER,this.gl.UNSIGNED_BYTE,f));n.global_min===void 0&&n.calMinMax();let S=null;if(this.gl.bindVertexArray(this.genericVAO),s>1){if(!this.back.dims)throw new Error("back.dims undefined");S=this.rgbaTex(S,TEXTURE10_BLEND,this.back.dims),this.gl.bindTexture(this.gl.TEXTURE_3D,S);const q=this.passThroughShader;q.use(this.gl),this.gl.uniform1i(q.uniforms.in3D,2);for(let Y=0;Y7){const q=n.colormapLabel.max-n.colormapLabel.min+1;I=this.createColormapTexture(I,1,q),this.gl.texSubImage2D(this.gl.TEXTURE_2D,0,0,0,q,1,this.gl.RGBA,this.gl.UNSIGNED_BYTE,n.colormapLabel.lut),this.gl.uniform1f(E.uniforms.cal_min,n.colormapLabel.min-.5),this.gl.uniform1f(E.uniforms.cal_max,n.colormapLabel.max+.5),this.gl.bindTexture(this.gl.TEXTURE_2D,I)}else this.gl.bindTexture(this.gl.TEXTURE_2D,this.colormapTexture),this.gl.uniform1f(E.uniforms.cal_min,n.cal_min),this.gl.uniform1f(E.uniforms.cal_max,n.cal_max);this.gl.uniform1i(E.uniforms.isAlphaThreshold,n.alphaThreshold),this.gl.uniform1i(E.uniforms.isAdditiveBlend,this.opts.isAdditiveBlend?1:0);let e=Number.POSITIVE_INFINITY,F=Number.NEGATIVE_INFINITY;if(n.colormapNegative.length>0&&(e=Math.min(-n.cal_min,-n.cal_max),F=Math.max(-n.cal_min,-n.cal_max),isFinite(n.cal_minNeg)&&isFinite(n.cal_maxNeg)&&(e=Math.min(n.cal_minNeg,n.cal_maxNeg),F=Math.max(n.cal_minNeg,n.cal_maxNeg))),!E)throw new Error("orientShader undefined");this.gl.uniform1f(E.uniforms.layer??null,s),this.gl.uniform1f(E.uniforms.cal_minNeg??null,e),this.gl.uniform1f(E.uniforms.cal_maxNeg??null,F),this.gl.bindTexture(this.gl.TEXTURE_3D,T),this.gl.uniform1i(E.uniforms.intensityVol??null,9),this.gl.uniform1i(E.uniforms.blend3D??null,10),this.gl.uniform1i(E.uniforms.colormap??null,1),this.gl.uniform1f(E.uniforms.scl_inter??null,u.scl_inter),this.gl.uniform1f(E.uniforms.scl_slope??null,u.scl_slope),this.gl.uniform1f(E.uniforms.opacity??null,m),this.gl.uniform1i(E.uniforms.modulationVol??null,7);let M=null;if(n.modulationImage!==null&&n.modulationImage>=0&&n.modulationImage0;let fe=this.volumes[n.modulationImage].cal_min,pe=this.volumes[n.modulationImage].cal_max;isFinite(this.volumes[n.modulationImage].cal_minNeg)&&isFinite(this.volumes[n.modulationImage].cal_maxNeg)&&(fe=this.volumes[n.modulationImage].cal_minNeg,pe=this.volumes[n.modulationImage].cal_minNeg),fe=Math.abs(fe),pe=Math.abs(pe),fe>pe&&([fe,pe]=[pe,fe]);const me=1/(pe-fe);let Se=Math.abs(n.modulateAlpha);Se=Math.max(Se,1);const ve=this.volumes[n.modulationImage].frame4D*Y;for(let we=0;we0?this.gradientGL(u):(this.gradientTexture!==null&&this.gl.deleteTexture(this.gradientTexture),this.gradientTexture=null)),!this.renderShader)throw new Error("renderShader undefined");this.renderShader.use(this.gl);const V=this.sliceScale(!0),B=V.vox,z=V.volScale;if(this.gl.uniform1f(this.renderShader.uniforms.overlays,this.overlays),this.gl.uniform4fv(this.renderShader.uniforms.clipPlaneColor,this.opts.clipPlaneColor),this.gl.uniform1f(this.renderShader.uniforms.backOpacity,this.volumes[0].opacity),this.gl.uniform1f(this.renderShader.uniforms.renderOverlayBlend,this.opts.renderOverlayBlend),this.gl.uniform4fv(this.renderShader.uniforms.clipPlane,this.scene.clipPlane),this.gl.uniform3fv(this.renderShader.uniforms.texVox,B),this.gl.uniform3fv(this.renderShader.uniforms.volScale,z),!this.pickingImageShader)throw new Error("pickingImageShader undefined");this.pickingImageShader.use(this.gl),this.gl.uniform1f(this.pickingImageShader.uniforms.overlays,this.overlays.length),this.gl.uniform3fv(this.pickingImageShader.uniforms.texVox,B);let b=this.sliceMMShader;if(this.opts.isV1SliceShader&&(b=this.sliceV1Shader),!b)throw new Error("slice shader undefined");b.use(this.gl),this.gl.uniform1f(b.uniforms.overlays,this.overlays.length),this.gl.uniform1f(b.uniforms.drawOpacity,this.drawOpacity),I!==null&&(this.gl.deleteTexture(I),this.gl.activeTexture(TEXTURE1_COLORMAPS),this.gl.bindTexture(this.gl.TEXTURE_2D,this.colormapTexture)),this.gl.uniform1i(b.uniforms.drawing,7),this.gl.activeTexture(TEXTURE7_DRAW),this.gl.bindTexture(this.gl.TEXTURE_3D,this.drawTexture),this.updateInterpolation(s)}colormaps(){return cmapper.colormaps()}addColormap(n,s){cmapper.addColormap(n,s)}setColormap(n,s){const u=this.getVolumeIndexByID(n);this.volumes[u].colormap=s,this.updateGLVolume()}idx(n,s,u,f){return u*f[0]*f[1]+s*f[0]+n}check_previous_slice(n,s,u,f,m,A,v,y){const T=new Uint32Array(27);let E=0;if(!m)return 0;const S=n[this.idx(u,f,m,A)];if(v>=6){const I=this.idx(u,f,m-1,A);S===n[I]&&(T[E++]=s[I])}if(v>=18){if(u){const I=this.idx(u-1,f,m-1,A);S===n[I]&&(T[E++]=s[I])}if(f){const I=this.idx(u,f-1,m-1,A);S===n[I]&&(T[E++]=s[I])}if(u=6){if(I){const M=this.idx(I-1,S,E,s);F===n[M]&&(T[e++]=y[M])}if(S){const M=this.idx(I,S-1,E,s);F===n[M]&&(T[e++]=y[M])}}if(u>=18){if(S&&I){const M=this.idx(I-1,S-1,E,s);F===n[M]&&(T[e++]=y[M])}if(S&&I=A){A+=m;const M=new Uint32Array(A);M.set(v),v=M}v[f-1]=f,f++}}}for(let E=0;E100){log$4.info(` -Ooh no!!`);break}m[y]=T,v=Math.min(v,T)}for(let y=0;y=1e-15&&E++;const S=1e3,I=(v-A)/S,e=new Array(S).fill(0);for(let z=0;z=M);)L++;const V=A;for(A=L*I+V,M=T-Math.floor((1-m)*E),L=0;L=M);)L++;v=L*I+V;let B=1;return A!==v&&(B=(u-s)/(v-A)),log$4.info(" Rescale: min: "+A+" max: "+v+" scale: "+B),[A,B]}conformVox2Vox(n,s,u=256,f=1,m=!1){const A=s.flat(),v=fromValues$3(A[0],A[1],A[2],A[3],A[4],A[5],A[6],A[7],A[8],A[9],A[10],A[11],A[12],A[13],A[14],A[15]),y=fromValues$1(n[1]/2,n[2]/2,n[3]/2,1),T=create$1(),E=create$3();transpose$3(E,v),transformMat4(T,y,E);const S=fromValues$2(T[0],T[1],T[2]),I=fromValues$2(f,f,f);let e=fromValues$3(-1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1);m&&(e=fromValues$3(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)),transpose$3(e,e);const F=fromValues$1(u,u,u,1),M=create$3();scale$4(M,e,I);const L=fromValues$1(F[0],F[1],F[2],1);transformMat4(L,L,M),scale$2(L,L,.5);const V=create$2();subtract$1(V,S,fromValues$2(L[0],L[1],L[2]));const B=create$3();transpose$3(B,M),B[3]=V[0],B[7]=V[1],B[11]=V[2];const z=create$3();invert(z,B);const b=create$3();mul$1(b,v,z);const W=create$3();return invert(W,b),[B,b,W]}async createNiftiArray(n=[256,256,256],s=[1,1,1],u=[1,0,0,-128,0,1,0,-128,0,0,1,-128,0,0,0,1],f=2,m=new Uint8Array){return await NVImage.createNiftiArray(n,s,u,f,m)}async niftiArray2NVImage(n=new Uint8Array){return await NVImage.loadFromUrl({url:n})}async loadFromUrl(n){return await NVImage.loadFromUrl({url:n})}async conform(n,s=!1,u=!0,f=!1){const v=this.conformVox2Vox(n.hdr.dims,n.hdr.affine.flat(),256,1,s),y=v[0],T=v[2],E=256*256*256,S=new Float32Array(E),I=new Float32Array(n.img),e=n.hdr.dims[1]*n.hdr.dims[2]*n.hdr.dims[3];if(n.hdr.scl_slope!==1||n.hdr.scl_inter!==0)for(let H=0;H=F||je>=M||nt>=L)continue;const Ue=pe-ve,ye=me-we,ut=Se-Ne,pt=1-Ue,It=1-ye,Lt=1-ut,Ot=z(ve,we,Ne);let Et=0;Et+=I[Ot]*pt*It*Lt,Et+=I[Ot+V]*pt*It*ut,Et+=I[Ot+F]*pt*ye*Lt,Et+=I[Ot+F+V]*pt*ye*ut,Et+=I[Ot+1]*Ue*It*Lt,Et+=I[Ot+1+V]*Ue*It*ut,Et+=I[Ot+1+F]*Ue*ye*Lt,Et+=I[Ot+1+F+V]*Ue*ye*ut,S[B]=Et}}else for(let H=0;H<256;H++)for(let g=0;g<256;g++){const J=g*T[1]+H*T[2]+T[3],re=g*T[5]+H*T[6]+T[7],ae=g*T[9]+H*T[10]+T[11];for(let fe=0;fe<256;fe++){const pe=Math.round(fe*b+J),me=Math.round(fe*W+re),Se=Math.round(fe*q+ae);B++,!(pe<0||me<0||Se<0)&&(pe>=F||me>=M||Se>=L||(S[B]=I[z(pe,me,Se)]))}}let Y=new Uint8Array;if(f){const H=await this.getScale(n,0,1),g=await this.scalecropFloat32(S,0,1,H[0],H[1]);Y=await this.createNiftiArray([256,256,256],[1,1,1],Array.from(y),16,new Uint8Array(g.buffer))}else{const H=await this.getScale(n,0,255),g=await this.scalecropUint8(S,0,255,H[0],H[1]);Y=await this.createNiftiArray([256,256,256],[1,1,1],Array.from(y),2,g)}return await this.niftiArray2NVImage(Y)}setRenderDrawAmbientOcclusion(n){if(!this.renderShader)throw new Error("renderShader undefined");this.renderDrawAmbientOcclusion=n,this.renderShader.use(this.gl),this.gl.uniform1fv(this.renderShader.uniforms.renderDrawAmbientOcclusion,[this.renderDrawAmbientOcclusion,1]),this.drawScene()}setColorMap(n,s){this.setColormap(n,s)}setColormapNegative(n,s){const u=this.getVolumeIndexByID(n);this.volumes[u].colormapNegative=s,this.updateGLVolume()}setModulationImage(n,s,u=0){const f=this.getVolumeIndexByID(n);let m=null;s.length>0&&(m=this.getVolumeIndexByID(s)),this.volumes[f].modulationImage=m,this.volumes[f].modulateAlpha=u,this.updateGLVolume()}setGamma(n=1){cmapper.gamma=n,this.updateGLVolume()}async loadDeferred4DVolumes(n){const s=this.getVolumeIndexByID(n),u=this.volumes[s];if(u.nTotalFrame4D<=u.nFrame4D)return;let f;u.fileObject?f=await NVImage.loadFromFile({file:u.fileObject}):f=await NVImage.loadFromUrl({url:u.url}),f&&(u.img=f.img.slice(),u.nTotalFrame4D=f.nTotalFrame4D,u.nFrame4D=f.nFrame4D,this.updateGLVolume())}setFrame4D(n,s){const u=this.getVolumeIndexByID(n),f=this.volumes[u];s>f.nFrame4D-1&&(s=f.nFrame4D-1),s<0&&(s=0),s!==f.frame4D&&(f.frame4D=s,this.updateGLVolume(),this.onFrameChange(f,s),this.createOnLocationChange())}getFrame4D(n){const s=this.getVolumeIndexByID(n);return this.volumes[s].frame4D}colormapFromKey(n){return cmapper.colormapFromKey(n)}colormap(n="",s=!1){return cmapper.colormap(n,s)}createColormapTexture(n=null,s=0,u=256){return n!==null&&this.gl.deleteTexture(n),s<1||u<1?null:(n=this.gl.createTexture(),this.gl.activeTexture(TEXTURE1_COLORMAPS),this.gl.bindTexture(this.gl.TEXTURE_2D,n),this.gl.texStorage2D(this.gl.TEXTURE_2D,1,this.gl.RGBA8,u,s),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_R,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.pixelStorei(this.gl.UNPACK_ALIGNMENT,1),n)}addColormapList(n="",s=NaN,u=NaN,f=!1,m=!1,A=!0,v=!1){n.length<1&&(A=!1),this.colormapLists.push({name:n,min:s,max:u,alphaThreshold:f,negative:m,visible:A,invert:v})}refreshColormaps(){if(this.colormapLists=[],this.volumes.length<1&&this.meshes.length<1)return;const n=this.volumes.length;if(n>0)for(let A=0;A0)for(let A=0;Af[0]&&s>f[1]&&n=0&&this.screenSlices[u].axCorSag===4?u:-1}sliceScroll3D(n=0){if(n!==0){if(this.volumes.length>0&&this.scene.clipPlaneDepthAziElev[0]<1.8){const s=this.scene.clipPlaneDepthAziElev.slice();return n>0&&(s[0]=Math.min(1.5,s[0]+.025)),n<0&&(s[0]=Math.max(-1.5,s[0]-.025)),s[0]!==this.scene.clipPlaneDepthAziElev[0]?(this.scene.clipPlaneDepthAziElev=s,this.setClipPlane(this.scene.clipPlaneDepthAziElev)):void 0}n>0&&(this.scene.volScaleMultiplier=Math.min(2,this.scene.volScaleMultiplier*1.1)),n<0&&(this.scene.volScaleMultiplier=Math.max(.5,this.scene.volScaleMultiplier*.9)),this.drawScene()}}deleteThumbnail(){this.bmpTexture&&(this.gl.deleteTexture(this.bmpTexture),this.bmpTexture=null,this.thumbnailVisible=!1)}inGraphTile(n,s){if(this.graph.opacity<=0||this.volumes.length<1||this.volumes[0].nFrame4D<1||!this.graph.plotLTWH||this.graph.plotLTWH[2]<1||this.graph.plotLTWH[3]<1)return!1;const u=[(n-this.graph.LTWH[0])/this.graph.LTWH[2],(s-this.graph.LTWH[1])/this.graph.LTWH[3]];return u[0]>0&&u[1]>0&&u[0]<=1&&u[1]<=1}mouseClick(n,s,u=0,f=!0){if(n*=this.uiData.dpr,s*=this.uiData.dpr,this.canvas.focus(),this.thumbnailVisible){this.thumbnailVisible=!1,Promise.all([this.loadVolumes(this.deferredVolumes),this.loadMeshes(this.deferredMeshes)]).catch(m=>{throw m});return}if(this.inGraphTile(n,s)){if(!this.graph.plotLTWH)throw new Error("plotLTWH undefined");const m=[(n-this.graph.plotLTWH[0])/this.graph.plotLTWH[2],(s-this.graph.plotLTWH[1])/this.graph.plotLTWH[3]];if(m[0]>0&&m[1]>0&&m[0]<=1&&m[1]<=1){const A=Math.round(m[0]*(this.volumes[0].nFrame4D-1));this.setFrame4D(this.volumes[0].id,A);return}m[0]>.5&&m[1]>1&&this.loadDeferred4DVolumes(this.volumes[0].id).catch(A=>{throw A});return}if(this.inRenderTile(n,s)>=0){this.sliceScroll3D(u),this.drawScene();return}if(!(this.screenSlices.length<1||this.gl.canvas.height<1||this.gl.canvas.width<1))for(let m=0;m=0&&this.drawPenAxCorSag!==A||A>2)continue;const v=this.screenXY2TextureFrac(n,s,m,!1);if(!(v[0]<0)){if(!f){this.scene.crosshairPos[2-A]=u,this.drawScene();return}if(u!==0){let y=1;u<0&&(y=-1);const T=[0,0,0];T[2-A]=y,this.moveCrosshairInVox(T[0],T[1],T[2]),this.drawScene(),this.createOnLocationChange(A);return}if(this.opts.isForceMouseClickToVoxelCenters?this.scene.crosshairPos=clone$2(this.vox2frac(this.frac2vox(v))):this.scene.crosshairPos=clone$2(v),this.opts.drawingEnabled){const y=this.frac2vox(this.scene.crosshairPos);if(!isFinite(this.opts.penValue)||this.opts.penValue<0||Object.is(this.opts.penValue,-0)){isFinite(this.opts.penValue)?this.drawFloodFill(y,Math.abs(this.opts.penValue),this.opts.floodFillNeighbors):this.drawFloodFill(y,0,this.opts.penValue,this.opts.floodFillNeighbors);return}if(isNaN(this.drawPenLocation[0]))this.drawPenAxCorSag=A,this.drawPenFillPts=[],this.drawPt(...y,this.opts.penValue);else{if(y[0]===this.drawPenLocation[0]&&y[1]===this.drawPenLocation[1]&&y[2]===this.drawPenLocation[2])return;this.drawPenLine(y,this.drawPenLocation,this.opts.penValue)}this.drawPenLocation=y,this.opts.isFilledPen&&this.drawPenFillPts.push(y),this.refreshDrawing(!1)}this.drawScene(),this.createOnLocationChange(A);return}}}drawRuler(){let n=[],s=[];for(let y=0;y1){s=this.screenSlices[y].leftTopWidthHeight,n=this.screenSlices[y].fovMM;break}if(s.length<4)return;const f=100/n[0]*s[2],m=s[0]+.5*s[2]-.5*f,A=s[1]+s[3]-2*this.opts.rulerWidth,v=[m,A,m+f,A];this.drawRuler10cm(v)}drawRuler10cm(n){if(!this.lineShader)throw new Error("lineShader undefined");this.gl.bindVertexArray(this.genericVAO),this.lineShader.use(this.gl),this.gl.uniform4fv(this.lineShader.uniforms.lineColor,this.opts.rulerColor),this.gl.uniform2fv(this.lineShader.uniforms.canvasWidthHeight,[this.gl.canvas.width,this.gl.canvas.height]),this.gl.uniform1f(this.lineShader.uniforms.thickness,this.opts.rulerWidth),this.gl.uniform4fv(this.lineShader.uniforms.startXYendXY,n),this.gl.drawArrays(this.gl.TRIANGLE_STRIP,0,4);const s=-.1*(n[0]-n[2]),u=n[1],f=u-2*this.opts.rulerWidth,m=u-4*this.opts.rulerWidth;for(let A=0;A<11;A++){const v=n[0]+A*s,y=[v,u,v,f];A%5===0&&(y[3]=m),this.gl.uniform4fv(this.lineShader.uniforms.startXYendXY,y),this.gl.drawArrays(this.gl.TRIANGLE_STRIP,0,4)}this.gl.bindVertexArray(this.unusedVAO)}screenXY2mm(n,s,u=-1){let f;for(let m=0;m=0&&(A=u),this.screenSlices[A].axCorSag>2)continue;const y=this.screenSlices[A].leftTopWidthHeight;if(ny[0]+y[2]||s>y[1]+y[3]||(f=this.screenXY2TextureFrac(n,s,A,!1),f[0]<0))continue;const T=this.frac2mm(f);return fromValues$1(T[0],T[1],T[2],A)}return fromValues$1(NaN,NaN,NaN,NaN)}dragForPanZoom(n){const s=this.screenXY2mm(n[2],n[3]);if(isNaN(s[0]))return;const u=this.screenXY2mm(n[0],n[1],s[3]);if(isNaN(u[0])||isNaN(s[0])||isNaN(s[3]))return;const f=create$1(),m=this.uiData.pan2DxyzmmAtMouseDown[3];sub$3(f,s,u),this.scene.pan2Dxyzmm[0]=this.uiData.pan2DxyzmmAtMouseDown[0]+m*f[0],this.scene.pan2Dxyzmm[1]=this.uiData.pan2DxyzmmAtMouseDown[1]+m*f[1],this.scene.pan2Dxyzmm[2]=this.uiData.pan2DxyzmmAtMouseDown[2]+m*f[2]}dragForCenterButton(n){this.dragForPanZoom(n)}dragForSlicer3D(n){let s=this.uiData.pan2DxyzmmAtMouseDown[3];const u=n[3]-n[1];s+=u*.01,s=Math.max(s,.1),s=Math.min(s,10);const m=this.scene.pan2Dxyzmm[3]-s;this.opts.yoke3Dto2DZoom&&(this.scene.volScaleMultiplier=s),this.scene.pan2Dxyzmm[3]=s;const A=this.frac2mm(this.scene.crosshairPos);this.scene.pan2Dxyzmm[0]+=m*A[0],this.scene.pan2Dxyzmm[1]+=m*A[1],this.scene.pan2Dxyzmm[2]+=m*A[2]}drawMeasurementTool(n){const s=this.gl;if(s.bindVertexArray(this.genericVAO),s.depthFunc(s.ALWAYS),s.enable(s.BLEND),s.blendFunc(s.SRC_ALPHA,s.ONE_MINUS_SRC_ALPHA),!this.lineShader)throw new Error("lineShader undefined");this.lineShader.use(this.gl),s.uniform4fv(this.lineShader.uniforms.lineColor,this.opts.rulerColor),s.uniform2fv(this.lineShader.uniforms.canvasWidthHeight,[s.canvas.width,s.canvas.height]),s.uniform1f(this.lineShader.uniforms.thickness,this.opts.rulerWidth),s.uniform4fv(this.lineShader.uniforms.startXYendXY,n),s.drawArrays(s.TRIANGLE_STRIP,0,4);const u=this.opts.rulerColor;u[3]=1,s.uniform4fv(this.lineShader.uniforms.lineColor,u);const f=this.opts.rulerWidth;s.uniform1f(this.lineShader.uniforms.thickness,f*2);let m=[n[0],n[1]-f,n[0],n[1]+f];s.uniform4fv(this.lineShader.uniforms.startXYendXY,m),s.drawArrays(s.TRIANGLE_STRIP,0,4),m=[n[2],n[3]-f,n[2],n[3]+f],s.uniform4fv(this.lineShader.uniforms.startXYendXY,m),s.drawArrays(s.TRIANGLE_STRIP,0,4);let A=this.canvasPos2frac([n[0],n[1]]),v=this.canvasPos2frac([n[2],n[3]]);if(A[0]>=0&&v[0]>=0){const y=this.frac2mm(A);A=fromValues$2(y[0],y[1],y[2]);const T=this.frac2mm(v);v=fromValues$2(T[0],T[1],T[2]);const E=create$2();sub$4(E,A,v);const S=len(E);let I=2;S>9&&(I=1),S>99&&(I=0);const e=S.toFixed(I);this.drawTextBetween(n,e,1,u)}s.bindVertexArray(this.unusedVAO)}drawRect(n,s=[1,0,0,-1]){if(s[3]<0&&(s=this.opts.crosshairColor),!this.rectShader)throw new Error("rectShader undefined");this.rectShader.use(this.gl),this.gl.enable(this.gl.BLEND),this.gl.uniform4fv(this.rectShader.uniforms.lineColor,s),this.gl.uniform2fv(this.rectShader.uniforms.canvasWidthHeight,[this.gl.canvas.width,this.gl.canvas.height]),this.gl.uniform4f(this.rectShader.uniforms.leftTopWidthHeight,n[0],n[1],n[2],n[3]),this.gl.bindVertexArray(this.genericVAO),this.gl.drawArrays(this.gl.TRIANGLE_STRIP,0,4),this.gl.bindVertexArray(this.unusedVAO)}drawCircle(n,s=this.opts.fontColor,u=1){if(!this.circleShader)throw new Error("circleShader undefined");this.circleShader.use(this.gl),this.gl.enable(this.gl.BLEND),this.gl.uniform4fv(this.circleShader.uniforms.circleColor,s),this.gl.uniform2fv(this.circleShader.uniforms.canvasWidthHeight,[this.gl.canvas.width,this.gl.canvas.height]),this.gl.uniform4f(this.circleShader.uniforms.leftTopWidthHeight,n[0],n[1],n[2],n[3]),this.gl.uniform1f(this.circleShader.uniforms.fillPercent,u),this.gl.uniform4fv(this.circleShader.uniforms.circleColor,s),this.gl.bindVertexArray(this.genericVAO),this.gl.drawArrays(this.gl.TRIANGLE_STRIP,0,4),this.gl.bindVertexArray(this.unusedVAO)}drawSelectionBox(n){this.drawRect(n,this.opts.selectionBoxColor)}effectiveCanvasHeight(){return this.gl.canvas.height-this.colorbarHeight}effectiveCanvasWidth(){return this.gl.canvas.width-this.getLegendPanelWidth()}getAllLabels(){const f=this.meshes.filter(A=>A.type==="connectome").flatMap(A=>A.nodes).map(A=>A.label).filter(A=>A!==void 0);return[...this.document.labels,...f]}getBulletMarginWidth(){let n=0;const s=this.getAllLabels();if(s.length===0)return 0;const u=s.length===1?s[0].style.bulletScale:s.reduce((A,v)=>A.style.bulletScale>v.style.bulletScale?A:v).style.bulletScale,f=s.length===1?s[0]:s.reduce((A,v)=>{const y=this.opts.textHeight*this.gl.canvas.height*A.style.textScale,T=this.opts.textHeight*this.gl.canvas.height*v.style.textScale;return this.textHeight(y,A.text)>this.textHeight(T,v.text)?A:v}),m=this.opts.textHeight*this.gl.canvas.height*f.style.textScale;return n=this.textHeight(m,f.text)*u,n+=m,n}getLegendPanelWidth(){const n=this.getAllLabels();if(!this.opts.showLegend||n.length===0)return 0;const u=this.opts.textHeight*this.gl.canvas.height*1;let f=0;const m=n.reduce((T,E)=>{const S=this.opts.textHeight*this.gl.canvas.height*T.style.textScale,I=this.opts.textHeight*this.gl.canvas.height*E.style.textScale;return this.textWidth(S,T.text)>this.textWidth(I,E.text)?T:E}),A=this.opts.textHeight*this.gl.canvas.height*m.style.textScale,v=this.textWidth(A,m.text),y=this.getBulletMarginWidth();return v&&(f=y+v,f+=u*2),f}getLegendPanelHeight(){const n=this.getAllLabels();let s=0;const f=this.opts.textHeight*this.gl.canvas.height*1;for(const m of n){const A=this.opts.textHeight*this.gl.canvas.height*m.style.textScale,v=this.textHeight(A,m.text);s+=v}return s&&(s+=f/2*(n.length+1)),s}reserveColorbarPanel(){let n=Math.max(this.opts.textHeight,.01);n=n*Math.min(this.gl.canvas.height,this.gl.canvas.width);const s=3*n,u=[0,this.gl.canvas.height-s,this.gl.canvas.width,s];return this.colorbarHeight=u[3]+1,u}drawColorbarCore(n=0,s=[0,0,0,0],u=!1,f=0,m=1,A){if(s[2]<=0||s[3]<=0)return;let v=Math.max(this.opts.textHeight,.01);v=v*Math.min(this.gl.canvas.height,this.gl.canvas.width);let y=v;const T=3*v;let E=v;if(s[3]0&&(F=f,f=0),f===m||v<1)return;const M=Math.abs(m-f);let[L,V]=tickSpacing(f,m);Vf.includes(y)).reduce((v,y)=>v.lbwh[3]>y.lbwh[3]?v:y).lbwh[3];return n*A}drawChar(n,s,u){if(!this.fontShader)throw new Error("fontShader undefined");const f=this.fontMets.mets[u],m=n[0]+s*f.lbwh[0],A=-(s*f.lbwh[1]),v=s*f.lbwh[2],y=s*f.lbwh[3],T=n[1]+(A-y)+s;return this.gl.uniform4f(this.fontShader.uniforms.leftTopWidthHeight,m,T,v,y),this.gl.uniform4fv(this.fontShader.uniforms.uvLeftTopWidthHeight,f.uv_lbwh),this.gl.drawArrays(this.gl.TRIANGLE_STRIP,0,4),s*f.xadv}drawLoadingText(n){if(!this.canvas)throw new Error("canvas undefined");this.gl.viewport(0,0,this.gl.canvas.width,this.gl.canvas.height),this.gl.enable(this.gl.CULL_FACE),this.gl.enable(this.gl.BLEND),this.drawTextBelow([this.canvas.width/2,this.canvas.height/2],n,3)}drawText(n,s,u=1,f=null){if(this.opts.textHeight<=0)return;if(!this.fontShader)throw new Error("fontShader undefined");this.fontShader.use(this.gl);const m=this.opts.textHeight*Math.min(this.gl.canvas.height,this.gl.canvas.width)*u;this.gl.enable(this.gl.BLEND),this.gl.uniform2f(this.fontShader.uniforms.canvasWidthHeight,this.gl.canvas.width,this.gl.canvas.height),f===null&&(f=this.opts.fontColor),this.gl.uniform4fv(this.fontShader.uniforms.fontColor,f);let A=m/this.fontMets.size*this.fontMets.distanceRange;A=Math.max(A,1),this.gl.uniform1f(this.fontShader.uniforms.screenPxRange,A);const v=new TextEncoder().encode(s);this.gl.bindVertexArray(this.genericVAO);for(let y=0;y.8?T=[0,0,0,.5]:T=[1,1,1,.5],this.drawRect(y,T),this.drawText(m,s,u,f)}drawTextBelow(n,s,u=1,f=null){if(this.opts.textHeight<=0)return;if(!this.canvas)throw new Error("canvas undefined");let m=this.opts.textHeight*this.gl.canvas.height*u,A=this.textWidth(m,s);A>this.canvas.width&&(u*=(this.canvas.width-2)/A,m=this.opts.textHeight*this.gl.canvas.height*u,A=this.textWidth(m,s)),n[0]-=.5*this.textWidth(m,s),n[0]=Math.max(n[0],1),n[0]=Math.min(n[0],this.canvas.width-A-1),this.drawText(n,s,u,f)}updateInterpolation(n,s=!1){let u=this.gl.LINEAR;!s&&this.opts.isNearestInterpolation&&(u=this.gl.NEAREST),n===0?this.gl.activeTexture(TEXTURE0_BACK_VOL):this.gl.activeTexture(TEXTURE2_OVERLAY_VOL),this.gl.texParameteri(this.gl.TEXTURE_3D,this.gl.TEXTURE_MIN_FILTER,u),this.gl.texParameteri(this.gl.TEXTURE_3D,this.gl.TEXTURE_MAG_FILTER,u)}setAtlasOutline(n){this.opts.atlasOutline=n,this.updateGLVolume(),this.drawScene()}setInterpolation(n){this.opts.isNearestInterpolation=n;const s=this.volumes.length;if(!(s<1)){for(let u=0;u0){this.opts.meshThicknessOn2D!==1/0&&(M=this.calculateMvpMatrix2D(n,m.mnMM,m.mxMM,this.opts.meshThicknessOn2D,F,T,y,v));const V=clone$3(M.modelViewProjectionMatrix);multiply$2(V,V,A),this.drawMesh3D(!0,1,V,M.modelMatrix,M.normalMatrix)}isNaN(u)&&this.drawCrosshairs3D(!1,.15,M.modelViewProjectionMatrix,!0,this.opts.isSliceMM),this.drawSliceOrientationText(n,s),this.readyForSync=!0}calculateMvpMatrix(n,s=[0,0,0,0],u,f){(s[2]===0||s[3]===0)&&(s=[0,0,this.gl.canvas.width,this.gl.canvas.height]);const m=s[2]/s[3];let A=this.furthestFromPivot;const v=this.pivot3D,y=create$3();A=.8*A/this.scene.volScaleMultiplier,m<1?ortho(y,-A,A,-A/m,A/m,A*.01,A*8):ortho(y,-A*m,A*m,-A,A,A*.01,A*8);const T=create$3();T[0]=-1;const E=fromValues$2(0,0,-A*1.8);translate(T,T,E),this.position&&translate(T,T,this.position),rotateX(T,T,deg2rad(270-f)),rotateZ(T,T,deg2rad(u-180)),translate(T,T,[-v[0],-v[1],-v[2]]);const S=create$3();invert(S,T);const I=create$3();transpose$3(I,S);const e=create$3();return multiply$2(e,y,T),[e,T,I]}calculateModelMatrix(n,s){if(!this.back)throw new Error("back undefined");const u=create$3();if(u[0]=-1,rotateX(u,u,deg2rad(270-s)),rotateZ(u,u,deg2rad(n-180)),this.back.obliqueRAS){const f=clone$3(this.back.obliqueRAS);multiply$2(u,u,f)}return u}calculateRayDirection(n,s){const u=this.calculateModelMatrix(n,s),f=fromValues$3(1,0,0,0,0,-1,0,0,0,0,-1,0,0,0,0,1),m=create$3();multiply$2(m,f,u);const A=create$3();invert(A,m);const v=fromValues$1(0,0,-1,1);transformMat4(v,v,A);const y=fromValues$2(v[0],v[1],v[2]);normalize$1(y,y);const T=5e-5;return Math.abs(y[0])0){if(!this.volumeObject3D)throw new Error("volumeObject3D undefined");s=fromValues$2(this.volumeObject3D.extentsMin[0],this.volumeObject3D.extentsMin[1],this.volumeObject3D.extentsMin[2]),u=fromValues$2(this.volumeObject3D.extentsMax[0],this.volumeObject3D.extentsMax[1],this.volumeObject3D.extentsMax[2]),n||(s=fromValues$2(this.volumes[0].extentsMinOrtho[0],this.volumes[0].extentsMinOrtho[1],this.volumes[0].extentsMinOrtho[2]),u=fromValues$2(this.volumes[0].extentsMaxOrtho[0],this.volumes[0].extentsMaxOrtho[1],this.volumes[0].extentsMaxOrtho[2]))}if(this.meshes.length>0){if(this.volumes.length<1){const m=this.meshes[0].extentsMin,A=this.meshes[0].extentsMax;s=fromValues$2(m[0],m[1],m[2]),u=fromValues$2(A[0],A[1],A[2])}for(let m=0;mthis.gl.canvas.width||n.LTWH[1]+n.LTWH[3]>this.gl.canvas.height)return;n.backColor=[.15,.15,.15,n.opacity],n.lineColor=[1,1,1,1],this.opts.backColor[0]+this.opts.backColor[1]+this.opts.backColor[2]>1.5&&(n.backColor=[.95,.95,.95,n.opacity],n.lineColor=[0,0,0,1]),n.textColor=n.lineColor.slice(),n.lineThickness=4,n.lineAlpha=1,n.lines=[];const u=[];if(n.vols.length<1)this.volumes[0]!=null&&u.push(0);else for(let re=0;rem){const re=A-m;for(let ae=0;ae=A&&(A=m+1),this.drawRect(n.LTWH,n.backColor);const[v,y,T]=tickSpacing(m,A),E=Math.max(0,-1*Math.floor(Math.log(v)/Math.log(10)));m=Math.min(y,m),A=Math.max(T,A);function S(re){return re.toFixed(6).replace(/\.?0*$/,"")}const e=.07*(Math.min(n.LTWH[2],n.LTWH[3])/(this.fontMets.size*this.uiData.dpr));let F=this.opts.textHeight*this.gl.canvas.height*e;F<16&&(F=0);let M=0,L=y;if(F>0)for(;L<=A;){const re=L.toFixed(E),ae=this.textWidth(F,re);M=Math.max(ae,M),L+=v}const V=.05,B=Math.abs(n.LTWH[2]),z=Math.abs(n.LTWH[3]),b=[n.LTWH[0]+V*B+M,n.LTWH[1]+V*z,n.LTWH[2]-M-2*V*B,n.LTWH[3]-F-2*V*z];this.graph.LTWH=n.LTWH,this.graph.plotLTWH=b,this.drawRect(b,this.opts.backColor);const W=A-m,q=b[3]/W,Y=b[2]/(n.lines[0].length-1),X=b[1]+b[3];L=y+.5*v;const H=n.lineColor.slice();for(H[3]=.25*n.lineColor[3];L<=A;){const re=X-(L-m)*q;this.drawLine([b[0],re,b[0]+b[2],re],.5*n.lineThickness,H),L+=v}L=y;const g=.5*n.lineThickness;for(;L<=A;){const re=X-(L-m)*q;this.drawLine([b[0]-g,re,b[0]+b[2]+n.lineThickness,re],n.lineThickness,n.lineColor);const ae=L.toFixed(E);F>0&&this.drawTextLeft([b[0]-6,re],ae,e,n.textColor),L+=v}let J=1;for(;n.lines[0].length/J>20;)J*=5;for(let re=0;re0&&this.drawTextBelow([ae,2+b[1]+b[3]],pe,e,n.textColor),this.drawLine([ae,b[1],ae,b[1]+b[3]],fe,n.lineColor)}}for(let re=0;re=0&&n.selectedColumnI/255);return}const v=unpackFloatFromVec4i(A);if(v>1)return;const y=(this.mousePos[0]-n[0])/n[2],T=(u.canvas.height-this.mousePos[1]-n[1])/n[3],E=unProject(y,T,v,s),S=this.mm2frac(E,0,!0);S[0]<0||S[0]>1||S[1]<0||S[1]>1||S[2]<0||S[2]>1||(this.scene.crosshairPos=this.mm2frac(E,0,!0))}drawImage3D(n,s,u){if(this.volumes.length===0)return;const f=this.gl,m=this.calculateRayDirection(s,u),A=this.volumeObject3D;if(A){f.enable(f.BLEND),f.blendFunc(f.SRC_ALPHA,f.ONE_MINUS_SRC_ALPHA),f.enable(f.CULL_FACE),f.cullFace(f.FRONT);let v=this.renderShader;if(this.uiData.mouseDepthPicker&&(v=this.pickingImageShader),v.use(this.gl),f.uniform1i(v.uniforms.backgroundMasksOverlays,this.backgroundMasksOverlays),this.gradientTextureAmount>0){f.activeTexture(TEXTURE6_GRADIENT),f.bindTexture(f.TEXTURE_3D,this.gradientTexture);const y=this.calculateModelMatrix(s,u),T=create$3();invert(T,y);const E=create$3();transpose$3(E,T),f.uniformMatrix4fv(v.uniforms.normMtx,!1,E)}this.drawBitmap&&this.drawBitmap.length>8?f.uniform2f(v.uniforms.renderDrawAmbientOcclusionXY,this.renderDrawAmbientOcclusion,this.drawOpacity):f.uniform2f(v.uniforms.renderDrawAmbientOcclusionXY,this.renderDrawAmbientOcclusion,0),f.uniformMatrix4fv(v.uniforms.mvpMtx,!1,n),f.uniformMatrix4fv(v.uniforms.matRAS,!1,this.back.matRAS),f.uniform3fv(v.uniforms.rayDir,m),this.gradientTextureAmount<0?f.uniform4fv(v.uniforms.clipPlane,[this.scene.crosshairPos[0],this.scene.crosshairPos[1],this.scene.crosshairPos[2],30]):f.uniform4fv(v.uniforms.clipPlane,this.scene.clipPlane),f.uniform1f(v.uniforms.drawOpacity,1),f.bindVertexArray(A.vao),f.drawElements(A.mode,A.indexCount,f.UNSIGNED_SHORT,0),f.bindVertexArray(this.unusedVAO)}}drawOrientationCube(n,s=0,u=0){if(!this.opts.isOrientCube)return;const f=.05*Math.min(n[2],n[3]);if(f<5)return;const m=this.gl;m.enable(m.CULL_FACE),m.cullFace(m.BACK),this.orientCubeShader.use(this.gl),m.bindVertexArray(this.orientCubeShaderVAO);const A=create$3(),v=create$3();ortho(v,0,m.canvas.width,0,m.canvas.height,-10*f,10*f);let y=0;n[1]===0&&(y=m.canvas.height-this.effectiveCanvasHeight()),translate(A,A,[1.8*f+n[0],y+1.8*f+n[1],0]),scale$4(A,A,[f,f,f]),rotateX(A,A,deg2rad(270-u)),rotateZ(A,A,deg2rad(-s));const T=create$3();multiply$2(T,v,A),m.uniformMatrix4fv(this.orientCubeShader.uniforms.u_matrix,!1,T),m.drawArrays(m.TRIANGLE_STRIP,0,168),m.bindVertexArray(this.unusedVAO),this.gl.disable(this.gl.CULL_FACE)}createOnLocationChange(n=NaN){const[s,u,f]=this.sceneExtentsMinMax(!0),m=Math.max(Math.max(f[0],f[1]),f[2]);function A(I){return Math.max(0,-Math.ceil(Math.log10(Math.abs(I))))}let v=A(m*.001);const y=this.frac2mm(this.scene.crosshairPos,0,!0);function T(I,e=0){return parseFloat(I.toFixed(e))}let E=T(y[0],v)+"×"+T(y[1],v)+"×"+T(y[2],v);if(this.volumes.length>0&&this.volumes[0].nFrame4D>0&&(E+="×"+T(this.volumes[0].frame4D)),this.volumes.length>0){let I=" = ";for(let M=0;M=0&&B=0&&(I+="+"),I+=T(V,v)),I+=" "}E+=I;const e=this.back.dimsRAS,F=e[1]*e[2]*e[3];if(this.drawBitmap&&this.drawBitmap.length===F){const M=this.frac2vox(this.scene.crosshairPos),L=M[0]+M[1]*e[1]+M[2]*e[1]*e[2];E+=" "+this.drawLut.labels[this.drawBitmap[L]]}}const S={mm:this.frac2mm(this.scene.crosshairPos,0,!0),axCorSag:n,vox:this.frac2vox(this.scene.crosshairPos),frac:this.scene.crosshairPos,xy:[this.mousePos[0],this.mousePos[1]],values:this.volumes.map(I=>{const e=this.frac2mm(this.scene.crosshairPos,0,!0),F=I.mm2vox(e),M=I.getValue(F[0],F[1],F[2],I.frame4D);return{name:I.name,value:M,id:I.id,mm:e,vox:F}}),string:E};this.onLocationChange(S)}addLabel(n,s,u){const f={textColor:this.opts.legendTextColor,textScale:1,textAlignment:"left",lineWidth:0,lineColor:this.opts.legendTextColor,lineTerminator:"none",bulletScale:0,bulletColor:this.opts.legendTextColor},m=s?{...f,...s}:{...f},A=new NVLabel3D(n,m,u);return this.document.labels.push(A),A}calculateScreenPoint(n,s,u){const f=create$1();return transformMat4(f,[...n,1],s),f[3]!==0&&(f[0]=(f[0]/f[3]+1)*.5*u[2],f[1]=(1-f[1]/f[3])*.5*u[3],f[2]/=f[3],f[0]+=u[0],f[1]+=u[1]),f}getLabelAtPoint(n){log$4.debug("screenPoint",n);const s=this.getLegendPanelHeight(),u=this.getLegendPanelWidth(),f=this.gl.canvas.width-u;let m=(this.canvas.height-s)/2;if(log$4.debug("panelrect",f,m,f+u,m+s),n[0]f+u||n[1]>m+s)return null;const v=this.opts.textHeight*Math.min(this.gl.canvas.height,this.gl.canvas.width)*1,y=this.getAllLabels();for(const T of y){const E=this.opts.textHeight*this.gl.canvas.height*T.style.textScale,S=this.textHeight(E,T.text);if(n[1]>=m&&n[1]<=m+S+v/2)return T;m+=S,m+=v/2}return null}drawLabelLine(n,s,u,f,m=!1){const A=Array.isArray(n.points)&&Array.isArray(n.points[0])?n.points:[n.points];for(const v of A){const y=this.calculateScreenPoint(v,u,f);m?this.drawDottedLine([...s,y[0],y[1]],n.style.lineWidth,n.style.lineColor):this.draw3DLine(s,[y[0],y[1],y[2]],n.style.lineWidth,n.style.lineColor)}}draw3DLabel(n,s,u,f,m=0,A,v=!1){const y=n.text,T=s[0],E=s[1],S=this.opts.textHeight*Math.min(this.gl.canvas.height,this.gl.canvas.width)*1,I=this.textHeight(n.style.textScale,y)*S;if(n.style.lineWidth>0&&Array.isArray(n.points)&&this.drawLabelLine(n,[T,E+I],u,f,v),n.style.bulletScale){const F=n.style.bulletScale*I,M=I-F,L=E+M/2+F/2,V=T+(m-F)/2;this.drawCircle([V,L,F,F],n.style.bulletColor)}let e=T;if(n.style.textAlignment!=="left"){const F=this.textWidth(n.style.textScale,n.text)*S;if(n.style.textAlignment==="right")e=T+A-S*1.5-F;else{const M=A-(m||S);e+=(M-F)/2}}else e+=m;this.drawText([e,E],y,n.style.textScale,n.style.textColor)}draw3DLabels(n,s,u=!1){const f=this.getAllLabels();if(!this.opts.showLegend||f.length===0)return;if(!this.canvas)throw new Error("canvas undefined");const m=this.gl;m.disable(m.CULL_FACE),m.viewport(0,0,this.canvas.width,this.canvas.height);const v=this.opts.textHeight*Math.min(this.gl.canvas.height,this.gl.canvas.width)*1,y=this.getBulletMarginWidth(),T=this.getLegendPanelHeight(),E=this.getLegendPanelWidth(),S=m.canvas.width-E;let I=(this.canvas.height-T)/2;this.drawRect([m.canvas.width-E,I,E-v,T],this.opts.legendBackgroundColor);const e=m.getParameter(m.BLEND),F=m.getParameter(m.DEPTH_FUNC);u||(m.disable(m.BLEND),m.depthFunc(m.GREATER));for(const M of f){this.draw3DLabel(M,[S,I],n,s,y,E,u);const L=this.opts.textHeight*this.gl.canvas.height*M.style.textScale,V=this.textHeight(L,M.text);I+=V,I+=v/2}u||(m.depthFunc(F),e&&m.enable(m.BLEND))}draw3D(n=[0,0,0,0],s=null,u=null,f=null,m=null,A=0){const v=m!==null;this.setPivot3D(),v||(m=this.scene.renderAzimuth,A=this.scene.renderElevation);const y=this.gl;s===null&&([s,u,f]=this.calculateMvpMatrix(null,n,m,A));let T=[...n];if(n[2]===0||n[3]===0?(n=[0,0,y.canvas.width,y.canvas.height],T=[...n],this.screenSlices.push({leftTopWidthHeight:n,axCorSag:4,sliceFrac:0,AxyzMxy:[],leftTopMM:[],fovMM:[isRadiological(u),0]})):(this.screenSlices.push({leftTopWidthHeight:n.slice(),axCorSag:4,sliceFrac:0,AxyzMxy:[],leftTopMM:[],fovMM:[isRadiological(u),0]}),n[1]=y.canvas.height-n[3]-n[1]),y.enable(y.DEPTH_TEST),y.depthFunc(y.ALWAYS),y.depthMask(!0),y.clearDepth(0),this.draw3DLabels(s,T,!1),y.viewport(n[0],n[1],n[2],n[3]),this.volumes.length>0&&(this.updateInterpolation(0,!0),this.updateInterpolation(1,!0),this.drawImage3D(s,m,A)),this.updateInterpolation(0),this.updateInterpolation(1),v||this.drawCrosshairs3D(!0,1,s),this.drawMesh3D(!0,1,s,u,f),this.uiData.mouseDepthPicker){this.depthPicker(n,s),this.createOnLocationChange(),this.draw3D(n,s,u,f,m,A);return}this.opts.meshXRay>0&&this.drawMesh3D(!1,this.opts.meshXRay,s,u,f),this.draw3DLabels(s,T,!1),y.viewport(n[0],n[1],n[2],n[3]),v||this.drawCrosshairs3D(!1,.15,s),y.viewport(0,0,y.canvas.width,y.canvas.height),this.drawOrientationCube(n,m,A);const E="azimuth: "+this.scene.renderAzimuth.toFixed(0)+" elevation: "+this.scene.renderElevation.toFixed(0);return this.readyForSync=!0,this.sync(),this.draw3DLabels(s,T,!0),E}drawMesh3D(n=!0,s=1,u,f,m){if(this.meshes.length<1)return;const A=this.gl;u||([u,f,m]=this.calculateMvpMatrix(this.volumeObject3D,void 0,this.scene.renderAzimuth,this.scene.renderElevation)),A.enable(A.DEPTH_TEST),A.blendFunc(A.SRC_ALPHA,A.ONE_MINUS_SRC_ALPHA),A.disable(A.BLEND),A.depthFunc(A.GREATER),A.disable(A.CULL_FACE),n?(A.disable(A.BLEND),A.depthFunc(A.GREATER)):(A.enable(A.BLEND),A.depthFunc(A.ALWAYS),A.enable(A.CULL_FACE)),A.cullFace(A.BACK);let v=this.meshShaders[0].shader,y=!1;for(let T=0;T=3&&this.meshes[T].fiberRadius>0||(A.bindVertexArray(this.meshes[T].vaoFiber),A.drawElements(A.LINE_STRIP,this.meshes[T].indexCount,A.UNSIGNED_INT,0),A.bindVertexArray(this.unusedVAO)));A.enable(A.BLEND),A.depthFunc(A.ALWAYS),this.readyForSync=!0}drawCrosshairs3D(n=!0,s=1,u=null,f=!1,m=!0){if(!this.opts.show3Dcrosshair&&!f||this.opts.crosshairWidth<=0&&f)return;const A=this.gl,v=this.frac2mm(this.scene.crosshairPos,0,m);if(this.crosshairs3D===null||this.crosshairs3D.mm[0]!==v[0]||this.crosshairs3D.mm[1]!==v[1]||this.crosshairs3D.mm[2]!==v[2]){this.crosshairs3D!==null&&(A.deleteBuffer(this.crosshairs3D.indexBuffer),A.deleteBuffer(this.crosshairs3D.vertexBuffer));const[E,S,I]=this.sceneExtentsMinMax(m);let e=1;if(this.volumes.length>0){if(!this.back)throw new Error("back undefined");e=.5*Math.min(Math.min(this.back.pixDims[1],this.back.pixDims[2]),this.back.pixDims[3])}else(I[0]<50||I[0]>1e3)&&(e=I[0]*.02);e*=this.opts.crosshairWidth,this.crosshairs3D=NiivueObject3D.generateCrosshairs(this.gl,1,v,E,S,e,20,this.opts.crosshairGap),this.crosshairs3D.mm=v}if(!this.surfaceShader)throw new Error("surfaceShader undefined");const y=this.surfaceShader;y.use(this.gl),u==null&&([u]=this.calculateMvpMatrix(this.crosshairs3D,void 0,this.scene.renderAzimuth,this.scene.renderElevation)),A.uniformMatrix4fv(y.uniforms.mvpMtx,!1,u),A.bindBuffer(A.ELEMENT_ARRAY_BUFFER,this.crosshairs3D.indexBuffer),A.enable(A.DEPTH_TEST);const T=[...this.opts.crosshairColor];n?(A.disable(A.BLEND),A.depthFunc(A.GREATER)):(A.enable(A.BLEND),A.blendFunc(A.SRC_ALPHA,A.ONE_MINUS_SRC_ALPHA),A.depthFunc(A.ALWAYS)),T[3]=s,A.uniform4fv(y.uniforms.surfaceColor,T),A.bindVertexArray(this.crosshairs3D.vao),A.drawElements(A.TRIANGLES,this.crosshairs3D.indexCount,A.UNSIGNED_INT,0),A.bindVertexArray(this.unusedVAO)}mm2frac(n,s=0,u=!1){if(this.volumes.length<1){const f=fromValues$2(.1,.5,.5),[m,A,v]=this.sceneExtentsMinMax();return f[0]=(n[0]-m[0])/v[0],f[1]=(n[1]-m[1])/v[1],f[2]=(n[2]-m[2])/v[2],isFinite(f)||(isFinite(f[0])||(f[0]=.5),isFinite(f[1])||(f[1]=.5),isFinite(f[2])||(f[2]=.5),this.meshes.length<1&&log$4.error("mm2frac() not finite: objects not (yet) loaded.")),f}return this.volumes[s].convertMM2Frac(n,u||this.opts.isSliceMM)}vox2frac(n,s=0){return this.volumes[s].convertVox2Frac(n)}frac2vox(n,s=0){return this.volumes.length<=s?[0,0,0]:this.volumes[s].convertFrac2Vox(n)}moveCrosshairInVox(n,s,u){const f=this.frac2vox(this.scene.crosshairPos);f[0]+=n,f[1]+=s,f[2]+=u,f[0]=clamp$1(f[0],0,this.volumes[0].dimsRAS[1]-1),f[1]=clamp$1(f[1],0,this.volumes[0].dimsRAS[2]-1),f[2]=clamp$1(f[2],0,this.volumes[0].dimsRAS[3]-1),this.scene.crosshairPos=this.vox2frac(f),this.createOnLocationChange(),this.drawScene()}frac2mm(n,s=0,u=!1){const f=fromValues$1(n[0],n[1],n[2],1);if(this.volumes.length>0)return this.volumes[s].convertFrac2MM(n,u||this.opts.isSliceMM);{const[m,A]=this.sceneExtentsMinMax(),v=(y,T,E)=>y*(1-E)+T*E;f[0]=v(m[0],A[0],n[0]),f[1]=v(m[1],A[1],n[1]),f[2]=v(m[2],A[2],n[2])}return f}screenXY2TextureFrac(n,s,u,f=!0){const m=fromValues$2(-1,-1,-1),A=this.screenSlices[u].axCorSag;if(A>2)return m;const v=this.screenSlices[u].leftTopWidthHeight.slice();let y=!1;v[2]<0&&(y=!0,v[0]+=v[2],v[2]=-v[2]);let T=(n-v[0])/v[2];y&&(T=1-T);const E=1-(s-v[1])/v[3];if(T<0||T>1||E<0||E>1||this.screenSlices[u].AxyzMxy.length<4)return m;let S=fromValues$2(0,0,0);S[0]=this.screenSlices[u].leftTopMM[0]+T*this.screenSlices[u].fovMM[0],S[1]=this.screenSlices[u].leftTopMM[1]+E*this.screenSlices[u].fovMM[1];const I=this.screenSlices[u].AxyzMxy;S[2]=I[2]+I[4]*(S[1]-I[1])-I[3]*(S[0]-I[0]),A===1&&(S=swizzleVec3(S,[0,2,1])),A===2&&(S=swizzleVec3(S,[2,0,1]));const e=this.mm2frac(S);return f&&(e[0]<0||e[0]>1||e[1]<0||e[1]>1||e[2]<0||e[2]>1)?m:e}canvasPos2frac(n){for(let s=0;s=0)return u}return[-1,-1,-1]}scaleSlice(n,s,u=0,f=0){const m=this.effectiveCanvasWidth()-u,A=this.effectiveCanvasHeight()-f;let v=m/n;s*v>A&&(v=A/s);const y=n*v,T=s*v;return[(m-y)*.5,(A-T)*.5,y,T,v]}drawThumbnail(){if(!this.bmpShader)throw new Error("bmpShader undefined");this.bmpShader.use(this.gl),this.gl.uniform2f(this.bmpShader.uniforms.canvasWidthHeight,this.gl.canvas.width,this.gl.canvas.height);let n=this.gl.canvas.height,s=this.gl.canvas.height*this.bmpTextureWH;s>this.gl.canvas.width&&(n=this.gl.canvas.width/this.bmpTextureWH,s=this.gl.canvas.width),this.gl.uniform4f(this.bmpShader.uniforms.leftTopWidthHeight,0,0,s,n),this.gl.bindVertexArray(this.genericVAO),this.gl.drawArrays(this.gl.TRIANGLE_STRIP,0,4),this.gl.bindVertexArray(this.unusedVAO)}drawLine(n,s=1,u=[1,0,0,-1]){if(this.gl.bindVertexArray(this.genericVAO),!this.lineShader)throw new Error("lineShader undefined");this.lineShader.use(this.gl),u[3]<0&&(u=this.opts.crosshairColor),this.gl.uniform4fv(this.lineShader.uniforms.lineColor,u),this.gl.uniform2fv(this.lineShader.uniforms.canvasWidthHeight,[this.gl.canvas.width,this.gl.canvas.height]),this.gl.uniform1f(this.lineShader.uniforms.thickness,s),this.gl.uniform4fv(this.lineShader.uniforms.startXYendXY,n),this.gl.drawArrays(this.gl.TRIANGLE_STRIP,0,4),this.gl.bindVertexArray(this.unusedVAO)}draw3DLine(n,s,u=1,f=[1,0,0,-1]){if(this.gl.bindVertexArray(this.genericVAO),!this.line3DShader)throw new Error("line3DShader undefined");this.line3DShader.use(this.gl),f[3]<0&&(f=this.opts.crosshairColor),this.gl.uniform4fv(this.line3DShader.uniforms.lineColor,f),this.gl.uniform2fv(this.line3DShader.uniforms.canvasWidthHeight,[this.gl.canvas.width,this.gl.canvas.height]),this.gl.uniform1f(this.line3DShader.uniforms.thickness,u),this.gl.uniform2fv(this.line3DShader.uniforms.startXY,n),this.gl.uniform3fv(this.line3DShader.uniforms.endXYZ,s),this.gl.drawArrays(this.gl.TRIANGLE_STRIP,0,4),this.gl.bindVertexArray(this.unusedVAO)}drawDottedLine(n,s=1,u=[1,0,0,-1]){if(this.gl.bindVertexArray(this.genericVAO),!this.lineShader)throw new Error("lineShader undefined");this.lineShader.use(this.gl);const f=u[3]<0?[...this.opts.crosshairColor]:[...u];f[3]=.3;const m=fromValues(n[2]-n[0],n[3]-n[1]),A=length(m);normalize(m,m);const y=this.opts.textHeight*Math.min(this.gl.canvas.height,this.gl.canvas.width)*1;scale$1(m,m,y/2);const T=length(m);let E=Math.floor(A/T);A%T&&E++;const S=[n[0],n[1]];this.gl.uniform4fv(this.lineShader.uniforms.lineColor,f),this.gl.uniform2fv(this.lineShader.uniforms.canvasWidthHeight,[this.gl.canvas.width,this.gl.canvas.height]),this.gl.uniform1f(this.lineShader.uniforms.thickness,s);for(let I=0;I0&&s===0){const e=v,F=1;for(let M=0;M0&&s===1){const e=v,F=2;for(let M=0;M0&&s===2){const e=v,F=2;for(let M=0;M0&&s===0){const e=v,F=0;for(let M=0;M0&&s===1){const e=v,F=0;for(let M=0;M0&&s===2){const e=v,F=1;for(let M=0;M0){const T=A.leftTopWidthHeight.slice();let E=2;s===0&&(E=1);const S=this.frac2mm([.5,.5,.5]);for(let I=0;I0){const T=A.leftTopWidthHeight.slice(),E=A.fovMM[0]<0;let S=0;s===2&&(S=1);const I=this.frac2mm([.5,.5,.5]);for(let e=0;e"u"){if(this.meshes.length>0){this.screenSlices=[],this.opts.sliceType=4,this.draw3D(),this.opts.isColorbar&&this.drawColorbar();return}this.drawLoadingText(this.loadingText);return}if(this.back===null)return;if(this.uiData.isDragging&&this.scene.clipPlaneDepthAziElev[0]<1.8&&this.inRenderTile(this.uiData.dragStart[0],this.uiData.dragStart[1])>=0){const m=this.uiData.dragStart[0]-this.uiData.dragEnd[0],A=this.uiData.dragStart[1]-this.uiData.dragEnd[1],v=this.uiData.dragClipPlaneStartDepthAziElev.slice();if(v[1]-=m,v[1]=v[1]%360,v[2]+=A,v[1]!==this.scene.clipPlaneDepthAziElev[1]||v[2]!==this.scene.clipPlaneDepthAziElev[2])return this.scene.clipPlaneDepthAziElev=v,this.setClipPlane(this.scene.clipPlaneDepthAziElev)}if(this.sliceMosaicString.length<1&&this.opts.sliceType===4){this.opts.isColorbar&&this.reserveColorbarPanel(),this.screenSlices=[],this.draw3D(),this.opts.isColorbar&&this.drawColorbar();return}this.opts.isColorbar&&this.reserveColorbarPanel();const s=this.getMaxVols(),u=this.opts.sliceType===3&&s>1&&this.graph.autoSizeMultiplanar&&this.graph.opacity>0;if(this.sliceMosaicString.length>0)this.drawMosaic(this.sliceMosaicString);else if(this.gl.viewport(0,0,this.gl.canvas.width,this.gl.canvas.height),this.screenSlices=[],this.opts.sliceType===0)this.draw2D([0,0,0,0],0);else if(this.opts.sliceType===1)this.draw2D([0,0,0,0],1);else if(this.opts.sliceType===2)this.draw2D([0,0,0,0],2);else{const m=isFinite(this.drawPenLocation[0])&&this.opts.drawingEnabled,{volScale:A}=this.sliceScale();typeof this.opts.multiplanarPadPixels!="number"&&log$4.debug("multiplanarPadPixels must be numeric");const v=parseFloat(`${this.opts.multiplanarPadPixels}`),y=this.scaleSlice(A[0]+A[1],A[1]+A[2],v*1,v*1),T=Math.max(Math.max(A[1],A[2]),A[0]),E=this.scaleSlice(A[0]+A[0]+A[1],Math.max(A[1],A[2]),v*2),S=this.scaleSlice(A[0]+A[0]+A[1]+T,Math.max(A[1],A[2]),v*3),I=this.scaleSlice(T,A[1]+A[2]+A[2],0,v*2),e=this.scaleSlice(T,A[1]+A[2]+A[2]+T,0,v*3);let F=!m&&(s<2||!u),M=!1,L=!1,V=!1;if(this.opts.multiplanarLayout===1?M=!0:this.opts.multiplanarLayout===2?L=!0:this.opts.multiplanarLayout===3?V=!0:I[4]>E[4]&&I[4]>y[4]?M=!0:E[4]>y[4]?V=!0:L=!0,M){let B=I;this.opts.multiplanarForceRender||e[4]>=I[4]?B=e:F=!1;const z=A[0]*B[4],b=A[1]*B[4],W=A[2]*B[4],q=T*B[4];this.draw2D([B[0],B[1],z,b],0),this.draw2D([B[0],B[1]+b+v,z,W],1),this.draw2D([B[0],B[1]+b+v+W+v,b,W],2),F&&this.draw3D([B[0],B[1]+b+W+W+v*3,q,q])}else if(V){let B=E;this.opts.multiplanarForceRender||S[4]>=E[4]?B=S:F=!1;const z=A[0]*B[4],b=A[1]*B[4],W=A[2]*B[4];this.draw2D([B[0],B[1],z,b],0),this.draw2D([B[0]+z+v,B[1],z,W],1),this.draw2D([B[0]+z+z+v*2,B[1],b,W],2),F&&this.draw3D([B[0]+z+z+b+v*3,B[1],B[3],B[3]])}else if(L){const B=y,z=A[0]*B[4],b=A[1]*B[4],W=A[2]*B[4];this.draw2D([B[0],B[1]+W+v,z,b],0),this.draw2D([B[0],B[1],z,W],1),this.draw2D([B[0]+z+v,B[1],b,W],2),F&&this.draw3D([B[0]+z+v,B[1]+W+v,b,b])}}if(this.opts.isRuler&&this.drawRuler(),this.opts.isColorbar&&this.drawColorbar(),u&&this.drawGraph(),this.uiData.isDragging){if(this.uiData.mouseButtonCenterDown){this.dragForCenterButton([this.uiData.dragStart[0],this.uiData.dragStart[1],this.uiData.dragEnd[0],this.uiData.dragEnd[1]]);return}if(this.opts.dragMode===4){this.dragForSlicer3D([this.uiData.dragStart[0],this.uiData.dragStart[1],this.uiData.dragEnd[0],this.uiData.dragEnd[1]]);return}if(this.opts.dragMode===3){this.dragForPanZoom([this.uiData.dragStart[0],this.uiData.dragStart[1],this.uiData.dragEnd[0],this.uiData.dragEnd[1]]);return}if(this.inRenderTile(this.uiData.dragStart[0],this.uiData.dragStart[1])>=0)return;if(this.opts.dragMode===2){this.drawMeasurementTool([this.uiData.dragStart[0],this.uiData.dragStart[1],this.uiData.dragEnd[0],this.uiData.dragEnd[1]]);return}const m=Math.abs(this.uiData.dragStart[0]-this.uiData.dragEnd[0]),A=Math.abs(this.uiData.dragStart[1]-this.uiData.dragEnd[1]);this.drawSelectionBox([Math.min(this.uiData.dragStart[0],this.uiData.dragEnd[0]),Math.min(this.uiData.dragStart[1],this.uiData.dragEnd[1]),m,A])}const f=this.frac2mm([this.scene.crosshairPos[0],this.scene.crosshairPos[1],this.scene.crosshairPos[2]]);return n=f[0].toFixed(2)+"×"+f[1].toFixed(2)+"×"+f[2].toFixed(2),this.readyForSync=!0,this.sync(),n}drawScene(){if(this.isBusy){this.needsRefresh=!0;return}this.isBusy=!1,this.needsRefresh=!1;let n=this.drawSceneCore();return this._gl!==null&&this.gl.finish(),this.needsRefresh&&(n=this.drawScene()),n}get gl(){if(!this._gl)throw new Error("unable to get WebGL context. Maybe the browser doesn't support WebGL2.");return this._gl}set gl(n){this._gl=n}};/** + `}saveHTML(n="untitled.html",s="gl1",u){const f=this.generateHTML(s,u);NVUtilities.download(f,n,"application/html")}json(){this.document.opts=this.opts,this.document.scene=this.scene,this.document.volumes=this.volumes,this.document.meshes=this.meshes,this.drawScene(),this.document.previewImageDataURL=this.canvas.toDataURL();const n=this.document.json();return n.sceneData={...this.scene},n}async saveDocument(n="untitled.nvd"){this.document.opts=this.opts,this.document.scene=this.scene,this.document.title=n,log$4.debug("saveDocument",this.volumes[0]),this.drawScene(),this.document.previewImageDataURL=this.canvas.toDataURL(),this.document.download(n)}async loadVolumes(n){if(this.loadingText="loading...",this.drawScene(),this.thumbnailVisible)return this.deferredVolumes=n,this;this.volumes=[],this.gl.clearColor(0,0,0,1),this.gl.clear(this.gl.COLOR_BUFFER_BIT);for(let s=0;s0&&(m[W]=T);const E=this.r16Tex(null,TEXTURE12_GC_STRENGTH0,this.back.dims,m),S=this.r16Tex(null,TEXTURE13_GC_STRENGTH1,this.back.dims,m);s.bindVertexArray(this.genericVAO);const I=this.growCutShader;I.use(s);const e=128;s.uniform1i(I.uniforms.finalPass,0),s.uniform1i(I.uniforms.backTex,11);for(let W=0;Wn[0]&&(v=1),s[1]>n[1]&&(y=1),s[2]>n[2]&&(T=1);let E=n[0],S=n[1],I=n[2];const e=s[0],F=s[1],M=s[2];if(f>=m&&f>=A){let L=2*m-f,V=2*A-f;for(;E!==e;)E+=v,L>=0&&(S+=y,L-=2*f),V>=0&&(I+=T,V-=2*f),L+=2*m,V+=2*A,this.drawPt(E,S,I,u)}else if(m>=f&&m>=A){let L=2*f-m,V=2*A-m;for(;S!==F;)S+=y,L>=0&&(E+=v,L-=2*m),V>=0&&(I+=T,V-=2*m),L+=2*f,V+=2*A,this.drawPt(E,S,I,u)}else{let L=2*m-A,V=2*f-A;for(;I!==M;)I+=T,L>=0&&(S+=y,L-=2*A),V>=0&&(E+=v,V-=2*A),L+=2*m,V+=2*f,this.drawPt(E,S,I,u)}}drawFloodFillCore(n,s,u=6){var E;if(!((E=this.back)!=null&&E.dims))throw new Error("back.dims undefined");const f=[this.back.dims[1],this.back.dims[2],this.back.dims[3]],m=f[0],A=m*f[1];function v(S){return S[0]+S[1]*m+S[2]*A}function y(S){const I=Math.floor(S/A),e=Math.floor((S-I*A)/m);return[Math.floor(S%m),e,I]}const T=[];for(T.push(s),n[s]=2;T.length>0;){let S=function(F){const M=e.slice();if(M[0]+=F[0],M[1]+=F[1],M[2]+=F[2],M[0]<0||M[1]<0||M[2]<0||M[0]>=f[0]||M[1]>=f[1]||M[2]>=f[2])return;const L=v(M);n[L]===1&&(n[L]=2,T.push(L))};const I=T[0];T.shift();const e=y(I);S([0,0,-1]),S([0,0,1]),S([0,-1,0]),S([0,1,0]),S([-1,0,0]),S([1,0,0]),!(u<=6)&&(S([-1,-1,0]),S([1,1,0]),S([-1,1,0]),S([1,1,0]),S([0,-1,-1]),S([0,1,-1]),S([-1,0,-1]),S([1,0,-1]),S([0,-1,1]),S([0,1,1]),S([-1,0,1]),S([1,0,1]),!(u<=18)&&(S([-1,-1,-1]),S([1,-1,-1]),S([-1,1,-1]),S([1,1,-1]),S([-1,-1,1]),S([1,-1,1]),S([-1,1,1]),S([1,1,1])))}}drawFloodFill(n,s=0,u=0,f=NaN,m=NaN,A=6){var M;if(!this.drawBitmap)throw new Error("drawBitmap undefined");if(!((M=this.back)!=null&&M.dims))throw new Error("back.dims undefined");s=Math.abs(s);const v=[this.back.dims[1],this.back.dims[2],this.back.dims[3]];if(n[0]<0||n[1]<0||n[2]<0||n[0]>=v[0]||n[1]>=v[1]||n[2]>=v[2])return;const y=v[0],T=y*v[1],E=T*v[2],S=this.drawBitmap.slice();if(S.length!==T*v[2])return;function I(L){return L[0]+L[1]*y+L[2]*T}const e=I(n),F=S[e];if(F===s){u!==0?log$4.debug("drawFloodFill selected voxel is not part of a drawing"):log$4.debug("drawFloodFill selected voxel is already desired color");return}for(let L=1;L=B&&L[z]<=V&&(S[z]=1);this.drawFloodFillCore(S,e,A),s=F}for(let L=1;LM[0]&&(z=1),L[1]>M[1]&&(b=1);let W=M[0],q=M[1];const Y=L[0],X=L[1];if(V>=B){let Q=2*B-V;for(;W!==Y;)W+=z,Q>=0&&(q+=b,Q-=2*V),Q+=2*B,A[W+q*m[0]]=v}else{let Q=2*V-B;for(;q!==X;)q+=b,Q>=0&&(W+=z,Q-=2*B),Q+=2*V,A[W+q*m[0]]=v}}const T=[this.drawPenFillPts[0][u],this.drawPenFillPts[0][f]];let E=T;for(let M=1;M=m[0]||M[1]>=m[1])return;const L=M[0]+M[1]*m[0];A[L]===0&&(S.push(M),A[L]=2)}for(let M=0;M0;){const M=S.shift();I([M[0]-1,M[1]]),I([M[0]+1,M[1]]),I([M[0],M[1]-1]),I([M[0],M[1]+1])}v=this.opts.penValue;const e=this.drawPenFillPts[0][3-(u+f)];if(!this.drawBitmap)throw new Error("drawBitmap undefined");if(s===0){const M=e*m[0]*m[1];for(let L=0;L0){const M=this.drawBitmap.length,L=decodeRLE(this.drawUndoBitmaps[this.currentDrawUndoBitmap],M);for(let V=0;V{const m=new Image;m.onload=()=>{if(!this.bmpShader)return;let A;s===4?(this.bmpTexture!==null&&this.gl.deleteTexture(this.bmpTexture),this.bmpTexture=this.gl.createTexture(),A=this.bmpTexture,this.bmpTextureWH=m.width/m.height,this.gl.activeTexture(TEXTURE4_THUMBNAIL),this.bmpShader.use(this.gl),this.gl.uniform1i(this.bmpShader.uniforms.bmpTexture,4)):s===5?(this.gl.activeTexture(TEXTURE5_MATCAP),this.matCapTexture!==null&&this.gl.deleteTexture(this.matCapTexture),this.matCapTexture=this.gl.createTexture(),A=this.matCapTexture):(this.fontShader.use(this.gl),this.gl.activeTexture(TEXTURE3_FONT),this.gl.uniform1i(this.fontShader.uniforms.fontTexture,3),this.fontTexture!==null&&this.gl.deleteTexture(this.fontTexture),this.fontTexture=this.gl.createTexture(),A=this.fontTexture),this.gl.bindTexture(this.gl.TEXTURE_2D,A),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,this.gl.RGBA,this.gl.UNSIGNED_BYTE,m),u(A),s!==4&&this.drawScene()},m.onerror=f,this.requestCORSIfNotSameOrigin(m,n),m.src=n})}async loadFontTexture(n){return this.loadPngAsTexture(n,3)}async loadBmpTexture(n){return this.loadPngAsTexture(n,4)}async loadMatCapTexture(n){return this.loadPngAsTexture(n,5)}initFontMets(){if(!this.fontMetrics)throw new Error("fontMetrics undefined");this.fontMets={distanceRange:this.fontMetrics.atlas.distanceRange,size:this.fontMetrics.atlas.size,mets:{}};for(let u=0;u<256;u++)this.fontMets.mets[u]={xadv:0,uv_lbwh:[0,0,0,0],lbwh:[0,0,0,0]};const n=this.fontMetrics.atlas.width,s=this.fontMetrics.atlas.height;for(let u=0;u=this.meshes.length){log$4.debug("Unable to change shader until mesh is loaded (maybe you need async)");return}this.meshes[f].meshShaderIndex=u,this.updateGLVolume(),this.onMeshShaderChanged(f,u)}createCustomMeshShader(n,s="Custom"){if(!n)throw new Error("Need fragment shader");const u=this.meshShaderNameToNumber(s);u>=0&&(this.gl.deleteProgram(this.meshShaders[u].shader.program),this.meshShaders.splice(u,1));const f=new Shader(this.gl,vertMeshShader,n);return f.use(this.gl),{Name:s,Frag:n,shader:f}}setCustomMeshShader(n="",s="Custom"){const u=this.createCustomMeshShader(n,s);return this.meshShaders.push(u),this.onCustomMeshShaderAdded(n,s),this.meshShaders.length-1}meshShaderNames(n=!0){const s=[];for(let u=0;u0&&(await this.loadBmpTexture(this.opts.thumbnail),this.thumbnailVisible=!0),this.updateGLVolume(),this.initialized=!0,this.resizeListener(),this.drawScene(),this}gradientGL(n){const s=this.gl,u=[0,0,0,0,1,0,1,0,0,1,1,0],f=s.createVertexArray();s.bindVertexArray(f);const m=s.createBuffer();s.bindBuffer(s.ARRAY_BUFFER,m),s.bufferData(s.ARRAY_BUFFER,new Float32Array(u),s.STATIC_DRAW),s.enableVertexAttribArray(0),s.vertexAttribPointer(0,3,s.FLOAT,!1,0,0);const A=s.createFramebuffer();s.bindFramebuffer(s.FRAMEBUFFER,A),s.disable(s.CULL_FACE),s.viewport(0,0,n.dims[1],n.dims[2]),s.disable(s.BLEND);const v=this.rgbaTex(null,TEXTURE8_GRADIENT_TEMP,n.dims),y=this.blurShader;y.use(s),s.activeTexture(TEXTURE0_BACK_VOL),s.bindTexture(s.TEXTURE_3D,this.volumeTexture);const T=.7;s.uniform1i(y.uniforms.intensityVol,0),s.uniform1f(y.uniforms.dX,T/n.dims[1]),s.uniform1f(y.uniforms.dY,T/n.dims[2]),s.uniform1f(y.uniforms.dZ,T/n.dims[3]),s.bindVertexArray(f);for(let I=0;I0&&(this.furthestVertexFromOrigin=this.volumeObject3D.furthestVertexFromOrigin),this.meshes)for(let u=0;u0)for(let Y=0;Y0&&n.frame4D1&&m===0)return;let A=null;if(!this.back)throw new Error("back undefined");this.gl.bindVertexArray(this.unusedVAO),this.crosshairs3D&&(this.crosshairs3D.mm[0]=NaN);let v=clone$3(n.toRAS);if(s===0){this.volumeObject3D=n.toNiivueObject3D(this.VOLUME_ID,this.gl),invert(v,v),this.back.matRAS=n.matRAS,this.back.dims=n.dimsRAS,this.back.pixDims=n.pixDimsRAS,A=this.rgbaTex(this.volumeTexture,TEXTURE0_BACK_VOL,n.dimsRAS);const{volScale:q,vox:Y}=this.sliceScale(!0);if(this.volScale=q,this.vox=Y,this.volumeObject3D.scale=q,!this.renderShader)throw new Error("renderShader undefined");this.renderShader.use(this.gl),this.gl.uniform3fv(this.renderShader.uniforms.texVox,Y),this.gl.uniform3fv(this.renderShader.uniforms.volScale,q);const X=this.pickingImageShader;X.use(this.gl),this.gl.uniform1i(X.uniforms.volume,0),this.gl.uniform1i(X.uniforms.colormap,1),this.gl.uniform1i(X.uniforms.overlay,2),this.gl.uniform3fv(X.uniforms.volScale,q),log$4.debug(this.volumeObject3D)}else{((W=this.back)==null?void 0:W.dims)===void 0&&log$4.error("Fatal error: Unable to render overlay: background dimensions not defined!");const q=this.mm2frac(n.mm000,0,!0);let Y=this.mm2frac(n.mm100,0,!0),X=this.mm2frac(n.mm010,0,!0),Q=this.mm2frac(n.mm001,0,!0);Y=subtract$1(Y,Y,q),X=subtract$1(X,X,q),Q=subtract$1(Q,Q,q),v=fromValues$3(Y[0],X[0],Q[0],q[0],Y[1],X[1],Q[1],q[1],Y[2],X[2],Q[2],q[2],0,0,0,1),invert(v,v),s===1?(A=this.rgbaTex(this.overlayTexture,TEXTURE2_OVERLAY_VOL,this.back.dims),this.overlayTexture=A,this.overlayTextureID=A):A=this.overlayTextureID}const y=this.gl.createFramebuffer();this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,y),this.gl.disable(this.gl.CULL_FACE),this.gl.viewport(0,0,this.back.dims[1],this.back.dims[2]),this.gl.disable(this.gl.BLEND);const T=this.gl.createTexture();this.gl.activeTexture(TEXTURE9_ORIENT),this.gl.bindTexture(this.gl.TEXTURE_3D,T),this.gl.texParameteri(this.gl.TEXTURE_3D,this.gl.TEXTURE_MIN_FILTER,this.gl.NEAREST),this.gl.texParameteri(this.gl.TEXTURE_3D,this.gl.TEXTURE_MAG_FILTER,this.gl.NEAREST),this.gl.texParameteri(this.gl.TEXTURE_3D,this.gl.TEXTURE_WRAP_R,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_3D,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_3D,this.gl.TEXTURE_WRAP_T,this.gl.CLAMP_TO_EDGE),this.gl.pixelStorei(this.gl.UNPACK_ALIGNMENT,1);let E=this.orientShaderU;if(!u)throw new Error("hdr undefined");if(!f)throw new Error("img undefined");if(u.datatypeCode===2)u.intent_code===1002&&(E=this.orientShaderAtlasU),this.gl.texStorage3D(this.gl.TEXTURE_3D,1,this.gl.R8UI,u.dims[1],u.dims[2],u.dims[3]),this.gl.texSubImage3D(this.gl.TEXTURE_3D,0,0,0,0,u.dims[1],u.dims[2],u.dims[3],this.gl.RED_INTEGER,this.gl.UNSIGNED_BYTE,f);else if(u.datatypeCode===4)E=this.orientShaderI,u.intent_code===1002&&(E=this.orientShaderAtlasI),this.gl.texStorage3D(this.gl.TEXTURE_3D,1,this.gl.R16I,u.dims[1],u.dims[2],u.dims[3]),this.gl.texSubImage3D(this.gl.TEXTURE_3D,0,0,0,0,u.dims[1],u.dims[2],u.dims[3],this.gl.RED_INTEGER,this.gl.SHORT,f);else if(u.datatypeCode===16)this.gl.texStorage3D(this.gl.TEXTURE_3D,1,this.gl.R32F,u.dims[1],u.dims[2],u.dims[3]),this.gl.texSubImage3D(this.gl.TEXTURE_3D,0,0,0,0,u.dims[1],u.dims[2],u.dims[3],this.gl.RED,this.gl.FLOAT,f),E=this.orientShaderF;else if(u.datatypeCode===64){let q=new Float32Array;q=Float32Array.from(f),this.gl.texStorage3D(this.gl.TEXTURE_3D,1,this.gl.R32F,u.dims[1],u.dims[2],u.dims[3]),this.gl.texSubImage3D(this.gl.TEXTURE_3D,0,0,0,0,u.dims[1],u.dims[2],u.dims[3],this.gl.RED,this.gl.FLOAT,q),E=this.orientShaderF}else u.datatypeCode===128?(E=this.orientShaderRGBU,E.use(this.gl),this.gl.uniform1i(E.uniforms.hasAlpha,0),this.gl.texStorage3D(this.gl.TEXTURE_3D,1,this.gl.RGB8UI,u.dims[1],u.dims[2],u.dims[3]),this.gl.texSubImage3D(this.gl.TEXTURE_3D,0,0,0,0,u.dims[1],u.dims[2],u.dims[3],this.gl.RGB_INTEGER,this.gl.UNSIGNED_BYTE,f)):u.datatypeCode===512?(u.intent_code===1002&&(E=this.orientShaderAtlasU),this.gl.texStorage3D(this.gl.TEXTURE_3D,1,this.gl.R16UI,u.dims[1],u.dims[2],u.dims[3]),this.gl.texSubImage3D(this.gl.TEXTURE_3D,0,0,0,0,u.dims[1],u.dims[2],u.dims[3],this.gl.RED_INTEGER,this.gl.UNSIGNED_SHORT,f)):u.datatypeCode===2304&&(E=this.orientShaderRGBU,E.use(this.gl),this.gl.uniform1i(E.uniforms.hasAlpha,1),this.gl.texStorage3D(this.gl.TEXTURE_3D,1,this.gl.RGBA8UI,u.dims[1],u.dims[2],u.dims[3]),this.gl.texSubImage3D(this.gl.TEXTURE_3D,0,0,0,0,u.dims[1],u.dims[2],u.dims[3],this.gl.RGBA_INTEGER,this.gl.UNSIGNED_BYTE,f));n.global_min===void 0&&n.calMinMax();let S=null;if(this.gl.bindVertexArray(this.genericVAO),s>1){if(!this.back.dims)throw new Error("back.dims undefined");S=this.rgbaTex(S,TEXTURE10_BLEND,this.back.dims),this.gl.bindTexture(this.gl.TEXTURE_3D,S);const q=this.passThroughShader;q.use(this.gl),this.gl.uniform1i(q.uniforms.in3D,2);for(let Y=0;Y7){const q=n.colormapLabel.max-n.colormapLabel.min+1;I=this.createColormapTexture(I,1,q),this.gl.texSubImage2D(this.gl.TEXTURE_2D,0,0,0,q,1,this.gl.RGBA,this.gl.UNSIGNED_BYTE,n.colormapLabel.lut),this.gl.uniform1f(E.uniforms.cal_min,n.colormapLabel.min-.5),this.gl.uniform1f(E.uniforms.cal_max,n.colormapLabel.max+.5),this.gl.bindTexture(this.gl.TEXTURE_2D,I)}else this.gl.bindTexture(this.gl.TEXTURE_2D,this.colormapTexture),this.gl.uniform1f(E.uniforms.cal_min,n.cal_min),this.gl.uniform1f(E.uniforms.cal_max,n.cal_max);this.gl.uniform1i(E.uniforms.isAlphaThreshold,n.alphaThreshold),this.gl.uniform1i(E.uniforms.isAdditiveBlend,this.opts.isAdditiveBlend?1:0);let e=Number.POSITIVE_INFINITY,F=Number.NEGATIVE_INFINITY;if(n.colormapNegative.length>0&&(e=Math.min(-n.cal_min,-n.cal_max),F=Math.max(-n.cal_min,-n.cal_max),isFinite(n.cal_minNeg)&&isFinite(n.cal_maxNeg)&&(e=Math.min(n.cal_minNeg,n.cal_maxNeg),F=Math.max(n.cal_minNeg,n.cal_maxNeg))),!E)throw new Error("orientShader undefined");this.gl.uniform1f(E.uniforms.layer??null,s),this.gl.uniform1f(E.uniforms.cal_minNeg??null,e),this.gl.uniform1f(E.uniforms.cal_maxNeg??null,F),this.gl.bindTexture(this.gl.TEXTURE_3D,T),this.gl.uniform1i(E.uniforms.intensityVol??null,9),this.gl.uniform1i(E.uniforms.blend3D??null,10),this.gl.uniform1i(E.uniforms.colormap??null,1),this.gl.uniform1f(E.uniforms.scl_inter??null,u.scl_inter),this.gl.uniform1f(E.uniforms.scl_slope??null,u.scl_slope),this.gl.uniform1f(E.uniforms.opacity??null,m),this.gl.uniform1i(E.uniforms.modulationVol??null,7);let M=null;if(n.modulationImage!==null&&n.modulationImage>=0&&n.modulationImage0;let fe=this.volumes[n.modulationImage].cal_min,pe=this.volumes[n.modulationImage].cal_max;isFinite(this.volumes[n.modulationImage].cal_minNeg)&&isFinite(this.volumes[n.modulationImage].cal_maxNeg)&&(fe=this.volumes[n.modulationImage].cal_minNeg,pe=this.volumes[n.modulationImage].cal_minNeg),fe=Math.abs(fe),pe=Math.abs(pe),fe>pe&&([fe,pe]=[pe,fe]);const me=1/(pe-fe);let Se=Math.abs(n.modulateAlpha);Se=Math.max(Se,1);const ve=this.volumes[n.modulationImage].frame4D*Y;for(let we=0;we0?this.gradientGL(u):(this.gradientTexture!==null&&this.gl.deleteTexture(this.gradientTexture),this.gradientTexture=null)),!this.renderShader)throw new Error("renderShader undefined");this.renderShader.use(this.gl);const V=this.sliceScale(!0),B=V.vox,z=V.volScale;if(this.gl.uniform1f(this.renderShader.uniforms.overlays,this.overlays),this.gl.uniform4fv(this.renderShader.uniforms.clipPlaneColor,this.opts.clipPlaneColor),this.gl.uniform1f(this.renderShader.uniforms.backOpacity,this.volumes[0].opacity),this.gl.uniform1f(this.renderShader.uniforms.renderOverlayBlend,this.opts.renderOverlayBlend),this.gl.uniform4fv(this.renderShader.uniforms.clipPlane,this.scene.clipPlane),this.gl.uniform3fv(this.renderShader.uniforms.texVox,B),this.gl.uniform3fv(this.renderShader.uniforms.volScale,z),!this.pickingImageShader)throw new Error("pickingImageShader undefined");this.pickingImageShader.use(this.gl),this.gl.uniform1f(this.pickingImageShader.uniforms.overlays,this.overlays.length),this.gl.uniform3fv(this.pickingImageShader.uniforms.texVox,B);let b=this.sliceMMShader;if(this.opts.isV1SliceShader&&(b=this.sliceV1Shader),!b)throw new Error("slice shader undefined");b.use(this.gl),this.gl.uniform1f(b.uniforms.overlays,this.overlays.length),this.gl.uniform1f(b.uniforms.drawOpacity,this.drawOpacity),I!==null&&(this.gl.deleteTexture(I),this.gl.activeTexture(TEXTURE1_COLORMAPS),this.gl.bindTexture(this.gl.TEXTURE_2D,this.colormapTexture)),this.gl.uniform1i(b.uniforms.drawing,7),this.gl.activeTexture(TEXTURE7_DRAW),this.gl.bindTexture(this.gl.TEXTURE_3D,this.drawTexture),this.updateInterpolation(s)}colormaps(){return cmapper.colormaps()}addColormap(n,s){cmapper.addColormap(n,s)}setColormap(n,s){const u=this.getVolumeIndexByID(n);this.volumes[u].colormap=s,this.updateGLVolume()}idx(n,s,u,f){return u*f[0]*f[1]+s*f[0]+n}check_previous_slice(n,s,u,f,m,A,v,y){const T=new Uint32Array(27);let E=0;if(!m)return 0;const S=n[this.idx(u,f,m,A)];if(v>=6){const I=this.idx(u,f,m-1,A);S===n[I]&&(T[E++]=s[I])}if(v>=18){if(u){const I=this.idx(u-1,f,m-1,A);S===n[I]&&(T[E++]=s[I])}if(f){const I=this.idx(u,f-1,m-1,A);S===n[I]&&(T[E++]=s[I])}if(u=6){if(I){const M=this.idx(I-1,S,E,s);F===n[M]&&(T[e++]=y[M])}if(S){const M=this.idx(I,S-1,E,s);F===n[M]&&(T[e++]=y[M])}}if(u>=18){if(S&&I){const M=this.idx(I-1,S-1,E,s);F===n[M]&&(T[e++]=y[M])}if(S&&I=A){A+=m;const M=new Uint32Array(A);M.set(v),v=M}v[f-1]=f,f++}}}for(let E=0;E100){log$4.info(` +Ooh no!!`);break}m[y]=T,v=Math.min(v,T)}for(let y=0;y=1e-15&&E++;const S=1e3,I=(v-A)/S,e=new Array(S).fill(0);for(let z=0;z=M);)L++;const V=A;for(A=L*I+V,M=T-Math.floor((1-m)*E),L=0;L=M);)L++;v=L*I+V;let B=1;return A!==v&&(B=(u-s)/(v-A)),log$4.info(" Rescale: min: "+A+" max: "+v+" scale: "+B),[A,B]}conformVox2Vox(n,s,u=256,f=1,m=!1){const A=s.flat(),v=fromValues$3(A[0],A[1],A[2],A[3],A[4],A[5],A[6],A[7],A[8],A[9],A[10],A[11],A[12],A[13],A[14],A[15]),y=fromValues$1(n[1]/2,n[2]/2,n[3]/2,1),T=create$1(),E=create$3();transpose$3(E,v),transformMat4(T,y,E);const S=fromValues$2(T[0],T[1],T[2]),I=fromValues$2(f,f,f);let e=fromValues$3(-1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1);m&&(e=fromValues$3(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)),transpose$3(e,e);const F=fromValues$1(u,u,u,1),M=create$3();scale$4(M,e,I);const L=fromValues$1(F[0],F[1],F[2],1);transformMat4(L,L,M),scale$2(L,L,.5);const V=create$2();subtract$1(V,S,fromValues$2(L[0],L[1],L[2]));const B=create$3();transpose$3(B,M),B[3]=V[0],B[7]=V[1],B[11]=V[2];const z=create$3();invert(z,B);const b=create$3();mul$1(b,v,z);const W=create$3();return invert(W,b),[B,b,W]}async createNiftiArray(n=[256,256,256],s=[1,1,1],u=[1,0,0,-128,0,1,0,-128,0,0,1,-128,0,0,0,1],f=2,m=new Uint8Array){return await NVImage.createNiftiArray(n,s,u,f,m)}async niftiArray2NVImage(n=new Uint8Array){return await NVImage.loadFromUrl({url:n})}async loadFromUrl(n){return await NVImage.loadFromUrl({url:n})}async conform(n,s=!1,u=!0,f=!1){const v=this.conformVox2Vox(n.hdr.dims,n.hdr.affine.flat(),256,1,s),y=v[0],T=v[2],E=256*256*256,S=new Float32Array(E),I=new Float32Array(n.img),e=n.hdr.dims[1]*n.hdr.dims[2]*n.hdr.dims[3];if(n.hdr.scl_slope!==1||n.hdr.scl_inter!==0)for(let Q=0;Q=F||je>=M||nt>=L)continue;const Ue=pe-ve,ye=me-we,ut=Se-Ne,pt=1-Ue,It=1-ye,Lt=1-ut,Ot=z(ve,we,Ne);let Et=0;Et+=I[Ot]*pt*It*Lt,Et+=I[Ot+V]*pt*It*ut,Et+=I[Ot+F]*pt*ye*Lt,Et+=I[Ot+F+V]*pt*ye*ut,Et+=I[Ot+1]*Ue*It*Lt,Et+=I[Ot+1+V]*Ue*It*ut,Et+=I[Ot+1+F]*Ue*ye*Lt,Et+=I[Ot+1+F+V]*Ue*ye*ut,S[B]=Et}}else for(let Q=0;Q<256;Q++)for(let g=0;g<256;g++){const J=g*T[1]+Q*T[2]+T[3],re=g*T[5]+Q*T[6]+T[7],ae=g*T[9]+Q*T[10]+T[11];for(let fe=0;fe<256;fe++){const pe=Math.round(fe*b+J),me=Math.round(fe*W+re),Se=Math.round(fe*q+ae);B++,!(pe<0||me<0||Se<0)&&(pe>=F||me>=M||Se>=L||(S[B]=I[z(pe,me,Se)]))}}let Y=new Uint8Array;if(f){const Q=await this.getScale(n,0,1),g=await this.scalecropFloat32(S,0,1,Q[0],Q[1]);Y=await this.createNiftiArray([256,256,256],[1,1,1],Array.from(y),16,new Uint8Array(g.buffer))}else{const Q=await this.getScale(n,0,255),g=await this.scalecropUint8(S,0,255,Q[0],Q[1]);Y=await this.createNiftiArray([256,256,256],[1,1,1],Array.from(y),2,g)}return await this.niftiArray2NVImage(Y)}setRenderDrawAmbientOcclusion(n){if(!this.renderShader)throw new Error("renderShader undefined");this.renderDrawAmbientOcclusion=n,this.renderShader.use(this.gl),this.gl.uniform1fv(this.renderShader.uniforms.renderDrawAmbientOcclusion,[this.renderDrawAmbientOcclusion,1]),this.drawScene()}setColorMap(n,s){this.setColormap(n,s)}setColormapNegative(n,s){const u=this.getVolumeIndexByID(n);this.volumes[u].colormapNegative=s,this.updateGLVolume()}setModulationImage(n,s,u=0){const f=this.getVolumeIndexByID(n);let m=null;s.length>0&&(m=this.getVolumeIndexByID(s)),this.volumes[f].modulationImage=m,this.volumes[f].modulateAlpha=u,this.updateGLVolume()}setGamma(n=1){cmapper.gamma=n,this.updateGLVolume()}async loadDeferred4DVolumes(n){const s=this.getVolumeIndexByID(n),u=this.volumes[s];if(u.nTotalFrame4D<=u.nFrame4D)return;let f;u.fileObject?f=await NVImage.loadFromFile({file:u.fileObject}):f=await NVImage.loadFromUrl({url:u.url}),f&&(u.img=f.img.slice(),u.nTotalFrame4D=f.nTotalFrame4D,u.nFrame4D=f.nFrame4D,this.updateGLVolume())}setFrame4D(n,s){const u=this.getVolumeIndexByID(n),f=this.volumes[u];s>f.nFrame4D-1&&(s=f.nFrame4D-1),s<0&&(s=0),s!==f.frame4D&&(f.frame4D=s,this.updateGLVolume(),this.onFrameChange(f,s),this.createOnLocationChange())}getFrame4D(n){const s=this.getVolumeIndexByID(n);return this.volumes[s].frame4D}colormapFromKey(n){return cmapper.colormapFromKey(n)}colormap(n="",s=!1){return cmapper.colormap(n,s)}createColormapTexture(n=null,s=0,u=256){return n!==null&&this.gl.deleteTexture(n),s<1||u<1?null:(n=this.gl.createTexture(),this.gl.activeTexture(TEXTURE1_COLORMAPS),this.gl.bindTexture(this.gl.TEXTURE_2D,n),this.gl.texStorage2D(this.gl.TEXTURE_2D,1,this.gl.RGBA8,u,s),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_R,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.pixelStorei(this.gl.UNPACK_ALIGNMENT,1),n)}addColormapList(n="",s=NaN,u=NaN,f=!1,m=!1,A=!0,v=!1){n.length<1&&(A=!1),this.colormapLists.push({name:n,min:s,max:u,alphaThreshold:f,negative:m,visible:A,invert:v})}refreshColormaps(){if(this.colormapLists=[],this.volumes.length<1&&this.meshes.length<1)return;const n=this.volumes.length;if(n>0)for(let A=0;A0)for(let A=0;Af[0]&&s>f[1]&&n=0&&this.screenSlices[u].axCorSag===4?u:-1}sliceScroll3D(n=0){if(n!==0){if(this.volumes.length>0&&this.scene.clipPlaneDepthAziElev[0]<1.8){const s=this.scene.clipPlaneDepthAziElev.slice();return n>0&&(s[0]=Math.min(1.5,s[0]+.025)),n<0&&(s[0]=Math.max(-1.5,s[0]-.025)),s[0]!==this.scene.clipPlaneDepthAziElev[0]?(this.scene.clipPlaneDepthAziElev=s,this.setClipPlane(this.scene.clipPlaneDepthAziElev)):void 0}n>0&&(this.scene.volScaleMultiplier=Math.min(2,this.scene.volScaleMultiplier*1.1)),n<0&&(this.scene.volScaleMultiplier=Math.max(.5,this.scene.volScaleMultiplier*.9)),this.drawScene()}}deleteThumbnail(){this.bmpTexture&&(this.gl.deleteTexture(this.bmpTexture),this.bmpTexture=null,this.thumbnailVisible=!1)}inGraphTile(n,s){if(this.graph.opacity<=0||this.volumes.length<1||this.volumes[0].nFrame4D<1||!this.graph.plotLTWH||this.graph.plotLTWH[2]<1||this.graph.plotLTWH[3]<1)return!1;const u=[(n-this.graph.LTWH[0])/this.graph.LTWH[2],(s-this.graph.LTWH[1])/this.graph.LTWH[3]];return u[0]>0&&u[1]>0&&u[0]<=1&&u[1]<=1}mouseClick(n,s,u=0,f=!0){if(n*=this.uiData.dpr,s*=this.uiData.dpr,this.canvas.focus(),this.thumbnailVisible){this.thumbnailVisible=!1,Promise.all([this.loadVolumes(this.deferredVolumes),this.loadMeshes(this.deferredMeshes)]).catch(m=>{throw m});return}if(this.inGraphTile(n,s)){if(!this.graph.plotLTWH)throw new Error("plotLTWH undefined");const m=[(n-this.graph.plotLTWH[0])/this.graph.plotLTWH[2],(s-this.graph.plotLTWH[1])/this.graph.plotLTWH[3]];if(m[0]>0&&m[1]>0&&m[0]<=1&&m[1]<=1){const A=Math.round(m[0]*(this.volumes[0].nFrame4D-1));this.setFrame4D(this.volumes[0].id,A);return}m[0]>.5&&m[1]>1&&this.loadDeferred4DVolumes(this.volumes[0].id).catch(A=>{throw A});return}if(this.inRenderTile(n,s)>=0){this.sliceScroll3D(u),this.drawScene();return}if(!(this.screenSlices.length<1||this.gl.canvas.height<1||this.gl.canvas.width<1))for(let m=0;m=0&&this.drawPenAxCorSag!==A||A>2)continue;const v=this.screenXY2TextureFrac(n,s,m,!1);if(!(v[0]<0)){if(!f){this.scene.crosshairPos[2-A]=u,this.drawScene();return}if(u!==0){let y=1;u<0&&(y=-1);const T=[0,0,0];T[2-A]=y,this.moveCrosshairInVox(T[0],T[1],T[2]),this.drawScene(),this.createOnLocationChange(A);return}if(this.opts.isForceMouseClickToVoxelCenters?this.scene.crosshairPos=clone$2(this.vox2frac(this.frac2vox(v))):this.scene.crosshairPos=clone$2(v),this.opts.drawingEnabled){const y=this.frac2vox(this.scene.crosshairPos);if(!isFinite(this.opts.penValue)||this.opts.penValue<0||Object.is(this.opts.penValue,-0)){isFinite(this.opts.penValue)?this.drawFloodFill(y,Math.abs(this.opts.penValue),this.opts.floodFillNeighbors):this.drawFloodFill(y,0,this.opts.penValue,this.opts.floodFillNeighbors);return}if(isNaN(this.drawPenLocation[0]))this.drawPenAxCorSag=A,this.drawPenFillPts=[],this.drawPt(...y,this.opts.penValue);else{if(y[0]===this.drawPenLocation[0]&&y[1]===this.drawPenLocation[1]&&y[2]===this.drawPenLocation[2])return;this.drawPenLine(y,this.drawPenLocation,this.opts.penValue)}this.drawPenLocation=y,this.opts.isFilledPen&&this.drawPenFillPts.push(y),this.refreshDrawing(!1)}this.drawScene(),this.createOnLocationChange(A);return}}}drawRuler(){let n=[],s=[];for(let y=0;y1){s=this.screenSlices[y].leftTopWidthHeight,n=this.screenSlices[y].fovMM;break}if(s.length<4)return;const f=100/n[0]*s[2],m=s[0]+.5*s[2]-.5*f,A=s[1]+s[3]-2*this.opts.rulerWidth,v=[m,A,m+f,A];this.drawRuler10cm(v)}drawRuler10cm(n){if(!this.lineShader)throw new Error("lineShader undefined");this.gl.bindVertexArray(this.genericVAO),this.lineShader.use(this.gl),this.gl.uniform4fv(this.lineShader.uniforms.lineColor,this.opts.rulerColor),this.gl.uniform2fv(this.lineShader.uniforms.canvasWidthHeight,[this.gl.canvas.width,this.gl.canvas.height]),this.gl.uniform1f(this.lineShader.uniforms.thickness,this.opts.rulerWidth),this.gl.uniform4fv(this.lineShader.uniforms.startXYendXY,n),this.gl.drawArrays(this.gl.TRIANGLE_STRIP,0,4);const s=-.1*(n[0]-n[2]),u=n[1],f=u-2*this.opts.rulerWidth,m=u-4*this.opts.rulerWidth;for(let A=0;A<11;A++){const v=n[0]+A*s,y=[v,u,v,f];A%5===0&&(y[3]=m),this.gl.uniform4fv(this.lineShader.uniforms.startXYendXY,y),this.gl.drawArrays(this.gl.TRIANGLE_STRIP,0,4)}this.gl.bindVertexArray(this.unusedVAO)}screenXY2mm(n,s,u=-1){let f;for(let m=0;m=0&&(A=u),this.screenSlices[A].axCorSag>2)continue;const y=this.screenSlices[A].leftTopWidthHeight;if(ny[0]+y[2]||s>y[1]+y[3]||(f=this.screenXY2TextureFrac(n,s,A,!1),f[0]<0))continue;const T=this.frac2mm(f);return fromValues$1(T[0],T[1],T[2],A)}return fromValues$1(NaN,NaN,NaN,NaN)}dragForPanZoom(n){const s=this.screenXY2mm(n[2],n[3]);if(isNaN(s[0]))return;const u=this.screenXY2mm(n[0],n[1],s[3]);if(isNaN(u[0])||isNaN(s[0])||isNaN(s[3]))return;const f=create$1(),m=this.uiData.pan2DxyzmmAtMouseDown[3];sub$3(f,s,u),this.scene.pan2Dxyzmm[0]=this.uiData.pan2DxyzmmAtMouseDown[0]+m*f[0],this.scene.pan2Dxyzmm[1]=this.uiData.pan2DxyzmmAtMouseDown[1]+m*f[1],this.scene.pan2Dxyzmm[2]=this.uiData.pan2DxyzmmAtMouseDown[2]+m*f[2]}dragForCenterButton(n){this.dragForPanZoom(n)}dragForSlicer3D(n){let s=this.uiData.pan2DxyzmmAtMouseDown[3];const u=n[3]-n[1];s+=u*.01,s=Math.max(s,.1),s=Math.min(s,10);const m=this.scene.pan2Dxyzmm[3]-s;this.opts.yoke3Dto2DZoom&&(this.scene.volScaleMultiplier=s),this.scene.pan2Dxyzmm[3]=s;const A=this.frac2mm(this.scene.crosshairPos);this.scene.pan2Dxyzmm[0]+=m*A[0],this.scene.pan2Dxyzmm[1]+=m*A[1],this.scene.pan2Dxyzmm[2]+=m*A[2]}drawMeasurementTool(n){const s=this.gl;if(s.bindVertexArray(this.genericVAO),s.depthFunc(s.ALWAYS),s.enable(s.BLEND),s.blendFunc(s.SRC_ALPHA,s.ONE_MINUS_SRC_ALPHA),!this.lineShader)throw new Error("lineShader undefined");this.lineShader.use(this.gl),s.uniform4fv(this.lineShader.uniforms.lineColor,this.opts.rulerColor),s.uniform2fv(this.lineShader.uniforms.canvasWidthHeight,[s.canvas.width,s.canvas.height]),s.uniform1f(this.lineShader.uniforms.thickness,this.opts.rulerWidth),s.uniform4fv(this.lineShader.uniforms.startXYendXY,n),s.drawArrays(s.TRIANGLE_STRIP,0,4);const u=this.opts.rulerColor;u[3]=1,s.uniform4fv(this.lineShader.uniforms.lineColor,u);const f=this.opts.rulerWidth;s.uniform1f(this.lineShader.uniforms.thickness,f*2);let m=[n[0],n[1]-f,n[0],n[1]+f];s.uniform4fv(this.lineShader.uniforms.startXYendXY,m),s.drawArrays(s.TRIANGLE_STRIP,0,4),m=[n[2],n[3]-f,n[2],n[3]+f],s.uniform4fv(this.lineShader.uniforms.startXYendXY,m),s.drawArrays(s.TRIANGLE_STRIP,0,4);let A=this.canvasPos2frac([n[0],n[1]]),v=this.canvasPos2frac([n[2],n[3]]);if(A[0]>=0&&v[0]>=0){const y=this.frac2mm(A);A=fromValues$2(y[0],y[1],y[2]);const T=this.frac2mm(v);v=fromValues$2(T[0],T[1],T[2]);const E=create$2();sub$4(E,A,v);const S=len(E);let I=2;S>9&&(I=1),S>99&&(I=0);const e=S.toFixed(I);this.drawTextBetween(n,e,1,u)}s.bindVertexArray(this.unusedVAO)}drawRect(n,s=[1,0,0,-1]){if(s[3]<0&&(s=this.opts.crosshairColor),!this.rectShader)throw new Error("rectShader undefined");this.rectShader.use(this.gl),this.gl.enable(this.gl.BLEND),this.gl.uniform4fv(this.rectShader.uniforms.lineColor,s),this.gl.uniform2fv(this.rectShader.uniforms.canvasWidthHeight,[this.gl.canvas.width,this.gl.canvas.height]),this.gl.uniform4f(this.rectShader.uniforms.leftTopWidthHeight,n[0],n[1],n[2],n[3]),this.gl.bindVertexArray(this.genericVAO),this.gl.drawArrays(this.gl.TRIANGLE_STRIP,0,4),this.gl.bindVertexArray(this.unusedVAO)}drawCircle(n,s=this.opts.fontColor,u=1){if(!this.circleShader)throw new Error("circleShader undefined");this.circleShader.use(this.gl),this.gl.enable(this.gl.BLEND),this.gl.uniform4fv(this.circleShader.uniforms.circleColor,s),this.gl.uniform2fv(this.circleShader.uniforms.canvasWidthHeight,[this.gl.canvas.width,this.gl.canvas.height]),this.gl.uniform4f(this.circleShader.uniforms.leftTopWidthHeight,n[0],n[1],n[2],n[3]),this.gl.uniform1f(this.circleShader.uniforms.fillPercent,u),this.gl.uniform4fv(this.circleShader.uniforms.circleColor,s),this.gl.bindVertexArray(this.genericVAO),this.gl.drawArrays(this.gl.TRIANGLE_STRIP,0,4),this.gl.bindVertexArray(this.unusedVAO)}drawSelectionBox(n){this.drawRect(n,this.opts.selectionBoxColor)}effectiveCanvasHeight(){return this.gl.canvas.height-this.colorbarHeight}effectiveCanvasWidth(){return this.gl.canvas.width-this.getLegendPanelWidth()}getAllLabels(){const f=this.meshes.filter(A=>A.type==="connectome").flatMap(A=>A.nodes).map(A=>A.label).filter(A=>A!==void 0);return[...this.document.labels,...f]}getBulletMarginWidth(){let n=0;const s=this.getAllLabels();if(s.length===0)return 0;const u=s.length===1?s[0].style.bulletScale:s.reduce((A,v)=>A.style.bulletScale>v.style.bulletScale?A:v).style.bulletScale,f=s.length===1?s[0]:s.reduce((A,v)=>{const y=this.opts.textHeight*this.gl.canvas.height*A.style.textScale,T=this.opts.textHeight*this.gl.canvas.height*v.style.textScale;return this.textHeight(y,A.text)>this.textHeight(T,v.text)?A:v}),m=this.opts.textHeight*this.gl.canvas.height*f.style.textScale;return n=this.textHeight(m,f.text)*u,n+=m,n}getLegendPanelWidth(){const n=this.getAllLabels();if(!this.opts.showLegend||n.length===0)return 0;const u=this.opts.textHeight*this.gl.canvas.height*1;let f=0;const m=n.reduce((T,E)=>{const S=this.opts.textHeight*this.gl.canvas.height*T.style.textScale,I=this.opts.textHeight*this.gl.canvas.height*E.style.textScale;return this.textWidth(S,T.text)>this.textWidth(I,E.text)?T:E}),A=this.opts.textHeight*this.gl.canvas.height*m.style.textScale,v=this.textWidth(A,m.text),y=this.getBulletMarginWidth();return v&&(f=y+v,f+=u*2),f}getLegendPanelHeight(){const n=this.getAllLabels();let s=0;const f=this.opts.textHeight*this.gl.canvas.height*1;for(const m of n){const A=this.opts.textHeight*this.gl.canvas.height*m.style.textScale,v=this.textHeight(A,m.text);s+=v}return s&&(s+=f/2*(n.length+1)),s}reserveColorbarPanel(){let n=Math.max(this.opts.textHeight,.01);n=n*Math.min(this.gl.canvas.height,this.gl.canvas.width);const s=3*n,u=[0,this.gl.canvas.height-s,this.gl.canvas.width,s];return this.colorbarHeight=u[3]+1,u}drawColorbarCore(n=0,s=[0,0,0,0],u=!1,f=0,m=1,A){if(s[2]<=0||s[3]<=0)return;let v=Math.max(this.opts.textHeight,.01);v=v*Math.min(this.gl.canvas.height,this.gl.canvas.width);let y=v;const T=3*v;let E=v;if(s[3]0&&(F=f,f=0),f===m||v<1)return;const M=Math.abs(m-f);let[L,V]=tickSpacing(f,m);Vf.includes(y)).reduce((v,y)=>v.lbwh[3]>y.lbwh[3]?v:y).lbwh[3];return n*A}drawChar(n,s,u){if(!this.fontShader)throw new Error("fontShader undefined");const f=this.fontMets.mets[u],m=n[0]+s*f.lbwh[0],A=-(s*f.lbwh[1]),v=s*f.lbwh[2],y=s*f.lbwh[3],T=n[1]+(A-y)+s;return this.gl.uniform4f(this.fontShader.uniforms.leftTopWidthHeight,m,T,v,y),this.gl.uniform4fv(this.fontShader.uniforms.uvLeftTopWidthHeight,f.uv_lbwh),this.gl.drawArrays(this.gl.TRIANGLE_STRIP,0,4),s*f.xadv}drawLoadingText(n){if(!this.canvas)throw new Error("canvas undefined");this.gl.viewport(0,0,this.gl.canvas.width,this.gl.canvas.height),this.gl.enable(this.gl.CULL_FACE),this.gl.enable(this.gl.BLEND),this.drawTextBelow([this.canvas.width/2,this.canvas.height/2],n,3)}drawText(n,s,u=1,f=null){if(this.opts.textHeight<=0)return;if(!this.fontShader)throw new Error("fontShader undefined");this.fontShader.use(this.gl);const m=this.opts.textHeight*Math.min(this.gl.canvas.height,this.gl.canvas.width)*u;this.gl.enable(this.gl.BLEND),this.gl.uniform2f(this.fontShader.uniforms.canvasWidthHeight,this.gl.canvas.width,this.gl.canvas.height),f===null&&(f=this.opts.fontColor),this.gl.uniform4fv(this.fontShader.uniforms.fontColor,f);let A=m/this.fontMets.size*this.fontMets.distanceRange;A=Math.max(A,1),this.gl.uniform1f(this.fontShader.uniforms.screenPxRange,A);const v=new TextEncoder().encode(s);this.gl.bindVertexArray(this.genericVAO);for(let y=0;y.8?T=[0,0,0,.5]:T=[1,1,1,.5],this.drawRect(y,T),this.drawText(m,s,u,f)}drawTextBelow(n,s,u=1,f=null){if(this.opts.textHeight<=0)return;if(!this.canvas)throw new Error("canvas undefined");let m=this.opts.textHeight*this.gl.canvas.height*u,A=this.textWidth(m,s);A>this.canvas.width&&(u*=(this.canvas.width-2)/A,m=this.opts.textHeight*this.gl.canvas.height*u,A=this.textWidth(m,s)),n[0]-=.5*this.textWidth(m,s),n[0]=Math.max(n[0],1),n[0]=Math.min(n[0],this.canvas.width-A-1),this.drawText(n,s,u,f)}updateInterpolation(n,s=!1){let u=this.gl.LINEAR;!s&&this.opts.isNearestInterpolation&&(u=this.gl.NEAREST),n===0?this.gl.activeTexture(TEXTURE0_BACK_VOL):this.gl.activeTexture(TEXTURE2_OVERLAY_VOL),this.gl.texParameteri(this.gl.TEXTURE_3D,this.gl.TEXTURE_MIN_FILTER,u),this.gl.texParameteri(this.gl.TEXTURE_3D,this.gl.TEXTURE_MAG_FILTER,u)}setAtlasOutline(n){this.opts.atlasOutline=n,this.updateGLVolume(),this.drawScene()}setInterpolation(n){this.opts.isNearestInterpolation=n;const s=this.volumes.length;if(!(s<1)){for(let u=0;u0){this.opts.meshThicknessOn2D!==1/0&&(M=this.calculateMvpMatrix2D(n,m.mnMM,m.mxMM,this.opts.meshThicknessOn2D,F,T,y,v));const V=clone$3(M.modelViewProjectionMatrix);multiply$2(V,V,A),this.drawMesh3D(!0,1,V,M.modelMatrix,M.normalMatrix)}isNaN(u)&&this.drawCrosshairs3D(!1,.15,M.modelViewProjectionMatrix,!0,this.opts.isSliceMM),this.drawSliceOrientationText(n,s),this.readyForSync=!0}calculateMvpMatrix(n,s=[0,0,0,0],u,f){(s[2]===0||s[3]===0)&&(s=[0,0,this.gl.canvas.width,this.gl.canvas.height]);const m=s[2]/s[3];let A=this.furthestFromPivot;const v=this.pivot3D,y=create$3();A=.8*A/this.scene.volScaleMultiplier,m<1?ortho(y,-A,A,-A/m,A/m,A*.01,A*8):ortho(y,-A*m,A*m,-A,A,A*.01,A*8);const T=create$3();T[0]=-1;const E=fromValues$2(0,0,-A*1.8);translate(T,T,E),this.position&&translate(T,T,this.position),rotateX(T,T,deg2rad(270-f)),rotateZ(T,T,deg2rad(u-180)),translate(T,T,[-v[0],-v[1],-v[2]]);const S=create$3();invert(S,T);const I=create$3();transpose$3(I,S);const e=create$3();return multiply$2(e,y,T),[e,T,I]}calculateModelMatrix(n,s){if(!this.back)throw new Error("back undefined");const u=create$3();if(u[0]=-1,rotateX(u,u,deg2rad(270-s)),rotateZ(u,u,deg2rad(n-180)),this.back.obliqueRAS){const f=clone$3(this.back.obliqueRAS);multiply$2(u,u,f)}return u}calculateRayDirection(n,s){const u=this.calculateModelMatrix(n,s),f=fromValues$3(1,0,0,0,0,-1,0,0,0,0,-1,0,0,0,0,1),m=create$3();multiply$2(m,f,u);const A=create$3();invert(A,m);const v=fromValues$1(0,0,-1,1);transformMat4(v,v,A);const y=fromValues$2(v[0],v[1],v[2]);normalize$1(y,y);const T=5e-5;return Math.abs(y[0])0){if(!this.volumeObject3D)throw new Error("volumeObject3D undefined");s=fromValues$2(this.volumeObject3D.extentsMin[0],this.volumeObject3D.extentsMin[1],this.volumeObject3D.extentsMin[2]),u=fromValues$2(this.volumeObject3D.extentsMax[0],this.volumeObject3D.extentsMax[1],this.volumeObject3D.extentsMax[2]),n||(s=fromValues$2(this.volumes[0].extentsMinOrtho[0],this.volumes[0].extentsMinOrtho[1],this.volumes[0].extentsMinOrtho[2]),u=fromValues$2(this.volumes[0].extentsMaxOrtho[0],this.volumes[0].extentsMaxOrtho[1],this.volumes[0].extentsMaxOrtho[2]))}if(this.meshes.length>0){if(this.volumes.length<1){const m=this.meshes[0].extentsMin,A=this.meshes[0].extentsMax;s=fromValues$2(m[0],m[1],m[2]),u=fromValues$2(A[0],A[1],A[2])}for(let m=0;mthis.gl.canvas.width||n.LTWH[1]+n.LTWH[3]>this.gl.canvas.height)return;n.backColor=[.15,.15,.15,n.opacity],n.lineColor=[1,1,1,1],this.opts.backColor[0]+this.opts.backColor[1]+this.opts.backColor[2]>1.5&&(n.backColor=[.95,.95,.95,n.opacity],n.lineColor=[0,0,0,1]),n.textColor=n.lineColor.slice(),n.lineThickness=4,n.lineAlpha=1,n.lines=[];const u=[];if(n.vols.length<1)this.volumes[0]!=null&&u.push(0);else for(let re=0;rem){const re=A-m;for(let ae=0;ae=A&&(A=m+1),this.drawRect(n.LTWH,n.backColor);const[v,y,T]=tickSpacing(m,A),E=Math.max(0,-1*Math.floor(Math.log(v)/Math.log(10)));m=Math.min(y,m),A=Math.max(T,A);function S(re){return re.toFixed(6).replace(/\.?0*$/,"")}const e=.07*(Math.min(n.LTWH[2],n.LTWH[3])/(this.fontMets.size*this.uiData.dpr));let F=this.opts.textHeight*this.gl.canvas.height*e;F<16&&(F=0);let M=0,L=y;if(F>0)for(;L<=A;){const re=L.toFixed(E),ae=this.textWidth(F,re);M=Math.max(ae,M),L+=v}const V=.05,B=Math.abs(n.LTWH[2]),z=Math.abs(n.LTWH[3]),b=[n.LTWH[0]+V*B+M,n.LTWH[1]+V*z,n.LTWH[2]-M-2*V*B,n.LTWH[3]-F-2*V*z];this.graph.LTWH=n.LTWH,this.graph.plotLTWH=b,this.drawRect(b,this.opts.backColor);const W=A-m,q=b[3]/W,Y=b[2]/(n.lines[0].length-1),X=b[1]+b[3];L=y+.5*v;const Q=n.lineColor.slice();for(Q[3]=.25*n.lineColor[3];L<=A;){const re=X-(L-m)*q;this.drawLine([b[0],re,b[0]+b[2],re],.5*n.lineThickness,Q),L+=v}L=y;const g=.5*n.lineThickness;for(;L<=A;){const re=X-(L-m)*q;this.drawLine([b[0]-g,re,b[0]+b[2]+n.lineThickness,re],n.lineThickness,n.lineColor);const ae=L.toFixed(E);F>0&&this.drawTextLeft([b[0]-6,re],ae,e,n.textColor),L+=v}let J=1;for(;n.lines[0].length/J>20;)J*=5;for(let re=0;re0&&this.drawTextBelow([ae,2+b[1]+b[3]],pe,e,n.textColor),this.drawLine([ae,b[1],ae,b[1]+b[3]],fe,n.lineColor)}}for(let re=0;re=0&&n.selectedColumnI/255);return}const v=unpackFloatFromVec4i(A);if(v>1)return;const y=(this.mousePos[0]-n[0])/n[2],T=(u.canvas.height-this.mousePos[1]-n[1])/n[3],E=unProject(y,T,v,s),S=this.mm2frac(E,0,!0);S[0]<0||S[0]>1||S[1]<0||S[1]>1||S[2]<0||S[2]>1||(this.scene.crosshairPos=this.mm2frac(E,0,!0))}drawImage3D(n,s,u){if(this.volumes.length===0)return;const f=this.gl,m=this.calculateRayDirection(s,u),A=this.volumeObject3D;if(A){f.enable(f.BLEND),f.blendFunc(f.SRC_ALPHA,f.ONE_MINUS_SRC_ALPHA),f.enable(f.CULL_FACE),f.cullFace(f.FRONT);let v=this.renderShader;if(this.uiData.mouseDepthPicker&&(v=this.pickingImageShader),v.use(this.gl),f.uniform1i(v.uniforms.backgroundMasksOverlays,this.backgroundMasksOverlays),this.gradientTextureAmount>0){f.activeTexture(TEXTURE6_GRADIENT),f.bindTexture(f.TEXTURE_3D,this.gradientTexture);const y=this.calculateModelMatrix(s,u),T=create$3();invert(T,y);const E=create$3();transpose$3(E,T),f.uniformMatrix4fv(v.uniforms.normMtx,!1,E)}this.drawBitmap&&this.drawBitmap.length>8?f.uniform2f(v.uniforms.renderDrawAmbientOcclusionXY,this.renderDrawAmbientOcclusion,this.drawOpacity):f.uniform2f(v.uniforms.renderDrawAmbientOcclusionXY,this.renderDrawAmbientOcclusion,0),f.uniformMatrix4fv(v.uniforms.mvpMtx,!1,n),f.uniformMatrix4fv(v.uniforms.matRAS,!1,this.back.matRAS),f.uniform3fv(v.uniforms.rayDir,m),this.gradientTextureAmount<0?f.uniform4fv(v.uniforms.clipPlane,[this.scene.crosshairPos[0],this.scene.crosshairPos[1],this.scene.crosshairPos[2],30]):f.uniform4fv(v.uniforms.clipPlane,this.scene.clipPlane),f.uniform1f(v.uniforms.drawOpacity,1),f.bindVertexArray(A.vao),f.drawElements(A.mode,A.indexCount,f.UNSIGNED_SHORT,0),f.bindVertexArray(this.unusedVAO)}}drawOrientationCube(n,s=0,u=0){if(!this.opts.isOrientCube)return;const f=.05*Math.min(n[2],n[3]);if(f<5)return;const m=this.gl;m.enable(m.CULL_FACE),m.cullFace(m.BACK),this.orientCubeShader.use(this.gl),m.bindVertexArray(this.orientCubeShaderVAO);const A=create$3(),v=create$3();ortho(v,0,m.canvas.width,0,m.canvas.height,-10*f,10*f);let y=0;n[1]===0&&(y=m.canvas.height-this.effectiveCanvasHeight()),translate(A,A,[1.8*f+n[0],y+1.8*f+n[1],0]),scale$4(A,A,[f,f,f]),rotateX(A,A,deg2rad(270-u)),rotateZ(A,A,deg2rad(-s));const T=create$3();multiply$2(T,v,A),m.uniformMatrix4fv(this.orientCubeShader.uniforms.u_matrix,!1,T),m.drawArrays(m.TRIANGLE_STRIP,0,168),m.bindVertexArray(this.unusedVAO),this.gl.disable(this.gl.CULL_FACE)}createOnLocationChange(n=NaN){const[s,u,f]=this.sceneExtentsMinMax(!0),m=Math.max(Math.max(f[0],f[1]),f[2]);function A(I){return Math.max(0,-Math.ceil(Math.log10(Math.abs(I))))}let v=A(m*.001);const y=this.frac2mm(this.scene.crosshairPos,0,!0);function T(I,e=0){return parseFloat(I.toFixed(e))}let E=T(y[0],v)+"×"+T(y[1],v)+"×"+T(y[2],v);if(this.volumes.length>0&&this.volumes[0].nFrame4D>0&&(E+="×"+T(this.volumes[0].frame4D)),this.volumes.length>0){let I=" = ";for(let M=0;M=0&&B=0&&(I+="+"),I+=T(V,v)),I+=" "}E+=I;const e=this.back.dimsRAS,F=e[1]*e[2]*e[3];if(this.drawBitmap&&this.drawBitmap.length===F){const M=this.frac2vox(this.scene.crosshairPos),L=M[0]+M[1]*e[1]+M[2]*e[1]*e[2];E+=" "+this.drawLut.labels[this.drawBitmap[L]]}}const S={mm:this.frac2mm(this.scene.crosshairPos,0,!0),axCorSag:n,vox:this.frac2vox(this.scene.crosshairPos),frac:this.scene.crosshairPos,xy:[this.mousePos[0],this.mousePos[1]],values:this.volumes.map(I=>{const e=this.frac2mm(this.scene.crosshairPos,0,!0),F=I.mm2vox(e),M=I.getValue(F[0],F[1],F[2],I.frame4D);return{name:I.name,value:M,id:I.id,mm:e,vox:F}}),string:E};this.onLocationChange(S)}addLabel(n,s,u){const f={textColor:this.opts.legendTextColor,textScale:1,textAlignment:"left",lineWidth:0,lineColor:this.opts.legendTextColor,lineTerminator:"none",bulletScale:0,bulletColor:this.opts.legendTextColor},m=s?{...f,...s}:{...f},A=new NVLabel3D(n,m,u);return this.document.labels.push(A),A}calculateScreenPoint(n,s,u){const f=create$1();return transformMat4(f,[...n,1],s),f[3]!==0&&(f[0]=(f[0]/f[3]+1)*.5*u[2],f[1]=(1-f[1]/f[3])*.5*u[3],f[2]/=f[3],f[0]+=u[0],f[1]+=u[1]),f}getLabelAtPoint(n){log$4.debug("screenPoint",n);const s=this.getLegendPanelHeight(),u=this.getLegendPanelWidth(),f=this.gl.canvas.width-u;let m=(this.canvas.height-s)/2;if(log$4.debug("panelrect",f,m,f+u,m+s),n[0]f+u||n[1]>m+s)return null;const v=this.opts.textHeight*Math.min(this.gl.canvas.height,this.gl.canvas.width)*1,y=this.getAllLabels();for(const T of y){const E=this.opts.textHeight*this.gl.canvas.height*T.style.textScale,S=this.textHeight(E,T.text);if(n[1]>=m&&n[1]<=m+S+v/2)return T;m+=S,m+=v/2}return null}drawLabelLine(n,s,u,f,m=!1){const A=Array.isArray(n.points)&&Array.isArray(n.points[0])?n.points:[n.points];for(const v of A){const y=this.calculateScreenPoint(v,u,f);m?this.drawDottedLine([...s,y[0],y[1]],n.style.lineWidth,n.style.lineColor):this.draw3DLine(s,[y[0],y[1],y[2]],n.style.lineWidth,n.style.lineColor)}}draw3DLabel(n,s,u,f,m=0,A,v=!1){const y=n.text,T=s[0],E=s[1],S=this.opts.textHeight*Math.min(this.gl.canvas.height,this.gl.canvas.width)*1,I=this.textHeight(n.style.textScale,y)*S;if(n.style.lineWidth>0&&Array.isArray(n.points)&&this.drawLabelLine(n,[T,E+I],u,f,v),n.style.bulletScale){const F=n.style.bulletScale*I,M=I-F,L=E+M/2+F/2,V=T+(m-F)/2;this.drawCircle([V,L,F,F],n.style.bulletColor)}let e=T;if(n.style.textAlignment!=="left"){const F=this.textWidth(n.style.textScale,n.text)*S;if(n.style.textAlignment==="right")e=T+A-S*1.5-F;else{const M=A-(m||S);e+=(M-F)/2}}else e+=m;this.drawText([e,E],y,n.style.textScale,n.style.textColor)}draw3DLabels(n,s,u=!1){const f=this.getAllLabels();if(!this.opts.showLegend||f.length===0)return;if(!this.canvas)throw new Error("canvas undefined");const m=this.gl;m.disable(m.CULL_FACE),m.viewport(0,0,this.canvas.width,this.canvas.height);const v=this.opts.textHeight*Math.min(this.gl.canvas.height,this.gl.canvas.width)*1,y=this.getBulletMarginWidth(),T=this.getLegendPanelHeight(),E=this.getLegendPanelWidth(),S=m.canvas.width-E;let I=(this.canvas.height-T)/2;this.drawRect([m.canvas.width-E,I,E-v,T],this.opts.legendBackgroundColor);const e=m.getParameter(m.BLEND),F=m.getParameter(m.DEPTH_FUNC);u||(m.disable(m.BLEND),m.depthFunc(m.GREATER));for(const M of f){this.draw3DLabel(M,[S,I],n,s,y,E,u);const L=this.opts.textHeight*this.gl.canvas.height*M.style.textScale,V=this.textHeight(L,M.text);I+=V,I+=v/2}u||(m.depthFunc(F),e&&m.enable(m.BLEND))}draw3D(n=[0,0,0,0],s=null,u=null,f=null,m=null,A=0){const v=m!==null;this.setPivot3D(),v||(m=this.scene.renderAzimuth,A=this.scene.renderElevation);const y=this.gl;s===null&&([s,u,f]=this.calculateMvpMatrix(null,n,m,A));let T=[...n];if(n[2]===0||n[3]===0?(n=[0,0,y.canvas.width,y.canvas.height],T=[...n],this.screenSlices.push({leftTopWidthHeight:n,axCorSag:4,sliceFrac:0,AxyzMxy:[],leftTopMM:[],fovMM:[isRadiological(u),0]})):(this.screenSlices.push({leftTopWidthHeight:n.slice(),axCorSag:4,sliceFrac:0,AxyzMxy:[],leftTopMM:[],fovMM:[isRadiological(u),0]}),n[1]=y.canvas.height-n[3]-n[1]),y.enable(y.DEPTH_TEST),y.depthFunc(y.ALWAYS),y.depthMask(!0),y.clearDepth(0),this.draw3DLabels(s,T,!1),y.viewport(n[0],n[1],n[2],n[3]),this.volumes.length>0&&(this.updateInterpolation(0,!0),this.updateInterpolation(1,!0),this.drawImage3D(s,m,A)),this.updateInterpolation(0),this.updateInterpolation(1),v||this.drawCrosshairs3D(!0,1,s),this.drawMesh3D(!0,1,s,u,f),this.uiData.mouseDepthPicker){this.depthPicker(n,s),this.createOnLocationChange(),this.draw3D(n,s,u,f,m,A);return}this.opts.meshXRay>0&&this.drawMesh3D(!1,this.opts.meshXRay,s,u,f),this.draw3DLabels(s,T,!1),y.viewport(n[0],n[1],n[2],n[3]),v||this.drawCrosshairs3D(!1,.15,s),y.viewport(0,0,y.canvas.width,y.canvas.height),this.drawOrientationCube(n,m,A);const E="azimuth: "+this.scene.renderAzimuth.toFixed(0)+" elevation: "+this.scene.renderElevation.toFixed(0);return this.readyForSync=!0,this.sync(),this.draw3DLabels(s,T,!0),E}drawMesh3D(n=!0,s=1,u,f,m){if(this.meshes.length<1)return;const A=this.gl;u||([u,f,m]=this.calculateMvpMatrix(this.volumeObject3D,void 0,this.scene.renderAzimuth,this.scene.renderElevation)),A.enable(A.DEPTH_TEST),A.blendFunc(A.SRC_ALPHA,A.ONE_MINUS_SRC_ALPHA),A.disable(A.BLEND),A.depthFunc(A.GREATER),A.disable(A.CULL_FACE),n?(A.disable(A.BLEND),A.depthFunc(A.GREATER)):(A.enable(A.BLEND),A.depthFunc(A.ALWAYS),A.enable(A.CULL_FACE)),A.cullFace(A.BACK);let v=this.meshShaders[0].shader,y=!1;for(let T=0;T=3&&this.meshes[T].fiberRadius>0||(A.bindVertexArray(this.meshes[T].vaoFiber),A.drawElements(A.LINE_STRIP,this.meshes[T].indexCount,A.UNSIGNED_INT,0),A.bindVertexArray(this.unusedVAO)));A.enable(A.BLEND),A.depthFunc(A.ALWAYS),this.readyForSync=!0}drawCrosshairs3D(n=!0,s=1,u=null,f=!1,m=!0){if(!this.opts.show3Dcrosshair&&!f||this.opts.crosshairWidth<=0&&f)return;const A=this.gl,v=this.frac2mm(this.scene.crosshairPos,0,m);if(this.crosshairs3D===null||this.crosshairs3D.mm[0]!==v[0]||this.crosshairs3D.mm[1]!==v[1]||this.crosshairs3D.mm[2]!==v[2]){this.crosshairs3D!==null&&(A.deleteBuffer(this.crosshairs3D.indexBuffer),A.deleteBuffer(this.crosshairs3D.vertexBuffer));const[E,S,I]=this.sceneExtentsMinMax(m);let e=1;if(this.volumes.length>0){if(!this.back)throw new Error("back undefined");e=.5*Math.min(Math.min(this.back.pixDims[1],this.back.pixDims[2]),this.back.pixDims[3])}else(I[0]<50||I[0]>1e3)&&(e=I[0]*.02);e*=this.opts.crosshairWidth,this.crosshairs3D=NiivueObject3D.generateCrosshairs(this.gl,1,v,E,S,e,20,this.opts.crosshairGap),this.crosshairs3D.mm=v}if(!this.surfaceShader)throw new Error("surfaceShader undefined");const y=this.surfaceShader;y.use(this.gl),u==null&&([u]=this.calculateMvpMatrix(this.crosshairs3D,void 0,this.scene.renderAzimuth,this.scene.renderElevation)),A.uniformMatrix4fv(y.uniforms.mvpMtx,!1,u),A.bindBuffer(A.ELEMENT_ARRAY_BUFFER,this.crosshairs3D.indexBuffer),A.enable(A.DEPTH_TEST);const T=[...this.opts.crosshairColor];n?(A.disable(A.BLEND),A.depthFunc(A.GREATER)):(A.enable(A.BLEND),A.blendFunc(A.SRC_ALPHA,A.ONE_MINUS_SRC_ALPHA),A.depthFunc(A.ALWAYS)),T[3]=s,A.uniform4fv(y.uniforms.surfaceColor,T),A.bindVertexArray(this.crosshairs3D.vao),A.drawElements(A.TRIANGLES,this.crosshairs3D.indexCount,A.UNSIGNED_INT,0),A.bindVertexArray(this.unusedVAO)}mm2frac(n,s=0,u=!1){if(this.volumes.length<1){const f=fromValues$2(.1,.5,.5),[m,A,v]=this.sceneExtentsMinMax();return f[0]=(n[0]-m[0])/v[0],f[1]=(n[1]-m[1])/v[1],f[2]=(n[2]-m[2])/v[2],isFinite(f)||(isFinite(f[0])||(f[0]=.5),isFinite(f[1])||(f[1]=.5),isFinite(f[2])||(f[2]=.5),this.meshes.length<1&&log$4.error("mm2frac() not finite: objects not (yet) loaded.")),f}return this.volumes[s].convertMM2Frac(n,u||this.opts.isSliceMM)}vox2frac(n,s=0){return this.volumes[s].convertVox2Frac(n)}frac2vox(n,s=0){return this.volumes.length<=s?[0,0,0]:this.volumes[s].convertFrac2Vox(n)}moveCrosshairInVox(n,s,u){const f=this.frac2vox(this.scene.crosshairPos);f[0]+=n,f[1]+=s,f[2]+=u,f[0]=clamp$1(f[0],0,this.volumes[0].dimsRAS[1]-1),f[1]=clamp$1(f[1],0,this.volumes[0].dimsRAS[2]-1),f[2]=clamp$1(f[2],0,this.volumes[0].dimsRAS[3]-1),this.scene.crosshairPos=this.vox2frac(f),this.createOnLocationChange(),this.drawScene()}frac2mm(n,s=0,u=!1){const f=fromValues$1(n[0],n[1],n[2],1);if(this.volumes.length>0)return this.volumes[s].convertFrac2MM(n,u||this.opts.isSliceMM);{const[m,A]=this.sceneExtentsMinMax(),v=(y,T,E)=>y*(1-E)+T*E;f[0]=v(m[0],A[0],n[0]),f[1]=v(m[1],A[1],n[1]),f[2]=v(m[2],A[2],n[2])}return f}screenXY2TextureFrac(n,s,u,f=!0){const m=fromValues$2(-1,-1,-1),A=this.screenSlices[u].axCorSag;if(A>2)return m;const v=this.screenSlices[u].leftTopWidthHeight.slice();let y=!1;v[2]<0&&(y=!0,v[0]+=v[2],v[2]=-v[2]);let T=(n-v[0])/v[2];y&&(T=1-T);const E=1-(s-v[1])/v[3];if(T<0||T>1||E<0||E>1||this.screenSlices[u].AxyzMxy.length<4)return m;let S=fromValues$2(0,0,0);S[0]=this.screenSlices[u].leftTopMM[0]+T*this.screenSlices[u].fovMM[0],S[1]=this.screenSlices[u].leftTopMM[1]+E*this.screenSlices[u].fovMM[1];const I=this.screenSlices[u].AxyzMxy;S[2]=I[2]+I[4]*(S[1]-I[1])-I[3]*(S[0]-I[0]),A===1&&(S=swizzleVec3(S,[0,2,1])),A===2&&(S=swizzleVec3(S,[2,0,1]));const e=this.mm2frac(S);return f&&(e[0]<0||e[0]>1||e[1]<0||e[1]>1||e[2]<0||e[2]>1)?m:e}canvasPos2frac(n){for(let s=0;s=0)return u}return[-1,-1,-1]}scaleSlice(n,s,u=0,f=0){const m=this.effectiveCanvasWidth()-u,A=this.effectiveCanvasHeight()-f;let v=m/n;s*v>A&&(v=A/s);const y=n*v,T=s*v;return[(m-y)*.5,(A-T)*.5,y,T,v]}drawThumbnail(){if(!this.bmpShader)throw new Error("bmpShader undefined");this.bmpShader.use(this.gl),this.gl.uniform2f(this.bmpShader.uniforms.canvasWidthHeight,this.gl.canvas.width,this.gl.canvas.height);let n=this.gl.canvas.height,s=this.gl.canvas.height*this.bmpTextureWH;s>this.gl.canvas.width&&(n=this.gl.canvas.width/this.bmpTextureWH,s=this.gl.canvas.width),this.gl.uniform4f(this.bmpShader.uniforms.leftTopWidthHeight,0,0,s,n),this.gl.bindVertexArray(this.genericVAO),this.gl.drawArrays(this.gl.TRIANGLE_STRIP,0,4),this.gl.bindVertexArray(this.unusedVAO)}drawLine(n,s=1,u=[1,0,0,-1]){if(this.gl.bindVertexArray(this.genericVAO),!this.lineShader)throw new Error("lineShader undefined");this.lineShader.use(this.gl),u[3]<0&&(u=this.opts.crosshairColor),this.gl.uniform4fv(this.lineShader.uniforms.lineColor,u),this.gl.uniform2fv(this.lineShader.uniforms.canvasWidthHeight,[this.gl.canvas.width,this.gl.canvas.height]),this.gl.uniform1f(this.lineShader.uniforms.thickness,s),this.gl.uniform4fv(this.lineShader.uniforms.startXYendXY,n),this.gl.drawArrays(this.gl.TRIANGLE_STRIP,0,4),this.gl.bindVertexArray(this.unusedVAO)}draw3DLine(n,s,u=1,f=[1,0,0,-1]){if(this.gl.bindVertexArray(this.genericVAO),!this.line3DShader)throw new Error("line3DShader undefined");this.line3DShader.use(this.gl),f[3]<0&&(f=this.opts.crosshairColor),this.gl.uniform4fv(this.line3DShader.uniforms.lineColor,f),this.gl.uniform2fv(this.line3DShader.uniforms.canvasWidthHeight,[this.gl.canvas.width,this.gl.canvas.height]),this.gl.uniform1f(this.line3DShader.uniforms.thickness,u),this.gl.uniform2fv(this.line3DShader.uniforms.startXY,n),this.gl.uniform3fv(this.line3DShader.uniforms.endXYZ,s),this.gl.drawArrays(this.gl.TRIANGLE_STRIP,0,4),this.gl.bindVertexArray(this.unusedVAO)}drawDottedLine(n,s=1,u=[1,0,0,-1]){if(this.gl.bindVertexArray(this.genericVAO),!this.lineShader)throw new Error("lineShader undefined");this.lineShader.use(this.gl);const f=u[3]<0?[...this.opts.crosshairColor]:[...u];f[3]=.3;const m=fromValues(n[2]-n[0],n[3]-n[1]),A=length(m);normalize(m,m);const y=this.opts.textHeight*Math.min(this.gl.canvas.height,this.gl.canvas.width)*1;scale$1(m,m,y/2);const T=length(m);let E=Math.floor(A/T);A%T&&E++;const S=[n[0],n[1]];this.gl.uniform4fv(this.lineShader.uniforms.lineColor,f),this.gl.uniform2fv(this.lineShader.uniforms.canvasWidthHeight,[this.gl.canvas.width,this.gl.canvas.height]),this.gl.uniform1f(this.lineShader.uniforms.thickness,s);for(let I=0;I0&&s===0){const e=v,F=1;for(let M=0;M0&&s===1){const e=v,F=2;for(let M=0;M0&&s===2){const e=v,F=2;for(let M=0;M0&&s===0){const e=v,F=0;for(let M=0;M0&&s===1){const e=v,F=0;for(let M=0;M0&&s===2){const e=v,F=1;for(let M=0;M0){const T=A.leftTopWidthHeight.slice();let E=2;s===0&&(E=1);const S=this.frac2mm([.5,.5,.5]);for(let I=0;I0){const T=A.leftTopWidthHeight.slice(),E=A.fovMM[0]<0;let S=0;s===2&&(S=1);const I=this.frac2mm([.5,.5,.5]);for(let e=0;e"u"){if(this.meshes.length>0){this.screenSlices=[],this.opts.sliceType=4,this.draw3D(),this.opts.isColorbar&&this.drawColorbar();return}this.drawLoadingText(this.loadingText);return}if(this.back===null)return;if(this.uiData.isDragging&&this.scene.clipPlaneDepthAziElev[0]<1.8&&this.inRenderTile(this.uiData.dragStart[0],this.uiData.dragStart[1])>=0){const m=this.uiData.dragStart[0]-this.uiData.dragEnd[0],A=this.uiData.dragStart[1]-this.uiData.dragEnd[1],v=this.uiData.dragClipPlaneStartDepthAziElev.slice();if(v[1]-=m,v[1]=v[1]%360,v[2]+=A,v[1]!==this.scene.clipPlaneDepthAziElev[1]||v[2]!==this.scene.clipPlaneDepthAziElev[2])return this.scene.clipPlaneDepthAziElev=v,this.setClipPlane(this.scene.clipPlaneDepthAziElev)}if(this.sliceMosaicString.length<1&&this.opts.sliceType===4){this.opts.isColorbar&&this.reserveColorbarPanel(),this.screenSlices=[],this.draw3D(),this.opts.isColorbar&&this.drawColorbar();return}this.opts.isColorbar&&this.reserveColorbarPanel();const s=this.getMaxVols(),u=this.opts.sliceType===3&&s>1&&this.graph.autoSizeMultiplanar&&this.graph.opacity>0;if(this.sliceMosaicString.length>0)this.drawMosaic(this.sliceMosaicString);else if(this.gl.viewport(0,0,this.gl.canvas.width,this.gl.canvas.height),this.screenSlices=[],this.opts.sliceType===0)this.draw2D([0,0,0,0],0);else if(this.opts.sliceType===1)this.draw2D([0,0,0,0],1);else if(this.opts.sliceType===2)this.draw2D([0,0,0,0],2);else{const m=isFinite(this.drawPenLocation[0])&&this.opts.drawingEnabled,{volScale:A}=this.sliceScale();typeof this.opts.multiplanarPadPixels!="number"&&log$4.debug("multiplanarPadPixels must be numeric");const v=parseFloat(`${this.opts.multiplanarPadPixels}`),y=this.scaleSlice(A[0]+A[1],A[1]+A[2],v*1,v*1),T=Math.max(Math.max(A[1],A[2]),A[0]),E=this.scaleSlice(A[0]+A[0]+A[1],Math.max(A[1],A[2]),v*2),S=this.scaleSlice(A[0]+A[0]+A[1]+T,Math.max(A[1],A[2]),v*3),I=this.scaleSlice(T,A[1]+A[2]+A[2],0,v*2),e=this.scaleSlice(T,A[1]+A[2]+A[2]+T,0,v*3);let F=!m&&(s<2||!u),M=!1,L=!1,V=!1;if(this.opts.multiplanarLayout===1?M=!0:this.opts.multiplanarLayout===2?L=!0:this.opts.multiplanarLayout===3?V=!0:I[4]>E[4]&&I[4]>y[4]?M=!0:E[4]>y[4]?V=!0:L=!0,M){let B=I;this.opts.multiplanarForceRender||e[4]>=I[4]?B=e:F=!1;const z=A[0]*B[4],b=A[1]*B[4],W=A[2]*B[4],q=T*B[4];this.draw2D([B[0],B[1],z,b],0),this.draw2D([B[0],B[1]+b+v,z,W],1),this.draw2D([B[0],B[1]+b+v+W+v,b,W],2),F&&this.draw3D([B[0],B[1]+b+W+W+v*3,q,q])}else if(V){let B=E;this.opts.multiplanarForceRender||S[4]>=E[4]?B=S:F=!1;const z=A[0]*B[4],b=A[1]*B[4],W=A[2]*B[4];this.draw2D([B[0],B[1],z,b],0),this.draw2D([B[0]+z+v,B[1],z,W],1),this.draw2D([B[0]+z+z+v*2,B[1],b,W],2),F&&this.draw3D([B[0]+z+z+b+v*3,B[1],B[3],B[3]])}else if(L){const B=y,z=A[0]*B[4],b=A[1]*B[4],W=A[2]*B[4];this.draw2D([B[0],B[1]+W+v,z,b],0),this.draw2D([B[0],B[1],z,W],1),this.draw2D([B[0]+z+v,B[1],b,W],2),F&&this.draw3D([B[0]+z+v,B[1]+W+v,b,b])}}if(this.opts.isRuler&&this.drawRuler(),this.opts.isColorbar&&this.drawColorbar(),u&&this.drawGraph(),this.uiData.isDragging){if(this.uiData.mouseButtonCenterDown){this.dragForCenterButton([this.uiData.dragStart[0],this.uiData.dragStart[1],this.uiData.dragEnd[0],this.uiData.dragEnd[1]]);return}if(this.opts.dragMode===4){this.dragForSlicer3D([this.uiData.dragStart[0],this.uiData.dragStart[1],this.uiData.dragEnd[0],this.uiData.dragEnd[1]]);return}if(this.opts.dragMode===3){this.dragForPanZoom([this.uiData.dragStart[0],this.uiData.dragStart[1],this.uiData.dragEnd[0],this.uiData.dragEnd[1]]);return}if(this.inRenderTile(this.uiData.dragStart[0],this.uiData.dragStart[1])>=0)return;if(this.opts.dragMode===2){this.drawMeasurementTool([this.uiData.dragStart[0],this.uiData.dragStart[1],this.uiData.dragEnd[0],this.uiData.dragEnd[1]]);return}const m=Math.abs(this.uiData.dragStart[0]-this.uiData.dragEnd[0]),A=Math.abs(this.uiData.dragStart[1]-this.uiData.dragEnd[1]);this.drawSelectionBox([Math.min(this.uiData.dragStart[0],this.uiData.dragEnd[0]),Math.min(this.uiData.dragStart[1],this.uiData.dragEnd[1]),m,A])}const f=this.frac2mm([this.scene.crosshairPos[0],this.scene.crosshairPos[1],this.scene.crosshairPos[2]]);return n=f[0].toFixed(2)+"×"+f[1].toFixed(2)+"×"+f[2].toFixed(2),this.readyForSync=!0,this.sync(),n}drawScene(){if(this.isBusy){this.needsRefresh=!0;return}this.isBusy=!1,this.needsRefresh=!1;let n=this.drawSceneCore();return this._gl!==null&&this.gl.finish(),this.needsRefresh&&(n=this.drawScene()),n}get gl(){if(!this._gl)throw new Error("unable to get WebGL context. Maybe the browser doesn't support WebGL2.");return this._gl}set gl(n){this._gl=n}};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -2514,7 +2514,7 @@ Ooh no!!`);break}m[y]=T,v=Math.min(v,T)}for(let y=0;y=n[v]&&(A[v]=round$3((a[v]-n[v]+2*f)/u[v]+1,m));return A}function computeDefaultPad(a,n,s,u=1){const f=getEffectiveFilterSize(n,u);return Math.floor((a[0]*(s-1)-s+f)/2)}function parseTupleParam(a){return typeof a=="number"?[a,a,a]:a.length===2?[a[0],a[1],1]:a}function parse3TupleParam(a){return typeof a=="number"?[a,a,a]:a}function getEffectiveFilterSize(a,n){return n<=1?a:a+(a-1)*(n-1)}function getPadAndOutInfo(a,n,s,u,f,m,A,v,y){let T,E,S;if(typeof a=="number"){T={top:a,bottom:a,left:a,right:a,type:a===0?"VALID":"NUMBER"};const e=computeOutputShape2D([n,s],m,u,a,v);E=e[0],S=e[1]}else if(a==="same"){E=Math.ceil(n/u),S=Math.ceil(s/f);const I=Math.max(0,(E-1)*u+m-n),e=Math.max(0,(S-1)*f+A-s),F=Math.floor(I/2),M=I-F,L=Math.floor(e/2),V=e-L;T={top:F,bottom:M,left:L,right:V,type:"SAME"}}else if(a==="valid")T={top:0,bottom:0,left:0,right:0,type:"VALID"},E=Math.ceil((n-m+1)/u),S=Math.ceil((s-A+1)/f);else if(typeof a=="object"){const I=y==="channelsLast"?a[1][0]:a[2][0],e=y==="channelsLast"?a[1][1]:a[2][1],F=y==="channelsLast"?a[2][0]:a[3][0],M=y==="channelsLast"?a[2][1]:a[3][1];T={top:I,bottom:e,left:F,right:M,type:I===0&&e===0&&F===0&&M===0?"VALID":"EXPLICIT"},E=round$3((n-m+I+e)/u+1,v),S=round$3((s-A+F+M)/f+1,v)}else throw Error(`Unknown padding parameter: ${a}`);return{padInfo:T,outHeight:E,outWidth:S}}function get3DPadAndOutInfo(a,n,s,u,f,m,A,v,y,T,E){let S,I,e,F;if(a==="valid"&&(a=0),typeof a=="number"){S={top:a,bottom:a,left:a,right:a,front:a,back:a,type:a===0?"VALID":"NUMBER"};const L=computeOutputShape4D([n,s,u,1],[v,y,T],1,[f,m,A],a,E);I=L[0],e=L[1],F=L[2]}else if(a==="same"){I=Math.ceil(n/f),e=Math.ceil(s/m),F=Math.ceil(u/A);const M=(I-1)*f+v-n,L=(e-1)*m+y-s,V=(F-1)*A+T-u,B=Math.floor(M/2),z=M-B,b=Math.floor(L/2),W=L-b,q=Math.floor(V/2),Y=V-q;S={top:b,bottom:W,left:q,right:Y,front:B,back:z,type:"SAME"}}else throw Error(`Unknown padding parameter: ${a}`);return{padInfo:S,outDepth:I,outHeight:e,outWidth:F}}function round$3(a,n){if(!n)return Math.trunc(a);switch(n){case"round":return Math.round(a);case"ceil":return Math.ceil(a);case"floor":return Math.floor(a);default:throw new Error(`Unknown roundingMode ${n}`)}}function tupleValuesAreOne(a){const[n,s,u]=parseTupleParam(a);return n===1&&s===1&&u===1}function eitherStridesOrDilationsAreOne(a,n){return tupleValuesAreOne(a)||tupleValuesAreOne(n)}function stridesOrDilationsArePositive(a){return parseTupleParam(a).every(n=>n>0)}function convertConv2DDataFormat(a){if(a==="NHWC")return"channelsLast";if(a==="NCHW")return"channelsFirst";throw new Error(`Unknown dataFormat ${a}`)}function checkPadOnDimRoundingMode(a,n,s){if(s!=null){if(typeof n=="string")throw Error(`Error in ${a}: pad must be an integer when using dimRoundingMode ${s} but got pad ${n}.`);if(typeof n=="number")assert$1(isInt(n),()=>`Error in ${a}: pad must be an integer when using dimRoundingMode ${s} but got pad ${n}.`);else if(typeof n=="object")n.forEach(u=>{u.forEach(f=>{assert$1(isInt(f),()=>`Error in ${a}: pad must be an integer when using dimRoundingMode ${s} but got pad ${f}.`)})});else throw Error(`Error in ${a}: Unknown padding parameter: ${n}`)}}/** + */function computeDilation2DInfo(a,n,s,u,f="NHWC",m){const A=a[3],v=[...n,A],y=convertConv2DDataFormat(f);return computeConv2DInfo(a,v,s,m,u,null,null,y)}function computePool2DInfo(a,n,s,u,f,m,A="channelsLast"){const[v,y]=parseTupleParam(n);let T;if(A==="channelsLast")T=[v,y,a[3],a[3]];else if(A==="channelsFirst")T=[v,y,a[1],a[1]];else throw new Error(`Unknown dataFormat ${A}`);return computeConv2DInfo(a,T,s,u,f,m,!1,A)}function computePool3DInfo(a,n,s,u,f,m,A="NDHWC"){const[v,y,T]=parse3TupleParam(n);let E,S;if(A==="NDHWC")S="channelsLast",E=[v,y,T,a[4],a[4]];else if(A==="NCDHW")S="channelsFirst",E=[v,y,T,a[1],a[1]];else throw new Error(`Unknown dataFormat ${A}`);return computeConv3DInfo(a,E,s,u,f,!1,S,m)}function computeConv2DInfo(a,n,s,u,f,m,A=!1,v="channelsLast"){let[y,T,E,S]=[-1,-1,-1,-1];if(v==="channelsLast")[y,T,E,S]=a;else if(v==="channelsFirst")[y,S,T,E]=a;else throw new Error(`Unknown dataFormat ${v}`);const[I,e,,F]=n,[M,L]=parseTupleParam(s),[V,B]=parseTupleParam(u),z=getEffectiveFilterSize(I,V),b=getEffectiveFilterSize(e,B),{padInfo:W,outHeight:q,outWidth:Y}=getPadAndOutInfo(f,T,E,M,L,z,b,m,v),X=A?F*S:F;let Q;return v==="channelsFirst"?Q=[y,X,q,Y]:v==="channelsLast"&&(Q=[y,q,Y,X]),{batchSize:y,dataFormat:v,inHeight:T,inWidth:E,inChannels:S,outHeight:q,outWidth:Y,outChannels:X,padInfo:W,strideHeight:M,strideWidth:L,filterHeight:I,filterWidth:e,effectiveFilterHeight:z,effectiveFilterWidth:b,dilationHeight:V,dilationWidth:B,inShape:a,outShape:Q,filterShape:n}}function computeConv3DInfo(a,n,s,u,f,m=!1,A="channelsLast",v){let[y,T,E,S,I]=[-1,-1,-1,-1,-1];if(A==="channelsLast")[y,T,E,S,I]=a;else if(A==="channelsFirst")[y,I,T,E,S]=a;else throw new Error(`Unknown dataFormat ${A}`);const[e,F,M,,L]=n,[V,B,z]=parse3TupleParam(s),[b,W,q]=parse3TupleParam(u),Y=getEffectiveFilterSize(e,b),X=getEffectiveFilterSize(F,W),Q=getEffectiveFilterSize(M,q),{padInfo:g,outDepth:J,outHeight:re,outWidth:ae}=get3DPadAndOutInfo(f,T,E,S,V,B,z,Y,X,Q,v),fe=m?L*I:L;let pe;return A==="channelsFirst"?pe=[y,fe,J,re,ae]:A==="channelsLast"&&(pe=[y,J,re,ae,fe]),{batchSize:y,dataFormat:A,inDepth:T,inHeight:E,inWidth:S,inChannels:I,outDepth:J,outHeight:re,outWidth:ae,outChannels:fe,padInfo:g,strideDepth:V,strideHeight:B,strideWidth:z,filterDepth:e,filterHeight:F,filterWidth:M,effectiveFilterDepth:Y,effectiveFilterHeight:X,effectiveFilterWidth:Q,dilationDepth:b,dilationHeight:W,dilationWidth:q,inShape:a,outShape:pe,filterShape:n}}function computeOutputShape2D(a,n,s,u,f){u==null&&(u=computeDefaultPad(a,n,s));const m=a[0],A=a[1],v=round$3((m-n+2*u)/s+1,f),y=round$3((A-n+2*u)/s+1,f);return[v,y]}function computeOutputShape4D(a,n,s,u,f,m){f==null&&(f=computeDefaultPad(a,n[0],u[0]));const A=[0,0,0,s];for(let v=0;v<3;v++)a[v]+2*f>=n[v]&&(A[v]=round$3((a[v]-n[v]+2*f)/u[v]+1,m));return A}function computeDefaultPad(a,n,s,u=1){const f=getEffectiveFilterSize(n,u);return Math.floor((a[0]*(s-1)-s+f)/2)}function parseTupleParam(a){return typeof a=="number"?[a,a,a]:a.length===2?[a[0],a[1],1]:a}function parse3TupleParam(a){return typeof a=="number"?[a,a,a]:a}function getEffectiveFilterSize(a,n){return n<=1?a:a+(a-1)*(n-1)}function getPadAndOutInfo(a,n,s,u,f,m,A,v,y){let T,E,S;if(typeof a=="number"){T={top:a,bottom:a,left:a,right:a,type:a===0?"VALID":"NUMBER"};const e=computeOutputShape2D([n,s],m,u,a,v);E=e[0],S=e[1]}else if(a==="same"){E=Math.ceil(n/u),S=Math.ceil(s/f);const I=Math.max(0,(E-1)*u+m-n),e=Math.max(0,(S-1)*f+A-s),F=Math.floor(I/2),M=I-F,L=Math.floor(e/2),V=e-L;T={top:F,bottom:M,left:L,right:V,type:"SAME"}}else if(a==="valid")T={top:0,bottom:0,left:0,right:0,type:"VALID"},E=Math.ceil((n-m+1)/u),S=Math.ceil((s-A+1)/f);else if(typeof a=="object"){const I=y==="channelsLast"?a[1][0]:a[2][0],e=y==="channelsLast"?a[1][1]:a[2][1],F=y==="channelsLast"?a[2][0]:a[3][0],M=y==="channelsLast"?a[2][1]:a[3][1];T={top:I,bottom:e,left:F,right:M,type:I===0&&e===0&&F===0&&M===0?"VALID":"EXPLICIT"},E=round$3((n-m+I+e)/u+1,v),S=round$3((s-A+F+M)/f+1,v)}else throw Error(`Unknown padding parameter: ${a}`);return{padInfo:T,outHeight:E,outWidth:S}}function get3DPadAndOutInfo(a,n,s,u,f,m,A,v,y,T,E){let S,I,e,F;if(a==="valid"&&(a=0),typeof a=="number"){S={top:a,bottom:a,left:a,right:a,front:a,back:a,type:a===0?"VALID":"NUMBER"};const L=computeOutputShape4D([n,s,u,1],[v,y,T],1,[f,m,A],a,E);I=L[0],e=L[1],F=L[2]}else if(a==="same"){I=Math.ceil(n/f),e=Math.ceil(s/m),F=Math.ceil(u/A);const M=(I-1)*f+v-n,L=(e-1)*m+y-s,V=(F-1)*A+T-u,B=Math.floor(M/2),z=M-B,b=Math.floor(L/2),W=L-b,q=Math.floor(V/2),Y=V-q;S={top:b,bottom:W,left:q,right:Y,front:B,back:z,type:"SAME"}}else throw Error(`Unknown padding parameter: ${a}`);return{padInfo:S,outDepth:I,outHeight:e,outWidth:F}}function round$3(a,n){if(!n)return Math.trunc(a);switch(n){case"round":return Math.round(a);case"ceil":return Math.ceil(a);case"floor":return Math.floor(a);default:throw new Error(`Unknown roundingMode ${n}`)}}function tupleValuesAreOne(a){const[n,s,u]=parseTupleParam(a);return n===1&&s===1&&u===1}function eitherStridesOrDilationsAreOne(a,n){return tupleValuesAreOne(a)||tupleValuesAreOne(n)}function stridesOrDilationsArePositive(a){return parseTupleParam(a).every(n=>n>0)}function convertConv2DDataFormat(a){if(a==="NHWC")return"channelsLast";if(a==="NCHW")return"channelsFirst";throw new Error(`Unknown dataFormat ${a}`)}function checkPadOnDimRoundingMode(a,n,s){if(s!=null){if(typeof n=="string")throw Error(`Error in ${a}: pad must be an integer when using dimRoundingMode ${s} but got pad ${n}.`);if(typeof n=="number")assert$1(isInt(n),()=>`Error in ${a}: pad must be an integer when using dimRoundingMode ${s} but got pad ${n}.`);else if(typeof n=="object")n.forEach(u=>{u.forEach(f=>{assert$1(isInt(f),()=>`Error in ${a}: pad must be an integer when using dimRoundingMode ${s} but got pad ${f}.`)})});else throw Error(`Error in ${a}: Unknown padding parameter: ${n}`)}}/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -3930,7 +3930,7 @@ Ooh no!!`);break}m[y]=T,v=Math.min(v,T)}for(let y=0;y>>0,I-=y,I*=y,y=I>>>0,I-=y,y+=I*4294967296}return(y>>>0)*23283064365386963e-26};return T}s&&s.exports?s.exports=A:u&&u.amd?u(function(){return A}):this.alea=A})(commonjsGlobal,a,!1)})(alea$1);var aleaExports=alea$1.exports,xor128$1={exports:{}};xor128$1.exports;(function(a){(function(n,s,u){function f(v){var y=this,T="";y.x=0,y.y=0,y.z=0,y.w=0,y.next=function(){var S=y.x^y.x<<11;return y.x=y.y,y.y=y.z,y.z=y.w,y.w^=y.w>>>19^S^S>>>8},v===(v|0)?y.x=v:T+=v;for(var E=0;E>>0)/4294967296};return S.double=function(){do var I=T.next()>>>11,e=(T.next()>>>0)/4294967296,F=(I+e)/(1<<21);while(F===0);return F},S.int32=T.next,S.quick=S,E&&(typeof E=="object"&&m(E,T),S.state=function(){return m(T,{})}),S}s&&s.exports?s.exports=A:u&&u.amd?u(function(){return A}):this.xor128=A})(commonjsGlobal,a,!1)})(xor128$1);var xor128Exports=xor128$1.exports,xorwow$1={exports:{}};xorwow$1.exports;(function(a){(function(n,s,u){function f(v){var y=this,T="";y.next=function(){var S=y.x^y.x>>>2;return y.x=y.y,y.y=y.z,y.z=y.w,y.w=y.v,(y.d=y.d+362437|0)+(y.v=y.v^y.v<<4^(S^S<<1))|0},y.x=0,y.y=0,y.z=0,y.w=0,y.v=0,v===(v|0)?y.x=v:T+=v;for(var E=0;E>>4),y.next()}function m(v,y){return y.x=v.x,y.y=v.y,y.z=v.z,y.w=v.w,y.v=v.v,y.d=v.d,y}function A(v,y){var T=new f(v),E=y&&y.state,S=function(){return(T.next()>>>0)/4294967296};return S.double=function(){do var I=T.next()>>>11,e=(T.next()>>>0)/4294967296,F=(I+e)/(1<<21);while(F===0);return F},S.int32=T.next,S.quick=S,E&&(typeof E=="object"&&m(E,T),S.state=function(){return m(T,{})}),S}s&&s.exports?s.exports=A:u&&u.amd?u(function(){return A}):this.xorwow=A})(commonjsGlobal,a,!1)})(xorwow$1);var xorwowExports=xorwow$1.exports,xorshift7$1={exports:{}};xorshift7$1.exports;(function(a){(function(n,s,u){function f(v){var y=this;y.next=function(){var E=y.x,S=y.i,I,e;return I=E[S],I^=I>>>7,e=I^I<<24,I=E[S+1&7],e^=I^I>>>10,I=E[S+3&7],e^=I^I>>>3,I=E[S+4&7],e^=I^I<<7,I=E[S+7&7],I=I^I<<13,e^=I^I<<9,E[S]=e,y.i=S+1&7,e};function T(E,S){var I,e=[];if(S===(S|0))e[0]=S;else for(S=""+S,I=0;I0;--I)E.next()}T(y,v)}function m(v,y){return y.x=v.x.slice(),y.i=v.i,y}function A(v,y){v==null&&(v=+new Date);var T=new f(v),E=y&&y.state,S=function(){return(T.next()>>>0)/4294967296};return S.double=function(){do var I=T.next()>>>11,e=(T.next()>>>0)/4294967296,F=(I+e)/(1<<21);while(F===0);return F},S.int32=T.next,S.quick=S,E&&(E.x&&m(E,T),S.state=function(){return m(T,{})}),S}s&&s.exports?s.exports=A:u&&u.amd?u(function(){return A}):this.xorshift7=A})(commonjsGlobal,a,!1)})(xorshift7$1);var xorshift7Exports=xorshift7$1.exports,xor4096$1={exports:{}};xor4096$1.exports;(function(a){(function(n,s,u){function f(v){var y=this;y.next=function(){var E=y.w,S=y.X,I=y.i,e,F;return y.w=E=E+1640531527|0,F=S[I+34&127],e=S[I=I+1&127],F^=F<<13,e^=e<<17,F^=F>>>15,e^=e>>>12,F=S[I]=F^e,y.i=I,F+(E^E>>>16)|0};function T(E,S){var I,e,F,M,L,V=[],B=128;for(S===(S|0)?(e=S,S=null):(S=S+"\0",e=0,B=Math.max(B,S.length)),F=0,M=-32;M>>15,e^=e<<4,e^=e>>>13,M>=0&&(L=L+1640531527|0,I=V[M&127]^=e+L,F=I==0?F+1:0);for(F>=128&&(V[(S&&S.length||0)&127]=-1),F=127,M=4*128;M>0;--M)e=V[F+34&127],I=V[F=F+1&127],e^=e<<13,I^=I<<17,e^=e>>>15,I^=I>>>12,V[F]=e^I;E.w=L,E.X=V,E.i=F}T(y,v)}function m(v,y){return y.i=v.i,y.w=v.w,y.X=v.X.slice(),y}function A(v,y){v==null&&(v=+new Date);var T=new f(v),E=y&&y.state,S=function(){return(T.next()>>>0)/4294967296};return S.double=function(){do var I=T.next()>>>11,e=(T.next()>>>0)/4294967296,F=(I+e)/(1<<21);while(F===0);return F},S.int32=T.next,S.quick=S,E&&(E.X&&m(E,T),S.state=function(){return m(T,{})}),S}s&&s.exports?s.exports=A:u&&u.amd?u(function(){return A}):this.xor4096=A})(commonjsGlobal,a,!1)})(xor4096$1);var xor4096Exports=xor4096$1.exports,tychei$1={exports:{}};tychei$1.exports;(function(a){(function(n,s,u){function f(v){var y=this,T="";y.next=function(){var S=y.b,I=y.c,e=y.d,F=y.a;return S=S<<25^S>>>7^I,I=I-e|0,e=e<<24^e>>>8^F,F=F-S|0,y.b=S=S<<20^S>>>12^I,y.c=I=I-e|0,y.d=e<<16^I>>>16^F,y.a=F-S|0},y.a=0,y.b=0,y.c=-1640531527,y.d=1367130551,v===Math.floor(v)?(y.a=v/4294967296|0,y.b=v|0):T+=v;for(var E=0;E>>0)/4294967296};return S.double=function(){do var I=T.next()>>>11,e=(T.next()>>>0)/4294967296,F=(I+e)/(1<<21);while(F===0);return F},S.int32=T.next,S.quick=S,E&&(typeof E=="object"&&m(E,T),S.state=function(){return m(T,{})}),S}s&&s.exports?s.exports=A:u&&u.amd?u(function(){return A}):this.tychei=A})(commonjsGlobal,a,!1)})(tychei$1);var tycheiExports=tychei$1.exports,seedrandom$1={exports:{}};(function(a){(function(n,s,u){var f=256,m=6,A=52,v="random",y=u.pow(f,m),T=u.pow(2,A),E=T*2,S=f-1,I;function e(b,W,q){var Y=[];W=W==!0?{entropy:!0}:W||{};var X=V(L(W.entropy?[b,z(s)]:b??B(),3),Y),H=new F(Y),g=function(){for(var J=H.g(m),re=y,ae=0;J=E;)J/=2,re/=2,ae>>>=1;return(J+ae)/re};return g.int32=function(){return H.g(4)|0},g.quick=function(){return H.g(4)/4294967296},g.double=g,V(z(H.S),s),(W.pass||q||function(J,re,ae,fe){return fe&&(fe.S&&M(fe,H),J.state=function(){return M(H,{})}),ae?(u[v]=J,re):J})(g,X,"global"in W?W.global:this==u,W.state)}function F(b){var W,q=b.length,Y=this,X=0,H=Y.i=Y.j=0,g=Y.S=[];for(q||(b=[q++]);X>>0,I-=y,I*=y,y=I>>>0,I-=y,y+=I*4294967296}return(y>>>0)*23283064365386963e-26};return T}s&&s.exports?s.exports=A:u&&u.amd?u(function(){return A}):this.alea=A})(commonjsGlobal,a,!1)})(alea$1);var aleaExports=alea$1.exports,xor128$1={exports:{}};xor128$1.exports;(function(a){(function(n,s,u){function f(v){var y=this,T="";y.x=0,y.y=0,y.z=0,y.w=0,y.next=function(){var S=y.x^y.x<<11;return y.x=y.y,y.y=y.z,y.z=y.w,y.w^=y.w>>>19^S^S>>>8},v===(v|0)?y.x=v:T+=v;for(var E=0;E>>0)/4294967296};return S.double=function(){do var I=T.next()>>>11,e=(T.next()>>>0)/4294967296,F=(I+e)/(1<<21);while(F===0);return F},S.int32=T.next,S.quick=S,E&&(typeof E=="object"&&m(E,T),S.state=function(){return m(T,{})}),S}s&&s.exports?s.exports=A:u&&u.amd?u(function(){return A}):this.xor128=A})(commonjsGlobal,a,!1)})(xor128$1);var xor128Exports=xor128$1.exports,xorwow$1={exports:{}};xorwow$1.exports;(function(a){(function(n,s,u){function f(v){var y=this,T="";y.next=function(){var S=y.x^y.x>>>2;return y.x=y.y,y.y=y.z,y.z=y.w,y.w=y.v,(y.d=y.d+362437|0)+(y.v=y.v^y.v<<4^(S^S<<1))|0},y.x=0,y.y=0,y.z=0,y.w=0,y.v=0,v===(v|0)?y.x=v:T+=v;for(var E=0;E>>4),y.next()}function m(v,y){return y.x=v.x,y.y=v.y,y.z=v.z,y.w=v.w,y.v=v.v,y.d=v.d,y}function A(v,y){var T=new f(v),E=y&&y.state,S=function(){return(T.next()>>>0)/4294967296};return S.double=function(){do var I=T.next()>>>11,e=(T.next()>>>0)/4294967296,F=(I+e)/(1<<21);while(F===0);return F},S.int32=T.next,S.quick=S,E&&(typeof E=="object"&&m(E,T),S.state=function(){return m(T,{})}),S}s&&s.exports?s.exports=A:u&&u.amd?u(function(){return A}):this.xorwow=A})(commonjsGlobal,a,!1)})(xorwow$1);var xorwowExports=xorwow$1.exports,xorshift7$1={exports:{}};xorshift7$1.exports;(function(a){(function(n,s,u){function f(v){var y=this;y.next=function(){var E=y.x,S=y.i,I,e;return I=E[S],I^=I>>>7,e=I^I<<24,I=E[S+1&7],e^=I^I>>>10,I=E[S+3&7],e^=I^I>>>3,I=E[S+4&7],e^=I^I<<7,I=E[S+7&7],I=I^I<<13,e^=I^I<<9,E[S]=e,y.i=S+1&7,e};function T(E,S){var I,e=[];if(S===(S|0))e[0]=S;else for(S=""+S,I=0;I0;--I)E.next()}T(y,v)}function m(v,y){return y.x=v.x.slice(),y.i=v.i,y}function A(v,y){v==null&&(v=+new Date);var T=new f(v),E=y&&y.state,S=function(){return(T.next()>>>0)/4294967296};return S.double=function(){do var I=T.next()>>>11,e=(T.next()>>>0)/4294967296,F=(I+e)/(1<<21);while(F===0);return F},S.int32=T.next,S.quick=S,E&&(E.x&&m(E,T),S.state=function(){return m(T,{})}),S}s&&s.exports?s.exports=A:u&&u.amd?u(function(){return A}):this.xorshift7=A})(commonjsGlobal,a,!1)})(xorshift7$1);var xorshift7Exports=xorshift7$1.exports,xor4096$1={exports:{}};xor4096$1.exports;(function(a){(function(n,s,u){function f(v){var y=this;y.next=function(){var E=y.w,S=y.X,I=y.i,e,F;return y.w=E=E+1640531527|0,F=S[I+34&127],e=S[I=I+1&127],F^=F<<13,e^=e<<17,F^=F>>>15,e^=e>>>12,F=S[I]=F^e,y.i=I,F+(E^E>>>16)|0};function T(E,S){var I,e,F,M,L,V=[],B=128;for(S===(S|0)?(e=S,S=null):(S=S+"\0",e=0,B=Math.max(B,S.length)),F=0,M=-32;M>>15,e^=e<<4,e^=e>>>13,M>=0&&(L=L+1640531527|0,I=V[M&127]^=e+L,F=I==0?F+1:0);for(F>=128&&(V[(S&&S.length||0)&127]=-1),F=127,M=4*128;M>0;--M)e=V[F+34&127],I=V[F=F+1&127],e^=e<<13,I^=I<<17,e^=e>>>15,I^=I>>>12,V[F]=e^I;E.w=L,E.X=V,E.i=F}T(y,v)}function m(v,y){return y.i=v.i,y.w=v.w,y.X=v.X.slice(),y}function A(v,y){v==null&&(v=+new Date);var T=new f(v),E=y&&y.state,S=function(){return(T.next()>>>0)/4294967296};return S.double=function(){do var I=T.next()>>>11,e=(T.next()>>>0)/4294967296,F=(I+e)/(1<<21);while(F===0);return F},S.int32=T.next,S.quick=S,E&&(E.X&&m(E,T),S.state=function(){return m(T,{})}),S}s&&s.exports?s.exports=A:u&&u.amd?u(function(){return A}):this.xor4096=A})(commonjsGlobal,a,!1)})(xor4096$1);var xor4096Exports=xor4096$1.exports,tychei$1={exports:{}};tychei$1.exports;(function(a){(function(n,s,u){function f(v){var y=this,T="";y.next=function(){var S=y.b,I=y.c,e=y.d,F=y.a;return S=S<<25^S>>>7^I,I=I-e|0,e=e<<24^e>>>8^F,F=F-S|0,y.b=S=S<<20^S>>>12^I,y.c=I=I-e|0,y.d=e<<16^I>>>16^F,y.a=F-S|0},y.a=0,y.b=0,y.c=-1640531527,y.d=1367130551,v===Math.floor(v)?(y.a=v/4294967296|0,y.b=v|0):T+=v;for(var E=0;E>>0)/4294967296};return S.double=function(){do var I=T.next()>>>11,e=(T.next()>>>0)/4294967296,F=(I+e)/(1<<21);while(F===0);return F},S.int32=T.next,S.quick=S,E&&(typeof E=="object"&&m(E,T),S.state=function(){return m(T,{})}),S}s&&s.exports?s.exports=A:u&&u.amd?u(function(){return A}):this.tychei=A})(commonjsGlobal,a,!1)})(tychei$1);var tycheiExports=tychei$1.exports,seedrandom$1={exports:{}};(function(a){(function(n,s,u){var f=256,m=6,A=52,v="random",y=u.pow(f,m),T=u.pow(2,A),E=T*2,S=f-1,I;function e(b,W,q){var Y=[];W=W==!0?{entropy:!0}:W||{};var X=V(L(W.entropy?[b,z(s)]:b??B(),3),Y),Q=new F(Y),g=function(){for(var J=Q.g(m),re=y,ae=0;J=E;)J/=2,re/=2,ae>>>=1;return(J+ae)/re};return g.int32=function(){return Q.g(4)|0},g.quick=function(){return Q.g(4)/4294967296},g.double=g,V(z(Q.S),s),(W.pass||q||function(J,re,ae,fe){return fe&&(fe.S&&M(fe,Q),J.state=function(){return M(Q,{})}),ae?(u[v]=J,re):J})(g,X,"global"in W?W.global:this==u,W.state)}function F(b){var W,q=b.length,Y=this,X=0,Q=Y.i=Y.j=0,g=Y.S=[];for(q||(b=[q++]);X`Error in fused conv2d: got dataFormat of ${f} but only NHWC is currently supported for the case of gradient depth is 0 and the activation is not linear.`);let q=conv2d$2(a,n,s,u,f,m,A);return v!=null&&(q=add$1(q,v)),applyActivation$1(q,y,T,E)}const S=convertToTensor(a,"x","conv2d","float32"),I=convertToTensor(n,"filter","conv2d","float32");let e=S,F=!1;S.rank===3&&(F=!0,e=reshape$2(S,[1,S.shape[0],S.shape[1],S.shape[2]])),assert$1(e.rank===4,()=>`Error in fused conv2d: input must be rank 4, but got rank ${e.rank}.`),assert$1(I.rank===4,()=>`Error in fused conv2d: filter must be rank 4, but got rank ${I.rank}.`),checkPadOnDimRoundingMode("fused conv2d",u,A);const M=f==="NHWC"?e.shape[3]:e.shape[1];assert$1(I.shape[2]===M,()=>`Error in conv2d: depth of input (${M}) must match input depth for filter ${I.shape[2]}.`),assert$1(eitherStridesOrDilationsAreOne(s,m),()=>`Error in conv2D: Either strides or dilations must be 1. Got strides ${s} and dilations '${m}'`);const L=computeConv2DInfo(e.shape,I.shape,s,m,u,A);let V;v!=null&&(V=convertToTensor(v,"bias","fused conv2d"),[V]=makeTypesMatch(V,S),f==="NHWC"?assertAndGetBroadcastShape(L.outShape,V.shape):(assert$1(V.shape.length<=1,()=>`Error in fused conv2d: only supports scalar or 1-D Tensor bias for NCHW format but got the bias of rank-${V.shape.length}.`),assert$1(V.shape.length===0||V.shape[0]===L.outChannels||V.shape[0]===1,()=>`Error in fused conv2d: bias shape (${V.shape}) is not compatible with the number of output channels (${L.outChannels})`)));let B;if(T!=null){const q=T.shape;if(assert$1(q.length<=1||q.length===3,()=>`Error in fused conv2d: only supports scalar, 1-D Tensor or 3-D Tensor PReLU activation weights but got a tensor of rank-${q.length}.`),q.length===1)assert$1(q[0]===1||q[0]===L.outChannels,()=>`Error in fused conv2d: PReLU activation weights (${q}) is not compatible with the number of output channels (${L.outChannels}).`);else if(q.length===3)try{assertAndGetBroadcastShape(q,L.outShape)}catch{const X=`Error in fused conv2d: PReLU activation weights (${q}) is not compatible with the output shape of the conv2d (${L.outShape}).`;throw Error(X)}B=convertToTensor(T,"prelu weights","fused conv2d")}const z=(q,Y)=>{assert$1(f==="NHWC",()=>`Error in gradient of fused conv2D: got dataFormat of ${f} but only NHWC is currently supported.`);const[X,H,g,J]=Y,re=getFusedDyActivation(q,g,y);assert$1(tupleValuesAreOne(m),()=>`Error in gradient of fused conv2D: dilation rates greater than 1 are not yet supported in gradients. Got dilations '${m}'`);const ae=conv2DBackpropInput$2(H.shape,re,X,s,u),fe=conv2DBackpropFilter$2(H,re,X.shape,s,u),pe=[ae,fe];if(J!=null){const me=getFusedBiasGradient(J,re);pe.push(me)}return pe},b={x:e,filter:I,bias:V,preluActivationWeights:B},W={strides:s,pad:u,dataFormat:f,dilations:m,dimRoundingMode:A,activation:y,leakyreluAlpha:E};return v==null?customGrad((Y,X,H)=>{let g=ENGINE.runKernel(FusedConv2D,b,W);return H([X,Y,g]),F&&(g=reshape$2(g,[g.shape[1],g.shape[2],g.shape[3]])),{value:g,gradFunc:z}})(e,I):customGrad((Y,X,H,g)=>{let J=ENGINE.runKernel(FusedConv2D,b,W);return g([X,Y,J,H]),F&&(J=reshape$2(J,[J.shape[1],J.shape[2],J.shape[3]])),{value:J,gradFunc:z}})(e,I,V)}const conv2d$1=op({fusedConv2d_});/** + */function fusedConv2d_({x:a,filter:n,strides:s,pad:u,dataFormat:f="NHWC",dilations:m=[1,1],dimRoundingMode:A,bias:v,activation:y="linear",preluActivationWeights:T,leakyreluAlpha:E}){if(y=y||"linear",shouldFuse(ENGINE.state.gradientDepth,y)===!1){assert$1(f==="NHWC",()=>`Error in fused conv2d: got dataFormat of ${f} but only NHWC is currently supported for the case of gradient depth is 0 and the activation is not linear.`);let q=conv2d$2(a,n,s,u,f,m,A);return v!=null&&(q=add$1(q,v)),applyActivation$1(q,y,T,E)}const S=convertToTensor(a,"x","conv2d","float32"),I=convertToTensor(n,"filter","conv2d","float32");let e=S,F=!1;S.rank===3&&(F=!0,e=reshape$2(S,[1,S.shape[0],S.shape[1],S.shape[2]])),assert$1(e.rank===4,()=>`Error in fused conv2d: input must be rank 4, but got rank ${e.rank}.`),assert$1(I.rank===4,()=>`Error in fused conv2d: filter must be rank 4, but got rank ${I.rank}.`),checkPadOnDimRoundingMode("fused conv2d",u,A);const M=f==="NHWC"?e.shape[3]:e.shape[1];assert$1(I.shape[2]===M,()=>`Error in conv2d: depth of input (${M}) must match input depth for filter ${I.shape[2]}.`),assert$1(eitherStridesOrDilationsAreOne(s,m),()=>`Error in conv2D: Either strides or dilations must be 1. Got strides ${s} and dilations '${m}'`);const L=computeConv2DInfo(e.shape,I.shape,s,m,u,A);let V;v!=null&&(V=convertToTensor(v,"bias","fused conv2d"),[V]=makeTypesMatch(V,S),f==="NHWC"?assertAndGetBroadcastShape(L.outShape,V.shape):(assert$1(V.shape.length<=1,()=>`Error in fused conv2d: only supports scalar or 1-D Tensor bias for NCHW format but got the bias of rank-${V.shape.length}.`),assert$1(V.shape.length===0||V.shape[0]===L.outChannels||V.shape[0]===1,()=>`Error in fused conv2d: bias shape (${V.shape}) is not compatible with the number of output channels (${L.outChannels})`)));let B;if(T!=null){const q=T.shape;if(assert$1(q.length<=1||q.length===3,()=>`Error in fused conv2d: only supports scalar, 1-D Tensor or 3-D Tensor PReLU activation weights but got a tensor of rank-${q.length}.`),q.length===1)assert$1(q[0]===1||q[0]===L.outChannels,()=>`Error in fused conv2d: PReLU activation weights (${q}) is not compatible with the number of output channels (${L.outChannels}).`);else if(q.length===3)try{assertAndGetBroadcastShape(q,L.outShape)}catch{const X=`Error in fused conv2d: PReLU activation weights (${q}) is not compatible with the output shape of the conv2d (${L.outShape}).`;throw Error(X)}B=convertToTensor(T,"prelu weights","fused conv2d")}const z=(q,Y)=>{assert$1(f==="NHWC",()=>`Error in gradient of fused conv2D: got dataFormat of ${f} but only NHWC is currently supported.`);const[X,Q,g,J]=Y,re=getFusedDyActivation(q,g,y);assert$1(tupleValuesAreOne(m),()=>`Error in gradient of fused conv2D: dilation rates greater than 1 are not yet supported in gradients. Got dilations '${m}'`);const ae=conv2DBackpropInput$2(Q.shape,re,X,s,u),fe=conv2DBackpropFilter$2(Q,re,X.shape,s,u),pe=[ae,fe];if(J!=null){const me=getFusedBiasGradient(J,re);pe.push(me)}return pe},b={x:e,filter:I,bias:V,preluActivationWeights:B},W={strides:s,pad:u,dataFormat:f,dilations:m,dimRoundingMode:A,activation:y,leakyreluAlpha:E};return v==null?customGrad((Y,X,Q)=>{let g=ENGINE.runKernel(FusedConv2D,b,W);return Q([X,Y,g]),F&&(g=reshape$2(g,[g.shape[1],g.shape[2],g.shape[3]])),{value:g,gradFunc:z}})(e,I):customGrad((Y,X,Q,g)=>{let J=ENGINE.runKernel(FusedConv2D,b,W);return g([X,Y,J,Q]),F&&(J=reshape$2(J,[J.shape[1],J.shape[2],J.shape[3]])),{value:J,gradFunc:z}})(e,I,V)}const conv2d$1=op({fusedConv2d_});/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -4680,7 +4680,7 @@ Ooh no!!`);break}m[y]=T,v=Math.min(v,T)}for(let y=0;y`Error in fused matMul: inner shapes (${E}) and (${S}) of Tensors with shapes ${y.shape} and ${T.shape} and transposeA=${s} and transposeB=${u} must match.`);const z=assertAndGetBroadcastShape(y.shape.slice(0,-2),T.shape.slice(0,-2)).concat([I,e]),b=s?reshape$2(y,[L,E,I]):reshape$2(y,[L,I,E]),W=u?reshape$2(T,[V,e,S]):reshape$2(T,[V,S,e]);let q;f!=null&&(q=convertToTensor(f,"bias","fused matMul"),[q]=makeTypesMatch(q,y),assertAndGetBroadcastShape(z,q.shape));let Y;A!=null&&(Y=convertToTensor(A,"prelu weights","fused matMul"));const X=(J,re)=>{const[ae,fe,pe,me]=re,Se=getFusedDyActivation(reshape$2(J,pe.shape),pe,m);let ve,we;if(!s&&!u?(ve=matMul$1(Se,fe,!1,!0),we=matMul$1(ae,Se,!0,!1)):!s&&u?(ve=matMul$1(Se,fe,!1,!1),we=matMul$1(Se,ae,!0,!1)):s&&!u?(ve=matMul$1(fe,Se,!1,!0),we=matMul$1(ae,Se,!1,!1)):(ve=matMul$1(fe,Se,!0,!0),we=matMul$1(Se,ae,!0,!0)),f!=null){const Ne=getFusedBiasGradient(me,Se);return[ve,we,Ne]}else return[ve,we]},H={a:b,b:W,bias:q,preluActivationWeights:Y},g={transposeA:s,transposeB:u,activation:m,leakyreluAlpha:v};return f==null?customGrad((re,ae,fe)=>{const pe=ENGINE.runKernel(_FusedMatMul,H,g);return fe([re,ae,pe]),{value:reshape$2(pe,z),gradFunc:X}})(b,W):customGrad((re,ae,fe,pe)=>{const me=ENGINE.runKernel(_FusedMatMul,H,g);return pe([re,ae,me,fe]),{value:reshape$2(me,z),gradFunc:X}})(b,W,q)}const matMul=op({fusedMatMul_});/** + */function fusedMatMul_({a,b:n,transposeA:s=!1,transposeB:u=!1,bias:f,activation:m="linear",preluActivationWeights:A,leakyreluAlpha:v=.2}){if(shouldFuse(ENGINE.state.gradientDepth,m)===!1){let J=matMul$1(a,n,s,u);return f!=null&&(J=add$1(J,f)),applyActivation$1(J,m,A,v)}let y=convertToTensor(a,"a","fused matMul"),T=convertToTensor(n,"b","fused matMul");[y,T]=makeTypesMatch(y,T);const E=s?y.shape[y.rank-2]:y.shape[y.rank-1],S=u?T.shape[T.rank-1]:T.shape[T.rank-2],I=s?y.shape[y.rank-1]:y.shape[y.rank-2],e=u?T.shape[T.rank-2]:T.shape[T.rank-1],F=y.shape.slice(0,-2),M=T.shape.slice(0,-2),L=sizeFromShape(F),V=sizeFromShape(M);assert$1(E===S,()=>`Error in fused matMul: inner shapes (${E}) and (${S}) of Tensors with shapes ${y.shape} and ${T.shape} and transposeA=${s} and transposeB=${u} must match.`);const z=assertAndGetBroadcastShape(y.shape.slice(0,-2),T.shape.slice(0,-2)).concat([I,e]),b=s?reshape$2(y,[L,E,I]):reshape$2(y,[L,I,E]),W=u?reshape$2(T,[V,e,S]):reshape$2(T,[V,S,e]);let q;f!=null&&(q=convertToTensor(f,"bias","fused matMul"),[q]=makeTypesMatch(q,y),assertAndGetBroadcastShape(z,q.shape));let Y;A!=null&&(Y=convertToTensor(A,"prelu weights","fused matMul"));const X=(J,re)=>{const[ae,fe,pe,me]=re,Se=getFusedDyActivation(reshape$2(J,pe.shape),pe,m);let ve,we;if(!s&&!u?(ve=matMul$1(Se,fe,!1,!0),we=matMul$1(ae,Se,!0,!1)):!s&&u?(ve=matMul$1(Se,fe,!1,!1),we=matMul$1(Se,ae,!0,!1)):s&&!u?(ve=matMul$1(fe,Se,!1,!0),we=matMul$1(ae,Se,!1,!1)):(ve=matMul$1(fe,Se,!0,!0),we=matMul$1(Se,ae,!0,!0)),f!=null){const Ne=getFusedBiasGradient(me,Se);return[ve,we,Ne]}else return[ve,we]},Q={a:b,b:W,bias:q,preluActivationWeights:Y},g={transposeA:s,transposeB:u,activation:m,leakyreluAlpha:v};return f==null?customGrad((re,ae,fe)=>{const pe=ENGINE.runKernel(_FusedMatMul,Q,g);return fe([re,ae,pe]),{value:reshape$2(pe,z),gradFunc:X}})(b,W):customGrad((re,ae,fe,pe)=>{const me=ENGINE.runKernel(_FusedMatMul,Q,g);return pe([re,ae,me,fe]),{value:reshape$2(me,z),gradFunc:X}})(b,W,q)}const matMul=op({fusedMatMul_});/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -4995,7 +4995,7 @@ Ooh no!!`);break}m[y]=T,v=Math.min(v,T)}for(let y=0;y=2,()=>`qr() requires input tensor to have a rank >= 2, but got rank ${a.rank}`),a.rank===2)return qr2d(a,n);{const s=a.shape.slice(0,a.shape.length-2).reduce((y,T)=>y*T),u=unstack(reshape$2(a,[s,a.shape[a.shape.length-2],a.shape[a.shape.length-1]]),0),f=[],m=[];u.forEach(y=>{const[T,E]=qr2d(y,n);f.push(T),m.push(E)});const A=reshape$2(stack(f,0),a.shape),v=reshape$2(stack(m,0),a.shape);return[A,v]}}function qr2d(a,n=!1){return ENGINE.tidy(()=>{assert$1(a.shape.length===2,()=>`qr2d() requires a 2D Tensor, but got a ${a.shape.length}D Tensor.`);const s=a.shape[0],u=a.shape[1];let f=eye(s),m=clone(a);const A=tensor2d([[1]],[1,1]);let v=clone(A);const y=s>=u?u:s;for(let T=0;T{const e=slice$2(m,[T,T],[s-T,1]),F=norm(e),M=slice$2(m,[T,T],[1,1]),L=where(greater$2(M,0),tensor2d([[-1]]),tensor2d([[1]])),V=sub$2(M,mul(L,F)),B=div$1(e,V);B.shape[0]===1?v=clone(A):v=concat$2([A,slice$2(B,[1,0],[B.shape[0]-1,B.shape[1]])],0);const z=neg$2(div$1(matMul$1(L,V),F)),b=slice$2(m,[T,0],[s-T,u]),W=mul(z,v),q=transpose$2(v);if(T===0)m=sub$2(b,matMul$1(W,matMul$1(q,b)));else{const H=sub$2(b,matMul$1(W,matMul$1(q,b)));m=concat$2([slice$2(m,[0,0],[T,u]),H],0)}const Y=transpose$2(W),X=slice$2(f,[0,T],[s,f.shape[1]-T]);if(T===0)f=sub$2(X,matMul$1(matMul$1(X,v),Y));else{const H=sub$2(X,matMul$1(matMul$1(X,v),Y));f=concat$2([slice$2(f,[0,0],[s,T]),H],1)}return[v,m,f]}),dispose([E,S,I])}return!n&&s>u&&(f=slice$2(f,[0,0],[s,u]),m=slice$2(m,[0,0],[u,u])),[f,m]})}const qr=op({qr_});/** + */function qr_(a,n=!1){if(assert$1(a.rank>=2,()=>`qr() requires input tensor to have a rank >= 2, but got rank ${a.rank}`),a.rank===2)return qr2d(a,n);{const s=a.shape.slice(0,a.shape.length-2).reduce((y,T)=>y*T),u=unstack(reshape$2(a,[s,a.shape[a.shape.length-2],a.shape[a.shape.length-1]]),0),f=[],m=[];u.forEach(y=>{const[T,E]=qr2d(y,n);f.push(T),m.push(E)});const A=reshape$2(stack(f,0),a.shape),v=reshape$2(stack(m,0),a.shape);return[A,v]}}function qr2d(a,n=!1){return ENGINE.tidy(()=>{assert$1(a.shape.length===2,()=>`qr2d() requires a 2D Tensor, but got a ${a.shape.length}D Tensor.`);const s=a.shape[0],u=a.shape[1];let f=eye(s),m=clone(a);const A=tensor2d([[1]],[1,1]);let v=clone(A);const y=s>=u?u:s;for(let T=0;T{const e=slice$2(m,[T,T],[s-T,1]),F=norm(e),M=slice$2(m,[T,T],[1,1]),L=where(greater$2(M,0),tensor2d([[-1]]),tensor2d([[1]])),V=sub$2(M,mul(L,F)),B=div$1(e,V);B.shape[0]===1?v=clone(A):v=concat$2([A,slice$2(B,[1,0],[B.shape[0]-1,B.shape[1]])],0);const z=neg$2(div$1(matMul$1(L,V),F)),b=slice$2(m,[T,0],[s-T,u]),W=mul(z,v),q=transpose$2(v);if(T===0)m=sub$2(b,matMul$1(W,matMul$1(q,b)));else{const Q=sub$2(b,matMul$1(W,matMul$1(q,b)));m=concat$2([slice$2(m,[0,0],[T,u]),Q],0)}const Y=transpose$2(W),X=slice$2(f,[0,T],[s,f.shape[1]-T]);if(T===0)f=sub$2(X,matMul$1(matMul$1(X,v),Y));else{const Q=sub$2(X,matMul$1(matMul$1(X,v),Y));f=concat$2([slice$2(f,[0,0],[s,T]),Q],1)}return[v,m,f]}),dispose([E,S,I])}return!n&&s>u&&(f=slice$2(f,[0,0],[s,u]),m=slice$2(m,[0,0],[u,u])),[f,m]})}const qr=op({qr_});/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -5220,7 +5220,7 @@ Ooh no!!`);break}m[y]=T,v=Math.min(v,T)}for(let y=0;y`Error in slice${u}D: Length of begin ${n} must match the rank of the array (${u}).`),assert$1(u===s.length,()=>`Error in slice${u}D: Length of size ${s} must match the rank of the array (${u}).`);for(let f=0;f`Error in slice${u}D: begin[${f}] + size[${f}] (${n[f]+s[f]}) would overflow input.shape[${f}] (${a.shape[f]})`)}function maskToAxes(a){const n=[];let s=0;for(;a>0;)a&1&&n.push(s),a/=2,s++;return n}function computeOutShape$2(a,n,s){const u=[];for(let f=0;f0){const e=n[0],F=s+1;E=startIndicesWithElidedDims(A,e,F,u,a),S=stopIndicesWithElidedDims(v,e,F,f,a),I=stridesWithElidedDims(m,e,F,a)}else for(let e=0;e-1)m[v]=0;else{const y=unnormalizeAxis(n,s,v);let T=u[y];a&1<-1)m[v]=Number.MAX_SAFE_INTEGER;else{const y=unnormalizeAxis(n,s,v);let T=u[y];a&1<0?A=Number.MIN_SAFE_INTEGER:A=Number.MAX_SAFE_INTEGER);const y=u[f];return A<0&&(A+=y),A=clamp(0,A,y-1),A}function stopForAxis(a,n,s,u,f,m){let A=n[f];const v=s[f]||1;(a&1<0?A=Number.MAX_SAFE_INTEGER:A=Number.MIN_SAFE_INTEGER);const y=u[f];return A<0&&(A+=y),v>0?A=clamp(0,A,y):A=clamp(-1,A,y-1),A}function isSliceContinous(a,n,s){let u=s.length;for(let f=0;f1){u=f;break}for(let f=u+1;f0||s[f]!==a[f])return!1;return!0}function computeFlatOffset(a,n){let s=a.length>0?a[a.length-1]:1;for(let u=0;u{assert$1(A!==-1,()=>"slice() does not support negative begin indexing.")});let m;return s==null?m=new Array(f).fill(-1):typeof s=="number"?m=[s,...new Array(f-1).fill(-1)]:s.lengthA>=0?A:(assert$1(A===-1,()=>`Negative size values should be exactly -1 but got ${A} for the slice() size at index ${v}.`),a.shape[v]-u[v])),[u,m]}function sliceInfo(a,n,s,u,f,m,A,v,y){let T;if(u==null?(T=new Array(n.length),T.fill(1)):T=u,A!=null&&A&A-1)throw new Error("Multiple ellipses in slice is not allowed.");let E=!1;const S={dims:T.length,numAddAxisAfterEllipsis:0,begin:n.slice(),end:s.slice(),strides:T.slice(),beginMask:f,endMask:m,ellipsisMask:A,newAxisMask:v,shrinkAxisMask:y};for(let z=0;z0?0:-1,I.strides[z]>0?W:W-1];if(b&&I.strides[z]<=0)throw Error("only stride 1 allowed on non-range indexing.");M=M&&I.strides[z]===1;const X=!!(I.beginMask&1<=W)throw Error(`slice index ${I.begin[z]} of dimension ${z} out of bounds.`)}else I.begin[z]=canonical(I.begin[z],0,I.strides[z],W,q,Y),I.end[z]=canonical(I.end[z],1,I.strides[z],W,q,Y);const J=I.strides[z]===1&&I.begin[z]===0&&I.end[z]===W;e=e&&J,F=F&&(z===0&&I.strides[z]===1||J)}else e=e&&I.strides[z]===1&&X,F=F&&(z===0&&I.strides[z]===1||X);let H,g=!1;if(I.beginValid&&I.endValid?(H=I.end[z]-I.begin[z],g=!0):b?(H=1,g=!0):X&&W>=0&&(I.strides[z]<0?H=-W:H=W,g=!0),g){let J;H===0||H<0!=I.strides[z]<0?J=0:J=Math.trunc(H/I.strides[z])+(H%I.strides[z]!==0?1:0),L.push(J)}else L.push(-1)}for(let z=0;z=0?V.push(L[b]):b===NEW_AXIS&&V.push(1)}return{finalShapeSparse:V.filter((z,b)=>I.finalShapeGatherIndices[b]!==NEW_AXIS),finalShape:V,isIdentity:e,sliceDim0:F,isSimpleSlice:M,begin:I.begin,end:I.end,strides:I.strides}}function buildDenseSpec(a,n){n.beginMask=0,n.endMask=0,n.shrinkAxisMask=0;let s=0;n.beginValid=a.begin!=null,n.endValid=a.end!=null,n.begin=new Array(n.dims),n.end=new Array(n.dims),n.strides=new Array(n.dims),n.finalShapeGatherIndices=[],n.finalShapeGatherIndicesSparse=[],n.inputShapeGatherIndicesSparse=new Array(n.dims);for(let u=0;u0?m[n]:m[n+1&1];{const A=a<0?u+a:a;return Am[1]?m[1]:A}}const slice_util=Object.freeze(Object.defineProperty({__proto__:null,assertParamsValid,computeFlatOffset,computeOutShape:computeOutShape$2,getNormalizedAxes,isSliceContinous,maskToAxes,parseSliceParams,sliceInfo,startForAxis,startIndicesWithElidedDims,stopForAxis,stopIndicesWithElidedDims,stridesForAxis,stridesWithElidedDims},Symbol.toStringTag,{value:"Module"}));/** + */const NEW_AXIS=-2,SHRINK_AXIS=-1;function assertParamsValid(a,n,s){const u=a.shape.length;assert$1(u===n.length,()=>`Error in slice${u}D: Length of begin ${n} must match the rank of the array (${u}).`),assert$1(u===s.length,()=>`Error in slice${u}D: Length of size ${s} must match the rank of the array (${u}).`);for(let f=0;f`Error in slice${u}D: begin[${f}] + size[${f}] (${n[f]+s[f]}) would overflow input.shape[${f}] (${a.shape[f]})`)}function maskToAxes(a){const n=[];let s=0;for(;a>0;)a&1&&n.push(s),a/=2,s++;return n}function computeOutShape$2(a,n,s){const u=[];for(let f=0;f0){const e=n[0],F=s+1;E=startIndicesWithElidedDims(A,e,F,u,a),S=stopIndicesWithElidedDims(v,e,F,f,a),I=stridesWithElidedDims(m,e,F,a)}else for(let e=0;e-1)m[v]=0;else{const y=unnormalizeAxis(n,s,v);let T=u[y];a&1<-1)m[v]=Number.MAX_SAFE_INTEGER;else{const y=unnormalizeAxis(n,s,v);let T=u[y];a&1<0?A=Number.MIN_SAFE_INTEGER:A=Number.MAX_SAFE_INTEGER);const y=u[f];return A<0&&(A+=y),A=clamp(0,A,y-1),A}function stopForAxis(a,n,s,u,f,m){let A=n[f];const v=s[f]||1;(a&1<0?A=Number.MAX_SAFE_INTEGER:A=Number.MIN_SAFE_INTEGER);const y=u[f];return A<0&&(A+=y),v>0?A=clamp(0,A,y):A=clamp(-1,A,y-1),A}function isSliceContinous(a,n,s){let u=s.length;for(let f=0;f1){u=f;break}for(let f=u+1;f0||s[f]!==a[f])return!1;return!0}function computeFlatOffset(a,n){let s=a.length>0?a[a.length-1]:1;for(let u=0;u{assert$1(A!==-1,()=>"slice() does not support negative begin indexing.")});let m;return s==null?m=new Array(f).fill(-1):typeof s=="number"?m=[s,...new Array(f-1).fill(-1)]:s.lengthA>=0?A:(assert$1(A===-1,()=>`Negative size values should be exactly -1 but got ${A} for the slice() size at index ${v}.`),a.shape[v]-u[v])),[u,m]}function sliceInfo(a,n,s,u,f,m,A,v,y){let T;if(u==null?(T=new Array(n.length),T.fill(1)):T=u,A!=null&&A&A-1)throw new Error("Multiple ellipses in slice is not allowed.");let E=!1;const S={dims:T.length,numAddAxisAfterEllipsis:0,begin:n.slice(),end:s.slice(),strides:T.slice(),beginMask:f,endMask:m,ellipsisMask:A,newAxisMask:v,shrinkAxisMask:y};for(let z=0;z0?0:-1,I.strides[z]>0?W:W-1];if(b&&I.strides[z]<=0)throw Error("only stride 1 allowed on non-range indexing.");M=M&&I.strides[z]===1;const X=!!(I.beginMask&1<=W)throw Error(`slice index ${I.begin[z]} of dimension ${z} out of bounds.`)}else I.begin[z]=canonical(I.begin[z],0,I.strides[z],W,q,Y),I.end[z]=canonical(I.end[z],1,I.strides[z],W,q,Y);const J=I.strides[z]===1&&I.begin[z]===0&&I.end[z]===W;e=e&&J,F=F&&(z===0&&I.strides[z]===1||J)}else e=e&&I.strides[z]===1&&X,F=F&&(z===0&&I.strides[z]===1||X);let Q,g=!1;if(I.beginValid&&I.endValid?(Q=I.end[z]-I.begin[z],g=!0):b?(Q=1,g=!0):X&&W>=0&&(I.strides[z]<0?Q=-W:Q=W,g=!0),g){let J;Q===0||Q<0!=I.strides[z]<0?J=0:J=Math.trunc(Q/I.strides[z])+(Q%I.strides[z]!==0?1:0),L.push(J)}else L.push(-1)}for(let z=0;z=0?V.push(L[b]):b===NEW_AXIS&&V.push(1)}return{finalShapeSparse:V.filter((z,b)=>I.finalShapeGatherIndices[b]!==NEW_AXIS),finalShape:V,isIdentity:e,sliceDim0:F,isSimpleSlice:M,begin:I.begin,end:I.end,strides:I.strides}}function buildDenseSpec(a,n){n.beginMask=0,n.endMask=0,n.shrinkAxisMask=0;let s=0;n.beginValid=a.begin!=null,n.endValid=a.end!=null,n.begin=new Array(n.dims),n.end=new Array(n.dims),n.strides=new Array(n.dims),n.finalShapeGatherIndices=[],n.finalShapeGatherIndicesSparse=[],n.inputShapeGatherIndicesSparse=new Array(n.dims);for(let u=0;u0?m[n]:m[n+1&1];{const A=a<0?u+a:a;return Am[1]?m[1]:A}}const slice_util=Object.freeze(Object.defineProperty({__proto__:null,assertParamsValid,computeFlatOffset,computeOutShape:computeOutShape$2,getNormalizedAxes,isSliceContinous,maskToAxes,parseSliceParams,sliceInfo,startForAxis,startIndicesWithElidedDims,stopForAxis,stopIndicesWithElidedDims,stridesForAxis,stridesWithElidedDims},Symbol.toStringTag,{value:"Module"}));/** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -6123,7 +6123,7 @@ Ooh no!!`);break}m[y]=T,v=Math.min(v,T)}for(let y=0;y{const[u,f]=n,{axis:m,batchDims:A}=s,v=parseAxisParam(m,u.shape)[0],y=(T,E,S)=>()=>{const I=T.shape,e=E.size,F=I.slice(0,v),M=F.length,L=I.slice(m,I.length).slice(1),V=L.length,B=arrayRange(0,M),z=arrayRange(M+1,M+1+V),b=arrayConcat([F,[e],L]),W=reshape$2(S,b),q=reshape$2(E,[e]),Y=arrayConcat([[M],B,z]),X=transpose$2(W,Y);let H=unsortedSegmentSum$2(X,q,T.shape[v]);const g=getUndoAxesPermutation(Y);return H=transpose$2(H,g),H};if(A===1){const T=u.shape[0],E=u.split(T,0);return{x:()=>stack(E.map((e,F)=>y(e,f.slice(F,1),a.slice(F,1))())).reshape(u.shape),indices:()=>f}}else return{x:y(u,f,a),indices:()=>f}}};function arrayRange(a,n){const s=[];for(let u=a;u{const[u,f]=n,{axis:m,batchDims:A}=s,v=parseAxisParam(m,u.shape)[0],y=(T,E,S)=>()=>{const I=T.shape,e=E.size,F=I.slice(0,v),M=F.length,L=I.slice(m,I.length).slice(1),V=L.length,B=arrayRange(0,M),z=arrayRange(M+1,M+1+V),b=arrayConcat([F,[e],L]),W=reshape$2(S,b),q=reshape$2(E,[e]),Y=arrayConcat([[M],B,z]),X=transpose$2(W,Y);let Q=unsortedSegmentSum$2(X,q,T.shape[v]);const g=getUndoAxesPermutation(Y);return Q=transpose$2(Q,g),Q};if(A===1){const T=u.shape[0],E=u.split(T,0);return{x:()=>stack(E.map((e,F)=>y(e,f.slice(F,1),a.slice(F,1))())).reshape(u.shape),indices:()=>f}}else return{x:y(u,f,a),indices:()=>f}}};function arrayRange(a,n){const s=[];for(let u=a;uF.name),y=[],T=n.names();for(const F of v)T.indexOf(F)!==-1?y.push(n.getValue(F)):y.push(null);u!=null&&(u.maxNumTensors=-1/0,u.minNumTensors=1/0);const E=v.join(",")+"|"+n.names().sort().join(",");let S=cachedSorted.get(E),I;if(S==null){const F=getTopologicalSortAndRecipientCounts(A,n);S=F.sorted,I=F.recipientCounts,cachedSorted.put(E,S),cachedRecipientCounts.put(E,I)}I={},f||Object.assign(I,cachedRecipientCounts.get(E));const e=new FeedDict(n);for(let F=0;Fu.maxNumTensors&&(u.maxNumTensors=H),H0,()=>"Expected at least one fetch, got none");let s=[],u={};if(a.length===1){const f=getTopologicalSortAndRecipientCountsForOneFetch(a[0],n);s=f.sorted,u=f.recipientMap}else{const f=new Set;for(const m of a){const{sorted:A,recipientMap:v}=getTopologicalSortAndRecipientCountsForOneFetch(m,n);for(const y of A)f.has(y.name)||(s.push(y),f.add(y.name));for(const y in v)u[y]==null&&(u[y]=new Set),v[y].forEach(T=>u[y].add(T))}}return{sorted:s,recipientCounts:recipientMap2Counts(u)}}function recipientMap2Counts(a){const n={};for(const s in a)n[s]=a[s].size;return n}function getTopologicalSortAndRecipientCountsForOneFetch(a,n){const s=new Set,u=[],f={};for(const v of n.names())s.add(v);const m=[],A=[];for(m.push(a);m.length>0;){const v=m[m.length-1];if(s.has(v.name)){m.pop();continue}const y=A[A.length-1]===m.length-1;if(v.inputs.length===0||y)m.pop(),u.push(v),s.add(v.name),y&&A.pop();else{A.push(m.length-1);for(const T of v.inputs)f[T.name]==null&&(f[T.name]=new Set),f[T.name].add(v.name),!s.has(T.name)&&m.push(T)}}return{sorted:u,recipientMap:f}}function getNodeOutputs(a){let n;if(a.sourceLayer.inboundNodes.length===1)n=a.sourceLayer.output;else{let s=null;for(let u=0;uF.name),y=[],T=n.names();for(const F of v)T.indexOf(F)!==-1?y.push(n.getValue(F)):y.push(null);u!=null&&(u.maxNumTensors=-1/0,u.minNumTensors=1/0);const E=v.join(",")+"|"+n.names().sort().join(",");let S=cachedSorted.get(E),I;if(S==null){const F=getTopologicalSortAndRecipientCounts(A,n);S=F.sorted,I=F.recipientCounts,cachedSorted.put(E,S),cachedRecipientCounts.put(E,I)}I={},f||Object.assign(I,cachedRecipientCounts.get(E));const e=new FeedDict(n);for(let F=0;Fu.maxNumTensors&&(u.maxNumTensors=Q),Q0,()=>"Expected at least one fetch, got none");let s=[],u={};if(a.length===1){const f=getTopologicalSortAndRecipientCountsForOneFetch(a[0],n);s=f.sorted,u=f.recipientMap}else{const f=new Set;for(const m of a){const{sorted:A,recipientMap:v}=getTopologicalSortAndRecipientCountsForOneFetch(m,n);for(const y of A)f.has(y.name)||(s.push(y),f.add(y.name));for(const y in v)u[y]==null&&(u[y]=new Set),v[y].forEach(T=>u[y].add(T))}}return{sorted:s,recipientCounts:recipientMap2Counts(u)}}function recipientMap2Counts(a){const n={};for(const s in a)n[s]=a[s].size;return n}function getTopologicalSortAndRecipientCountsForOneFetch(a,n){const s=new Set,u=[],f={};for(const v of n.names())s.add(v);const m=[],A=[];for(m.push(a);m.length>0;){const v=m[m.length-1];if(s.has(v.name)){m.pop();continue}const y=A[A.length-1]===m.length-1;if(v.inputs.length===0||y)m.pop(),u.push(v),s.add(v.name),y&&A.pop();else{A.push(m.length-1);for(const T of v.inputs)f[T.name]==null&&(f[T.name]=new Set),f[T.name].add(v.name),!s.has(T.name)&&m.push(T)}}return{sorted:u,recipientMap:f}}function getNodeOutputs(a){let n;if(a.sourceLayer.inboundNodes.length===1)n=a.sourceLayer.output;else{let s=null;for(let u=0;u{const n=Object.keys(a);if(n.length===0)return!1;const s=n[0].split("/");return!isNaN(parseInt(s[s.length-1],10))};class Container extends Layer{constructor(n){if(super({}),this.containerNodes=new Set,this.name=n.name,this.name==null){const B=this.getClassName().toLowerCase();this.name=getUid(B)}if(this.supportsMasking=!1,this.trainable_=!0,Array.isArray(n.inputs)?this.inputs=n.inputs.slice():this.inputs=[n.inputs],Array.isArray(n.outputs)?this.outputs=n.outputs.slice():this.outputs=[n.outputs],unique$2(this.inputs).length!==this.inputs.length)throw new ValueError(`The list of inputs passed to the model is redundant. All inputs should only appear once. Found: ${this.inputs.map(B=>B.name)}`);unique$2(this.outputs).length!==this.outputs.length&&console.warn(`The list of outputs passed to the model is redundant. All outputs should only appear once. Found: ${this.outputs.map(B=>B.name)}`),this.inputLayers=[],this.inputLayersNodeIndices=[],this.inputLayersTensorIndices=[],this.outputLayers=[],this.outputLayersNodeIndices=[],this.outputLayersTensorIndices=[],this.layers=[],this.internalContainerRefs=[];for(const B of this.outputs){const z=B.sourceLayer,b=B.nodeIndex,W=B.tensorIndex;this.outputLayers.push(z),this.outputLayersNodeIndices.push(b),this.outputLayersTensorIndices.push(W)}for(const B of this.inputs){const z=B.sourceLayer,b=B.nodeIndex,W=B.tensorIndex;assert(b===0,"input layer has >1 nodes"),assert(W===0,"input layer has >1 tensors"),this.inputLayers.push(z),this.inputLayersNodeIndices.push(b),this.inputLayersTensorIndices.push(W)}this.inputNames=[],this.outputNames=[],this.feedInputShapes=[],this.feedInputNames=[],this.feedOutputNames=[];for(let B=0;BB.shape),this.internalOutputShapes=this.outputs.map(B=>B.shape);const s={},u={},f={},m={},A={},v=[],y=(B,z,b,W,q,Y)=>{(W==null||q==null||Y==null)&&(W=B.sourceLayer,q=B.nodeIndex,Y=B.tensorIndex);const X=W.inboundNodes[q];if(b.indexOf(X)!==-1)throw new RuntimeError(`The tensor ${B.name} at layer "${W.name}" is part of a cycle.`);if(z.indexOf(X)!==-1)return;this.containerNodes.add(Container.nodeKey(W,q)),W.id in A||(A[W.id]=Object.keys(A).length),b.indexOf(X)===-1&&b.push(X);const H=X.inboundLayers.length;for(let g=0;g=0;)b.splice(b.indexOf(X),1);v.push(X)},T=[],E=[];for(const B of this.outputs)y(B,T,E);const S=v.slice().reverse();for(const B of S){u[B.id]=B,B.id in s||(s[B.id]=0);let z=s[B.id];const b=f[B.outboundLayer.id]==null?0:f[B.outboundLayer.id];z=Math.max(z,b),f[B.outboundLayer.id]=z,m[B.outboundLayer.id]=B.outboundLayer,s[B.id]=z;for(let W=0;WparseInt(B,10)).sort(reverseNumberCompare);this.layers=[];for(const B of F){const z=e[B];z.sort((b,W)=>{const q=A[b.id],Y=A[W.id];return qY?1:0});for(const b of z)b instanceof Container&&this.internalContainerRefs.push(b),this.layers.push(b)}this.layersByDepth=e,F=Object.keys(I).map(B=>parseInt(B,10)).sort(reverseNumberCompare);const M=this.inputs.slice(),L=[];for(const B of F)for(const z of I[B]){const b=z.outboundLayer;if(b!=null){for(const W of z.inputTensors)if(M.indexOf(W)===-1)throw new RuntimeError(`Graph disconnected: cannot obtain value for tensor ${W} at layer "${b.name}". The following previous layers were accessed without issue: ${L}`);for(const W of z.outputTensors)M.push(W);L.push(b.name)}}this.nodesByDepth=I;const V=this.layers.map(B=>B.name);for(const B of V){const z=V.filter(b=>b===B).length;if(z!==1)throw new RuntimeError(`The name "${B}" is used ${z} times in the model. All layer names should be unique. Layer names: `+JSON.stringify(V))}this.outboundNodes=[],this.inboundNodes=[],new Node({outboundLayer:this,inboundLayers:[],nodeIndices:[],tensorIndices:[],inputTensors:this.inputs,outputTensors:this.outputs,inputMasks:this.inputs.map(B=>null),outputMasks:this.outputs.map(B=>null),inputShapes:this.inputs.map(B=>B.shape),outputShapes:this.outputs.map(B=>B.shape)}),this.built=!0,this._refCount=1}assertNotDisposed(){if(this._refCount===0)throw new Error(`Container '${this.name}' is already disposed.`)}dispose(){this.assertNotDisposed();const n={refCountAfterDispose:null,numDisposedVariables:0};if(--this._refCount===0){for(const s of this.layers)n.numDisposedVariables+=s.dispose().numDisposedVariables;for(const s of this.internalContainerRefs)n.numDisposedVariables+=s.dispose().numDisposedVariables}return n.refCountAfterDispose=this._refCount,n}get trainable(){return this.trainable_}set trainable(n){this.layers.forEach(s=>{s._trainableWeights.forEach(u=>u.trainable=n)}),this.trainable_=n}get trainableWeights(){if(this._trainableWeights.length>0)throw new ValueError("Container instance unexpectedly contains _trainableWeights.The trainable weights of a Container are a union of the trainable weights of its consituent Layers. Its own _trainableWeights must remain an empty Array.");if(!this.trainable)return[];let n=[];for(const s of this.layers)n=n.concat(s.trainableWeights);return n}get nonTrainableWeights(){const n=[];for(const s of this.layers)n.push(...s.nonTrainableWeights);if(!this.trainable){const s=[];for(const u of this.layers)s.push(...u.trainableWeights);return s.concat(n)}return n}get weights(){return this.trainableWeights.concat(this.nonTrainableWeights)}loadWeights(n,s=!0){const u={};let f=0;const m=isKerasSavedModelFormat(n);m&&this.parseWeights(n);for(const v of this.layers)for(const[y,T]of v.weights.entries()){const E=m?`${T.name.split("/").slice(0,-1).join("/")+"/"}${y}`:T.originalName;if(u[E]!=null)throw new ValueError(`Duplicate weight name: ${E}`);u[E]=T,f++}const A=[];for(const v in n){let y=v;if(u[v]==null){const T=v.split("/");y=T.slice(0,-2).concat([T[T.length-1]]).join("/")}if(u[y]!=null)A.push([u[y],n[v]]);else if(s)throw new ValueError(`Provided weight data has no target variable: ${v}`);delete u[y]}if(s){const v=[];for(const y in u)v.push(y);if(v.length>0)throw new ValueError(`${v.length} of ${f} weights are not set: ${v}`)}batchSetValue(A)}parseWeights(n){for(const s in Object.keys(n)){const u=s.split("/"),f=["vars","layer_checkpoint_dependencies"],m=u.map(A=>A.startsWith("_")?A.slice(1):A).filter(A=>!f.includes(A)).join("/");m!==s&&(n[m]=n[s],delete n[s])}}updatedConfig(){const n=this.getConfig(),s={};return s.className=this.getClassName(),s.config=n,s.kerasVersion=`tfjs-layers ${version}`,s.backend="TensorFlow.js",s}toJSON(n,s=!0){const u=convertTsToPythonic(this.updatedConfig());return s?JSON.stringify(u):u}call(n,s){return tidy(()=>{n=toList(n);const u=new FeedDict;for(let f=0;f{n=toList(n);let u;return s==null?u=pyListRepeat(null,n.length):u=toList(s),this.runInternalGraph(n,u)[1]})}computeOutputShape(n){const s=normalizeShapeList(n);if(s.length!==this.inputLayers.length)throw new ValueError(`Invalid inputShape argument ${n}: model has ${this.inputLayers.length} tensor inputs.`);const u={};for(let v=0;vparseInt(v,10)).sort(reverseNumberCompare);if(f.length>1)for(const v of f){const y=this.nodesByDepth[v];for(const T of y){const E=T.outboundLayer;if(this.inputLayers.map(M=>M.id).indexOf(E.id)!==-1)continue;const S=[];for(let M=0;MparseInt(y,10)).sort(reverseNumberCompare);for(const y of f){const T=this.nodesByDepth[y];for(const E of T){const S=E.outboundLayer,I=E.inputTensors,e=E.outputTensors,F=new Array;for(const M of I)M.id in u&&F.push(u[M.id]);if(F.length===I.length){let M={},L,V,B,z;if(E.callArgs!=null&&(M=E.callArgs),F.length===1){const[b,W]=F[0];M.mask==null&&(M.mask=W),B=toList(S.call(b,M)),z=toList(S.computeMask(b,W)),L=[b],V=[W]}else L=F.map(b=>b[0]),V=F.map(b=>b[1]),M.mask==null&&(M.mask=V),B=toList(S.call(L,M)),z=toList(S.computeMask(L,V));if(S.activityRegularizer)throw new NotImplementedError("LayersModel invocation with concrete Tensor value(s) in the presence of activity regularizer(s) is not supported yet.");for(let b=0;b{const n=[];for(const s of this.layers)for(let u=0;u0){const M=[];for(let L=0;L0&&L.apply(singletonOrArray(B),z)}function T(L){const V=L.name,B=deserialize(L,s.customObjects!=null?s.customObjects:{});B.setFastWeightInitDuringBuild(f),m[V]=B,L.inboundNodes.forEach(b=>{if(!(b instanceof Array))throw new ValueError(`Corrupted configuration, expected array for nodeData: ${b}`);v(B,b)})}const E=s.name,S=s.layers;for(const L of S)T(L);for(;!isObjectEmpty(A);)for(const L of S){const V=m[L.name];if(V.name in A){const B=A[V.name];delete A[V.name];for(const z of B)y(V,z)}}const I=[],e=[],F=s.inputLayers;for(const L of F){const V=L[0],B=L[1],z=L[2];assert(V in m);const W=m[V].inboundNodes[B].outputTensors;I.push(W[z])}const M=s.outputLayers;for(const L of M){const V=L[0],B=L[1],z=L[2];assert(V in m);const W=m[V].inboundNodes[B].outputTensors;e.push(W[z])}return new n({inputs:I,outputs:e,name:E})}get stateful(){if(this._stateful)throw new ValueError("Container instance unexpectedly has _stateful = true. The statefulness of a Container is determined by the Layers it contains. Its _stateful property must remain the default false.");for(const n of this.layers)if(n.stateful)return!0;return!1}resetStates(){tidy(()=>{this.layers.forEach(n=>{n.stateful&&n.resetStates()})})}}/** + */const isKerasSavedModelFormat=a=>{const n=Object.keys(a);if(n.length===0)return!1;const s=n[0].split("/");return!isNaN(parseInt(s[s.length-1],10))};class Container extends Layer{constructor(n){if(super({}),this.containerNodes=new Set,this.name=n.name,this.name==null){const B=this.getClassName().toLowerCase();this.name=getUid(B)}if(this.supportsMasking=!1,this.trainable_=!0,Array.isArray(n.inputs)?this.inputs=n.inputs.slice():this.inputs=[n.inputs],Array.isArray(n.outputs)?this.outputs=n.outputs.slice():this.outputs=[n.outputs],unique$2(this.inputs).length!==this.inputs.length)throw new ValueError(`The list of inputs passed to the model is redundant. All inputs should only appear once. Found: ${this.inputs.map(B=>B.name)}`);unique$2(this.outputs).length!==this.outputs.length&&console.warn(`The list of outputs passed to the model is redundant. All outputs should only appear once. Found: ${this.outputs.map(B=>B.name)}`),this.inputLayers=[],this.inputLayersNodeIndices=[],this.inputLayersTensorIndices=[],this.outputLayers=[],this.outputLayersNodeIndices=[],this.outputLayersTensorIndices=[],this.layers=[],this.internalContainerRefs=[];for(const B of this.outputs){const z=B.sourceLayer,b=B.nodeIndex,W=B.tensorIndex;this.outputLayers.push(z),this.outputLayersNodeIndices.push(b),this.outputLayersTensorIndices.push(W)}for(const B of this.inputs){const z=B.sourceLayer,b=B.nodeIndex,W=B.tensorIndex;assert(b===0,"input layer has >1 nodes"),assert(W===0,"input layer has >1 tensors"),this.inputLayers.push(z),this.inputLayersNodeIndices.push(b),this.inputLayersTensorIndices.push(W)}this.inputNames=[],this.outputNames=[],this.feedInputShapes=[],this.feedInputNames=[],this.feedOutputNames=[];for(let B=0;BB.shape),this.internalOutputShapes=this.outputs.map(B=>B.shape);const s={},u={},f={},m={},A={},v=[],y=(B,z,b,W,q,Y)=>{(W==null||q==null||Y==null)&&(W=B.sourceLayer,q=B.nodeIndex,Y=B.tensorIndex);const X=W.inboundNodes[q];if(b.indexOf(X)!==-1)throw new RuntimeError(`The tensor ${B.name} at layer "${W.name}" is part of a cycle.`);if(z.indexOf(X)!==-1)return;this.containerNodes.add(Container.nodeKey(W,q)),W.id in A||(A[W.id]=Object.keys(A).length),b.indexOf(X)===-1&&b.push(X);const Q=X.inboundLayers.length;for(let g=0;g=0;)b.splice(b.indexOf(X),1);v.push(X)},T=[],E=[];for(const B of this.outputs)y(B,T,E);const S=v.slice().reverse();for(const B of S){u[B.id]=B,B.id in s||(s[B.id]=0);let z=s[B.id];const b=f[B.outboundLayer.id]==null?0:f[B.outboundLayer.id];z=Math.max(z,b),f[B.outboundLayer.id]=z,m[B.outboundLayer.id]=B.outboundLayer,s[B.id]=z;for(let W=0;WparseInt(B,10)).sort(reverseNumberCompare);this.layers=[];for(const B of F){const z=e[B];z.sort((b,W)=>{const q=A[b.id],Y=A[W.id];return qY?1:0});for(const b of z)b instanceof Container&&this.internalContainerRefs.push(b),this.layers.push(b)}this.layersByDepth=e,F=Object.keys(I).map(B=>parseInt(B,10)).sort(reverseNumberCompare);const M=this.inputs.slice(),L=[];for(const B of F)for(const z of I[B]){const b=z.outboundLayer;if(b!=null){for(const W of z.inputTensors)if(M.indexOf(W)===-1)throw new RuntimeError(`Graph disconnected: cannot obtain value for tensor ${W} at layer "${b.name}". The following previous layers were accessed without issue: ${L}`);for(const W of z.outputTensors)M.push(W);L.push(b.name)}}this.nodesByDepth=I;const V=this.layers.map(B=>B.name);for(const B of V){const z=V.filter(b=>b===B).length;if(z!==1)throw new RuntimeError(`The name "${B}" is used ${z} times in the model. All layer names should be unique. Layer names: `+JSON.stringify(V))}this.outboundNodes=[],this.inboundNodes=[],new Node({outboundLayer:this,inboundLayers:[],nodeIndices:[],tensorIndices:[],inputTensors:this.inputs,outputTensors:this.outputs,inputMasks:this.inputs.map(B=>null),outputMasks:this.outputs.map(B=>null),inputShapes:this.inputs.map(B=>B.shape),outputShapes:this.outputs.map(B=>B.shape)}),this.built=!0,this._refCount=1}assertNotDisposed(){if(this._refCount===0)throw new Error(`Container '${this.name}' is already disposed.`)}dispose(){this.assertNotDisposed();const n={refCountAfterDispose:null,numDisposedVariables:0};if(--this._refCount===0){for(const s of this.layers)n.numDisposedVariables+=s.dispose().numDisposedVariables;for(const s of this.internalContainerRefs)n.numDisposedVariables+=s.dispose().numDisposedVariables}return n.refCountAfterDispose=this._refCount,n}get trainable(){return this.trainable_}set trainable(n){this.layers.forEach(s=>{s._trainableWeights.forEach(u=>u.trainable=n)}),this.trainable_=n}get trainableWeights(){if(this._trainableWeights.length>0)throw new ValueError("Container instance unexpectedly contains _trainableWeights.The trainable weights of a Container are a union of the trainable weights of its consituent Layers. Its own _trainableWeights must remain an empty Array.");if(!this.trainable)return[];let n=[];for(const s of this.layers)n=n.concat(s.trainableWeights);return n}get nonTrainableWeights(){const n=[];for(const s of this.layers)n.push(...s.nonTrainableWeights);if(!this.trainable){const s=[];for(const u of this.layers)s.push(...u.trainableWeights);return s.concat(n)}return n}get weights(){return this.trainableWeights.concat(this.nonTrainableWeights)}loadWeights(n,s=!0){const u={};let f=0;const m=isKerasSavedModelFormat(n);m&&this.parseWeights(n);for(const v of this.layers)for(const[y,T]of v.weights.entries()){const E=m?`${T.name.split("/").slice(0,-1).join("/")+"/"}${y}`:T.originalName;if(u[E]!=null)throw new ValueError(`Duplicate weight name: ${E}`);u[E]=T,f++}const A=[];for(const v in n){let y=v;if(u[v]==null){const T=v.split("/");y=T.slice(0,-2).concat([T[T.length-1]]).join("/")}if(u[y]!=null)A.push([u[y],n[v]]);else if(s)throw new ValueError(`Provided weight data has no target variable: ${v}`);delete u[y]}if(s){const v=[];for(const y in u)v.push(y);if(v.length>0)throw new ValueError(`${v.length} of ${f} weights are not set: ${v}`)}batchSetValue(A)}parseWeights(n){for(const s in Object.keys(n)){const u=s.split("/"),f=["vars","layer_checkpoint_dependencies"],m=u.map(A=>A.startsWith("_")?A.slice(1):A).filter(A=>!f.includes(A)).join("/");m!==s&&(n[m]=n[s],delete n[s])}}updatedConfig(){const n=this.getConfig(),s={};return s.className=this.getClassName(),s.config=n,s.kerasVersion=`tfjs-layers ${version}`,s.backend="TensorFlow.js",s}toJSON(n,s=!0){const u=convertTsToPythonic(this.updatedConfig());return s?JSON.stringify(u):u}call(n,s){return tidy(()=>{n=toList(n);const u=new FeedDict;for(let f=0;f{n=toList(n);let u;return s==null?u=pyListRepeat(null,n.length):u=toList(s),this.runInternalGraph(n,u)[1]})}computeOutputShape(n){const s=normalizeShapeList(n);if(s.length!==this.inputLayers.length)throw new ValueError(`Invalid inputShape argument ${n}: model has ${this.inputLayers.length} tensor inputs.`);const u={};for(let v=0;vparseInt(v,10)).sort(reverseNumberCompare);if(f.length>1)for(const v of f){const y=this.nodesByDepth[v];for(const T of y){const E=T.outboundLayer;if(this.inputLayers.map(M=>M.id).indexOf(E.id)!==-1)continue;const S=[];for(let M=0;MparseInt(y,10)).sort(reverseNumberCompare);for(const y of f){const T=this.nodesByDepth[y];for(const E of T){const S=E.outboundLayer,I=E.inputTensors,e=E.outputTensors,F=new Array;for(const M of I)M.id in u&&F.push(u[M.id]);if(F.length===I.length){let M={},L,V,B,z;if(E.callArgs!=null&&(M=E.callArgs),F.length===1){const[b,W]=F[0];M.mask==null&&(M.mask=W),B=toList(S.call(b,M)),z=toList(S.computeMask(b,W)),L=[b],V=[W]}else L=F.map(b=>b[0]),V=F.map(b=>b[1]),M.mask==null&&(M.mask=V),B=toList(S.call(L,M)),z=toList(S.computeMask(L,V));if(S.activityRegularizer)throw new NotImplementedError("LayersModel invocation with concrete Tensor value(s) in the presence of activity regularizer(s) is not supported yet.");for(let b=0;b{const n=[];for(const s of this.layers)for(let u=0;u0){const M=[];for(let L=0;L0&&L.apply(singletonOrArray(B),z)}function T(L){const V=L.name,B=deserialize(L,s.customObjects!=null?s.customObjects:{});B.setFastWeightInitDuringBuild(f),m[V]=B,L.inboundNodes.forEach(b=>{if(!(b instanceof Array))throw new ValueError(`Corrupted configuration, expected array for nodeData: ${b}`);v(B,b)})}const E=s.name,S=s.layers;for(const L of S)T(L);for(;!isObjectEmpty(A);)for(const L of S){const V=m[L.name];if(V.name in A){const B=A[V.name];delete A[V.name];for(const z of B)y(V,z)}}const I=[],e=[],F=s.inputLayers;for(const L of F){const V=L[0],B=L[1],z=L[2];assert(V in m);const W=m[V].inboundNodes[B].outputTensors;I.push(W[z])}const M=s.outputLayers;for(const L of M){const V=L[0],B=L[1],z=L[2];assert(V in m);const W=m[V].inboundNodes[B].outputTensors;e.push(W[z])}return new n({inputs:I,outputs:e,name:E})}get stateful(){if(this._stateful)throw new ValueError("Container instance unexpectedly has _stateful = true. The statefulness of a Container is determined by the Layers it contains. Its _stateful property must remain the default false.");for(const n of this.layers)if(n.stateful)return!0;return!1}resetStates(){tidy(()=>{this.layers.forEach(n=>{n.stateful&&n.resetStates()})})}}/** * @license * Copyright 2018 Google LLC * @@ -9398,7 +9398,7 @@ Ooh no!!`);break}m[y]=T,v=Math.min(v,T)}for(let y=0;y`A Dataset iterator for fitDataset() is expected to generate objects of the form \`{xs: xVal, ys: yVal}\`, where the two values may be \`tf.Tensor\`, an array of Tensors, or a map of string to Tensor. The provided Dataset instead generates ${n}`);const m=flattenTensorOrArrayOrMap("input",a.inputNames,s),A=flattenTensorOrArrayOrMap("output",a.outputNames,u),v=m[0].shape[0];assert$1(m.length===a.inputs.length,()=>`LayersModel has ${a.inputs.length} inputs, but the dataset provides ${m.length} inputs. (Expected input keys: ${JSON.stringify(a.inputNames)})`),assert$1(A.length===a.outputs.length,()=>`LayersModel has ${a.outputs.length} outputs, but the dataset provides ${A.length} outputs. (Expected output keys: ${JSON.stringify(a.outputNames)})`);for(let y=0;y`Batch size mismatch: input ${a.inputNames[y]} has ${m[y].shape[0]}; expected ${v} based on input ${a.inputNames[0]}.`);for(let y=0;y`Batch size mismatch: output ${a.outputNames[y]} has ${A[y].shape[0]}; expected ${v} based on input ${a.inputNames[0]}.`);return{xs:m,ys:A}}function flattenTensorOrArrayOrMap(a,n,s){if(s instanceof Tensor)return[s];if(Array.isArray(s))return assert$1(s.length===n.length,()=>`Received an array of ${s.length} Tensors, but expected ${n.length} to match the ${a} keys ${n}.`),s;{const u=[];for(const f of n){if(s[f]==null)throw new ValueError(`The feature data generated by the dataset lacks the required ${a} key '${f}'.`);u.push(s[f])}return u}}function standardizeTensorValidationData(a){if(a.length===3)throw new NotImplementedError("Validation with sample weights is not implemented yet.");return{xs:a[0],ys:a[1]}}async function fitDataset(a,n,s){const u=s.batchesPerEpoch!=null;if(assert$1(a.optimizer!=null,()=>"You must compile a model before training/testing. Use LayersModel.compile(modelCompileConfig)."),assert$1(s!=null,()=>"For fitDataset(), the 2nd argument (config) is required, but it is not provided in this call."),assert$1(s.epochs!=null&&s.epochs>0&&Number.isInteger(s.epochs),()=>`For fitDataset(), config.epochs is expected to be a positive integer, but got ${s.epochs}`),assert$1(!u||s.batchesPerEpoch>0&&Number.isInteger(s.batchesPerEpoch),()=>`For fitDataset(), config.batchesPerEpoch is expected to be a positive integer if specified, but got ${s.batchesPerEpoch}`),assert$1(s.validationSplit==null,()=>"`validationSplit` is not supported by `fitDataset()`. Use validationData instead."),a.isTraining)throw new Error("Cannot start training because another fit() call is ongoing.");a.isTraining=!0;try{const f=s.validationData!=null;let m,A;if(f)if(isDatasetObject(s.validationData))assert$1(s.validationBatches==null||s.validationBatches>0&&Number.isInteger(s.validationBatches),()=>`For fitDataset() with dataset-based validation, config.validationBatches is expected not to be provided, or to be a positive integer, but got ${s.validationBatches}`);else{const L=standardizeTensorValidationData(s.validationData);m=L.xs,A=L.ys}const v=a.makeTrainFunction(),y=a.getDedupedMetricsNames();let T;f?T=y.slice().concat(y.map(L=>"val_"+L)):T=y.slice();const E=standardizeCallbacks(s.callbacks,s.yieldEvery),S=s.verbose==null?1:s.verbose,{callbackList:I,history:e}=configureCallbacks(E,S,s.epochs,null,null,getStepsPerEpoch(n,s),null,f,T);I.setModel(a),a.history=e,await I.onTrainBegin(),a.stopTraining_=!1;let F=s.initialEpoch==null?0:s.initialEpoch,M=await n.iterator();for(;F=s.batchesPerEpoch:z.done){if(f){let b;isDatasetObject(s.validationData)?b=toList(await a.evaluateDataset(s.validationData,{batches:s.validationBatches})):b=toList(a.evaluate(m,A,{batchSize:s.validationBatchSize==null?DEFAULT_VALIDATION_BATCH_SIZE:s.validationBatchSize,verbose:0}));for(let W=0;W0)throw new NotImplementedError("Verbose mode is not implemented yet.");assert$1(!u||s.batches>0&&Number.isInteger(s.batches),()=>`Test loop expects \`batches\` to be a positive integer, but received ${JSON.stringify(s.batches)}`);const A=isLazyIteratorObject(n)?n:await n.iterator();let v=0,y=0;for(;!u||y{if(T.value){const{xs:E,ys:S}=standardizeDataIteratorOutput(a,T.value),I=E.concat(S),e=tidy(()=>f(I));if(dispose(I),y===0)for(let M=0;Madd$1(m[M],mul(F,L))),y>0&&dispose(V)}dispose(e),v+=F,++y}return m}),T.done){u&&console.warn(`Your dataset iterator ran out of data during evaluateDataset(). Interrupting evalution. Make sure that your dataset can generate at least \`batches\` batches (in this case, ${s.batches} batches). You may need to use the repeat() function when building your dataset.`);break}}for(let T=0;T`A Dataset iterator for fitDataset() is expected to generate objects of the form \`{xs: xVal, ys: yVal}\`, where the two values may be \`tf.Tensor\`, an array of Tensors, or a map of string to Tensor. The provided Dataset instead generates ${n}`);const m=flattenTensorOrArrayOrMap("input",a.inputNames,s),A=flattenTensorOrArrayOrMap("output",a.outputNames,u),v=m[0].shape[0];assert$1(m.length===a.inputs.length,()=>`LayersModel has ${a.inputs.length} inputs, but the dataset provides ${m.length} inputs. (Expected input keys: ${JSON.stringify(a.inputNames)})`),assert$1(A.length===a.outputs.length,()=>`LayersModel has ${a.outputs.length} outputs, but the dataset provides ${A.length} outputs. (Expected output keys: ${JSON.stringify(a.outputNames)})`);for(let y=0;y`Batch size mismatch: input ${a.inputNames[y]} has ${m[y].shape[0]}; expected ${v} based on input ${a.inputNames[0]}.`);for(let y=0;y`Batch size mismatch: output ${a.outputNames[y]} has ${A[y].shape[0]}; expected ${v} based on input ${a.inputNames[0]}.`);return{xs:m,ys:A}}function flattenTensorOrArrayOrMap(a,n,s){if(s instanceof Tensor)return[s];if(Array.isArray(s))return assert$1(s.length===n.length,()=>`Received an array of ${s.length} Tensors, but expected ${n.length} to match the ${a} keys ${n}.`),s;{const u=[];for(const f of n){if(s[f]==null)throw new ValueError(`The feature data generated by the dataset lacks the required ${a} key '${f}'.`);u.push(s[f])}return u}}function standardizeTensorValidationData(a){if(a.length===3)throw new NotImplementedError("Validation with sample weights is not implemented yet.");return{xs:a[0],ys:a[1]}}async function fitDataset(a,n,s){const u=s.batchesPerEpoch!=null;if(assert$1(a.optimizer!=null,()=>"You must compile a model before training/testing. Use LayersModel.compile(modelCompileConfig)."),assert$1(s!=null,()=>"For fitDataset(), the 2nd argument (config) is required, but it is not provided in this call."),assert$1(s.epochs!=null&&s.epochs>0&&Number.isInteger(s.epochs),()=>`For fitDataset(), config.epochs is expected to be a positive integer, but got ${s.epochs}`),assert$1(!u||s.batchesPerEpoch>0&&Number.isInteger(s.batchesPerEpoch),()=>`For fitDataset(), config.batchesPerEpoch is expected to be a positive integer if specified, but got ${s.batchesPerEpoch}`),assert$1(s.validationSplit==null,()=>"`validationSplit` is not supported by `fitDataset()`. Use validationData instead."),a.isTraining)throw new Error("Cannot start training because another fit() call is ongoing.");a.isTraining=!0;try{const f=s.validationData!=null;let m,A;if(f)if(isDatasetObject(s.validationData))assert$1(s.validationBatches==null||s.validationBatches>0&&Number.isInteger(s.validationBatches),()=>`For fitDataset() with dataset-based validation, config.validationBatches is expected not to be provided, or to be a positive integer, but got ${s.validationBatches}`);else{const L=standardizeTensorValidationData(s.validationData);m=L.xs,A=L.ys}const v=a.makeTrainFunction(),y=a.getDedupedMetricsNames();let T;f?T=y.slice().concat(y.map(L=>"val_"+L)):T=y.slice();const E=standardizeCallbacks(s.callbacks,s.yieldEvery),S=s.verbose==null?1:s.verbose,{callbackList:I,history:e}=configureCallbacks(E,S,s.epochs,null,null,getStepsPerEpoch(n,s),null,f,T);I.setModel(a),a.history=e,await I.onTrainBegin(),a.stopTraining_=!1;let F=s.initialEpoch==null?0:s.initialEpoch,M=await n.iterator();for(;F=s.batchesPerEpoch:z.done){if(f){let b;isDatasetObject(s.validationData)?b=toList(await a.evaluateDataset(s.validationData,{batches:s.validationBatches})):b=toList(a.evaluate(m,A,{batchSize:s.validationBatchSize==null?DEFAULT_VALIDATION_BATCH_SIZE:s.validationBatchSize,verbose:0}));for(let W=0;W0)throw new NotImplementedError("Verbose mode is not implemented yet.");assert$1(!u||s.batches>0&&Number.isInteger(s.batches),()=>`Test loop expects \`batches\` to be a positive integer, but received ${JSON.stringify(s.batches)}`);const A=isLazyIteratorObject(n)?n:await n.iterator();let v=0,y=0;for(;!u||y{if(T.value){const{xs:E,ys:S}=standardizeDataIteratorOutput(a,T.value),I=E.concat(S),e=tidy(()=>f(I));if(dispose(I),y===0)for(let M=0;Madd$1(m[M],mul(F,L))),y>0&&dispose(V)}dispose(e),v+=F,++y}return m}),T.done){u&&console.warn(`Your dataset iterator ran out of data during evaluateDataset(). Interrupting evalution. Make sure that your dataset can generate at least \`batches\` batches (in this case, ${s.batches} batches). You may need to use the repeat() function when building your dataset.`);break}}for(let T=0;T0)A=!0;else if(isDataDict(a)){for(const v in a)if(a.hasOwnProperty(v)){A=!0;break}}else A=!0;if(A)throw new ValueError(`Error when checking model ${f} expected no data, but got ${a}`)}return[]}if(a==null)return n.map(A=>null);let m;if(isDataDict(a)){a=a,m=[];for(const A of n){if(a[A]==null)throw new ValueError(`No data provided for "${A}". Need data for each key in: ${n}`);m.push(a[A])}}else if(isDataArray(a)){if(a=a,a.length!==n.length)throw new ValueError(`Error when checking model ${f}: the Array of Tensors that you are passing to your model is not the size the model expected. Expected to see ${n.length} Tensor(s), but instead got the following list of Tensor(s): ${a}`);m=a}else{if(a=a,n.length>1)throw new ValueError(`The model ${f} expects ${n.length} Tensor(s), but only received one Tensor. Found: Tensor with shape ${a.shape}`);m=[a]}if(m=ensureTensorsRank2OrHigher(m),s!=null)for(let A=0;A=0&&T!==E)throw new ValueError(`${f} expected a batch of elements where each example has shape [${s[A].slice(1,s[A].length)}] (i.e.,tensor shape [*,${s[A].slice(1,s[A].length)}]) but the ${f} received an input with ${v.shape[0]} examples, each with shape [${v.shape.slice(1,v.shape.length)}] (tensor shape [${v.shape}])`)}}return m}function checkArrayLengths(a,n,s){const u=unique$2(a.map(m=>m.shape[0]));u.sort();const f=unique$2(n.map(m=>m.shape[0]));if(f.sort(),u.length>1)throw new ValueError(`All input Tensors (x) should have the same number of samples. Got array shapes: ${JSON.stringify(a.map(m=>m.shape))}`);if(f.length>1)throw new ValueError(`All target Tensors (y) should have the same number of samples. Got array shapes: ${JSON.stringify(n.map(m=>m.shape))}`);if(u.length>0&&f.length>0&&!arraysEqual(u,f))throw new ValueError(`Input Tensors should have the same number of samples as target Tensors. Found ${u[0]} input sample(s) and ${f[0]} target sample(s).`)}function checkLossAndTargetCompatibility(a,n,s){const u=[meanSquaredError,binaryCrossentropy$1,categoricalCrossentropy$1];for(let f=0;f1)throw new ValueError(`The model expects ${n.length} ${f} Tensors, but only received one Tensor. Found: array with shape ${JSON.stringify(a.shape)}.`);m=[a]}if(s!=null)for(let A=0;A[]);let s;if(typeof a=="string"||typeof a=="function")s=[a];else if(Array.isArray(a)||typeof a=="object")s=a;else throw new TypeError(`Type of metrics argument not understood. Expected an string,function, Array, or Object, found: ${a}`);if(Array.isArray(s))return n.map(u=>s);{const u=[];for(const f of n){let m=s.hasOwnProperty(f)?s[f]:[];Array.isArray(m)||(m=[m]),u.push(m)}return u}}const LAYERS_MODEL_FORMAT_NAME="layers-model";class LayersModel extends Container{constructor(n){super(n),this.isTraining=!1}summary(n,s,u=console.log){if(!this.built)throw new ValueError("This model has never been called, thus its weights have not been created yet. So no summary can be displayed. Build the model first (e.g., by calling it on some test data).");printSummary(this,n,s,u)}compile(n){if(n.loss==null&&(n.loss=[]),this.loss=n.loss,typeof n.optimizer=="string")this.optimizer_=getOptimizer(n.optimizer),this.isOptimizerOwned=!0;else{if(!(n.optimizer instanceof Optimizer))throw new ValueError("User-defined optimizer must be an instance of tf.Optimizer.");this.optimizer_=n.optimizer,this.isOptimizerOwned=!1}let s=[];if(!Array.isArray(n.loss)&&typeof n.loss!="string"&&typeof n.loss!="function"){n.loss=n.loss;for(const A in n.loss)if(this.outputNames.indexOf(A)===-1)throw new ValueError(`Unknown entry in loss dictionary: "${A}". Only expected the following keys: ${this.outputNames}`);for(const A of this.outputNames)n.loss[A]==null&&console.warn(`Output "${A}" is missing from loss dictionary. We assume this was done on purpose, and we will not be expecting data to be passed to ${A} during training`),s.push(get$1(n.loss[A]))}else if(Array.isArray(n.loss)){if(n.loss.length!==this.outputs.length)throw new ValueError(`When passing an Array as loss, it should have one entry per model output. The model has ${this.outputs.length} output(s), but you passed loss=${n.loss}.`);s=n.loss.map(v=>get$1(v))}else{const A=get$1(n.loss);this.outputs.forEach(v=>{s.push(A)})}this.lossFunctions=s,this.feedOutputNames=[],this.feedOutputShapes=[],this.feedLossFns=[];for(let A=0;A{for(let A=0;A1&&(this.metricsTensors.push([v,A]),this.metricsNames.push(this.outputNames[A]+"_loss"))}});const f=collectMetrics(n.metrics,this.outputNames),m=(A,v,y)=>{this.outputNames.length>1&&(v=this.outputNames[A]+"_"+v),this.metricsNames.push(v),this.metricsTensors.push([y,A])};nameScope("metric",()=>{for(let A=0;A{const E="";let S,I,e;for(const F of T){if(typeof F=="string"&&["accuracy","acc","crossentropy","ce"].indexOf(F)!==-1){const L=this.internalOutputShapes[A];L[L.length-1]===1||this.lossFunctions[A]===binaryCrossentropy$1?["accuracy","acc"].indexOf(F)!==-1?I=binaryAccuracy:["crossentropy","ce"].indexOf(F)!==-1&&(I=binaryCrossentropy):this.lossFunctions[A]===sparseCategoricalCrossentropy$1?["accuracy","acc"].indexOf(F)!==-1?I=sparseCategoricalAccuracy:["crossentropy","ce"].indexOf(F)!==-1&&(I=sparseCategoricalCrossentropy):["accuracy","acc"].indexOf(F)!==-1?I=categoricalAccuracy:["crossentropy","ce"].indexOf(F)!==-1&&(I=categoricalCrossentropy);let V;["accuracy","acc"].indexOf(F)!==-1?V="acc":["crossentropy","ce"].indexOf(F)!==-1&&(V="ce"),e=I,S=E+V}else e=get(F),S=E+getLossOrMetricName(F);let M;nameScope(S,()=>{M=e}),m(A,S,M)}})(v)}}),this.collectedTrainableWeights=this.trainableWeights}checkTrainableWeightsConsistency(){this.collectedTrainableWeights!=null&&this.trainableWeights.length!==this.collectedTrainableWeights.length&&console.warn("Discrepancy between trainableweights and collected trainable weights. Did you set `model.trainable` without calling `model.compile()` afterwards?")}evaluate(n,s,u={}){const f=u.batchSize==null?32:u.batchSize;checkBatchSize(f);const A=this.standardizeUserDataXY(n,s,!0,f);try{const v=A[0].concat(A[1]);this.makeTestFunction();const y=this.testFunction,T=this.testLoop(y,v,f,u.verbose,u.steps);return singletonOrArray(T)}finally{disposeNewTensors(A[0],n),disposeNewTensors(A[1],s)}}async evaluateDataset(n,s){return this.makeTestFunction(),evaluateDataset(this,n,s)}checkNumSamples(n,s,u,f="steps"){let m;if(u!=null){if(m=null,s!=null)throw new ValueError(`If ${f} is set, batchSize must be null or undefined.Got batchSize = ${s}`)}else if(n!=null)Array.isArray(n)?m=n[0].shape[0]:m=n.shape[0];else throw new ValueError(`Either the input data should have a defined shape, or ${f} shoud be specified.`);return m}execute(n,s){if(Array.isArray(s)&&s.length===0)throw new ValueError("`outputs` is an empty Array, which is not allowed.");const u=Array.isArray(s),f=u?s:[s],m=this.retrieveSymbolicTensors(f),A=new FeedDict;if(n instanceof Tensor&&(n=[n]),Array.isArray(n)){if(n.length!==this.inputs.length)throw new ValueError(`The number of inputs provided (${n.length}) does not match the number of inputs of this model (${this.inputs.length}).`);for(let y=0;yv.name);for(let v=0;v0){const f=[];throw s.forEach((m,A)=>{m==null&&f.push(n[A])}),new ValueError(`Cannot find SymbolicTensors for output name(s): ${JSON.stringify(f)}`)}return s}predictLoop(n,s=32,u=!1){return tidy(()=>{const f=this.checkNumSamples(n);if(u)throw new NotImplementedError("Verbose predictLoop() is not implemented yet.");const m=makeBatches(f,s),A=this.outputs.map(v=>[]);for(let v=0;v{const T=m[v][0],E=m[v][1],S=sliceArrays(n,T,E),I=[];if(Array.isArray(S))for(let F=0;FA[E].push(T));return singletonOrArray(A.map(v=>concat$2(v,0)))})}predict(n,s={}){const u=ensureTensorsRank2OrHigher(n);checkInputData(u,this.inputNames,this.feedInputShapes,!1);try{const f=s.batchSize==null?32:s.batchSize;return checkBatchSize(f),this.predictLoop(u,f)}finally{disposeNewTensors(u,n)}}predictOnBatch(n){checkInputData(n,this.inputNames,this.feedInputShapes,!0);const s=(Array.isArray(n)?n[0]:n).shape[0];return this.predictLoop(n,s)}standardizeUserDataXY(n,s,u=!0,f){if(this.optimizer_==null)throw new RuntimeError("You must compile a model before training/testing. Use LayersModel.compile(modelCompileArgs).");const m=[];for(let A=0;A0&&n[0].shape[0]%f!==0)throw new ValueError(`In a stateful network, you should only pass inputs with a number of samples that is divisible by the batch size ${f}. Found: ${n[0].shape[0]} sample(s).`);return[n,s]}async standardizeUserData(n,s,u,f,m=!0,A){const[v,y]=this.standardizeUserDataXY(n,s,m,A);if(u!=null)throw new Error("sample weight is not supported yet.");let T=null;if(f!=null){const E=standardizeClassWeights(f,this.outputNames);T=[];for(let S=0;S{const A=this.checkNumSamples(s,u,m,"steps"),v=[];if(f>0)throw new NotImplementedError("Verbose mode is not implemented yet.");if(m!=null)throw new NotImplementedError("steps mode in testLoop() is not implemented yet");{const y=makeBatches(A,u),T=tensor1d(range$2(0,A));for(let E=0;E1){const A=count(n.slice(0,u),f);m+=`_${A}`}s.push(m)}return s}makeTrainFunction(){return n=>{const s=[],u=n.slice(0,this.inputs.length),f=n.slice(this.inputs.length,this.inputs.length+this.outputs.length),m=n.slice(this.inputs.length+this.outputs.length,this.inputs.length+this.outputs.length*2),A=[],v=()=>{const S=[];for(let M=0;M1&&M{F=add$1(F,M)}),F},y=this.collectedTrainableWeights.map(S=>S.read());return[this.optimizer_.minimize(v,!0,y)].concat(A)}}makeTestFunction(){this.testFunction=n=>tidy(()=>{const s=[];let u;const f=n.slice(0,this.inputs.length),m=n.slice(this.inputs.length,this.inputs.length+this.outputs.length),A=[];for(let T=0;T0){if(L=!0,u.validationData.length===2)y=u.validationData[0],T=u.validationData[1];else throw u.validationData.length===3?new NotImplementedError("validationData including sample weights is not supported yet."):new ValueError(`When passing validation data, it must contain 2 (valX, valY) or 3 (valX, valY, valSampleWeight) items; ${u.validationData} is invalid.`);const g=await this.standardizeUserData(y,T,null,null,!0,e);E=g[0],S=g[1],V=E.concat(S)}else if(u.validationSplit!=null&&u.validationSplit>0&&u.validationSplit<1){L=!0;const H=Math.floor(f[0].shape[0]*(1-u.validationSplit)),g=f[0].shape[0];E=sliceArrays(f,H,g),A=f,f=sliceArrays(f,0,H),S=sliceArrays(m,H,g),v=m,m=sliceArrays(m,0,H),V=E.concat(S)}else u.validationSteps!=null&&(L=!0);const B=f.concat(m).concat(I);this.checkTrainableWeightsConsistency();const z=this.makeTrainFunction(),b=this.getDedupedMetricsNames();let W,q;L?(this.makeTestFunction(),W=this.testFunction,q=b.slice().concat(b.map(H=>"val_"+H))):(W=null,V=[],q=b.slice());const Y=standardizeCallbacks(u.callbacks,u.yieldEvery);return await this.fitLoop(z,B,b,e,u.epochs,u.verbose,Y,W,V,u.shuffle,q,u.initialEpoch,null,null)}finally{this.isTraining=!1,disposeNewTensors(f,n),disposeNewTensors(m,s),disposeNewTensors(A,n),disposeNewTensors(v,s),disposeNewTensors(E,y),disposeNewTensors(S,T),I!=null&&dispose(I)}}async fitLoop(n,s,u,f,m,A,v,y,T,E,S,I,e,F){f==null&&(f=32),m==null&&(m=1),E==null&&(E=!0),I==null&&(I=0);let M=!1;if(y!=null&&T!=null&&(M=!0),F!=null&&(M=!0,e==null))throw new ValueError("Can only use `validationSteps` when doing step-wise training, i.e., `stepsPerEpoch` must be set.");const L=this.checkNumSamples(s,f,e,"steps_per_epoch");let V;L!=null&&(V=range$2(0,L)),A==null&&(A=1);const{callbackList:B,history:z}=configureCallbacks(v,A,m,I,L,e,f,M,S);B.setModel(this),this.history=z,await B.onTrainBegin(),this.stopTraining_=!1;for(let b=I;b{const g=Y[X][0],J=Y[X][1],re=sliceAlongFirstAxis(q,g,J-g);H.batch=X,H.size=J-g;const ae=sliceArraysByIndices(s,re),fe=n(ae);for(let pe=0;petoSnakeCase(s))}else{const s=Object.keys(this.loss);n={};const u=this.loss;for(const f of s)if(typeof u[f]=="string")n[f]=toSnakeCase(u[f]);else throw new Error("Serialization of non-string loss is not supported.")}return n}getMetricIdentifiers(){if(typeof this.metrics=="string"||typeof this.metrics=="function")return[toSnakeCase(getLossOrMetricName(this.metrics))];if(Array.isArray(this.metrics))return this.metrics.map(n=>toSnakeCase(getLossOrMetricName(n)));{const n={};for(const s in this.metrics)n[s]=toSnakeCase(getLossOrMetricName(this.metrics[s]));return n}}getTrainingConfig(){return{loss:this.getLossIdentifiers(),metrics:this.getMetricIdentifiers(),optimizer_config:{class_name:this.optimizer.getClassName(),config:this.optimizer.getConfig()}}}loadTrainingConfig(n){if(n.weighted_metrics!=null)throw new Error("Loading weight_metrics is not supported yet.");if(n.loss_weights!=null)throw new Error("Loading loss_weights is not supported yet.");if(n.sample_weight_mode!=null)throw new Error("Loading sample_weight_mode is not supported yet.");const s=convertPythonicToTs(n.optimizer_config),u=deserialize(s);let f;if(typeof n.loss=="string")f=toCamelCase(n.loss);else if(Array.isArray(n.loss))f=n.loss.map(A=>toCamelCase(A));else if(n.loss!=null){f={};for(const A in n.loss)f[A]=toCamelCase(n.loss[A])}let m;if(Array.isArray(n.metrics))m=n.metrics.map(A=>toCamelCase(A));else if(n.metrics!=null){m={};for(const A in n.metrics)m[A]=toCamelCase(n.metrics[A])}this.compile({loss:f,metrics:m,optimizer:u})}async save(n,s){if(typeof n=="string"){const T=getSaveHandlers(n);if(T.length===0)throw new ValueError(`Cannot find any save handlers for URL '${n}'`);if(T.length>1)throw new ValueError(`Found more than one (${T.length}) save handlers for URL '${n}'`);n=T[0]}if(n.save==null)throw new ValueError("LayersModel.save() cannot proceed because the IOHandler provided does not have the `save` attribute defined.");const u=await encodeWeights(this.getNamedWeights(s)),v={modelTopology:this.toJSON(null,!1),format:LAYERS_MODEL_FORMAT_NAME,generatedBy:`TensorFlow.js tfjs-layers v${version}`,convertedBy:null};if((s==null?!1:s.includeOptimizer)&&this.optimizer!=null){v.trainingConfig=this.getTrainingConfig();const T="optimizer",{data:E,specs:S}=await encodeWeights(await this.optimizer.getWeights(),T);u.specs.push(...S),u.data=concatenateArrayBuffers([u.data,E])}return this.userDefinedMetadata!=null&&(checkUserDefinedMetadata(this.userDefinedMetadata,this.name,!0),v.userDefinedMetadata=this.userDefinedMetadata),v.weightData=u.data,v.weightSpecs=u.specs,n.save(v)}setUserDefinedMetadata(n){checkUserDefinedMetadata(n,this.name),this.userDefinedMetadata=n}getUserDefinedMetadata(){return this.userDefinedMetadata}}LayersModel.className="Model";registerClass(LayersModel);class Functional extends LayersModel{}Functional.className="Functional";registerClass(Functional);/** + */function isDataTensor(a){return a instanceof Tensor}function isDataArray(a){return Array.isArray(a)}function isDataDict(a){return!isDataTensor(a)&&!isDataArray(a)}function standardizeInputData(a,n,s,u=!0,f=""){if(n==null||n.length===0){if(a!=null){let A=!1;if(isDataArray(a)&&a.length>0)A=!0;else if(isDataDict(a)){for(const v in a)if(a.hasOwnProperty(v)){A=!0;break}}else A=!0;if(A)throw new ValueError(`Error when checking model ${f} expected no data, but got ${a}`)}return[]}if(a==null)return n.map(A=>null);let m;if(isDataDict(a)){a=a,m=[];for(const A of n){if(a[A]==null)throw new ValueError(`No data provided for "${A}". Need data for each key in: ${n}`);m.push(a[A])}}else if(isDataArray(a)){if(a=a,a.length!==n.length)throw new ValueError(`Error when checking model ${f}: the Array of Tensors that you are passing to your model is not the size the model expected. Expected to see ${n.length} Tensor(s), but instead got the following list of Tensor(s): ${a}`);m=a}else{if(a=a,n.length>1)throw new ValueError(`The model ${f} expects ${n.length} Tensor(s), but only received one Tensor. Found: Tensor with shape ${a.shape}`);m=[a]}if(m=ensureTensorsRank2OrHigher(m),s!=null)for(let A=0;A=0&&T!==E)throw new ValueError(`${f} expected a batch of elements where each example has shape [${s[A].slice(1,s[A].length)}] (i.e.,tensor shape [*,${s[A].slice(1,s[A].length)}]) but the ${f} received an input with ${v.shape[0]} examples, each with shape [${v.shape.slice(1,v.shape.length)}] (tensor shape [${v.shape}])`)}}return m}function checkArrayLengths(a,n,s){const u=unique$2(a.map(m=>m.shape[0]));u.sort();const f=unique$2(n.map(m=>m.shape[0]));if(f.sort(),u.length>1)throw new ValueError(`All input Tensors (x) should have the same number of samples. Got array shapes: ${JSON.stringify(a.map(m=>m.shape))}`);if(f.length>1)throw new ValueError(`All target Tensors (y) should have the same number of samples. Got array shapes: ${JSON.stringify(n.map(m=>m.shape))}`);if(u.length>0&&f.length>0&&!arraysEqual(u,f))throw new ValueError(`Input Tensors should have the same number of samples as target Tensors. Found ${u[0]} input sample(s) and ${f[0]} target sample(s).`)}function checkLossAndTargetCompatibility(a,n,s){const u=[meanSquaredError,binaryCrossentropy$1,categoricalCrossentropy$1];for(let f=0;f1)throw new ValueError(`The model expects ${n.length} ${f} Tensors, but only received one Tensor. Found: array with shape ${JSON.stringify(a.shape)}.`);m=[a]}if(s!=null)for(let A=0;A[]);let s;if(typeof a=="string"||typeof a=="function")s=[a];else if(Array.isArray(a)||typeof a=="object")s=a;else throw new TypeError(`Type of metrics argument not understood. Expected an string,function, Array, or Object, found: ${a}`);if(Array.isArray(s))return n.map(u=>s);{const u=[];for(const f of n){let m=s.hasOwnProperty(f)?s[f]:[];Array.isArray(m)||(m=[m]),u.push(m)}return u}}const LAYERS_MODEL_FORMAT_NAME="layers-model";class LayersModel extends Container{constructor(n){super(n),this.isTraining=!1}summary(n,s,u=console.log){if(!this.built)throw new ValueError("This model has never been called, thus its weights have not been created yet. So no summary can be displayed. Build the model first (e.g., by calling it on some test data).");printSummary(this,n,s,u)}compile(n){if(n.loss==null&&(n.loss=[]),this.loss=n.loss,typeof n.optimizer=="string")this.optimizer_=getOptimizer(n.optimizer),this.isOptimizerOwned=!0;else{if(!(n.optimizer instanceof Optimizer))throw new ValueError("User-defined optimizer must be an instance of tf.Optimizer.");this.optimizer_=n.optimizer,this.isOptimizerOwned=!1}let s=[];if(!Array.isArray(n.loss)&&typeof n.loss!="string"&&typeof n.loss!="function"){n.loss=n.loss;for(const A in n.loss)if(this.outputNames.indexOf(A)===-1)throw new ValueError(`Unknown entry in loss dictionary: "${A}". Only expected the following keys: ${this.outputNames}`);for(const A of this.outputNames)n.loss[A]==null&&console.warn(`Output "${A}" is missing from loss dictionary. We assume this was done on purpose, and we will not be expecting data to be passed to ${A} during training`),s.push(get$1(n.loss[A]))}else if(Array.isArray(n.loss)){if(n.loss.length!==this.outputs.length)throw new ValueError(`When passing an Array as loss, it should have one entry per model output. The model has ${this.outputs.length} output(s), but you passed loss=${n.loss}.`);s=n.loss.map(v=>get$1(v))}else{const A=get$1(n.loss);this.outputs.forEach(v=>{s.push(A)})}this.lossFunctions=s,this.feedOutputNames=[],this.feedOutputShapes=[],this.feedLossFns=[];for(let A=0;A{for(let A=0;A1&&(this.metricsTensors.push([v,A]),this.metricsNames.push(this.outputNames[A]+"_loss"))}});const f=collectMetrics(n.metrics,this.outputNames),m=(A,v,y)=>{this.outputNames.length>1&&(v=this.outputNames[A]+"_"+v),this.metricsNames.push(v),this.metricsTensors.push([y,A])};nameScope("metric",()=>{for(let A=0;A{const E="";let S,I,e;for(const F of T){if(typeof F=="string"&&["accuracy","acc","crossentropy","ce"].indexOf(F)!==-1){const L=this.internalOutputShapes[A];L[L.length-1]===1||this.lossFunctions[A]===binaryCrossentropy$1?["accuracy","acc"].indexOf(F)!==-1?I=binaryAccuracy:["crossentropy","ce"].indexOf(F)!==-1&&(I=binaryCrossentropy):this.lossFunctions[A]===sparseCategoricalCrossentropy$1?["accuracy","acc"].indexOf(F)!==-1?I=sparseCategoricalAccuracy:["crossentropy","ce"].indexOf(F)!==-1&&(I=sparseCategoricalCrossentropy):["accuracy","acc"].indexOf(F)!==-1?I=categoricalAccuracy:["crossentropy","ce"].indexOf(F)!==-1&&(I=categoricalCrossentropy);let V;["accuracy","acc"].indexOf(F)!==-1?V="acc":["crossentropy","ce"].indexOf(F)!==-1&&(V="ce"),e=I,S=E+V}else e=get(F),S=E+getLossOrMetricName(F);let M;nameScope(S,()=>{M=e}),m(A,S,M)}})(v)}}),this.collectedTrainableWeights=this.trainableWeights}checkTrainableWeightsConsistency(){this.collectedTrainableWeights!=null&&this.trainableWeights.length!==this.collectedTrainableWeights.length&&console.warn("Discrepancy between trainableweights and collected trainable weights. Did you set `model.trainable` without calling `model.compile()` afterwards?")}evaluate(n,s,u={}){const f=u.batchSize==null?32:u.batchSize;checkBatchSize(f);const A=this.standardizeUserDataXY(n,s,!0,f);try{const v=A[0].concat(A[1]);this.makeTestFunction();const y=this.testFunction,T=this.testLoop(y,v,f,u.verbose,u.steps);return singletonOrArray(T)}finally{disposeNewTensors(A[0],n),disposeNewTensors(A[1],s)}}async evaluateDataset(n,s){return this.makeTestFunction(),evaluateDataset(this,n,s)}checkNumSamples(n,s,u,f="steps"){let m;if(u!=null){if(m=null,s!=null)throw new ValueError(`If ${f} is set, batchSize must be null or undefined.Got batchSize = ${s}`)}else if(n!=null)Array.isArray(n)?m=n[0].shape[0]:m=n.shape[0];else throw new ValueError(`Either the input data should have a defined shape, or ${f} shoud be specified.`);return m}execute(n,s){if(Array.isArray(s)&&s.length===0)throw new ValueError("`outputs` is an empty Array, which is not allowed.");const u=Array.isArray(s),f=u?s:[s],m=this.retrieveSymbolicTensors(f),A=new FeedDict;if(n instanceof Tensor&&(n=[n]),Array.isArray(n)){if(n.length!==this.inputs.length)throw new ValueError(`The number of inputs provided (${n.length}) does not match the number of inputs of this model (${this.inputs.length}).`);for(let y=0;yv.name);for(let v=0;v0){const f=[];throw s.forEach((m,A)=>{m==null&&f.push(n[A])}),new ValueError(`Cannot find SymbolicTensors for output name(s): ${JSON.stringify(f)}`)}return s}predictLoop(n,s=32,u=!1){return tidy(()=>{const f=this.checkNumSamples(n);if(u)throw new NotImplementedError("Verbose predictLoop() is not implemented yet.");const m=makeBatches(f,s),A=this.outputs.map(v=>[]);for(let v=0;v{const T=m[v][0],E=m[v][1],S=sliceArrays(n,T,E),I=[];if(Array.isArray(S))for(let F=0;FA[E].push(T));return singletonOrArray(A.map(v=>concat$2(v,0)))})}predict(n,s={}){const u=ensureTensorsRank2OrHigher(n);checkInputData(u,this.inputNames,this.feedInputShapes,!1);try{const f=s.batchSize==null?32:s.batchSize;return checkBatchSize(f),this.predictLoop(u,f)}finally{disposeNewTensors(u,n)}}predictOnBatch(n){checkInputData(n,this.inputNames,this.feedInputShapes,!0);const s=(Array.isArray(n)?n[0]:n).shape[0];return this.predictLoop(n,s)}standardizeUserDataXY(n,s,u=!0,f){if(this.optimizer_==null)throw new RuntimeError("You must compile a model before training/testing. Use LayersModel.compile(modelCompileArgs).");const m=[];for(let A=0;A0&&n[0].shape[0]%f!==0)throw new ValueError(`In a stateful network, you should only pass inputs with a number of samples that is divisible by the batch size ${f}. Found: ${n[0].shape[0]} sample(s).`);return[n,s]}async standardizeUserData(n,s,u,f,m=!0,A){const[v,y]=this.standardizeUserDataXY(n,s,m,A);if(u!=null)throw new Error("sample weight is not supported yet.");let T=null;if(f!=null){const E=standardizeClassWeights(f,this.outputNames);T=[];for(let S=0;S{const A=this.checkNumSamples(s,u,m,"steps"),v=[];if(f>0)throw new NotImplementedError("Verbose mode is not implemented yet.");if(m!=null)throw new NotImplementedError("steps mode in testLoop() is not implemented yet");{const y=makeBatches(A,u),T=tensor1d(range$2(0,A));for(let E=0;E1){const A=count(n.slice(0,u),f);m+=`_${A}`}s.push(m)}return s}makeTrainFunction(){return n=>{const s=[],u=n.slice(0,this.inputs.length),f=n.slice(this.inputs.length,this.inputs.length+this.outputs.length),m=n.slice(this.inputs.length+this.outputs.length,this.inputs.length+this.outputs.length*2),A=[],v=()=>{const S=[];for(let M=0;M1&&M{F=add$1(F,M)}),F},y=this.collectedTrainableWeights.map(S=>S.read());return[this.optimizer_.minimize(v,!0,y)].concat(A)}}makeTestFunction(){this.testFunction=n=>tidy(()=>{const s=[];let u;const f=n.slice(0,this.inputs.length),m=n.slice(this.inputs.length,this.inputs.length+this.outputs.length),A=[];for(let T=0;T0){if(L=!0,u.validationData.length===2)y=u.validationData[0],T=u.validationData[1];else throw u.validationData.length===3?new NotImplementedError("validationData including sample weights is not supported yet."):new ValueError(`When passing validation data, it must contain 2 (valX, valY) or 3 (valX, valY, valSampleWeight) items; ${u.validationData} is invalid.`);const g=await this.standardizeUserData(y,T,null,null,!0,e);E=g[0],S=g[1],V=E.concat(S)}else if(u.validationSplit!=null&&u.validationSplit>0&&u.validationSplit<1){L=!0;const Q=Math.floor(f[0].shape[0]*(1-u.validationSplit)),g=f[0].shape[0];E=sliceArrays(f,Q,g),A=f,f=sliceArrays(f,0,Q),S=sliceArrays(m,Q,g),v=m,m=sliceArrays(m,0,Q),V=E.concat(S)}else u.validationSteps!=null&&(L=!0);const B=f.concat(m).concat(I);this.checkTrainableWeightsConsistency();const z=this.makeTrainFunction(),b=this.getDedupedMetricsNames();let W,q;L?(this.makeTestFunction(),W=this.testFunction,q=b.slice().concat(b.map(Q=>"val_"+Q))):(W=null,V=[],q=b.slice());const Y=standardizeCallbacks(u.callbacks,u.yieldEvery);return await this.fitLoop(z,B,b,e,u.epochs,u.verbose,Y,W,V,u.shuffle,q,u.initialEpoch,null,null)}finally{this.isTraining=!1,disposeNewTensors(f,n),disposeNewTensors(m,s),disposeNewTensors(A,n),disposeNewTensors(v,s),disposeNewTensors(E,y),disposeNewTensors(S,T),I!=null&&dispose(I)}}async fitLoop(n,s,u,f,m,A,v,y,T,E,S,I,e,F){f==null&&(f=32),m==null&&(m=1),E==null&&(E=!0),I==null&&(I=0);let M=!1;if(y!=null&&T!=null&&(M=!0),F!=null&&(M=!0,e==null))throw new ValueError("Can only use `validationSteps` when doing step-wise training, i.e., `stepsPerEpoch` must be set.");const L=this.checkNumSamples(s,f,e,"steps_per_epoch");let V;L!=null&&(V=range$2(0,L)),A==null&&(A=1);const{callbackList:B,history:z}=configureCallbacks(v,A,m,I,L,e,f,M,S);B.setModel(this),this.history=z,await B.onTrainBegin(),this.stopTraining_=!1;for(let b=I;b{const g=Y[X][0],J=Y[X][1],re=sliceAlongFirstAxis(q,g,J-g);Q.batch=X,Q.size=J-g;const ae=sliceArraysByIndices(s,re),fe=n(ae);for(let pe=0;petoSnakeCase(s))}else{const s=Object.keys(this.loss);n={};const u=this.loss;for(const f of s)if(typeof u[f]=="string")n[f]=toSnakeCase(u[f]);else throw new Error("Serialization of non-string loss is not supported.")}return n}getMetricIdentifiers(){if(typeof this.metrics=="string"||typeof this.metrics=="function")return[toSnakeCase(getLossOrMetricName(this.metrics))];if(Array.isArray(this.metrics))return this.metrics.map(n=>toSnakeCase(getLossOrMetricName(n)));{const n={};for(const s in this.metrics)n[s]=toSnakeCase(getLossOrMetricName(this.metrics[s]));return n}}getTrainingConfig(){return{loss:this.getLossIdentifiers(),metrics:this.getMetricIdentifiers(),optimizer_config:{class_name:this.optimizer.getClassName(),config:this.optimizer.getConfig()}}}loadTrainingConfig(n){if(n.weighted_metrics!=null)throw new Error("Loading weight_metrics is not supported yet.");if(n.loss_weights!=null)throw new Error("Loading loss_weights is not supported yet.");if(n.sample_weight_mode!=null)throw new Error("Loading sample_weight_mode is not supported yet.");const s=convertPythonicToTs(n.optimizer_config),u=deserialize(s);let f;if(typeof n.loss=="string")f=toCamelCase(n.loss);else if(Array.isArray(n.loss))f=n.loss.map(A=>toCamelCase(A));else if(n.loss!=null){f={};for(const A in n.loss)f[A]=toCamelCase(n.loss[A])}let m;if(Array.isArray(n.metrics))m=n.metrics.map(A=>toCamelCase(A));else if(n.metrics!=null){m={};for(const A in n.metrics)m[A]=toCamelCase(n.metrics[A])}this.compile({loss:f,metrics:m,optimizer:u})}async save(n,s){if(typeof n=="string"){const T=getSaveHandlers(n);if(T.length===0)throw new ValueError(`Cannot find any save handlers for URL '${n}'`);if(T.length>1)throw new ValueError(`Found more than one (${T.length}) save handlers for URL '${n}'`);n=T[0]}if(n.save==null)throw new ValueError("LayersModel.save() cannot proceed because the IOHandler provided does not have the `save` attribute defined.");const u=await encodeWeights(this.getNamedWeights(s)),v={modelTopology:this.toJSON(null,!1),format:LAYERS_MODEL_FORMAT_NAME,generatedBy:`TensorFlow.js tfjs-layers v${version}`,convertedBy:null};if((s==null?!1:s.includeOptimizer)&&this.optimizer!=null){v.trainingConfig=this.getTrainingConfig();const T="optimizer",{data:E,specs:S}=await encodeWeights(await this.optimizer.getWeights(),T);u.specs.push(...S),u.data=concatenateArrayBuffers([u.data,E])}return this.userDefinedMetadata!=null&&(checkUserDefinedMetadata(this.userDefinedMetadata,this.name,!0),v.userDefinedMetadata=this.userDefinedMetadata),v.weightData=u.data,v.weightSpecs=u.specs,n.save(v)}setUserDefinedMetadata(n){checkUserDefinedMetadata(n,this.name),this.userDefinedMetadata=n}getUserDefinedMetadata(){return this.userDefinedMetadata}}LayersModel.className="Model";registerClass(LayersModel);class Functional extends LayersModel{}Functional.className="Functional";registerClass(Functional);/** * @license * Copyright 2018 Google LLC * @@ -9478,7 +9478,7 @@ Ooh no!!`);break}m[y]=T,v=Math.min(v,T)}for(let y=0;y1&&(n=a.slice(1,a.length)),a=a[0]}function f(m){return m==null||Array.isArray(m)?m:[m]}return n=f(n),s=f(s),{inputs:a,initialState:n,constants:s}}function rnn(a,n,s,u=!1,f,m,A=!1,v=!1){return tidy(()=>{const y=n.shape.length;if(y<3)throw new ValueError(`Input should be at least 3D, but is ${y}D.`);const T=[1,0].concat(range$2(2,y));if(n=transpose$2(n,T),m!=null)throw new NotImplementedError("The rnn() functoin of the deeplearn.js backend does not support constants yet.");A&&console.warn("Backend rnn(): the unroll = true option is not applicable to the imperative deeplearn.js backend."),f!=null&&(f=cast$3(cast$3(f,"bool"),"float32"),f.rank===y-1&&(f=expandDims$3(f,-1)),f=transpose$2(f,T)),u&&(n=reverse$2(n,0),f!=null&&(f=reverse$2(f,0)));const E=[];let S,I=s;const e=n.shape[0],F=unstack(n);let M;f!=null&&(M=unstack(f));for(let V=0;Va(B,I));if(f==null)S=z[0],I=z[1];else{const b=tidy(()=>{const W=M[V],q=sub$2(onesLike$2(W),W),Y=add$1(mul(z[0],W),mul(I[0],q)),X=I.map((H,g)=>add$1(mul(z[1][g],W),mul(H,q)));return{output:Y,newStates:X}});S=b.output,I=b.newStates}v&&E.push(S)}let L;return v&&(L=stack(E,1)),[S,L,I]})}class RNN extends Layer{constructor(n){super(n);let s;if(n.cell==null)throw new ValueError("cell property is missing for the constructor of RNN.");if(Array.isArray(n.cell)?s=new StackedRNNCells({cells:n.cell}):s=n.cell,s.stateSize==null)throw new ValueError("The RNN cell should have an attribute `stateSize` (tuple of integers, one integer per RNN state).");this.cell=s,this.returnSequences=n.returnSequences==null?!1:n.returnSequences,this.returnState=n.returnState==null?!1:n.returnState,this.goBackwards=n.goBackwards==null?!1:n.goBackwards,this._stateful=n.stateful==null?!1:n.stateful,this.unroll=n.unroll==null?!1:n.unroll,this.supportsMasking=!0,this.inputSpec=[new InputSpec({ndim:3})],this.stateSpec=null,this.states_=null,this.numConstants=null,this.keptStates=[]}getStates(){if(this.states_==null){const n=Array.isArray(this.cell.stateSize)?this.cell.stateSize.length:1;return range$2(0,n).map(s=>null)}else return this.states_}setStates(n){this.states_=n}computeOutputShape(n){isArrayOfShapes(n)&&(n=n[0]),n=n;let s=this.cell.stateSize;Array.isArray(s)||(s=[s]);const u=s[0];let f;if(this.returnSequences?f=[n[0],n[1],u]:f=[n[0],u],this.returnState){const m=[];for(const A of s)m.push([n[0],A]);return[f].concat(m)}else return f}computeMask(n,s){return tidy(()=>{Array.isArray(s)&&(s=s[0]);const u=this.returnSequences?s:null;if(this.returnState){const f=this.states.map(m=>null);return[u].concat(f)}else return u})}get states(){if(this.states_==null){const n=Array.isArray(this.cell.stateSize)?this.cell.stateSize.length:1,s=[];for(let u=0;uA.shape[A.shape.length-1]),m))throw new ValueError(`An initialState was passed that is not compatible with cell.stateSize. Received stateSpec=${this.stateSpec}; However cell.stateSize is ${this.cell.stateSize}`)}else this.stateSpec=m.map(A=>new InputSpec({shape:[null,A]}));this.stateful&&this.resetStates()}resetStates(n,s=!1){tidy(()=>{if(!this.stateful)throw new AttributeError("Cannot call resetStates() on an RNN Layer that is not stateful.");const u=this.inputSpec[0].shape[0];if(u==null)throw new ValueError("If an RNN is stateful, it needs to know its batch size. Specify the batch size of your input tensors: \n- If using a Sequential model, specify the batch size by passing a `batchInputShape` option to your first layer.\n- If using the functional API, specify the batch size by passing a `batchShape` option to your Input layer.");if(this.states_==null)Array.isArray(this.cell.stateSize)?this.states_=this.cell.stateSize.map(f=>zeros$1([u,f])):this.states_=[zeros$1([u,this.cell.stateSize])];else if(n==null)dispose(this.states_),this.keptStates!=null&&(dispose(this.keptStates),this.keptStates=[]),Array.isArray(this.cell.stateSize)?this.states_=this.cell.stateSize.map(f=>zeros$1([u,f])):this.states_[0]=zeros$1([u,this.cell.stateSize]);else{if(Array.isArray(n)||(n=[n]),n.length!==this.states_.length)throw new ValueError(`Layer ${this.name} expects ${this.states_.length} state(s), but it received ${n.length} state value(s). Input received: ${n}`);s===!0?this.keptStates.push(this.states_.slice()):dispose(this.states_);for(let f=0;fkeep(f.clone()))})}apply(n,s){let u=s==null?null:s.initialState,f=s==null?null:s.constants;s==null&&(s={});const m=standardizeArgs(n,u,f,this.numConstants);n=m.inputs,u=m.initialState,f=m.constants;let A=[],v=[];if(u!=null){s.initialState=u,A=A.concat(u),this.stateSpec=[];for(const T of u)this.stateSpec.push(new InputSpec({shape:T.shape}));v=v.concat(this.stateSpec)}if(f!=null&&(s.constants=f,A=A.concat(f),this.numConstants=f.length),A[0]instanceof SymbolicTensor){const T=[n].concat(A),E=this.inputSpec.concat(v),S=this.inputSpec;this.inputSpec=E;const I=super.apply(T,s);return this.inputSpec=S,I}else return super.apply(n,s)}call(n,s){return tidy(()=>{const u=s==null?null:s.mask,f=s==null?null:s.training;let m=s==null?null:s.initialState;n=getExactlyOneTensor(n),m==null&&(this.stateful?m=this.states_:m=this.getInitialState(n));const A=Array.isArray(this.cell.stateSize)?this.cell.stateSize.length:1;if(m.length!==A)throw new ValueError(`RNN Layer has ${A} state(s) but was passed ${m.length} initial state(s).`);this.unroll&&console.warn("Ignoring unroll = true for RNN layer, due to imperative backend.");const v={training:f},T=rnn((F,M)=>{const L=this.cell.call([F].concat(M),v);return[L[0],L.slice(1)]},n,m,this.goBackwards,u,null,this.unroll,this.returnSequences),E=T[0],S=T[1],I=T[2];this.stateful&&this.resetStates(I,f);const e=this.returnSequences?S:E;return this.returnState?[e].concat(I):e})}getInitialState(n){return tidy(()=>{let s=zeros$1(n.shape);return s=sum$2(s,[1,2]),s=expandDims$2(s),Array.isArray(this.cell.stateSize)?this.cell.stateSize.map(u=>u>1?tile$2(s,[1,u]):s):this.cell.stateSize>1?[tile$2(s,[1,this.cell.stateSize])]:[s]})}get trainableWeights(){return this.trainable?this.cell.trainableWeights:[]}get nonTrainableWeights(){return this.trainable?this.cell.nonTrainableWeights:this.cell.weights}setFastWeightInitDuringBuild(n){super.setFastWeightInitDuringBuild(n),this.cell!=null&&this.cell.setFastWeightInitDuringBuild(n)}getConfig(){const n=super.getConfig(),s={returnSequences:this.returnSequences,returnState:this.returnState,goBackwards:this.goBackwards,stateful:this.stateful,unroll:this.unroll};this.numConstants!=null&&(s.numConstants=this.numConstants);const u=this.cell.getConfig();return this.getClassName()===RNN.className&&(s.cell={className:this.cell.getClassName(),config:u}),Object.assign(Object.assign(Object.assign({},u),n),s)}static fromConfig(n,s,u={}){const f=s.cell,m=deserialize(f,u);return new n(Object.assign(s,{cell:m}))}}RNN.className="RNN";registerClass(RNN);class RNNCell extends Layer{}class SimpleRNNCell extends RNNCell{constructor(n){super(n),this.DEFAULT_ACTIVATION="tanh",this.DEFAULT_KERNEL_INITIALIZER="glorotNormal",this.DEFAULT_RECURRENT_INITIALIZER="orthogonal",this.DEFAULT_BIAS_INITIALIZER="zeros",this.units=n.units,assertPositiveInteger(this.units,"units"),this.activation=getActivation(n.activation==null?this.DEFAULT_ACTIVATION:n.activation),this.useBias=n.useBias==null?!0:n.useBias,this.kernelInitializer=getInitializer(n.kernelInitializer||this.DEFAULT_KERNEL_INITIALIZER),this.recurrentInitializer=getInitializer(n.recurrentInitializer||this.DEFAULT_RECURRENT_INITIALIZER),this.biasInitializer=getInitializer(n.biasInitializer||this.DEFAULT_BIAS_INITIALIZER),this.kernelRegularizer=getRegularizer(n.kernelRegularizer),this.recurrentRegularizer=getRegularizer(n.recurrentRegularizer),this.biasRegularizer=getRegularizer(n.biasRegularizer),this.kernelConstraint=getConstraint(n.kernelConstraint),this.recurrentConstraint=getConstraint(n.recurrentConstraint),this.biasConstraint=getConstraint(n.biasConstraint),this.dropout=min$2([1,max$2([0,n.dropout==null?0:n.dropout])]),this.recurrentDropout=min$2([1,max$2([0,n.recurrentDropout==null?0:n.recurrentDropout])]),this.dropoutFunc=n.dropoutFunc,this.stateSize=this.units,this.dropoutMask=null,this.recurrentDropoutMask=null}build(n){n=getExactlyOneShape(n),this.kernel=this.addWeight("kernel",[n[n.length-1],this.units],null,this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint),this.recurrentKernel=this.addWeight("recurrent_kernel",[this.units,this.units],null,this.recurrentInitializer,this.recurrentRegularizer,!0,this.recurrentConstraint),this.useBias?this.bias=this.addWeight("bias",[this.units],null,this.biasInitializer,this.biasRegularizer,!0,this.biasConstraint):this.bias=null,this.built=!0}call(n,s){return tidy(()=>{if(n=n,n.length!==2)throw new ValueError(`SimpleRNNCell expects 2 input Tensors, got ${n.length}.`);let u=n[1];n=n[0];const f=s.training==null?!1:s.training;0onesLike$2(n),rate:this.dropout,training:f,dropoutFunc:this.dropoutFunc})),0onesLike$2(u),rate:this.recurrentDropout,training:f,dropoutFunc:this.dropoutFunc}));let m;const A=this.dropoutMask,v=this.recurrentDropoutMask;A!=null?m=dot(mul(n,A),this.kernel.read()):m=dot(n,this.kernel.read()),this.bias!=null&&(m=biasAdd(m,this.bias.read())),v!=null&&(u=mul(u,v));let y=add$1(m,dot(u,this.recurrentKernel.read()));return this.activation!=null&&(y=this.activation.apply(y)),[y,y]})}getConfig(){const n=super.getConfig(),s={units:this.units,activation:serializeActivation(this.activation),useBias:this.useBias,kernelInitializer:serializeInitializer(this.kernelInitializer),recurrentInitializer:serializeInitializer(this.recurrentInitializer),biasInitializer:serializeInitializer(this.biasInitializer),kernelRegularizer:serializeRegularizer(this.kernelRegularizer),recurrentRegularizer:serializeRegularizer(this.recurrentRegularizer),biasRegularizer:serializeRegularizer(this.biasRegularizer),activityRegularizer:serializeRegularizer(this.activityRegularizer),kernelConstraint:serializeConstraint(this.kernelConstraint),recurrentConstraint:serializeConstraint(this.recurrentConstraint),biasConstraint:serializeConstraint(this.biasConstraint),dropout:this.dropout,recurrentDropout:this.recurrentDropout};return Object.assign(Object.assign({},n),s)}}SimpleRNNCell.className="SimpleRNNCell";registerClass(SimpleRNNCell);class SimpleRNN extends RNN{constructor(n){n.cell=new SimpleRNNCell(n),super(n)}call(n,s){return tidy(()=>{this.cell.dropoutMask!=null&&(dispose(this.cell.dropoutMask),this.cell.dropoutMask=null),this.cell.recurrentDropoutMask!=null&&(dispose(this.cell.recurrentDropoutMask),this.cell.recurrentDropoutMask=null);const u=s==null?null:s.mask,f=s==null?null:s.training,m=s==null?null:s.initialState;return super.call(n,{mask:u,training:f,initialState:m})})}static fromConfig(n,s){return new n(s)}}SimpleRNN.className="SimpleRNN";registerClass(SimpleRNN);class GRUCell extends RNNCell{constructor(n){if(super(n),this.DEFAULT_ACTIVATION="tanh",this.DEFAULT_RECURRENT_ACTIVATION="hardSigmoid",this.DEFAULT_KERNEL_INITIALIZER="glorotNormal",this.DEFAULT_RECURRENT_INITIALIZER="orthogonal",this.DEFAULT_BIAS_INITIALIZER="zeros",n.resetAfter)throw new ValueError("GRUCell does not support reset_after parameter set to true.");this.units=n.units,assertPositiveInteger(this.units,"units"),this.activation=getActivation(n.activation===void 0?this.DEFAULT_ACTIVATION:n.activation),this.recurrentActivation=getActivation(n.recurrentActivation===void 0?this.DEFAULT_RECURRENT_ACTIVATION:n.recurrentActivation),this.useBias=n.useBias==null?!0:n.useBias,this.kernelInitializer=getInitializer(n.kernelInitializer||this.DEFAULT_KERNEL_INITIALIZER),this.recurrentInitializer=getInitializer(n.recurrentInitializer||this.DEFAULT_RECURRENT_INITIALIZER),this.biasInitializer=getInitializer(n.biasInitializer||this.DEFAULT_BIAS_INITIALIZER),this.kernelRegularizer=getRegularizer(n.kernelRegularizer),this.recurrentRegularizer=getRegularizer(n.recurrentRegularizer),this.biasRegularizer=getRegularizer(n.biasRegularizer),this.kernelConstraint=getConstraint(n.kernelConstraint),this.recurrentConstraint=getConstraint(n.recurrentConstraint),this.biasConstraint=getConstraint(n.biasConstraint),this.dropout=min$2([1,max$2([0,n.dropout==null?0:n.dropout])]),this.recurrentDropout=min$2([1,max$2([0,n.recurrentDropout==null?0:n.recurrentDropout])]),this.dropoutFunc=n.dropoutFunc,this.implementation=n.implementation,this.stateSize=this.units,this.dropoutMask=null,this.recurrentDropoutMask=null}build(n){n=getExactlyOneShape(n);const s=n[n.length-1];this.kernel=this.addWeight("kernel",[s,this.units*3],null,this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint),this.recurrentKernel=this.addWeight("recurrent_kernel",[this.units,this.units*3],null,this.recurrentInitializer,this.recurrentRegularizer,!0,this.recurrentConstraint),this.useBias?this.bias=this.addWeight("bias",[this.units*3],null,this.biasInitializer,this.biasRegularizer,!0,this.biasConstraint):this.bias=null,this.built=!0}call(n,s){return tidy(()=>{if(n=n,n.length!==2)throw new ValueError(`GRUCell expects 2 input Tensors (inputs, h, c), got ${n.length}.`);const u=s.training==null?!1:s.training;let f=n[1];n=n[0],0onesLike$2(n),rate:this.dropout,training:u,count:3,dropoutFunc:this.dropoutFunc})),0onesLike$2(f),rate:this.recurrentDropout,training:u,count:3,dropoutFunc:this.dropoutFunc}));const m=this.dropoutMask,A=this.recurrentDropoutMask;let v,y,T;0{this.cell.dropoutMask!=null&&(dispose(this.cell.dropoutMask),this.cell.dropoutMask=null),this.cell.recurrentDropoutMask!=null&&(dispose(this.cell.recurrentDropoutMask),this.cell.recurrentDropoutMask=null);const u=s==null?null:s.mask,f=s==null?null:s.training,m=s==null?null:s.initialState;return super.call(n,{mask:u,training:f,initialState:m})})}static fromConfig(n,s){return s.implmentation===0&&(s.implementation=1),new n(s)}}GRU.className="GRU";registerClass(GRU);class LSTMCell extends RNNCell{constructor(n){super(n),this.DEFAULT_ACTIVATION="tanh",this.DEFAULT_RECURRENT_ACTIVATION="hardSigmoid",this.DEFAULT_KERNEL_INITIALIZER="glorotNormal",this.DEFAULT_RECURRENT_INITIALIZER="orthogonal",this.DEFAULT_BIAS_INITIALIZER="zeros",this.units=n.units,assertPositiveInteger(this.units,"units"),this.activation=getActivation(n.activation===void 0?this.DEFAULT_ACTIVATION:n.activation),this.recurrentActivation=getActivation(n.recurrentActivation===void 0?this.DEFAULT_RECURRENT_ACTIVATION:n.recurrentActivation),this.useBias=n.useBias==null?!0:n.useBias,this.kernelInitializer=getInitializer(n.kernelInitializer||this.DEFAULT_KERNEL_INITIALIZER),this.recurrentInitializer=getInitializer(n.recurrentInitializer||this.DEFAULT_RECURRENT_INITIALIZER),this.biasInitializer=getInitializer(n.biasInitializer||this.DEFAULT_BIAS_INITIALIZER),this.unitForgetBias=n.unitForgetBias,this.kernelRegularizer=getRegularizer(n.kernelRegularizer),this.recurrentRegularizer=getRegularizer(n.recurrentRegularizer),this.biasRegularizer=getRegularizer(n.biasRegularizer),this.kernelConstraint=getConstraint(n.kernelConstraint),this.recurrentConstraint=getConstraint(n.recurrentConstraint),this.biasConstraint=getConstraint(n.biasConstraint),this.dropout=min$2([1,max$2([0,n.dropout==null?0:n.dropout])]),this.recurrentDropout=min$2([1,max$2([0,n.recurrentDropout==null?0:n.recurrentDropout])]),this.dropoutFunc=n.dropoutFunc,this.implementation=n.implementation,this.stateSize=[this.units,this.units],this.dropoutMask=null,this.recurrentDropoutMask=null}build(n){var s;n=getExactlyOneShape(n);const u=n[n.length-1];this.kernel=this.addWeight("kernel",[u,this.units*4],null,this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint),this.recurrentKernel=this.addWeight("recurrent_kernel",[this.units,this.units*4],null,this.recurrentInitializer,this.recurrentRegularizer,!0,this.recurrentConstraint);let f;if(this.useBias){if(this.unitForgetBias){const m=this.biasInitializer,A=this.units;f=new(s=class extends Initializer{apply(y,T){const E=m.apply([A]),S=new Ones().apply([A]),I=m.apply([A*2]);return concatAlongFirstAxis(concatAlongFirstAxis(E,S),I)}},s.className="CustomInit",s)}else f=this.biasInitializer;this.bias=this.addWeight("bias",[this.units*4],null,f,this.biasRegularizer,!0,this.biasConstraint)}else this.bias=null;this.built=!0}call(n,s){return tidy(()=>{const u=s.training==null?!1:s.training;if(n=n,n.length!==3)throw new ValueError(`LSTMCell expects 3 input Tensors (inputs, h, c), got ${n.length}.`);let f=n[1];const m=n[2];n=n[0],0onesLike$2(n),rate:this.dropout,training:u,count:4,dropoutFunc:this.dropoutFunc})),0onesLike$2(f),rate:this.recurrentDropout,training:u,count:4,dropoutFunc:this.dropoutFunc}));const A=this.dropoutMask,v=this.recurrentDropoutMask;let y,T,E,S;0{this.cell.dropoutMask!=null&&(dispose(this.cell.dropoutMask),this.cell.dropoutMask=null),this.cell.recurrentDropoutMask!=null&&(dispose(this.cell.recurrentDropoutMask),this.cell.recurrentDropoutMask=null);const u=s==null?null:s.mask,f=s==null?null:s.training,m=s==null?null:s.initialState;return super.call(n,{mask:u,training:f,initialState:m})})}static fromConfig(n,s){return s.implmentation===0&&(s.implementation=1),new n(s)}}LSTM.className="LSTM";registerClass(LSTM);class StackedRNNCells extends RNNCell{constructor(n){super(n),this.cells=n.cells}get stateSize(){const n=[];for(const s of this.cells.slice().reverse())Array.isArray(s.stateSize)?n.push(...s.stateSize):n.push(s.stateSize);return n}call(n,s){return tidy(()=>{n=n;let u=n.slice(1);const f=[];for(const v of this.cells.slice().reverse())Array.isArray(v.stateSize)?f.push(u.splice(0,v.stateSize.length)):f.push(u.splice(0,1));f.reverse();const m=[];let A;for(let v=0;v{nameScope(`RNNCell_${f}`,()=>{u.build(n),Array.isArray(u.stateSize)?s=u.stateSize[0]:s=u.stateSize,n=[n[0],s]})}),this.built=!0}getConfig(){const n=super.getConfig(),s=m=>({className:m.getClassName(),config:m.getConfig()}),f={cells:this.cells.map(s)};return Object.assign(Object.assign({},n),f)}static fromConfig(n,s,u={}){const f=[];for(const m of s.cells)f.push(deserialize(m,u));return new n({cells:f})}get trainableWeights(){if(!this.trainable)return[];const n=[];for(const s of this.cells)n.push(...s.trainableWeights);return n}get nonTrainableWeights(){const n=[];for(const s of this.cells)n.push(...s.nonTrainableWeights);if(!this.trainable){const s=[];for(const u of this.cells)s.push(...u.trainableWeights);return s.concat(n)}return n}getWeights(){const n=[];for(const s of this.cells)n.push(...s.weights);return batchGetValue(n)}setWeights(n){const s=[];for(const u of this.cells){const f=u.weights.length,m=n.splice(f);for(let A=0;Am!=null?m(n(),s):dropout(n(),s),v=()=>inTrainPhase(A,n,u);return!f||f<=1?keep(v().clone()):Array(f).fill(void 0).map(v).map(T=>keep(T.clone()))}/** + */function standardizeArgs(a,n,s,u){if(Array.isArray(a)){if(n!=null||s!=null)throw new ValueError("When inputs is an array, neither initialState or constants should be provided");u!=null&&(s=a.slice(a.length-u,a.length),a=a.slice(0,a.length-u)),a.length>1&&(n=a.slice(1,a.length)),a=a[0]}function f(m){return m==null||Array.isArray(m)?m:[m]}return n=f(n),s=f(s),{inputs:a,initialState:n,constants:s}}function rnn(a,n,s,u=!1,f,m,A=!1,v=!1){return tidy(()=>{const y=n.shape.length;if(y<3)throw new ValueError(`Input should be at least 3D, but is ${y}D.`);const T=[1,0].concat(range$2(2,y));if(n=transpose$2(n,T),m!=null)throw new NotImplementedError("The rnn() functoin of the deeplearn.js backend does not support constants yet.");A&&console.warn("Backend rnn(): the unroll = true option is not applicable to the imperative deeplearn.js backend."),f!=null&&(f=cast$3(cast$3(f,"bool"),"float32"),f.rank===y-1&&(f=expandDims$3(f,-1)),f=transpose$2(f,T)),u&&(n=reverse$2(n,0),f!=null&&(f=reverse$2(f,0)));const E=[];let S,I=s;const e=n.shape[0],F=unstack(n);let M;f!=null&&(M=unstack(f));for(let V=0;Va(B,I));if(f==null)S=z[0],I=z[1];else{const b=tidy(()=>{const W=M[V],q=sub$2(onesLike$2(W),W),Y=add$1(mul(z[0],W),mul(I[0],q)),X=I.map((Q,g)=>add$1(mul(z[1][g],W),mul(Q,q)));return{output:Y,newStates:X}});S=b.output,I=b.newStates}v&&E.push(S)}let L;return v&&(L=stack(E,1)),[S,L,I]})}class RNN extends Layer{constructor(n){super(n);let s;if(n.cell==null)throw new ValueError("cell property is missing for the constructor of RNN.");if(Array.isArray(n.cell)?s=new StackedRNNCells({cells:n.cell}):s=n.cell,s.stateSize==null)throw new ValueError("The RNN cell should have an attribute `stateSize` (tuple of integers, one integer per RNN state).");this.cell=s,this.returnSequences=n.returnSequences==null?!1:n.returnSequences,this.returnState=n.returnState==null?!1:n.returnState,this.goBackwards=n.goBackwards==null?!1:n.goBackwards,this._stateful=n.stateful==null?!1:n.stateful,this.unroll=n.unroll==null?!1:n.unroll,this.supportsMasking=!0,this.inputSpec=[new InputSpec({ndim:3})],this.stateSpec=null,this.states_=null,this.numConstants=null,this.keptStates=[]}getStates(){if(this.states_==null){const n=Array.isArray(this.cell.stateSize)?this.cell.stateSize.length:1;return range$2(0,n).map(s=>null)}else return this.states_}setStates(n){this.states_=n}computeOutputShape(n){isArrayOfShapes(n)&&(n=n[0]),n=n;let s=this.cell.stateSize;Array.isArray(s)||(s=[s]);const u=s[0];let f;if(this.returnSequences?f=[n[0],n[1],u]:f=[n[0],u],this.returnState){const m=[];for(const A of s)m.push([n[0],A]);return[f].concat(m)}else return f}computeMask(n,s){return tidy(()=>{Array.isArray(s)&&(s=s[0]);const u=this.returnSequences?s:null;if(this.returnState){const f=this.states.map(m=>null);return[u].concat(f)}else return u})}get states(){if(this.states_==null){const n=Array.isArray(this.cell.stateSize)?this.cell.stateSize.length:1,s=[];for(let u=0;uA.shape[A.shape.length-1]),m))throw new ValueError(`An initialState was passed that is not compatible with cell.stateSize. Received stateSpec=${this.stateSpec}; However cell.stateSize is ${this.cell.stateSize}`)}else this.stateSpec=m.map(A=>new InputSpec({shape:[null,A]}));this.stateful&&this.resetStates()}resetStates(n,s=!1){tidy(()=>{if(!this.stateful)throw new AttributeError("Cannot call resetStates() on an RNN Layer that is not stateful.");const u=this.inputSpec[0].shape[0];if(u==null)throw new ValueError("If an RNN is stateful, it needs to know its batch size. Specify the batch size of your input tensors: \n- If using a Sequential model, specify the batch size by passing a `batchInputShape` option to your first layer.\n- If using the functional API, specify the batch size by passing a `batchShape` option to your Input layer.");if(this.states_==null)Array.isArray(this.cell.stateSize)?this.states_=this.cell.stateSize.map(f=>zeros$1([u,f])):this.states_=[zeros$1([u,this.cell.stateSize])];else if(n==null)dispose(this.states_),this.keptStates!=null&&(dispose(this.keptStates),this.keptStates=[]),Array.isArray(this.cell.stateSize)?this.states_=this.cell.stateSize.map(f=>zeros$1([u,f])):this.states_[0]=zeros$1([u,this.cell.stateSize]);else{if(Array.isArray(n)||(n=[n]),n.length!==this.states_.length)throw new ValueError(`Layer ${this.name} expects ${this.states_.length} state(s), but it received ${n.length} state value(s). Input received: ${n}`);s===!0?this.keptStates.push(this.states_.slice()):dispose(this.states_);for(let f=0;fkeep(f.clone()))})}apply(n,s){let u=s==null?null:s.initialState,f=s==null?null:s.constants;s==null&&(s={});const m=standardizeArgs(n,u,f,this.numConstants);n=m.inputs,u=m.initialState,f=m.constants;let A=[],v=[];if(u!=null){s.initialState=u,A=A.concat(u),this.stateSpec=[];for(const T of u)this.stateSpec.push(new InputSpec({shape:T.shape}));v=v.concat(this.stateSpec)}if(f!=null&&(s.constants=f,A=A.concat(f),this.numConstants=f.length),A[0]instanceof SymbolicTensor){const T=[n].concat(A),E=this.inputSpec.concat(v),S=this.inputSpec;this.inputSpec=E;const I=super.apply(T,s);return this.inputSpec=S,I}else return super.apply(n,s)}call(n,s){return tidy(()=>{const u=s==null?null:s.mask,f=s==null?null:s.training;let m=s==null?null:s.initialState;n=getExactlyOneTensor(n),m==null&&(this.stateful?m=this.states_:m=this.getInitialState(n));const A=Array.isArray(this.cell.stateSize)?this.cell.stateSize.length:1;if(m.length!==A)throw new ValueError(`RNN Layer has ${A} state(s) but was passed ${m.length} initial state(s).`);this.unroll&&console.warn("Ignoring unroll = true for RNN layer, due to imperative backend.");const v={training:f},T=rnn((F,M)=>{const L=this.cell.call([F].concat(M),v);return[L[0],L.slice(1)]},n,m,this.goBackwards,u,null,this.unroll,this.returnSequences),E=T[0],S=T[1],I=T[2];this.stateful&&this.resetStates(I,f);const e=this.returnSequences?S:E;return this.returnState?[e].concat(I):e})}getInitialState(n){return tidy(()=>{let s=zeros$1(n.shape);return s=sum$2(s,[1,2]),s=expandDims$2(s),Array.isArray(this.cell.stateSize)?this.cell.stateSize.map(u=>u>1?tile$2(s,[1,u]):s):this.cell.stateSize>1?[tile$2(s,[1,this.cell.stateSize])]:[s]})}get trainableWeights(){return this.trainable?this.cell.trainableWeights:[]}get nonTrainableWeights(){return this.trainable?this.cell.nonTrainableWeights:this.cell.weights}setFastWeightInitDuringBuild(n){super.setFastWeightInitDuringBuild(n),this.cell!=null&&this.cell.setFastWeightInitDuringBuild(n)}getConfig(){const n=super.getConfig(),s={returnSequences:this.returnSequences,returnState:this.returnState,goBackwards:this.goBackwards,stateful:this.stateful,unroll:this.unroll};this.numConstants!=null&&(s.numConstants=this.numConstants);const u=this.cell.getConfig();return this.getClassName()===RNN.className&&(s.cell={className:this.cell.getClassName(),config:u}),Object.assign(Object.assign(Object.assign({},u),n),s)}static fromConfig(n,s,u={}){const f=s.cell,m=deserialize(f,u);return new n(Object.assign(s,{cell:m}))}}RNN.className="RNN";registerClass(RNN);class RNNCell extends Layer{}class SimpleRNNCell extends RNNCell{constructor(n){super(n),this.DEFAULT_ACTIVATION="tanh",this.DEFAULT_KERNEL_INITIALIZER="glorotNormal",this.DEFAULT_RECURRENT_INITIALIZER="orthogonal",this.DEFAULT_BIAS_INITIALIZER="zeros",this.units=n.units,assertPositiveInteger(this.units,"units"),this.activation=getActivation(n.activation==null?this.DEFAULT_ACTIVATION:n.activation),this.useBias=n.useBias==null?!0:n.useBias,this.kernelInitializer=getInitializer(n.kernelInitializer||this.DEFAULT_KERNEL_INITIALIZER),this.recurrentInitializer=getInitializer(n.recurrentInitializer||this.DEFAULT_RECURRENT_INITIALIZER),this.biasInitializer=getInitializer(n.biasInitializer||this.DEFAULT_BIAS_INITIALIZER),this.kernelRegularizer=getRegularizer(n.kernelRegularizer),this.recurrentRegularizer=getRegularizer(n.recurrentRegularizer),this.biasRegularizer=getRegularizer(n.biasRegularizer),this.kernelConstraint=getConstraint(n.kernelConstraint),this.recurrentConstraint=getConstraint(n.recurrentConstraint),this.biasConstraint=getConstraint(n.biasConstraint),this.dropout=min$2([1,max$2([0,n.dropout==null?0:n.dropout])]),this.recurrentDropout=min$2([1,max$2([0,n.recurrentDropout==null?0:n.recurrentDropout])]),this.dropoutFunc=n.dropoutFunc,this.stateSize=this.units,this.dropoutMask=null,this.recurrentDropoutMask=null}build(n){n=getExactlyOneShape(n),this.kernel=this.addWeight("kernel",[n[n.length-1],this.units],null,this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint),this.recurrentKernel=this.addWeight("recurrent_kernel",[this.units,this.units],null,this.recurrentInitializer,this.recurrentRegularizer,!0,this.recurrentConstraint),this.useBias?this.bias=this.addWeight("bias",[this.units],null,this.biasInitializer,this.biasRegularizer,!0,this.biasConstraint):this.bias=null,this.built=!0}call(n,s){return tidy(()=>{if(n=n,n.length!==2)throw new ValueError(`SimpleRNNCell expects 2 input Tensors, got ${n.length}.`);let u=n[1];n=n[0];const f=s.training==null?!1:s.training;0onesLike$2(n),rate:this.dropout,training:f,dropoutFunc:this.dropoutFunc})),0onesLike$2(u),rate:this.recurrentDropout,training:f,dropoutFunc:this.dropoutFunc}));let m;const A=this.dropoutMask,v=this.recurrentDropoutMask;A!=null?m=dot(mul(n,A),this.kernel.read()):m=dot(n,this.kernel.read()),this.bias!=null&&(m=biasAdd(m,this.bias.read())),v!=null&&(u=mul(u,v));let y=add$1(m,dot(u,this.recurrentKernel.read()));return this.activation!=null&&(y=this.activation.apply(y)),[y,y]})}getConfig(){const n=super.getConfig(),s={units:this.units,activation:serializeActivation(this.activation),useBias:this.useBias,kernelInitializer:serializeInitializer(this.kernelInitializer),recurrentInitializer:serializeInitializer(this.recurrentInitializer),biasInitializer:serializeInitializer(this.biasInitializer),kernelRegularizer:serializeRegularizer(this.kernelRegularizer),recurrentRegularizer:serializeRegularizer(this.recurrentRegularizer),biasRegularizer:serializeRegularizer(this.biasRegularizer),activityRegularizer:serializeRegularizer(this.activityRegularizer),kernelConstraint:serializeConstraint(this.kernelConstraint),recurrentConstraint:serializeConstraint(this.recurrentConstraint),biasConstraint:serializeConstraint(this.biasConstraint),dropout:this.dropout,recurrentDropout:this.recurrentDropout};return Object.assign(Object.assign({},n),s)}}SimpleRNNCell.className="SimpleRNNCell";registerClass(SimpleRNNCell);class SimpleRNN extends RNN{constructor(n){n.cell=new SimpleRNNCell(n),super(n)}call(n,s){return tidy(()=>{this.cell.dropoutMask!=null&&(dispose(this.cell.dropoutMask),this.cell.dropoutMask=null),this.cell.recurrentDropoutMask!=null&&(dispose(this.cell.recurrentDropoutMask),this.cell.recurrentDropoutMask=null);const u=s==null?null:s.mask,f=s==null?null:s.training,m=s==null?null:s.initialState;return super.call(n,{mask:u,training:f,initialState:m})})}static fromConfig(n,s){return new n(s)}}SimpleRNN.className="SimpleRNN";registerClass(SimpleRNN);class GRUCell extends RNNCell{constructor(n){if(super(n),this.DEFAULT_ACTIVATION="tanh",this.DEFAULT_RECURRENT_ACTIVATION="hardSigmoid",this.DEFAULT_KERNEL_INITIALIZER="glorotNormal",this.DEFAULT_RECURRENT_INITIALIZER="orthogonal",this.DEFAULT_BIAS_INITIALIZER="zeros",n.resetAfter)throw new ValueError("GRUCell does not support reset_after parameter set to true.");this.units=n.units,assertPositiveInteger(this.units,"units"),this.activation=getActivation(n.activation===void 0?this.DEFAULT_ACTIVATION:n.activation),this.recurrentActivation=getActivation(n.recurrentActivation===void 0?this.DEFAULT_RECURRENT_ACTIVATION:n.recurrentActivation),this.useBias=n.useBias==null?!0:n.useBias,this.kernelInitializer=getInitializer(n.kernelInitializer||this.DEFAULT_KERNEL_INITIALIZER),this.recurrentInitializer=getInitializer(n.recurrentInitializer||this.DEFAULT_RECURRENT_INITIALIZER),this.biasInitializer=getInitializer(n.biasInitializer||this.DEFAULT_BIAS_INITIALIZER),this.kernelRegularizer=getRegularizer(n.kernelRegularizer),this.recurrentRegularizer=getRegularizer(n.recurrentRegularizer),this.biasRegularizer=getRegularizer(n.biasRegularizer),this.kernelConstraint=getConstraint(n.kernelConstraint),this.recurrentConstraint=getConstraint(n.recurrentConstraint),this.biasConstraint=getConstraint(n.biasConstraint),this.dropout=min$2([1,max$2([0,n.dropout==null?0:n.dropout])]),this.recurrentDropout=min$2([1,max$2([0,n.recurrentDropout==null?0:n.recurrentDropout])]),this.dropoutFunc=n.dropoutFunc,this.implementation=n.implementation,this.stateSize=this.units,this.dropoutMask=null,this.recurrentDropoutMask=null}build(n){n=getExactlyOneShape(n);const s=n[n.length-1];this.kernel=this.addWeight("kernel",[s,this.units*3],null,this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint),this.recurrentKernel=this.addWeight("recurrent_kernel",[this.units,this.units*3],null,this.recurrentInitializer,this.recurrentRegularizer,!0,this.recurrentConstraint),this.useBias?this.bias=this.addWeight("bias",[this.units*3],null,this.biasInitializer,this.biasRegularizer,!0,this.biasConstraint):this.bias=null,this.built=!0}call(n,s){return tidy(()=>{if(n=n,n.length!==2)throw new ValueError(`GRUCell expects 2 input Tensors (inputs, h, c), got ${n.length}.`);const u=s.training==null?!1:s.training;let f=n[1];n=n[0],0onesLike$2(n),rate:this.dropout,training:u,count:3,dropoutFunc:this.dropoutFunc})),0onesLike$2(f),rate:this.recurrentDropout,training:u,count:3,dropoutFunc:this.dropoutFunc}));const m=this.dropoutMask,A=this.recurrentDropoutMask;let v,y,T;0{this.cell.dropoutMask!=null&&(dispose(this.cell.dropoutMask),this.cell.dropoutMask=null),this.cell.recurrentDropoutMask!=null&&(dispose(this.cell.recurrentDropoutMask),this.cell.recurrentDropoutMask=null);const u=s==null?null:s.mask,f=s==null?null:s.training,m=s==null?null:s.initialState;return super.call(n,{mask:u,training:f,initialState:m})})}static fromConfig(n,s){return s.implmentation===0&&(s.implementation=1),new n(s)}}GRU.className="GRU";registerClass(GRU);class LSTMCell extends RNNCell{constructor(n){super(n),this.DEFAULT_ACTIVATION="tanh",this.DEFAULT_RECURRENT_ACTIVATION="hardSigmoid",this.DEFAULT_KERNEL_INITIALIZER="glorotNormal",this.DEFAULT_RECURRENT_INITIALIZER="orthogonal",this.DEFAULT_BIAS_INITIALIZER="zeros",this.units=n.units,assertPositiveInteger(this.units,"units"),this.activation=getActivation(n.activation===void 0?this.DEFAULT_ACTIVATION:n.activation),this.recurrentActivation=getActivation(n.recurrentActivation===void 0?this.DEFAULT_RECURRENT_ACTIVATION:n.recurrentActivation),this.useBias=n.useBias==null?!0:n.useBias,this.kernelInitializer=getInitializer(n.kernelInitializer||this.DEFAULT_KERNEL_INITIALIZER),this.recurrentInitializer=getInitializer(n.recurrentInitializer||this.DEFAULT_RECURRENT_INITIALIZER),this.biasInitializer=getInitializer(n.biasInitializer||this.DEFAULT_BIAS_INITIALIZER),this.unitForgetBias=n.unitForgetBias,this.kernelRegularizer=getRegularizer(n.kernelRegularizer),this.recurrentRegularizer=getRegularizer(n.recurrentRegularizer),this.biasRegularizer=getRegularizer(n.biasRegularizer),this.kernelConstraint=getConstraint(n.kernelConstraint),this.recurrentConstraint=getConstraint(n.recurrentConstraint),this.biasConstraint=getConstraint(n.biasConstraint),this.dropout=min$2([1,max$2([0,n.dropout==null?0:n.dropout])]),this.recurrentDropout=min$2([1,max$2([0,n.recurrentDropout==null?0:n.recurrentDropout])]),this.dropoutFunc=n.dropoutFunc,this.implementation=n.implementation,this.stateSize=[this.units,this.units],this.dropoutMask=null,this.recurrentDropoutMask=null}build(n){var s;n=getExactlyOneShape(n);const u=n[n.length-1];this.kernel=this.addWeight("kernel",[u,this.units*4],null,this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint),this.recurrentKernel=this.addWeight("recurrent_kernel",[this.units,this.units*4],null,this.recurrentInitializer,this.recurrentRegularizer,!0,this.recurrentConstraint);let f;if(this.useBias){if(this.unitForgetBias){const m=this.biasInitializer,A=this.units;f=new(s=class extends Initializer{apply(y,T){const E=m.apply([A]),S=new Ones().apply([A]),I=m.apply([A*2]);return concatAlongFirstAxis(concatAlongFirstAxis(E,S),I)}},s.className="CustomInit",s)}else f=this.biasInitializer;this.bias=this.addWeight("bias",[this.units*4],null,f,this.biasRegularizer,!0,this.biasConstraint)}else this.bias=null;this.built=!0}call(n,s){return tidy(()=>{const u=s.training==null?!1:s.training;if(n=n,n.length!==3)throw new ValueError(`LSTMCell expects 3 input Tensors (inputs, h, c), got ${n.length}.`);let f=n[1];const m=n[2];n=n[0],0onesLike$2(n),rate:this.dropout,training:u,count:4,dropoutFunc:this.dropoutFunc})),0onesLike$2(f),rate:this.recurrentDropout,training:u,count:4,dropoutFunc:this.dropoutFunc}));const A=this.dropoutMask,v=this.recurrentDropoutMask;let y,T,E,S;0{this.cell.dropoutMask!=null&&(dispose(this.cell.dropoutMask),this.cell.dropoutMask=null),this.cell.recurrentDropoutMask!=null&&(dispose(this.cell.recurrentDropoutMask),this.cell.recurrentDropoutMask=null);const u=s==null?null:s.mask,f=s==null?null:s.training,m=s==null?null:s.initialState;return super.call(n,{mask:u,training:f,initialState:m})})}static fromConfig(n,s){return s.implmentation===0&&(s.implementation=1),new n(s)}}LSTM.className="LSTM";registerClass(LSTM);class StackedRNNCells extends RNNCell{constructor(n){super(n),this.cells=n.cells}get stateSize(){const n=[];for(const s of this.cells.slice().reverse())Array.isArray(s.stateSize)?n.push(...s.stateSize):n.push(s.stateSize);return n}call(n,s){return tidy(()=>{n=n;let u=n.slice(1);const f=[];for(const v of this.cells.slice().reverse())Array.isArray(v.stateSize)?f.push(u.splice(0,v.stateSize.length)):f.push(u.splice(0,1));f.reverse();const m=[];let A;for(let v=0;v{nameScope(`RNNCell_${f}`,()=>{u.build(n),Array.isArray(u.stateSize)?s=u.stateSize[0]:s=u.stateSize,n=[n[0],s]})}),this.built=!0}getConfig(){const n=super.getConfig(),s=m=>({className:m.getClassName(),config:m.getConfig()}),f={cells:this.cells.map(s)};return Object.assign(Object.assign({},n),f)}static fromConfig(n,s,u={}){const f=[];for(const m of s.cells)f.push(deserialize(m,u));return new n({cells:f})}get trainableWeights(){if(!this.trainable)return[];const n=[];for(const s of this.cells)n.push(...s.trainableWeights);return n}get nonTrainableWeights(){const n=[];for(const s of this.cells)n.push(...s.nonTrainableWeights);if(!this.trainable){const s=[];for(const u of this.cells)s.push(...u.trainableWeights);return s.concat(n)}return n}getWeights(){const n=[];for(const s of this.cells)n.push(...s.weights);return batchGetValue(n)}setWeights(n){const s=[];for(const u of this.cells){const f=u.weights.length,m=n.splice(f);for(let A=0;Am!=null?m(n(),s):dropout(n(),s),v=()=>inTrainPhase(A,n,u);return!f||f<=1?keep(v().clone()):Array(f).fill(void 0).map(v).map(T=>keep(T.clone()))}/** * @license * Copyright 2020 Google LLC * @@ -9486,7 +9486,7 @@ Ooh no!!`);break}m[y]=T,v=Math.min(v,T)}for(let y=0;y{if(this.cell.dropoutMask!=null&&(dispose(this.cell.dropoutMask),this.cell.dropoutMask=null),this.cell.recurrentDropoutMask!=null&&(dispose(this.cell.recurrentDropoutMask),this.cell.recurrentDropoutMask=null),s&&s.constants)throw new ValueError("ConvRNN2D cell does not support constants");const u=s==null?null:s.mask,f=s==null?null:s.training,m=s==null?null:s.initialState;return super.call(n,{mask:u,training:f,initialState:m})})}computeOutputShape(n){let s=this.computeSingleOutputShape(n);return this.returnSequences||(s=[s[0],...s.slice(2)]),this.returnState&&(s=[s,...Array(2).fill([n[0],...s.slice(-3)])]),s}getInitialState(n){return tidy(()=>{const{stateSize:s}=this.cell,u=n.shape,f=this.computeSingleOutputShape(u),m=[f[0],...f.slice(2)],A=zeros$1(m);return Array.isArray(s)?Array(s.length).fill(A):[A]})}resetStates(n,s=!1){tidy(()=>{if(!this.stateful)throw new AttributeError("Cannot call resetStates() on an RNN Layer that is not stateful.");const u=this.inputSpec[0].shape,f=this.computeSingleOutputShape(u),m=[f[0],...f.slice(2)];if(u[0]==null)throw new ValueError("If an RNN is stateful, it needs to know its batch size. Specify the batch size of your input tensors: \n- If using a Sequential model, specify the batch size by passing a `batchInputShape` option to your first layer.\n- If using the functional API, specify the batch size by passing a `batchShape` option to your Input layer.");if(this.getStates()==null)Array.isArray(this.cell.stateSize)?this.states_=this.cell.stateSize.map(()=>zeros$1(m)):this.states_=[zeros$1(m)];else if(n==null)dispose(this.states_),this.keptStates!=null&&(dispose(this.keptStates),this.keptStates=[]),Array.isArray(this.cell.stateSize)?this.states_=this.cell.stateSize.map(()=>zeros$1(m)):this.states_[0]=zeros$1(m);else{if(Array.isArray(n)||(n=[n]),n.length!==this.states_.length)throw new ValueError(`Layer ${this.name} expects ${this.states_.length} state(s), but it received ${n.length} state value(s). Input received: ${n}`);s?this.keptStates.push(this.states_.slice()):dispose(this.states_);for(let v=0;vkeep(v.clone()))})}computeSingleOutputShape(n){const{dataFormat:s,filters:u,kernelSize:f,padding:m,strides:A,dilationRate:v}=this.cell,y=s==="channelsFirst",T=n[y?3:2],E=n[y?4:3],S=convOutputLength(T,f[0],m,A[0],v[0]),I=convOutputLength(E,f[1],m,A[1],v[1]);return[...n.slice(0,2),...y?[u,S,I]:[S,I,u]]}}ConvRNN2D.className="ConvRNN2D";class ConvLSTM2DCell extends LSTMCell{constructor(n){const{filters:s,kernelSize:u,strides:f,padding:m,dataFormat:A,dilationRate:v}=n;super(Object.assign(Object.assign({},n),{units:s})),this.filters=s,assertPositiveInteger(this.filters,"filters"),this.kernelSize=normalizeArray(u,2,"kernelSize"),this.kernelSize.forEach(y=>assertPositiveInteger(y,"kernelSize")),this.strides=normalizeArray(f||1,2,"strides"),this.strides.forEach(y=>assertPositiveInteger(y,"strides")),this.padding=m||"valid",checkPaddingMode(this.padding),this.dataFormat=A||"channelsLast",checkDataFormat(this.dataFormat),this.dilationRate=normalizeArray(v||1,2,"dilationRate"),this.dilationRate.forEach(y=>assertPositiveInteger(y,"dilationRate"))}build(n){var s;n=getExactlyOneShape(n);const u=this.dataFormat==="channelsFirst"?1:n.length-1;if(n[u]==null)throw new ValueError(`The channel dimension of the input should be defined. Found ${n[u]}`);const f=n[u],m=4,A=this.kernelSize.concat([f,this.filters*m]);this.kernel=this.addWeight("kernel",A,null,this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint);const v=this.kernelSize.concat([this.filters,this.filters*m]);if(this.recurrentKernel=this.addWeight("recurrent_kernel",v,null,this.recurrentInitializer,this.recurrentRegularizer,!0,this.recurrentConstraint),this.useBias){let y;if(this.unitForgetBias){const T=this.biasInitializer,E=this.filters;y=new(s=class extends Initializer{apply(I,e){const F=T.apply([E]),M=ones([E]),L=T.apply([E*2]);return concatenate([F,M,L])}},s.className="CustomInit",s)}else y=this.biasInitializer;this.bias=this.addWeight("bias",[this.filters*m],null,y,this.biasRegularizer,!0,this.biasConstraint)}this.built=!0}call(n,s){return tidy(()=>{if(n.length!==3)throw new ValueError(`ConvLSTM2DCell expects 3 input Tensors (inputs, h, c), got ${n.length}.`);const u=s.training||!1,f=n[0],m=n[1],A=n[2],v=4;0onesLike$2(f),rate:this.dropout,training:u,count:v,dropoutFunc:this.dropoutFunc}));const y=this.dropoutMask,T=(Ne,De,je)=>!De||!De[je]?Ne:mul(De[je],Ne);let E=T(f,y,0),S=T(f,y,1),I=T(f,y,2),e=T(f,y,3);0onesLike$2(m),rate:this.recurrentDropout,training:u,count:v,dropoutFunc:this.dropoutFunc}));const F=this.recurrentDropoutMask;let M=T(m,F,0),L=T(m,F,1),V=T(m,F,2),B=T(m,F,3);const z=3,[b,W,q,Y]=split$1(this.kernel.read(),v,z),[X,H,g,J]=this.useBias?split$1(this.bias.read(),v):[null,null,null,null];E=this.inputConv(E,b,X,this.padding),S=this.inputConv(S,W,H,this.padding),I=this.inputConv(I,q,g,this.padding),e=this.inputConv(e,Y,J,this.padding);const[re,ae,fe,pe]=split$1(this.recurrentKernel.read(),v,z);M=this.recurrentConv(M,re),L=this.recurrentConv(L,ae),V=this.recurrentConv(V,fe),B=this.recurrentConv(B,pe);const me=this.recurrentActivation.apply(add$1(E,M)),Se=this.recurrentActivation.apply(add$1(S,L)),ve=add$1(mul(Se,A),mul(me,this.activation.apply(add$1(I,V)))),we=mul(this.recurrentActivation.apply(add$1(e,B)),this.activation.apply(ve));return[we,we,ve]})}getConfig(){const n=super.getConfig(),s=__rest(n,["units"]),u={filters:this.filters,kernelSize:this.kernelSize,padding:this.padding,dataFormat:this.dataFormat,dilationRate:this.dilationRate,strides:this.strides};return Object.assign(Object.assign({},s),u)}inputConv(n,s,u,f){const m=conv2d$2(n,s,this.strides,f||"valid",this.dataFormat==="channelsFirst"?"NCHW":"NHWC",this.dilationRate);return u?biasAdd(m,u,this.dataFormat):m}recurrentConv(n,s){return conv2d$2(n,s,1,"same",this.dataFormat==="channelsFirst"?"NCHW":"NHWC")}}ConvLSTM2DCell.className="ConvLSTM2DCell";registerClass(ConvLSTM2DCell);class ConvLSTM2D extends ConvRNN2D{constructor(n){const s=new ConvLSTM2DCell(n);super(Object.assign(Object.assign({},n),{cell:s}))}static fromConfig(n,s){return new n(s)}}ConvLSTM2D.className="ConvLSTM2D";registerClass(ConvLSTM2D);/** + */var __rest=function(a,n){var s={};for(var u in a)Object.prototype.hasOwnProperty.call(a,u)&&n.indexOf(u)<0&&(s[u]=a[u]);if(a!=null&&typeof Object.getOwnPropertySymbols=="function")for(var f=0,u=Object.getOwnPropertySymbols(a);f{if(this.cell.dropoutMask!=null&&(dispose(this.cell.dropoutMask),this.cell.dropoutMask=null),this.cell.recurrentDropoutMask!=null&&(dispose(this.cell.recurrentDropoutMask),this.cell.recurrentDropoutMask=null),s&&s.constants)throw new ValueError("ConvRNN2D cell does not support constants");const u=s==null?null:s.mask,f=s==null?null:s.training,m=s==null?null:s.initialState;return super.call(n,{mask:u,training:f,initialState:m})})}computeOutputShape(n){let s=this.computeSingleOutputShape(n);return this.returnSequences||(s=[s[0],...s.slice(2)]),this.returnState&&(s=[s,...Array(2).fill([n[0],...s.slice(-3)])]),s}getInitialState(n){return tidy(()=>{const{stateSize:s}=this.cell,u=n.shape,f=this.computeSingleOutputShape(u),m=[f[0],...f.slice(2)],A=zeros$1(m);return Array.isArray(s)?Array(s.length).fill(A):[A]})}resetStates(n,s=!1){tidy(()=>{if(!this.stateful)throw new AttributeError("Cannot call resetStates() on an RNN Layer that is not stateful.");const u=this.inputSpec[0].shape,f=this.computeSingleOutputShape(u),m=[f[0],...f.slice(2)];if(u[0]==null)throw new ValueError("If an RNN is stateful, it needs to know its batch size. Specify the batch size of your input tensors: \n- If using a Sequential model, specify the batch size by passing a `batchInputShape` option to your first layer.\n- If using the functional API, specify the batch size by passing a `batchShape` option to your Input layer.");if(this.getStates()==null)Array.isArray(this.cell.stateSize)?this.states_=this.cell.stateSize.map(()=>zeros$1(m)):this.states_=[zeros$1(m)];else if(n==null)dispose(this.states_),this.keptStates!=null&&(dispose(this.keptStates),this.keptStates=[]),Array.isArray(this.cell.stateSize)?this.states_=this.cell.stateSize.map(()=>zeros$1(m)):this.states_[0]=zeros$1(m);else{if(Array.isArray(n)||(n=[n]),n.length!==this.states_.length)throw new ValueError(`Layer ${this.name} expects ${this.states_.length} state(s), but it received ${n.length} state value(s). Input received: ${n}`);s?this.keptStates.push(this.states_.slice()):dispose(this.states_);for(let v=0;vkeep(v.clone()))})}computeSingleOutputShape(n){const{dataFormat:s,filters:u,kernelSize:f,padding:m,strides:A,dilationRate:v}=this.cell,y=s==="channelsFirst",T=n[y?3:2],E=n[y?4:3],S=convOutputLength(T,f[0],m,A[0],v[0]),I=convOutputLength(E,f[1],m,A[1],v[1]);return[...n.slice(0,2),...y?[u,S,I]:[S,I,u]]}}ConvRNN2D.className="ConvRNN2D";class ConvLSTM2DCell extends LSTMCell{constructor(n){const{filters:s,kernelSize:u,strides:f,padding:m,dataFormat:A,dilationRate:v}=n;super(Object.assign(Object.assign({},n),{units:s})),this.filters=s,assertPositiveInteger(this.filters,"filters"),this.kernelSize=normalizeArray(u,2,"kernelSize"),this.kernelSize.forEach(y=>assertPositiveInteger(y,"kernelSize")),this.strides=normalizeArray(f||1,2,"strides"),this.strides.forEach(y=>assertPositiveInteger(y,"strides")),this.padding=m||"valid",checkPaddingMode(this.padding),this.dataFormat=A||"channelsLast",checkDataFormat(this.dataFormat),this.dilationRate=normalizeArray(v||1,2,"dilationRate"),this.dilationRate.forEach(y=>assertPositiveInteger(y,"dilationRate"))}build(n){var s;n=getExactlyOneShape(n);const u=this.dataFormat==="channelsFirst"?1:n.length-1;if(n[u]==null)throw new ValueError(`The channel dimension of the input should be defined. Found ${n[u]}`);const f=n[u],m=4,A=this.kernelSize.concat([f,this.filters*m]);this.kernel=this.addWeight("kernel",A,null,this.kernelInitializer,this.kernelRegularizer,!0,this.kernelConstraint);const v=this.kernelSize.concat([this.filters,this.filters*m]);if(this.recurrentKernel=this.addWeight("recurrent_kernel",v,null,this.recurrentInitializer,this.recurrentRegularizer,!0,this.recurrentConstraint),this.useBias){let y;if(this.unitForgetBias){const T=this.biasInitializer,E=this.filters;y=new(s=class extends Initializer{apply(I,e){const F=T.apply([E]),M=ones([E]),L=T.apply([E*2]);return concatenate([F,M,L])}},s.className="CustomInit",s)}else y=this.biasInitializer;this.bias=this.addWeight("bias",[this.filters*m],null,y,this.biasRegularizer,!0,this.biasConstraint)}this.built=!0}call(n,s){return tidy(()=>{if(n.length!==3)throw new ValueError(`ConvLSTM2DCell expects 3 input Tensors (inputs, h, c), got ${n.length}.`);const u=s.training||!1,f=n[0],m=n[1],A=n[2],v=4;0onesLike$2(f),rate:this.dropout,training:u,count:v,dropoutFunc:this.dropoutFunc}));const y=this.dropoutMask,T=(Ne,De,je)=>!De||!De[je]?Ne:mul(De[je],Ne);let E=T(f,y,0),S=T(f,y,1),I=T(f,y,2),e=T(f,y,3);0onesLike$2(m),rate:this.recurrentDropout,training:u,count:v,dropoutFunc:this.dropoutFunc}));const F=this.recurrentDropoutMask;let M=T(m,F,0),L=T(m,F,1),V=T(m,F,2),B=T(m,F,3);const z=3,[b,W,q,Y]=split$1(this.kernel.read(),v,z),[X,Q,g,J]=this.useBias?split$1(this.bias.read(),v):[null,null,null,null];E=this.inputConv(E,b,X,this.padding),S=this.inputConv(S,W,Q,this.padding),I=this.inputConv(I,q,g,this.padding),e=this.inputConv(e,Y,J,this.padding);const[re,ae,fe,pe]=split$1(this.recurrentKernel.read(),v,z);M=this.recurrentConv(M,re),L=this.recurrentConv(L,ae),V=this.recurrentConv(V,fe),B=this.recurrentConv(B,pe);const me=this.recurrentActivation.apply(add$1(E,M)),Se=this.recurrentActivation.apply(add$1(S,L)),ve=add$1(mul(Se,A),mul(me,this.activation.apply(add$1(I,V)))),we=mul(this.recurrentActivation.apply(add$1(e,B)),this.activation.apply(ve));return[we,we,ve]})}getConfig(){const n=super.getConfig(),s=__rest(n,["units"]),u={filters:this.filters,kernelSize:this.kernelSize,padding:this.padding,dataFormat:this.dataFormat,dilationRate:this.dilationRate,strides:this.strides};return Object.assign(Object.assign({},s),u)}inputConv(n,s,u,f){const m=conv2d$2(n,s,this.strides,f||"valid",this.dataFormat==="channelsFirst"?"NCHW":"NHWC",this.dilationRate);return u?biasAdd(m,u,this.dataFormat):m}recurrentConv(n,s){return conv2d$2(n,s,1,"same",this.dataFormat==="channelsFirst"?"NCHW":"NHWC")}}ConvLSTM2DCell.className="ConvLSTM2DCell";registerClass(ConvLSTM2DCell);class ConvLSTM2D extends ConvRNN2D{constructor(n){const s=new ConvLSTM2DCell(n);super(Object.assign(Object.assign({},n),{cell:s}))}static fromConfig(n,s){return new n(s)}}ConvLSTM2D.className="ConvLSTM2D";registerClass(ConvLSTM2D);/** * @license * Copyright 2018 Google LLC * @@ -9819,7 +9819,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function binaryKernelFunc$1(a,n,s,u){return s==null?({inputs:f,backend:m})=>{const{a:A,b:v}=f,y=m;assertNotComplex$1([A,v],a);const T=y.data.get(A.dataId).values,E=y.data.get(v.dataId).values,S=A.dtype==="string"?fromUint8ToStringArray(T):T,I=A.dtype==="string"?fromUint8ToStringArray(E):E,e=u||A.dtype,[F,M]=n(A.shape,v.shape,S,I,e);return y.makeTensorInfo(M,e,F)}:({inputs:f,backend:m})=>{const{a:A,b:v}=f,y=m;if(A.dtype==="complex64"||v.dtype==="complex64"){const T=cast$1({inputs:{x:A},backend:y,attrs:{dtype:"complex64"}}),E=y.data.get(T.dataId),S=E.complexTensorInfos.real,I=E.complexTensorInfos.imag,e=y.data.get(S.dataId).values,F=y.data.get(I.dataId).values,M=cast$1({inputs:{x:v},backend:y,attrs:{dtype:"complex64"}}),L=y.data.get(M.dataId),V=L.complexTensorInfos.real,B=L.complexTensorInfos.imag,z=y.data.get(V.dataId).values,b=y.data.get(B.dataId).values,[W,q,Y]=s(A.shape,v.shape,e,F,z,b),X=y.makeTensorInfo(Y,"float32",W),H=y.makeTensorInfo(Y,"float32",q),g=complex$1({inputs:{real:X,imag:H},backend:y});return y.disposeIntermediateTensorInfo(T),y.disposeIntermediateTensorInfo(M),y.disposeIntermediateTensorInfo(X),y.disposeIntermediateTensorInfo(H),g}else{const T=y.data.get(A.dataId).values,E=y.data.get(v.dataId).values,S=u||A.dtype,[I,e]=n(A.shape,v.shape,T,E,S);return y.makeTensorInfo(e,S,I)}}}function createComplexBinaryKernelImpl(a){return(n,s,u,f,m,A)=>{const v=assertAndGetBroadcastShape(n,s),y=sizeFromShape(v),T=v.length,E=computeStrides(v),S=getTypedArrayFromDType("float32",y),I=getTypedArrayFromDType("float32",y),e=getBroadcastDims$1(n,v),F=getBroadcastDims$1(s,v),M=mergeRealAndImagArrays(u,f),L=mergeRealAndImagArrays(m,A),V=n.length,B=computeStrides(n),z=s.length,b=computeStrides(s);if(e.length+F.length===0)for(let W=0;WY[re]=0);const X=locToIndex(Y,V,B),H=q.slice(-z);F.forEach(re=>H[re]=0);const g=locToIndex(H,z,b),J=a(M[X*2],M[X*2+1],L[g*2],L[g*2+1]);S[W]=J.real,I[W]=J.imag}return[S,I,v]}}/** + */function binaryKernelFunc$1(a,n,s,u){return s==null?({inputs:f,backend:m})=>{const{a:A,b:v}=f,y=m;assertNotComplex$1([A,v],a);const T=y.data.get(A.dataId).values,E=y.data.get(v.dataId).values,S=A.dtype==="string"?fromUint8ToStringArray(T):T,I=A.dtype==="string"?fromUint8ToStringArray(E):E,e=u||A.dtype,[F,M]=n(A.shape,v.shape,S,I,e);return y.makeTensorInfo(M,e,F)}:({inputs:f,backend:m})=>{const{a:A,b:v}=f,y=m;if(A.dtype==="complex64"||v.dtype==="complex64"){const T=cast$1({inputs:{x:A},backend:y,attrs:{dtype:"complex64"}}),E=y.data.get(T.dataId),S=E.complexTensorInfos.real,I=E.complexTensorInfos.imag,e=y.data.get(S.dataId).values,F=y.data.get(I.dataId).values,M=cast$1({inputs:{x:v},backend:y,attrs:{dtype:"complex64"}}),L=y.data.get(M.dataId),V=L.complexTensorInfos.real,B=L.complexTensorInfos.imag,z=y.data.get(V.dataId).values,b=y.data.get(B.dataId).values,[W,q,Y]=s(A.shape,v.shape,e,F,z,b),X=y.makeTensorInfo(Y,"float32",W),Q=y.makeTensorInfo(Y,"float32",q),g=complex$1({inputs:{real:X,imag:Q},backend:y});return y.disposeIntermediateTensorInfo(T),y.disposeIntermediateTensorInfo(M),y.disposeIntermediateTensorInfo(X),y.disposeIntermediateTensorInfo(Q),g}else{const T=y.data.get(A.dataId).values,E=y.data.get(v.dataId).values,S=u||A.dtype,[I,e]=n(A.shape,v.shape,T,E,S);return y.makeTensorInfo(e,S,I)}}}function createComplexBinaryKernelImpl(a){return(n,s,u,f,m,A)=>{const v=assertAndGetBroadcastShape(n,s),y=sizeFromShape(v),T=v.length,E=computeStrides(v),S=getTypedArrayFromDType("float32",y),I=getTypedArrayFromDType("float32",y),e=getBroadcastDims$1(n,v),F=getBroadcastDims$1(s,v),M=mergeRealAndImagArrays(u,f),L=mergeRealAndImagArrays(m,A),V=n.length,B=computeStrides(n),z=s.length,b=computeStrides(s);if(e.length+F.length===0)for(let W=0;WY[re]=0);const X=locToIndex(Y,V,B),Q=q.slice(-z);F.forEach(re=>Q[re]=0);const g=locToIndex(Q,z,b),J=a(M[X*2],M[X*2+1],L[g*2],L[g*2+1]);S[W]=J.real,I[W]=J.imag}return[S,I,v]}}/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -10734,7 +10734,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function batchMatMul$1(a){const{inputs:n,backend:s,attrs:u}=a,{a:f,b:m}=n,{transposeA:A,transposeB:v}=u;assertNotComplex$1([f,m],"matMul");const y=f.shape.length,T=m.shape.length,E=A?f.shape[y-2]:f.shape[y-1],S=v?m.shape[T-1]:m.shape[T-2],I=A?f.shape[y-1]:f.shape[y-2],e=v?m.shape[T-2]:m.shape[T-1],F=f.shape.slice(0,-2),M=m.shape.slice(0,-2),L=sizeFromShape(F),V=sizeFromShape(M),z=assertAndGetBroadcastShape(f.shape.slice(0,-2),m.shape.slice(0,-2)).concat([I,e]);assert$1(E===S,()=>`Error in matMul: inner shapes (${E}) and (${S}) of Tensors with shapes ${f.shape} and ${m.shape} and transposeA=${A} and transposeB=${v} must match.`);const b=A?[L,E,I]:[L,I,E],W=v?[V,e,S]:[V,S,e],q=reshape$1({inputs:{x:f},backend:s,attrs:{shape:b}}),Y=reshape$1({inputs:{x:m},backend:s,attrs:{shape:W}}),X=A?q.shape[1]:q.shape[2],H=A?q.shape[2]:q.shape[1],g=v?Y.shape[1]:Y.shape[2],J=Math.max(L,V),re=s.data.get(q.dataId).values,ae=s.data.get(Y.dataId).values,fe=computeStrides(q.shape),pe=computeStrides(Y.shape),[me,Se,ve]=A?[fe[0],1,fe[1]]:[fe[0],fe[1],1],[we,Ne,De]=v?[1,pe[1],pe[0]]:[pe[1],1,pe[0]],je=H*g,nt=buffer([J,H,g],q.dtype),Ue=nt.values,ye=s.blockSize;for(let ut=0;ut`Error in matMul: inner shapes (${E}) and (${S}) of Tensors with shapes ${f.shape} and ${m.shape} and transposeA=${A} and transposeB=${v} must match.`);const b=A?[L,E,I]:[L,I,E],W=v?[V,e,S]:[V,S,e],q=reshape$1({inputs:{x:f},backend:s,attrs:{shape:b}}),Y=reshape$1({inputs:{x:m},backend:s,attrs:{shape:W}}),X=A?q.shape[1]:q.shape[2],Q=A?q.shape[2]:q.shape[1],g=v?Y.shape[1]:Y.shape[2],J=Math.max(L,V),re=s.data.get(q.dataId).values,ae=s.data.get(Y.dataId).values,fe=computeStrides(q.shape),pe=computeStrides(Y.shape),[me,Se,ve]=A?[fe[0],1,fe[1]]:[fe[0],fe[1],1],[we,Ne,De]=v?[1,pe[1],pe[0]]:[pe[1],1,pe[0]],je=Q*g,nt=buffer([J,Q,g],q.dtype),Ue=nt.values,ye=s.blockSize;for(let ut=0;utSe?Se=ye:m==="avg"&&(ve+=ye,we++)}if(isNaN(Se))break}const Ne=re+ae*z+Y;L[Ne]=m==="avg"?ve/we:Se}}}return M}function maxPoolPositions(a,n,s,u,f=!1,m=!1){const A=buffer(u.outShape,"int32"),v=u.strideHeight,y=u.strideWidth,T=u.dilationHeight,E=u.dilationWidth,S=u.effectiveFilterHeight,I=u.effectiveFilterWidth,e=u.padInfo.top,F=u.padInfo.left,M=buffer(n,s,a);for(let L=0;Lg&&(g=me,f?J=m?((L*u.inHeight+re)*u.inWidth+fe)*u.inChannels+V:(re*u.inWidth+fe)*u.inChannels+V:J=ae*I+pe)}}A.set(J,L,B,q,V)}}return A}function pool3d(a,n,s,u,f,m){const A=f.strideDepth,v=f.strideHeight,y=f.strideWidth,T=f.dilationDepth,E=f.dilationHeight,S=f.dilationWidth,I=f.effectiveFilterDepth,e=f.effectiveFilterHeight,F=f.effectiveFilterWidth,M=f.padInfo.front,L=f.padInfo.top,V=f.padInfo.left,B=m==="max"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,z=buffer(f.outShape,s),b=z.values,W=f.outShape[1]*f.outShape[2]*f.outShape[3]*f.outShape[4],q=f.outShape[2]*f.outShape[3]*f.outShape[4],Y=f.outShape[3]*f.outShape[4],X=f.outShape[4];for(let H=0;HIt?It=at:m==="avg"&&(Lt+=at,Ot++),isNaN(It))break}if(isNaN(It))break}if(isNaN(It))break}const Et=pt+re;b[Et]=m==="avg"?Lt/Math.max(Ot,1):It}}}}return z}function maxPool3dPositions(a,n){const s=buffer(n.outShape,"int32"),u=n.strideDepth,f=n.strideHeight,m=n.strideWidth,A=n.dilationDepth,v=n.dilationHeight,y=n.dilationWidth,T=n.effectiveFilterDepth,E=n.effectiveFilterHeight,S=n.effectiveFilterWidth,I=n.padInfo.front,e=n.padInfo.top,F=n.padInfo.left;for(let M=0;M=ae&&(ae=De,fe=me*E*S+ve*E+Ne)}}}s.set(fe,M,V,W,H,L)}}}return s}/** + */function pool(a,n,s,u,f,m){const A=f.strideHeight,v=f.strideWidth,y=f.dilationHeight,T=f.dilationWidth,E=f.effectiveFilterHeight,S=f.effectiveFilterWidth,I=f.padInfo.top,e=f.padInfo.left,F=m==="max"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,M=buffer(f.outShape,s),L=M.values,V=f.outShape[1]*f.outShape[2]*f.outShape[3],B=f.outShape[2]*f.outShape[3],z=f.outShape[3];for(let b=0;bSe?Se=ye:m==="avg"&&(ve+=ye,we++)}if(isNaN(Se))break}const Ne=re+ae*z+Y;L[Ne]=m==="avg"?ve/we:Se}}}return M}function maxPoolPositions(a,n,s,u,f=!1,m=!1){const A=buffer(u.outShape,"int32"),v=u.strideHeight,y=u.strideWidth,T=u.dilationHeight,E=u.dilationWidth,S=u.effectiveFilterHeight,I=u.effectiveFilterWidth,e=u.padInfo.top,F=u.padInfo.left,M=buffer(n,s,a);for(let L=0;Lg&&(g=me,f?J=m?((L*u.inHeight+re)*u.inWidth+fe)*u.inChannels+V:(re*u.inWidth+fe)*u.inChannels+V:J=ae*I+pe)}}A.set(J,L,B,q,V)}}return A}function pool3d(a,n,s,u,f,m){const A=f.strideDepth,v=f.strideHeight,y=f.strideWidth,T=f.dilationDepth,E=f.dilationHeight,S=f.dilationWidth,I=f.effectiveFilterDepth,e=f.effectiveFilterHeight,F=f.effectiveFilterWidth,M=f.padInfo.front,L=f.padInfo.top,V=f.padInfo.left,B=m==="max"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,z=buffer(f.outShape,s),b=z.values,W=f.outShape[1]*f.outShape[2]*f.outShape[3]*f.outShape[4],q=f.outShape[2]*f.outShape[3]*f.outShape[4],Y=f.outShape[3]*f.outShape[4],X=f.outShape[4];for(let Q=0;QIt?It=at:m==="avg"&&(Lt+=at,Ot++),isNaN(It))break}if(isNaN(It))break}if(isNaN(It))break}const Et=pt+re;b[Et]=m==="avg"?Lt/Math.max(Ot,1):It}}}}return z}function maxPool3dPositions(a,n){const s=buffer(n.outShape,"int32"),u=n.strideDepth,f=n.strideHeight,m=n.strideWidth,A=n.dilationDepth,v=n.dilationHeight,y=n.dilationWidth,T=n.effectiveFilterDepth,E=n.effectiveFilterHeight,S=n.effectiveFilterWidth,I=n.padInfo.front,e=n.padInfo.top,F=n.padInfo.left;for(let M=0;M=ae&&(ae=De,fe=me*E*S+ve*E+Ne)}}}s.set(fe,M,V,W,Q,L)}}}return s}/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -10989,7 +10989,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function avgPool3DGrad$1(a){const{inputs:n,backend:s,attrs:u}=a,{dy:f,input:m}=n,{filterSize:A,strides:v,pad:y,dimRoundingMode:T}=u;assertNotComplex$1([f,m],"avgPool3DGrad");const E=computePool3DInfo(m.shape,A,v,1,y,T),S=E.strideDepth,I=E.strideHeight,e=E.strideWidth,F=E.filterDepth,M=E.filterHeight,L=E.filterWidth,V=E.dilationDepth,B=E.dilationHeight,z=E.dilationWidth,b=E.effectiveFilterDepth,W=E.effectiveFilterHeight,q=E.effectiveFilterWidth,Y=b-1-E.padInfo.front,X=q-1-E.padInfo.left,H=W-1-E.padInfo.top,g=buffer(m.shape,"float32"),J=1/(F*M*L),re=s.bufferSync(f);for(let ae=0;ae=E.outDepth||Math.floor(nt)!==nt))for(let Ue=0;Ue=E.outHeight||Math.floor(ye)!==ye))for(let ut=0;ut=E.outWidth||Math.floor(pt)!==pt)continue;const It=re.get(ae,nt,ye,pt,fe);De+=It}}}g.set(De*J,ae,pe,me,Se,fe)}return s.makeTensorInfo(g.shape,g.dtype,g.values)}const avgPool3DGradConfig$1={kernelName:AvgPool3DGrad,backendName:"cpu",kernelFunc:avgPool3DGrad$1};/** + */function avgPool3DGrad$1(a){const{inputs:n,backend:s,attrs:u}=a,{dy:f,input:m}=n,{filterSize:A,strides:v,pad:y,dimRoundingMode:T}=u;assertNotComplex$1([f,m],"avgPool3DGrad");const E=computePool3DInfo(m.shape,A,v,1,y,T),S=E.strideDepth,I=E.strideHeight,e=E.strideWidth,F=E.filterDepth,M=E.filterHeight,L=E.filterWidth,V=E.dilationDepth,B=E.dilationHeight,z=E.dilationWidth,b=E.effectiveFilterDepth,W=E.effectiveFilterHeight,q=E.effectiveFilterWidth,Y=b-1-E.padInfo.front,X=q-1-E.padInfo.left,Q=W-1-E.padInfo.top,g=buffer(m.shape,"float32"),J=1/(F*M*L),re=s.bufferSync(f);for(let ae=0;ae=E.outDepth||Math.floor(nt)!==nt))for(let Ue=0;Ue=E.outHeight||Math.floor(ye)!==ye))for(let ut=0;ut=E.outWidth||Math.floor(pt)!==pt)continue;const It=re.get(ae,nt,ye,pt,fe);De+=It}}}g.set(De*J,ae,pe,me,Se,fe)}return s.makeTensorInfo(g.shape,g.dtype,g.values)}const avgPool3DGradConfig$1={kernelName:AvgPool3DGrad,backendName:"cpu",kernelFunc:avgPool3DGrad$1};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -11004,7 +11004,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function avgPoolGrad$1(a){const{inputs:n,backend:s,attrs:u}=a,{dy:f,input:m}=n,A=m;assertNotComplex$1([f,m],"avgPoolGrad");const{filterSize:v,strides:y,pad:T}=u,E=computePool2DInfo(A.shape,v,y,1,T),S=E.strideHeight,I=E.strideWidth,e=E.filterHeight,F=E.filterWidth,M=E.dilationHeight,L=E.dilationWidth,V=E.effectiveFilterHeight,B=E.effectiveFilterWidth,z=B-1-E.padInfo.left,b=V-1-E.padInfo.top,W=buffer(A.shape,"float32"),q=1/(e*F),Y=s.data.get(f.dataId).values,X=buffer(f.shape,"float32",Y);for(let H=0;H=E.outHeight||Math.floor(Se)!==Se))for(let ve=0;ve=E.outWidth||Math.floor(we)!==we)continue;const Ne=X.get(H,Se,we,g);pe+=Ne}}W.set(pe*q,H,J,re,g)}return s.makeTensorInfo(W.shape,W.dtype,W.values)}const avgPoolGradConfig$1={kernelName:AvgPoolGrad,backendName:"cpu",kernelFunc:avgPoolGrad$1};/** + */function avgPoolGrad$1(a){const{inputs:n,backend:s,attrs:u}=a,{dy:f,input:m}=n,A=m;assertNotComplex$1([f,m],"avgPoolGrad");const{filterSize:v,strides:y,pad:T}=u,E=computePool2DInfo(A.shape,v,y,1,T),S=E.strideHeight,I=E.strideWidth,e=E.filterHeight,F=E.filterWidth,M=E.dilationHeight,L=E.dilationWidth,V=E.effectiveFilterHeight,B=E.effectiveFilterWidth,z=B-1-E.padInfo.left,b=V-1-E.padInfo.top,W=buffer(A.shape,"float32"),q=1/(e*F),Y=s.data.get(f.dataId).values,X=buffer(f.shape,"float32",Y);for(let Q=0;Q=E.outHeight||Math.floor(Se)!==Se))for(let ve=0;ve=E.outWidth||Math.floor(we)!==we)continue;const Ne=X.get(Q,Se,we,g);pe+=Ne}}W.set(pe*q,Q,J,re,g)}return s.makeTensorInfo(W.shape,W.dtype,W.values)}const avgPoolGradConfig$1={kernelName:AvgPoolGrad,backendName:"cpu",kernelFunc:avgPoolGrad$1};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -11139,7 +11139,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function conv2D(a){const{inputs:n,backend:s,attrs:u}=a,{x:f,filter:m}=n,{strides:A,pad:v,dataFormat:y,dilations:T,dimRoundingMode:E}=u;assertNotComplex$1([f,m],"conv2d");const S=convertConv2DDataFormat(y),I=computeConv2DInfo(f.shape,m.shape,A,T,v,E,!1,S),e=I.filterHeight,F=I.filterWidth,M=I.dilationHeight,L=I.dilationWidth,V=I.padInfo.left,B=I.padInfo.top,z=I.dataFormat==="channelsLast",b=new TensorBuffer(I.outShape,f.dtype),W=computeStrides(f.shape),q=computeStrides(m.shape),Y=W[0],X=z?W[1]:W[2],H=z?W[2]:1,g=z?1:W[1],J=b.strides[0],re=z?b.strides[1]:b.strides[2],ae=z?b.strides[2]:1,fe=z?1:b.strides[1],pe=s.data.get(f.dataId).values,me=s.data.get(m.dataId).values,Se=b.values;for(let ve=0;ve=I.inHeight)continue;const ut=Ue*q[0],pt=we+ye*X;for(let It=0;It=I.inWidth)continue;const Ze=ut+Et*q[1],Me=pt+Rt*H;let Qe=Ze;for(let Ie=0;Ie=I.inHeight)continue;const ut=Ue*q[0],pt=we+ye*X;for(let It=0;It=I.inWidth)continue;const Ze=ut+Et*q[1],Me=pt+Rt*Q;let Qe=Ze;for(let Ie=0;Ie=T.inDepth)continue;const ve=me*H[0],we=J+Se*X[1];for(let Ne=0;Ne=T.inHeight)continue;const ye=ve+nt*H[1],ut=we+Ue*X[2];for(let pt=0;pt=T.inWidth)continue;const Rt=ye+Ot*H[2],Ze=ut+Et*T.inChannels;let Me=Rt;for(let Qe=0;Qe=T.inDepth)continue;const ve=me*Q[0],we=J+Se*X[1];for(let Ne=0;Ne=T.inHeight)continue;const ye=ve+nt*Q[1],ut=we+Ue*X[2];for(let pt=0;pt=T.inWidth)continue;const Rt=ye+Ot*Q[2],Ze=ut+Et*T.inChannels;let Me=Rt;for(let Qe=0;Qe=E)continue;const fe=M>1?(J-H)*(S-1)/(M-1):0,pe=L>1?(re-g)*(I-1)/(L-1):0;for(let me=0;me1?H*(S-1)+me*fe:.5*(H+J)*(S-1);if(Se<0||Se>S-1){for(let ve=0;ve1?g*(I-1)+De*pe:.5*(g+re)*(I-1);if(je<0||je>I-1){for(let ut=0;ut1?g*(I-1)+ve*pe:.5*(g+re)*(I-1);if(we<0||we>I-1){for(let je=0;je=E)continue;const fe=M>1?(J-Q)*(S-1)/(M-1):0,pe=L>1?(re-g)*(I-1)/(L-1):0;for(let me=0;me1?Q*(S-1)+me*fe:.5*(Q+J)*(S-1);if(Se<0||Se>S-1){for(let ve=0;ve1?g*(I-1)+De*pe:.5*(g+re)*(I-1);if(je<0||je>I-1){for(let ut=0;ut1?g*(I-1)+ve*pe:.5*(g+re)*(I-1);if(we<0||we>I-1){for(let je=0;je`Only NHWC dataFormat supported on CPU for depthToSpace. Got ${A}`);const v=f.shape[0],y=f.shape[1],T=f.shape[2],E=f.shape[3],S=y*m,I=T*m,e=E/(m*m),F=s.data.get(f.dataId).values,M=new Float32Array(v*S*I*e);let L=0;for(let V=0;V`Only NHWC dataFormat supported on CPU for depthToSpace. Got ${A}`);const v=f.shape[0],y=f.shape[1],T=f.shape[2],E=f.shape[3],S=y*m,I=T*m,e=E/(m*m),F=s.data.get(f.dataId).values,M=new Float32Array(v*S*I*e);let L=0;for(let V=0;V`Error in depthwiseConv2d: Either strides or dilations must be 1. Got strides ${A} and dilations '${I}'`);const e=computeConv2DInfo(f.shape,m.shape,A,I,v,T,!0),{filterHeight:F,filterWidth:M,dilationHeight:L,dilationWidth:V,padInfo:B}=e,z=B.left,b=B.top,W=e.outChannels/e.inChannels,q=new TensorBuffer(e.outShape,f.dtype),Y=s.data.get(f.dataId).values,X=s.data.get(m.dataId).values,H=q.values;for(let g=0;g=e.inHeight)continue;const ve=me*S[0],we=J+Se*E[1];for(let Ne=0;Ne=e.inWidth)continue;const ye=ve+nt*S[1],ut=we+Ue*e.inChannels;let pt=De,It=ye;for(let Lt=0;Lt`Error in depthwiseConv2d: Either strides or dilations must be 1. Got strides ${A} and dilations '${I}'`);const e=computeConv2DInfo(f.shape,m.shape,A,I,v,T,!0),{filterHeight:F,filterWidth:M,dilationHeight:L,dilationWidth:V,padInfo:B}=e,z=B.left,b=B.top,W=e.outChannels/e.inChannels,q=new TensorBuffer(e.outShape,f.dtype),Y=s.data.get(f.dataId).values,X=s.data.get(m.dataId).values,Q=q.values;for(let g=0;g=e.inHeight)continue;const ve=me*S[0],we=J+Se*E[1];for(let Ne=0;Ne=e.inWidth)continue;const ye=ve+nt*S[1],ut=we+Ue*e.inChannels;let pt=De,It=ye;for(let Lt=0;Lt{const{x:u,filter:f}=a,{strides:m,pad:A,dilations:v}=s,y=n,T=y.data.get(u.dataId).values,E=u.shape.length,S=y.data.get(f.dataId).values,I=f.shape.length,{batchSize:e,inHeight:F,inWidth:M,inChannels:L,outHeight:V,outWidth:B,padInfo:z,strideHeight:b,strideWidth:W,filterHeight:q,filterWidth:Y,dilationHeight:X,dilationWidth:H,outShape:g}=computeDilation2DInfo(u.shape,f.shape,m,A,"NHWC",v),J=sizeFromShape(g),re=g.length,ae=getArrayFromDType(u.dtype,J);for(let pe=0;pe=0&&Ue=0&&utDe&&(De=Lt)}}}const je=locToIndex([pe,me,ve,Ne],re,computeStrides(g));ae[je]=De}}}return{dataId:y.write(toTypedArray(ae,u.dtype),g,u.dtype),shape:g,dtype:u.dtype}}};/** + */const dilation2DConfig$1={kernelName:Dilation2D,backendName:"cpu",kernelFunc:({inputs:a,backend:n,attrs:s})=>{const{x:u,filter:f}=a,{strides:m,pad:A,dilations:v}=s,y=n,T=y.data.get(u.dataId).values,E=u.shape.length,S=y.data.get(f.dataId).values,I=f.shape.length,{batchSize:e,inHeight:F,inWidth:M,inChannels:L,outHeight:V,outWidth:B,padInfo:z,strideHeight:b,strideWidth:W,filterHeight:q,filterWidth:Y,dilationHeight:X,dilationWidth:Q,outShape:g}=computeDilation2DInfo(u.shape,f.shape,m,A,"NHWC",v),J=sizeFromShape(g),re=g.length,ae=getArrayFromDType(u.dtype,J);for(let pe=0;pe=0&&Ue=0&&utDe&&(De=Lt)}}}const je=locToIndex([pe,me,ve,Ne],re,computeStrides(g));ae[je]=De}}}return{dataId:y.write(toTypedArray(ae,u.dtype),g,u.dtype),shape:g,dtype:u.dtype}}};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -11409,7 +11409,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const dilation2DBackpropFilterConfig={kernelName:Dilation2DBackpropFilter,backendName:"cpu",kernelFunc:({inputs:a,backend:n,attrs:s})=>{const{x:u,filter:f,dy:m}=a,{strides:A,pad:v,dilations:y}=s,T=n,E=toNestedArray(u.shape,T.data.get(u.dataId).values),S=toNestedArray(f.shape,T.data.get(f.dataId).values),{batchSize:I,inHeight:e,inWidth:F,inChannels:M,outHeight:L,outWidth:V,padInfo:B,strideHeight:z,strideWidth:b,filterHeight:W,filterWidth:q,dilationHeight:Y,dilationWidth:X,outShape:H}=computeDilation2DInfo(u.shape,f.shape,A,v,"NHWC",y);assert$1(m.rank===H.length,()=>`Error in ${Dilation2DBackpropFilter}, dy must have the same rank as output ${H.length}, but got ${m.rank}`);const g=toNestedArray(H,T.data.get(m.dataId).values),J=makeZerosNestedTypedArray(f.shape,f.dtype);for(let ae=0;ae=0&&nt=0&&yewe&&(we=ut,Ne=je,De=Ue)}}}J[Ne][De][ve]+=g[ae][fe][me][ve]}}}return{dataId:T.write(toTypedArray(J,u.dtype),f.shape,f.dtype),shape:f.shape,dtype:f.dtype}}};/** + */const dilation2DBackpropFilterConfig={kernelName:Dilation2DBackpropFilter,backendName:"cpu",kernelFunc:({inputs:a,backend:n,attrs:s})=>{const{x:u,filter:f,dy:m}=a,{strides:A,pad:v,dilations:y}=s,T=n,E=toNestedArray(u.shape,T.data.get(u.dataId).values),S=toNestedArray(f.shape,T.data.get(f.dataId).values),{batchSize:I,inHeight:e,inWidth:F,inChannels:M,outHeight:L,outWidth:V,padInfo:B,strideHeight:z,strideWidth:b,filterHeight:W,filterWidth:q,dilationHeight:Y,dilationWidth:X,outShape:Q}=computeDilation2DInfo(u.shape,f.shape,A,v,"NHWC",y);assert$1(m.rank===Q.length,()=>`Error in ${Dilation2DBackpropFilter}, dy must have the same rank as output ${Q.length}, but got ${m.rank}`);const g=toNestedArray(Q,T.data.get(m.dataId).values),J=makeZerosNestedTypedArray(f.shape,f.dtype);for(let ae=0;ae=0&&nt=0&&yewe&&(we=ut,Ne=je,De=Ue)}}}J[Ne][De][ve]+=g[ae][fe][me][ve]}}}return{dataId:T.write(toTypedArray(J,u.dtype),f.shape,f.dtype),shape:f.shape,dtype:f.dtype}}};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -11424,7 +11424,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const dilation2DBackpropInputConfig={kernelName:Dilation2DBackpropInput,backendName:"cpu",kernelFunc:({inputs:a,backend:n,attrs:s})=>{const{x:u,filter:f,dy:m}=a,{strides:A,pad:v,dilations:y}=s,T=n,E=toNestedArray(u.shape,T.data.get(u.dataId).values),S=toNestedArray(f.shape,T.data.get(f.dataId).values),{batchSize:I,inHeight:e,inWidth:F,inChannels:M,outHeight:L,outWidth:V,padInfo:B,strideHeight:z,strideWidth:b,filterHeight:W,filterWidth:q,dilationHeight:Y,dilationWidth:X,outShape:H}=computeDilation2DInfo(u.shape,f.shape,A,v,"NHWC",y);assert$1(m.rank===H.length,()=>`Error in ${Dilation2DBackpropInput}, dy must have the same rank as output ${H.length}, but got ${m.rank}`);const g=toNestedArray(H,T.data.get(m.dataId).values),J=makeZerosNestedTypedArray(u.shape,u.dtype);for(let ae=0;ae=0&&nt=0&&yewe&&(we=ut,Ne=nt,De=ye)}}}J[ae][Ne][De][ve]+=g[ae][fe][me][ve]}}}return{dataId:T.write(toTypedArray(J,u.dtype),u.shape,u.dtype),shape:u.shape,dtype:u.dtype}}};/** + */const dilation2DBackpropInputConfig={kernelName:Dilation2DBackpropInput,backendName:"cpu",kernelFunc:({inputs:a,backend:n,attrs:s})=>{const{x:u,filter:f,dy:m}=a,{strides:A,pad:v,dilations:y}=s,T=n,E=toNestedArray(u.shape,T.data.get(u.dataId).values),S=toNestedArray(f.shape,T.data.get(f.dataId).values),{batchSize:I,inHeight:e,inWidth:F,inChannels:M,outHeight:L,outWidth:V,padInfo:B,strideHeight:z,strideWidth:b,filterHeight:W,filterWidth:q,dilationHeight:Y,dilationWidth:X,outShape:Q}=computeDilation2DInfo(u.shape,f.shape,A,v,"NHWC",y);assert$1(m.rank===Q.length,()=>`Error in ${Dilation2DBackpropInput}, dy must have the same rank as output ${Q.length}, but got ${m.rank}`);const g=toNestedArray(Q,T.data.get(m.dataId).values),J=makeZerosNestedTypedArray(u.shape,u.dtype);for(let ae=0;ae=0&&nt=0&&yewe&&(we=ut,Ne=nt,De=ye)}}}J[ae][Ne][De][ve]+=g[ae][fe][me][ve]}}}return{dataId:T.write(toTypedArray(J,u.dtype),u.shape,u.dtype),shape:u.shape,dtype:u.dtype}}};/** * @license * Copyright 2023 Google LLC. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -11544,7 +11544,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function fftBatch(a,n,s){const u=a.shape,f=u[0],m=u[1],A=s.data.get(a.dataId),v=A.complexTensorInfos.real,y=A.complexTensorInfos.imag,T=[f,m],E=sizeFromShape(T),S=getTypedArrayFromDType("float32",E),I=getTypedArrayFromDType("float32",E);for(let L=0;L=E.outDepth||Math.floor(De)!==De))for(let je=0;je=E.outHeight||Math.floor(nt)!==nt))for(let Ue=0;Ue=E.outWidth||Math.floor(ye)!==ye)continue;const ut=z*b*W-1-I.get(J,De,nt,ye,re),pt=Ne*b*W+je*W+Ue,It=ut===pt?1:0;if(It===0)continue;const Lt=g.get(J,De,nt,ye,re);we+=Lt*It}}}H.set(we,J,ae,fe,pe,re)}return s.makeTensorInfo(H.shape,H.dtype,H.values)}const maxPool3DGradConfig$1={kernelName:MaxPool3DGrad,backendName:"cpu",kernelFunc:maxPool3DGrad$1};/** + */function maxPool3DGrad$1(a){const{inputs:n,backend:s,attrs:u}=a,{dy:f,input:m}=n,{filterSize:A,strides:v,pad:y,dimRoundingMode:T}=u;assertNotComplex$1([f,m],"maxPool3DGrad");const E=computePool3DInfo(m.shape,A,v,1,y,T),S=s.bufferSync(m),I=maxPool3dPositions(S,E),e=E.strideDepth,F=E.strideHeight,M=E.strideWidth,L=E.dilationDepth,V=E.dilationHeight,B=E.dilationWidth,z=E.effectiveFilterDepth,b=E.effectiveFilterHeight,W=E.effectiveFilterWidth,q=z-1-E.padInfo.front,Y=W-1-E.padInfo.left,X=b-1-E.padInfo.top,Q=buffer(m.shape,"float32"),g=s.bufferSync(f);for(let J=0;J=E.outDepth||Math.floor(De)!==De))for(let je=0;je=E.outHeight||Math.floor(nt)!==nt))for(let Ue=0;Ue=E.outWidth||Math.floor(ye)!==ye)continue;const ut=z*b*W-1-I.get(J,De,nt,ye,re),pt=Ne*b*W+je*W+Ue,It=ut===pt?1:0;if(It===0)continue;const Lt=g.get(J,De,nt,ye,re);we+=Lt*It}}}Q.set(we,J,ae,fe,pe,re)}return s.makeTensorInfo(Q.shape,Q.dtype,Q.values)}const maxPool3DGradConfig$1={kernelName:MaxPool3DGrad,backendName:"cpu",kernelFunc:maxPool3DGrad$1};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -11889,7 +11889,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function maxPoolGrad$1(a){const{inputs:n,backend:s,attrs:u}=a,{dy:f,input:m,output:A}=n,v=m;assertNotComplex$1([m,A],"maxPoolGrad");const{filterSize:y,strides:T,pad:E,dimRoundingMode:S}=u,I=computePool2DInfo(v.shape,y,T,1,E,S),e=s.data.get(v.dataId).values,F=buffer(I.outShape,v.dtype,maxPoolPositions(e,v.shape,v.dtype,I).values),M=I.strideHeight,L=I.strideWidth,V=I.dilationHeight,B=I.dilationWidth,z=I.effectiveFilterHeight,b=I.effectiveFilterWidth,W=b-1-I.padInfo.left,q=z-1-I.padInfo.top,Y=buffer(v.shape,"float32"),X=s.data.get(f.dataId).values,H=buffer(f.shape,"float32",X);for(let g=0;g=I.outHeight||Math.floor(ve)!==ve))for(let we=0;we=I.outWidth||Math.floor(Ne)!==Ne)continue;const De=z*b-1-F.get(g,ve,Ne,J),je=Se*b+we,nt=De===je?1:0;if(nt===0)continue;const Ue=H.get(g,ve,Ne,J);me+=Ue*nt}}Y.set(me,g,re,ae,J)}return s.makeTensorInfo(Y.shape,Y.dtype,Y.values)}const maxPoolGradConfig$1={kernelName:MaxPoolGrad,backendName:"cpu",kernelFunc:maxPoolGrad$1};/** + */function maxPoolGrad$1(a){const{inputs:n,backend:s,attrs:u}=a,{dy:f,input:m,output:A}=n,v=m;assertNotComplex$1([m,A],"maxPoolGrad");const{filterSize:y,strides:T,pad:E,dimRoundingMode:S}=u,I=computePool2DInfo(v.shape,y,T,1,E,S),e=s.data.get(v.dataId).values,F=buffer(I.outShape,v.dtype,maxPoolPositions(e,v.shape,v.dtype,I).values),M=I.strideHeight,L=I.strideWidth,V=I.dilationHeight,B=I.dilationWidth,z=I.effectiveFilterHeight,b=I.effectiveFilterWidth,W=b-1-I.padInfo.left,q=z-1-I.padInfo.top,Y=buffer(v.shape,"float32"),X=s.data.get(f.dataId).values,Q=buffer(f.shape,"float32",X);for(let g=0;g=I.outHeight||Math.floor(ve)!==ve))for(let we=0;we=I.outWidth||Math.floor(Ne)!==Ne)continue;const De=z*b-1-F.get(g,ve,Ne,J),je=Se*b+we,nt=De===je?1:0;if(nt===0)continue;const Ue=Q.get(g,ve,Ne,J);me+=Ue*nt}}Y.set(me,g,re,ae,J)}return s.makeTensorInfo(Y.shape,Y.dtype,Y.values)}const maxPoolGradConfig$1={kernelName:MaxPoolGrad,backendName:"cpu",kernelFunc:maxPoolGrad$1};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -12234,7 +12234,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function resizeBilinear$1(a){const{inputs:n,backend:s,attrs:u}=a,{images:f}=n,{alignCorners:m,halfPixelCenters:A,size:v}=u;assertNotComplex$1(f,"resizeBilinear");const y=computeStrides(f.shape),[T,E]=v,[S,I,e,F]=f.shape,M=s.data.get(f.dataId).values,L=new Float32Array(sizeFromShape([S,T,E,F])),V=[m&&T>1?I-1:I,m&&E>1?e-1:e],B=[m&&T>1?T-1:T,m&&E>1?E-1:E];let z=0;const b=V[0]/B[0],W=V[1]/B[1];for(let q=0;q1?I-1:I,m&&E>1?e-1:e],B=[m&&T>1?T-1:T,m&&E>1?E-1:E];let z=0;const b=V[0]/B[0],W=V[1]/B[1];for(let q=0;q1?T-1:T,A&&e>1?E-1:E],L=[A&&I>1?I-1:I,A&&e>1?e-1:e],V=M[0]/L[0],B=M[1]/L[1],z=s.data.get(m.dataId).values;let b=0;for(let W=0;W1?T-1:T,A&&e>1?E-1:E],L=[A&&I>1?I-1:I,A&&e>1?e-1:e],V=M[0]/L[0],B=M[1]/L[1],z=s.data.get(m.dataId).values;let b=0;for(let W=0;W1?I-1:I,m&&E>1?e-1:e],B=[m&&T>1?T-1:T,m&&E>1?E-1:E],z=V[0]/B[0],b=V[1]/B[1];let W=0;for(let q=0;q1?I-1:I,m&&E>1?e-1:e],B=[m&&T>1?T-1:T,m&&E>1?E-1:E],z=V[0]/B[0],b=V[1]/B[1];let W=0;for(let q=0;q1?E-1:E,A&&F>1?S-1:S],B=[A&&e>1?e-1:e,A&&F>1?F-1:F],z=V[0]/B[0],b=V[1]/B[1],W=1/z,q=1/b,Y=Math.ceil(W)*2+2,X=Math.ceil(q)*2+2;for(let H=0;H=e)continue;const nt=g+je*y[1],Ue=je*z,ye=Math.min(E-1,A?Math.round(Ue):Math.floor(Ue));if(J===ye)for(let ut=0;ut=F)continue;const It=nt+pt*y[2],Lt=pt*b,Ot=Math.min(S-1,A?Math.round(Lt):Math.floor(Lt));pe===Ot&&(Ne+=L[It+we])}}M[me+we]=Ne}}}}return s.makeTensorInfo(f.shape,f.dtype,M)}const resizeNearestNeighborGradConfig$1={kernelName:ResizeNearestNeighborGrad,backendName:"cpu",kernelFunc:resizeNearestNeighborGrad$1};/** + */function resizeNearestNeighborGrad$1(a){const{inputs:n,backend:s,attrs:u}=a,{images:f,dy:m}=n,{alignCorners:A}=u;assertNotComplex$1([m,f],"resizeNearestNeighborGrad");const v=computeStrides(f.shape),y=computeStrides(m.shape),[T,E,S,I]=f.shape,[,e,F]=m.shape,M=new Float32Array(T*E*S*I),L=s.data.get(m.dataId).values,V=[A&&e>1?E-1:E,A&&F>1?S-1:S],B=[A&&e>1?e-1:e,A&&F>1?F-1:F],z=V[0]/B[0],b=V[1]/B[1],W=1/z,q=1/b,Y=Math.ceil(W)*2+2,X=Math.ceil(q)*2+2;for(let Q=0;Q=e)continue;const nt=g+je*y[1],Ue=je*z,ye=Math.min(E-1,A?Math.round(Ue):Math.floor(Ue));if(J===ye)for(let ut=0;ut=F)continue;const It=nt+pt*y[2],Lt=pt*b,Ot=Math.min(S-1,A?Math.round(Lt):Math.floor(Lt));pe===Ot&&(Ne+=L[It+we])}}M[me+we]=Ne}}}}return s.makeTensorInfo(f.shape,f.dtype,M)}const resizeNearestNeighborGradConfig$1={kernelName:ResizeNearestNeighborGrad,backendName:"cpu",kernelFunc:resizeNearestNeighborGrad$1};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -12309,7 +12309,7 @@ Hi, looks like you are running TensorFlow.js in Node.js. To speed things up dram * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const rotateWithOffsetConfig$1={kernelName:RotateWithOffset,backendName:"cpu",kernelFunc:({inputs:a,attrs:n,backend:s})=>{const{image:u}=a,{radians:f,fillValue:m,center:A}=n,v=s,y=getTypedArrayFromDType(u.dtype,sizeFromShape(u.shape)),[T,E,S,I]=u.shape,[e,F]=getImageCenter(A,E,S),M=255,L=Math.sin(f),V=Math.cos(f),B=v.data.get(u.dataId).values;for(let b=0;b=0&&fe=0&&pe{const{image:u}=a,{radians:f,fillValue:m,center:A}=n,v=s,y=getTypedArrayFromDType(u.dtype,sizeFromShape(u.shape)),[T,E,S,I]=u.shape,[e,F]=getImageCenter(A,E,S),M=255,L=Math.sin(f),V=Math.cos(f),B=v.data.get(u.dataId).values;for(let b=0;b=0&&fe=0&&pen-1)if(n<=1)s=0;else{const u=2*n;s-=u*Math.trunc(s/u),s>=n&&(s=u-s-1)}return clamp(0,s,n-1)}function mapCoordWrap(a,n){let s=a;if(s<0)if(n<=1)s=0;else{const u=n-1;s+=n*(Math.trunc(-s/u)+1)}else if(s>n-1)if(n<=1)s=0;else{const u=n-1;s-=n*Math.trunc(s/u)}return clamp(0,s,n-1)}function mapCoordConstant(a,n){return a}function mapCoordNearest(a,n){return clamp(0,a,n-1)}function readWithFillValue(a,n,s,u,f,m,A,v,y,T,E){const S=A*u+v*f+y*m+T;return 0<=v&&vn-1)if(n<=1)s=0;else{const u=2*n;s-=u*Math.trunc(s/u),s>=n&&(s=u-s-1)}return clamp(0,s,n-1)}function mapCoordWrap(a,n){let s=a;if(s<0)if(n<=1)s=0;else{const u=n-1;s+=n*(Math.trunc(-s/u)+1)}else if(s>n-1)if(n<=1)s=0;else{const u=n-1;s-=n*Math.trunc(s/u)}return clamp(0,s,n-1)}function mapCoordConstant(a,n){return a}function mapCoordNearest(a,n){return clamp(0,a,n-1)}function readWithFillValue(a,n,s,u,f,m,A,v,y,T,E){const S=A*u+v*f+y*m+T;return 0<=v&&v`Error in matMul: inner shapes (${S}) and (${I}) of Tensors with shapes ${a.shape} and ${n.shape} and transposeA=${s} and transposeB=${u} must match.`);const W=s?[V,S,e]:[V,e,S],q=u?[B,F,I]:[B,I,F],Y=reshape({inputs:{x:a},backend:f,attrs:{shape:W}}),X=reshape({inputs:{x:n},backend:f,attrs:{shape:q}}),H=[Y,X],g=Math.max(V,B),J=s?Y.shape[1]:Y.shape[2],re=m!=null,ae=A!=null,fe=y==="leakyrelu",pe=y!=null?mapActivationToShaderProgram(y,!0):null,me=re||ae||fe||pe!=null;let Se;if((e===1||F===1)&&J>MATMUL_SHARED_DIM_THRESHOLD&&me===!1){let we=Y,Ne=X;s&&(we=transpose({inputs:{x:Y},backend:f,attrs:{perm:[0,2,1]}}),H.push(we)),u&&(Ne=transpose({inputs:{x:X},backend:f,attrs:{perm:[0,2,1]}}),H.push(Ne));const De=F!==1,je=F===1;let nt=we;De&&(nt=reshape({inputs:{x:we},backend:f,attrs:{shape:[g,J,1]}}),H.push(nt));const Ue=F===1?2:1;let ye=Ne;je&&(ye=reshape({inputs:{x:Ne},backend:f,attrs:{shape:[g,1,J]}}),H.push(ye));const ut=multiply({inputs:{a:nt,b:ye},backend:f});Se=sum({inputs:{x:ut},backend:f,attrs:{axis:Ue,keepDims:!0}}),H.push(ut)}else{const we=upcastType(a.dtype,n.dtype),Ne=new MatMulPackedProgram(W,q,[g,e,F],s,u,re,pe,ae,fe),De=[Y,X];if(m!=null&&De.push(m),ae&&De.push(A),fe){const je=f.makeTensorInfo([],"float32",createScalarValue(v,"float32"));De.push(je),H.push(je)}Se=f.runWebGLProgram(Ne,De,we)}const ve=reshape({inputs:{x:Se},backend:f,attrs:{shape:b}});H.push(Se);for(const we of H)f.disposeIntermediateTensorInfo(we);return ve}/** + */const MATMUL_SHARED_DIM_THRESHOLD=1e3;function batchMatMulImpl({a,b:n,transposeA:s,transposeB:u,backend:f,bias:m=null,preluActivationWeights:A=null,leakyreluAlpha:v=0,activation:y=null}){const T=a.shape.length,E=n.shape.length,S=s?a.shape[T-2]:a.shape[T-1],I=u?n.shape[E-1]:n.shape[E-2],e=s?a.shape[T-1]:a.shape[T-2],F=u?n.shape[E-2]:n.shape[E-1],M=a.shape.slice(0,-2),L=n.shape.slice(0,-2),V=sizeFromShape(M),B=sizeFromShape(L),b=assertAndGetBroadcastShape(a.shape.slice(0,-2),n.shape.slice(0,-2)).concat([e,F]);assert$1(S===I,()=>`Error in matMul: inner shapes (${S}) and (${I}) of Tensors with shapes ${a.shape} and ${n.shape} and transposeA=${s} and transposeB=${u} must match.`);const W=s?[V,S,e]:[V,e,S],q=u?[B,F,I]:[B,I,F],Y=reshape({inputs:{x:a},backend:f,attrs:{shape:W}}),X=reshape({inputs:{x:n},backend:f,attrs:{shape:q}}),Q=[Y,X],g=Math.max(V,B),J=s?Y.shape[1]:Y.shape[2],re=m!=null,ae=A!=null,fe=y==="leakyrelu",pe=y!=null?mapActivationToShaderProgram(y,!0):null,me=re||ae||fe||pe!=null;let Se;if((e===1||F===1)&&J>MATMUL_SHARED_DIM_THRESHOLD&&me===!1){let we=Y,Ne=X;s&&(we=transpose({inputs:{x:Y},backend:f,attrs:{perm:[0,2,1]}}),Q.push(we)),u&&(Ne=transpose({inputs:{x:X},backend:f,attrs:{perm:[0,2,1]}}),Q.push(Ne));const De=F!==1,je=F===1;let nt=we;De&&(nt=reshape({inputs:{x:we},backend:f,attrs:{shape:[g,J,1]}}),Q.push(nt));const Ue=F===1?2:1;let ye=Ne;je&&(ye=reshape({inputs:{x:Ne},backend:f,attrs:{shape:[g,1,J]}}),Q.push(ye));const ut=multiply({inputs:{a:nt,b:ye},backend:f});Se=sum({inputs:{x:ut},backend:f,attrs:{axis:Ue,keepDims:!0}}),Q.push(ut)}else{const we=upcastType(a.dtype,n.dtype),Ne=new MatMulPackedProgram(W,q,[g,e,F],s,u,re,pe,ae,fe),De=[Y,X];if(m!=null&&De.push(m),ae&&De.push(A),fe){const je=f.makeTensorInfo([],"float32",createScalarValue(v,"float32"));De.push(je),Q.push(je)}Se=f.runWebGLProgram(Ne,De,we)}const ve=reshape({inputs:{x:Se},backend:f,attrs:{shape:b}});Q.push(Se);for(const we of Q)f.disposeIntermediateTensorInfo(we);return ve}/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the License); @@ -15641,7 +15641,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,atanh=unaryKernelFunc({opSnippet:AT } setOutput(float(minMaxPosition)); } - `;return}const W="max";let q=`${s}(${s}(${s}(minMaxValue[0], minMaxValue[1]), minMaxValue[2]), minMaxValue[3])`;s==="avg"&&(q="avgValue / max(count, 1.0)");const Y=Math.floor(A/4)*4,X=A%4,H=` + `;return}const W="max";let q=`${s}(${s}(${s}(minMaxValue[0], minMaxValue[1]), minMaxValue[2]), minMaxValue[3])`;s==="avg"&&(q="avgValue / max(count, 1.0)");const Y=Math.floor(A/4)*4,X=A%4,Q=` if (${z}) { avgValue += dot(values, ones); } else { @@ -15706,7 +15706,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,atanh=unaryKernelFunc({opSnippet:AT getValue(batch, xD, xR, xC + 3 * ${I}, ch) ); - ${H} + ${Q} } int xC = xCCorner + ${Y}; @@ -15718,7 +15718,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,atanh=unaryKernelFunc({opSnippet:AT initializationValue ); - ${H} + ${Q} } else if (${X===2}) { vec4 values = vec4( getValue(batch, xD, xR, xC, ch), @@ -15727,7 +15727,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,atanh=unaryKernelFunc({opSnippet:AT initializationValue ); - ${H} + ${Q} } else if (${X===3}) { vec4 values = vec4( getValue(batch, xD, xR, xC, ch), @@ -15736,7 +15736,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,atanh=unaryKernelFunc({opSnippet:AT initializationValue ); - ${H} + ${Q} } } } @@ -16981,7 +16981,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,atanh=unaryKernelFunc({opSnippet:AT * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function getShapeForBatchMatMul(a,n){const s=a.length;return s>=3?n?[...a.slice(0,-3),a[s-3]*a[s-2],a[s-1]]:[...a.slice(0,-3),a[s-3],a[s-2]*a[s-1]]:!n&&s===1&&a[0]>1?[a[0],1]:null}function conv2dByMatMul({x:a,filter:n,convInfo:s,backend:u,bias:f=null,preluActivationWeights:m=null,leakyreluAlpha:A=0,activation:v=null}){const y=a.shape,T=u.texData.get(a.dataId),E=s.inChannels,S=y[0]*y[1]*y[2],I=s.outChannels,e=s.dataFormat==="channelsLast",F=!1,M=!1;let L;const V=[];if(m!=null){const b=getShapeForBatchMatMul(m.shape,e);b!=null&&(m=reshape({inputs:{x:m},backend:u,attrs:{shape:b}}),V.push(m))}if(f!=null){const b=getShapeForBatchMatMul(f.shape,e);b!=null&&(f=reshape({inputs:{x:f},backend:u,attrs:{shape:b}}),V.push(f))}if(!((S===1||I===1)&&E>MATMUL_SHARED_DIM_THRESHOLD)&&T.isPacked&&e&&T.texture!=null&&y[2]%2!==0&&arraysEqual(T.shape.slice(-3),y.slice(-3))){const b=y[0]*y[1]*(y[2]+1),W={dataId:a.dataId,shape:[1,b,s.inChannels],dtype:a.dtype},q=T.shape;T.shape=T.shape.slice(),T.shape[T.shape.length-2]++,assert$1(isReshapeFree(T.shape,W.shape),()=>`packed reshape ${T.shape} to ${W.shape} isn't free`);const Y=reshape({inputs:{x:n},backend:u,attrs:{shape:[1,s.inChannels,s.outChannels]}});V.push(Y);const X=batchMatMulImpl({a:W,b:Y,backend:u,transposeA:F,transposeB:M,bias:f,activation:v,preluActivationWeights:m,leakyreluAlpha:A}),H=u.texData.get(X.dataId);assert$1(H.isPacked,()=>"batchMatMul result is expected to be packed"),T.shape=q,H.shape=s.outShape,L=identity({inputs:{x:X},backend:u}),L.shape=s.outShape,V.push(X)}else{const b=s.outHeight*s.outWidth,W=reshape({inputs:{x:a},backend:u,attrs:{shape:e?[s.batchSize,b,s.inChannels]:[s.batchSize,s.inChannels,b]}}),q=reshape({inputs:{x:n},backend:u,attrs:{shape:[1,s.inChannels,s.outChannels]}}),Y=batchMatMulImpl({a:e?W:q,b:e?q:W,transposeA:!e,transposeB:M,backend:u,bias:f,activation:v,preluActivationWeights:m,leakyreluAlpha:A});L=reshape({inputs:{x:Y},backend:u,attrs:{shape:s.outShape}}),V.push(W),V.push(q),V.push(Y)}for(const b of V)u.disposeIntermediateTensorInfo(b);return L}function conv2dWithIm2Row({x:a,filter:n,convInfo:s,backend:u,bias:f=null,preluActivationWeights:m=null,leakyreluAlpha:A=0,activation:v=null}){const{filterWidth:y,filterHeight:T,inChannels:E,outWidth:S,outHeight:I,dataFormat:e}=s,F=e==="channelsLast",M=y*T*E,L=I*S,V=[s.batchSize,M,L],B=!0,z=!1,b=[];if(m!=null){const ve=getShapeForBatchMatMul(m.shape,F);ve!=null&&(m=reshape({inputs:{x:m},backend:u,attrs:{shape:ve}}),b.push(m))}if(f!=null){const ve=getShapeForBatchMatMul(f.shape,F);ve!=null&&(f=reshape({inputs:{x:f},backend:u,attrs:{shape:ve}}),b.push(f))}const W=reshape({inputs:{x:n},backend:u,attrs:{shape:[1,M,sizeFromShape(n.shape)/M]}});b.push(W);const q=new Im2ColPackedProgram(V,s),Y=[a.shape,[s.padInfo.top,s.padInfo.left],[s.strideHeight,s.strideWidth],[s.dilationHeight,s.dilationWidth],[s.inChannels],[s.filterWidth*s.inChannels],[s.outWidth]],X=u.runWebGLProgram(q,[a],"float32",Y),H=reshape({inputs:{x:X},backend:u,attrs:{shape:V}});b.push(X),b.push(H);const g=f!=null,J=m!=null,re=v==="leakyrelu",ae=v?mapActivationToShaderProgram(v,!0):null,fe=new MatMulPackedProgram(F?H.shape:W.shape,F?W.shape:H.shape,F?[s.batchSize,L,s.outChannels]:[s.batchSize,s.outChannels,L],B,z,g,ae,J,re),pe=F?[H,W]:[W,H];if(f&&pe.push(f),J&&pe.push(m),re){const ve=u.makeTensorInfo([],"float32",createScalarValue(A,"float32"));pe.push(ve),b.push(ve)}const me=u.runWebGLProgram(fe,pe,"float32"),Se=reshape({inputs:{x:me},backend:u,attrs:{shape:s.outShape}});b.push(me);for(const ve of b)u.disposeIntermediateTensorInfo(ve);return Se}/** + */function getShapeForBatchMatMul(a,n){const s=a.length;return s>=3?n?[...a.slice(0,-3),a[s-3]*a[s-2],a[s-1]]:[...a.slice(0,-3),a[s-3],a[s-2]*a[s-1]]:!n&&s===1&&a[0]>1?[a[0],1]:null}function conv2dByMatMul({x:a,filter:n,convInfo:s,backend:u,bias:f=null,preluActivationWeights:m=null,leakyreluAlpha:A=0,activation:v=null}){const y=a.shape,T=u.texData.get(a.dataId),E=s.inChannels,S=y[0]*y[1]*y[2],I=s.outChannels,e=s.dataFormat==="channelsLast",F=!1,M=!1;let L;const V=[];if(m!=null){const b=getShapeForBatchMatMul(m.shape,e);b!=null&&(m=reshape({inputs:{x:m},backend:u,attrs:{shape:b}}),V.push(m))}if(f!=null){const b=getShapeForBatchMatMul(f.shape,e);b!=null&&(f=reshape({inputs:{x:f},backend:u,attrs:{shape:b}}),V.push(f))}if(!((S===1||I===1)&&E>MATMUL_SHARED_DIM_THRESHOLD)&&T.isPacked&&e&&T.texture!=null&&y[2]%2!==0&&arraysEqual(T.shape.slice(-3),y.slice(-3))){const b=y[0]*y[1]*(y[2]+1),W={dataId:a.dataId,shape:[1,b,s.inChannels],dtype:a.dtype},q=T.shape;T.shape=T.shape.slice(),T.shape[T.shape.length-2]++,assert$1(isReshapeFree(T.shape,W.shape),()=>`packed reshape ${T.shape} to ${W.shape} isn't free`);const Y=reshape({inputs:{x:n},backend:u,attrs:{shape:[1,s.inChannels,s.outChannels]}});V.push(Y);const X=batchMatMulImpl({a:W,b:Y,backend:u,transposeA:F,transposeB:M,bias:f,activation:v,preluActivationWeights:m,leakyreluAlpha:A}),Q=u.texData.get(X.dataId);assert$1(Q.isPacked,()=>"batchMatMul result is expected to be packed"),T.shape=q,Q.shape=s.outShape,L=identity({inputs:{x:X},backend:u}),L.shape=s.outShape,V.push(X)}else{const b=s.outHeight*s.outWidth,W=reshape({inputs:{x:a},backend:u,attrs:{shape:e?[s.batchSize,b,s.inChannels]:[s.batchSize,s.inChannels,b]}}),q=reshape({inputs:{x:n},backend:u,attrs:{shape:[1,s.inChannels,s.outChannels]}}),Y=batchMatMulImpl({a:e?W:q,b:e?q:W,transposeA:!e,transposeB:M,backend:u,bias:f,activation:v,preluActivationWeights:m,leakyreluAlpha:A});L=reshape({inputs:{x:Y},backend:u,attrs:{shape:s.outShape}}),V.push(W),V.push(q),V.push(Y)}for(const b of V)u.disposeIntermediateTensorInfo(b);return L}function conv2dWithIm2Row({x:a,filter:n,convInfo:s,backend:u,bias:f=null,preluActivationWeights:m=null,leakyreluAlpha:A=0,activation:v=null}){const{filterWidth:y,filterHeight:T,inChannels:E,outWidth:S,outHeight:I,dataFormat:e}=s,F=e==="channelsLast",M=y*T*E,L=I*S,V=[s.batchSize,M,L],B=!0,z=!1,b=[];if(m!=null){const ve=getShapeForBatchMatMul(m.shape,F);ve!=null&&(m=reshape({inputs:{x:m},backend:u,attrs:{shape:ve}}),b.push(m))}if(f!=null){const ve=getShapeForBatchMatMul(f.shape,F);ve!=null&&(f=reshape({inputs:{x:f},backend:u,attrs:{shape:ve}}),b.push(f))}const W=reshape({inputs:{x:n},backend:u,attrs:{shape:[1,M,sizeFromShape(n.shape)/M]}});b.push(W);const q=new Im2ColPackedProgram(V,s),Y=[a.shape,[s.padInfo.top,s.padInfo.left],[s.strideHeight,s.strideWidth],[s.dilationHeight,s.dilationWidth],[s.inChannels],[s.filterWidth*s.inChannels],[s.outWidth]],X=u.runWebGLProgram(q,[a],"float32",Y),Q=reshape({inputs:{x:X},backend:u,attrs:{shape:V}});b.push(X),b.push(Q);const g=f!=null,J=m!=null,re=v==="leakyrelu",ae=v?mapActivationToShaderProgram(v,!0):null,fe=new MatMulPackedProgram(F?Q.shape:W.shape,F?W.shape:Q.shape,F?[s.batchSize,L,s.outChannels]:[s.batchSize,s.outChannels,L],B,z,g,ae,J,re),pe=F?[Q,W]:[W,Q];if(f&&pe.push(f),J&&pe.push(m),re){const ve=u.makeTensorInfo([],"float32",createScalarValue(A,"float32"));pe.push(ve),b.push(ve)}const me=u.runWebGLProgram(fe,pe,"float32"),Se=reshape({inputs:{x:me},backend:u,attrs:{shape:s.outShape}});b.push(me);for(const ve of b)u.disposeIntermediateTensorInfo(ve);return Se}/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -18627,7 +18627,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,atanh=unaryKernelFunc({opSnippet:AT * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function fusedConv2d(a){const{inputs:n,backend:s,attrs:u}=a,{x:f,filter:m,bias:A,preluActivationWeights:v}=n,{strides:y,pad:T,dataFormat:E,dilations:S,dimRoundingMode:I,activation:e,leakyreluAlpha:F}=u,M=convertConv2DDataFormat(E),L=computeConv2DInfo(f.shape,m.shape,y,S,T,I,!1,M);let V;const B=[],z=A!=null,b=v!=null,W=e==="leakyrelu",q=()=>{const X=[f,m],H=(g,J)=>{if(J==="NCHW"&&g.shape.length===1&&g.shape[0]!==1){const re=reshape({inputs:{x:g},backend:s,attrs:{shape:[g.shape[0],1,1]}});return B.push(re),re}return g};if(z&&X.push(H(A,E)),b&&X.push(H(v,E)),W){const g=s.makeTensorInfo([],"float32",createScalarValue(F,"float32"));X.push(g),B.push(g)}return X};if(L.filterHeight===1&&L.filterWidth===1&&L.dilationHeight===1&&L.dilationWidth===1&&L.strideHeight===1&&L.strideWidth===1&&(L.padInfo.type==="SAME"||L.padInfo.type==="VALID"))V=conv2dByMatMul({x:f,filter:m,convInfo:L,backend:s,bias:A,activation:e,preluActivationWeights:v,leakyreluAlpha:F});else if(L.strideWidth<=2&&M==="channelsLast"&&env().getBool("WEBGL_EXP_CONV")){const X=e?mapActivationToShaderProgram(e,!0):null,H=new Conv2DPackedProgram(L,z,X,b,W),g=[[L.padInfo.top,L.padInfo.left],[L.strideHeight,L.strideWidth],[L.dilationHeight,L.dilationWidth],[L.inHeight,L.inWidth]],J=q();V=s.runWebGLProgram(H,J,"float32",g)}else if(env().getBool("WEBGL_CONV_IM2COL"))V=conv2dWithIm2Row({x:f,filter:m,convInfo:L,backend:s,bias:A,activation:e,preluActivationWeights:v,leakyreluAlpha:F});else{const X=e?mapActivationToShaderProgram(e,!1):null,H=new Conv2DProgram(L,z,X,b,W),g=q();V=s.runWebGLProgram(H,g,"float32")}const Y=reshape({inputs:{x:V},backend:s,attrs:{shape:L.outShape}});return B.push(V),B.forEach(X=>s.disposeIntermediateTensorInfo(X)),Y}const fusedConv2DConfig={kernelName:FusedConv2D,backendName:"webgl",kernelFunc:fusedConv2d};/** + */function fusedConv2d(a){const{inputs:n,backend:s,attrs:u}=a,{x:f,filter:m,bias:A,preluActivationWeights:v}=n,{strides:y,pad:T,dataFormat:E,dilations:S,dimRoundingMode:I,activation:e,leakyreluAlpha:F}=u,M=convertConv2DDataFormat(E),L=computeConv2DInfo(f.shape,m.shape,y,S,T,I,!1,M);let V;const B=[],z=A!=null,b=v!=null,W=e==="leakyrelu",q=()=>{const X=[f,m],Q=(g,J)=>{if(J==="NCHW"&&g.shape.length===1&&g.shape[0]!==1){const re=reshape({inputs:{x:g},backend:s,attrs:{shape:[g.shape[0],1,1]}});return B.push(re),re}return g};if(z&&X.push(Q(A,E)),b&&X.push(Q(v,E)),W){const g=s.makeTensorInfo([],"float32",createScalarValue(F,"float32"));X.push(g),B.push(g)}return X};if(L.filterHeight===1&&L.filterWidth===1&&L.dilationHeight===1&&L.dilationWidth===1&&L.strideHeight===1&&L.strideWidth===1&&(L.padInfo.type==="SAME"||L.padInfo.type==="VALID"))V=conv2dByMatMul({x:f,filter:m,convInfo:L,backend:s,bias:A,activation:e,preluActivationWeights:v,leakyreluAlpha:F});else if(L.strideWidth<=2&&M==="channelsLast"&&env().getBool("WEBGL_EXP_CONV")){const X=e?mapActivationToShaderProgram(e,!0):null,Q=new Conv2DPackedProgram(L,z,X,b,W),g=[[L.padInfo.top,L.padInfo.left],[L.strideHeight,L.strideWidth],[L.dilationHeight,L.dilationWidth],[L.inHeight,L.inWidth]],J=q();V=s.runWebGLProgram(Q,J,"float32",g)}else if(env().getBool("WEBGL_CONV_IM2COL"))V=conv2dWithIm2Row({x:f,filter:m,convInfo:L,backend:s,bias:A,activation:e,preluActivationWeights:v,leakyreluAlpha:F});else{const X=e?mapActivationToShaderProgram(e,!1):null,Q=new Conv2DProgram(L,z,X,b,W),g=q();V=s.runWebGLProgram(Q,g,"float32")}const Y=reshape({inputs:{x:V},backend:s,attrs:{shape:L.outShape}});return B.push(V),B.forEach(X=>s.disposeIntermediateTensorInfo(X)),Y}const fusedConv2DConfig={kernelName:FusedConv2D,backendName:"webgl",kernelFunc:fusedConv2d};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -18642,7 +18642,7 @@ return (log(1.0 + x) - log(1.0 - x)) / 2.0;`,atanh=unaryKernelFunc({opSnippet:AT * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function fusedDepthwiseConv2D(a){const{inputs:n,backend:s,attrs:u}=a,{x:f,filter:m,bias:A,preluActivationWeights:v}=n,{strides:y,pad:T,dilations:E,dimRoundingMode:S,activation:I,leakyreluAlpha:e}=u,F=[];let M=E;M==null&&(M=[1,1]),assert$1(eitherStridesOrDilationsAreOne(y,M),()=>`Error in depthwiseConv2d: Either strides or dilations must be 1. Got strides ${y} and dilations '${M}'`);const L=computeConv2DInfo(f.shape,m.shape,y,M,T,S,!0),V=env().getBool("WEBGL_PACK_DEPTHWISECONV")&&L.strideWidth<=2&&L.outChannels/L.inChannels===1,B=I?mapActivationToShaderProgram(I,V):null,z=[f,m],b=A!=null,W=v!=null,q=I==="leakyrelu";if(b&&z.push(A),W&&z.push(v),q){const g=s.makeTensorInfo([],"float32",createScalarValue(e,"float32"));z.push(g),F.push(g)}let Y;V?Y=new DepthwiseConvPacked2DProgram(L,b,B,W,q):Y=new DepthwiseConv2DProgram(L,b,B,W,q);const X=[[L.padInfo.top,L.padInfo.left],[L.strideHeight,L.strideWidth],[L.dilationHeight,L.dilationWidth],[L.inHeight,L.inWidth]],H=s.runWebGLProgram(Y,z,"float32",X);return F.forEach(g=>s.disposeIntermediateTensorInfo(g)),H}const fusedDepthwiseConv2DConfig={kernelName:FusedDepthwiseConv2D,backendName:"webgl",kernelFunc:fusedDepthwiseConv2D};class GatherNDProgram{constructor(n,s,u,f){this.sliceDim=n,this.strides=s,this.paramsShape=f,this.variableNames=["x","indices"],this.outputShape=u;const m=getCoordsDataType(u.length);let A=` + */function fusedDepthwiseConv2D(a){const{inputs:n,backend:s,attrs:u}=a,{x:f,filter:m,bias:A,preluActivationWeights:v}=n,{strides:y,pad:T,dilations:E,dimRoundingMode:S,activation:I,leakyreluAlpha:e}=u,F=[];let M=E;M==null&&(M=[1,1]),assert$1(eitherStridesOrDilationsAreOne(y,M),()=>`Error in depthwiseConv2d: Either strides or dilations must be 1. Got strides ${y} and dilations '${M}'`);const L=computeConv2DInfo(f.shape,m.shape,y,M,T,S,!0),V=env().getBool("WEBGL_PACK_DEPTHWISECONV")&&L.strideWidth<=2&&L.outChannels/L.inChannels===1,B=I?mapActivationToShaderProgram(I,V):null,z=[f,m],b=A!=null,W=v!=null,q=I==="leakyrelu";if(b&&z.push(A),W&&z.push(v),q){const g=s.makeTensorInfo([],"float32",createScalarValue(e,"float32"));z.push(g),F.push(g)}let Y;V?Y=new DepthwiseConvPacked2DProgram(L,b,B,W,q):Y=new DepthwiseConv2DProgram(L,b,B,W,q);const X=[[L.padInfo.top,L.padInfo.left],[L.strideHeight,L.strideWidth],[L.dilationHeight,L.dilationWidth],[L.inHeight,L.inWidth]],Q=s.runWebGLProgram(Y,z,"float32",X);return F.forEach(g=>s.disposeIntermediateTensorInfo(g)),Q}const fusedDepthwiseConv2DConfig={kernelName:FusedDepthwiseConv2D,backendName:"webgl",kernelFunc:fusedDepthwiseConv2D};class GatherNDProgram{constructor(n,s,u,f){this.sliceDim=n,this.strides=s,this.paramsShape=f,this.variableNames=["x","indices"],this.outputShape=u;const m=getCoordsDataType(u.length);let A=` int index;`;for(let v=0;v=1,()=>`Input must have rank at least 1, got: ${f.shape.length}`);const Y=computeOutShape$2(B,z,b),X=slice({inputs:{x:f},backend:s,attrs:{begin:B,size:Y}});W=reshape({inputs:{x:X},backend:s,attrs:{shape:F}}),s.disposeIntermediateTensorInfo(X)}else if(s.shouldExecuteOnCPU([f])){const X=s.readSync(f.dataId),H=buffer(f.shape,f.dtype,X),g=stridedSliceImplCPU(e,H,b,B);W=s.makeTensorInfo(F,f.dtype,g.values)}else{const X=new StridedSliceProgram(B,b,e);W=s.runWebGLProgram(X,[f],f.dtype)}const q=reshape({inputs:{x:W},backend:s,attrs:{shape:F}});return s.disposeIntermediateTensorInfo(W),q}const stridedSliceConfig={kernelName:StridedSlice,backendName:"webgl",kernelFunc:stridedSlice};/** + */function stridedSlice(a){const{inputs:n,backend:s,attrs:u}=a,{x:f}=n,{begin:m,end:A,strides:v,beginMask:y,endMask:T,ellipsisMask:E,newAxisMask:S,shrinkAxisMask:I}=u,{finalShapeSparse:e,finalShape:F,isIdentity:M,sliceDim0:L,isSimpleSlice:V,begin:B,end:z,strides:b}=sliceInfo(f.shape,m,A,v,y,T,E,S,I);let W;if(M)W=reshape({inputs:{x:f},backend:s,attrs:{shape:F}});else if(L||V){assert$1(f.shape.length>=1,()=>`Input must have rank at least 1, got: ${f.shape.length}`);const Y=computeOutShape$2(B,z,b),X=slice({inputs:{x:f},backend:s,attrs:{begin:B,size:Y}});W=reshape({inputs:{x:X},backend:s,attrs:{shape:F}}),s.disposeIntermediateTensorInfo(X)}else if(s.shouldExecuteOnCPU([f])){const X=s.readSync(f.dataId),Q=buffer(f.shape,f.dtype,X),g=stridedSliceImplCPU(e,Q,b,B);W=s.makeTensorInfo(F,f.dtype,g.values)}else{const X=new StridedSliceProgram(B,b,e);W=s.runWebGLProgram(X,[f],f.dtype)}const q=reshape({inputs:{x:W},backend:s,attrs:{shape:F}});return s.disposeIntermediateTensorInfo(W),q}const stridedSliceConfig={kernelName:StridedSlice,backendName:"webgl",kernelFunc:stridedSlice};/** * @license * Copyright 2021 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -21633,7 +21633,7 @@ return a / b;`,DIV_PACKED=` * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function disposeIntermediateTensorInfoOrNull(a,n){n!==null&&a.disposeIntermediateTensorInfo(n)}function roundUpToPow2(a){let n=1;for(;ny){const g=s.readSync(f.dataId),[J,re]=topKImplCPU(g,T,f.dtype,m,A);return[s.makeTensorInfo(J.shape,J.dtype,J.values),s.makeTensorInfo(re.shape,re.dtype,re.values)]}if(m===0)return T[T.length-1]=0,[s.makeTensorInfo(T,f.dtype,[]),s.makeTensorInfo(T,"int32",[])];if(E===1)return[f,fill({attrs:{shape:T,dtype:"int32",value:0},backend:s})];const S=s.texData.get(f.dataId),I=S!==null&&S.isPacked,e=I?s.unpackTensor(f):f,M=sizeFromShape(T)/E,L=reshape({inputs:{x:e},attrs:{shape:[M,E]},backend:s});I&&disposeIntermediateTensorInfoOrNull(s,e);const V=roundUpToPow2(m),B=roundUpToPow2(E);let z=null;const b=()=>z===null?[L,L]:[L,z],W=(g,J,re)=>{const ae=b(),fe=new SwapProgram(re),me=[[E],[z===null?1:0],[Number.NEGATIVE_INFINITY],[g],[J]],Se=z;z=s.runWebGLProgram(fe,ae,"int32",me),disposeIntermediateTensorInfoOrNull(s,Se)};for(let g=1;g=1;re/=2)W(J,re,[M,B])}for(let g=B;g>V;g/=2){const J=b(),re=new MergeProgram([M,g/2]),fe=[[E],[z===null?1:0],[V]],pe=z;z=s.runWebGLProgram(re,J,"int32",fe),disposeIntermediateTensorInfoOrNull(s,pe);const me=V/2,Se=me*2;for(let ve=me;ve>=1;ve/=2)W(Se,ve,z.shape)}let q=z;z=slice({inputs:{x:z},backend:s,attrs:{begin:0,size:[M,m]}}),disposeIntermediateTensorInfoOrNull(s,q);let Y=gatherV2({inputs:{x:L,indices:z},backend:s,attrs:{axis:1,batchDims:1}});disposeIntermediateTensorInfoOrNull(s,L);const X=T.slice(0,-1);X.push(m),q=z,z=reshape({inputs:{x:z},attrs:{shape:X},backend:s}),disposeIntermediateTensorInfoOrNull(s,q);const H=Y;return Y=reshape({inputs:{x:Y},attrs:{shape:X},backend:s}),disposeIntermediateTensorInfoOrNull(s,H),[Y,z]}const topKConfig={kernelName:TopK,backendName:"webgl",kernelFunc:topK};/** + */function disposeIntermediateTensorInfoOrNull(a,n){n!==null&&a.disposeIntermediateTensorInfo(n)}function roundUpToPow2(a){let n=1;for(;ny){const g=s.readSync(f.dataId),[J,re]=topKImplCPU(g,T,f.dtype,m,A);return[s.makeTensorInfo(J.shape,J.dtype,J.values),s.makeTensorInfo(re.shape,re.dtype,re.values)]}if(m===0)return T[T.length-1]=0,[s.makeTensorInfo(T,f.dtype,[]),s.makeTensorInfo(T,"int32",[])];if(E===1)return[f,fill({attrs:{shape:T,dtype:"int32",value:0},backend:s})];const S=s.texData.get(f.dataId),I=S!==null&&S.isPacked,e=I?s.unpackTensor(f):f,M=sizeFromShape(T)/E,L=reshape({inputs:{x:e},attrs:{shape:[M,E]},backend:s});I&&disposeIntermediateTensorInfoOrNull(s,e);const V=roundUpToPow2(m),B=roundUpToPow2(E);let z=null;const b=()=>z===null?[L,L]:[L,z],W=(g,J,re)=>{const ae=b(),fe=new SwapProgram(re),me=[[E],[z===null?1:0],[Number.NEGATIVE_INFINITY],[g],[J]],Se=z;z=s.runWebGLProgram(fe,ae,"int32",me),disposeIntermediateTensorInfoOrNull(s,Se)};for(let g=1;g=1;re/=2)W(J,re,[M,B])}for(let g=B;g>V;g/=2){const J=b(),re=new MergeProgram([M,g/2]),fe=[[E],[z===null?1:0],[V]],pe=z;z=s.runWebGLProgram(re,J,"int32",fe),disposeIntermediateTensorInfoOrNull(s,pe);const me=V/2,Se=me*2;for(let ve=me;ve>=1;ve/=2)W(Se,ve,z.shape)}let q=z;z=slice({inputs:{x:z},backend:s,attrs:{begin:0,size:[M,m]}}),disposeIntermediateTensorInfoOrNull(s,q);let Y=gatherV2({inputs:{x:L,indices:z},backend:s,attrs:{axis:1,batchDims:1}});disposeIntermediateTensorInfoOrNull(s,L);const X=T.slice(0,-1);X.push(m),q=z,z=reshape({inputs:{x:z},attrs:{shape:X},backend:s}),disposeIntermediateTensorInfoOrNull(s,q);const Q=Y;return Y=reshape({inputs:{x:Y},attrs:{shape:X},backend:s}),disposeIntermediateTensorInfoOrNull(s,Q),[Y,z]}const topKConfig={kernelName:TopK,backendName:"webgl",kernelFunc:topK};/** * @license * Copyright 2021 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -21941,7 +21941,7 @@ return a / b;`,DIV_PACKED=` * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */function unsortedSegmentSum(a){const{inputs:n,backend:s,attrs:u}=a,{x:f,segmentIds:m}=n,{numSegments:A}=u,v=f.shape.length,y=[];let T=0;const E=getAxesPermutation([T],v);let S=f;E!=null&&(S=transpose({inputs:{x:f},backend:s,attrs:{perm:E}}),y.push(S),T=getInnerMostAxes(1,v)[0]);const I=computeOutShape(S.shape,T,A),e=sizeFromShape([S.shape[T]]),F=reshape({inputs:{x:S},backend:s,attrs:{shape:[-1,e]}});y.push(F);const M=sumOutType(f.dtype),L=(b,W,q,Y,X)=>{const H=b.shape[0],g=b.shape[1],J=segOpComputeOptimalWindowSize(g,X),re={windowSize:J,inSize:g,batchSize:H,numSegments:X},ae=new SegmentOpProgram(re,W),fe=s.compileAndRun(ae,[b,q],Y);if(y.push(fe),fe.shape[1]===X)return fe;const pe=range({backend:s,attrs:{start:0,stop:X,step:1,dtype:"float32"}}),me=tile({inputs:{x:pe},backend:s,attrs:{reps:[g/J]}});return y.push(pe),y.push(me),L(fe,W,me,Y,X)},V=L(F,"unsortedSegmentSum",m,M,A),B=reshape({inputs:{x:V},backend:s,attrs:{shape:I}});let z=B;if(E!=null){y.push(B);const b=getUndoAxesPermutation(E);z=transpose({inputs:{x:z},backend:s,attrs:{perm:b}})}return y.forEach(b=>s.disposeIntermediateTensorInfo(b)),z}const unsortedSegmentSumConfig={kernelName:UnsortedSegmentSum,backendName:"webgl",kernelFunc:unsortedSegmentSum};/** + */function unsortedSegmentSum(a){const{inputs:n,backend:s,attrs:u}=a,{x:f,segmentIds:m}=n,{numSegments:A}=u,v=f.shape.length,y=[];let T=0;const E=getAxesPermutation([T],v);let S=f;E!=null&&(S=transpose({inputs:{x:f},backend:s,attrs:{perm:E}}),y.push(S),T=getInnerMostAxes(1,v)[0]);const I=computeOutShape(S.shape,T,A),e=sizeFromShape([S.shape[T]]),F=reshape({inputs:{x:S},backend:s,attrs:{shape:[-1,e]}});y.push(F);const M=sumOutType(f.dtype),L=(b,W,q,Y,X)=>{const Q=b.shape[0],g=b.shape[1],J=segOpComputeOptimalWindowSize(g,X),re={windowSize:J,inSize:g,batchSize:Q,numSegments:X},ae=new SegmentOpProgram(re,W),fe=s.compileAndRun(ae,[b,q],Y);if(y.push(fe),fe.shape[1]===X)return fe;const pe=range({backend:s,attrs:{start:0,stop:X,step:1,dtype:"float32"}}),me=tile({inputs:{x:pe},backend:s,attrs:{reps:[g/J]}});return y.push(pe),y.push(me),L(fe,W,me,Y,X)},V=L(F,"unsortedSegmentSum",m,M,A),B=reshape({inputs:{x:V},backend:s,attrs:{shape:I}});let z=B;if(E!=null){y.push(B);const b=getUndoAxesPermutation(E);z=transpose({inputs:{x:z},backend:s,attrs:{perm:b}})}return y.forEach(b=>s.disposeIntermediateTensorInfo(b)),z}const unsortedSegmentSumConfig={kernelName:UnsortedSegmentSum,backendName:"webgl",kernelFunc:unsortedSegmentSum};/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -21956,7 +21956,7 @@ return a / b;`,DIV_PACKED=` * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= - */const kernelConfigs=[_fusedMatMulConfig,absConfig,acosConfig,acoshConfig,addConfig,addNConfig,allConfig,anyConfig,argMaxConfig,argMinConfig,asinConfig,asinhConfig,atanConfig,atan2Config,atanhConfig,avgPoolConfig,avgPool3DConfig,avgPool3DGradConfig,avgPoolGradConfig,batchMatMulConfig,batchNormConfig,batchToSpaceNDConfig,bincountConfig,bitwiseAndConfig,broadcastArgsConfig,castConfig,ceilConfig,clipByValueConfig,complexConfig,complexAbsConfig,concatConfig,conv2DConfig,conv2DBackpropFilterConfig,conv2DBackpropInputConfig,conv3DConfig,conv3DBackpropFilterV2Config,conv3DBackpropInputConfig,cosConfig,coshConfig,cropAndResizeConfig,cumprodConfig,cumsumConfig,denseBincountConfig,depthToSpaceConfig,depthwiseConv2dNativeConfig,depthwiseConv2dNativeBackpropFilterConfig,depthwiseConv2dNativeBackpropInputConfig,diagConfig,dilation2DConfig,einsumConfig,eluConfig,eluGradConfig,equalConfig,erfConfig,expConfig,expandDimsConfig,expm1Config,fftConfig,fillConfig,flipLeftRightConfig,floorConfig,floorDivConfig,fromPixelsConfig,fusedConv2DConfig,fusedDepthwiseConv2DConfig,gatherNdConfig,gatherV2Config,greaterConfig,greaterEqualConfig,identityConfig,ifftConfig,imagConfig,isFiniteConfig,isInfConfig,isNaNConfig,leakyReluConfig,lessConfig,lessEqualConfig,linSpaceConfig,logConfig,log1pConfig,logicalAndConfig,logicalNotConfig,logicalOrConfig,LRNConfig,LRNGradConfig,maxConfig,maximumConfig,maxPoolConfig,maxPool3DConfig,maxPool3DGradConfig,maxPoolGradConfig,maxPoolWithArgmaxConfig,meanConfig,minConfig,minimumConfig,mirrorPadConfig,modConfig,multinomialConfig,multiplyConfig,negConfig,nonMaxSuppressionV3Config,nonMaxSuppressionV4Config,nonMaxSuppressionV5Config,notEqualConfig,oneHotConfig,onesLikeConfig,packConfig,padV2Config,powConfig,preluConfig,prodConfig,raggedGatherConfig,raggedRangeConfig,raggedTensorToTensorConfig,rangeConfig,realConfig,realDivConfig,reciprocalConfig,reluConfig,relu6Config,reshapeConfig,resizeBilinearConfig,resizeBilinearGradConfig,resizeNearestNeighborConfig,resizeNearestNeighborGradConfig,reverseConfig,rotateWithOffsetConfig,roundConfig,rsqrtConfig,scatterNdConfig,searchSortedConfig,selectConfig,seluConfig,sigmoidConfig,signConfig,sinConfig,sinhConfig,sliceConfig,softmaxConfig,softplusConfig,spaceToBatchNDConfig,sparseFillEmptyRowsConfig,sparseReshapeConfig,sparseSegmentMeanConfig,sparseSegmentSumConfig,sparseToDenseConfig,splitVConfig,sqrtConfig,squareConfig,squaredDifferenceConfig,staticRegexReplaceConfig,stepConfig,stridedSliceConfig,stringNGramsConfig,stringSplitConfig,stringToHashBucketFastConfig,subConfig,sumConfig,tanConfig,tanhConfig,tensorScatterUpdateConfig,tileConfig,topKConfig,transformConfig,transposeConfig,uniqueConfig,unpackConfig,unsortedSegmentSumConfig,zerosLikeConfig];for(const a of kernelConfigs)registerKernel(a);class BWLabeler{idx(n,s,u,f){return u*f[0]*f[1]+s*f[0]+n}check_previous_slice(n,s,u,f,m,A,v,y,T,E){let S=0;if(!m)return 0;const I=n[this.idx(u,f,m,A)];if(v>=6){const e=this.idx(u,f,m-1,A);I===n[e]&&(T[S++]=s[e])}if(v>=18){if(u){const e=this.idx(u-1,f,m-1,A);I===n[e]&&(T[S++]=s[e])}if(f){const e=this.idx(u,f-1,m-1,A);I===n[e]&&(T[S++]=s[e])}if(u=6){if(F){const V=this.idx(F-1,e,I,s);L===n[V]&&(S[M++]=E[V])}if(e){const V=this.idx(F,e-1,I,s);L===n[V]&&(S[M++]=E[V])}}if(u>=18){if(e&&F){const V=this.idx(F-1,e-1,I,s);L===n[V]&&(S[M++]=E[V])}if(e&&F=y){y+=v;const V=new Uint32Array(y);V.set(T),T=V}T[A-1]=A,A++}}}for(let I=0;I.",inferenceDelay:100,description:"Gray and white matter segmentation model. Operates on full T1 image in a single pass but needs a dedicated graphics card to operate. Provides the best accuracy with hard cropping for better speed"},{id:3,type:"Segmentation",path:"/models/model20chan3cls/model.json",modelName:"🔪 Tissue GWM (High Acc, Low Mem)",labelsPath:"./models/model20chan3cls/labels.json",colorsPath:"./models/model20chan3cls/colorLUT.json",colormapPath:"./models/model20chan3cls/colormap.json",preModelId:null,preModelPostProcess:!1,isBatchOverlapEnable:!1,numOverlapBatches:0,enableTranspose:!0,enableCrop:!0,cropPadding:0,autoThreshold:.2,enableQuantileNorm:!0,filterOutWithPreMask:!1,enableSeqConv:!0,textureSize:0,warning:"This model may need dedicated graphics card. For more info please check with Browser Resources .",inferenceDelay:100,description:"Gray and white matter segmentation model. Operates on full T1 image in a single pass but needs a dedicated graphics card to operate. Provides high accuracy and fit low memory available but slower"},{id:4,type:"Atlas",path:"/models/model30chan18cls/model.json",modelName:"🪓 Subcortical + GWM (High Mem, Fast)",labelsPath:"./models/model30chan18cls/labels.json",colorsPath:"./models/model30chan18cls/colorLUT.json",colormapPath:"./models/model30chan18cls/colormap.json",preModelId:null,preModelPostProcess:!1,isBatchOverlapEnable:!1,numOverlapBatches:200,enableTranspose:!0,enableCrop:!0,cropPadding:0,autoThreshold:.2,enableQuantileNorm:!1,filterOutWithPreMask:!1,enableSeqConv:!1,textureSize:0,warning:"This model may need dedicated graphics card. For more info please check with Browser Resources .",inferenceDelay:100,description:"Parcellation of the brain into 17 regions: gray and white matter plus subcortical areas. This is a robust model able to handle range of data quality, including varying saturation, and even clinical scans. It may work on infant brains, but your mileage may vary."},{id:5,type:"Atlas",path:"/models/model30chan18cls/model.json",modelName:"🪓 Subcortical + GWM (Low Mem, Slow)",labelsPath:"./models/model30chan18cls/labels.json",colorsPath:"./models/model30chan18cls/colorLUT.json",colormapPath:"./models/model30chan18cls/colormap.json",preModelId:null,preModelPostProcess:!1,isBatchOverlapEnable:!1,numOverlapBatches:200,enableTranspose:!0,enableCrop:!0,cropPadding:0,autoThreshold:.2,enableQuantileNorm:!1,filterOutWithPreMask:!1,enableSeqConv:!0,textureSize:0,warning:"This model may need dedicated graphics card. For more info please check with Browser Resources .",inferenceDelay:100,description:"Parcellation of the brain into 17 regions: gray and white matter plus subcortical areas. This is a robust model able to handle range of data quality, including varying saturation, and even clinical scans. It may work on infant brains, but your mileage may vary."},{id:6,type:"Atlas",path:"/models/model18cls/model.json",modelName:"🪓 Subcortical + GWM (Low Mem, Faster)",labelsPath:"./models/model18cls/labels.json",colorsPath:"./models/model18cls/colorLUT.json",colormapPath:"./models/model18cls/colormap.json",preModelId:null,preModelPostProcess:!1,isBatchOverlapEnable:!1,numOverlapBatches:200,enableTranspose:!0,enableCrop:!0,cropPadding:0,autoThreshold:.2,enableQuantileNorm:!1,filterOutWithPreMask:!1,enableSeqConv:!0,textureSize:0,warning:"This model may need dedicated graphics card. For more info please check with Browser Resources .",inferenceDelay:100,description:"Parcellation of the brain into 17 regions: gray and white matter plus subcortical areas. This is a robust model able to handle range of data quality, including varying saturation, and even clinical scans. It may work on infant brains, but your mileage may vary."},{id:7,type:"Atlas",path:"/models/model30chan18cls/model.json",modelName:"🔪🪓 Subcortical + GWM (Failsafe, Less Acc)",labelsPath:"./models/model30chan18cls/labels.json",colorsPath:"./models/model30chan18cls/colorLUT.json",colormapPath:"./models/model30chan18cls/colormap.json",preModelId:1,preModelPostProcess:!1,isBatchOverlapEnable:!1,numOverlapBatches:200,enableTranspose:!0,enableCrop:!0,cropPadding:0,autoThreshold:0,enableQuantileNorm:!1,filterOutWithPreMask:!1,enableSeqConv:!1,textureSize:0,warning:"This model may need dedicated graphics card. For more info please check with Browser Resources .",inferenceDelay:100,description:"Parcellation of the brain into 17 regions: gray and white matter plus subcortical areas. This is not a robust model, it may work on low data quality, including varying saturation, and even clinical scans. It may work also on infant brains, but your mileage may vary."},{id:8,type:"Atlas",path:"/models/model30chan50cls/model.json",modelName:"🔪 Aparc+Aseg 50 (High Mem, Fast)",labelsPath:"./models/model30chan50cls/labels.json",colorsPath:"./models/model30chan50cls/colorLUT.json",colormapPath:"./models/model30chan50cls/colormap.json",preModelId:1,preModelPostProcess:!1,isBatchOverlapEnable:!1,numOverlapBatches:200,enableTranspose:!0,enableCrop:!0,cropPadding:0,autoThreshold:0,enableQuantileNorm:!0,filterOutWithPreMask:!1,enableSeqConv:!1,textureSize:0,warning:"This model may need dedicated graphics card. For more info please check with Browser Resources .",inferenceDelay:100,description:"This is a 50-class model, that segments the brain into the Aparc+Aseg Freesurfer Atlas but one where cortical homologues are merged into a single class."},{id:9,type:"Atlas",path:"/models/model30chan50cls/model.json",modelName:"🔪 Aparc+Aseg 50 (Low Mem, Slow)",labelsPath:"./models/model30chan50cls/labels.json",colorsPath:"./models/model30chan50cls/colorLUT.json",colormapPath:"./models/model30chan50cls/colormap.json",preModelId:1,preModelPostProcess:!1,isBatchOverlapEnable:!1,numOverlapBatches:200,enableTranspose:!0,enableCrop:!0,cropPadding:0,autoThreshold:0,enableQuantileNorm:!0,filterOutWithPreMask:!1,enableSeqConv:!0,textureSize:0,warning:"This model may need dedicated graphics card. For more info please check with Browser Resources .",inferenceDelay:100,description:"This is a 50-class model, that segments the brain into the Aparc+Aseg Freesurfer Atlas but one where cortical homologues are merged into a single class. The model use sequential convolution for inference to overcome browser memory limitations but leads to longer computation time."},{id:10,type:"Brain_Extraction",path:"/models/model5_gw_ae/model.json",modelName:"⚡ Extract the Brain (FAST)",labelsPath:null,colorsPath:null,preModelId:null,preModelPostProcess:!1,isBatchOverlapEnable:!1,numOverlapBatches:0,enableTranspose:!0,enableCrop:!0,cropPadding:18,autoThreshold:0,enableQuantileNorm:!1,filterOutWithPreMask:!1,enableSeqConv:!1,textureSize:0,warning:null,inferenceDelay:100,description:"Extract the brain fast model operates on full T1 image in a single pass, but uses only 5 filters per layer. Can work on integrated graphics cards but is barely large enough to provide good accuracy. Still more accurate than the failsafe version."},{id:11,type:"Brain_Extraction",path:"/models/model11_gw_ae/model.json",modelName:"🔪 Extract the Brain (High Acc, Slow)",labelsPath:null,colorsPath:null,preModelId:null,preModelPostProcess:!1,isBatchOverlapEnable:!1,numOverlapBatches:0,enableTranspose:!0,enableCrop:!0,cropPadding:0,autoThreshold:0,enableQuantileNorm:!1,filterOutWithPreMask:!1,enableSeqConv:!0,textureSize:0,warning:"This model may need dedicated graphics card. For more info please check with Browser Resources .",inferenceDelay:100,description:"Extract the brain high accuracy model operates on full T1 image in a single pass, but uses only 11 filters per layer. Can work on dedicated graphics cards. Still more accurate than the fast version."},{id:12,type:"Brain_Masking",path:"/models/model5_gw_ae/model.json",modelName:"⚡ Brain Mask (FAST)",labelsPath:null,colorsPath:null,colormapPath:"./models/model5_gw_ae/colormap.json",preModelId:null,preModelPostProcess:!1,isBatchOverlapEnable:!1,numOverlapBatches:0,enableTranspose:!0,enableCrop:!0,cropPadding:17,autoThreshold:0,enableQuantileNorm:!1,filterOutWithPreMask:!1,enableSeqConv:!1,textureSize:0,warning:null,inferenceDelay:100,description:"This fast masking model operates on full T1 image in a single pass, but uses only 5 filters per layer. Can work on integrated graphics cards but is barely large enough to provide good accuracy. Still more accurate than failsafe version."},{id:13,type:"Brain_Masking",path:"/models/model11_gw_ae/model.json",modelName:"🔪 Brain Mask (High Acc, Low Mem)",labelsPath:null,colorsPath:null,preModelId:null,preModelPostProcess:!1,isBatchOverlapEnable:!1,numOverlapBatches:0,enableTranspose:!0,enableCrop:!0,cropPadding:0,autoThreshold:0,enableQuantileNorm:!0,filterOutWithPreMask:!1,enableSeqConv:!0,textureSize:0,warning:"This model may need dedicated graphics card. For more info please check with Browser Resources .",inferenceDelay:100,description:"This masking model operates on full T1 image in a single pass, but uses 11 filters per layer. Can work on dedicated graphics cards. Still more accurate than fast version."},{id:14,type:"Atlas",path:"/models/model21_104class/model.json",modelName:"🔪 Aparc+Aseg 104 (High Mem, Fast)",labelsPath:"./models/model21_104class/labels.json",colorsPath:"./models/model21_104class/colorLUT.json",colormapPath:"./models/model21_104class/colormap.json",preModelId:1,preModelPostProcess:!1,isBatchOverlapEnable:!1,numOverlapBatches:200,enableTranspose:!0,enableCrop:!0,cropPadding:0,autoThreshold:0,enableQuantileNorm:!1,filterOutWithPreMask:!1,enableSeqConv:!1,textureSize:0,warning:"This model may need dedicated graphics card. For more info please check with Browser Resources .",inferenceDelay:100,description:"FreeSurfer aparc+aseg atlas 104 parcellate brain areas into 104 regions. It contains a combination of the Desikan-Killiany atlas for cortical area and also segmentation of subcortical regions."},{id:15,type:"Atlas",path:"/models/model21_104class/model.json",modelName:"🔪 Aparc+Aseg 104 (Low Mem, Slow)",labelsPath:"./models/model21_104class/labels.json",colorsPath:"./models/model21_104class/colorLUT.json",colormapPath:"./models/model21_104class/colormap.json",preModelId:1,preModelPostProcess:!1,isBatchOverlapEnable:!1,numOverlapBatches:200,enableTranspose:!0,enableCrop:!0,cropPadding:0,autoThreshold:0,enableQuantileNorm:!1,filterOutWithPreMask:!1,enableSeqConv:!0,textureSize:0,warning:"This model may need dedicated graphics card. For more info please check with Browser Resources .",inferenceDelay:100,description:"FreeSurfer aparc+aseg atlas 104 parcellate brain areas into 104 regions. It contains a combination of the Desikan-Killiany atlas for cortical area and also segmentation of subcortical regions. The model use sequential convolution for inference to overcome browser memory limitations but leads to longer computation time. "}];async function getModelNumParameters(a){let n=0;for(let s=0;se-F);const m=tensor1d(f),A=m.shape[0],v=Math.floor(A*n),y=Math.ceil(A*s)-1,T=m.slice(v,1),E=m.slice(y,1),S=(await T.array())[0],I=(await E.array())[0];return u.dispose(),m.dispose(),T.dispose(),E.dispose(),{qmin:S,qmax:I}}async function quantileNormalizeVolumeData(a,n=.05,s=.95){const{qmin:u,qmax:f}=await calculateQuantiles(a,n,s),m=scalar(u),A=scalar(f),v=a.sub(m).div(A.sub(m));return m.dispose(),A.dispose(),v}async function minMaxNormalizeVolumeData(a){const n=a.max(),s=a.min();return await a.sub(s).div(n.sub(s))}async function inferenceFullVolumeSeqCovLayer(a,n,s,u,f,m,A){window.alert("inferenceFullVolumeSeqCovLayer() is not dead code?")}async function inferenceFullVolume(a,n,s,u,f,m,A){window.alert("inferenceFullVolume() is not dead code?")}async function inferenceSubVolumes(a,n,s,u,f,m=null){window.alert("inferenceSubVolumes() is not dead code?")}async function tensor2LightBuffer(a,n){window.alert("tensor2LightBuffer() is not dead code?")}async function draw3dObjBoundingVolume(a){window.alert("draw3dObjBoundingVolume() is not dead code?")}async function argMaxLarge(a,n,s,u,f,m="float32"){window.alert("argMaxLarge() is not dead code?")}async function addZeroPaddingTo3dTensor(a,n=[1,1],s=[1,1],u=[1,1]){if(a.rank!==3)throw new Error("Tensor must be 3D");return a.pad([n,s,u])}async function removeZeroPaddingFrom3dTensor(a,n=1,s=1,u=1){if(a.rank!==3)throw new Error("Tensor must be 3D");const[f,m,A]=a.shape;return a.slice([n,s,u],[f-2*n,m-2*s,A-2*u])}async function resizeWithZeroPadding(a,n,s,u,f,m){const A=f[0],v=f[1],y=f[2],T=A+m[0]-1,E=v+m[1]-1,S=y+m[2]-1,I=s-T-1>0?s-T-1:0,e=u-E-1>0?u-E-1:0,F=n-S-1>0?n-S-1:0;return a.pad([[A,I],[v,e],[y,F]])}async function applyMriThreshold(a,n){const s=a.max(),u=s.mul(n),f=await u.data();return s.dispose(),u.dispose(),tidy(()=>a.clone().greater(f[0]))}async function binarizeVolumeDataTensor(a){return a.step(0)}async function generateBrainMask(a,n,s,u,f,m,A,v,y=!0){console.log("Generate Brain Masking ... ");let T=[];for(let F=0;F{const F="postProcessSlices3D() should be upgraded to BWLabeler";A(F,-1,F)}),console.log("Post processing done ")):console.log("Phase-1 Post processing disabled ... ");const S=new Array(T[0].length*T.length);let I=0;for(let F=0;F{const z=a.slice([0,0,0,0,L],[-1,-1,-1,-1,V-L]),b=n.slice([0,0,0,L,E],[-1,-1,-1,V-L,1]);return conv3d(z,b,u,f,"NDHWC",m)});if(e===null)e=B;else{const z=e.add(B);e.dispose(),B.dispose(),e=z}}}const F=e.add(I);if(e.dispose(),I.dispose(),T==null)T=F;else{const M=await concat$2([T,F],4);F.dispose(),T.dispose(),T=M}}return T}function processTensorInChunks(a,n,s){const A=a.shape[4],v=Math.ceil(A/s);let y=null;for(let T=0;Ta.slice([0,0,0,0,E],[-1,-1,-1,-1,I])),F=tidy(()=>n.slice([0,0,0,E,0],[-1,-1,-1,I,-1])),M=conv3d(e,F,1,0,"NDHWC",1);e.dispose(),F.dispose();const L=squeeze(M);if(M.dispose(),y===null)y=L;else{const V=y.add(L);y.dispose(),y!==L&&L.dispose(),y=V}tidy(()=>{matMul$1(zeros$1([1,1]),zeros$1([1,1]))})}return y}class SequentialConvLayer{constructor(n,s,u,f){this.model=n,this.outChannels=n.outputLayers[0].kernel.shape[4],this.chunkSize=s,this.isChannelLast=u,this.callbackUI=f}async apply(n){const s=ENV$4.get("WEBGL_DELETE_TEXTURE_THRESHOLD");ENV$4.set("WEBGL_DELETE_TEXTURE_THRESHOLD",0);const u=this;return new Promise(f=>{const m=performance.now(),A=u.model.layers[u.model.layers.length-1],v=A.getWeights()[0],y=A.getWeights()[1],T=u.isChannelLast?n.shape.slice(1,-1):n.shape.slice(2);let E=mul(ones(T),-1e4),S=zeros$1(T),I=0;console.log(" channel loop");const e=window.setInterval(async function(){engine().startScope(),console.log("=======================");const F=await memory();console.log(`| Number of Tensors: ${F.numTensors}`),console.log(`| Number of Data Buffers: ${F.numDataBuffers}`),console.log("Channel : ",I);const M=await tidy(()=>{const V=v.slice([0,0,0,0,I],[-1,-1,-1,-1,1]),B=y.slice([I],[1]),z=processTensorInChunks(n,V,Math.min(u.chunkSize,u.outChannels)).add(B),b=greater$2(z,E),W=where(b,z,E),q=where(b,fill$2(S.shape,I),S);return dispose([E,S,V,B,z,b]),tidy(()=>matMul$1(ones([1,1]),ones([1,1]))),[q,W]});console.log("=======================");const L=await memory();if(u.callbackUI(`Iteration ${I}`,I/u.outChannels),console.log(`Number of Tensors: ${L.numTensors}`),console.log(`Number of Data Buffers: ${L.numDataBuffers}`),console.log(`Megabytes In Use: ${(L.numBytes/1048576).toFixed(3)} MB`),L.unreliable&&console.log(`Unreliable: ${L.unreliable}`),typeof S<"u"&&S.dispose(),typeof E<"u"&&E.dispose(),S=keep(M[0]),E=keep(M[1]),engine().endScope(),I===u.outChannels-1){window.clearInterval(e),dispose(E);const B=performance.now()-m;console.log(`Execution time for output layer: ${B} milliseconds`),ENV$4.set("WEBGL_DELETE_TEXTURE_THRESHOLD",s),f(S)}else{I++;const V=S.shape,B=S.dataSync(),z=S.shape,b=E.dataSync();S.dispose(),E.dispose(),S=tensor(B,V),E=tensor(b,z)}await new Promise(V=>setTimeout(V,300))},0)})}}async function generateOutputSlicesV2(a,n,s,u,f,m,A,v,y,T){if(y.isPostProcessEnable){const I=new BWLabeler,e=new Uint32Array(n),F=26,M=!0,L=!0,[V,B]=I.bwlabel(a,e,F,M,L);for(let z=0;z0&&re<=1?e=await applyMriThreshold(u,re):(console.log("No valid crop threshold value"),e=await u.greater([0]).asType("bool"))}else e=await v.greater([0]).asType("bool");console.log(" mask_3d shape : ",e.shape);const F=await whereAsync(e);e.dispose();const M=F.arraySync();let L=m,V=0,B=A,z=0,b=f,W=0;for(let re=0;reM[re][0]?L=M[re][0]:VM[re][1]?B=M[re][1]:zM[re][2]?b=M[re][2]:Where
'),memory().unreliable){const ae="unreliable reasons :"+memory().reasons;y(ae,NaN,ae)}}}async function inferenceFullVolumePhase2(a,n,s,u,f,m,A,v,y,T,E,S){let I=[];console.log(" ---- Start FullVolume inference phase-II ---- "),A.enableQuantileNorm?(console.log("preModel Quantile normalization enabled"),n=await quantileNormalizeVolumeData(n)):(console.log("preModel Min Max normalization enabled"),n=await minMaxNormalizeVolumeData(n));let F;if(m==null){const pe=A.autoThreshold;pe>0&&pe<=1?F=await applyMriThreshold(n,pe):(console.log("No valid crop threshold value"),F=await n.greater([0]).asType("bool"))}else F=m.greater([0]).asType("bool");console.log(" mask_3d shape : ",F.shape);const M=await whereAsync(F);F.dispose();const L=M.arraySync();let V=u,B=0,z=f,b=0,W=s,q=0;for(let pe=0;peL[pe][0]?V=L[pe][0]:BL[pe][1]?z=L[pe][1]:bL[pe][2]?W=L[pe][2]:qhere')}}async function inferenceFullVolumePhase1(a,n,s,u,f,m,A,v,y,T,E,S){if(v.No_SubVolumes=1,A.preModelId){const I=await load_model(y.rootURL+inferenceModelsList[A.preModelId-1].path),e=inferenceModelsList[A.preModelId-1].enableTranspose,F=inferenceModelsList[A.preModelId-1].enableQuantileNorm;let M=null;F?(console.log("preModel Quantile normalization enabled"),M=await quantileNormalizeVolumeData(n)):(console.log("preModel Min Max normalization enabled"),M=await minMaxNormalizeVolumeData(n)),e?(M=await M.transpose(),console.log("Input transposed for pre-model")):console.log("Transpose not enabled for pre-model"),v.Brainchop_Ver="PreModel_FV";const L=await I;try{const V=performance.now(),B=L,z=B.layers[0].batchInputShape;if(console.log(" Pre-Model batch input shape : ",z),z.length!==5){const Se="The pre-model input shape must be 5D ";return E(Se,-1,Se),0}const b=isModelChnlLast(B),W=y.batchSize,q=y.numOfChan;let Y,X,H,g;if(b){if(console.log("Pre-Model Channel Last"),isNaN(z[4])||z[4]!==1){const Se="The number of channels for pre-model input shape must be 1";return E(Se,-1,Se),0}Y=z[1],X=z[2],H=z[3],g=[W,Y,X,H,q]}else{if(console.log("Pre-Model Channel First"),isNaN(z[1])||z[1]!==1){const Se="The number of channels for pre-model input shape must be 1";return E(Se,-1,Se),0}Y=z[2],X=z[3],H=z[4],g=[W,q,Y,X,H]}v.Input_Shape=JSON.stringify(g),v.Output_Shape=JSON.stringify(B.output.shape),v.Channel_Last=b,v.Model_Param=await getModelNumParameters(B),v.Model_Layers=await getModelNumLayers(B);let J=0;const re=inferenceModelsList[A.preModelId-1].inferenceDelay;let ae=1;const fe=L.layers.length,pe=[];pe[0]=M.reshape(g),dispose(M);const me=window.setInterval(async function(){try{pe[ae]=L.layers[ae].apply(pe[ae-1])}catch(Se){const ve="Your graphics card (e.g. Intel) may not be compatible with WebGL. "+Se.message;return E(ve,-1,ve),window.clearInterval(me),engine().endScope(),engine().disposeVariables(),v.Inference_t=1/0,v.Postprocess_t=1/0,v.Status="Fail",v.Error_Type=Se.message,v.Extra_Err_Info="PreModel Failed while model layer "+ae+" apply",E("",-1,"",v),0}if(L.layers[ae].dispose(),pe[ae-1].dispose(),E("Layer "+ae.toString(),(ae+1)/fe),memory().unreliable){const Se="unreliable reasons :"+memory().reasons;E(Se,NaN,Se)}if(ae===fe-1){window.clearInterval(me);const Se=b?-1:1;console.log(" find argmax "),console.log("last Tensor shape : ",pe[ae].shape);const ve=b?pe[ae].shape[4]:pe[ae].shape[1];let we;try{console.log(" Try tf.argMax for fullVolume .."),we=await argMax$2(pe[ae],Se)}catch(pt){if(Se===-1)try{const It=performance.now();console.log(" tf.argMax failed .. try argMaxLarge ..");const Lt=tensor2LightBuffer(pe[ae].reshape([s,u,f,ve]),"float16");we=argMaxLarge(Lt,s,u,f,ve,"float16"),console.log("argMaxLarge for fullVolume takes : ",((performance.now()-It)/1e3).toFixed(4))}catch(It){const Lt="argMax buffer couldn't be created due to limited memory resources.";return E(Lt,-1,Lt),we.dispose(),window.clearInterval(me),engine().endScope(),engine().disposeVariables(),v.Inference_t=1/0,v.Postprocess_t=1/0,v.Status="Fail",v.Error_Type=It.message,v.Extra_Err_Info="preModel prediction_argmax from argMaxLarge failed",E("",-1,"",v),0}else{const It="argMax buffer couldn't be created due to limited memory resources.";return E(It,-1,It),we.dispose(),window.clearInterval(me),engine().endScope(),engine().disposeVariables(),v.Inference_t=1/0,v.Postprocess_t=1/0,v.Status="Fail",v.Error_Type=pt.message,v.Extra_Err_Info="preModel prediction_argmax from argMaxLarge not support yet channel first",E("",-1,"",v),0}}console.log(" Pre-model prediction_argmax shape : ",we.shape);const Ne=((performance.now()-V)/1e3).toFixed(4);dispose(pe[ae]),console.log(" Pre-model find array max ");const De=await we.max().dataSync()[0];Jhere')}}else console.log("--- No pre-model is selected ---"),console.log("------ Run voxel cropping ------"),m?A.enableSeqConv?(console.log("------ Seq Convoluton ------"),await inferenceFullVolumeSeqCovLayerPhase2(y,A,a,n,s,u,f,null,E,T,v,S)):inferenceFullVolumePhase2(a,n,s,u,f,null,A,v,y,T,E,S):inferenceSubVolumes(a,n,s,u,f,null)}async function enableProductionMode(a=!0){await enableProdMode(),env().set("DEBUG",!1),env().set("WEBGL_FORCE_F16_TEXTURES",a),env().set("WEBGL_DELETE_TEXTURE_THRESHOLD",0),await ready(),console.log("tf env() flags :",env().flags),console.log("tf env() features :",env().features),console.log("tf env total features: ",Object.keys(env().features).length),console.log(getBackend())}async function runInference(a,n,s,u,f,m){const A=[];A.startTime=Date.now(),m("Segmentation started",0),performance.now();const v=a.batchSize,y=a.numOfChan;if(isNaN(v)||v!==1){const H="The batch Size for input shape must be 1";return m(H,-1,H),0}if(isNaN(y)||y!==1){const H="The number of channels for input shape must be 1";return m(H,-1,H),0}engine().startScope(),console.log("Batch size: ",v),console.log("Num of Channels: ",y);const T=await load_model(a.rootURL+n.path);await enableProductionMode(!0),A.TF_Backend=getBackend();const E=T;let S=[];if(S=E.layers[0].batchInputShape,console.log(" Model batch input shape : ",S),S.length!==5){const H="The model input shape must be 5D";return m(H,-1,H),0}let I,e,F;const M=s.dims[1],L=s.dims[2],V=s.dims[3];if(await isModelChnlLast(E)){if(console.log("Model Channel Last"),isNaN(S[4])||S[4]!==1){const H="The number of channels for input shape must be 1";return m(H,-1,H),0}I=S[1],e=S[2],F=S[3]}else{if(console.log("Model Channel First"),isNaN(S[1])||S[1]!==1){const H="The number of channels for input shape must be 1";return m(H,-1,H),0}I=S[2],e=S[3],F=S[4]}let z;I===256&&e===256&&F===256?z=!0:z=!1,A.isModelFullVol=z;let b=await getAllSlicesData1D(V,s,u);const W=await getAllSlices2D(b,L,M);b=null;let q=await getSlices3D(W);dispose(W);const Y=n.enableTranspose,X=n.enableCrop;z&&(X?await inferenceFullVolumePhase1(T,q,V,L,M,z,n,A,a,f,m,u):(console.log("Cropping Disabled"),Y?(q=q.transpose(),console.log("Input transposed")):console.log("Transpose NOT Enabled"),n.enableSeqConv?(console.log("Seq Convoluton Enabled"),await inferenceFullVolumeSeqCovLayer()):(console.log("Seq Convoluton Disabled"),await inferenceFullVolume())))}async function detectBrowser(){return navigator.userAgent.indexOf("OPR/")>-1?"Opera":navigator.userAgent.indexOf("Edg/")>-1?"Edge":navigator.userAgent.indexOf("Falkon/")>-1?"Falkon":navigator.userAgent.indexOf("Chrome/")>-1?"Chrome":navigator.userAgent.indexOf("Firefox/")>-1?"Firefox":navigator.userAgent.indexOf("Safari/")>-1?"Safari":navigator.userAgent.indexOf("MSIE/")>-1||navigator.userAgent.indexOf("rv:")>-1?"IExplorer":"Unknown"}async function detectBrowserVersion(){return navigator.userAgent.indexOf("OPR/")>-1?parseInt(navigator.userAgent.split("OPR/")[1]):navigator.userAgent.indexOf("Edg/")>-1?parseInt(navigator.userAgent.split("Edg/")[1]):navigator.userAgent.indexOf("Falkon/")>-1?parseInt(navigator.userAgent.split("Falkon/")[1]):navigator.userAgent.indexOf("Chrome/")>-1?parseInt(navigator.userAgent.split("Chrome/")[1]):navigator.userAgent.indexOf("Firefox/")>-1?parseInt(navigator.userAgent.split("Firefox/")[1]):navigator.userAgent.indexOf("Safari/")>-1?parseInt(navigator.userAgent.split("Safari/")[1]):navigator.userAgent.indexOf("MSIE/")>-1||navigator.userAgent.indexOf("rv:")>-1?parseInt(navigator.userAgent.split("MSIE/")[1]):1/0}async function detectOperatingSys(){return navigator.userAgent.indexOf("Win")>-1?"Windows":navigator.userAgent.indexOf("Mac")>-1?"MacOS":navigator.userAgent.indexOf("Linux")>-1?"Linux":navigator.userAgent.indexOf("UNIX")>-1?"UNIX":"Unknown"}async function checkWebGl2(a){return a?(console.log("WebGl2 is enabled"),!0):(console.log(typeof WebGL2RenderingContext<"u"?"WebGL2 may be disabled. Please try updating video card drivers":"WebGL2 is not supported"),!1)}async function detectGPUVendor(a){let n;if(a&&(n=a.getExtension("WEBGL_debug_renderer_info"),n)){const s=a.getParameter(n.UNMASKED_VENDOR_WEBGL);return s.indexOf("(")>-1&&s.indexOf(")")>-1?s.substring(s.indexOf("(")+1,s.indexOf(")")):s}return null}async function detectGPUVendor_v0(a){if(a){const n=a.getExtension("WEBGL_debug_renderer_info");return n?a.getParameter(n.UNMASKED_VENDOR_WEBGL):null}else return null}async function detectGPUCardType_v0(a){if(a){if(detectBrowser()==="Firefox")return a.getParameter(a.RENDERER);const n=a.getExtension("WEBGL_debug_renderer_info");return n?a.getParameter(n.UNMASKED_RENDERER_WEBGL):null}else return null}async function detectGPUCardType(a){let n;if(a){if(detectBrowser()==="Firefox")return a.getParameter(a.RENDERER);if(n=a.getExtension("WEBGL_debug_renderer_info"),n){let s=a.getParameter(n.UNMASKED_RENDERER_WEBGL);return s.indexOf("(")>-1&&s.indexOf(")")>-1&&s.indexOf("(R)")===-1&&(s=s.substring(s.indexOf("(")+1,s.indexOf(")")),s.split(",").length===3)?s.split(",")[1].trim():s}}return null}async function getCPUNumCores(){return navigator.hardwareConcurrency}async function isChrome(){return/Chrome/.test(navigator.userAgent)&&/Google Inc/.test(navigator.vendor)}async function localSystemDetails(a,n=null){const s=new Date;if(a.isModelFullVol?a.Brainchop_Ver="FullVolume":a.Brainchop_Ver="SubVolumes",a.Total_t=(Date.now()-a.startTime)/1e3,delete a.startTime,a.Date=parseInt(s.getMonth()+1)+"/"+s.getDate()+"/"+s.getFullYear(),a.Browser=await detectBrowser(),a.Browser_Ver=await detectBrowserVersion(),a.OS=await detectOperatingSys(),a.WebGL2=await checkWebGl2(n),a.GPU_Vendor=await detectGPUVendor(n),a.GPU_Card=await detectGPUCardType(n),a.GPU_Vendor_Full=await detectGPUVendor_v0(n),a.GPU_Card_Full=await detectGPUCardType_v0(n),a.CPU_Cores=await getCPUNumCores(),a.Which_Brainchop="latest",await isChrome()&&(a.Heap_Size_MB=window.performance.memory.totalJSHeapSize/(1024*1024).toFixed(2),a.Used_Heap_MB=window.performance.memory.usedJSHeapSize/(1024*1024).toFixed(2),a.Heap_Limit_MB=window.performance.memory.jsHeapSizeLimit/(1024*1024).toFixed(2)),n){console.log("MAX_TEXTURE_SIZE :",n.getParameter(n.MAX_TEXTURE_SIZE)),console.log("MAX_RENDERBUFFER_SIZE :",n.getParameter(n.MAX_RENDERBUFFER_SIZE));const u=n.getExtension("WEBGL_debug_renderer_info");console.log("VENDOR WEBGL:",n.getParameter(u.UNMASKED_VENDOR_WEBGL)),a.Texture_Size=n.getParameter(n.MAX_TEXTURE_SIZE)}else a.Texture_Size=null;return a}function WorkerWrapper(a){return new Worker(""+new URL("brainchop-webworker-DDjdSg4F.js",import.meta.url).href,{name:a==null?void 0:a.name})}async function main(){dragMode.onchange=async function(){S.opts.dragMode=this.selectedIndex},drawDrop.onchange=async function(){if(S.volumes.length<2){window.alert("No segmentation open (use the Segmentation pull down)"),drawDrop.selectedIndex=-1;return}if(!S.drawBitmap){window.alert("No drawing (hint: use the Draw pull down to select a pen)"),drawDrop.selectedIndex=-1;return}const I=parseInt(this.value);if(I===0){S.drawUndo(),drawDrop.selectedIndex=-1;return}let e=S.volumes[1].img,F=await S.saveImage({filename:"",isSaveDrawing:!0});const M=352,L=F.length;if(I===1)for(let V=0;V0&&(e[V]=1);if(I===2)for(let V=0;V0&&(e[V]=0);S.closeDrawing(),S.updateGLVolume(),S.setDrawingEnabled(!1),penDrop.selectedIndex=-1,drawDrop.selectedIndex=-1},penDrop.onchange=async function(){const I=parseInt(this.value);S.setDrawingEnabled(I>=0),I>=0&&S.setPenValue(I&7,I>7)},aboutBtn.onclick=function(){window.alert("Drag and drop NIfTI images. Use pulldown menu to choose brainchop model")},diagnosticsBtn.onclick=function(){if(T.length<1){window.alert("No diagnostic string generated: run a model to create diagnostics");return}navigator.clipboard.writeText(T),window.alert(`Diagnostics copied to clipboard + */const kernelConfigs=[_fusedMatMulConfig,absConfig,acosConfig,acoshConfig,addConfig,addNConfig,allConfig,anyConfig,argMaxConfig,argMinConfig,asinConfig,asinhConfig,atanConfig,atan2Config,atanhConfig,avgPoolConfig,avgPool3DConfig,avgPool3DGradConfig,avgPoolGradConfig,batchMatMulConfig,batchNormConfig,batchToSpaceNDConfig,bincountConfig,bitwiseAndConfig,broadcastArgsConfig,castConfig,ceilConfig,clipByValueConfig,complexConfig,complexAbsConfig,concatConfig,conv2DConfig,conv2DBackpropFilterConfig,conv2DBackpropInputConfig,conv3DConfig,conv3DBackpropFilterV2Config,conv3DBackpropInputConfig,cosConfig,coshConfig,cropAndResizeConfig,cumprodConfig,cumsumConfig,denseBincountConfig,depthToSpaceConfig,depthwiseConv2dNativeConfig,depthwiseConv2dNativeBackpropFilterConfig,depthwiseConv2dNativeBackpropInputConfig,diagConfig,dilation2DConfig,einsumConfig,eluConfig,eluGradConfig,equalConfig,erfConfig,expConfig,expandDimsConfig,expm1Config,fftConfig,fillConfig,flipLeftRightConfig,floorConfig,floorDivConfig,fromPixelsConfig,fusedConv2DConfig,fusedDepthwiseConv2DConfig,gatherNdConfig,gatherV2Config,greaterConfig,greaterEqualConfig,identityConfig,ifftConfig,imagConfig,isFiniteConfig,isInfConfig,isNaNConfig,leakyReluConfig,lessConfig,lessEqualConfig,linSpaceConfig,logConfig,log1pConfig,logicalAndConfig,logicalNotConfig,logicalOrConfig,LRNConfig,LRNGradConfig,maxConfig,maximumConfig,maxPoolConfig,maxPool3DConfig,maxPool3DGradConfig,maxPoolGradConfig,maxPoolWithArgmaxConfig,meanConfig,minConfig,minimumConfig,mirrorPadConfig,modConfig,multinomialConfig,multiplyConfig,negConfig,nonMaxSuppressionV3Config,nonMaxSuppressionV4Config,nonMaxSuppressionV5Config,notEqualConfig,oneHotConfig,onesLikeConfig,packConfig,padV2Config,powConfig,preluConfig,prodConfig,raggedGatherConfig,raggedRangeConfig,raggedTensorToTensorConfig,rangeConfig,realConfig,realDivConfig,reciprocalConfig,reluConfig,relu6Config,reshapeConfig,resizeBilinearConfig,resizeBilinearGradConfig,resizeNearestNeighborConfig,resizeNearestNeighborGradConfig,reverseConfig,rotateWithOffsetConfig,roundConfig,rsqrtConfig,scatterNdConfig,searchSortedConfig,selectConfig,seluConfig,sigmoidConfig,signConfig,sinConfig,sinhConfig,sliceConfig,softmaxConfig,softplusConfig,spaceToBatchNDConfig,sparseFillEmptyRowsConfig,sparseReshapeConfig,sparseSegmentMeanConfig,sparseSegmentSumConfig,sparseToDenseConfig,splitVConfig,sqrtConfig,squareConfig,squaredDifferenceConfig,staticRegexReplaceConfig,stepConfig,stridedSliceConfig,stringNGramsConfig,stringSplitConfig,stringToHashBucketFastConfig,subConfig,sumConfig,tanConfig,tanhConfig,tensorScatterUpdateConfig,tileConfig,topKConfig,transformConfig,transposeConfig,uniqueConfig,unpackConfig,unsortedSegmentSumConfig,zerosLikeConfig];for(const a of kernelConfigs)registerKernel(a);class BWLabeler{idx(n,s,u,f){return u*f[0]*f[1]+s*f[0]+n}check_previous_slice(n,s,u,f,m,A,v,y,T,E){let S=0;if(!m)return 0;const I=n[this.idx(u,f,m,A)];if(v>=6){const e=this.idx(u,f,m-1,A);I===n[e]&&(T[S++]=s[e])}if(v>=18){if(u){const e=this.idx(u-1,f,m-1,A);I===n[e]&&(T[S++]=s[e])}if(f){const e=this.idx(u,f-1,m-1,A);I===n[e]&&(T[S++]=s[e])}if(u=6){if(F){const V=this.idx(F-1,e,I,s);L===n[V]&&(S[M++]=E[V])}if(e){const V=this.idx(F,e-1,I,s);L===n[V]&&(S[M++]=E[V])}}if(u>=18){if(e&&F){const V=this.idx(F-1,e-1,I,s);L===n[V]&&(S[M++]=E[V])}if(e&&F=y){y+=v;const V=new Uint32Array(y);V.set(T),T=V}T[A-1]=A,A++}}}for(let I=0;I.",inferenceDelay:100,description:"Gray and white matter segmentation model. Operates on full T1 image in a single pass but needs a dedicated graphics card to operate. Provides the best accuracy with hard cropping for better speed"},{id:3,type:"Segmentation",path:"/models/model20chan3cls/model.json",modelName:"🔪 Tissue GWM (High Acc, Low Mem)",labelsPath:"./models/model20chan3cls/labels.json",colorsPath:"./models/model20chan3cls/colorLUT.json",colormapPath:"./models/model20chan3cls/colormap.json",preModelId:null,preModelPostProcess:!1,isBatchOverlapEnable:!1,numOverlapBatches:0,enableTranspose:!0,enableCrop:!0,cropPadding:0,autoThreshold:.2,enableQuantileNorm:!0,filterOutWithPreMask:!1,enableSeqConv:!0,textureSize:0,warning:"This model may need dedicated graphics card. For more info please check with Browser Resources .",inferenceDelay:100,description:"Gray and white matter segmentation model. Operates on full T1 image in a single pass but needs a dedicated graphics card to operate. Provides high accuracy and fit low memory available but slower"},{id:4,type:"Atlas",path:"/models/model30chan18cls/model.json",modelName:"🪓 Subcortical + GWM (High Mem, Fast)",labelsPath:"./models/model30chan18cls/labels.json",colorsPath:"./models/model30chan18cls/colorLUT.json",colormapPath:"./models/model30chan18cls/colormap.json",preModelId:null,preModelPostProcess:!1,isBatchOverlapEnable:!1,numOverlapBatches:200,enableTranspose:!0,enableCrop:!0,cropPadding:0,autoThreshold:.2,enableQuantileNorm:!1,filterOutWithPreMask:!1,enableSeqConv:!1,textureSize:0,warning:"This model may need dedicated graphics card. For more info please check with Browser Resources .",inferenceDelay:100,description:"Parcellation of the brain into 17 regions: gray and white matter plus subcortical areas. This is a robust model able to handle range of data quality, including varying saturation, and even clinical scans. It may work on infant brains, but your mileage may vary."},{id:5,type:"Atlas",path:"/models/model30chan18cls/model.json",modelName:"🪓 Subcortical + GWM (Low Mem, Slow)",labelsPath:"./models/model30chan18cls/labels.json",colorsPath:"./models/model30chan18cls/colorLUT.json",colormapPath:"./models/model30chan18cls/colormap.json",preModelId:null,preModelPostProcess:!1,isBatchOverlapEnable:!1,numOverlapBatches:200,enableTranspose:!0,enableCrop:!0,cropPadding:0,autoThreshold:.2,enableQuantileNorm:!1,filterOutWithPreMask:!1,enableSeqConv:!0,textureSize:0,warning:"This model may need dedicated graphics card. For more info please check with Browser Resources .",inferenceDelay:100,description:"Parcellation of the brain into 17 regions: gray and white matter plus subcortical areas. This is a robust model able to handle range of data quality, including varying saturation, and even clinical scans. It may work on infant brains, but your mileage may vary."},{id:6,type:"Atlas",path:"/models/model18cls/model.json",modelName:"🪓 Subcortical + GWM (Low Mem, Faster)",labelsPath:"./models/model18cls/labels.json",colorsPath:"./models/model18cls/colorLUT.json",colormapPath:"./models/model18cls/colormap.json",preModelId:null,preModelPostProcess:!1,isBatchOverlapEnable:!1,numOverlapBatches:200,enableTranspose:!0,enableCrop:!0,cropPadding:0,autoThreshold:.2,enableQuantileNorm:!1,filterOutWithPreMask:!1,enableSeqConv:!0,textureSize:0,warning:"This model may need dedicated graphics card. For more info please check with Browser Resources .",inferenceDelay:100,description:"Parcellation of the brain into 17 regions: gray and white matter plus subcortical areas. This is a robust model able to handle range of data quality, including varying saturation, and even clinical scans. It may work on infant brains, but your mileage may vary."},{id:7,type:"Atlas",path:"/models/model30chan18cls/model.json",modelName:"🔪🪓 Subcortical + GWM (Failsafe, Less Acc)",labelsPath:"./models/model30chan18cls/labels.json",colorsPath:"./models/model30chan18cls/colorLUT.json",colormapPath:"./models/model30chan18cls/colormap.json",preModelId:1,preModelPostProcess:!1,isBatchOverlapEnable:!1,numOverlapBatches:200,enableTranspose:!0,enableCrop:!0,cropPadding:0,autoThreshold:0,enableQuantileNorm:!1,filterOutWithPreMask:!1,enableSeqConv:!1,textureSize:0,warning:"This model may need dedicated graphics card. For more info please check with Browser Resources .",inferenceDelay:100,description:"Parcellation of the brain into 17 regions: gray and white matter plus subcortical areas. This is not a robust model, it may work on low data quality, including varying saturation, and even clinical scans. It may work also on infant brains, but your mileage may vary."},{id:8,type:"Atlas",path:"/models/model30chan50cls/model.json",modelName:"🔪 Aparc+Aseg 50 (High Mem, Fast)",labelsPath:"./models/model30chan50cls/labels.json",colorsPath:"./models/model30chan50cls/colorLUT.json",colormapPath:"./models/model30chan50cls/colormap.json",preModelId:1,preModelPostProcess:!1,isBatchOverlapEnable:!1,numOverlapBatches:200,enableTranspose:!0,enableCrop:!0,cropPadding:0,autoThreshold:0,enableQuantileNorm:!0,filterOutWithPreMask:!1,enableSeqConv:!1,textureSize:0,warning:"This model may need dedicated graphics card. For more info please check with Browser Resources .",inferenceDelay:100,description:"This is a 50-class model, that segments the brain into the Aparc+Aseg Freesurfer Atlas but one where cortical homologues are merged into a single class."},{id:9,type:"Atlas",path:"/models/model30chan50cls/model.json",modelName:"🔪 Aparc+Aseg 50 (Low Mem, Slow)",labelsPath:"./models/model30chan50cls/labels.json",colorsPath:"./models/model30chan50cls/colorLUT.json",colormapPath:"./models/model30chan50cls/colormap.json",preModelId:1,preModelPostProcess:!1,isBatchOverlapEnable:!1,numOverlapBatches:200,enableTranspose:!0,enableCrop:!0,cropPadding:0,autoThreshold:0,enableQuantileNorm:!0,filterOutWithPreMask:!1,enableSeqConv:!0,textureSize:0,warning:"This model may need dedicated graphics card. For more info please check with Browser Resources .",inferenceDelay:100,description:"This is a 50-class model, that segments the brain into the Aparc+Aseg Freesurfer Atlas but one where cortical homologues are merged into a single class. The model use sequential convolution for inference to overcome browser memory limitations but leads to longer computation time."},{id:10,type:"Brain_Extraction",path:"/models/model5_gw_ae/model.json",modelName:"⚡ Extract the Brain (FAST)",labelsPath:null,colorsPath:null,preModelId:null,preModelPostProcess:!1,isBatchOverlapEnable:!1,numOverlapBatches:0,enableTranspose:!0,enableCrop:!0,cropPadding:18,autoThreshold:0,enableQuantileNorm:!1,filterOutWithPreMask:!1,enableSeqConv:!1,textureSize:0,warning:null,inferenceDelay:100,description:"Extract the brain fast model operates on full T1 image in a single pass, but uses only 5 filters per layer. Can work on integrated graphics cards but is barely large enough to provide good accuracy. Still more accurate than the failsafe version."},{id:11,type:"Brain_Extraction",path:"/models/model11_gw_ae/model.json",modelName:"🔪 Extract the Brain (High Acc, Slow)",labelsPath:null,colorsPath:null,preModelId:null,preModelPostProcess:!1,isBatchOverlapEnable:!1,numOverlapBatches:0,enableTranspose:!0,enableCrop:!0,cropPadding:0,autoThreshold:0,enableQuantileNorm:!1,filterOutWithPreMask:!1,enableSeqConv:!0,textureSize:0,warning:"This model may need dedicated graphics card. For more info please check with Browser Resources .",inferenceDelay:100,description:"Extract the brain high accuracy model operates on full T1 image in a single pass, but uses only 11 filters per layer. Can work on dedicated graphics cards. Still more accurate than the fast version."},{id:12,type:"Brain_Masking",path:"/models/model5_gw_ae/model.json",modelName:"⚡ Brain Mask (FAST)",labelsPath:null,colorsPath:null,colormapPath:"./models/model5_gw_ae/colormap.json",preModelId:null,preModelPostProcess:!1,isBatchOverlapEnable:!1,numOverlapBatches:0,enableTranspose:!0,enableCrop:!0,cropPadding:17,autoThreshold:0,enableQuantileNorm:!1,filterOutWithPreMask:!1,enableSeqConv:!1,textureSize:0,warning:null,inferenceDelay:100,description:"This fast masking model operates on full T1 image in a single pass, but uses only 5 filters per layer. Can work on integrated graphics cards but is barely large enough to provide good accuracy. Still more accurate than failsafe version."},{id:13,type:"Brain_Masking",path:"/models/model11_gw_ae/model.json",modelName:"🔪 Brain Mask (High Acc, Low Mem)",labelsPath:null,colorsPath:null,preModelId:null,preModelPostProcess:!1,isBatchOverlapEnable:!1,numOverlapBatches:0,enableTranspose:!0,enableCrop:!0,cropPadding:0,autoThreshold:0,enableQuantileNorm:!0,filterOutWithPreMask:!1,enableSeqConv:!0,textureSize:0,warning:"This model may need dedicated graphics card. For more info please check with Browser Resources .",inferenceDelay:100,description:"This masking model operates on full T1 image in a single pass, but uses 11 filters per layer. Can work on dedicated graphics cards. Still more accurate than fast version."},{id:14,type:"Atlas",path:"/models/model21_104class/model.json",modelName:"🔪 Aparc+Aseg 104 (High Mem, Fast)",labelsPath:"./models/model21_104class/labels.json",colorsPath:"./models/model21_104class/colorLUT.json",colormapPath:"./models/model21_104class/colormap.json",preModelId:1,preModelPostProcess:!1,isBatchOverlapEnable:!1,numOverlapBatches:200,enableTranspose:!0,enableCrop:!0,cropPadding:0,autoThreshold:0,enableQuantileNorm:!1,filterOutWithPreMask:!1,enableSeqConv:!1,textureSize:0,warning:"This model may need dedicated graphics card. For more info please check with Browser Resources .",inferenceDelay:100,description:"FreeSurfer aparc+aseg atlas 104 parcellate brain areas into 104 regions. It contains a combination of the Desikan-Killiany atlas for cortical area and also segmentation of subcortical regions."},{id:15,type:"Atlas",path:"/models/model21_104class/model.json",modelName:"🔪 Aparc+Aseg 104 (Low Mem, Slow)",labelsPath:"./models/model21_104class/labels.json",colorsPath:"./models/model21_104class/colorLUT.json",colormapPath:"./models/model21_104class/colormap.json",preModelId:1,preModelPostProcess:!1,isBatchOverlapEnable:!1,numOverlapBatches:200,enableTranspose:!0,enableCrop:!0,cropPadding:0,autoThreshold:0,enableQuantileNorm:!1,filterOutWithPreMask:!1,enableSeqConv:!0,textureSize:0,warning:"This model may need dedicated graphics card. For more info please check with Browser Resources .",inferenceDelay:100,description:"FreeSurfer aparc+aseg atlas 104 parcellate brain areas into 104 regions. It contains a combination of the Desikan-Killiany atlas for cortical area and also segmentation of subcortical regions. The model use sequential convolution for inference to overcome browser memory limitations but leads to longer computation time. "}];async function getModelNumParameters(a){let n=0;for(let s=0;se-F);const m=tensor1d(f),A=m.shape[0],v=Math.floor(A*n),y=Math.ceil(A*s)-1,T=m.slice(v,1),E=m.slice(y,1),S=(await T.array())[0],I=(await E.array())[0];return u.dispose(),m.dispose(),T.dispose(),E.dispose(),{qmin:S,qmax:I}}async function quantileNormalizeVolumeData(a,n=.05,s=.95){const{qmin:u,qmax:f}=await calculateQuantiles(a,n,s),m=scalar(u),A=scalar(f),v=a.sub(m).div(A.sub(m));return m.dispose(),A.dispose(),v}async function minMaxNormalizeVolumeData(a){const n=a.max(),s=a.min();return await a.sub(s).div(n.sub(s))}async function inferenceFullVolumeSeqCovLayer(a,n,s,u,f,m,A){window.alert("inferenceFullVolumeSeqCovLayer() is not dead code?")}async function inferenceFullVolume(a,n,s,u,f,m,A){window.alert("inferenceFullVolume() is not dead code?")}async function inferenceSubVolumes(a,n,s,u,f,m=null){window.alert("inferenceSubVolumes() is not dead code?")}async function tensor2LightBuffer(a,n){window.alert("tensor2LightBuffer() is not dead code?")}async function draw3dObjBoundingVolume(a){window.alert("draw3dObjBoundingVolume() is not dead code?")}async function argMaxLarge(a,n,s,u,f,m="float32"){window.alert("argMaxLarge() is not dead code?")}async function addZeroPaddingTo3dTensor(a,n=[1,1],s=[1,1],u=[1,1]){if(a.rank!==3)throw new Error("Tensor must be 3D");return a.pad([n,s,u])}async function removeZeroPaddingFrom3dTensor(a,n=1,s=1,u=1){if(a.rank!==3)throw new Error("Tensor must be 3D");const[f,m,A]=a.shape;return a.slice([n,s,u],[f-2*n,m-2*s,A-2*u])}async function resizeWithZeroPadding(a,n,s,u,f,m){const A=f[0],v=f[1],y=f[2],T=A+m[0]-1,E=v+m[1]-1,S=y+m[2]-1,I=s-T-1>0?s-T-1:0,e=u-E-1>0?u-E-1:0,F=n-S-1>0?n-S-1:0;return a.pad([[A,I],[v,e],[y,F]])}async function applyMriThreshold(a,n){const s=a.max(),u=s.mul(n),f=await u.data();return s.dispose(),u.dispose(),tidy(()=>a.clone().greater(f[0]))}async function binarizeVolumeDataTensor(a){return a.step(0)}async function generateBrainMask(a,n,s,u,f,m,A,v,y=!0){a[0].dtype!=="int32"&&A("",-1,"generateBrainMask assumes int32"),f.preModelPostProcess&&A("",-1,"generateBrainMask assumes BWLabeler instead of preModelPostProcess");const T=a.length,E=a[0].size,S=T*E,I=new Int32Array(S);let e=0;for(let F=0;F{const z=a.slice([0,0,0,0,L],[-1,-1,-1,-1,V-L]),b=n.slice([0,0,0,L,E],[-1,-1,-1,V-L,1]);return conv3d(z,b,u,f,"NDHWC",m)});if(e===null)e=B;else{const z=e.add(B);e.dispose(),B.dispose(),e=z}}}const F=e.add(I);if(e.dispose(),I.dispose(),T==null)T=F;else{const M=await concat$2([T,F],4);F.dispose(),T.dispose(),T=M}}return T}function processTensorInChunks(a,n,s){const A=a.shape[4],v=Math.ceil(A/s);let y=null;for(let T=0;Ta.slice([0,0,0,0,E],[-1,-1,-1,-1,I])),F=tidy(()=>n.slice([0,0,0,E,0],[-1,-1,-1,I,-1])),M=conv3d(e,F,1,0,"NDHWC",1);e.dispose(),F.dispose();const L=squeeze(M);if(M.dispose(),y===null)y=L;else{const V=y.add(L);y.dispose(),y!==L&&L.dispose(),y=V}tidy(()=>{matMul$1(zeros$1([1,1]),zeros$1([1,1]))})}return y}class SequentialConvLayer{constructor(n,s,u,f){this.model=n,this.outChannels=n.outputLayers[0].kernel.shape[4],this.chunkSize=s,this.isChannelLast=u,this.callbackUI=f}async apply(n){const s=ENV$4.get("WEBGL_DELETE_TEXTURE_THRESHOLD");ENV$4.set("WEBGL_DELETE_TEXTURE_THRESHOLD",0);const u=this;return new Promise(f=>{const m=performance.now(),A=u.model.layers[u.model.layers.length-1],v=A.getWeights()[0],y=A.getWeights()[1],T=u.isChannelLast?n.shape.slice(1,-1):n.shape.slice(2);let E=mul(ones(T),-1e4),S=zeros$1(T),I=0;console.log(" channel loop");const e=window.setInterval(async function(){engine().startScope();const F=await tidy(()=>{const L=v.slice([0,0,0,0,I],[-1,-1,-1,-1,1]),V=y.slice([I],[1]),B=processTensorInChunks(n,L,Math.min(u.chunkSize,u.outChannels)).add(V),z=greater$2(B,E),b=where(z,B,E),W=where(z,fill$2(S.shape,I),S);return dispose([E,S,L,V,B,z]),tidy(()=>matMul$1(ones([1,1]),ones([1,1]))),[W,b]});console.log("======================="),u.callbackUI(`Iteration ${I}`,I/u.outChannels);const M=await memory();if(console.log(`Number of Tensors: ${M.numTensors}`),console.log(`Number of Data Buffers: ${M.numDataBuffers}`),console.log(`Megabytes In Use: ${(M.numBytes/1048576).toFixed(3)} MB`),M.unreliable&&console.log(`Unreliable: ${M.unreliable}`),typeof S<"u"&&S.dispose(),typeof E<"u"&&E.dispose(),S=keep(F[0]),E=keep(F[1]),engine().endScope(),I===u.outChannels-1){window.clearInterval(e),dispose(E);const V=performance.now()-m;console.log(`Execution time for output layer: ${V} milliseconds`),ENV$4.set("WEBGL_DELETE_TEXTURE_THRESHOLD",s),f(S)}else{I++;const L=S.shape,V=S.dataSync(),B=S.shape,z=E.dataSync();S.dispose(),E.dispose(),S=tensor(V,L),E=tensor(z,B)}await new Promise(L=>setTimeout(L,300))},0)})}}async function generateOutputSlicesV2(a,n,s,u,f,m,A,v,y,T){if(y.isPostProcessEnable){const I=new BWLabeler,e=new Uint32Array(n),F=26,M=!0,L=!0,[V,B]=I.bwlabel(a,e,F,M,L);for(let z=0;z0&&re<=1?e=await applyMriThreshold(u,re):(console.log("No valid crop threshold value"),e=await u.greater([0]).asType("bool"))}else e=await v.greater([0]).asType("bool");console.log(" mask_3d shape : ",e.shape);const F=await whereAsync(e);e.dispose();const M=F.arraySync();let L=m,V=0,B=A,z=0,b=f,W=0;for(let re=0;reM[re][0]?L=M[re][0]:VM[re][1]?B=M[re][1]:zM[re][2]?b=M[re][2]:Where'),memory().unreliable){const ae="unreliable reasons :"+memory().reasons;y(ae,NaN,ae)}}}async function inferenceFullVolumePhase2(a,n,s,u,f,m,A,v,y,T,E,S){let I=[];console.log(" ---- Start FullVolume inference phase-II ---- "),A.enableQuantileNorm?(console.log("preModel Quantile normalization enabled"),n=await quantileNormalizeVolumeData(n)):(console.log("preModel Min Max normalization enabled"),n=await minMaxNormalizeVolumeData(n));let F;if(m==null){const pe=A.autoThreshold;pe>0&&pe<=1?F=await applyMriThreshold(n,pe):(console.log("No valid crop threshold value"),F=await n.greater([0]).asType("bool"))}else F=m.greater([0]).asType("bool");console.log(" mask_3d shape : ",F.shape);const M=await whereAsync(F);F.dispose();const L=M.arraySync();let V=u,B=0,z=f,b=0,W=s,q=0;for(let pe=0;peL[pe][0]?V=L[pe][0]:BL[pe][1]?z=L[pe][1]:bL[pe][2]?W=L[pe][2]:qhere')}}async function inferenceFullVolumePhase1(a,n,s,u,f,m,A,v,y,T,E,S){if(v.No_SubVolumes=1,A.preModelId){const I=await load_model(y.rootURL+inferenceModelsList[A.preModelId-1].path),e=inferenceModelsList[A.preModelId-1].enableTranspose,F=inferenceModelsList[A.preModelId-1].enableQuantileNorm;let M=null;F?(console.log("preModel Quantile normalization enabled"),M=await quantileNormalizeVolumeData(n)):(console.log("preModel Min Max normalization enabled"),M=await minMaxNormalizeVolumeData(n)),e?(M=await M.transpose(),console.log("Input transposed for pre-model")):console.log("Transpose not enabled for pre-model"),v.Brainchop_Ver="PreModel_FV";const L=await I;try{const V=performance.now(),B=L,z=B.layers[0].batchInputShape;if(console.log(" Pre-Model batch input shape : ",z),z.length!==5){const Se="The pre-model input shape must be 5D ";return E(Se,-1,Se),0}const b=isModelChnlLast(B),W=y.batchSize,q=y.numOfChan;let Y,X,Q,g;if(b){if(console.log("Pre-Model Channel Last"),isNaN(z[4])||z[4]!==1){const Se="The number of channels for pre-model input shape must be 1";return E(Se,-1,Se),0}Y=z[1],X=z[2],Q=z[3],g=[W,Y,X,Q,q]}else{if(console.log("Pre-Model Channel First"),isNaN(z[1])||z[1]!==1){const Se="The number of channels for pre-model input shape must be 1";return E(Se,-1,Se),0}Y=z[2],X=z[3],Q=z[4],g=[W,q,Y,X,Q]}v.Input_Shape=JSON.stringify(g),v.Output_Shape=JSON.stringify(B.output.shape),v.Channel_Last=b,v.Model_Param=await getModelNumParameters(B),v.Model_Layers=await getModelNumLayers(B);let J=0;const re=inferenceModelsList[A.preModelId-1].inferenceDelay;let ae=1;const fe=L.layers.length,pe=[];pe[0]=M.reshape(g),dispose(M);const me=window.setInterval(async function(){try{pe[ae]=await L.layers[ae].apply(pe[ae-1])}catch(Se){const ve="Your graphics card (e.g. Intel) may not be compatible with WebGL. "+Se.message;return E(ve,-1,ve),window.clearInterval(me),engine().endScope(),engine().disposeVariables(),v.Inference_t=1/0,v.Postprocess_t=1/0,v.Status="Fail",v.Error_Type=Se.message,v.Extra_Err_Info="PreModel Failed while model layer "+ae+" apply",E("",-1,"",v),0}if(L.layers[ae].dispose(),pe[ae-1].dispose(),E("Layer "+ae.toString(),(ae+1)/fe),memory().unreliable){const Se="unreliable reasons :"+memory().reasons;E(Se,NaN,Se)}if(ae===fe-1){window.clearInterval(me);const Se=b?-1:1;console.log(" find argmax "),console.log("last Tensor shape : ",pe[ae].shape);const ve=b?pe[ae].shape[4]:pe[ae].shape[1];let we;try{console.log(" Try tf.argMax for fullVolume .."),we=await argMax$2(pe[ae],Se)}catch(pt){if(Se===-1)try{const It=performance.now();console.log(" tf.argMax failed .. try argMaxLarge ..");const Lt=tensor2LightBuffer(pe[ae].reshape([s,u,f,ve]),"float16");we=argMaxLarge(Lt,s,u,f,ve,"float16"),console.log("argMaxLarge for fullVolume takes : ",((performance.now()-It)/1e3).toFixed(4))}catch(It){const Lt="argMax buffer couldn't be created due to limited memory resources.";return E(Lt,-1,Lt),we.dispose(),window.clearInterval(me),engine().endScope(),engine().disposeVariables(),v.Inference_t=1/0,v.Postprocess_t=1/0,v.Status="Fail",v.Error_Type=It.message,v.Extra_Err_Info="preModel prediction_argmax from argMaxLarge failed",E("",-1,"",v),0}else{const It="argMax buffer couldn't be created due to limited memory resources.";return E(It,-1,It),we.dispose(),window.clearInterval(me),engine().endScope(),engine().disposeVariables(),v.Inference_t=1/0,v.Postprocess_t=1/0,v.Status="Fail",v.Error_Type=pt.message,v.Extra_Err_Info="preModel prediction_argmax from argMaxLarge not support yet channel first",E("",-1,"",v),0}}console.log(" Pre-model prediction_argmax shape : ",we.shape);const Ne=((performance.now()-V)/1e3).toFixed(4);dispose(pe[ae]),console.log(" Pre-model find array max ");const De=await we.max().dataSync()[0];Jhere')}}else console.log("--- No pre-model is selected ---"),console.log("------ Run voxel cropping ------"),m?A.enableSeqConv?(console.log("------ Seq Convoluton ------"),await inferenceFullVolumeSeqCovLayerPhase2(y,A,a,n,s,u,f,null,E,T,v,S)):inferenceFullVolumePhase2(a,n,s,u,f,null,A,v,y,T,E,S):inferenceSubVolumes(a,n,s,u,f,null)}async function enableProductionMode(a=!0){await enableProdMode(),env().set("DEBUG",!1),env().set("WEBGL_FORCE_F16_TEXTURES",a),env().set("WEBGL_DELETE_TEXTURE_THRESHOLD",0),await ready(),console.log("tf env() flags :",env().flags),console.log("tf env() features :",env().features),console.log("tf env total features: ",Object.keys(env().features).length),console.log(getBackend())}async function runInference(a,n,s,u,f,m){const A=[];A.startTime=Date.now(),m("Segmentation started",0),performance.now();const v=a.batchSize,y=a.numOfChan;if(isNaN(v)||v!==1){const Y="The batch Size for input shape must be 1";return m(Y,-1,Y),0}if(isNaN(y)||y!==1){const Y="The number of channels for input shape must be 1";return m(Y,-1,Y),0}engine().startScope(),console.log("Batch size: ",v),console.log("Num of Channels: ",y);const T=await load_model(a.rootURL+n.path);await enableProductionMode(!0),A.TF_Backend=getBackend(),m("Segmentation mork",0);const E=T;let S=[];if(S=E.layers[0].batchInputShape,console.log(" Model batch input shape : ",S),S.length!==5){const Y="The model input shape must be 5D";return m(Y,-1,Y),0}let I,e,F;const M=s.dims[1],L=s.dims[2],V=s.dims[3];if(await isModelChnlLast(E)){if(console.log("Model Channel Last"),isNaN(S[4])||S[4]!==1){const Y="The number of channels for input shape must be 1";return m(Y,-1,Y),0}I=S[1],e=S[2],F=S[3]}else{if(console.log("Model Channel First"),isNaN(S[1])||S[1]!==1){const Y="The number of channels for input shape must be 1";return m(Y,-1,Y),0}I=S[2],e=S[3],F=S[4]}let z;I===256&&e===256&&F===256?z=!0:z=!1,A.isModelFullVol=z;let b=await getAllSlicesDataAsTF3D(V,s,u);const W=n.enableTranspose,q=n.enableCrop;z&&(q?await inferenceFullVolumePhase1(T,b,V,L,M,z,n,A,a,f,m,u):(console.log("Cropping Disabled"),W?(b=b.transpose(),console.log("Input transposed")):console.log("Transpose NOT Enabled"),n.enableSeqConv?(console.log("Seq Convoluton Enabled"),await inferenceFullVolumeSeqCovLayer()):(console.log("Seq Convoluton Disabled"),await inferenceFullVolume())))}async function detectBrowser(){return navigator.userAgent.indexOf("OPR/")>-1?"Opera":navigator.userAgent.indexOf("Edg/")>-1?"Edge":navigator.userAgent.indexOf("Falkon/")>-1?"Falkon":navigator.userAgent.indexOf("Chrome/")>-1?"Chrome":navigator.userAgent.indexOf("Firefox/")>-1?"Firefox":navigator.userAgent.indexOf("Safari/")>-1?"Safari":navigator.userAgent.indexOf("MSIE/")>-1||navigator.userAgent.indexOf("rv:")>-1?"IExplorer":"Unknown"}async function detectBrowserVersion(){return navigator.userAgent.indexOf("OPR/")>-1?parseInt(navigator.userAgent.split("OPR/")[1]):navigator.userAgent.indexOf("Edg/")>-1?parseInt(navigator.userAgent.split("Edg/")[1]):navigator.userAgent.indexOf("Falkon/")>-1?parseInt(navigator.userAgent.split("Falkon/")[1]):navigator.userAgent.indexOf("Chrome/")>-1?parseInt(navigator.userAgent.split("Chrome/")[1]):navigator.userAgent.indexOf("Firefox/")>-1?parseInt(navigator.userAgent.split("Firefox/")[1]):navigator.userAgent.indexOf("Safari/")>-1?parseInt(navigator.userAgent.split("Safari/")[1]):navigator.userAgent.indexOf("MSIE/")>-1||navigator.userAgent.indexOf("rv:")>-1?parseInt(navigator.userAgent.split("MSIE/")[1]):1/0}async function detectOperatingSys(){return navigator.userAgent.indexOf("Win")>-1?"Windows":navigator.userAgent.indexOf("Mac")>-1?"MacOS":navigator.userAgent.indexOf("Linux")>-1?"Linux":navigator.userAgent.indexOf("UNIX")>-1?"UNIX":"Unknown"}async function checkWebGl2(a){return a?(console.log("WebGl2 is enabled"),!0):(console.log(typeof WebGL2RenderingContext<"u"?"WebGL2 may be disabled. Please try updating video card drivers":"WebGL2 is not supported"),!1)}async function detectGPUVendor(a){let n;if(a&&(n=a.getExtension("WEBGL_debug_renderer_info"),n)){const s=a.getParameter(n.UNMASKED_VENDOR_WEBGL);return s.indexOf("(")>-1&&s.indexOf(")")>-1?s.substring(s.indexOf("(")+1,s.indexOf(")")):s}return null}async function detectGPUVendor_v0(a){if(a){const n=a.getExtension("WEBGL_debug_renderer_info");return n?a.getParameter(n.UNMASKED_VENDOR_WEBGL):null}else return null}async function detectGPUCardType_v0(a){if(a){if(detectBrowser()==="Firefox")return a.getParameter(a.RENDERER);const n=a.getExtension("WEBGL_debug_renderer_info");return n?a.getParameter(n.UNMASKED_RENDERER_WEBGL):null}else return null}async function detectGPUCardType(a){let n;if(a){if(detectBrowser()==="Firefox")return a.getParameter(a.RENDERER);if(n=a.getExtension("WEBGL_debug_renderer_info"),n){let s=a.getParameter(n.UNMASKED_RENDERER_WEBGL);return s.indexOf("(")>-1&&s.indexOf(")")>-1&&s.indexOf("(R)")===-1&&(s=s.substring(s.indexOf("(")+1,s.indexOf(")")),s.split(",").length===3)?s.split(",")[1].trim():s}}return null}async function getCPUNumCores(){return navigator.hardwareConcurrency}async function isChrome(){return/Chrome/.test(navigator.userAgent)&&/Google Inc/.test(navigator.vendor)}async function localSystemDetails(a,n=null){const s=new Date;if(a.isModelFullVol?a.Brainchop_Ver="FullVolume":a.Brainchop_Ver="SubVolumes",a.Total_t=(Date.now()-a.startTime)/1e3,delete a.startTime,a.Date=parseInt(s.getMonth()+1)+"/"+s.getDate()+"/"+s.getFullYear(),a.Browser=await detectBrowser(),a.Browser_Ver=await detectBrowserVersion(),a.OS=await detectOperatingSys(),a.WebGL2=await checkWebGl2(n),a.GPU_Vendor=await detectGPUVendor(n),a.GPU_Card=await detectGPUCardType(n),a.GPU_Vendor_Full=await detectGPUVendor_v0(n),a.GPU_Card_Full=await detectGPUCardType_v0(n),a.CPU_Cores=await getCPUNumCores(),a.Which_Brainchop="latest",await isChrome()&&(a.Heap_Size_MB=window.performance.memory.totalJSHeapSize/(1024*1024).toFixed(2),a.Used_Heap_MB=window.performance.memory.usedJSHeapSize/(1024*1024).toFixed(2),a.Heap_Limit_MB=window.performance.memory.jsHeapSizeLimit/(1024*1024).toFixed(2)),n){console.log("MAX_TEXTURE_SIZE :",n.getParameter(n.MAX_TEXTURE_SIZE)),console.log("MAX_RENDERBUFFER_SIZE :",n.getParameter(n.MAX_RENDERBUFFER_SIZE));const u=n.getExtension("WEBGL_debug_renderer_info");console.log("VENDOR WEBGL:",n.getParameter(u.UNMASKED_VENDOR_WEBGL)),a.Texture_Size=n.getParameter(n.MAX_TEXTURE_SIZE)}else a.Texture_Size=null;return a}function WorkerWrapper(a){return new Worker(""+new URL("brainchop-webworker-CY-cU9Jz.js",import.meta.url).href,{name:a==null?void 0:a.name})}async function main(){dragMode.onchange=async function(){S.opts.dragMode=this.selectedIndex},drawDrop.onchange=async function(){if(S.volumes.length<2){window.alert("No segmentation open (use the Segmentation pull down)"),drawDrop.selectedIndex=-1;return}if(!S.drawBitmap){window.alert("No drawing (hint: use the Draw pull down to select a pen)"),drawDrop.selectedIndex=-1;return}const I=parseInt(this.value);if(I===0){S.drawUndo(),drawDrop.selectedIndex=-1;return}let e=S.volumes[1].img,F=await S.saveImage({filename:"",isSaveDrawing:!0});const M=352,L=F.length;if(I===1)for(let V=0;V0&&(e[V]=1);if(I===2)for(let V=0;V0&&(e[V]=0);S.closeDrawing(),S.updateGLVolume(),S.setDrawingEnabled(!1),penDrop.selectedIndex=-1,drawDrop.selectedIndex=-1},penDrop.onchange=async function(){const I=parseInt(this.value);S.setDrawingEnabled(I>=0),I>=0&&S.setPenValue(I&7,I>7)},aboutBtn.onclick=function(){window.alert("Drag and drop NIfTI images. Use pulldown menu to choose brainchop model")},diagnosticsBtn.onclick=function(){if(T.length<1){window.alert("No diagnostic string generated: run a model to create diagnostics");return}navigator.clipboard.writeText(T),window.alert(`Diagnostics copied to clipboard `+T)},opacitySlider0.oninput=function(){S.setOpacity(0,opacitySlider0.value/255),S.updateGLVolume()},opacitySlider1.oninput=function(){S.setOpacity(1,opacitySlider1.value/255)};async function a(){const I=S.volumes[0];let e=I.dims[1]===256&&I.dims[2]===256&&I.dims[3]===256;if((I.permRAS[0]!==-1||I.permRAS[1]!==3||I.permRAS[2]!==-2)&&(e=!1),e)return;const F=await S.conform(I,!1);await S.removeVolume(S.volumes[0]),await S.addVolume(F)}async function n(){for(;S.volumes.length>1;)await S.removeVolume(S.volumes[1])}modelSelect.onchange=async function(){this.selectedIndex<0&&(modelSelect.selectedIndex=11),await n(),await a();const I=inferenceModelsList[this.selectedIndex],e=brainChopOpts;if(e.rootURL=location.href,!!(window.location.hostname==="localhost"||window.location.hostname==="[::1]"||window.location.hostname.match(/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/))&&(e.rootURL=location.protocol+"//"+location.host),workerCheck.checked){if(typeof E<"u"){console.log("Unable to start new segmentation: previous call has not completed");return}E=await new WorkerWrapper({type:"module"});const M={datatypeCode:S.volumes[0].hdr.datatypeCode,dims:S.volumes[0].hdr.dims},L={opts:e,modelEntry:I,niftiHeader:M,niftiImage:S.volumes[0].img};E.postMessage(L),E.onmessage=function(V){const B=V.data.cmd;B==="ui"&&(V.data.modalMessage!==""&&(E.terminate(),E=void 0),A(V.data.message,V.data.progressFrac,V.data.modalMessage,V.data.statData)),B==="img"&&(E.terminate(),E=void 0,f(V.data.img,V.data.opts,V.data.modelEntry))}}else runInference(e,I,S.volumes[0].hdr,S.volumes[0].img,f,A)},saveBtn.onclick=function(){S.volumes[1].saveToDisk("Custom.nii")},workerCheck.onchange=function(){modelSelect.onchange()},clipCheck.onchange=function(){clipCheck.checked?S.setClipPlane([0,0,90]):S.setClipPlane([2,0,90])};function s(){opacitySlider0.oninput()}async function u(I){return await(await fetch(I)).json()}async function f(I,e,F){n();const M=await S.volumes[0].clone();if(M.zeroImage(),M.hdr.scl_inter=0,M.hdr.scl_slope=1,M.img=new Uint8Array(I),F.colormapPath){const L=await u(F.colormapPath);M.setColormapLabel(L),M.hdr.intent_code=1002}else{let L=e.atlasSelectedColorTable.toLowerCase();S.colormaps().includes(L)||(L="actc"),M.colormap=L}M.opacity=opacitySlider1.value/255,await S.addVolume(M)}async function m(I){(typeof I=="string"||I instanceof String)&&(I=function(F){const M=JSON.parse(F),L=[];for(const V in M)L[V]=M[V];return L}(I)),I=await localSystemDetails(I,S.gl),T=`:: Diagnostics can help resolve issues https://github.com/neuroneural/brainchop/issues :: `;for(const e in I)T+=e+": "+I[e]+` `}function A(I="",e=-1,F="",M=[]){I!==""&&(console.log(I),document.getElementById("location").innerHTML=I),isNaN(e)?(memstatus.style.color="red",memstatus.innerHTML="Memory Issue"):e>=0&&(modelProgress.value=e*modelProgress.max),F!==""&&window.alert(F),Object.keys(M).length>0&&m(M)}function v(I){document.getElementById("location").innerHTML="  "+I.string}const y={backColor:[.4,.4,.4,1],show3Dcrosshair:!0,onLocationChange:v};let T="",E;const S=new Niivue(y);S.attachToCanvas(gl1),S.opts.dragMode=S.dragModes.pan,S.opts.multiplanarForceRender=!0,S.opts.yoke3Dto2DZoom=!0,S.opts.crosshairGap=11,S.setInterpolation(!0),await S.loadVolumes([{url:"./t1_crop.nii.gz"}]);for(let I=0;I Niivue brain chop - +