diff --git a/README.md b/README.md index fba01d3..bc19f12 100644 --- a/README.md +++ b/README.md @@ -172,7 +172,7 @@ api 文档 (待完善,如有需要功能欢迎提[issue](https://github.com/ | TouchHead | 点击头部时聊天框随机出现数组的值,该值当模型未存入头部触摸事件时无效 | Array | ['讨厌,不要掐人家的脸嘛~','希望明天也能感受到你的触摸呢'] | | TouchDefault | 点击盒子任意位置时聊天框随机出现数组的值,该值所有模型均有效且优先级最低 | Array | ['今天又是开心的一天呢~','真是元气满满呀'] | | color | 聊天框背景颜色 | String | '#C8E6FE' | -| PathFull | 当SSR框架时,必须传入此参数,用以额外指定绝对路径资源域名地址 | String | '' | +| PathFull | 当SSR框架时,必须传入此参数,用以额外指定绝对路径资源域名地址;当SPA框架时,目录较深的页面也可以根据自己需要,设置该参数指向正确的路径,如'../Resources/' | String | '' | | MobileShow | 是否在移动设备展示看板娘 | Boolean | false | | menuList | 启用的功能菜单列表,该值传空数组时不启用菜单,可用参数为:Mtab | Array | ['Mtab'] | diff --git a/Samples/TypeScript/Demo/Framework/src/live2dcubismframework.ts b/Samples/TypeScript/Demo/Framework/src/live2dcubismframework.ts index a7a51b3..6a31892 100644 --- a/Samples/TypeScript/Demo/Framework/src/live2dcubismframework.ts +++ b/Samples/TypeScript/Demo/Framework/src/live2dcubismframework.ts @@ -133,8 +133,8 @@ export namespace Live2DCubismFramework { } /** - * Cubism Framework内のリソースを初期化してモデルを表示可能な状態にします。
- * 再度Initialize()するには先にDispose()を実行する必要があります。 + * 将Cubism Framework内的资源初始化,使模型处于可显示状态。 + * 要再次Initialize(),必须先执行Dispose()。 */ public static initialize(): void { CSM_ASSERT(s_isStarted); diff --git a/Samples/TypeScript/Demo/Framework/src/motion/cubismmotionqueuemanager.ts b/Samples/TypeScript/Demo/Framework/src/motion/cubismmotionqueuemanager.ts index 7103784..bd3edc0 100644 --- a/Samples/TypeScript/Demo/Framework/src/motion/cubismmotionqueuemanager.ts +++ b/Samples/TypeScript/Demo/Framework/src/motion/cubismmotionqueuemanager.ts @@ -92,7 +92,7 @@ export namespace Live2DCubismFramework { motionQueueEntry._motion = motion; // console.log('eventCount',motion['_motionData']) // 添加超频动作拦截器,据测试,curveCount超过100的模型会导致动作异常,待修复 2020.9.11 - if(motion['_motionData']['curveCount']<100){ + if(motion?.['_motionData']?.['curveCount']<100){ this._motions.pushBack(motionQueueEntry); } diff --git a/Samples/TypeScript/Demo/dist/bundle.js b/Samples/TypeScript/Demo/dist/bundle.js index 2aa1e0e..9bac61d 100644 --- a/Samples/TypeScript/Demo/dist/bundle.js +++ b/Samples/TypeScript/Demo/dist/bundle.js @@ -1,2 +1,53795 @@ -!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react")):"function"==typeof define&&define.amd?define(["react"],e):"object"==typeof exports?exports.live2d=e(require("react")):t.live2d=e(t.React)}(window,(function(t){return function(t){var e={};function i(r){if(e[r])return e[r].exports;var n=e[r]={i:r,l:!1,exports:{}};return t[r].call(n.exports,n,n.exports,i),n.l=!0,n.exports}return i.m=t,i.c=e,i.d=function(t,e,r){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(i.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)i.d(r,n,function(e){return t[e]}.bind(null,n));return r},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=20)}([function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=i(6),n=i(22),o=i(15),a=i(4),s=r.Live2DCubismFramework.Value,u=n.Live2DCubismFramework.CubismIdManager,l=o.Live2DCubismFramework.CubismRenderer;e.strtod=function(t,e){for(var i=0,r=1;;r++){var n=t.slice(r-1,r);if("e"!=n&&"-"!=n&&"E"!=n){var o=t.substring(0,r),a=Number(o);if(isNaN(a))break;i=r}}var s=parseFloat(t);return isNaN(s)&&(s=NaN),e[0]=t.slice(i),s},function(t){var e=!1,i=!1,r=null,n=null;!function(t){t.vertexOffset=0,t.vertexStep=2}(t.Constant||(t.Constant={})),t.csmDelete=function(t){t&&(t=void 0)};var o=function(){function t(){}return t.startUp=function(t){if(void 0===t&&(t=null),e)return a.CubismLogInfo("CubismFramework.startUp() is already done."),e;if(null!=(r=t)&&Live2DCubismCore.Logging.csmSetLogFunction(r.logFunction),e=!0){var i=Live2DCubismCore.Version.csmGetVersion(),n=(4278190080&i)>>24,o=(16711680&i)>>16,s=65535&i,u=i;a.CubismLogInfo("Live2D Cubism Core version: {0}.{1}.{2} ({3})",("00"+n).slice(-2),("00"+o).slice(-2),("0000"+s).slice(-4),u)}return a.CubismLogInfo("CubismFramework.startUp() is complete."),e},t.cleanUp=function(){e=!1,i=!1,r=null,n=null},t.initialize=function(){a.CSM_ASSERT(e),e?i?a.CubismLogWarning("CubismFramework.initialize() skipped, already initialized."):(s.staticInitializeNotForClientCall(),n=new u,i=!0,a.CubismLogInfo("CubismFramework.initialize() is complete.")):a.CubismLogWarning("CubismFramework is not started.")},t.dispose=function(){a.CSM_ASSERT(e),e?i?(s.staticReleaseNotForClientCall(),n.release(),n=null,l.staticRelease(),i=!1,a.CubismLogInfo("CubismFramework.dispose() is complete.")):a.CubismLogWarning("CubismFramework.dispose() skipped, not initialized."):a.CubismLogWarning("CubismFramework is not started.")},t.isStarted=function(){return e},t.isInitialized=function(){return i},t.coreLogFunction=function(t){Live2DCubismCore.Logging.csmGetLogFunction()&&Live2DCubismCore.Logging.csmGetLogFunction()(t)},t.getLoggingLevel=function(){return null!=r?r.loggingLevel:h.LogLevel_Off},t.getIdManager=function(){return n},t}();t.CubismFramework=o}(e.Live2DCubismFramework||(e.Live2DCubismFramework={}));var h,p=function(){};e.Option=p,function(t){t[t.LogLevel_Verbose=0]="LogLevel_Verbose",t[t.LogLevel_Debug=1]="LogLevel_Debug",t[t.LogLevel_Info=2]="LogLevel_Info",t[t.LogLevel_Warning=3]="LogLevel_Warning",t[t.LogLevel_Error=4]="LogLevel_Error",t[t.LogLevel_Off=5]="LogLevel_Off"}(h=e.LogLevel||(e.LogLevel={}))},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t){var e=function(){function t(t){void 0===t&&(t=0),t<1?(this._ptr=[],this._capacity=0,this._size=0):(this._ptr=new Array(t),this._capacity=t,this._size=0)}return t.prototype.at=function(t){return this._ptr[t]},t.prototype.set=function(t,e){this._ptr[t]=e},t.prototype.get=function(t){void 0===t&&(t=0);for(var e=new Array,i=t;i=this._capacity&&this.prepareCapacity(0==this._capacity?t.s_defaultSize:2*this._capacity),this._ptr[this._size++]=e},t.prototype.clear=function(){this._ptr.length=0,this._size=0},t.prototype.getSize=function(){return this._size},t.prototype.assign=function(t,e){this._size0)for(var u=0;uthis._capacity&&(0==this._capacity?(this._ptr=new Array(t),this._capacity=t):(this._ptr.length=t,this._capacity=t))},t.prototype.begin=function(){return 0==this._size?this.end():new i(this,0)},t.prototype.end=function(){return new i(this,this._size)},t.prototype.getOffset=function(e){var i=new t;return i._ptr=this.get(e),i._size=this.get(e).length,i._capacity=this.get(e).length,i},t.s_defaultSize=10,t}();t.csmVector=e;var i=function(){function t(t,e){this._vector=null!=t?t:null,this._index=null!=e?e:0}return t.prototype.set=function(t){return this._index=t._index,this._vector=t._vector,this},t.prototype.preIncrement=function(){return++this._index,this},t.prototype.preDecrement=function(){return--this._index,this},t.prototype.increment=function(){var e=new t(this._vector,this._index++);return this._vector=e._vector,this._index=e._index,this},t.prototype.decrement=function(){var e=new t(this._vector,this._index--);return this._vector=e._vector,this._index=e._index,this},t.prototype.ptr=function(){return this._vector._ptr[this._index]},t.prototype.substitution=function(t){return this._index=t._index,this._vector=t._vector,this},t.prototype.notEqual=function(t){return this._index!=t._index||this._vector!=t._vector},t}();t.iterator=i}(e.Live2DCubismFramework||(e.Live2DCubismFramework={}))},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=i(0);e.ViewMaxScale=2,e.ViewMinScale=.8,e.ViewLogicalLeft=-1,e.ViewLogicalRight=1,e.ViewLogicalMaxLeft=-2,e.ViewLogicalMaxRight=2,e.ViewLogicalMaxBottom=-2,e.ViewLogicalMaxTop=2,e.ResourcesPath="./Resources/",e.BackImageName="back_class_normal.png",e.GearImageName="icon_gear.png",e.PowerImageName="CloseNormal.png",e.ModelDir=["Hiyori","Haru","Rice"],e.MotionGroupDefault="",e.MotionGroupIdle="Idle",e.MotionGroupTapBody="TapBody",e.HitAreaNameHead="Head",e.HitAreaNameBody="Body",e.HitBodyList=["啊呀,你的手在摸哪里嘛~","哼,坏人"],e.HitHeadList=["讨厌~不要掐人家的脸嘛~","希望明天也能感受到你的触摸呢"],e.HitDefaultList=["今天又是开心的一天呢~","真是元气满满呀"],e.PriorityNone=0,e.PriorityIdle=1,e.PriorityNormal=2,e.PriorityForce=3,e.DebugLogEnable=!0,e.DebugTouchLogEnable=!1,e.CubismLoggingLevel=r.LogLevel.LogLevel_Verbose,e.RenderTargetWidth=1900,e.RenderTargetHeight=1e3;var n=function(){function t(){}return t.setModelDir=function(t){e.ModelDir=t.length>0?t:e.ModelDir},t.setHitBody=function(t){e.HitBodyList=t.length>0?t:e.HitBodyList},t.setHitHead=function(t){e.HitHeadList=t.length>0?t:e.HitHeadList},t.setHitDefault=function(t){e.HitDefaultList=t.length>0?t:e.HitDefaultList},t.setPathFull=function(t){e.ResourcesPath=t.length>0?t:e.ResourcesPath},t}();e.lappdefineSet=n},function(e,i){e.exports=t},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r,n=i(0),o=i(21);e.CubismLogPrint=function(t,e,i){r.CubismDebug.print(t,"[CSM]"+e,i)},e.CubismLogPrintIn=function(t,i,r){e.CubismLogPrint(t,i+"\n",r)},e.CSM_ASSERT=function(t){console.assert(t)},o.CSM_LOG_LEVEL<=o.CSM_LOG_LEVEL_VERBOSE?(e.CubismLogVerbose=function(t){for(var i=[],r=1;r0?this.print(t,"\n"):r%8==0&&r>0&&this.print(t," "),this.print(t,"{0} ",[255&e[r]]);this.print(t,"\n")},t}();t.CubismDebug=e}(r=e.Live2DCubismFramework||(e.Live2DCubismFramework={}))},function(t,e,i){"use strict";var r=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var i in t)Object.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e.default=t,e};Object.defineProperty(e,"__esModule",{value:!0});var n=i(0),o=n.Live2DCubismFramework.CubismFramework,a=i(24),s=i(13),u=i(51),l=i(14),h=r(i(2));e.canvas=null,e.s_instance=null,e.gl=null,e.frameBuffer=null;var p=function(){function t(){this._captured=!1,this._mouseX=0,this._mouseY=0,this._isEnd=!1,this._cubismOption=new n.Option,this._view=new a.LAppView,this._textureManager=new u.LAppTextureManager}return t.getInstance=function(){return null==e.s_instance&&(e.s_instance=new t),e.s_instance},t.releaseInstance=function(){console.log("releaseInstance"),null!=e.s_instance&&e.s_instance.release(),e.s_instance=null},t.prototype.initialize=function(){return e.canvas=document.getElementById("live2d"),document.addEventListener("mousemove",(function(e){if(t.getInstance()._view){var i=document.getElementById("live2d").getBoundingClientRect(),r=e.clientX-i.left,n=e.clientY-i.top;t.getInstance()._view.onTouchesMoved(r,n)}else s.LAppPal.printMessage("view notfound")}),!1),document.addEventListener("mouseout",(function(t){l.LAppLive2DManager.getInstance().onDrag(0,0)}),!1),e.canvas.addEventListener("click",(function(i){if(t.getInstance()._view){var r=e.canvas.getBoundingClientRect(),n=i.clientX-r.left,o=i.clientY-r.top;t.getInstance()._view.onTouchesBegan(n,o),t.getInstance()._view.onTouchesEnded(n,o)}else s.LAppPal.printMessage("view notfound")}),!1),e.gl=e.canvas.getContext("webgl")||e.canvas.getContext("experimental-webgl"),e.gl?(e.frameBuffer||(e.frameBuffer=e.gl.getParameter(e.gl.FRAMEBUFFER_BINDING)),e.gl.enable(e.gl.BLEND),e.gl.blendFunc(e.gl.SRC_ALPHA,e.gl.ONE_MINUS_SRC_ALPHA),"ontouchend"in e.canvas&&(e.canvas.ontouchstart=c,e.canvas.ontouchmove=g,e.canvas.ontouchend=d,e.canvas.ontouchcancel=m),this._view.initialize(),this.initializeCubism(),!0):(alert("Cannot initialize WebGL. This browser does not support."),e.gl=null,document.body.innerHTML="This browser does not support the <canvas> element.",!1)},t.prototype.release=function(){this._textureManager.release(),this._textureManager=null,this._view.release(),this._view=null,l.LAppLive2DManager.releaseInstance(),o.dispose()},t.prototype.run=function(){var t=this,i=function(){null!=e.s_instance&&(s.LAppPal.updateTime(),e.gl.clearColor(0,0,0,0),e.gl.enable(e.gl.DEPTH_TEST),e.gl.depthFunc(e.gl.LEQUAL),e.gl.clear(e.gl.COLOR_BUFFER_BIT|e.gl.DEPTH_BUFFER_BIT),e.gl.clearDepth(1),e.gl.enable(e.gl.BLEND),e.gl.blendFunc(e.gl.SRC_ALPHA,e.gl.ONE_MINUS_SRC_ALPHA),t._view.render(),requestAnimationFrame(i))};i()},t.prototype.createShader=function(){var t=e.gl.createShader(e.gl.VERTEX_SHADER);if(null==t)return s.LAppPal.printMessage("failed to create vertexShader"),null;e.gl.shaderSource(t,"precision mediump float;attribute vec3 position;attribute vec2 uv;varying vec2 vuv;void main(void){ gl_Position = vec4(position, 1.0); vuv = uv;}"),e.gl.compileShader(t);var i=e.gl.createShader(e.gl.FRAGMENT_SHADER);if(null==i)return s.LAppPal.printMessage("failed to create fragmentShader"),null;e.gl.shaderSource(i,"precision mediump float;varying vec2 vuv;uniform sampler2D texture;void main(void){ gl_FragColor = texture2D(texture, vuv);}"),e.gl.compileShader(i);var r=e.gl.createProgram();return e.gl.attachShader(r,t),e.gl.attachShader(r,i),e.gl.deleteShader(t),e.gl.deleteShader(i),e.gl.linkProgram(r),e.gl.useProgram(r),r},t.prototype.getView=function(){return this._view},t.prototype.getTextureManager=function(){return this._textureManager},t.prototype.initializeCubism=function(){this._cubismOption.logFunction=s.LAppPal.printMessage,this._cubismOption.loggingLevel=h.CubismLoggingLevel,o.startUp(this._cubismOption),o.initialize(),l.LAppLive2DManager.getInstance(),s.LAppPal.updateTime(),this._view.initializeSprite()},t}();function c(t){if(p.getInstance()._view){p.getInstance()._captured=!0;var e=t.changedTouches[0].pageX,i=t.changedTouches[0].pageY;p.getInstance()._view.onTouchesBegan(e,i)}else s.LAppPal.printMessage("view notfound")}function g(t){if(p.getInstance()._captured)if(p.getInstance()._view){var e=t.target.getBoundingClientRect(),i=t.changedTouches[0].clientX-e.left,r=t.changedTouches[0].clientY-e.top;p.getInstance()._view.onTouchesMoved(i,r)}else s.LAppPal.printMessage("view notfound")}function d(t){if(p.getInstance()._captured=!1,p.getInstance()._view){var e=t.target.getBoundingClientRect(),i=t.changedTouches[0].clientX-e.left,r=t.changedTouches[0].clientY-e.top;p.getInstance()._view.onTouchesEnded(i,r)}else s.LAppPal.printMessage("view notfound")}function m(t){if(p.getInstance()._captured=!1,p.getInstance()._view){var e=t.target.getBoundingClientRect(),i=t.changedTouches[0].clientX-e.left,r=t.changedTouches[0].clientY-e.top;p.getInstance()._view.onTouchesEnded(i,r)}else s.LAppPal.printMessage("view notfound")}e.LAppDelegate=p},function(t,e,i){"use strict";var r,n=this&&this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(t,e)},function(t,e){function i(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)});Object.defineProperty(e,"__esModule",{value:!0});var o=i(8),a=i(9),s=i(1),u=i(4),l=i(0),h=s.Live2DCubismFramework.csmVector,p=a.Live2DCubismFramework.csmMap,c=o.Live2DCubismFramework.csmString;!function(t){var e=function(){function t(){}return t.prototype.getRawString=function(t,e){return this.getString(t,e)},t.prototype.toInt=function(t){return void 0===t&&(t=0),t},t.prototype.toFloat=function(t){return void 0===t&&(t=0),t},t.prototype.toBoolean=function(t){return void 0===t&&(t=!1),t},t.prototype.getSize=function(){return 0},t.prototype.getArray=function(t){return void 0===t&&(t=null),t},t.prototype.getVector=function(t){return t},t.prototype.getMap=function(t){return t},t.prototype.getValueByIndex=function(e){return t.errorValue.setErrorNotForClientCall("Error: type mismatch")},t.prototype.getValueByString=function(e){return t.nullValue.setErrorNotForClientCall("Error: type mismatch")},t.prototype.getKeys=function(){return t.s_dummyKeys},t.prototype.isError=function(){return!1},t.prototype.isNull=function(){return!1},t.prototype.isBool=function(){return!1},t.prototype.isFloat=function(){return!1},t.prototype.isString=function(){return!1},t.prototype.isArray=function(){return!1},t.prototype.isMap=function(){return!1},t.prototype.equals=function(t){return!1},t.prototype.isStatic=function(){return!1},t.prototype.setErrorNotForClientCall=function(t){return s.errorValue},t.staticInitializeNotForClientCall=function(){o.trueValue=new o(!0),o.falseValue=new o(!1),s.errorValue=new s("ERROR",!0),this.nullValue=new g,t.s_dummyKeys=new h},t.staticReleaseNotForClientCall=function(){o.trueValue=null,o.falseValue=null,s.errorValue=null,t.nullValue=null,t.s_dummyKeys=null,o.trueValue=null,o.falseValue=null,s.errorValue=null,t.nullValue=null,t.s_dummyKeys=null},t}();t.Value=e;var i=function(){function t(t,e){this._error=null,this._lineCount=0,this._root=null,null!=t&&this.parseBytes(t,e)}return t.create=function(e,i){var r=new t;return r.parseBytes(e,i)?r:(t.delete(r),null)},t.delete=function(t){null},t.prototype.getRoot=function(){return this._root},t.prototype.arrayBufferToString=function(t){for(var e=new Uint8Array(t),i="",r=0,n=e.length;ra&&o.append(t.slice(a),n-a),a=n+1,nt.s},t.prototype.isEqual=function(t){return this.s==t},t.prototype.isEmpty=function(){return 0==this.s.length},t}();t.csmString=e}(e.Live2DCubismFramework||(e.Live2DCubismFramework={}))},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=i(4);!function(t){var e=function(t,e){this.first=null==t?null:t,this.second=null==e?null:e};t.csmPair=e;var i=function(){function t(t){null!=t?t<1?(this._keyValues=[],this._dummyValue=null,this._size=0):(this._keyValues=new Array(t),this._size=t):(this._keyValues=[],this._dummyValue=null,this._size=0)}return t.prototype.release=function(){this.clear()},t.prototype.appendKey=function(t){this.prepareCapacity(this._size+1,!1),this._keyValues[this._size]=new e(t),this._size+=1},t.prototype.getValue=function(t){for(var e=-1,i=0;i=0?this._keyValues[e].second:(this.appendKey(t),this._keyValues[this._size-1].second)},t.prototype.setValue=function(t,e){for(var i=-1,r=0;r=0?this._keyValues[i].second=e:(this.appendKey(t),this._keyValues[this._size-1].second=e)},t.prototype.isExist=function(t){for(var e=0;ethis._keyValues.length&&(0==this._keyValues.length?(!i&&e0&&e.getEndTime()i&&(t=i),t},t.sin=function(t){return Math.sin(t)},t.cos=function(t){return Math.cos(t)},t.abs=function(t){return Math.abs(t)},t.sqrt=function(t){return Math.sqrt(t)},t.getEasingSine=function(t){return t<0?0:t>1?1:.5-.5*this.cos(t*Math.PI)},t.max=function(t,e){return t>e?t:e},t.min=function(t,e){return t>e?e:t},t.degreesToRadian=function(t){return t/180*Math.PI},t.radianToDegrees=function(t){return 180*t/Math.PI},t.directionToRadian=function(t,e){for(var i=Math.atan2(e.y,e.x)-Math.atan2(t.y,t.x);i<-Math.PI;)i+=2*Math.PI;for(;i>Math.PI;)i-=2*Math.PI;return i},t.directionToDegrees=function(t,e){var i=this.directionToRadian(t,e),r=this.radianToDegrees(i);return e.x-t.x>0&&(r=-r),r},t.radianToDirection=function(t){var e=new r;return e.x=this.sin(t),e.y=this.cos(t),e},t}();t.CubismMath=e}(e.Live2DCubismFramework||(e.Live2DCubismFramework={}))},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t){var e=function(){function t(t,e){this.x=t,this.y=e,this.x=null==t?0:t,this.y=null==e?0:e}return t.prototype.add=function(e){var i=new t(0,0);return i.x=this.x+e.x,i.y=this.y+e.y,i},t.prototype.substract=function(e){var i=new t(0,0);return i.x=this.x-e.x,i.y=this.y-e.y,i},t.prototype.multiply=function(e){var i=new t(0,0);return i.x=this.x*e.x,i.y=this.y*e.y,i},t.prototype.multiplyByScaler=function(e){return this.multiply(new t(e,e))},t.prototype.division=function(e){var i=new t(0,0);return i.x=this.x/e.x,i.y=this.y/e.y,i},t.prototype.divisionByScalar=function(e){return this.division(new t(e,e))},t.prototype.getLength=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},t.prototype.getDistanceWith=function(t){return Math.sqrt((this.x-t.x)*(this.x-t.x)+(this.y-t.y)*(this.y-t.y))},t.prototype.dot=function(t){return this.x*t.x+this.y*t.y},t.prototype.normalize=function(){var t=Math.pow(this.x*this.x+this.y*this.y,.5);this.x=this.x/t,this.y=this.y/t},t.prototype.isEqual=function(t){return this.x==t.x&&this.y==t.y},t.prototype.isNotEqual=function(t){return!this.isEqual(t)},t}();t.CubismVector2=e}(e.Live2DCubismFramework||(e.Live2DCubismFramework={}))},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(){}return t.loadFileAsBytes=function(t,e){fetch(t).then((function(t){return t.arrayBuffer()})).then((function(t){return e(t,t.byteLength)}))},t.getDeltaTime=function(){return this.s_deltaTime},t.updateTime=function(){this.s_currentFrame=Date.now(),this.s_deltaTime=(this.s_currentFrame-this.s_lastFrame)/1e3,this.s_lastFrame=this.s_currentFrame},t.printMessage=function(t){console.log(t)},t.lastUpdate=Date.now(),t.s_currentFrame=0,t.s_lastFrame=0,t.s_deltaTime=0,t}();e.LAppPal=r},function(t,e,i){"use strict";var r=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var i in t)Object.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e.default=t,e};Object.defineProperty(e,"__esModule",{value:!0});var n=i(7),o=i(1).Live2DCubismFramework.csmVector,a=n.Live2DCubismFramework.CubismMatrix44,s=i(27),u=i(13),l=i(5),h=r(i(2));e.s_instance=null;var p=null,c=function(){function t(){this._finishedMotion=function(t){u.LAppPal.printMessage("Motion Finished:")},this._viewMatrix=new a,this._models=new o,this._sceneIndex=0,this.changeScene(this._sceneIndex)}return t.getInstance=function(){return null==e.s_instance&&(e.s_instance=new t),e.s_instance},t.releaseInstance=function(){null!=e.s_instance&&(e.s_instance=void 0),e.s_instance=null},t.prototype.getModel=function(t){return t1&&(t=1),e<0?e=0:e>1&&(e=1),i<0?i=0:i>1&&(i=1),r<0?r=0:r>1&&(r=1),this._modelColor.R=t,this._modelColor.G=e,this._modelColor.B=i,this._modelColor.A=r},t.prototype.getModelColor=function(){return JSON.parse(JSON.stringify(this._modelColor))},t.prototype.setIsPremultipliedAlpha=function(t){this._isPremultipliedAlpha=t},t.prototype.isPremultipliedAlpha=function(){return this._isPremultipliedAlpha},t.prototype.setIsCulling=function(t){this._isCulling=t},t.prototype.isCulling=function(){return this._isCulling},t.prototype.setAnisotropy=function(t){this._anisortopy=t},t.prototype.getAnisotropy=function(){return this._anisortopy},t.prototype.getModel=function(){return this._model},t}();t.CubismRenderer=e,function(t){t[t.CubismBlendMode_Normal=0]="CubismBlendMode_Normal",t[t.CubismBlendMode_Additive=1]="CubismBlendMode_Additive",t[t.CubismBlendMode_Multiplicative=2]="CubismBlendMode_Multiplicative"}(t.CubismBlendMode||(t.CubismBlendMode={}));var i=function(){this.R=1,this.G=1,this.B=1,this.A=1};t.CubismTextureColor=i}(e.Live2DCubismFramework||(e.Live2DCubismFramework={}))},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=i(30),n=i(1).Live2DCubismFramework.csmVector,o=r.Live2DCubismFramework.CubismMotionQueueEntry;!function(t){var e=function(){function e(){this._userTimeSeconds=0,this._eventCallBack=null,this._eventCustomData=null,this._motions=new n}return e.prototype.release=function(){for(var t=0;t=1&&(o=1,this._blinkingState=e.EyeState_Closed,this._stateStartTimeSeconds=this._userTimeSeconds),n=1-o;break;case e.EyeState_Closed:(o=(this._userTimeSeconds-this._stateStartTimeSeconds)/this._closedSeconds)>=1&&(this._blinkingState=e.EyeState_Opening,this._stateStartTimeSeconds=this._userTimeSeconds),n=0;break;case e.EyeState_Opening:(o=(this._userTimeSeconds-this._stateStartTimeSeconds)/this._openingSeconds)>=1&&(o=1,this._blinkingState=e.EyeState_Interval,this._nextBlinkingTime=this.determinNextBlinkingTiming()),n=o;break;case e.EyeState_Interval:this._nextBlinkingTimet.length)&&(e=t.length);for(var i=0,r=new Array(e);i300?t.width/2:"150px",left:t.width>300?(t.width-t.width/2)/2+"px":(t.width-150)/2+"px",top:"0",minHeight:"20px",display:"block",borderRadius:"5px",border:"1px dashed #ccc",padding:"5px",background:t.color?t.color:"#C8E6FE"},l="none",(i="display")in e?Object.defineProperty(e,i,{value:l,enumerable:!0,configurable:!0,writable:!0}):e[i]=l,e),g={color:t.color?t.color:"#C8E6FE",width:"30px",height:"30px"},d=null,m=u(Object(a.useState)(!1),2),_=m[0],f=m[1],y=u(Object(a.useState)(!1),2),v=y[0],S=y[1],b=u(Object(a.useState)(!1),2);return b[0],b[1],Object(a.useEffect)((function(){if(console.log("props",t),t.ModelList?o.lappdefineSet.setModelDir(t.ModelList):o.lappdefineSet.setModelDir([]),t.TouchBody?o.lappdefineSet.setHitBody(t.TouchBody):o.lappdefineSet.setHitBody([]),t.TouchHead?o.lappdefineSet.setHitHead(t.TouchHead):o.lappdefineSet.setHitHead([]),t.TouchDefault?o.lappdefineSet.setHitDefault(t.TouchDefault):o.lappdefineSet.setHitDefault([]),t.PathFull?o.lappdefineSet.setPathFull(t.PathFull):o.lappdefineSet.setPathFull(""),!navigator.userAgent.match(/mobile/i)||1==t.MobileShow){if(0==r.LAppDelegate.getInstance().initialize())return;r.LAppDelegate.getInstance().run(),window.onbeforeunload=function(){return r.LAppDelegate.releaseInstance()}}}),[]),s.a.createElement("div",null,s.a.createElement("div",{style:h,width:t.width?t.width:"300",height:t.height?t.height:"500",id:"live2d-container"},s.a.createElement("div",{id:"live2d-hidden",style:{width:"100%",height:"100%",position:"absolute",top:"0",left:"0",zIndex:"2"}}),s.a.createElement("div",{id:"live2d-print",style:c}),s.a.createElement("canvas",{id:"live2d",style:p,width:t.width?t.width:"300",height:t.height?t.height:"500",className:"live2d",onMouseEnter:function(){f(!0)},onMouseLeave:function(){d=setTimeout((function(){v||(f(!1),S(!1))}),10)}}),_&&(!t.menuList||t.menuList.length>0)&&s.a.createElement("div",{className:"live2d-controller",style:{position:"absolute",top:"20px",left:"20px"},onMouseEnter:function(){S(!0),clearTimeout(d)},onMouseLeave:function(){S(!1)}},(!t.menuList||t.menuList.indexOf("Mtab")>-1)&&s.a.createElement("div",{className:"iconfont",style:g,onClick:function(){n.LAppLive2DManager.getInstance().nextScene()},onMouseEnter:function(){return t="你想要换一个看板娘吗?",(e=document.getElementById("live2d-print")).innerHTML=t,void(e.style.display="block");var t,e},onMouseLeave:function(){var t=document.getElementById("live2d-print");t.innerHTML="",t.style.display="none"}},""))))}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.CSM_LOG_LEVEL_VERBOSE=0,e.CSM_LOG_LEVEL_DEBUG=1,e.CSM_LOG_LEVEL_INFO=2,e.CSM_LOG_LEVEL_WARNING=3,e.CSM_LOG_LEVEL_ERROR=4,e.CSM_LOG_LEVEL_OFF=5,e.CSM_LOG_LEVEL=e.CSM_LOG_LEVEL_VERBOSE},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=i(1),n=i(23).Live2DCubismFramework.CubismId,o=r.Live2DCubismFramework.csmVector;!function(t){var e=function(){function t(){this._ids=new o}return t.prototype.release=function(){for(var t=0;tthis._screenLeft&&(t=this._screenLeft-this._tr[0]*this._maxLeft-this._tr[12]),this._tr[0]*this._maxRight+(this._tr[12]+t)this._screenBottom&&(e=this._screenBottom-this._tr[5]*this._maxBottom-this._tr[13]);var i=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,t,e,0,1]);o.multiply(i,this._tr,this._tr)},e.prototype.adjustScale=function(t,e,i){var r=this.getMaxScale(),n=this.getMinScale(),a=i*this._tr[0];a0&&(i=n/this._tr[0]):a>r&&this._tr[0]>0&&(i=r/this._tr[0]);var s=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,t,e,0,1]),u=new Float32Array([i,0,0,0,0,i,0,0,0,0,1,0,0,0,0,1]),l=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,-t,-e,0,1]);o.multiply(l,this._tr,this._tr),o.multiply(u,this._tr,this._tr),o.multiply(s,this._tr,this._tr)},e.prototype.setScreenRect=function(t,e,i,r){this._screenLeft=t,this._screenRight=e,this._screenBottom=i,this._screenTop=r},e.prototype.setMaxScreenRect=function(t,e,i,r){this._maxLeft=t,this._maxRight=e,this._maxTop=r,this._maxBottom=i},e.prototype.setMaxScale=function(t){this._maxScale=t},e.prototype.setMinScale=function(t){this._minScale=t},e.prototype.getMaxScale=function(){return this._maxScale},e.prototype.getMinScale=function(){return this._minScale},e.prototype.isMaxScale=function(){return this.getScaleX()>=this._maxScale},e.prototype.isMinScale=function(){return this.getScaleX()<=this._minScale},e.prototype.getScreenLeft=function(){return this._screenLeft},e.prototype.getScreenRight=function(){return this._screenRight},e.prototype.getScreenBottom=function(){return this._screenBottom},e.prototype.getScreenTop=function(){return this._screenTop},e.prototype.getMaxLeft=function(){return this._maxLeft},e.prototype.getMaxRight=function(){return this._maxRight},e.prototype.getMaxBottom=function(){return this._maxBottom},e.prototype.getMaxTop=function(){return this._maxTop},e}(o);t.CubismViewMatrix=e}(e.Live2DCubismFramework||(e.Live2DCubismFramework={}))},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(){this._startX=0,this._startY=0,this._lastX=0,this._lastY=0,this._lastX1=0,this._lastY1=0,this._lastX2=0,this._lastY2=0,this._lastTouchDistance=0,this._deltaX=0,this._deltaY=0,this._scale=1,this._touchSingle=!1,this._flipAvailable=!1}return t.prototype.getCenterX=function(){return this._lastX},t.prototype.getCenterY=function(){return this._lastY},t.prototype.getDeltaX=function(){return this._deltaX},t.prototype.getDeltaY=function(){return this._deltaY},t.prototype.getStartX=function(){return this._startX},t.prototype.getStartY=function(){return this._startY},t.prototype.getScale=function(){return this._scale},t.prototype.getX=function(){return this._lastX},t.prototype.getY=function(){return this._lastY},t.prototype.getX1=function(){return this._lastX1},t.prototype.getY1=function(){return this._lastY1},t.prototype.getX2=function(){return this._lastX2},t.prototype.getY2=function(){return this._lastY2},t.prototype.isSingleTouch=function(){return this._touchSingle},t.prototype.isFlickAvailable=function(){return this._flipAvailable},t.prototype.disableFlick=function(){this._flipAvailable=!1},t.prototype.touchesBegan=function(t,e){this._lastX=t,this._lastY=e,this._startX=t,this._startY=e,this._lastTouchDistance=-1,this._flipAvailable=!0,this._touchSingle=!0},t.prototype.touchesMoved=function(t,e){this._lastX=t,this._lastY=e,this._lastTouchDistance=-1,this._touchSingle=!0},t.prototype.getFlickDistance=function(){return this.calculateDistance(this._startX,this._startY,this._lastX,this._lastY)},t.prototype.calculateDistance=function(t,e,i,r){return Math.sqrt((t-i)*(t-i)+(e-r)*(e-r))},t.prototype.calculateMovingAmount=function(t,e){if(t>0!=e>0)return 0;var i=t>0?1:-1,r=Math.abs(t),n=Math.abs(e);return i*(r0){for(var t=e._modelSetting.getExpressionCount(),i=function(i){var r=e._modelSetting.getExpressionName(i),o=e._modelSetting.getExpressionFileName(i);fetch(e._modelHomeDir+"/"+o).then((function(t){return t.arrayBuffer()})).then((function(i){var o=e.loadExpression(i,i.byteLength,r);null!=e._expressions.getValue(r)&&(M.delete(e._expressions.getValue(r)),e._expressions.setValue(r,null)),e._expressions.setValue(r,o),e._expressionCount++,e._expressionCount>=t&&(e._state=a.LoadPhysics,n())}))},r=0;r0&&(e._eyeBlink=x.create(e._modelSetting),e._state=a.SetupBreath),u()},u=function(){e._breath=b.create();var t=new S;t.pushBack(new C(e._idParamAngleX,0,15,6.5345,.5)),t.pushBack(new C(e._idParamAngleY,0,8,3.5345,.5)),t.pushBack(new C(e._idParamAngleZ,0,10,5.5345,.5)),t.pushBack(new C(e._idParamBodyAngleX,0,4,15.5345,.5)),t.pushBack(new C(L.getIdManager().getId(B.ParamBreath),0,.5,3.2345,.5)),e._breath.setParameters(t),e._state=a.LoadUserData,l()},l=function(){if(""!=e._modelSetting.getUserDataFile()){var t=e._modelSetting.getUserDataFile();fetch(e._modelHomeDir+"/"+t).then((function(t){return t.arrayBuffer()})).then((function(t){e.loadUserData(t,t.byteLength),e._state=a.SetupEyeBlinkIds,h()})),e._state=a.WaitLoadUserData}else e._state=a.SetupEyeBlinkIds,h()},h=function(){for(var t=e._modelSetting.getEyeBlinkParameterCount(),i=0;i=e&&(t._state=a.CompleteSetup)})),r.getRenderer().setIsPremultipliedAlpha(!0)},r=this,n=0;n=0&&s.setFadeInTime(o),(o=n._modelSetting.getMotionFadeOutTimeValue(t,e))>=0&&s.setFadeOutTime(o),s.setEffectIds(n._eyeBlinkIds,n._lipSyncIds),u=!0})):s.setFinishedMotionHandler(r),this._debugMode&&I.LAppPal.printMessage("[APP]start motion: ["+t+"_"+e),this._motionManager.startMotionPriority(s,u,i)},e.prototype.startRandomMotion=function(t,e,i){if(0==this._modelSetting.getMotionCount(t))return y;var r=Math.floor(Math.random()*this._modelSetting.getMotionCount(t));return this.startMotion(t,r,e,i)},e.prototype.setExpression=function(t){var e=this._expressions.getValue(t);this._debugMode&&I.LAppPal.printMessage("[APP]expression: ["+t+"]"),null!=e?this._expressionManager.startMotionPriority(e,!1,V.PriorityForce):this._debugMode&&I.LAppPal.printMessage("[APP]expression["+t+"] is null")},e.prototype.setRandomExpression=function(){if(0!=this._expressions.getSize())for(var t=Math.floor(Math.random()*this._expressions.getSize()),e=0;e ["+o+"]"),fetch(r._modelHomeDir+"/"+n).then((function(t){return t.arrayBuffer()})).then((function(r){var n=e.loadMotion(r,r.byteLength,o),s=e._modelSetting.getMotionFadeInTimeValue(t,i);s>=0&&n.setFadeInTime(s),(s=e._modelSetting.getMotionFadeOutTimeValue(t,i))>=0&&n.setFadeOutTime(s),n.setEffectIds(e._eyeBlinkIds,e._lipSyncIds),null!=e._motions.getValue(o)&&M.delete(e._motions.getValue(o)),e._motions.setValue(o,n),e._motionCount++,e._motionCount>=e._allMotionCount&&(e._state=a.LoadTexture,document.getElementById("live2d-hidden").style.display="none",e._motionManager&&(e._motionManager.stopAllMotions(),e.createRenderer(),e.setupTextures(),e.getRenderer().startUp(F.gl)),e._updating=!1,e._initialized=!0,document.getElementById("live2d").style.visibility="visible")}))},r=this,n=0;ns&&(s=p),cl&&(l=c)}var g=this._modelMatrix.invertTransformX(e),d=this._modelMatrix.invertTransformY(i);return a<=g&&g<=s&&u<=d&&d<=l},t.prototype.getModel=function(){return this._model},t.prototype.getRenderer=function(){return this._renderer},t.prototype.createRenderer=function(){this._renderer&&this.deleteRenderer(),this._renderer=new f,this._renderer.initialize(this._model)},t.prototype.deleteRenderer=function(){null!=this._renderer&&(this._renderer.release(),this._renderer=null)},t.prototype.motionEventFired=function(t){_.CubismLogInfo("{0}",t.s)},t.cubismDefaultMotionEventCallback=function(t,e,i){null!=i&&i.motionEventFired(e)},t.prototype.release=function(){null!=this._motionManager&&(this._motionManager.release(),this._motionManager=null),null!=this._expressionManager&&(this._expressionManager.release(),this._expressionManager=null),null!=this._moc&&(this._moc.deleteModel(this._model),this._moc.release(),this._moc=null),this._modelMatrix=null,x.delete(this._pose),y.delete(this._eyeBlink),v.delete(this._breath),this._dragManager=null,b.delete(this._physics),C.delete(this._modelUserData),this.deleteRenderer()},t}();t.CubismUserModel=e}(e.Live2DCubismFramework||(e.Live2DCubismFramework={}))},function(t,e,i){"use strict";var r,n=this&&this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(t,e)},function(t,e){function i(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)});Object.defineProperty(e,"__esModule",{value:!0});var o=i(16).Live2DCubismFramework.CubismMotionQueueManager;!function(t){var e=function(t){function e(){var e=t.call(this)||this;return e._currentPriority=0,e._reservePriority=0,e}return n(e,t),e.prototype.getCurrentPriority=function(){return this._currentPriority},e.prototype.getReservePriority=function(){return this._reservePriority},e.prototype.setReservePriority=function(t){this._reservePriority=t},e.prototype.startMotionPriority=function(e,i,r){return r==this._reservePriority&&(this._reservePriority=0),this._currentPriority=r,t.prototype.startMotion.call(this,e,i,this._userTimeSeconds)},e.prototype.updateMotion=function(e,i){this._userTimeSeconds+=i;var r=t.prototype.doUpdateMotion.call(this,e,this._userTimeSeconds);return this.isFinished()&&(this._currentPriority=0),r},e.prototype.reserveMotion=function(t){return!(t<=this._reservePriority||t<=this._currentPriority)&&(this._reservePriority=t,!0)},e}(o);t.CubismMotionManager=e}(e.Live2DCubismFramework||(e.Live2DCubismFramework={}))},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=i(10).Live2DCubismFramework.ACubismMotion;!function(t){var e=function(){function t(){this._autoDelete=!1,this._motion=null,this._available=!0,this._finished=!1,this._started=!1,this._startTimeSeconds=-1,this._fadeInStartTimeSeconds=0,this._endTimeSeconds=-1,this._stateTimeSeconds=0,this._stateWeight=0,this._lastEventCheckSeconds=0,this._motionQueueEntryHandle=this}return t.prototype.release=function(){this._autoDelete&&this._motion&&r.delete(this._motion)},t.prototype.startFadeout=function(t,e){var i=e+t;(this._endTimeSeconds<0||ii)&&(u*=i/h,l*=i/h),this._faceVX+=u,this._faceVY+=l;var p=.5*(r.sqrt(i*i+16*i*a-8*i*a)-i),c=r.sqrt(this._faceVX*this._faceVX+this._faceVY*this._faceVY);c>p&&(this._faceVX*=p/c,this._faceVY*=p/c),this._faceX+=this._faceVX,this._faceY+=this._faceVY}}else this._lastTimeSeconds=this._userTimeSeconds},t.prototype.getX=function(){return this._faceX},t.prototype.getY=function(){return this._faceY},t.prototype.set=function(t,e){this._faceTargetX=t,this._faceTargetY=e},t}();t.CubismTargetPoint=e}(e.Live2DCubismFramework||(e.Live2DCubismFramework={}))},function(t,e,i){"use strict";var r,n=this&&this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(t,e)},function(t,e){function i(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)});Object.defineProperty(e,"__esModule",{value:!0});var o=i(7).Live2DCubismFramework.CubismMatrix44;!function(t){var e=function(t){function e(e,i){var r=t.call(this)||this;return r._width=void 0!==e?e:0,r._height=void 0!==i?i:0,r.setHeight(1),r}return n(e,t),e.prototype.setWidth=function(t){var e=t/this._width,i=e;this.scale(2.6*e,2.6*i)},e.prototype.setHeight=function(t){var e=t/this._height,i=e;this.scale(2.6*e,2.6*i)},e.prototype.setPosition=function(t,e){this.translate(t,e)},e.prototype.setCenterPosition=function(t,e){this.centerX(t),this.centerY(e)},e.prototype.top=function(t){this.setY(t)},e.prototype.bottom=function(t){var e=this._height*this.getScaleY();this.translateY(t-e)},e.prototype.left=function(t){this.setX(t)},e.prototype.right=function(t){var e=this._width*this.getScaleX();this.translateX(t-e)},e.prototype.centerX=function(t){var e=this._width*this.getScaleX();this.translateX(t-e/2)},e.prototype.setX=function(t){this.translateX(t)},e.prototype.centerY=function(t){var e=this._height*this.getScaleY();this.translateY(t-e/2)},e.prototype.setY=function(t){this.translateY(t)},e.prototype.setupFromLayout=function(t){for(var e=t.begin();e.notEqual(t.end());e.preIncrement()){var i=e.ptr().first,r=e.ptr().second;"width"==i?this.setWidth(r):"height"==i&&this.setHeight(r)}for(e=t.begin();e.notEqual(t.end());e.preIncrement()){i=e.ptr().first,r=e.ptr().second;"x"==i?this.setX(r):"y"==i?this.setY(r):"center_x"==i?this.centerX(r):"center_y"==i?this.centerY(r):"top"==i?this.top(r):"bottom"==i?this.bottom(r):"left"==i?this.left(r):"right"==i&&this.right(r)}},e}(o);t.CubismModelMatrix=e}(e.Live2DCubismFramework||(e.Live2DCubismFramework={}))},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=i(34).Live2DCubismFramework.CubismModel,n=i(4);!function(t){var e=function(){function t(t){this._moc=t,this._modelCount=0}return t.create=function(e){var i=null,r=Live2DCubismCore.Moc.fromArrayBuffer(e);return r&&(i=new t(r)),i},t.delete=function(t){t._moc._release(),t._moc=null,t=null},t.prototype.createModel=function(){var t=null,e=Live2DCubismCore.Model.fromMoc(this._moc);return e&&((t=new r(e)).initialize(),++this._modelCount),t},t.prototype.deleteModel=function(t){null!=t&&(t.release(),t=null,--this._modelCount)},t.prototype.release=function(){n.CSM_ASSERT(0==this._modelCount),this._moc._release(),this._moc=null},t}();t.CubismMoc=e}(e.Live2DCubismFramework||(e.Live2DCubismFramework={}))},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=i(15),n=i(0),o=i(9),a=i(1),s=i(4),u=n.Live2DCubismFramework.CubismFramework,l=r.Live2DCubismFramework.CubismBlendMode,h=a.Live2DCubismFramework.csmVector,p=o.Live2DCubismFramework.csmMap;!function(t){var e=function(){function t(t){this._model=t,this._parameterValues=null,this._parameterMaximumValues=null,this._parameterMinimumValues=null,this._partOpacities=null,this._savedParameters=new h,this._parameterIds=new h,this._drawableIds=new h,this._partIds=new h,this._notExistPartId=new p,this._notExistParameterId=new p,this._notExistParameterValues=new p,this._notExistPartOpacities=new p}return t.prototype.update=function(){this._model.update(),this._model.drawables.resetDynamicFlags()},t.prototype.getCanvasWidth=function(){return null==this._model?0:this._model.canvasinfo.CanvasWidth/this._model.canvasinfo.PixelsPerUnit},t.prototype.getCanvasHeight=function(){return null==this._model?0:this._model.canvasinfo.CanvasHeight/this._model.canvasinfo.PixelsPerUnit},t.prototype.saveParameters=function(){for(var t=this._model.parameters.count,e=this._savedParameters.getSize(),i=0;ie&&(e=this._model.parameters.minimumValues[t]),this._parameterValues[t]=1==i?e:this._parameterValues[t]=this._parameterValues[t]*(1-i)+e*i)},t.prototype.setParameterValueById=function(t,e,i){void 0===i&&(i=1);var r=this.getParameterIndex(t);this.setParameterValueByIndex(r,e,i)},t.prototype.addParameterValueByIndex=function(t,e,i){void 0===i&&(i=1),this.setParameterValueByIndex(t,this.getParameterValueByIndex(t)+e*i)},t.prototype.addParameterValueById=function(t,e,i){void 0===i&&(i=1);var r=this.getParameterIndex(t);this.addParameterValueByIndex(r,e,i)},t.prototype.multiplyParameterValueById=function(t,e,i){void 0===i&&(i=1);var r=this.getParameterIndex(t);this.multiplyParameterValueByIndex(r,e,i)},t.prototype.multiplyParameterValueByIndex=function(t,e,i){void 0===i&&(i=1),this.setParameterValueByIndex(t,this.getParameterValueByIndex(t)*(1+(e-1)*i))},t.prototype.getDrawableIndex=function(t){for(var e=this._model.drawables.count,i=0;ie&&(t=e);for(var i=0;i0&&(i=(e-t[0].time)/(t[1].time-t[0].time)),i<0&&(i=0),t[0].value+(t[1].value-t[0].value)*i}function r(t,i){var r=(i-t[0].time)/(t[3].time-t[0].time);r<0&&(r=0);var n=e(t[0],t[1],r),o=e(t[1],t[2],r),a=e(t[2],t[3],r),s=e(n,o,r),u=e(o,a,r);return e(s,u,r).value}function o(t,e){return t[0].value}function a(t,e){return t[1].value}function s(t,e,i){for(var r=t.curves.at(e),n=-1,o=r.baseSegmentIndex+r.segmentCount,a=0,s=r.baseSegmentIndex;s=t.points._size&&(a=t.points._size-3),t.points.at(a).time>i){n=s;break}if(-1==n)return t.points.at(a).value;var u=t.segments.at(n);return u.evaluate(t.points.get(u.basePointIndex),i)}var u=function(t){function e(){var e=t.call(this)||this;return e._sourceFrameRate=30,e._loopDurationSeconds=-1,e._isLoop=!1,e._isLoopFadeIn=!0,e._lastWeight=0,e._motionData=null,e._modelCurveIdEyeBlink=null,e._modelCurveIdLipSync=null,e._eyeBlinkParameterIds=null,e._lipSyncParameterIds=null,e}return n(e,t),e.create=function(t,i,r){var n=new e;return n.parse(t,i),n._sourceFrameRate=n._motionData.fps,n._loopDurationSeconds=n._motionData.duration,n._onFinishedMotion=r,n},e.prototype.doUpdateParameters=function(t,e,i,r){null==this._modelCurveIdEyeBlink&&(this._modelCurveIdEyeBlink=b.getIdManager().getId("EyeBlink")),null==this._modelCurveIdLipSync&&(this._modelCurveIdLipSync=b.getIdManager().getId("LipSync"));var n=e-r.getStartTime();n<0&&(n=0);var o=Number.MAX_VALUE,a=Number.MAX_VALUE,u=0,l=0;this._eyeBlinkParameterIds.getSize()>64&&p.CubismLogDebug("too many eye blink targets : {0}",this._eyeBlinkParameterIds.getSize()),this._lipSyncParameterIds.getSize()>64&&p.CubismLogDebug("too many lip sync targets : {0}",this._lipSyncParameterIds.getSize());var h,c,g,d=this._fadeInSeconds<=0?1:S.getEasingSine((e-r.getFadeInStartTime())/this._fadeInSeconds),m=this._fadeOutSeconds<=0||r.getEndTime()<0?1:S.getEasingSine((r.getEndTime()-e)/this._fadeOutSeconds),_=n;if(this._isLoop)for(;_>this._motionData.duration;)_-=this._motionData.duration;var f=this._motionData.curves;for(c=0;c>C&1)){x=y+(a-y)*i;t.setParameterValueById(this._eyeBlinkParameterIds.at(C),x)}}if(o!=Number.MAX_VALUE)for(C=0;C>C&1)){x=y+(o-y)*i;t.setParameterValueById(this._lipSyncParameterIds.at(C),x)}}for(;c=this._motionData.duration&&(this._isLoop?(r.setStartTime(e),this._isLoopFadeIn&&r.setFadeInStartTime(e)):(this._onFinishedMotion&&this._onFinishedMotion(this),r.setIsFinished(!0))),this._lastWeight=i},e.prototype.setIsLoop=function(t){this._isLoop=t},e.prototype.isLoop=function(){return this._isLoop},e.prototype.setIsLoopFadeIn=function(t){this._isLoopFadeIn=t},e.prototype.isLoopFadeIn=function(){return this._isLoopFadeIn},e.prototype.getDuration=function(){return this._isLoop?-1:this._loopDurationSeconds},e.prototype.getLoopDuration=function(){return this._loopDurationSeconds},e.prototype.setParameterFadeInTime=function(t,e){for(var i=this._motionData.curves,r=0;rt&&this._motionData.events.at(i).fireTime<=e&&this._firedEventValues.pushBack(new c(this._motionData.events.at(i).value.s));return this._firedEventValues},e}(C);t.CubismMotion=u}(e.Live2DCubismFramework||(e.Live2DCubismFramework={}))},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=i(6),n=i(0),o=i(8).Live2DCubismFramework.csmString,a=n.Live2DCubismFramework.CubismFramework,s=r.Live2DCubismFramework.CubismJson;!function(t){var e="Meta",i=function(){function t(t,e){this._json=s.create(t,e)}return t.prototype.release=function(){s.delete(this._json)},t.prototype.getMotionDuration=function(){return this._json.getRoot().getValueByString(e).getValueByString("Duration").toFloat()},t.prototype.isMotionLoop=function(){return this._json.getRoot().getValueByString(e).getValueByString("Loop").toBoolean()},t.prototype.getMotionCurveCount=function(){return this._json.getRoot().getValueByString(e).getValueByString("CurveCount").toInt()},t.prototype.getMotionFps=function(){return this._json.getRoot().getValueByString(e).getValueByString("Fps").toFloat()},t.prototype.getMotionTotalSegmentCount=function(){return this._json.getRoot().getValueByString(e).getValueByString("TotalSegmentCount").toInt()},t.prototype.getMotionTotalPointCount=function(){return this._json.getRoot().getValueByString(e).getValueByString("TotalPointCount").toInt()},t.prototype.isExistMotionFadeInTime=function(){return!this._json.getRoot().getValueByString(e).getValueByString("FadeInTime").isNull()},t.prototype.isExistMotionFadeOutTime=function(){return!this._json.getRoot().getValueByString(e).getValueByString("FadeOutTime").isNull()},t.prototype.getMotionFadeInTime=function(){return this._json.getRoot().getValueByString(e).getValueByString("FadeInTime").toFloat()},t.prototype.getMotionFadeOutTime=function(){return this._json.getRoot().getValueByString(e).getValueByString("FadeOutTime").toFloat()},t.prototype.getMotionCurveTarget=function(t){return this._json.getRoot().getValueByString("Curves").getValueByIndex(t).getValueByString("Target").getRawString()},t.prototype.getMotionCurveId=function(t){return a.getIdManager().getId(this._json.getRoot().getValueByString("Curves").getValueByIndex(t).getValueByString("Id").getRawString())},t.prototype.isExistMotionCurveFadeInTime=function(t){return!this._json.getRoot().getValueByString("Curves").getValueByIndex(t).getValueByString("FadeInTime").isNull()},t.prototype.isExistMotionCurveFadeOutTime=function(t){return!this._json.getRoot().getValueByString("Curves").getValueByIndex(t).getValueByString("FadeOutTime").isNull()},t.prototype.getMotionCurveFadeInTime=function(t){return this._json.getRoot().getValueByString("Curves").getValueByIndex(t).getValueByString("FadeInTime").toFloat()},t.prototype.getMotionCurveFadeOutTime=function(t){return this._json.getRoot().getValueByString("Curves").getValueByIndex(t).getValueByString("FadeOutTime").toFloat()},t.prototype.getMotionCurveSegmentCount=function(t){return this._json.getRoot().getValueByString("Curves").getValueByIndex(t).getValueByString("Segments").getVector().getSize()},t.prototype.getMotionCurveSegment=function(t,e){return this._json.getRoot().getValueByString("Curves").getValueByIndex(t).getValueByString("Segments").getValueByIndex(e).toFloat()},t.prototype.getEventCount=function(){return this._json.getRoot().getValueByString(e).getValueByString("UserDataCount").toInt()},t.prototype.getTotalEventValueSize=function(){return this._json.getRoot().getValueByString(e).getValueByString("TotalUserDataSize").toInt()},t.prototype.getEventTime=function(t){return this._json.getRoot().getValueByString("UserData").getValueByIndex(t).getValueByString("Time").toInt()},t.prototype.getEventValue=function(t){return new o(this._json.getRoot().getValueByString("UserData").getValueByIndex(t).getValueByString("Value").getRawString())},t}();t.CubismMotionJson=i}(e.Live2DCubismFramework||(e.Live2DCubismFramework={}))},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=i(1).Live2DCubismFramework.csmVector;!function(t){var e;!function(t){t[t.CubismMotionCurveTarget_Model=0]="CubismMotionCurveTarget_Model",t[t.CubismMotionCurveTarget_Parameter=1]="CubismMotionCurveTarget_Parameter",t[t.CubismMotionCurveTarget_PartOpacity=2]="CubismMotionCurveTarget_PartOpacity"}(e=t.CubismMotionCurveTarget||(t.CubismMotionCurveTarget={})),function(t){t[t.CubismMotionSegmentType_Linear=0]="CubismMotionSegmentType_Linear",t[t.CubismMotionSegmentType_Bezier=1]="CubismMotionSegmentType_Bezier",t[t.CubismMotionSegmentType_Stepped=2]="CubismMotionSegmentType_Stepped",t[t.CubismMotionSegmentType_InverseStepped=3]="CubismMotionSegmentType_InverseStepped"}(t.CubismMotionSegmentType||(t.CubismMotionSegmentType={}));var i=function(){this.time=0,this.value=0};t.CubismMotionPoint=i;var n=function(){this.evaluate=null,this.basePointIndex=0,this.segmentType=0};t.CubismMotionSegment=n;var o=function(){this.type=e.CubismMotionCurveTarget_Model,this.segmentCount=0,this.baseSegmentIndex=0,this.fadeInTime=0,this.fadeOutTime=0};t.CubismMotionCurve=o;var a=function(){this.fireTime=0};t.CubismMotionEvent=a;var s=function(){this.duration=0,this.loop=!1,this.curveCount=0,this.eventCount=0,this.fps=0,this.curves=new r,this.segments=new r,this.points=new r,this.events=new r};t.CubismMotionData=s}(e.Live2DCubismFramework||(e.Live2DCubismFramework={}))},function(t,e,i){"use strict";var r,n=this&&this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(t,e)},function(t,e){function i(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)});Object.defineProperty(e,"__esModule",{value:!0});var o=i(10),a=i(6),s=i(0),u=i(1).Live2DCubismFramework.csmVector,l=s.Live2DCubismFramework.CubismFramework,h=a.Live2DCubismFramework.CubismJson,p=o.Live2DCubismFramework.ACubismMotion;!function(t){var e,i=function(t){function i(){var e=t.call(this)||this;return e._parameters=new u,e}return n(i,t),i.create=function(t,n){var o=new i,a=h.create(t,n),s=a.getRoot();o.setFadeInTime(s.getValueByString("FadeInTime").toFloat(1)),o.setFadeOutTime(s.getValueByString("FadeOutTime").toFloat(1));var u=s.getValueByString("Parameters").getSize();o._parameters.prepareCapacity(u);for(var p=0;p.001){if(n>=0)break;n=a,o=t.getPartOpacityByIndex(s),(o+=e/this._fadeTimeSeconds)>1&&(o=1)}}n<0&&(n=0,o=1);for(a=i;a.15&&(p=1-.15/(1-o)),h>p&&(h=p),t.setPartOpacityByIndex(l,h)}}},t}();t.CubismPose=e;var i=function(){function t(t){if(this.parameterIndex=0,this.partIndex=0,this.link=new a,null!=t){this.partId=t.partId;for(var e=t.link.begin();e.notEqual(t.link.end());e.preIncrement())this.link.pushBack(e.ptr().clone())}}return t.prototype.assignment=function(t){this.partId=t.partId;for(var e=t.link.begin();e.notEqual(t.link.end());e.preIncrement())this.link.pushBack(e.ptr().clone());return this},t.prototype.initialize=function(t){this.parameterIndex=t.getParameterIndex(this.partId),this.partIndex=t.getPartIndex(this.partId),t.setParameterValueByIndex(this.parameterIndex,1)},t.prototype.clone=function(){var e=new t;e.partId=this.partId,e.parameterIndex=this.parameterIndex,e.partIndex=this.partIndex,e.link=new a;for(var i=this.link.begin();i.notEqual(this.link.end());i.increment())e.link.pushBack(i.ptr().clone());return e},t}();t.PartData=i}(e.Live2DCubismFramework||(e.Live2DCubismFramework={}))},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=i(41),n=i(8),o=i(1),a=i(0).Live2DCubismFramework.CubismFramework,s=o.Live2DCubismFramework.csmVector,u=n.Live2DCubismFramework.csmString,l=r.Live2DCubismFramework.CubismModelUserDataJson;!function(t){var e=function(){};t.CubismModelUserDataNode=e;var i=function(){function t(){this._userDataNodes=new s,this._artMeshUserDataNode=new s}return t.create=function(e,i){var r=new t;return r.parseUserData(e,i),r},t.delete=function(t){null!=t&&(t.release(),t=null)},t.prototype.getArtMeshUserDatas=function(){return this._artMeshUserDataNode},t.prototype.parseUserData=function(t,i){for(var r=new l(t,i),n=a.getIdManager().getId("ArtMesh"),o=r.getUserDataCount(),s=0;s=a.particleCount)break;-1==l[y].destinationParameterIndex&&(l[y].destinationParameterIndex=t.getParameterIndex(l[y].destination.id));var S=new m;S.x=h[v].position.x-h[v-1].position.x,S.y=h[v].position.y-h[v-1].position.y,o=l[y].getValue(S,h,v,l[y].reflect,this._options.gravity);var b=l[y].destinationParameterIndex,C=!Float32Array.prototype.slice&&"subarray"in Float32Array.prototype?JSON.parse(JSON.stringify(p.subarray(b))):p.slice(b);M(C,g[b],c[b],o,l[y]);for(var L=b,P=0;L=2?e[i-1].position.substract(e[i-2].position):n.multiplyByScaler(-1),o=s.directionToRadian(n,t),r&&(o*=-1),o}function v(t,e){return s.min(t,e)+function(t,e){var i=s.max(t,e),r=s.min(t,e);return s.abs(i-r)}(t,e)/2}function S(t,e){return JSON.parse(JSON.stringify(t.x))}function b(t,e){return JSON.parse(JSON.stringify(t.y))}function C(t,e){return JSON.parse(JSON.stringify(e))}function x(t,e,i,r,n,o,a,u){var l,h,p,c,g=new m(0,0),d=new m(0,0),_=new m(0,0),f=new m(0,0);t[0].position=new m(i.x,i.y),l=s.degreesToRadian(r),(c=s.radianToDirection(l)).normalize();for(var y=1;yi&&(o>n.valueExceededMaximum&&(n.valueExceededMaximum=o),o=i),(a=n.weight/100)>=1?t[0]=o:(o=t[0]*(1-a)+o*a,t[0]=o)}function L(t,e,i,r,n,o,a,u){var l=0,h=s.max(i,e);ht&&(t=p);var c=s.min(n,o),g=s.max(n,o),d=a,m=v(p,h),_=t-m;switch(function(t){var e=0;return t>0?e=1:t<0&&(e=-1),e}(_)){case 1:var f=g-d;0!=(y=h-m)&&(l=_*(f/y),l+=d);break;case-1:var y;f=c-d;0!=(y=p-m)&&(l=_*(f/y),l+=d);break;case 0:l=d}return u?l:-1*l}t.Options=i}(e.Live2DCubismFramework||(e.Live2DCubismFramework={}))},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=i(12),n=i(1).Live2DCubismFramework.csmVector,o=r.Live2DCubismFramework.CubismVector2;!function(t){!function(t){t[t.CubismPhysicsTargetType_Parameter=0]="CubismPhysicsTargetType_Parameter"}(t.CubismPhysicsTargetType||(t.CubismPhysicsTargetType={})),function(t){t[t.CubismPhysicsSource_X=0]="CubismPhysicsSource_X",t[t.CubismPhysicsSource_Y=1]="CubismPhysicsSource_Y",t[t.CubismPhysicsSource_Angle=2]="CubismPhysicsSource_Angle"}(t.CubismPhysicsSource||(t.CubismPhysicsSource={}));var e=function(){this.gravity=new o(0,0),this.wind=new o(0,0)};t.PhysicsJsonEffectiveForces=e;var i=function(){};t.CubismPhysicsParameter=i;var r=function(){};t.CubismPhysicsNormalization=r;var a=function(){this.initialPosition=new o(0,0),this.position=new o(0,0),this.lastPosition=new o(0,0),this.lastGravity=new o(0,0),this.force=new o(0,0),this.velocity=new o(0,0)};t.CubismPhysicsParticle=a;var s=function(){this.normalizationPosition=new r,this.normalizationAngle=new r};t.CubismPhysicsSubRig=s;var u=function(){this.source=new i};t.CubismPhysicsInput=u;var l=function(){this.destination=new i,this.translationScale=new o(0,0)};t.CubismPhysicsOutput=l;var h=function(){this.settings=new n,this.inputs=new n,this.outputs=new n,this.particles=new n,this.gravity=new o(0,0),this.wind=new o(0,0)};t.CubismPhysicsRig=h}(e.Live2DCubismFramework||(e.Live2DCubismFramework={}))},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=i(6),n=i(12),o=i(0).Live2DCubismFramework.CubismFramework,a=n.Live2DCubismFramework.CubismVector2,s=r.Live2DCubismFramework.CubismJson;!function(t){var e="Meta",i="PhysicsSettings",r=function(){function t(t,e){this._json=s.create(t,e)}return t.prototype.release=function(){s.delete(this._json)},t.prototype.getGravity=function(){var t=new a(0,0);return t.x=this._json.getRoot().getValueByString(e).getValueByString("EffectiveForces").getValueByString("Gravity").getValueByString("X").toFloat(),t.y=this._json.getRoot().getValueByString(e).getValueByString("EffectiveForces").getValueByString("Gravity").getValueByString("Y").toFloat(),t},t.prototype.getWind=function(){var t=new a(0,0);return t.x=this._json.getRoot().getValueByString(e).getValueByString("EffectiveForces").getValueByString("Wind").getValueByString("X").toFloat(),t.y=this._json.getRoot().getValueByString(e).getValueByString("EffectiveForces").getValueByString("Wind").getValueByString("Y").toFloat(),t},t.prototype.getSubRigCount=function(){return this._json.getRoot().getValueByString(e).getValueByString("PhysicsSettingCount").toInt()},t.prototype.getTotalInputCount=function(){return this._json.getRoot().getValueByString(e).getValueByString("TotalInputCount").toInt()},t.prototype.getTotalOutputCount=function(){return this._json.getRoot().getValueByString(e).getValueByString("TotalOutputCount").toInt()},t.prototype.getVertexCount=function(){return this._json.getRoot().getValueByString(e).getValueByString("VertexCount").toInt()},t.prototype.getNormalizationPositionMinimumValue=function(t){return this._json.getRoot().getValueByString(i).getValueByIndex(t).getValueByString("Normalization").getValueByString("Position").getValueByString("Minimum").toFloat()},t.prototype.getNormalizationPositionMaximumValue=function(t){return this._json.getRoot().getValueByString(i).getValueByIndex(t).getValueByString("Normalization").getValueByString("Position").getValueByString("Maximum").toFloat()},t.prototype.getNormalizationPositionDefaultValue=function(t){return this._json.getRoot().getValueByString(i).getValueByIndex(t).getValueByString("Normalization").getValueByString("Position").getValueByString("Default").toFloat()},t.prototype.getNormalizationAngleMinimumValue=function(t){return this._json.getRoot().getValueByString(i).getValueByIndex(t).getValueByString("Normalization").getValueByString("Angle").getValueByString("Minimum").toFloat()},t.prototype.getNormalizationAngleMaximumValue=function(t){return this._json.getRoot().getValueByString(i).getValueByIndex(t).getValueByString("Normalization").getValueByString("Angle").getValueByString("Maximum").toFloat()},t.prototype.getNormalizationAngleDefaultValue=function(t){return this._json.getRoot().getValueByString(i).getValueByIndex(t).getValueByString("Normalization").getValueByString("Angle").getValueByString("Default").toFloat()},t.prototype.getInputCount=function(t){return this._json.getRoot().getValueByString(i).getValueByIndex(t).getValueByString("Input").getVector().getSize()},t.prototype.getInputWeight=function(t,e){return this._json.getRoot().getValueByString(i).getValueByIndex(t).getValueByString("Input").getValueByIndex(e).getValueByString("Weight").toFloat()},t.prototype.getInputReflect=function(t,e){return this._json.getRoot().getValueByString(i).getValueByIndex(t).getValueByString("Input").getValueByIndex(e).getValueByString("Reflect").toBoolean()},t.prototype.getInputType=function(t,e){return this._json.getRoot().getValueByString(i).getValueByIndex(t).getValueByString("Input").getValueByIndex(e).getValueByString("Type").getRawString()},t.prototype.getInputSourceId=function(t,e){return o.getIdManager().getId(this._json.getRoot().getValueByString(i).getValueByIndex(t).getValueByString("Input").getValueByIndex(e).getValueByString("Source").getValueByString("Id").getRawString())},t.prototype.getOutputCount=function(t){return this._json.getRoot().getValueByString(i).getValueByIndex(t).getValueByString("Output").getVector().getSize()},t.prototype.getOutputVertexIndex=function(t,e){return this._json.getRoot().getValueByString(i).getValueByIndex(t).getValueByString("Output").getValueByIndex(e).getValueByString("VertexIndex").toInt()},t.prototype.getOutputAngleScale=function(t,e){return this._json.getRoot().getValueByString(i).getValueByIndex(t).getValueByString("Output").getValueByIndex(e).getValueByString("Scale").toFloat()},t.prototype.getOutputWeight=function(t,e){return this._json.getRoot().getValueByString(i).getValueByIndex(t).getValueByString("Output").getValueByIndex(e).getValueByString("Weight").toFloat()},t.prototype.getOutputDestinationId=function(t,e){return o.getIdManager().getId(this._json.getRoot().getValueByString(i).getValueByIndex(t).getValueByString("Output").getValueByIndex(e).getValueByString("Destination").getValueByString("Id").getRawString())},t.prototype.getOutputType=function(t,e){return this._json.getRoot().getValueByString(i).getValueByIndex(t).getValueByString("Output").getValueByIndex(e).getValueByString("Type").getRawString()},t.prototype.getOutputReflect=function(t,e){return this._json.getRoot().getValueByString(i).getValueByIndex(t).getValueByString("Output").getValueByIndex(e).getValueByString("Reflect").toBoolean()},t.prototype.getParticleCount=function(t){return this._json.getRoot().getValueByString(i).getValueByIndex(t).getValueByString("Vertices").getVector().getSize()},t.prototype.getParticleMobility=function(t,e){return this._json.getRoot().getValueByString(i).getValueByIndex(t).getValueByString("Vertices").getValueByIndex(e).getValueByString("Mobility").toFloat()},t.prototype.getParticleDelay=function(t,e){return this._json.getRoot().getValueByString(i).getValueByIndex(t).getValueByString("Vertices").getValueByIndex(e).getValueByString("Delay").toFloat()},t.prototype.getParticleAcceleration=function(t,e){return this._json.getRoot().getValueByString(i).getValueByIndex(t).getValueByString("Vertices").getValueByIndex(e).getValueByString("Acceleration").toFloat()},t.prototype.getParticleRadius=function(t,e){return this._json.getRoot().getValueByString(i).getValueByIndex(t).getValueByString("Vertices").getValueByIndex(e).getValueByString("Radius").toInt()},t.prototype.getParticlePosition=function(t,e){var r=new a(0,0);return r.x=this._json.getRoot().getValueByString(i).getValueByIndex(t).getValueByString("Vertices").getValueByIndex(e).getValueByString("Position").getValueByString("X").toFloat(),r.y=this._json.getRoot().getValueByString(i).getValueByIndex(t).getValueByString("Vertices").getValueByIndex(e).getValueByString("Position").getValueByString("Y").toFloat(),r},t}();t.CubismPhysicsJson=r}(e.Live2DCubismFramework||(e.Live2DCubismFramework={}))},function(t,e,i){"use strict";var r,n=this&&this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(t,e)},function(t,e){function i(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)});Object.defineProperty(e,"__esModule",{value:!0});var o=i(0),a=i(46),s=i(15),u=i(7),l=i(9),h=i(1),p=i(4),c=o.Live2DCubismFramework.Constant,g=u.Live2DCubismFramework.CubismMatrix44,d=a.Live2DCubismFramework.csmRect,m=l.Live2DCubismFramework.csmMap,_=h.Live2DCubismFramework.csmVector,f=s.Live2DCubismFramework.CubismRenderer,y=s.Live2DCubismFramework.CubismBlendMode,v=s.Live2DCubismFramework.CubismTextureColor;!function(t){var e,i,r,o=function(){function t(){this._maskRenderTexture=null,this._colorBuffer=null,this._currentFrameNo=0,this._clippingMaskBufferSize=256,this._clippingContextListForMask=new _,this._clippingContextListForDraw=new _,this._channelColors=new _,this._tmpBoundsOnModel=new d,this._tmpMatrix=new g,this._tmpMatrixForMask=new g,this._tmpMatrixForDraw=new g,this._maskTexture=null;var t=new v;t.R=1,t.G=0,t.B=0,t.A=0,this._channelColors.pushBack(t),(t=new v).R=0,t.G=1,t.B=0,t.A=0,this._channelColors.pushBack(t),(t=new v).R=0,t.G=0,t.B=1,t.A=0,this._channelColors.pushBack(t),(t=new v).R=0,t.G=0,t.B=0,t.A=1,this._channelColors.pushBack(t)}return t.prototype.getChannelFlagAsColor=function(t){return this._channelColors.at(t)},t.prototype.getMaskRenderTexture=function(){var t=0;if(this._maskTexture&&0!=this._maskTexture.texture&&(this._maskTexture.frameNo=this._currentFrameNo,t=this._maskTexture.texture),0==t){var e=this._clippingMaskBufferSize;this._colorBuffer=this.gl.createTexture(),this.gl.bindTexture(this.gl.TEXTURE_2D,this._colorBuffer),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,e,e,0,this.gl.RGBA,this.gl.UNSIGNED_BYTE,null),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.bindTexture(this.gl.TEXTURE_2D,null),t=this.gl.createFramebuffer(),this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,t),this.gl.framebufferTexture2D(this.gl.FRAMEBUFFER,this.gl.COLOR_ATTACHMENT0,this.gl.TEXTURE_2D,this._colorBuffer,0),this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,r),this._maskTexture=new a(this._currentFrameNo,t)}return t},t.prototype.setGL=function(t){this.gl=t},t.prototype.calcClippedDrawTotalBounds=function(t,e){for(var i=Number.MAX_VALUE,r=Number.MAX_VALUE,n=Number.MIN_VALUE,o=Number.MIN_VALUE,a=e._clippedDrawableIndexList.length,s=0;sd&&(d=y),vm&&(m=v)}if(p!=Number.MAX_VALUE)if(pn&&(n=d),m>o&&(o=m),i==Number.MAX_VALUE)e._allClippedDrawRect.x=0,e._allClippedDrawRect.y=0,e._allClippedDrawRect.width=0,e._allClippedDrawRect.height=0,e._isUsing=!1;else{e._isUsing=!0;var S=n-i,b=o-r;e._allClippedDrawRect.x=i,e._allClippedDrawRect.y=r,e._allClippedDrawRect.width=S,e._allClippedDrawRect.height=b}}},t.prototype.release=function(){for(var t=0;t0){this.gl.viewport(0,0,this._clippingMaskBufferSize,this._clippingMaskBufferSize),this._maskRenderTexture=this.getMaskRenderTexture();e.getMvpMatrix();e.preDraw(),this.setupLayoutBounds(n),this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,this._maskRenderTexture),this.gl.clearColor(1,1,1,1),this.gl.clear(this.gl.COLOR_BUFFER_BIT);for(o=0;o-1};function h(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function p(t){return"string"!=typeof t&&(t=String(t)),t}function c(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return n&&(e[Symbol.iterator]=function(){return e}),e}function g(t){this.map={},t instanceof g?t.forEach((function(t,e){this.append(e,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(e){this.append(e,t[e])}),this)}function d(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function m(t){return new Promise((function(e,i){t.onload=function(){e(t.result)},t.onerror=function(){i(t.error)}}))}function _(t){var e=new FileReader,i=m(e);return e.readAsArrayBuffer(t),i}function f(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function y(){return this.bodyUsed=!1,this._initBody=function(t){var e;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:o&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:a&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:r&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():s&&o&&((e=t)&&DataView.prototype.isPrototypeOf(e))?(this._bodyArrayBuffer=f(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):s&&(ArrayBuffer.prototype.isPrototypeOf(t)||l(t))?this._bodyArrayBuffer=f(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):r&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},o&&(this.blob=function(){var t=d(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?d(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(_)}),this.text=function(){var t,e,i,r=d(this);if(r)return r;if(this._bodyBlob)return t=this._bodyBlob,e=new FileReader,i=m(e),e.readAsText(t),i;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),i=new Array(e.length),r=0;r-1?r:i),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&n)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(n)}function b(t){var e=new FormData;return t.trim().split("&").forEach((function(t){if(t){var i=t.split("="),r=i.shift().replace(/\+/g," "),n=i.join("=").replace(/\+/g," ");e.append(decodeURIComponent(r),decodeURIComponent(n))}})),e}function C(t,e){e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new g(e.headers),this.url=e.url||"",this._initBody(t)}S.prototype.clone=function(){return new S(this,{body:this._bodyInit})},y.call(S.prototype),y.call(C.prototype),C.prototype.clone=function(){return new C(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new g(this.headers),url:this.url})},C.error=function(){var t=new C(null,{status:0,statusText:""});return t.type="error",t};var x=[301,302,303,307,308];C.redirect=function(t,e){if(-1===x.indexOf(e))throw new RangeError("Invalid status code");return new C(null,{status:e,headers:{location:t}})};var M=self.DOMException;try{new M}catch(t){(M=function(t,e){this.message=t,this.name=e;var i=Error(t);this.stack=i.stack}).prototype=Object.create(Error.prototype),M.prototype.constructor=M}function L(t,e){return new Promise((function(i,r){var n=new S(t,e);if(n.signal&&n.signal.aborted)return r(new M("Aborted","AbortError"));var a=new XMLHttpRequest;function s(){a.abort()}a.onload=function(){var t,e,r={status:a.status,statusText:a.statusText,headers:(t=a.getAllResponseHeaders()||"",e=new g,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var i=t.split(":"),r=i.shift().trim();if(r){var n=i.join(":").trim();e.append(r,n)}})),e)};r.url="responseURL"in a?a.responseURL:r.headers.get("X-Request-URL");var n="response"in a?a.response:a.responseText;i(new C(n,r))},a.onerror=function(){r(new TypeError("Network request failed"))},a.ontimeout=function(){r(new TypeError("Network request failed"))},a.onabort=function(){r(new M("Aborted","AbortError"))},a.open(n.method,n.url,!0),"include"===n.credentials?a.withCredentials=!0:"omit"===n.credentials&&(a.withCredentials=!1),"responseType"in a&&o&&(a.responseType="blob"),n.headers.forEach((function(t,e){a.setRequestHeader(e,t)})),n.signal&&(n.signal.addEventListener("abort",s),a.onreadystatechange=function(){4===a.readyState&&n.signal.removeEventListener("abort",s)}),a.send(void 0===n._bodyInit?null:n._bodyInit)}))}L.polyfill=!0,self.fetch||(self.fetch=L,self.Headers=g,self.Request=S,self.Response=C)},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=i(1).Live2DCubismFramework.csmVector,n=i(5),o=function(){function t(){this._textures=new r}return t.prototype.release=function(){for(var t=this._textures.begin();t.notEqual(this._textures.end());t.preIncrement())n.gl.deleteTexture(t.ptr().id);this._textures=null},t.prototype.createTextureFromPngFile=function(t,e,i){for(var r=this,o=function(r){if(r.ptr().fileName==t&&r.ptr().usePremultply==e)return r.ptr().img=new Image,r.ptr().img.onload=function(){return i(r.ptr())},r.ptr().img.src=t,{value:void 0}},s=this._textures.begin();s.notEqual(this._textures.end());s.preIncrement()){var u=o(s);if("object"==typeof u)return u.value}var l=new Image;l.onload=function(){var o=n.gl.createTexture();n.gl.bindTexture(n.gl.TEXTURE_2D,o),n.gl.texParameteri(n.gl.TEXTURE_2D,n.gl.TEXTURE_MIN_FILTER,n.gl.LINEAR_MIPMAP_LINEAR),n.gl.texParameteri(n.gl.TEXTURE_2D,n.gl.TEXTURE_MAG_FILTER,n.gl.LINEAR),e&&n.gl.pixelStorei(n.gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL,1),n.gl.texImage2D(n.gl.TEXTURE_2D,0,n.gl.RGBA,n.gl.RGBA,n.gl.UNSIGNED_BYTE,l),n.gl.generateMipmap(n.gl.TEXTURE_2D),n.gl.bindTexture(n.gl.TEXTURE_2D,null);var s=new a;null!=s&&(s.fileName=t,s.width=l.width,s.height=l.height,s.id=o,s.img=l,s.usePremultply=e,r._textures.pushBack(s)),i(s)},l.src=t,l.crossOrigin="anonymous"},t.prototype.releaseTextures=function(){for(var t=0;t= 0) hot._disposeHandlers.splice(idx, 1); +/******/ }, +/******/ +/******/ // Management API +/******/ check: hotCheck, +/******/ apply: hotApply, +/******/ status: function(l) { +/******/ if (!l) return hotStatus; +/******/ hotStatusHandlers.push(l); +/******/ }, +/******/ addStatusHandler: function(l) { +/******/ hotStatusHandlers.push(l); +/******/ }, +/******/ removeStatusHandler: function(l) { +/******/ var idx = hotStatusHandlers.indexOf(l); +/******/ if (idx >= 0) hotStatusHandlers.splice(idx, 1); +/******/ }, +/******/ +/******/ //inherit from previous dispose call +/******/ data: hotCurrentModuleData[moduleId] +/******/ }; +/******/ hotCurrentChildModule = undefined; +/******/ return hot; +/******/ } +/******/ +/******/ var hotStatusHandlers = []; +/******/ var hotStatus = "idle"; +/******/ +/******/ function hotSetStatus(newStatus) { +/******/ hotStatus = newStatus; +/******/ for (var i = 0; i < hotStatusHandlers.length; i++) +/******/ hotStatusHandlers[i].call(null, newStatus); +/******/ } +/******/ +/******/ // while downloading +/******/ var hotWaitingFiles = 0; +/******/ var hotChunksLoading = 0; +/******/ var hotWaitingFilesMap = {}; +/******/ var hotRequestedFilesMap = {}; +/******/ var hotAvailableFilesMap = {}; +/******/ var hotDeferred; +/******/ +/******/ // The update info +/******/ var hotUpdate, hotUpdateNewHash; +/******/ +/******/ function toModuleId(id) { +/******/ var isNumber = +id + "" === id; +/******/ return isNumber ? +id : id; +/******/ } +/******/ +/******/ function hotCheck(apply) { +/******/ if (hotStatus !== "idle") { +/******/ throw new Error("check() is only allowed in idle status"); +/******/ } +/******/ hotApplyOnUpdate = apply; +/******/ hotSetStatus("check"); +/******/ return hotDownloadManifest(hotRequestTimeout).then(function(update) { +/******/ if (!update) { +/******/ hotSetStatus("idle"); +/******/ return null; +/******/ } +/******/ hotRequestedFilesMap = {}; +/******/ hotWaitingFilesMap = {}; +/******/ hotAvailableFilesMap = update.c; +/******/ hotUpdateNewHash = update.h; +/******/ +/******/ hotSetStatus("prepare"); +/******/ var promise = new Promise(function(resolve, reject) { +/******/ hotDeferred = { +/******/ resolve: resolve, +/******/ reject: reject +/******/ }; +/******/ }); +/******/ hotUpdate = {}; +/******/ var chunkId = "main"; +/******/ // eslint-disable-next-line no-lone-blocks +/******/ { +/******/ /*globals chunkId */ +/******/ hotEnsureUpdateChunk(chunkId); +/******/ } +/******/ if ( +/******/ hotStatus === "prepare" && +/******/ hotChunksLoading === 0 && +/******/ hotWaitingFiles === 0 +/******/ ) { +/******/ hotUpdateDownloaded(); +/******/ } +/******/ return promise; +/******/ }); +/******/ } +/******/ +/******/ // eslint-disable-next-line no-unused-vars +/******/ function hotAddUpdateChunk(chunkId, moreModules) { +/******/ if (!hotAvailableFilesMap[chunkId] || !hotRequestedFilesMap[chunkId]) +/******/ return; +/******/ hotRequestedFilesMap[chunkId] = false; +/******/ for (var moduleId in moreModules) { +/******/ if (Object.prototype.hasOwnProperty.call(moreModules, moduleId)) { +/******/ hotUpdate[moduleId] = moreModules[moduleId]; +/******/ } +/******/ } +/******/ if (--hotWaitingFiles === 0 && hotChunksLoading === 0) { +/******/ hotUpdateDownloaded(); +/******/ } +/******/ } +/******/ +/******/ function hotEnsureUpdateChunk(chunkId) { +/******/ if (!hotAvailableFilesMap[chunkId]) { +/******/ hotWaitingFilesMap[chunkId] = true; +/******/ } else { +/******/ hotRequestedFilesMap[chunkId] = true; +/******/ hotWaitingFiles++; +/******/ hotDownloadUpdateChunk(chunkId); +/******/ } +/******/ } +/******/ +/******/ function hotUpdateDownloaded() { +/******/ hotSetStatus("ready"); +/******/ var deferred = hotDeferred; +/******/ hotDeferred = null; +/******/ if (!deferred) return; +/******/ if (hotApplyOnUpdate) { +/******/ // Wrap deferred object in Promise to mark it as a well-handled Promise to +/******/ // avoid triggering uncaught exception warning in Chrome. +/******/ // See https://bugs.chromium.org/p/chromium/issues/detail?id=465666 +/******/ Promise.resolve() +/******/ .then(function() { +/******/ return hotApply(hotApplyOnUpdate); +/******/ }) +/******/ .then( +/******/ function(result) { +/******/ deferred.resolve(result); +/******/ }, +/******/ function(err) { +/******/ deferred.reject(err); +/******/ } +/******/ ); +/******/ } else { +/******/ var outdatedModules = []; +/******/ for (var id in hotUpdate) { +/******/ if (Object.prototype.hasOwnProperty.call(hotUpdate, id)) { +/******/ outdatedModules.push(toModuleId(id)); +/******/ } +/******/ } +/******/ deferred.resolve(outdatedModules); +/******/ } +/******/ } +/******/ +/******/ function hotApply(options) { +/******/ if (hotStatus !== "ready") +/******/ throw new Error("apply() is only allowed in ready status"); +/******/ options = options || {}; +/******/ +/******/ var cb; +/******/ var i; +/******/ var j; +/******/ var module; +/******/ var moduleId; +/******/ +/******/ function getAffectedStuff(updateModuleId) { +/******/ var outdatedModules = [updateModuleId]; +/******/ var outdatedDependencies = {}; +/******/ +/******/ var queue = outdatedModules.map(function(id) { +/******/ return { +/******/ chain: [id], +/******/ id: id +/******/ }; +/******/ }); +/******/ while (queue.length > 0) { +/******/ var queueItem = queue.pop(); +/******/ var moduleId = queueItem.id; +/******/ var chain = queueItem.chain; +/******/ module = installedModules[moduleId]; +/******/ if (!module || module.hot._selfAccepted) continue; +/******/ if (module.hot._selfDeclined) { +/******/ return { +/******/ type: "self-declined", +/******/ chain: chain, +/******/ moduleId: moduleId +/******/ }; +/******/ } +/******/ if (module.hot._main) { +/******/ return { +/******/ type: "unaccepted", +/******/ chain: chain, +/******/ moduleId: moduleId +/******/ }; +/******/ } +/******/ for (var i = 0; i < module.parents.length; i++) { +/******/ var parentId = module.parents[i]; +/******/ var parent = installedModules[parentId]; +/******/ if (!parent) continue; +/******/ if (parent.hot._declinedDependencies[moduleId]) { +/******/ return { +/******/ type: "declined", +/******/ chain: chain.concat([parentId]), +/******/ moduleId: moduleId, +/******/ parentId: parentId +/******/ }; +/******/ } +/******/ if (outdatedModules.indexOf(parentId) !== -1) continue; +/******/ if (parent.hot._acceptedDependencies[moduleId]) { +/******/ if (!outdatedDependencies[parentId]) +/******/ outdatedDependencies[parentId] = []; +/******/ addAllToSet(outdatedDependencies[parentId], [moduleId]); +/******/ continue; +/******/ } +/******/ delete outdatedDependencies[parentId]; +/******/ outdatedModules.push(parentId); +/******/ queue.push({ +/******/ chain: chain.concat([parentId]), +/******/ id: parentId +/******/ }); +/******/ } +/******/ } +/******/ +/******/ return { +/******/ type: "accepted", +/******/ moduleId: updateModuleId, +/******/ outdatedModules: outdatedModules, +/******/ outdatedDependencies: outdatedDependencies +/******/ }; +/******/ } +/******/ +/******/ function addAllToSet(a, b) { +/******/ for (var i = 0; i < b.length; i++) { +/******/ var item = b[i]; +/******/ if (a.indexOf(item) === -1) a.push(item); +/******/ } +/******/ } +/******/ +/******/ // at begin all updates modules are outdated +/******/ // the "outdated" status can propagate to parents if they don't accept the children +/******/ var outdatedDependencies = {}; +/******/ var outdatedModules = []; +/******/ var appliedUpdate = {}; +/******/ +/******/ var warnUnexpectedRequire = function warnUnexpectedRequire() { +/******/ console.warn( +/******/ "[HMR] unexpected require(" + result.moduleId + ") to disposed module" +/******/ ); +/******/ }; +/******/ +/******/ for (var id in hotUpdate) { +/******/ if (Object.prototype.hasOwnProperty.call(hotUpdate, id)) { +/******/ moduleId = toModuleId(id); +/******/ /** @type {TODO} */ +/******/ var result; +/******/ if (hotUpdate[id]) { +/******/ result = getAffectedStuff(moduleId); +/******/ } else { +/******/ result = { +/******/ type: "disposed", +/******/ moduleId: id +/******/ }; +/******/ } +/******/ /** @type {Error|false} */ +/******/ var abortError = false; +/******/ var doApply = false; +/******/ var doDispose = false; +/******/ var chainInfo = ""; +/******/ if (result.chain) { +/******/ chainInfo = "\nUpdate propagation: " + result.chain.join(" -> "); +/******/ } +/******/ switch (result.type) { +/******/ case "self-declined": +/******/ if (options.onDeclined) options.onDeclined(result); +/******/ if (!options.ignoreDeclined) +/******/ abortError = new Error( +/******/ "Aborted because of self decline: " + +/******/ result.moduleId + +/******/ chainInfo +/******/ ); +/******/ break; +/******/ case "declined": +/******/ if (options.onDeclined) options.onDeclined(result); +/******/ if (!options.ignoreDeclined) +/******/ abortError = new Error( +/******/ "Aborted because of declined dependency: " + +/******/ result.moduleId + +/******/ " in " + +/******/ result.parentId + +/******/ chainInfo +/******/ ); +/******/ break; +/******/ case "unaccepted": +/******/ if (options.onUnaccepted) options.onUnaccepted(result); +/******/ if (!options.ignoreUnaccepted) +/******/ abortError = new Error( +/******/ "Aborted because " + moduleId + " is not accepted" + chainInfo +/******/ ); +/******/ break; +/******/ case "accepted": +/******/ if (options.onAccepted) options.onAccepted(result); +/******/ doApply = true; +/******/ break; +/******/ case "disposed": +/******/ if (options.onDisposed) options.onDisposed(result); +/******/ doDispose = true; +/******/ break; +/******/ default: +/******/ throw new Error("Unexception type " + result.type); +/******/ } +/******/ if (abortError) { +/******/ hotSetStatus("abort"); +/******/ return Promise.reject(abortError); +/******/ } +/******/ if (doApply) { +/******/ appliedUpdate[moduleId] = hotUpdate[moduleId]; +/******/ addAllToSet(outdatedModules, result.outdatedModules); +/******/ for (moduleId in result.outdatedDependencies) { +/******/ if ( +/******/ Object.prototype.hasOwnProperty.call( +/******/ result.outdatedDependencies, +/******/ moduleId +/******/ ) +/******/ ) { +/******/ if (!outdatedDependencies[moduleId]) +/******/ outdatedDependencies[moduleId] = []; +/******/ addAllToSet( +/******/ outdatedDependencies[moduleId], +/******/ result.outdatedDependencies[moduleId] +/******/ ); +/******/ } +/******/ } +/******/ } +/******/ if (doDispose) { +/******/ addAllToSet(outdatedModules, [result.moduleId]); +/******/ appliedUpdate[moduleId] = warnUnexpectedRequire; +/******/ } +/******/ } +/******/ } +/******/ +/******/ // Store self accepted outdated modules to require them later by the module system +/******/ var outdatedSelfAcceptedModules = []; +/******/ for (i = 0; i < outdatedModules.length; i++) { +/******/ moduleId = outdatedModules[i]; +/******/ if ( +/******/ installedModules[moduleId] && +/******/ installedModules[moduleId].hot._selfAccepted && +/******/ // removed self-accepted modules should not be required +/******/ appliedUpdate[moduleId] !== warnUnexpectedRequire +/******/ ) { +/******/ outdatedSelfAcceptedModules.push({ +/******/ module: moduleId, +/******/ errorHandler: installedModules[moduleId].hot._selfAccepted +/******/ }); +/******/ } +/******/ } +/******/ +/******/ // Now in "dispose" phase +/******/ hotSetStatus("dispose"); +/******/ Object.keys(hotAvailableFilesMap).forEach(function(chunkId) { +/******/ if (hotAvailableFilesMap[chunkId] === false) { +/******/ hotDisposeChunk(chunkId); +/******/ } +/******/ }); +/******/ +/******/ var idx; +/******/ var queue = outdatedModules.slice(); +/******/ while (queue.length > 0) { +/******/ moduleId = queue.pop(); +/******/ module = installedModules[moduleId]; +/******/ if (!module) continue; +/******/ +/******/ var data = {}; +/******/ +/******/ // Call dispose handlers +/******/ var disposeHandlers = module.hot._disposeHandlers; +/******/ for (j = 0; j < disposeHandlers.length; j++) { +/******/ cb = disposeHandlers[j]; +/******/ cb(data); +/******/ } +/******/ hotCurrentModuleData[moduleId] = data; +/******/ +/******/ // disable module (this disables requires from this module) +/******/ module.hot.active = false; +/******/ +/******/ // remove module from cache +/******/ delete installedModules[moduleId]; +/******/ +/******/ // when disposing there is no need to call dispose handler +/******/ delete outdatedDependencies[moduleId]; +/******/ +/******/ // remove "parents" references from all children +/******/ for (j = 0; j < module.children.length; j++) { +/******/ var child = installedModules[module.children[j]]; +/******/ if (!child) continue; +/******/ idx = child.parents.indexOf(moduleId); +/******/ if (idx >= 0) { +/******/ child.parents.splice(idx, 1); +/******/ } +/******/ } +/******/ } +/******/ +/******/ // remove outdated dependency from module children +/******/ var dependency; +/******/ var moduleOutdatedDependencies; +/******/ for (moduleId in outdatedDependencies) { +/******/ if ( +/******/ Object.prototype.hasOwnProperty.call(outdatedDependencies, moduleId) +/******/ ) { +/******/ module = installedModules[moduleId]; +/******/ if (module) { +/******/ moduleOutdatedDependencies = outdatedDependencies[moduleId]; +/******/ for (j = 0; j < moduleOutdatedDependencies.length; j++) { +/******/ dependency = moduleOutdatedDependencies[j]; +/******/ idx = module.children.indexOf(dependency); +/******/ if (idx >= 0) module.children.splice(idx, 1); +/******/ } +/******/ } +/******/ } +/******/ } +/******/ +/******/ // Now in "apply" phase +/******/ hotSetStatus("apply"); +/******/ +/******/ hotCurrentHash = hotUpdateNewHash; +/******/ +/******/ // insert new code +/******/ for (moduleId in appliedUpdate) { +/******/ if (Object.prototype.hasOwnProperty.call(appliedUpdate, moduleId)) { +/******/ modules[moduleId] = appliedUpdate[moduleId]; +/******/ } +/******/ } +/******/ +/******/ // call accept handlers +/******/ var error = null; +/******/ for (moduleId in outdatedDependencies) { +/******/ if ( +/******/ Object.prototype.hasOwnProperty.call(outdatedDependencies, moduleId) +/******/ ) { +/******/ module = installedModules[moduleId]; +/******/ if (module) { +/******/ moduleOutdatedDependencies = outdatedDependencies[moduleId]; +/******/ var callbacks = []; +/******/ for (i = 0; i < moduleOutdatedDependencies.length; i++) { +/******/ dependency = moduleOutdatedDependencies[i]; +/******/ cb = module.hot._acceptedDependencies[dependency]; +/******/ if (cb) { +/******/ if (callbacks.indexOf(cb) !== -1) continue; +/******/ callbacks.push(cb); +/******/ } +/******/ } +/******/ for (i = 0; i < callbacks.length; i++) { +/******/ cb = callbacks[i]; +/******/ try { +/******/ cb(moduleOutdatedDependencies); +/******/ } catch (err) { +/******/ if (options.onErrored) { +/******/ options.onErrored({ +/******/ type: "accept-errored", +/******/ moduleId: moduleId, +/******/ dependencyId: moduleOutdatedDependencies[i], +/******/ error: err +/******/ }); +/******/ } +/******/ if (!options.ignoreErrored) { +/******/ if (!error) error = err; +/******/ } +/******/ } +/******/ } +/******/ } +/******/ } +/******/ } +/******/ +/******/ // Load self accepted modules +/******/ for (i = 0; i < outdatedSelfAcceptedModules.length; i++) { +/******/ var item = outdatedSelfAcceptedModules[i]; +/******/ moduleId = item.module; +/******/ hotCurrentParents = [moduleId]; +/******/ try { +/******/ __webpack_require__(moduleId); +/******/ } catch (err) { +/******/ if (typeof item.errorHandler === "function") { +/******/ try { +/******/ item.errorHandler(err); +/******/ } catch (err2) { +/******/ if (options.onErrored) { +/******/ options.onErrored({ +/******/ type: "self-accept-error-handler-errored", +/******/ moduleId: moduleId, +/******/ error: err2, +/******/ originalError: err +/******/ }); +/******/ } +/******/ if (!options.ignoreErrored) { +/******/ if (!error) error = err2; +/******/ } +/******/ if (!error) error = err; +/******/ } +/******/ } else { +/******/ if (options.onErrored) { +/******/ options.onErrored({ +/******/ type: "self-accept-errored", +/******/ moduleId: moduleId, +/******/ error: err +/******/ }); +/******/ } +/******/ if (!options.ignoreErrored) { +/******/ if (!error) error = err; +/******/ } +/******/ } +/******/ } +/******/ } +/******/ +/******/ // handle errors in accept handlers and self accepted module load +/******/ if (error) { +/******/ hotSetStatus("fail"); +/******/ return Promise.reject(error); +/******/ } +/******/ +/******/ hotSetStatus("idle"); +/******/ return new Promise(function(resolve) { +/******/ resolve(outdatedModules); +/******/ }); +/******/ } +/******/ +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {}, +/******/ hot: hotCreateModule(moduleId), +/******/ parents: (hotCurrentParentsTemp = hotCurrentParents, hotCurrentParents = [], hotCurrentParentsTemp), +/******/ children: [] +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, hotCreateRequire(moduleId)); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); +/******/ } +/******/ }; +/******/ +/******/ // define __esModule on exports +/******/ __webpack_require__.r = function(exports) { +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); +/******/ } +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; +/******/ +/******/ // create a fake namespace object +/******/ // mode & 1: value is a module id, require it +/******/ // mode & 2: merge all properties of value into the ns +/******/ // mode & 4: return value when already ns object +/******/ // mode & 8|1: behave like require +/******/ __webpack_require__.t = function(value, mode) { +/******/ if(mode & 1) value = __webpack_require__(value); +/******/ if(mode & 8) return value; +/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; +/******/ var ns = Object.create(null); +/******/ __webpack_require__.r(ns); +/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); +/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); +/******/ return ns; +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; +/******/ +/******/ // __webpack_hash__ +/******/ __webpack_require__.h = function() { return hotCurrentHash; }; +/******/ +/******/ +/******/ // Load entry module and return exports +/******/ return hotCreateRequire(0)(__webpack_require__.s = 0); +/******/ }) +/************************************************************************/ +/******/ ({ + +/***/ "./Framework/src/cubismdefaultparameterid.ts": +/*!***************************************************!*\ + !*** ./Framework/src/cubismdefaultparameterid.ts ***! + \***************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +var Live2DCubismFramework; +(function (Live2DCubismFramework) { + Live2DCubismFramework.HitAreaPrefix = 'HitArea'; + Live2DCubismFramework.HitAreaHead = 'Head'; + Live2DCubismFramework.HitAreaBody = 'Body'; + Live2DCubismFramework.PartsIdCore = 'Parts01Core'; + Live2DCubismFramework.PartsArmPrefix = 'Parts01Arm_'; + Live2DCubismFramework.PartsArmLPrefix = 'Parts01ArmL_'; + Live2DCubismFramework.PartsArmRPrefix = 'Parts01ArmR_'; + Live2DCubismFramework.ParamAngleX = 'ParamAngleX'; + Live2DCubismFramework.ParamAngleY = 'ParamAngleY'; + Live2DCubismFramework.ParamAngleZ = 'ParamAngleZ'; + Live2DCubismFramework.ParamEyeLOpen = 'ParamEyeLOpen'; + Live2DCubismFramework.ParamEyeLSmile = 'ParamEyeLSmile'; + Live2DCubismFramework.ParamEyeROpen = 'ParamEyeROpen'; + Live2DCubismFramework.ParamEyeRSmile = 'ParamEyeRSmile'; + Live2DCubismFramework.ParamEyeBallX = 'ParamEyeBallX'; + Live2DCubismFramework.ParamEyeBallY = 'ParamEyeBallY'; + Live2DCubismFramework.ParamEyeBallForm = 'ParamEyeBallForm'; + Live2DCubismFramework.ParamBrowLY = 'ParamBrowLY'; + Live2DCubismFramework.ParamBrowRY = 'ParamBrowRY'; + Live2DCubismFramework.ParamBrowLX = 'ParamBrowLX'; + Live2DCubismFramework.ParamBrowRX = 'ParamBrowRX'; + Live2DCubismFramework.ParamBrowLAngle = 'ParamBrowLAngle'; + Live2DCubismFramework.ParamBrowRAngle = 'ParamBrowRAngle'; + Live2DCubismFramework.ParamBrowLForm = 'ParamBrowLForm'; + Live2DCubismFramework.ParamBrowRForm = 'ParamBrowRForm'; + Live2DCubismFramework.ParamMouthForm = 'ParamMouthForm'; + Live2DCubismFramework.ParamMouthOpenY = 'ParamMouthOpenY'; + Live2DCubismFramework.ParamCheek = 'ParamCheek'; + Live2DCubismFramework.ParamBodyAngleX = 'ParamBodyAngleX'; + Live2DCubismFramework.ParamBodyAngleY = 'ParamBodyAngleY'; + Live2DCubismFramework.ParamBodyAngleZ = 'ParamBodyAngleZ'; + Live2DCubismFramework.ParamBreath = 'ParamBreath'; + Live2DCubismFramework.ParamArmLA = 'ParamArmLA'; + Live2DCubismFramework.ParamArmRA = 'ParamArmRA'; + Live2DCubismFramework.ParamArmLB = 'ParamArmLB'; + Live2DCubismFramework.ParamArmRB = 'ParamArmRB'; + Live2DCubismFramework.ParamHandL = 'ParamHandL'; + Live2DCubismFramework.ParamHandR = 'ParamHandR'; + Live2DCubismFramework.ParamHairFront = 'ParamHairFront'; + Live2DCubismFramework.ParamHairSide = 'ParamHairSide'; + Live2DCubismFramework.ParamHairBack = 'ParamHairBack'; + Live2DCubismFramework.ParamHairFluffy = 'ParamHairFluffy'; + Live2DCubismFramework.ParamShoulderY = 'ParamShoulderY'; + Live2DCubismFramework.ParamBustX = 'ParamBustX'; + Live2DCubismFramework.ParamBustY = 'ParamBustY'; + Live2DCubismFramework.ParamBaseX = 'ParamBaseX'; + Live2DCubismFramework.ParamBaseY = 'ParamBaseY'; + Live2DCubismFramework.ParamNONE = 'NONE:'; +})(Live2DCubismFramework = exports.Live2DCubismFramework || (exports.Live2DCubismFramework = {})); + + +/***/ }), + +/***/ "./Framework/src/cubismframeworkconfig.ts": +/*!************************************************!*\ + !*** ./Framework/src/cubismframeworkconfig.ts ***! + \************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.CSM_LOG_LEVEL_VERBOSE = 0; +exports.CSM_LOG_LEVEL_DEBUG = 1; +exports.CSM_LOG_LEVEL_INFO = 2; +exports.CSM_LOG_LEVEL_WARNING = 3; +exports.CSM_LOG_LEVEL_ERROR = 4; +exports.CSM_LOG_LEVEL_OFF = 5; +exports.CSM_LOG_LEVEL = exports.CSM_LOG_LEVEL_VERBOSE; + + +/***/ }), + +/***/ "./Framework/src/cubismmodelsettingjson.ts": +/*!*************************************************!*\ + !*** ./Framework/src/cubismmodelsettingjson.ts ***! + \*************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +var live2dcubismframework_1 = __webpack_require__(/*! ./live2dcubismframework */ "./Framework/src/live2dcubismframework.ts"); +var icubismmodelsetting_1 = __webpack_require__(/*! ./icubismmodelsetting */ "./Framework/src/icubismmodelsetting.ts"); +var cubismjson_1 = __webpack_require__(/*! ./utils/cubismjson */ "./Framework/src/utils/cubismjson.ts"); +var csmvector_1 = __webpack_require__(/*! ./type/csmvector */ "./Framework/src/type/csmvector.ts"); +var csmVector = csmvector_1.Live2DCubismFramework.csmVector; +var CubismFramework = live2dcubismframework_1.Live2DCubismFramework.CubismFramework; +var CubismJson = cubismjson_1.Live2DCubismFramework.CubismJson; +var ICubismModelSetting = icubismmodelsetting_1.Live2DCubismFramework.ICubismModelSetting; +var Live2DCubismFramework; +(function (Live2DCubismFramework) { + var Version = 'Version'; + var FileReferences = 'FileReferences'; + var Groups = 'Groups'; + var Layout = 'Layout'; + var HitAreas = 'HitAreas'; + var Moc = 'Moc'; + var Textures = 'Textures'; + var Physics = 'Physics'; + var Pose = 'Pose'; + var Expressions = 'Expressions'; + var Motions = 'Motions'; + var UserData = 'UserData'; + var Name = 'Name'; + var FilePath = 'File'; + var Id = 'Id'; + var Ids = 'Ids'; + var Target = 'Target'; + var Idle = 'Idle'; + var TapBody = 'TapBody'; + var PinchIn = 'PinchIn'; + var PinchOut = 'PinchOut'; + var Shake = 'Shake'; + var FlickHead = 'FlickHead'; + var Parameter = 'Parameter'; + var SoundPath = 'Sound'; + var FadeInTime = 'FadeInTime'; + var FadeOutTime = 'FadeOutTime'; + var CenterX = 'CenterX'; + var CenterY = 'CenterY'; + var X = 'X'; + var Y = 'Y'; + var Width = 'Width'; + var Height = 'Height'; + var LipSync = 'LipSync'; + var EyeBlink = 'EyeBlink'; + var InitParameter = 'init_param'; + var InitPartsVisible = 'init_parts_visible'; + var Val = 'val'; + var FrequestNode; + (function (FrequestNode) { + FrequestNode[FrequestNode["FrequestNode_Groups"] = 0] = "FrequestNode_Groups"; + FrequestNode[FrequestNode["FrequestNode_Moc"] = 1] = "FrequestNode_Moc"; + FrequestNode[FrequestNode["FrequestNode_Motions"] = 2] = "FrequestNode_Motions"; + FrequestNode[FrequestNode["FrequestNode_Expressions"] = 3] = "FrequestNode_Expressions"; + FrequestNode[FrequestNode["FrequestNode_Textures"] = 4] = "FrequestNode_Textures"; + FrequestNode[FrequestNode["FrequestNode_Physics"] = 5] = "FrequestNode_Physics"; + FrequestNode[FrequestNode["FrequestNode_Pose"] = 6] = "FrequestNode_Pose"; + FrequestNode[FrequestNode["FrequestNode_HitAreas"] = 7] = "FrequestNode_HitAreas"; + })(FrequestNode || (FrequestNode = {})); + var CubismModelSettingJson = (function (_super) { + __extends(CubismModelSettingJson, _super); + function CubismModelSettingJson(buffer, size) { + var _this = _super.call(this) || this; + _this._json = CubismJson.create(buffer, size); + if (_this._json) { + _this._jsonValue = new csmVector(); + _this._jsonValue.pushBack(_this._json.getRoot().getValueByString(Groups)); + _this._jsonValue.pushBack(_this._json + .getRoot() + .getValueByString(FileReferences) + .getValueByString(Moc)); + _this._jsonValue.pushBack(_this._json + .getRoot() + .getValueByString(FileReferences) + .getValueByString(Motions)); + _this._jsonValue.pushBack(_this._json + .getRoot() + .getValueByString(FileReferences) + .getValueByString(Expressions)); + _this._jsonValue.pushBack(_this._json + .getRoot() + .getValueByString(FileReferences) + .getValueByString(Textures)); + _this._jsonValue.pushBack(_this._json + .getRoot() + .getValueByString(FileReferences) + .getValueByString(Physics)); + _this._jsonValue.pushBack(_this._json + .getRoot() + .getValueByString(FileReferences) + .getValueByString(Pose)); + _this._jsonValue.pushBack(_this._json.getRoot().getValueByString(HitAreas)); + } + return _this; + } + CubismModelSettingJson.prototype.release = function () { + CubismJson.delete(this._json); + this._jsonValue = null; + }; + CubismModelSettingJson.prototype.GetJson = function () { + return this._json; + }; + CubismModelSettingJson.prototype.getModelFileName = function () { + if (!this.isExistModelFile()) { + return ''; + } + return this._jsonValue.at(FrequestNode.FrequestNode_Moc).getRawString(); + }; + CubismModelSettingJson.prototype.getTextureCount = function () { + if (!this.isExistTextureFiles()) { + return 0; + } + return this._jsonValue.at(FrequestNode.FrequestNode_Textures).getSize(); + }; + CubismModelSettingJson.prototype.getTextureDirectory = function () { + return this._jsonValue + .at(FrequestNode.FrequestNode_Textures) + .getRawString(); + }; + CubismModelSettingJson.prototype.getTextureFileName = function (index) { + return this._jsonValue + .at(FrequestNode.FrequestNode_Textures) + .getValueByIndex(index) + .getRawString(); + }; + CubismModelSettingJson.prototype.getHitAreasCount = function () { + if (!this.isExistHitAreas()) { + return 0; + } + return this._jsonValue.at(FrequestNode.FrequestNode_HitAreas).getSize(); + }; + CubismModelSettingJson.prototype.getHitAreaId = function (index) { + return CubismFramework.getIdManager().getId(this._jsonValue + .at(FrequestNode.FrequestNode_HitAreas) + .getValueByIndex(index) + .getValueByString(Id) + .getRawString()); + }; + CubismModelSettingJson.prototype.getHitAreaName = function (index) { + return this._jsonValue + .at(FrequestNode.FrequestNode_HitAreas) + .getValueByIndex(index) + .getValueByString(Name) + .getRawString(); + }; + CubismModelSettingJson.prototype.getPhysicsFileName = function () { + if (!this.isExistPhysicsFile()) { + return ''; + } + return this._jsonValue + .at(FrequestNode.FrequestNode_Physics) + .getRawString(); + }; + CubismModelSettingJson.prototype.getPoseFileName = function () { + if (!this.isExistPoseFile()) { + return ''; + } + return this._jsonValue.at(FrequestNode.FrequestNode_Pose).getRawString(); + }; + CubismModelSettingJson.prototype.getExpressionCount = function () { + if (!this.isExistExpressionFile()) { + return 0; + } + return this._jsonValue + .at(FrequestNode.FrequestNode_Expressions) + .getSize(); + }; + CubismModelSettingJson.prototype.getExpressionName = function (index) { + return this._jsonValue + .at(FrequestNode.FrequestNode_Expressions) + .getValueByIndex(index) + .getValueByString(Name) + .getRawString(); + }; + CubismModelSettingJson.prototype.getExpressionFileName = function (index) { + return this._jsonValue + .at(FrequestNode.FrequestNode_Expressions) + .getValueByIndex(index) + .getValueByString(FilePath) + .getRawString(); + }; + CubismModelSettingJson.prototype.getMotionGroupCount = function () { + if (!this.isExistMotionGroups()) { + return 0; + } + return this._jsonValue + .at(FrequestNode.FrequestNode_Motions) + .getKeys() + .getSize(); + }; + CubismModelSettingJson.prototype.getMotionGroupName = function (index) { + if (!this.isExistMotionGroups()) { + return null; + } + return this._jsonValue + .at(FrequestNode.FrequestNode_Motions) + .getKeys() + .at(index); + }; + CubismModelSettingJson.prototype.getMotionCount = function (groupName) { + if (!this.isExistMotionGroupName(groupName)) { + return 0; + } + return this._jsonValue + .at(FrequestNode.FrequestNode_Motions) + .getValueByString(groupName) + .getSize(); + }; + CubismModelSettingJson.prototype.getMotionFileName = function (groupName, index) { + if (!this.isExistMotionGroupName(groupName)) { + return ''; + } + return this._jsonValue + .at(FrequestNode.FrequestNode_Motions) + .getValueByString(groupName) + .getValueByIndex(index) + .getValueByString(FilePath) + .getRawString(); + }; + CubismModelSettingJson.prototype.getMotionSoundFileName = function (groupName, index) { + if (!this.isExistMotionSoundFile(groupName, index)) { + return ''; + } + return this._jsonValue + .at(FrequestNode.FrequestNode_Motions) + .getValueByString(groupName) + .getValueByIndex(index) + .getValueByString(SoundPath) + .getRawString(); + }; + CubismModelSettingJson.prototype.getMotionFadeInTimeValue = function (groupName, index) { + if (!this.isExistMotionFadeIn(groupName, index)) { + return -1.0; + } + return this._jsonValue + .at(FrequestNode.FrequestNode_Motions) + .getValueByString(groupName) + .getValueByIndex(index) + .getValueByString(FadeInTime) + .toFloat(); + }; + CubismModelSettingJson.prototype.getMotionFadeOutTimeValue = function (groupName, index) { + if (!this.isExistMotionFadeOut(groupName, index)) { + return -1.0; + } + return this._jsonValue + .at(FrequestNode.FrequestNode_Motions) + .getValueByString(groupName) + .getValueByIndex(index) + .getValueByString(FadeOutTime) + .toFloat(); + }; + CubismModelSettingJson.prototype.getUserDataFile = function () { + if (!this.isExistUserDataFile()) { + return ''; + } + return this._json + .getRoot() + .getValueByString(FileReferences) + .getValueByString(UserData) + .getRawString(); + }; + CubismModelSettingJson.prototype.getLayoutMap = function (outLayoutMap) { + var map = this._json + .getRoot() + .getValueByString(Layout) + .getMap(); + if (map == null) { + return false; + } + var ret = false; + for (var ite = map.begin(); ite.notEqual(map.end()); ite.preIncrement()) { + outLayoutMap.setValue(ite.ptr().first, ite.ptr().second.toFloat()); + ret = true; + } + return ret; + }; + CubismModelSettingJson.prototype.getEyeBlinkParameterCount = function () { + if (!this.isExistEyeBlinkParameters()) { + return 0; + } + var num = 0; + for (var i = 0; i < this._jsonValue.at(FrequestNode.FrequestNode_Groups).getSize(); i++) { + var refI = this._jsonValue + .at(FrequestNode.FrequestNode_Groups) + .getValueByIndex(i); + if (refI.isNull() || refI.isError()) { + continue; + } + if (refI.getValueByString(Name).getRawString() == EyeBlink) { + num = refI + .getValueByString(Ids) + .getVector() + .getSize(); + break; + } + } + return num; + }; + CubismModelSettingJson.prototype.getEyeBlinkParameterId = function (index) { + if (!this.isExistEyeBlinkParameters()) { + return null; + } + for (var i = 0; i < this._jsonValue.at(FrequestNode.FrequestNode_Groups).getSize(); i++) { + var refI = this._jsonValue + .at(FrequestNode.FrequestNode_Groups) + .getValueByIndex(i); + if (refI.isNull() || refI.isError()) { + continue; + } + if (refI.getValueByString(Name).getRawString() == EyeBlink) { + return CubismFramework.getIdManager().getId(refI + .getValueByString(Ids) + .getValueByIndex(index) + .getRawString()); + } + } + return null; + }; + CubismModelSettingJson.prototype.getLipSyncParameterCount = function () { + if (!this.isExistLipSyncParameters()) { + return 0; + } + var num = 0; + for (var i = 0; i < this._jsonValue.at(FrequestNode.FrequestNode_Groups).getSize(); i++) { + var refI = this._jsonValue + .at(FrequestNode.FrequestNode_Groups) + .getValueByIndex(i); + if (refI.isNull() || refI.isError()) { + continue; + } + if (refI.getValueByString(Name).getRawString() == LipSync) { + num = refI + .getValueByString(Ids) + .getVector() + .getSize(); + break; + } + } + return num; + }; + CubismModelSettingJson.prototype.getLipSyncParameterId = function (index) { + if (!this.isExistLipSyncParameters()) { + return null; + } + for (var i = 0; i < this._jsonValue.at(FrequestNode.FrequestNode_Groups).getSize(); i++) { + var refI = this._jsonValue + .at(FrequestNode.FrequestNode_Groups) + .getValueByIndex(i); + if (refI.isNull() || refI.isError()) { + continue; + } + if (refI.getValueByString(Name).getRawString() == LipSync) { + return CubismFramework.getIdManager().getId(refI + .getValueByString(Ids) + .getValueByIndex(index) + .getRawString()); + } + } + return null; + }; + CubismModelSettingJson.prototype.isExistModelFile = function () { + var node = this._jsonValue.at(FrequestNode.FrequestNode_Moc); + return !node.isNull() && !node.isError(); + }; + CubismModelSettingJson.prototype.isExistTextureFiles = function () { + var node = this._jsonValue.at(FrequestNode.FrequestNode_Textures); + return !node.isNull() && !node.isError(); + }; + CubismModelSettingJson.prototype.isExistHitAreas = function () { + var node = this._jsonValue.at(FrequestNode.FrequestNode_HitAreas); + return !node.isNull() && !node.isError(); + }; + CubismModelSettingJson.prototype.isExistPhysicsFile = function () { + var node = this._jsonValue.at(FrequestNode.FrequestNode_Physics); + return !node.isNull() && !node.isError(); + }; + CubismModelSettingJson.prototype.isExistPoseFile = function () { + var node = this._jsonValue.at(FrequestNode.FrequestNode_Pose); + return !node.isNull() && !node.isError(); + }; + CubismModelSettingJson.prototype.isExistExpressionFile = function () { + var node = this._jsonValue.at(FrequestNode.FrequestNode_Expressions); + return !node.isNull() && !node.isError(); + }; + CubismModelSettingJson.prototype.isExistMotionGroups = function () { + var node = this._jsonValue.at(FrequestNode.FrequestNode_Motions); + return !node.isNull() && !node.isError(); + }; + CubismModelSettingJson.prototype.isExistMotionGroupName = function (groupName) { + var node = this._jsonValue + .at(FrequestNode.FrequestNode_Motions) + .getValueByString(groupName); + return !node.isNull() && !node.isError(); + }; + CubismModelSettingJson.prototype.isExistMotionSoundFile = function (groupName, index) { + var node = this._jsonValue + .at(FrequestNode.FrequestNode_Motions) + .getValueByString(groupName) + .getValueByIndex(index) + .getValueByString(SoundPath); + return !node.isNull() && !node.isError(); + }; + CubismModelSettingJson.prototype.isExistMotionFadeIn = function (groupName, index) { + var node = this._jsonValue + .at(FrequestNode.FrequestNode_Motions) + .getValueByString(groupName) + .getValueByIndex(index) + .getValueByString(FadeInTime); + return !node.isNull() && !node.isError(); + }; + CubismModelSettingJson.prototype.isExistMotionFadeOut = function (groupName, index) { + var node = this._jsonValue + .at(FrequestNode.FrequestNode_Motions) + .getValueByString(groupName) + .getValueByIndex(index) + .getValueByString(FadeOutTime); + return !node.isNull() && !node.isError(); + }; + CubismModelSettingJson.prototype.isExistUserDataFile = function () { + var node = this._json + .getRoot() + .getValueByString(FileReferences) + .getValueByString(UserData); + return !node.isNull() && !node.isError(); + }; + CubismModelSettingJson.prototype.isExistEyeBlinkParameters = function () { + if (this._jsonValue.at(FrequestNode.FrequestNode_Groups).isNull() || + this._jsonValue.at(FrequestNode.FrequestNode_Groups).isError()) { + return false; + } + for (var i = 0; i < this._jsonValue.at(FrequestNode.FrequestNode_Groups).getSize(); ++i) { + if (this._jsonValue + .at(FrequestNode.FrequestNode_Groups) + .getValueByIndex(i) + .getValueByString(Name) + .getRawString() == EyeBlink) { + return true; + } + } + return false; + }; + CubismModelSettingJson.prototype.isExistLipSyncParameters = function () { + if (this._jsonValue.at(FrequestNode.FrequestNode_Groups).isNull() || + this._jsonValue.at(FrequestNode.FrequestNode_Groups).isError()) { + return false; + } + for (var i = 0; i < this._jsonValue.at(FrequestNode.FrequestNode_Groups).getSize(); ++i) { + if (this._jsonValue + .at(FrequestNode.FrequestNode_Groups) + .getValueByIndex(i) + .getValueByString(Name) + .getRawString() == LipSync) { + return true; + } + } + return false; + }; + return CubismModelSettingJson; + }(ICubismModelSetting)); + Live2DCubismFramework.CubismModelSettingJson = CubismModelSettingJson; +})(Live2DCubismFramework = exports.Live2DCubismFramework || (exports.Live2DCubismFramework = {})); + + +/***/ }), + +/***/ "./Framework/src/effect/cubismbreath.ts": +/*!**********************************************!*\ + !*** ./Framework/src/effect/cubismbreath.ts ***! + \**********************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +var Live2DCubismFramework; +(function (Live2DCubismFramework) { + var CubismBreath = (function () { + function CubismBreath() { + this._currentTime = 0.0; + } + CubismBreath.create = function () { + return new CubismBreath(); + }; + CubismBreath.delete = function (instance) { + if (instance != null) { + instance = null; + } + }; + CubismBreath.prototype.setParameters = function (breathParameters) { + this._breathParameters = breathParameters; + }; + CubismBreath.prototype.getParameters = function () { + return this._breathParameters; + }; + CubismBreath.prototype.updateParameters = function (model, deltaTimeSeconds) { + this._currentTime += deltaTimeSeconds; + var t = this._currentTime * 2.0 * 3.14159; + for (var i = 0; i < this._breathParameters.getSize(); ++i) { + var data = this._breathParameters.at(i); + model.addParameterValueById(data.parameterId, data.offset + data.peak * Math.sin(t / data.cycle), data.weight); + } + }; + return CubismBreath; + }()); + Live2DCubismFramework.CubismBreath = CubismBreath; + var BreathParameterData = (function () { + function BreathParameterData(parameterId, offset, peak, cycle, weight) { + this.parameterId = parameterId == undefined ? null : parameterId; + this.offset = offset == undefined ? 0.0 : offset; + this.peak = peak == undefined ? 0.0 : peak; + this.cycle = cycle == undefined ? 0.0 : cycle; + this.weight = weight == undefined ? 0.0 : weight; + } + return BreathParameterData; + }()); + Live2DCubismFramework.BreathParameterData = BreathParameterData; +})(Live2DCubismFramework = exports.Live2DCubismFramework || (exports.Live2DCubismFramework = {})); + + +/***/ }), + +/***/ "./Framework/src/effect/cubismeyeblink.ts": +/*!************************************************!*\ + !*** ./Framework/src/effect/cubismeyeblink.ts ***! + \************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +var csmvector_1 = __webpack_require__(/*! ../type/csmvector */ "./Framework/src/type/csmvector.ts"); +var csmVector = csmvector_1.Live2DCubismFramework.csmVector; +var Live2DCubismFramework; +(function (Live2DCubismFramework) { + var CubismEyeBlink = (function () { + function CubismEyeBlink(modelSetting) { + this._blinkingState = EyeState.EyeState_First; + this._nextBlinkingTime = 0.0; + this._stateStartTimeSeconds = 0.0; + this._blinkingIntervalSeconds = 4.0; + this._closingSeconds = 0.1; + this._closedSeconds = 0.05; + this._openingSeconds = 0.15; + this._userTimeSeconds = 0.0; + this._parameterIds = new csmVector(); + if (modelSetting == null) { + return; + } + for (var i = 0; i < modelSetting.getEyeBlinkParameterCount(); ++i) { + this._parameterIds.pushBack(modelSetting.getEyeBlinkParameterId(i)); + } + } + CubismEyeBlink.create = function (modelSetting) { + if (modelSetting === void 0) { modelSetting = null; } + return new CubismEyeBlink(modelSetting); + }; + CubismEyeBlink.delete = function (eyeBlink) { + if (eyeBlink != null) { + eyeBlink = null; + } + }; + CubismEyeBlink.prototype.setBlinkingInterval = function (blinkingInterval) { + this._blinkingIntervalSeconds = blinkingInterval; + }; + CubismEyeBlink.prototype.setBlinkingSetting = function (closing, closed, opening) { + this._closingSeconds = closing; + this._closedSeconds = closed; + this._openingSeconds = opening; + }; + CubismEyeBlink.prototype.setParameterIds = function (parameterIds) { + this._parameterIds = parameterIds; + }; + CubismEyeBlink.prototype.getParameterIds = function () { + return this._parameterIds; + }; + CubismEyeBlink.prototype.updateParameters = function (model, deltaTimeSeconds) { + this._userTimeSeconds += deltaTimeSeconds; + var parameterValue; + var t = 0.0; + switch (this._blinkingState) { + case EyeState.EyeState_Closing: + t = + (this._userTimeSeconds - this._stateStartTimeSeconds) / + this._closingSeconds; + if (t >= 1.0) { + t = 1.0; + this._blinkingState = EyeState.EyeState_Closed; + this._stateStartTimeSeconds = this._userTimeSeconds; + } + parameterValue = 1.0 - t; + break; + case EyeState.EyeState_Closed: + t = + (this._userTimeSeconds - this._stateStartTimeSeconds) / + this._closedSeconds; + if (t >= 1.0) { + this._blinkingState = EyeState.EyeState_Opening; + this._stateStartTimeSeconds = this._userTimeSeconds; + } + parameterValue = 0.0; + break; + case EyeState.EyeState_Opening: + t = + (this._userTimeSeconds - this._stateStartTimeSeconds) / + this._openingSeconds; + if (t >= 1.0) { + t = 1.0; + this._blinkingState = EyeState.EyeState_Interval; + this._nextBlinkingTime = this.determinNextBlinkingTiming(); + } + parameterValue = t; + break; + case EyeState.EyeState_Interval: + if (this._nextBlinkingTime < this._userTimeSeconds) { + this._blinkingState = EyeState.EyeState_Closing; + this._stateStartTimeSeconds = this._userTimeSeconds; + } + parameterValue = 1.0; + break; + case EyeState.EyeState_First: + default: + this._blinkingState = EyeState.EyeState_Interval; + this._nextBlinkingTime = this.determinNextBlinkingTiming(); + parameterValue = 1.0; + break; + } + if (!CubismEyeBlink.CloseIfZero) { + parameterValue = -parameterValue; + } + for (var i = 0; i < this._parameterIds.getSize(); ++i) { + model.setParameterValueById(this._parameterIds.at(i), parameterValue); + } + }; + CubismEyeBlink.prototype.determinNextBlinkingTiming = function () { + var r = Math.random(); + return (this._userTimeSeconds + r * (2.0 * this._blinkingIntervalSeconds - 1.0)); + }; + CubismEyeBlink.CloseIfZero = true; + return CubismEyeBlink; + }()); + Live2DCubismFramework.CubismEyeBlink = CubismEyeBlink; + var EyeState; + (function (EyeState) { + EyeState[EyeState["EyeState_First"] = 0] = "EyeState_First"; + EyeState[EyeState["EyeState_Interval"] = 1] = "EyeState_Interval"; + EyeState[EyeState["EyeState_Closing"] = 2] = "EyeState_Closing"; + EyeState[EyeState["EyeState_Closed"] = 3] = "EyeState_Closed"; + EyeState[EyeState["EyeState_Opening"] = 4] = "EyeState_Opening"; + })(EyeState = Live2DCubismFramework.EyeState || (Live2DCubismFramework.EyeState = {})); +})(Live2DCubismFramework = exports.Live2DCubismFramework || (exports.Live2DCubismFramework = {})); + + +/***/ }), + +/***/ "./Framework/src/effect/cubismpose.ts": +/*!********************************************!*\ + !*** ./Framework/src/effect/cubismpose.ts ***! + \********************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +var csmvector_1 = __webpack_require__(/*! ../type/csmvector */ "./Framework/src/type/csmvector.ts"); +var live2dcubismframework_1 = __webpack_require__(/*! ../live2dcubismframework */ "./Framework/src/live2dcubismframework.ts"); +var cubismjson_1 = __webpack_require__(/*! ../utils/cubismjson */ "./Framework/src/utils/cubismjson.ts"); +var csmVector = csmvector_1.Live2DCubismFramework.csmVector; +var CubismFramework = live2dcubismframework_1.Live2DCubismFramework.CubismFramework; +var CubismJson = cubismjson_1.Live2DCubismFramework.CubismJson; +var Live2DCubismFramework; +(function (Live2DCubismFramework) { + var Epsilon = 0.001; + var DefaultFadeInSeconds = 0.5; + var FadeIn = 'FadeInTime'; + var Link = 'Link'; + var Groups = 'Groups'; + var Id = 'Id'; + var CubismPose = (function () { + function CubismPose() { + this._fadeTimeSeconds = DefaultFadeInSeconds; + this._lastModel = null; + this._partGroups = new csmVector(); + this._partGroupCounts = new csmVector(); + } + CubismPose.create = function (pose3json, size) { + var ret = new CubismPose(); + var json = CubismJson.create(pose3json, size); + var root = json.getRoot(); + if (!root.getValueByString(FadeIn).isNull()) { + ret._fadeTimeSeconds = root + .getValueByString(FadeIn) + .toFloat(DefaultFadeInSeconds); + if (ret._fadeTimeSeconds <= 0.0) { + ret._fadeTimeSeconds = DefaultFadeInSeconds; + } + } + var poseListInfo = root.getValueByString(Groups); + var poseCount = poseListInfo.getSize(); + for (var poseIndex = 0; poseIndex < poseCount; ++poseIndex) { + var idListInfo = poseListInfo.getValueByIndex(poseIndex); + var idCount = idListInfo.getSize(); + var groupCount = 0; + for (var groupIndex = 0; groupIndex < idCount; ++groupIndex) { + var partInfo = idListInfo.getValueByIndex(groupIndex); + var partData = new PartData(); + var parameterId = CubismFramework.getIdManager().getId(partInfo.getValueByString(Id).getRawString()); + partData.partId = parameterId; + if (!partInfo.getValueByString(Link).isNull()) { + var linkListInfo = partInfo.getValueByString(Link); + var linkCount = linkListInfo.getSize(); + for (var linkIndex = 0; linkIndex < linkCount; ++linkIndex) { + var linkPart = new PartData(); + var linkId = CubismFramework.getIdManager().getId(linkListInfo.getValueByIndex(linkIndex).getString()); + linkPart.partId = linkId; + partData.link.pushBack(linkPart); + } + } + ret._partGroups.pushBack(partData.clone()); + ++groupCount; + } + ret._partGroupCounts.pushBack(groupCount); + } + CubismJson.delete(json); + return ret; + }; + CubismPose.delete = function (pose) { + if (pose != null) { + pose = null; + } + }; + CubismPose.prototype.updateParameters = function (model, deltaTimeSeconds) { + if (model != this._lastModel) { + this.reset(model); + } + this._lastModel = model; + if (deltaTimeSeconds < 0.0) { + deltaTimeSeconds = 0.0; + } + var beginIndex = 0; + for (var i = 0; i < this._partGroupCounts.getSize(); i++) { + var partGroupCount = this._partGroupCounts.at(i); + this.doFade(model, deltaTimeSeconds, beginIndex, partGroupCount); + beginIndex += partGroupCount; + } + this.copyPartOpacities(model); + }; + CubismPose.prototype.reset = function (model) { + var beginIndex = 0; + for (var i = 0; i < this._partGroupCounts.getSize(); ++i) { + var groupCount = this._partGroupCounts.at(i); + for (var j = beginIndex; j < beginIndex + groupCount; ++j) { + this._partGroups.at(j).initialize(model); + var partsIndex = this._partGroups.at(j).partIndex; + var paramIndex = this._partGroups.at(j).parameterIndex; + if (partsIndex < 0) { + continue; + } + model.setPartOpacityByIndex(partsIndex, j == beginIndex ? 1.0 : 0.0); + model.setParameterValueByIndex(paramIndex, j == beginIndex ? 1.0 : 0.0); + for (var k = 0; k < this._partGroups.at(j).link.getSize(); ++k) { + this._partGroups + .at(j) + .link.at(k) + .initialize(model); + } + } + beginIndex += groupCount; + } + }; + CubismPose.prototype.copyPartOpacities = function (model) { + for (var groupIndex = 0; groupIndex < this._partGroups.getSize(); ++groupIndex) { + var partData = this._partGroups.at(groupIndex); + if (partData.link.getSize() == 0) { + continue; + } + var partIndex = this._partGroups.at(groupIndex).partIndex; + var opacity = model.getPartOpacityByIndex(partIndex); + for (var linkIndex = 0; linkIndex < partData.link.getSize(); ++linkIndex) { + var linkPart = partData.link.at(linkIndex); + var linkPartIndex = linkPart.partIndex; + if (linkPartIndex < 0) { + continue; + } + model.setPartOpacityByIndex(linkPartIndex, opacity); + } + } + }; + CubismPose.prototype.doFade = function (model, deltaTimeSeconds, beginIndex, partGroupCount) { + var visiblePartIndex = -1; + var newOpacity = 1.0; + var phi = 0.5; + var backOpacityThreshold = 0.15; + for (var i = beginIndex; i < beginIndex + partGroupCount; ++i) { + var partIndex = this._partGroups.at(i).partIndex; + var paramIndex = this._partGroups.at(i).parameterIndex; + if (model.getParameterValueByIndex(paramIndex) > Epsilon) { + if (visiblePartIndex >= 0) { + break; + } + visiblePartIndex = i; + newOpacity = model.getPartOpacityByIndex(partIndex); + newOpacity += deltaTimeSeconds / this._fadeTimeSeconds; + if (newOpacity > 1.0) { + newOpacity = 1.0; + } + } + } + if (visiblePartIndex < 0) { + visiblePartIndex = 0; + newOpacity = 1.0; + } + for (var i = beginIndex; i < beginIndex + partGroupCount; ++i) { + var partsIndex = this._partGroups.at(i).partIndex; + if (visiblePartIndex == i) { + model.setPartOpacityByIndex(partsIndex, newOpacity); + } + else { + var opacity = model.getPartOpacityByIndex(partsIndex); + var a1 = void 0; + if (newOpacity < phi) { + a1 = (newOpacity * (phi - 1)) / phi + 1.0; + } + else { + a1 = ((1 - newOpacity) * phi) / (1.0 - phi); + } + var backOpacity = (1.0 - a1) * (1.0 - newOpacity); + if (backOpacity > backOpacityThreshold) { + a1 = 1.0 - backOpacityThreshold / (1.0 - newOpacity); + } + if (opacity > a1) { + opacity = a1; + } + model.setPartOpacityByIndex(partsIndex, opacity); + } + } + }; + return CubismPose; + }()); + Live2DCubismFramework.CubismPose = CubismPose; + var PartData = (function () { + function PartData(v) { + this.parameterIndex = 0; + this.partIndex = 0; + this.link = new csmVector(); + if (v != undefined) { + this.partId = v.partId; + for (var ite = v.link.begin(); ite.notEqual(v.link.end()); ite.preIncrement()) { + this.link.pushBack(ite.ptr().clone()); + } + } + } + PartData.prototype.assignment = function (v) { + this.partId = v.partId; + for (var ite = v.link.begin(); ite.notEqual(v.link.end()); ite.preIncrement()) { + this.link.pushBack(ite.ptr().clone()); + } + return this; + }; + PartData.prototype.initialize = function (model) { + this.parameterIndex = model.getParameterIndex(this.partId); + this.partIndex = model.getPartIndex(this.partId); + model.setParameterValueByIndex(this.parameterIndex, 1); + }; + PartData.prototype.clone = function () { + var clonePartData = new PartData(); + clonePartData.partId = this.partId; + clonePartData.parameterIndex = this.parameterIndex; + clonePartData.partIndex = this.partIndex; + clonePartData.link = new csmVector(); + for (var ite = this.link.begin(); ite.notEqual(this.link.end()); ite.increment()) { + clonePartData.link.pushBack(ite.ptr().clone()); + } + return clonePartData; + }; + return PartData; + }()); + Live2DCubismFramework.PartData = PartData; +})(Live2DCubismFramework = exports.Live2DCubismFramework || (exports.Live2DCubismFramework = {})); + + +/***/ }), + +/***/ "./Framework/src/icubismmodelsetting.ts": +/*!**********************************************!*\ + !*** ./Framework/src/icubismmodelsetting.ts ***! + \**********************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +var Live2DCubismFramework; +(function (Live2DCubismFramework) { + var ICubismModelSetting = (function () { + function ICubismModelSetting() { + } + return ICubismModelSetting; + }()); + Live2DCubismFramework.ICubismModelSetting = ICubismModelSetting; +})(Live2DCubismFramework = exports.Live2DCubismFramework || (exports.Live2DCubismFramework = {})); + + +/***/ }), + +/***/ "./Framework/src/id/cubismid.ts": +/*!**************************************!*\ + !*** ./Framework/src/id/cubismid.ts ***! + \**************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +var csmstring_1 = __webpack_require__(/*! ../type/csmstring */ "./Framework/src/type/csmstring.ts"); +var csmString = csmstring_1.Live2DCubismFramework.csmString; +var Live2DCubismFramework; +(function (Live2DCubismFramework) { + var CubismId = (function () { + function CubismId(id) { + if (typeof id === 'string') { + this._id = new csmString(id); + return; + } + this._id = id; + } + CubismId.prototype.getString = function () { + return this._id; + }; + CubismId.prototype.isEqual = function (c) { + if (typeof c === 'string') { + return this._id.isEqual(c); + } + else if (c instanceof csmString) { + return this._id.isEqual(c.s); + } + else if (c instanceof CubismId) { + return this._id.isEqual(c._id.s); + } + return false; + }; + CubismId.prototype.isNotEqual = function (c) { + if (typeof c == 'string') { + return !this._id.isEqual(c); + } + else if (c instanceof csmString) { + return !this._id.isEqual(c.s); + } + else if (c instanceof CubismId) { + return !this._id.isEqual(c._id.s); + } + return false; + }; + return CubismId; + }()); + Live2DCubismFramework.CubismId = CubismId; +})(Live2DCubismFramework = exports.Live2DCubismFramework || (exports.Live2DCubismFramework = {})); + + +/***/ }), + +/***/ "./Framework/src/id/cubismidmanager.ts": +/*!*********************************************!*\ + !*** ./Framework/src/id/cubismidmanager.ts ***! + \*********************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +var csmvector_1 = __webpack_require__(/*! ../type/csmvector */ "./Framework/src/type/csmvector.ts"); +var cubismid_1 = __webpack_require__(/*! ./cubismid */ "./Framework/src/id/cubismid.ts"); +var CubismId = cubismid_1.Live2DCubismFramework.CubismId; +var csmVector = csmvector_1.Live2DCubismFramework.csmVector; +var Live2DCubismFramework; +(function (Live2DCubismFramework) { + var CubismIdManager = (function () { + function CubismIdManager() { + this._ids = new csmVector(); + } + CubismIdManager.prototype.release = function () { + for (var i = 0; i < this._ids.getSize(); ++i) { + this._ids.set(i, void 0); + } + this._ids = null; + }; + CubismIdManager.prototype.registerIds = function (ids) { + for (var i = 0; i < ids.length; i++) { + this.registerId(ids[i]); + } + }; + CubismIdManager.prototype.registerId = function (id) { + var result = null; + if ('string' == typeof id) { + if ((result = this.findId(id)) != null) { + return result; + } + result = new CubismId(id); + this._ids.pushBack(result); + } + else { + return this.registerId(id.s); + } + return result; + }; + CubismIdManager.prototype.getId = function (id) { + return this.registerId(id); + }; + CubismIdManager.prototype.isExist = function (id) { + if ('string' == typeof id) { + return this.findId(id) != null; + } + return this.isExist(id.s); + }; + CubismIdManager.prototype.findId = function (id) { + for (var i = 0; i < this._ids.getSize(); ++i) { + if (this._ids + .at(i) + .getString() + .isEqual(id)) { + return this._ids.at(i); + } + } + return null; + }; + return CubismIdManager; + }()); + Live2DCubismFramework.CubismIdManager = CubismIdManager; +})(Live2DCubismFramework = exports.Live2DCubismFramework || (exports.Live2DCubismFramework = {})); + + +/***/ }), + +/***/ "./Framework/src/live2dcubismframework.ts": +/*!************************************************!*\ + !*** ./Framework/src/live2dcubismframework.ts ***! + \************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +var cubismjson_1 = __webpack_require__(/*! ./utils/cubismjson */ "./Framework/src/utils/cubismjson.ts"); +var cubismidmanager_1 = __webpack_require__(/*! ./id/cubismidmanager */ "./Framework/src/id/cubismidmanager.ts"); +var cubismrenderer_1 = __webpack_require__(/*! ./rendering/cubismrenderer */ "./Framework/src/rendering/cubismrenderer.ts"); +var cubismdebug_1 = __webpack_require__(/*! ./utils/cubismdebug */ "./Framework/src/utils/cubismdebug.ts"); +var Value = cubismjson_1.Live2DCubismFramework.Value; +var CubismIdManager = cubismidmanager_1.Live2DCubismFramework.CubismIdManager; +var CubismRenderer = cubismrenderer_1.Live2DCubismFramework.CubismRenderer; +function strtod(s, endPtr) { + var index = 0; + for (var i = 1;; i++) { + var testC = s.slice(i - 1, i); + if (testC == 'e' || testC == '-' || testC == 'E') { + continue; + } + var test = s.substring(0, i); + var number = Number(test); + if (isNaN(number)) { + break; + } + index = i; + } + var d = parseFloat(s); + if (isNaN(d)) { + d = NaN; + } + endPtr[0] = s.slice(index); + return d; +} +exports.strtod = strtod; +var Live2DCubismFramework; +(function (Live2DCubismFramework) { + var s_isStarted = false; + var s_isInitialized = false; + var s_option = null; + var s_cubismIdManager = null; + var Constant; + (function (Constant) { + Constant.vertexOffset = 0; + Constant.vertexStep = 2; + })(Constant = Live2DCubismFramework.Constant || (Live2DCubismFramework.Constant = {})); + function csmDelete(address) { + if (!address) { + return; + } + address = void 0; + } + Live2DCubismFramework.csmDelete = csmDelete; + var CubismFramework = (function () { + function CubismFramework() { + } + CubismFramework.startUp = function (option) { + if (option === void 0) { option = null; } + if (s_isStarted) { + cubismdebug_1.CubismLogInfo('CubismFramework.startUp() is already done.'); + return s_isStarted; + } + s_option = option; + if (s_option != null) { + Live2DCubismCore.Logging.csmSetLogFunction(s_option.logFunction); + } + s_isStarted = true; + if (s_isStarted) { + var version = Live2DCubismCore.Version.csmGetVersion(); + var major = (version & 0xff000000) >> 24; + var minor = (version & 0x00ff0000) >> 16; + var patch = version & 0x0000ffff; + var versionNumber = version; + cubismdebug_1.CubismLogInfo("Live2D Cubism Core version: {0}.{1}.{2} ({3})", ('00' + major).slice(-2), ('00' + minor).slice(-2), ('0000' + patch).slice(-4), versionNumber); + } + cubismdebug_1.CubismLogInfo('CubismFramework.startUp() is complete.'); + return s_isStarted; + }; + CubismFramework.cleanUp = function () { + s_isStarted = false; + s_isInitialized = false; + s_option = null; + s_cubismIdManager = null; + }; + CubismFramework.initialize = function () { + cubismdebug_1.CSM_ASSERT(s_isStarted); + if (!s_isStarted) { + cubismdebug_1.CubismLogWarning('CubismFramework is not started.'); + return; + } + if (s_isInitialized) { + cubismdebug_1.CubismLogWarning('CubismFramework.initialize() skipped, already initialized.'); + return; + } + Value.staticInitializeNotForClientCall(); + s_cubismIdManager = new CubismIdManager(); + s_isInitialized = true; + cubismdebug_1.CubismLogInfo('CubismFramework.initialize() is complete.'); + }; + CubismFramework.dispose = function () { + cubismdebug_1.CSM_ASSERT(s_isStarted); + if (!s_isStarted) { + cubismdebug_1.CubismLogWarning('CubismFramework is not started.'); + return; + } + if (!s_isInitialized) { + cubismdebug_1.CubismLogWarning('CubismFramework.dispose() skipped, not initialized.'); + return; + } + Value.staticReleaseNotForClientCall(); + s_cubismIdManager.release(); + s_cubismIdManager = null; + CubismRenderer.staticRelease(); + s_isInitialized = false; + cubismdebug_1.CubismLogInfo('CubismFramework.dispose() is complete.'); + }; + CubismFramework.isStarted = function () { + return s_isStarted; + }; + CubismFramework.isInitialized = function () { + return s_isInitialized; + }; + CubismFramework.coreLogFunction = function (message) { + if (!Live2DCubismCore.Logging.csmGetLogFunction()) { + return; + } + Live2DCubismCore.Logging.csmGetLogFunction()(message); + }; + CubismFramework.getLoggingLevel = function () { + if (s_option != null) { + return s_option.loggingLevel; + } + return LogLevel.LogLevel_Off; + }; + CubismFramework.getIdManager = function () { + return s_cubismIdManager; + }; + return CubismFramework; + }()); + Live2DCubismFramework.CubismFramework = CubismFramework; +})(Live2DCubismFramework = exports.Live2DCubismFramework || (exports.Live2DCubismFramework = {})); +var Option = (function () { + function Option() { + } + return Option; +}()); +exports.Option = Option; +var LogLevel; +(function (LogLevel) { + LogLevel[LogLevel["LogLevel_Verbose"] = 0] = "LogLevel_Verbose"; + LogLevel[LogLevel["LogLevel_Debug"] = 1] = "LogLevel_Debug"; + LogLevel[LogLevel["LogLevel_Info"] = 2] = "LogLevel_Info"; + LogLevel[LogLevel["LogLevel_Warning"] = 3] = "LogLevel_Warning"; + LogLevel[LogLevel["LogLevel_Error"] = 4] = "LogLevel_Error"; + LogLevel[LogLevel["LogLevel_Off"] = 5] = "LogLevel_Off"; +})(LogLevel = exports.LogLevel || (exports.LogLevel = {})); + + +/***/ }), + +/***/ "./Framework/src/math/cubismmath.ts": +/*!******************************************!*\ + !*** ./Framework/src/math/cubismmath.ts ***! + \******************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +var cubismvector2_1 = __webpack_require__(/*! ./cubismvector2 */ "./Framework/src/math/cubismvector2.ts"); +var CubismVector2 = cubismvector2_1.Live2DCubismFramework.CubismVector2; +var Live2DCubismFramework; +(function (Live2DCubismFramework) { + var CubismMath = (function () { + function CubismMath() { + } + CubismMath.range = function (value, min, max) { + if (value < min) { + value = min; + } + else if (value > max) { + value = max; + } + return value; + }; + CubismMath.sin = function (x) { + return Math.sin(x); + }; + CubismMath.cos = function (x) { + return Math.cos(x); + }; + CubismMath.abs = function (x) { + return Math.abs(x); + }; + CubismMath.sqrt = function (x) { + return Math.sqrt(x); + }; + CubismMath.getEasingSine = function (value) { + if (value < 0.0) { + return 0.0; + } + else if (value > 1.0) { + return 1.0; + } + return 0.5 - 0.5 * this.cos(value * Math.PI); + }; + CubismMath.max = function (left, right) { + return left > right ? left : right; + }; + CubismMath.min = function (left, right) { + return left > right ? right : left; + }; + CubismMath.degreesToRadian = function (degrees) { + return (degrees / 180.0) * Math.PI; + }; + CubismMath.radianToDegrees = function (radian) { + return (radian * 180.0) / Math.PI; + }; + CubismMath.directionToRadian = function (from, to) { + var q1 = Math.atan2(to.y, to.x); + var q2 = Math.atan2(from.y, from.x); + var ret = q1 - q2; + while (ret < -Math.PI) { + ret += Math.PI * 2.0; + } + while (ret > Math.PI) { + ret -= Math.PI * 2.0; + } + return ret; + }; + CubismMath.directionToDegrees = function (from, to) { + var radian = this.directionToRadian(from, to); + var degree = this.radianToDegrees(radian); + if (to.x - from.x > 0.0) { + degree = -degree; + } + return degree; + }; + CubismMath.radianToDirection = function (totalAngle) { + var ret = new CubismVector2(); + ret.x = this.sin(totalAngle); + ret.y = this.cos(totalAngle); + return ret; + }; + return CubismMath; + }()); + Live2DCubismFramework.CubismMath = CubismMath; +})(Live2DCubismFramework = exports.Live2DCubismFramework || (exports.Live2DCubismFramework = {})); + + +/***/ }), + +/***/ "./Framework/src/math/cubismmatrix44.ts": +/*!**********************************************!*\ + !*** ./Framework/src/math/cubismmatrix44.ts ***! + \**********************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +var Live2DCubismFramework; +(function (Live2DCubismFramework) { + var CubismMatrix44 = (function () { + function CubismMatrix44() { + this._tr = new Float32Array(16); + this.loadIdentity(); + } + CubismMatrix44.multiply = function (a, b, dst) { + var c = new Float32Array([ + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0 + ]); + var n = 4; + for (var i = 0; i < n; ++i) { + for (var j = 0; j < n; ++j) { + for (var k = 0; k < n; ++k) { + c[j + i * 4] += a[k + i * 4] * b[j + k * 4]; + } + } + } + for (var i = 0; i < 16; ++i) { + dst[i] = c[i]; + } + }; + CubismMatrix44.prototype.loadIdentity = function () { + var c = new Float32Array([ + 1.0, + 0.0, + 0.0, + 0.0, + 0.0, + 1.0, + 0.0, + 0.0, + 0.0, + 0.0, + 1.0, + 0.0, + 0.0, + 0.0, + 0.0, + 1.0 + ]); + this.setMatrix(c); + }; + CubismMatrix44.prototype.setMatrix = function (tr) { + for (var i = 0; i < 16; ++i) { + this._tr[i] = tr[i]; + } + }; + CubismMatrix44.prototype.getArray = function () { + return this._tr; + }; + CubismMatrix44.prototype.getScaleX = function () { + return this._tr[0]; + }; + CubismMatrix44.prototype.getScaleY = function () { + return this._tr[5]; + }; + CubismMatrix44.prototype.getTranslateX = function () { + return this._tr[12]; + }; + CubismMatrix44.prototype.getTranslateY = function () { + return this._tr[13]; + }; + CubismMatrix44.prototype.transformX = function (src) { + return this._tr[0] * src + this._tr[12]; + }; + CubismMatrix44.prototype.transformY = function (src) { + return this._tr[5] * src + this._tr[13]; + }; + CubismMatrix44.prototype.invertTransformX = function (src) { + return (src - this._tr[12]) / this._tr[0]; + }; + CubismMatrix44.prototype.invertTransformY = function (src) { + return (src - this._tr[13]) / this._tr[5]; + }; + CubismMatrix44.prototype.translateRelative = function (x, y) { + var tr1 = new Float32Array([ + 1.0, + 0.0, + 0.0, + 0.0, + 0.0, + 1.0, + 0.0, + 0.0, + 0.0, + 0.0, + 1.0, + 0.0, + x, + y, + 0.0, + 1.0 + ]); + CubismMatrix44.multiply(tr1, this._tr, this._tr); + }; + CubismMatrix44.prototype.translate = function (x, y) { + this._tr[12] = x; + this._tr[13] = y; + }; + CubismMatrix44.prototype.translateX = function (x) { + this._tr[12] = x; + }; + CubismMatrix44.prototype.translateY = function (y) { + this._tr[13] = y; + }; + CubismMatrix44.prototype.scaleRelative = function (x, y) { + var tr1 = new Float32Array([ + x, + 0.0, + 0.0, + 0.0, + 0.0, + y, + 0.0, + 0.0, + 0.0, + 0.0, + 1.0, + 0.0, + 0.0, + 0.0, + 0.0, + 1.0 + ]); + CubismMatrix44.multiply(tr1, this._tr, this._tr); + }; + CubismMatrix44.prototype.scale = function (x, y) { + this._tr[0] = x; + this._tr[5] = y; + }; + CubismMatrix44.prototype.multiplyByMatrix = function (m) { + CubismMatrix44.multiply(m.getArray(), this._tr, this._tr); + }; + CubismMatrix44.prototype.clone = function () { + var cloneMatrix = new CubismMatrix44(); + for (var i = 0; i < this._tr.length; i++) { + cloneMatrix._tr[i] = this._tr[i]; + } + return cloneMatrix; + }; + return CubismMatrix44; + }()); + Live2DCubismFramework.CubismMatrix44 = CubismMatrix44; +})(Live2DCubismFramework = exports.Live2DCubismFramework || (exports.Live2DCubismFramework = {})); + + +/***/ }), + +/***/ "./Framework/src/math/cubismmodelmatrix.ts": +/*!*************************************************!*\ + !*** ./Framework/src/math/cubismmodelmatrix.ts ***! + \*************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +var cubismmatrix44_1 = __webpack_require__(/*! ./cubismmatrix44 */ "./Framework/src/math/cubismmatrix44.ts"); +var CubismMatrix44 = cubismmatrix44_1.Live2DCubismFramework.CubismMatrix44; +var Live2DCubismFramework; +(function (Live2DCubismFramework) { + var CubismModelMatrix = (function (_super) { + __extends(CubismModelMatrix, _super); + function CubismModelMatrix(w, h) { + var _this = _super.call(this) || this; + _this._width = w !== undefined ? w : 0.0; + _this._height = h !== undefined ? h : 0.0; + _this.setHeight(1.0); + return _this; + } + CubismModelMatrix.prototype.setWidth = function (w) { + var scaleX = w / this._width; + var scaleY = scaleX; + this.scale(scaleX * 2.6, scaleY * 2.6); + }; + CubismModelMatrix.prototype.setHeight = function (h) { + var scaleX = h / this._height; + var scaleY = scaleX; + this.scale(scaleX * 2.6, scaleY * 2.6); + }; + CubismModelMatrix.prototype.setPosition = function (x, y) { + this.translate(x, y); + }; + CubismModelMatrix.prototype.setCenterPosition = function (x, y) { + this.centerX(x); + this.centerY(y); + }; + CubismModelMatrix.prototype.top = function (y) { + this.setY(y); + }; + CubismModelMatrix.prototype.bottom = function (y) { + var h = this._height * this.getScaleY(); + this.translateY(y - h); + }; + CubismModelMatrix.prototype.left = function (x) { + this.setX(x); + }; + CubismModelMatrix.prototype.right = function (x) { + var w = this._width * this.getScaleX(); + this.translateX(x - w); + }; + CubismModelMatrix.prototype.centerX = function (x) { + var w = this._width * this.getScaleX(); + this.translateX(x - w / 2.0); + }; + CubismModelMatrix.prototype.setX = function (x) { + this.translateX(x); + }; + CubismModelMatrix.prototype.centerY = function (y) { + var h = this._height * this.getScaleY(); + this.translateY(y - h / 2.0); + }; + CubismModelMatrix.prototype.setY = function (y) { + this.translateY(y); + }; + CubismModelMatrix.prototype.setupFromLayout = function (layout) { + var keyWidth = 'width'; + var keyHeight = 'height'; + var keyX = 'x'; + var keyY = 'y'; + var keyCenterX = 'center_x'; + var keyCenterY = 'center_y'; + var keyTop = 'top'; + var keyBottom = 'bottom'; + var keyLeft = 'left'; + var keyRight = 'right'; + for (var ite = layout.begin(); ite.notEqual(layout.end()); ite.preIncrement()) { + var key = ite.ptr().first; + var value = ite.ptr().second; + if (key == keyWidth) { + this.setWidth(value); + } + else if (key == keyHeight) { + this.setHeight(value); + } + } + for (var ite = layout.begin(); ite.notEqual(layout.end()); ite.preIncrement()) { + var key = ite.ptr().first; + var value = ite.ptr().second; + if (key == keyX) { + this.setX(value); + } + else if (key == keyY) { + this.setY(value); + } + else if (key == keyCenterX) { + this.centerX(value); + } + else if (key == keyCenterY) { + this.centerY(value); + } + else if (key == keyTop) { + this.top(value); + } + else if (key == keyBottom) { + this.bottom(value); + } + else if (key == keyLeft) { + this.left(value); + } + else if (key == keyRight) { + this.right(value); + } + } + }; + return CubismModelMatrix; + }(CubismMatrix44)); + Live2DCubismFramework.CubismModelMatrix = CubismModelMatrix; +})(Live2DCubismFramework = exports.Live2DCubismFramework || (exports.Live2DCubismFramework = {})); + + +/***/ }), + +/***/ "./Framework/src/math/cubismtargetpoint.ts": +/*!*************************************************!*\ + !*** ./Framework/src/math/cubismtargetpoint.ts ***! + \*************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +var cubismmath_1 = __webpack_require__(/*! ./cubismmath */ "./Framework/src/math/cubismmath.ts"); +var CubismMath = cubismmath_1.Live2DCubismFramework.CubismMath; +var Live2DCubismFramework; +(function (Live2DCubismFramework) { + var FrameRate = 30; + var Epsilon = 0.01; + var CubismTargetPoint = (function () { + function CubismTargetPoint() { + this._faceTargetX = 0.0; + this._faceTargetY = 0.0; + this._faceX = 0.0; + this._faceY = 0.0; + this._faceVX = 0.0; + this._faceVY = 0.0; + this._lastTimeSeconds = 0.0; + this._userTimeSeconds = 0.0; + } + CubismTargetPoint.prototype.update = function (deltaTimeSeconds) { + this._userTimeSeconds += deltaTimeSeconds; + var faceParamMaxV = 40.0 / 10.0; + var maxV = (faceParamMaxV * 1.0) / FrameRate; + if (this._lastTimeSeconds == 0.0) { + this._lastTimeSeconds = this._userTimeSeconds; + return; + } + var deltaTimeWeight = (this._userTimeSeconds - this._lastTimeSeconds) * FrameRate; + this._lastTimeSeconds = this._userTimeSeconds; + var timeToMaxSpeed = 0.15; + var frameToMaxSpeed = timeToMaxSpeed * FrameRate; + var maxA = (deltaTimeWeight * maxV) / frameToMaxSpeed; + var dx = this._faceTargetX - this._faceX; + var dy = this._faceTargetY - this._faceY; + if (CubismMath.abs(dx) <= Epsilon && CubismMath.abs(dy) <= Epsilon) { + return; + } + var d = CubismMath.sqrt(dx * dx + dy * dy); + var vx = (maxV * dx) / d; + var vy = (maxV * dy) / d; + var ax = vx - this._faceVX; + var ay = vy - this._faceVY; + var a = CubismMath.sqrt(ax * ax + ay * ay); + if (a < -maxA || a > maxA) { + ax *= maxA / a; + ay *= maxA / a; + } + this._faceVX += ax; + this._faceVY += ay; + { + var maxV_1 = 0.5 * + (CubismMath.sqrt(maxA * maxA + 16.0 * maxA * d - 8.0 * maxA * d) - + maxA); + var curV = CubismMath.sqrt(this._faceVX * this._faceVX + this._faceVY * this._faceVY); + if (curV > maxV_1) { + this._faceVX *= maxV_1 / curV; + this._faceVY *= maxV_1 / curV; + } + } + this._faceX += this._faceVX; + this._faceY += this._faceVY; + }; + CubismTargetPoint.prototype.getX = function () { + return this._faceX; + }; + CubismTargetPoint.prototype.getY = function () { + return this._faceY; + }; + CubismTargetPoint.prototype.set = function (x, y) { + this._faceTargetX = x; + this._faceTargetY = y; + }; + return CubismTargetPoint; + }()); + Live2DCubismFramework.CubismTargetPoint = CubismTargetPoint; +})(Live2DCubismFramework = exports.Live2DCubismFramework || (exports.Live2DCubismFramework = {})); + + +/***/ }), + +/***/ "./Framework/src/math/cubismvector2.ts": +/*!*********************************************!*\ + !*** ./Framework/src/math/cubismvector2.ts ***! + \*********************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +var Live2DCubismFramework; +(function (Live2DCubismFramework) { + var CubismVector2 = (function () { + function CubismVector2(x, y) { + this.x = x; + this.y = y; + this.x = x == undefined ? 0.0 : x; + this.y = y == undefined ? 0.0 : y; + } + CubismVector2.prototype.add = function (vector2) { + var ret = new CubismVector2(0.0, 0.0); + ret.x = this.x + vector2.x; + ret.y = this.y + vector2.y; + return ret; + }; + CubismVector2.prototype.substract = function (vector2) { + var ret = new CubismVector2(0.0, 0.0); + ret.x = this.x - vector2.x; + ret.y = this.y - vector2.y; + return ret; + }; + CubismVector2.prototype.multiply = function (vector2) { + var ret = new CubismVector2(0.0, 0.0); + ret.x = this.x * vector2.x; + ret.y = this.y * vector2.y; + return ret; + }; + CubismVector2.prototype.multiplyByScaler = function (scalar) { + return this.multiply(new CubismVector2(scalar, scalar)); + }; + CubismVector2.prototype.division = function (vector2) { + var ret = new CubismVector2(0.0, 0.0); + ret.x = this.x / vector2.x; + ret.y = this.y / vector2.y; + return ret; + }; + CubismVector2.prototype.divisionByScalar = function (scalar) { + return this.division(new CubismVector2(scalar, scalar)); + }; + CubismVector2.prototype.getLength = function () { + return Math.sqrt(this.x * this.x + this.y * this.y); + }; + CubismVector2.prototype.getDistanceWith = function (a) { + return Math.sqrt((this.x - a.x) * (this.x - a.x) + (this.y - a.y) * (this.y - a.y)); + }; + CubismVector2.prototype.dot = function (a) { + return this.x * a.x + this.y * a.y; + }; + CubismVector2.prototype.normalize = function () { + var length = Math.pow(this.x * this.x + this.y * this.y, 0.5); + this.x = this.x / length; + this.y = this.y / length; + }; + CubismVector2.prototype.isEqual = function (rhs) { + return this.x == rhs.x && this.y == rhs.y; + }; + CubismVector2.prototype.isNotEqual = function (rhs) { + return !this.isEqual(rhs); + }; + return CubismVector2; + }()); + Live2DCubismFramework.CubismVector2 = CubismVector2; +})(Live2DCubismFramework = exports.Live2DCubismFramework || (exports.Live2DCubismFramework = {})); + + +/***/ }), + +/***/ "./Framework/src/math/cubismviewmatrix.ts": +/*!************************************************!*\ + !*** ./Framework/src/math/cubismviewmatrix.ts ***! + \************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +var cubismmatrix44_1 = __webpack_require__(/*! ./cubismmatrix44 */ "./Framework/src/math/cubismmatrix44.ts"); +var CubismMatrix44 = cubismmatrix44_1.Live2DCubismFramework.CubismMatrix44; +var Live2DCubismFramework; +(function (Live2DCubismFramework) { + var CubismViewMatrix = (function (_super) { + __extends(CubismViewMatrix, _super); + function CubismViewMatrix() { + var _this = _super.call(this) || this; + _this._screenLeft = 0.0; + _this._screenRight = 0.0; + _this._screenTop = 0.0; + _this._screenBottom = 0.0; + _this._maxLeft = 0.0; + _this._maxRight = 0.0; + _this._maxTop = 0.0; + _this._maxBottom = 0.0; + _this._maxScale = 0.0; + _this._minScale = 0.0; + return _this; + } + CubismViewMatrix.prototype.adjustTranslate = function (x, y) { + if (this._tr[0] * this._maxLeft + (this._tr[12] + x) > this._screenLeft) { + x = this._screenLeft - this._tr[0] * this._maxLeft - this._tr[12]; + } + if (this._tr[0] * this._maxRight + (this._tr[12] + x) < + this._screenRight) { + x = this._screenRight - this._tr[0] * this._maxRight - this._tr[12]; + } + if (this._tr[5] * this._maxTop + (this._tr[13] + y) < this._screenTop) { + y = this._screenTop - this._tr[5] * this._maxTop - this._tr[13]; + } + if (this._tr[5] * this._maxBottom + (this._tr[13] + y) > + this._screenBottom) { + y = this._screenBottom - this._tr[5] * this._maxBottom - this._tr[13]; + } + var tr1 = new Float32Array([ + 1.0, + 0.0, + 0.0, + 0.0, + 0.0, + 1.0, + 0.0, + 0.0, + 0.0, + 0.0, + 1.0, + 0.0, + x, + y, + 0.0, + 1.0 + ]); + CubismMatrix44.multiply(tr1, this._tr, this._tr); + }; + CubismViewMatrix.prototype.adjustScale = function (cx, cy, scale) { + var maxScale = this.getMaxScale(); + var minScale = this.getMinScale(); + var targetScale = scale * this._tr[0]; + if (targetScale < minScale) { + if (this._tr[0] > 0.0) { + scale = minScale / this._tr[0]; + } + } + else if (targetScale > maxScale) { + if (this._tr[0] > 0.0) { + scale = maxScale / this._tr[0]; + } + } + var tr1 = new Float32Array([ + 1.0, + 0.0, + 0.0, + 0.0, + 0.0, + 1.0, + 0.0, + 0.0, + 0.0, + 0.0, + 1.0, + 0.0, + cx, + cy, + 0.0, + 1.0 + ]); + var tr2 = new Float32Array([ + scale, + 0.0, + 0.0, + 0.0, + 0.0, + scale, + 0.0, + 0.0, + 0.0, + 0.0, + 1.0, + 0.0, + 0.0, + 0.0, + 0.0, + 1.0 + ]); + var tr3 = new Float32Array([ + 1.0, + 0.0, + 0.0, + 0.0, + 0.0, + 1.0, + 0.0, + 0.0, + 0.0, + 0.0, + 1.0, + 0.0, + -cx, + -cy, + 0.0, + 1.0 + ]); + CubismMatrix44.multiply(tr3, this._tr, this._tr); + CubismMatrix44.multiply(tr2, this._tr, this._tr); + CubismMatrix44.multiply(tr1, this._tr, this._tr); + }; + CubismViewMatrix.prototype.setScreenRect = function (left, right, bottom, top) { + this._screenLeft = left; + this._screenRight = right; + this._screenBottom = bottom; + this._screenTop = top; + }; + CubismViewMatrix.prototype.setMaxScreenRect = function (left, right, bottom, top) { + this._maxLeft = left; + this._maxRight = right; + this._maxTop = top; + this._maxBottom = bottom; + }; + CubismViewMatrix.prototype.setMaxScale = function (maxScale) { + this._maxScale = maxScale; + }; + CubismViewMatrix.prototype.setMinScale = function (minScale) { + this._minScale = minScale; + }; + CubismViewMatrix.prototype.getMaxScale = function () { + return this._maxScale; + }; + CubismViewMatrix.prototype.getMinScale = function () { + return this._minScale; + }; + CubismViewMatrix.prototype.isMaxScale = function () { + return this.getScaleX() >= this._maxScale; + }; + CubismViewMatrix.prototype.isMinScale = function () { + return this.getScaleX() <= this._minScale; + }; + CubismViewMatrix.prototype.getScreenLeft = function () { + return this._screenLeft; + }; + CubismViewMatrix.prototype.getScreenRight = function () { + return this._screenRight; + }; + CubismViewMatrix.prototype.getScreenBottom = function () { + return this._screenBottom; + }; + CubismViewMatrix.prototype.getScreenTop = function () { + return this._screenTop; + }; + CubismViewMatrix.prototype.getMaxLeft = function () { + return this._maxLeft; + }; + CubismViewMatrix.prototype.getMaxRight = function () { + return this._maxRight; + }; + CubismViewMatrix.prototype.getMaxBottom = function () { + return this._maxBottom; + }; + CubismViewMatrix.prototype.getMaxTop = function () { + return this._maxTop; + }; + return CubismViewMatrix; + }(CubismMatrix44)); + Live2DCubismFramework.CubismViewMatrix = CubismViewMatrix; +})(Live2DCubismFramework = exports.Live2DCubismFramework || (exports.Live2DCubismFramework = {})); + + +/***/ }), + +/***/ "./Framework/src/model/cubismmoc.ts": +/*!******************************************!*\ + !*** ./Framework/src/model/cubismmoc.ts ***! + \******************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +var cubismmodel_1 = __webpack_require__(/*! ./cubismmodel */ "./Framework/src/model/cubismmodel.ts"); +var CubismModel = cubismmodel_1.Live2DCubismFramework.CubismModel; +var cubismdebug_1 = __webpack_require__(/*! ../utils/cubismdebug */ "./Framework/src/utils/cubismdebug.ts"); +var Live2DCubismFramework; +(function (Live2DCubismFramework) { + var CubismMoc = (function () { + function CubismMoc(moc) { + this._moc = moc; + this._modelCount = 0; + } + CubismMoc.create = function (mocBytes) { + var cubismMoc = null; + var moc = Live2DCubismCore.Moc.fromArrayBuffer(mocBytes); + if (moc) { + cubismMoc = new CubismMoc(moc); + } + return cubismMoc; + }; + CubismMoc.delete = function (moc) { + moc._moc._release(); + moc._moc = null; + moc = null; + }; + CubismMoc.prototype.createModel = function () { + var cubismModel = null; + var model = Live2DCubismCore.Model.fromMoc(this._moc); + if (model) { + cubismModel = new CubismModel(model); + cubismModel.initialize(); + ++this._modelCount; + } + return cubismModel; + }; + CubismMoc.prototype.deleteModel = function (model) { + if (model != null) { + model.release(); + model = null; + --this._modelCount; + } + }; + CubismMoc.prototype.release = function () { + cubismdebug_1.CSM_ASSERT(this._modelCount == 0); + this._moc._release(); + this._moc = null; + }; + return CubismMoc; + }()); + Live2DCubismFramework.CubismMoc = CubismMoc; +})(Live2DCubismFramework = exports.Live2DCubismFramework || (exports.Live2DCubismFramework = {})); + + +/***/ }), + +/***/ "./Framework/src/model/cubismmodel.ts": +/*!********************************************!*\ + !*** ./Framework/src/model/cubismmodel.ts ***! + \********************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +var cubismrenderer_1 = __webpack_require__(/*! ../rendering/cubismrenderer */ "./Framework/src/rendering/cubismrenderer.ts"); +var live2dcubismframework_1 = __webpack_require__(/*! ../live2dcubismframework */ "./Framework/src/live2dcubismframework.ts"); +var csmmap_1 = __webpack_require__(/*! ../type/csmmap */ "./Framework/src/type/csmmap.ts"); +var csmvector_1 = __webpack_require__(/*! ../type/csmvector */ "./Framework/src/type/csmvector.ts"); +var cubismdebug_1 = __webpack_require__(/*! ../utils/cubismdebug */ "./Framework/src/utils/cubismdebug.ts"); +var CubismFramework = live2dcubismframework_1.Live2DCubismFramework.CubismFramework; +var CubismBlendMode = cubismrenderer_1.Live2DCubismFramework.CubismBlendMode; +var csmVector = csmvector_1.Live2DCubismFramework.csmVector; +var csmMap = csmmap_1.Live2DCubismFramework.csmMap; +var Live2DCubismFramework; +(function (Live2DCubismFramework) { + var CubismModel = (function () { + function CubismModel(model) { + this._model = model; + this._parameterValues = null; + this._parameterMaximumValues = null; + this._parameterMinimumValues = null; + this._partOpacities = null; + this._savedParameters = new csmVector(); + this._parameterIds = new csmVector(); + this._drawableIds = new csmVector(); + this._partIds = new csmVector(); + this._notExistPartId = new csmMap(); + this._notExistParameterId = new csmMap(); + this._notExistParameterValues = new csmMap(); + this._notExistPartOpacities = new csmMap(); + } + CubismModel.prototype.update = function () { + this._model.update(); + this._model.drawables.resetDynamicFlags(); + }; + CubismModel.prototype.getCanvasWidth = function () { + if (this._model == null) { + return 0.0; + } + return (this._model.canvasinfo.CanvasWidth / + this._model.canvasinfo.PixelsPerUnit); + }; + CubismModel.prototype.getCanvasHeight = function () { + if (this._model == null) { + return 0.0; + } + return (this._model.canvasinfo.CanvasHeight / + this._model.canvasinfo.PixelsPerUnit); + }; + CubismModel.prototype.saveParameters = function () { + var parameterCount = this._model.parameters.count; + var savedParameterCount = this._savedParameters.getSize(); + for (var i = 0; i < parameterCount; ++i) { + if (i < savedParameterCount) { + this._savedParameters.set(i, this._parameterValues[i]); + } + else { + this._savedParameters.pushBack(this._parameterValues[i]); + } + } + }; + CubismModel.prototype.getModel = function () { + return this._model; + }; + CubismModel.prototype.getPartIndex = function (partId) { + var partIndex; + var partCount = this._model.parts.count; + for (partIndex = 0; partIndex < partCount; ++partIndex) { + if (partId == this._partIds.at(partIndex)) { + return partIndex; + } + } + if (this._notExistPartId.isExist(partId)) { + return this._notExistPartId.getValue(partId); + } + partIndex = partCount + this._notExistPartId.getSize(); + this._notExistPartId.setValue(partId, partIndex); + this._notExistPartOpacities.appendKey(partIndex); + return partIndex; + }; + CubismModel.prototype.getPartCount = function () { + var partCount = this._model.parts.count; + return partCount; + }; + CubismModel.prototype.setPartOpacityByIndex = function (partIndex, opacity) { + if (this._notExistPartOpacities.isExist(partIndex)) { + this._notExistPartOpacities.setValue(partIndex, opacity); + return; + } + cubismdebug_1.CSM_ASSERT(0 <= partIndex && partIndex < this.getPartCount()); + this._partOpacities[partIndex] = opacity; + }; + CubismModel.prototype.setPartOpacityById = function (partId, opacity) { + var index = this.getPartIndex(partId); + if (index < 0) { + return; + } + this.setPartOpacityByIndex(index, opacity); + }; + CubismModel.prototype.getPartOpacityByIndex = function (partIndex) { + if (this._notExistPartOpacities.isExist(partIndex)) { + return this._notExistPartOpacities.getValue(partIndex); + } + cubismdebug_1.CSM_ASSERT(0 <= partIndex && partIndex < this.getPartCount()); + return this._partOpacities[partIndex]; + }; + CubismModel.prototype.getPartOpacityById = function (partId) { + var index = this.getPartIndex(partId); + if (index < 0) { + return 0; + } + return this.getPartOpacityByIndex(index); + }; + CubismModel.prototype.getParameterIndex = function (parameterId) { + var parameterIndex; + var idCount = this._model.parameters.count; + for (parameterIndex = 0; parameterIndex < idCount; ++parameterIndex) { + if (parameterId != this._parameterIds.at(parameterIndex)) { + continue; + } + return parameterIndex; + } + if (this._notExistParameterId.isExist(parameterId)) { + return this._notExistParameterId.getValue(parameterId); + } + parameterIndex = + this._model.parameters.count + this._notExistParameterId.getSize(); + this._notExistParameterId.setValue(parameterId, parameterIndex); + this._notExistParameterValues.appendKey(parameterIndex); + return parameterIndex; + }; + CubismModel.prototype.getParameterCount = function () { + return this._model.parameters.count; + }; + CubismModel.prototype.getParameterMaximumValue = function (parameterIndex) { + return this._model.parameters.maximumValues[parameterIndex]; + }; + CubismModel.prototype.getParameterMinimumValue = function (parameterIndex) { + return this._model.parameters.minimumValues[parameterIndex]; + }; + CubismModel.prototype.getParameterDefaultValue = function (parameterIndex) { + return this._model.parameters.defaultValues[parameterIndex]; + }; + CubismModel.prototype.getParameterValueByIndex = function (parameterIndex) { + if (this._notExistParameterValues.isExist(parameterIndex)) { + return this._notExistParameterValues.getValue(parameterIndex); + } + cubismdebug_1.CSM_ASSERT(0 <= parameterIndex && parameterIndex < this.getParameterCount()); + return this._parameterValues[parameterIndex]; + }; + CubismModel.prototype.getParameterValueById = function (parameterId) { + var parameterIndex = this.getParameterIndex(parameterId); + return this.getParameterValueByIndex(parameterIndex); + }; + CubismModel.prototype.setParameterValueByIndex = function (parameterIndex, value, weight) { + if (weight === void 0) { weight = 1.0; } + if (this._notExistParameterValues.isExist(parameterIndex)) { + this._notExistParameterValues.setValue(parameterIndex, weight == 1 + ? value + : this._notExistParameterValues.getValue(parameterIndex) * + (1 - weight) + + value * weight); + return; + } + cubismdebug_1.CSM_ASSERT(0 <= parameterIndex && parameterIndex < this.getParameterCount()); + if (this._model.parameters.maximumValues[parameterIndex] < value) { + value = this._model.parameters.maximumValues[parameterIndex]; + } + if (this._model.parameters.minimumValues[parameterIndex] > value) { + value = this._model.parameters.minimumValues[parameterIndex]; + } + this._parameterValues[parameterIndex] = + weight == 1 + ? value + : (this._parameterValues[parameterIndex] = + this._parameterValues[parameterIndex] * (1 - weight) + + value * weight); + }; + CubismModel.prototype.setParameterValueById = function (parameterId, value, weight) { + if (weight === void 0) { weight = 1.0; } + var index = this.getParameterIndex(parameterId); + this.setParameterValueByIndex(index, value, weight); + }; + CubismModel.prototype.addParameterValueByIndex = function (parameterIndex, value, weight) { + if (weight === void 0) { weight = 1.0; } + this.setParameterValueByIndex(parameterIndex, this.getParameterValueByIndex(parameterIndex) + value * weight); + }; + CubismModel.prototype.addParameterValueById = function (parameterId, value, weight) { + if (weight === void 0) { weight = 1.0; } + var index = this.getParameterIndex(parameterId); + this.addParameterValueByIndex(index, value, weight); + }; + CubismModel.prototype.multiplyParameterValueById = function (parameterId, value, weight) { + if (weight === void 0) { weight = 1.0; } + var index = this.getParameterIndex(parameterId); + this.multiplyParameterValueByIndex(index, value, weight); + }; + CubismModel.prototype.multiplyParameterValueByIndex = function (parameterIndex, value, weight) { + if (weight === void 0) { weight = 1.0; } + this.setParameterValueByIndex(parameterIndex, this.getParameterValueByIndex(parameterIndex) * + (1.0 + (value - 1.0) * weight)); + }; + CubismModel.prototype.getDrawableIndex = function (drawableId) { + var drawableCount = this._model.drawables.count; + for (var drawableIndex = 0; drawableIndex < drawableCount; ++drawableIndex) { + if (this._drawableIds.at(drawableIndex) == drawableId) { + return drawableIndex; + } + } + return -1; + }; + CubismModel.prototype.getDrawableCount = function () { + var drawableCount = this._model.drawables.count; + return drawableCount; + }; + CubismModel.prototype.getDrawableId = function (drawableIndex) { + var parameterIds = this._model.drawables.ids; + return CubismFramework.getIdManager().getId(parameterIds[drawableIndex]); + }; + CubismModel.prototype.getDrawableRenderOrders = function () { + var renderOrders = this._model.drawables.renderOrders; + return renderOrders; + }; + CubismModel.prototype.getDrawableTextureIndices = function (drawableIndex) { + var textureIndices = this._model.drawables.textureIndices; + return textureIndices[drawableIndex]; + }; + CubismModel.prototype.getDrawableDynamicFlagVertexPositionsDidChange = function (drawableIndex) { + var dynamicFlags = this._model.drawables.dynamicFlags; + return Live2DCubismCore.Utils.hasVertexPositionsDidChangeBit(dynamicFlags[drawableIndex]); + }; + CubismModel.prototype.getDrawableVertexIndexCount = function (drawableIndex) { + var indexCounts = this._model.drawables.indexCounts; + return indexCounts[drawableIndex]; + }; + CubismModel.prototype.getDrawableVertexCount = function (drawableIndex) { + var vertexCounts = this._model.drawables.vertexCounts; + return vertexCounts[drawableIndex]; + }; + CubismModel.prototype.getDrawableVertices = function (drawableIndex) { + return this.getDrawableVertexPositions(drawableIndex); + }; + CubismModel.prototype.getDrawableVertexIndices = function (drawableIndex) { + var indicesArray = this._model.drawables.indices; + return indicesArray[drawableIndex]; + }; + CubismModel.prototype.getDrawableVertexPositions = function (drawableIndex) { + var verticesArray = this._model.drawables + .vertexPositions; + return verticesArray[drawableIndex]; + }; + CubismModel.prototype.getDrawableVertexUvs = function (drawableIndex) { + var uvsArray = this._model.drawables.vertexUvs; + return uvsArray[drawableIndex]; + }; + CubismModel.prototype.getDrawableOpacity = function (drawableIndex) { + var opacities = this._model.drawables.opacities; + return opacities[drawableIndex]; + }; + CubismModel.prototype.getDrawableCulling = function (drawableIndex) { + var constantFlags = this._model.drawables.constantFlags; + return !Live2DCubismCore.Utils.hasIsDoubleSidedBit(constantFlags[drawableIndex]); + }; + CubismModel.prototype.getDrawableBlendMode = function (drawableIndex) { + var constantFlags = this._model.drawables.constantFlags; + return Live2DCubismCore.Utils.hasBlendAdditiveBit(constantFlags[drawableIndex]) + ? CubismBlendMode.CubismBlendMode_Additive + : Live2DCubismCore.Utils.hasBlendMultiplicativeBit(constantFlags[drawableIndex]) + ? CubismBlendMode.CubismBlendMode_Multiplicative + : CubismBlendMode.CubismBlendMode_Normal; + }; + CubismModel.prototype.getDrawableInvertedMaskBit = function (drawableIndex) { + var constantFlags = this._model.drawables.constantFlags; + return Live2DCubismCore.Utils.hasIsInvertedMaskBit(constantFlags[drawableIndex]); + }; + CubismModel.prototype.getDrawableMasks = function () { + var masks = this._model.drawables.masks; + return masks; + }; + CubismModel.prototype.getDrawableMaskCounts = function () { + var maskCounts = this._model.drawables.maskCounts; + return maskCounts; + }; + CubismModel.prototype.isUsingMasking = function () { + for (var d = 0; d < this._model.drawables.count; ++d) { + if (this._model.drawables.maskCounts[d] <= 0) { + continue; + } + return true; + } + return false; + }; + CubismModel.prototype.getDrawableDynamicFlagIsVisible = function (drawableIndex) { + var dynamicFlags = this._model.drawables.dynamicFlags; + return Live2DCubismCore.Utils.hasIsVisibleBit(dynamicFlags[drawableIndex]); + }; + CubismModel.prototype.getDrawableDynamicFlagVisibilityDidChange = function (drawableIndex) { + var dynamicFlags = this._model.drawables.dynamicFlags; + return Live2DCubismCore.Utils.hasVisibilityDidChangeBit(dynamicFlags[drawableIndex]); + }; + CubismModel.prototype.getDrawableDynamicFlagOpacityDidChange = function (drawableIndex) { + var dynamicFlags = this._model.drawables.dynamicFlags; + return Live2DCubismCore.Utils.hasOpacityDidChangeBit(dynamicFlags[drawableIndex]); + }; + CubismModel.prototype.getDrawableDynamicFlagRenderOrderDidChange = function (drawableIndex) { + var dynamicFlags = this._model.drawables.dynamicFlags; + return Live2DCubismCore.Utils.hasRenderOrderDidChangeBit(dynamicFlags[drawableIndex]); + }; + CubismModel.prototype.loadParameters = function () { + var parameterCount = this._model.parameters.count; + var savedParameterCount = this._savedParameters.getSize(); + if (parameterCount > savedParameterCount) { + parameterCount = savedParameterCount; + } + for (var i = 0; i < parameterCount; ++i) { + this._parameterValues[i] = this._savedParameters.at(i); + } + }; + CubismModel.prototype.initialize = function () { + cubismdebug_1.CSM_ASSERT(this._model); + this._parameterValues = this._model.parameters.values; + this._partOpacities = this._model.parts.opacities; + this._parameterMaximumValues = this._model.parameters.maximumValues; + this._parameterMinimumValues = this._model.parameters.minimumValues; + { + var parameterIds = this._model.parameters.ids; + var parameterCount = this._model.parameters.count; + this._parameterIds.prepareCapacity(parameterCount); + for (var i = 0; i < parameterCount; ++i) { + this._parameterIds.pushBack(CubismFramework.getIdManager().getId(parameterIds[i])); + } + } + { + var partIds = this._model.parts.ids; + var partCount = this._model.parts.count; + this._partIds.prepareCapacity(partCount); + for (var i = 0; i < partCount; ++i) { + this._partIds.pushBack(CubismFramework.getIdManager().getId(partIds[i])); + } + } + { + var drawableIds = this._model.drawables.ids; + var drawableCount = this._model.drawables.count; + this._drawableIds.prepareCapacity(drawableCount); + for (var i = 0; i < drawableCount; ++i) { + this._drawableIds.pushBack(CubismFramework.getIdManager().getId(drawableIds[i])); + } + } + }; + CubismModel.prototype.release = function () { + this._model.release(); + this._model = null; + }; + return CubismModel; + }()); + Live2DCubismFramework.CubismModel = CubismModel; +})(Live2DCubismFramework = exports.Live2DCubismFramework || (exports.Live2DCubismFramework = {})); + + +/***/ }), + +/***/ "./Framework/src/model/cubismmodeluserdata.ts": +/*!****************************************************!*\ + !*** ./Framework/src/model/cubismmodeluserdata.ts ***! + \****************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +var cubismmodeluserdatajson_1 = __webpack_require__(/*! ./cubismmodeluserdatajson */ "./Framework/src/model/cubismmodeluserdatajson.ts"); +var csmstring_1 = __webpack_require__(/*! ../type/csmstring */ "./Framework/src/type/csmstring.ts"); +var csmvector_1 = __webpack_require__(/*! ../type/csmvector */ "./Framework/src/type/csmvector.ts"); +var live2dcubismframework_1 = __webpack_require__(/*! ../live2dcubismframework */ "./Framework/src/live2dcubismframework.ts"); +var CubismFramework = live2dcubismframework_1.Live2DCubismFramework.CubismFramework; +var csmVector = csmvector_1.Live2DCubismFramework.csmVector; +var csmString = csmstring_1.Live2DCubismFramework.csmString; +var CubismModelUserDataJson = cubismmodeluserdatajson_1.Live2DCubismFramework.CubismModelUserDataJson; +var Live2DCubismFramework; +(function (Live2DCubismFramework) { + var ArtMesh = 'ArtMesh'; + var CubismModelUserDataNode = (function () { + function CubismModelUserDataNode() { + } + return CubismModelUserDataNode; + }()); + Live2DCubismFramework.CubismModelUserDataNode = CubismModelUserDataNode; + var CubismModelUserData = (function () { + function CubismModelUserData() { + this._userDataNodes = new csmVector(); + this._artMeshUserDataNode = new csmVector(); + } + CubismModelUserData.create = function (buffer, size) { + var ret = new CubismModelUserData(); + ret.parseUserData(buffer, size); + return ret; + }; + CubismModelUserData.delete = function (modelUserData) { + if (modelUserData != null) { + modelUserData.release(); + modelUserData = null; + } + }; + CubismModelUserData.prototype.getArtMeshUserDatas = function () { + return this._artMeshUserDataNode; + }; + CubismModelUserData.prototype.parseUserData = function (buffer, size) { + var json = new CubismModelUserDataJson(buffer, size); + var typeOfArtMesh = CubismFramework.getIdManager().getId(ArtMesh); + var nodeCount = json.getUserDataCount(); + for (var i = 0; i < nodeCount; i++) { + var addNode = new CubismModelUserDataNode(); + addNode.targetId = json.getUserDataId(i); + addNode.targetType = CubismFramework.getIdManager().getId(json.getUserDataTargetType(i)); + addNode.value = new csmString(json.getUserDataValue(i)); + this._userDataNodes.pushBack(addNode); + if (addNode.targetType == typeOfArtMesh) { + this._artMeshUserDataNode.pushBack(addNode); + } + } + json.release(); + json = void 0; + }; + CubismModelUserData.prototype.release = function () { + for (var i = 0; i < this._userDataNodes.getSize(); ++i) { + this._userDataNodes.set(i, null); + } + this._userDataNodes = null; + }; + return CubismModelUserData; + }()); + Live2DCubismFramework.CubismModelUserData = CubismModelUserData; +})(Live2DCubismFramework = exports.Live2DCubismFramework || (exports.Live2DCubismFramework = {})); + + +/***/ }), + +/***/ "./Framework/src/model/cubismmodeluserdatajson.ts": +/*!********************************************************!*\ + !*** ./Framework/src/model/cubismmodeluserdatajson.ts ***! + \********************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +var cubismjson_1 = __webpack_require__(/*! ../utils/cubismjson */ "./Framework/src/utils/cubismjson.ts"); +var live2dcubismframework_1 = __webpack_require__(/*! ../live2dcubismframework */ "./Framework/src/live2dcubismframework.ts"); +var CubismFramework = live2dcubismframework_1.Live2DCubismFramework.CubismFramework; +var CubismJson = cubismjson_1.Live2DCubismFramework.CubismJson; +var Live2DCubismFramework; +(function (Live2DCubismFramework) { + var Meta = 'Meta'; + var UserDataCount = 'UserDataCount'; + var TotalUserDataSize = 'TotalUserDataSize'; + var UserData = 'UserData'; + var Target = 'Target'; + var Id = 'Id'; + var Value = 'Value'; + var CubismModelUserDataJson = (function () { + function CubismModelUserDataJson(buffer, size) { + this._json = CubismJson.create(buffer, size); + } + CubismModelUserDataJson.prototype.release = function () { + CubismJson.delete(this._json); + }; + CubismModelUserDataJson.prototype.getUserDataCount = function () { + return this._json + .getRoot() + .getValueByString(Meta) + .getValueByString(UserDataCount) + .toInt(); + }; + CubismModelUserDataJson.prototype.getTotalUserDataSize = function () { + return this._json + .getRoot() + .getValueByString(Meta) + .getValueByString(TotalUserDataSize) + .toInt(); + }; + CubismModelUserDataJson.prototype.getUserDataTargetType = function (i) { + return this._json + .getRoot() + .getValueByString(UserData) + .getValueByIndex(i) + .getValueByString(Target) + .getRawString(); + }; + CubismModelUserDataJson.prototype.getUserDataId = function (i) { + return CubismFramework.getIdManager().getId(this._json + .getRoot() + .getValueByString(UserData) + .getValueByIndex(i) + .getValueByString(Id) + .getRawString()); + }; + CubismModelUserDataJson.prototype.getUserDataValue = function (i) { + return this._json + .getRoot() + .getValueByString(UserData) + .getValueByIndex(i) + .getValueByString(Value) + .getRawString(); + }; + return CubismModelUserDataJson; + }()); + Live2DCubismFramework.CubismModelUserDataJson = CubismModelUserDataJson; +})(Live2DCubismFramework = exports.Live2DCubismFramework || (exports.Live2DCubismFramework = {})); + + +/***/ }), + +/***/ "./Framework/src/model/cubismusermodel.ts": +/*!************************************************!*\ + !*** ./Framework/src/model/cubismusermodel.ts ***! + \************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +var live2dcubismframework_1 = __webpack_require__(/*! ../live2dcubismframework */ "./Framework/src/live2dcubismframework.ts"); +var cubismmotionmanager_1 = __webpack_require__(/*! ../motion/cubismmotionmanager */ "./Framework/src/motion/cubismmotionmanager.ts"); +var cubismtargetpoint_1 = __webpack_require__(/*! ../math/cubismtargetpoint */ "./Framework/src/math/cubismtargetpoint.ts"); +var cubismmodelmatrix_1 = __webpack_require__(/*! ../math/cubismmodelmatrix */ "./Framework/src/math/cubismmodelmatrix.ts"); +var cubismmoc_1 = __webpack_require__(/*! ./cubismmoc */ "./Framework/src/model/cubismmoc.ts"); +var cubismmotion_1 = __webpack_require__(/*! ../motion/cubismmotion */ "./Framework/src/motion/cubismmotion.ts"); +var cubismexpressionmotion_1 = __webpack_require__(/*! ../motion/cubismexpressionmotion */ "./Framework/src/motion/cubismexpressionmotion.ts"); +var cubismpose_1 = __webpack_require__(/*! ../effect/cubismpose */ "./Framework/src/effect/cubismpose.ts"); +var cubismmodeluserdata_1 = __webpack_require__(/*! ./cubismmodeluserdata */ "./Framework/src/model/cubismmodeluserdata.ts"); +var cubismphysics_1 = __webpack_require__(/*! ../physics/cubismphysics */ "./Framework/src/physics/cubismphysics.ts"); +var cubismbreath_1 = __webpack_require__(/*! ../effect/cubismbreath */ "./Framework/src/effect/cubismbreath.ts"); +var cubismeyeblink_1 = __webpack_require__(/*! ../effect/cubismeyeblink */ "./Framework/src/effect/cubismeyeblink.ts"); +var cubismrenderer_webgl_1 = __webpack_require__(/*! ../rendering/cubismrenderer_webgl */ "./Framework/src/rendering/cubismrenderer_webgl.ts"); +var cubismdebug_1 = __webpack_require__(/*! ../utils/cubismdebug */ "./Framework/src/utils/cubismdebug.ts"); +var CubismRenderer_WebGL = cubismrenderer_webgl_1.Live2DCubismFramework.CubismRenderer_WebGL; +var CubismEyeBlink = cubismeyeblink_1.Live2DCubismFramework.CubismEyeBlink; +var CubismBreath = cubismbreath_1.Live2DCubismFramework.CubismBreath; +var Constant = live2dcubismframework_1.Live2DCubismFramework.Constant; +var CubismPhysics = cubismphysics_1.Live2DCubismFramework.CubismPhysics; +var CubismModelUserData = cubismmodeluserdata_1.Live2DCubismFramework.CubismModelUserData; +var CubismPose = cubismpose_1.Live2DCubismFramework.CubismPose; +var CubismExpressionMotion = cubismexpressionmotion_1.Live2DCubismFramework.CubismExpressionMotion; +var CubismMotion = cubismmotion_1.Live2DCubismFramework.CubismMotion; +var CubismMoc = cubismmoc_1.Live2DCubismFramework.CubismMoc; +var CubismModelMatrix = cubismmodelmatrix_1.Live2DCubismFramework.CubismModelMatrix; +var CubismTargetPoint = cubismtargetpoint_1.Live2DCubismFramework.CubismTargetPoint; +var CubismMotionManager = cubismmotionmanager_1.Live2DCubismFramework.CubismMotionManager; +var Live2DCubismFramework; +(function (Live2DCubismFramework) { + var CubismUserModel = (function () { + function CubismUserModel() { + this.loadMotion = function (buffer, size, name, onFinishedMotionHandler) { return CubismMotion.create(buffer, size, onFinishedMotionHandler); }; + this._moc = null; + this._model = null; + this._motionManager = null; + this._expressionManager = null; + this._eyeBlink = null; + this._breath = null; + this._modelMatrix = null; + this._pose = null; + this._dragManager = null; + this._physics = null; + this._modelUserData = null; + this._initialized = false; + this._updating = false; + this._opacity = 1.0; + this._lipsync = true; + this._lastLipSyncValue = 0.0; + this._dragX = 0.0; + this._dragY = 0.0; + this._accelerationX = 0.0; + this._accelerationY = 0.0; + this._accelerationZ = 0.0; + this._debugMode = false; + this._renderer = null; + this._motionManager = new CubismMotionManager(); + this._motionManager.setEventCallback(CubismUserModel.cubismDefaultMotionEventCallback, this); + this._expressionManager = new CubismMotionManager(); + this._dragManager = new CubismTargetPoint(); + } + CubismUserModel.prototype.isInitialized = function () { + return this._initialized; + }; + CubismUserModel.prototype.setInitialized = function (v) { + this._initialized = v; + }; + CubismUserModel.prototype.isUpdating = function () { + return this._updating; + }; + CubismUserModel.prototype.setUpdating = function (v) { + this._updating = v; + }; + CubismUserModel.prototype.setDragging = function (x, y) { + this._dragManager.set(x, y); + }; + CubismUserModel.prototype.setAcceleration = function (x, y, z) { + this._accelerationX = x; + this._accelerationY = y; + this._accelerationZ = z; + }; + CubismUserModel.prototype.getModelMatrix = function () { + return this._modelMatrix; + }; + CubismUserModel.prototype.setOpacity = function (a) { + this._opacity = a; + }; + CubismUserModel.prototype.getOpacity = function () { + return this._opacity; + }; + CubismUserModel.prototype.loadModel = function (buffer) { + this._moc = CubismMoc.create(buffer); + this._model = this._moc.createModel(); + this._model.saveParameters(); + if (this._moc == null || this._model == null) { + cubismdebug_1.CubismLogError('Failed to CreateModel().'); + return; + } + this._modelMatrix = new CubismModelMatrix(this._model.getCanvasWidth(), this._model.getCanvasHeight()); + }; + CubismUserModel.prototype.loadExpression = function (buffer, size, name) { + return CubismExpressionMotion.create(buffer, size); + }; + CubismUserModel.prototype.loadPose = function (buffer, size) { + this._pose = CubismPose.create(buffer, size); + }; + CubismUserModel.prototype.loadUserData = function (buffer, size) { + this._modelUserData = CubismModelUserData.create(buffer, size); + }; + CubismUserModel.prototype.loadPhysics = function (buffer, size) { + this._physics = CubismPhysics.create(buffer, size); + }; + CubismUserModel.prototype.isHit = function (drawableId, pointX, pointY) { + var drawIndex = this._model.getDrawableIndex(drawableId); + if (drawIndex < 0) { + return false; + } + var count = this._model.getDrawableVertexCount(drawIndex); + var vertices = this._model.getDrawableVertices(drawIndex); + var left = vertices[0]; + var right = vertices[0]; + var top = vertices[1]; + var bottom = vertices[1]; + for (var j = 1; j < count; ++j) { + var x = vertices[Constant.vertexOffset + j * Constant.vertexStep]; + var y = vertices[Constant.vertexOffset + j * Constant.vertexStep + 1]; + if (x < left) { + left = x; + } + if (x > right) { + right = x; + } + if (y < top) { + top = y; + } + if (y > bottom) { + bottom = y; + } + } + var tx = this._modelMatrix.invertTransformX(pointX); + var ty = this._modelMatrix.invertTransformY(pointY); + return left <= tx && tx <= right && top <= ty && ty <= bottom; + }; + CubismUserModel.prototype.getModel = function () { + return this._model; + }; + CubismUserModel.prototype.getRenderer = function () { + return this._renderer; + }; + CubismUserModel.prototype.createRenderer = function () { + if (this._renderer) { + this.deleteRenderer(); + } + this._renderer = new CubismRenderer_WebGL(); + this._renderer.initialize(this._model); + }; + CubismUserModel.prototype.deleteRenderer = function () { + if (this._renderer != null) { + this._renderer.release(); + this._renderer = null; + } + }; + CubismUserModel.prototype.motionEventFired = function (eventValue) { + cubismdebug_1.CubismLogInfo('{0}', eventValue.s); + }; + CubismUserModel.cubismDefaultMotionEventCallback = function (caller, eventValue, customData) { + var model = customData; + if (model != null) { + model.motionEventFired(eventValue); + } + }; + CubismUserModel.prototype.release = function () { + if (this._motionManager != null) { + this._motionManager.release(); + this._motionManager = null; + } + if (this._expressionManager != null) { + this._expressionManager.release(); + this._expressionManager = null; + } + if (this._moc != null) { + this._moc.deleteModel(this._model); + this._moc.release(); + this._moc = null; + } + this._modelMatrix = null; + CubismPose.delete(this._pose); + CubismEyeBlink.delete(this._eyeBlink); + CubismBreath.delete(this._breath); + this._dragManager = null; + CubismPhysics.delete(this._physics); + CubismModelUserData.delete(this._modelUserData); + this.deleteRenderer(); + }; + return CubismUserModel; + }()); + Live2DCubismFramework.CubismUserModel = CubismUserModel; +})(Live2DCubismFramework = exports.Live2DCubismFramework || (exports.Live2DCubismFramework = {})); + + +/***/ }), + +/***/ "./Framework/src/motion/acubismmotion.ts": +/*!***********************************************!*\ + !*** ./Framework/src/motion/acubismmotion.ts ***! + \***********************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +var cubismmath_1 = __webpack_require__(/*! ../math/cubismmath */ "./Framework/src/math/cubismmath.ts"); +var csmvector_1 = __webpack_require__(/*! ../type/csmvector */ "./Framework/src/type/csmvector.ts"); +var cubismdebug_1 = __webpack_require__(/*! ../utils/cubismdebug */ "./Framework/src/utils/cubismdebug.ts"); +var csmVector = csmvector_1.Live2DCubismFramework.csmVector; +var CubismMath = cubismmath_1.Live2DCubismFramework.CubismMath; +var Live2DCubismFramework; +(function (Live2DCubismFramework) { + var ACubismMotion = (function () { + function ACubismMotion() { + var _this = this; + this.setFinishedMotionHandler = function (onFinishedMotionHandler) { return (_this._onFinishedMotion = onFinishedMotionHandler); }; + this.getFinishedMotionHandler = function () { return _this._onFinishedMotion; }; + this._fadeInSeconds = -1.0; + this._fadeOutSeconds = -1.0; + this._weight = 1.0; + this._offsetSeconds = 0.0; + this._firedEventValues = new csmVector(); + } + ACubismMotion.delete = function (motion) { + motion.release(); + motion = void 0; + motion = null; + }; + ACubismMotion.prototype.release = function () { + this._weight = 0.0; + }; + ACubismMotion.prototype.updateParameters = function (model, motionQueueEntry, userTimeSeconds) { + if (!motionQueueEntry.isAvailable() || motionQueueEntry.isFinished()) { + return; + } + if (!motionQueueEntry.isStarted()) { + motionQueueEntry.setIsStarted(true); + motionQueueEntry.setStartTime(userTimeSeconds - this._offsetSeconds); + motionQueueEntry.setFadeInStartTime(userTimeSeconds); + var duration = this.getDuration(); + if (motionQueueEntry.getEndTime() < 0) { + motionQueueEntry.setEndTime(duration <= 0 ? -1 : motionQueueEntry.getStartTime() + duration); + } + } + var fadeWeight = this._weight; + var fadeIn = this._fadeInSeconds == 0.0 + ? 1.0 + : CubismMath.getEasingSine((userTimeSeconds - motionQueueEntry.getFadeInStartTime()) / + this._fadeInSeconds); + var fadeOut = this._fadeOutSeconds == 0.0 || motionQueueEntry.getEndTime() < 0.0 + ? 1.0 + : CubismMath.getEasingSine((motionQueueEntry.getEndTime() - userTimeSeconds) / + this._fadeOutSeconds); + fadeWeight = fadeWeight * fadeIn * fadeOut; + motionQueueEntry.setState(userTimeSeconds, fadeWeight); + cubismdebug_1.CSM_ASSERT(0.0 <= fadeWeight && fadeWeight <= 1.0); + this.doUpdateParameters(model, userTimeSeconds, fadeWeight, motionQueueEntry); + if (motionQueueEntry.getEndTime() > 0 && + motionQueueEntry.getEndTime() < userTimeSeconds) { + motionQueueEntry.setIsFinished(true); + } + }; + ACubismMotion.prototype.setFadeInTime = function (fadeInSeconds) { + this._fadeInSeconds = fadeInSeconds; + }; + ACubismMotion.prototype.setFadeOutTime = function (fadeOutSeconds) { + this._fadeOutSeconds = fadeOutSeconds; + }; + ACubismMotion.prototype.getFadeOutTime = function () { + return this._fadeOutSeconds; + }; + ACubismMotion.prototype.getFadeInTime = function () { + return this._fadeInSeconds; + }; + ACubismMotion.prototype.setWeight = function (weight) { + this._weight = weight; + }; + ACubismMotion.prototype.getWeight = function () { + return this._weight; + }; + ACubismMotion.prototype.getDuration = function () { + return -1.0; + }; + ACubismMotion.prototype.getLoopDuration = function () { + return -1.0; + }; + ACubismMotion.prototype.setOffsetTime = function (offsetSeconds) { + this._offsetSeconds = offsetSeconds; + }; + ACubismMotion.prototype.getFiredEvent = function (beforeCheckTimeSeconds, motionTimeSeconds) { + return this._firedEventValues; + }; + return ACubismMotion; + }()); + Live2DCubismFramework.ACubismMotion = ACubismMotion; +})(Live2DCubismFramework = exports.Live2DCubismFramework || (exports.Live2DCubismFramework = {})); + + +/***/ }), + +/***/ "./Framework/src/motion/cubismexpressionmotion.ts": +/*!********************************************************!*\ + !*** ./Framework/src/motion/cubismexpressionmotion.ts ***! + \********************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +var acubismmotion_1 = __webpack_require__(/*! ./acubismmotion */ "./Framework/src/motion/acubismmotion.ts"); +var cubismjson_1 = __webpack_require__(/*! ../utils/cubismjson */ "./Framework/src/utils/cubismjson.ts"); +var live2dcubismframework_1 = __webpack_require__(/*! ../live2dcubismframework */ "./Framework/src/live2dcubismframework.ts"); +var csmvector_1 = __webpack_require__(/*! ../type/csmvector */ "./Framework/src/type/csmvector.ts"); +var csmVector = csmvector_1.Live2DCubismFramework.csmVector; +var CubismFramework = live2dcubismframework_1.Live2DCubismFramework.CubismFramework; +var CubismJson = cubismjson_1.Live2DCubismFramework.CubismJson; +var ACubismMotion = acubismmotion_1.Live2DCubismFramework.ACubismMotion; +var Live2DCubismFramework; +(function (Live2DCubismFramework) { + var ExpressionKeyFadeIn = 'FadeInTime'; + var ExpressionKeyFadeOut = 'FadeOutTime'; + var ExpressionKeyParameters = 'Parameters'; + var ExpressionKeyId = 'Id'; + var ExpressionKeyValue = 'Value'; + var ExpressionKeyBlend = 'Blend'; + var BlendValueAdd = 'Add'; + var BlendValueMultiply = 'Multiply'; + var BlendValueOverwrite = 'Overwrite'; + var DefaultFadeTime = 1.0; + var CubismExpressionMotion = (function (_super) { + __extends(CubismExpressionMotion, _super); + function CubismExpressionMotion() { + var _this = _super.call(this) || this; + _this._parameters = new csmVector(); + return _this; + } + CubismExpressionMotion.create = function (buffer, size) { + var expression = new CubismExpressionMotion(); + var json = CubismJson.create(buffer, size); + var root = json.getRoot(); + expression.setFadeInTime(root.getValueByString(ExpressionKeyFadeIn).toFloat(DefaultFadeTime)); + expression.setFadeOutTime(root.getValueByString(ExpressionKeyFadeOut).toFloat(DefaultFadeTime)); + var parameterCount = root + .getValueByString(ExpressionKeyParameters) + .getSize(); + expression._parameters.prepareCapacity(parameterCount); + for (var i = 0; i < parameterCount; ++i) { + var param = root + .getValueByString(ExpressionKeyParameters) + .getValueByIndex(i); + var parameterId = CubismFramework.getIdManager().getId(param.getValueByString(ExpressionKeyId).getRawString()); + var value = param + .getValueByString(ExpressionKeyValue) + .toFloat(); + var blendType = void 0; + if (param.getValueByString(ExpressionKeyBlend).isNull() || + param.getValueByString(ExpressionKeyBlend).getString() == + BlendValueAdd) { + blendType = ExpressionBlendType.ExpressionBlendType_Add; + } + else if (param.getValueByString(ExpressionKeyBlend).getString() == + BlendValueMultiply) { + blendType = ExpressionBlendType.ExpressionBlendType_Multiply; + } + else if (param.getValueByString(ExpressionKeyBlend).getString() == + BlendValueOverwrite) { + blendType = ExpressionBlendType.ExpressionBlendType_Overwrite; + } + else { + blendType = ExpressionBlendType.ExpressionBlendType_Add; + } + var item = new ExpressionParameter(); + item.parameterId = parameterId; + item.blendType = blendType; + item.value = value; + expression._parameters.pushBack(item); + } + CubismJson.delete(json); + return expression; + }; + CubismExpressionMotion.prototype.doUpdateParameters = function (model, userTimeSeconds, weight, motionQueueEntry) { + for (var i = 0; i < this._parameters.getSize(); ++i) { + var parameter = this._parameters.at(i); + switch (parameter.blendType) { + case ExpressionBlendType.ExpressionBlendType_Add: { + model.addParameterValueById(parameter.parameterId, parameter.value, weight); + break; + } + case ExpressionBlendType.ExpressionBlendType_Multiply: { + model.multiplyParameterValueById(parameter.parameterId, parameter.value, weight); + break; + } + case ExpressionBlendType.ExpressionBlendType_Overwrite: { + model.setParameterValueById(parameter.parameterId, parameter.value, weight); + break; + } + default: + break; + } + } + }; + return CubismExpressionMotion; + }(ACubismMotion)); + Live2DCubismFramework.CubismExpressionMotion = CubismExpressionMotion; + var ExpressionBlendType; + (function (ExpressionBlendType) { + ExpressionBlendType[ExpressionBlendType["ExpressionBlendType_Add"] = 0] = "ExpressionBlendType_Add"; + ExpressionBlendType[ExpressionBlendType["ExpressionBlendType_Multiply"] = 1] = "ExpressionBlendType_Multiply"; + ExpressionBlendType[ExpressionBlendType["ExpressionBlendType_Overwrite"] = 2] = "ExpressionBlendType_Overwrite"; + })(ExpressionBlendType = Live2DCubismFramework.ExpressionBlendType || (Live2DCubismFramework.ExpressionBlendType = {})); + var ExpressionParameter = (function () { + function ExpressionParameter() { + } + return ExpressionParameter; + }()); + Live2DCubismFramework.ExpressionParameter = ExpressionParameter; +})(Live2DCubismFramework = exports.Live2DCubismFramework || (exports.Live2DCubismFramework = {})); + + +/***/ }), + +/***/ "./Framework/src/motion/cubismmotion.ts": +/*!**********************************************!*\ + !*** ./Framework/src/motion/cubismmotion.ts ***! + \**********************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +var cubismmotionjson_1 = __webpack_require__(/*! ./cubismmotionjson */ "./Framework/src/motion/cubismmotionjson.ts"); +var cubismmotioninternal_1 = __webpack_require__(/*! ./cubismmotioninternal */ "./Framework/src/motion/cubismmotioninternal.ts"); +var acubismmotion_1 = __webpack_require__(/*! ./acubismmotion */ "./Framework/src/motion/acubismmotion.ts"); +var live2dcubismframework_1 = __webpack_require__(/*! ../live2dcubismframework */ "./Framework/src/live2dcubismframework.ts"); +var cubismmath_1 = __webpack_require__(/*! ../math/cubismmath */ "./Framework/src/math/cubismmath.ts"); +var csmstring_1 = __webpack_require__(/*! ../type/csmstring */ "./Framework/src/type/csmstring.ts"); +var cubismdebug_1 = __webpack_require__(/*! ../utils/cubismdebug */ "./Framework/src/utils/cubismdebug.ts"); +var csmString = csmstring_1.Live2DCubismFramework.csmString; +var CubismMotionData = cubismmotioninternal_1.Live2DCubismFramework.CubismMotionData; +var CubismMotionSegment = cubismmotioninternal_1.Live2DCubismFramework.CubismMotionSegment; +var CubismMotionPoint = cubismmotioninternal_1.Live2DCubismFramework.CubismMotionPoint; +var CubismMotionEvent = cubismmotioninternal_1.Live2DCubismFramework.CubismMotionEvent; +var CubismMotionSegmentType = cubismmotioninternal_1.Live2DCubismFramework.CubismMotionSegmentType; +var CubismMotionCurve = cubismmotioninternal_1.Live2DCubismFramework.CubismMotionCurve; +var CubismMotionCurveTarget = cubismmotioninternal_1.Live2DCubismFramework.CubismMotionCurveTarget; +var CubismMath = cubismmath_1.Live2DCubismFramework.CubismMath; +var CubismFramework = live2dcubismframework_1.Live2DCubismFramework.CubismFramework; +var ACubismMotion = acubismmotion_1.Live2DCubismFramework.ACubismMotion; +var CubismMotionJson = cubismmotionjson_1.Live2DCubismFramework.CubismMotionJson; +var Live2DCubismFramework; +(function (Live2DCubismFramework) { + var EffectNameEyeBlink = 'EyeBlink'; + var EffectNameLipSync = 'LipSync'; + var TargetNameModel = 'Model'; + var TargetNameParameter = 'Parameter'; + var TargetNamePartOpacity = 'PartOpacity'; + function lerpPoints(a, b, t) { + var result = new CubismMotionPoint(); + result.time = a.time + (b.time - a.time) * t; + result.value = a.value + (b.value - a.value) * t; + return result; + } + function linearEvaluate(points, time) { + var t; + if (points[0] && points[0].time != 0) { + t = (time - points[0].time) / (points[1].time - points[0].time); + } + else if (points[2] && points[2].time) { + t = (time - points[1].time) / (points[2].time - points[1].time); + } + else if (points.length > 0) { + t = (time - points[0].time) / (points[1].time - points[0].time); + } + if (t < 0.0) { + t = 0.0; + } + return points[0].value + (points[1].value - points[0].value) * t; + } + function bezierEvaluate(points, time) { + var t = (time - points[0].time) / (points[3].time - points[0].time); + if (t < 0.0) { + t = 0.0; + } + var p01 = lerpPoints(points[0], points[1], t); + var p12 = lerpPoints(points[1], points[2], t); + var p23 = lerpPoints(points[2], points[3], t); + var p012 = lerpPoints(p01, p12, t); + var p123 = lerpPoints(p12, p23, t); + return lerpPoints(p012, p123, t).value; + } + function steppedEvaluate(points, time) { + return points[0].value; + } + function inverseSteppedEvaluate(points, time) { + return points[1].value; + } + function evaluateCurve(motionData, index, time) { + var curve = motionData.curves.at(index); + var target = -1; + var totalSegmentCount = curve.baseSegmentIndex + curve.segmentCount; + var pointPosition = 0; + for (var i = curve.baseSegmentIndex; i < totalSegmentCount; ++i) { + pointPosition = motionData.segments.at(i).basePointIndex + (motionData.segments.at(i).segmentType == CubismMotionSegmentType.CubismMotionSegmentType_Bezier ? 3 : 1); + if (pointPosition >= motionData.points._size) { + pointPosition = motionData.points._size - 3; + } + if (motionData.points.at(pointPosition).time > time) { + target = i; + break; + } + } + if (target == -1) { + return motionData.points.at(pointPosition).value; + } + var segment = motionData.segments.at(target); + return segment.evaluate(motionData.points.get(segment.basePointIndex), time); + } + var CubismMotion = (function (_super) { + __extends(CubismMotion, _super); + function CubismMotion() { + var _this = _super.call(this) || this; + _this._sourceFrameRate = 30.0; + _this._loopDurationSeconds = -1.0; + _this._isLoop = false; + _this._isLoopFadeIn = true; + _this._lastWeight = 0.0; + _this._motionData = null; + _this._modelCurveIdEyeBlink = null; + _this._modelCurveIdLipSync = null; + _this._eyeBlinkParameterIds = null; + _this._lipSyncParameterIds = null; + return _this; + } + CubismMotion.create = function (buffer, size, onFinishedMotionHandler) { + var ret = new CubismMotion(); + ret.parse(buffer, size); + ret._sourceFrameRate = ret._motionData.fps; + ret._loopDurationSeconds = ret._motionData.duration; + ret._onFinishedMotion = onFinishedMotionHandler; + return ret; + }; + CubismMotion.prototype.doUpdateParameters = function (model, userTimeSeconds, fadeWeight, motionQueueEntry) { + if (this._modelCurveIdEyeBlink == null) { + this._modelCurveIdEyeBlink = CubismFramework.getIdManager().getId(EffectNameEyeBlink); + } + if (this._modelCurveIdLipSync == null) { + this._modelCurveIdLipSync = CubismFramework.getIdManager().getId(EffectNameLipSync); + } + var timeOffsetSeconds = userTimeSeconds - motionQueueEntry.getStartTime(); + if (timeOffsetSeconds < 0.0) { + timeOffsetSeconds = 0.0; + } + var lipSyncValue = Number.MAX_VALUE; + var eyeBlinkValue = Number.MAX_VALUE; + var MaxTargetSize = 64; + var lipSyncFlags = 0; + var eyeBlinkFlags = 0; + if (this._eyeBlinkParameterIds.getSize() > MaxTargetSize) { + cubismdebug_1.CubismLogDebug('too many eye blink targets : {0}', this._eyeBlinkParameterIds.getSize()); + } + if (this._lipSyncParameterIds.getSize() > MaxTargetSize) { + cubismdebug_1.CubismLogDebug('too many lip sync targets : {0}', this._lipSyncParameterIds.getSize()); + } + var tmpFadeIn = this._fadeInSeconds <= 0.0 + ? 1.0 + : CubismMath.getEasingSine((userTimeSeconds - motionQueueEntry.getFadeInStartTime()) / + this._fadeInSeconds); + var tmpFadeOut = this._fadeOutSeconds <= 0.0 || motionQueueEntry.getEndTime() < 0.0 + ? 1.0 + : CubismMath.getEasingSine((motionQueueEntry.getEndTime() - userTimeSeconds) / + this._fadeOutSeconds); + var value; + var c, parameterIndex; + var time = timeOffsetSeconds; + if (this._isLoop) { + while (time > this._motionData.duration) { + time -= this._motionData.duration; + } + } + var curves = this._motionData.curves; + for (c = 0; c < this._motionData.curveCount && + curves.at(c).type == + CubismMotionCurveTarget.CubismMotionCurveTarget_Model; ++c) { + value = evaluateCurve(this._motionData, c, time); + if (curves.at(c).id == this._modelCurveIdEyeBlink) { + eyeBlinkValue = value; + } + else if (curves.at(c).id == this._modelCurveIdLipSync) { + lipSyncValue = value; + } + } + var parameterMotionCurveCount = 0; + for (; c < this._motionData.curveCount && + curves.at(c).type == + CubismMotionCurveTarget.CubismMotionCurveTarget_Parameter; ++c) { + parameterMotionCurveCount++; + parameterIndex = model.getParameterIndex(curves.at(c).id); + if (parameterIndex == -1) { + continue; + } + var sourceValue = model.getParameterValueByIndex(parameterIndex); + value = evaluateCurve(this._motionData, c, time); + if (eyeBlinkValue != Number.MAX_VALUE) { + for (var i = 0; i < this._eyeBlinkParameterIds.getSize() && i < MaxTargetSize; ++i) { + if (this._eyeBlinkParameterIds.at(i) == curves.at(c).id) { + value *= eyeBlinkValue; + eyeBlinkFlags |= 1 << i; + break; + } + } + } + if (lipSyncValue != Number.MAX_VALUE) { + for (var i = 0; i < this._lipSyncParameterIds.getSize() && i < MaxTargetSize; ++i) { + if (this._lipSyncParameterIds.at(i) == curves.at(c).id) { + value += lipSyncValue; + lipSyncFlags |= 1 << i; + break; + } + } + } + var v = void 0; + if (curves.at(c).fadeInTime < 0.0 && curves.at(c).fadeOutTime < 0.0) { + v = sourceValue + (value - sourceValue) * fadeWeight; + } + else { + var fin = void 0; + var fout = void 0; + if (curves.at(c).fadeInTime < 0.0) { + fin = tmpFadeIn; + } + else { + fin = + curves.at(c).fadeInTime == 0.0 + ? 1.0 + : CubismMath.getEasingSine((userTimeSeconds - motionQueueEntry.getFadeInStartTime()) / + curves.at(c).fadeInTime); + } + if (curves.at(c).fadeOutTime < 0.0) { + fout = tmpFadeOut; + } + else { + fout = + curves.at(c).fadeOutTime == 0.0 || + motionQueueEntry.getEndTime() < 0.0 + ? 1.0 + : CubismMath.getEasingSine((motionQueueEntry.getEndTime() - userTimeSeconds) / + curves.at(c).fadeOutTime); + } + var paramWeight = this._weight * fin * fout; + v = sourceValue + (value - sourceValue) * paramWeight; + } + model.setParameterValueByIndex(parameterIndex, v, 1.0); + } + { + if (eyeBlinkValue != Number.MAX_VALUE) { + for (var i = 0; i < this._eyeBlinkParameterIds.getSize() && i < MaxTargetSize; ++i) { + var sourceValue = model.getParameterValueById(this._eyeBlinkParameterIds.at(i)); + if ((eyeBlinkFlags >> i) & 0x01) { + continue; + } + var v = sourceValue + (eyeBlinkValue - sourceValue) * fadeWeight; + model.setParameterValueById(this._eyeBlinkParameterIds.at(i), v); + } + } + if (lipSyncValue != Number.MAX_VALUE) { + for (var i = 0; i < this._lipSyncParameterIds.getSize() && i < MaxTargetSize; ++i) { + var sourceValue = model.getParameterValueById(this._lipSyncParameterIds.at(i)); + if ((lipSyncFlags >> i) & 0x01) { + continue; + } + var v = sourceValue + (lipSyncValue - sourceValue) * fadeWeight; + model.setParameterValueById(this._lipSyncParameterIds.at(i), v); + } + } + } + for (; c < this._motionData.curveCount && + curves.at(c).type == + CubismMotionCurveTarget.CubismMotionCurveTarget_PartOpacity; ++c) { + parameterIndex = model.getParameterIndex(curves.at(c).id); + if (parameterIndex == -1) { + continue; + } + value = evaluateCurve(this._motionData, c, time); + model.setParameterValueByIndex(parameterIndex, value); + } + if (timeOffsetSeconds >= this._motionData.duration) { + if (this._isLoop) { + motionQueueEntry.setStartTime(userTimeSeconds); + if (this._isLoopFadeIn) { + motionQueueEntry.setFadeInStartTime(userTimeSeconds); + } + } + else { + if (this._onFinishedMotion) { + this._onFinishedMotion(this); + } + motionQueueEntry.setIsFinished(true); + } + } + this._lastWeight = fadeWeight; + }; + CubismMotion.prototype.setIsLoop = function (loop) { + this._isLoop = loop; + }; + CubismMotion.prototype.isLoop = function () { + return this._isLoop; + }; + CubismMotion.prototype.setIsLoopFadeIn = function (loopFadeIn) { + this._isLoopFadeIn = loopFadeIn; + }; + CubismMotion.prototype.isLoopFadeIn = function () { + return this._isLoopFadeIn; + }; + CubismMotion.prototype.getDuration = function () { + return this._isLoop ? -1.0 : this._loopDurationSeconds; + }; + CubismMotion.prototype.getLoopDuration = function () { + return this._loopDurationSeconds; + }; + CubismMotion.prototype.setParameterFadeInTime = function (parameterId, value) { + var curves = this._motionData.curves; + for (var i = 0; i < this._motionData.curveCount; ++i) { + if (parameterId == curves.at(i).id) { + curves.at(i).fadeInTime = value; + return; + } + } + }; + CubismMotion.prototype.setParameterFadeOutTime = function (parameterId, value) { + var curves = this._motionData.curves; + for (var i = 0; i < this._motionData.curveCount; ++i) { + if (parameterId == curves.at(i).id) { + curves.at(i).fadeOutTime = value; + return; + } + } + }; + CubismMotion.prototype.getParameterFadeInTime = function (parameterId) { + var curves = this._motionData.curves; + for (var i = 0; i < this._motionData.curveCount; ++i) { + if (parameterId == curves.at(i).id) { + return curves.at(i).fadeInTime; + } + } + return -1; + }; + CubismMotion.prototype.getParameterFadeOutTime = function (parameterId) { + var curves = this._motionData.curves; + for (var i = 0; i < this._motionData.curveCount; ++i) { + if (parameterId == curves.at(i).id) { + return curves.at(i).fadeOutTime; + } + } + return -1; + }; + CubismMotion.prototype.setEffectIds = function (eyeBlinkParameterIds, lipSyncParameterIds) { + this._eyeBlinkParameterIds = eyeBlinkParameterIds; + this._lipSyncParameterIds = lipSyncParameterIds; + }; + CubismMotion.prototype.release = function () { + this._motionData = void 0; + this._motionData = null; + }; + CubismMotion.prototype.parse = function (motionJson, size) { + this._motionData = new CubismMotionData(); + var json = new CubismMotionJson(motionJson, size); + this._motionData.duration = json.getMotionDuration(); + this._motionData.loop = json.isMotionLoop(); + this._motionData.curveCount = json.getMotionCurveCount(); + this._motionData.fps = json.getMotionFps(); + this._motionData.eventCount = json.getEventCount(); + if (json.isExistMotionFadeInTime()) { + this._fadeInSeconds = + json.getMotionFadeInTime() < 0.0 ? 1.0 : json.getMotionFadeInTime(); + } + else { + this._fadeInSeconds = 1.0; + } + if (json.isExistMotionFadeOutTime()) { + this._fadeOutSeconds = + json.getMotionFadeOutTime() < 0.0 ? 1.0 : json.getMotionFadeOutTime(); + } + else { + this._fadeOutSeconds = 1.0; + } + this._motionData.curves.updateSize(this._motionData.curveCount, CubismMotionCurve, true); + this._motionData.segments.updateSize(json.getMotionTotalSegmentCount(), CubismMotionSegment, true); + this._motionData.points.updateSize(json.getMotionTotalPointCount(), CubismMotionPoint, true); + this._motionData.events.updateSize(this._motionData.eventCount, CubismMotionEvent, true); + var totalPointCount = 0; + var totalSegmentCount = 0; + for (var curveCount = 0; curveCount < this._motionData.curveCount; ++curveCount) { + if (json.getMotionCurveTarget(curveCount) == TargetNameModel) { + this._motionData.curves.at(curveCount).type = + CubismMotionCurveTarget.CubismMotionCurveTarget_Model; + } + else if (json.getMotionCurveTarget(curveCount) == TargetNameParameter) { + this._motionData.curves.at(curveCount).type = + CubismMotionCurveTarget.CubismMotionCurveTarget_Parameter; + } + else if (json.getMotionCurveTarget(curveCount) == TargetNamePartOpacity) { + this._motionData.curves.at(curveCount).type = + CubismMotionCurveTarget.CubismMotionCurveTarget_PartOpacity; + } + this._motionData.curves.at(curveCount).id = json.getMotionCurveId(curveCount); + this._motionData.curves.at(curveCount).baseSegmentIndex = totalSegmentCount; + this._motionData.curves.at(curveCount).fadeInTime = json.isExistMotionCurveFadeInTime(curveCount) + ? json.getMotionCurveFadeInTime(curveCount) + : -1.0; + this._motionData.curves.at(curveCount).fadeOutTime = json.isExistMotionCurveFadeOutTime(curveCount) + ? json.getMotionCurveFadeOutTime(curveCount) + : -1.0; + for (var segmentPosition = 0; segmentPosition < json.getMotionCurveSegmentCount(curveCount);) { + if (segmentPosition == 0) { + this._motionData.segments.at(totalSegmentCount).basePointIndex = totalPointCount; + if (this._motionData.points.at(totalPointCount)) { + this._motionData.points.at(totalPointCount).time = json.getMotionCurveSegment(curveCount, segmentPosition); + this._motionData.points.at(totalPointCount).value = json.getMotionCurveSegment(curveCount, segmentPosition + 1); + } + totalPointCount += 1; + segmentPosition += 2; + } + else { + this._motionData.segments.at(totalSegmentCount).basePointIndex = + totalPointCount - 1; + } + var segment = json.getMotionCurveSegment(curveCount, segmentPosition); + switch (segment) { + case CubismMotionSegmentType.CubismMotionSegmentType_Linear: { + this._motionData.segments.at(totalSegmentCount).segmentType = + CubismMotionSegmentType.CubismMotionSegmentType_Linear; + this._motionData.segments.at(totalSegmentCount).evaluate = linearEvaluate; + if (this._motionData.points.at(totalPointCount)) { + this._motionData.points.at(totalPointCount).time = json.getMotionCurveSegment(curveCount, segmentPosition + 1); + this._motionData.points.at(totalPointCount).value = json.getMotionCurveSegment(curveCount, segmentPosition + 2); + } + totalPointCount += 1; + segmentPosition += 3; + break; + } + case CubismMotionSegmentType.CubismMotionSegmentType_Bezier: { + this._motionData.segments.at(totalSegmentCount).segmentType = + CubismMotionSegmentType.CubismMotionSegmentType_Bezier; + this._motionData.segments.at(totalSegmentCount).evaluate = bezierEvaluate; + if (this._motionData.points.at(totalPointCount)) { + this._motionData.points.at(totalPointCount).time = json.getMotionCurveSegment(curveCount, segmentPosition + 1); + this._motionData.points.at(totalPointCount).value = json.getMotionCurveSegment(curveCount, segmentPosition + 2); + } + if (this._motionData.points.at(totalPointCount + 1)) { + this._motionData.points.at(totalPointCount + 1).time = json.getMotionCurveSegment(curveCount, segmentPosition + 3); + this._motionData.points.at(totalPointCount + 1).value = json.getMotionCurveSegment(curveCount, segmentPosition + 4); + } + if (this._motionData.points.at(totalPointCount + 2)) { + this._motionData.points.at(totalPointCount + 2).time = json.getMotionCurveSegment(curveCount, segmentPosition + 5); + this._motionData.points.at(totalPointCount + 2).value = json.getMotionCurveSegment(curveCount, segmentPosition + 6); + } + totalPointCount += 3; + segmentPosition += 7; + break; + } + case CubismMotionSegmentType.CubismMotionSegmentType_Stepped: { + this._motionData.segments.at(totalSegmentCount).segmentType = + CubismMotionSegmentType.CubismMotionSegmentType_Stepped; + this._motionData.segments.at(totalSegmentCount).evaluate = steppedEvaluate; + if (this._motionData.points.at(totalPointCount)) { + this._motionData.points.at(totalPointCount).time = json.getMotionCurveSegment(curveCount, segmentPosition + 1); + this._motionData.points.at(totalPointCount).value = json.getMotionCurveSegment(curveCount, segmentPosition + 2); + } + totalPointCount += 1; + segmentPosition += 3; + break; + } + case CubismMotionSegmentType.CubismMotionSegmentType_InverseStepped: { + this._motionData.segments.at(totalSegmentCount).segmentType = + CubismMotionSegmentType.CubismMotionSegmentType_InverseStepped; + this._motionData.segments.at(totalSegmentCount).evaluate = inverseSteppedEvaluate; + if (this._motionData.points.at(totalPointCount)) { + this._motionData.points.at(totalPointCount).time = json.getMotionCurveSegment(curveCount, segmentPosition + 1); + this._motionData.points.at(totalPointCount).value = json.getMotionCurveSegment(curveCount, segmentPosition + 2); + } + totalPointCount += 1; + segmentPosition += 3; + break; + } + default: { + cubismdebug_1.CSM_ASSERT(0); + break; + } + } + ++this._motionData.curves.at(curveCount).segmentCount; + ++totalSegmentCount; + } + } + for (var userdatacount = 0; userdatacount < json.getEventCount(); ++userdatacount) { + this._motionData.events.at(userdatacount).fireTime = json.getEventTime(userdatacount); + this._motionData.events.at(userdatacount).value = json.getEventValue(userdatacount); + } + json.release(); + json = void 0; + json = null; + }; + CubismMotion.prototype.getFiredEvent = function (beforeCheckTimeSeconds, motionTimeSeconds) { + this._firedEventValues.updateSize(0); + for (var u = 0; u < this._motionData.eventCount; ++u) { + if (this._motionData.events.at(u).fireTime > beforeCheckTimeSeconds && + this._motionData.events.at(u).fireTime <= motionTimeSeconds) { + this._firedEventValues.pushBack(new csmString(this._motionData.events.at(u).value.s)); + } + } + return this._firedEventValues; + }; + return CubismMotion; + }(ACubismMotion)); + Live2DCubismFramework.CubismMotion = CubismMotion; +})(Live2DCubismFramework = exports.Live2DCubismFramework || (exports.Live2DCubismFramework = {})); + + +/***/ }), + +/***/ "./Framework/src/motion/cubismmotioninternal.ts": +/*!******************************************************!*\ + !*** ./Framework/src/motion/cubismmotioninternal.ts ***! + \******************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +var csmvector_1 = __webpack_require__(/*! ../type/csmvector */ "./Framework/src/type/csmvector.ts"); +var csmVector = csmvector_1.Live2DCubismFramework.csmVector; +var Live2DCubismFramework; +(function (Live2DCubismFramework) { + var CubismMotionCurveTarget; + (function (CubismMotionCurveTarget) { + CubismMotionCurveTarget[CubismMotionCurveTarget["CubismMotionCurveTarget_Model"] = 0] = "CubismMotionCurveTarget_Model"; + CubismMotionCurveTarget[CubismMotionCurveTarget["CubismMotionCurveTarget_Parameter"] = 1] = "CubismMotionCurveTarget_Parameter"; + CubismMotionCurveTarget[CubismMotionCurveTarget["CubismMotionCurveTarget_PartOpacity"] = 2] = "CubismMotionCurveTarget_PartOpacity"; + })(CubismMotionCurveTarget = Live2DCubismFramework.CubismMotionCurveTarget || (Live2DCubismFramework.CubismMotionCurveTarget = {})); + var CubismMotionSegmentType; + (function (CubismMotionSegmentType) { + CubismMotionSegmentType[CubismMotionSegmentType["CubismMotionSegmentType_Linear"] = 0] = "CubismMotionSegmentType_Linear"; + CubismMotionSegmentType[CubismMotionSegmentType["CubismMotionSegmentType_Bezier"] = 1] = "CubismMotionSegmentType_Bezier"; + CubismMotionSegmentType[CubismMotionSegmentType["CubismMotionSegmentType_Stepped"] = 2] = "CubismMotionSegmentType_Stepped"; + CubismMotionSegmentType[CubismMotionSegmentType["CubismMotionSegmentType_InverseStepped"] = 3] = "CubismMotionSegmentType_InverseStepped"; + })(CubismMotionSegmentType = Live2DCubismFramework.CubismMotionSegmentType || (Live2DCubismFramework.CubismMotionSegmentType = {})); + var CubismMotionPoint = (function () { + function CubismMotionPoint() { + this.time = 0.0; + this.value = 0.0; + } + return CubismMotionPoint; + }()); + Live2DCubismFramework.CubismMotionPoint = CubismMotionPoint; + var CubismMotionSegment = (function () { + function CubismMotionSegment() { + this.evaluate = null; + this.basePointIndex = 0; + this.segmentType = 0; + } + return CubismMotionSegment; + }()); + Live2DCubismFramework.CubismMotionSegment = CubismMotionSegment; + var CubismMotionCurve = (function () { + function CubismMotionCurve() { + this.type = CubismMotionCurveTarget.CubismMotionCurveTarget_Model; + this.segmentCount = 0; + this.baseSegmentIndex = 0; + this.fadeInTime = 0.0; + this.fadeOutTime = 0.0; + } + return CubismMotionCurve; + }()); + Live2DCubismFramework.CubismMotionCurve = CubismMotionCurve; + var CubismMotionEvent = (function () { + function CubismMotionEvent() { + this.fireTime = 0.0; + } + return CubismMotionEvent; + }()); + Live2DCubismFramework.CubismMotionEvent = CubismMotionEvent; + var CubismMotionData = (function () { + function CubismMotionData() { + this.duration = 0.0; + this.loop = false; + this.curveCount = 0; + this.eventCount = 0; + this.fps = 0.0; + this.curves = new csmVector(); + this.segments = new csmVector(); + this.points = new csmVector(); + this.events = new csmVector(); + } + return CubismMotionData; + }()); + Live2DCubismFramework.CubismMotionData = CubismMotionData; +})(Live2DCubismFramework = exports.Live2DCubismFramework || (exports.Live2DCubismFramework = {})); + + +/***/ }), + +/***/ "./Framework/src/motion/cubismmotionjson.ts": +/*!**************************************************!*\ + !*** ./Framework/src/motion/cubismmotionjson.ts ***! + \**************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +var cubismjson_1 = __webpack_require__(/*! ../utils/cubismjson */ "./Framework/src/utils/cubismjson.ts"); +var live2dcubismframework_1 = __webpack_require__(/*! ../live2dcubismframework */ "./Framework/src/live2dcubismframework.ts"); +var csmstring_1 = __webpack_require__(/*! ../type/csmstring */ "./Framework/src/type/csmstring.ts"); +var csmString = csmstring_1.Live2DCubismFramework.csmString; +var CubismFramework = live2dcubismframework_1.Live2DCubismFramework.CubismFramework; +var CubismJson = cubismjson_1.Live2DCubismFramework.CubismJson; +var Live2DCubismFramework; +(function (Live2DCubismFramework) { + var Meta = 'Meta'; + var Duration = 'Duration'; + var Loop = 'Loop'; + var CurveCount = 'CurveCount'; + var Fps = 'Fps'; + var TotalSegmentCount = 'TotalSegmentCount'; + var TotalPointCount = 'TotalPointCount'; + var Curves = 'Curves'; + var Target = 'Target'; + var Id = 'Id'; + var FadeInTime = 'FadeInTime'; + var FadeOutTime = 'FadeOutTime'; + var Segments = 'Segments'; + var UserData = 'UserData'; + var UserDataCount = 'UserDataCount'; + var TotalUserDataSize = 'TotalUserDataSize'; + var Time = 'Time'; + var Value = 'Value'; + var CubismMotionJson = (function () { + function CubismMotionJson(buffer, size) { + this._json = CubismJson.create(buffer, size); + } + CubismMotionJson.prototype.release = function () { + CubismJson.delete(this._json); + }; + CubismMotionJson.prototype.getMotionDuration = function () { + return this._json + .getRoot() + .getValueByString(Meta) + .getValueByString(Duration) + .toFloat(); + }; + CubismMotionJson.prototype.isMotionLoop = function () { + return this._json + .getRoot() + .getValueByString(Meta) + .getValueByString(Loop) + .toBoolean(); + }; + CubismMotionJson.prototype.getMotionCurveCount = function () { + return this._json + .getRoot() + .getValueByString(Meta) + .getValueByString(CurveCount) + .toInt(); + }; + CubismMotionJson.prototype.getMotionFps = function () { + return this._json + .getRoot() + .getValueByString(Meta) + .getValueByString(Fps) + .toFloat(); + }; + CubismMotionJson.prototype.getMotionTotalSegmentCount = function () { + return this._json + .getRoot() + .getValueByString(Meta) + .getValueByString(TotalSegmentCount) + .toInt(); + }; + CubismMotionJson.prototype.getMotionTotalPointCount = function () { + return this._json + .getRoot() + .getValueByString(Meta) + .getValueByString(TotalPointCount) + .toInt(); + }; + CubismMotionJson.prototype.isExistMotionFadeInTime = function () { + return !this._json + .getRoot() + .getValueByString(Meta) + .getValueByString(FadeInTime) + .isNull(); + }; + CubismMotionJson.prototype.isExistMotionFadeOutTime = function () { + return !this._json + .getRoot() + .getValueByString(Meta) + .getValueByString(FadeOutTime) + .isNull(); + }; + CubismMotionJson.prototype.getMotionFadeInTime = function () { + return this._json + .getRoot() + .getValueByString(Meta) + .getValueByString(FadeInTime) + .toFloat(); + }; + CubismMotionJson.prototype.getMotionFadeOutTime = function () { + return this._json + .getRoot() + .getValueByString(Meta) + .getValueByString(FadeOutTime) + .toFloat(); + }; + CubismMotionJson.prototype.getMotionCurveTarget = function (curveIndex) { + return this._json + .getRoot() + .getValueByString(Curves) + .getValueByIndex(curveIndex) + .getValueByString(Target) + .getRawString(); + }; + CubismMotionJson.prototype.getMotionCurveId = function (curveIndex) { + return CubismFramework.getIdManager().getId(this._json + .getRoot() + .getValueByString(Curves) + .getValueByIndex(curveIndex) + .getValueByString(Id) + .getRawString()); + }; + CubismMotionJson.prototype.isExistMotionCurveFadeInTime = function (curveIndex) { + return !this._json + .getRoot() + .getValueByString(Curves) + .getValueByIndex(curveIndex) + .getValueByString(FadeInTime) + .isNull(); + }; + CubismMotionJson.prototype.isExistMotionCurveFadeOutTime = function (curveIndex) { + return !this._json + .getRoot() + .getValueByString(Curves) + .getValueByIndex(curveIndex) + .getValueByString(FadeOutTime) + .isNull(); + }; + CubismMotionJson.prototype.getMotionCurveFadeInTime = function (curveIndex) { + return this._json + .getRoot() + .getValueByString(Curves) + .getValueByIndex(curveIndex) + .getValueByString(FadeInTime) + .toFloat(); + }; + CubismMotionJson.prototype.getMotionCurveFadeOutTime = function (curveIndex) { + return this._json + .getRoot() + .getValueByString(Curves) + .getValueByIndex(curveIndex) + .getValueByString(FadeOutTime) + .toFloat(); + }; + CubismMotionJson.prototype.getMotionCurveSegmentCount = function (curveIndex) { + return this._json + .getRoot() + .getValueByString(Curves) + .getValueByIndex(curveIndex) + .getValueByString(Segments) + .getVector() + .getSize(); + }; + CubismMotionJson.prototype.getMotionCurveSegment = function (curveIndex, segmentIndex) { + return this._json + .getRoot() + .getValueByString(Curves) + .getValueByIndex(curveIndex) + .getValueByString(Segments) + .getValueByIndex(segmentIndex) + .toFloat(); + }; + CubismMotionJson.prototype.getEventCount = function () { + return this._json + .getRoot() + .getValueByString(Meta) + .getValueByString(UserDataCount) + .toInt(); + }; + CubismMotionJson.prototype.getTotalEventValueSize = function () { + return this._json + .getRoot() + .getValueByString(Meta) + .getValueByString(TotalUserDataSize) + .toInt(); + }; + CubismMotionJson.prototype.getEventTime = function (userDataIndex) { + return this._json + .getRoot() + .getValueByString(UserData) + .getValueByIndex(userDataIndex) + .getValueByString(Time) + .toInt(); + }; + CubismMotionJson.prototype.getEventValue = function (userDataIndex) { + return new csmString(this._json + .getRoot() + .getValueByString(UserData) + .getValueByIndex(userDataIndex) + .getValueByString(Value) + .getRawString()); + }; + return CubismMotionJson; + }()); + Live2DCubismFramework.CubismMotionJson = CubismMotionJson; +})(Live2DCubismFramework = exports.Live2DCubismFramework || (exports.Live2DCubismFramework = {})); + + +/***/ }), + +/***/ "./Framework/src/motion/cubismmotionmanager.ts": +/*!*****************************************************!*\ + !*** ./Framework/src/motion/cubismmotionmanager.ts ***! + \*****************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +var cubismmotionqueuemanager_1 = __webpack_require__(/*! ./cubismmotionqueuemanager */ "./Framework/src/motion/cubismmotionqueuemanager.ts"); +var CubismMotionQueueManager = cubismmotionqueuemanager_1.Live2DCubismFramework.CubismMotionQueueManager; +var Live2DCubismFramework; +(function (Live2DCubismFramework) { + var CubismMotionManager = (function (_super) { + __extends(CubismMotionManager, _super); + function CubismMotionManager() { + var _this = _super.call(this) || this; + _this._currentPriority = 0; + _this._reservePriority = 0; + return _this; + } + CubismMotionManager.prototype.getCurrentPriority = function () { + return this._currentPriority; + }; + CubismMotionManager.prototype.getReservePriority = function () { + return this._reservePriority; + }; + CubismMotionManager.prototype.setReservePriority = function (val) { + this._reservePriority = val; + }; + CubismMotionManager.prototype.startMotionPriority = function (motion, autoDelete, priority) { + if (priority == this._reservePriority) { + this._reservePriority = 0; + } + this._currentPriority = priority; + return _super.prototype.startMotion.call(this, motion, autoDelete, this._userTimeSeconds); + }; + CubismMotionManager.prototype.updateMotion = function (model, deltaTimeSeconds) { + this._userTimeSeconds += deltaTimeSeconds; + var updated = _super.prototype.doUpdateMotion.call(this, model, this._userTimeSeconds); + if (this.isFinished()) { + this._currentPriority = 0; + } + return updated; + }; + CubismMotionManager.prototype.reserveMotion = function (priority) { + if (priority <= this._reservePriority || + priority <= this._currentPriority) { + return false; + } + this._reservePriority = priority; + return true; + }; + return CubismMotionManager; + }(CubismMotionQueueManager)); + Live2DCubismFramework.CubismMotionManager = CubismMotionManager; +})(Live2DCubismFramework = exports.Live2DCubismFramework || (exports.Live2DCubismFramework = {})); + + +/***/ }), + +/***/ "./Framework/src/motion/cubismmotionqueueentry.ts": +/*!********************************************************!*\ + !*** ./Framework/src/motion/cubismmotionqueueentry.ts ***! + \********************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +var acubismmotion_1 = __webpack_require__(/*! ./acubismmotion */ "./Framework/src/motion/acubismmotion.ts"); +var ACubismMotion = acubismmotion_1.Live2DCubismFramework.ACubismMotion; +var Live2DCubismFramework; +(function (Live2DCubismFramework) { + var CubismMotionQueueEntry = (function () { + function CubismMotionQueueEntry() { + this._autoDelete = false; + this._motion = null; + this._available = true; + this._finished = false; + this._started = false; + this._startTimeSeconds = -1.0; + this._fadeInStartTimeSeconds = 0.0; + this._endTimeSeconds = -1.0; + this._stateTimeSeconds = 0.0; + this._stateWeight = 0.0; + this._lastEventCheckSeconds = 0.0; + this._motionQueueEntryHandle = this; + } + CubismMotionQueueEntry.prototype.release = function () { + if (this._autoDelete && this._motion) { + ACubismMotion.delete(this._motion); + } + }; + CubismMotionQueueEntry.prototype.startFadeout = function (fadeoutSeconds, userTimeSeconds) { + var newEndTimeSeconds = userTimeSeconds + fadeoutSeconds; + if (this._endTimeSeconds < 0.0 || + newEndTimeSeconds < this._endTimeSeconds) { + this._endTimeSeconds = newEndTimeSeconds; + } + }; + CubismMotionQueueEntry.prototype.isFinished = function () { + return this._finished; + }; + CubismMotionQueueEntry.prototype.isStarted = function () { + return this._started; + }; + CubismMotionQueueEntry.prototype.getStartTime = function () { + return this._startTimeSeconds; + }; + CubismMotionQueueEntry.prototype.getFadeInStartTime = function () { + return this._fadeInStartTimeSeconds; + }; + CubismMotionQueueEntry.prototype.getEndTime = function () { + return this._endTimeSeconds; + }; + CubismMotionQueueEntry.prototype.setStartTime = function (startTime) { + this._startTimeSeconds = startTime; + }; + CubismMotionQueueEntry.prototype.setFadeInStartTime = function (startTime) { + this._fadeInStartTimeSeconds = startTime; + }; + CubismMotionQueueEntry.prototype.setEndTime = function (endTime) { + this._endTimeSeconds = endTime; + }; + CubismMotionQueueEntry.prototype.setIsFinished = function (f) { + this._finished = f; + }; + CubismMotionQueueEntry.prototype.setIsStarted = function (f) { + this._started = f; + }; + CubismMotionQueueEntry.prototype.isAvailable = function () { + return this._available; + }; + CubismMotionQueueEntry.prototype.setIsAvailable = function (v) { + this._available = v; + }; + CubismMotionQueueEntry.prototype.setState = function (timeSeconds, weight) { + this._stateTimeSeconds = timeSeconds; + this._stateWeight = weight; + }; + CubismMotionQueueEntry.prototype.getStateTime = function () { + return this._stateTimeSeconds; + }; + CubismMotionQueueEntry.prototype.getStateWeight = function () { + return this._stateWeight; + }; + CubismMotionQueueEntry.prototype.getLastCheckEventTime = function () { + return this._lastEventCheckSeconds; + }; + CubismMotionQueueEntry.prototype.setLastCheckEventTime = function (checkTime) { + this._lastEventCheckSeconds = checkTime; + }; + return CubismMotionQueueEntry; + }()); + Live2DCubismFramework.CubismMotionQueueEntry = CubismMotionQueueEntry; +})(Live2DCubismFramework = exports.Live2DCubismFramework || (exports.Live2DCubismFramework = {})); + + +/***/ }), + +/***/ "./Framework/src/motion/cubismmotionqueuemanager.ts": +/*!**********************************************************!*\ + !*** ./Framework/src/motion/cubismmotionqueuemanager.ts ***! + \**********************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +var cubismmotionqueueentry_1 = __webpack_require__(/*! ./cubismmotionqueueentry */ "./Framework/src/motion/cubismmotionqueueentry.ts"); +var csmvector_1 = __webpack_require__(/*! ../type/csmvector */ "./Framework/src/type/csmvector.ts"); +var csmVector = csmvector_1.Live2DCubismFramework.csmVector; +var CubismMotionQueueEntry = cubismmotionqueueentry_1.Live2DCubismFramework.CubismMotionQueueEntry; +var Live2DCubismFramework; +(function (Live2DCubismFramework) { + var CubismMotionQueueManager = (function () { + function CubismMotionQueueManager() { + this._userTimeSeconds = 0.0; + this._eventCallBack = null; + this._eventCustomData = null; + this._motions = new csmVector(); + } + CubismMotionQueueManager.prototype.release = function () { + for (var i = 0; i < this._motions.getSize(); ++i) { + if (this._motions.at(i)) { + this._motions.at(i).release(); + this._motions.set(i, void 0); + this._motions.set(i, null); + } + } + this._motions = null; + }; + CubismMotionQueueManager.prototype.startMotion = function (motion, autoDelete, userTimeSeconds) { + var _a, _b; + if (motion == null) { + return Live2DCubismFramework.InvalidMotionQueueEntryHandleValue; + } + var motionQueueEntry = null; + for (var i = 0; i < this._motions.getSize(); ++i) { + motionQueueEntry = this._motions.at(i); + if (motionQueueEntry == null) { + continue; + } + motionQueueEntry.startFadeout(motionQueueEntry._motion.getFadeOutTime(), userTimeSeconds); + } + motionQueueEntry = new CubismMotionQueueEntry(); + motionQueueEntry._autoDelete = autoDelete; + motionQueueEntry._motion = motion; + if (((_b = (_a = motion) === null || _a === void 0 ? void 0 : _a['_motionData']) === null || _b === void 0 ? void 0 : _b['curveCount']) < 100) { + this._motions.pushBack(motionQueueEntry); + } + return motionQueueEntry._motionQueueEntryHandle; + }; + CubismMotionQueueManager.prototype.isFinished = function () { + for (var ite = this._motions.begin(); ite.notEqual(this._motions.end());) { + var motionQueueEntry = ite.ptr(); + if (motionQueueEntry == null) { + ite = this._motions.erase(ite); + continue; + } + var motion = motionQueueEntry._motion; + if (motion == null) { + motionQueueEntry.release(); + motionQueueEntry = void 0; + motionQueueEntry = null; + ite = this._motions.erase(ite); + continue; + } + if (!motionQueueEntry.isFinished()) { + return false; + } + else { + ite.preIncrement(); + } + } + return true; + }; + CubismMotionQueueManager.prototype.isFinishedByHandle = function (motionQueueEntryNumber) { + for (var ite = this._motions.begin(); ite.notEqual(this._motions.end()); ite.increment()) { + var motionQueueEntry = ite.ptr(); + if (motionQueueEntry == null) { + continue; + } + if (motionQueueEntry._motionQueueEntryHandle == motionQueueEntryNumber && + !motionQueueEntry.isFinished()) { + return false; + } + } + return true; + }; + CubismMotionQueueManager.prototype.stopAllMotions = function () { + for (var ite = this._motions.begin(); ite.notEqual(this._motions.end());) { + var motionQueueEntry = ite.ptr(); + if (motionQueueEntry == null) { + ite = this._motions.erase(ite); + continue; + } + motionQueueEntry.release(); + motionQueueEntry = void 0; + motionQueueEntry = null; + ite = this._motions.erase(ite); + } + }; + CubismMotionQueueManager.prototype.getCubismMotionQueueEntry = function (motionQueueEntryNumber) { + for (var ite = this._motions.begin(); ite.notEqual(this._motions.end()); ite.preIncrement()) { + var motionQueueEntry = ite.ptr(); + if (motionQueueEntry == null) { + continue; + } + if (motionQueueEntry._motionQueueEntryHandle == motionQueueEntryNumber) { + return motionQueueEntry; + } + } + return null; + }; + CubismMotionQueueManager.prototype.setEventCallback = function (callback, customData) { + if (customData === void 0) { customData = null; } + this._eventCallBack = callback; + this._eventCustomData = customData; + }; + CubismMotionQueueManager.prototype.doUpdateMotion = function (model, userTimeSeconds) { + var updated = false; + for (var ite = this._motions.begin(); ite.notEqual(this._motions.end());) { + var motionQueueEntry = ite.ptr(); + if (motionQueueEntry == null) { + ite = this._motions.erase(ite); + continue; + } + var motion = motionQueueEntry._motion; + if (motion == null) { + motionQueueEntry.release(); + motionQueueEntry = void 0; + motionQueueEntry = null; + ite = this._motions.erase(ite); + continue; + } + motion.updateParameters(model, motionQueueEntry, userTimeSeconds); + updated = true; + var firedList = motion.getFiredEvent(motionQueueEntry.getLastCheckEventTime() - + motionQueueEntry.getStartTime(), userTimeSeconds - motionQueueEntry.getStartTime()); + for (var i = 0; i < firedList.getSize(); ++i) { + this._eventCallBack(this, firedList.at(i), this._eventCustomData); + } + motionQueueEntry.setLastCheckEventTime(userTimeSeconds); + if (motionQueueEntry.isFinished()) { + motionQueueEntry.release(); + motionQueueEntry = void 0; + motionQueueEntry = null; + ite = this._motions.erase(ite); + } + else { + ite.preIncrement(); + } + } + return updated; + }; + return CubismMotionQueueManager; + }()); + Live2DCubismFramework.CubismMotionQueueManager = CubismMotionQueueManager; + Live2DCubismFramework.InvalidMotionQueueEntryHandleValue = -1; +})(Live2DCubismFramework = exports.Live2DCubismFramework || (exports.Live2DCubismFramework = {})); + + +/***/ }), + +/***/ "./Framework/src/physics/cubismphysics.ts": +/*!************************************************!*\ + !*** ./Framework/src/physics/cubismphysics.ts ***! + \************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +var cubismphysicsinternal_1 = __webpack_require__(/*! ./cubismphysicsinternal */ "./Framework/src/physics/cubismphysicsinternal.ts"); +var cubismvector2_1 = __webpack_require__(/*! ../math/cubismvector2 */ "./Framework/src/math/cubismvector2.ts"); +var cubismmath_1 = __webpack_require__(/*! ../math/cubismmath */ "./Framework/src/math/cubismmath.ts"); +var cubismphysicsjson_1 = __webpack_require__(/*! ./cubismphysicsjson */ "./Framework/src/physics/cubismphysicsjson.ts"); +var CubismPhysicsJson = cubismphysicsjson_1.Live2DCubismFramework.CubismPhysicsJson; +var CubismMath = cubismmath_1.Live2DCubismFramework.CubismMath; +var CubismPhysicsRig = cubismphysicsinternal_1.Live2DCubismFramework.CubismPhysicsRig; +var CubismPhysicsSubRig = cubismphysicsinternal_1.Live2DCubismFramework.CubismPhysicsSubRig; +var CubismPhysicsInput = cubismphysicsinternal_1.Live2DCubismFramework.CubismPhysicsInput; +var CubismPhysicsOutput = cubismphysicsinternal_1.Live2DCubismFramework.CubismPhysicsOutput; +var CubismPhysicsParticle = cubismphysicsinternal_1.Live2DCubismFramework.CubismPhysicsParticle; +var CubismPhysicsSource = cubismphysicsinternal_1.Live2DCubismFramework.CubismPhysicsSource; +var CubismPhysicsTargetType = cubismphysicsinternal_1.Live2DCubismFramework.CubismPhysicsTargetType; +var CubismVector2 = cubismvector2_1.Live2DCubismFramework.CubismVector2; +var Live2DCubismFramework; +(function (Live2DCubismFramework) { + var PhysicsTypeTagX = 'X'; + var PhysicsTypeTagY = 'Y'; + var PhysicsTypeTagAngle = 'Angle'; + var AirResistance = 5.0; + var MaximumWeight = 100.0; + var MovementThreshold = 0.001; + var CubismPhysics = (function () { + function CubismPhysics() { + this._physicsRig = null; + this._options = new Options(); + this._options.gravity.y = -1.0; + this._options.gravity.x = 0; + this._options.wind.x = 0; + this._options.wind.y = 0; + } + CubismPhysics.create = function (buffer, size) { + var ret = new CubismPhysics(); + ret.parse(buffer, size); + ret._physicsRig.gravity.y = 0; + return ret; + }; + CubismPhysics.delete = function (physics) { + if (physics != null) { + physics.release(); + physics = null; + } + }; + CubismPhysics.prototype.evaluate = function (model, deltaTimeSeconds) { + var totalAngle; + var weight; + var radAngle; + var outputValue; + var totalTranslation = new CubismVector2(); + var currentSetting; + var currentInput; + var currentOutput; + var currentParticles; + var parameterValue; + var parameterMaximumValue; + var parameterMinimumValue; + var parameterDefaultValue; + parameterValue = model.getModel().parameters.values; + parameterMaximumValue = model.getModel().parameters.maximumValues; + parameterMinimumValue = model.getModel().parameters.minimumValues; + parameterDefaultValue = model.getModel().parameters.defaultValues; + for (var settingIndex = 0; settingIndex < this._physicsRig.subRigCount; ++settingIndex) { + totalAngle = { angle: 0.0 }; + totalTranslation.x = 0.0; + totalTranslation.y = 0.0; + currentSetting = this._physicsRig.settings.at(settingIndex); + currentInput = this._physicsRig.inputs.get(currentSetting.baseInputIndex); + currentOutput = this._physicsRig.outputs.get(currentSetting.baseOutputIndex); + currentParticles = this._physicsRig.particles.get(currentSetting.baseParticleIndex); + for (var i = 0; i < currentSetting.inputCount; ++i) { + weight = currentInput[i].weight / MaximumWeight; + if (currentInput[i].sourceParameterIndex == -1) { + currentInput[i].sourceParameterIndex = model.getParameterIndex(currentInput[i].source.id); + } + currentInput[i].getNormalizedParameterValue(totalTranslation, totalAngle, parameterValue[currentInput[i].sourceParameterIndex], parameterMinimumValue[currentInput[i].sourceParameterIndex], parameterMaximumValue[currentInput[i].sourceParameterIndex], parameterDefaultValue[currentInput[i].sourceParameterIndex], currentSetting.normalizationPosition, currentSetting.normalizationAngle, currentInput[0].reflect, weight); + } + radAngle = CubismMath.degreesToRadian(-totalAngle.angle); + totalTranslation.x = + totalTranslation.x * CubismMath.cos(radAngle) - + totalTranslation.y * CubismMath.sin(radAngle); + totalTranslation.y = + totalTranslation.x * CubismMath.sin(radAngle) + + totalTranslation.y * CubismMath.cos(radAngle); + updateParticles(currentParticles, currentSetting.particleCount, totalTranslation, totalAngle.angle, this._options.wind, MovementThreshold * currentSetting.normalizationPosition.maximum, deltaTimeSeconds, AirResistance); + for (var i = 0; i < currentSetting.outputCount; ++i) { + var particleIndex = currentOutput[i].vertexIndex; + if (particleIndex < 1 || + particleIndex >= currentSetting.particleCount) { + break; + } + if (currentOutput[i].destinationParameterIndex == -1) { + currentOutput[i].destinationParameterIndex = model.getParameterIndex(currentOutput[i].destination.id); + } + var translation = new CubismVector2(); + translation.x = + currentParticles[particleIndex].position.x - + currentParticles[particleIndex - 1].position.x; + translation.y = + currentParticles[particleIndex].position.y - + currentParticles[particleIndex - 1].position.y; + outputValue = currentOutput[i].getValue(translation, currentParticles, particleIndex, currentOutput[i].reflect, this._options.gravity); + var destinationParameterIndex = currentOutput[i].destinationParameterIndex; + var outParameterValue = !Float32Array.prototype.slice && + 'subarray' in Float32Array.prototype + ? JSON.parse(JSON.stringify(parameterValue.subarray(destinationParameterIndex))) + : parameterValue.slice(destinationParameterIndex); + updateOutputParameterValue(outParameterValue, parameterMinimumValue[destinationParameterIndex], parameterMaximumValue[destinationParameterIndex], outputValue, currentOutput[i]); + for (var offset = destinationParameterIndex, outParamIndex = 0; offset < parameterValue.length; offset++, outParamIndex++) { + parameterValue[offset] = outParameterValue[outParamIndex]; + } + } + } + }; + CubismPhysics.prototype.setOptions = function (options) { + this._options = options; + }; + CubismPhysics.prototype.getOption = function () { + return this._options; + }; + CubismPhysics.prototype.release = function () { + this._physicsRig = void 0; + this._physicsRig = null; + }; + CubismPhysics.prototype.parse = function (physicsJson, size) { + this._physicsRig = new CubismPhysicsRig(); + var json = new CubismPhysicsJson(physicsJson, size); + this._physicsRig.gravity = json.getGravity(); + this._physicsRig.wind = json.getWind(); + this._physicsRig.subRigCount = json.getSubRigCount(); + this._physicsRig.settings.updateSize(this._physicsRig.subRigCount, CubismPhysicsSubRig, true); + this._physicsRig.inputs.updateSize(json.getTotalInputCount(), CubismPhysicsInput, true); + this._physicsRig.outputs.updateSize(json.getTotalOutputCount(), CubismPhysicsOutput, true); + this._physicsRig.particles.updateSize(json.getVertexCount(), CubismPhysicsParticle, true); + var inputIndex = 0, outputIndex = 0, particleIndex = 0; + for (var i = 0; i < this._physicsRig.settings.getSize(); ++i) { + this._physicsRig.settings.at(i).normalizationPosition.minimum = json.getNormalizationPositionMinimumValue(i); + this._physicsRig.settings.at(i).normalizationPosition.maximum = json.getNormalizationPositionMaximumValue(i); + this._physicsRig.settings.at(i).normalizationPosition.defalut = json.getNormalizationPositionDefaultValue(i); + this._physicsRig.settings.at(i).normalizationAngle.minimum = json.getNormalizationAngleMinimumValue(i); + this._physicsRig.settings.at(i).normalizationAngle.maximum = json.getNormalizationAngleMaximumValue(i); + this._physicsRig.settings.at(i).normalizationAngle.defalut = json.getNormalizationAngleDefaultValue(i); + this._physicsRig.settings.at(i).inputCount = json.getInputCount(i); + this._physicsRig.settings.at(i).baseInputIndex = inputIndex; + for (var j = 0; j < this._physicsRig.settings.at(i).inputCount; ++j) { + this._physicsRig.inputs.at(inputIndex + j).sourceParameterIndex = -1; + this._physicsRig.inputs.at(inputIndex + j).weight = json.getInputWeight(i, j); + this._physicsRig.inputs.at(inputIndex + j).reflect = json.getInputReflect(i, j); + if (json.getInputType(i, j) == PhysicsTypeTagX) { + this._physicsRig.inputs.at(inputIndex + j).type = + CubismPhysicsSource.CubismPhysicsSource_X; + this._physicsRig.inputs.at(inputIndex + j).getNormalizedParameterValue = getInputTranslationXFromNormalizedParameterValue; + } + else if (json.getInputType(i, j) == PhysicsTypeTagY) { + this._physicsRig.inputs.at(inputIndex + j).type = + CubismPhysicsSource.CubismPhysicsSource_Y; + this._physicsRig.inputs.at(inputIndex + j).getNormalizedParameterValue = getInputTranslationYFromNormalizedParamterValue; + } + else if (json.getInputType(i, j) == PhysicsTypeTagAngle) { + this._physicsRig.inputs.at(inputIndex + j).type = + CubismPhysicsSource.CubismPhysicsSource_Angle; + this._physicsRig.inputs.at(inputIndex + j).getNormalizedParameterValue = getInputAngleFromNormalizedParameterValue; + } + this._physicsRig.inputs.at(inputIndex + j).source.targetType = + CubismPhysicsTargetType.CubismPhysicsTargetType_Parameter; + this._physicsRig.inputs.at(inputIndex + j).source.id = json.getInputSourceId(i, j); + } + inputIndex += this._physicsRig.settings.at(i).inputCount; + this._physicsRig.settings.at(i).outputCount = json.getOutputCount(i); + this._physicsRig.settings.at(i).baseOutputIndex = outputIndex; + for (var j = 0; j < this._physicsRig.settings.at(i).outputCount; ++j) { + this._physicsRig.outputs.at(outputIndex + j).destinationParameterIndex = -1; + this._physicsRig.outputs.at(outputIndex + j).vertexIndex = json.getOutputVertexIndex(i, j); + this._physicsRig.outputs.at(outputIndex + j).angleScale = json.getOutputAngleScale(i, j); + this._physicsRig.outputs.at(outputIndex + j).weight = json.getOutputWeight(i, j); + this._physicsRig.outputs.at(outputIndex + j).destination.targetType = + CubismPhysicsTargetType.CubismPhysicsTargetType_Parameter; + this._physicsRig.outputs.at(outputIndex + j).destination.id = json.getOutputDestinationId(i, j); + if (json.getOutputType(i, j) == PhysicsTypeTagX) { + this._physicsRig.outputs.at(outputIndex + j).type = + CubismPhysicsSource.CubismPhysicsSource_X; + this._physicsRig.outputs.at(outputIndex + j).getValue = getOutputTranslationX; + this._physicsRig.outputs.at(outputIndex + j).getScale = getOutputScaleTranslationX; + } + else if (json.getOutputType(i, j) == PhysicsTypeTagY) { + this._physicsRig.outputs.at(outputIndex + j).type = + CubismPhysicsSource.CubismPhysicsSource_Y; + this._physicsRig.outputs.at(outputIndex + j).getValue = getOutputTranslationY; + this._physicsRig.outputs.at(outputIndex + j).getScale = getOutputScaleTranslationY; + } + else if (json.getOutputType(i, j) == PhysicsTypeTagAngle) { + this._physicsRig.outputs.at(outputIndex + j).type = + CubismPhysicsSource.CubismPhysicsSource_Angle; + this._physicsRig.outputs.at(outputIndex + j).getValue = getOutputAngle; + this._physicsRig.outputs.at(outputIndex + j).getScale = getOutputScaleAngle; + } + this._physicsRig.outputs.at(outputIndex + j).reflect = json.getOutputReflect(i, j); + } + outputIndex += this._physicsRig.settings.at(i).outputCount; + this._physicsRig.settings.at(i).particleCount = json.getParticleCount(i); + this._physicsRig.settings.at(i).baseParticleIndex = particleIndex; + for (var j = 0; j < this._physicsRig.settings.at(i).particleCount; ++j) { + this._physicsRig.particles.at(particleIndex + j).mobility = json.getParticleMobility(i, j); + this._physicsRig.particles.at(particleIndex + j).delay = json.getParticleDelay(i, j); + this._physicsRig.particles.at(particleIndex + j).acceleration = json.getParticleAcceleration(i, j); + this._physicsRig.particles.at(particleIndex + j).radius = json.getParticleRadius(i, j); + this._physicsRig.particles.at(particleIndex + j).position = json.getParticlePosition(i, j); + } + particleIndex += this._physicsRig.settings.at(i).particleCount; + } + this.initialize(); + json.release(); + json = void 0; + json = null; + }; + CubismPhysics.prototype.initialize = function () { + var strand; + var currentSetting; + var radius; + for (var settingIndex = 0; settingIndex < this._physicsRig.subRigCount; ++settingIndex) { + currentSetting = this._physicsRig.settings.at(settingIndex); + strand = this._physicsRig.particles.get(currentSetting.baseParticleIndex); + strand[0].initialPosition = new CubismVector2(0.0, 0.0); + strand[0].lastPosition = new CubismVector2(strand[0].initialPosition.x, strand[0].initialPosition.y); + strand[0].lastGravity = new CubismVector2(0.0, -1.0); + strand[0].lastGravity.y *= -1.0; + strand[0].velocity = new CubismVector2(0.0, 0.0); + strand[0].force = new CubismVector2(0.0, 0.0); + for (var i = 1; i < currentSetting.particleCount; ++i) { + radius = new CubismVector2(0.0, 0.0); + radius.y = strand[i].radius; + strand[i].initialPosition = new CubismVector2(strand[i - 1].initialPosition.x + radius.x, strand[i - 1].initialPosition.y + radius.y); + strand[i].position = new CubismVector2(strand[i].initialPosition.x, strand[i].initialPosition.y); + strand[i].lastPosition = new CubismVector2(strand[i].initialPosition.x, strand[i].initialPosition.y); + strand[i].lastGravity = new CubismVector2(0.0, -1.0); + strand[i].lastGravity.y *= -1.0; + strand[i].velocity = new CubismVector2(0.0, 0.0); + strand[i].force = new CubismVector2(0.0, 0.0); + } + } + }; + return CubismPhysics; + }()); + Live2DCubismFramework.CubismPhysics = CubismPhysics; + var Options = (function () { + function Options() { + this.gravity = new CubismVector2(0, 0); + this.wind = new CubismVector2(0, 0); + } + return Options; + }()); + Live2DCubismFramework.Options = Options; + function sign(value) { + var ret = 0; + if (value > 0.0) { + ret = 1; + } + else if (value < 0.0) { + ret = -1; + } + return ret; + } + function getInputTranslationXFromNormalizedParameterValue(targetTranslation, targetAngle, value, parameterMinimumValue, parameterMaximumValue, parameterDefaultValue, normalizationPosition, normalizationAngle, isInverted, weight) { + targetTranslation.x += + normalizeParameterValue(value, parameterMinimumValue, parameterMaximumValue, parameterDefaultValue, normalizationPosition.minimum, normalizationPosition.maximum, normalizationPosition.defalut, isInverted) * weight; + } + function getInputTranslationYFromNormalizedParamterValue(targetTranslation, targetAngle, value, parameterMinimumValue, parameterMaximumValue, parameterDefaultValue, normalizationPosition, normalizationAngle, isInverted, weight) { + targetTranslation.y += + normalizeParameterValue(value, parameterMinimumValue, parameterMaximumValue, parameterDefaultValue, normalizationPosition.minimum, normalizationPosition.maximum, normalizationPosition.defalut, isInverted) * weight; + } + function getInputAngleFromNormalizedParameterValue(targetTranslation, targetAngle, value, parameterMinimumValue, parameterMaximumValue, parameterDefaultValue, normalizaitionPosition, normalizationAngle, isInverted, weight) { + targetAngle.angle += + normalizeParameterValue(value, parameterMinimumValue, parameterMaximumValue, parameterDefaultValue, normalizationAngle.minimum, normalizationAngle.maximum, normalizationAngle.defalut, isInverted) * weight; + } + function getOutputTranslationX(translation, particles, particleIndex, isInverted, parentGravity) { + var outputValue = translation.x; + if (isInverted) { + outputValue *= -1.0; + } + return outputValue; + } + function getOutputTranslationY(translation, particles, particleIndex, isInverted, parentGravity) { + var outputValue = translation.y; + if (isInverted) { + outputValue *= -1.0; + } + return outputValue; + } + function getOutputAngle(translation, particles, particleIndex, isInverted, parentGravity) { + var outputValue; + if (particleIndex >= 2) { + parentGravity = particles[particleIndex - 1].position.substract(particles[particleIndex - 2].position); + } + else { + parentGravity = parentGravity.multiplyByScaler(-1.0); + } + outputValue = CubismMath.directionToRadian(parentGravity, translation); + if (isInverted) { + outputValue *= -1.0; + } + return outputValue; + } + function getRangeValue(min, max) { + var maxValue = CubismMath.max(min, max); + var minValue = CubismMath.min(min, max); + return CubismMath.abs(maxValue - minValue); + } + function getDefaultValue(min, max) { + var minValue = CubismMath.min(min, max); + return minValue + getRangeValue(min, max) / 2.0; + } + function getOutputScaleTranslationX(translationScale, angleScale) { + return JSON.parse(JSON.stringify(translationScale.x)); + } + function getOutputScaleTranslationY(translationScale, angleScale) { + return JSON.parse(JSON.stringify(translationScale.y)); + } + function getOutputScaleAngle(translationScale, angleScale) { + return JSON.parse(JSON.stringify(angleScale)); + } + function updateParticles(strand, strandCount, totalTranslation, totalAngle, windDirection, thresholdValue, deltaTimeSeconds, airResistance) { + var totalRadian; + var delay; + var radian; + var currentGravity; + var direction = new CubismVector2(0.0, 0.0); + var velocity = new CubismVector2(0.0, 0.0); + var force = new CubismVector2(0.0, 0.0); + var newDirection = new CubismVector2(0.0, 0.0); + strand[0].position = new CubismVector2(totalTranslation.x, totalTranslation.y); + totalRadian = CubismMath.degreesToRadian(totalAngle); + currentGravity = CubismMath.radianToDirection(totalRadian); + currentGravity.normalize(); + for (var i = 1; i < strandCount; ++i) { + strand[i].force = currentGravity + .multiplyByScaler(strand[i].acceleration) + .add(windDirection); + strand[i].lastPosition = new CubismVector2(strand[i].position.x, strand[i].position.y); + delay = strand[i].delay * deltaTimeSeconds * 30.0; + direction = strand[i].position.substract(strand[i - 1].position); + radian = + CubismMath.directionToRadian(strand[i].lastGravity, currentGravity) / + airResistance; + direction.x = + CubismMath.cos(radian) * direction.x - + direction.y * CubismMath.sin(radian); + direction.y = + CubismMath.sin(radian) * direction.x + + direction.y * CubismMath.cos(radian); + strand[i].position = strand[i - 1].position.add(direction); + velocity = strand[i].velocity.multiplyByScaler(delay); + force = strand[i].force.multiplyByScaler(delay).multiplyByScaler(delay); + strand[i].position = strand[i].position.add(velocity).add(force); + newDirection = strand[i].position.substract(strand[i - 1].position); + newDirection.normalize(); + strand[i].position = strand[i - 1].position.add(newDirection.multiplyByScaler(strand[i].radius)); + if (CubismMath.abs(strand[i].position.x) < thresholdValue) { + strand[i].position.x = 0.0; + } + if (delay != 0.0) { + strand[i].velocity = strand[i].position.substract(strand[i].lastPosition); + strand[i].velocity = strand[i].velocity.divisionByScalar(delay); + strand[i].velocity = strand[i].velocity.multiplyByScaler(strand[i].mobility); + } + strand[i].force = new CubismVector2(0.0, 0.0); + strand[i].lastGravity = new CubismVector2(currentGravity.x, currentGravity.y); + } + } + function updateOutputParameterValue(parameterValue, parameterValueMinimum, parameterValueMaximum, translation, output) { + var outputScale; + var value; + var weight; + outputScale = output.getScale(output.translationScale, output.angleScale); + value = translation * outputScale; + if (value < parameterValueMinimum) { + if (value < output.valueBelowMinimum) { + output.valueBelowMinimum = value; + } + value = parameterValueMinimum; + } + else if (value > parameterValueMaximum) { + if (value > output.valueExceededMaximum) { + output.valueExceededMaximum = value; + } + value = parameterValueMaximum; + } + weight = output.weight / MaximumWeight; + if (weight >= 1.0) { + parameterValue[0] = value; + } + else { + value = parameterValue[0] * (1.0 - weight) + value * weight; + parameterValue[0] = value; + } + } + function normalizeParameterValue(value, parameterMinimum, parameterMaximum, parameterDefault, normalizedMinimum, normalizedMaximum, normalizedDefault, isInverted) { + var result = 0.0; + var maxValue = CubismMath.max(parameterMaximum, parameterMinimum); + if (maxValue < value) { + value = maxValue; + } + var minValue = CubismMath.min(parameterMaximum, parameterMinimum); + if (minValue > value) { + value = minValue; + } + var minNormValue = CubismMath.min(normalizedMinimum, normalizedMaximum); + var maxNormValue = CubismMath.max(normalizedMinimum, normalizedMaximum); + var middleNormValue = normalizedDefault; + var middleValue = getDefaultValue(minValue, maxValue); + var paramValue = value - middleValue; + switch (sign(paramValue)) { + case 1: { + var nLength = maxNormValue - middleNormValue; + var pLength = maxValue - middleValue; + if (pLength != 0.0) { + result = paramValue * (nLength / pLength); + result += middleNormValue; + } + break; + } + case -1: { + var nLength = minNormValue - middleNormValue; + var pLength = minValue - middleValue; + if (pLength != 0.0) { + result = paramValue * (nLength / pLength); + result += middleNormValue; + } + break; + } + case 0: { + result = middleNormValue; + break; + } + default: { + break; + } + } + return isInverted ? result : result * -1.0; + } +})(Live2DCubismFramework = exports.Live2DCubismFramework || (exports.Live2DCubismFramework = {})); + + +/***/ }), + +/***/ "./Framework/src/physics/cubismphysicsinternal.ts": +/*!********************************************************!*\ + !*** ./Framework/src/physics/cubismphysicsinternal.ts ***! + \********************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +var cubismvector2_1 = __webpack_require__(/*! ../math/cubismvector2 */ "./Framework/src/math/cubismvector2.ts"); +var csmvector_1 = __webpack_require__(/*! ../type/csmvector */ "./Framework/src/type/csmvector.ts"); +var csmVector = csmvector_1.Live2DCubismFramework.csmVector; +var CubismVector2 = cubismvector2_1.Live2DCubismFramework.CubismVector2; +var Live2DCubismFramework; +(function (Live2DCubismFramework) { + var CubismPhysicsTargetType; + (function (CubismPhysicsTargetType) { + CubismPhysicsTargetType[CubismPhysicsTargetType["CubismPhysicsTargetType_Parameter"] = 0] = "CubismPhysicsTargetType_Parameter"; + })(CubismPhysicsTargetType = Live2DCubismFramework.CubismPhysicsTargetType || (Live2DCubismFramework.CubismPhysicsTargetType = {})); + var CubismPhysicsSource; + (function (CubismPhysicsSource) { + CubismPhysicsSource[CubismPhysicsSource["CubismPhysicsSource_X"] = 0] = "CubismPhysicsSource_X"; + CubismPhysicsSource[CubismPhysicsSource["CubismPhysicsSource_Y"] = 1] = "CubismPhysicsSource_Y"; + CubismPhysicsSource[CubismPhysicsSource["CubismPhysicsSource_Angle"] = 2] = "CubismPhysicsSource_Angle"; + })(CubismPhysicsSource = Live2DCubismFramework.CubismPhysicsSource || (Live2DCubismFramework.CubismPhysicsSource = {})); + var PhysicsJsonEffectiveForces = (function () { + function PhysicsJsonEffectiveForces() { + this.gravity = new CubismVector2(0, 0); + this.wind = new CubismVector2(0, 0); + } + return PhysicsJsonEffectiveForces; + }()); + Live2DCubismFramework.PhysicsJsonEffectiveForces = PhysicsJsonEffectiveForces; + var CubismPhysicsParameter = (function () { + function CubismPhysicsParameter() { + } + return CubismPhysicsParameter; + }()); + Live2DCubismFramework.CubismPhysicsParameter = CubismPhysicsParameter; + var CubismPhysicsNormalization = (function () { + function CubismPhysicsNormalization() { + } + return CubismPhysicsNormalization; + }()); + Live2DCubismFramework.CubismPhysicsNormalization = CubismPhysicsNormalization; + var CubismPhysicsParticle = (function () { + function CubismPhysicsParticle() { + this.initialPosition = new CubismVector2(0, 0); + this.position = new CubismVector2(0, 0); + this.lastPosition = new CubismVector2(0, 0); + this.lastGravity = new CubismVector2(0, 0); + this.force = new CubismVector2(0, 0); + this.velocity = new CubismVector2(0, 0); + } + return CubismPhysicsParticle; + }()); + Live2DCubismFramework.CubismPhysicsParticle = CubismPhysicsParticle; + var CubismPhysicsSubRig = (function () { + function CubismPhysicsSubRig() { + this.normalizationPosition = new CubismPhysicsNormalization(); + this.normalizationAngle = new CubismPhysicsNormalization(); + } + return CubismPhysicsSubRig; + }()); + Live2DCubismFramework.CubismPhysicsSubRig = CubismPhysicsSubRig; + var CubismPhysicsInput = (function () { + function CubismPhysicsInput() { + this.source = new CubismPhysicsParameter(); + } + return CubismPhysicsInput; + }()); + Live2DCubismFramework.CubismPhysicsInput = CubismPhysicsInput; + var CubismPhysicsOutput = (function () { + function CubismPhysicsOutput() { + this.destination = new CubismPhysicsParameter(); + this.translationScale = new CubismVector2(0, 0); + } + return CubismPhysicsOutput; + }()); + Live2DCubismFramework.CubismPhysicsOutput = CubismPhysicsOutput; + var CubismPhysicsRig = (function () { + function CubismPhysicsRig() { + this.settings = new csmVector(); + this.inputs = new csmVector(); + this.outputs = new csmVector(); + this.particles = new csmVector(); + this.gravity = new CubismVector2(0, 0); + this.wind = new CubismVector2(0, 0); + } + return CubismPhysicsRig; + }()); + Live2DCubismFramework.CubismPhysicsRig = CubismPhysicsRig; +})(Live2DCubismFramework = exports.Live2DCubismFramework || (exports.Live2DCubismFramework = {})); + + +/***/ }), + +/***/ "./Framework/src/physics/cubismphysicsjson.ts": +/*!****************************************************!*\ + !*** ./Framework/src/physics/cubismphysicsjson.ts ***! + \****************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +var cubismjson_1 = __webpack_require__(/*! ../utils/cubismjson */ "./Framework/src/utils/cubismjson.ts"); +var cubismvector2_1 = __webpack_require__(/*! ../math/cubismvector2 */ "./Framework/src/math/cubismvector2.ts"); +var live2dcubismframework_1 = __webpack_require__(/*! ../live2dcubismframework */ "./Framework/src/live2dcubismframework.ts"); +var CubismFramework = live2dcubismframework_1.Live2DCubismFramework.CubismFramework; +var CubismVector2 = cubismvector2_1.Live2DCubismFramework.CubismVector2; +var CubismJson = cubismjson_1.Live2DCubismFramework.CubismJson; +var Live2DCubismFramework; +(function (Live2DCubismFramework) { + var Position = 'Position'; + var X = 'X'; + var Y = 'Y'; + var Angle = 'Angle'; + var Type = 'Type'; + var Id = 'Id'; + var Meta = 'Meta'; + var EffectiveForces = 'EffectiveForces'; + var TotalInputCount = 'TotalInputCount'; + var TotalOutputCount = 'TotalOutputCount'; + var PhysicsSettingCount = 'PhysicsSettingCount'; + var Gravity = 'Gravity'; + var Wind = 'Wind'; + var VertexCount = 'VertexCount'; + var PhysicsSettings = 'PhysicsSettings'; + var Normalization = 'Normalization'; + var Minimum = 'Minimum'; + var Maximum = 'Maximum'; + var Default = 'Default'; + var Reflect = 'Reflect'; + var Weight = 'Weight'; + var Input = 'Input'; + var Source = 'Source'; + var Output = 'Output'; + var Scale = 'Scale'; + var VertexIndex = 'VertexIndex'; + var Destination = 'Destination'; + var Vertices = 'Vertices'; + var Mobility = 'Mobility'; + var Delay = 'Delay'; + var Radius = 'Radius'; + var Acceleration = 'Acceleration'; + var CubismPhysicsJson = (function () { + function CubismPhysicsJson(buffer, size) { + this._json = CubismJson.create(buffer, size); + } + CubismPhysicsJson.prototype.release = function () { + CubismJson.delete(this._json); + }; + CubismPhysicsJson.prototype.getGravity = function () { + var ret = new CubismVector2(0, 0); + ret.x = this._json + .getRoot() + .getValueByString(Meta) + .getValueByString(EffectiveForces) + .getValueByString(Gravity) + .getValueByString(X) + .toFloat(); + ret.y = this._json + .getRoot() + .getValueByString(Meta) + .getValueByString(EffectiveForces) + .getValueByString(Gravity) + .getValueByString(Y) + .toFloat(); + return ret; + }; + CubismPhysicsJson.prototype.getWind = function () { + var ret = new CubismVector2(0, 0); + ret.x = this._json + .getRoot() + .getValueByString(Meta) + .getValueByString(EffectiveForces) + .getValueByString(Wind) + .getValueByString(X) + .toFloat(); + ret.y = this._json + .getRoot() + .getValueByString(Meta) + .getValueByString(EffectiveForces) + .getValueByString(Wind) + .getValueByString(Y) + .toFloat(); + return ret; + }; + CubismPhysicsJson.prototype.getSubRigCount = function () { + return this._json + .getRoot() + .getValueByString(Meta) + .getValueByString(PhysicsSettingCount) + .toInt(); + }; + CubismPhysicsJson.prototype.getTotalInputCount = function () { + return this._json + .getRoot() + .getValueByString(Meta) + .getValueByString(TotalInputCount) + .toInt(); + }; + CubismPhysicsJson.prototype.getTotalOutputCount = function () { + return this._json + .getRoot() + .getValueByString(Meta) + .getValueByString(TotalOutputCount) + .toInt(); + }; + CubismPhysicsJson.prototype.getVertexCount = function () { + return this._json + .getRoot() + .getValueByString(Meta) + .getValueByString(VertexCount) + .toInt(); + }; + CubismPhysicsJson.prototype.getNormalizationPositionMinimumValue = function (physicsSettingIndex) { + return this._json + .getRoot() + .getValueByString(PhysicsSettings) + .getValueByIndex(physicsSettingIndex) + .getValueByString(Normalization) + .getValueByString(Position) + .getValueByString(Minimum) + .toFloat(); + }; + CubismPhysicsJson.prototype.getNormalizationPositionMaximumValue = function (physicsSettingIndex) { + return this._json + .getRoot() + .getValueByString(PhysicsSettings) + .getValueByIndex(physicsSettingIndex) + .getValueByString(Normalization) + .getValueByString(Position) + .getValueByString(Maximum) + .toFloat(); + }; + CubismPhysicsJson.prototype.getNormalizationPositionDefaultValue = function (physicsSettingIndex) { + return this._json + .getRoot() + .getValueByString(PhysicsSettings) + .getValueByIndex(physicsSettingIndex) + .getValueByString(Normalization) + .getValueByString(Position) + .getValueByString(Default) + .toFloat(); + }; + CubismPhysicsJson.prototype.getNormalizationAngleMinimumValue = function (physicsSettingIndex) { + return this._json + .getRoot() + .getValueByString(PhysicsSettings) + .getValueByIndex(physicsSettingIndex) + .getValueByString(Normalization) + .getValueByString(Angle) + .getValueByString(Minimum) + .toFloat(); + }; + CubismPhysicsJson.prototype.getNormalizationAngleMaximumValue = function (physicsSettingIndex) { + return this._json + .getRoot() + .getValueByString(PhysicsSettings) + .getValueByIndex(physicsSettingIndex) + .getValueByString(Normalization) + .getValueByString(Angle) + .getValueByString(Maximum) + .toFloat(); + }; + CubismPhysicsJson.prototype.getNormalizationAngleDefaultValue = function (physicsSettingIndex) { + return this._json + .getRoot() + .getValueByString(PhysicsSettings) + .getValueByIndex(physicsSettingIndex) + .getValueByString(Normalization) + .getValueByString(Angle) + .getValueByString(Default) + .toFloat(); + }; + CubismPhysicsJson.prototype.getInputCount = function (physicsSettingIndex) { + return this._json + .getRoot() + .getValueByString(PhysicsSettings) + .getValueByIndex(physicsSettingIndex) + .getValueByString(Input) + .getVector() + .getSize(); + }; + CubismPhysicsJson.prototype.getInputWeight = function (physicsSettingIndex, inputIndex) { + return this._json + .getRoot() + .getValueByString(PhysicsSettings) + .getValueByIndex(physicsSettingIndex) + .getValueByString(Input) + .getValueByIndex(inputIndex) + .getValueByString(Weight) + .toFloat(); + }; + CubismPhysicsJson.prototype.getInputReflect = function (physicsSettingIndex, inputIndex) { + return this._json + .getRoot() + .getValueByString(PhysicsSettings) + .getValueByIndex(physicsSettingIndex) + .getValueByString(Input) + .getValueByIndex(inputIndex) + .getValueByString(Reflect) + .toBoolean(); + }; + CubismPhysicsJson.prototype.getInputType = function (physicsSettingIndex, inputIndex) { + return this._json + .getRoot() + .getValueByString(PhysicsSettings) + .getValueByIndex(physicsSettingIndex) + .getValueByString(Input) + .getValueByIndex(inputIndex) + .getValueByString(Type) + .getRawString(); + }; + CubismPhysicsJson.prototype.getInputSourceId = function (physicsSettingIndex, inputIndex) { + return CubismFramework.getIdManager().getId(this._json + .getRoot() + .getValueByString(PhysicsSettings) + .getValueByIndex(physicsSettingIndex) + .getValueByString(Input) + .getValueByIndex(inputIndex) + .getValueByString(Source) + .getValueByString(Id) + .getRawString()); + }; + CubismPhysicsJson.prototype.getOutputCount = function (physicsSettingIndex) { + return this._json + .getRoot() + .getValueByString(PhysicsSettings) + .getValueByIndex(physicsSettingIndex) + .getValueByString(Output) + .getVector() + .getSize(); + }; + CubismPhysicsJson.prototype.getOutputVertexIndex = function (physicsSettingIndex, outputIndex) { + return this._json + .getRoot() + .getValueByString(PhysicsSettings) + .getValueByIndex(physicsSettingIndex) + .getValueByString(Output) + .getValueByIndex(outputIndex) + .getValueByString(VertexIndex) + .toInt(); + }; + CubismPhysicsJson.prototype.getOutputAngleScale = function (physicsSettingIndex, outputIndex) { + return this._json + .getRoot() + .getValueByString(PhysicsSettings) + .getValueByIndex(physicsSettingIndex) + .getValueByString(Output) + .getValueByIndex(outputIndex) + .getValueByString(Scale) + .toFloat(); + }; + CubismPhysicsJson.prototype.getOutputWeight = function (physicsSettingIndex, outputIndex) { + return this._json + .getRoot() + .getValueByString(PhysicsSettings) + .getValueByIndex(physicsSettingIndex) + .getValueByString(Output) + .getValueByIndex(outputIndex) + .getValueByString(Weight) + .toFloat(); + }; + CubismPhysicsJson.prototype.getOutputDestinationId = function (physicsSettingIndex, outputIndex) { + return CubismFramework.getIdManager().getId(this._json + .getRoot() + .getValueByString(PhysicsSettings) + .getValueByIndex(physicsSettingIndex) + .getValueByString(Output) + .getValueByIndex(outputIndex) + .getValueByString(Destination) + .getValueByString(Id) + .getRawString()); + }; + CubismPhysicsJson.prototype.getOutputType = function (physicsSettingIndex, outputIndex) { + return this._json + .getRoot() + .getValueByString(PhysicsSettings) + .getValueByIndex(physicsSettingIndex) + .getValueByString(Output) + .getValueByIndex(outputIndex) + .getValueByString(Type) + .getRawString(); + }; + CubismPhysicsJson.prototype.getOutputReflect = function (physicsSettingIndex, outputIndex) { + return this._json + .getRoot() + .getValueByString(PhysicsSettings) + .getValueByIndex(physicsSettingIndex) + .getValueByString(Output) + .getValueByIndex(outputIndex) + .getValueByString(Reflect) + .toBoolean(); + }; + CubismPhysicsJson.prototype.getParticleCount = function (physicsSettingIndex) { + return this._json + .getRoot() + .getValueByString(PhysicsSettings) + .getValueByIndex(physicsSettingIndex) + .getValueByString(Vertices) + .getVector() + .getSize(); + }; + CubismPhysicsJson.prototype.getParticleMobility = function (physicsSettingIndex, vertexIndex) { + return this._json + .getRoot() + .getValueByString(PhysicsSettings) + .getValueByIndex(physicsSettingIndex) + .getValueByString(Vertices) + .getValueByIndex(vertexIndex) + .getValueByString(Mobility) + .toFloat(); + }; + CubismPhysicsJson.prototype.getParticleDelay = function (physicsSettingIndex, vertexIndex) { + return this._json + .getRoot() + .getValueByString(PhysicsSettings) + .getValueByIndex(physicsSettingIndex) + .getValueByString(Vertices) + .getValueByIndex(vertexIndex) + .getValueByString(Delay) + .toFloat(); + }; + CubismPhysicsJson.prototype.getParticleAcceleration = function (physicsSettingIndex, vertexIndex) { + return this._json + .getRoot() + .getValueByString(PhysicsSettings) + .getValueByIndex(physicsSettingIndex) + .getValueByString(Vertices) + .getValueByIndex(vertexIndex) + .getValueByString(Acceleration) + .toFloat(); + }; + CubismPhysicsJson.prototype.getParticleRadius = function (physicsSettingIndex, vertexIndex) { + return this._json + .getRoot() + .getValueByString(PhysicsSettings) + .getValueByIndex(physicsSettingIndex) + .getValueByString(Vertices) + .getValueByIndex(vertexIndex) + .getValueByString(Radius) + .toInt(); + }; + CubismPhysicsJson.prototype.getParticlePosition = function (physicsSettingIndex, vertexIndex) { + var ret = new CubismVector2(0, 0); + ret.x = this._json + .getRoot() + .getValueByString(PhysicsSettings) + .getValueByIndex(physicsSettingIndex) + .getValueByString(Vertices) + .getValueByIndex(vertexIndex) + .getValueByString(Position) + .getValueByString(X) + .toFloat(); + ret.y = this._json + .getRoot() + .getValueByString(PhysicsSettings) + .getValueByIndex(physicsSettingIndex) + .getValueByString(Vertices) + .getValueByIndex(vertexIndex) + .getValueByString(Position) + .getValueByString(Y) + .toFloat(); + return ret; + }; + return CubismPhysicsJson; + }()); + Live2DCubismFramework.CubismPhysicsJson = CubismPhysicsJson; +})(Live2DCubismFramework = exports.Live2DCubismFramework || (exports.Live2DCubismFramework = {})); + + +/***/ }), + +/***/ "./Framework/src/rendering/cubismrenderer.ts": +/*!***************************************************!*\ + !*** ./Framework/src/rendering/cubismrenderer.ts ***! + \***************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +var cubismmatrix44_1 = __webpack_require__(/*! ../math/cubismmatrix44 */ "./Framework/src/math/cubismmatrix44.ts"); +var CubismMatrix44 = cubismmatrix44_1.Live2DCubismFramework.CubismMatrix44; +var Live2DCubismFramework; +(function (Live2DCubismFramework) { + var CubismRenderer = (function () { + function CubismRenderer() { + this._isCulling = false; + this._isPremultipliedAlpha = false; + this._anisortopy = 0.0; + this._model = null; + this._modelColor = new CubismTextureColor(); + this._mvpMatrix4x4 = new CubismMatrix44(); + this._mvpMatrix4x4.loadIdentity(); + } + CubismRenderer.create = function () { + return null; + }; + CubismRenderer.delete = function (renderer) { + renderer = null; + }; + CubismRenderer.prototype.initialize = function (model) { + this._model = model; + }; + CubismRenderer.prototype.drawModel = function () { + if (this.getModel() == null) + return; + this.doDrawModel(); + }; + CubismRenderer.prototype.setMvpMatrix = function (matrix44) { + this._mvpMatrix4x4.setMatrix(matrix44.getArray()); + }; + CubismRenderer.prototype.getMvpMatrix = function () { + return this._mvpMatrix4x4; + }; + CubismRenderer.prototype.setModelColor = function (red, green, blue, alpha) { + if (red < 0.0) { + red = 0.0; + } + else if (red > 1.0) { + red = 1.0; + } + if (green < 0.0) { + green = 0.0; + } + else if (green > 1.0) { + green = 1.0; + } + if (blue < 0.0) { + blue = 0.0; + } + else if (blue > 1.0) { + blue = 1.0; + } + if (alpha < 0.0) { + alpha = 0.0; + } + else if (alpha > 1.0) { + alpha = 1.0; + } + this._modelColor.R = red; + this._modelColor.G = green; + this._modelColor.B = blue; + this._modelColor.A = alpha; + }; + CubismRenderer.prototype.getModelColor = function () { + return JSON.parse(JSON.stringify(this._modelColor)); + }; + CubismRenderer.prototype.setIsPremultipliedAlpha = function (enable) { + this._isPremultipliedAlpha = enable; + }; + CubismRenderer.prototype.isPremultipliedAlpha = function () { + return this._isPremultipliedAlpha; + }; + CubismRenderer.prototype.setIsCulling = function (culling) { + this._isCulling = culling; + }; + CubismRenderer.prototype.isCulling = function () { + return this._isCulling; + }; + CubismRenderer.prototype.setAnisotropy = function (n) { + this._anisortopy = n; + }; + CubismRenderer.prototype.getAnisotropy = function () { + return this._anisortopy; + }; + CubismRenderer.prototype.getModel = function () { + return this._model; + }; + return CubismRenderer; + }()); + Live2DCubismFramework.CubismRenderer = CubismRenderer; + var CubismBlendMode; + (function (CubismBlendMode) { + CubismBlendMode[CubismBlendMode["CubismBlendMode_Normal"] = 0] = "CubismBlendMode_Normal"; + CubismBlendMode[CubismBlendMode["CubismBlendMode_Additive"] = 1] = "CubismBlendMode_Additive"; + CubismBlendMode[CubismBlendMode["CubismBlendMode_Multiplicative"] = 2] = "CubismBlendMode_Multiplicative"; + })(CubismBlendMode = Live2DCubismFramework.CubismBlendMode || (Live2DCubismFramework.CubismBlendMode = {})); + var CubismTextureColor = (function () { + function CubismTextureColor() { + this.R = 1.0; + this.G = 1.0; + this.B = 1.0; + this.A = 1.0; + } + return CubismTextureColor; + }()); + Live2DCubismFramework.CubismTextureColor = CubismTextureColor; +})(Live2DCubismFramework = exports.Live2DCubismFramework || (exports.Live2DCubismFramework = {})); + + +/***/ }), + +/***/ "./Framework/src/rendering/cubismrenderer_webgl.ts": +/*!*********************************************************!*\ + !*** ./Framework/src/rendering/cubismrenderer_webgl.ts ***! + \*********************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +var live2dcubismframework_1 = __webpack_require__(/*! ../live2dcubismframework */ "./Framework/src/live2dcubismframework.ts"); +var csmrectf_1 = __webpack_require__(/*! ../type/csmrectf */ "./Framework/src/type/csmrectf.ts"); +var cubismrenderer_1 = __webpack_require__(/*! ./cubismrenderer */ "./Framework/src/rendering/cubismrenderer.ts"); +var cubismmatrix44_1 = __webpack_require__(/*! ../math/cubismmatrix44 */ "./Framework/src/math/cubismmatrix44.ts"); +var csmmap_1 = __webpack_require__(/*! ../type/csmmap */ "./Framework/src/type/csmmap.ts"); +var csmvector_1 = __webpack_require__(/*! ../type/csmvector */ "./Framework/src/type/csmvector.ts"); +var cubismdebug_1 = __webpack_require__(/*! ../utils/cubismdebug */ "./Framework/src/utils/cubismdebug.ts"); +var Constant = live2dcubismframework_1.Live2DCubismFramework.Constant; +var CubismMatrix44 = cubismmatrix44_1.Live2DCubismFramework.CubismMatrix44; +var csmRect = csmrectf_1.Live2DCubismFramework.csmRect; +var csmMap = csmmap_1.Live2DCubismFramework.csmMap; +var csmVector = csmvector_1.Live2DCubismFramework.csmVector; +var CubismRenderer = cubismrenderer_1.Live2DCubismFramework.CubismRenderer; +var CubismBlendMode = cubismrenderer_1.Live2DCubismFramework.CubismBlendMode; +var CubismTextureColor = cubismrenderer_1.Live2DCubismFramework.CubismTextureColor; +var Live2DCubismFramework; +(function (Live2DCubismFramework) { + var ColorChannelCount = 4; + var shaderCount = 10; + var s_instance; + var s_viewport; + var s_fbo; + var CubismClippingManager_WebGL = (function () { + function CubismClippingManager_WebGL() { + this._maskRenderTexture = null; + this._colorBuffer = null; + this._currentFrameNo = 0; + this._clippingMaskBufferSize = 256; + this._clippingContextListForMask = new csmVector(); + this._clippingContextListForDraw = new csmVector(); + this._channelColors = new csmVector(); + this._tmpBoundsOnModel = new csmRect(); + this._tmpMatrix = new CubismMatrix44(); + this._tmpMatrixForMask = new CubismMatrix44(); + this._tmpMatrixForDraw = new CubismMatrix44(); + this._maskTexture = null; + var tmp = new CubismTextureColor(); + tmp.R = 1.0; + tmp.G = 0.0; + tmp.B = 0.0; + tmp.A = 0.0; + this._channelColors.pushBack(tmp); + tmp = new CubismTextureColor(); + tmp.R = 0.0; + tmp.G = 1.0; + tmp.B = 0.0; + tmp.A = 0.0; + this._channelColors.pushBack(tmp); + tmp = new CubismTextureColor(); + tmp.R = 0.0; + tmp.G = 0.0; + tmp.B = 1.0; + tmp.A = 0.0; + this._channelColors.pushBack(tmp); + tmp = new CubismTextureColor(); + tmp.R = 0.0; + tmp.G = 0.0; + tmp.B = 0.0; + tmp.A = 1.0; + this._channelColors.pushBack(tmp); + } + CubismClippingManager_WebGL.prototype.getChannelFlagAsColor = function (channelNo) { + return this._channelColors.at(channelNo); + }; + CubismClippingManager_WebGL.prototype.getMaskRenderTexture = function () { + var ret = 0; + if (this._maskTexture && this._maskTexture.texture != 0) { + this._maskTexture.frameNo = this._currentFrameNo; + ret = this._maskTexture.texture; + } + if (ret == 0) { + var size = this._clippingMaskBufferSize; + this._colorBuffer = this.gl.createTexture(); + this.gl.bindTexture(this.gl.TEXTURE_2D, this._colorBuffer); + this.gl.texImage2D(this.gl.TEXTURE_2D, 0, this.gl.RGBA, size, size, 0, this.gl.RGBA, this.gl.UNSIGNED_BYTE, null); + 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.bindTexture(this.gl.TEXTURE_2D, null); + ret = this.gl.createFramebuffer(); + this.gl.bindFramebuffer(this.gl.FRAMEBUFFER, ret); + this.gl.framebufferTexture2D(this.gl.FRAMEBUFFER, this.gl.COLOR_ATTACHMENT0, this.gl.TEXTURE_2D, this._colorBuffer, 0); + this.gl.bindFramebuffer(this.gl.FRAMEBUFFER, s_fbo); + this._maskTexture = new CubismRenderTextureResource(this._currentFrameNo, ret); + } + return ret; + }; + CubismClippingManager_WebGL.prototype.setGL = function (gl) { + this.gl = gl; + }; + CubismClippingManager_WebGL.prototype.calcClippedDrawTotalBounds = function (model, clippingContext) { + var clippedDrawTotalMinX = Number.MAX_VALUE; + var clippedDrawTotalMinY = Number.MAX_VALUE; + var clippedDrawTotalMaxX = Number.MIN_VALUE; + var clippedDrawTotalMaxY = Number.MIN_VALUE; + var clippedDrawCount = clippingContext._clippedDrawableIndexList.length; + for (var clippedDrawableIndex = 0; clippedDrawableIndex < clippedDrawCount; clippedDrawableIndex++) { + var drawableIndex = clippingContext._clippedDrawableIndexList[clippedDrawableIndex]; + var drawableVertexCount = model.getDrawableVertexCount(drawableIndex); + var drawableVertexes = model.getDrawableVertices(drawableIndex); + var minX = Number.MAX_VALUE; + var minY = Number.MAX_VALUE; + var maxX = Number.MIN_VALUE; + var maxY = Number.MIN_VALUE; + var loop = drawableVertexCount * Constant.vertexStep; + for (var pi = Constant.vertexOffset; pi < loop; pi += Constant.vertexStep) { + var x = drawableVertexes[pi]; + var y = drawableVertexes[pi + 1]; + if (x < minX) { + minX = x; + } + if (x > maxX) { + maxX = x; + } + if (y < minY) { + minY = y; + } + if (y > maxY) { + maxY = y; + } + } + if (minX == Number.MAX_VALUE) { + continue; + } + if (minX < clippedDrawTotalMinX) { + clippedDrawTotalMinX = minX; + } + if (minY < clippedDrawTotalMinY) { + clippedDrawTotalMinY = minY; + } + if (maxX > clippedDrawTotalMaxX) { + clippedDrawTotalMaxX = maxX; + } + if (maxY > clippedDrawTotalMaxY) { + clippedDrawTotalMaxY = maxY; + } + if (clippedDrawTotalMinX == Number.MAX_VALUE) { + clippingContext._allClippedDrawRect.x = 0.0; + clippingContext._allClippedDrawRect.y = 0.0; + clippingContext._allClippedDrawRect.width = 0.0; + clippingContext._allClippedDrawRect.height = 0.0; + clippingContext._isUsing = false; + } + else { + clippingContext._isUsing = true; + var w = clippedDrawTotalMaxX - clippedDrawTotalMinX; + var h = clippedDrawTotalMaxY - clippedDrawTotalMinY; + clippingContext._allClippedDrawRect.x = clippedDrawTotalMinX; + clippingContext._allClippedDrawRect.y = clippedDrawTotalMinY; + clippingContext._allClippedDrawRect.width = w; + clippingContext._allClippedDrawRect.height = h; + } + } + }; + CubismClippingManager_WebGL.prototype.release = function () { + for (var i = 0; i < this._clippingContextListForMask.getSize(); i++) { + if (this._clippingContextListForMask.at(i)) { + this._clippingContextListForMask.at(i).release(); + this._clippingContextListForMask.set(i, void 0); + } + this._clippingContextListForMask.set(i, null); + } + this._clippingContextListForMask = null; + for (var i = 0; i < this._clippingContextListForDraw.getSize(); i++) { + this._clippingContextListForDraw.set(i, null); + } + this._clippingContextListForDraw = null; + if (this._maskTexture) { + this.gl.deleteFramebuffer(this._maskTexture.texture); + this._maskTexture = null; + } + for (var i = 0; i < this._channelColors.getSize(); i++) { + this._channelColors.set(i, null); + } + this._channelColors = null; + this.gl.deleteTexture(this._colorBuffer); + this._colorBuffer = null; + }; + CubismClippingManager_WebGL.prototype.initialize = function (model, drawableCount, drawableMasks, drawableMaskCounts) { + for (var i = 0; i < drawableCount; i++) { + if (drawableMaskCounts[i] <= 0) { + this._clippingContextListForDraw.pushBack(null); + continue; + } + var clippingContext = this.findSameClip(drawableMasks[i], drawableMaskCounts[i]); + if (clippingContext == null) { + clippingContext = new CubismClippingContext(this, drawableMasks[i], drawableMaskCounts[i]); + this._clippingContextListForMask.pushBack(clippingContext); + } + clippingContext.addClippedDrawable(i); + this._clippingContextListForDraw.pushBack(clippingContext); + } + }; + CubismClippingManager_WebGL.prototype.setupClippingContext = function (model, renderer) { + this._currentFrameNo++; + var usingClipCount = 0; + for (var clipIndex = 0; clipIndex < this._clippingContextListForMask.getSize(); clipIndex++) { + var cc = this._clippingContextListForMask.at(clipIndex); + this.calcClippedDrawTotalBounds(model, cc); + if (cc._isUsing) { + usingClipCount++; + } + } + if (usingClipCount > 0) { + this.gl.viewport(0, 0, this._clippingMaskBufferSize, this._clippingMaskBufferSize); + this._maskRenderTexture = this.getMaskRenderTexture(); + var modelToWorldF = renderer.getMvpMatrix(); + renderer.preDraw(); + this.setupLayoutBounds(usingClipCount); + this.gl.bindFramebuffer(this.gl.FRAMEBUFFER, this._maskRenderTexture); + this.gl.clearColor(1.0, 1.0, 1.0, 1.0); + this.gl.clear(this.gl.COLOR_BUFFER_BIT); + for (var clipIndex = 0; clipIndex < this._clippingContextListForMask.getSize(); clipIndex++) { + var clipContext = this._clippingContextListForMask.at(clipIndex); + var allClipedDrawRect = clipContext._allClippedDrawRect; + var layoutBoundsOnTex01 = clipContext._layoutBounds; + var MARGIN = 0.05; + this._tmpBoundsOnModel.setRect(allClipedDrawRect); + this._tmpBoundsOnModel.expand(allClipedDrawRect.width * MARGIN, allClipedDrawRect.height * MARGIN); + var scaleX = layoutBoundsOnTex01.width / this._tmpBoundsOnModel.width; + var scaleY = layoutBoundsOnTex01.height / this._tmpBoundsOnModel.height; + { + this._tmpMatrix.loadIdentity(); + { + this._tmpMatrix.translateRelative(-1.0, -1.0); + this._tmpMatrix.scaleRelative(2.0, 2.0); + } + { + this._tmpMatrix.translateRelative(layoutBoundsOnTex01.x, layoutBoundsOnTex01.y); + this._tmpMatrix.scaleRelative(scaleX, scaleY); + this._tmpMatrix.translateRelative(-this._tmpBoundsOnModel.x, -this._tmpBoundsOnModel.y); + } + this._tmpMatrixForMask.setMatrix(this._tmpMatrix.getArray()); + } + { + this._tmpMatrix.loadIdentity(); + { + this._tmpMatrix.translateRelative(layoutBoundsOnTex01.x, layoutBoundsOnTex01.y); + this._tmpMatrix.scaleRelative(scaleX, scaleY); + this._tmpMatrix.translateRelative(-this._tmpBoundsOnModel.x, -this._tmpBoundsOnModel.y); + } + this._tmpMatrixForDraw.setMatrix(this._tmpMatrix.getArray()); + } + clipContext._matrixForMask.setMatrix(this._tmpMatrixForMask.getArray()); + clipContext._matrixForDraw.setMatrix(this._tmpMatrixForDraw.getArray()); + var clipDrawCount = clipContext._clippingIdCount; + for (var i = 0; i < clipDrawCount; i++) { + var clipDrawIndex = clipContext._clippingIdList[i]; + if (!model.getDrawableDynamicFlagVertexPositionsDidChange(clipDrawIndex)) { + continue; + } + renderer.setIsCulling(model.getDrawableCulling(clipDrawIndex) != false); + renderer.setClippingContextBufferForMask(clipContext); + renderer.drawMesh(model.getDrawableTextureIndices(clipDrawIndex), model.getDrawableVertexIndexCount(clipDrawIndex), model.getDrawableVertexCount(clipDrawIndex), model.getDrawableVertexIndices(clipDrawIndex), model.getDrawableVertices(clipDrawIndex), model.getDrawableVertexUvs(clipDrawIndex), model.getDrawableOpacity(clipDrawIndex), CubismBlendMode.CubismBlendMode_Normal, false); + } + } + this.gl.bindFramebuffer(this.gl.FRAMEBUFFER, s_fbo); + renderer.setClippingContextBufferForMask(null); + this.gl.viewport(s_viewport[0], s_viewport[1], s_viewport[2], s_viewport[3]); + } + }; + CubismClippingManager_WebGL.prototype.findSameClip = function (drawableMasks, drawableMaskCounts) { + for (var i = 0; i < this._clippingContextListForMask.getSize(); i++) { + var clippingContext = this._clippingContextListForMask.at(i); + var count = clippingContext._clippingIdCount; + if (count != drawableMaskCounts) { + continue; + } + var sameCount = 0; + for (var j = 0; j < count; j++) { + var clipId = clippingContext._clippingIdList[j]; + for (var k = 0; k < count; k++) { + if (drawableMasks[k] == clipId) { + sameCount++; + break; + } + } + } + if (sameCount == count) { + return clippingContext; + } + } + return null; + }; + CubismClippingManager_WebGL.prototype.setupLayoutBounds = function (usingClipCount) { + var div = usingClipCount / ColorChannelCount; + var mod = usingClipCount % ColorChannelCount; + div = ~~div; + mod = ~~mod; + var curClipIndex = 0; + for (var channelNo = 0; channelNo < ColorChannelCount; channelNo++) { + var layoutCount = div + (channelNo < mod ? 1 : 0); + if (layoutCount == 0) { + } + else if (layoutCount == 1) { + var clipContext = this._clippingContextListForMask.at(curClipIndex++); + clipContext._layoutChannelNo = channelNo; + clipContext._layoutBounds.x = 0.0; + clipContext._layoutBounds.y = 0.0; + clipContext._layoutBounds.width = 1.0; + clipContext._layoutBounds.height = 1.0; + } + else if (layoutCount == 2) { + for (var i = 0; i < layoutCount; i++) { + var xpos = i % 2; + xpos = ~~xpos; + var cc = this._clippingContextListForMask.at(curClipIndex++); + cc._layoutChannelNo = channelNo; + cc._layoutBounds.x = xpos * 0.5; + cc._layoutBounds.y = 0.0; + cc._layoutBounds.width = 0.5; + cc._layoutBounds.height = 1.0; + } + } + else if (layoutCount <= 4) { + for (var i = 0; i < layoutCount; i++) { + var xpos = i % 2; + var ypos = i / 2; + xpos = ~~xpos; + ypos = ~~ypos; + var cc = this._clippingContextListForMask.at(curClipIndex++); + cc._layoutChannelNo = channelNo; + cc._layoutBounds.x = xpos * 0.5; + cc._layoutBounds.y = ypos * 0.5; + cc._layoutBounds.width = 0.5; + cc._layoutBounds.height = 0.5; + } + } + else if (layoutCount <= 9) { + for (var i = 0; i < layoutCount; i++) { + var xpos = i % 3; + var ypos = i / 3; + xpos = ~~xpos; + ypos = ~~ypos; + var cc = this._clippingContextListForMask.at(curClipIndex++); + cc._layoutChannelNo = channelNo; + cc._layoutBounds.x = xpos / 3.0; + cc._layoutBounds.y = ypos / 3.0; + cc._layoutBounds.width = 1.0 / 3.0; + cc._layoutBounds.height = 1.0 / 3.0; + } + } + else { + cubismdebug_1.CubismLogError('not supported mask count : {0}', layoutCount); + } + } + }; + CubismClippingManager_WebGL.prototype.getColorBuffer = function () { + return this._colorBuffer; + }; + CubismClippingManager_WebGL.prototype.getClippingContextListForDraw = function () { + return this._clippingContextListForDraw; + }; + CubismClippingManager_WebGL.prototype.setClippingMaskBufferSize = function (size) { + this._clippingMaskBufferSize = size; + }; + CubismClippingManager_WebGL.prototype.getClippingMaskBufferSize = function () { + return this._clippingMaskBufferSize; + }; + return CubismClippingManager_WebGL; + }()); + Live2DCubismFramework.CubismClippingManager_WebGL = CubismClippingManager_WebGL; + var CubismRenderTextureResource = (function () { + function CubismRenderTextureResource(frameNo, texture) { + this.frameNo = frameNo; + this.texture = texture; + } + return CubismRenderTextureResource; + }()); + Live2DCubismFramework.CubismRenderTextureResource = CubismRenderTextureResource; + var CubismClippingContext = (function () { + function CubismClippingContext(manager, clippingDrawableIndices, clipCount) { + this._owner = manager; + this._clippingIdList = clippingDrawableIndices; + this._clippingIdCount = clipCount; + this._allClippedDrawRect = new csmRect(); + this._layoutBounds = new csmRect(); + this._clippedDrawableIndexList = []; + this._matrixForMask = new CubismMatrix44(); + this._matrixForDraw = new CubismMatrix44(); + } + CubismClippingContext.prototype.release = function () { + if (this._layoutBounds != null) { + this._layoutBounds = null; + } + if (this._allClippedDrawRect != null) { + this._allClippedDrawRect = null; + } + if (this._clippedDrawableIndexList != null) { + this._clippedDrawableIndexList = null; + } + }; + CubismClippingContext.prototype.addClippedDrawable = function (drawableIndex) { + this._clippedDrawableIndexList.push(drawableIndex); + }; + CubismClippingContext.prototype.getClippingManager = function () { + return this._owner; + }; + CubismClippingContext.prototype.setGl = function (gl) { + this._owner.setGL(gl); + }; + return CubismClippingContext; + }()); + Live2DCubismFramework.CubismClippingContext = CubismClippingContext; + var CubismShader_WebGL = (function () { + function CubismShader_WebGL() { + this._shaderSets = new csmVector(); + } + CubismShader_WebGL.getInstance = function () { + if (s_instance == null) { + s_instance = new CubismShader_WebGL(); + return s_instance; + } + return s_instance; + }; + CubismShader_WebGL.deleteInstance = function () { + if (s_instance) { + s_instance.release(); + s_instance = null; + } + }; + CubismShader_WebGL.prototype.release = function () { + this.releaseShaderProgram(); + }; + CubismShader_WebGL.prototype.setupShaderProgram = function (renderer, textureId, vertexCount, vertexArray, indexArray, uvArray, bufferData, opacity, colorBlendMode, baseColor, isPremultipliedAlpha, matrix4x4, invertedMask) { + if (!isPremultipliedAlpha) { + cubismdebug_1.CubismLogError('NoPremultipliedAlpha is not allowed'); + } + if (this._shaderSets.getSize() == 0) { + this.generateShaders(); + } + var SRC_COLOR; + var DST_COLOR; + var SRC_ALPHA; + var DST_ALPHA; + if (renderer.getClippingContextBufferForMask() != null) { + var shaderSet = this._shaderSets.at(ShaderNames.ShaderNames_SetupMask); + this.gl.useProgram(shaderSet.shaderProgram); + this.gl.activeTexture(this.gl.TEXTURE0); + this.gl.bindTexture(this.gl.TEXTURE_2D, textureId); + this.gl.uniform1i(shaderSet.samplerTexture0Location, 0); + if (bufferData.vertex == null) { + bufferData.vertex = this.gl.createBuffer(); + } + this.gl.bindBuffer(this.gl.ARRAY_BUFFER, bufferData.vertex); + this.gl.bufferData(this.gl.ARRAY_BUFFER, vertexArray, this.gl.DYNAMIC_DRAW); + this.gl.enableVertexAttribArray(shaderSet.attributePositionLocation); + this.gl.vertexAttribPointer(shaderSet.attributePositionLocation, 2, this.gl.FLOAT, false, 0, 0); + if (bufferData.uv == null) { + bufferData.uv = this.gl.createBuffer(); + } + this.gl.bindBuffer(this.gl.ARRAY_BUFFER, bufferData.uv); + this.gl.bufferData(this.gl.ARRAY_BUFFER, uvArray, this.gl.DYNAMIC_DRAW); + this.gl.enableVertexAttribArray(shaderSet.attributeTexCoordLocation); + this.gl.vertexAttribPointer(shaderSet.attributeTexCoordLocation, 2, this.gl.FLOAT, false, 0, 0); + var channelNo = renderer.getClippingContextBufferForMask() + ._layoutChannelNo; + var colorChannel = renderer + .getClippingContextBufferForMask() + .getClippingManager() + .getChannelFlagAsColor(channelNo); + this.gl.uniform4f(shaderSet.uniformChannelFlagLocation, colorChannel.R, colorChannel.G, colorChannel.B, colorChannel.A); + this.gl.uniformMatrix4fv(shaderSet.uniformClipMatrixLocation, false, renderer.getClippingContextBufferForMask()._matrixForMask.getArray()); + var rect = renderer.getClippingContextBufferForMask() + ._layoutBounds; + this.gl.uniform4f(shaderSet.uniformBaseColorLocation, rect.x * 2.0 - 1.0, rect.y * 2.0 - 1.0, rect.getRight() * 2.0 - 1.0, rect.getBottom() * 2.0 - 1.0); + SRC_COLOR = this.gl.ZERO; + DST_COLOR = this.gl.ONE_MINUS_SRC_COLOR; + SRC_ALPHA = this.gl.ZERO; + DST_ALPHA = this.gl.ONE_MINUS_SRC_ALPHA; + } + else { + var masked = renderer.getClippingContextBufferForDraw() != null; + var offset = masked ? (invertedMask ? 2 : 1) : 0; + var shaderSet = new CubismShaderSet(); + switch (colorBlendMode) { + case CubismBlendMode.CubismBlendMode_Normal: + default: + shaderSet = this._shaderSets.at(ShaderNames.ShaderNames_NormalPremultipliedAlpha + offset); + SRC_COLOR = this.gl.ONE; + DST_COLOR = this.gl.ONE_MINUS_SRC_ALPHA; + SRC_ALPHA = this.gl.ONE; + DST_ALPHA = this.gl.ONE_MINUS_SRC_ALPHA; + break; + case CubismBlendMode.CubismBlendMode_Additive: + shaderSet = this._shaderSets.at(ShaderNames.ShaderNames_AddPremultipliedAlpha + offset); + SRC_COLOR = this.gl.ONE; + DST_COLOR = this.gl.ONE; + SRC_ALPHA = this.gl.ZERO; + DST_ALPHA = this.gl.ONE; + break; + case CubismBlendMode.CubismBlendMode_Multiplicative: + shaderSet = this._shaderSets.at(ShaderNames.ShaderNames_MultPremultipliedAlpha + offset); + SRC_COLOR = this.gl.DST_COLOR; + DST_COLOR = this.gl.ONE_MINUS_SRC_ALPHA; + SRC_ALPHA = this.gl.ZERO; + DST_ALPHA = this.gl.ONE; + break; + } + this.gl.useProgram(shaderSet.shaderProgram); + if (bufferData.vertex == null) { + bufferData.vertex = this.gl.createBuffer(); + } + this.gl.bindBuffer(this.gl.ARRAY_BUFFER, bufferData.vertex); + this.gl.bufferData(this.gl.ARRAY_BUFFER, vertexArray, this.gl.DYNAMIC_DRAW); + this.gl.enableVertexAttribArray(shaderSet.attributePositionLocation); + this.gl.vertexAttribPointer(shaderSet.attributePositionLocation, 2, this.gl.FLOAT, false, 0, 0); + if (bufferData.uv == null) { + bufferData.uv = this.gl.createBuffer(); + } + this.gl.bindBuffer(this.gl.ARRAY_BUFFER, bufferData.uv); + this.gl.bufferData(this.gl.ARRAY_BUFFER, uvArray, this.gl.DYNAMIC_DRAW); + this.gl.enableVertexAttribArray(shaderSet.attributeTexCoordLocation); + this.gl.vertexAttribPointer(shaderSet.attributeTexCoordLocation, 2, this.gl.FLOAT, false, 0, 0); + if (masked) { + this.gl.activeTexture(this.gl.TEXTURE1); + var tex = renderer + .getClippingContextBufferForDraw() + .getClippingManager() + .getColorBuffer(); + this.gl.bindTexture(this.gl.TEXTURE_2D, tex); + this.gl.uniform1i(shaderSet.samplerTexture1Location, 1); + this.gl.uniformMatrix4fv(shaderSet.uniformClipMatrixLocation, false, renderer.getClippingContextBufferForDraw()._matrixForDraw.getArray()); + var channelNo = renderer.getClippingContextBufferForDraw() + ._layoutChannelNo; + var colorChannel = renderer + .getClippingContextBufferForDraw() + .getClippingManager() + .getChannelFlagAsColor(channelNo); + this.gl.uniform4f(shaderSet.uniformChannelFlagLocation, colorChannel.R, colorChannel.G, colorChannel.B, colorChannel.A); + } + this.gl.activeTexture(this.gl.TEXTURE0); + this.gl.bindTexture(this.gl.TEXTURE_2D, textureId); + this.gl.uniform1i(shaderSet.samplerTexture0Location, 0); + this.gl.uniformMatrix4fv(shaderSet.uniformMatrixLocation, false, matrix4x4.getArray()); + this.gl.uniform4f(shaderSet.uniformBaseColorLocation, baseColor.R, baseColor.G, baseColor.B, baseColor.A); + } + if (bufferData.index == null) { + bufferData.index = this.gl.createBuffer(); + } + this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, bufferData.index); + this.gl.bufferData(this.gl.ELEMENT_ARRAY_BUFFER, indexArray, this.gl.DYNAMIC_DRAW); + this.gl.blendFuncSeparate(SRC_COLOR, DST_COLOR, SRC_ALPHA, DST_ALPHA); + }; + CubismShader_WebGL.prototype.releaseShaderProgram = function () { + for (var i = 0; i < this._shaderSets.getSize(); i++) { + this.gl.deleteProgram(this._shaderSets.at(i).shaderProgram); + this._shaderSets.at(i).shaderProgram = 0; + this._shaderSets.set(i, void 0); + this._shaderSets.set(i, null); + } + }; + CubismShader_WebGL.prototype.generateShaders = function () { + for (var i = 0; i < shaderCount; i++) { + this._shaderSets.pushBack(new CubismShaderSet()); + } + this._shaderSets.at(0).shaderProgram = this.loadShaderProgram(Live2DCubismFramework.vertexShaderSrcSetupMask, Live2DCubismFramework.fragmentShaderSrcsetupMask); + this._shaderSets.at(1).shaderProgram = this.loadShaderProgram(Live2DCubismFramework.vertexShaderSrc, Live2DCubismFramework.fragmentShaderSrcPremultipliedAlpha); + this._shaderSets.at(2).shaderProgram = this.loadShaderProgram(Live2DCubismFramework.vertexShaderSrcMasked, Live2DCubismFramework.fragmentShaderSrcMaskPremultipliedAlpha); + this._shaderSets.at(3).shaderProgram = this.loadShaderProgram(Live2DCubismFramework.vertexShaderSrcMasked, Live2DCubismFramework.fragmentShaderSrcMaskInvertedPremultipliedAlpha); + this._shaderSets.at(4).shaderProgram = this._shaderSets.at(1).shaderProgram; + this._shaderSets.at(5).shaderProgram = this._shaderSets.at(2).shaderProgram; + this._shaderSets.at(6).shaderProgram = this._shaderSets.at(3).shaderProgram; + this._shaderSets.at(7).shaderProgram = this._shaderSets.at(1).shaderProgram; + this._shaderSets.at(8).shaderProgram = this._shaderSets.at(2).shaderProgram; + this._shaderSets.at(9).shaderProgram = this._shaderSets.at(3).shaderProgram; + this._shaderSets.at(0).attributePositionLocation = this.gl.getAttribLocation(this._shaderSets.at(0).shaderProgram, 'a_position'); + this._shaderSets.at(0).attributeTexCoordLocation = this.gl.getAttribLocation(this._shaderSets.at(0).shaderProgram, 'a_texCoord'); + this._shaderSets.at(0).samplerTexture0Location = this.gl.getUniformLocation(this._shaderSets.at(0).shaderProgram, 's_texture0'); + this._shaderSets.at(0).uniformClipMatrixLocation = this.gl.getUniformLocation(this._shaderSets.at(0).shaderProgram, 'u_clipMatrix'); + this._shaderSets.at(0).uniformChannelFlagLocation = this.gl.getUniformLocation(this._shaderSets.at(0).shaderProgram, 'u_channelFlag'); + this._shaderSets.at(0).uniformBaseColorLocation = this.gl.getUniformLocation(this._shaderSets.at(0).shaderProgram, 'u_baseColor'); + this._shaderSets.at(1).attributePositionLocation = this.gl.getAttribLocation(this._shaderSets.at(1).shaderProgram, 'a_position'); + this._shaderSets.at(1).attributeTexCoordLocation = this.gl.getAttribLocation(this._shaderSets.at(1).shaderProgram, 'a_texCoord'); + this._shaderSets.at(1).samplerTexture0Location = this.gl.getUniformLocation(this._shaderSets.at(1).shaderProgram, 's_texture0'); + this._shaderSets.at(1).uniformMatrixLocation = this.gl.getUniformLocation(this._shaderSets.at(1).shaderProgram, 'u_matrix'); + this._shaderSets.at(1).uniformBaseColorLocation = this.gl.getUniformLocation(this._shaderSets.at(1).shaderProgram, 'u_baseColor'); + this._shaderSets.at(2).attributePositionLocation = this.gl.getAttribLocation(this._shaderSets.at(2).shaderProgram, 'a_position'); + this._shaderSets.at(2).attributeTexCoordLocation = this.gl.getAttribLocation(this._shaderSets.at(2).shaderProgram, 'a_texCoord'); + this._shaderSets.at(2).samplerTexture0Location = this.gl.getUniformLocation(this._shaderSets.at(2).shaderProgram, 's_texture0'); + this._shaderSets.at(2).samplerTexture1Location = this.gl.getUniformLocation(this._shaderSets.at(2).shaderProgram, 's_texture1'); + this._shaderSets.at(2).uniformMatrixLocation = this.gl.getUniformLocation(this._shaderSets.at(2).shaderProgram, 'u_matrix'); + this._shaderSets.at(2).uniformClipMatrixLocation = this.gl.getUniformLocation(this._shaderSets.at(2).shaderProgram, 'u_clipMatrix'); + this._shaderSets.at(2).uniformChannelFlagLocation = this.gl.getUniformLocation(this._shaderSets.at(2).shaderProgram, 'u_channelFlag'); + this._shaderSets.at(2).uniformBaseColorLocation = this.gl.getUniformLocation(this._shaderSets.at(2).shaderProgram, 'u_baseColor'); + this._shaderSets.at(3).attributePositionLocation = this.gl.getAttribLocation(this._shaderSets.at(3).shaderProgram, 'a_position'); + this._shaderSets.at(3).attributeTexCoordLocation = this.gl.getAttribLocation(this._shaderSets.at(3).shaderProgram, 'a_texCoord'); + this._shaderSets.at(3).samplerTexture0Location = this.gl.getUniformLocation(this._shaderSets.at(3).shaderProgram, 's_texture0'); + this._shaderSets.at(3).samplerTexture1Location = this.gl.getUniformLocation(this._shaderSets.at(3).shaderProgram, 's_texture1'); + this._shaderSets.at(3).uniformMatrixLocation = this.gl.getUniformLocation(this._shaderSets.at(3).shaderProgram, 'u_matrix'); + this._shaderSets.at(3).uniformClipMatrixLocation = this.gl.getUniformLocation(this._shaderSets.at(3).shaderProgram, 'u_clipMatrix'); + this._shaderSets.at(3).uniformChannelFlagLocation = this.gl.getUniformLocation(this._shaderSets.at(3).shaderProgram, 'u_channelFlag'); + this._shaderSets.at(3).uniformBaseColorLocation = this.gl.getUniformLocation(this._shaderSets.at(3).shaderProgram, 'u_baseColor'); + this._shaderSets.at(4).attributePositionLocation = this.gl.getAttribLocation(this._shaderSets.at(4).shaderProgram, 'a_position'); + this._shaderSets.at(4).attributeTexCoordLocation = this.gl.getAttribLocation(this._shaderSets.at(4).shaderProgram, 'a_texCoord'); + this._shaderSets.at(4).samplerTexture0Location = this.gl.getUniformLocation(this._shaderSets.at(4).shaderProgram, 's_texture0'); + this._shaderSets.at(4).uniformMatrixLocation = this.gl.getUniformLocation(this._shaderSets.at(4).shaderProgram, 'u_matrix'); + this._shaderSets.at(4).uniformBaseColorLocation = this.gl.getUniformLocation(this._shaderSets.at(4).shaderProgram, 'u_baseColor'); + this._shaderSets.at(5).attributePositionLocation = this.gl.getAttribLocation(this._shaderSets.at(5).shaderProgram, 'a_position'); + this._shaderSets.at(5).attributeTexCoordLocation = this.gl.getAttribLocation(this._shaderSets.at(5).shaderProgram, 'a_texCoord'); + this._shaderSets.at(5).samplerTexture0Location = this.gl.getUniformLocation(this._shaderSets.at(5).shaderProgram, 's_texture0'); + this._shaderSets.at(5).samplerTexture1Location = this.gl.getUniformLocation(this._shaderSets.at(5).shaderProgram, 's_texture1'); + this._shaderSets.at(5).uniformMatrixLocation = this.gl.getUniformLocation(this._shaderSets.at(5).shaderProgram, 'u_matrix'); + this._shaderSets.at(5).uniformClipMatrixLocation = this.gl.getUniformLocation(this._shaderSets.at(5).shaderProgram, 'u_clipMatrix'); + this._shaderSets.at(5).uniformChannelFlagLocation = this.gl.getUniformLocation(this._shaderSets.at(5).shaderProgram, 'u_channelFlag'); + this._shaderSets.at(5).uniformBaseColorLocation = this.gl.getUniformLocation(this._shaderSets.at(5).shaderProgram, 'u_baseColor'); + this._shaderSets.at(6).attributePositionLocation = this.gl.getAttribLocation(this._shaderSets.at(6).shaderProgram, 'a_position'); + this._shaderSets.at(6).attributeTexCoordLocation = this.gl.getAttribLocation(this._shaderSets.at(6).shaderProgram, 'a_texCoord'); + this._shaderSets.at(6).samplerTexture0Location = this.gl.getUniformLocation(this._shaderSets.at(6).shaderProgram, 's_texture0'); + this._shaderSets.at(6).samplerTexture1Location = this.gl.getUniformLocation(this._shaderSets.at(6).shaderProgram, 's_texture1'); + this._shaderSets.at(6).uniformMatrixLocation = this.gl.getUniformLocation(this._shaderSets.at(6).shaderProgram, 'u_matrix'); + this._shaderSets.at(6).uniformClipMatrixLocation = this.gl.getUniformLocation(this._shaderSets.at(6).shaderProgram, 'u_clipMatrix'); + this._shaderSets.at(6).uniformChannelFlagLocation = this.gl.getUniformLocation(this._shaderSets.at(6).shaderProgram, 'u_channelFlag'); + this._shaderSets.at(6).uniformBaseColorLocation = this.gl.getUniformLocation(this._shaderSets.at(6).shaderProgram, 'u_baseColor'); + this._shaderSets.at(7).attributePositionLocation = this.gl.getAttribLocation(this._shaderSets.at(7).shaderProgram, 'a_position'); + this._shaderSets.at(7).attributeTexCoordLocation = this.gl.getAttribLocation(this._shaderSets.at(7).shaderProgram, 'a_texCoord'); + this._shaderSets.at(7).samplerTexture0Location = this.gl.getUniformLocation(this._shaderSets.at(7).shaderProgram, 's_texture0'); + this._shaderSets.at(7).uniformMatrixLocation = this.gl.getUniformLocation(this._shaderSets.at(7).shaderProgram, 'u_matrix'); + this._shaderSets.at(7).uniformBaseColorLocation = this.gl.getUniformLocation(this._shaderSets.at(7).shaderProgram, 'u_baseColor'); + this._shaderSets.at(8).attributePositionLocation = this.gl.getAttribLocation(this._shaderSets.at(8).shaderProgram, 'a_position'); + this._shaderSets.at(8).attributeTexCoordLocation = this.gl.getAttribLocation(this._shaderSets.at(8).shaderProgram, 'a_texCoord'); + this._shaderSets.at(8).samplerTexture0Location = this.gl.getUniformLocation(this._shaderSets.at(8).shaderProgram, 's_texture0'); + this._shaderSets.at(8).samplerTexture1Location = this.gl.getUniformLocation(this._shaderSets.at(8).shaderProgram, 's_texture1'); + this._shaderSets.at(8).uniformMatrixLocation = this.gl.getUniformLocation(this._shaderSets.at(8).shaderProgram, 'u_matrix'); + this._shaderSets.at(8).uniformClipMatrixLocation = this.gl.getUniformLocation(this._shaderSets.at(8).shaderProgram, 'u_clipMatrix'); + this._shaderSets.at(8).uniformChannelFlagLocation = this.gl.getUniformLocation(this._shaderSets.at(8).shaderProgram, 'u_channelFlag'); + this._shaderSets.at(8).uniformBaseColorLocation = this.gl.getUniformLocation(this._shaderSets.at(8).shaderProgram, 'u_baseColor'); + this._shaderSets.at(9).attributePositionLocation = this.gl.getAttribLocation(this._shaderSets.at(9).shaderProgram, 'a_position'); + this._shaderSets.at(9).attributeTexCoordLocation = this.gl.getAttribLocation(this._shaderSets.at(9).shaderProgram, 'a_texCoord'); + this._shaderSets.at(9).samplerTexture0Location = this.gl.getUniformLocation(this._shaderSets.at(9).shaderProgram, 's_texture0'); + this._shaderSets.at(9).samplerTexture1Location = this.gl.getUniformLocation(this._shaderSets.at(9).shaderProgram, 's_texture1'); + this._shaderSets.at(9).uniformMatrixLocation = this.gl.getUniformLocation(this._shaderSets.at(9).shaderProgram, 'u_matrix'); + this._shaderSets.at(9).uniformClipMatrixLocation = this.gl.getUniformLocation(this._shaderSets.at(9).shaderProgram, 'u_clipMatrix'); + this._shaderSets.at(9).uniformChannelFlagLocation = this.gl.getUniformLocation(this._shaderSets.at(9).shaderProgram, 'u_channelFlag'); + this._shaderSets.at(9).uniformBaseColorLocation = this.gl.getUniformLocation(this._shaderSets.at(9).shaderProgram, 'u_baseColor'); + }; + CubismShader_WebGL.prototype.loadShaderProgram = function (vertexShaderSource, fragmentShaderSource) { + var shaderProgram = this.gl.createProgram(); + var vertShader = this.compileShaderSource(this.gl.VERTEX_SHADER, vertexShaderSource); + if (!vertShader) { + cubismdebug_1.CubismLogError('Vertex shader compile error!'); + return 0; + } + var fragShader = this.compileShaderSource(this.gl.FRAGMENT_SHADER, fragmentShaderSource); + if (!fragShader) { + cubismdebug_1.CubismLogError('Vertex shader compile error!'); + return 0; + } + this.gl.attachShader(shaderProgram, vertShader); + this.gl.attachShader(shaderProgram, fragShader); + this.gl.linkProgram(shaderProgram); + var linkStatus = this.gl.getProgramParameter(shaderProgram, this.gl.LINK_STATUS); + if (!linkStatus) { + cubismdebug_1.CubismLogError('Failed to link program: {0}', shaderProgram); + this.gl.deleteShader(vertShader); + vertShader = 0; + this.gl.deleteShader(fragShader); + fragShader = 0; + if (shaderProgram) { + this.gl.deleteProgram(shaderProgram); + shaderProgram = 0; + } + return 0; + } + this.gl.deleteShader(vertShader); + this.gl.deleteShader(fragShader); + return shaderProgram; + }; + CubismShader_WebGL.prototype.compileShaderSource = function (shaderType, shaderSource) { + var source = shaderSource; + var shader = this.gl.createShader(shaderType); + this.gl.shaderSource(shader, source); + this.gl.compileShader(shader); + if (!shader) { + var log = this.gl.getShaderInfoLog(shader); + cubismdebug_1.CubismLogError('Shader compile log: {0} ', log); + } + var status = this.gl.getShaderParameter(shader, this.gl.COMPILE_STATUS); + if (!status) { + this.gl.deleteShader(shader); + return null; + } + return shader; + }; + CubismShader_WebGL.prototype.setGl = function (gl) { + this.gl = gl; + }; + return CubismShader_WebGL; + }()); + Live2DCubismFramework.CubismShader_WebGL = CubismShader_WebGL; + var CubismShaderSet = (function () { + function CubismShaderSet() { + } + return CubismShaderSet; + }()); + Live2DCubismFramework.CubismShaderSet = CubismShaderSet; + var ShaderNames; + (function (ShaderNames) { + ShaderNames[ShaderNames["ShaderNames_SetupMask"] = 0] = "ShaderNames_SetupMask"; + ShaderNames[ShaderNames["ShaderNames_NormalPremultipliedAlpha"] = 1] = "ShaderNames_NormalPremultipliedAlpha"; + ShaderNames[ShaderNames["ShaderNames_NormalMaskedPremultipliedAlpha"] = 2] = "ShaderNames_NormalMaskedPremultipliedAlpha"; + ShaderNames[ShaderNames["ShaderNames_NomralMaskedInvertedPremultipliedAlpha"] = 3] = "ShaderNames_NomralMaskedInvertedPremultipliedAlpha"; + ShaderNames[ShaderNames["ShaderNames_AddPremultipliedAlpha"] = 4] = "ShaderNames_AddPremultipliedAlpha"; + ShaderNames[ShaderNames["ShaderNames_AddMaskedPremultipliedAlpha"] = 5] = "ShaderNames_AddMaskedPremultipliedAlpha"; + ShaderNames[ShaderNames["ShaderNames_AddMaskedPremultipliedAlphaInverted"] = 6] = "ShaderNames_AddMaskedPremultipliedAlphaInverted"; + ShaderNames[ShaderNames["ShaderNames_MultPremultipliedAlpha"] = 7] = "ShaderNames_MultPremultipliedAlpha"; + ShaderNames[ShaderNames["ShaderNames_MultMaskedPremultipliedAlpha"] = 8] = "ShaderNames_MultMaskedPremultipliedAlpha"; + ShaderNames[ShaderNames["ShaderNames_MultMaskedPremultipliedAlphaInverted"] = 9] = "ShaderNames_MultMaskedPremultipliedAlphaInverted"; + })(ShaderNames = Live2DCubismFramework.ShaderNames || (Live2DCubismFramework.ShaderNames = {})); + Live2DCubismFramework.vertexShaderSrcSetupMask = 'attribute vec4 a_position;' + + 'attribute vec2 a_texCoord;' + + 'varying vec2 v_texCoord;' + + 'varying vec4 v_myPos;' + + 'uniform mat4 u_clipMatrix;' + + 'void main()' + + '{' + + ' gl_Position = u_clipMatrix * a_position;' + + ' v_myPos = u_clipMatrix * a_position;' + + ' v_texCoord = a_texCoord;' + + ' v_texCoord.y = 1.0 - v_texCoord.y;' + + '}'; + Live2DCubismFramework.fragmentShaderSrcsetupMask = 'precision mediump float;' + + 'varying vec2 v_texCoord;' + + 'varying vec4 v_myPos;' + + 'uniform vec4 u_baseColor;' + + 'uniform vec4 u_channelFlag;' + + 'uniform sampler2D s_texture0;' + + 'void main()' + + '{' + + ' float isInside = ' + + ' step(u_baseColor.x, v_myPos.x/v_myPos.w)' + + ' * step(u_baseColor.y, v_myPos.y/v_myPos.w)' + + ' * step(v_myPos.x/v_myPos.w, u_baseColor.z)' + + ' * step(v_myPos.y/v_myPos.w, u_baseColor.w);' + + ' gl_FragColor = u_channelFlag * texture2D(s_texture0, v_texCoord).a * isInside;' + + '}'; + Live2DCubismFramework.vertexShaderSrc = 'attribute vec4 a_position;' + + 'attribute vec2 a_texCoord;' + + 'varying vec2 v_texCoord;' + + 'uniform mat4 u_matrix;' + + 'void main()' + + '{' + + ' gl_Position = u_matrix * a_position;' + + ' v_texCoord = a_texCoord;' + + ' v_texCoord.y = 1.0 - v_texCoord.y;' + + '}'; + Live2DCubismFramework.vertexShaderSrcMasked = 'attribute vec4 a_position;' + + 'attribute vec2 a_texCoord;' + + 'varying vec2 v_texCoord;' + + 'varying vec4 v_clipPos;' + + 'uniform mat4 u_matrix;' + + 'uniform mat4 u_clipMatrix;' + + 'void main()' + + '{' + + ' gl_Position = u_matrix * a_position;' + + ' v_clipPos = u_clipMatrix * a_position;' + + ' v_texCoord = a_texCoord;' + + ' v_texCoord.y = 1.0 - v_texCoord.y;' + + '}'; + Live2DCubismFramework.fragmentShaderSrcPremultipliedAlpha = 'precision mediump float;' + + 'varying vec2 v_texCoord;' + + 'uniform vec4 u_baseColor;' + + 'uniform sampler2D s_texture0;' + + 'void main()' + + '{' + + ' gl_FragColor = texture2D(s_texture0 , v_texCoord) * u_baseColor;' + + '}'; + Live2DCubismFramework.fragmentShaderSrcMaskPremultipliedAlpha = 'precision mediump float;' + + 'varying vec2 v_texCoord;' + + 'varying vec4 v_clipPos;' + + 'uniform vec4 u_baseColor;' + + 'uniform vec4 u_channelFlag;' + + 'uniform sampler2D s_texture0;' + + 'uniform sampler2D s_texture1;' + + 'void main()' + + '{' + + ' vec4 col_formask = texture2D(s_texture0 , v_texCoord) * u_baseColor;' + + ' vec4 clipMask = (1.0 - texture2D(s_texture1, v_clipPos.xy / v_clipPos.w)) * u_channelFlag;' + + ' float maskVal = clipMask.r + clipMask.g + clipMask.b + clipMask.a;' + + ' col_formask = col_formask * maskVal;' + + ' gl_FragColor = col_formask;' + + '}'; + Live2DCubismFramework.fragmentShaderSrcMaskInvertedPremultipliedAlpha = 'precision mediump float;' + + 'varying vec2 v_texCoord;' + + 'varying vec4 v_clipPos;' + + 'uniform sampler2D s_texture0;' + + 'uniform sampler2D s_texture1;' + + 'uniform vec4 u_channelFlag;' + + 'uniform vec4 u_baseColor;' + + 'void main()' + + '{' + + 'vec4 col_formask = texture2D(s_texture0, v_texCoord) * u_baseColor;' + + 'vec4 clipMask = (1.0 - texture2D(s_texture1, v_clipPos.xy / v_clipPos.w)) * u_channelFlag;' + + 'float maskVal = clipMask.r + clipMask.g + clipMask.b + clipMask.a;' + + 'col_formask = col_formask * (1.0 - maskVal);' + + 'gl_FragColor = col_formask;' + + '}'; + var CubismRenderer_WebGL = (function (_super) { + __extends(CubismRenderer_WebGL, _super); + function CubismRenderer_WebGL() { + var _this = _super.call(this) || this; + _this._clippingContextBufferForMask = null; + _this._clippingContextBufferForDraw = null; + _this._clippingManager = new CubismClippingManager_WebGL(); + _this.firstDraw = true; + _this._textures = new csmMap(); + _this._sortedDrawableIndexList = new csmVector(); + _this._bufferData = { + vertex: WebGLBuffer = null, + uv: WebGLBuffer = null, + index: WebGLBuffer = null + }; + _this._textures.prepareCapacity(32, true); + return _this; + } + CubismRenderer_WebGL.prototype.initialize = function (model) { + if (model.isUsingMasking()) { + this._clippingManager = new CubismClippingManager_WebGL(); + this._clippingManager.initialize(model, model.getDrawableCount(), model.getDrawableMasks(), model.getDrawableMaskCounts()); + } + this._sortedDrawableIndexList.resize(model.getDrawableCount(), 0); + _super.prototype.initialize.call(this, model); + }; + CubismRenderer_WebGL.prototype.bindTexture = function (modelTextureNo, glTexture) { + this._textures.setValue(modelTextureNo, glTexture); + }; + CubismRenderer_WebGL.prototype.getBindedTextures = function () { + return this._textures; + }; + CubismRenderer_WebGL.prototype.setClippingMaskBufferSize = function (size) { + this._clippingManager.release(); + this._clippingManager = void 0; + this._clippingManager = null; + this._clippingManager = new CubismClippingManager_WebGL(); + this._clippingManager.setClippingMaskBufferSize(size); + this._clippingManager.initialize(this.getModel(), this.getModel().getDrawableCount(), this.getModel().getDrawableMasks(), this.getModel().getDrawableMaskCounts()); + }; + CubismRenderer_WebGL.prototype.getClippingMaskBufferSize = function () { + return this._clippingManager.getClippingMaskBufferSize(); + }; + CubismRenderer_WebGL.prototype.release = function () { + this._clippingManager.release(); + this._clippingManager = void 0; + this._clippingManager = null; + this.gl.deleteBuffer(this._bufferData.vertex); + this._bufferData.vertex = null; + this.gl.deleteBuffer(this._bufferData.uv); + this._bufferData.uv = null; + this.gl.deleteBuffer(this._bufferData.index); + this._bufferData.index = null; + this._bufferData = null; + this._textures = null; + }; + CubismRenderer_WebGL.prototype.doDrawModel = function () { + if (this._clippingManager != null) { + this.preDraw(); + this._clippingManager.setupClippingContext(this.getModel(), this); + } + this.preDraw(); + var drawableCount = this.getModel().getDrawableCount(); + var renderOrder = this.getModel().getDrawableRenderOrders(); + for (var i = 0; i < drawableCount; ++i) { + var order = renderOrder[i]; + this._sortedDrawableIndexList.set(order, i); + } + for (var i = 0; i < drawableCount; ++i) { + var drawableIndex = this._sortedDrawableIndexList.at(i); + if (!this.getModel().getDrawableDynamicFlagIsVisible(drawableIndex)) { + continue; + } + this.setClippingContextBufferForDraw(this._clippingManager != null + ? this._clippingManager + .getClippingContextListForDraw() + .at(drawableIndex) + : null); + this.setIsCulling(this.getModel().getDrawableCulling(drawableIndex)); + this.drawMesh(this.getModel().getDrawableTextureIndices(drawableIndex), this.getModel().getDrawableVertexIndexCount(drawableIndex), this.getModel().getDrawableVertexCount(drawableIndex), this.getModel().getDrawableVertexIndices(drawableIndex), this.getModel().getDrawableVertices(drawableIndex), this.getModel().getDrawableVertexUvs(drawableIndex), this.getModel().getDrawableOpacity(drawableIndex), this.getModel().getDrawableBlendMode(drawableIndex), this.getModel().getDrawableInvertedMaskBit(drawableIndex)); + } + }; + CubismRenderer_WebGL.prototype.drawMesh = function (textureNo, indexCount, vertexCount, indexArray, vertexArray, uvArray, opacity, colorBlendMode, invertedMask) { + if (this.isCulling()) { + this.gl.enable(this.gl.CULL_FACE); + } + else { + this.gl.disable(this.gl.CULL_FACE); + } + this.gl.frontFace(this.gl.CCW); + var modelColorRGBA = this.getModelColor(); + if (this.getClippingContextBufferForMask() == null) { + modelColorRGBA.A *= opacity; + if (this.isPremultipliedAlpha()) { + modelColorRGBA.R *= modelColorRGBA.A; + modelColorRGBA.G *= modelColorRGBA.A; + modelColorRGBA.B *= modelColorRGBA.A; + } + } + var drawtexture; + if (this._textures.getValue(textureNo) != null) { + drawtexture = this._textures.getValue(textureNo); + } + else { + drawtexture = null; + } + CubismShader_WebGL.getInstance().setupShaderProgram(this, drawtexture, vertexCount, vertexArray, indexArray, uvArray, this._bufferData, opacity, colorBlendMode, modelColorRGBA, this.isPremultipliedAlpha(), this.getMvpMatrix(), invertedMask); + this.gl.drawElements(this.gl.TRIANGLES, indexCount, this.gl.UNSIGNED_SHORT, 0); + this.gl.useProgram(null); + this.setClippingContextBufferForDraw(null); + this.setClippingContextBufferForMask(null); + }; + CubismRenderer_WebGL.doStaticRelease = function () { + CubismShader_WebGL.deleteInstance(); + }; + CubismRenderer_WebGL.prototype.setRenderState = function (fbo, viewport) { + s_fbo = fbo; + s_viewport = viewport; + }; + CubismRenderer_WebGL.prototype.preDraw = function () { + if (this.firstDraw) { + this.firstDraw = false; + this._anisortopy = + this.gl.getExtension('EXT_texture_filter_anisotropic') || + this.gl.getExtension('WEBKIT_EXT_texture_filter_anisotropic') || + this.gl.getExtension('MOZ_EXT_texture_filter_anisotropic'); + } + this.gl.disable(this.gl.SCISSOR_TEST); + this.gl.disable(this.gl.STENCIL_TEST); + this.gl.disable(this.gl.DEPTH_TEST); + this.gl.frontFace(this.gl.CW); + this.gl.enable(this.gl.BLEND); + this.gl.colorMask(true, true, true, true); + this.gl.bindBuffer(this.gl.ARRAY_BUFFER, null); + this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, null); + }; + CubismRenderer_WebGL.prototype.setClippingContextBufferForMask = function (clip) { + this._clippingContextBufferForMask = clip; + }; + CubismRenderer_WebGL.prototype.getClippingContextBufferForMask = function () { + return this._clippingContextBufferForMask; + }; + CubismRenderer_WebGL.prototype.setClippingContextBufferForDraw = function (clip) { + this._clippingContextBufferForDraw = clip; + }; + CubismRenderer_WebGL.prototype.getClippingContextBufferForDraw = function () { + return this._clippingContextBufferForDraw; + }; + CubismRenderer_WebGL.prototype.startUp = function (gl) { + this.gl = gl; + this._clippingManager.setGL(gl); + CubismShader_WebGL.getInstance().setGl(gl); + }; + return CubismRenderer_WebGL; + }(CubismRenderer)); + Live2DCubismFramework.CubismRenderer_WebGL = CubismRenderer_WebGL; + CubismRenderer.staticRelease = function () { + CubismRenderer_WebGL.doStaticRelease(); + }; +})(Live2DCubismFramework = exports.Live2DCubismFramework || (exports.Live2DCubismFramework = {})); + + +/***/ }), + +/***/ "./Framework/src/type/csmmap.ts": +/*!**************************************!*\ + !*** ./Framework/src/type/csmmap.ts ***! + \**************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +var cubismdebug_1 = __webpack_require__(/*! ../utils/cubismdebug */ "./Framework/src/utils/cubismdebug.ts"); +var Live2DCubismFramework; +(function (Live2DCubismFramework) { + var csmPair = (function () { + function csmPair(key, value) { + this.first = key == undefined ? null : key; + this.second = value == undefined ? null : value; + } + return csmPair; + }()); + Live2DCubismFramework.csmPair = csmPair; + var csmMap = (function () { + function csmMap(size) { + if (size != undefined) { + if (size < 1) { + this._keyValues = []; + this._dummyValue = null; + this._size = 0; + } + else { + this._keyValues = new Array(size); + this._size = size; + } + } + else { + this._keyValues = []; + this._dummyValue = null; + this._size = 0; + } + } + csmMap.prototype.release = function () { + this.clear(); + }; + csmMap.prototype.appendKey = function (key) { + this.prepareCapacity(this._size + 1, false); + this._keyValues[this._size] = new csmPair(key); + this._size += 1; + }; + csmMap.prototype.getValue = function (key) { + var found = -1; + for (var i = 0; i < this._size; i++) { + if (this._keyValues[i].first == key) { + found = i; + break; + } + } + if (found >= 0) { + return this._keyValues[found].second; + } + else { + this.appendKey(key); + return this._keyValues[this._size - 1].second; + } + }; + csmMap.prototype.setValue = function (key, value) { + var found = -1; + for (var i = 0; i < this._size; i++) { + if (this._keyValues[i].first == key) { + found = i; + break; + } + } + if (found >= 0) { + this._keyValues[found].second = value; + } + else { + this.appendKey(key); + this._keyValues[this._size - 1].second = value; + } + }; + csmMap.prototype.isExist = function (key) { + for (var i = 0; i < this._size; i++) { + if (this._keyValues[i].first == key) { + return true; + } + } + return false; + }; + csmMap.prototype.clear = function () { + this._keyValues = void 0; + this._keyValues = null; + this._keyValues = []; + this._size = 0; + }; + csmMap.prototype.getSize = function () { + return this._size; + }; + csmMap.prototype.prepareCapacity = function (newSize, fitToSize) { + if (newSize > this._keyValues.length) { + if (this._keyValues.length == 0) { + if (!fitToSize && newSize < csmMap.DefaultSize) + newSize = csmMap.DefaultSize; + this._keyValues.length = newSize; + } + else { + if (!fitToSize && newSize < this._keyValues.length * 2) + newSize = this._keyValues.length * 2; + this._keyValues.length = newSize; + } + } + }; + csmMap.prototype.begin = function () { + var ite = new iterator(this, 0); + return ite; + }; + csmMap.prototype.end = function () { + var ite = new iterator(this, this._size); + return ite; + }; + csmMap.prototype.erase = function (ite) { + var index = ite._index; + if (index < 0 || this._size <= index) { + return ite; + } + this._keyValues.splice(index, 1); + --this._size; + var ite2 = new iterator(this, index); + return ite2; + }; + csmMap.prototype.dumpAsInt = function () { + for (var i = 0; i < this._size; i++) { + cubismdebug_1.CubismLogDebug('{0} ,', this._keyValues[i]); + cubismdebug_1.CubismLogDebug('\n'); + } + }; + csmMap.DefaultSize = 10; + return csmMap; + }()); + Live2DCubismFramework.csmMap = csmMap; + var iterator = (function () { + function iterator(v, idx) { + this._map = v != undefined ? v : new csmMap(); + this._index = idx != undefined ? idx : 0; + } + iterator.prototype.set = function (ite) { + this._index = ite._index; + this._map = ite._map; + return this; + }; + iterator.prototype.preIncrement = function () { + ++this._index; + return this; + }; + iterator.prototype.preDecrement = function () { + --this._index; + return this; + }; + iterator.prototype.increment = function () { + var iteold = new iterator(this._map, this._index++); + this._map = iteold._map; + this._index = iteold._index; + return this; + }; + iterator.prototype.decrement = function () { + var iteold = new iterator(this._map, this._index); + this._map = iteold._map; + this._index = iteold._index; + return this; + }; + iterator.prototype.ptr = function () { + return this._map._keyValues[this._index]; + }; + iterator.prototype.notEqual = function (ite) { + return this._index != ite._index || this._map != ite._map; + }; + return iterator; + }()); + Live2DCubismFramework.iterator = iterator; +})(Live2DCubismFramework = exports.Live2DCubismFramework || (exports.Live2DCubismFramework = {})); + + +/***/ }), + +/***/ "./Framework/src/type/csmrectf.ts": +/*!****************************************!*\ + !*** ./Framework/src/type/csmrectf.ts ***! + \****************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +var Live2DCubismFramework; +(function (Live2DCubismFramework) { + var csmRect = (function () { + function csmRect(x, y, w, h) { + this.x = x; + this.y = y; + this.width = w; + this.height = h; + } + csmRect.prototype.getCenterX = function () { + return this.x + 0.5 * this.width; + }; + csmRect.prototype.getCenterY = function () { + return this.y + 0.5 * this.height; + }; + csmRect.prototype.getRight = function () { + return this.x + this.width; + }; + csmRect.prototype.getBottom = function () { + return this.y + this.height; + }; + csmRect.prototype.setRect = function (r) { + this.x = r.x; + this.y = r.y; + this.width = r.width; + this.height = r.height; + }; + csmRect.prototype.expand = function (w, h) { + this.x -= w; + this.y -= h; + this.width += w * 2.0; + this.height += h * 2.0; + }; + return csmRect; + }()); + Live2DCubismFramework.csmRect = csmRect; +})(Live2DCubismFramework = exports.Live2DCubismFramework || (exports.Live2DCubismFramework = {})); + + +/***/ }), + +/***/ "./Framework/src/type/csmstring.ts": +/*!*****************************************!*\ + !*** ./Framework/src/type/csmstring.ts ***! + \*****************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +var Live2DCubismFramework; +(function (Live2DCubismFramework) { + var csmString = (function () { + function csmString(s) { + this.s = s; + } + csmString.prototype.append = function (c, length) { + this.s += length !== undefined ? c.substr(0, length) : c; + return this; + }; + csmString.prototype.expansion = function (length, v) { + for (var i = 0; i < length; i++) { + this.append(v); + } + return this; + }; + csmString.prototype.getBytes = function () { + return encodeURIComponent(this.s).replace(/%../g, 'x').length; + }; + csmString.prototype.getLength = function () { + return this.s.length; + }; + csmString.prototype.isLess = function (s) { + return this.s < s.s; + }; + csmString.prototype.isGreat = function (s) { + return this.s > s.s; + }; + csmString.prototype.isEqual = function (s) { + return this.s == s; + }; + csmString.prototype.isEmpty = function () { + return this.s.length == 0; + }; + return csmString; + }()); + Live2DCubismFramework.csmString = csmString; +})(Live2DCubismFramework = exports.Live2DCubismFramework || (exports.Live2DCubismFramework = {})); + + +/***/ }), + +/***/ "./Framework/src/type/csmvector.ts": +/*!*****************************************!*\ + !*** ./Framework/src/type/csmvector.ts ***! + \*****************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +var Live2DCubismFramework; +(function (Live2DCubismFramework) { + var csmVector = (function () { + function csmVector(initialCapacity) { + if (initialCapacity === void 0) { initialCapacity = 0; } + if (initialCapacity < 1) { + this._ptr = []; + this._capacity = 0; + this._size = 0; + } + else { + this._ptr = new Array(initialCapacity); + this._capacity = initialCapacity; + this._size = 0; + } + } + csmVector.prototype.at = function (index) { + return this._ptr[index]; + }; + csmVector.prototype.set = function (index, value) { + this._ptr[index] = value; + }; + csmVector.prototype.get = function (offset) { + if (offset === void 0) { offset = 0; } + var ret = new Array(); + for (var i = offset; i < this._size; i++) { + ret.push(this._ptr[i]); + } + return ret; + }; + csmVector.prototype.pushBack = function (value) { + if (this._size >= this._capacity) { + this.prepareCapacity(this._capacity == 0 ? csmVector.s_defaultSize : this._capacity * 2); + } + this._ptr[this._size++] = value; + }; + csmVector.prototype.clear = function () { + this._ptr.length = 0; + this._size = 0; + }; + csmVector.prototype.getSize = function () { + return this._size; + }; + csmVector.prototype.assign = function (newSize, value) { + var curSize = this._size; + if (curSize < newSize) { + this.prepareCapacity(newSize); + } + for (var i = 0; i < newSize; i++) { + this._ptr[i] = value; + } + this._size = newSize; + }; + csmVector.prototype.resize = function (newSize, value) { + if (value === void 0) { value = null; } + this.updateSize(newSize, value, true); + }; + csmVector.prototype.updateSize = function (newSize, value, callPlacementNew) { + if (value === void 0) { value = null; } + if (callPlacementNew === void 0) { callPlacementNew = true; } + var curSize = this._size; + if (curSize < newSize) { + this.prepareCapacity(newSize); + if (callPlacementNew) { + for (var i = this._size; i < newSize; i++) { + if (typeof value == 'function') { + this._ptr[i] = JSON.parse(JSON.stringify(new value())); + } + else { + this._ptr[i] = value; + } + } + } + else { + for (var i = this._size; i < newSize; i++) { + this._ptr[i] = value; + } + } + } + else { + var sub = this._size - newSize; + this._ptr.splice(this._size - sub, sub); + } + this._size = newSize; + }; + csmVector.prototype.insert = function (position, begin, end) { + var dstSi = position._index; + var srcSi = begin._index; + var srcEi = end._index; + var addCount = srcEi - srcSi; + this.prepareCapacity(this._size + addCount); + var addSize = this._size - dstSi; + if (addSize > 0) { + for (var i = 0; i < addSize; i++) { + this._ptr.splice(dstSi + i, 0, null); + } + } + for (var i = srcSi; i < srcEi; i++, dstSi++) { + this._ptr[dstSi] = begin._vector._ptr[i]; + } + this._size = this._size + addCount; + }; + csmVector.prototype.remove = function (index) { + if (index < 0 || this._size <= index) { + return false; + } + this._ptr.splice(index, 1); + --this._size; + return true; + }; + csmVector.prototype.erase = function (ite) { + var index = ite._index; + if (index < 0 || this._size <= index) { + return ite; + } + this._ptr.splice(index, 1); + --this._size; + var ite2 = new iterator(this, index); + return ite2; + }; + csmVector.prototype.prepareCapacity = function (newSize) { + if (newSize > this._capacity) { + if (this._capacity == 0) { + this._ptr = new Array(newSize); + this._capacity = newSize; + } + else { + this._ptr.length = newSize; + this._capacity = newSize; + } + } + }; + csmVector.prototype.begin = function () { + var ite = this._size == 0 ? this.end() : new iterator(this, 0); + return ite; + }; + csmVector.prototype.end = function () { + var ite = new iterator(this, this._size); + return ite; + }; + csmVector.prototype.getOffset = function (offset) { + var newVector = new csmVector(); + newVector._ptr = this.get(offset); + newVector._size = this.get(offset).length; + newVector._capacity = this.get(offset).length; + return newVector; + }; + csmVector.s_defaultSize = 10; + return csmVector; + }()); + Live2DCubismFramework.csmVector = csmVector; + var iterator = (function () { + function iterator(v, index) { + this._vector = v != undefined ? v : null; + this._index = index != undefined ? index : 0; + } + iterator.prototype.set = function (ite) { + this._index = ite._index; + this._vector = ite._vector; + return this; + }; + iterator.prototype.preIncrement = function () { + ++this._index; + return this; + }; + iterator.prototype.preDecrement = function () { + --this._index; + return this; + }; + iterator.prototype.increment = function () { + var iteold = new iterator(this._vector, this._index++); + this._vector = iteold._vector; + this._index = iteold._index; + return this; + }; + iterator.prototype.decrement = function () { + var iteold = new iterator(this._vector, this._index--); + this._vector = iteold._vector; + this._index = iteold._index; + return this; + }; + iterator.prototype.ptr = function () { + return this._vector._ptr[this._index]; + }; + iterator.prototype.substitution = function (ite) { + this._index = ite._index; + this._vector = ite._vector; + return this; + }; + iterator.prototype.notEqual = function (ite) { + return this._index != ite._index || this._vector != ite._vector; + }; + return iterator; + }()); + Live2DCubismFramework.iterator = iterator; +})(Live2DCubismFramework = exports.Live2DCubismFramework || (exports.Live2DCubismFramework = {})); + + +/***/ }), + +/***/ "./Framework/src/utils/cubismdebug.ts": +/*!********************************************!*\ + !*** ./Framework/src/utils/cubismdebug.ts ***! + \********************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +var live2dcubismframework_1 = __webpack_require__(/*! ../live2dcubismframework */ "./Framework/src/live2dcubismframework.ts"); +var cubismframeworkconfig_1 = __webpack_require__(/*! ../cubismframeworkconfig */ "./Framework/src/cubismframeworkconfig.ts"); +exports.CubismLogPrint = function (level, fmt, args) { + Live2DCubismFramework.CubismDebug.print(level, '[CSM]' + fmt, args); +}; +exports.CubismLogPrintIn = function (level, fmt, args) { + exports.CubismLogPrint(level, fmt + '\n', args); +}; +exports.CSM_ASSERT = function (expr) { + console.assert(expr); +}; +if (cubismframeworkconfig_1.CSM_LOG_LEVEL <= cubismframeworkconfig_1.CSM_LOG_LEVEL_VERBOSE) { + exports.CubismLogVerbose = function (fmt) { + var args = []; + for (var _i = 1; _i < arguments.length; _i++) { + args[_i - 1] = arguments[_i]; + } + exports.CubismLogPrintIn(live2dcubismframework_1.LogLevel.LogLevel_Verbose, '[V]' + fmt, args); + }; + exports.CubismLogDebug = function (fmt) { + var args = []; + for (var _i = 1; _i < arguments.length; _i++) { + args[_i - 1] = arguments[_i]; + } + exports.CubismLogPrintIn(live2dcubismframework_1.LogLevel.LogLevel_Debug, '[D]' + fmt, args); + }; + exports.CubismLogInfo = function (fmt) { + var args = []; + for (var _i = 1; _i < arguments.length; _i++) { + args[_i - 1] = arguments[_i]; + } + exports.CubismLogPrintIn(live2dcubismframework_1.LogLevel.LogLevel_Info, '[I]' + fmt, args); + }; + exports.CubismLogWarning = function (fmt) { + var args = []; + for (var _i = 1; _i < arguments.length; _i++) { + args[_i - 1] = arguments[_i]; + } + exports.CubismLogPrintIn(live2dcubismframework_1.LogLevel.LogLevel_Warning, '[W]' + fmt, args); + }; + exports.CubismLogError = function (fmt) { + var args = []; + for (var _i = 1; _i < arguments.length; _i++) { + args[_i - 1] = arguments[_i]; + } + exports.CubismLogPrintIn(live2dcubismframework_1.LogLevel.LogLevel_Error, '[E]' + fmt, args); + }; +} +else if (cubismframeworkconfig_1.CSM_LOG_LEVEL == cubismframeworkconfig_1.CSM_LOG_LEVEL_DEBUG) { + exports.CubismLogDebug = function (fmt) { + var args = []; + for (var _i = 1; _i < arguments.length; _i++) { + args[_i - 1] = arguments[_i]; + } + exports.CubismLogPrintIn(live2dcubismframework_1.LogLevel.LogLevel_Debug, '[D]' + fmt, args); + }; + exports.CubismLogInfo = function (fmt) { + var args = []; + for (var _i = 1; _i < arguments.length; _i++) { + args[_i - 1] = arguments[_i]; + } + exports.CubismLogPrintIn(live2dcubismframework_1.LogLevel.LogLevel_Info, '[I]' + fmt, args); + }; + exports.CubismLogWarning = function (fmt) { + var args = []; + for (var _i = 1; _i < arguments.length; _i++) { + args[_i - 1] = arguments[_i]; + } + exports.CubismLogPrintIn(live2dcubismframework_1.LogLevel.LogLevel_Warning, '[W]' + fmt, args); + }; + exports.CubismLogError = function (fmt) { + var args = []; + for (var _i = 1; _i < arguments.length; _i++) { + args[_i - 1] = arguments[_i]; + } + exports.CubismLogPrintIn(live2dcubismframework_1.LogLevel.LogLevel_Error, '[E]' + fmt, args); + }; +} +else if (cubismframeworkconfig_1.CSM_LOG_LEVEL == cubismframeworkconfig_1.CSM_LOG_LEVEL_INFO) { + exports.CubismLogInfo = function (fmt) { + var args = []; + for (var _i = 1; _i < arguments.length; _i++) { + args[_i - 1] = arguments[_i]; + } + exports.CubismLogPrintIn(live2dcubismframework_1.LogLevel.LogLevel_Info, '[I]' + fmt, args); + }; + exports.CubismLogWarning = function (fmt) { + var args = []; + for (var _i = 1; _i < arguments.length; _i++) { + args[_i - 1] = arguments[_i]; + } + exports.CubismLogPrintIn(live2dcubismframework_1.LogLevel.LogLevel_Warning, '[W]' + fmt, args); + }; + exports.CubismLogError = function (fmt) { + var args = []; + for (var _i = 1; _i < arguments.length; _i++) { + args[_i - 1] = arguments[_i]; + } + exports.CubismLogPrintIn(live2dcubismframework_1.LogLevel.LogLevel_Error, '[E]' + fmt, args); + }; +} +else if (cubismframeworkconfig_1.CSM_LOG_LEVEL == cubismframeworkconfig_1.CSM_LOG_LEVEL_WARNING) { + exports.CubismLogWarning = function (fmt) { + var args = []; + for (var _i = 1; _i < arguments.length; _i++) { + args[_i - 1] = arguments[_i]; + } + exports.CubismLogPrintIn(live2dcubismframework_1.LogLevel.LogLevel_Warning, '[W]' + fmt, args); + }; + exports.CubismLogError = function (fmt) { + var args = []; + for (var _i = 1; _i < arguments.length; _i++) { + args[_i - 1] = arguments[_i]; + } + exports.CubismLogPrintIn(live2dcubismframework_1.LogLevel.LogLevel_Error, '[E]' + fmt, args); + }; +} +else if (cubismframeworkconfig_1.CSM_LOG_LEVEL == cubismframeworkconfig_1.CSM_LOG_LEVEL_ERROR) { + exports.CubismLogError = function (fmt) { + var args = []; + for (var _i = 1; _i < arguments.length; _i++) { + args[_i - 1] = arguments[_i]; + } + exports.CubismLogPrintIn(live2dcubismframework_1.LogLevel.LogLevel_Error, '[E]' + fmt, args); + }; +} +var Live2DCubismFramework; +(function (Live2DCubismFramework) { + var CubismDebug = (function () { + function CubismDebug() { + } + CubismDebug.print = function (logLevel, format, args) { + if (logLevel < live2dcubismframework_1.Live2DCubismFramework.CubismFramework.getLoggingLevel()) { + return; + } + var logPrint = live2dcubismframework_1.Live2DCubismFramework.CubismFramework.coreLogFunction; + if (!logPrint) + return; + var buffer = format.replace(/\{(\d+)\}/g, function (m, k) { + return args[k]; + }); + logPrint(buffer); + }; + CubismDebug.dumpBytes = function (logLevel, data, length) { + for (var i = 0; i < length; i++) { + if (i % 16 == 0 && i > 0) + this.print(logLevel, '\n'); + else if (i % 8 == 0 && i > 0) + this.print(logLevel, ' '); + this.print(logLevel, '{0} ', [data[i] & 0xff]); + } + this.print(logLevel, '\n'); + }; + return CubismDebug; + }()); + Live2DCubismFramework.CubismDebug = CubismDebug; +})(Live2DCubismFramework = exports.Live2DCubismFramework || (exports.Live2DCubismFramework = {})); + + +/***/ }), + +/***/ "./Framework/src/utils/cubismjson.ts": +/*!*******************************************!*\ + !*** ./Framework/src/utils/cubismjson.ts ***! + \*******************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +var csmstring_1 = __webpack_require__(/*! ../type/csmstring */ "./Framework/src/type/csmstring.ts"); +var csmmap_1 = __webpack_require__(/*! ../type/csmmap */ "./Framework/src/type/csmmap.ts"); +var csmvector_1 = __webpack_require__(/*! ../type/csmvector */ "./Framework/src/type/csmvector.ts"); +var cubismdebug_1 = __webpack_require__(/*! ./cubismdebug */ "./Framework/src/utils/cubismdebug.ts"); +var live2dcubismframework_1 = __webpack_require__(/*! ../live2dcubismframework */ "./Framework/src/live2dcubismframework.ts"); +var csmVector = csmvector_1.Live2DCubismFramework.csmVector; +var csmMap = csmmap_1.Live2DCubismFramework.csmMap; +var csmString = csmstring_1.Live2DCubismFramework.csmString; +var Live2DCubismFramework; +(function (Live2DCubismFramework) { + var CSM_JSON_ERROR_TYPE_MISMATCH = 'Error: type mismatch'; + var CSM_JSON_ERROR_INDEX_OF_BOUNDS = 'Error: index out of bounds'; + var Value = (function () { + function Value() { + } + Value.prototype.getRawString = function (defaultValue, indent) { + return this.getString(defaultValue, indent); + }; + Value.prototype.toInt = function (defaultValue) { + if (defaultValue === void 0) { defaultValue = 0; } + return defaultValue; + }; + Value.prototype.toFloat = function (defaultValue) { + if (defaultValue === void 0) { defaultValue = 0; } + return defaultValue; + }; + Value.prototype.toBoolean = function (defaultValue) { + if (defaultValue === void 0) { defaultValue = false; } + return defaultValue; + }; + Value.prototype.getSize = function () { + return 0; + }; + Value.prototype.getArray = function (defaultValue) { + if (defaultValue === void 0) { defaultValue = null; } + return defaultValue; + }; + Value.prototype.getVector = function (defaultValue) { + return defaultValue; + }; + Value.prototype.getMap = function (defaultValue) { + return defaultValue; + }; + Value.prototype.getValueByIndex = function (index) { + return Value.errorValue.setErrorNotForClientCall(CSM_JSON_ERROR_TYPE_MISMATCH); + }; + Value.prototype.getValueByString = function (s) { + return Value.nullValue.setErrorNotForClientCall(CSM_JSON_ERROR_TYPE_MISMATCH); + }; + Value.prototype.getKeys = function () { + return Value.s_dummyKeys; + }; + Value.prototype.isError = function () { + return false; + }; + Value.prototype.isNull = function () { + return false; + }; + Value.prototype.isBool = function () { + return false; + }; + Value.prototype.isFloat = function () { + return false; + }; + Value.prototype.isString = function () { + return false; + }; + Value.prototype.isArray = function () { + return false; + }; + Value.prototype.isMap = function () { + return false; + }; + Value.prototype.equals = function (value) { + return false; + }; + Value.prototype.isStatic = function () { + return false; + }; + Value.prototype.setErrorNotForClientCall = function (errorStr) { + return JsonError.errorValue; + }; + Value.staticInitializeNotForClientCall = function () { + JsonBoolean.trueValue = new JsonBoolean(true); + JsonBoolean.falseValue = new JsonBoolean(false); + JsonError.errorValue = new JsonError('ERROR', true); + this.nullValue = new JsonNullvalue(); + Value.s_dummyKeys = new csmVector(); + }; + Value.staticReleaseNotForClientCall = function () { + JsonBoolean.trueValue = null; + JsonBoolean.falseValue = null; + JsonError.errorValue = null; + Value.nullValue = null; + Value.s_dummyKeys = null; + JsonBoolean.trueValue = null; + JsonBoolean.falseValue = null; + JsonError.errorValue = null; + Value.nullValue = null; + Value.s_dummyKeys = null; + }; + return Value; + }()); + Live2DCubismFramework.Value = Value; + var CubismJson = (function () { + function CubismJson(buffer, length) { + this._error = null; + this._lineCount = 0; + this._root = null; + if (buffer != undefined) { + this.parseBytes(buffer, length); + } + } + CubismJson.create = function (buffer, size) { + var json = new CubismJson(); + var succeeded = json.parseBytes(buffer, size); + if (!succeeded) { + CubismJson.delete(json); + return null; + } + else { + return json; + } + }; + CubismJson.delete = function (instance) { + instance = null; + }; + CubismJson.prototype.getRoot = function () { + return this._root; + }; + CubismJson.prototype.arrayBufferToString = function (buffer) { + var uint8Array = new Uint8Array(buffer); + var str = ''; + for (var i = 0, len = uint8Array.length; i < len; ++i) { + str += '%' + this.pad(uint8Array[i].toString(16)); + } + str = decodeURIComponent(str); + return str; + }; + CubismJson.prototype.pad = function (n) { + return n.length < 2 ? '0' + n : n; + }; + CubismJson.prototype.parseBytes = function (buffer, size) { + var endPos = new Array(1); + var decodeBuffer = this.arrayBufferToString(buffer); + this._root = this.parseValue(decodeBuffer, size, 0, endPos); + if (this._error) { + var strbuf = '\0'; + strbuf = 'Json parse error : @line ' + (this._lineCount + 1) + '\n'; + this._root = new JsonString(strbuf); + cubismdebug_1.CubismLogInfo('{0}', this._root.getRawString()); + return false; + } + else if (this._root == null) { + this._root = new JsonError(new csmString(this._error), false); + return false; + } + return true; + }; + CubismJson.prototype.getParseError = function () { + return this._error; + }; + CubismJson.prototype.checkEndOfFile = function () { + return this._root.getArray()[1].equals('EOF'); + }; + CubismJson.prototype.parseValue = function (buffer, length, begin, outEndPos) { + if (this._error) + return null; + var o = null; + var i = begin; + var f; + for (; i < length; i++) { + var c = buffer[i]; + switch (c) { + case '-': + case '.': + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': { + var afterString = new Array(1); + f = live2dcubismframework_1.strtod(buffer.slice(i), afterString); + outEndPos[0] = buffer.indexOf(afterString[0]); + return new JsonFloat(f); + } + case '"': + return new JsonString(this.parseString(buffer, length, i + 1, outEndPos)); + case '[': + o = this.parseArray(buffer, length, i + 1, outEndPos); + return o; + case '{': + o = this.parseObject(buffer, length, i + 1, outEndPos); + return o; + case 'n': + if (i + 3 < length) { + o = new JsonNullvalue(); + outEndPos[0] = i + 4; + } + else { + this._error = 'parse null'; + } + return o; + case 't': + if (i + 3 < length) { + o = JsonBoolean.trueValue; + outEndPos[0] = i + 4; + } + else { + this._error = 'parse true'; + } + return o; + case 'f': + if (i + 4 < length) { + o = JsonBoolean.falseValue; + outEndPos[0] = i + 5; + } + else { + this._error = "illegal ',' position"; + } + return o; + case ',': + this._error = "illegal ',' position"; + return null; + case ']': + outEndPos[0] = i; + return null; + case '\n': + this._lineCount++; + case ' ': + case '\t': + case '\r': + default: + break; + } + } + this._error = 'illegal end of value'; + return null; + }; + CubismJson.prototype.parseString = function (string, length, begin, outEndPos) { + if (this._error) + return null; + var i = begin; + var c, c2; + var ret = new csmString(''); + var bufStart = begin; + for (; i < length; i++) { + c = string[i]; + switch (c) { + case '"': { + outEndPos[0] = i + 1; + ret.append(string.slice(bufStart), i - bufStart); + return ret.s; + } + case '//': { + i++; + if (i - 1 > bufStart) { + ret.append(string.slice(bufStart), i - bufStart); + } + bufStart = i + 1; + if (i < length) { + c2 = string[i]; + switch (c2) { + case '\\': + ret.expansion(1, '\\'); + break; + case '"': + ret.expansion(1, '"'); + break; + case '/': + ret.expansion(1, '/'); + break; + case 'b': + ret.expansion(1, '\b'); + break; + case 'f': + ret.expansion(1, '\f'); + break; + case 'n': + ret.expansion(1, '\n'); + break; + case 'r': + ret.expansion(1, '\r'); + break; + case 't': + ret.expansion(1, '\t'); + break; + case 'u': + this._error = 'parse string/unicord escape not supported'; + break; + default: + break; + } + } + else { + this._error = 'parse string/escape error'; + } + } + default: { + break; + } + } + } + this._error = 'parse string/illegal end'; + return null; + }; + CubismJson.prototype.parseObject = function (buffer, length, begin, outEndPos) { + if (this._error) + return null; + var ret = new JsonMap(); + var key = ''; + var i = begin; + var c = ''; + var localRetEndPos2 = Array(1); + var ok = false; + for (; i < length; i++) { + FOR_LOOP: for (; i < length; i++) { + c = buffer[i]; + switch (c) { + case '"': + key = this.parseString(buffer, length, i + 1, localRetEndPos2); + if (this._error) { + return null; + } + i = localRetEndPos2[0]; + ok = true; + break FOR_LOOP; + case '}': + outEndPos[0] = i + 1; + return ret; + case ':': + this._error = "illegal ':' position"; + break; + case '\n': + this._lineCount++; + default: + break; + } + } + if (!ok) { + this._error = 'key not found'; + return null; + } + ok = false; + FOR_LOOP2: for (; i < length; i++) { + c = buffer[i]; + switch (c) { + case ':': + ok = true; + i++; + break FOR_LOOP2; + case '}': + this._error = "illegal '}' position"; + break; + case '\n': + this._lineCount++; + default: + break; + } + } + if (!ok) { + this._error = "':' not found"; + return null; + } + var value = this.parseValue(buffer, length, i, localRetEndPos2); + if (this._error) { + return null; + } + i = localRetEndPos2[0]; + ret.put(key, value); + FOR_LOOP3: for (; i < length; i++) { + c = buffer[i]; + switch (c) { + case ',': + break FOR_LOOP3; + case '}': + outEndPos[0] = i + 1; + return ret; + case '\n': + this._lineCount++; + default: + break; + } + } + } + this._error = 'illegal end of perseObject'; + return null; + }; + CubismJson.prototype.parseArray = function (buffer, length, begin, outEndPos) { + if (this._error) + return null; + var ret = new JsonArray(); + var i = begin; + var c; + var localRetEndpos2 = new Array(1); + for (; i < length; i++) { + var value = this.parseValue(buffer, length, i, localRetEndpos2); + if (this._error) { + return null; + } + i = localRetEndpos2[0]; + if (value) { + ret.add(value); + } + FOR_LOOP: for (; i < length; i++) { + c = buffer[i]; + switch (c) { + case ',': + break FOR_LOOP; + case ']': + outEndPos[0] = i + 1; + return ret; + case '\n': + ++this._lineCount; + default: + break; + } + } + } + ret = void 0; + this._error = 'illegal end of parseObject'; + return null; + }; + return CubismJson; + }()); + Live2DCubismFramework.CubismJson = CubismJson; + var JsonFloat = (function (_super) { + __extends(JsonFloat, _super); + function JsonFloat(v) { + var _this = _super.call(this) || this; + _this._value = v; + return _this; + } + JsonFloat.prototype.isFloat = function () { + return true; + }; + JsonFloat.prototype.getString = function (defaultValue, indent) { + var strbuf = '\0'; + this._value = parseFloat(strbuf); + this._stringBuffer = strbuf; + return this._stringBuffer; + }; + JsonFloat.prototype.toInt = function (defaultValue) { + if (defaultValue === void 0) { defaultValue = 0; } + return parseInt(this._value.toString()); + }; + JsonFloat.prototype.toFloat = function (defaultValue) { + if (defaultValue === void 0) { defaultValue = 0.0; } + return this._value; + }; + JsonFloat.prototype.equals = function (value) { + if ('number' === typeof value) { + if (Math.round(value)) { + return false; + } + else { + return value == this._value; + } + } + return false; + }; + return JsonFloat; + }(Value)); + Live2DCubismFramework.JsonFloat = JsonFloat; + var JsonBoolean = (function (_super) { + __extends(JsonBoolean, _super); + function JsonBoolean(v) { + var _this = _super.call(this) || this; + _this._boolValue = v; + return _this; + } + JsonBoolean.prototype.isBool = function () { + return true; + }; + JsonBoolean.prototype.toBoolean = function (defaultValue) { + if (defaultValue === void 0) { defaultValue = false; } + return this._boolValue; + }; + JsonBoolean.prototype.getString = function (defaultValue, indent) { + this._stringBuffer = this._boolValue ? 'true' : 'false'; + return this._stringBuffer; + }; + JsonBoolean.prototype.equals = function (value) { + if ('boolean' === typeof value) { + return value == this._boolValue; + } + return false; + }; + JsonBoolean.prototype.isStatic = function () { + return true; + }; + return JsonBoolean; + }(Value)); + Live2DCubismFramework.JsonBoolean = JsonBoolean; + var JsonString = (function (_super) { + __extends(JsonString, _super); + function JsonString(s) { + var _this = _super.call(this) || this; + if ('string' === typeof s) { + _this._stringBuffer = s; + } + if (s instanceof csmString) { + _this._stringBuffer = s.s; + } + return _this; + } + JsonString.prototype.isString = function () { + return true; + }; + JsonString.prototype.getString = function (defaultValue, indent) { + return this._stringBuffer; + }; + JsonString.prototype.equals = function (value) { + if ('string' === typeof value) { + return this._stringBuffer == value; + } + if (value instanceof csmString) { + return this._stringBuffer == value.s; + } + return false; + }; + return JsonString; + }(Value)); + Live2DCubismFramework.JsonString = JsonString; + var JsonError = (function (_super) { + __extends(JsonError, _super); + function JsonError(s, isStatic) { + var _this = this; + if ('string' === typeof s) { + _this = _super.call(this, s) || this; + } + else { + _this = _super.call(this, s) || this; + } + _this._isStatic = isStatic; + return _this; + } + JsonError.prototype.isStatic = function () { + return this._isStatic; + }; + JsonError.prototype.setErrorNotForClientCall = function (s) { + this._stringBuffer = s; + return this; + }; + JsonError.prototype.isError = function () { + return true; + }; + return JsonError; + }(JsonString)); + Live2DCubismFramework.JsonError = JsonError; + var JsonNullvalue = (function (_super) { + __extends(JsonNullvalue, _super); + function JsonNullvalue() { + var _this = _super.call(this) || this; + _this._stringBuffer = 'NullValue'; + return _this; + } + JsonNullvalue.prototype.isNull = function () { + return true; + }; + JsonNullvalue.prototype.getString = function (defaultValue, indent) { + return this._stringBuffer; + }; + JsonNullvalue.prototype.isStatic = function () { + return true; + }; + return JsonNullvalue; + }(Value)); + Live2DCubismFramework.JsonNullvalue = JsonNullvalue; + var JsonArray = (function (_super) { + __extends(JsonArray, _super); + function JsonArray() { + var _this = _super.call(this) || this; + _this._array = new csmVector(); + return _this; + } + JsonArray.prototype.release = function () { + for (var ite = this._array.begin(); ite.notEqual(this._array.end()); ite.preIncrement()) { + var v = ite.ptr(); + if (v && !v.isStatic()) { + v = void 0; + v = null; + } + } + }; + JsonArray.prototype.isArray = function () { + return true; + }; + JsonArray.prototype.getValueByIndex = function (index) { + if (index < 0 || this._array.getSize() <= index) { + return Value.errorValue.setErrorNotForClientCall(CSM_JSON_ERROR_INDEX_OF_BOUNDS); + } + var v = this._array.at(index); + if (v == null) { + return Value.nullValue; + } + return v; + }; + JsonArray.prototype.getValueByString = function (s) { + return Value.errorValue.setErrorNotForClientCall(CSM_JSON_ERROR_TYPE_MISMATCH); + }; + JsonArray.prototype.getString = function (defaultValue, indent) { + var stringBuffer = indent + '[\n'; + for (var ite = this._array.begin(); ite.notEqual(this._array.end()); ite.increment()) { + var v = ite.ptr(); + this._stringBuffer += indent + '' + v.getString(indent + ' ') + '\n'; + } + this._stringBuffer = stringBuffer + indent + ']\n'; + return this._stringBuffer; + }; + JsonArray.prototype.add = function (v) { + this._array.pushBack(v); + }; + JsonArray.prototype.getVector = function (defaultValue) { + if (defaultValue === void 0) { defaultValue = null; } + return this._array; + }; + JsonArray.prototype.getSize = function () { + return this._array.getSize(); + }; + return JsonArray; + }(Value)); + Live2DCubismFramework.JsonArray = JsonArray; + var JsonMap = (function (_super) { + __extends(JsonMap, _super); + function JsonMap() { + var _this = _super.call(this) || this; + _this._map = new csmMap(); + return _this; + } + JsonMap.prototype.release = function () { + var ite = this._map.begin(); + while (ite.notEqual(this._map.end())) { + var v = ite.ptr().second; + if (v && !v.isStatic()) { + v = void 0; + v = null; + } + ite.preIncrement(); + } + }; + JsonMap.prototype.isMap = function () { + return true; + }; + JsonMap.prototype.getValueByString = function (s) { + if (s instanceof csmString) { + var ret = this._map.getValue(s.s); + if (ret == null) { + return Value.nullValue; + } + return ret; + } + for (var iter = this._map.begin(); iter.notEqual(this._map.end()); iter.preIncrement()) { + if (iter.ptr().first == s) { + if (iter.ptr().second == null) { + return Value.nullValue; + } + return iter.ptr().second; + } + } + return Value.nullValue; + }; + JsonMap.prototype.getValueByIndex = function (index) { + return Value.errorValue.setErrorNotForClientCall(CSM_JSON_ERROR_TYPE_MISMATCH); + }; + JsonMap.prototype.getString = function (defaultValue, indent) { + this._stringBuffer = indent + '{\n'; + var ite = this._map.begin(); + while (ite.notEqual(this._map.end())) { + var key = ite.ptr().first; + var v = ite.ptr().second; + this._stringBuffer += + indent + ' ' + key + ' : ' + v.getString(indent + ' ') + ' \n'; + ite.preIncrement(); + } + this._stringBuffer += indent + '}\n'; + return this._stringBuffer; + }; + JsonMap.prototype.getMap = function (defaultValue) { + return this._map; + }; + JsonMap.prototype.put = function (key, v) { + this._map.setValue(key, v); + }; + JsonMap.prototype.getKeys = function () { + if (!this._keys) { + this._keys = new csmVector(); + var ite = this._map.begin(); + while (ite.notEqual(this._map.end())) { + var key = ite.ptr().first; + this._keys.pushBack(key); + ite.preIncrement(); + } + } + return this._keys; + }; + JsonMap.prototype.getSize = function () { + return this._keys.getSize(); + }; + return JsonMap; + }(Value)); + Live2DCubismFramework.JsonMap = JsonMap; +})(Live2DCubismFramework = exports.Live2DCubismFramework || (exports.Live2DCubismFramework = {})); + + +/***/ }), + +/***/ "./example/src/App.js": +/*!****************************!*\ + !*** ./example/src/App.js ***! + \****************************/ +/*! exports provided: default */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); +/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _src_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../src/index.js */ "./src/index.js"); +function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } + +function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } + +function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } + +function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } + +function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } + +function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } + + + + +function App(props) { + var _useState = Object(react__WEBPACK_IMPORTED_MODULE_0__["useState"])(false), + _useState2 = _slicedToArray(_useState, 2), + release = _useState2[0], + setRelease = _useState2[1]; + + function handleClick() { + setRelease(true); + props.history.push({ + pathname: "/Other" + }); + } + + Object(react__WEBPACK_IMPORTED_MODULE_0__["useEffect"])(function () {}, []); + return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", null, "liv2d"), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("button", { + type: "button", + onClick: handleClick + }, "Go normal page test"), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_src_index_js__WEBPACK_IMPORTED_MODULE_1__["default"], { + width: 300, + height: 500, + bottom: '10px', + right: '10px', + ModelList: ['Haru', 'Hiyori'], + TouchBody: ['啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊你要干嘛', '哼', '坏人'], + release: release + })); +} + +; +/* harmony default export */ __webpack_exports__["default"] = (App); + +/***/ }), + +/***/ "./example/src/Other.js": +/*!******************************!*\ + !*** ./example/src/Other.js ***! + \******************************/ +/*! exports provided: default */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); +/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); + + +function Other(props) { + function handleClick() { + props.history.push({ + pathname: "/" + }); + } + + return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", { + className: "App" + }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", null, "\u5176\u4ED6\u666E\u901A\u9875\u9762"), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("button", { + type: "button", + onClick: handleClick + }, "Go to the Live2d components page")); +} + +/* harmony default export */ __webpack_exports__["default"] = (Other); + +/***/ }), + +/***/ "./example/src/index.js": +/*!******************************!*\ + !*** ./example/src/index.js ***! + \******************************/ +/*! exports provided: default */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); +/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react-dom */ "./node_modules/react-dom/index.js"); +/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react_dom__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var react_router_dom__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react-router-dom */ "./node_modules/react-router-dom/esm/react-router-dom.js"); +/* harmony import */ var _App__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./App */ "./example/src/App.js"); +/* harmony import */ var _Other__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./Other */ "./example/src/Other.js"); + + + + + + +function Main() { + return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react_router_dom__WEBPACK_IMPORTED_MODULE_2__["BrowserRouter"], null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react_router_dom__WEBPACK_IMPORTED_MODULE_2__["Route"], { + path: "/", + exact: true, + component: _App__WEBPACK_IMPORTED_MODULE_3__["default"] + }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react_router_dom__WEBPACK_IMPORTED_MODULE_2__["Route"], { + path: "/Other", + exact: true, + component: _Other__WEBPACK_IMPORTED_MODULE_4__["default"] + })); +} + +/* harmony default export */ __webpack_exports__["default"] = (Main); +react_dom__WEBPACK_IMPORTED_MODULE_1___default.a.render( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(Main, null), document.getElementById('root')); + +/***/ }), + +/***/ "./node_modules/@babel/runtime/helpers/esm/extends.js": +/*!************************************************************!*\ + !*** ./node_modules/@babel/runtime/helpers/esm/extends.js ***! + \************************************************************/ +/*! exports provided: default */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return _extends; }); +function _extends() { + _extends = Object.assign || function (target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i]; + + for (var key in source) { + if (Object.prototype.hasOwnProperty.call(source, key)) { + target[key] = source[key]; + } + } + } + + return target; + }; + + return _extends.apply(this, arguments); +} + +/***/ }), + +/***/ "./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js": +/*!******************************************************************!*\ + !*** ./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js ***! + \******************************************************************/ +/*! exports provided: default */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return _inheritsLoose; }); +function _inheritsLoose(subClass, superClass) { + subClass.prototype = Object.create(superClass.prototype); + subClass.prototype.constructor = subClass; + subClass.__proto__ = superClass; +} + +/***/ }), + +/***/ "./node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js": +/*!*********************************************************************************!*\ + !*** ./node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js ***! + \*********************************************************************************/ +/*! exports provided: default */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return _objectWithoutPropertiesLoose; }); +function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + + for (i = 0; i < sourceKeys.length; i++) { + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + + return target; +} + +/***/ }), + +/***/ "./node_modules/ansi-html/index.js": +/*!*****************************************!*\ + !*** ./node_modules/ansi-html/index.js ***! + \*****************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +module.exports = ansiHTML + +// Reference to https://github.com/sindresorhus/ansi-regex +var _regANSI = /(?:(?:\u001b\[)|\u009b)(?:(?:[0-9]{1,3})?(?:(?:;[0-9]{0,3})*)?[A-M|f-m])|\u001b[A-M]/ + +var _defColors = { + reset: ['fff', '000'], // [FOREGROUD_COLOR, BACKGROUND_COLOR] + black: '000', + red: 'ff0000', + green: '209805', + yellow: 'e8bf03', + blue: '0000ff', + magenta: 'ff00ff', + cyan: '00ffee', + lightgrey: 'f0f0f0', + darkgrey: '888' +} +var _styles = { + 30: 'black', + 31: 'red', + 32: 'green', + 33: 'yellow', + 34: 'blue', + 35: 'magenta', + 36: 'cyan', + 37: 'lightgrey' +} +var _openTags = { + '1': 'font-weight:bold', // bold + '2': 'opacity:0.5', // dim + '3': '', // italic + '4': '', // underscore + '8': 'display:none', // hidden + '9': '' // delete +} +var _closeTags = { + '23': '', // reset italic + '24': '', // reset underscore + '29': '' // reset delete +} + +;[0, 21, 22, 27, 28, 39, 49].forEach(function (n) { + _closeTags[n] = '' +}) + +/** + * Converts text with ANSI color codes to HTML markup. + * @param {String} text + * @returns {*} + */ +function ansiHTML (text) { + // Returns the text if the string has no ANSI escape code. + if (!_regANSI.test(text)) { + return text + } + + // Cache opened sequence. + var ansiCodes = [] + // Replace with markup. + var ret = text.replace(/\033\[(\d+)*m/g, function (match, seq) { + var ot = _openTags[seq] + if (ot) { + // If current sequence has been opened, close it. + if (!!~ansiCodes.indexOf(seq)) { // eslint-disable-line no-extra-boolean-cast + ansiCodes.pop() + return '' + } + // Open tag. + ansiCodes.push(seq) + return ot[0] === '<' ? ot : '' + } + + var ct = _closeTags[seq] + if (ct) { + // Pop sequence + ansiCodes.pop() + return ct + } + return '' + }) + + // Make sure tags are closed. + var l = ansiCodes.length + ;(l > 0) && (ret += Array(l + 1).join('')) + + return ret +} + +/** + * Customize colors. + * @param {Object} colors reference to _defColors + */ +ansiHTML.setColors = function (colors) { + if (typeof colors !== 'object') { + throw new Error('`colors` parameter must be an Object.') + } + + var _finalColors = {} + for (var key in _defColors) { + var hex = colors.hasOwnProperty(key) ? colors[key] : null + if (!hex) { + _finalColors[key] = _defColors[key] + continue + } + if ('reset' === key) { + if (typeof hex === 'string') { + hex = [hex] + } + if (!Array.isArray(hex) || hex.length === 0 || hex.some(function (h) { + return typeof h !== 'string' + })) { + throw new Error('The value of `' + key + '` property must be an Array and each item could only be a hex string, e.g.: FF0000') + } + var defHexColor = _defColors[key] + if (!hex[0]) { + hex[0] = defHexColor[0] + } + if (hex.length === 1 || !hex[1]) { + hex = [hex[0]] + hex.push(defHexColor[1]) + } + + hex = hex.slice(0, 2) + } else if (typeof hex !== 'string') { + throw new Error('The value of `' + key + '` property must be a hex string, e.g.: FF0000') + } + _finalColors[key] = hex + } + _setTags(_finalColors) +} + +/** + * Reset colors. + */ +ansiHTML.reset = function () { + _setTags(_defColors) +} + +/** + * Expose tags, including open and close. + * @type {Object} + */ +ansiHTML.tags = {} + +if (Object.defineProperty) { + Object.defineProperty(ansiHTML.tags, 'open', { + get: function () { return _openTags } + }) + Object.defineProperty(ansiHTML.tags, 'close', { + get: function () { return _closeTags } + }) +} else { + ansiHTML.tags.open = _openTags + ansiHTML.tags.close = _closeTags +} + +function _setTags (colors) { + // reset all + _openTags['0'] = 'font-weight:normal;opacity:1;color:#' + colors.reset[0] + ';background:#' + colors.reset[1] + // inverse + _openTags['7'] = 'color:#' + colors.reset[1] + ';background:#' + colors.reset[0] + // dark grey + _openTags['90'] = 'color:#' + colors.darkgrey + + for (var code in _styles) { + var color = _styles[code] + var oriColor = colors[color] || '000' + _openTags[code] = 'color:#' + oriColor + code = parseInt(code) + _openTags[(code + 10).toString()] = 'background:#' + oriColor + } +} + +ansiHTML.reset() + + +/***/ }), + +/***/ "./node_modules/css-loader/dist/cjs.js!./src/asset/index.css": +/*!*******************************************************************!*\ + !*** ./node_modules/css-loader/dist/cjs.js!./src/asset/index.css ***! + \*******************************************************************/ +/*! exports provided: default */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../node_modules/css-loader/dist/runtime/api.js */ "./node_modules/css-loader/dist/runtime/api.js"); +/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0__); +// Imports + +var ___CSS_LOADER_EXPORT___ = _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0___default()(true); +// Module +___CSS_LOADER_EXPORT___.push([module.i, "@font-face {\r\n font-family: 'iconfont'; /* project id 1168737 */\r\n src: url('//at.alicdn.com/t/font_1168737_j6ahlsx1dk.eot');\r\n src: url('//at.alicdn.com/t/font_1168737_j6ahlsx1dk.eot?#iefix') format('embedded-opentype'),\r\n url('//at.alicdn.com/t/font_1168737_j6ahlsx1dk.woff2') format('woff2'),\r\n url('//at.alicdn.com/t/font_1168737_j6ahlsx1dk.woff') format('woff'),\r\n url('//at.alicdn.com/t/font_1168737_j6ahlsx1dk.ttf') format('truetype'),\r\n url('//at.alicdn.com/t/font_1168737_j6ahlsx1dk.svg#iconfont') format('svg');\r\n }\r\n\r\n.iconfont{\r\n font-family:\"iconfont\" !important;\r\n font-size:16px;font-style:normal;\r\n -webkit-font-smoothing: antialiased;\r\n -webkit-text-stroke-width: 0.2px;\r\n -moz-osx-font-smoothing: grayscale;\r\n cursor: pointer;\r\n}\r\n\r\n", "",{"version":3,"sources":["webpack://src/asset/index.css"],"names":[],"mappings":"AAAA;IACI,uBAAuB,GAAG,uBAAuB;IACjD,yDAAyD;IACzD;;;;+EAI2E;EAC7E;;AAEF;IACI,iCAAiC;IACjC,cAAc,CAAC,iBAAiB;IAChC,mCAAmC;IACnC,gCAAgC;IAChC,kCAAkC;IAClC,eAAe;AACnB","sourcesContent":["@font-face {\r\n font-family: 'iconfont'; /* project id 1168737 */\r\n src: url('//at.alicdn.com/t/font_1168737_j6ahlsx1dk.eot');\r\n src: url('//at.alicdn.com/t/font_1168737_j6ahlsx1dk.eot?#iefix') format('embedded-opentype'),\r\n url('//at.alicdn.com/t/font_1168737_j6ahlsx1dk.woff2') format('woff2'),\r\n url('//at.alicdn.com/t/font_1168737_j6ahlsx1dk.woff') format('woff'),\r\n url('//at.alicdn.com/t/font_1168737_j6ahlsx1dk.ttf') format('truetype'),\r\n url('//at.alicdn.com/t/font_1168737_j6ahlsx1dk.svg#iconfont') format('svg');\r\n }\r\n\r\n.iconfont{\r\n font-family:\"iconfont\" !important;\r\n font-size:16px;font-style:normal;\r\n -webkit-font-smoothing: antialiased;\r\n -webkit-text-stroke-width: 0.2px;\r\n -moz-osx-font-smoothing: grayscale;\r\n cursor: pointer;\r\n}\r\n\r\n"],"sourceRoot":""}]); +// Exports +/* harmony default export */ __webpack_exports__["default"] = (___CSS_LOADER_EXPORT___); + + +/***/ }), + +/***/ "./node_modules/css-loader/dist/runtime/api.js": +/*!*****************************************************!*\ + !*** ./node_modules/css-loader/dist/runtime/api.js ***! + \*****************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ +// css base code, injected by the css-loader +// eslint-disable-next-line func-names +module.exports = function (useSourceMap) { + var list = []; // return the list of modules as css string + + list.toString = function toString() { + return this.map(function (item) { + var content = cssWithMappingToString(item, useSourceMap); + + if (item[2]) { + return "@media ".concat(item[2], " {").concat(content, "}"); + } + + return content; + }).join(''); + }; // import a list of modules into the list + // eslint-disable-next-line func-names + + + list.i = function (modules, mediaQuery, dedupe) { + if (typeof modules === 'string') { + // eslint-disable-next-line no-param-reassign + modules = [[null, modules, '']]; + } + + var alreadyImportedModules = {}; + + if (dedupe) { + for (var i = 0; i < this.length; i++) { + // eslint-disable-next-line prefer-destructuring + var id = this[i][0]; + + if (id != null) { + alreadyImportedModules[id] = true; + } + } + } + + for (var _i = 0; _i < modules.length; _i++) { + var item = [].concat(modules[_i]); + + if (dedupe && alreadyImportedModules[item[0]]) { + // eslint-disable-next-line no-continue + continue; + } + + if (mediaQuery) { + if (!item[2]) { + item[2] = mediaQuery; + } else { + item[2] = "".concat(mediaQuery, " and ").concat(item[2]); + } + } + + list.push(item); + } + }; + + return list; +}; + +function cssWithMappingToString(item, useSourceMap) { + var content = item[1] || ''; // eslint-disable-next-line prefer-destructuring + + var cssMapping = item[3]; + + if (!cssMapping) { + return content; + } + + if (useSourceMap && typeof btoa === 'function') { + var sourceMapping = toComment(cssMapping); + var sourceURLs = cssMapping.sources.map(function (source) { + return "/*# sourceURL=".concat(cssMapping.sourceRoot || '').concat(source, " */"); + }); + return [content].concat(sourceURLs).concat([sourceMapping]).join('\n'); + } + + return [content].join('\n'); +} // Adapted from convert-source-map (MIT) + + +function toComment(sourceMap) { + // eslint-disable-next-line no-undef + var base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))); + var data = "sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(base64); + return "/*# ".concat(data, " */"); +} + +/***/ }), + +/***/ "./node_modules/events/events.js": +/*!***************************************!*\ + !*** ./node_modules/events/events.js ***! + \***************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + + + +var R = typeof Reflect === 'object' ? Reflect : null +var ReflectApply = R && typeof R.apply === 'function' + ? R.apply + : function ReflectApply(target, receiver, args) { + return Function.prototype.apply.call(target, receiver, args); + } + +var ReflectOwnKeys +if (R && typeof R.ownKeys === 'function') { + ReflectOwnKeys = R.ownKeys +} else if (Object.getOwnPropertySymbols) { + ReflectOwnKeys = function ReflectOwnKeys(target) { + return Object.getOwnPropertyNames(target) + .concat(Object.getOwnPropertySymbols(target)); + }; +} else { + ReflectOwnKeys = function ReflectOwnKeys(target) { + return Object.getOwnPropertyNames(target); + }; +} + +function ProcessEmitWarning(warning) { + if (console && console.warn) console.warn(warning); +} + +var NumberIsNaN = Number.isNaN || function NumberIsNaN(value) { + return value !== value; +} + +function EventEmitter() { + EventEmitter.init.call(this); +} +module.exports = EventEmitter; + +// Backwards-compat with node 0.10.x +EventEmitter.EventEmitter = EventEmitter; + +EventEmitter.prototype._events = undefined; +EventEmitter.prototype._eventsCount = 0; +EventEmitter.prototype._maxListeners = undefined; + +// By default EventEmitters will print a warning if more than 10 listeners are +// added to it. This is a useful default which helps finding memory leaks. +var defaultMaxListeners = 10; + +function checkListener(listener) { + if (typeof listener !== 'function') { + throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof listener); + } +} + +Object.defineProperty(EventEmitter, 'defaultMaxListeners', { + enumerable: true, + get: function() { + return defaultMaxListeners; + }, + set: function(arg) { + if (typeof arg !== 'number' || arg < 0 || NumberIsNaN(arg)) { + throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + arg + '.'); + } + defaultMaxListeners = arg; + } +}); + +EventEmitter.init = function() { + + if (this._events === undefined || + this._events === Object.getPrototypeOf(this)._events) { + this._events = Object.create(null); + this._eventsCount = 0; + } + + this._maxListeners = this._maxListeners || undefined; +}; + +// Obviously not all Emitters should be limited to 10. This function allows +// that to be increased. Set to zero for unlimited. +EventEmitter.prototype.setMaxListeners = function setMaxListeners(n) { + if (typeof n !== 'number' || n < 0 || NumberIsNaN(n)) { + throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + n + '.'); + } + this._maxListeners = n; + return this; +}; + +function _getMaxListeners(that) { + if (that._maxListeners === undefined) + return EventEmitter.defaultMaxListeners; + return that._maxListeners; +} + +EventEmitter.prototype.getMaxListeners = function getMaxListeners() { + return _getMaxListeners(this); +}; + +EventEmitter.prototype.emit = function emit(type) { + var args = []; + for (var i = 1; i < arguments.length; i++) args.push(arguments[i]); + var doError = (type === 'error'); + + var events = this._events; + if (events !== undefined) + doError = (doError && events.error === undefined); + else if (!doError) + return false; + + // If there is no 'error' event listener then throw. + if (doError) { + var er; + if (args.length > 0) + er = args[0]; + if (er instanceof Error) { + // Note: The comments on the `throw` lines are intentional, they show + // up in Node's output if this results in an unhandled exception. + throw er; // Unhandled 'error' event + } + // At least give some kind of context to the user + var err = new Error('Unhandled error.' + (er ? ' (' + er.message + ')' : '')); + err.context = er; + throw err; // Unhandled 'error' event + } + + var handler = events[type]; + + if (handler === undefined) + return false; + + if (typeof handler === 'function') { + ReflectApply(handler, this, args); + } else { + var len = handler.length; + var listeners = arrayClone(handler, len); + for (var i = 0; i < len; ++i) + ReflectApply(listeners[i], this, args); + } + + return true; +}; + +function _addListener(target, type, listener, prepend) { + var m; + var events; + var existing; + + checkListener(listener); + + events = target._events; + if (events === undefined) { + events = target._events = Object.create(null); + target._eventsCount = 0; + } else { + // To avoid recursion in the case that type === "newListener"! Before + // adding it to the listeners, first emit "newListener". + if (events.newListener !== undefined) { + target.emit('newListener', type, + listener.listener ? listener.listener : listener); + + // Re-assign `events` because a newListener handler could have caused the + // this._events to be assigned to a new object + events = target._events; + } + existing = events[type]; + } + + if (existing === undefined) { + // Optimize the case of one listener. Don't need the extra array object. + existing = events[type] = listener; + ++target._eventsCount; + } else { + if (typeof existing === 'function') { + // Adding the second element, need to change to array. + existing = events[type] = + prepend ? [listener, existing] : [existing, listener]; + // If we've already got an array, just append. + } else if (prepend) { + existing.unshift(listener); + } else { + existing.push(listener); + } + + // Check for listener leak + m = _getMaxListeners(target); + if (m > 0 && existing.length > m && !existing.warned) { + existing.warned = true; + // No error code for this since it is a Warning + // eslint-disable-next-line no-restricted-syntax + var w = new Error('Possible EventEmitter memory leak detected. ' + + existing.length + ' ' + String(type) + ' listeners ' + + 'added. Use emitter.setMaxListeners() to ' + + 'increase limit'); + w.name = 'MaxListenersExceededWarning'; + w.emitter = target; + w.type = type; + w.count = existing.length; + ProcessEmitWarning(w); + } + } + + return target; +} + +EventEmitter.prototype.addListener = function addListener(type, listener) { + return _addListener(this, type, listener, false); +}; + +EventEmitter.prototype.on = EventEmitter.prototype.addListener; + +EventEmitter.prototype.prependListener = + function prependListener(type, listener) { + return _addListener(this, type, listener, true); + }; + +function onceWrapper() { + if (!this.fired) { + this.target.removeListener(this.type, this.wrapFn); + this.fired = true; + if (arguments.length === 0) + return this.listener.call(this.target); + return this.listener.apply(this.target, arguments); + } +} + +function _onceWrap(target, type, listener) { + var state = { fired: false, wrapFn: undefined, target: target, type: type, listener: listener }; + var wrapped = onceWrapper.bind(state); + wrapped.listener = listener; + state.wrapFn = wrapped; + return wrapped; +} + +EventEmitter.prototype.once = function once(type, listener) { + checkListener(listener); + this.on(type, _onceWrap(this, type, listener)); + return this; +}; + +EventEmitter.prototype.prependOnceListener = + function prependOnceListener(type, listener) { + checkListener(listener); + this.prependListener(type, _onceWrap(this, type, listener)); + return this; + }; + +// Emits a 'removeListener' event if and only if the listener was removed. +EventEmitter.prototype.removeListener = + function removeListener(type, listener) { + var list, events, position, i, originalListener; + + checkListener(listener); + + events = this._events; + if (events === undefined) + return this; + + list = events[type]; + if (list === undefined) + return this; + + if (list === listener || list.listener === listener) { + if (--this._eventsCount === 0) + this._events = Object.create(null); + else { + delete events[type]; + if (events.removeListener) + this.emit('removeListener', type, list.listener || listener); + } + } else if (typeof list !== 'function') { + position = -1; + + for (i = list.length - 1; i >= 0; i--) { + if (list[i] === listener || list[i].listener === listener) { + originalListener = list[i].listener; + position = i; + break; + } + } + + if (position < 0) + return this; + + if (position === 0) + list.shift(); + else { + spliceOne(list, position); + } + + if (list.length === 1) + events[type] = list[0]; + + if (events.removeListener !== undefined) + this.emit('removeListener', type, originalListener || listener); + } + + return this; + }; + +EventEmitter.prototype.off = EventEmitter.prototype.removeListener; + +EventEmitter.prototype.removeAllListeners = + function removeAllListeners(type) { + var listeners, events, i; + + events = this._events; + if (events === undefined) + return this; + + // not listening for removeListener, no need to emit + if (events.removeListener === undefined) { + if (arguments.length === 0) { + this._events = Object.create(null); + this._eventsCount = 0; + } else if (events[type] !== undefined) { + if (--this._eventsCount === 0) + this._events = Object.create(null); + else + delete events[type]; + } + return this; + } + + // emit removeListener for all listeners on all events + if (arguments.length === 0) { + var keys = Object.keys(events); + var key; + for (i = 0; i < keys.length; ++i) { + key = keys[i]; + if (key === 'removeListener') continue; + this.removeAllListeners(key); + } + this.removeAllListeners('removeListener'); + this._events = Object.create(null); + this._eventsCount = 0; + return this; + } + + listeners = events[type]; + + if (typeof listeners === 'function') { + this.removeListener(type, listeners); + } else if (listeners !== undefined) { + // LIFO order + for (i = listeners.length - 1; i >= 0; i--) { + this.removeListener(type, listeners[i]); + } + } + + return this; + }; + +function _listeners(target, type, unwrap) { + var events = target._events; + + if (events === undefined) + return []; + + var evlistener = events[type]; + if (evlistener === undefined) + return []; + + if (typeof evlistener === 'function') + return unwrap ? [evlistener.listener || evlistener] : [evlistener]; + + return unwrap ? + unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length); +} + +EventEmitter.prototype.listeners = function listeners(type) { + return _listeners(this, type, true); +}; + +EventEmitter.prototype.rawListeners = function rawListeners(type) { + return _listeners(this, type, false); +}; + +EventEmitter.listenerCount = function(emitter, type) { + if (typeof emitter.listenerCount === 'function') { + return emitter.listenerCount(type); + } else { + return listenerCount.call(emitter, type); + } +}; + +EventEmitter.prototype.listenerCount = listenerCount; +function listenerCount(type) { + var events = this._events; + + if (events !== undefined) { + var evlistener = events[type]; + + if (typeof evlistener === 'function') { + return 1; + } else if (evlistener !== undefined) { + return evlistener.length; + } + } + + return 0; +} + +EventEmitter.prototype.eventNames = function eventNames() { + return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : []; +}; + +function arrayClone(arr, n) { + var copy = new Array(n); + for (var i = 0; i < n; ++i) + copy[i] = arr[i]; + return copy; +} + +function spliceOne(list, index) { + for (; index + 1 < list.length; index++) + list[index] = list[index + 1]; + list.pop(); +} + +function unwrapListeners(arr) { + var ret = new Array(arr.length); + for (var i = 0; i < ret.length; ++i) { + ret[i] = arr[i].listener || arr[i]; + } + return ret; +} + + +/***/ }), + +/***/ "./node_modules/history/esm/history.js": +/*!*********************************************!*\ + !*** ./node_modules/history/esm/history.js ***! + \*********************************************/ +/*! exports provided: createBrowserHistory, createHashHistory, createMemoryHistory, createLocation, locationsAreEqual, parsePath, createPath */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createBrowserHistory", function() { return createBrowserHistory; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createHashHistory", function() { return createHashHistory; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createMemoryHistory", function() { return createMemoryHistory; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createLocation", function() { return createLocation; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "locationsAreEqual", function() { return locationsAreEqual; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "parsePath", function() { return parsePath; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createPath", function() { return createPath; }); +/* harmony import */ var _babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/extends */ "./node_modules/@babel/runtime/helpers/esm/extends.js"); +/* harmony import */ var resolve_pathname__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! resolve-pathname */ "./node_modules/resolve-pathname/esm/resolve-pathname.js"); +/* harmony import */ var value_equal__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! value-equal */ "./node_modules/value-equal/esm/value-equal.js"); +/* harmony import */ var tiny_warning__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! tiny-warning */ "./node_modules/tiny-warning/dist/tiny-warning.esm.js"); +/* harmony import */ var tiny_invariant__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! tiny-invariant */ "./node_modules/tiny-invariant/dist/tiny-invariant.esm.js"); + + + + + + +function addLeadingSlash(path) { + return path.charAt(0) === '/' ? path : '/' + path; +} +function stripLeadingSlash(path) { + return path.charAt(0) === '/' ? path.substr(1) : path; +} +function hasBasename(path, prefix) { + return path.toLowerCase().indexOf(prefix.toLowerCase()) === 0 && '/?#'.indexOf(path.charAt(prefix.length)) !== -1; +} +function stripBasename(path, prefix) { + return hasBasename(path, prefix) ? path.substr(prefix.length) : path; +} +function stripTrailingSlash(path) { + return path.charAt(path.length - 1) === '/' ? path.slice(0, -1) : path; +} +function parsePath(path) { + var pathname = path || '/'; + var search = ''; + var hash = ''; + var hashIndex = pathname.indexOf('#'); + + if (hashIndex !== -1) { + hash = pathname.substr(hashIndex); + pathname = pathname.substr(0, hashIndex); + } + + var searchIndex = pathname.indexOf('?'); + + if (searchIndex !== -1) { + search = pathname.substr(searchIndex); + pathname = pathname.substr(0, searchIndex); + } + + return { + pathname: pathname, + search: search === '?' ? '' : search, + hash: hash === '#' ? '' : hash + }; +} +function createPath(location) { + var pathname = location.pathname, + search = location.search, + hash = location.hash; + var path = pathname || '/'; + if (search && search !== '?') path += search.charAt(0) === '?' ? search : "?" + search; + if (hash && hash !== '#') path += hash.charAt(0) === '#' ? hash : "#" + hash; + return path; +} + +function createLocation(path, state, key, currentLocation) { + var location; + + if (typeof path === 'string') { + // Two-arg form: push(path, state) + location = parsePath(path); + location.state = state; + } else { + // One-arg form: push(location) + location = Object(_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__["default"])({}, path); + if (location.pathname === undefined) location.pathname = ''; + + if (location.search) { + if (location.search.charAt(0) !== '?') location.search = '?' + location.search; + } else { + location.search = ''; + } + + if (location.hash) { + if (location.hash.charAt(0) !== '#') location.hash = '#' + location.hash; + } else { + location.hash = ''; + } + + if (state !== undefined && location.state === undefined) location.state = state; + } + + try { + location.pathname = decodeURI(location.pathname); + } catch (e) { + if (e instanceof URIError) { + throw new URIError('Pathname "' + location.pathname + '" could not be decoded. ' + 'This is likely caused by an invalid percent-encoding.'); + } else { + throw e; + } + } + + if (key) location.key = key; + + if (currentLocation) { + // Resolve incomplete/relative pathname relative to current location. + if (!location.pathname) { + location.pathname = currentLocation.pathname; + } else if (location.pathname.charAt(0) !== '/') { + location.pathname = Object(resolve_pathname__WEBPACK_IMPORTED_MODULE_1__["default"])(location.pathname, currentLocation.pathname); + } + } else { + // When there is no prior location and pathname is empty, set it to / + if (!location.pathname) { + location.pathname = '/'; + } + } + + return location; +} +function locationsAreEqual(a, b) { + return a.pathname === b.pathname && a.search === b.search && a.hash === b.hash && a.key === b.key && Object(value_equal__WEBPACK_IMPORTED_MODULE_2__["default"])(a.state, b.state); +} + +function createTransitionManager() { + var prompt = null; + + function setPrompt(nextPrompt) { + true ? Object(tiny_warning__WEBPACK_IMPORTED_MODULE_3__["default"])(prompt == null, 'A history supports only one prompt at a time') : undefined; + prompt = nextPrompt; + return function () { + if (prompt === nextPrompt) prompt = null; + }; + } + + function confirmTransitionTo(location, action, getUserConfirmation, callback) { + // TODO: If another transition starts while we're still confirming + // the previous one, we may end up in a weird state. Figure out the + // best way to handle this. + if (prompt != null) { + var result = typeof prompt === 'function' ? prompt(location, action) : prompt; + + if (typeof result === 'string') { + if (typeof getUserConfirmation === 'function') { + getUserConfirmation(result, callback); + } else { + true ? Object(tiny_warning__WEBPACK_IMPORTED_MODULE_3__["default"])(false, 'A history needs a getUserConfirmation function in order to use a prompt message') : undefined; + callback(true); + } + } else { + // Return false from a transition hook to cancel the transition. + callback(result !== false); + } + } else { + callback(true); + } + } + + var listeners = []; + + function appendListener(fn) { + var isActive = true; + + function listener() { + if (isActive) fn.apply(void 0, arguments); + } + + listeners.push(listener); + return function () { + isActive = false; + listeners = listeners.filter(function (item) { + return item !== listener; + }); + }; + } + + function notifyListeners() { + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + listeners.forEach(function (listener) { + return listener.apply(void 0, args); + }); + } + + return { + setPrompt: setPrompt, + confirmTransitionTo: confirmTransitionTo, + appendListener: appendListener, + notifyListeners: notifyListeners + }; +} + +var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement); +function getConfirmation(message, callback) { + callback(window.confirm(message)); // eslint-disable-line no-alert +} +/** + * Returns true if the HTML5 history API is supported. Taken from Modernizr. + * + * https://github.com/Modernizr/Modernizr/blob/master/LICENSE + * https://github.com/Modernizr/Modernizr/blob/master/feature-detects/history.js + * changed to avoid false negatives for Windows Phones: https://github.com/reactjs/react-router/issues/586 + */ + +function supportsHistory() { + var ua = window.navigator.userAgent; + if ((ua.indexOf('Android 2.') !== -1 || ua.indexOf('Android 4.0') !== -1) && ua.indexOf('Mobile Safari') !== -1 && ua.indexOf('Chrome') === -1 && ua.indexOf('Windows Phone') === -1) return false; + return window.history && 'pushState' in window.history; +} +/** + * Returns true if browser fires popstate on hash change. + * IE10 and IE11 do not. + */ + +function supportsPopStateOnHashChange() { + return window.navigator.userAgent.indexOf('Trident') === -1; +} +/** + * Returns false if using go(n) with hash history causes a full page reload. + */ + +function supportsGoWithoutReloadUsingHash() { + return window.navigator.userAgent.indexOf('Firefox') === -1; +} +/** + * Returns true if a given popstate event is an extraneous WebKit event. + * Accounts for the fact that Chrome on iOS fires real popstate events + * containing undefined state when pressing the back button. + */ + +function isExtraneousPopstateEvent(event) { + return event.state === undefined && navigator.userAgent.indexOf('CriOS') === -1; +} + +var PopStateEvent = 'popstate'; +var HashChangeEvent = 'hashchange'; + +function getHistoryState() { + try { + return window.history.state || {}; + } catch (e) { + // IE 11 sometimes throws when accessing window.history.state + // See https://github.com/ReactTraining/history/pull/289 + return {}; + } +} +/** + * Creates a history object that uses the HTML5 history API including + * pushState, replaceState, and the popstate event. + */ + + +function createBrowserHistory(props) { + if (props === void 0) { + props = {}; + } + + !canUseDOM ? true ? Object(tiny_invariant__WEBPACK_IMPORTED_MODULE_4__["default"])(false, 'Browser history needs a DOM') : undefined : void 0; + var globalHistory = window.history; + var canUseHistory = supportsHistory(); + var needsHashChangeListener = !supportsPopStateOnHashChange(); + var _props = props, + _props$forceRefresh = _props.forceRefresh, + forceRefresh = _props$forceRefresh === void 0 ? false : _props$forceRefresh, + _props$getUserConfirm = _props.getUserConfirmation, + getUserConfirmation = _props$getUserConfirm === void 0 ? getConfirmation : _props$getUserConfirm, + _props$keyLength = _props.keyLength, + keyLength = _props$keyLength === void 0 ? 6 : _props$keyLength; + var basename = props.basename ? stripTrailingSlash(addLeadingSlash(props.basename)) : ''; + + function getDOMLocation(historyState) { + var _ref = historyState || {}, + key = _ref.key, + state = _ref.state; + + var _window$location = window.location, + pathname = _window$location.pathname, + search = _window$location.search, + hash = _window$location.hash; + var path = pathname + search + hash; + true ? Object(tiny_warning__WEBPACK_IMPORTED_MODULE_3__["default"])(!basename || hasBasename(path, basename), 'You are attempting to use a basename on a page whose URL path does not begin ' + 'with the basename. Expected path "' + path + '" to begin with "' + basename + '".') : undefined; + if (basename) path = stripBasename(path, basename); + return createLocation(path, state, key); + } + + function createKey() { + return Math.random().toString(36).substr(2, keyLength); + } + + var transitionManager = createTransitionManager(); + + function setState(nextState) { + Object(_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__["default"])(history, nextState); + + history.length = globalHistory.length; + transitionManager.notifyListeners(history.location, history.action); + } + + function handlePopState(event) { + // Ignore extraneous popstate events in WebKit. + if (isExtraneousPopstateEvent(event)) return; + handlePop(getDOMLocation(event.state)); + } + + function handleHashChange() { + handlePop(getDOMLocation(getHistoryState())); + } + + var forceNextPop = false; + + function handlePop(location) { + if (forceNextPop) { + forceNextPop = false; + setState(); + } else { + var action = 'POP'; + transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) { + if (ok) { + setState({ + action: action, + location: location + }); + } else { + revertPop(location); + } + }); + } + } + + function revertPop(fromLocation) { + var toLocation = history.location; // TODO: We could probably make this more reliable by + // keeping a list of keys we've seen in sessionStorage. + // Instead, we just default to 0 for keys we don't know. + + var toIndex = allKeys.indexOf(toLocation.key); + if (toIndex === -1) toIndex = 0; + var fromIndex = allKeys.indexOf(fromLocation.key); + if (fromIndex === -1) fromIndex = 0; + var delta = toIndex - fromIndex; + + if (delta) { + forceNextPop = true; + go(delta); + } + } + + var initialLocation = getDOMLocation(getHistoryState()); + var allKeys = [initialLocation.key]; // Public interface + + function createHref(location) { + return basename + createPath(location); + } + + function push(path, state) { + true ? Object(tiny_warning__WEBPACK_IMPORTED_MODULE_3__["default"])(!(typeof path === 'object' && path.state !== undefined && state !== undefined), 'You should avoid providing a 2nd state argument to push when the 1st ' + 'argument is a location-like object that already has state; it is ignored') : undefined; + var action = 'PUSH'; + var location = createLocation(path, state, createKey(), history.location); + transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) { + if (!ok) return; + var href = createHref(location); + var key = location.key, + state = location.state; + + if (canUseHistory) { + globalHistory.pushState({ + key: key, + state: state + }, null, href); + + if (forceRefresh) { + window.location.href = href; + } else { + var prevIndex = allKeys.indexOf(history.location.key); + var nextKeys = allKeys.slice(0, prevIndex + 1); + nextKeys.push(location.key); + allKeys = nextKeys; + setState({ + action: action, + location: location + }); + } + } else { + true ? Object(tiny_warning__WEBPACK_IMPORTED_MODULE_3__["default"])(state === undefined, 'Browser history cannot push state in browsers that do not support HTML5 history') : undefined; + window.location.href = href; + } + }); + } + + function replace(path, state) { + true ? Object(tiny_warning__WEBPACK_IMPORTED_MODULE_3__["default"])(!(typeof path === 'object' && path.state !== undefined && state !== undefined), 'You should avoid providing a 2nd state argument to replace when the 1st ' + 'argument is a location-like object that already has state; it is ignored') : undefined; + var action = 'REPLACE'; + var location = createLocation(path, state, createKey(), history.location); + transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) { + if (!ok) return; + var href = createHref(location); + var key = location.key, + state = location.state; + + if (canUseHistory) { + globalHistory.replaceState({ + key: key, + state: state + }, null, href); + + if (forceRefresh) { + window.location.replace(href); + } else { + var prevIndex = allKeys.indexOf(history.location.key); + if (prevIndex !== -1) allKeys[prevIndex] = location.key; + setState({ + action: action, + location: location + }); + } + } else { + true ? Object(tiny_warning__WEBPACK_IMPORTED_MODULE_3__["default"])(state === undefined, 'Browser history cannot replace state in browsers that do not support HTML5 history') : undefined; + window.location.replace(href); + } + }); + } + + function go(n) { + globalHistory.go(n); + } + + function goBack() { + go(-1); + } + + function goForward() { + go(1); + } + + var listenerCount = 0; + + function checkDOMListeners(delta) { + listenerCount += delta; + + if (listenerCount === 1 && delta === 1) { + window.addEventListener(PopStateEvent, handlePopState); + if (needsHashChangeListener) window.addEventListener(HashChangeEvent, handleHashChange); + } else if (listenerCount === 0) { + window.removeEventListener(PopStateEvent, handlePopState); + if (needsHashChangeListener) window.removeEventListener(HashChangeEvent, handleHashChange); + } + } + + var isBlocked = false; + + function block(prompt) { + if (prompt === void 0) { + prompt = false; + } + + var unblock = transitionManager.setPrompt(prompt); + + if (!isBlocked) { + checkDOMListeners(1); + isBlocked = true; + } + + return function () { + if (isBlocked) { + isBlocked = false; + checkDOMListeners(-1); + } + + return unblock(); + }; + } + + function listen(listener) { + var unlisten = transitionManager.appendListener(listener); + checkDOMListeners(1); + return function () { + checkDOMListeners(-1); + unlisten(); + }; + } + + var history = { + length: globalHistory.length, + action: 'POP', + location: initialLocation, + createHref: createHref, + push: push, + replace: replace, + go: go, + goBack: goBack, + goForward: goForward, + block: block, + listen: listen + }; + return history; +} + +var HashChangeEvent$1 = 'hashchange'; +var HashPathCoders = { + hashbang: { + encodePath: function encodePath(path) { + return path.charAt(0) === '!' ? path : '!/' + stripLeadingSlash(path); + }, + decodePath: function decodePath(path) { + return path.charAt(0) === '!' ? path.substr(1) : path; + } + }, + noslash: { + encodePath: stripLeadingSlash, + decodePath: addLeadingSlash + }, + slash: { + encodePath: addLeadingSlash, + decodePath: addLeadingSlash + } +}; + +function stripHash(url) { + var hashIndex = url.indexOf('#'); + return hashIndex === -1 ? url : url.slice(0, hashIndex); +} + +function getHashPath() { + // We can't use window.location.hash here because it's not + // consistent across browsers - Firefox will pre-decode it! + var href = window.location.href; + var hashIndex = href.indexOf('#'); + return hashIndex === -1 ? '' : href.substring(hashIndex + 1); +} + +function pushHashPath(path) { + window.location.hash = path; +} + +function replaceHashPath(path) { + window.location.replace(stripHash(window.location.href) + '#' + path); +} + +function createHashHistory(props) { + if (props === void 0) { + props = {}; + } + + !canUseDOM ? true ? Object(tiny_invariant__WEBPACK_IMPORTED_MODULE_4__["default"])(false, 'Hash history needs a DOM') : undefined : void 0; + var globalHistory = window.history; + var canGoWithoutReload = supportsGoWithoutReloadUsingHash(); + var _props = props, + _props$getUserConfirm = _props.getUserConfirmation, + getUserConfirmation = _props$getUserConfirm === void 0 ? getConfirmation : _props$getUserConfirm, + _props$hashType = _props.hashType, + hashType = _props$hashType === void 0 ? 'slash' : _props$hashType; + var basename = props.basename ? stripTrailingSlash(addLeadingSlash(props.basename)) : ''; + var _HashPathCoders$hashT = HashPathCoders[hashType], + encodePath = _HashPathCoders$hashT.encodePath, + decodePath = _HashPathCoders$hashT.decodePath; + + function getDOMLocation() { + var path = decodePath(getHashPath()); + true ? Object(tiny_warning__WEBPACK_IMPORTED_MODULE_3__["default"])(!basename || hasBasename(path, basename), 'You are attempting to use a basename on a page whose URL path does not begin ' + 'with the basename. Expected path "' + path + '" to begin with "' + basename + '".') : undefined; + if (basename) path = stripBasename(path, basename); + return createLocation(path); + } + + var transitionManager = createTransitionManager(); + + function setState(nextState) { + Object(_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__["default"])(history, nextState); + + history.length = globalHistory.length; + transitionManager.notifyListeners(history.location, history.action); + } + + var forceNextPop = false; + var ignorePath = null; + + function locationsAreEqual$$1(a, b) { + return a.pathname === b.pathname && a.search === b.search && a.hash === b.hash; + } + + function handleHashChange() { + var path = getHashPath(); + var encodedPath = encodePath(path); + + if (path !== encodedPath) { + // Ensure we always have a properly-encoded hash. + replaceHashPath(encodedPath); + } else { + var location = getDOMLocation(); + var prevLocation = history.location; + if (!forceNextPop && locationsAreEqual$$1(prevLocation, location)) return; // A hashchange doesn't always == location change. + + if (ignorePath === createPath(location)) return; // Ignore this change; we already setState in push/replace. + + ignorePath = null; + handlePop(location); + } + } + + function handlePop(location) { + if (forceNextPop) { + forceNextPop = false; + setState(); + } else { + var action = 'POP'; + transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) { + if (ok) { + setState({ + action: action, + location: location + }); + } else { + revertPop(location); + } + }); + } + } + + function revertPop(fromLocation) { + var toLocation = history.location; // TODO: We could probably make this more reliable by + // keeping a list of paths we've seen in sessionStorage. + // Instead, we just default to 0 for paths we don't know. + + var toIndex = allPaths.lastIndexOf(createPath(toLocation)); + if (toIndex === -1) toIndex = 0; + var fromIndex = allPaths.lastIndexOf(createPath(fromLocation)); + if (fromIndex === -1) fromIndex = 0; + var delta = toIndex - fromIndex; + + if (delta) { + forceNextPop = true; + go(delta); + } + } // Ensure the hash is encoded properly before doing anything else. + + + var path = getHashPath(); + var encodedPath = encodePath(path); + if (path !== encodedPath) replaceHashPath(encodedPath); + var initialLocation = getDOMLocation(); + var allPaths = [createPath(initialLocation)]; // Public interface + + function createHref(location) { + var baseTag = document.querySelector('base'); + var href = ''; + + if (baseTag && baseTag.getAttribute('href')) { + href = stripHash(window.location.href); + } + + return href + '#' + encodePath(basename + createPath(location)); + } + + function push(path, state) { + true ? Object(tiny_warning__WEBPACK_IMPORTED_MODULE_3__["default"])(state === undefined, 'Hash history cannot push state; it is ignored') : undefined; + var action = 'PUSH'; + var location = createLocation(path, undefined, undefined, history.location); + transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) { + if (!ok) return; + var path = createPath(location); + var encodedPath = encodePath(basename + path); + var hashChanged = getHashPath() !== encodedPath; + + if (hashChanged) { + // We cannot tell if a hashchange was caused by a PUSH, so we'd + // rather setState here and ignore the hashchange. The caveat here + // is that other hash histories in the page will consider it a POP. + ignorePath = path; + pushHashPath(encodedPath); + var prevIndex = allPaths.lastIndexOf(createPath(history.location)); + var nextPaths = allPaths.slice(0, prevIndex + 1); + nextPaths.push(path); + allPaths = nextPaths; + setState({ + action: action, + location: location + }); + } else { + true ? Object(tiny_warning__WEBPACK_IMPORTED_MODULE_3__["default"])(false, 'Hash history cannot PUSH the same path; a new entry will not be added to the history stack') : undefined; + setState(); + } + }); + } + + function replace(path, state) { + true ? Object(tiny_warning__WEBPACK_IMPORTED_MODULE_3__["default"])(state === undefined, 'Hash history cannot replace state; it is ignored') : undefined; + var action = 'REPLACE'; + var location = createLocation(path, undefined, undefined, history.location); + transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) { + if (!ok) return; + var path = createPath(location); + var encodedPath = encodePath(basename + path); + var hashChanged = getHashPath() !== encodedPath; + + if (hashChanged) { + // We cannot tell if a hashchange was caused by a REPLACE, so we'd + // rather setState here and ignore the hashchange. The caveat here + // is that other hash histories in the page will consider it a POP. + ignorePath = path; + replaceHashPath(encodedPath); + } + + var prevIndex = allPaths.indexOf(createPath(history.location)); + if (prevIndex !== -1) allPaths[prevIndex] = path; + setState({ + action: action, + location: location + }); + }); + } + + function go(n) { + true ? Object(tiny_warning__WEBPACK_IMPORTED_MODULE_3__["default"])(canGoWithoutReload, 'Hash history go(n) causes a full page reload in this browser') : undefined; + globalHistory.go(n); + } + + function goBack() { + go(-1); + } + + function goForward() { + go(1); + } + + var listenerCount = 0; + + function checkDOMListeners(delta) { + listenerCount += delta; + + if (listenerCount === 1 && delta === 1) { + window.addEventListener(HashChangeEvent$1, handleHashChange); + } else if (listenerCount === 0) { + window.removeEventListener(HashChangeEvent$1, handleHashChange); + } + } + + var isBlocked = false; + + function block(prompt) { + if (prompt === void 0) { + prompt = false; + } + + var unblock = transitionManager.setPrompt(prompt); + + if (!isBlocked) { + checkDOMListeners(1); + isBlocked = true; + } + + return function () { + if (isBlocked) { + isBlocked = false; + checkDOMListeners(-1); + } + + return unblock(); + }; + } + + function listen(listener) { + var unlisten = transitionManager.appendListener(listener); + checkDOMListeners(1); + return function () { + checkDOMListeners(-1); + unlisten(); + }; + } + + var history = { + length: globalHistory.length, + action: 'POP', + location: initialLocation, + createHref: createHref, + push: push, + replace: replace, + go: go, + goBack: goBack, + goForward: goForward, + block: block, + listen: listen + }; + return history; +} + +function clamp(n, lowerBound, upperBound) { + return Math.min(Math.max(n, lowerBound), upperBound); +} +/** + * Creates a history object that stores locations in memory. + */ + + +function createMemoryHistory(props) { + if (props === void 0) { + props = {}; + } + + var _props = props, + getUserConfirmation = _props.getUserConfirmation, + _props$initialEntries = _props.initialEntries, + initialEntries = _props$initialEntries === void 0 ? ['/'] : _props$initialEntries, + _props$initialIndex = _props.initialIndex, + initialIndex = _props$initialIndex === void 0 ? 0 : _props$initialIndex, + _props$keyLength = _props.keyLength, + keyLength = _props$keyLength === void 0 ? 6 : _props$keyLength; + var transitionManager = createTransitionManager(); + + function setState(nextState) { + Object(_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__["default"])(history, nextState); + + history.length = history.entries.length; + transitionManager.notifyListeners(history.location, history.action); + } + + function createKey() { + return Math.random().toString(36).substr(2, keyLength); + } + + var index = clamp(initialIndex, 0, initialEntries.length - 1); + var entries = initialEntries.map(function (entry) { + return typeof entry === 'string' ? createLocation(entry, undefined, createKey()) : createLocation(entry, undefined, entry.key || createKey()); + }); // Public interface + + var createHref = createPath; + + function push(path, state) { + true ? Object(tiny_warning__WEBPACK_IMPORTED_MODULE_3__["default"])(!(typeof path === 'object' && path.state !== undefined && state !== undefined), 'You should avoid providing a 2nd state argument to push when the 1st ' + 'argument is a location-like object that already has state; it is ignored') : undefined; + var action = 'PUSH'; + var location = createLocation(path, state, createKey(), history.location); + transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) { + if (!ok) return; + var prevIndex = history.index; + var nextIndex = prevIndex + 1; + var nextEntries = history.entries.slice(0); + + if (nextEntries.length > nextIndex) { + nextEntries.splice(nextIndex, nextEntries.length - nextIndex, location); + } else { + nextEntries.push(location); + } + + setState({ + action: action, + location: location, + index: nextIndex, + entries: nextEntries + }); + }); + } + + function replace(path, state) { + true ? Object(tiny_warning__WEBPACK_IMPORTED_MODULE_3__["default"])(!(typeof path === 'object' && path.state !== undefined && state !== undefined), 'You should avoid providing a 2nd state argument to replace when the 1st ' + 'argument is a location-like object that already has state; it is ignored') : undefined; + var action = 'REPLACE'; + var location = createLocation(path, state, createKey(), history.location); + transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) { + if (!ok) return; + history.entries[history.index] = location; + setState({ + action: action, + location: location + }); + }); + } + + function go(n) { + var nextIndex = clamp(history.index + n, 0, history.entries.length - 1); + var action = 'POP'; + var location = history.entries[nextIndex]; + transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) { + if (ok) { + setState({ + action: action, + location: location, + index: nextIndex + }); + } else { + // Mimic the behavior of DOM histories by + // causing a render after a cancelled POP. + setState(); + } + }); + } + + function goBack() { + go(-1); + } + + function goForward() { + go(1); + } + + function canGo(n) { + var nextIndex = history.index + n; + return nextIndex >= 0 && nextIndex < history.entries.length; + } + + function block(prompt) { + if (prompt === void 0) { + prompt = false; + } + + return transitionManager.setPrompt(prompt); + } + + function listen(listener) { + return transitionManager.appendListener(listener); + } + + var history = { + length: entries.length, + action: 'POP', + location: entries[index], + index: index, + entries: entries, + createHref: createHref, + push: push, + replace: replace, + go: go, + goBack: goBack, + goForward: goForward, + canGo: canGo, + block: block, + listen: listen + }; + return history; +} + + + + +/***/ }), + +/***/ "./node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.cjs.js": +/*!**********************************************************************************!*\ + !*** ./node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.cjs.js ***! + \**********************************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var reactIs = __webpack_require__(/*! react-is */ "./node_modules/react-is/index.js"); + +/** + * Copyright 2015, Yahoo! Inc. + * Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms. + */ +var REACT_STATICS = { + childContextTypes: true, + contextType: true, + contextTypes: true, + defaultProps: true, + displayName: true, + getDefaultProps: true, + getDerivedStateFromError: true, + getDerivedStateFromProps: true, + mixins: true, + propTypes: true, + type: true +}; +var KNOWN_STATICS = { + name: true, + length: true, + prototype: true, + caller: true, + callee: true, + arguments: true, + arity: true +}; +var FORWARD_REF_STATICS = { + '$$typeof': true, + render: true, + defaultProps: true, + displayName: true, + propTypes: true +}; +var MEMO_STATICS = { + '$$typeof': true, + compare: true, + defaultProps: true, + displayName: true, + propTypes: true, + type: true +}; +var TYPE_STATICS = {}; +TYPE_STATICS[reactIs.ForwardRef] = FORWARD_REF_STATICS; +TYPE_STATICS[reactIs.Memo] = MEMO_STATICS; + +function getStatics(component) { + // React v16.11 and below + if (reactIs.isMemo(component)) { + return MEMO_STATICS; + } // React v16.12 and above + + + return TYPE_STATICS[component['$$typeof']] || REACT_STATICS; +} + +var defineProperty = Object.defineProperty; +var getOwnPropertyNames = Object.getOwnPropertyNames; +var getOwnPropertySymbols = Object.getOwnPropertySymbols; +var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; +var getPrototypeOf = Object.getPrototypeOf; +var objectPrototype = Object.prototype; +function hoistNonReactStatics(targetComponent, sourceComponent, blacklist) { + if (typeof sourceComponent !== 'string') { + // don't hoist over string (html) components + if (objectPrototype) { + var inheritedComponent = getPrototypeOf(sourceComponent); + + if (inheritedComponent && inheritedComponent !== objectPrototype) { + hoistNonReactStatics(targetComponent, inheritedComponent, blacklist); + } + } + + var keys = getOwnPropertyNames(sourceComponent); + + if (getOwnPropertySymbols) { + keys = keys.concat(getOwnPropertySymbols(sourceComponent)); + } + + var targetStatics = getStatics(targetComponent); + var sourceStatics = getStatics(sourceComponent); + + for (var i = 0; i < keys.length; ++i) { + var key = keys[i]; + + if (!KNOWN_STATICS[key] && !(blacklist && blacklist[key]) && !(sourceStatics && sourceStatics[key]) && !(targetStatics && targetStatics[key])) { + var descriptor = getOwnPropertyDescriptor(sourceComponent, key); + + try { + // Avoid failures from read-only properties + defineProperty(targetComponent, key, descriptor); + } catch (e) {} + } + } + } + + return targetComponent; +} + +module.exports = hoistNonReactStatics; + + +/***/ }), + +/***/ "./node_modules/html-entities/index.js": +/*!*********************************************!*\ + !*** ./node_modules/html-entities/index.js ***! + \*********************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +module.exports = { + XmlEntities: __webpack_require__(/*! ./lib/xml-entities.js */ "./node_modules/html-entities/lib/xml-entities.js"), + Html4Entities: __webpack_require__(/*! ./lib/html4-entities.js */ "./node_modules/html-entities/lib/html4-entities.js"), + Html5Entities: __webpack_require__(/*! ./lib/html5-entities.js */ "./node_modules/html-entities/lib/html5-entities.js"), + AllHtmlEntities: __webpack_require__(/*! ./lib/html5-entities.js */ "./node_modules/html-entities/lib/html5-entities.js") +}; + + +/***/ }), + +/***/ "./node_modules/html-entities/lib/html4-entities.js": +/*!**********************************************************!*\ + !*** ./node_modules/html-entities/lib/html4-entities.js ***! + \**********************************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +var HTML_ALPHA = ['apos', 'nbsp', 'iexcl', 'cent', 'pound', 'curren', 'yen', 'brvbar', 'sect', 'uml', 'copy', 'ordf', 'laquo', 'not', 'shy', 'reg', 'macr', 'deg', 'plusmn', 'sup2', 'sup3', 'acute', 'micro', 'para', 'middot', 'cedil', 'sup1', 'ordm', 'raquo', 'frac14', 'frac12', 'frac34', 'iquest', 'Agrave', 'Aacute', 'Acirc', 'Atilde', 'Auml', 'Aring', 'Aelig', 'Ccedil', 'Egrave', 'Eacute', 'Ecirc', 'Euml', 'Igrave', 'Iacute', 'Icirc', 'Iuml', 'ETH', 'Ntilde', 'Ograve', 'Oacute', 'Ocirc', 'Otilde', 'Ouml', 'times', 'Oslash', 'Ugrave', 'Uacute', 'Ucirc', 'Uuml', 'Yacute', 'THORN', 'szlig', 'agrave', 'aacute', 'acirc', 'atilde', 'auml', 'aring', 'aelig', 'ccedil', 'egrave', 'eacute', 'ecirc', 'euml', 'igrave', 'iacute', 'icirc', 'iuml', 'eth', 'ntilde', 'ograve', 'oacute', 'ocirc', 'otilde', 'ouml', 'divide', 'oslash', 'ugrave', 'uacute', 'ucirc', 'uuml', 'yacute', 'thorn', 'yuml', 'quot', 'amp', 'lt', 'gt', 'OElig', 'oelig', 'Scaron', 'scaron', 'Yuml', 'circ', 'tilde', 'ensp', 'emsp', 'thinsp', 'zwnj', 'zwj', 'lrm', 'rlm', 'ndash', 'mdash', 'lsquo', 'rsquo', 'sbquo', 'ldquo', 'rdquo', 'bdquo', 'dagger', 'Dagger', 'permil', 'lsaquo', 'rsaquo', 'euro', 'fnof', 'Alpha', 'Beta', 'Gamma', 'Delta', 'Epsilon', 'Zeta', 'Eta', 'Theta', 'Iota', 'Kappa', 'Lambda', 'Mu', 'Nu', 'Xi', 'Omicron', 'Pi', 'Rho', 'Sigma', 'Tau', 'Upsilon', 'Phi', 'Chi', 'Psi', 'Omega', 'alpha', 'beta', 'gamma', 'delta', 'epsilon', 'zeta', 'eta', 'theta', 'iota', 'kappa', 'lambda', 'mu', 'nu', 'xi', 'omicron', 'pi', 'rho', 'sigmaf', 'sigma', 'tau', 'upsilon', 'phi', 'chi', 'psi', 'omega', 'thetasym', 'upsih', 'piv', 'bull', 'hellip', 'prime', 'Prime', 'oline', 'frasl', 'weierp', 'image', 'real', 'trade', 'alefsym', 'larr', 'uarr', 'rarr', 'darr', 'harr', 'crarr', 'lArr', 'uArr', 'rArr', 'dArr', 'hArr', 'forall', 'part', 'exist', 'empty', 'nabla', 'isin', 'notin', 'ni', 'prod', 'sum', 'minus', 'lowast', 'radic', 'prop', 'infin', 'ang', 'and', 'or', 'cap', 'cup', 'int', 'there4', 'sim', 'cong', 'asymp', 'ne', 'equiv', 'le', 'ge', 'sub', 'sup', 'nsub', 'sube', 'supe', 'oplus', 'otimes', 'perp', 'sdot', 'lceil', 'rceil', 'lfloor', 'rfloor', 'lang', 'rang', 'loz', 'spades', 'clubs', 'hearts', 'diams']; +var HTML_CODES = [39, 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, 34, 38, 60, 62, 338, 339, 352, 353, 376, 710, 732, 8194, 8195, 8201, 8204, 8205, 8206, 8207, 8211, 8212, 8216, 8217, 8218, 8220, 8221, 8222, 8224, 8225, 8240, 8249, 8250, 8364, 402, 913, 914, 915, 916, 917, 918, 919, 920, 921, 922, 923, 924, 925, 926, 927, 928, 929, 931, 932, 933, 934, 935, 936, 937, 945, 946, 947, 948, 949, 950, 951, 952, 953, 954, 955, 956, 957, 958, 959, 960, 961, 962, 963, 964, 965, 966, 967, 968, 969, 977, 978, 982, 8226, 8230, 8242, 8243, 8254, 8260, 8472, 8465, 8476, 8482, 8501, 8592, 8593, 8594, 8595, 8596, 8629, 8656, 8657, 8658, 8659, 8660, 8704, 8706, 8707, 8709, 8711, 8712, 8713, 8715, 8719, 8721, 8722, 8727, 8730, 8733, 8734, 8736, 8743, 8744, 8745, 8746, 8747, 8756, 8764, 8773, 8776, 8800, 8801, 8804, 8805, 8834, 8835, 8836, 8838, 8839, 8853, 8855, 8869, 8901, 8968, 8969, 8970, 8971, 9001, 9002, 9674, 9824, 9827, 9829, 9830]; + +var alphaIndex = {}; +var numIndex = {}; + +var i = 0; +var length = HTML_ALPHA.length; +while (i < length) { + var a = HTML_ALPHA[i]; + var c = HTML_CODES[i]; + alphaIndex[a] = String.fromCharCode(c); + numIndex[c] = a; + i++; +} + +/** + * @constructor + */ +function Html4Entities() {} + +/** + * @param {String} str + * @returns {String} + */ +Html4Entities.prototype.decode = function(str) { + if (!str || !str.length) { + return ''; + } + return str.replace(/&(#?[\w\d]+);?/g, function(s, entity) { + var chr; + if (entity.charAt(0) === "#") { + var code = entity.charAt(1).toLowerCase() === 'x' ? + parseInt(entity.substr(2), 16) : + parseInt(entity.substr(1)); + + if (!(isNaN(code) || code < -32768 || code > 65535)) { + chr = String.fromCharCode(code); + } + } else { + chr = alphaIndex[entity]; + } + return chr || s; + }); +}; + +/** + * @param {String} str + * @returns {String} + */ +Html4Entities.decode = function(str) { + return new Html4Entities().decode(str); +}; + +/** + * @param {String} str + * @returns {String} + */ +Html4Entities.prototype.encode = function(str) { + if (!str || !str.length) { + return ''; + } + var strLength = str.length; + var result = ''; + var i = 0; + while (i < strLength) { + var alpha = numIndex[str.charCodeAt(i)]; + result += alpha ? "&" + alpha + ";" : str.charAt(i); + i++; + } + return result; +}; + +/** + * @param {String} str + * @returns {String} + */ +Html4Entities.encode = function(str) { + return new Html4Entities().encode(str); +}; + +/** + * @param {String} str + * @returns {String} + */ +Html4Entities.prototype.encodeNonUTF = function(str) { + if (!str || !str.length) { + return ''; + } + var strLength = str.length; + var result = ''; + var i = 0; + while (i < strLength) { + var cc = str.charCodeAt(i); + var alpha = numIndex[cc]; + if (alpha) { + result += "&" + alpha + ";"; + } else if (cc < 32 || cc > 126) { + result += "&#" + cc + ";"; + } else { + result += str.charAt(i); + } + i++; + } + return result; +}; + +/** + * @param {String} str + * @returns {String} + */ +Html4Entities.encodeNonUTF = function(str) { + return new Html4Entities().encodeNonUTF(str); +}; + +/** + * @param {String} str + * @returns {String} + */ +Html4Entities.prototype.encodeNonASCII = function(str) { + if (!str || !str.length) { + return ''; + } + var strLength = str.length; + var result = ''; + var i = 0; + while (i < strLength) { + var c = str.charCodeAt(i); + if (c <= 255) { + result += str[i++]; + continue; + } + result += '&#' + c + ';'; + i++; + } + return result; +}; + +/** + * @param {String} str + * @returns {String} + */ +Html4Entities.encodeNonASCII = function(str) { + return new Html4Entities().encodeNonASCII(str); +}; + +module.exports = Html4Entities; + + +/***/ }), + +/***/ "./node_modules/html-entities/lib/html5-entities.js": +/*!**********************************************************!*\ + !*** ./node_modules/html-entities/lib/html5-entities.js ***! + \**********************************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +var ENTITIES = [['Aacute', [193]], ['aacute', [225]], ['Abreve', [258]], ['abreve', [259]], ['ac', [8766]], ['acd', [8767]], ['acE', [8766, 819]], ['Acirc', [194]], ['acirc', [226]], ['acute', [180]], ['Acy', [1040]], ['acy', [1072]], ['AElig', [198]], ['aelig', [230]], ['af', [8289]], ['Afr', [120068]], ['afr', [120094]], ['Agrave', [192]], ['agrave', [224]], ['alefsym', [8501]], ['aleph', [8501]], ['Alpha', [913]], ['alpha', [945]], ['Amacr', [256]], ['amacr', [257]], ['amalg', [10815]], ['amp', [38]], ['AMP', [38]], ['andand', [10837]], ['And', [10835]], ['and', [8743]], ['andd', [10844]], ['andslope', [10840]], ['andv', [10842]], ['ang', [8736]], ['ange', [10660]], ['angle', [8736]], ['angmsdaa', [10664]], ['angmsdab', [10665]], ['angmsdac', [10666]], ['angmsdad', [10667]], ['angmsdae', [10668]], ['angmsdaf', [10669]], ['angmsdag', [10670]], ['angmsdah', [10671]], ['angmsd', [8737]], ['angrt', [8735]], ['angrtvb', [8894]], ['angrtvbd', [10653]], ['angsph', [8738]], ['angst', [197]], ['angzarr', [9084]], ['Aogon', [260]], ['aogon', [261]], ['Aopf', [120120]], ['aopf', [120146]], ['apacir', [10863]], ['ap', [8776]], ['apE', [10864]], ['ape', [8778]], ['apid', [8779]], ['apos', [39]], ['ApplyFunction', [8289]], ['approx', [8776]], ['approxeq', [8778]], ['Aring', [197]], ['aring', [229]], ['Ascr', [119964]], ['ascr', [119990]], ['Assign', [8788]], ['ast', [42]], ['asymp', [8776]], ['asympeq', [8781]], ['Atilde', [195]], ['atilde', [227]], ['Auml', [196]], ['auml', [228]], ['awconint', [8755]], ['awint', [10769]], ['backcong', [8780]], ['backepsilon', [1014]], ['backprime', [8245]], ['backsim', [8765]], ['backsimeq', [8909]], ['Backslash', [8726]], ['Barv', [10983]], ['barvee', [8893]], ['barwed', [8965]], ['Barwed', [8966]], ['barwedge', [8965]], ['bbrk', [9141]], ['bbrktbrk', [9142]], ['bcong', [8780]], ['Bcy', [1041]], ['bcy', [1073]], ['bdquo', [8222]], ['becaus', [8757]], ['because', [8757]], ['Because', [8757]], ['bemptyv', [10672]], ['bepsi', [1014]], ['bernou', [8492]], ['Bernoullis', [8492]], ['Beta', [914]], ['beta', [946]], ['beth', [8502]], ['between', [8812]], ['Bfr', [120069]], ['bfr', [120095]], ['bigcap', [8898]], ['bigcirc', [9711]], ['bigcup', [8899]], ['bigodot', [10752]], ['bigoplus', [10753]], ['bigotimes', [10754]], ['bigsqcup', [10758]], ['bigstar', [9733]], ['bigtriangledown', [9661]], ['bigtriangleup', [9651]], ['biguplus', [10756]], ['bigvee', [8897]], ['bigwedge', [8896]], ['bkarow', [10509]], ['blacklozenge', [10731]], ['blacksquare', [9642]], ['blacktriangle', [9652]], ['blacktriangledown', [9662]], ['blacktriangleleft', [9666]], ['blacktriangleright', [9656]], ['blank', [9251]], ['blk12', [9618]], ['blk14', [9617]], ['blk34', [9619]], ['block', [9608]], ['bne', [61, 8421]], ['bnequiv', [8801, 8421]], ['bNot', [10989]], ['bnot', [8976]], ['Bopf', [120121]], ['bopf', [120147]], ['bot', [8869]], ['bottom', [8869]], ['bowtie', [8904]], ['boxbox', [10697]], ['boxdl', [9488]], ['boxdL', [9557]], ['boxDl', [9558]], ['boxDL', [9559]], ['boxdr', [9484]], ['boxdR', [9554]], ['boxDr', [9555]], ['boxDR', [9556]], ['boxh', [9472]], ['boxH', [9552]], ['boxhd', [9516]], ['boxHd', [9572]], ['boxhD', [9573]], ['boxHD', [9574]], ['boxhu', [9524]], ['boxHu', [9575]], ['boxhU', [9576]], ['boxHU', [9577]], ['boxminus', [8863]], ['boxplus', [8862]], ['boxtimes', [8864]], ['boxul', [9496]], ['boxuL', [9563]], ['boxUl', [9564]], ['boxUL', [9565]], ['boxur', [9492]], ['boxuR', [9560]], ['boxUr', [9561]], ['boxUR', [9562]], ['boxv', [9474]], ['boxV', [9553]], ['boxvh', [9532]], ['boxvH', [9578]], ['boxVh', [9579]], ['boxVH', [9580]], ['boxvl', [9508]], ['boxvL', [9569]], ['boxVl', [9570]], ['boxVL', [9571]], ['boxvr', [9500]], ['boxvR', [9566]], ['boxVr', [9567]], ['boxVR', [9568]], ['bprime', [8245]], ['breve', [728]], ['Breve', [728]], ['brvbar', [166]], ['bscr', [119991]], ['Bscr', [8492]], ['bsemi', [8271]], ['bsim', [8765]], ['bsime', [8909]], ['bsolb', [10693]], ['bsol', [92]], ['bsolhsub', [10184]], ['bull', [8226]], ['bullet', [8226]], ['bump', [8782]], ['bumpE', [10926]], ['bumpe', [8783]], ['Bumpeq', [8782]], ['bumpeq', [8783]], ['Cacute', [262]], ['cacute', [263]], ['capand', [10820]], ['capbrcup', [10825]], ['capcap', [10827]], ['cap', [8745]], ['Cap', [8914]], ['capcup', [10823]], ['capdot', [10816]], ['CapitalDifferentialD', [8517]], ['caps', [8745, 65024]], ['caret', [8257]], ['caron', [711]], ['Cayleys', [8493]], ['ccaps', [10829]], ['Ccaron', [268]], ['ccaron', [269]], ['Ccedil', [199]], ['ccedil', [231]], ['Ccirc', [264]], ['ccirc', [265]], ['Cconint', [8752]], ['ccups', [10828]], ['ccupssm', [10832]], ['Cdot', [266]], ['cdot', [267]], ['cedil', [184]], ['Cedilla', [184]], ['cemptyv', [10674]], ['cent', [162]], ['centerdot', [183]], ['CenterDot', [183]], ['cfr', [120096]], ['Cfr', [8493]], ['CHcy', [1063]], ['chcy', [1095]], ['check', [10003]], ['checkmark', [10003]], ['Chi', [935]], ['chi', [967]], ['circ', [710]], ['circeq', [8791]], ['circlearrowleft', [8634]], ['circlearrowright', [8635]], ['circledast', [8859]], ['circledcirc', [8858]], ['circleddash', [8861]], ['CircleDot', [8857]], ['circledR', [174]], ['circledS', [9416]], ['CircleMinus', [8854]], ['CirclePlus', [8853]], ['CircleTimes', [8855]], ['cir', [9675]], ['cirE', [10691]], ['cire', [8791]], ['cirfnint', [10768]], ['cirmid', [10991]], ['cirscir', [10690]], ['ClockwiseContourIntegral', [8754]], ['clubs', [9827]], ['clubsuit', [9827]], ['colon', [58]], ['Colon', [8759]], ['Colone', [10868]], ['colone', [8788]], ['coloneq', [8788]], ['comma', [44]], ['commat', [64]], ['comp', [8705]], ['compfn', [8728]], ['complement', [8705]], ['complexes', [8450]], ['cong', [8773]], ['congdot', [10861]], ['Congruent', [8801]], ['conint', [8750]], ['Conint', [8751]], ['ContourIntegral', [8750]], ['copf', [120148]], ['Copf', [8450]], ['coprod', [8720]], ['Coproduct', [8720]], ['copy', [169]], ['COPY', [169]], ['copysr', [8471]], ['CounterClockwiseContourIntegral', [8755]], ['crarr', [8629]], ['cross', [10007]], ['Cross', [10799]], ['Cscr', [119966]], ['cscr', [119992]], ['csub', [10959]], ['csube', [10961]], ['csup', [10960]], ['csupe', [10962]], ['ctdot', [8943]], ['cudarrl', [10552]], ['cudarrr', [10549]], ['cuepr', [8926]], ['cuesc', [8927]], ['cularr', [8630]], ['cularrp', [10557]], ['cupbrcap', [10824]], ['cupcap', [10822]], ['CupCap', [8781]], ['cup', [8746]], ['Cup', [8915]], ['cupcup', [10826]], ['cupdot', [8845]], ['cupor', [10821]], ['cups', [8746, 65024]], ['curarr', [8631]], ['curarrm', [10556]], ['curlyeqprec', [8926]], ['curlyeqsucc', [8927]], ['curlyvee', [8910]], ['curlywedge', [8911]], ['curren', [164]], ['curvearrowleft', [8630]], ['curvearrowright', [8631]], ['cuvee', [8910]], ['cuwed', [8911]], ['cwconint', [8754]], ['cwint', [8753]], ['cylcty', [9005]], ['dagger', [8224]], ['Dagger', [8225]], ['daleth', [8504]], ['darr', [8595]], ['Darr', [8609]], ['dArr', [8659]], ['dash', [8208]], ['Dashv', [10980]], ['dashv', [8867]], ['dbkarow', [10511]], ['dblac', [733]], ['Dcaron', [270]], ['dcaron', [271]], ['Dcy', [1044]], ['dcy', [1076]], ['ddagger', [8225]], ['ddarr', [8650]], ['DD', [8517]], ['dd', [8518]], ['DDotrahd', [10513]], ['ddotseq', [10871]], ['deg', [176]], ['Del', [8711]], ['Delta', [916]], ['delta', [948]], ['demptyv', [10673]], ['dfisht', [10623]], ['Dfr', [120071]], ['dfr', [120097]], ['dHar', [10597]], ['dharl', [8643]], ['dharr', [8642]], ['DiacriticalAcute', [180]], ['DiacriticalDot', [729]], ['DiacriticalDoubleAcute', [733]], ['DiacriticalGrave', [96]], ['DiacriticalTilde', [732]], ['diam', [8900]], ['diamond', [8900]], ['Diamond', [8900]], ['diamondsuit', [9830]], ['diams', [9830]], ['die', [168]], ['DifferentialD', [8518]], ['digamma', [989]], ['disin', [8946]], ['div', [247]], ['divide', [247]], ['divideontimes', [8903]], ['divonx', [8903]], ['DJcy', [1026]], ['djcy', [1106]], ['dlcorn', [8990]], ['dlcrop', [8973]], ['dollar', [36]], ['Dopf', [120123]], ['dopf', [120149]], ['Dot', [168]], ['dot', [729]], ['DotDot', [8412]], ['doteq', [8784]], ['doteqdot', [8785]], ['DotEqual', [8784]], ['dotminus', [8760]], ['dotplus', [8724]], ['dotsquare', [8865]], ['doublebarwedge', [8966]], ['DoubleContourIntegral', [8751]], ['DoubleDot', [168]], ['DoubleDownArrow', [8659]], ['DoubleLeftArrow', [8656]], ['DoubleLeftRightArrow', [8660]], ['DoubleLeftTee', [10980]], ['DoubleLongLeftArrow', [10232]], ['DoubleLongLeftRightArrow', [10234]], ['DoubleLongRightArrow', [10233]], ['DoubleRightArrow', [8658]], ['DoubleRightTee', [8872]], ['DoubleUpArrow', [8657]], ['DoubleUpDownArrow', [8661]], ['DoubleVerticalBar', [8741]], ['DownArrowBar', [10515]], ['downarrow', [8595]], ['DownArrow', [8595]], ['Downarrow', [8659]], ['DownArrowUpArrow', [8693]], ['DownBreve', [785]], ['downdownarrows', [8650]], ['downharpoonleft', [8643]], ['downharpoonright', [8642]], ['DownLeftRightVector', [10576]], ['DownLeftTeeVector', [10590]], ['DownLeftVectorBar', [10582]], ['DownLeftVector', [8637]], ['DownRightTeeVector', [10591]], ['DownRightVectorBar', [10583]], ['DownRightVector', [8641]], ['DownTeeArrow', [8615]], ['DownTee', [8868]], ['drbkarow', [10512]], ['drcorn', [8991]], ['drcrop', [8972]], ['Dscr', [119967]], ['dscr', [119993]], ['DScy', [1029]], ['dscy', [1109]], ['dsol', [10742]], ['Dstrok', [272]], ['dstrok', [273]], ['dtdot', [8945]], ['dtri', [9663]], ['dtrif', [9662]], ['duarr', [8693]], ['duhar', [10607]], ['dwangle', [10662]], ['DZcy', [1039]], ['dzcy', [1119]], ['dzigrarr', [10239]], ['Eacute', [201]], ['eacute', [233]], ['easter', [10862]], ['Ecaron', [282]], ['ecaron', [283]], ['Ecirc', [202]], ['ecirc', [234]], ['ecir', [8790]], ['ecolon', [8789]], ['Ecy', [1069]], ['ecy', [1101]], ['eDDot', [10871]], ['Edot', [278]], ['edot', [279]], ['eDot', [8785]], ['ee', [8519]], ['efDot', [8786]], ['Efr', [120072]], ['efr', [120098]], ['eg', [10906]], ['Egrave', [200]], ['egrave', [232]], ['egs', [10902]], ['egsdot', [10904]], ['el', [10905]], ['Element', [8712]], ['elinters', [9191]], ['ell', [8467]], ['els', [10901]], ['elsdot', [10903]], ['Emacr', [274]], ['emacr', [275]], ['empty', [8709]], ['emptyset', [8709]], ['EmptySmallSquare', [9723]], ['emptyv', [8709]], ['EmptyVerySmallSquare', [9643]], ['emsp13', [8196]], ['emsp14', [8197]], ['emsp', [8195]], ['ENG', [330]], ['eng', [331]], ['ensp', [8194]], ['Eogon', [280]], ['eogon', [281]], ['Eopf', [120124]], ['eopf', [120150]], ['epar', [8917]], ['eparsl', [10723]], ['eplus', [10865]], ['epsi', [949]], ['Epsilon', [917]], ['epsilon', [949]], ['epsiv', [1013]], ['eqcirc', [8790]], ['eqcolon', [8789]], ['eqsim', [8770]], ['eqslantgtr', [10902]], ['eqslantless', [10901]], ['Equal', [10869]], ['equals', [61]], ['EqualTilde', [8770]], ['equest', [8799]], ['Equilibrium', [8652]], ['equiv', [8801]], ['equivDD', [10872]], ['eqvparsl', [10725]], ['erarr', [10609]], ['erDot', [8787]], ['escr', [8495]], ['Escr', [8496]], ['esdot', [8784]], ['Esim', [10867]], ['esim', [8770]], ['Eta', [919]], ['eta', [951]], ['ETH', [208]], ['eth', [240]], ['Euml', [203]], ['euml', [235]], ['euro', [8364]], ['excl', [33]], ['exist', [8707]], ['Exists', [8707]], ['expectation', [8496]], ['exponentiale', [8519]], ['ExponentialE', [8519]], ['fallingdotseq', [8786]], ['Fcy', [1060]], ['fcy', [1092]], ['female', [9792]], ['ffilig', [64259]], ['fflig', [64256]], ['ffllig', [64260]], ['Ffr', [120073]], ['ffr', [120099]], ['filig', [64257]], ['FilledSmallSquare', [9724]], ['FilledVerySmallSquare', [9642]], ['fjlig', [102, 106]], ['flat', [9837]], ['fllig', [64258]], ['fltns', [9649]], ['fnof', [402]], ['Fopf', [120125]], ['fopf', [120151]], ['forall', [8704]], ['ForAll', [8704]], ['fork', [8916]], ['forkv', [10969]], ['Fouriertrf', [8497]], ['fpartint', [10765]], ['frac12', [189]], ['frac13', [8531]], ['frac14', [188]], ['frac15', [8533]], ['frac16', [8537]], ['frac18', [8539]], ['frac23', [8532]], ['frac25', [8534]], ['frac34', [190]], ['frac35', [8535]], ['frac38', [8540]], ['frac45', [8536]], ['frac56', [8538]], ['frac58', [8541]], ['frac78', [8542]], ['frasl', [8260]], ['frown', [8994]], ['fscr', [119995]], ['Fscr', [8497]], ['gacute', [501]], ['Gamma', [915]], ['gamma', [947]], ['Gammad', [988]], ['gammad', [989]], ['gap', [10886]], ['Gbreve', [286]], ['gbreve', [287]], ['Gcedil', [290]], ['Gcirc', [284]], ['gcirc', [285]], ['Gcy', [1043]], ['gcy', [1075]], ['Gdot', [288]], ['gdot', [289]], ['ge', [8805]], ['gE', [8807]], ['gEl', [10892]], ['gel', [8923]], ['geq', [8805]], ['geqq', [8807]], ['geqslant', [10878]], ['gescc', [10921]], ['ges', [10878]], ['gesdot', [10880]], ['gesdoto', [10882]], ['gesdotol', [10884]], ['gesl', [8923, 65024]], ['gesles', [10900]], ['Gfr', [120074]], ['gfr', [120100]], ['gg', [8811]], ['Gg', [8921]], ['ggg', [8921]], ['gimel', [8503]], ['GJcy', [1027]], ['gjcy', [1107]], ['gla', [10917]], ['gl', [8823]], ['glE', [10898]], ['glj', [10916]], ['gnap', [10890]], ['gnapprox', [10890]], ['gne', [10888]], ['gnE', [8809]], ['gneq', [10888]], ['gneqq', [8809]], ['gnsim', [8935]], ['Gopf', [120126]], ['gopf', [120152]], ['grave', [96]], ['GreaterEqual', [8805]], ['GreaterEqualLess', [8923]], ['GreaterFullEqual', [8807]], ['GreaterGreater', [10914]], ['GreaterLess', [8823]], ['GreaterSlantEqual', [10878]], ['GreaterTilde', [8819]], ['Gscr', [119970]], ['gscr', [8458]], ['gsim', [8819]], ['gsime', [10894]], ['gsiml', [10896]], ['gtcc', [10919]], ['gtcir', [10874]], ['gt', [62]], ['GT', [62]], ['Gt', [8811]], ['gtdot', [8919]], ['gtlPar', [10645]], ['gtquest', [10876]], ['gtrapprox', [10886]], ['gtrarr', [10616]], ['gtrdot', [8919]], ['gtreqless', [8923]], ['gtreqqless', [10892]], ['gtrless', [8823]], ['gtrsim', [8819]], ['gvertneqq', [8809, 65024]], ['gvnE', [8809, 65024]], ['Hacek', [711]], ['hairsp', [8202]], ['half', [189]], ['hamilt', [8459]], ['HARDcy', [1066]], ['hardcy', [1098]], ['harrcir', [10568]], ['harr', [8596]], ['hArr', [8660]], ['harrw', [8621]], ['Hat', [94]], ['hbar', [8463]], ['Hcirc', [292]], ['hcirc', [293]], ['hearts', [9829]], ['heartsuit', [9829]], ['hellip', [8230]], ['hercon', [8889]], ['hfr', [120101]], ['Hfr', [8460]], ['HilbertSpace', [8459]], ['hksearow', [10533]], ['hkswarow', [10534]], ['hoarr', [8703]], ['homtht', [8763]], ['hookleftarrow', [8617]], ['hookrightarrow', [8618]], ['hopf', [120153]], ['Hopf', [8461]], ['horbar', [8213]], ['HorizontalLine', [9472]], ['hscr', [119997]], ['Hscr', [8459]], ['hslash', [8463]], ['Hstrok', [294]], ['hstrok', [295]], ['HumpDownHump', [8782]], ['HumpEqual', [8783]], ['hybull', [8259]], ['hyphen', [8208]], ['Iacute', [205]], ['iacute', [237]], ['ic', [8291]], ['Icirc', [206]], ['icirc', [238]], ['Icy', [1048]], ['icy', [1080]], ['Idot', [304]], ['IEcy', [1045]], ['iecy', [1077]], ['iexcl', [161]], ['iff', [8660]], ['ifr', [120102]], ['Ifr', [8465]], ['Igrave', [204]], ['igrave', [236]], ['ii', [8520]], ['iiiint', [10764]], ['iiint', [8749]], ['iinfin', [10716]], ['iiota', [8489]], ['IJlig', [306]], ['ijlig', [307]], ['Imacr', [298]], ['imacr', [299]], ['image', [8465]], ['ImaginaryI', [8520]], ['imagline', [8464]], ['imagpart', [8465]], ['imath', [305]], ['Im', [8465]], ['imof', [8887]], ['imped', [437]], ['Implies', [8658]], ['incare', [8453]], ['in', [8712]], ['infin', [8734]], ['infintie', [10717]], ['inodot', [305]], ['intcal', [8890]], ['int', [8747]], ['Int', [8748]], ['integers', [8484]], ['Integral', [8747]], ['intercal', [8890]], ['Intersection', [8898]], ['intlarhk', [10775]], ['intprod', [10812]], ['InvisibleComma', [8291]], ['InvisibleTimes', [8290]], ['IOcy', [1025]], ['iocy', [1105]], ['Iogon', [302]], ['iogon', [303]], ['Iopf', [120128]], ['iopf', [120154]], ['Iota', [921]], ['iota', [953]], ['iprod', [10812]], ['iquest', [191]], ['iscr', [119998]], ['Iscr', [8464]], ['isin', [8712]], ['isindot', [8949]], ['isinE', [8953]], ['isins', [8948]], ['isinsv', [8947]], ['isinv', [8712]], ['it', [8290]], ['Itilde', [296]], ['itilde', [297]], ['Iukcy', [1030]], ['iukcy', [1110]], ['Iuml', [207]], ['iuml', [239]], ['Jcirc', [308]], ['jcirc', [309]], ['Jcy', [1049]], ['jcy', [1081]], ['Jfr', [120077]], ['jfr', [120103]], ['jmath', [567]], ['Jopf', [120129]], ['jopf', [120155]], ['Jscr', [119973]], ['jscr', [119999]], ['Jsercy', [1032]], ['jsercy', [1112]], ['Jukcy', [1028]], ['jukcy', [1108]], ['Kappa', [922]], ['kappa', [954]], ['kappav', [1008]], ['Kcedil', [310]], ['kcedil', [311]], ['Kcy', [1050]], ['kcy', [1082]], ['Kfr', [120078]], ['kfr', [120104]], ['kgreen', [312]], ['KHcy', [1061]], ['khcy', [1093]], ['KJcy', [1036]], ['kjcy', [1116]], ['Kopf', [120130]], ['kopf', [120156]], ['Kscr', [119974]], ['kscr', [120000]], ['lAarr', [8666]], ['Lacute', [313]], ['lacute', [314]], ['laemptyv', [10676]], ['lagran', [8466]], ['Lambda', [923]], ['lambda', [955]], ['lang', [10216]], ['Lang', [10218]], ['langd', [10641]], ['langle', [10216]], ['lap', [10885]], ['Laplacetrf', [8466]], ['laquo', [171]], ['larrb', [8676]], ['larrbfs', [10527]], ['larr', [8592]], ['Larr', [8606]], ['lArr', [8656]], ['larrfs', [10525]], ['larrhk', [8617]], ['larrlp', [8619]], ['larrpl', [10553]], ['larrsim', [10611]], ['larrtl', [8610]], ['latail', [10521]], ['lAtail', [10523]], ['lat', [10923]], ['late', [10925]], ['lates', [10925, 65024]], ['lbarr', [10508]], ['lBarr', [10510]], ['lbbrk', [10098]], ['lbrace', [123]], ['lbrack', [91]], ['lbrke', [10635]], ['lbrksld', [10639]], ['lbrkslu', [10637]], ['Lcaron', [317]], ['lcaron', [318]], ['Lcedil', [315]], ['lcedil', [316]], ['lceil', [8968]], ['lcub', [123]], ['Lcy', [1051]], ['lcy', [1083]], ['ldca', [10550]], ['ldquo', [8220]], ['ldquor', [8222]], ['ldrdhar', [10599]], ['ldrushar', [10571]], ['ldsh', [8626]], ['le', [8804]], ['lE', [8806]], ['LeftAngleBracket', [10216]], ['LeftArrowBar', [8676]], ['leftarrow', [8592]], ['LeftArrow', [8592]], ['Leftarrow', [8656]], ['LeftArrowRightArrow', [8646]], ['leftarrowtail', [8610]], ['LeftCeiling', [8968]], ['LeftDoubleBracket', [10214]], ['LeftDownTeeVector', [10593]], ['LeftDownVectorBar', [10585]], ['LeftDownVector', [8643]], ['LeftFloor', [8970]], ['leftharpoondown', [8637]], ['leftharpoonup', [8636]], ['leftleftarrows', [8647]], ['leftrightarrow', [8596]], ['LeftRightArrow', [8596]], ['Leftrightarrow', [8660]], ['leftrightarrows', [8646]], ['leftrightharpoons', [8651]], ['leftrightsquigarrow', [8621]], ['LeftRightVector', [10574]], ['LeftTeeArrow', [8612]], ['LeftTee', [8867]], ['LeftTeeVector', [10586]], ['leftthreetimes', [8907]], ['LeftTriangleBar', [10703]], ['LeftTriangle', [8882]], ['LeftTriangleEqual', [8884]], ['LeftUpDownVector', [10577]], ['LeftUpTeeVector', [10592]], ['LeftUpVectorBar', [10584]], ['LeftUpVector', [8639]], ['LeftVectorBar', [10578]], ['LeftVector', [8636]], ['lEg', [10891]], ['leg', [8922]], ['leq', [8804]], ['leqq', [8806]], ['leqslant', [10877]], ['lescc', [10920]], ['les', [10877]], ['lesdot', [10879]], ['lesdoto', [10881]], ['lesdotor', [10883]], ['lesg', [8922, 65024]], ['lesges', [10899]], ['lessapprox', [10885]], ['lessdot', [8918]], ['lesseqgtr', [8922]], ['lesseqqgtr', [10891]], ['LessEqualGreater', [8922]], ['LessFullEqual', [8806]], ['LessGreater', [8822]], ['lessgtr', [8822]], ['LessLess', [10913]], ['lesssim', [8818]], ['LessSlantEqual', [10877]], ['LessTilde', [8818]], ['lfisht', [10620]], ['lfloor', [8970]], ['Lfr', [120079]], ['lfr', [120105]], ['lg', [8822]], ['lgE', [10897]], ['lHar', [10594]], ['lhard', [8637]], ['lharu', [8636]], ['lharul', [10602]], ['lhblk', [9604]], ['LJcy', [1033]], ['ljcy', [1113]], ['llarr', [8647]], ['ll', [8810]], ['Ll', [8920]], ['llcorner', [8990]], ['Lleftarrow', [8666]], ['llhard', [10603]], ['lltri', [9722]], ['Lmidot', [319]], ['lmidot', [320]], ['lmoustache', [9136]], ['lmoust', [9136]], ['lnap', [10889]], ['lnapprox', [10889]], ['lne', [10887]], ['lnE', [8808]], ['lneq', [10887]], ['lneqq', [8808]], ['lnsim', [8934]], ['loang', [10220]], ['loarr', [8701]], ['lobrk', [10214]], ['longleftarrow', [10229]], ['LongLeftArrow', [10229]], ['Longleftarrow', [10232]], ['longleftrightarrow', [10231]], ['LongLeftRightArrow', [10231]], ['Longleftrightarrow', [10234]], ['longmapsto', [10236]], ['longrightarrow', [10230]], ['LongRightArrow', [10230]], ['Longrightarrow', [10233]], ['looparrowleft', [8619]], ['looparrowright', [8620]], ['lopar', [10629]], ['Lopf', [120131]], ['lopf', [120157]], ['loplus', [10797]], ['lotimes', [10804]], ['lowast', [8727]], ['lowbar', [95]], ['LowerLeftArrow', [8601]], ['LowerRightArrow', [8600]], ['loz', [9674]], ['lozenge', [9674]], ['lozf', [10731]], ['lpar', [40]], ['lparlt', [10643]], ['lrarr', [8646]], ['lrcorner', [8991]], ['lrhar', [8651]], ['lrhard', [10605]], ['lrm', [8206]], ['lrtri', [8895]], ['lsaquo', [8249]], ['lscr', [120001]], ['Lscr', [8466]], ['lsh', [8624]], ['Lsh', [8624]], ['lsim', [8818]], ['lsime', [10893]], ['lsimg', [10895]], ['lsqb', [91]], ['lsquo', [8216]], ['lsquor', [8218]], ['Lstrok', [321]], ['lstrok', [322]], ['ltcc', [10918]], ['ltcir', [10873]], ['lt', [60]], ['LT', [60]], ['Lt', [8810]], ['ltdot', [8918]], ['lthree', [8907]], ['ltimes', [8905]], ['ltlarr', [10614]], ['ltquest', [10875]], ['ltri', [9667]], ['ltrie', [8884]], ['ltrif', [9666]], ['ltrPar', [10646]], ['lurdshar', [10570]], ['luruhar', [10598]], ['lvertneqq', [8808, 65024]], ['lvnE', [8808, 65024]], ['macr', [175]], ['male', [9794]], ['malt', [10016]], ['maltese', [10016]], ['Map', [10501]], ['map', [8614]], ['mapsto', [8614]], ['mapstodown', [8615]], ['mapstoleft', [8612]], ['mapstoup', [8613]], ['marker', [9646]], ['mcomma', [10793]], ['Mcy', [1052]], ['mcy', [1084]], ['mdash', [8212]], ['mDDot', [8762]], ['measuredangle', [8737]], ['MediumSpace', [8287]], ['Mellintrf', [8499]], ['Mfr', [120080]], ['mfr', [120106]], ['mho', [8487]], ['micro', [181]], ['midast', [42]], ['midcir', [10992]], ['mid', [8739]], ['middot', [183]], ['minusb', [8863]], ['minus', [8722]], ['minusd', [8760]], ['minusdu', [10794]], ['MinusPlus', [8723]], ['mlcp', [10971]], ['mldr', [8230]], ['mnplus', [8723]], ['models', [8871]], ['Mopf', [120132]], ['mopf', [120158]], ['mp', [8723]], ['mscr', [120002]], ['Mscr', [8499]], ['mstpos', [8766]], ['Mu', [924]], ['mu', [956]], ['multimap', [8888]], ['mumap', [8888]], ['nabla', [8711]], ['Nacute', [323]], ['nacute', [324]], ['nang', [8736, 8402]], ['nap', [8777]], ['napE', [10864, 824]], ['napid', [8779, 824]], ['napos', [329]], ['napprox', [8777]], ['natural', [9838]], ['naturals', [8469]], ['natur', [9838]], ['nbsp', [160]], ['nbump', [8782, 824]], ['nbumpe', [8783, 824]], ['ncap', [10819]], ['Ncaron', [327]], ['ncaron', [328]], ['Ncedil', [325]], ['ncedil', [326]], ['ncong', [8775]], ['ncongdot', [10861, 824]], ['ncup', [10818]], ['Ncy', [1053]], ['ncy', [1085]], ['ndash', [8211]], ['nearhk', [10532]], ['nearr', [8599]], ['neArr', [8663]], ['nearrow', [8599]], ['ne', [8800]], ['nedot', [8784, 824]], ['NegativeMediumSpace', [8203]], ['NegativeThickSpace', [8203]], ['NegativeThinSpace', [8203]], ['NegativeVeryThinSpace', [8203]], ['nequiv', [8802]], ['nesear', [10536]], ['nesim', [8770, 824]], ['NestedGreaterGreater', [8811]], ['NestedLessLess', [8810]], ['nexist', [8708]], ['nexists', [8708]], ['Nfr', [120081]], ['nfr', [120107]], ['ngE', [8807, 824]], ['nge', [8817]], ['ngeq', [8817]], ['ngeqq', [8807, 824]], ['ngeqslant', [10878, 824]], ['nges', [10878, 824]], ['nGg', [8921, 824]], ['ngsim', [8821]], ['nGt', [8811, 8402]], ['ngt', [8815]], ['ngtr', [8815]], ['nGtv', [8811, 824]], ['nharr', [8622]], ['nhArr', [8654]], ['nhpar', [10994]], ['ni', [8715]], ['nis', [8956]], ['nisd', [8954]], ['niv', [8715]], ['NJcy', [1034]], ['njcy', [1114]], ['nlarr', [8602]], ['nlArr', [8653]], ['nldr', [8229]], ['nlE', [8806, 824]], ['nle', [8816]], ['nleftarrow', [8602]], ['nLeftarrow', [8653]], ['nleftrightarrow', [8622]], ['nLeftrightarrow', [8654]], ['nleq', [8816]], ['nleqq', [8806, 824]], ['nleqslant', [10877, 824]], ['nles', [10877, 824]], ['nless', [8814]], ['nLl', [8920, 824]], ['nlsim', [8820]], ['nLt', [8810, 8402]], ['nlt', [8814]], ['nltri', [8938]], ['nltrie', [8940]], ['nLtv', [8810, 824]], ['nmid', [8740]], ['NoBreak', [8288]], ['NonBreakingSpace', [160]], ['nopf', [120159]], ['Nopf', [8469]], ['Not', [10988]], ['not', [172]], ['NotCongruent', [8802]], ['NotCupCap', [8813]], ['NotDoubleVerticalBar', [8742]], ['NotElement', [8713]], ['NotEqual', [8800]], ['NotEqualTilde', [8770, 824]], ['NotExists', [8708]], ['NotGreater', [8815]], ['NotGreaterEqual', [8817]], ['NotGreaterFullEqual', [8807, 824]], ['NotGreaterGreater', [8811, 824]], ['NotGreaterLess', [8825]], ['NotGreaterSlantEqual', [10878, 824]], ['NotGreaterTilde', [8821]], ['NotHumpDownHump', [8782, 824]], ['NotHumpEqual', [8783, 824]], ['notin', [8713]], ['notindot', [8949, 824]], ['notinE', [8953, 824]], ['notinva', [8713]], ['notinvb', [8951]], ['notinvc', [8950]], ['NotLeftTriangleBar', [10703, 824]], ['NotLeftTriangle', [8938]], ['NotLeftTriangleEqual', [8940]], ['NotLess', [8814]], ['NotLessEqual', [8816]], ['NotLessGreater', [8824]], ['NotLessLess', [8810, 824]], ['NotLessSlantEqual', [10877, 824]], ['NotLessTilde', [8820]], ['NotNestedGreaterGreater', [10914, 824]], ['NotNestedLessLess', [10913, 824]], ['notni', [8716]], ['notniva', [8716]], ['notnivb', [8958]], ['notnivc', [8957]], ['NotPrecedes', [8832]], ['NotPrecedesEqual', [10927, 824]], ['NotPrecedesSlantEqual', [8928]], ['NotReverseElement', [8716]], ['NotRightTriangleBar', [10704, 824]], ['NotRightTriangle', [8939]], ['NotRightTriangleEqual', [8941]], ['NotSquareSubset', [8847, 824]], ['NotSquareSubsetEqual', [8930]], ['NotSquareSuperset', [8848, 824]], ['NotSquareSupersetEqual', [8931]], ['NotSubset', [8834, 8402]], ['NotSubsetEqual', [8840]], ['NotSucceeds', [8833]], ['NotSucceedsEqual', [10928, 824]], ['NotSucceedsSlantEqual', [8929]], ['NotSucceedsTilde', [8831, 824]], ['NotSuperset', [8835, 8402]], ['NotSupersetEqual', [8841]], ['NotTilde', [8769]], ['NotTildeEqual', [8772]], ['NotTildeFullEqual', [8775]], ['NotTildeTilde', [8777]], ['NotVerticalBar', [8740]], ['nparallel', [8742]], ['npar', [8742]], ['nparsl', [11005, 8421]], ['npart', [8706, 824]], ['npolint', [10772]], ['npr', [8832]], ['nprcue', [8928]], ['nprec', [8832]], ['npreceq', [10927, 824]], ['npre', [10927, 824]], ['nrarrc', [10547, 824]], ['nrarr', [8603]], ['nrArr', [8655]], ['nrarrw', [8605, 824]], ['nrightarrow', [8603]], ['nRightarrow', [8655]], ['nrtri', [8939]], ['nrtrie', [8941]], ['nsc', [8833]], ['nsccue', [8929]], ['nsce', [10928, 824]], ['Nscr', [119977]], ['nscr', [120003]], ['nshortmid', [8740]], ['nshortparallel', [8742]], ['nsim', [8769]], ['nsime', [8772]], ['nsimeq', [8772]], ['nsmid', [8740]], ['nspar', [8742]], ['nsqsube', [8930]], ['nsqsupe', [8931]], ['nsub', [8836]], ['nsubE', [10949, 824]], ['nsube', [8840]], ['nsubset', [8834, 8402]], ['nsubseteq', [8840]], ['nsubseteqq', [10949, 824]], ['nsucc', [8833]], ['nsucceq', [10928, 824]], ['nsup', [8837]], ['nsupE', [10950, 824]], ['nsupe', [8841]], ['nsupset', [8835, 8402]], ['nsupseteq', [8841]], ['nsupseteqq', [10950, 824]], ['ntgl', [8825]], ['Ntilde', [209]], ['ntilde', [241]], ['ntlg', [8824]], ['ntriangleleft', [8938]], ['ntrianglelefteq', [8940]], ['ntriangleright', [8939]], ['ntrianglerighteq', [8941]], ['Nu', [925]], ['nu', [957]], ['num', [35]], ['numero', [8470]], ['numsp', [8199]], ['nvap', [8781, 8402]], ['nvdash', [8876]], ['nvDash', [8877]], ['nVdash', [8878]], ['nVDash', [8879]], ['nvge', [8805, 8402]], ['nvgt', [62, 8402]], ['nvHarr', [10500]], ['nvinfin', [10718]], ['nvlArr', [10498]], ['nvle', [8804, 8402]], ['nvlt', [60, 8402]], ['nvltrie', [8884, 8402]], ['nvrArr', [10499]], ['nvrtrie', [8885, 8402]], ['nvsim', [8764, 8402]], ['nwarhk', [10531]], ['nwarr', [8598]], ['nwArr', [8662]], ['nwarrow', [8598]], ['nwnear', [10535]], ['Oacute', [211]], ['oacute', [243]], ['oast', [8859]], ['Ocirc', [212]], ['ocirc', [244]], ['ocir', [8858]], ['Ocy', [1054]], ['ocy', [1086]], ['odash', [8861]], ['Odblac', [336]], ['odblac', [337]], ['odiv', [10808]], ['odot', [8857]], ['odsold', [10684]], ['OElig', [338]], ['oelig', [339]], ['ofcir', [10687]], ['Ofr', [120082]], ['ofr', [120108]], ['ogon', [731]], ['Ograve', [210]], ['ograve', [242]], ['ogt', [10689]], ['ohbar', [10677]], ['ohm', [937]], ['oint', [8750]], ['olarr', [8634]], ['olcir', [10686]], ['olcross', [10683]], ['oline', [8254]], ['olt', [10688]], ['Omacr', [332]], ['omacr', [333]], ['Omega', [937]], ['omega', [969]], ['Omicron', [927]], ['omicron', [959]], ['omid', [10678]], ['ominus', [8854]], ['Oopf', [120134]], ['oopf', [120160]], ['opar', [10679]], ['OpenCurlyDoubleQuote', [8220]], ['OpenCurlyQuote', [8216]], ['operp', [10681]], ['oplus', [8853]], ['orarr', [8635]], ['Or', [10836]], ['or', [8744]], ['ord', [10845]], ['order', [8500]], ['orderof', [8500]], ['ordf', [170]], ['ordm', [186]], ['origof', [8886]], ['oror', [10838]], ['orslope', [10839]], ['orv', [10843]], ['oS', [9416]], ['Oscr', [119978]], ['oscr', [8500]], ['Oslash', [216]], ['oslash', [248]], ['osol', [8856]], ['Otilde', [213]], ['otilde', [245]], ['otimesas', [10806]], ['Otimes', [10807]], ['otimes', [8855]], ['Ouml', [214]], ['ouml', [246]], ['ovbar', [9021]], ['OverBar', [8254]], ['OverBrace', [9182]], ['OverBracket', [9140]], ['OverParenthesis', [9180]], ['para', [182]], ['parallel', [8741]], ['par', [8741]], ['parsim', [10995]], ['parsl', [11005]], ['part', [8706]], ['PartialD', [8706]], ['Pcy', [1055]], ['pcy', [1087]], ['percnt', [37]], ['period', [46]], ['permil', [8240]], ['perp', [8869]], ['pertenk', [8241]], ['Pfr', [120083]], ['pfr', [120109]], ['Phi', [934]], ['phi', [966]], ['phiv', [981]], ['phmmat', [8499]], ['phone', [9742]], ['Pi', [928]], ['pi', [960]], ['pitchfork', [8916]], ['piv', [982]], ['planck', [8463]], ['planckh', [8462]], ['plankv', [8463]], ['plusacir', [10787]], ['plusb', [8862]], ['pluscir', [10786]], ['plus', [43]], ['plusdo', [8724]], ['plusdu', [10789]], ['pluse', [10866]], ['PlusMinus', [177]], ['plusmn', [177]], ['plussim', [10790]], ['plustwo', [10791]], ['pm', [177]], ['Poincareplane', [8460]], ['pointint', [10773]], ['popf', [120161]], ['Popf', [8473]], ['pound', [163]], ['prap', [10935]], ['Pr', [10939]], ['pr', [8826]], ['prcue', [8828]], ['precapprox', [10935]], ['prec', [8826]], ['preccurlyeq', [8828]], ['Precedes', [8826]], ['PrecedesEqual', [10927]], ['PrecedesSlantEqual', [8828]], ['PrecedesTilde', [8830]], ['preceq', [10927]], ['precnapprox', [10937]], ['precneqq', [10933]], ['precnsim', [8936]], ['pre', [10927]], ['prE', [10931]], ['precsim', [8830]], ['prime', [8242]], ['Prime', [8243]], ['primes', [8473]], ['prnap', [10937]], ['prnE', [10933]], ['prnsim', [8936]], ['prod', [8719]], ['Product', [8719]], ['profalar', [9006]], ['profline', [8978]], ['profsurf', [8979]], ['prop', [8733]], ['Proportional', [8733]], ['Proportion', [8759]], ['propto', [8733]], ['prsim', [8830]], ['prurel', [8880]], ['Pscr', [119979]], ['pscr', [120005]], ['Psi', [936]], ['psi', [968]], ['puncsp', [8200]], ['Qfr', [120084]], ['qfr', [120110]], ['qint', [10764]], ['qopf', [120162]], ['Qopf', [8474]], ['qprime', [8279]], ['Qscr', [119980]], ['qscr', [120006]], ['quaternions', [8461]], ['quatint', [10774]], ['quest', [63]], ['questeq', [8799]], ['quot', [34]], ['QUOT', [34]], ['rAarr', [8667]], ['race', [8765, 817]], ['Racute', [340]], ['racute', [341]], ['radic', [8730]], ['raemptyv', [10675]], ['rang', [10217]], ['Rang', [10219]], ['rangd', [10642]], ['range', [10661]], ['rangle', [10217]], ['raquo', [187]], ['rarrap', [10613]], ['rarrb', [8677]], ['rarrbfs', [10528]], ['rarrc', [10547]], ['rarr', [8594]], ['Rarr', [8608]], ['rArr', [8658]], ['rarrfs', [10526]], ['rarrhk', [8618]], ['rarrlp', [8620]], ['rarrpl', [10565]], ['rarrsim', [10612]], ['Rarrtl', [10518]], ['rarrtl', [8611]], ['rarrw', [8605]], ['ratail', [10522]], ['rAtail', [10524]], ['ratio', [8758]], ['rationals', [8474]], ['rbarr', [10509]], ['rBarr', [10511]], ['RBarr', [10512]], ['rbbrk', [10099]], ['rbrace', [125]], ['rbrack', [93]], ['rbrke', [10636]], ['rbrksld', [10638]], ['rbrkslu', [10640]], ['Rcaron', [344]], ['rcaron', [345]], ['Rcedil', [342]], ['rcedil', [343]], ['rceil', [8969]], ['rcub', [125]], ['Rcy', [1056]], ['rcy', [1088]], ['rdca', [10551]], ['rdldhar', [10601]], ['rdquo', [8221]], ['rdquor', [8221]], ['CloseCurlyDoubleQuote', [8221]], ['rdsh', [8627]], ['real', [8476]], ['realine', [8475]], ['realpart', [8476]], ['reals', [8477]], ['Re', [8476]], ['rect', [9645]], ['reg', [174]], ['REG', [174]], ['ReverseElement', [8715]], ['ReverseEquilibrium', [8651]], ['ReverseUpEquilibrium', [10607]], ['rfisht', [10621]], ['rfloor', [8971]], ['rfr', [120111]], ['Rfr', [8476]], ['rHar', [10596]], ['rhard', [8641]], ['rharu', [8640]], ['rharul', [10604]], ['Rho', [929]], ['rho', [961]], ['rhov', [1009]], ['RightAngleBracket', [10217]], ['RightArrowBar', [8677]], ['rightarrow', [8594]], ['RightArrow', [8594]], ['Rightarrow', [8658]], ['RightArrowLeftArrow', [8644]], ['rightarrowtail', [8611]], ['RightCeiling', [8969]], ['RightDoubleBracket', [10215]], ['RightDownTeeVector', [10589]], ['RightDownVectorBar', [10581]], ['RightDownVector', [8642]], ['RightFloor', [8971]], ['rightharpoondown', [8641]], ['rightharpoonup', [8640]], ['rightleftarrows', [8644]], ['rightleftharpoons', [8652]], ['rightrightarrows', [8649]], ['rightsquigarrow', [8605]], ['RightTeeArrow', [8614]], ['RightTee', [8866]], ['RightTeeVector', [10587]], ['rightthreetimes', [8908]], ['RightTriangleBar', [10704]], ['RightTriangle', [8883]], ['RightTriangleEqual', [8885]], ['RightUpDownVector', [10575]], ['RightUpTeeVector', [10588]], ['RightUpVectorBar', [10580]], ['RightUpVector', [8638]], ['RightVectorBar', [10579]], ['RightVector', [8640]], ['ring', [730]], ['risingdotseq', [8787]], ['rlarr', [8644]], ['rlhar', [8652]], ['rlm', [8207]], ['rmoustache', [9137]], ['rmoust', [9137]], ['rnmid', [10990]], ['roang', [10221]], ['roarr', [8702]], ['robrk', [10215]], ['ropar', [10630]], ['ropf', [120163]], ['Ropf', [8477]], ['roplus', [10798]], ['rotimes', [10805]], ['RoundImplies', [10608]], ['rpar', [41]], ['rpargt', [10644]], ['rppolint', [10770]], ['rrarr', [8649]], ['Rrightarrow', [8667]], ['rsaquo', [8250]], ['rscr', [120007]], ['Rscr', [8475]], ['rsh', [8625]], ['Rsh', [8625]], ['rsqb', [93]], ['rsquo', [8217]], ['rsquor', [8217]], ['CloseCurlyQuote', [8217]], ['rthree', [8908]], ['rtimes', [8906]], ['rtri', [9657]], ['rtrie', [8885]], ['rtrif', [9656]], ['rtriltri', [10702]], ['RuleDelayed', [10740]], ['ruluhar', [10600]], ['rx', [8478]], ['Sacute', [346]], ['sacute', [347]], ['sbquo', [8218]], ['scap', [10936]], ['Scaron', [352]], ['scaron', [353]], ['Sc', [10940]], ['sc', [8827]], ['sccue', [8829]], ['sce', [10928]], ['scE', [10932]], ['Scedil', [350]], ['scedil', [351]], ['Scirc', [348]], ['scirc', [349]], ['scnap', [10938]], ['scnE', [10934]], ['scnsim', [8937]], ['scpolint', [10771]], ['scsim', [8831]], ['Scy', [1057]], ['scy', [1089]], ['sdotb', [8865]], ['sdot', [8901]], ['sdote', [10854]], ['searhk', [10533]], ['searr', [8600]], ['seArr', [8664]], ['searrow', [8600]], ['sect', [167]], ['semi', [59]], ['seswar', [10537]], ['setminus', [8726]], ['setmn', [8726]], ['sext', [10038]], ['Sfr', [120086]], ['sfr', [120112]], ['sfrown', [8994]], ['sharp', [9839]], ['SHCHcy', [1065]], ['shchcy', [1097]], ['SHcy', [1064]], ['shcy', [1096]], ['ShortDownArrow', [8595]], ['ShortLeftArrow', [8592]], ['shortmid', [8739]], ['shortparallel', [8741]], ['ShortRightArrow', [8594]], ['ShortUpArrow', [8593]], ['shy', [173]], ['Sigma', [931]], ['sigma', [963]], ['sigmaf', [962]], ['sigmav', [962]], ['sim', [8764]], ['simdot', [10858]], ['sime', [8771]], ['simeq', [8771]], ['simg', [10910]], ['simgE', [10912]], ['siml', [10909]], ['simlE', [10911]], ['simne', [8774]], ['simplus', [10788]], ['simrarr', [10610]], ['slarr', [8592]], ['SmallCircle', [8728]], ['smallsetminus', [8726]], ['smashp', [10803]], ['smeparsl', [10724]], ['smid', [8739]], ['smile', [8995]], ['smt', [10922]], ['smte', [10924]], ['smtes', [10924, 65024]], ['SOFTcy', [1068]], ['softcy', [1100]], ['solbar', [9023]], ['solb', [10692]], ['sol', [47]], ['Sopf', [120138]], ['sopf', [120164]], ['spades', [9824]], ['spadesuit', [9824]], ['spar', [8741]], ['sqcap', [8851]], ['sqcaps', [8851, 65024]], ['sqcup', [8852]], ['sqcups', [8852, 65024]], ['Sqrt', [8730]], ['sqsub', [8847]], ['sqsube', [8849]], ['sqsubset', [8847]], ['sqsubseteq', [8849]], ['sqsup', [8848]], ['sqsupe', [8850]], ['sqsupset', [8848]], ['sqsupseteq', [8850]], ['square', [9633]], ['Square', [9633]], ['SquareIntersection', [8851]], ['SquareSubset', [8847]], ['SquareSubsetEqual', [8849]], ['SquareSuperset', [8848]], ['SquareSupersetEqual', [8850]], ['SquareUnion', [8852]], ['squarf', [9642]], ['squ', [9633]], ['squf', [9642]], ['srarr', [8594]], ['Sscr', [119982]], ['sscr', [120008]], ['ssetmn', [8726]], ['ssmile', [8995]], ['sstarf', [8902]], ['Star', [8902]], ['star', [9734]], ['starf', [9733]], ['straightepsilon', [1013]], ['straightphi', [981]], ['strns', [175]], ['sub', [8834]], ['Sub', [8912]], ['subdot', [10941]], ['subE', [10949]], ['sube', [8838]], ['subedot', [10947]], ['submult', [10945]], ['subnE', [10955]], ['subne', [8842]], ['subplus', [10943]], ['subrarr', [10617]], ['subset', [8834]], ['Subset', [8912]], ['subseteq', [8838]], ['subseteqq', [10949]], ['SubsetEqual', [8838]], ['subsetneq', [8842]], ['subsetneqq', [10955]], ['subsim', [10951]], ['subsub', [10965]], ['subsup', [10963]], ['succapprox', [10936]], ['succ', [8827]], ['succcurlyeq', [8829]], ['Succeeds', [8827]], ['SucceedsEqual', [10928]], ['SucceedsSlantEqual', [8829]], ['SucceedsTilde', [8831]], ['succeq', [10928]], ['succnapprox', [10938]], ['succneqq', [10934]], ['succnsim', [8937]], ['succsim', [8831]], ['SuchThat', [8715]], ['sum', [8721]], ['Sum', [8721]], ['sung', [9834]], ['sup1', [185]], ['sup2', [178]], ['sup3', [179]], ['sup', [8835]], ['Sup', [8913]], ['supdot', [10942]], ['supdsub', [10968]], ['supE', [10950]], ['supe', [8839]], ['supedot', [10948]], ['Superset', [8835]], ['SupersetEqual', [8839]], ['suphsol', [10185]], ['suphsub', [10967]], ['suplarr', [10619]], ['supmult', [10946]], ['supnE', [10956]], ['supne', [8843]], ['supplus', [10944]], ['supset', [8835]], ['Supset', [8913]], ['supseteq', [8839]], ['supseteqq', [10950]], ['supsetneq', [8843]], ['supsetneqq', [10956]], ['supsim', [10952]], ['supsub', [10964]], ['supsup', [10966]], ['swarhk', [10534]], ['swarr', [8601]], ['swArr', [8665]], ['swarrow', [8601]], ['swnwar', [10538]], ['szlig', [223]], ['Tab', [9]], ['target', [8982]], ['Tau', [932]], ['tau', [964]], ['tbrk', [9140]], ['Tcaron', [356]], ['tcaron', [357]], ['Tcedil', [354]], ['tcedil', [355]], ['Tcy', [1058]], ['tcy', [1090]], ['tdot', [8411]], ['telrec', [8981]], ['Tfr', [120087]], ['tfr', [120113]], ['there4', [8756]], ['therefore', [8756]], ['Therefore', [8756]], ['Theta', [920]], ['theta', [952]], ['thetasym', [977]], ['thetav', [977]], ['thickapprox', [8776]], ['thicksim', [8764]], ['ThickSpace', [8287, 8202]], ['ThinSpace', [8201]], ['thinsp', [8201]], ['thkap', [8776]], ['thksim', [8764]], ['THORN', [222]], ['thorn', [254]], ['tilde', [732]], ['Tilde', [8764]], ['TildeEqual', [8771]], ['TildeFullEqual', [8773]], ['TildeTilde', [8776]], ['timesbar', [10801]], ['timesb', [8864]], ['times', [215]], ['timesd', [10800]], ['tint', [8749]], ['toea', [10536]], ['topbot', [9014]], ['topcir', [10993]], ['top', [8868]], ['Topf', [120139]], ['topf', [120165]], ['topfork', [10970]], ['tosa', [10537]], ['tprime', [8244]], ['trade', [8482]], ['TRADE', [8482]], ['triangle', [9653]], ['triangledown', [9663]], ['triangleleft', [9667]], ['trianglelefteq', [8884]], ['triangleq', [8796]], ['triangleright', [9657]], ['trianglerighteq', [8885]], ['tridot', [9708]], ['trie', [8796]], ['triminus', [10810]], ['TripleDot', [8411]], ['triplus', [10809]], ['trisb', [10701]], ['tritime', [10811]], ['trpezium', [9186]], ['Tscr', [119983]], ['tscr', [120009]], ['TScy', [1062]], ['tscy', [1094]], ['TSHcy', [1035]], ['tshcy', [1115]], ['Tstrok', [358]], ['tstrok', [359]], ['twixt', [8812]], ['twoheadleftarrow', [8606]], ['twoheadrightarrow', [8608]], ['Uacute', [218]], ['uacute', [250]], ['uarr', [8593]], ['Uarr', [8607]], ['uArr', [8657]], ['Uarrocir', [10569]], ['Ubrcy', [1038]], ['ubrcy', [1118]], ['Ubreve', [364]], ['ubreve', [365]], ['Ucirc', [219]], ['ucirc', [251]], ['Ucy', [1059]], ['ucy', [1091]], ['udarr', [8645]], ['Udblac', [368]], ['udblac', [369]], ['udhar', [10606]], ['ufisht', [10622]], ['Ufr', [120088]], ['ufr', [120114]], ['Ugrave', [217]], ['ugrave', [249]], ['uHar', [10595]], ['uharl', [8639]], ['uharr', [8638]], ['uhblk', [9600]], ['ulcorn', [8988]], ['ulcorner', [8988]], ['ulcrop', [8975]], ['ultri', [9720]], ['Umacr', [362]], ['umacr', [363]], ['uml', [168]], ['UnderBar', [95]], ['UnderBrace', [9183]], ['UnderBracket', [9141]], ['UnderParenthesis', [9181]], ['Union', [8899]], ['UnionPlus', [8846]], ['Uogon', [370]], ['uogon', [371]], ['Uopf', [120140]], ['uopf', [120166]], ['UpArrowBar', [10514]], ['uparrow', [8593]], ['UpArrow', [8593]], ['Uparrow', [8657]], ['UpArrowDownArrow', [8645]], ['updownarrow', [8597]], ['UpDownArrow', [8597]], ['Updownarrow', [8661]], ['UpEquilibrium', [10606]], ['upharpoonleft', [8639]], ['upharpoonright', [8638]], ['uplus', [8846]], ['UpperLeftArrow', [8598]], ['UpperRightArrow', [8599]], ['upsi', [965]], ['Upsi', [978]], ['upsih', [978]], ['Upsilon', [933]], ['upsilon', [965]], ['UpTeeArrow', [8613]], ['UpTee', [8869]], ['upuparrows', [8648]], ['urcorn', [8989]], ['urcorner', [8989]], ['urcrop', [8974]], ['Uring', [366]], ['uring', [367]], ['urtri', [9721]], ['Uscr', [119984]], ['uscr', [120010]], ['utdot', [8944]], ['Utilde', [360]], ['utilde', [361]], ['utri', [9653]], ['utrif', [9652]], ['uuarr', [8648]], ['Uuml', [220]], ['uuml', [252]], ['uwangle', [10663]], ['vangrt', [10652]], ['varepsilon', [1013]], ['varkappa', [1008]], ['varnothing', [8709]], ['varphi', [981]], ['varpi', [982]], ['varpropto', [8733]], ['varr', [8597]], ['vArr', [8661]], ['varrho', [1009]], ['varsigma', [962]], ['varsubsetneq', [8842, 65024]], ['varsubsetneqq', [10955, 65024]], ['varsupsetneq', [8843, 65024]], ['varsupsetneqq', [10956, 65024]], ['vartheta', [977]], ['vartriangleleft', [8882]], ['vartriangleright', [8883]], ['vBar', [10984]], ['Vbar', [10987]], ['vBarv', [10985]], ['Vcy', [1042]], ['vcy', [1074]], ['vdash', [8866]], ['vDash', [8872]], ['Vdash', [8873]], ['VDash', [8875]], ['Vdashl', [10982]], ['veebar', [8891]], ['vee', [8744]], ['Vee', [8897]], ['veeeq', [8794]], ['vellip', [8942]], ['verbar', [124]], ['Verbar', [8214]], ['vert', [124]], ['Vert', [8214]], ['VerticalBar', [8739]], ['VerticalLine', [124]], ['VerticalSeparator', [10072]], ['VerticalTilde', [8768]], ['VeryThinSpace', [8202]], ['Vfr', [120089]], ['vfr', [120115]], ['vltri', [8882]], ['vnsub', [8834, 8402]], ['vnsup', [8835, 8402]], ['Vopf', [120141]], ['vopf', [120167]], ['vprop', [8733]], ['vrtri', [8883]], ['Vscr', [119985]], ['vscr', [120011]], ['vsubnE', [10955, 65024]], ['vsubne', [8842, 65024]], ['vsupnE', [10956, 65024]], ['vsupne', [8843, 65024]], ['Vvdash', [8874]], ['vzigzag', [10650]], ['Wcirc', [372]], ['wcirc', [373]], ['wedbar', [10847]], ['wedge', [8743]], ['Wedge', [8896]], ['wedgeq', [8793]], ['weierp', [8472]], ['Wfr', [120090]], ['wfr', [120116]], ['Wopf', [120142]], ['wopf', [120168]], ['wp', [8472]], ['wr', [8768]], ['wreath', [8768]], ['Wscr', [119986]], ['wscr', [120012]], ['xcap', [8898]], ['xcirc', [9711]], ['xcup', [8899]], ['xdtri', [9661]], ['Xfr', [120091]], ['xfr', [120117]], ['xharr', [10231]], ['xhArr', [10234]], ['Xi', [926]], ['xi', [958]], ['xlarr', [10229]], ['xlArr', [10232]], ['xmap', [10236]], ['xnis', [8955]], ['xodot', [10752]], ['Xopf', [120143]], ['xopf', [120169]], ['xoplus', [10753]], ['xotime', [10754]], ['xrarr', [10230]], ['xrArr', [10233]], ['Xscr', [119987]], ['xscr', [120013]], ['xsqcup', [10758]], ['xuplus', [10756]], ['xutri', [9651]], ['xvee', [8897]], ['xwedge', [8896]], ['Yacute', [221]], ['yacute', [253]], ['YAcy', [1071]], ['yacy', [1103]], ['Ycirc', [374]], ['ycirc', [375]], ['Ycy', [1067]], ['ycy', [1099]], ['yen', [165]], ['Yfr', [120092]], ['yfr', [120118]], ['YIcy', [1031]], ['yicy', [1111]], ['Yopf', [120144]], ['yopf', [120170]], ['Yscr', [119988]], ['yscr', [120014]], ['YUcy', [1070]], ['yucy', [1102]], ['yuml', [255]], ['Yuml', [376]], ['Zacute', [377]], ['zacute', [378]], ['Zcaron', [381]], ['zcaron', [382]], ['Zcy', [1047]], ['zcy', [1079]], ['Zdot', [379]], ['zdot', [380]], ['zeetrf', [8488]], ['ZeroWidthSpace', [8203]], ['Zeta', [918]], ['zeta', [950]], ['zfr', [120119]], ['Zfr', [8488]], ['ZHcy', [1046]], ['zhcy', [1078]], ['zigrarr', [8669]], ['zopf', [120171]], ['Zopf', [8484]], ['Zscr', [119989]], ['zscr', [120015]], ['zwj', [8205]], ['zwnj', [8204]]]; + +var alphaIndex = {}; +var charIndex = {}; + +createIndexes(alphaIndex, charIndex); + +/** + * @constructor + */ +function Html5Entities() {} + +/** + * @param {String} str + * @returns {String} + */ +Html5Entities.prototype.decode = function(str) { + if (!str || !str.length) { + return ''; + } + return str.replace(/&(#?[\w\d]+);?/g, function(s, entity) { + var chr; + if (entity.charAt(0) === "#") { + var code = entity.charAt(1) === 'x' ? + parseInt(entity.substr(2).toLowerCase(), 16) : + parseInt(entity.substr(1)); + + if (!(isNaN(code) || code < -32768 || code > 65535)) { + chr = String.fromCharCode(code); + } + } else { + chr = alphaIndex[entity]; + } + return chr || s; + }); +}; + +/** + * @param {String} str + * @returns {String} + */ + Html5Entities.decode = function(str) { + return new Html5Entities().decode(str); + }; + +/** + * @param {String} str + * @returns {String} + */ +Html5Entities.prototype.encode = function(str) { + if (!str || !str.length) { + return ''; + } + var strLength = str.length; + var result = ''; + var i = 0; + while (i < strLength) { + var charInfo = charIndex[str.charCodeAt(i)]; + if (charInfo) { + var alpha = charInfo[str.charCodeAt(i + 1)]; + if (alpha) { + i++; + } else { + alpha = charInfo['']; + } + if (alpha) { + result += "&" + alpha + ";"; + i++; + continue; + } + } + result += str.charAt(i); + i++; + } + return result; +}; + +/** + * @param {String} str + * @returns {String} + */ + Html5Entities.encode = function(str) { + return new Html5Entities().encode(str); + }; + +/** + * @param {String} str + * @returns {String} + */ +Html5Entities.prototype.encodeNonUTF = function(str) { + if (!str || !str.length) { + return ''; + } + var strLength = str.length; + var result = ''; + var i = 0; + while (i < strLength) { + var c = str.charCodeAt(i); + var charInfo = charIndex[c]; + if (charInfo) { + var alpha = charInfo[str.charCodeAt(i + 1)]; + if (alpha) { + i++; + } else { + alpha = charInfo['']; + } + if (alpha) { + result += "&" + alpha + ";"; + i++; + continue; + } + } + if (c < 32 || c > 126) { + result += '&#' + c + ';'; + } else { + result += str.charAt(i); + } + i++; + } + return result; +}; + +/** + * @param {String} str + * @returns {String} + */ + Html5Entities.encodeNonUTF = function(str) { + return new Html5Entities().encodeNonUTF(str); + }; + +/** + * @param {String} str + * @returns {String} + */ +Html5Entities.prototype.encodeNonASCII = function(str) { + if (!str || !str.length) { + return ''; + } + var strLength = str.length; + var result = ''; + var i = 0; + while (i < strLength) { + var c = str.charCodeAt(i); + if (c <= 255) { + result += str[i++]; + continue; + } + result += '&#' + c + ';'; + i++ + } + return result; +}; + +/** + * @param {String} str + * @returns {String} + */ + Html5Entities.encodeNonASCII = function(str) { + return new Html5Entities().encodeNonASCII(str); + }; + +/** + * @param {Object} alphaIndex Passed by reference. + * @param {Object} charIndex Passed by reference. + */ +function createIndexes(alphaIndex, charIndex) { + var i = ENTITIES.length; + var _results = []; + while (i--) { + var e = ENTITIES[i]; + var alpha = e[0]; + var chars = e[1]; + var chr = chars[0]; + var addChar = (chr < 32 || chr > 126) || chr === 62 || chr === 60 || chr === 38 || chr === 34 || chr === 39; + var charInfo; + if (addChar) { + charInfo = charIndex[chr] = charIndex[chr] || {}; + } + if (chars[1]) { + var chr2 = chars[1]; + alphaIndex[alpha] = String.fromCharCode(chr) + String.fromCharCode(chr2); + _results.push(addChar && (charInfo[chr2] = alpha)); + } else { + alphaIndex[alpha] = String.fromCharCode(chr); + _results.push(addChar && (charInfo[''] = alpha)); + } + } +} + +module.exports = Html5Entities; + + +/***/ }), + +/***/ "./node_modules/html-entities/lib/xml-entities.js": +/*!********************************************************!*\ + !*** ./node_modules/html-entities/lib/xml-entities.js ***! + \********************************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +var ALPHA_INDEX = { + '<': '<', + '>': '>', + '"': '"', + '&apos': '\'', + '&': '&', + '<': '<', + '>': '>', + '"': '"', + ''': '\'', + '&': '&' +}; + +var CHAR_INDEX = { + 60: 'lt', + 62: 'gt', + 34: 'quot', + 39: 'apos', + 38: 'amp' +}; + +var CHAR_S_INDEX = { + '<': '<', + '>': '>', + '"': '"', + '\'': ''', + '&': '&' +}; + +/** + * @constructor + */ +function XmlEntities() {} + +/** + * @param {String} str + * @returns {String} + */ +XmlEntities.prototype.encode = function(str) { + if (!str || !str.length) { + return ''; + } + return str.replace(/<|>|"|'|&/g, function(s) { + return CHAR_S_INDEX[s]; + }); +}; + +/** + * @param {String} str + * @returns {String} + */ + XmlEntities.encode = function(str) { + return new XmlEntities().encode(str); + }; + +/** + * @param {String} str + * @returns {String} + */ +XmlEntities.prototype.decode = function(str) { + if (!str || !str.length) { + return ''; + } + return str.replace(/&#?[0-9a-zA-Z]+;?/g, function(s) { + if (s.charAt(1) === '#') { + var code = s.charAt(2).toLowerCase() === 'x' ? + parseInt(s.substr(3), 16) : + parseInt(s.substr(2)); + + if (isNaN(code) || code < -32768 || code > 65535) { + return ''; + } + return String.fromCharCode(code); + } + return ALPHA_INDEX[s] || s; + }); +}; + +/** + * @param {String} str + * @returns {String} + */ + XmlEntities.decode = function(str) { + return new XmlEntities().decode(str); + }; + +/** + * @param {String} str + * @returns {String} + */ +XmlEntities.prototype.encodeNonUTF = function(str) { + if (!str || !str.length) { + return ''; + } + var strLength = str.length; + var result = ''; + var i = 0; + while (i < strLength) { + var c = str.charCodeAt(i); + var alpha = CHAR_INDEX[c]; + if (alpha) { + result += "&" + alpha + ";"; + i++; + continue; + } + if (c < 32 || c > 126) { + result += '&#' + c + ';'; + } else { + result += str.charAt(i); + } + i++; + } + return result; +}; + +/** + * @param {String} str + * @returns {String} + */ + XmlEntities.encodeNonUTF = function(str) { + return new XmlEntities().encodeNonUTF(str); + }; + +/** + * @param {String} str + * @returns {String} + */ +XmlEntities.prototype.encodeNonASCII = function(str) { + if (!str || !str.length) { + return ''; + } + var strLenght = str.length; + var result = ''; + var i = 0; + while (i < strLenght) { + var c = str.charCodeAt(i); + if (c <= 255) { + result += str[i++]; + continue; + } + result += '&#' + c + ';'; + i++; + } + return result; +}; + +/** + * @param {String} str + * @returns {String} + */ + XmlEntities.encodeNonASCII = function(str) { + return new XmlEntities().encodeNonASCII(str); + }; + +module.exports = XmlEntities; + + +/***/ }), + +/***/ "./node_modules/loglevel/lib/loglevel.js": +/*!***********************************************!*\ + !*** ./node_modules/loglevel/lib/loglevel.js ***! + \***********************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/* +* loglevel - https://github.com/pimterry/loglevel +* +* Copyright (c) 2013 Tim Perry +* Licensed under the MIT license. +*/ +(function (root, definition) { + "use strict"; + if (true) { + !(__WEBPACK_AMD_DEFINE_FACTORY__ = (definition), + __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? + (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) : + __WEBPACK_AMD_DEFINE_FACTORY__), + __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); + } else {} +}(this, function () { + "use strict"; + + // Slightly dubious tricks to cut down minimized file size + var noop = function() {}; + var undefinedType = "undefined"; + var isIE = (typeof window !== undefinedType) && ( + /Trident\/|MSIE /.test(window.navigator.userAgent) + ); + + var logMethods = [ + "trace", + "debug", + "info", + "warn", + "error" + ]; + + // Cross-browser bind equivalent that works at least back to IE6 + function bindMethod(obj, methodName) { + var method = obj[methodName]; + if (typeof method.bind === 'function') { + return method.bind(obj); + } else { + try { + return Function.prototype.bind.call(method, obj); + } catch (e) { + // Missing bind shim or IE8 + Modernizr, fallback to wrapping + return function() { + return Function.prototype.apply.apply(method, [obj, arguments]); + }; + } + } + } + + // Trace() doesn't print the message in IE, so for that case we need to wrap it + function traceForIE() { + if (console.log) { + if (console.log.apply) { + console.log.apply(console, arguments); + } else { + // In old IE, native console methods themselves don't have apply(). + Function.prototype.apply.apply(console.log, [console, arguments]); + } + } + if (console.trace) console.trace(); + } + + // Build the best logging method possible for this env + // Wherever possible we want to bind, not wrap, to preserve stack traces + function realMethod(methodName) { + if (methodName === 'debug') { + methodName = 'log'; + } + + if (typeof console === undefinedType) { + return false; // No method possible, for now - fixed later by enableLoggingWhenConsoleArrives + } else if (methodName === 'trace' && isIE) { + return traceForIE; + } else if (console[methodName] !== undefined) { + return bindMethod(console, methodName); + } else if (console.log !== undefined) { + return bindMethod(console, 'log'); + } else { + return noop; + } + } + + // These private functions always need `this` to be set properly + + function replaceLoggingMethods(level, loggerName) { + /*jshint validthis:true */ + for (var i = 0; i < logMethods.length; i++) { + var methodName = logMethods[i]; + this[methodName] = (i < level) ? + noop : + this.methodFactory(methodName, level, loggerName); + } + + // Define log.log as an alias for log.debug + this.log = this.debug; + } + + // In old IE versions, the console isn't present until you first open it. + // We build realMethod() replacements here that regenerate logging methods + function enableLoggingWhenConsoleArrives(methodName, level, loggerName) { + return function () { + if (typeof console !== undefinedType) { + replaceLoggingMethods.call(this, level, loggerName); + this[methodName].apply(this, arguments); + } + }; + } + + // By default, we use closely bound real methods wherever possible, and + // otherwise we wait for a console to appear, and then try again. + function defaultMethodFactory(methodName, level, loggerName) { + /*jshint validthis:true */ + return realMethod(methodName) || + enableLoggingWhenConsoleArrives.apply(this, arguments); + } + + function Logger(name, defaultLevel, factory) { + var self = this; + var currentLevel; + var storageKey = "loglevel"; + if (name) { + storageKey += ":" + name; + } + + function persistLevelIfPossible(levelNum) { + var levelName = (logMethods[levelNum] || 'silent').toUpperCase(); + + if (typeof window === undefinedType) return; + + // Use localStorage if available + try { + window.localStorage[storageKey] = levelName; + return; + } catch (ignore) {} + + // Use session cookie as fallback + try { + window.document.cookie = + encodeURIComponent(storageKey) + "=" + levelName + ";"; + } catch (ignore) {} + } + + function getPersistedLevel() { + var storedLevel; + + if (typeof window === undefinedType) return; + + try { + storedLevel = window.localStorage[storageKey]; + } catch (ignore) {} + + // Fallback to cookies if local storage gives us nothing + if (typeof storedLevel === undefinedType) { + try { + var cookie = window.document.cookie; + var location = cookie.indexOf( + encodeURIComponent(storageKey) + "="); + if (location !== -1) { + storedLevel = /^([^;]+)/.exec(cookie.slice(location))[1]; + } + } catch (ignore) {} + } + + // If the stored level is not valid, treat it as if nothing was stored. + if (self.levels[storedLevel] === undefined) { + storedLevel = undefined; + } + + return storedLevel; + } + + /* + * + * Public logger API - see https://github.com/pimterry/loglevel for details + * + */ + + self.name = name; + + self.levels = { "TRACE": 0, "DEBUG": 1, "INFO": 2, "WARN": 3, + "ERROR": 4, "SILENT": 5}; + + self.methodFactory = factory || defaultMethodFactory; + + self.getLevel = function () { + return currentLevel; + }; + + self.setLevel = function (level, persist) { + if (typeof level === "string" && self.levels[level.toUpperCase()] !== undefined) { + level = self.levels[level.toUpperCase()]; + } + if (typeof level === "number" && level >= 0 && level <= self.levels.SILENT) { + currentLevel = level; + if (persist !== false) { // defaults to true + persistLevelIfPossible(level); + } + replaceLoggingMethods.call(self, level, name); + if (typeof console === undefinedType && level < self.levels.SILENT) { + return "No console available for logging"; + } + } else { + throw "log.setLevel() called with invalid level: " + level; + } + }; + + self.setDefaultLevel = function (level) { + if (!getPersistedLevel()) { + self.setLevel(level, false); + } + }; + + self.enableAll = function(persist) { + self.setLevel(self.levels.TRACE, persist); + }; + + self.disableAll = function(persist) { + self.setLevel(self.levels.SILENT, persist); + }; + + // Initialize with the right level + var initialLevel = getPersistedLevel(); + if (initialLevel == null) { + initialLevel = defaultLevel == null ? "WARN" : defaultLevel; + } + self.setLevel(initialLevel, false); + } + + /* + * + * Top-level API + * + */ + + var defaultLogger = new Logger(); + + var _loggersByName = {}; + defaultLogger.getLogger = function getLogger(name) { + if (typeof name !== "string" || name === "") { + throw new TypeError("You must supply a name when creating a logger."); + } + + var logger = _loggersByName[name]; + if (!logger) { + logger = _loggersByName[name] = new Logger( + name, defaultLogger.getLevel(), defaultLogger.methodFactory); + } + return logger; + }; + + // Grab the current global log variable in case of overwrite + var _log = (typeof window !== undefinedType) ? window.log : undefined; + defaultLogger.noConflict = function() { + if (typeof window !== undefinedType && + window.log === defaultLogger) { + window.log = _log; + } + + return defaultLogger; + }; + + defaultLogger.getLoggers = function getLoggers() { + return _loggersByName; + }; + + return defaultLogger; +})); + + +/***/ }), + +/***/ "./node_modules/mini-create-react-context/dist/esm/index.js": +/*!******************************************************************!*\ + !*** ./node_modules/mini-create-react-context/dist/esm/index.js ***! + \******************************************************************/ +/*! exports provided: default */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* WEBPACK VAR INJECTION */(function(global) {/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); +/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _babel_runtime_helpers_esm_inheritsLoose__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/esm/inheritsLoose */ "./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js"); +/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! prop-types */ "./node_modules/prop-types/index.js"); +/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_2__); +/* harmony import */ var tiny_warning__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! tiny-warning */ "./node_modules/tiny-warning/dist/tiny-warning.esm.js"); + + + + + +var MAX_SIGNED_31_BIT_INT = 1073741823; +var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : {}; + +function getUniqueId() { + var key = '__global_unique_id__'; + return commonjsGlobal[key] = (commonjsGlobal[key] || 0) + 1; +} + +function objectIs(x, y) { + if (x === y) { + return x !== 0 || 1 / x === 1 / y; + } else { + return x !== x && y !== y; + } +} + +function createEventEmitter(value) { + var handlers = []; + return { + on: function on(handler) { + handlers.push(handler); + }, + off: function off(handler) { + handlers = handlers.filter(function (h) { + return h !== handler; + }); + }, + get: function get() { + return value; + }, + set: function set(newValue, changedBits) { + value = newValue; + handlers.forEach(function (handler) { + return handler(value, changedBits); + }); + } + }; +} + +function onlyChild(children) { + return Array.isArray(children) ? children[0] : children; +} + +function createReactContext(defaultValue, calculateChangedBits) { + var _Provider$childContex, _Consumer$contextType; + + var contextProp = '__create-react-context-' + getUniqueId() + '__'; + + var Provider = /*#__PURE__*/function (_Component) { + Object(_babel_runtime_helpers_esm_inheritsLoose__WEBPACK_IMPORTED_MODULE_1__["default"])(Provider, _Component); + + function Provider() { + var _this; + + _this = _Component.apply(this, arguments) || this; + _this.emitter = createEventEmitter(_this.props.value); + return _this; + } + + var _proto = Provider.prototype; + + _proto.getChildContext = function getChildContext() { + var _ref; + + return _ref = {}, _ref[contextProp] = this.emitter, _ref; + }; + + _proto.componentWillReceiveProps = function componentWillReceiveProps(nextProps) { + if (this.props.value !== nextProps.value) { + var oldValue = this.props.value; + var newValue = nextProps.value; + var changedBits; + + if (objectIs(oldValue, newValue)) { + changedBits = 0; + } else { + changedBits = typeof calculateChangedBits === 'function' ? calculateChangedBits(oldValue, newValue) : MAX_SIGNED_31_BIT_INT; + + if (true) { + Object(tiny_warning__WEBPACK_IMPORTED_MODULE_3__["default"])((changedBits & MAX_SIGNED_31_BIT_INT) === changedBits, 'calculateChangedBits: Expected the return value to be a ' + '31-bit integer. Instead received: ' + changedBits); + } + + changedBits |= 0; + + if (changedBits !== 0) { + this.emitter.set(nextProps.value, changedBits); + } + } + } + }; + + _proto.render = function render() { + return this.props.children; + }; + + return Provider; + }(react__WEBPACK_IMPORTED_MODULE_0__["Component"]); + + Provider.childContextTypes = (_Provider$childContex = {}, _Provider$childContex[contextProp] = prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.object.isRequired, _Provider$childContex); + + var Consumer = /*#__PURE__*/function (_Component2) { + Object(_babel_runtime_helpers_esm_inheritsLoose__WEBPACK_IMPORTED_MODULE_1__["default"])(Consumer, _Component2); + + function Consumer() { + var _this2; + + _this2 = _Component2.apply(this, arguments) || this; + _this2.state = { + value: _this2.getValue() + }; + + _this2.onUpdate = function (newValue, changedBits) { + var observedBits = _this2.observedBits | 0; + + if ((observedBits & changedBits) !== 0) { + _this2.setState({ + value: _this2.getValue() + }); + } + }; + + return _this2; + } + + var _proto2 = Consumer.prototype; + + _proto2.componentWillReceiveProps = function componentWillReceiveProps(nextProps) { + var observedBits = nextProps.observedBits; + this.observedBits = observedBits === undefined || observedBits === null ? MAX_SIGNED_31_BIT_INT : observedBits; + }; + + _proto2.componentDidMount = function componentDidMount() { + if (this.context[contextProp]) { + this.context[contextProp].on(this.onUpdate); + } + + var observedBits = this.props.observedBits; + this.observedBits = observedBits === undefined || observedBits === null ? MAX_SIGNED_31_BIT_INT : observedBits; + }; + + _proto2.componentWillUnmount = function componentWillUnmount() { + if (this.context[contextProp]) { + this.context[contextProp].off(this.onUpdate); + } + }; + + _proto2.getValue = function getValue() { + if (this.context[contextProp]) { + return this.context[contextProp].get(); + } else { + return defaultValue; + } + }; + + _proto2.render = function render() { + return onlyChild(this.props.children)(this.state.value); + }; + + return Consumer; + }(react__WEBPACK_IMPORTED_MODULE_0__["Component"]); + + Consumer.contextTypes = (_Consumer$contextType = {}, _Consumer$contextType[contextProp] = prop_types__WEBPACK_IMPORTED_MODULE_2___default.a.object, _Consumer$contextType); + return { + Provider: Provider, + Consumer: Consumer + }; +} + +var index = react__WEBPACK_IMPORTED_MODULE_0___default.a.createContext || createReactContext; + +/* harmony default export */ __webpack_exports__["default"] = (index); + +/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js"))) + +/***/ }), + +/***/ "./node_modules/node-libs-browser/node_modules/punycode/punycode.js": +/*!**************************************************************************!*\ + !*** ./node_modules/node-libs-browser/node_modules/punycode/punycode.js ***! + \**************************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +/* WEBPACK VAR INJECTION */(function(module, global) {var __WEBPACK_AMD_DEFINE_RESULT__;/*! https://mths.be/punycode v1.4.1 by @mathias */ +;(function(root) { + + /** Detect free variables */ + var freeExports = true && exports && + !exports.nodeType && exports; + var freeModule = true && module && + !module.nodeType && module; + var freeGlobal = typeof global == 'object' && global; + if ( + freeGlobal.global === freeGlobal || + freeGlobal.window === freeGlobal || + freeGlobal.self === freeGlobal + ) { + root = freeGlobal; + } + + /** + * The `punycode` object. + * @name punycode + * @type Object + */ + var punycode, + + /** Highest positive signed 32-bit float value */ + maxInt = 2147483647, // aka. 0x7FFFFFFF or 2^31-1 + + /** Bootstring parameters */ + base = 36, + tMin = 1, + tMax = 26, + skew = 38, + damp = 700, + initialBias = 72, + initialN = 128, // 0x80 + delimiter = '-', // '\x2D' + + /** Regular expressions */ + regexPunycode = /^xn--/, + regexNonASCII = /[^\x20-\x7E]/, // unprintable ASCII chars + non-ASCII chars + regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g, // RFC 3490 separators + + /** Error messages */ + errors = { + 'overflow': 'Overflow: input needs wider integers to process', + 'not-basic': 'Illegal input >= 0x80 (not a basic code point)', + 'invalid-input': 'Invalid input' + }, + + /** Convenience shortcuts */ + baseMinusTMin = base - tMin, + floor = Math.floor, + stringFromCharCode = String.fromCharCode, + + /** Temporary variable */ + key; + + /*--------------------------------------------------------------------------*/ + + /** + * A generic error utility function. + * @private + * @param {String} type The error type. + * @returns {Error} Throws a `RangeError` with the applicable error message. + */ + function error(type) { + throw new RangeError(errors[type]); + } + + /** + * A generic `Array#map` utility function. + * @private + * @param {Array} array The array to iterate over. + * @param {Function} callback The function that gets called for every array + * item. + * @returns {Array} A new array of values returned by the callback function. + */ + function map(array, fn) { + var length = array.length; + var result = []; + while (length--) { + result[length] = fn(array[length]); + } + return result; + } + + /** + * A simple `Array#map`-like wrapper to work with domain name strings or email + * addresses. + * @private + * @param {String} domain The domain name or email address. + * @param {Function} callback The function that gets called for every + * character. + * @returns {Array} A new string of characters returned by the callback + * function. + */ + function mapDomain(string, fn) { + var parts = string.split('@'); + var result = ''; + if (parts.length > 1) { + // In email addresses, only the domain name should be punycoded. Leave + // the local part (i.e. everything up to `@`) intact. + result = parts[0] + '@'; + string = parts[1]; + } + // Avoid `split(regex)` for IE8 compatibility. See #17. + string = string.replace(regexSeparators, '\x2E'); + var labels = string.split('.'); + var encoded = map(labels, fn).join('.'); + return result + encoded; + } + + /** + * Creates an array containing the numeric code points of each Unicode + * character in the string. While JavaScript uses UCS-2 internally, + * this function will convert a pair of surrogate halves (each of which + * UCS-2 exposes as separate characters) into a single code point, + * matching UTF-16. + * @see `punycode.ucs2.encode` + * @see + * @memberOf punycode.ucs2 + * @name decode + * @param {String} string The Unicode input string (UCS-2). + * @returns {Array} The new array of code points. + */ + function ucs2decode(string) { + var output = [], + counter = 0, + length = string.length, + value, + extra; + while (counter < length) { + value = string.charCodeAt(counter++); + if (value >= 0xD800 && value <= 0xDBFF && counter < length) { + // high surrogate, and there is a next character + extra = string.charCodeAt(counter++); + if ((extra & 0xFC00) == 0xDC00) { // low surrogate + output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000); + } else { + // unmatched surrogate; only append this code unit, in case the next + // code unit is the high surrogate of a surrogate pair + output.push(value); + counter--; + } + } else { + output.push(value); + } + } + return output; + } + + /** + * Creates a string based on an array of numeric code points. + * @see `punycode.ucs2.decode` + * @memberOf punycode.ucs2 + * @name encode + * @param {Array} codePoints The array of numeric code points. + * @returns {String} The new Unicode string (UCS-2). + */ + function ucs2encode(array) { + return map(array, function(value) { + var output = ''; + if (value > 0xFFFF) { + value -= 0x10000; + output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800); + value = 0xDC00 | value & 0x3FF; + } + output += stringFromCharCode(value); + return output; + }).join(''); + } + + /** + * Converts a basic code point into a digit/integer. + * @see `digitToBasic()` + * @private + * @param {Number} codePoint The basic numeric code point value. + * @returns {Number} The numeric value of a basic code point (for use in + * representing integers) in the range `0` to `base - 1`, or `base` if + * the code point does not represent a value. + */ + function basicToDigit(codePoint) { + if (codePoint - 48 < 10) { + return codePoint - 22; + } + if (codePoint - 65 < 26) { + return codePoint - 65; + } + if (codePoint - 97 < 26) { + return codePoint - 97; + } + return base; + } + + /** + * Converts a digit/integer into a basic code point. + * @see `basicToDigit()` + * @private + * @param {Number} digit The numeric value of a basic code point. + * @returns {Number} The basic code point whose value (when used for + * representing integers) is `digit`, which needs to be in the range + * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is + * used; else, the lowercase form is used. The behavior is undefined + * if `flag` is non-zero and `digit` has no uppercase form. + */ + function digitToBasic(digit, flag) { + // 0..25 map to ASCII a..z or A..Z + // 26..35 map to ASCII 0..9 + return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5); + } + + /** + * Bias adaptation function as per section 3.4 of RFC 3492. + * https://tools.ietf.org/html/rfc3492#section-3.4 + * @private + */ + function adapt(delta, numPoints, firstTime) { + var k = 0; + delta = firstTime ? floor(delta / damp) : delta >> 1; + delta += floor(delta / numPoints); + for (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) { + delta = floor(delta / baseMinusTMin); + } + return floor(k + (baseMinusTMin + 1) * delta / (delta + skew)); + } + + /** + * Converts a Punycode string of ASCII-only symbols to a string of Unicode + * symbols. + * @memberOf punycode + * @param {String} input The Punycode string of ASCII-only symbols. + * @returns {String} The resulting string of Unicode symbols. + */ + function decode(input) { + // Don't use UCS-2 + var output = [], + inputLength = input.length, + out, + i = 0, + n = initialN, + bias = initialBias, + basic, + j, + index, + oldi, + w, + k, + digit, + t, + /** Cached calculation results */ + baseMinusT; + + // Handle the basic code points: let `basic` be the number of input code + // points before the last delimiter, or `0` if there is none, then copy + // the first basic code points to the output. + + basic = input.lastIndexOf(delimiter); + if (basic < 0) { + basic = 0; + } + + for (j = 0; j < basic; ++j) { + // if it's not a basic code point + if (input.charCodeAt(j) >= 0x80) { + error('not-basic'); + } + output.push(input.charCodeAt(j)); + } + + // Main decoding loop: start just after the last delimiter if any basic code + // points were copied; start at the beginning otherwise. + + for (index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) { + + // `index` is the index of the next character to be consumed. + // Decode a generalized variable-length integer into `delta`, + // which gets added to `i`. The overflow checking is easier + // if we increase `i` as we go, then subtract off its starting + // value at the end to obtain `delta`. + for (oldi = i, w = 1, k = base; /* no condition */; k += base) { + + if (index >= inputLength) { + error('invalid-input'); + } + + digit = basicToDigit(input.charCodeAt(index++)); + + if (digit >= base || digit > floor((maxInt - i) / w)) { + error('overflow'); + } + + i += digit * w; + t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias); + + if (digit < t) { + break; + } + + baseMinusT = base - t; + if (w > floor(maxInt / baseMinusT)) { + error('overflow'); + } + + w *= baseMinusT; + + } + + out = output.length + 1; + bias = adapt(i - oldi, out, oldi == 0); + + // `i` was supposed to wrap around from `out` to `0`, + // incrementing `n` each time, so we'll fix that now: + if (floor(i / out) > maxInt - n) { + error('overflow'); + } + + n += floor(i / out); + i %= out; + + // Insert `n` at position `i` of the output + output.splice(i++, 0, n); + + } + + return ucs2encode(output); + } + + /** + * Converts a string of Unicode symbols (e.g. a domain name label) to a + * Punycode string of ASCII-only symbols. + * @memberOf punycode + * @param {String} input The string of Unicode symbols. + * @returns {String} The resulting Punycode string of ASCII-only symbols. + */ + function encode(input) { + var n, + delta, + handledCPCount, + basicLength, + bias, + j, + m, + q, + k, + t, + currentValue, + output = [], + /** `inputLength` will hold the number of code points in `input`. */ + inputLength, + /** Cached calculation results */ + handledCPCountPlusOne, + baseMinusT, + qMinusT; + + // Convert the input in UCS-2 to Unicode + input = ucs2decode(input); + + // Cache the length + inputLength = input.length; + + // Initialize the state + n = initialN; + delta = 0; + bias = initialBias; + + // Handle the basic code points + for (j = 0; j < inputLength; ++j) { + currentValue = input[j]; + if (currentValue < 0x80) { + output.push(stringFromCharCode(currentValue)); + } + } + + handledCPCount = basicLength = output.length; + + // `handledCPCount` is the number of code points that have been handled; + // `basicLength` is the number of basic code points. + + // Finish the basic string - if it is not empty - with a delimiter + if (basicLength) { + output.push(delimiter); + } + + // Main encoding loop: + while (handledCPCount < inputLength) { + + // All non-basic code points < n have been handled already. Find the next + // larger one: + for (m = maxInt, j = 0; j < inputLength; ++j) { + currentValue = input[j]; + if (currentValue >= n && currentValue < m) { + m = currentValue; + } + } + + // Increase `delta` enough to advance the decoder's state to , + // but guard against overflow + handledCPCountPlusOne = handledCPCount + 1; + if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) { + error('overflow'); + } + + delta += (m - n) * handledCPCountPlusOne; + n = m; + + for (j = 0; j < inputLength; ++j) { + currentValue = input[j]; + + if (currentValue < n && ++delta > maxInt) { + error('overflow'); + } + + if (currentValue == n) { + // Represent delta as a generalized variable-length integer + for (q = delta, k = base; /* no condition */; k += base) { + t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias); + if (q < t) { + break; + } + qMinusT = q - t; + baseMinusT = base - t; + output.push( + stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0)) + ); + q = floor(qMinusT / baseMinusT); + } + + output.push(stringFromCharCode(digitToBasic(q, 0))); + bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength); + delta = 0; + ++handledCPCount; + } + } + + ++delta; + ++n; + + } + return output.join(''); + } + + /** + * Converts a Punycode string representing a domain name or an email address + * to Unicode. Only the Punycoded parts of the input will be converted, i.e. + * it doesn't matter if you call it on a string that has already been + * converted to Unicode. + * @memberOf punycode + * @param {String} input The Punycoded domain name or email address to + * convert to Unicode. + * @returns {String} The Unicode representation of the given Punycode + * string. + */ + function toUnicode(input) { + return mapDomain(input, function(string) { + return regexPunycode.test(string) + ? decode(string.slice(4).toLowerCase()) + : string; + }); + } + + /** + * Converts a Unicode string representing a domain name or an email address to + * Punycode. Only the non-ASCII parts of the domain name will be converted, + * i.e. it doesn't matter if you call it with a domain that's already in + * ASCII. + * @memberOf punycode + * @param {String} input The domain name or email address to convert, as a + * Unicode string. + * @returns {String} The Punycode representation of the given domain name or + * email address. + */ + function toASCII(input) { + return mapDomain(input, function(string) { + return regexNonASCII.test(string) + ? 'xn--' + encode(string) + : string; + }); + } + + /*--------------------------------------------------------------------------*/ + + /** Define the public API */ + punycode = { + /** + * A string representing the current Punycode.js version number. + * @memberOf punycode + * @type String + */ + 'version': '1.4.1', + /** + * An object of methods to convert from JavaScript's internal character + * representation (UCS-2) to Unicode code points, and back. + * @see + * @memberOf punycode + * @type Object + */ + 'ucs2': { + 'decode': ucs2decode, + 'encode': ucs2encode + }, + 'decode': decode, + 'encode': encode, + 'toASCII': toASCII, + 'toUnicode': toUnicode + }; + + /** Expose `punycode` */ + // Some AMD build optimizers, like r.js, check for specific condition patterns + // like the following: + if ( + true + ) { + !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() { + return punycode; + }).call(exports, __webpack_require__, exports, module), + __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); + } else {} + +}(this)); + +/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../webpack/buildin/module.js */ "./node_modules/webpack/buildin/module.js")(module), __webpack_require__(/*! ./../../../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js"))) + +/***/ }), + +/***/ "./node_modules/object-assign/index.js": +/*!*********************************************!*\ + !*** ./node_modules/object-assign/index.js ***! + \*********************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/* +object-assign +(c) Sindre Sorhus +@license MIT +*/ + + +/* eslint-disable no-unused-vars */ +var getOwnPropertySymbols = Object.getOwnPropertySymbols; +var hasOwnProperty = Object.prototype.hasOwnProperty; +var propIsEnumerable = Object.prototype.propertyIsEnumerable; + +function toObject(val) { + if (val === null || val === undefined) { + throw new TypeError('Object.assign cannot be called with null or undefined'); + } + + return Object(val); +} + +function shouldUseNative() { + try { + if (!Object.assign) { + return false; + } + + // Detect buggy property enumeration order in older V8 versions. + + // https://bugs.chromium.org/p/v8/issues/detail?id=4118 + var test1 = new String('abc'); // eslint-disable-line no-new-wrappers + test1[5] = 'de'; + if (Object.getOwnPropertyNames(test1)[0] === '5') { + return false; + } + + // https://bugs.chromium.org/p/v8/issues/detail?id=3056 + var test2 = {}; + for (var i = 0; i < 10; i++) { + test2['_' + String.fromCharCode(i)] = i; + } + var order2 = Object.getOwnPropertyNames(test2).map(function (n) { + return test2[n]; + }); + if (order2.join('') !== '0123456789') { + return false; + } + + // https://bugs.chromium.org/p/v8/issues/detail?id=3056 + var test3 = {}; + 'abcdefghijklmnopqrst'.split('').forEach(function (letter) { + test3[letter] = letter; + }); + if (Object.keys(Object.assign({}, test3)).join('') !== + 'abcdefghijklmnopqrst') { + return false; + } + + return true; + } catch (err) { + // We don't expect any of the above to throw, but better to be safe. + return false; + } +} + +module.exports = shouldUseNative() ? Object.assign : function (target, source) { + var from; + var to = toObject(target); + var symbols; + + for (var s = 1; s < arguments.length; s++) { + from = Object(arguments[s]); + + for (var key in from) { + if (hasOwnProperty.call(from, key)) { + to[key] = from[key]; + } + } + + if (getOwnPropertySymbols) { + symbols = getOwnPropertySymbols(from); + for (var i = 0; i < symbols.length; i++) { + if (propIsEnumerable.call(from, symbols[i])) { + to[symbols[i]] = from[symbols[i]]; + } + } + } + } + + return to; +}; + + +/***/ }), + +/***/ "./node_modules/prop-types/checkPropTypes.js": +/*!***************************************************!*\ + !*** ./node_modules/prop-types/checkPropTypes.js ***! + \***************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + + + +var printWarning = function() {}; + +if (true) { + var ReactPropTypesSecret = __webpack_require__(/*! ./lib/ReactPropTypesSecret */ "./node_modules/prop-types/lib/ReactPropTypesSecret.js"); + var loggedTypeFailures = {}; + var has = Function.call.bind(Object.prototype.hasOwnProperty); + + printWarning = function(text) { + var message = 'Warning: ' + text; + if (typeof console !== 'undefined') { + console.error(message); + } + try { + // --- Welcome to debugging React --- + // This error was thrown as a convenience so that you can use this stack + // to find the callsite that caused this warning to fire. + throw new Error(message); + } catch (x) {} + }; +} + +/** + * Assert that the values match with the type specs. + * Error messages are memorized and will only be shown once. + * + * @param {object} typeSpecs Map of name to a ReactPropType + * @param {object} values Runtime values that need to be type-checked + * @param {string} location e.g. "prop", "context", "child context" + * @param {string} componentName Name of the component for error messages. + * @param {?Function} getStack Returns the component stack. + * @private + */ +function checkPropTypes(typeSpecs, values, location, componentName, getStack) { + if (true) { + for (var typeSpecName in typeSpecs) { + if (has(typeSpecs, typeSpecName)) { + var error; + // Prop type validation may throw. In case they do, we don't want to + // fail the render phase where it didn't fail before. So we log it. + // After these have been cleaned up, we'll let them throw. + try { + // This is intentionally an invariant that gets caught. It's the same + // behavior as without this statement except with a better message. + if (typeof typeSpecs[typeSpecName] !== 'function') { + var err = Error( + (componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + + 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' + ); + err.name = 'Invariant Violation'; + throw err; + } + error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret); + } catch (ex) { + error = ex; + } + if (error && !(error instanceof Error)) { + printWarning( + (componentName || 'React class') + ': type specification of ' + + location + ' `' + typeSpecName + '` is invalid; the type checker ' + + 'function must return `null` or an `Error` but returned a ' + typeof error + '. ' + + 'You may have forgotten to pass an argument to the type checker ' + + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + + 'shape all require an argument).' + ); + } + if (error instanceof Error && !(error.message in loggedTypeFailures)) { + // Only monitor this failure once because there tends to be a lot of the + // same error. + loggedTypeFailures[error.message] = true; + + var stack = getStack ? getStack() : ''; + + printWarning( + 'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '') + ); + } + } + } + } +} + +/** + * Resets warning cache when testing. + * + * @private + */ +checkPropTypes.resetWarningCache = function() { + if (true) { + loggedTypeFailures = {}; + } +} + +module.exports = checkPropTypes; + + +/***/ }), + +/***/ "./node_modules/prop-types/factoryWithTypeCheckers.js": +/*!************************************************************!*\ + !*** ./node_modules/prop-types/factoryWithTypeCheckers.js ***! + \************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + + + +var ReactIs = __webpack_require__(/*! react-is */ "./node_modules/react-is/index.js"); +var assign = __webpack_require__(/*! object-assign */ "./node_modules/object-assign/index.js"); + +var ReactPropTypesSecret = __webpack_require__(/*! ./lib/ReactPropTypesSecret */ "./node_modules/prop-types/lib/ReactPropTypesSecret.js"); +var checkPropTypes = __webpack_require__(/*! ./checkPropTypes */ "./node_modules/prop-types/checkPropTypes.js"); + +var has = Function.call.bind(Object.prototype.hasOwnProperty); +var printWarning = function() {}; + +if (true) { + printWarning = function(text) { + var message = 'Warning: ' + text; + if (typeof console !== 'undefined') { + console.error(message); + } + try { + // --- Welcome to debugging React --- + // This error was thrown as a convenience so that you can use this stack + // to find the callsite that caused this warning to fire. + throw new Error(message); + } catch (x) {} + }; +} + +function emptyFunctionThatReturnsNull() { + return null; +} + +module.exports = function(isValidElement, throwOnDirectAccess) { + /* global Symbol */ + var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator; + var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec. + + /** + * Returns the iterator method function contained on the iterable object. + * + * Be sure to invoke the function with the iterable as context: + * + * var iteratorFn = getIteratorFn(myIterable); + * if (iteratorFn) { + * var iterator = iteratorFn.call(myIterable); + * ... + * } + * + * @param {?object} maybeIterable + * @return {?function} + */ + function getIteratorFn(maybeIterable) { + var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]); + if (typeof iteratorFn === 'function') { + return iteratorFn; + } + } + + /** + * Collection of methods that allow declaration and validation of props that are + * supplied to React components. Example usage: + * + * var Props = require('ReactPropTypes'); + * var MyArticle = React.createClass({ + * propTypes: { + * // An optional string prop named "description". + * description: Props.string, + * + * // A required enum prop named "category". + * category: Props.oneOf(['News','Photos']).isRequired, + * + * // A prop named "dialog" that requires an instance of Dialog. + * dialog: Props.instanceOf(Dialog).isRequired + * }, + * render: function() { ... } + * }); + * + * A more formal specification of how these methods are used: + * + * type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...) + * decl := ReactPropTypes.{type}(.isRequired)? + * + * Each and every declaration produces a function with the same signature. This + * allows the creation of custom validation functions. For example: + * + * var MyLink = React.createClass({ + * propTypes: { + * // An optional string or URI prop named "href". + * href: function(props, propName, componentName) { + * var propValue = props[propName]; + * if (propValue != null && typeof propValue !== 'string' && + * !(propValue instanceof URI)) { + * return new Error( + * 'Expected a string or an URI for ' + propName + ' in ' + + * componentName + * ); + * } + * } + * }, + * render: function() {...} + * }); + * + * @internal + */ + + var ANONYMOUS = '<>'; + + // Important! + // Keep this list in sync with production version in `./factoryWithThrowingShims.js`. + var ReactPropTypes = { + array: createPrimitiveTypeChecker('array'), + bool: createPrimitiveTypeChecker('boolean'), + func: createPrimitiveTypeChecker('function'), + number: createPrimitiveTypeChecker('number'), + object: createPrimitiveTypeChecker('object'), + string: createPrimitiveTypeChecker('string'), + symbol: createPrimitiveTypeChecker('symbol'), + + any: createAnyTypeChecker(), + arrayOf: createArrayOfTypeChecker, + element: createElementTypeChecker(), + elementType: createElementTypeTypeChecker(), + instanceOf: createInstanceTypeChecker, + node: createNodeChecker(), + objectOf: createObjectOfTypeChecker, + oneOf: createEnumTypeChecker, + oneOfType: createUnionTypeChecker, + shape: createShapeTypeChecker, + exact: createStrictShapeTypeChecker, + }; + + /** + * inlined Object.is polyfill to avoid requiring consumers ship their own + * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is + */ + /*eslint-disable no-self-compare*/ + function is(x, y) { + // SameValue algorithm + if (x === y) { + // Steps 1-5, 7-10 + // Steps 6.b-6.e: +0 != -0 + return x !== 0 || 1 / x === 1 / y; + } else { + // Step 6.a: NaN == NaN + return x !== x && y !== y; + } + } + /*eslint-enable no-self-compare*/ + + /** + * We use an Error-like object for backward compatibility as people may call + * PropTypes directly and inspect their output. However, we don't use real + * Errors anymore. We don't inspect their stack anyway, and creating them + * is prohibitively expensive if they are created too often, such as what + * happens in oneOfType() for any type before the one that matched. + */ + function PropTypeError(message) { + this.message = message; + this.stack = ''; + } + // Make `instanceof Error` still work for returned errors. + PropTypeError.prototype = Error.prototype; + + function createChainableTypeChecker(validate) { + if (true) { + var manualPropTypeCallCache = {}; + var manualPropTypeWarningCount = 0; + } + function checkType(isRequired, props, propName, componentName, location, propFullName, secret) { + componentName = componentName || ANONYMOUS; + propFullName = propFullName || propName; + + if (secret !== ReactPropTypesSecret) { + if (throwOnDirectAccess) { + // New behavior only for users of `prop-types` package + var err = new Error( + 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' + + 'Use `PropTypes.checkPropTypes()` to call them. ' + + 'Read more at http://fb.me/use-check-prop-types' + ); + err.name = 'Invariant Violation'; + throw err; + } else if ( true && typeof console !== 'undefined') { + // Old behavior for people using React.PropTypes + var cacheKey = componentName + ':' + propName; + if ( + !manualPropTypeCallCache[cacheKey] && + // Avoid spamming the console because they are often not actionable except for lib authors + manualPropTypeWarningCount < 3 + ) { + printWarning( + 'You are manually calling a React.PropTypes validation ' + + 'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' + + 'and will throw in the standalone `prop-types` package. ' + + 'You may be seeing this warning due to a third-party PropTypes ' + + 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.' + ); + manualPropTypeCallCache[cacheKey] = true; + manualPropTypeWarningCount++; + } + } + } + if (props[propName] == null) { + if (isRequired) { + if (props[propName] === null) { + return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.')); + } + return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.')); + } + return null; + } else { + return validate(props, propName, componentName, location, propFullName); + } + } + + var chainedCheckType = checkType.bind(null, false); + chainedCheckType.isRequired = checkType.bind(null, true); + + return chainedCheckType; + } + + function createPrimitiveTypeChecker(expectedType) { + function validate(props, propName, componentName, location, propFullName, secret) { + var propValue = props[propName]; + var propType = getPropType(propValue); + if (propType !== expectedType) { + // `propValue` being instance of, say, date/regexp, pass the 'object' + // check, but we can offer a more precise error message here rather than + // 'of type `object`'. + var preciseType = getPreciseType(propValue); + + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.')); + } + return null; + } + return createChainableTypeChecker(validate); + } + + function createAnyTypeChecker() { + return createChainableTypeChecker(emptyFunctionThatReturnsNull); + } + + function createArrayOfTypeChecker(typeChecker) { + function validate(props, propName, componentName, location, propFullName) { + if (typeof typeChecker !== 'function') { + return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.'); + } + var propValue = props[propName]; + if (!Array.isArray(propValue)) { + var propType = getPropType(propValue); + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.')); + } + for (var i = 0; i < propValue.length; i++) { + var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret); + if (error instanceof Error) { + return error; + } + } + return null; + } + return createChainableTypeChecker(validate); + } + + function createElementTypeChecker() { + function validate(props, propName, componentName, location, propFullName) { + var propValue = props[propName]; + if (!isValidElement(propValue)) { + var propType = getPropType(propValue); + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.')); + } + return null; + } + return createChainableTypeChecker(validate); + } + + function createElementTypeTypeChecker() { + function validate(props, propName, componentName, location, propFullName) { + var propValue = props[propName]; + if (!ReactIs.isValidElementType(propValue)) { + var propType = getPropType(propValue); + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement type.')); + } + return null; + } + return createChainableTypeChecker(validate); + } + + function createInstanceTypeChecker(expectedClass) { + function validate(props, propName, componentName, location, propFullName) { + if (!(props[propName] instanceof expectedClass)) { + var expectedClassName = expectedClass.name || ANONYMOUS; + var actualClassName = getClassName(props[propName]); + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.')); + } + return null; + } + return createChainableTypeChecker(validate); + } + + function createEnumTypeChecker(expectedValues) { + if (!Array.isArray(expectedValues)) { + if (true) { + if (arguments.length > 1) { + printWarning( + 'Invalid arguments supplied to oneOf, expected an array, got ' + arguments.length + ' arguments. ' + + 'A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).' + ); + } else { + printWarning('Invalid argument supplied to oneOf, expected an array.'); + } + } + return emptyFunctionThatReturnsNull; + } + + function validate(props, propName, componentName, location, propFullName) { + var propValue = props[propName]; + for (var i = 0; i < expectedValues.length; i++) { + if (is(propValue, expectedValues[i])) { + return null; + } + } + + var valuesString = JSON.stringify(expectedValues, function replacer(key, value) { + var type = getPreciseType(value); + if (type === 'symbol') { + return String(value); + } + return value; + }); + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + String(propValue) + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.')); + } + return createChainableTypeChecker(validate); + } + + function createObjectOfTypeChecker(typeChecker) { + function validate(props, propName, componentName, location, propFullName) { + if (typeof typeChecker !== 'function') { + return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.'); + } + var propValue = props[propName]; + var propType = getPropType(propValue); + if (propType !== 'object') { + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.')); + } + for (var key in propValue) { + if (has(propValue, key)) { + var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret); + if (error instanceof Error) { + return error; + } + } + } + return null; + } + return createChainableTypeChecker(validate); + } + + function createUnionTypeChecker(arrayOfTypeCheckers) { + if (!Array.isArray(arrayOfTypeCheckers)) { + true ? printWarning('Invalid argument supplied to oneOfType, expected an instance of array.') : undefined; + return emptyFunctionThatReturnsNull; + } + + for (var i = 0; i < arrayOfTypeCheckers.length; i++) { + var checker = arrayOfTypeCheckers[i]; + if (typeof checker !== 'function') { + printWarning( + 'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' + + 'received ' + getPostfixForTypeWarning(checker) + ' at index ' + i + '.' + ); + return emptyFunctionThatReturnsNull; + } + } + + function validate(props, propName, componentName, location, propFullName) { + for (var i = 0; i < arrayOfTypeCheckers.length; i++) { + var checker = arrayOfTypeCheckers[i]; + if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret) == null) { + return null; + } + } + + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.')); + } + return createChainableTypeChecker(validate); + } + + function createNodeChecker() { + function validate(props, propName, componentName, location, propFullName) { + if (!isNode(props[propName])) { + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.')); + } + return null; + } + return createChainableTypeChecker(validate); + } + + function createShapeTypeChecker(shapeTypes) { + function validate(props, propName, componentName, location, propFullName) { + var propValue = props[propName]; + var propType = getPropType(propValue); + if (propType !== 'object') { + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.')); + } + for (var key in shapeTypes) { + var checker = shapeTypes[key]; + if (!checker) { + continue; + } + var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret); + if (error) { + return error; + } + } + return null; + } + return createChainableTypeChecker(validate); + } + + function createStrictShapeTypeChecker(shapeTypes) { + function validate(props, propName, componentName, location, propFullName) { + var propValue = props[propName]; + var propType = getPropType(propValue); + if (propType !== 'object') { + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.')); + } + // We need to check all keys in case some are required but missing from + // props. + var allKeys = assign({}, props[propName], shapeTypes); + for (var key in allKeys) { + var checker = shapeTypes[key]; + if (!checker) { + return new PropTypeError( + 'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' + + '\nBad object: ' + JSON.stringify(props[propName], null, ' ') + + '\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ') + ); + } + var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret); + if (error) { + return error; + } + } + return null; + } + + return createChainableTypeChecker(validate); + } + + function isNode(propValue) { + switch (typeof propValue) { + case 'number': + case 'string': + case 'undefined': + return true; + case 'boolean': + return !propValue; + case 'object': + if (Array.isArray(propValue)) { + return propValue.every(isNode); + } + if (propValue === null || isValidElement(propValue)) { + return true; + } + + var iteratorFn = getIteratorFn(propValue); + if (iteratorFn) { + var iterator = iteratorFn.call(propValue); + var step; + if (iteratorFn !== propValue.entries) { + while (!(step = iterator.next()).done) { + if (!isNode(step.value)) { + return false; + } + } + } else { + // Iterator will provide entry [k,v] tuples rather than values. + while (!(step = iterator.next()).done) { + var entry = step.value; + if (entry) { + if (!isNode(entry[1])) { + return false; + } + } + } + } + } else { + return false; + } + + return true; + default: + return false; + } + } + + function isSymbol(propType, propValue) { + // Native Symbol. + if (propType === 'symbol') { + return true; + } + + // falsy value can't be a Symbol + if (!propValue) { + return false; + } + + // 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol' + if (propValue['@@toStringTag'] === 'Symbol') { + return true; + } + + // Fallback for non-spec compliant Symbols which are polyfilled. + if (typeof Symbol === 'function' && propValue instanceof Symbol) { + return true; + } + + return false; + } + + // Equivalent of `typeof` but with special handling for array and regexp. + function getPropType(propValue) { + var propType = typeof propValue; + if (Array.isArray(propValue)) { + return 'array'; + } + if (propValue instanceof RegExp) { + // Old webkits (at least until Android 4.0) return 'function' rather than + // 'object' for typeof a RegExp. We'll normalize this here so that /bla/ + // passes PropTypes.object. + return 'object'; + } + if (isSymbol(propType, propValue)) { + return 'symbol'; + } + return propType; + } + + // This handles more types than `getPropType`. Only used for error messages. + // See `createPrimitiveTypeChecker`. + function getPreciseType(propValue) { + if (typeof propValue === 'undefined' || propValue === null) { + return '' + propValue; + } + var propType = getPropType(propValue); + if (propType === 'object') { + if (propValue instanceof Date) { + return 'date'; + } else if (propValue instanceof RegExp) { + return 'regexp'; + } + } + return propType; + } + + // Returns a string that is postfixed to a warning about an invalid type. + // For example, "undefined" or "of type array" + function getPostfixForTypeWarning(value) { + var type = getPreciseType(value); + switch (type) { + case 'array': + case 'object': + return 'an ' + type; + case 'boolean': + case 'date': + case 'regexp': + return 'a ' + type; + default: + return type; + } + } + + // Returns class name of the object, if any. + function getClassName(propValue) { + if (!propValue.constructor || !propValue.constructor.name) { + return ANONYMOUS; + } + return propValue.constructor.name; + } + + ReactPropTypes.checkPropTypes = checkPropTypes; + ReactPropTypes.resetWarningCache = checkPropTypes.resetWarningCache; + ReactPropTypes.PropTypes = ReactPropTypes; + + return ReactPropTypes; +}; + + +/***/ }), + +/***/ "./node_modules/prop-types/index.js": +/*!******************************************!*\ + !*** ./node_modules/prop-types/index.js ***! + \******************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +if (true) { + var ReactIs = __webpack_require__(/*! react-is */ "./node_modules/react-is/index.js"); + + // By explicitly using `prop-types` you are opting into new development behavior. + // http://fb.me/prop-types-in-prod + var throwOnDirectAccess = true; + module.exports = __webpack_require__(/*! ./factoryWithTypeCheckers */ "./node_modules/prop-types/factoryWithTypeCheckers.js")(ReactIs.isElement, throwOnDirectAccess); +} else {} + + +/***/ }), + +/***/ "./node_modules/prop-types/lib/ReactPropTypesSecret.js": +/*!*************************************************************!*\ + !*** ./node_modules/prop-types/lib/ReactPropTypesSecret.js ***! + \*************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + + + +var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'; + +module.exports = ReactPropTypesSecret; + + +/***/ }), + +/***/ "./node_modules/querystring-es3/decode.js": +/*!************************************************!*\ + !*** ./node_modules/querystring-es3/decode.js ***! + \************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + + + +// If obj.hasOwnProperty has been overridden, then calling +// obj.hasOwnProperty(prop) will break. +// See: https://github.com/joyent/node/issues/1707 +function hasOwnProperty(obj, prop) { + return Object.prototype.hasOwnProperty.call(obj, prop); +} + +module.exports = function(qs, sep, eq, options) { + sep = sep || '&'; + eq = eq || '='; + var obj = {}; + + if (typeof qs !== 'string' || qs.length === 0) { + return obj; + } + + var regexp = /\+/g; + qs = qs.split(sep); + + var maxKeys = 1000; + if (options && typeof options.maxKeys === 'number') { + maxKeys = options.maxKeys; + } + + var len = qs.length; + // maxKeys <= 0 means that we should not limit keys count + if (maxKeys > 0 && len > maxKeys) { + len = maxKeys; + } + + for (var i = 0; i < len; ++i) { + var x = qs[i].replace(regexp, '%20'), + idx = x.indexOf(eq), + kstr, vstr, k, v; + + if (idx >= 0) { + kstr = x.substr(0, idx); + vstr = x.substr(idx + 1); + } else { + kstr = x; + vstr = ''; + } + + k = decodeURIComponent(kstr); + v = decodeURIComponent(vstr); + + if (!hasOwnProperty(obj, k)) { + obj[k] = v; + } else if (isArray(obj[k])) { + obj[k].push(v); + } else { + obj[k] = [obj[k], v]; + } + } + + return obj; +}; + +var isArray = Array.isArray || function (xs) { + return Object.prototype.toString.call(xs) === '[object Array]'; +}; + + +/***/ }), + +/***/ "./node_modules/querystring-es3/encode.js": +/*!************************************************!*\ + !*** ./node_modules/querystring-es3/encode.js ***! + \************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + + + +var stringifyPrimitive = function(v) { + switch (typeof v) { + case 'string': + return v; + + case 'boolean': + return v ? 'true' : 'false'; + + case 'number': + return isFinite(v) ? v : ''; + + default: + return ''; + } +}; + +module.exports = function(obj, sep, eq, name) { + sep = sep || '&'; + eq = eq || '='; + if (obj === null) { + obj = undefined; + } + + if (typeof obj === 'object') { + return map(objectKeys(obj), function(k) { + var ks = encodeURIComponent(stringifyPrimitive(k)) + eq; + if (isArray(obj[k])) { + return map(obj[k], function(v) { + return ks + encodeURIComponent(stringifyPrimitive(v)); + }).join(sep); + } else { + return ks + encodeURIComponent(stringifyPrimitive(obj[k])); + } + }).join(sep); + + } + + if (!name) return ''; + return encodeURIComponent(stringifyPrimitive(name)) + eq + + encodeURIComponent(stringifyPrimitive(obj)); +}; + +var isArray = Array.isArray || function (xs) { + return Object.prototype.toString.call(xs) === '[object Array]'; +}; + +function map (xs, f) { + if (xs.map) return xs.map(f); + var res = []; + for (var i = 0; i < xs.length; i++) { + res.push(f(xs[i], i)); + } + return res; +} + +var objectKeys = Object.keys || function (obj) { + var res = []; + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) res.push(key); + } + return res; +}; + + +/***/ }), + +/***/ "./node_modules/querystring-es3/index.js": +/*!***********************************************!*\ + !*** ./node_modules/querystring-es3/index.js ***! + \***********************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +exports.decode = exports.parse = __webpack_require__(/*! ./decode */ "./node_modules/querystring-es3/decode.js"); +exports.encode = exports.stringify = __webpack_require__(/*! ./encode */ "./node_modules/querystring-es3/encode.js"); + + +/***/ }), + +/***/ "./node_modules/react-dom/cjs/react-dom.development.js": +/*!*************************************************************!*\ + !*** ./node_modules/react-dom/cjs/react-dom.development.js ***! + \*************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** @license React v16.13.1 + * react-dom.development.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + + + + + +if (true) { + (function() { +'use strict'; + +var React = __webpack_require__(/*! react */ "./node_modules/react/index.js"); +var _assign = __webpack_require__(/*! object-assign */ "./node_modules/object-assign/index.js"); +var Scheduler = __webpack_require__(/*! scheduler */ "./node_modules/scheduler/index.js"); +var checkPropTypes = __webpack_require__(/*! prop-types/checkPropTypes */ "./node_modules/prop-types/checkPropTypes.js"); +var tracing = __webpack_require__(/*! scheduler/tracing */ "./node_modules/scheduler/tracing.js"); + +var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; // Prevent newer renderers from RTE when used with older react package versions. +// Current owner and dispatcher used to share the same ref, +// but PR #14548 split them out to better support the react-debug-tools package. + +if (!ReactSharedInternals.hasOwnProperty('ReactCurrentDispatcher')) { + ReactSharedInternals.ReactCurrentDispatcher = { + current: null + }; +} + +if (!ReactSharedInternals.hasOwnProperty('ReactCurrentBatchConfig')) { + ReactSharedInternals.ReactCurrentBatchConfig = { + suspense: null + }; +} + +// by calls to these methods by a Babel plugin. +// +// In PROD (or in packages without access to React internals), +// they are left as they are instead. + +function warn(format) { + { + for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { + args[_key - 1] = arguments[_key]; + } + + printWarning('warn', format, args); + } +} +function error(format) { + { + for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { + args[_key2 - 1] = arguments[_key2]; + } + + printWarning('error', format, args); + } +} + +function printWarning(level, format, args) { + // When changing this logic, you might want to also + // update consoleWithStackDev.www.js as well. + { + var hasExistingStack = args.length > 0 && typeof args[args.length - 1] === 'string' && args[args.length - 1].indexOf('\n in') === 0; + + if (!hasExistingStack) { + var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame; + var stack = ReactDebugCurrentFrame.getStackAddendum(); + + if (stack !== '') { + format += '%s'; + args = args.concat([stack]); + } + } + + var argsWithFormat = args.map(function (item) { + return '' + item; + }); // Careful: RN currently depends on this prefix + + argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it + // breaks IE9: https://github.com/facebook/react/issues/13610 + // eslint-disable-next-line react-internal/no-production-logging + + Function.prototype.apply.call(console[level], console, argsWithFormat); + + try { + // --- Welcome to debugging React --- + // This error was thrown as a convenience so that you can use this stack + // to find the callsite that caused this warning to fire. + var argIndex = 0; + var message = 'Warning: ' + format.replace(/%s/g, function () { + return args[argIndex++]; + }); + throw new Error(message); + } catch (x) {} + } +} + +if (!React) { + { + throw Error( "ReactDOM was loaded before React. Make sure you load the React package before loading ReactDOM." ); + } +} + +var invokeGuardedCallbackImpl = function (name, func, context, a, b, c, d, e, f) { + var funcArgs = Array.prototype.slice.call(arguments, 3); + + try { + func.apply(context, funcArgs); + } catch (error) { + this.onError(error); + } +}; + +{ + // In DEV mode, we swap out invokeGuardedCallback for a special version + // that plays more nicely with the browser's DevTools. The idea is to preserve + // "Pause on exceptions" behavior. Because React wraps all user-provided + // functions in invokeGuardedCallback, and the production version of + // invokeGuardedCallback uses a try-catch, all user exceptions are treated + // like caught exceptions, and the DevTools won't pause unless the developer + // takes the extra step of enabling pause on caught exceptions. This is + // unintuitive, though, because even though React has caught the error, from + // the developer's perspective, the error is uncaught. + // + // To preserve the expected "Pause on exceptions" behavior, we don't use a + // try-catch in DEV. Instead, we synchronously dispatch a fake event to a fake + // DOM node, and call the user-provided callback from inside an event handler + // for that fake event. If the callback throws, the error is "captured" using + // a global event handler. But because the error happens in a different + // event loop context, it does not interrupt the normal program flow. + // Effectively, this gives us try-catch behavior without actually using + // try-catch. Neat! + // Check that the browser supports the APIs we need to implement our special + // DEV version of invokeGuardedCallback + if (typeof window !== 'undefined' && typeof window.dispatchEvent === 'function' && typeof document !== 'undefined' && typeof document.createEvent === 'function') { + var fakeNode = document.createElement('react'); + + var invokeGuardedCallbackDev = function (name, func, context, a, b, c, d, e, f) { + // If document doesn't exist we know for sure we will crash in this method + // when we call document.createEvent(). However this can cause confusing + // errors: https://github.com/facebookincubator/create-react-app/issues/3482 + // So we preemptively throw with a better message instead. + if (!(typeof document !== 'undefined')) { + { + throw Error( "The `document` global was defined when React was initialized, but is not defined anymore. This can happen in a test environment if a component schedules an update from an asynchronous callback, but the test has already finished running. To solve this, you can either unmount the component at the end of your test (and ensure that any asynchronous operations get canceled in `componentWillUnmount`), or you can change the test itself to be asynchronous." ); + } + } + + var evt = document.createEvent('Event'); // Keeps track of whether the user-provided callback threw an error. We + // set this to true at the beginning, then set it to false right after + // calling the function. If the function errors, `didError` will never be + // set to false. This strategy works even if the browser is flaky and + // fails to call our global error handler, because it doesn't rely on + // the error event at all. + + var didError = true; // Keeps track of the value of window.event so that we can reset it + // during the callback to let user code access window.event in the + // browsers that support it. + + var windowEvent = window.event; // Keeps track of the descriptor of window.event to restore it after event + // dispatching: https://github.com/facebook/react/issues/13688 + + var windowEventDescriptor = Object.getOwnPropertyDescriptor(window, 'event'); // Create an event handler for our fake event. We will synchronously + // dispatch our fake event using `dispatchEvent`. Inside the handler, we + // call the user-provided callback. + + var funcArgs = Array.prototype.slice.call(arguments, 3); + + function callCallback() { + // We immediately remove the callback from event listeners so that + // nested `invokeGuardedCallback` calls do not clash. Otherwise, a + // nested call would trigger the fake event handlers of any call higher + // in the stack. + fakeNode.removeEventListener(evtType, callCallback, false); // We check for window.hasOwnProperty('event') to prevent the + // window.event assignment in both IE <= 10 as they throw an error + // "Member not found" in strict mode, and in Firefox which does not + // support window.event. + + if (typeof window.event !== 'undefined' && window.hasOwnProperty('event')) { + window.event = windowEvent; + } + + func.apply(context, funcArgs); + didError = false; + } // Create a global error event handler. We use this to capture the value + // that was thrown. It's possible that this error handler will fire more + // than once; for example, if non-React code also calls `dispatchEvent` + // and a handler for that event throws. We should be resilient to most of + // those cases. Even if our error event handler fires more than once, the + // last error event is always used. If the callback actually does error, + // we know that the last error event is the correct one, because it's not + // possible for anything else to have happened in between our callback + // erroring and the code that follows the `dispatchEvent` call below. If + // the callback doesn't error, but the error event was fired, we know to + // ignore it because `didError` will be false, as described above. + + + var error; // Use this to track whether the error event is ever called. + + var didSetError = false; + var isCrossOriginError = false; + + function handleWindowError(event) { + error = event.error; + didSetError = true; + + if (error === null && event.colno === 0 && event.lineno === 0) { + isCrossOriginError = true; + } + + if (event.defaultPrevented) { + // Some other error handler has prevented default. + // Browsers silence the error report if this happens. + // We'll remember this to later decide whether to log it or not. + if (error != null && typeof error === 'object') { + try { + error._suppressLogging = true; + } catch (inner) {// Ignore. + } + } + } + } // Create a fake event type. + + + var evtType = "react-" + (name ? name : 'invokeguardedcallback'); // Attach our event handlers + + window.addEventListener('error', handleWindowError); + fakeNode.addEventListener(evtType, callCallback, false); // Synchronously dispatch our fake event. If the user-provided function + // errors, it will trigger our global error handler. + + evt.initEvent(evtType, false, false); + fakeNode.dispatchEvent(evt); + + if (windowEventDescriptor) { + Object.defineProperty(window, 'event', windowEventDescriptor); + } + + if (didError) { + if (!didSetError) { + // The callback errored, but the error event never fired. + error = new Error('An error was thrown inside one of your components, but React ' + "doesn't know what it was. This is likely due to browser " + 'flakiness. React does its best to preserve the "Pause on ' + 'exceptions" behavior of the DevTools, which requires some ' + "DEV-mode only tricks. It's possible that these don't work in " + 'your browser. Try triggering the error in production mode, ' + 'or switching to a modern browser. If you suspect that this is ' + 'actually an issue with React, please file an issue.'); + } else if (isCrossOriginError) { + error = new Error("A cross-origin error was thrown. React doesn't have access to " + 'the actual error object in development. ' + 'See https://fb.me/react-crossorigin-error for more information.'); + } + + this.onError(error); + } // Remove our event listeners + + + window.removeEventListener('error', handleWindowError); + }; + + invokeGuardedCallbackImpl = invokeGuardedCallbackDev; + } +} + +var invokeGuardedCallbackImpl$1 = invokeGuardedCallbackImpl; + +var hasError = false; +var caughtError = null; // Used by event system to capture/rethrow the first error. + +var hasRethrowError = false; +var rethrowError = null; +var reporter = { + onError: function (error) { + hasError = true; + caughtError = error; + } +}; +/** + * Call a function while guarding against errors that happens within it. + * Returns an error if it throws, otherwise null. + * + * In production, this is implemented using a try-catch. The reason we don't + * use a try-catch directly is so that we can swap out a different + * implementation in DEV mode. + * + * @param {String} name of the guard to use for logging or debugging + * @param {Function} func The function to invoke + * @param {*} context The context to use when calling the function + * @param {...*} args Arguments for function + */ + +function invokeGuardedCallback(name, func, context, a, b, c, d, e, f) { + hasError = false; + caughtError = null; + invokeGuardedCallbackImpl$1.apply(reporter, arguments); +} +/** + * Same as invokeGuardedCallback, but instead of returning an error, it stores + * it in a global so it can be rethrown by `rethrowCaughtError` later. + * TODO: See if caughtError and rethrowError can be unified. + * + * @param {String} name of the guard to use for logging or debugging + * @param {Function} func The function to invoke + * @param {*} context The context to use when calling the function + * @param {...*} args Arguments for function + */ + +function invokeGuardedCallbackAndCatchFirstError(name, func, context, a, b, c, d, e, f) { + invokeGuardedCallback.apply(this, arguments); + + if (hasError) { + var error = clearCaughtError(); + + if (!hasRethrowError) { + hasRethrowError = true; + rethrowError = error; + } + } +} +/** + * During execution of guarded functions we will capture the first error which + * we will rethrow to be handled by the top level error handler. + */ + +function rethrowCaughtError() { + if (hasRethrowError) { + var error = rethrowError; + hasRethrowError = false; + rethrowError = null; + throw error; + } +} +function hasCaughtError() { + return hasError; +} +function clearCaughtError() { + if (hasError) { + var error = caughtError; + hasError = false; + caughtError = null; + return error; + } else { + { + { + throw Error( "clearCaughtError was called but no error was captured. This error is likely caused by a bug in React. Please file an issue." ); + } + } + } +} + +var getFiberCurrentPropsFromNode = null; +var getInstanceFromNode = null; +var getNodeFromInstance = null; +function setComponentTree(getFiberCurrentPropsFromNodeImpl, getInstanceFromNodeImpl, getNodeFromInstanceImpl) { + getFiberCurrentPropsFromNode = getFiberCurrentPropsFromNodeImpl; + getInstanceFromNode = getInstanceFromNodeImpl; + getNodeFromInstance = getNodeFromInstanceImpl; + + { + if (!getNodeFromInstance || !getInstanceFromNode) { + error('EventPluginUtils.setComponentTree(...): Injected ' + 'module is missing getNodeFromInstance or getInstanceFromNode.'); + } + } +} +var validateEventDispatches; + +{ + validateEventDispatches = function (event) { + var dispatchListeners = event._dispatchListeners; + var dispatchInstances = event._dispatchInstances; + var listenersIsArr = Array.isArray(dispatchListeners); + var listenersLen = listenersIsArr ? dispatchListeners.length : dispatchListeners ? 1 : 0; + var instancesIsArr = Array.isArray(dispatchInstances); + var instancesLen = instancesIsArr ? dispatchInstances.length : dispatchInstances ? 1 : 0; + + if (instancesIsArr !== listenersIsArr || instancesLen !== listenersLen) { + error('EventPluginUtils: Invalid `event`.'); + } + }; +} +/** + * Dispatch the event to the listener. + * @param {SyntheticEvent} event SyntheticEvent to handle + * @param {function} listener Application-level callback + * @param {*} inst Internal component instance + */ + + +function executeDispatch(event, listener, inst) { + var type = event.type || 'unknown-event'; + event.currentTarget = getNodeFromInstance(inst); + invokeGuardedCallbackAndCatchFirstError(type, listener, undefined, event); + event.currentTarget = null; +} +/** + * Standard/simple iteration through an event's collected dispatches. + */ + +function executeDispatchesInOrder(event) { + var dispatchListeners = event._dispatchListeners; + var dispatchInstances = event._dispatchInstances; + + { + validateEventDispatches(event); + } + + if (Array.isArray(dispatchListeners)) { + for (var i = 0; i < dispatchListeners.length; i++) { + if (event.isPropagationStopped()) { + break; + } // Listeners and Instances are two parallel arrays that are always in sync. + + + executeDispatch(event, dispatchListeners[i], dispatchInstances[i]); + } + } else if (dispatchListeners) { + executeDispatch(event, dispatchListeners, dispatchInstances); + } + + event._dispatchListeners = null; + event._dispatchInstances = null; +} + +var FunctionComponent = 0; +var ClassComponent = 1; +var IndeterminateComponent = 2; // Before we know whether it is function or class + +var HostRoot = 3; // Root of a host tree. Could be nested inside another node. + +var HostPortal = 4; // A subtree. Could be an entry point to a different renderer. + +var HostComponent = 5; +var HostText = 6; +var Fragment = 7; +var Mode = 8; +var ContextConsumer = 9; +var ContextProvider = 10; +var ForwardRef = 11; +var Profiler = 12; +var SuspenseComponent = 13; +var MemoComponent = 14; +var SimpleMemoComponent = 15; +var LazyComponent = 16; +var IncompleteClassComponent = 17; +var DehydratedFragment = 18; +var SuspenseListComponent = 19; +var FundamentalComponent = 20; +var ScopeComponent = 21; +var Block = 22; + +/** + * Injectable ordering of event plugins. + */ +var eventPluginOrder = null; +/** + * Injectable mapping from names to event plugin modules. + */ + +var namesToPlugins = {}; +/** + * Recomputes the plugin list using the injected plugins and plugin ordering. + * + * @private + */ + +function recomputePluginOrdering() { + if (!eventPluginOrder) { + // Wait until an `eventPluginOrder` is injected. + return; + } + + for (var pluginName in namesToPlugins) { + var pluginModule = namesToPlugins[pluginName]; + var pluginIndex = eventPluginOrder.indexOf(pluginName); + + if (!(pluginIndex > -1)) { + { + throw Error( "EventPluginRegistry: Cannot inject event plugins that do not exist in the plugin ordering, `" + pluginName + "`." ); + } + } + + if (plugins[pluginIndex]) { + continue; + } + + if (!pluginModule.extractEvents) { + { + throw Error( "EventPluginRegistry: Event plugins must implement an `extractEvents` method, but `" + pluginName + "` does not." ); + } + } + + plugins[pluginIndex] = pluginModule; + var publishedEvents = pluginModule.eventTypes; + + for (var eventName in publishedEvents) { + if (!publishEventForPlugin(publishedEvents[eventName], pluginModule, eventName)) { + { + throw Error( "EventPluginRegistry: Failed to publish event `" + eventName + "` for plugin `" + pluginName + "`." ); + } + } + } + } +} +/** + * Publishes an event so that it can be dispatched by the supplied plugin. + * + * @param {object} dispatchConfig Dispatch configuration for the event. + * @param {object} PluginModule Plugin publishing the event. + * @return {boolean} True if the event was successfully published. + * @private + */ + + +function publishEventForPlugin(dispatchConfig, pluginModule, eventName) { + if (!!eventNameDispatchConfigs.hasOwnProperty(eventName)) { + { + throw Error( "EventPluginRegistry: More than one plugin attempted to publish the same event name, `" + eventName + "`." ); + } + } + + eventNameDispatchConfigs[eventName] = dispatchConfig; + var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames; + + if (phasedRegistrationNames) { + for (var phaseName in phasedRegistrationNames) { + if (phasedRegistrationNames.hasOwnProperty(phaseName)) { + var phasedRegistrationName = phasedRegistrationNames[phaseName]; + publishRegistrationName(phasedRegistrationName, pluginModule, eventName); + } + } + + return true; + } else if (dispatchConfig.registrationName) { + publishRegistrationName(dispatchConfig.registrationName, pluginModule, eventName); + return true; + } + + return false; +} +/** + * Publishes a registration name that is used to identify dispatched events. + * + * @param {string} registrationName Registration name to add. + * @param {object} PluginModule Plugin publishing the event. + * @private + */ + + +function publishRegistrationName(registrationName, pluginModule, eventName) { + if (!!registrationNameModules[registrationName]) { + { + throw Error( "EventPluginRegistry: More than one plugin attempted to publish the same registration name, `" + registrationName + "`." ); + } + } + + registrationNameModules[registrationName] = pluginModule; + registrationNameDependencies[registrationName] = pluginModule.eventTypes[eventName].dependencies; + + { + var lowerCasedName = registrationName.toLowerCase(); + possibleRegistrationNames[lowerCasedName] = registrationName; + + if (registrationName === 'onDoubleClick') { + possibleRegistrationNames.ondblclick = registrationName; + } + } +} +/** + * Registers plugins so that they can extract and dispatch events. + */ + +/** + * Ordered list of injected plugins. + */ + + +var plugins = []; +/** + * Mapping from event name to dispatch config + */ + +var eventNameDispatchConfigs = {}; +/** + * Mapping from registration name to plugin module + */ + +var registrationNameModules = {}; +/** + * Mapping from registration name to event name + */ + +var registrationNameDependencies = {}; +/** + * Mapping from lowercase registration names to the properly cased version, + * used to warn in the case of missing event handlers. Available + * only in true. + * @type {Object} + */ + +var possibleRegistrationNames = {} ; // Trust the developer to only use possibleRegistrationNames in true + +/** + * Injects an ordering of plugins (by plugin name). This allows the ordering + * to be decoupled from injection of the actual plugins so that ordering is + * always deterministic regardless of packaging, on-the-fly injection, etc. + * + * @param {array} InjectedEventPluginOrder + * @internal + */ + +function injectEventPluginOrder(injectedEventPluginOrder) { + if (!!eventPluginOrder) { + { + throw Error( "EventPluginRegistry: Cannot inject event plugin ordering more than once. You are likely trying to load more than one copy of React." ); + } + } // Clone the ordering so it cannot be dynamically mutated. + + + eventPluginOrder = Array.prototype.slice.call(injectedEventPluginOrder); + recomputePluginOrdering(); +} +/** + * Injects plugins to be used by plugin event system. The plugin names must be + * in the ordering injected by `injectEventPluginOrder`. + * + * Plugins can be injected as part of page initialization or on-the-fly. + * + * @param {object} injectedNamesToPlugins Map from names to plugin modules. + * @internal + */ + +function injectEventPluginsByName(injectedNamesToPlugins) { + var isOrderingDirty = false; + + for (var pluginName in injectedNamesToPlugins) { + if (!injectedNamesToPlugins.hasOwnProperty(pluginName)) { + continue; + } + + var pluginModule = injectedNamesToPlugins[pluginName]; + + if (!namesToPlugins.hasOwnProperty(pluginName) || namesToPlugins[pluginName] !== pluginModule) { + if (!!namesToPlugins[pluginName]) { + { + throw Error( "EventPluginRegistry: Cannot inject two different event plugins using the same name, `" + pluginName + "`." ); + } + } + + namesToPlugins[pluginName] = pluginModule; + isOrderingDirty = true; + } + } + + if (isOrderingDirty) { + recomputePluginOrdering(); + } +} + +var canUseDOM = !!(typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined'); + +var PLUGIN_EVENT_SYSTEM = 1; +var IS_REPLAYED = 1 << 5; +var IS_FIRST_ANCESTOR = 1 << 6; + +var restoreImpl = null; +var restoreTarget = null; +var restoreQueue = null; + +function restoreStateOfTarget(target) { + // We perform this translation at the end of the event loop so that we + // always receive the correct fiber here + var internalInstance = getInstanceFromNode(target); + + if (!internalInstance) { + // Unmounted + return; + } + + if (!(typeof restoreImpl === 'function')) { + { + throw Error( "setRestoreImplementation() needs to be called to handle a target for controlled events. This error is likely caused by a bug in React. Please file an issue." ); + } + } + + var stateNode = internalInstance.stateNode; // Guard against Fiber being unmounted. + + if (stateNode) { + var _props = getFiberCurrentPropsFromNode(stateNode); + + restoreImpl(internalInstance.stateNode, internalInstance.type, _props); + } +} + +function setRestoreImplementation(impl) { + restoreImpl = impl; +} +function enqueueStateRestore(target) { + if (restoreTarget) { + if (restoreQueue) { + restoreQueue.push(target); + } else { + restoreQueue = [target]; + } + } else { + restoreTarget = target; + } +} +function needsStateRestore() { + return restoreTarget !== null || restoreQueue !== null; +} +function restoreStateIfNeeded() { + if (!restoreTarget) { + return; + } + + var target = restoreTarget; + var queuedTargets = restoreQueue; + restoreTarget = null; + restoreQueue = null; + restoreStateOfTarget(target); + + if (queuedTargets) { + for (var i = 0; i < queuedTargets.length; i++) { + restoreStateOfTarget(queuedTargets[i]); + } + } +} + +var enableProfilerTimer = true; // Trace which interactions trigger each commit. + +var enableDeprecatedFlareAPI = false; // Experimental Host Component support. + +var enableFundamentalAPI = false; // Experimental Scope support. +var warnAboutStringRefs = false; + +// the renderer. Such as when we're dispatching events or if third party +// libraries need to call batchedUpdates. Eventually, this API will go away when +// everything is batched by default. We'll then have a similar API to opt-out of +// scheduled work and instead do synchronous work. +// Defaults + +var batchedUpdatesImpl = function (fn, bookkeeping) { + return fn(bookkeeping); +}; + +var discreteUpdatesImpl = function (fn, a, b, c, d) { + return fn(a, b, c, d); +}; + +var flushDiscreteUpdatesImpl = function () {}; + +var batchedEventUpdatesImpl = batchedUpdatesImpl; +var isInsideEventHandler = false; +var isBatchingEventUpdates = false; + +function finishEventHandler() { + // Here we wait until all updates have propagated, which is important + // when using controlled components within layers: + // https://github.com/facebook/react/issues/1698 + // Then we restore state of any controlled component. + var controlledComponentsHavePendingUpdates = needsStateRestore(); + + if (controlledComponentsHavePendingUpdates) { + // If a controlled event was fired, we may need to restore the state of + // the DOM node back to the controlled value. This is necessary when React + // bails out of the update without touching the DOM. + flushDiscreteUpdatesImpl(); + restoreStateIfNeeded(); + } +} + +function batchedUpdates(fn, bookkeeping) { + if (isInsideEventHandler) { + // If we are currently inside another batch, we need to wait until it + // fully completes before restoring state. + return fn(bookkeeping); + } + + isInsideEventHandler = true; + + try { + return batchedUpdatesImpl(fn, bookkeeping); + } finally { + isInsideEventHandler = false; + finishEventHandler(); + } +} +function batchedEventUpdates(fn, a, b) { + if (isBatchingEventUpdates) { + // If we are currently inside another batch, we need to wait until it + // fully completes before restoring state. + return fn(a, b); + } + + isBatchingEventUpdates = true; + + try { + return batchedEventUpdatesImpl(fn, a, b); + } finally { + isBatchingEventUpdates = false; + finishEventHandler(); + } +} // This is for the React Flare event system +function discreteUpdates(fn, a, b, c, d) { + var prevIsInsideEventHandler = isInsideEventHandler; + isInsideEventHandler = true; + + try { + return discreteUpdatesImpl(fn, a, b, c, d); + } finally { + isInsideEventHandler = prevIsInsideEventHandler; + + if (!isInsideEventHandler) { + finishEventHandler(); + } + } +} +function flushDiscreteUpdatesIfNeeded(timeStamp) { + // event.timeStamp isn't overly reliable due to inconsistencies in + // how different browsers have historically provided the time stamp. + // Some browsers provide high-resolution time stamps for all events, + // some provide low-resolution time stamps for all events. FF < 52 + // even mixes both time stamps together. Some browsers even report + // negative time stamps or time stamps that are 0 (iOS9) in some cases. + // Given we are only comparing two time stamps with equality (!==), + // we are safe from the resolution differences. If the time stamp is 0 + // we bail-out of preventing the flush, which can affect semantics, + // such as if an earlier flush removes or adds event listeners that + // are fired in the subsequent flush. However, this is the same + // behaviour as we had before this change, so the risks are low. + if (!isInsideEventHandler && (!enableDeprecatedFlareAPI )) { + flushDiscreteUpdatesImpl(); + } +} +function setBatchingImplementation(_batchedUpdatesImpl, _discreteUpdatesImpl, _flushDiscreteUpdatesImpl, _batchedEventUpdatesImpl) { + batchedUpdatesImpl = _batchedUpdatesImpl; + discreteUpdatesImpl = _discreteUpdatesImpl; + flushDiscreteUpdatesImpl = _flushDiscreteUpdatesImpl; + batchedEventUpdatesImpl = _batchedEventUpdatesImpl; +} + +var DiscreteEvent = 0; +var UserBlockingEvent = 1; +var ContinuousEvent = 2; + +// A reserved attribute. +// It is handled by React separately and shouldn't be written to the DOM. +var RESERVED = 0; // A simple string attribute. +// Attributes that aren't in the whitelist are presumed to have this type. + +var STRING = 1; // A string attribute that accepts booleans in React. In HTML, these are called +// "enumerated" attributes with "true" and "false" as possible values. +// When true, it should be set to a "true" string. +// When false, it should be set to a "false" string. + +var BOOLEANISH_STRING = 2; // A real boolean attribute. +// When true, it should be present (set either to an empty string or its name). +// When false, it should be omitted. + +var BOOLEAN = 3; // An attribute that can be used as a flag as well as with a value. +// When true, it should be present (set either to an empty string or its name). +// When false, it should be omitted. +// For any other value, should be present with that value. + +var OVERLOADED_BOOLEAN = 4; // An attribute that must be numeric or parse as a numeric. +// When falsy, it should be removed. + +var NUMERIC = 5; // An attribute that must be positive numeric or parse as a positive numeric. +// When falsy, it should be removed. + +var POSITIVE_NUMERIC = 6; + +/* eslint-disable max-len */ +var ATTRIBUTE_NAME_START_CHAR = ":A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD"; +/* eslint-enable max-len */ + +var ATTRIBUTE_NAME_CHAR = ATTRIBUTE_NAME_START_CHAR + "\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040"; +var ROOT_ATTRIBUTE_NAME = 'data-reactroot'; +var VALID_ATTRIBUTE_NAME_REGEX = new RegExp('^[' + ATTRIBUTE_NAME_START_CHAR + '][' + ATTRIBUTE_NAME_CHAR + ']*$'); +var hasOwnProperty = Object.prototype.hasOwnProperty; +var illegalAttributeNameCache = {}; +var validatedAttributeNameCache = {}; +function isAttributeNameSafe(attributeName) { + if (hasOwnProperty.call(validatedAttributeNameCache, attributeName)) { + return true; + } + + if (hasOwnProperty.call(illegalAttributeNameCache, attributeName)) { + return false; + } + + if (VALID_ATTRIBUTE_NAME_REGEX.test(attributeName)) { + validatedAttributeNameCache[attributeName] = true; + return true; + } + + illegalAttributeNameCache[attributeName] = true; + + { + error('Invalid attribute name: `%s`', attributeName); + } + + return false; +} +function shouldIgnoreAttribute(name, propertyInfo, isCustomComponentTag) { + if (propertyInfo !== null) { + return propertyInfo.type === RESERVED; + } + + if (isCustomComponentTag) { + return false; + } + + if (name.length > 2 && (name[0] === 'o' || name[0] === 'O') && (name[1] === 'n' || name[1] === 'N')) { + return true; + } + + return false; +} +function shouldRemoveAttributeWithWarning(name, value, propertyInfo, isCustomComponentTag) { + if (propertyInfo !== null && propertyInfo.type === RESERVED) { + return false; + } + + switch (typeof value) { + case 'function': // $FlowIssue symbol is perfectly valid here + + case 'symbol': + // eslint-disable-line + return true; + + case 'boolean': + { + if (isCustomComponentTag) { + return false; + } + + if (propertyInfo !== null) { + return !propertyInfo.acceptsBooleans; + } else { + var prefix = name.toLowerCase().slice(0, 5); + return prefix !== 'data-' && prefix !== 'aria-'; + } + } + + default: + return false; + } +} +function shouldRemoveAttribute(name, value, propertyInfo, isCustomComponentTag) { + if (value === null || typeof value === 'undefined') { + return true; + } + + if (shouldRemoveAttributeWithWarning(name, value, propertyInfo, isCustomComponentTag)) { + return true; + } + + if (isCustomComponentTag) { + return false; + } + + if (propertyInfo !== null) { + switch (propertyInfo.type) { + case BOOLEAN: + return !value; + + case OVERLOADED_BOOLEAN: + return value === false; + + case NUMERIC: + return isNaN(value); + + case POSITIVE_NUMERIC: + return isNaN(value) || value < 1; + } + } + + return false; +} +function getPropertyInfo(name) { + return properties.hasOwnProperty(name) ? properties[name] : null; +} + +function PropertyInfoRecord(name, type, mustUseProperty, attributeName, attributeNamespace, sanitizeURL) { + this.acceptsBooleans = type === BOOLEANISH_STRING || type === BOOLEAN || type === OVERLOADED_BOOLEAN; + this.attributeName = attributeName; + this.attributeNamespace = attributeNamespace; + this.mustUseProperty = mustUseProperty; + this.propertyName = name; + this.type = type; + this.sanitizeURL = sanitizeURL; +} // When adding attributes to this list, be sure to also add them to +// the `possibleStandardNames` module to ensure casing and incorrect +// name warnings. + + +var properties = {}; // These props are reserved by React. They shouldn't be written to the DOM. + +var reservedProps = ['children', 'dangerouslySetInnerHTML', // TODO: This prevents the assignment of defaultValue to regular +// elements (not just inputs). Now that ReactDOMInput assigns to the +// defaultValue property -- do we need this? +'defaultValue', 'defaultChecked', 'innerHTML', 'suppressContentEditableWarning', 'suppressHydrationWarning', 'style']; + +reservedProps.forEach(function (name) { + properties[name] = new PropertyInfoRecord(name, RESERVED, false, // mustUseProperty + name, // attributeName + null, // attributeNamespace + false); +}); // A few React string attributes have a different name. +// This is a mapping from React prop names to the attribute names. + +[['acceptCharset', 'accept-charset'], ['className', 'class'], ['htmlFor', 'for'], ['httpEquiv', 'http-equiv']].forEach(function (_ref) { + var name = _ref[0], + attributeName = _ref[1]; + properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty + attributeName, // attributeName + null, // attributeNamespace + false); +}); // These are "enumerated" HTML attributes that accept "true" and "false". +// In React, we let users pass `true` and `false` even though technically +// these aren't boolean attributes (they are coerced to strings). + +['contentEditable', 'draggable', 'spellCheck', 'value'].forEach(function (name) { + properties[name] = new PropertyInfoRecord(name, BOOLEANISH_STRING, false, // mustUseProperty + name.toLowerCase(), // attributeName + null, // attributeNamespace + false); +}); // These are "enumerated" SVG attributes that accept "true" and "false". +// In React, we let users pass `true` and `false` even though technically +// these aren't boolean attributes (they are coerced to strings). +// Since these are SVG attributes, their attribute names are case-sensitive. + +['autoReverse', 'externalResourcesRequired', 'focusable', 'preserveAlpha'].forEach(function (name) { + properties[name] = new PropertyInfoRecord(name, BOOLEANISH_STRING, false, // mustUseProperty + name, // attributeName + null, // attributeNamespace + false); +}); // These are HTML boolean attributes. + +['allowFullScreen', 'async', // Note: there is a special case that prevents it from being written to the DOM +// on the client side because the browsers are inconsistent. Instead we call focus(). +'autoFocus', 'autoPlay', 'controls', 'default', 'defer', 'disabled', 'disablePictureInPicture', 'formNoValidate', 'hidden', 'loop', 'noModule', 'noValidate', 'open', 'playsInline', 'readOnly', 'required', 'reversed', 'scoped', 'seamless', // Microdata +'itemScope'].forEach(function (name) { + properties[name] = new PropertyInfoRecord(name, BOOLEAN, false, // mustUseProperty + name.toLowerCase(), // attributeName + null, // attributeNamespace + false); +}); // These are the few React props that we set as DOM properties +// rather than attributes. These are all booleans. + +['checked', // Note: `option.selected` is not updated if `select.multiple` is +// disabled with `removeAttribute`. We have special logic for handling this. +'multiple', 'muted', 'selected' // NOTE: if you add a camelCased prop to this list, +// you'll need to set attributeName to name.toLowerCase() +// instead in the assignment below. +].forEach(function (name) { + properties[name] = new PropertyInfoRecord(name, BOOLEAN, true, // mustUseProperty + name, // attributeName + null, // attributeNamespace + false); +}); // These are HTML attributes that are "overloaded booleans": they behave like +// booleans, but can also accept a string value. + +['capture', 'download' // NOTE: if you add a camelCased prop to this list, +// you'll need to set attributeName to name.toLowerCase() +// instead in the assignment below. +].forEach(function (name) { + properties[name] = new PropertyInfoRecord(name, OVERLOADED_BOOLEAN, false, // mustUseProperty + name, // attributeName + null, // attributeNamespace + false); +}); // These are HTML attributes that must be positive numbers. + +['cols', 'rows', 'size', 'span' // NOTE: if you add a camelCased prop to this list, +// you'll need to set attributeName to name.toLowerCase() +// instead in the assignment below. +].forEach(function (name) { + properties[name] = new PropertyInfoRecord(name, POSITIVE_NUMERIC, false, // mustUseProperty + name, // attributeName + null, // attributeNamespace + false); +}); // These are HTML attributes that must be numbers. + +['rowSpan', 'start'].forEach(function (name) { + properties[name] = new PropertyInfoRecord(name, NUMERIC, false, // mustUseProperty + name.toLowerCase(), // attributeName + null, // attributeNamespace + false); +}); +var CAMELIZE = /[\-\:]([a-z])/g; + +var capitalize = function (token) { + return token[1].toUpperCase(); +}; // This is a list of all SVG attributes that need special casing, namespacing, +// or boolean value assignment. Regular attributes that just accept strings +// and have the same names are omitted, just like in the HTML whitelist. +// Some of these attributes can be hard to find. This list was created by +// scraping the MDN documentation. + + +['accent-height', 'alignment-baseline', 'arabic-form', 'baseline-shift', 'cap-height', 'clip-path', 'clip-rule', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'dominant-baseline', 'enable-background', 'fill-opacity', 'fill-rule', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'glyph-name', 'glyph-orientation-horizontal', 'glyph-orientation-vertical', 'horiz-adv-x', 'horiz-origin-x', 'image-rendering', 'letter-spacing', 'lighting-color', 'marker-end', 'marker-mid', 'marker-start', 'overline-position', 'overline-thickness', 'paint-order', 'panose-1', 'pointer-events', 'rendering-intent', 'shape-rendering', 'stop-color', 'stop-opacity', 'strikethrough-position', 'strikethrough-thickness', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke-width', 'text-anchor', 'text-decoration', 'text-rendering', 'underline-position', 'underline-thickness', 'unicode-bidi', 'unicode-range', 'units-per-em', 'v-alphabetic', 'v-hanging', 'v-ideographic', 'v-mathematical', 'vector-effect', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'word-spacing', 'writing-mode', 'xmlns:xlink', 'x-height' // NOTE: if you add a camelCased prop to this list, +// you'll need to set attributeName to name.toLowerCase() +// instead in the assignment below. +].forEach(function (attributeName) { + var name = attributeName.replace(CAMELIZE, capitalize); + properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty + attributeName, null, // attributeNamespace + false); +}); // String SVG attributes with the xlink namespace. + +['xlink:actuate', 'xlink:arcrole', 'xlink:role', 'xlink:show', 'xlink:title', 'xlink:type' // NOTE: if you add a camelCased prop to this list, +// you'll need to set attributeName to name.toLowerCase() +// instead in the assignment below. +].forEach(function (attributeName) { + var name = attributeName.replace(CAMELIZE, capitalize); + properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty + attributeName, 'http://www.w3.org/1999/xlink', false); +}); // String SVG attributes with the xml namespace. + +['xml:base', 'xml:lang', 'xml:space' // NOTE: if you add a camelCased prop to this list, +// you'll need to set attributeName to name.toLowerCase() +// instead in the assignment below. +].forEach(function (attributeName) { + var name = attributeName.replace(CAMELIZE, capitalize); + properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty + attributeName, 'http://www.w3.org/XML/1998/namespace', false); +}); // These attribute exists both in HTML and SVG. +// The attribute name is case-sensitive in SVG so we can't just use +// the React name like we do for attributes that exist only in HTML. + +['tabIndex', 'crossOrigin'].forEach(function (attributeName) { + properties[attributeName] = new PropertyInfoRecord(attributeName, STRING, false, // mustUseProperty + attributeName.toLowerCase(), // attributeName + null, // attributeNamespace + false); +}); // These attributes accept URLs. These must not allow javascript: URLS. +// These will also need to accept Trusted Types object in the future. + +var xlinkHref = 'xlinkHref'; +properties[xlinkHref] = new PropertyInfoRecord('xlinkHref', STRING, false, // mustUseProperty +'xlink:href', 'http://www.w3.org/1999/xlink', true); +['src', 'href', 'action', 'formAction'].forEach(function (attributeName) { + properties[attributeName] = new PropertyInfoRecord(attributeName, STRING, false, // mustUseProperty + attributeName.toLowerCase(), // attributeName + null, // attributeNamespace + true); +}); + +var ReactDebugCurrentFrame = null; + +{ + ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame; +} // A javascript: URL can contain leading C0 control or \u0020 SPACE, +// and any newline or tab are filtered out as if they're not part of the URL. +// https://url.spec.whatwg.org/#url-parsing +// Tab or newline are defined as \r\n\t: +// https://infra.spec.whatwg.org/#ascii-tab-or-newline +// A C0 control is a code point in the range \u0000 NULL to \u001F +// INFORMATION SEPARATOR ONE, inclusive: +// https://infra.spec.whatwg.org/#c0-control-or-space + +/* eslint-disable max-len */ + + +var isJavaScriptProtocol = /^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*\:/i; +var didWarn = false; + +function sanitizeURL(url) { + { + if (!didWarn && isJavaScriptProtocol.test(url)) { + didWarn = true; + + error('A future version of React will block javascript: URLs as a security precaution. ' + 'Use event handlers instead if you can. If you need to generate unsafe HTML try ' + 'using dangerouslySetInnerHTML instead. React was passed %s.', JSON.stringify(url)); + } + } +} + +/** + * Get the value for a property on a node. Only used in DEV for SSR validation. + * The "expected" argument is used as a hint of what the expected value is. + * Some properties have multiple equivalent values. + */ +function getValueForProperty(node, name, expected, propertyInfo) { + { + if (propertyInfo.mustUseProperty) { + var propertyName = propertyInfo.propertyName; + return node[propertyName]; + } else { + if ( propertyInfo.sanitizeURL) { + // If we haven't fully disabled javascript: URLs, and if + // the hydration is successful of a javascript: URL, we + // still want to warn on the client. + sanitizeURL('' + expected); + } + + var attributeName = propertyInfo.attributeName; + var stringValue = null; + + if (propertyInfo.type === OVERLOADED_BOOLEAN) { + if (node.hasAttribute(attributeName)) { + var value = node.getAttribute(attributeName); + + if (value === '') { + return true; + } + + if (shouldRemoveAttribute(name, expected, propertyInfo, false)) { + return value; + } + + if (value === '' + expected) { + return expected; + } + + return value; + } + } else if (node.hasAttribute(attributeName)) { + if (shouldRemoveAttribute(name, expected, propertyInfo, false)) { + // We had an attribute but shouldn't have had one, so read it + // for the error message. + return node.getAttribute(attributeName); + } + + if (propertyInfo.type === BOOLEAN) { + // If this was a boolean, it doesn't matter what the value is + // the fact that we have it is the same as the expected. + return expected; + } // Even if this property uses a namespace we use getAttribute + // because we assume its namespaced name is the same as our config. + // To use getAttributeNS we need the local name which we don't have + // in our config atm. + + + stringValue = node.getAttribute(attributeName); + } + + if (shouldRemoveAttribute(name, expected, propertyInfo, false)) { + return stringValue === null ? expected : stringValue; + } else if (stringValue === '' + expected) { + return expected; + } else { + return stringValue; + } + } + } +} +/** + * Get the value for a attribute on a node. Only used in DEV for SSR validation. + * The third argument is used as a hint of what the expected value is. Some + * attributes have multiple equivalent values. + */ + +function getValueForAttribute(node, name, expected) { + { + if (!isAttributeNameSafe(name)) { + return; + } + + if (!node.hasAttribute(name)) { + return expected === undefined ? undefined : null; + } + + var value = node.getAttribute(name); + + if (value === '' + expected) { + return expected; + } + + return value; + } +} +/** + * Sets the value for a property on a node. + * + * @param {DOMElement} node + * @param {string} name + * @param {*} value + */ + +function setValueForProperty(node, name, value, isCustomComponentTag) { + var propertyInfo = getPropertyInfo(name); + + if (shouldIgnoreAttribute(name, propertyInfo, isCustomComponentTag)) { + return; + } + + if (shouldRemoveAttribute(name, value, propertyInfo, isCustomComponentTag)) { + value = null; + } // If the prop isn't in the special list, treat it as a simple attribute. + + + if (isCustomComponentTag || propertyInfo === null) { + if (isAttributeNameSafe(name)) { + var _attributeName = name; + + if (value === null) { + node.removeAttribute(_attributeName); + } else { + node.setAttribute(_attributeName, '' + value); + } + } + + return; + } + + var mustUseProperty = propertyInfo.mustUseProperty; + + if (mustUseProperty) { + var propertyName = propertyInfo.propertyName; + + if (value === null) { + var type = propertyInfo.type; + node[propertyName] = type === BOOLEAN ? false : ''; + } else { + // Contrary to `setAttribute`, object properties are properly + // `toString`ed by IE8/9. + node[propertyName] = value; + } + + return; + } // The rest are treated as attributes with special cases. + + + var attributeName = propertyInfo.attributeName, + attributeNamespace = propertyInfo.attributeNamespace; + + if (value === null) { + node.removeAttribute(attributeName); + } else { + var _type = propertyInfo.type; + var attributeValue; + + if (_type === BOOLEAN || _type === OVERLOADED_BOOLEAN && value === true) { + // If attribute type is boolean, we know for sure it won't be an execution sink + // and we won't require Trusted Type here. + attributeValue = ''; + } else { + // `setAttribute` with objects becomes only `[object]` in IE8/9, + // ('' + value) makes it output the correct toString()-value. + { + attributeValue = '' + value; + } + + if (propertyInfo.sanitizeURL) { + sanitizeURL(attributeValue.toString()); + } + } + + if (attributeNamespace) { + node.setAttributeNS(attributeNamespace, attributeName, attributeValue); + } else { + node.setAttribute(attributeName, attributeValue); + } + } +} + +var BEFORE_SLASH_RE = /^(.*)[\\\/]/; +function describeComponentFrame (name, source, ownerName) { + var sourceInfo = ''; + + if (source) { + var path = source.fileName; + var fileName = path.replace(BEFORE_SLASH_RE, ''); + + { + // In DEV, include code for a common special case: + // prefer "folder/index.js" instead of just "index.js". + if (/^index\./.test(fileName)) { + var match = path.match(BEFORE_SLASH_RE); + + if (match) { + var pathBeforeSlash = match[1]; + + if (pathBeforeSlash) { + var folderName = pathBeforeSlash.replace(BEFORE_SLASH_RE, ''); + fileName = folderName + '/' + fileName; + } + } + } + } + + sourceInfo = ' (at ' + fileName + ':' + source.lineNumber + ')'; + } else if (ownerName) { + sourceInfo = ' (created by ' + ownerName + ')'; + } + + return '\n in ' + (name || 'Unknown') + sourceInfo; +} + +// The Symbol used to tag the ReactElement-like types. If there is no native Symbol +// nor polyfill, then a plain number is used for performance. +var hasSymbol = typeof Symbol === 'function' && Symbol.for; +var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7; +var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca; +var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb; +var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc; +var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2; +var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd; +var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary +var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf; +var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0; +var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1; +var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8; +var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3; +var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4; +var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9; +var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator; +var FAUX_ITERATOR_SYMBOL = '@@iterator'; +function getIteratorFn(maybeIterable) { + if (maybeIterable === null || typeof maybeIterable !== 'object') { + return null; + } + + var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]; + + if (typeof maybeIterator === 'function') { + return maybeIterator; + } + + return null; +} + +var Uninitialized = -1; +var Pending = 0; +var Resolved = 1; +var Rejected = 2; +function refineResolvedLazyComponent(lazyComponent) { + return lazyComponent._status === Resolved ? lazyComponent._result : null; +} +function initializeLazyComponentType(lazyComponent) { + if (lazyComponent._status === Uninitialized) { + lazyComponent._status = Pending; + var ctor = lazyComponent._ctor; + var thenable = ctor(); + lazyComponent._result = thenable; + thenable.then(function (moduleObject) { + if (lazyComponent._status === Pending) { + var defaultExport = moduleObject.default; + + { + if (defaultExport === undefined) { + error('lazy: Expected the result of a dynamic import() call. ' + 'Instead received: %s\n\nYour code should look like: \n ' + "const MyComponent = lazy(() => import('./MyComponent'))", moduleObject); + } + } + + lazyComponent._status = Resolved; + lazyComponent._result = defaultExport; + } + }, function (error) { + if (lazyComponent._status === Pending) { + lazyComponent._status = Rejected; + lazyComponent._result = error; + } + }); + } +} + +function getWrappedName(outerType, innerType, wrapperName) { + var functionName = innerType.displayName || innerType.name || ''; + return outerType.displayName || (functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName); +} + +function getComponentName(type) { + if (type == null) { + // Host root, text node or just invalid type. + return null; + } + + { + if (typeof type.tag === 'number') { + error('Received an unexpected object in getComponentName(). ' + 'This is likely a bug in React. Please file an issue.'); + } + } + + if (typeof type === 'function') { + return type.displayName || type.name || null; + } + + if (typeof type === 'string') { + return type; + } + + switch (type) { + case REACT_FRAGMENT_TYPE: + return 'Fragment'; + + case REACT_PORTAL_TYPE: + return 'Portal'; + + case REACT_PROFILER_TYPE: + return "Profiler"; + + case REACT_STRICT_MODE_TYPE: + return 'StrictMode'; + + case REACT_SUSPENSE_TYPE: + return 'Suspense'; + + case REACT_SUSPENSE_LIST_TYPE: + return 'SuspenseList'; + } + + if (typeof type === 'object') { + switch (type.$$typeof) { + case REACT_CONTEXT_TYPE: + return 'Context.Consumer'; + + case REACT_PROVIDER_TYPE: + return 'Context.Provider'; + + case REACT_FORWARD_REF_TYPE: + return getWrappedName(type, type.render, 'ForwardRef'); + + case REACT_MEMO_TYPE: + return getComponentName(type.type); + + case REACT_BLOCK_TYPE: + return getComponentName(type.render); + + case REACT_LAZY_TYPE: + { + var thenable = type; + var resolvedThenable = refineResolvedLazyComponent(thenable); + + if (resolvedThenable) { + return getComponentName(resolvedThenable); + } + + break; + } + } + } + + return null; +} + +var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame; + +function describeFiber(fiber) { + switch (fiber.tag) { + case HostRoot: + case HostPortal: + case HostText: + case Fragment: + case ContextProvider: + case ContextConsumer: + return ''; + + default: + var owner = fiber._debugOwner; + var source = fiber._debugSource; + var name = getComponentName(fiber.type); + var ownerName = null; + + if (owner) { + ownerName = getComponentName(owner.type); + } + + return describeComponentFrame(name, source, ownerName); + } +} + +function getStackByFiberInDevAndProd(workInProgress) { + var info = ''; + var node = workInProgress; + + do { + info += describeFiber(node); + node = node.return; + } while (node); + + return info; +} +var current = null; +var isRendering = false; +function getCurrentFiberOwnerNameInDevOrNull() { + { + if (current === null) { + return null; + } + + var owner = current._debugOwner; + + if (owner !== null && typeof owner !== 'undefined') { + return getComponentName(owner.type); + } + } + + return null; +} +function getCurrentFiberStackInDev() { + { + if (current === null) { + return ''; + } // Safe because if current fiber exists, we are reconciling, + // and it is guaranteed to be the work-in-progress version. + + + return getStackByFiberInDevAndProd(current); + } +} +function resetCurrentFiber() { + { + ReactDebugCurrentFrame$1.getCurrentStack = null; + current = null; + isRendering = false; + } +} +function setCurrentFiber(fiber) { + { + ReactDebugCurrentFrame$1.getCurrentStack = getCurrentFiberStackInDev; + current = fiber; + isRendering = false; + } +} +function setIsRendering(rendering) { + { + isRendering = rendering; + } +} + +// Flow does not allow string concatenation of most non-string types. To work +// around this limitation, we use an opaque type that can only be obtained by +// passing the value through getToStringValue first. +function toString(value) { + return '' + value; +} +function getToStringValue(value) { + switch (typeof value) { + case 'boolean': + case 'number': + case 'object': + case 'string': + case 'undefined': + return value; + + default: + // function, symbol are assigned as empty strings + return ''; + } +} + +var ReactDebugCurrentFrame$2 = null; +var ReactControlledValuePropTypes = { + checkPropTypes: null +}; + +{ + ReactDebugCurrentFrame$2 = ReactSharedInternals.ReactDebugCurrentFrame; + var hasReadOnlyValue = { + button: true, + checkbox: true, + image: true, + hidden: true, + radio: true, + reset: true, + submit: true + }; + var propTypes = { + value: function (props, propName, componentName) { + if (hasReadOnlyValue[props.type] || props.onChange || props.readOnly || props.disabled || props[propName] == null || enableDeprecatedFlareAPI ) { + return null; + } + + return new Error('You provided a `value` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultValue`. Otherwise, ' + 'set either `onChange` or `readOnly`.'); + }, + checked: function (props, propName, componentName) { + if (props.onChange || props.readOnly || props.disabled || props[propName] == null || enableDeprecatedFlareAPI ) { + return null; + } + + return new Error('You provided a `checked` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultChecked`. Otherwise, ' + 'set either `onChange` or `readOnly`.'); + } + }; + /** + * Provide a linked `value` attribute for controlled forms. You should not use + * this outside of the ReactDOM controlled form components. + */ + + ReactControlledValuePropTypes.checkPropTypes = function (tagName, props) { + checkPropTypes(propTypes, props, 'prop', tagName, ReactDebugCurrentFrame$2.getStackAddendum); + }; +} + +function isCheckable(elem) { + var type = elem.type; + var nodeName = elem.nodeName; + return nodeName && nodeName.toLowerCase() === 'input' && (type === 'checkbox' || type === 'radio'); +} + +function getTracker(node) { + return node._valueTracker; +} + +function detachTracker(node) { + node._valueTracker = null; +} + +function getValueFromNode(node) { + var value = ''; + + if (!node) { + return value; + } + + if (isCheckable(node)) { + value = node.checked ? 'true' : 'false'; + } else { + value = node.value; + } + + return value; +} + +function trackValueOnNode(node) { + var valueField = isCheckable(node) ? 'checked' : 'value'; + var descriptor = Object.getOwnPropertyDescriptor(node.constructor.prototype, valueField); + var currentValue = '' + node[valueField]; // if someone has already defined a value or Safari, then bail + // and don't track value will cause over reporting of changes, + // but it's better then a hard failure + // (needed for certain tests that spyOn input values and Safari) + + if (node.hasOwnProperty(valueField) || typeof descriptor === 'undefined' || typeof descriptor.get !== 'function' || typeof descriptor.set !== 'function') { + return; + } + + var get = descriptor.get, + set = descriptor.set; + Object.defineProperty(node, valueField, { + configurable: true, + get: function () { + return get.call(this); + }, + set: function (value) { + currentValue = '' + value; + set.call(this, value); + } + }); // We could've passed this the first time + // but it triggers a bug in IE11 and Edge 14/15. + // Calling defineProperty() again should be equivalent. + // https://github.com/facebook/react/issues/11768 + + Object.defineProperty(node, valueField, { + enumerable: descriptor.enumerable + }); + var tracker = { + getValue: function () { + return currentValue; + }, + setValue: function (value) { + currentValue = '' + value; + }, + stopTracking: function () { + detachTracker(node); + delete node[valueField]; + } + }; + return tracker; +} + +function track(node) { + if (getTracker(node)) { + return; + } // TODO: Once it's just Fiber we can move this to node._wrapperState + + + node._valueTracker = trackValueOnNode(node); +} +function updateValueIfChanged(node) { + if (!node) { + return false; + } + + var tracker = getTracker(node); // if there is no tracker at this point it's unlikely + // that trying again will succeed + + if (!tracker) { + return true; + } + + var lastValue = tracker.getValue(); + var nextValue = getValueFromNode(node); + + if (nextValue !== lastValue) { + tracker.setValue(nextValue); + return true; + } + + return false; +} + +var didWarnValueDefaultValue = false; +var didWarnCheckedDefaultChecked = false; +var didWarnControlledToUncontrolled = false; +var didWarnUncontrolledToControlled = false; + +function isControlled(props) { + var usesChecked = props.type === 'checkbox' || props.type === 'radio'; + return usesChecked ? props.checked != null : props.value != null; +} +/** + * Implements an host component that allows setting these optional + * props: `checked`, `value`, `defaultChecked`, and `defaultValue`. + * + * If `checked` or `value` are not supplied (or null/undefined), user actions + * that affect the checked state or value will trigger updates to the element. + * + * If they are supplied (and not null/undefined), the rendered element will not + * trigger updates to the element. Instead, the props must change in order for + * the rendered element to be updated. + * + * The rendered element will be initialized as unchecked (or `defaultChecked`) + * with an empty value (or `defaultValue`). + * + * See http://www.w3.org/TR/2012/WD-html5-20121025/the-input-element.html + */ + + +function getHostProps(element, props) { + var node = element; + var checked = props.checked; + + var hostProps = _assign({}, props, { + defaultChecked: undefined, + defaultValue: undefined, + value: undefined, + checked: checked != null ? checked : node._wrapperState.initialChecked + }); + + return hostProps; +} +function initWrapperState(element, props) { + { + ReactControlledValuePropTypes.checkPropTypes('input', props); + + if (props.checked !== undefined && props.defaultChecked !== undefined && !didWarnCheckedDefaultChecked) { + error('%s contains an input of type %s with both checked and defaultChecked props. ' + 'Input elements must be either controlled or uncontrolled ' + '(specify either the checked prop, or the defaultChecked prop, but not ' + 'both). Decide between using a controlled or uncontrolled input ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components', getCurrentFiberOwnerNameInDevOrNull() || 'A component', props.type); + + didWarnCheckedDefaultChecked = true; + } + + if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValueDefaultValue) { + error('%s contains an input of type %s with both value and defaultValue props. ' + 'Input elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled input ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components', getCurrentFiberOwnerNameInDevOrNull() || 'A component', props.type); + + didWarnValueDefaultValue = true; + } + } + + var node = element; + var defaultValue = props.defaultValue == null ? '' : props.defaultValue; + node._wrapperState = { + initialChecked: props.checked != null ? props.checked : props.defaultChecked, + initialValue: getToStringValue(props.value != null ? props.value : defaultValue), + controlled: isControlled(props) + }; +} +function updateChecked(element, props) { + var node = element; + var checked = props.checked; + + if (checked != null) { + setValueForProperty(node, 'checked', checked, false); + } +} +function updateWrapper(element, props) { + var node = element; + + { + var controlled = isControlled(props); + + if (!node._wrapperState.controlled && controlled && !didWarnUncontrolledToControlled) { + error('A component is changing an uncontrolled input of type %s to be controlled. ' + 'Input elements should not switch from uncontrolled to controlled (or vice versa). ' + 'Decide between using a controlled or uncontrolled input ' + 'element for the lifetime of the component. More info: https://fb.me/react-controlled-components', props.type); + + didWarnUncontrolledToControlled = true; + } + + if (node._wrapperState.controlled && !controlled && !didWarnControlledToUncontrolled) { + error('A component is changing a controlled input of type %s to be uncontrolled. ' + 'Input elements should not switch from controlled to uncontrolled (or vice versa). ' + 'Decide between using a controlled or uncontrolled input ' + 'element for the lifetime of the component. More info: https://fb.me/react-controlled-components', props.type); + + didWarnControlledToUncontrolled = true; + } + } + + updateChecked(element, props); + var value = getToStringValue(props.value); + var type = props.type; + + if (value != null) { + if (type === 'number') { + if (value === 0 && node.value === '' || // We explicitly want to coerce to number here if possible. + // eslint-disable-next-line + node.value != value) { + node.value = toString(value); + } + } else if (node.value !== toString(value)) { + node.value = toString(value); + } + } else if (type === 'submit' || type === 'reset') { + // Submit/reset inputs need the attribute removed completely to avoid + // blank-text buttons. + node.removeAttribute('value'); + return; + } + + { + // When syncing the value attribute, the value comes from a cascade of + // properties: + // 1. The value React property + // 2. The defaultValue React property + // 3. Otherwise there should be no change + if (props.hasOwnProperty('value')) { + setDefaultValue(node, props.type, value); + } else if (props.hasOwnProperty('defaultValue')) { + setDefaultValue(node, props.type, getToStringValue(props.defaultValue)); + } + } + + { + // When syncing the checked attribute, it only changes when it needs + // to be removed, such as transitioning from a checkbox into a text input + if (props.checked == null && props.defaultChecked != null) { + node.defaultChecked = !!props.defaultChecked; + } + } +} +function postMountWrapper(element, props, isHydrating) { + var node = element; // Do not assign value if it is already set. This prevents user text input + // from being lost during SSR hydration. + + if (props.hasOwnProperty('value') || props.hasOwnProperty('defaultValue')) { + var type = props.type; + var isButton = type === 'submit' || type === 'reset'; // Avoid setting value attribute on submit/reset inputs as it overrides the + // default value provided by the browser. See: #12872 + + if (isButton && (props.value === undefined || props.value === null)) { + return; + } + + var initialValue = toString(node._wrapperState.initialValue); // Do not assign value if it is already set. This prevents user text input + // from being lost during SSR hydration. + + if (!isHydrating) { + { + // When syncing the value attribute, the value property should use + // the wrapperState._initialValue property. This uses: + // + // 1. The value React property when present + // 2. The defaultValue React property when present + // 3. An empty string + if (initialValue !== node.value) { + node.value = initialValue; + } + } + } + + { + // Otherwise, the value attribute is synchronized to the property, + // so we assign defaultValue to the same thing as the value property + // assignment step above. + node.defaultValue = initialValue; + } + } // Normally, we'd just do `node.checked = node.checked` upon initial mount, less this bug + // this is needed to work around a chrome bug where setting defaultChecked + // will sometimes influence the value of checked (even after detachment). + // Reference: https://bugs.chromium.org/p/chromium/issues/detail?id=608416 + // We need to temporarily unset name to avoid disrupting radio button groups. + + + var name = node.name; + + if (name !== '') { + node.name = ''; + } + + { + // When syncing the checked attribute, both the checked property and + // attribute are assigned at the same time using defaultChecked. This uses: + // + // 1. The checked React property when present + // 2. The defaultChecked React property when present + // 3. Otherwise, false + node.defaultChecked = !node.defaultChecked; + node.defaultChecked = !!node._wrapperState.initialChecked; + } + + if (name !== '') { + node.name = name; + } +} +function restoreControlledState(element, props) { + var node = element; + updateWrapper(node, props); + updateNamedCousins(node, props); +} + +function updateNamedCousins(rootNode, props) { + var name = props.name; + + if (props.type === 'radio' && name != null) { + var queryRoot = rootNode; + + while (queryRoot.parentNode) { + queryRoot = queryRoot.parentNode; + } // If `rootNode.form` was non-null, then we could try `form.elements`, + // but that sometimes behaves strangely in IE8. We could also try using + // `form.getElementsByName`, but that will only return direct children + // and won't include inputs that use the HTML5 `form=` attribute. Since + // the input might not even be in a form. It might not even be in the + // document. Let's just use the local `querySelectorAll` to ensure we don't + // miss anything. + + + var group = queryRoot.querySelectorAll('input[name=' + JSON.stringify('' + name) + '][type="radio"]'); + + for (var i = 0; i < group.length; i++) { + var otherNode = group[i]; + + if (otherNode === rootNode || otherNode.form !== rootNode.form) { + continue; + } // This will throw if radio buttons rendered by different copies of React + // and the same name are rendered into the same form (same as #1939). + // That's probably okay; we don't support it just as we don't support + // mixing React radio buttons with non-React ones. + + + var otherProps = getFiberCurrentPropsFromNode$1(otherNode); + + if (!otherProps) { + { + throw Error( "ReactDOMInput: Mixing React and non-React radio inputs with the same `name` is not supported." ); + } + } // We need update the tracked value on the named cousin since the value + // was changed but the input saw no event or value set + + + updateValueIfChanged(otherNode); // If this is a controlled radio button group, forcing the input that + // was previously checked to update will cause it to be come re-checked + // as appropriate. + + updateWrapper(otherNode, otherProps); + } + } +} // In Chrome, assigning defaultValue to certain input types triggers input validation. +// For number inputs, the display value loses trailing decimal points. For email inputs, +// Chrome raises "The specified value is not a valid email address". +// +// Here we check to see if the defaultValue has actually changed, avoiding these problems +// when the user is inputting text +// +// https://github.com/facebook/react/issues/7253 + + +function setDefaultValue(node, type, value) { + if ( // Focused number inputs synchronize on blur. See ChangeEventPlugin.js + type !== 'number' || node.ownerDocument.activeElement !== node) { + if (value == null) { + node.defaultValue = toString(node._wrapperState.initialValue); + } else if (node.defaultValue !== toString(value)) { + node.defaultValue = toString(value); + } + } +} + +var didWarnSelectedSetOnOption = false; +var didWarnInvalidChild = false; + +function flattenChildren(children) { + var content = ''; // Flatten children. We'll warn if they are invalid + // during validateProps() which runs for hydration too. + // Note that this would throw on non-element objects. + // Elements are stringified (which is normally irrelevant + // but matters for ). + + React.Children.forEach(children, function (child) { + if (child == null) { + return; + } + + content += child; // Note: we don't warn about invalid children here. + // Instead, this is done separately below so that + // it happens during the hydration codepath too. + }); + return content; +} +/** + * Implements an