/** * Generated by Verge3D Puzzles v.3.9.1 * Thu Apr 27 2023 00:59:00 GMT-0400 (Eastern Daylight Time) * Prefer not editing this file as your changes may get overridden once Puzzles are saved. * Check out https://www.soft8soft.com/docs/manual/en/introduction/Using-JavaScript.html * for the information on how to add your own JavaScript to Verge3D apps. */ 'use strict'; (function() { // global variables/constants used by puzzles' functions var LIST_NONE = ''; var _pGlob = {}; _pGlob.objCache = {}; _pGlob.fadeAnnotations = true; _pGlob.pickedObject = ''; _pGlob.hoveredObject = ''; _pGlob.mediaElements = {}; _pGlob.loadedFile = ''; _pGlob.states = []; _pGlob.percentage = 0; _pGlob.openedFile = ''; _pGlob.xrSessionAcquired = false; _pGlob.xrSessionCallbacks = []; _pGlob.screenCoords = new v3d.Vector2(); _pGlob.intervalTimers = {}; _pGlob.AXIS_X = new v3d.Vector3(1, 0, 0); _pGlob.AXIS_Y = new v3d.Vector3(0, 1, 0); _pGlob.AXIS_Z = new v3d.Vector3(0, 0, 1); _pGlob.MIN_DRAG_SCALE = 10e-4; _pGlob.SET_OBJ_ROT_EPS = 1e-8; _pGlob.vec2Tmp = new v3d.Vector2(); _pGlob.vec2Tmp2 = new v3d.Vector2(); _pGlob.vec3Tmp = new v3d.Vector3(); _pGlob.vec3Tmp2 = new v3d.Vector3(); _pGlob.vec3Tmp3 = new v3d.Vector3(); _pGlob.vec3Tmp4 = new v3d.Vector3(); _pGlob.eulerTmp = new v3d.Euler(); _pGlob.eulerTmp2 = new v3d.Euler(); _pGlob.quatTmp = new v3d.Quaternion(); _pGlob.quatTmp2 = new v3d.Quaternion(); _pGlob.colorTmp = new v3d.Color(); _pGlob.mat4Tmp = new v3d.Matrix4(); _pGlob.planeTmp = new v3d.Plane(); _pGlob.raycasterTmp = new v3d.Raycaster(); var PL = v3d.PL = v3d.PL || {}; // a more readable alias for PL (stands for "Puzzle Logic") v3d.puzzles = PL; PL.procedures = PL.procedures || {}; PL.execInitPuzzles = function(options) { // always null, should not be available in "init" puzzles var appInstance = null; // app is more conventional than appInstance (used in exec script and app templates) var app = null; var _initGlob = {}; _initGlob.percentage = 0; _initGlob.output = { initOptions: { fadeAnnotations: true, useBkgTransp: false, preserveDrawBuf: false, useCompAssets: false, useFullscreen: true, useCustomPreloader: false, preloaderStartCb: function() {}, preloaderProgressCb: function() {}, preloaderEndCb: function() {}, } } // provide the container's id to puzzles that need access to the container _initGlob.container = options !== undefined && 'container' in options ? options.container : ""; var PROC = { }; // initSettings puzzle _initGlob.output.initOptions.fadeAnnotations = true; _initGlob.output.initOptions.useBkgTransp = false; _initGlob.output.initOptions.preserveDrawBuf = false; _initGlob.output.initOptions.useCompAssets = false; _initGlob.output.initOptions.useFullscreen = true; return _initGlob.output; } PL.init = function(appInstance, initOptions) { // app is more conventional than appInstance (used in exec script and app templates) var app = appInstance; initOptions = initOptions || {}; if ('fadeAnnotations' in initOptions) { _pGlob.fadeAnnotations = initOptions.fadeAnnotations; } this.procedures["show warning"] = show_warning; var PROC = { "show warning": show_warning, }; var AR_available, id; // featureAvailable puzzle function featureAvailable(feature) { var userAgent = window.navigator.userAgent; var platform = window.navigator.platform; switch (feature) { case 'LINUX': return /Linux/.test(platform); case 'WINDOWS': return ['Win32', 'Win64', 'Windows', 'WinCE'].indexOf(platform) !== -1; case 'MACOS': return (['Macintosh', 'MacIntel', 'MacPPC', 'Mac68K'].indexOf(platform) !== -1 && !v3d.Detector.checkIOS()); case 'IOS': return v3d.Detector.checkIOS(); case 'ANDROID': return /Android/i.test(userAgent); case 'MOBILE': return (/Android|webOS|BlackBerry/i.test(userAgent) || v3d.Detector.checkIOS()); case 'CHROME': // Chromium based return (!!window.chrome && !/Edge/.test(navigator.userAgent)); case 'FIREFOX': return /Firefox/.test(navigator.userAgent); case 'IE': return /Trident/.test(navigator.userAgent); case 'EDGE': return /Edge/.test(navigator.userAgent); case 'SAFARI': return (/Safari/.test(navigator.userAgent) && !/Chrome/.test(navigator.userAgent)); case 'TOUCH': return !!(('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch); case 'RETINA': return window.devicePixelRatio >= 2; case 'HDR': return appInstance.useHDR; case 'WEBAUDIO': return v3d.Detector.checkWebAudio(); case 'WEBGL2': var canvas = document.createElement('canvas'); var gl = canvas.getContext('webgl2') return !!gl; case 'WOOCOMMERCE': var woo_fun = window.parent.v3d_woo_get_product_info || window.parent.parent.v3d_woo_get_product_info; return !!woo_fun; case 'DO_NOT_TRACK': if (navigator.doNotTrack == '1' || window.doNotTrack == '1') return true; else return false; default: return false; } } // utility function envoked by almost all V3D-specific puzzles // filter off some non-mesh types function notIgnoredObj(obj) { return obj.type !== 'AmbientLight' && obj.name !== '' && !(obj.isMesh && obj.isMaterialGeneratedMesh) && !obj.isAuxClippingMesh; } // utility function envoked by almost all V3D-specific puzzles // find first occurence of the object by its name function getObjectByName(objName) { var objFound; var runTime = _pGlob !== undefined; objFound = runTime ? _pGlob.objCache[objName] : null; if (objFound && objFound.name === objName) return objFound; appInstance.scene.traverse(function(obj) { if (!objFound && notIgnoredObj(obj) && (obj.name == objName)) { objFound = obj; if (runTime) { _pGlob.objCache[objName] = objFound; } } }); return objFound; } // utility function envoked by almost all V3D-specific puzzles // retrieve all objects on the scene function getAllObjectNames() { var objNameList = []; appInstance.scene.traverse(function(obj) { if (notIgnoredObj(obj)) objNameList.push(obj.name) }); return objNameList; } // utility function envoked by almost all V3D-specific puzzles // retrieve all objects which belong to the group function getObjectNamesByGroupName(targetGroupName) { var objNameList = []; appInstance.scene.traverse(function(obj){ if (notIgnoredObj(obj)) { var groupNames = obj.groupNames; if (!groupNames) return; for (var i = 0; i < groupNames.length; i++) { var groupName = groupNames[i]; if (groupName == targetGroupName) { objNameList.push(obj.name); } } } }); return objNameList; } // utility function envoked by almost all V3D-specific puzzles // process object input, which can be either single obj or array of objects, or a group function retrieveObjectNames(objNames) { var acc = []; retrieveObjectNamesAcc(objNames, acc); return acc.filter(function(name) { return name; }); } function retrieveObjectNamesAcc(currObjNames, acc) { if (typeof currObjNames == "string") { acc.push(currObjNames); } else if (Array.isArray(currObjNames) && currObjNames[0] == "GROUP") { var newObj = getObjectNamesByGroupName(currObjNames[1]); for (var i = 0; i < newObj.length; i++) acc.push(newObj[i]); } else if (Array.isArray(currObjNames) && currObjNames[0] == "ALL_OBJECTS") { var newObj = getAllObjectNames(); for (var i = 0; i < newObj.length; i++) acc.push(newObj[i]); } else if (Array.isArray(currObjNames)) { for (var i = 0; i < currObjNames.length; i++) retrieveObjectNamesAcc(currObjNames[i], acc); } } var parseDataUriRe = /^data:(.+\/.+);base64,(.*)$/; /** * Check if object is a Data URI string */ function checkDataUri(obj) { // NOTE: checking with parseDataUriRe is slow return (typeof obj === 'string' && obj.indexOf('data:') == 0); } /** * Check if object is a URI to a Blob object */ function checkBlobUri(obj) { return (typeof obj === 'string' && obj.indexOf('blob:') == 0); } /** * First we use encodeURIComponent to get percent-encoded UTF-8, * then we convert the percent encodings into raw bytes which can be fed into btoa * https://bit.ly/3dvpq60 */ function base64EncodeUnicode(str) { return btoa(encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, function toSolidBytes(match, p1) { return String.fromCharCode('0x' + p1); })); } /** * Going backwards: from bytestream, to percent-encoding, to original string * https://bit.ly/3dvpq60 */ function base64DecodeUnicode(str) { return decodeURIComponent(atob(str).split('').map(function(c) { return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2); }).join('')); } /** * Convert object or string to application/json Data URI */ function toJSONDataUri(obj) { if (typeof obj !== 'string') obj = JSON.stringify(obj); return 'data:application/json;base64,' + base64EncodeUnicode(obj); } /** * Convert object or string to application/json Data URI */ function toTextDataUri(obj) { if (typeof obj !== 'string') obj = JSON.stringify(obj); return 'data:text/plain;base64,' + base64EncodeUnicode(obj); } /** * Extract text data from Data URI */ function extractDataUriData(str) { var matches = str.match(parseDataUriRe); return base64DecodeUnicode(matches[2]); } (function() { class USDZExporter { async parse(scene) { const files = {}; const modelFileName = 'model.usda'; // model file should be first in USDZ archive so we init it here files[modelFileName] = null; let output = buildHeader(); const materials = {}; const textures = {}; scene.traverseVisible(object => { if (object.isMesh && object.material.isMeshStandardMaterial) { const geometry = object.geometry; const material = object.material; const geometryFileName = 'geometries/Geometry_' + geometry.id + '.usd'; if (!(geometryFileName in files)) { const meshObject = buildMeshObject(geometry); files[geometryFileName] = buildUSDFileAsString(meshObject); } if (!(material.uuid in materials)) { materials[material.uuid] = material; } output += buildXform(object, geometry, material); } }); output += buildMaterials(materials, textures); files[modelFileName] = fflate.strToU8(output); output = null; for (const id in textures) { const texture = textures[id]; const color = id.split('_')[1]; files['textures/Texture_' + id + '.jpg'] = await imgToU8(texture.image, color); } // 64 byte alignment // https://github.com/101arrowz/fflate/issues/39#issuecomment-777263109 let offset = 0; for (const filename in files) { const file = files[filename]; const headerSize = 34 + filename.length; offset += headerSize; const offsetMod64 = offset & 63; if (offsetMod64 !== 4) { const padLength = 64 - offsetMod64; const padding = new Uint8Array(padLength); files[filename] = [file, { extra: { 12345: padding } }]; } offset = file.length; } return fflate.zipSync(files, { level: 0 }); } } async function imgToU8(image, color) { if (typeof HTMLImageElement !== 'undefined' && image instanceof HTMLImageElement || typeof HTMLCanvasElement !== 'undefined' && image instanceof HTMLCanvasElement || typeof OffscreenCanvas !== 'undefined' && image instanceof OffscreenCanvas || typeof ImageBitmap !== 'undefined' && image instanceof ImageBitmap) { const scale = 1024 / Math.max(image.width, image.height); const canvas = document.createElement('canvas'); canvas.width = image.width * Math.min(1, scale); canvas.height = image.height * Math.min(1, scale); const context = canvas.getContext('2d'); context.drawImage(image, 0, 0, canvas.width, canvas.height); if (color !== undefined) { context.globalCompositeOperation = 'multiply'; context.fillStyle = `#${color}`; context.fillRect(0, 0, canvas.width, canvas.height); } const blob = await new Promise(resolve => canvas.toBlob(resolve, 'image/jpeg', 1)); return new Uint8Array(await blob.arrayBuffer()); } } // const PRECISION = 7; function buildHeader() { return `#usda 1.0 ( customLayerData = { string creator = "Three.js USDZExporter" } metersPerUnit = 1 upAxis = "Y" ) `; } function buildUSDFileAsString(dataToInsert) { let output = buildHeader(); output += dataToInsert; return fflate.strToU8(output); } // Xform function buildXform(object, geometry, material) { const name = 'Object_' + object.id; const transform = buildMatrix(object.matrixWorld); return `def Xform "${name}" ( prepend references = @./geometries/Geometry_${geometry.id}.usd@ ) { matrix4d xformOp:transform = ${transform} uniform token[] xformOpOrder = ["xformOp:transform"] rel material:binding = } `; } function buildMatrix(matrix) { const array = matrix.elements; return `(${buildMatrixRow(array, 0)}, ${buildMatrixRow(array, 4)}, ${buildMatrixRow(array, 8)}, ${buildMatrixRow(array, 12)})`; } function buildMatrixRow(array, offset) { return `(${array[offset + 0]}, ${array[offset + 1]}, ${array[offset + 2]}, ${array[offset + 3]})`; } // Mesh function buildMeshObject(geometry) { const mesh = buildMesh(geometry); return ` def "Geometry" { ${mesh} } `; } function buildMesh(geometry) { const name = 'Geometry'; const attributes = geometry.attributes; const count = attributes.position.count; return ` def Mesh "${name}" { int[] faceVertexCounts = [${buildMeshVertexCount(geometry)}] int[] faceVertexIndices = [${buildMeshVertexIndices(geometry)}] normal3f[] normals = [${buildVector3Array(attributes.normal, count)}] ( interpolation = "vertex" ) point3f[] points = [${buildVector3Array(attributes.position, count)}] float2[] primvars:st = [${buildVector2Array(attributes.uv, count)}] ( interpolation = "vertex" ) uniform token subdivisionScheme = "none" } `; } function buildMeshVertexCount(geometry) { const count = geometry.index !== null ? geometry.index.array.length : geometry.attributes.position.count; return Array(count / 3).fill(3).join(', '); } function buildMeshVertexIndices(geometry) { if (geometry.index !== null) { return geometry.index.array.join(', '); } const array = []; const length = geometry.attributes.position.count; for (let i = 0; i < length; i++) { array.push(i); } return array.join(', '); } function buildVector3Array(attribute, count) { if (attribute === undefined) { console.warn('USDZExporter: Normals missing.'); return Array(count).fill('(0, 0, 0)').join(', '); } const array = []; const data = attribute.array; for (let i = 0; i < data.length; i += 3) { array.push(`(${data[i + 0].toPrecision(PRECISION)}, ${data[i + 1].toPrecision(PRECISION)}, ${data[i + 2].toPrecision(PRECISION)})`); } return array.join(', '); } function buildVector2Array(attribute, count) { if (attribute === undefined) { console.warn('USDZExporter: UVs missing.'); return Array(count).fill('(0, 0)').join(', '); } const array = []; const data = attribute.array; for (let i = 0; i < data.length; i += 2) { array.push(`(${data[i + 0].toPrecision(PRECISION)}, ${1 - data[i + 1].toPrecision(PRECISION)})`); } return array.join(', '); } // Materials function buildMaterials(materials, textures) { const array = []; for (const uuid in materials) { const material = materials[uuid]; array.push(buildMaterial(material, textures)); } return `def "Materials" { ${array.join('')} } `; } function buildMaterial(material, textures) { // https://graphics.pixar.com/usd/docs/UsdPreviewSurface-Proposal.html const pad = ' '; const inputs = []; const samplers = []; function buildTexture(texture, mapType, color) { const id = texture.id + (color ? '_' + color.getHexString() : ''); textures[id] = texture; return ` def Shader "Transform2d_${mapType}" ( sdrMetadata = { string role = "math" } ) { uniform token info:id = "UsdTransform2d" float2 inputs:in.connect = float2 inputs:scale = ${buildVector2(texture.repeat)} float2 inputs:translation = ${buildVector2(texture.offset)} float2 outputs:result } def Shader "Texture_${texture.id}_${mapType}" { uniform token info:id = "UsdUVTexture" asset inputs:file = @textures/Texture_${id}.jpg@ float2 inputs:st.connect = token inputs:wrapS = "repeat" token inputs:wrapT = "repeat" float outputs:r float outputs:g float outputs:b float3 outputs:rgb }`; } if (material.map !== null) { inputs.push(`${pad}color3f inputs:diffuseColor.connect = `); samplers.push(buildTexture(material.map, 'diffuse', material.color)); } else { inputs.push(`${pad}color3f inputs:diffuseColor = ${buildColor(material.color)}`); } if (material.emissiveMap !== null) { inputs.push(`${pad}color3f inputs:emissiveColor.connect = `); samplers.push(buildTexture(material.emissiveMap, 'emissive')); } else if (material.emissive.getHex() > 0) { inputs.push(`${pad}color3f inputs:emissiveColor = ${buildColor(material.emissive)}`); } if (material.normalMap !== null) { inputs.push(`${pad}normal3f inputs:normal.connect = `); samplers.push(buildTexture(material.normalMap, 'normal')); } if (material.aoMap !== null) { inputs.push(`${pad}float inputs:occlusion.connect = `); samplers.push(buildTexture(material.aoMap, 'occlusion')); } if (material.roughnessMap !== null) { inputs.push(`${pad}float inputs:roughness.connect = `); samplers.push(buildTexture(material.roughnessMap, 'roughness')); } else { inputs.push(`${pad}float inputs:roughness = ${material.roughness}`); } if (material.metalnessMap !== null) { inputs.push(`${pad}float inputs:metallic.connect = `); samplers.push(buildTexture(material.metalnessMap, 'metallic')); } else { inputs.push(`${pad}float inputs:metallic = ${material.metalness}`); } inputs.push(`${pad}float inputs:opacity = ${material.opacity}`); if (material.isMeshPhysicalMaterial) { inputs.push(`${pad}float inputs:clearcoat = ${material.clearcoat}`); inputs.push(`${pad}float inputs:clearcoatRoughness = ${material.clearcoatRoughness}`); inputs.push(`${pad}float inputs:ior = ${material.ior}`); } return ` def Material "Material_${material.id}" { def Shader "PreviewSurface" { uniform token info:id = "UsdPreviewSurface" ${inputs.join('\n')} int inputs:useSpecularWorkflow = 0 token outputs:surface } token outputs:surface.connect = token inputs:frame:stPrimvarName = "st" def Shader "uvReader_st" { uniform token info:id = "UsdPrimvarReader_float2" token inputs:varname.connect = float2 inputs:fallback = (0.0, 0.0) float2 outputs:result } ${samplers.join('\n')} } `; } function buildColor(color) { return `(${color.r}, ${color.g}, ${color.b})`; } function buildVector2(vector) { return `(${vector.x}, ${vector.y})`; } v3d.USDZExporter = USDZExporter; })(); /*! fflate - fast JavaScript compression/decompression Licensed under MIT. https://github.com/101arrowz/fflate/blob/master/LICENSE version 0.6.9 */ !function(f){typeof module!='undefined'&&typeof exports=='object'?module.exports=f():typeof define!='undefined'&&define.amd?define(['fflate',f]):(typeof self!='undefined'?self:this).fflate=f()}(function(){var _e={};"use strict";var t=(typeof module!='undefined'&&typeof exports=='object'?function(_f){"use strict";var e,t=";var __w=require('worker_threads');__w.parentPort.on('message',function(m){onmessage({data:m})}),postMessage=function(m,t){__w.parentPort.postMessage(m,t)},close=process.exit;self=global";try{e=require("worker_threads").Worker}catch(e){}exports.default=e?function(r,n,o,a,s){var u=!1,i=new e(r+t,{eval:!0}).on("error",(function(e){return s(e,null)})).on("message",(function(e){return s(null,e)})).on("exit",(function(e){e&&!u&&s(Error("exited with code "+e),null)}));return i.postMessage(o,a),i.terminate=function(){return u=!0,e.prototype.terminate.call(i)},i}:function(e,t,r,n,o){setImmediate((function(){return o(Error("async operations unsupported - update to Node 12+ (or Node 10-11 with the --experimental-worker CLI flag)"),null)}));var a=function(){};return{terminate:a,postMessage:a}};return _f}:function(_f){"use strict";var e={},r=function(e){return URL.createObjectURL(new Blob([e],{type:"text/javascript"}))},t=function(e){return new Worker(e)};try{URL.revokeObjectURL(r(""))}catch(e){r=function(e){return"data:application/javascript;charset=UTF-8,"+encodeURI(e)},t=function(e){return new Worker(e,{type:"module"})}}_f.default=function(n,o,u,a,c){var i=t(e[o]||(e[o]=r(n)));return i.onerror=function(e){return c(e.error,null)},i.onmessage=function(e){return c(null,e.data)},i.postMessage(u,a),i};return _f})({}),n=Uint8Array,r=Uint16Array,e=Uint32Array,i=new n([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),o=new n([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),a=new n([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),s=function(t,n){for(var i=new r(31),o=0;o<31;++o)i[o]=n+=1<>>1|(21845&d)<<1;v[d]=((65280&(g=(61680&(g=(52428&g)>>>2|(13107&g)<<2))>>>4|(3855&g)<<4))>>>8|(255&g)<<8)>>>1}var w=function(t,n,e){for(var i=t.length,o=0,a=new r(n);o>>u]=h}else for(s=new r(i),o=0;o>>15-t[o]);return s},y=new n(288);for(d=0;d<144;++d)y[d]=8;for(d=144;d<256;++d)y[d]=9;for(d=256;d<280;++d)y[d]=7;for(d=280;d<288;++d)y[d]=8;var m=new n(32);for(d=0;d<32;++d)m[d]=5;var b=w(y,9,0),x=w(y,9,1),z=w(m,5,0),k=w(m,5,1),M=function(t){for(var n=t[0],r=1;rn&&(n=t[r]);return n},A=function(t,n,r){var e=n/8|0;return(t[e]|t[e+1]<<8)>>(7&n)&r},S=function(t,n){var r=n/8|0;return(t[r]|t[r+1]<<8|t[r+2]<<16)>>(7&n)},D=function(t){return(t/8|0)+(7&t&&1)},C=function(t,i,o){(null==i||i<0)&&(i=0),(null==o||o>t.length)&&(o=t.length);var a=new(t instanceof r?r:t instanceof e?e:n)(o-i);return a.set(t.subarray(i,o)),a},U=function(t,r,e){var s=t.length;if(!s||e&&!e.l&&s<5)return r||new n(0);var f=!r||e,h=!e||e.i;e||(e={}),r||(r=new n(3*s));var c=function(t){var e=r.length;if(t>e){var i=new n(Math.max(2*e,t));i.set(r),r=i}},p=e.f||0,v=e.p||0,d=e.b||0,g=e.l,y=e.d,m=e.m,b=e.n,z=8*s;do{if(!g){e.f=p=A(t,v,1);var U=A(t,v+1,3);if(v+=3,!U){var O=t[(Y=D(v)+4)-4]|t[Y-3]<<8,T=Y+O;if(T>s){if(h)throw"unexpected EOF";break}f&&c(d+O),r.set(t.subarray(Y,T),d),e.b=d+=O,e.p=v=8*T;continue}if(1==U)g=x,y=k,m=9,b=5;else{if(2!=U)throw"invalid block type";var Z=A(t,v,31)+257,I=A(t,v+10,15)+4,F=Z+A(t,v+5,31)+1;v+=14;for(var E=new n(F),G=new n(19),P=0;P>>4)<16)E[P++]=Y;else{var J=0,K=0;for(16==Y?(K=3+A(t,v,3),v+=2,J=E[P-1]):17==Y?(K=3+A(t,v,7),v+=3):18==Y&&(K=11+A(t,v,127),v+=7);K--;)E[P++]=J}}var L=E.subarray(0,Z),N=E.subarray(Z);m=M(L),b=M(N),g=w(L,m,1),y=w(N,b,1)}if(v>z){if(h)throw"unexpected EOF";break}}f&&c(d+131072);for(var Q=(1<>>4;if((v+=15&J)>z){if(h)throw"unexpected EOF";break}if(!J)throw"invalid length/literal";if(W<256)r[d++]=W;else{if(256==W){V=v,g=null;break}var X=W-254;W>264&&(X=A(t,v,(1<<(tt=i[P=W-257]))-1)+u[P],v+=tt);var $=y[S(t,v)&R],_=$>>>4;if(!$)throw"invalid distance";if(v+=15&$,N=l[_],_>3){var tt=o[_];N+=S(t,v)&(1<z){if(h)throw"unexpected EOF";break}f&&c(d+131072);for(var nt=d+X;d>>8},T=function(t,n,r){var e=n/8|0;t[e]|=r<<=7&n,t[e+1]|=r>>>8,t[e+2]|=r>>>16},Z=function(t,e){for(var i=[],o=0;ov&&(v=s[o].s);var d=new r(v+1),g=I(i[l-1],d,0);if(g>e){o=0;var w=0,y=g-e,m=1<e))break;w+=m-(1<>>=y;w>0;){var x=s[o].s;d[x]=0&&w;--o){var z=s[o].s;d[z]==e&&(--d[z],++w)}g=e}return[new n(d),g]},I=function(t,n,r){return-1==t.s?Math.max(I(t.l,n,r+1),I(t.r,n,r+1)):n[t.s]=r},F=function(t){for(var n=t.length;n&&!t[--n];);for(var e=new r(++n),i=0,o=t[0],a=1,s=function(t){e[i++]=t},f=1;f<=n;++f)if(t[f]==o&&f!=n)++a;else{if(!o&&a>2){for(;a>138;a-=138)s(32754);a>2&&(s(a>10?a-11<<5|28690:a-3<<5|12305),a=0)}else if(a>3){for(s(o),--a;a>6;a-=6)s(8304);a>2&&(s(a-3<<5|8208),a=0)}for(;a--;)s(o);a=1,o=t[f]}return[e.subarray(0,i),n]},E=function(t,n){for(var r=0,e=0;e>>8,t[i+2]=255^t[i],t[i+3]=255^t[i+1];for(var o=0;o4&&!Y[a[J-1]];--J);var K,L,N,Q,R=p+5<<3,V=E(f,y)+E(u,m)+h,W=E(f,g)+E(u,M)+h+14+3*J+E(j,Y)+(2*j[16]+3*j[17]+7*j[18]);if(R<=V&&R<=W)return G(n,v,t.subarray(l,l+p));if(O(n,v,1+(W15&&(O(n,v,tt[q]>>>5&127),v+=tt[q]>>>12)}}else K=b,L=y,N=z,Q=m;for(q=0;q255){var nt;T(n,v,K[257+(nt=s[q]>>>18&31)]),v+=L[nt+257],nt>7&&(O(n,v,s[q]>>>23&31),v+=i[nt]);var rt=31&s[q];T(n,v,N[rt]),v+=Q[rt],rt>3&&(T(n,v,s[q]>>>5&8191),v+=o[rt])}else T(n,v,K[s[q]]),v+=L[s[q]];return T(n,v,K[256]),v+L[256]},j=new e([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),q=new n(0),H=function(t,a,s,f,u,c){var l=t.length,v=new n(f+l+5*(1+Math.ceil(l/7e3))+u),d=v.subarray(f,v.length-u),g=0;if(!a||l<8)for(var w=0;w<=l;w+=65535){var y=w+65535;y>>13,x=8191&m,z=(1<7e3||E>24576)&&L>423){g=P(t,d,0,O,T,Z,F,E,Y,w-Y,g),E=I=F=0,Y=w;for(var N=0;N<286;++N)T[N]=0;for(N=0;N<30;++N)Z[N]=0}var Q=2,R=0,V=x,W=J-K&32767;if(L>2&&B==U(w-W))for(var X=Math.min(b,L)-1,$=Math.min(32767,w),_=Math.min(258,L);W<=$&&--V&&J!=K;){if(t[w+Q]==t[w+Q-W]){for(var tt=0;tt<_&&t[w+tt]==t[w+tt-W];++tt);if(tt>Q){if(Q=tt,R=W,tt>X)break;var nt=Math.min(W,tt-2),rt=0;for(N=0;Nrt&&(rt=it,K=et)}}}W+=(J=K)-(K=k[J])+32768&32767}if(R){O[E++]=268435456|h[Q]<<18|p[R];var ot=31&h[Q],at=31&p[R];F+=i[ot]+o[at],++T[257+ot],++Z[at],H=w+Q,++I}else O[E++]=t[w],++T[t[w]]}}g=P(t,d,c,O,T,Z,F,E,Y,w-Y,g),!c&&7&g&&(g=G(d,g+1,q))}return C(v,0,f+D(g)+u)},Y=function(){for(var t=new e(256),n=0;n<256;++n){for(var r=n,i=9;--i;)r=(1&r&&3988292384)^r>>>1;t[n]=r}return t}(),B=function(){var t=-1;return{p:function(n){for(var r=t,e=0;e>>8;t=r},d:function(){return~t}}},J=function(){var t=1,n=0;return{p:function(r){for(var e=t,i=n,o=r.length,a=0;a!=o;){for(var s=Math.min(a+2655,o);a>16),i=(65535&i)+15*(i>>16)}t=e,n=i},d:function(){return(255&(t%=65521))<<24|t>>>8<<16|(255&(n%=65521))<<8|n>>>8}}},K=function(t,n,r,e,i){return H(t,null==n.level?6:n.level,null==n.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(t.length)))):12+n.mem,r,e,!i)},L=function(t,n){var r={};for(var e in t)r[e]=t[e];for(var e in n)r[e]=n[e];return r},N=function(t,n,r){for(var e=t(),i=""+t,o=i.slice(i.indexOf("[")+1,i.lastIndexOf("]")).replace(/ /g,"").split(","),a=0;a>>0},ut=function(t,n){return ft(t,n)+4294967296*ft(t,n+4)},ht=function(t,n,r){for(;r;++n)t[n]=r,r>>>=8},ct=function(t,n){var r=n.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=n.level<2?4:9==n.level?2:0,t[9]=3,0!=n.mtime&&ht(t,4,Math.floor(new Date(n.mtime||Date.now())/1e3)),r){t[3]=8;for(var e=0;e<=r.length;++e)t[e+10]=r.charCodeAt(e)}},lt=function(t){if(31!=t[0]||139!=t[1]||8!=t[2])throw"invalid gzip data";var n=t[3],r=10;4&n&&(r+=t[10]|2+(t[11]<<8));for(var e=(n>>3&1)+(n>>4&1);e>0;e-=!t[r++]);return r+(2&n)},pt=function(t){var n=t.length;return(t[n-4]|t[n-3]<<8|t[n-2]<<16|t[n-1]<<24)>>>0},vt=function(t){return 10+(t.filename&&t.filename.length+1||0)},dt=function(t,n){var r=n.level,e=0==r?0:r<6?1:9==r?3:2;t[0]=120,t[1]=e<<6|(e?32-2*e:1)},gt=function(t){if(8!=(15&t[0])||t[0]>>>4>7||(t[0]<<8|t[1])%31)throw"invalid zlib data";if(32&t[1])throw"invalid zlib data: preset dictionaries not supported"};function wt(t,n){return n||"function"!=typeof t||(n=t,t={}),this.ondata=n,t}var yt=function(){function t(t,n){n||"function"!=typeof t||(n=t,t={}),this.ondata=n,this.o=t||{}}return t.prototype.p=function(t,n){this.ondata(K(t,this.o,0,0,!n),n)},t.prototype.push=function(t,n){if(this.d)throw"stream finished";if(!this.ondata)throw"no stream handler";this.d=n,this.p(t,n||!1)},t}();_e.Deflate=yt;var mt=function(){return function(t,n){at([X,function(){return[ot,yt]}],this,wt.call(this,t,n),(function(t){var n=new yt(t.data);onmessage=ot(n)}),6)}}();function bt(t,n,r){if(r||(r=n,n={}),"function"!=typeof r)throw"no callback";return it(t,n,[X],(function(t){return rt(xt(t.data[0],t.data[1]))}),0,r)}function xt(t,n){return K(t,n||{},0,0)}_e.AsyncDeflate=mt,_e.deflate=bt,_e.deflateSync=xt;var zt=function(){function t(t){this.s={},this.p=new n(0),this.ondata=t}return t.prototype.e=function(t){if(this.d)throw"stream finished";if(!this.ondata)throw"no stream handler";var r=this.p.length,e=new n(r+t.length);e.set(this.p),e.set(t,r),this.p=e},t.prototype.c=function(t){this.d=this.s.i=t||!1;var n=this.s.b,r=U(this.p,this.o,this.s);this.ondata(C(r,n,this.s.b),this.d),this.o=C(r,this.s.b-32768),this.s.b=this.o.length,this.p=C(this.p,this.s.p/8|0),this.s.p&=7},t.prototype.push=function(t,n){this.e(t),this.c(n)},t}();_e.Inflate=zt;var kt=function(){return function(t){this.ondata=t,at([W,function(){return[ot,zt]}],this,0,(function(){var t=new zt;onmessage=ot(t)}),7)}}();function Mt(t,n,r){if(r||(r=n,n={}),"function"!=typeof r)throw"no callback";return it(t,n,[W],(function(t){return rt(At(t.data[0],et(t.data[1])))}),1,r)}function At(t,n){return U(t,n)}_e.AsyncInflate=kt,_e.inflate=Mt,_e.inflateSync=At;var St=function(){function t(t,n){this.c=B(),this.l=0,this.v=1,yt.call(this,t,n)}return t.prototype.push=function(t,n){yt.prototype.push.call(this,t,n)},t.prototype.p=function(t,n){this.c.p(t),this.l+=t.length;var r=K(t,this.o,this.v&&vt(this.o),n&&8,!n);this.v&&(ct(r,this.o),this.v=0),n&&(ht(r,r.length-8,this.c.d()),ht(r,r.length-4,this.l)),this.ondata(r,n)},t}();_e.Gzip=St,_e.Compress=St;var Dt=function(){return function(t,n){at([X,$,function(){return[ot,yt,St]}],this,wt.call(this,t,n),(function(t){var n=new St(t.data);onmessage=ot(n)}),8)}}();function Ct(t,n,r){if(r||(r=n,n={}),"function"!=typeof r)throw"no callback";return it(t,n,[X,$,function(){return[Ut]}],(function(t){return rt(Ut(t.data[0],t.data[1]))}),2,r)}function Ut(t,n){n||(n={});var r=B(),e=t.length;r.p(t);var i=K(t,n,vt(n),8),o=i.length;return ct(i,n),ht(i,o-8,r.d()),ht(i,o-4,e),i}_e.AsyncGzip=Dt,_e.AsyncCompress=Dt,_e.gzip=Ct,_e.compress=Ct,_e.gzipSync=Ut,_e.compressSync=Ut;var Ot=function(){function t(t){this.v=1,zt.call(this,t)}return t.prototype.push=function(t,n){if(zt.prototype.e.call(this,t),this.v){var r=this.p.length>3?lt(this.p):4;if(r>=this.p.length&&!n)return;this.p=this.p.subarray(r),this.v=0}if(n){if(this.p.length<8)throw"invalid gzip stream";this.p=this.p.subarray(0,-8)}zt.prototype.c.call(this,n)},t}();_e.Gunzip=Ot;var Tt=function(){return function(t){this.ondata=t,at([W,_,function(){return[ot,zt,Ot]}],this,0,(function(){var t=new Ot;onmessage=ot(t)}),9)}}();function Zt(t,n,r){if(r||(r=n,n={}),"function"!=typeof r)throw"no callback";return it(t,n,[W,_,function(){return[It]}],(function(t){return rt(It(t.data[0]))}),3,r)}function It(t,r){return U(t.subarray(lt(t),-8),r||new n(pt(t)))}_e.AsyncGunzip=Tt,_e.gunzip=Zt,_e.gunzipSync=It;var Ft=function(){function t(t,n){this.c=J(),this.v=1,yt.call(this,t,n)}return t.prototype.push=function(t,n){yt.prototype.push.call(this,t,n)},t.prototype.p=function(t,n){this.c.p(t);var r=K(t,this.o,this.v&&2,n&&4,!n);this.v&&(dt(r,this.o),this.v=0),n&&ht(r,r.length-4,this.c.d()),this.ondata(r,n)},t}();_e.Zlib=Ft;var Et=function(){return function(t,n){at([X,tt,function(){return[ot,yt,Ft]}],this,wt.call(this,t,n),(function(t){var n=new Ft(t.data);onmessage=ot(n)}),10)}}();function Gt(t,n,r){if(r||(r=n,n={}),"function"!=typeof r)throw"no callback";return it(t,n,[X,tt,function(){return[Pt]}],(function(t){return rt(Pt(t.data[0],t.data[1]))}),4,r)}function Pt(t,n){n||(n={});var r=J();r.p(t);var e=K(t,n,2,4);return dt(e,n),ht(e,e.length-4,r.d()),e}_e.AsyncZlib=Et,_e.zlib=Gt,_e.zlibSync=Pt;var jt=function(){function t(t){this.v=1,zt.call(this,t)}return t.prototype.push=function(t,n){if(zt.prototype.e.call(this,t),this.v){if(this.p.length<2&&!n)return;this.p=this.p.subarray(2),this.v=0}if(n){if(this.p.length<4)throw"invalid zlib stream";this.p=this.p.subarray(0,-4)}zt.prototype.c.call(this,n)},t}();_e.Unzlib=jt;var qt=function(){return function(t){this.ondata=t,at([W,nt,function(){return[ot,zt,jt]}],this,0,(function(){var t=new jt;onmessage=ot(t)}),11)}}();function Ht(t,n,r){if(r||(r=n,n={}),"function"!=typeof r)throw"no callback";return it(t,n,[W,nt,function(){return[Yt]}],(function(t){return rt(Yt(t.data[0],et(t.data[1])))}),5,r)}function Yt(t,n){return U((gt(t),t.subarray(2,-4)),n)}_e.AsyncUnzlib=qt,_e.unzlib=Ht,_e.unzlibSync=Yt;var Bt=function(){function t(t){this.G=Ot,this.I=zt,this.Z=jt,this.ondata=t}return t.prototype.push=function(t,r){if(!this.ondata)throw"no stream handler";if(this.s)this.s.push(t,r);else{if(this.p&&this.p.length){var e=new n(this.p.length+t.length);e.set(this.p),e.set(t,this.p.length)}else this.p=t;if(this.p.length>2){var i=this,o=function(){i.ondata.apply(i,arguments)};this.s=31==this.p[0]&&139==this.p[1]&&8==this.p[2]?new this.G(o):8!=(15&this.p[0])||this.p[0]>>4>7||(this.p[0]<<8|this.p[1])%31?new this.I(o):new this.Z(o),this.s.push(this.p,r),this.p=null}}},t}();_e.Decompress=Bt;var Jt=function(){function t(t){this.G=Tt,this.I=kt,this.Z=qt,this.ondata=t}return t.prototype.push=function(t,n){Bt.prototype.push.call(this,t,n)},t}();function Kt(t,n,r){if(r||(r=n,n={}),"function"!=typeof r)throw"no callback";return 31==t[0]&&139==t[1]&&8==t[2]?Zt(t,n,r):8!=(15&t[0])||t[0]>>4>7||(t[0]<<8|t[1])%31?Mt(t,n,r):Ht(t,n,r)}function Lt(t,n){return 31==t[0]&&139==t[1]&&8==t[2]?It(t,n):8!=(15&t[0])||t[0]>>4>7||(t[0]<<8|t[1])%31?At(t,n):Yt(t,n)}_e.AsyncDecompress=Jt,_e.decompress=Kt,_e.decompressSync=Lt;var Nt=function(t,r,e,i){for(var o in t){var a=t[o],s=r+o;a instanceof n?e[s]=[a,i]:Array.isArray(a)?e[s]=[a[0],L(i,a[1])]:Nt(a,s+"/",e,i)}},Qt="undefined"!=typeof TextEncoder&&new TextEncoder,Rt="undefined"!=typeof TextDecoder&&new TextDecoder,Vt=0;try{Rt.decode(q,{stream:!0}),Vt=1}catch(t){}var Wt=function(t){for(var n="",r=0;;){var e=t[r++],i=(e>127)+(e>223)+(e>239);if(r+i>t.length)return[n,C(t,r-1)];i?3==i?(e=((15&e)<<18|(63&t[r++])<<12|(63&t[r++])<<6|63&t[r++])-65536,n+=String.fromCharCode(55296|e>>10,56320|1023&e)):n+=String.fromCharCode(1&i?(31&e)<<6|63&t[r++]:(15&e)<<12|(63&t[r++])<<6|63&t[r++]):n+=String.fromCharCode(e)}},Xt=function(){function t(t){this.ondata=t,Vt?this.t=new TextDecoder:this.p=q}return t.prototype.push=function(t,r){if(!this.ondata)throw"no callback";if(r=!!r,this.t){if(this.ondata(this.t.decode(t,{stream:!0}),r),r){if(this.t.decode().length)throw"invalid utf-8 data";this.t=null}}else{if(!this.p)throw"stream finished";var e=new n(this.p.length+t.length);e.set(this.p),e.set(t,this.p.length);var i=Wt(e),o=i[0],a=i[1];if(r){if(a.length)throw"invalid utf-8 data";this.p=null}else this.p=a;this.ondata(o,r)}},t}();_e.DecodeUTF8=Xt;var $t=function(){function t(t){this.ondata=t}return t.prototype.push=function(t,n){if(!this.ondata)throw"no callback";if(this.d)throw"stream finished";this.ondata(_t(t),this.d=n||!1)},t}();function _t(t,r){if(r){for(var e=new n(t.length),i=0;i>1)),s=0,f=function(t){a[s++]=t};for(i=0;ia.length){var u=new n(s+8+(o-i<<1));u.set(a),a=u}var h=t.charCodeAt(i);h<128||r?f(h):h<2048?(f(192|h>>6),f(128|63&h)):h>55295&&h<57344?(f(240|(h=65536+(1047552&h)|1023&t.charCodeAt(++i))>>18),f(128|h>>12&63),f(128|h>>6&63),f(128|63&h)):(f(224|h>>12),f(128|h>>6&63),f(128|63&h))}return C(a,0,s)}function tn(t,n){if(n){for(var r="",e=0;e65535)throw"extra field too long";n+=e+4}return n},sn=function(t,n,r,e,i,o,a,s){var f=e.length,u=r.extra,h=s&&s.length,c=an(u);ht(t,n,null!=a?33639248:67324752),n+=4,null!=a&&(t[n++]=20,t[n++]=r.os),t[n]=20,n+=2,t[n++]=r.flag<<1|(null==o&&8),t[n++]=i&&8,t[n++]=255&r.compression,t[n++]=r.compression>>8;var l=new Date(null==r.mtime?Date.now():r.mtime),p=l.getFullYear()-1980;if(p<0||p>119)throw"date not in range 1980-2099";if(ht(t,n,p<<25|l.getMonth()+1<<21|l.getDate()<<16|l.getHours()<<11|l.getMinutes()<<5|l.getSeconds()>>>1),n+=4,null!=o&&(ht(t,n,r.crc),ht(t,n+4,o),ht(t,n+8,r.size)),ht(t,n+12,f),ht(t,n+14,c),n+=16,null!=a&&(ht(t,n,h),ht(t,n+6,r.attrs),ht(t,n+10,a),n+=14),t.set(e,n),n+=f,c)for(var v in u){var d=u[v],g=d.length;ht(t,n,+v),ht(t,n+2,g),t.set(d,n+4),n+=4+g}return h&&(t.set(s,n),n+=h),n},fn=function(t,n,r,e,i){ht(t,n,101010256),ht(t,n+8,r),ht(t,n+10,r),ht(t,n+12,e),ht(t,n+16,i)},un=function(){function t(t){this.filename=t,this.c=B(),this.size=0,this.compression=0}return t.prototype.process=function(t,n){this.ondata(null,t,n)},t.prototype.push=function(t,n){if(!this.ondata)throw"no callback - add to ZIP archive before pushing";this.c.p(t),this.size+=t.length,n&&(this.crc=this.c.d()),this.process(t,n||!1)},t}();_e.ZipPassThrough=un;var hn=function(){function t(t,n){var r=this;n||(n={}),un.call(this,t),this.d=new yt(n,(function(t,n){r.ondata(null,t,n)})),this.compression=8,this.flag=nn(n.level)}return t.prototype.process=function(t,n){try{this.d.push(t,n)}catch(t){this.ondata(t,null,n)}},t.prototype.push=function(t,n){un.prototype.push.call(this,t,n)},t}();_e.ZipDeflate=hn;var cn=function(){function t(t,n){var r=this;n||(n={}),un.call(this,t),this.d=new mt(n,(function(t,n,e){r.ondata(t,n,e)})),this.compression=8,this.flag=nn(n.level),this.terminate=this.d.terminate}return t.prototype.process=function(t,n){this.d.push(t,n)},t.prototype.push=function(t,n){un.prototype.push.call(this,t,n)},t}();_e.AsyncZipDeflate=cn;var ln=function(){function t(t){this.ondata=t,this.u=[],this.d=1}return t.prototype.add=function(t){var r=this;if(2&this.d)throw"stream finished";var e=_t(t.filename),i=e.length,o=t.comment,a=o&&_t(o),s=i!=t.filename.length||a&&o.length!=a.length,f=i+an(t.extra)+30;if(i>65535)throw"filename too long";var u=new n(f);sn(u,0,t,e,s);var h=[u],c=function(){for(var t=0,n=h;t65535&&M("filename too long",null),k)if(g<16e4)try{M(null,xt(u,v))}catch(t){M(t,null)}else c.push(bt(u,v,M));else M(null,u)},d=0;d65535)throw"filename too long";var w=c?xt(u,h):u,y=w.length,m=B();m.p(u),i.push(L(h,{size:u.length,crc:m.d(),c:w,f:M,m:v,u:l!=s.length||v&&p.length!=d,o:o,compression:c})),o+=30+l+g+y,a+=76+2*(l+g)+(d||0)+y}for(var b=new n(a+22),x=o,z=a-o,k=0;k0){var i=Math.min(this.c,t.length),o=t.subarray(0,i);if(this.c-=i,this.d?this.d.push(o,!this.c):this.k[0].push(o),(t=t.subarray(i)).length)return this.push(t,r)}else{var a=0,s=0,f=void 0,u=void 0;this.p.length?t.length?((u=new n(this.p.length+t.length)).set(this.p),u.set(t,this.p.length)):u=this.p:u=t;for(var h=u.length,c=this.c,l=c&&this.d,p=function(){var t,n=ft(u,s);if(67324752==n){a=1,f=s,v.d=null,v.c=0;var r=st(u,s+6),i=st(u,s+8),o=2048&r,l=8&r,p=st(u,s+26),d=st(u,s+28);if(h>s+30+p+d){var g=[];v.k.unshift(g),a=2;var w,y=ft(u,s+18),m=ft(u,s+22),b=tn(u.subarray(s+30,s+=30+p),!o);4294967295==y?(t=l?[-2]:on(u,s),y=t[0],m=t[1]):l&&(y=-1),s+=d,v.c=y;var x={name:b,compression:i,start:function(){if(!x.ondata)throw"no callback";if(y){var t=e.o[i];if(!t)throw"unknown compression type "+i;(w=y<0?new t(b):new t(b,y,m)).ondata=function(t,n,r){x.ondata(t,n,r)};for(var n=0,r=g;n=0&&(x.size=y,x.originalSize=m),v.onfile(x)}return"break"}if(c){if(134695760==n)return f=s+=12+(-2==c&&8),a=3,v.c=0,"break";if(33639248==n)return f=s-=4,a=3,v.c=0,"break"}},v=this;s65558)return void r("invalid zip file",null);var s=st(t,a+8);s||r(null,{});var f=s,u=ft(t,a+16),h=4294967295==u;if(h){if(a=ft(t,a-12),101075792!=ft(t,a))return void r("invalid zip file",null);f=s=ft(t,a+32),u=ft(t,a+48)}for(var c=function(a){var f=en(t,u,h),c=f[0],l=f[1],p=f[2],v=f[3],d=f[4],g=rn(t,f[5]);u=d;var w=function(t,n){t?(i(),r(t,null)):(o[v]=n,--s||r(null,o))};if(c)if(8==c){var y=t.subarray(g,g+l);if(l<32e4)try{w(null,At(y,new n(p)))}catch(t){w(t,null)}else e.push(Mt(y,{size:p},w))}else w("unknown compression type "+c,null);else w(null,C(t,g,g+l))},l=0;l65558)throw"invalid zip file";var i=st(t,e+8);if(!i)return{};var o=ft(t,e+16),a=4294967295==o;if(a){if(e=ft(t,e-12),101075792!=ft(t,e))throw"invalid zip file";i=ft(t,e+32),o=ft(t,e+48)}for(var s=0;s= 0 ? action.timeStart : action.getClip().duration; action.paused = false; action.play(); // push unique callbacks only var callbacks = _pGlob.animMixerCallbacks; var found = false; for (var j = 0; j < callbacks.length; j++) if (callbacks[j][0] == action && callbacks[j][1] == callback) found = true; if (!found) _pGlob.animMixerCallbacks.push([action, callback]); } break; case 'STOP': action.stop(); // remove callbacks var callbacks = _pGlob.animMixerCallbacks; for (var j = 0; j < callbacks.length; j++) if (callbacks[j][0] == action) { callbacks.splice(j, 1); j-- } break; case 'PAUSE': action.paused = true; break; case 'RESUME': action.paused = false; break; case 'SET_FRAME': var scene = getSceneByAction(action); var frameRate = getSceneAnimFrameRate(scene); action.time = from ? from/frameRate : 0; action.play(); action.paused = true; break; } } for (var i = 0; i < animations.length; i++) { var animName = animations[i]; if (animName) processAnimation(animName); } initAnimationMixer(); } // Copyright (c) 2010-2019 Tween.js authors. // Easing equations Copyright (c) 2001 Robert Penner http://robertpenner.com/easing/ // Code copied from https://cdnjs.cloudflare.com/ajax/libs/tween.js/17.3.0/Tween.min.js var _Group=function(){this._tweens={},this._tweensAddedDuringUpdate={}};_Group.prototype={getAll:function(){return Object.keys(this._tweens).map(function(t){return this._tweens[t]}.bind(this))},removeAll:function(){this._tweens={}},add:function(t){this._tweens[t.getId()]=t,this._tweensAddedDuringUpdate[t.getId()]=t},remove:function(t){delete this._tweens[t.getId()],delete this._tweensAddedDuringUpdate[t.getId()]},update:function(t,n){var e=Object.keys(this._tweens); if(0===e.length)return!1;for(t=void 0!==t?t:TWEEN.now();0 0) { pickListener(event); prevTapTime = 0; return; } prevTapTime = new Date().getTime(); } var touchEventName = mouseDownUseTouchStart ? 'touchstart' : 'touchend'; elem.addEventListener(touchEventName, doubleTapCallback); if (v3d.PL.editorEventListeners) v3d.PL.editorEventListeners.push([elem, touchEventName, doubleTapCallback]); } var raycaster = new v3d.Raycaster(); function pickListener(event) { // to handle unload in loadScene puzzle if (!appInstance.getCamera()) return; event.preventDefault(); var xNorm = 0, yNorm = 0; if (event instanceof MouseEvent) { if (mouseButtons && mouseButtons.indexOf(event.button) == -1) return; xNorm = event.offsetX / elem.clientWidth; yNorm = event.offsetY / elem.clientHeight; } else if (event instanceof TouchEvent) { var rect = elem.getBoundingClientRect(); xNorm = (event.changedTouches[0].clientX - rect.left) / rect.width; yNorm = (event.changedTouches[0].clientY - rect.top) / rect.height; } _pGlob.screenCoords.x = xNorm * 2 - 1; _pGlob.screenCoords.y = -yNorm * 2 + 1; raycaster.setFromCamera(_pGlob.screenCoords, appInstance.getCamera(true)); var objList = []; appInstance.scene.traverse(function(obj){objList.push(obj);}); var intersects = raycaster.intersectObjects(objList); callback(intersects, event); } } function objectsIncludeObj(objNames, testedObjName) { if (!testedObjName) return false; for (var i = 0; i < objNames.length; i++) { if (testedObjName == objNames[i]) { return true; } else { // also check children which are auto-generated for multi-material objects var obj = getObjectByName(objNames[i]); if (obj && obj.type == "Group") { for (var j = 0; j < obj.children.length; j++) { if (testedObjName == obj.children[j].name) { return true; } } } } } return false; } // utility function used by the whenClicked, whenHovered, whenDraggedOver, and raycast puzzles function getPickedObjectName(obj) { // auto-generated from a multi-material object, use parent name instead if (obj.isMesh && obj.isMaterialGeneratedMesh && obj.parent) { return obj.parent.name; } else { return obj.name; } } // whenClicked puzzle function registerOnClick(objSelector, xRay, doubleClick, mouseButtons, cbDo, cbIfMissedDo) { // for AR/VR _pGlob.objClickInfo = _pGlob.objClickInfo || []; _pGlob.objClickInfo.push({ objSelector: objSelector, callbacks: [cbDo, cbIfMissedDo] }); initObjectPicking(function(intersects, event) { var isPicked = false; var maxIntersects = xRay ? intersects.length : Math.min(1, intersects.length); for (var i = 0; i < maxIntersects; i++) { var obj = intersects[i].object; var objName = getPickedObjectName(obj); var objNames = retrieveObjectNames(objSelector); if (objectsIncludeObj(objNames, objName)) { // save the object for the pickedObject block _pGlob.pickedObject = objName; isPicked = true; cbDo(event); } } if (!isPicked) { _pGlob.pickedObject = ''; cbIfMissedDo(event); } }, doubleClick ? 'dblclick' : 'mousedown', false, mouseButtons); } // checkARMode puzzle function checkARMode(availableCb, unAvailableCb) { // COMPAT: < 2.13.1 if (v3d.Detector.checkWebXR) v3d.Detector.checkWebXR('immersive-ar', availableCb, unAvailableCb); else appInstance.checkWebXR('immersive-ar', availableCb, unAvailableCb); } /** * Retrieve coordinate system from the loaded scene */ function getCoordSystem() { var scene = appInstance.scene; if (scene && "v3d" in scene.userData && "coordSystem" in scene.userData.v3d) { return scene.userData.v3d.coordSystem; } else { // COMPAT: <2.17, consider replacing to 'Y_UP_RIGHT' for scenes with unknown origin return 'Z_UP_RIGHT'; } } /** * Transform coordinates from one space to another * Can be used with Vector3 or Euler. */ function coordsTransform(coords, from, to, noSignChange) { if (from == to) return coords; var y = coords.y, z = coords.z; if (from == 'Z_UP_RIGHT' && to == 'Y_UP_RIGHT') { coords.y = z; coords.z = noSignChange ? y : -y; } else if (from == 'Y_UP_RIGHT' && to == 'Z_UP_RIGHT') { coords.y = noSignChange ? z : -z; coords.z = y; } else { console.error('coordsTransform: Unsupported coordinate space'); } return coords; } /** * Verge3D euler rotation to Blender/Max shortest. * 1) Convert from intrinsic rotation (v3d) to extrinsic XYZ (Blender/Max default * order) via reversion: XYZ -> ZYX * 2) swizzle ZYX->YZX * 3) choose the shortest rotation to resemble Blender's behavior */ var eulerV3DToBlenderShortest = function() { var eulerTmp = new v3d.Euler(); var eulerTmp2 = new v3d.Euler(); var vec3Tmp = new v3d.Vector3(); return function(euler, dest) { var eulerBlender = eulerTmp.copy(euler).reorder('YZX'); var eulerBlenderAlt = eulerTmp2.copy(eulerBlender).makeAlternative(); var len = eulerBlender.toVector3(vec3Tmp).lengthSq(); var lenAlt = eulerBlenderAlt.toVector3(vec3Tmp).lengthSq(); dest.copy(len < lenAlt ? eulerBlender : eulerBlenderAlt); return coordsTransform(dest, 'Y_UP_RIGHT', 'Z_UP_RIGHT'); } }(); // arHitPoint puzzle function arHitPoint(coord) { if (!_pGlob.arHitPoint) { if (coord == 'xyz') return [0, 0, 0]; else return 0; } var hitPoint = coordsTransform(_pGlob.vec3Tmp.copy(_pGlob.arHitPoint), 'Y_UP_RIGHT', getCoordSystem()); if (coord == 'xyz') return hitPoint.toArray(); else return hitPoint[coord]; } function RotationInterface() { /** * For user manipulations use XYZ extrinsic rotations (which * are the same as ZYX intrinsic rotations) * - Blender/Max/Maya use extrinsic rotations in the UI * - XYZ is the default option, but could be set from * some order hint if exported */ this._userRotation = new v3d.Euler(0, 0, 0, 'ZYX'); this._actualRotation = new v3d.Euler(); } Object.assign(RotationInterface, { initObject: function(obj) { if (obj.userData.v3d.puzzles === undefined) { obj.userData.v3d.puzzles = {} } if (obj.userData.v3d.puzzles.rotationInterface === undefined) { obj.userData.v3d.puzzles.rotationInterface = new RotationInterface(); } var rotUI = obj.userData.v3d.puzzles.rotationInterface; rotUI.updateFromObject(obj); return rotUI; } }); Object.assign(RotationInterface.prototype, { updateFromObject: function(obj) { var SYNC_ROT_EPS = 1e-8; if (!this._actualRotation.equalsEps(obj.rotation, SYNC_ROT_EPS)) { this._actualRotation.copy(obj.rotation); this._updateUserRotFromActualRot(); } }, getActualRotation: function(euler) { return euler.copy(this._actualRotation); }, setUserRotation: function(euler) { // don't copy the order, since it's fixed to ZYX for now this._userRotation.set(euler.x, euler.y, euler.z); this._updateActualRotFromUserRot(); }, getUserRotation: function(euler) { return euler.copy(this._userRotation); }, _updateUserRotFromActualRot: function() { var order = this._userRotation.order; this._userRotation.copy(this._actualRotation).reorder(order); }, _updateActualRotFromUserRot: function() { var order = this._actualRotation.order; this._actualRotation.copy(this._userRotation).reorder(order); } }); // setObjTransform puzzle function setObjTransform(objSelector, isWorldSpace, mode, vector, offset){ var x = vector[0]; var y = vector[1]; var z = vector[2]; var objNames = retrieveObjectNames(objSelector); function setObjProp(obj, prop, val) { if (!offset) { obj[mode][prop] = val; } else { if (mode != "scale") obj[mode][prop] += val; else obj[mode][prop] *= val; } } var inputsUsed = _pGlob.vec3Tmp.set(Number(x !== ''), Number(y !== ''), Number(z !== '')); var coords = _pGlob.vec3Tmp2.set(x || 0, y || 0, z || 0); if (mode === 'rotation') { // rotations are specified in degrees coords.multiplyScalar(v3d.MathUtils.DEG2RAD); } var coordSystem = getCoordSystem(); coordsTransform(inputsUsed, coordSystem, 'Y_UP_RIGHT', true); coordsTransform(coords, coordSystem, 'Y_UP_RIGHT', mode === 'scale'); for (var i = 0; i < objNames.length; i++) { var objName = objNames[i]; if (!objName) continue; var obj = getObjectByName(objName); if (!obj) continue; if (isWorldSpace && obj.parent) { obj.matrixWorld.decomposeE(obj.position, obj.rotation, obj.scale); if (inputsUsed.x) setObjProp(obj, "x", coords.x); if (inputsUsed.y) setObjProp(obj, "y", coords.y); if (inputsUsed.z) setObjProp(obj, "z", coords.z); obj.matrixWorld.composeE(obj.position, obj.rotation, obj.scale); obj.matrix.multiplyMatrices(_pGlob.mat4Tmp.copy(obj.parent.matrixWorld).invert(), obj.matrixWorld); obj.matrix.decompose(obj.position, obj.quaternion, obj.scale); } else if (mode === 'rotation' && coordSystem == 'Z_UP_RIGHT') { // Blender/Max coordinates // need all the rotations for order conversions, especially if some // inputs are not specified var euler = eulerV3DToBlenderShortest(obj.rotation, _pGlob.eulerTmp); coordsTransform(euler, coordSystem, 'Y_UP_RIGHT'); if (inputsUsed.x) euler.x = offset ? euler.x + coords.x : coords.x; if (inputsUsed.y) euler.y = offset ? euler.y + coords.y : coords.y; if (inputsUsed.z) euler.z = offset ? euler.z + coords.z : coords.z; /** * convert from Blender/Max default XYZ extrinsic order to v3d XYZ * intrinsic with reversion (XYZ -> ZYX) and axes swizzling (ZYX -> YZX) */ euler.order = "YZX"; euler.reorder(obj.rotation.order); obj.rotation.copy(euler); } else if (mode === 'rotation' && coordSystem == 'Y_UP_RIGHT') { // Maya coordinates // Use separate rotation interface to fix ambiguous rotations for Maya, // might as well do the same for Blender/Max. var rotUI = RotationInterface.initObject(obj); var euler = rotUI.getUserRotation(_pGlob.eulerTmp); // TODO(ivan): this probably needs some reasonable wrapping if (inputsUsed.x) euler.x = offset ? euler.x + coords.x : coords.x; if (inputsUsed.y) euler.y = offset ? euler.y + coords.y : coords.y; if (inputsUsed.z) euler.z = offset ? euler.z + coords.z : coords.z; rotUI.setUserRotation(euler); rotUI.getActualRotation(obj.rotation); } else { if (inputsUsed.x) setObjProp(obj, "x", coords.x); if (inputsUsed.y) setObjProp(obj, "y", coords.y); if (inputsUsed.z) setObjProp(obj, "z", coords.z); } obj.updateMatrixWorld(true); } } // arHitTest puzzle _pGlob.arHitPoint = new v3d.Vector3(0, 0, 0); function arHitTest(cbHit, cbMiss, smooth) { appInstance.renderer.xr.arHitTest(0, 0, function(point) { smooth = v3d.MathUtils.clamp(smooth, 0, 1); var x = point.x; var y = point.y; var z = point.z; _pGlob.arHitPoint.x = _pGlob.arHitPoint.x * smooth + (1 - smooth) * x; _pGlob.arHitPoint.y = _pGlob.arHitPoint.y * smooth + (1 - smooth) * y; _pGlob.arHitPoint.z = _pGlob.arHitPoint.z * smooth + (1 - smooth) * z; cbHit(); }, cbMiss); } // setHTMLElemStyle puzzle function setHTMLElemStyle(prop, value, ids, isParent) { var elems = getElements(ids, isParent); for (var i = 0; i < elems.length; i++) { var elem = elems[i]; if (!elem || !elem.style) continue; elem.style[prop] = value; } } // getUrlData puzzle function getUrlData(kind, isParent) { var targetWindow = isParent ? window.parent : window; switch (kind) { case 'URL': return targetWindow.location.href; case 'PARAMS': return v3d.AppUtils.getPageParams(targetWindow); case 'HOSTNAME': return targetWindow.location.hostname; default: console.error('getUrlData: option does not exists.'); return ''; } } // openWebPage puzzle function openWebPage(url, mode) { if (appInstance && appInstance.controls) { appInstance.controls.forceMouseUp(); } if (mode == "NEW") { window.open(url); } else if (mode == "NO_RELOAD") { history.pushState('verge3d state', 'verge3d page', url); } else { var target; switch (mode) { case "SAME": target = "_self"; break; case "TOP": target = "_top"; break; case "PARENT": target = "_parent"; break; } if (typeof window.PE != "undefined") { if (window.confirm("Are you sure you want to leave Puzzles?")) window.open(url, target); } else { window.open(url, target); } } } function _pGetInputSource(controller) { if (controller && controller.userData.v3d && controller.userData.v3d.inputSource) { return controller.userData.v3d.inputSource } else { return null; } }; function _pTraverseNonControllers(obj, callback) { if (obj.name.startsWith('XR_CONTROLLER_')) return; callback(obj); var children = obj.children; for (var i = 0, l = children.length; i < l; i++) { _pTraverseNonControllers(children[i], callback); } }; function _pXRGetIntersections(controller) { controller.updateMatrixWorld(true); _pGlob.mat4Tmp.identity().extractRotation(controller.matrixWorld); var objList = []; _pTraverseNonControllers(appInstance.scene, function(obj) { objList.push(obj); }); var raycaster = new v3d.Raycaster(); raycaster.ray.origin.setFromMatrixPosition(controller.matrixWorld); raycaster.ray.direction.set(0, 0, -1).applyMatrix4(_pGlob.mat4Tmp); return raycaster.intersectObjects(objList); } function _pXROnSelect(event) { if (!_pGlob.objClickInfo) return; var controller = event.target; var intersections = _pXRGetIntersections(controller); if (intersections.length > 0) { var intersection = intersections[0]; var obj = intersection.object; // save the object for the pickedObject block _pGlob.pickedObject = getPickedObjectName(obj); _pGlob.objClickInfo.forEach(function(el) { var isPicked = obj && objectsIncludeObj(retrieveObjectNames(el.objSelector), getPickedObjectName(obj)); el.callbacks[isPicked ? 0 : 1](); }); } else { _pGlob.objClickInfo.forEach(function(el) { // missed el.callbacks[1](); }); } } // enterARMode puzzle function enterARMode(refSpace, allowHTML, enterCb, exitCb, unAvailableCb) { switch (refSpace) { case 'SITTING': var referenceSpace = 'local-floor'; break; case 'WALKING': var referenceSpace = 'unbounded'; break; case 'ORIGIN': var referenceSpace = 'local'; break; case 'ROOM': var referenceSpace = 'bounded-floor'; break; case 'VIEWER': var referenceSpace = 'viewer'; break; default: console.error('puzzles: Wrong VR reference space'); return; } appInstance.initWebXR('immersive-ar', referenceSpace, function() { var controllers = appInstance.xrControllers; for (var i = 0; i < controllers.length; i++) { var controller = controllers[i]; controller.addEventListener('select', _pXROnSelect); if (v3d.PL.editorEventListeners) v3d.PL.editorEventListeners.push([controller, 'select', _pXROnSelect]); _pGlob.xrSessionCallbacks.forEach(function(pair) { controller.addEventListener(pair[0], pair[1]); if (v3d.PL.editorEventListeners) v3d.PL.editorEventListeners.push([controller, pair[0], pair[1]]); }); } _pGlob.xrSessionAcquired = true; enterCb(); }, unAvailableCb, function() { var controllers = appInstance.xrControllers; for (var i = 0; i < controllers.length; i++) { var controller = controllers[i]; controller.removeEventListener('select', _pXROnSelect); _pGlob.xrSessionCallbacks.forEach(function(pair) { controller.removeEventListener(pair[0], pair[1]); }); } _pGlob.xrSessionAcquired = false; exitCb(); }, { domOverlay: allowHTML }); } // eventHTMLElem puzzle function eventHTMLElem(eventType, ids, isParent, callback) { var elems = getElements(ids, isParent); for (var i = 0; i < elems.length; i++) { var elem = elems[i]; if (!elem) continue; elem.addEventListener(eventType, callback); if (v3d.PL.editorEventListeners) v3d.PL.editorEventListeners.push([elem, eventType, callback]); } } // getObjTransform puzzle function getObjTransform(objName, isWorldSpace, mode, coord) { if (!objName) return; var obj = getObjectByName(objName); if (!obj) return; var coordSystem = getCoordSystem(); var transformVal; if (isWorldSpace && obj.parent) { if (mode === 'position') { transformVal = coordsTransform(obj.getWorldPosition(_pGlob.vec3Tmp), 'Y_UP_RIGHT', coordSystem, mode === 'scale'); } else if (mode === 'rotation') { transformVal = coordsTransform(obj.getWorldEuler(_pGlob.eulerTmp, 'XYZ'), 'Y_UP_RIGHT', coordSystem, mode === 'scale'); } else if (mode === 'scale') { transformVal = coordsTransform(obj.getWorldScale(_pGlob.vec3Tmp), 'Y_UP_RIGHT', coordSystem, mode === 'scale'); } } else if (mode === 'rotation' && coordSystem == 'Z_UP_RIGHT') { transformVal = eulerV3DToBlenderShortest(obj.rotation, _pGlob.eulerTmp); } else if (mode === 'rotation' && coordSystem == 'Y_UP_RIGHT') { // Maya coordinates // Use separate rotation interface to fix ambiguous rotations for Maya, // might as well do the same for Blender/Max. var rotUI = RotationInterface.initObject(obj); transformVal = rotUI.getUserRotation(_pGlob.eulerTmp); } else { transformVal = coordsTransform(obj[mode].clone(), 'Y_UP_RIGHT', coordSystem, mode === 'scale'); } if (mode === 'rotation') { transformVal.x = v3d.MathUtils.radToDeg(transformVal.x); transformVal.y = v3d.MathUtils.radToDeg(transformVal.y); transformVal.z = v3d.MathUtils.radToDeg(transformVal.z); } if (coord == 'xyz') { // remove order component for Euler vectors return transformVal.toArray().slice(0, 3); } else { return transformVal[coord]; } } // setObjDirection puzzle function setObjDirection(objSelector, vector, isPoint, lockUp) { var objNames = retrieveObjectNames(objSelector); var x = vector[0] || 0; var y = vector[1] || 0; var z = vector[2] || 0; var coords = coordsTransform(_pGlob.vec3Tmp.set(x, y, z), getCoordSystem(), 'Y_UP_RIGHT'); for (var i = 0; i < objNames.length; i++) { var objName = objNames[i]; if (!objName) continue; var obj = getObjectByName(objName); if (!obj) continue; if (!isPoint) { coords.normalize().add(obj.position); } if (lockUp) { // NOTE: partially copy-pasted from LockedTrackConstraint var targetWorldPos = new v3d.Vector3(coords.x, coords.y, coords.z); var lockDir = new v3d.Vector3(0, 1, 0); if (obj.isCamera || obj.isLight) var trackDir = new v3d.Vector3(0, 0, -1); else var trackDir = new v3d.Vector3(0, 0, 1); var projDir = new v3d.Vector3(); var plane = _pGlob.planeTmp; var objWorldPos = new v3d.Vector3(); objWorldPos.setFromMatrixPosition(obj.matrixWorld); plane.setFromNormalAndCoplanarPoint(lockDir, objWorldPos); plane.projectPoint(targetWorldPos, projDir).sub(objWorldPos); var sign = _pGlob.vec3Tmp2.crossVectors(trackDir, projDir).dot(lockDir) > 0 ? 1 : -1; obj.setRotationFromAxisAngle(plane.normal, sign * trackDir.angleTo(projDir)); if (obj.parent) { obj.parent.matrixWorld.decompose(_pGlob.vec3Tmp2, _pGlob.quatTmp, _pGlob.vec3Tmp2); obj.quaternion.premultiply(_pGlob.quatTmp.invert()); } } else { obj.lookAt(coords.x, coords.y, coords.z); } obj.updateMatrixWorld(true); } } // setTimeout puzzle function registerSetTimeout(timeout, callback) { window.setTimeout(callback, 1000 * timeout); } // Describe this function... function show_warning() { setHTMLElemStyle('display', 'block', 'warning_message_div', false); setHTMLElemStyle('display', 'block', id, false); registerSetTimeout(3, function() { setHTMLElemStyle('display', 'none', 'warning_message_div', false); setHTMLElemStyle('display', 'none', id, false); }); } if (featureAvailable('IOS')) { setHTMLElemAttribute('href', exportToUSDZ('furrymart8'), 'enter_AR_button', false); setHTMLElemAttribute('rel', 'ar', 'enter_AR_button', false); setHTMLElemAttribute('download', 'STICKER.usdz', 'enter_AR_button', false); } changeVis(['GROUP', 'Furry'], true); changeVis(['GROUP', 'indicator_group'], false); operateAnimation('PLAY', 'furrymart8', null, null, 'AUTO', 1, function() {}, undefined, false); animateParam(1, 100, 0, 'Linear', 'InOut', 0, false, function() {}, function() {}); registerOnClick('furrymart8', false, false, [0,1,2], function() { operateAnimation('STOP', 'furrymart8', null, null, 'AUTO', 1, function() {}, undefined, false); operateAnimation('PLAY', 'furrymart8', null, null, 'LoopRepeat', 1, function() {}, undefined, false); animateParam(1, 100, 0, 'Linear', 'InOut', 0, false, function() {}, function() {}); }, function() {}); registerOnClick('enter_AR_button', false, false, [0,1,2], function() { checkARMode(function() { AR_available = true; }, function() { AR_available = false; }); }, function() {}); eventHTMLElem('pointerup', 'enter_AR_button', false, function(event) { if (AR_available) { enterARMode('ORIGIN', true, function() { changeVis(['GROUP', 'Furry'], false); changeVis('prompt_move_around', true); arHitTest(function() { changeVis(['GROUP', 'indicator_group'], true); changeVis('prompt_move_around', false); setObjTransform('indicator_invis_plane', false, 'position', [arHitPoint('x'), arHitPoint('y'), arHitPoint('z')], false); }, function() { changeVis(['GROUP', 'indicator_group'], false); }, 0.7); setHTMLElemStyle('display', 'none', 'enter_AR_button', false); }, function() { openWebPage(getUrlData('URL', false), 'SAME'); }, function() { if (!featureAvailable('IOS')) { show_warning(); } }); } else { if (!featureAvailable('IOS')) { show_warning(); } } }); registerOnClick('indicator_invis_plane', false, false, [0,1,2], function() { changeVis(['GROUP', 'Furry'], true); setObjTransform('furrymart8', false, 'position', [arHitPoint('x'), arHitPoint('y'), arHitPoint('z')], false); setObjDirection('furrymart8', [getObjTransform('Camera.001', false, 'position', 'x'), getObjTransform('Camera.001', false, 'position', 'y'), getObjTransform('Camera.001', false, 'position', 'z')], true, true); }, function() {}); } // end of PL.init function })(); // end of closure /* ================================ end of code ============================= */