paper.js/dist/paper-core.min.js

32 lines
203 KiB
JavaScript
Raw Normal View History

/*!
* Paper.js v0.12.11-develop - The Swiss Army Knife of Vector Graphics Scripting.
* http://paperjs.org/
*
* Copyright (c) 2011 - 2020, Jürg Lehni & Jonathan Puckey
* http://juerglehni.com/ & https://puckey.studio/
*
* Distributed under the MIT license. See LICENSE file for details.
*
* All rights reserved.
*
* Date: Fri Mar 12 23:11:10 2021 +0100
*
***
*
* Straps.js - Class inheritance library with support for bean-style accessors
*
* Copyright (c) 2006 - 2020 Jürg Lehni
* http://juerglehni.com/
*
* Distributed under the MIT license.
*
***
*
* Acorn.js
* https://marijnhaverbeke.nl/acorn/
*
* Acorn is a tiny, fast JavaScript parser written in JavaScript,
* created by Marijn Haverbeke and released under an MIT license.
*
*/
var paper=function(u,F){var T=(u=u||require("./node/self.js")).window,f=u.document,D=new function(){function n(t,e,n){var i;return t&&((i=d(t,"length"))&&"number"==typeof i.value?s:function(t,e){for(var n in this)this.hasOwnProperty(n)&&t.call(e,this[n],n,this)}).call(t,e,n=n||t),n}var r=/^(statics|enumerable|beans|preserve)$/,t=[],i=t.slice,a=Object.create,d=Object.getOwnPropertyDescriptor,f=Object.defineProperty,s=t.forEach||function(t,e){for(var n=0,i=this.length;n<i;n++)t.call(e,this[n],n,this)},o=Object.assign||function(t){for(var e=1,n=arguments.length;e<n;e++){var i,r=arguments[e];for(i in r)r.hasOwnProperty(i)&&(t[i]=r[i])}return t};function h(a,o,h,u,l){var c={};function t(t,e){var n,i="function"==typeof(e="string"==typeof(e=e||(e=d(o,t))&&(e.get?e:e.value))&&"#"===e[0]?a[e.substring(1)]||e:e),r=e,s=l||i&&!e.base?e&&e.get?t in a:a[t]:null;l&&s||(i&&s&&(e.base=s),i&&!1!==u&&(n=t.match(/^([gs]et|is)(([A-Z])(.*))$/))&&(c[n[3].toLowerCase()+n[4]]=n[2]),r&&!i&&r.get&&"function"==typeof r.get&&_.isPlainObject(r)||(r={value:r,writable:!0}),(d(a,t)||{configurable:!0}).configurable&&(r.configurable=!0,r.enumerable=null!=h?h:!n),f(a,t,r))}if(o){for(var e in o)o.hasOwnProperty(e)&&!r.test(e)&&t(e);for(var e in c){var n=c[e],i=a["set"+n],n=a["get"+n]||i&&a["is"+n];!n||!0!==u&&0!==n.length||t(e,{get:n,set:i})}}return a}function _(){for(var t=0,e=arguments.length;t<e;t++){var n=arguments[t];n&&o(this,n)}return this}return h(_,{inject:function(t){var e,n,i;t&&(e=!0===t.statics?t:t.statics,n=t.beans,i=t.preserve,e!==t&&h(this.prototype,t,t.enumerable,n,i),h(this,e,null,n,i));for(var r=1,s=arguments.length;r<s;r++)this.inject(arguments[r]);return this},extend:function(){for(var t,e,n,i=this,r=0,s=arguments.length;r<s&&(!t||!e);r++)n=arguments[r],t=t||n.initialize,e=e||n.prototype;return e=(t=t||function(){i.apply(this,arguments)}).prototype=e||a(this.prototype),f(e,"constructor",{value:t,writable:!0,configurable:!0}),h(t,this),arguments.length&&this.inject.apply(t,arguments),t.base=i,t}}).inject({enumerable:!1,initialize:_,set:_,inject:function(){for(var t=0,e=arguments.length;t<e;t++){var n=arguments[t];n&&h(this,n,n.enumerable,n.beans,n.preserve)}return this},extend:function(){var t=a(this);return t.inject.apply(t,arguments)},each:function(t,e){return n(this,t,e)},clone:function(){return new this.constructor(this)},statics:{set:o,each:n,create:a,define:f,describe:d,clone:function(t){return o(new t.constructor,t)},isPlainObject:function(t){t=null!=t&&t.constructor;return t&&(t===Object||t===_||"Object"===t.name)},pick:function(t,e){return t!==F?t:e},slice:function(t,e,n){return i.call(t,e,n)}}})};"undefined"!=typeof module&&(module.exports=D),D.inject({enumerable:!1,toString:function(){return null!=this._id?(this._class||"Object")+(this._name?" '"+this._name+"'":" @"+this._id):"{ "+D.each(this,function(t,e){/^_/.test(e)||this.push(e+": "+("number"==(e=typeof t)?x.instance.number(t):"string"==e?"'"+t+"'":t))},[]).join(", ")+" }"},getClassName:function(){return this._class||""},importJSON:function(t){return D.importJSON(t,this)},exportJSON:function(t){return D.exportJSON(this,t)},toJSON:function(){return D.serialize(this)},set:function(t,e){return t&&D.filter(this,t,e,this._prioritize),this}},{beans:!1,statics:{exports:{},extend:function t(){var e=t.base.apply(this,arguments),n=e.prototype._class;return n&&!D.exports[n]&&(D.exports[n]=e),e},equals:function(t,e){if(t===e)return!0;if(t&&t.equals)return t.equals(e);if(e&&e.equals)return e.equals(t);if(t&&e&&"object"==typeof t&&"object"==typeof e){if(Array.isArray(t)&&Array.isArray(e)){if((n=t.length)!==e.length)return!1;for(;n--;)if(!D.equals(t[n],e[n]))return!1}else{var n,i=Object.keys(t);if((n=i.length)!==Object.keys(e).length)return!1;for(;n--;){var r=i[n];if(!e.hasOwnProperty(r)||!D.equals(t[r],e[r]))return!1}}return!0}return!1},read:function(t,e,n,i){if(this===D){var r=this.peek(t,e);return t.__index++,r}var s=this.prototype,a=s._readIndex,o=e||a&&t.__index||0,r=t.length,e=t[o];return i=i||r-o,e instanceof this||n&&n.readNull&&null==e&&i<=1?(a&&(t.__index=o+1),e&&n&&n.clone?e.